public function initView() { //init session $storage = new Zend_Auth_Storage_Session(); $this->session = $storage->read(); if ($this->session) { $this->_me = $this->session; $this->view->user = $this->_me; } $settingsModel = new Settings(); $offset = date('Z') / 60 / 60; $settingsModel->query("SET time_zone = '{$offset}:00'"); $this->view->currentRoute = Zend_Controller_Front::getInstance()->getRouter()->getCurrentRouteName(); $siteSettingsModel = new SiteSettings(); $this->view->siteSettings = $siteSettingsModel->getById(1); $this->init(); }
<?php require 'clibootstrap.php'; $commands = array(); /** Include commands files - must be listed here to be used. **/ $actions = scandir('cliactions'); foreach ($actions as $file) { if ($file != '.' && $file != '..') { include 'cliactions/' . $file; } } //Run function or provide help if (count($argv) > 1) { $settingsModel = new Settings(); $offset = date('Z') / 60 / 60; $settingsModel->query("SET time_zone = '{$offset}:00'"); $argv[1](@$argv[2]); } else { echo "\n[1;33m==============================================\n==============================================\n _____ _ ______ ________ ____\n / ___/ __(_) __/ /_/ ____/ / / _/\n \\__ \\ | /| / / / /_ __/ / / / / / \n ___/ / |/ |/ / / __/ /_/ /___/ /____/ / \n/____/|__/|__/_/_/ \\__/\\____/_____/___/ \n==============================================\n==============================================[0m \n \nZend Framework Command Line Interface \n \n[1;30;32mCLI Command Line Interface for PHP [0m\nAuthor: Brandon Swift 2012\n\n\nTo run a command, type 'php cli.php [commandName]' then hit Enter\n\n\n\nAvailable Methods: \n"; foreach ($commands as $command) { echo "[1;30;32m" . $command['command'] . "[0m - " . $command['description'] . "\n"; } echo "\n\n"; } function makeRed($text) { echo "[31m{$text}[0m"; } function makeGreen($text) { echo "[32m{$text}[0m";
require_once dirname(__FILE__) . '/../../www/config.php'; function handleError($errno, $errstr, $errfile, $errline, array $errcontext) { // error was suppressed with the @-operator if (0 === error_reporting()) { return false; } throw new ErrorException($errstr, 0, $errno, $errfile, $errline); } set_error_handler('handleError'); $regs = array("empty" => "", "illformed" => "[](9()))))))))) [34543/34]", "simple" => '"data.mp3'); $releases = new Releases(); $db = new Settings(); # fetch enabled regular expression $catsql = "select ID,groupname,regex from releaseregex where status = 1"; $res = $db->query($catsql); $total = count($res); $errcnt = 0; echo "\n"; foreach ($res as $regexrow) { foreach ($regs as $regex) { try { $res = preg_match($regexrow["regex"], $regex); } catch (Exception $e) { $errcnt++; $strerr = str_pad((int) $errcnt, 2, " ", STR_PAD_LEFT); echo "{$strerr}. id=" . $regexrow["id"] . ", group=" . $regexrow["groupname"] . "\n"; echo " regex='" . $regexrow["regex"] . "'\n"; echo " error=" . $e->getMessage() . "\n\n"; break; }
<?php require dirname(__FILE__) . "/../bin/config.php"; require_once WWW_DIR . "/lib/framework/db.php"; $db = new Settings(); $rel = $db->query("update releases set passwordstatus = -1 where rarinnerfilecount = 0");