app=$app; if($intern) { return; } $this->app->ActionHandlerInit($this); $this->app->ActionHandler("list","ProtokollList"); $this->app->ActionHandler("minidetail","ProtokollMiniDetail"); //$this->app->ActionHandler("delete","ProtokollDelete"); //$this->app->ActionHandler("deleteall","ProtokollDeleteAll"); $this->app->DefaultActionHandler("list"); $this->app->ActionHandlerListen($app); } /** * @param Application $app * @param string $name * @param array $erlaubtevars * * @return array */ public function TableSearch($app, $name, $erlaubtevars) { // in dieses switch alle lokalen Tabellen (diese Live Tabellen mit Suche etc.) für dieses Modul switch($name) { case "protokoll": // START EXTRA checkboxen // ENDE EXTRA checkboxen $allowed['protokoll'] = array('list'); // headings $heading = array('', 'ID', 'Zeit', 'Bearbeiter', 'Module', 'Action', 'Parameter', 'Funktion', 'Meldung', 'Menü'); $width = array('4%', '4%', '15%', '10%', '10%', '10%', '10%', '10%', '40%', '10%', '5%'); $findcols = array('open', 'a.id', 'a.datum', 'a.bearbeiter', 'a.module', 'a.action', 'a.parameter', 'a.funktionsname', 'a.meldung', 'a.id'); $searchsql = array("DATE_FORMAT(a.datum,'%d.%m.%Y %H:%i:%s')", 'a.bearbeiter', 'a.module', 'a.meldung', 'a.action', 'a.parameter', 'a.funktionsname'); $defaultorder = 2; $defaultorderdesc = 1; $menucol = 1; $moreinfo = true; $menu = "
" . "" . "app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\">" . // " ". // "". // "app->Conf->WFconf['defaulttheme']}/images/delete.svg\" border=\"0\">". " |
Argumente der Funktion '.$dump['funktionsname'].':'; echo '
'.base64_decode($dump['argumente']).'
Dump:'.$dump['dump'].''; $this->app->ExitXentral(); } function ProtokollList() { $this->ProtokollMenu(); $this->app->YUI->TableSearch('TAB1','protokoll','show','','',basename(__FILE__), __CLASS__); $this->app->Tpl->Parse('PAGE',"protokoll_list.tpl"); } function ProtokollMenu() { $this->app->erp->Headlines('Protokoll'); $this->app->erp->MenuEintrag('index.php?module=einstellungen&action=list','Zurück zur Übersicht'); $this->app->erp->MenuEintrag('index.php?module=protokoll&action=list','Aktualisieren'); $this->app->erp->RunMenuHook('protokoll'); } public function Install() { $this->app->erp->CheckTable('protokoll'); $this->app->erp->CheckColumn('id','int(11)','protokoll','NOT NULL AUTO_INCREMENT'); $this->app->erp->CheckColumn('meldung','TEXT','protokoll','DEFAULT \'\' NOT NULL'); $this->app->erp->CheckColumn('dump','TEXT','protokoll','DEFAULT \'\' NOT NULL'); $this->app->erp->CheckColumn('module','VARCHAR(64)','protokoll','DEFAULT \'\' NOT NULL'); $this->app->erp->CheckColumn('action','VARCHAR(64)','protokoll','DEFAULT \'\' NOT NULL'); $this->app->erp->CheckColumn('bearbeiter','VARCHAR(64)','protokoll','DEFAULT \'\' NOT NULL'); $this->app->erp->CheckColumn('funktionsname','VARCHAR(64)','protokoll','DEFAULT \'\' NOT NULL'); $this->app->erp->CheckColumn('datum','DATETIME','protokoll'); $this->app->erp->CheckColumn('parameter','int(11)','protokoll','DEFAULT 0 NOT NULL'); $this->app->erp->CheckColumn('argumente','TEXT','protokoll','DEFAULT \'\' NOT NULL'); } /** * @param int $days * @param int $count * * @return array */ public function getModuleStats($days = 90, $count = 10) { return $this->app->DB->SelectPairs( sprintf( "SELECT ms.module, SUM(ms.view_count) AS view_count FROM `module_stat` AS `ms` WHERE created_date > DATE_SUB(CURDATE(), INTERVAL %d DAY) GROUP BY ms.module ORDER BY SUM(ms.view_count) DESC LIMIT %d", $days, $count ) ); } /** * @param string $module * @param string $action */ public function addModuleStat($module = '', $action = '') { if($module=='') { $module = $this->app->Secure->GetGET('module'); } if($action=='') { $action = $this->app->Secure->GetGET('action'); } if(empty($module) || empty($action)) { return; } if(in_array($module, ['welcome','ajax','dateien','wizard'])) { return; } if(in_array($action, ['ajax','getfile','positionen'])) { return; } if($module === 'artikel' && $action === 'thumbnail') { return; } if($module === 'massenbearbeitung' && $action === 'edit') { return; } if($module === 'kalender' && $action === 'data') { return; } $date = date('Y-m-d'); $this->app->DB->Update( sprintf( "UPDATE `module_stat` SET `view_count` = `view_count` + 1 WHERE `module` = '%s' AND `action` = '%s' AND `created_date` = '%s'", $this->app->DB->real_escape_string($module), $this->app->DB->real_escape_string($action), $this->app->DB->real_escape_string($date) ) ); if($this->app->DB->affected_rows() > 0) { return; } $this->app->DB->Insert( sprintf( "INSERT INTO `module_stat` (`module`, `action`, `created_date`, `view_count`) VALUES ('%s', '%s', '%s', 1)", $this->app->DB->real_escape_string($module), $this->app->DB->real_escape_string($action), $this->app->DB->real_escape_string($date) ) ); } public function addProtokoll($meldung='',$dump='',$module='',$action='',$functionname='') { $isEmpty = empty($meldung) && empty($dump) && empty($module) && empty($action) && empty($functionname); $isSecure = isset($this->app->Secure); if($module=='' && $isSecure) { $module = $this->app->Secure->GetGET('module'); } if($action=='' && $isSecure) { $action = $this->app->Secure->GetGET('action'); } if($isEmpty && $isSecure) { $this->addModuleStat(); } $id = 0; if($isSecure){ $id = $this->app->Secure->GetGET('id'); } if($functionname=='') { if (strnatcmp(phpversion(),'5.0.0') >= 0) { $backtrace = debug_backtrace(); $functionname = $backtrace[1]['function']; if($functionname!=='Run'){ $argumente = base64_encode(print_r($backtrace[1]['args'], true)); } } } if(!isset($argumente)) { $argumente = ''; } $this->app->DB->Insert( sprintf( "INSERT INTO protokoll (module,`action`,meldung,dump,datum,bearbeiter,funktionsname,parameter,argumente) VALUES ('%s','%s','%s','%s',NOW(),'%s','%s',%d,'%s')", $module, $action, $meldung, $dump, isset($this->app->User)?$this->app->DB->real_escape_string($this->app->User->GetName()):'', $this->app->DB->real_escape_string($functionname),(int)$id, $argumente ) ); return $this->app->DB->GetInsertID(); } }