当前位置: 首页>>代码示例>>PHP>>正文


PHP GetSetting函数代码示例

本文整理汇总了PHP中GetSetting函数的典型用法代码示例。如果您正苦于以下问题:PHP GetSetting函数的具体用法?PHP GetSetting怎么用?PHP GetSetting使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetSetting函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: AgentUpdate

/**
* Automatically update the agent binaries from the public agents (if configured)
* 
*/
function AgentUpdate()
{
    $updateServer = GetSetting('agentUpdate');
    echo "\nChecking for agent update...\n";
    if ($updateServer && strlen($updateServer)) {
        if (!is_dir('./work/update')) {
            mkdir('./work/update', 0777, true);
        }
        $url = $updateServer . 'work/getupdates.php';
        $updates = json_decode(http_fetch($url), true);
        if ($updates && is_array($updates) && count($updates)) {
            foreach ($updates as $update) {
                $needsUpdate = true;
                $ini = "./work/update/{$update['name']}.ini";
                $zip = "./work/update/{$update['name']}.zip";
                if (is_file($ini) && is_file($zip)) {
                    $current = parse_ini_file($ini);
                    if ($current['ver'] == $update['ver']) {
                        $needsUpdate = false;
                    }
                }
                if ($needsUpdate && isset($update['md5'])) {
                    $tmp = "./work/update/{$update['name']}.tmp";
                    if (is_file($tmp)) {
                        unlink($tmp);
                    }
                    $url = $updateServer . str_replace(" ", "%20", "work/update/{$update['name']}.zip?v={$update['ver']}");
                    echo "Fetching {$url}\n";
                    if (http_fetch_file($url, $tmp)) {
                        $md5 = md5_file($tmp);
                        if ($md5 == $update['md5']) {
                            if (is_file("{$ini}.bak")) {
                                unlink("{$ini}.bak");
                            }
                            if (is_file($ini)) {
                                rename($ini, "{$ini}.bak");
                            }
                            if (is_file("{$zip}.bak")) {
                                unlink("{$zip}.bak");
                            }
                            if (is_file($zip)) {
                                rename($zip, "{$zip}.bak");
                            }
                            rename($tmp, $zip);
                            $z = new ZipArchive();
                            if ($z->open($zip) === TRUE) {
                                $z->extractTo('./work/update', "{$update['name']}.ini");
                                $z->close();
                            }
                        }
                    }
                }
            }
        }
    }
}
开发者ID:jonas-krummenacher,项目名称:webpagetest,代码行数:60,代码来源:hourly.php

示例2: graphite_key

function graphite_key($location, $browser, $label, $cached, $metric)
{
    if (GetSetting('statsdCleanPattern')) {
        $label = preg_replace('/' . GetSetting('statsdPattern') . '/', '', $label);
    }
    $fvrv = $cached ? 'repeat' : 'first';
    $locationParts = explode('_', $location);
    $location = $locationParts[0];
    return "{$location}.{$browser}.{$label}.{$fvrv}.";
}
开发者ID:NeilBryant,项目名称:webpagetest,代码行数:10,代码来源:statsd.inc.php

示例3: ProcessAVIVideo

