function getData() { global $config; if (!$this->submitted) { return; } $this->ds = array(); $this->errors = array(); $controller =& $config['currentcontroller']; include_once $this->presentationDir . $this->presentationName . '.php'; foreach ($this->elements as $e) { $dFunction = $this->presentationName . '_' . $e['type'] . '_save'; if (is_callable($dFunction)) { $value = $dFunction($e); switch ($e['filter']) { case 'safe': $value = safeName($value); break; } saveValueToArray($this->ds, $e['name'], $value); #$this->ds[$e['name']] = $value; switch ($e['validate']) { case 'notempty': if (trim($value) == '') { $this->errors[$e['name']] = l10n('field.cannotbeempty'); } break; case 'email': require_once 'lib/is_email.php'; if (is_email($value, true, E_WARNING) != ISEMAIL_VALID) { $this->errors[$e['name']] = l10n('field.invalidemail'); } break; } if (!isset($this->errors[$e['name']]) && isset($e['onvalidate'])) { $valid = $e['onvalidate']($value, $e, $this); if (!($valid === true || $valid == '')) { $this->errors[$e['name']] = $valid; } } } } if (isset($this->handlers['receive']) && sizeof($this->errors) == 0) { $this->handlers['receive']($this->ds, $this); } return $this->ds; }
function initController($controllerName) { $controllerName = first($controllerName, cfg('service/defaultcontroller')); $this->controllerName = safeName($controllerName); $this->controllerFile = 'mvc/' . strtolower($this->controllerName) . '/' . strtolower($this->controllerName) . '.controller.php'; if (!file_exists($this->controllerFile)) { header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found"); header('Status: 404 Not Found'); die('File not found at: ' . $_SERVER['REQUEST_URI'] . '<br/>Controller: ' . $this->controllerName); } require_once $this->controllerFile; $this->controllerClassName = $this->controllerName . 'Controller'; $this->controller = o(new $this->controllerClassName($this->controllerName), 'controller'); if (is_callable(array($this->controller, '__init'))) { $this->controller->__init(); } $_REQUEST['controller'] = $this->controllerName; profile_point('H2Dispatcher.initController(' . $this->controllerName . ')'); return $this; }
<body> <table cellspacing='4' cellpadding='4'> <tr> <td align='left' valign='top'> <p>This is <span class='big'>mfp</span> ( Mysql-Flot-PHP ).</p> <p>Written in PHP, <span class='big'>mfp</span> provides easy integration between MySQL and Flot. As you can see to the right if you have javascript enabled, a full range of graph types can be rendered. All rendering is done on the client side, making <span class='big'>mfp</span> ideal for large scale operations.</p> <p>Server requirements are fairly low, a web server with PHP loaded, and the PHP5-MySQL module are the only requirements. Obviously on the client side, a recent browser is required. See <a href='http://code.google.com/p/flot/'>flot</a> for supported browser listings.</p> <p><span class='big'>mfp</span> is licensed under the GNU GPLv3, and is freely available to anyone interested.</p> <p><span class='big'>mfp</span> source is available at the <a href='http://github.com/robertkeizer/mfp/'>github project page</a>.</p> </td> <td align='left'> <?php foreach ($graphArray as $graphName => $graphStuff) { echo "<div class='graphContainer'>\n"; echo "\t<table>\n"; echo "\t<tr>\n"; echo "\t<td class='big'>{$graphName}</td>\n"; echo "\t<td id='" . safeName($graphName) . "_legend' align='right'></td>\n"; echo "\t</tr><tr><td colspan='2'>\n"; echo "\t<div class='graphPlaceholder' id='" . safeName($graphName) . "' style='width:600px; height:100px;'></div>\n"; echo "\t</td></tr></table>\n"; echo "</div>\n"; } ?> </td> <td> </td> </tr> </table> </body> </html>
mfp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with mfp. If not, see <http://www.gnu.org/licenses/>. */ function __autoload($class) { if (file_exists("Class/{$class}.php")) { include "Class/{$class}.php"; } } // The 'a' is required so that the first character is always a letter. function safeName($name) { return "a" . md5($name); } // This is just an example function to show how configs could be cut down. Modification of this function // will modify all the graphs queries. function ExampleGenSql($y, $name) { // The CONCAT for time is used for turning the epoch time into javascript microseconds.. see how flot takes time arguments. // The subtraction of 18000000 is for the timezone, so graph does not appear in GMT. return "SELECT CONCAT(time, \"000-18000000\"), {$y} from machine WHERE name='{$name}' order by time desc limit 360"; } $simpleMysql = new SimpleMysql("host", "user", "pass", "database"); $graphArray = array("Load Average" => array("options" => array("setTimeVar" => "x", "setLegendPosition" => "nw", "setLegendContainer" => safeName("Load Average") . "_legend", "setNumLegendColumns" => 3), "data" => array("Core01" => $simpleMysql->getXYFromTable(ExampleGenSql("loadAverage", "core01")), "Core02" => $simpleMysql->getXYFromTable(ExampleGenSql("loadAverage", "core02")), "NotDesktop" => $simpleMysql->getXYFromTable(ExampleGenSql("loadAverage", "notdesktop")))), "Process count" => array("options" => array("setTimeVar" => "x", "setLegendContainer" => safeName("Process count") . "_legend", "setNumLegendColumns" => 3), "data" => array("Core01" => $simpleMysql->getXYFromTable(ExampleGenSql("processCount", "core01")), "Core02" => $simpleMysql->getXYFromTable(ExampleGenSql("processCount", "core02")), "NotDesktop" => $simpleMysql->getXYFromTable(ExampleGenSql("processCount", "notdesktop")))), "User count" => array("options" => array("setTimeVar" => "x", "setLegendContainer" => safeName("User count") . "_legend", "setNumLegendColumns" => 3), "data" => array("Core01" => $simpleMysql->getXYFromTable(ExampleGenSql("userCount", "core01")), "Core02" => $simpleMysql->getXYFromTable(ExampleGenSql("userCount", "core02")), "NotDesktop" => $simpleMysql->getXYFromTable(ExampleGenSql("userCount", "notdesktop")))), "Load by Process count" => array("options" => array("setLegendPosition" => "nw", "disableLines" => "", "enablePoints" => "", "setLegendContainer" => safeName("Load by Process count") . "_legend", "setNumLegendColumns" => 3), "data" => array("Core01" => $simpleMysql->getXYFromTable("SELECT loadAverage, processCount FROM machine WHERE name='core01' order by time desc limit 360"), "Core02" => $simpleMysql->getXYFromTable("SELECT loadAverage, processCount FROM machine WHERE name='core02' order by time desc limit 360"), "NotDesktop" => $simpleMysql->getXYFromTable("SELECT loadAverage, processCount FROM machine WHERE name='notdesktop' order by time desc limit 360"))));
function h2_getController($controllerName, $isRootController = true) { $controllerName = safeName($controllerName); $controllerFile = 'mvc/' . strtolower($controllerName) . '/' . strtolower($controllerName) . '.controller.php'; if (!file_exists($controllerFile) && $isRootController) { // maybe this is a user URL $entityDS = DB_GetDatasetWQuery('SELECT * FROM ' . getTableName('entities') . ' WHERE user=? AND _local="Y"', array($controllerName)); if (sizeof($entityDS) > 0) { $GLOBALS['msg']['entity'] = HubbubEntity::ds2array($entityDS); $GLOBALS['msg']['touser'] = $controllerName; $controllerName = 'userpage'; $_REQUEST['action'] = 'index'; $controllerFile = 'mvc/' . strtolower($controllerName) . '/' . strtolower($controllerName) . '.controller.php'; } else { header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found"); header('Status: 404 Not Found'); die('File not found: ' . $_SERVER['REQUEST_URI'] . '<br/>' . $controllerName); } } require_once $controllerFile; $controllerClassName = $controllerName . 'Controller'; $thisController = new $controllerClassName($controllerName); if (is_callable(array($thisController, '__init'))) { $thisController->__init(); } $GLOBALS['controllers'][] =& $thisController; if ($isRootController) { $GLOBALS['obj']['controller'] =& $thisController; } return $thisController; }
// $result = preg_replace($find, $replace, $title); $result = preg_replace($find, '', $title); $result = preg_replace('/:/', ' - ', $result); $result = preg_replace('/ +/', ' ', $result); $fileMp3 = $result . ".mp3"; } // print_r($xml); // exit(); global $getShow; foreach ($xml->channel->item as $k => $v) { global $debug, $fileMp3, $summary, $weather; $title = $v->title; $pubDate = $v->pubDate; $description = $v->description; $epoch = strtotime($pubDate); safeName($title); $title = preg_replace('/^[0-9]+ - /', '', $title); // $fileMp3 = $title .".mp3"; if (is_file("{$tank}/{$fileMp3}")) { // print "YES: $tank/$fileMp3\n"; $haveEpisode = TRUE; } else { // print "NO: $tank/$fileMp3\n"; $haveEpisode = FALSE; } $rerun = strpos($title, '(R)'); // if ( $debug == TRUE ) { print "RERUN: ". strpos($title, '(R)') ."\n"; } if ($haveEpisode == FALSE and !$rerun) { print "{$title} - \"{$fileMp3}\"\n"; print "{$epoch} - {$pubDate}\n"; parseInfo($description);