/**
  * 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;
 }
Beispiel #2
0
 /**
  * Fetches the records placed as child nodes of the current / passed id.
  *
  * @param string $strSystemid
  * @return string[]
  */
 private function getChildNodes($strSystemid)
 {
     $strQuery = "SELECT system_id\r\n                     FROM " . _dbprefix_ . "system\r\n                     WHERE system_prev_id=?\r\n                       AND system_id != '0'\r\n                     ORDER BY system_sort ASC";
     $arrReturn = array();
     $arrTemp = $this->objDb->getPArray($strQuery, array($strSystemid));
     foreach ($arrTemp as $arrOneRow) {
         $arrReturn[] = $arrOneRow["system_id"];
     }
     return $arrReturn;
 }
 /**
  * @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;
 }
 private function updateFilemanager()
 {
     echo "Updating filemanager to new mediamanager structure...\n";
     echo "Checking installation state of mediamanager...\n";
     if (!in_array(_dbprefix_ . "filemanager", $this->objDB->getTables())) {
         echo "Filemanager table missing, no update required.\n";
         return true;
     }
     $strOldDefaultImagesRepo = $this->getValueOfSetting("_filemanager_default_imagesrepoid_");
     $strOldDefaultFilesRepo = $this->getValueOfSetting("_filemanager_default_filesrepoid_");
     echo "Migrating old filemanager repos to new mediamanager repos...\n";
     $strQuery = "SELECT * FROM " . _dbprefix_ . "filemanager";
     $arrRows = $this->objDB->getPArray($strQuery, array());
     foreach ($arrRows as $arrOneRow) {
         if (!validateSystemid($arrOneRow["filemanager_foreign_id"])) {
             echo "migrating old repo " . $arrOneRow["filemanager_name"] . "\n";
             echo "  old path: " . $arrOneRow["filemanager_path"] . "\n";
             //convert the path
             $strPath = $this->convertOldPath($arrOneRow["filemanager_path"]);
             echo "  new path: " . $strPath . "\n";
             $objRepo = new class_module_mediamanager_repo();
             $objRepo->setStrPath($strPath);
             $objRepo->setStrTitle($arrOneRow["filemanager_name"]);
             $objRepo->setStrViewFilter($arrOneRow["filemanager_view_filter"]);
             $objRepo->setStrUploadFilter($arrOneRow["filemanager_upload_filter"]);
             $objRepo->updateObjectToDb();
             $objRepo->syncRepo();
             if ($arrOneRow["filemanager_id"] == $strOldDefaultFilesRepo) {
                 $objSetting = class_module_system_setting::getConfigByName("_mediamanager_default_filesrepoid_");
                 $objSetting->setStrValue($objRepo->getSystemid());
                 $objSetting->updateObjectToDb();
                 echo "  setting as default files repo\n";
             }
             if ($arrOneRow["filemanager_id"] == $strOldDefaultImagesRepo) {
                 $objSetting = class_module_system_setting::getConfigByName("_mediamanager_default_imagesrepoid_");
                 $objSetting->setStrValue($objRepo->getSystemid());
                 $objSetting->updateObjectToDb();
                 echo "  setting as default images repo\n";
             }
         }
         echo "  deleting repo from tables\n";
         $strQuery = "DELETE FROM " . _dbprefix_ . "filemanager WHERE filemanager_id = ?";
         $this->objDB->_pQuery($strQuery, array($arrOneRow["filemanager_id"]));
         $this->deleteSystemRecord($arrOneRow["filemanager_id"]);
     }
     echo "Deleting filemanager module...\n";
     $this->removeModule("filemanager");
     $this->objDB->_pQuery("DROP TABLE " . _dbprefix_ . "filemanager", array());
     $this->removeSetting("_filemanager_default_imagesrepoid_");
     $this->removeSetting("_filemanager_default_filesrepoid_");
     $this->removeSetting("_filemanager_foldersize_");
     $this->removeSetting("_filemanager_show_foreign_");
     return true;
 }
Beispiel #5
0
 /**
  * Fetches the records placed as child nodes of the current / passed id.
  * <b> Only the IDs are fetched since the current object-context is not available!!! </b>
  *
  * @param string $strSystemid
  * @return string[]
  * @deprecated
  */
 public function getChildNodesAsIdArray($strSystemid = "")
 {
     if ($strSystemid == "") {
         $strSystemid = $this->getSystemid();
     }
     $objORM = new class_orm_objectlist();
     $strQuery = "SELECT system_id\n                     FROM " . _dbprefix_ . "system\n                     WHERE system_prev_id=?\n                       AND system_id != '0'\n                       " . $objORM->getDeletedWhereRestriction() . "\n                     ORDER BY system_sort ASC";
     $arrReturn = array();
     $arrTemp = $this->objDB->getPArray($strQuery, array($strSystemid));
     if (count($arrTemp) > 0) {
         foreach ($arrTemp as $arrOneRow) {
             $arrReturn[] = $arrOneRow["system_id"];
         }
     }
     return $arrReturn;
 }
 /**
  * Sets the position of systemid using a given value.
  *
  * @param int $intNewPosition
  * @param array|bool $arrRestrictionModules If an array of module-ids is passed, the determination of siblings will be limited to the module-records matching one of the module-ids
  *
  * @throws class_exception
  * @return void
  */
 public function setAbsolutePosition($intNewPosition, $arrRestrictionModules = false)
 {
     class_logger::getInstance()->addLogRow("move " . $this->objSource->getSystemid() . " to new pos " . $intNewPosition, class_logger::$levelInfo);
     $this->objDB->flushQueryCache();
     //validate if object is sortable
     if (!$this->objSource->getLockManager()->isAccessibleForCurrentUser()) {
         throw new class_exception("Object is locked", class_exception::$level_ERROR);
     }
     $arrParams = array();
     $arrParams[] = $this->objSource->getPrevId();
     $strWhere = "";
     if ($arrRestrictionModules && is_array($arrRestrictionModules)) {
         $arrMarks = array();
         foreach ($arrRestrictionModules as $strOneId) {
             $arrMarks[] = "?";
             $arrParams[] = $strOneId;
         }
         $strWhere = "AND system_module_nr IN ( " . implode(", ", $arrMarks) . " )";
     }
     //Load all elements on the same level, so at first get the prev id
     $strQuery = "SELECT *\n                         FROM " . _dbprefix_ . "system\n                         WHERE system_prev_id=? AND system_id != '0'\n                           AND system_deleted = 0\n                         " . $strWhere . "\n                         ORDER BY system_sort ASC, system_comment ASC";
     //No caching here to allow multiple shiftings per request
     $arrElements = $this->objDB->getPArray($strQuery, $arrParams, null, null, false);
     //more than one record to set?
     if (count($arrElements) <= 1) {
         return;
     }
     //senseless new pos?
     if ($intNewPosition <= 0 || $intNewPosition > count($arrElements)) {
         return;
     }
     $intCurPos = $this->objSource->getIntSort();
     if ($intNewPosition == $intCurPos) {
         return;
     }
     //searching the current element to get to know if element should be sorted up- or downwards
     $bitSortDown = false;
     $bitSortUp = false;
     if ($intNewPosition < $intCurPos) {
         $bitSortUp = true;
     } else {
         $bitSortDown = true;
     }
     //sort up?
     if ($bitSortUp) {
         //move the record to be shifted to the wanted pos
         $strQuery = "UPDATE " . _dbprefix_ . "system\n                                SET system_sort=?\n                                WHERE system_id=?";
         $this->objDB->_pQuery($strQuery, array((int) $intNewPosition, $this->objSource->getSystemid()));
         //start at the pos to be reached and move all one down
         for ($intI = $intNewPosition; $intI < $intCurPos; $intI++) {
             $strQuery = "UPDATE " . _dbprefix_ . "system\n                            SET system_sort=?\n                            WHERE system_id=?";
             $this->objDB->_pQuery($strQuery, array($intI + 1, $arrElements[$intI - 1]["system_id"]));
         }
     }
     if ($bitSortDown) {
         //move the record to be shifted to the wanted pos
         $strQuery = "UPDATE " . _dbprefix_ . "system\n                                SET system_sort=?\n                                WHERE system_id=?";
         $this->objDB->_pQuery($strQuery, array((int) $intNewPosition, $this->objSource->getSystemid()));
         //start at the pos to be reached and move all one up
         for ($intI = $intCurPos + 1; $intI <= $intNewPosition; $intI++) {
             $strQuery = "UPDATE " . _dbprefix_ . "system\n                            SET system_sort= ?\n                            WHERE system_id=?";
             $this->objDB->_pQuery($strQuery, array($intI - 1, $arrElements[$intI - 1]["system_id"]));
         }
     }
     //flush the cache
     $this->objSource->flushCompletePagesCache();
     class_carrier::getInstance()->flushCache(class_carrier::INT_CACHE_TYPE_DBQUERIES | class_carrier::INT_CACHE_TYPE_ORMCACHE);
     $this->objSource->setIntSort($intNewPosition);
 }