public function myFunction() { log::debug('Starting export', __METHOD__); // Optional: Adding debug-notification to syslog return $this->getApi()->getPlaceholder()->setMethod('bbSomeClass::someMethod')->addParam('param1', true)->addParam('param2', 'string')->addParam('param3', ['a', 'r', 'r', 'y'])->get(); // Send api-call and fetch the result }
/** * Send application/csv-header and starts downloading the csv * * @param string $filename * @return $this * @throws \Exception */ public function sendDownloadCsv($filename = NULL) { $filename = $filename !== NULL ? $filename : 'DomainExport_' . date('ymd') . '_1SRV.csv'; log::info("Download started: {$filename}", __METHOD__); header('Content-Type: text/html; charset=iso-8859-15'); header('Content-Type: application/csv'); header("Content-Disposition: attachment; filename=\"{$filename}\";"); echo utf8_decode($this->getCsv()); return $this; }
/** * Authorizes the given user at the api * * @param $rp2InstanceUrl * @param $rp2ApiUser * @param $rp2ApiPwd * @return bool */ public function auth($rp2InstanceUrl, $rp2ApiUser, $rp2ApiPwd) { $duration = microtime(1); log::debug('Setting RPC-URL', "bbRpc::setUrl({$rp2InstanceUrl})"); bbRpc::setUrl($rp2InstanceUrl); $userId = bbRpc::auth($rp2ApiUser, $rp2ApiPwd); $duration = round(microtime(1) - $duration, 3); if (!$userId) { log::warning("Login failed from " . $_SERVER['REMOTE_ADDR'] . " within {$duration} sec.", "bbRpc::auth({$rp2ApiUser}, *****)", $_SERVER); $this->fetchRpcLog(); return false; } else { // https://doku.premium-admin.eu/doku.php/api/methoden/bbrpc/setutf8native log::info("Login successful from " . $_SERVER['REMOTE_ADDR'] . " within {$duration} sec.", "bbRpc::auth({$rp2ApiUser}, *****)"); $this->fetchRpcLog(); log::debug('Set UTF-8', 'bbRpc::setUTF8Native(true)'); bbRpc::setUTF8Native(true); $this->fetchRpcLog(); return true; } }
/** * DEPRECATED - Don't use any more * @return order */ public function getOrder() { log::debug("Usage of deprecated object 'order'", __METHOD__); return $this->getModule(order::class); }
/** * @todo fix me, seems like I'm broken */ protected function fetchRpcLog() { // I realy don't like the way of fetching RPC-Error-Messages... //$hLoglvl = array("error"=>0, "warn"=>1, "notice"=>2, "ok"=>3, "debug"=>4); global $_BBRPC_Msgs; if (is_array($_BBRPC_Msgs)) { foreach ($_BBRPC_Msgs as $key => &$hMsg) { switch ($hMsg["typ"]) { case 0: module\log::error("RPC-Msg.: {$hMsg}", __METHOD__); break; case 1: module\log::warning("RPC-Msg.: {$hMsg}", __METHOD__); break; case 2: module\log::info("RPC-Msg.: {$hMsg}", __METHOD__); break; case 3: module\log::debug("RPC-Msg.: OK! {$hMsg}", __METHOD__); break; case 4: module\log::debug("RPC-Msg.: {$hMsg}", __METHOD__); break; } unset($_BBRPC_Msgs[$key]); } } }
public function showIndex() { log::debug('Displaying Index-Page', __METHOD__); echo file_get_contents(__DIR__ . '/index/index.tpl'); }
/** * Lets pass all php-errors to our syslog * * @param $errorNumber * @param $errorString * @param $errorFile * @param $errorLine * @return bool */ function errorHandler($errorNumber, $errorString, $errorFile, $errorLine) { showError("Sorry, the script died with a PHP-Error", $errorString . ' in ' . $errorFile . ':' . $errorLine); log::error("PHP-ERROR\n\n!!!!! {$errorString}\n!!!!! {$errorFile}:{$errorLine}\n", __METHOD__, debug_backtrace()); die; }
public function __destruct() { log::debug("Shutdown moduleManager\n\n\n <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n\n", __METHOD__); }