/**
* Convert an AVI video capture into the video frames the WPT is expecting
* 
* @param mixed $testPath
* @param mixed $run
* @param mixed $cached
*/
function ProcessAVIVideo(&$test, $testPath, $run, $cached)
{
    global $max_load;
    $cachedText = '';
    if ($cached) {
        $cachedText = '_Cached';
    }
    $videoFile = "{$testPath}/{$run}{$cachedText}_video.mp4";
    $crop = '';
    if (!is_file($videoFile)) {
        $videoFile = "{$testPath}/{$run}{$cachedText}_video.avi";
    }
    if (!GetSetting('disable_video_processing') && is_file($videoFile)) {
        $videoDir = "{$testPath}/video_{$run}" . strtolower($cachedText);
        if (!is_file("{$videoDir}/video.json")) {
            if (isset($max_load) && $max_load > 0) {
                WaitForSystemLoad($max_load, 3600);
            }
            if (is_dir($videoDir)) {
                delTree($videoDir, false);
            }
            if (!is_dir($videoDir)) {
                mkdir($videoDir, 0777, true);
            }
            $videoFile = realpath($videoFile);
            $videoDir = realpath($videoDir);
            if (strlen($videoFile) && strlen($videoDir)) {
                if (PythonVisualMetrics($videoFile, $videoDir, $testPath, $run, $cached)) {
                    unlink($videoFile);
                } else {
                    $crop = FindVideoCrop($videoFile, $videoDir);
                    if (Video2PNG($videoFile, $videoDir, $crop)) {
                        $startOffset = DevToolsGetVideoOffset($testPath, $run, $cached, $endTime);
                        FindAVIViewport($videoDir, $startOffset, $viewport);
                        EliminateDuplicateAVIFiles($videoDir, $viewport);
                        $lastImage = ProcessVideoFrames($videoDir, $viewport);
                        $screenShot = "{$testPath}/{$run}{$cachedText}_screen.jpg";
                        if (isset($lastImage) && is_file($lastImage)) {
                            unlink($videoFile);
                            if (!is_file($screenShot)) {
                                copy($lastImage, $screenShot);
                            }
                        }
                    }
                }
            }
            $videoInfo = array();
            if (isset($viewport)) {
                $videoInfo['viewport'] = $viewport;
            }
            file_put_contents("{$videoDir}/video.json", json_encode($videoInfo));
        }
    }
}
开发者ID:lucasRolff,项目名称:webpagetest,代码行数:61,代码来源:avi2frames.inc.php

示例4: _createLegend

 private function _createLegend()
 {
     $out = '';
     if (!GetSetting('mime_waterfalls')) {
         $out .= '<table border="1" bordercolor="silver" cellpadding="2px" cellspacing="0" ' . 'style="width:auto; font-size:11px; margin-left:auto; margin-right:auto;">';
         $out .= "\n<tr>\n";
         $out .= $this->_legendBarTableCell("#1f7c83", "DNS Lookup", 15);
         $out .= $this->_legendBarTableCell("#e58226", "Initial Connection", 15);
         if ($this->requests->hasSecureRequests()) {
             $out .= $this->_legendBarTableCell("#c141cd", "SSL Negotiation", 15);
         }
         $out .= $this->_legendBarTableCell("#1fe11f", "Time to First Byte", 15);
         $out .= $this->_legendBarTableCell("#1977dd", "Content Download", 15);
         $out .= $this->_legendHighlightTableCell("#ffff60", "3xx response");
         $out .= $this->_legendHighlightTableCell("#ff6060", "4xx+ response");
         $out .= "</tr>\n</table>\n";
     }
     $out .= '<table border="1" bordercolor="silver" cellpadding="2px" cellspacing="0" ' . 'style="width:auto; font-size:11px; margin-left:auto; margin-right:auto; margin-top:11px;">';
     $out .= "\n<tr>\n";
     $out .= $this->_legendBarTableCell("#28BC00", "Start Render", 2);
     if ($this->stepResult->getMetric("aft")) {
         $out .= $this->_legendBarTableCell("#FF0000", "Above the Fold", 2);
     }
     if ((double) $this->stepResult->getMetric("domTime")) {
         $out .= $this->_legendBarTableCell("#F28300", "DOM Element", 2);
     }
     if ((double) $this->stepResult->getMetric("firstPaint")) {
         $out .= $this->_legendBarTableCell("#8FBC83", "msFirstPaint", 2);
     }
     if ((double) $this->stepResult->getMetric("domInteractive")) {
         $out .= $this->_legendBarTableCell("#FFC61A", "DOM Interactive", 2);
     }
     if ((double) $this->stepResult->getMetric("domContentLoadedEventStart")) {
         $out .= $this->_legendBarTableCell("#D888DF", "DOM Content Loaded", 15);
     }
     if ((double) $this->stepResult->getMetric("loadEventStart")) {
         $out .= $this->_legendBarTableCell("#C0C0FF", "On Load", 15);
     }
     $out .= $this->_legendBarTableCell("#0000FF", "Document Complete", 2);
     if (GetSetting('waterfall_show_user_timing') && ($this->stepResult->getMetric('userTime') || $this->hasCsi)) {
         $out .= '<td><table><tr><td><div class="arrow-down"></div></td><td>User Timings</td></tr></table></td>';
     }
     $out .= "</tr>\n</table>\n<br>";
     return $out;
 }
