function __construct($TraceURI, $ModelName) { $this->TraceURI = $TraceURI; $this->ModelName = $ModelName; $Trace = new Trace($TraceURI); $this->BaseURI = $Trace->getBaseURI(); //$this->BaseURI="http://ktbs.univ-lyon1.fr/semasema34/"; $this->Obsels = $Trace->getObsels(); //$TraceInfo = RestfulHelper::getInfo($TraceURI); //$this->BaseURI= json_decode($TraceInfo,true)['inBase']; //$ObselListInfo = RestfulHelper::getInfo(json_decode($TraceInfo,true)['hasObselList']); // $this->Obsels = json_decode($ObselListInfo,true)['obsels']; }
function __construct($BaseURI, $TraceName, $TraceSourceName, $ModelURI) { $this->TraceName = $TraceName; $this->BaseURI = $BaseURI; $this->TraceSourceName = $TraceSourceName; $this->TraceURI = $this->BaseURI . $this->TraceName; if ($ModelURI == null) { $trace = new Trace($this->TraceURI); $this->ModelURI = $trace->getModel(); } else { $this->ModelURI = $ModelURI; } }
function handle(Trace $trace) { $controllerName = $trace->getRequiredParameter(self::PARAMETER_CONTROLLER_NAME); $controllerClassName = $this->getControllerClassName($controllerName); if (!class_exists($controllerClassName, true)) { throw new TraceException(sprintf('unknown controller %s', $controllerClassName), $trace); } if (!in_array('IController', class_implements($controllerClassName, true))) { throw new TraceException(sprintf('%s is not a controller due it does not implement IController', $controllerClassName), $trace); } $controllerObject = $this->getControllerInstance($controllerClassName, $trace); $controllerObject->handle($trace); }
protected function checkCredentials(Trace $trace) { if (!$this->clientToken) { $this->clientToken = new ClientToken($trace->getWebContext()->getServer()->getClientHash(true)); $request = $trace->getWebContext()->getRequest(); try { $authkey = $request[self::ADMIN_AUTHORIZED_COOKIE_NAME]; $this->clientToken->getData($authkey); $this->setAdminAuthorized(); } catch (Exception $e) { $this->setAdminNotAuthorized(); } } }
public function fatalErrorHandler() { $error = error_get_last(); $code = $this->getArrayValue($error, "type"); if ($code === E_ERROR) { $message = $error["message"]; $file = $error["file"]; $line = $error["line"]; $traces = []; $trace = new Trace(); $trace->setFile($file); $trace->setLine($line); $traces[] = $trace; $this->log($message, $traces); } }
public static function Show() { $viewName = ""; $includeHeaderAndFooter = true; for ($i = 0; $i < func_num_args(); $i++) { $testArg = func_get_arg($i); if (is_string($testArg) && $i == 0) { $viewName = $testArg; } else { if (is_bool($testArg)) { $includeHeaderAndFooter = $testArg; } else { $_ViewData = $testArg; } } } $callTrace = Trace::GetLastMethodCall(); $viewPath = self::parseViewPath($viewName, $callTrace); if (self::verifyView($viewPath)) { if ($includeHeaderAndFooter) { self::includeHeader(); } include $viewPath; if ($includeHeaderAndFooter) { self::includeFooter(); } } else { Router::UnknownResource(); } }
public function saveImg() { Trace::output($this->traceID, "saveImg"); //---------------------------------------------------------- //init var //---------------------------------------------------------- $chk = array("bool" => 1); //---------------------------------------------------------- $img = str_replace('data:image/png;base64,', '', $this->img); $img = str_replace(' ', '+', $img); $data = base64_decode($img); $date = new DateTime(); //---------------------------------------------------------- if (is_null($imgName) || $encrypt) { $imgName = alphaID($date->getTimestamp()) . ".png"; } //---------------------------------------------------------- if (file_exists($this->dir)) { FileFolder::file_put_contents($this->dir . $imgName, $data); $chk["result"] = $this->fullURL . $imgName; } else { $chk['bool'] = false; $chk['message'] = $this->fullURL . " does no exist!!"; } //---------------------------------------------------------- return $chk; }
function __construct($conf) { Trace::add_trace('construct class', __METHOD__); self::$conf = $conf; self::$conn = new DB($conf); $this->Func = new Func(); }
public function dojetDidStart() { if (MRuntime::currentRuntime() === C_RUNTIME_SAE) { Trace::setDelegate(new LibSAETrace()); } parent::dojetDidStart(); }
public static function getData($file) { Trace::output(self::$traceID, "getData"); //---------------------------------------------------------- //init var //---------------------------------------------------------- $chk = array("bool" => true, 'traceID' => "getData"); //---------------------------------------------------------- $swfheader = new swfheader($file); $file_swf = new File_SWF($file); //---------------------------------------------------------- if ($file_swf->is_valid()) { $stat = $file_swf->stat(); $fileSize = $stat['fileSize'][0]; $swfheader->size = $fileSize; $chk['result'] = $swfheader; } else { $chk['bool'] = false; $chk['error'] = true; $chk['message'] = "swf was no valid"; } //---------------------------------------------------------- $chk['output'] = Trace::$output; //---------------------------------------------------------- return $chk; }
/** Load Dictionary * * @param Array $load - Dictionary array * */ public static function load($load) { Trace::add_trace('construct class', __METHOD__); self::$dic = isset($load['dic']) ? $load['dic'] : array(); self::$hooks = isset($load['js']) ? $load['js'] : array(); self::$lang = isset($load['lang']) ? $load['lang'] : array(); }
public function testExecute() { $instance = new Trace(''); $session = $this->getMock('Pry\\Session', ['getCallStack'], [__FILE__]); $callStack = $this->getMock('Pry\\CallStack', ['getTrace']); $trace = [['class' => 'A', 'type' => '->', 'function' => 'a', 'args' => ['one', 'two'], 'file' => '/a.php', 'line' => 1337], ['function' => 'b', 'args' => ['one'], 'file' => '/b.php', 'line' => 321], ['class' => 'C', 'type' => '::', 'function' => 'c', 'args' => [], 'file' => '/c.php', 'line' => 42]]; $callStack->expects($this->once())->method('getTrace')->will($this->returnValue($trace)); $session->expects($this->once())->method('getCallStack')->will($this->returnValue($callStack)); ob_start(); $status = $instance->execute($session); $actual = ob_get_contents(); ob_end_clean(); $expected = [' A->a($0,$1) /a.php 1337 ', ' b($0) /b.php 321 ', ' C::c() /c.php 42 ', '']; $this->assertTrue($status); $this->assertEquals(implode(PHP_EOL, $expected), $actual); # @TODO check $actual for correct contents }
public function __construct($urlInfo = array()) { parent::__construct(); // if (!empty($urlInfo)) { $this->aUrlInfo = $urlInfo; } $this->addGet('id', 'show'); Trace::addMessage('DB', '<strong>Старт контроллера</strong>'); }
/** * Esta función recibe el tipo de Trace y el mensaje para guardar el registro en la base de datos * @param string $controller * @param string $action * @param int $date * @param int $ip */ public function trace($status, $msg) { $controller = $this->dispatcher->getControllerName(); $action = $this->dispatcher->getActionName(); $date = time(); $ip = $_SERVER['REMOTE_ADDR']; $user = 1; $operation = $controller . '::' . $action; Trace::createTrace($user, $status, $operation, $msg, $date, $ip); }
/** * 记录日志 并且会过滤未经设置的级别 * @param string $message 日志信息 * @param string $level 日志级别 * @param boolean $record 是否强制记录 * @return void */ static function record($message, $level = self::ERR, $record = false) { if ($record || in_array($level, config('LOG_RECORD_LEVEL'))) { $now = date(self::$format); self::$log[] = "{$now} {$level}: {$message}\r\n"; if (config('APP_DEBUG')) { //如果为debug模式的话 loadCore('Trace'); Trace::addLog("{$now} {$level}: {$message}"); } } }
public static function init() { // 设置系统时区 PHP5支持 if (function_exists('date_default_timezone_set')) { date_default_timezone_set(config('DEFAULT_TIMEZONE')); } set_error_handler(array('App', 'appError')); set_exception_handler(array('App', 'appException')); loadCore('Trace'); loadCore('Dispatcher'); Dispatcher::dispatch(); Trace::write(); }
public function test($testId) { Trace::setDisabled(); $test = new extasyTestModel(); $found = $test->get($testId); if ($found) { $test->execute(); $result = array('lastTestDate' => $test->lastTestDate->getValue(), 'testResult' => $test->obj_lastResult->getAdminViewValue()); die(json_encode($result)); } else { throw new Exception('test model not found '); } }
function _insertContents($dirArray, $close = FALSE) { Trace::output($this->traceID, "_insertContents"); //---------------------------------------------------------- //init var //---------------------------------------------------------- $i; $queryString = ""; $chk = array("bool" => true, 'function' => "_insertContents"); //---------------------------------------------------------- //INSERT INTO tbl_name (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9); for ($i = 0; $i < sizeof($dirArray); $i++) { $queryString .= 'CALL insertVideo("' . $dirArray[$i]['path'] . '","' . $dirArray[$i]['title'] . '","' . $dirArray[$i]['hash'] . '","' . $dirArray[$i]['mp4'] . '","' . $dirArray[$i]['thumbnail_url'] . '"); '; } print_r($queryString); //---------------------------------------------------------- //$chk = MySQL::getResult($queryString); //---------------------------------------------------------- return $chk; }
/** * Дополняет sitemap данные данными из таблицы моделей. Если указан параметр $bWidthAdditional также берутся данные для парсинга * * @param $aData array массив данных * @param $bWithAdditional bool подключать ли данные для парсинга */ public static function toPreview($aData, $bWithAdditional = false) { Trace::addMessage('DB', '<b>Старт метода Sitemap_PagesOperations::toPreview</b>'); $aResult = array(); $objectList = self::toObject($aData); foreach ($aData as $key => $row) { if (!isset($objectList[$key])) { continue; } $obj = $objectList[$key]; if (!is_object($obj)) { continue; } $aInsert = $row; if ($bWithAdditional) { $aInsert['additional'] = $objectList[$key]->getPreviewParseData(); } else { $aInsert['document'] = $objectList[$key]->getData(); } $aResult[] = $aInsert; } return $aResult; }
public function sendLink($email, $message, $url) { Trace::output($this->traceID, "sendLink"); //---------------------------------------------------------- //init var //---------------------------------------------------------- $chk = array("bool" => true, "traceID" => "sendLink"); //---------------------------------------------------------- $chk = GenFun::error_CHK($obj); //---------------------------------------------------------- $emailObj = array("emailTo" => $email, 'link' => "http://awwthentic.com/Modules/DOM/uber_src/server/werm/services/Download.php?url={$url}", 'linkTxt' => "Click here to download file.", "message" => $message, "subject" => $subject = $obj['sender'] . " sent you a file!!!"); //---------------------------------------------------------- if ($chk['bool']) { $chk = SendEmail_v0::sendDefault($emailObj); } else { return $chk; } //---------------------------------------------------------- if ($chk['bool']) { $chk['message'] = "Email was successfully sent to {$email}"; } //---------------------------------------------------------- return $chk; }
public static function error_CHK($valueArr, $traceID = NULL) { Trace::output(self::$traceID, "error_CHK"); //---------------------------------------------------------- //init var //---------------------------------------------------------- $chk = $traceID != NULL ? array("bool" => true, "func" => $traceID . ": error_CHK") : array("bool" => true, "func" => ": error_CHK"); //---------------------------------------------------------- $keys = array_keys($valueArr); //---------------------------------------------------------- foreach ($valueArr as $i => $value) { $valueArr[$i] = GenFun::varCHK($valueArr[$i]); if ($valueArr[$i] == NULL || !isset($valueArr[$i]) || empty($valueArr[$i])) { $chk = array_merge($chk, array("bool" => false, "error" => true, "message" => "'" . $i . "' is NULL or is'nt set")); break; } } //---------------------------------------------------------- $chk["valueArr"] = $valueArr; //---------------------------------------------------------- $chk["output"] = Trace::$output; //---------------------------------------------------------- return $chk; }
function __construct($message, Trace $trace) { parent::__construct($message, $trace->getRoute(), $trace->getWebContext()); }
$multi_output->addOutput($aac_output, $format); $video = new Video($example_video_path); $process = $video->saveNonBlocking($multi_output, null, Video::OVERWRITE_EXISTING); $id = $video->getPortableId(); $_SESSION['process_id_multiple'] = $id; echo '<h1>Process ID</h1>'; Trace::vars($id); echo '<h1>Executed Command</h1>'; Trace::vars($process->getExecutedCommand()); echo '<meta http-equiv="refresh" content="1; url=?' . time() . '">'; exit; } catch (FfmpegProcessOutputException $e) { echo '<h1>Error</h1>'; Trace::vars($e); $process = $video->getProcess(); if ($process->isCompleted()) { echo '<hr /><h2>Executed Command</h2>'; Trace::vars($process->getExecutedCommand()); echo '<hr /><h2>FFmpeg Process Messages</h2>'; Trace::vars($process->getMessages()); echo '<hr /><h2>Buffer Output</h2>'; Trace::vars($process->getBuffer(true)); } echo '<a href="?reset=1">Reset Process</a>'; } catch (Exception $e) { echo '<h1>Error</h1>'; Trace::vars($e->getMessage()); echo '<h2>Exception</h2>'; Trace::vars($e); echo '<a href="?reset=1">Reset Process</a>'; }
namespace PHPVideoToolkit; include_once './includes/bootstrap.php'; $ffmpeg = new FfmpegParser(); $is_available = $ffmpeg->isAvailable(); Trace::vars('$ffmpeg->isAvailable()', $is_available); $ffmpeg_version = $ffmpeg->getVersion(); Trace::vars('$ffmpeg->getVersion()', $ffmpeg_version); $has_ffmpeg_php_support = $ffmpeg->hasFfmpegPhpSupport(); Trace::vars('$ffmpeg->hasFfmpegPhpSupport()', $has_ffmpeg_php_support); $basic_ffmpeg_information = $ffmpeg->getFfmpegData(); Trace::vars('$ffmpeg->getFfmpegData()', $basic_ffmpeg_information); $basic_ffmpeg_information = $ffmpeg->getCommands(); Trace::vars('$ffmpeg->getCommands()', $basic_ffmpeg_information); $ffmpeg_formats = $ffmpeg->getFormats(); Trace::vars('$ffmpeg->getFormats()', $ffmpeg_formats); $ffmpeg_audio_codecs = $ffmpeg->getCodecs('audio'); Trace::vars('$ffmpeg->getCodecs(\'audio\')', $ffmpeg_audio_codecs); $ffmpeg_video_codecs = $ffmpeg->getCodecs('video'); Trace::vars('$ffmpeg->getCodecs(\'video\')', $ffmpeg_video_codecs); $ffmpeg_subtitle_codecs = $ffmpeg->getCodecs('subtitle'); Trace::vars('$ffmpeg->getCodecs(\'subtitle\')', $ffmpeg_subtitle_codecs); $ffmpeg_bitstream_filters = $ffmpeg->getBitstreamFilters(); Trace::vars('$ffmpeg->getBitstreamFilters()', $ffmpeg_bitstream_filters); $ffmpeg_filters = $ffmpeg->getFilters(); Trace::vars('$ffmpeg->getFilters()', $ffmpeg_filters); $ffmpeg_protocols = $ffmpeg->getProtocols(); Trace::vars('$ffmpeg->getProtocols()', $ffmpeg_protocols); $ffmpeg_pixel_formats = $ffmpeg->getPixelFormats(); Trace::vars('$ffmpeg->getPixelFormats()', $ffmpeg_pixel_formats);
public function changePassword($hash, $password) { Trace::output($this->traceID, "changePassword"); //---------------------------------------------------------- $chk = GenFun::error_chk(array($hash, $password)); //---------------------------------------------------------- $this->tblName = ForgotPwRequest_const::TBL; //---------------------------------------------------------- //init var //---------------------------------------------------------- $chk = array("bool" => true, "traceID" => "changePassword"); //---------------------------------------------------------- $chk = $this->getAccountRow($hash); //---------------------------------------------------------- if (!$chk['bool']) { return $chk; } //---------------------------------------------------------- if ($chk['result'][0]['confirmed'] == 1) { $chk['bool'] = false; } //---------------------------------------------------------- if (sizeof($chk['result']) != 0 && $chk['bool']) { $chk = Update::go(Accounts_const::TBL, array("password" => GenFun::encrypt($password . $this->salt)), array("id" => $chk['result'][0]['accounts_id'])); $chk = $this->confirm($hash, "forgotPwRequest"); } else { $chk['bool'] = false; $chk['message'] = "This link has been disabled!!!"; } //---------------------------------------------------------- if ($chk['bool']) { $chk['message'] = "Password Updated!!!"; } //---------------------------------------------------------- return $chk; }
public static function insertFile($name, $uploadResult = NULL) { Trace::output(self::$traceID, "insertFile", func_get_args()); //---------------------------------------------------------- //init var //---------------------------------------------------------- $chk = array("bool" => true, 'result' => array(), "func" => "insertFile"); $date = date("Y-m-d H:i:s"); //---------------------------------------------------------- if (!$chk['bool']) { return $chk; } else { $chk = InsertINTO::go("files", array('name' => $name, "hash" => '{hash}' . $date, "uploadResult" => $uploadResult), array("returnRow" => true, "resetQueries" => true)); } //---------------------------------------------------------- return $chk; }
private function _updateMessages($updateArr, $approve, $close = FALSE) { Trace::output($this->traceID, "_updateMessages"); //---------------------------------------------------------- //init var //---------------------------------------------------------- $i; $queryString = ""; $chk = array("bool" => true, 'function' => "updateMessages"); //---------------------------------------------------------- $queryString .= "UPDATE " . GuestbookConst_v0::TBL_MESSAGES . " "; $queryString .= "SET " . GuestbookConst_v0::CLM_APPROVED . " = " . $approve . " "; $queryString .= "WHERE " . GuestbookConst_v0::CLM_ID . " IN ("; //---------------------------------------------------------- for ($i = 0; $i < sizeof($updateArr); $i++) { if ($i == 0) { $queryString .= $updateArr[$i]["id"]; } else { $queryString .= ","; $queryString .= $updateArr[$i]["id"]; } } //---------------------------------------------------------- $queryString .= ")"; //---------------------------------------------------------- $result = GlobalMas::$mysqli->query($queryString); //---------------------------------------------------------- $chk['query'] = $queryString; //---------------------------------------------------------- if (sizeof($result) < 0) { $chk["bool"] = false; $chk["result"] = "queryString did not go through"; } else { $chk["bool"] = true; $chk["result"] = "rows have been updated"; } $chk["approve"] = $approve; //---------------------------------------------------------- if ($close) { GlobalMas::$mysqli->close($this->conn); } //---------------------------------------------------------- $chk['output'] = Trace::$output; //---------------------------------------------------------- return $chk; }
private function _query($sql) { Trace::addLog($sql); $result = mysql_query($sql, $this->_link) or throwException("error sql: {$sql}. \t " . mysql_error($this->_link)); return $result; }
public function replyAction() { return; try { $globalContext = new \Sb\Context\Model\Context(); $messageId = ArrayHelper::getSafeFromArray($_GET, 'mid', null); $redirect = false; if ($messageId) { $message = MessageDao::getInstance()->get($messageId); $this->view->message = $message; if ($message->getRecipient()->getId() != $globalContext->getConnectedUser()->getId()) { Flash::addItem(__("Vous ne pouvez pas répondre à ce message car il ne vous est pas destiné.", "s1b")); $redirect = true; } } else { Flash::addItem(__("Le message auquel vous tentez de répondre n'existe pas.", "s1b")); $redirect = true; } if ($_POST) { $title = htmlspecialchars($_POST['Title']); $messageContent = htmlspecialchars($_POST['Message']); /* test if form is not empty */ if (!empty($title) && !empty($messageContent)) { // create new message in db $reply = new Message(); $reply->setRecipient($message->getSender()); $replySender = $globalContext->getConnectedUser(); $reply->setSender($replySender); $reply->setDate(new \DateTime()); $reply->setTitle($title); $reply->setMessage($messageContent); $reply->setIs_read(false); MessageDao::getInstance()->add($reply); if ($message->getSender()->getSetting()->getEmailMe() == 'Yes') { // send a email to warn the origianl sender of the email $body = MailHelper::newMessageArrivedBody($replySender->getUserName()); MailSvc::getInstance()->send($message->getSender()->getEmail(), sprintf(__("Un message vous a été envoyé depuis le site %s", "s1b"), Constants::SITENAME), $body); } Flash::addItem(__("Message envoyé.", "s1b")); $redirect = true; } else { Flash::addItem(__("Vous devez renseigné le titre et le contenu du message.", "s1b")); } } if ($redirect) { HTTPHelper::redirect(Urls::USER_MAILBOX); } } catch (\Exception $e) { Trace::addItem(sprintf("Une erreur s'est produite dans \"%s->%s\", TRACE : %s\"", get_class(), __FUNCTION__, $e->getTraceAsString())); $this->forward("error", "error", "default"); } }
$paths = array(); foreach ($output as $obj) { array_push($paths, $obj->getMediaPath()); } Trace::vars($paths); } catch (FfmpegProcessOutputException $e) { echo '<h1>Error</h1>'; Trace::vars($e); $process = $video->getProcess(); if ($process->isCompleted()) { echo '<hr /><h2>Executed Command</h2>'; Trace::vars($process->getExecutedCommand()); echo '<h1>Executed Command RAW</h1>'; Trace::vars($process->getExecutedCommand(true)); echo '<hr /><h2>FFmpeg Process Messages</h2>'; Trace::vars($process->getMessages()); echo '<hr /><h2>Buffer Output</h2>'; Trace::vars($process->getBuffer(true)); } } catch (Exception $e) { echo '<h1>Error</h1>'; Trace::vars($e->getMessage()); echo '<h2>Exception</h2>'; Trace::vars($e); if ($process) { echo '<hr /><h2>Executed Command</h2>'; Trace::vars($process->getExecutedCommand()); echo '<h1>Executed Command RAW</h1>'; Trace::vars($process->getExecutedCommand(true)); } }