public function flagAsPaid($itemExpenseId) { Debug::log('Flagging as paid...'); $data = array('isFullyPaid' => 1); $this->db->update('ItemExpense', $data, array('itemExpenseId' => $itemExpenseId)); Debug::log($this->db->last_query()); }
public function execute($arrParams = null) { // echo 'EXECUTING <Pre>'; // print_r($this); // print_r($arrParams); // echo '</pre>'; // echo '<pre>'; // print_r( debug_backtrace()) ; // echo '</pre>'; $start = $this->microtime_float(); $objRes = $this->statement->execute($arrParams); $time = $this->microtime_float() - $start; if (!in_array($this->statement->queryString, self::$arrAlreadyLogged)) { $strClass = 'unknown'; $strMethod = 'unknown'; $arrDebug = debug_backtrace(); if (!empty($arrDebug[1])) { $strClass = $arrDebug[1]['class']; $strMethod = $arrDebug[1]['function']; } unset($arrDebug); $strDebugString = sprintf("%s \n\tfrom %s::%s() \n\ttime: <span style='color:red;'>%s s.</span>\n", $this->statement->queryString, $strClass, $strMethod, $time); Debug::log($strDebugString, 'db-stmt-execute'); self::$arrAlreadyLogged[] = $this->statement->queryString; } return $objRes; }
function __construct() { Debug::log("Running", __LINE__, __FUNCTION__, __CLASS__, __FILE__); //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - self::$debug = new Debug(); self::$benchmark = new Benchmark(); self::$benchmark->mark("Run/Inicio"); $this->startBasicConfig(); self::$control = new Control(); self::$model = new Model(); self::$view = new View(); self::$session = new Session(); self::$cookie = new Cookie(); self::$properties = new Properties(); self::$language = new Language(); self::$json = new FastJSON(); self::$ajaxMethod = new AjaxMethod(); self::$action = new Action(); self::$benchmark->writeMark("Run/Inicio", "Run/Classes Instanciadas"); //é 0.003 mais rápido carregar td de uma vez //$this->startExtrasClasses(); //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if (Run::USE_ROUTER) { self::$benchmark->mark("USE_ROUTER/Inicio"); self::$router = new Router(); self::$router->startRouter(); $this->autoExecute(); self::$router->startLoadContent(); self::$benchmark->mark("USE_ROUTER/Final"); } else { $this->autoExecute(); } self::$benchmark->writeMark("Run/Inicio", "Run/Final"); }
function __construct() { Debug::log("Iniciando Core/log/Benchmark.", __LINE__, __FUNCTION__, __CLASS__, __FILE__); if (isset($_GET['benchmark'])) { Run::$DEBUG_BENCHMARK = true; } }
function __construct($settings, $id = 0) { Debug::log("Iniciando Core/Form/token.", __LINE__, __FUNCTION__, __CLASS__, __FILE__); $this->tokenId = $id; Debug::p("tokenId", $this->tokenId); $this->settings = $settings; }
public static function process() { // response object is a singleton $response = self::getResponse(); if ($_POST) { $todo = Utils::arrayValue('arlClass', $_POST); self::$request =& $_POST; } else { $todo = Utils::arrayValue('arlClass', $_GET); self::$request =& $_GET; } if ($todo == 'keepalive') { // noop $response->obj['success'] = 1; } else { self::runProcess($todo); } Debug::log("!! Response object:", $response); // if debugging, call fatal() if (Utils::arrayValue('debug', self::$request)) { Debug::fatal("Exited as debugging requested"); } // send response and exit; $response->send(); }
public static function assertEqual($expression1, $expression2) { Debug::log('ASSERT EQUAL', $expression1 == $expression2); if ($expression1 != $expression2) { self::$failsNumber++; } }
function cleanData($model) { Debug::log("Iniciando Core/Form/cleanData.", __LINE__, __FUNCTION__, __CLASS__, __FILE__); $this->model = $model; $this->checkCleanData(); $this->checkRecoverData(); }
public function fetchPayablesList($showFilter = self::FILTER_ACTIVE, $fromDate = null, $toDate = null, $supplierId = null) { $this->db->select('ie.*, s.supplierId, s.name as supplierName, i.itemId, i.description as itemDescription, i.productCode as itemProductCode')->from('ItemExpense ie')->join('Supplier s', 'ie.supplierId=s.supplierId', 'left')->join('Item i', 'i.itemId = ie.itemId')->where('ie.isCredit = 1'); switch ($showFilter) { case self::FILTER_PAID: $this->db->where('ie.isFullyPaid = 1'); break; default: $this->db->where('ie.isFullyPaid = 0'); break; } if (!empty($fromDate) && !empty($toDate)) { $this->db->where('DATE(ie.dateAdded) >= ', $fromDate); $this->db->where('DATE(ie.dateAdded) <= ', $toDate); } elseif (!empty($fromDate) && empty($toDate)) { $this->db->where('DATE(ie.dateAdded) >= ', $fromDate); $this->db->where('DATE(ie.dateAdded) <= ', date('Y-m-d')); } elseif (empty($fromDate) && !empty($toDate)) { $this->db->where('DATE(ie.dateAdded) <= ', $toDate); } if (!empty($supplierId)) { $this->db->where('ie.supplierId', $supplierId); } $query = $this->db->get(); Debug::log($this->db->last_query()); return $query->result_array(); }
function handleError($e, $msgForLog) { $msg = $e . $msgForLog; echo $msg; Debug::log($msg); die; }
public function insert() { Debug::log($this); $this->_checkArgs(); $this->db->insert($this->_name, $this); return $this->db->insert_id(); }
function __construct() { //Run::$DEBUG_PRINT = true; Debug::log("Iniciando Core/Debug.", __LINE__, __FUNCTION__, __CLASS__, __FILE__); if (isset($_GET['debug-print'])) { Run::$DEBUG_PRINT = true; } }
public function fetchTotalSales($date) { $this->db->select('SUM(totalPrice) as total')->from('SalesTransaction')->where('DATE(transactionDate)', $date); $query = $this->db->get(); Debug::log($this->db->last_query()); $result = $query->row_array(); return $result['total']; }
public function getTotalExpense($date) { $this->db->select('SUM(price) as total')->from('OtherExpense')->where('DATE(dateAdded)', $date); $query = $this->db->get(); Debug::log($this->db->last_query()); $result = $query->row_array(); return $result['total']; }
function fetchLowInStock() { $this->db->select('s.*, sum(quantity) as totalQuantity, i.*')->from('Stock s')->join('Item i', 's.itemId = i.itemId')->group_by('s.itemId')->having('totalQuantity < ' . self::LOW_STOCK_QUANTITY_THRESHOLD); $query = $this->db->get(); $results = $query->result_array(); Debug::log($this->db->last_query()); Debug::log($results); return $results; }
static function bt($s) { $bt = debug_backtrace(); $msg = array(); foreach ($bt as $l => $i) { $msg[] = array($i['file'], $i['line'], $i['class'] . '::' . $i['function']); } Debug::log($msg); }
function MailSender($mailManager = null) { Debug::log("Iniciando MailManager/MailSender.", __LINE__, __FUNCTION__, __CLASS__, __FILE__); if (!$mailManager) { $mailManager = new mailManager(); } $this->mailManager = $mailManager; return $this; }
function __construct() { //----------------------------------------------------------------------------------------------- $this->getAreas(); $this->checkAreas(); $this->setHtmlMail(); //----------------------------------------------------------------------------------------------- Debug::log("Finalizando configuração do template.", __LINE__, __FUNCTION__, __CLASS__, __FILE__); }
function __construct() { Debug::log("Iniciando Core/Control.", __LINE__, __FUNCTION__, __CLASS__, __FILE__); $this->date = new Date(); $this->data = new Data(); $this->protect = new Protect(); $this->string = new String(); $this->file = new File(); }
function handleError($e, $msgForLog) { $msg = $e . $msgForLog; if ($this->mailer->SMTPDebug > 0) { echo $msg; } Debug::log($msg); die; }
function MailManager($mailIndex = 0, $connectionID = "") { Debug::log("Iniciando Helper/MailManager.", __LINE__, __FUNCTION__, __CLASS__, __FILE__); $this->getMailProperties($mailIndex); $this->send_prefix = "sender_" . $mailIndex . "_"; $this->connectionID = $connectionID; $this->sender = new MailSender($this); return $this; }
public function run() { global $config; $new_yaml = \Symfony\Component\Yaml\Yaml::dump($config, 5, 4); \Debug::log($new_yaml); //file_put_contents($this->container->get('kernel')->getRootDir() . '/config/common.yml', $new_yaml); $view = $this->template->render($this->arrayTemplate); $this->response->setContent($view); $this->response->send(); }
public static function launch($strBoardName, $strBoardMethod = 'index') { $strBoardFullPath = sprintf('%s\\board\\%s', Application::getInstance()->strApplicationClassesPrefix, $strBoardName); Debug::log('Loading board ' . $strBoardFullPath . '->' . $strBoardMethod . '()', 'core-board'); $objSpecifiedBoard = new $strBoardFullPath(); $objBoardMethod = new \ReflectionMethod($strBoardFullPath, $strBoardMethod); $arrRequestParams = Request::getParams(); $objResponse = $objBoardMethod->invokeArgs($objSpecifiedBoard, $arrRequestParams); return $objResponse; }
public function log($level, $message, array $context = array()) { \Debug::log(array('level' => $level, 'message' => $message, 'context' => $context)); if (in_array($level, static::$logLevelsWrite)) { file_put_contents(static::$logPath, date('Y-m-d H:i:s') . " [{$level}] {$message}\n\t" . "context: " . trim(str_replace(PHP_EOL, "\n\t", print_r($context, true))) . "\n" . "\tbacktrace:\n\t\t" . implode("\n\t\t", static::buildBacktraceLines()) . "\n\n", FILE_APPEND); } if (in_array($level, static::$logLevelsEmail)) { \Emergence\Mailer\Mailer::send(\Site::$webmasterEmail, "{$level} logged on {$_SERVER['HTTP_HOST']}", '<dl>' . '<dt>Timestamp</dt><dd>' . date('Y-m-d H:i:s') . '</dd>' . '<dt>Level</dt><dd>' . $level . '</dd>' . '<dt>Message</dt><dd>' . htmlspecialchars($message) . '</dd>' . '<dt>Context</dt><dd><pre>' . htmlspecialchars(print_r($context, true)) . '</pre></dd>' . '<dt>Context</dt><dd><pre>' . htmlspecialchars(implode("\n", static::buildBacktraceLines())) . '</pre></dd>'); } }
public function fetchById($id) { if (empty($id)) { return null; } $idCol = lcfirst($this->_name) . 'Id'; $query = $this->db->get_where($this->_name, array($idCol => (int) $id)); Debug::log($this->db->last_query()); return $query->row_array(); }
public static function postcondition($callingFunction, $description, $test) { Debug::startTimer('postcondition'); $test = $test == true ? 'true' : 'false'; Debug::log($callingFunction, 'Postcondition test - ' . $description . ' : ' . $test); if ($test === 'false') { throw new PostconditionException($description . ' : ' . $test, 3); } Debug::stopTimer('postcondition'); }
public static function GetLocation() { if ($ip = self::IPAddress()) { Debug::log('IP Address : ' . $ip); $ipNumber = self::IPType($ip) == 'ipv4' ? self::IPAddressToIPNumber($ip) : self::IPV6AddressToIPNumber($ip); $parse = IpParser::get(self::GetProvider()); return $parse->getLocation($ip, $ipNumber); } return null; }
public function fetchSuppliersForItem($itemId) { if (!$itemId) { throw new InvalidArgumentException('ItemId must be supplied.'); } $this->db->select('s.*, ie.discount, ie.price')->from('ItemExpense ie')->join('Supplier s', 's.supplierId = ie.supplierId', 'left')->where('ie.ItemId', (int) $itemId)->where('ie.supplierId IS NOT NULL')->group_by(array('ie.supplierId', 'ie.discount'))->order_by('ie.supplierId')->order_by('ie.discount DESC'); $query = $this->db->get(); Debug::log($this->db->last_query()); $results = $query->result_array(); return $results; }
public function fetchByCriteria($where) { if (empty($where)) { throw new InvalidArgumentException('Where condition is required'); } $this->db->select('*')->from($this->_name)->where($where); $query = $this->db->get(); $results = $query->result_array(); Debug::log($this->db->last_query()); return $results; }
public function onConnected($connId, $ip, $port) { Debug::log(get_class($this) . '::' . __METHOD__ . '(' . $connId . ') invoked. '); $this->setConnSocketSession($connId, new memcacheClientSession($this)); $url = $this->connSocketSessionPool[$connId]->url = $this->connetingPool[$connId]['url']; $this->servConn[$url][$connId] = $connId; if (isset($this->connetingPool[$connId]['cb'])) { call_user_func($this->connetingPool[$connId]['cb'], $this->connSocketSessionPool[$connId]); unset($this->connetingPool[$connId]); } }