Esempio n. 1
0
function getFiles($fileName, &$updateTime = 0, $url = '', $levels = 100, $types = array('jpg', 'png', 'gif', 'jpeg', 'css', 'js'))
{
    if (empty($fileName) || !$levels) {
        return false;
    }
    $files = array();
    if (is_file($fileName)) {
        $updateTime = getMax(filectime($fileName), $updateTime);
        $files[] = $url;
    } else {
        if ($dir = @opendir($fileName)) {
            while (($file = readdir($dir)) !== false) {
                if (in_array($file, array('.', '..'))) {
                    continue;
                }
                if (is_dir($fileName . '/' . $file)) {
                    $files2 = getFiles($fileName . '/' . $file, $updateTime, $url . '/' . $file, $levels - 1);
                    if ($files2) {
                        $files = array_merge($files, $files2);
                    }
                } else {
                    $updateTime = getMax(filectime($fileName . '/' . $file), $updateTime);
                    $type = end(explode(".", $file));
                    if (in_array($type, $types)) {
                        $files[] = $url . '/' . $file;
                    }
                }
            }
        }
    }
    @closedir($dir);
    //	echo date("Y-m-d H:i:s",$updateTime).'<hr>';
    return $files;
}
Esempio n. 2
0
	/**
		 * Moves the row selected one position down. (Pos = Pos + 1);
		 *
		 * @param string $table Name of the table to move down from
		 * @param string $indexColumn Name of the Primary Key of the table
		 * @param integer $indexValue Value of the PK of the row to sort.
		 * @param string $sortColumn Name of the Column where order is stored
		 * @param string $cond Where-Clause, to select only some rows.
		 */
	function moveRowDown($table, $indexColumn, $indexValue, $sortColumn, $cond = "1") {
		global $db;

		$curPos = getDBCell($table, $sortColumn, $cond . " AND $indexColumn = $indexValue");
		$maxPos = getMax($table, $sortColumn, $cond);

		if ($curPos < $maxPos) {
			$chKey = getDBCell($table, $indexColumn, $cond . " AND $sortColumn =" . ($curPos + 1));
		
			$sql = "UPDATE $table SET $sortColumn=" . ($curPos) . " WHERE $cond AND $indexColumn = $chKey";
			$query = new query($db, $sql);
			$query->free();
			$sql = "UPDATE $table SET $sortColumn=" . ($curPos + 1) . " WHERE $cond AND $indexColumn = $indexValue";
			$query = new query($db, $sql);
			$query->free();
			sortTableRows($table, $indexColumn, $sortColumn, $cond);
		}
	}
		/**
		 * Create new items
		 */
		function createItems() {
			global $db;				
			$allowed_number = ($this->maxcard - count($this->members));
			if ($allowed_number < 0) $allowed_number = 0;
			$number_of_instances = value("number_of_instances".$this->clti, "NUMERIC");
			if ($allowed_number < $number_of_instances)$number_of_instances = $allowed_number;
				
			$newpos = getMax("cluster_content", "POSITION", "CLTI_ID = $this->clti AND CLID = $this->cl") + 1;
			if ($newpos < 1) $newpos=1;
			$created = false;	
			for ($i=0; $i < $number_of_instances; $i++) {
				$nextId = nextGUID();
				$ssql = "INSERT INTO cluster_content (CLCID, CLID, CLTI_ID, POSITION, TITLE, FKID, DELETED) VALUES ";
				$ssql .= "($nextId, $this->cl, $this->clti, $newpos+$i, '', 0, 0)";
				$synq = new query($db, $ssql);
				$this->createReferencedItem($nextId);
				$created = true;
			}
			if ($created) $this->members = $this->getItemData();
		}
Esempio n. 4
0
    return strtotime($dateString) * 1000;
}, $result[1], $result[2]);
// Create Points for Flot charting library
$points = array_map(function ($a, $b) {
    return array($a, $b);
}, $labels, $floatValues);
// Calculate average and min/max values
$average = average($floatValues);
$lowest = getMin($floatValues);
$highest = getMax($floatValues);
$average24Hours = average($valuesLast24Hours);
$lowest24Hours = getMin($valuesLast24Hours);
$highest24Hours = getMax($valuesLast24Hours);
$averageWeek = average($valuesLastWeek);
$lowestWeek = getMin($valuesLastWeek);
$highestWeek = getMax($valuesLastWeek);
?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Raspberry Pi Monitor</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <meta http-equiv="refresh" content="900">

    <!-- Le styles -->
    <link href="css/bootstrap.css" rel="stylesheet">
    <style>
      body {
Esempio n. 5
0
                echo $i;
                ?>
</a></li>
					<?php 
                if (getPageNb() + $siblingsNbr == $i) {
                    ?>
							<li ><a>...</a></li>
						<?php 
                }
            }
        }
        ?>


				<li><a href="<?php 
        echo getUrl("null", getPath(), true, array('pagenb' => $nbPage, 'max' => getMax(), 'mode' => $_GET['mode']));
        ?>
