Changeset 282
- Timestamp:
- 10/26/06 22:58:00 (2 years ago)
- Files:
-
- eaccelerator/trunk/control.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
eaccelerator/trunk/control.php
r281 r282 33 33 34 34 // Inline media 35 if ( $_GET['img']) {35 if (isset($_GET['img']) && $_GET['img']) { 36 36 $img = strtolower($_GET['img']); 37 37 $imgs['dnarr'][0] = 199; … … 61 61 } 62 62 63 $sec = (int)$_GET['sec'];63 $sec = isset($_GET['sec']) ? (int)$_GET['sec'] : 0; 64 64 65 65 // No-cache headers … … 172 172 // Returns standard column headers for the lists 173 173 function 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'] : ""; 176 176 return '<a href="'.$_SERVER['PHP_SELF'].'?'.qstring_update(array('ordby' => $id, 'dir' => ($cursrt == $id)?1-$srtdir:0)).'">'.$nme.' '.(($cursrt == $id)?'<img src="'.$_SERVER['PHP_SELF'].'?img='.(($srtdir)?'dnarr':'uparr').'" width="13" height="16" border="0" alt="'.(($srtdir)?'v':'^').'"/>':''); 177 177 } … … 180 180 function arrsort ($a, $b) { 181 181 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; 185 188 return $val; 186 189 } … … 403 406 // search 404 407 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']); 406 410 } 407 411 $scripts = array_filter($scripts, 'scriptsearch'); 408 412 409 413 // sort 410 switch ($_GET['ordby']) { 414 $ordby = isset($_GET['ordby']) ? intval($_GET['ordby']) : 0; 415 switch ($ordby) { 411 416 default: 412 417 case 0: $ordby = 'file'; $ordbystr = true; break; … … 421 426 $numtot = count($scripts); 422 427 423 $pg = (i nt)$_GET['pg']; // zero-starting428 $pg = (isset($_GET['pg']) ? (int)$_GET['pg'] : 0); // zero-starting 424 429 $pgs = ceil($numtot/$npp); 425 430 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; 428 435 429 436 $scripts = array_slice($scripts, $pg*$npp, $npp); … … 463 470 <?php 464 471 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> 468 476 <td class="fl"><small><?php echo date('Y-m-d H:i:s', $scripts[$i]['mtime'])?></small></td> 469 477 <td class="fr"><small><?php echo format_size($scripts[$i]['size'])?></small></td> … … 502 510 503 511 // sort 504 switch ($_GET['ordby']) { 512 $ordby = isset($_GET['ordby']) ? intval($_GET['ordby']) : 0; 513 switch ($ordby) { 505 514 default: 506 515 case 0: $ordby = 'name'; $ordbystr = true; break; … … 514 523 $numtot = count($userkeys); 515 524 516 $pg = (int)$_GET['pg']; // zero-starting525 $pg = isset($_GET['pg']) ? (int)$_GET['pg'] : 0; // zero-starting 517 526 $pgs = ceil($numtot/$npp); 518 527