Changeset 282

Show
Ignore:
Timestamp:
10/26/06 22:58:00 (2 years ago)
Author:
bart
Message:

Make the control panel work with E_ALL

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • eaccelerator/trunk/control.php

    r281 r282  
    3333 
    3434// Inline media 
    35 if ($_GET['img']) { 
     35if (isset($_GET['img']) && $_GET['img']) { 
    3636    $img = strtolower($_GET['img']); 
    3737    $imgs['dnarr'][0] = 199; 
     
    6161}  
    6262 
    63 $sec = (int)$_GET['sec']
     63$sec = isset($_GET['sec']) ? (int)$_GET['sec'] : 0
    6464 
    6565// No-cache headers 
     
    172172// Returns standard column headers for the lists 
    173173function colheadstr ($nme, $id) { 
    174     $cursrt = $_GET['ordby']
    175     $srtdir = $_GET['dir']
     174    $cursrt = isset($_GET['ordby']) ? $_GET['ordby'] : 0
     175    $srtdir = isset($_GET['dir']) ? $_GET['dir'] : ""
    176176    return '<a href="'.$_SERVER['PHP_SELF'].'?'.qstring_update(array('ordby' => $id, 'dir' => ($cursrt == $id)?1-$srtdir:0)).'">'.$nme.'&nbsp;'.(($cursrt == $id)?'<img src="'.$_SERVER['PHP_SELF'].'?img='.(($srtdir)?'dnarr':'uparr').'" width="13" height="16" border="0" alt="'.(($srtdir)?'v':'^').'"/>':''); 
    177177} 
     
    180180function arrsort ($a, $b) { 
    181181    global $ordby, $ordbystr; 
    182     if ($ordbystr) $val = strnatcmp($a[$ordby], $b[$ordby]); 
    183     else $val = ($a[$ordby]==$b[$ordby])?0:(($a[$ordby]<$b[$ordby])?-1:1); 
    184     if ($_GET['dir']) $val = -1*$val; 
     182    if ($ordbystr)  
     183        $val = strnatcmp($a[$ordby], $b[$ordby]); 
     184    else  
     185        $val = ($a[$ordby] == $b[$ordby]) ? 0 : (($a[$ordby] < $b[$ordby]) ? -1: 1); 
     186    if (isset($_GET['dir']) && $_GET['dir']) 
     187        $val = -1*$val; 
    185188    return $val; 
    186189} 
     
    403406        // search 
    404407        function scriptsearch ($val) { 
    405             return preg_match('/'.preg_quote($_GET['str'], '/').'/i', $val['file']); 
     408            $str = isset($_GET['str']) ? $_GET['str'] : ''; 
     409            return preg_match('/'.preg_quote($str, '/').'/i', $val['file']); 
    406410        } 
    407411        $scripts = array_filter($scripts, 'scriptsearch'); 
    408412     
    409413        // sort 
    410         switch ($_GET['ordby']) { 
     414        $ordby = isset($_GET['ordby']) ? intval($_GET['ordby']) : 0; 
     415        switch ($ordby) { 
    411416            default: 
    412417            case 0: $ordby = 'file'; $ordbystr = true; break; 
     
    421426        $numtot = count($scripts); 
    422427 
    423         $pg = (int)$_GET['pg']; // zero-starting 
     428        $pg = (isset($_GET['pg']) ? (int)$_GET['pg'] : 0); // zero-starting 
    424429        $pgs = ceil($numtot/$npp); 
    425430 
    426         if ($pg+1 > $pgs) $pg = $pgs-1; 
    427         if ($pg < 0) $pg = 0; 
     431        if ($pg + 1 > $pgs) 
     432            $pg = $pgs-1; 
     433        if ($pg < 0) 
     434            $pg = 0; 
    428435 
    429436        $scripts = array_slice($scripts, $pg*$npp, $npp); 
     
    463470<?php 
    464471            for ($i = 0; $i < $numres; $i++) { 
    465 ?> 
    466 <tr> 
    467     <td class="el"><small><?php echo (($scripts[$i]['removed'])?'<span class="s">':'').$scripts[$i]['file'].(($scripts[$i]['removed'])?'</span>':'')?></small></td> 
     472  
     473?> 
     474<tr> 
     475    <td class="el"><small><?php echo ((isset($scripts[$i]['removed']) && $scripts[$i]['removed'])?'<span class="s">':'').$scripts[$i]['file'].((isset($scripts[$i]['removed']) && $scripts[$i]['removed'])?'</span>':'')?></small></td> 
    468476    <td class="fl"><small><?php echo date('Y-m-d H:i:s', $scripts[$i]['mtime'])?></small></td> 
    469477    <td class="fr"><small><?php echo format_size($scripts[$i]['size'])?></small></td> 
     
    502510     
    503511        // sort 
    504         switch ($_GET['ordby']) { 
     512        $ordby = isset($_GET['ordby']) ? intval($_GET['ordby']) : 0; 
     513        switch ($ordby) { 
    505514            default: 
    506515            case 0: $ordby = 'name'; $ordbystr = true; break; 
     
    514523        $numtot = count($userkeys); 
    515524 
    516         $pg = (int)$_GET['pg']; // zero-starting 
     525        $pg = isset($_GET['pg']) ? (int)$_GET['pg'] : 0; // zero-starting 
    517526        $pgs = ceil($numtot/$npp); 
    518527