开发者ID:lucasRolff,项目名称:webpagetest,代码行数:45,代码来源:WaterfallViewHtmlSnippet.php

示例5: ValidateKey


//.........这里部分代码省略.........
        if (!isset($key) && isset($test['vh']) && strlen($test['vh'])) {
            // validate the hash
            $hashStr = $secret;
            $hashStr .= $_SERVER['HTTP_USER_AGENT'];
            $hashStr .= $test['owner'];
            $hashStr .= $test['vd'];
            $hmac = sha1($hashStr);
            // check the elapsed time since the hmac was issued
            $now = time();
            $origTime = strtotime($test['vd']);
            $elapsed = abs($now - $origTime);
            if ($hmac != $test['vh'] || $elapsed > 86400) {
                $error = 'Your test request could not be validated (this can happen if you leave the browser window open for over a day before submitting a test).  Please try submitting it again.';
            }
        } elseif (isset($key) || isset($test['key']) && strlen($test['key'])) {
            if (isset($test['key']) && strlen($test['key']) && !isset($key)) {
                $key = $test['key'];
            }
            // see if it was an auto-provisioned key
            if (preg_match('/^(?P<prefix>[0-9A-Za-z]+)\\.(?P<key>[0-9A-Za-z]+)$/', $key, $matches)) {
                $prefix = $matches['prefix'];
                $db = new SQLite3(__DIR__ . "/dat/{$prefix}_api_keys.db");
                $k = $db->escapeString($matches['key']);
                $info = $db->querySingle("SELECT key_limit FROM keys WHERE key='{$k}'", true);
                $db->close();
                if (isset($info) && is_array($info) && isset($info['key_limit'])) {
                    $keys[$key] = array('limit' => $info['key_limit']);
                }
            }
            // validate their API key and enforce any rate limits
            if (array_key_exists($key, $keys)) {
                if (array_key_exists('default location', $keys[$key]) && strlen($keys[$key]['default location']) && !strlen($test['location'])) {
                    $test['location'] = $keys[$key]['default location'];
                }
                if (isset($keys[$key]['priority'])) {
                    $test['priority'] = $keys[$key]['priority'];
                }
                if (isset($keys[$key]['limit'])) {
                    $limit = (int) $keys[$key]['limit'];
                    // update the number of tests they have submitted today
                    if (!is_dir('./dat')) {
                        mkdir('./dat', 0777, true);
                    }
                    $lock = Lock("API Keys");
                    if (isset($lock)) {
                        $keyfile = './dat/keys_' . gmdate('Ymd') . '.dat';
                        $usage = null;
                        if (is_file($keyfile)) {
                            $usage = json_decode(file_get_contents($keyfile), true);
                        }
                        if (!isset($usage)) {
                            $usage = array();
                        }
                        if (isset($usage[$key])) {
                            $used = (int) $usage[$key];
                        } else {
                            $used = 0;
                        }
                        $runcount = max(1, $test['runs']);
                        if (!$test['fvonly']) {
                            $runcount *= 2;
                        }
                        if ($limit > 0) {
                            if ($used + $runcount <= $limit) {
                                $used += $runcount;
                                $usage[$key] = $used;
                            } else {
                                $error = 'The test request will exceed the daily test limit for the given API key';
                            }
                        } else {
                            $used += $runcount;
                            $usage[$key] = $used;
                        }
                        if (!strlen($error)) {
                            file_put_contents($keyfile, json_encode($usage));
                        }
                        Unlock($lock);
                    }
                }
                // check to see if we need to limit queue lengths from this API key
                if ($keys[$key]['queue_limit']) {
                    $test['queue_limit'] = $keys[$key]['queue_limit'];
                }
            } else {
                $error = 'Invalid API Key';
            }
            if (!strlen($error) && $key != $keys['server']['key']) {
                global $usingAPI;
                $usingAPI = true;
            }
        } elseif (!isset($admin) || !$admin) {
            $error = 'An error occurred processing your request (missing API key).';
            if (GetSetting('allow_getkeys')) {
                $protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' || isset($_SERVER['HTTP_SSL']) && $_SERVER['HTTP_SSL'] == 'On' ? 'https' : 'http';
                $url = "{$protocol}://{$_SERVER['HTTP_HOST']}/getkey.php";
                $error .= "  If you do not have an API key assigned you can request one at {$url}";
            }
        }
    }
}
开发者ID:it114,项目名称:webpagetest,代码行数:101,代码来源:runtest.php