">&raquo;</a></li>
			</ul>

			<?php 
    }
} else {
    ?>
 
			<div class="alert alert-warning" role="alert"><?php 
    echo t('noLog', array(getPath(), getRev(), getRev2()));
    ?>
</div>
		<?php 
}
require_once "../admin_conn.php";
require_once "collect_fun.php";
//chkLogin();
$action = be("get", "action");
headAdminCollect("文章自定义采集");
$p_ids = be("get", "p_id");
var_dump($p_ids);
$num = be("get", "num");
$listnum = be("get", "listnum");
$viewnum = be("get", "viewnum");
$sb = be("get", "sb");
$cg = be("get", "cg");
$users = getUsers();
$maxPostid = getMax('discuzforum_post_tableid', 'pid');
$maxThreadid = getMax('discuzforum_thread', 'tid');
$maxarticleid = getMax("discuzportal_article_title", "aid");
$sql = "SELECT count(*) FROM discuzcommon_member where uid !=1";
$maxUser = $db->getOne($sql);
if (isn($num)) {
    $num = 0;
} else {
    $num = intval($num);
}
if (isN($listnum)) {
    $listnum = 0;
} else {
    $listnum = intval($listnum);
}
if (isN($viewnum)) {
    $viewnum = 0;
} else {
Esempio n. 7
0
 function fetchCache()
 {
     global $memcache_server;
     global $memcache_port;
     global $memcache_expiration;
     global $platforms;
     $cache = new Cache($memcache_server, $memcache_port, $memcache_expiration);
     $root = array();
     foreach ($platforms as $platformName => $components) {
         $root[$platformName] = array();
         $cachePlatform = $cache->get($platformName);
         /* overview data */
         $currentPlatformRT = 0;
         $currentDatabaseRT = 0;
         $currentDatabaseRTL = 0;
         $maxPlatformRT = 0;
         $maxDatabaseRT = 0;
         $maxDatabaseRTL = 0;
         $minPlatformRT = 0;
         $minDatabaseRT = 0;
         $minDatabaseRTL = 0;
         foreach ($cachePlatform as $componentName => $componentValue) {
             switch ($componentName) {
                 case 'responsetime':
                 case "tr1usuario1":
                 case "tr1usuario2":
                 case "tr1usuario3":
                 case "tr1usuario4":
                 case "tr1usuario5":
                 case "tr1usuario6":
                 case "tr1usuario7":
                 case "tr1usuario8":
                 case "tr1usuario9":
                 case "tr1usuario10":
                     $currentPlatformRT = $componentValue['live'];
                     $maxPlatformRT = $componentValue['hi'];
                     $minPlatformRT = $componentValue['lo'];
                 case 'db_responsetime':
                     $currentDatabaseRT = $componentValue['live'];
                     $maxDatabaseRT = $componentValue['hi'];
                     $minDatabaseRT = $componentValue['lo'];
                 case 'dbl_responsetime':
                     $currentDatabaseRTL = $componentValue['live'];
                     $maxDatabaseRTL = $componentValue['hi'];
                     $minDatabaseRTL = $componentValue['lo'];
                 case 'connections':
                     $live = $componentValue['live'];
                     $max = $componentName == 'connections' ? getMax($platformName) : $componentValue['hi'];
                     $min = $componentName == 'connections' ? 0 : $componentValue['lo'];
                     //$live = ($live >0)?$live:0;
                     $fillPercent = getPercent($live, $max, $min);
                     $root[$platformName][$componentName] = array();
                     $root[$platformName][$componentName]['chart'] = array($fillPercent, 100 - $fillPercent);
                     $root[$platformName][$componentName]['value'] = $live;
                     break;
                 case 'condition':
                 case 'appresponse1':
                 case 'appresponse2':
                 case 'appresponse3':
                 case 'appresponse4':
                 case 'appresponse5':
                 case 'appresponse6':
                 case 'appresponse7':
                 case 'appresponse8':
                 case 'appresponse9':
                 case 'appresponse10':
                 case 'appresponse11':
                 case 'appresponse12':
                 case 'appresponse13':
                 case 'appresponse14':
                 case 'appresponse15':
                 case 'db_condition':
                     $root[$platformName][$componentName] = $componentValue;
                     break;
                     /*10 usuarios Inicia tr*/
                 /*10 usuarios Inicia tr*/
                 case "app1usuario1":
                 case "app1usuario2":
                 case "app1usuario3":
                 case "app1usuario4":
                 case "app1usuario5":
                 case "app1usuario6":
                 case "app1usuario7":
                 case "app1usuario8":
                 case "app1usuario9":
                 case "app1usuario10":
                 case "app2usuario1":
                 case "app2usuario2":
                 case "app2usuario3":
                 case "app2usuario4":
                 case "app2usuario5":
                 case "app2usuario6":
                 case "app2usuario7":
                 case "app2usuario8":
                 case "app2usuario9":
                 case "app2usuario10":
                 case "app3usuario1":
                 case "app3usuario2":
                 case "app3usuario3":
                 case "app3usuario4":
                 case "app3usuario5":
                 case "app3usuario6":
                 case "app3usuario7":
                 case "app3usuario8":
                 case "app3usuario9":
                 case "app3usuario10":
                 case "app4usuario1":
                 case "app4usuario2":
                 case "app4usuario3":
                 case "app4usuario4":
                 case "app4usuario5":
                 case "app4usuario6":
                 case "app4usuario7":
                 case "app4usuario8":
                 case "app4usuario9":
                 case "app4usuario10":
                 case "app5usuario1":
                 case "app5usuario2":
                 case "app5usuario3":
                 case "app5usuario4":
                 case "app5usuario5":
                 case "app5usuario6":
                 case "app5usuario7":
                 case "app5usuario8":
                 case "app5usuario9":
                 case "app5usuario10":
                 case "app6usuario1":
                 case "app6usuario2":
                 case "app6usuario3":
                 case "app6usuario4":
                 case "app6usuario5":
                 case "app6usuario6":
                 case "app6usuario7":
                 case "app6usuario8":
                 case "app6usuario9":
                 case "app6usuario10":
                 case "app7usuario1":
                 case "app7usuario2":
                 case "app7usuario3":
                 case "app7usuario4":
                 case "app7usuario5":
                 case "app7usuario6":
                 case "app7usuario7":
                 case "app7usuario8":
                 case "app7usuario9":
                 case "app7usuario10":
                 case "app8usuario1":
                 case "app8usuario2":
                 case "app8usuario3":
                 case "app8usuario4":
                 case "app8usuario5":
                 case "app8usuario6":
                 case "app8usuario7":
                 case "app8usuario8":
                 case "app8usuario9":
                 case "app8usuario10":
                     $root[$platformName][$componentName] = $componentValue;
                     break;
                     /*10 usuarios finaliza*/
                     /*10 usuarios Inicia capa de datos*/
                 /*10 usuarios finaliza*/
                 /*10 usuarios Inicia capa de datos*/
                 case "bd1usuario1":
                 case "bd1usuario2":
                 case "bd1usuario3":
                 case "bd1usuario4":
                 case "bd1usuario5":
                 case "bd1usuario6":
                 case "bd1usuario7":
                 case "bd1usuario8":
                 case "bd1usuario9":
                 case "bd1usuario10":
                     $root[$platformName][$componentName] = $componentValue;
                     break;
                     /*10 usuarios Finaliza capa de datos*/
                 /*10 usuarios Finaliza capa de datos*/
                 default:
                     # code...
                     break;
             }
             /* compile overview data */
             $sumLive = 0;
             $sumMax = 0;
             $sumMin = 0;
             if ($currentPlatformRT > 0) {
                 $sumLive += $currentPlatformRT;
                 $sumMax += $maxPlatformRT;
                 $sumMin += $minPlatformRT;
             }
             if ($currentDatabaseRT > 0) {
                 $sumLive += $currentDatabaseRT;
                 $sumMax += $maxDatabaseRT;
                 $sumMin += $minDatabaseRT;
             }
             if ($currentDatabaseRTL > 0) {
                 $sumLive += $currentDatabaseRTL;
                 $sumMax += $maxDatabaseRTL;
                 $sumMin += $minDatabaseRTL;
             }
             $fillPercent = getPercent($sumLive, $sumMax, $sumMin);
             $root[$platformName]['overview']['chart'] = array($fillPercent, 100 - $fillPercent);
             $root[$platformName]['overview']['value'] = $sumLive;
         }
     }
     return json_encode($root);
 }
Esempio n. 8
0
?>
					</label>
				</div>
			</div>
			<div class="form-group btn-group-justified">
				<div class="input-group" rel="tooltip" title="<?php 
echo t('letEmptyForUnlimited');
?>
">

					<span class="input-group-addon"><?php 
echo t('maxLines');
?>
:</span>
					<input type="text" class="form-control input-sm" name="max" value="<?php 
echo getMax();
?>
">
				</div>
			</div>
			<div class="form-group btn-group-justified">
				<div class="input-group">
					<input type="text" class="form-control input-sm rev" name="rev" value="<?php 
echo getRev(true);
?>
" placeholder="HEAD">
					<span class="input-group-addon">:</span>
					<input type="text" class="form-control input-sm rev2" name="rev2" value="<?php 
echo getRev2(true);
?>
" placeholder="HEAD">