/** * Renders the list of available packages or any other kind of gui-representation * of the packageprovider. * * Whenever the provider is capable of uploading new packages, the copy & and upload process * should be triggered by the admin-class again. * So make sure links or forms point to * module = packagemanager * action = uploadPackage * provider = class_name * The provider will be called using the processPackageUpload method. * * @throws class_exception * @return string */ public function renderPackageList() { $objUser = new class_module_user_user(class_session::getInstance()->getUserID()); $intStart = ($this->getPageNumber() - 1) * $objUser->getIntItemsPerPage(); $intEnd = $intStart + $objUser->getIntItemsPerPage() - 1; $objToolkit = class_carrier::getInstance()->getObjToolkit("admin"); $objLang = class_carrier::getInstance()->getObjLang(); $objManager = new class_module_packagemanager_manager(); $objRemoteloader = $this->getRemoteloader(); $objRemoteloader->setStrQueryParams($this->buildQueryParams($intStart, $intEnd)); $strResponse = ""; try { $strResponse = $objRemoteloader->getRemoteContent(); } catch (class_exception $objEx) { return $objLang->getLang("package_remote_errorloading", self::$STR_MODULE_NAME); } $arrResponse = json_decode($strResponse, true); if ($arrResponse === null) { throw new class_exception("Error loading the remote package list. Got: <br />" . htmlToString($strResponse, true), class_exception::$level_ERROR); } $objRemoteParser = class_module_packagemanager_remoteparser_factory::getRemoteParser($arrResponse, $this->getPageNumber(), $intStart, $intEnd, get_class($this), "&name=" . urlencode($this->getParam("name")) . "&type=" . $this->getParam("type")); $arrPackages = $objRemoteParser->getArrPackages(); $strReturn = $this->createFilterCriteria(); $strReturn .= $objToolkit->listHeader(); if (!$this->containsItems($arrPackages)) { $strReturn .= $objToolkit->getTextRow($objLang->getLang("commons_list_empty", null)); } else { $intI = 0; foreach ($arrPackages as $arrOnePackage) { //check if already installed locally if ($objManager->getPackage($arrOnePackage["title"]) !== null) { $strAction = $objToolkit->listButton(getImageAdmin("icon_installDisabled", $objLang->getLang("package_noinstall_installed", self::$STR_MODULE_NAME))); } else { $strAction = $objToolkit->listButton(getLinkAdmin(self::$STR_MODULE_NAME, "uploadPackage", "provider=" . get_class($this) . "&systemid=" . $arrOnePackage["systemid"], $objLang->getLang("package_install", self::$STR_MODULE_NAME), $objLang->getLang("package_install", self::$STR_MODULE_NAME), "icon_install")); } $strIcon = "icon_module"; if ($arrOnePackage["type"] == "TEMPLATE") { $strIcon = "icon_dot"; } $arrOnePackage["version"] = $objLang->getLang("type_" . $arrOnePackage["type"], self::$STR_MODULE_NAME) . ", V " . $arrOnePackage["version"]; $strReturn .= $objToolkit->genericAdminList($arrOnePackage["systemid"], $arrOnePackage["title"], getImageAdmin($strIcon), $strAction, $intI++, $arrOnePackage["version"], $arrOnePackage["description"]); } } $strReturn .= $objToolkit->listFooter(); $strReturn .= $objRemoteParser->paginationFooter(); return $strReturn; }
/** * Returns the pages and their hits * * @return mixed */ public function getTopPages() { $objUser = new class_module_user_user(class_session::getInstance()->getUserID()); $strQuery = "SELECT stats_page as name, count(*) as anzahl, stats_language as language\n\t\t\t\t\t\tFROM " . _dbprefix_ . "stats_data\n\t\t\t\t\t\tWHERE stats_date > ?\n\t\t\t\t\t\t\t\tAND stats_date <= ?\n\t\t\t\t\t\tGROUP BY stats_page, stats_language\n\t\t\t\t\t\t\tORDER BY anzahl desc"; return $this->objDB->getPArray($strQuery, array($this->intDateStart, $this->intDateEnd), 0, $objUser->getIntItemsPerPage() - 1); }
/** * @param bool $intStart * @param bool $intEnd * * @return array */ private function getTopQueries($intStart = false, $intEnd = false) { $objUser = new class_module_user_user(class_session::getInstance()->getUserID()); $strQuery = "SELECT search_log_query, COUNT(*) as hits\n\t\t\t\t\t FROM " . _dbprefix_ . "search_log\n\t\t\t\t\t WHERE search_log_date > ?\n\t\t\t\t\t AND search_log_date <= ?\n\t\t\t\t GROUP BY search_log_query\n\t\t\t\t ORDER BY hits DESC"; if ($intStart !== false && $intEnd !== false) { $arrReturn = $this->objDB->getPArray($strQuery, array($this->intDateStart, $this->intDateEnd), $intStart, $intEnd); } else { $arrReturn = $this->objDB->getPArray($strQuery, array($this->intDateStart, $this->intDateEnd), 0, $objUser->getIntItemsPerPage() - 1); } return $arrReturn; }
/** * @return string */ public function getReport() { $strReturn = ""; //Create Data-table $arrHeader = array(); $arrValues = array(); //Fetch data $arrStats = $this->getTopQueries(); //calc a few values $intSum = 0; foreach ($arrStats as $intHits) { $intSum += $intHits; } $intI = 0; $objUser = new class_module_user_user(class_session::getInstance()->getUserID()); foreach ($arrStats as $strKey => $intHits) { //Escape? if ($intI >= $objUser->getIntItemsPerPage()) { break; } $arrValues[$intI] = array(); $arrValues[$intI][] = $intI + 1; $arrValues[$intI][] = $strKey; $arrValues[$intI][] = $intHits; $arrValues[$intI][] = $this->objToolkit->percentBeam($intHits / $intSum * 100); $intI++; } //HeaderRow $arrHeader[] = "#"; $arrHeader[] = $this->objTexts->getLang("top_query_titel", "stats"); $arrHeader[] = $this->objTexts->getLang("top_query_gewicht", "stats"); $arrHeader[] = $this->objTexts->getLang("anteil", "stats"); $strReturn .= $this->objToolkit->dataTable($arrHeader, $arrValues); return $strReturn; }
/** * Constructor * * @param $arrElements * * @return \class_array_iterator */ public function __construct($arrElements) { $objUser = new class_module_user_user(class_session::getInstance()->getUserID()); $this->intElementsPerPage = $objUser->getIntItemsPerPage(); $this->setArrElements($arrElements); }
/** * @return string */ public function getReport() { $strReturn = ""; //Create Data-table $arrHeader = array(); $arrValues = array(); //Fetch data $arrStats = $this->getTopVisitors(); //calc a few values $intSum = 0; foreach ($arrStats as $arrOneStat) { $intSum += $arrOneStat["anzahl"]; } $intI = 0; $objUser = new class_module_user_user(class_session::getInstance()->getUserID()); foreach ($arrStats as $arrOneStat) { //Escape? if ($intI >= $objUser->getIntItemsPerPage()) { break; } $arrValues[$intI] = array(); $arrValues[$intI][] = $intI + 1; if ($arrOneStat["stats_hostname"] != "" and $arrOneStat["stats_hostname"] != "na") { $arrValues[$intI][] = $arrOneStat["stats_hostname"]; } else { $arrValues[$intI][] = $arrOneStat["stats_ip"]; } $arrValues[$intI][] = $arrOneStat["anzahl"]; $arrValues[$intI][] = $this->objToolkit->percentBeam($arrOneStat["anzahl"] / $intSum * 100); $strUtraceLinkMap = "href=\"http://www.utrace.de/ip-adresse/" . $arrOneStat["stats_ip"] . "\" target=\"_blank\""; $strUtraceLinkText = "href=\"http://www.utrace.de/whois/" . $arrOneStat["stats_ip"] . "\" target=\"_blank\""; if ($arrOneStat["stats_ip"] != "127.0.0.1" && $arrOneStat["stats_ip"] != "::1") { $arrValues[$intI][] = class_link::getLinkAdminManual($strUtraceLinkMap, "", $this->objLang->getLang("login_utrace_showmap", "user"), "icon_earth") . " " . class_link::getLinkAdminManual($strUtraceLinkText, "", $this->objLang->getLang("login_utrace_showtext", "user"), "icon_text"); } else { $arrValues[$intI][] = getImageAdmin("icon_earthDisabled", $this->objLang->getLang("login_utrace_noinfo", "user")) . " " . getImageAdmin("icon_textDisabled", $this->objLang->getLang("login_utrace_noinfo", "user")); } $intI++; } //HeaderRow $arrHeader[] = "#"; $arrHeader[] = $this->objLang->getLang("top_visitor_titel", "stats"); $arrHeader[] = $this->objLang->getLang("commons_hits_header", "stats"); $arrHeader[] = $this->objLang->getLang("anteil", "stats"); $arrHeader[] = $this->objLang->getLang("login_utrace", "user"); $strReturn .= $this->objToolkit->dataTable($arrHeader, $arrValues); $strReturn .= $this->objToolkit->getTextRow($this->objLang->getLang("stats_hint_task", "stats")); return $strReturn; }
/** * @return string */ public function getReport() { $strReturn = ""; $arrData = $this->getTotalUniqueHostsInInterval(); $arrLogs = array(); $intI = 0; $objUser = new class_module_user_user(class_session::getInstance()->getUserID()); foreach ($arrData as $arrOneLog) { if ($intI++ >= $objUser->getIntItemsPerPage()) { break; } $arrLogs[$intI][0] = $intI; $arrLogs[$intI][1] = $arrOneLog["log_hostname"]; $arrLogs[$intI][2] = $arrOneLog["anzahl"]; } //Create a data-table $arrHeader = array(); $arrHeader[0] = "#"; $arrHeader[1] = $this->objLang->getLang("packageservertopqueries_header_host", "packageserver"); $arrHeader[2] = $this->objLang->getLang("packageservertopqueries_header_requests", "packageserver"); $strReturn .= $this->objToolkit->dataTable($arrHeader, $arrLogs); return $strReturn; }
/** * Loads the records of the dl-logbook * * @return mixed */ private function getLogbookData() { $objUser = new class_module_user_user(class_session::getInstance()->getUserID()); $strQuery = "SELECT *\n\t\t\t\t\t FROM " . _dbprefix_ . "mediamanager_dllog\n\t\t\t\t\t WHERE downloads_log_date > ?\n\t\t\t\t\t\t\tAND downloads_log_date <= ?\n\t\t\t\t\t ORDER BY downloads_log_date DESC"; $arrReturn = $this->objDB->getPArray($strQuery, array($this->intDateStart, $this->intDateEnd), 0, $objUser->getIntItemsPerPage() - 1); foreach ($arrReturn as &$arrOneRow) { //Load hostname, if available. faster, then mergin per LEFT JOIN $arrOneRow["stats_hostname"] = null; $strQuery = "SELECT stats_hostname\n \t\t FROM " . _dbprefix_ . "stats_data\n \t\t WHERE stats_ip = ?\n \t\t GROUP BY stats_hostname"; $arrRow = $this->objDB->getPRow($strQuery, array($arrOneRow["downloads_log_ip"])); if (isset($arrRow["stats_hostname"])) { $arrOneRow["stats_hostname"] = $arrRow["stats_hostname"]; } } return $arrReturn; }
/** * Loads the records of the dl-logbook * * @return mixed */ private function getLogbookData() { $objUser = new class_module_user_user(class_session::getInstance()->getUserID()); $strQuery = "SELECT COUNT(*) as amount, downloads_log_file\n\t\t\t\t\t FROM " . _dbprefix_ . "mediamanager_dllog\n\t\t\t\t\t WHERE downloads_log_date > ?\n\t\t\t\t AND downloads_log_date <= ?\n\t\t\t\t\t GROUP BY downloads_log_file\n\t\t\t\t\t ORDER BY amount DESC"; return $this->objDB->getPArray($strQuery, array($this->intDateStart, $this->intDateEnd), 0, $objUser->getIntItemsPerPage() - 1); }
/** * Returns the pages and their hits * * @return mixed */ public function getTopSessions() { $objUser = new class_module_user_user(class_session::getInstance()->getUserID()); $objUser = new class_module_user_user(class_session::getInstance()->getUserID()); $strQuery = "SELECT stats_session,\n stats_ip,\n stats_hostname,\n MIN(stats_date) AS startdate,\n MAX(stats_date) AS enddate,\n COUNT(*) AS anzahl,\n MAX(stats_date)-MIN(stats_date) AS dauer\n\n\n FROM " . _dbprefix_ . "stats_data\n WHERE stats_date > ?\n\t\t\t\t\t AND stats_date <= ?\n GROUP BY stats_session, stats_ip, stats_hostname\n ORDER BY enddate DESC"; $arrSessions = $this->objDB->getPArray($strQuery, array($this->intDateStart, $this->intDateEnd), 0, $objUser->getIntItemsPerPage() - 1); $intI = 0; foreach ($arrSessions as $intKey => $arrOneSession) { if ($intI++ >= $objUser->getIntItemsPerPage()) { break; } //Load the details for all sessions $strDetails = ""; $strSessionID = $arrOneSession["stats_session"]; $strDetails .= $this->objTexts->getLang("top_session_detail_start", "stats") . timeToString($arrOneSession["startdate"]) . "<br />"; $strDetails .= $this->objTexts->getLang("top_session_detail_end", "stats") . timeToString($arrOneSession["enddate"]) . "<br />"; $strDetails .= $this->objTexts->getLang("top_session_detail_time", "stats") . $arrOneSession["dauer"] . "<br />"; $strDetails .= $this->objTexts->getLang("top_session_detail_ip", "stats") . $arrOneSession["stats_ip"] . "<br />"; $strDetails .= $this->objTexts->getLang("top_session_detail_hostname", "stats") . $arrOneSession["stats_hostname"] . "<br />"; //and fetch all pages $strQuery = "SELECT stats_page\n FROM " . _dbprefix_ . "stats_data\n WHERE stats_session= ?\n ORDER BY stats_date ASC"; $arrPages = $this->objDB->getPArray($strQuery, array($strSessionID)); $strDetails .= $this->objTexts->getLang("top_session_detail_verlauf", "stats"); foreach ($arrPages as $arrOnePage) { $strDetails .= $arrOnePage["stats_page"] . " - "; } $strDetails = uniSubstr($strDetails, 0, -2); $arrFolder = $this->objToolkit->getLayoutFolder($strDetails, $this->objTexts->getLang("top_session_detail", "stats")); $arrSessions[$intKey]["detail"] = $arrFolder[1] . $arrFolder[0]; } return $arrSessions; }
/** * returns a list of top-referer * * @return mixed */ public function getTopReferer() { //Build excluded domains $arrBlocked = explode(",", class_module_system_setting::getConfigValue("_stats_exclusionlist_")); $arrParams = array("%" . str_replace("%", "\\%", _webpath_) . "%", $this->intDateStart, $this->intDateEnd); $strExclude = ""; foreach ($arrBlocked as $strBlocked) { if ($strBlocked != "") { $strExclude .= " AND stats_referer NOT LIKE ? \n"; $arrParams[] = "%" . str_replace("%", "\\%", $strBlocked) . "%"; } } $objUser = new class_module_user_user(class_session::getInstance()->getUserID()); $strQuery = "SELECT stats_referer as refurl, COUNT(*) as anzahl\n\t\t\t\t\t\tFROM " . _dbprefix_ . "stats_data\n\t\t\t\t\t\tWHERE stats_referer NOT LIKE ?\n\t\t\t\t\t\t\tAND stats_date > ?\n\t\t\t\t\t\t\tAND stats_date <= ?\n\t\t\t\t\t\t\t" . $strExclude . "\n\t\t\t\t\t\tGROUP BY stats_referer\n\t\t\t\t\t\tORDER BY anzahl desc"; return $this->objDB->getPArray($strQuery, $arrParams, 0, $objUser->getIntItemsPerPage() - 1); }