示例6: FCKeditor

				<p><input type="text" name="title<?php 
    echo $recROW['language_id'];
    ?>
" value="<?php 
    echo $title;
    ?>
"></p>				
				<div class="editor_holder">		
					<?php 
    $sBasePath = $absoluteURL . 'includes/php.module/fckeditor/';
    $body_text = 'body' . $recROW['language_id'];
    $oFCKeditor = new FCKeditor("{$body_text}");
    $oFCKeditor->BasePath = $sBasePath;
    $oFCKeditor->Value = $body;
    $oFCKeditor->ToolbarSet = GetSetting('toolbar_set', $feature_id);
    $oFCKeditor->Height = GetSetting('height', $feature_id);
    //$oFCKeditor->Config['EditorAreaCSS']	= $docRoot.'includes/style/editableregion.css';
    $oFCKeditor->Create();
    ?>
				</div>
	
			</div>
			
			<script type="text/javascript">	animatedcollapse.addDiv('content_<?php 
    echo $recROW['language_id'];
    ?>
', 'fade=0,speed=1000')</script>
	
	<?php 
}
?>
开发者ID:BGCX067,项目名称:facebooksurveyom-svn-to-git,代码行数:31,代码来源:index.php

示例7: SetSetting

function SetSetting()
{
    global $args, $SUDO;
    $setting = $args['key'];
    $value = $args['value'];
    check($setting, "setting", __FUNCTION__);
    check($value, "value", __FUNCTION__);
    WriteSettingToFile($setting, $value);
    if ($setting == "LogLevel") {
        SendCommand("LogLevel,{$value},");
    } else {
        if ($setting == "LogMask") {
            $newValue = "";
            if ($value != "") {
                $newValue = preg_replace("/,/", ";", $value);
            }
            SendCommand("LogMask,{$newValue},");
        } else {
            if ($setting == "HostName") {
                $value = preg_replace("/[^a-zA-Z0-9]/", "", $value);
                exec($SUDO . " sed -i 's/^.*\$/{$value}/' /etc/hostname ; " . $SUDO . " sed -i '/^127.0.1.1[^0-9]/d' /etc/hosts ; " . $SUDO . " sed -i '\$a127.0.1.1 {$value}' /etc/hosts ; " . $SUDO . " hostname {$value} ; " . $SUDO . " /etc/init.d/avahi-daemon restart ;" . $SUDO . " systemctl restart avahi-daemon.service", $output, $return_val);
                sleep(1);
                // Give Avahi time to restart before we return
            } else {
                if ($setting == "EnableRouting") {
                    if ($value != "1") {
                        $value = "0";
                    }
                    exec($SUDO . " sed -i '/net.ipv4.ip_forward/d' /etc/sysctl.conf; " . $SUDO . " sed -i '\$anet.ipv4.ip_forward = {$value}' /etc/sysctl.conf ; " . $SUDO . " sysctl --system", $output, $return_val);
                } else {
                    if ($setting == "storageDevice") {
                        exec('mount | grep boot | cut -f1 -d" " | sed -e "s/\\/dev\\///" -e "s/p[0-9]$//"', $output, $return_val);
                        $bootDevice = $output[0];
                        unset($output);
                        if (preg_match("/{$bootDevice}/", $value)) {
                            exec($SUDO . " sed -i 's/.*home\\/fpp\\/media/#\\/dev\\/sda1    \\/home\\/fpp\\/media/' /etc/fstab", $output, $return_val);
                        } else {
                            exec($SUDO . " sed -i 's/.*home\\/fpp\\/media/\\/dev\\/{$value}    \\/home\\/fpp\\/media/' /etc/fstab", $output, $return_val);
                        }
                    } else {
                        if ($setting == "AudioOutput") {
                            SetAudioOutput($value);
                        } else {
                            if ($setting == "ForceHDMI") {
                                if ($value) {
                                    exec($SUDO . " sed -i '/hdmi_force_hotplug/d' /boot/config.txt; " . $SUDO . " sed -i '\$ahdmi_force_hotplug=1' /boot/config.txt", $output, $return_val);
                                } else {
                                    exec($SUDO . " sed -i '/hdmi_force_hotplug/d' /boot/config.txt; " . $SUDO . " sed -i '\$a#hdmi_force_hotplug=1' /boot/config.txt", $output, $return_val);
                                }
                            } else {
                                SendCommand("SetSetting,{$setting},{$value},");
                            }
                        }
                    }
                }
            }
        }
    }
    GetSetting();
}
开发者ID:rudybrian,项目名称:fpp,代码行数:60,代码来源:fppjson.php

示例8:

                                         <small>Chrome 34+ on Android</small>
                                     </label>
                                 </li>
                                 <?php 
 if ($admin && GetSetting('wprDesktop')) {
     ?>
                                 <li>
                                     <input type="checkbox" name="wprDesktop" id="wprDesktop" class="checkbox" style="float: left;width: auto;">
                                     <label for="wprDesktop" class="auto_width">
                                         Use Web Page Replay recorded Desktop Page<br>
                                         <small>Limited list of available <a href="/wprDesktop.txt">URLs</a></small>
                                     </label>
                                 </li>
                                 <?php 
 }
 if ($admin && GetSetting('wprMobile')) {
     ?>
                                 <li>
                                     <input type="checkbox" name="wprMobile" id="wprMobile" class="checkbox" style="float: left;width: auto;">
                                     <label for="wprMobile" class="auto_width">
                                         Use Web Page Replay recorded Mobile Page<br>
                                         <small>Limited list of available <a href="/wprMobile.txt">URLs</a></small>
                                     </label>
                                 </li>
                                 <?php 
 }
 ?>
                                 <li>
                                     <label for="hostResolverRules" style="width: auto;">
                                     <a href="https://github.com/atom/electron/blob/master/docs/api/chrome-command-line-switches.md#--host-rulesrules">Host Rules</a><br>
                                     <small>i.e. MAP * 1.2.3.4</small>
开发者ID:NeilBryant,项目名称:webpagetest,代码行数:31,代码来源:index.php

示例9: ArchiveTest

 ArchiveTest($id, false);
 // post the test to tsview if requested
 $tsviewdb = GetSetting('tsviewdb');
 if (array_key_exists('tsview_id', $testInfo) && strlen($testInfo['tsview_id']) && strlen($tsviewdb) && is_file('./lib/tsview.inc.php')) {
     require_once './lib/tsview.inc.php';
     TSViewPostResult($testInfo, $id, $testPath, $settings['tsviewdb'], $testInfo['tsview_id']);
 }
 // post the test to statsd if requested
 if (GetSetting('statsdHost') && is_file('./lib/statsd.inc.php')) {
     require_once './lib/statsd.inc.php';
     StatsdPostResult($testInfo, $testPath);
 }
 // Send an email notification if necessary
 $notifyFrom = GetSetting('notifyFrom');
 if ($notifyFrom && strlen($notifyFrom) && is_file("{$testPath}/testinfo.ini")) {
     $host = GetSetting('host');
     $test = parse_ini_file("{$testPath}/testinfo.ini", true);
     if (array_key_exists('notify', $test['test']) && strlen($test['test']['notify'])) {
         notify($test['test']['notify'], $notifyFrom, $id, $testPath, $host);
     }
 }
 // send a callback/pingback request
 if (isset($testInfo) && isset($testInfo['callback']) && strlen($testInfo['callback'])) {
     $send_callback = true;
     $testId = $id;
     if (array_key_exists('batch_id', $testInfo) && strlen($testInfo['batch_id'])) {
         require_once 'testStatus.inc';
         $testId = $testInfo['batch_id'];
         $status = GetTestStatus($testId);
         $send_callback = false;
         if (array_key_exists('statusCode', $status) && $status['statusCode'] == 200) {
开发者ID:NeilBryant,项目名称:webpagetest,代码行数:31,代码来源:postprocess.php

示例10: GetImageHistogram

/**
* Calculate histograms for each color channel for the given image
*/
function GetImageHistogram($image_file, $options, $histograms)
{
    $histogram = null;
    $ext = strripos($image_file, '.jpg');
    if ($ext !== false) {
        $histogram_file = substr($image_file, 0, $ext) . '.hist';
    } else {
        $ext = strripos($image_file, '.png');
        if ($ext !== false) {
            $histogram_file = substr($image_file, 0, $ext) . '.hist';
        }
    }
    if (isset($histograms)) {
        // figure out the timestamp for the video frame in ms
        $ms = null;
        if (preg_match('/ms_(?P<ms>[0-9]+)\\.(png|jpg)/i', $image_file, $matches)) {
            $ms = intval($matches['ms']);
        } elseif (preg_match('/frame_(?P<ms>[0-9]+)\\.(png|jpg)/i', $image_file, $matches)) {
            $ms = intval($matches['ms']) * 100;
        }
        foreach ($histograms as &$hist) {
            if (isset($hist['histogram']) && isset($hist['time']) && $hist['time'] == $ms) {
                $histogram = $hist['histogram'];
                break;
            }
        }
    }
    // See if we have the old-style histograms (separate files)
    if (!isset($histogram) && !isset($options) && isset($histogram_file) && is_file($histogram_file)) {
        $histogram = json_decode(file_get_contents($histogram_file), true);
        if (!is_array($histogram) || !array_key_exists('r', $histogram) || !array_key_exists('g', $histogram) || !array_key_exists('b', $histogram) || count($histogram['r']) != 256 || count($histogram['g']) != 256 || count($histogram['b']) != 256) {
            unset($histogram);
        }
    }
    // generate a histogram from the image itself
    if (!isset($histogram) && !GetSetting('disable_image_processing')) {
        $im = imagecreatefromjpeg($image_file);
        if ($im !== false) {
            $width = imagesx($im);
            $height = imagesy($im);
            if ($width > 0 && $height > 0) {
                // default a resample to 1/4 in each direction which will significantly speed up processing with minimal impact to accuracy.
                // This is only for calculations done on the server.  Histograms from the client look at every pixel
                $resample = 8;
                if (isset($options) && array_key_exists('resample', $options)) {
                    $resample = $options['resample'];
                }
                if ($resample > 2) {
                    $oldWidth = $width;
                    $oldHeight = $height;
                    $width = intval($width * 2 / $resample);
                    $height = intval($height * 2 / $resample);
                    $tmp = imagecreatetruecolor($width, $height);
                    fastimagecopyresampled($tmp, $im, 0, 0, 0, 0, $width, $height, $oldWidth, $oldHeight, 3);
                    imagedestroy($im);
                    $im = $tmp;
                    unset($tmp);
                }
                $histogram = array();
                $histogram['r'] = array();
                $histogram['g'] = array();
                $histogram['b'] = array();
                $buckets = 256;
                if (isset($options) && array_key_exists('buckets', $options) && $options['buckets'] >= 1 && $options['buckets'] <= 256) {
                    $buckets = $options['buckets'];
                }
                for ($i = 0; $i < $buckets; $i++) {
                    $histogram['r'][$i] = 0;
                    $histogram['g'][$i] = 0;
                    $histogram['b'][$i] = 0;
                }
                for ($y = 0; $y < $height; $y++) {
                    for ($x = 0; $x < $width; $x++) {
                        $rgb = ImageColorAt($im, $x, $y);
                        $r = $rgb >> 16 & 0xff;
                        $g = $rgb >> 8 & 0xff;
                        $b = $rgb & 0xff;
                        // ignore white pixels
                        if ($r != 255 || $g != 255 || $b != 255) {
                            if (isset($options) && array_key_exists('colorSpace', $options) && $options['colorSpace'] != 'RGB') {
                                if ($options['colorSpace'] == 'HSV') {
                                    RGB_TO_HSV($r, $g, $b);
                                } elseif ($options['colorSpace'] == 'YUV') {
                                    RGB_TO_YUV($r, $g, $b);
                                }
                            }
                            $bucket = (int) (($r + 1.0) / 256.0 * $buckets) - 1;
                            $histogram['r'][$bucket]++;
                            $bucket = (int) (($g + 1.0) / 256.0 * $buckets) - 1;
                            $histogram['g'][$bucket]++;
                            $bucket = (int) (($b + 1.0) / 256.0 * $buckets) - 1;
                            $histogram['b'][$bucket]++;
                        }
                    }
                }
            }
            imagedestroy($im);
//.........这里部分代码省略.........
开发者ID:NeilBryant,项目名称:webpagetest,代码行数:101,代码来源:visualProgress.inc.php

示例11: GetReboot

        $is_done = GetReboot();
    }
    if (!$is_done && array_key_exists('ver', $_GET)) {
        $is_done = GetUpdate();
    }
    if (!$is_done && @$_GET['video']) {
        $is_done = GetVideoJob();
    }
    foreach ($locations as $loc) {
        $location = trim($loc);
        if (!$is_done && strlen($location)) {
            $is_done = GetJob();
        }
    }
} elseif (isset($_GET['freedisk']) && (double) $_GET['freedisk'] <= 0.1) {
    if (isset($_GET['reboot']) && GetSetting("lowDiskReboot")) {
        header('Content-type: text/plain');
        header("Cache-Control: no-cache, must-revalidate");
        header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
        echo "Reboot";
        $is_done = true;
    }
}
// kick off any cron work we need to do asynchronously
CheckCron();
// Send back a blank result if we didn't have anything.
if (!$is_done) {
    header('Content-type: text/plain');
    header("Cache-Control: no-cache, must-revalidate");
    header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
}
开发者ID:nowol79,项目名称:webpagetest-1,代码行数:31,代码来源:getwork.php

示例12: CreateApiKey

/**
* The request has been validated, generate the API key
* 
* @param mixed $request
*/
function CreateApiKey($request)
{
    global $prefix;
    $info = false;
    if ($db = OpenKeysDatabase()) {
        $email = '"' . $request['email'] . '"';
        $name = 'NULL';
        if (isset($request['name']) && strlen($request['name'])) {
            $name = '"' . $db->escapeString($request['name']) . '"';
        }
        $company = 'NULL';
        if (isset($request['company']) && strlen($request['company'])) {
            $company = '"' . $db->escapeString($request['company']) . '"';
        }
        $website = 'NULL';
        if (isset($request['website']) && strlen($request['website'])) {
            $website = '"' . $db->escapeString($request['website']) . '"';
        }
        $contact = 0;
        if (isset($request['contact']) && $request['contact']) {
            $contact = 1;
        }
        $ip = '"' . $db->escapeString($_SERVER["REMOTE_ADDR"]) . '"';
        $key = md5(uniqid(rand(), true));
        $now = time();
        $limit = GetSetting('api_key_limit');
        if (!$limit) {
            $limit = 200;
        }
        $query = "INSERT INTO keys (key, created, key_limit, email, ip, name, company, website, contact) VALUES (\"{$key}\", {$now}, {$limit}, {$email}, {$ip}, {$name}, {$company}, {$website}, {$contact})";
        if ($db->query($query)) {
            $info = $request;
            $info['key'] = $key;
            $info['key_limit'] = $limit;
            logMsg("{$ip},{$email},{$name},{$company},{$website},{$contact}", __DIR__ . '/log/keys.log', true);
        }
        $db->close();
    }
    return $info;
}
开发者ID:NeilBryant,项目名称:webpagetest,代码行数:45,代码来源:getkey.php

示例13: set_time_limit

set_time_limit(1200);
error_reporting(E_ALL);
$lock = Lock("cron-5", false, 1200);
if (!isset($lock)) {
    exit(0);
}
if (GetSetting('ec2')) {
    CleanGetWork();
}
require_once './ec2/ec2.inc.php';
if (GetSetting('ec2_key')) {
    EC2_TerminateIdleInstances();
    EC2_StartNeededInstances();
    EC2_DeleteOrphanedVolumes();
}
if (GetSetting('sbl_api_key')) {
    SBL_Update();
}
/**
* Clean up extraneous getwork.php.xxx files that may be left behind
* from using wget in a cron job.  The server AMI was supposed to run wget
* silently but there have been reports of the files getting created
* 
*/
function CleanGetWork()
{
    $files = glob('/var/www/getwork.php.*');
    foreach ($files as $file) {
        if (is_file($file)) {
            unlink($file);
        }
开发者ID:NeilBryant,项目名称:webpagetest,代码行数:31,代码来源:5min.php

示例14: GetSetting

?>
 </div>
	</div>
	<div class="top_navigation">
		<ul class="top_navigation_link_container">
			<li><a href="<?php 
echo $absoluteURL . "admin.space/";
?>
" target="_top">Home</a></li>
			<li style="background-image:none"><a href="<?php 
echo $absoluteURL . "admin.space/login/logout.php";
?>
" target="_top">Log out</a></li>
		</ul>
		<div class="back_end_name"><?php 
echo GetSetting('BackendName');
?>
</div>
	</div>
	<div class="top_sub_navigation">You are logged in as <strong><?php 
echo ucfirst(getAdmin($_SESSION['admin_login']));
?>
</strong>. Not you, please 
		<strong><a href="<?php 
echo $absoluteURL . "admin.space/login/logout.php";
?>
" target="_top">Sign out</a></strong></div>
</div>
</body>

</html>
开发者ID:BGCX067,项目名称:facebooksurveyom-svn-to-git,代码行数:31,代码来源:banner.php

示例15: usortpage

function usortpage()
{
    $admin_id = $_SESSION['admin_login'];
    if ($_GET['id'] && isset($_GET['pid']) && isset($_GET['usort']) && isset($_GET['fid'])) {
        // make GET vars easier to handle
        $dir = $_GET['dir'];
        // cast as int and couple with switch for sql injection prevention for $id
        $id = (int) $_GET['id'];
        $usort = (int) $_GET['usort'];
        $pid = (int) $_GET['pid'];
        $fid = (int) $_GET['fid'];
        $value = GetSetting('Dir', $fid);
        switch ($value) {
            // if we're going up, swap is 1 less than id
            case 'down':
                // make sure that there's a row above to swap
                //Check if there is a higher sort order
                $sql = "SELECT nav_tab_id,usort FROM navigation_tab WHERE usort > '{$usort}'  AND parent_id = '{$pid}' ORDER BY usort ASC LIMIT 1";
                $set = mysql_query($sql) or die(mysql_error());
                if ($row = mysql_fetch_assoc($set)) {
                    $swap_id = $row['nav_tab_id'];
                    $swap_usort = $row['usort'];
                    $sql = "UPDATE navigation_tab SET admin_id = 'Sort - {$admin_id}', usort = CASE nav_tab_id WHEN {$id} THEN {$swap_usort} WHEN {$swap_id} THEN {$usort} END WHERE nav_tab_id IN ({$id}, {$swap_id})";
                    /*
                                CASE Id
                                WHEN '$id' THEN UPDATE 
                                as t1, info as t2 SET t1.usort = '$swap_usort' WHERE usort WHEN $usort THEN $swap WHEN $swap THEN $usort END WHERE usort IN ($usort, $swap)";
                    */
                } else {
                    $usort++;
                    $sql = "UPDATE navigation_tab SET admin_id = '{$admin_id}', usort = '{$usort}' WHERE nav_tab_id = '{$id}'";
                }
                break;
                // if we're going down, swap is 1 more than id
            // if we're going down, swap is 1 more than id
            case 'up':
                //Check if there is a lower sort order
                $sql = "SELECT nav_tab_id,usort FROM navigation_tab WHERE usort < '{$usort}' AND  parent_id = '{$pid}' ORDER BY usort DESC LIMIT 1";
                $set = mysql_query($sql) or die(mysql_error());
                if ($row = mysql_fetch_assoc($set)) {
                    $swap_id = $row['nav_tab_id'];
                    $swap_usort = $row['usort'];
                    $sql = "UPDATE navigation_tab SET admin_id = 'Sort - {$admin_id}', usort = CASE nav_tab_id WHEN {$id} THEN {$swap_usort} WHEN {$swap_id} THEN {$usort} END WHERE nav_tab_id IN ({$id}, {$swap_id}) ";
                } else {
                    $usort--;
                    $sql = "UPDATE navigation_tab SET admin_id = '{$admin_id}', usort = '{$usort}' WHERE nav_tab_id = '{$id}'";
                }
                break;
                // default value (sql injection prevention for $dir)
            // default value (sql injection prevention for $dir)
            default:
                $swap = $id;
        }
        // end switch $dir
        //die($sql);
        // swap the rows. Basic idea is to make $id=$swap and $swap=$id
        $result = mysql_query($sql) or die(mysql_error());
        $return;
    } else {
        return;
    }
}
开发者ID:BGCX067,项目名称:facebooksurveyom-svn-to-git,代码行数:62,代码来源:vincent.php


注:本文中的GetSetting函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。