/**
  * Searches for tags assigned to the systemid to be deleted.
  *
  * @param string $strEventName
  * @param array $arrArguments
  *
  * @return bool
  */
 public function handleEvent($strEventName, array $arrArguments)
 {
     //unwrap arguments
     list($strSystemid, $strSourceClass) = $arrArguments;
     $bitReturn = true;
     if ($strSourceClass == "class_module_tags_tag" && class_module_system_module::getModuleByName("tags") != null) {
         //delete matching favorites
         class_orm_base::setObjHandleLogicalDeletedGlobal(class_orm_deletedhandling_enum::INCLUDED());
         $arrFavorites = class_module_tags_favorite::getAllFavoritesForTag($strSystemid);
         foreach ($arrFavorites as $objOneFavorite) {
             if ($strEventName == class_system_eventidentifier::EVENT_SYSTEM_RECORDDELETED_LOGICALLY) {
                 $bitReturn = $bitReturn && $objOneFavorite->deleteObject();
             }
             if ($strEventName == class_system_eventidentifier::EVENT_SYSTEM_RECORDDELETED) {
                 $bitReturn = $bitReturn && $objOneFavorite->deleteObjectFromDatabase();
                 $bitReturn = $bitReturn && class_carrier::getInstance()->getObjDB()->_pQuery("DELETE FROM " . _dbprefix_ . "tags_member WHERE tags_tagid=?", array($strSystemid));
             }
         }
         class_orm_base::setObjHandleLogicalDeletedGlobal(class_orm_deletedhandling_enum::EXCLUDED());
     }
     //delete memberships. Fire a plain query, faster then searching.
     if ($strEventName == class_system_eventidentifier::EVENT_SYSTEM_RECORDDELETED) {
         $bitReturn = $bitReturn && class_carrier::getInstance()->getObjDB()->_pQuery("DELETE FROM " . _dbprefix_ . "tags_member WHERE tags_systemid=?", array($strSystemid));
     }
     return $bitReturn;
 }
 public function install()
 {
     $strReturn = "";
     if (class_module_system_module::getModuleByName("mediamanager") == null) {
         return "Mediamanger not installed, skipping element\n";
     }
     //Table for page-element
     $strReturn .= "Installing downloads-element table...\n";
     $objManager = new class_orm_schemamanager();
     $objManager->createTable("class_element_downloads_admin");
     //Register the element
     $strReturn .= "Registering downloads-element...\n";
     if (class_module_system_module::getModuleByName("pages") !== null && class_module_pages_element::getElement("downloads") == null) {
         $objElement = new class_module_pages_element();
         $objElement->setStrName("downloads");
         $objElement->setStrClassAdmin("class_element_downloads_admin.php");
         $objElement->setStrClassPortal("class_element_downloads_portal.php");
         $objElement->setIntCachetime(3600);
         $objElement->setIntRepeat(1);
         $objElement->setStrVersion($this->objMetadata->getStrVersion());
         $objElement->updateObjectToDb();
         $strReturn .= "Element registered...\n";
     } else {
         $strReturn .= "Element already installed or pages module not installed!...\n";
     }
     return $strReturn;
 }
 /**
  * @return string
  * @autoTestable
  * @permissions view
  */
 protected function actionBrowserChooser()
 {
     $strReturn = "";
     if ($this->getParam("CKEditorFuncNum") != "") {
         $strReturn .= "<script type=\"text/javascript\">window.opener.KAJONA.admin.folderview.selectCallbackCKEditorFuncNum = " . (int) $this->getParam("CKEditorFuncNum") . ";</script>";
     }
     $intCounter = 1;
     $strReturn .= $this->objToolkit->listHeader();
     if (class_module_system_module::getModuleByName("pages") !== null) {
         $strAction = $this->objToolkit->listButton(class_link::getLinkAdmin("pages", "pagesFolderBrowser", "&pages=1&form_element=" . $this->getParam("form_element") . "&bit_link=1", $this->getLang("wysiwygPagesBrowser"), $this->getLang("wysiwygPagesBrowser"), "icon_folderActionOpen"));
         $strReturn .= $this->objToolkit->genericAdminList(generateSystemid(), $this->getLang("wysiwygPagesBrowser"), "", $strAction, $intCounter++);
     }
     $strRepoId = class_module_system_setting::getConfigValue("_mediamanager_default_filesrepoid_");
     if (validateSystemid($strRepoId) && class_module_system_module::getModuleByName("mediamanager") !== null && class_objectfactory::getInstance()->getObject($strRepoId) !== null) {
         $strAction = $this->objToolkit->listButton(class_link::getLinkAdmin("mediamanager", "folderContentFolderviewMode", "&systemid=" . $strRepoId . "&form_element=" . $this->getParam("form_element") . "&bit_link=1", $this->getLang("wysiwygFilesBrowser"), $this->getLang("wysiwygFilesBrowser"), "icon_folderActionOpen"));
         $strReturn .= $this->objToolkit->genericAdminList(generateSystemid(), $this->getLang("wysiwygFilesBrowser"), "", $strAction, $intCounter++);
     }
     $strRepoId = class_module_system_setting::getConfigValue("_mediamanager_default_imagesrepoid_");
     if (validateSystemid($strRepoId) && class_module_system_module::getModuleByName("mediamanager") !== null && class_objectfactory::getInstance()->getObject($strRepoId) !== null) {
         $strAction = $this->objToolkit->listButton(class_link::getLinkAdmin("mediamanager", "folderContentFolderviewMode", "&systemid=" . $strRepoId . "&form_element=" . $this->getParam("form_element") . "&bit_link=1", $this->getLang("wysiwygImagesBrowser"), $this->getLang("wysiwygImagesBrowser"), "icon_folderActionOpen"));
         $strReturn .= $this->objToolkit->genericAdminList(generateSystemid(), $this->getLang("wysiwygImagesBrowser"), "", $strAction, $intCounter++);
     }
     if (class_module_system_module::getModuleByName("mediamanager") !== null) {
         $strAction = $this->objToolkit->listButton(class_link::getLinkAdmin("mediamanager", "folderContentFolderviewMode", "&form_element=" . $this->getParam("form_element") . "&bit_link=1", $this->getLang("wysiwygRepoBrowser"), $this->getLang("wysiwygRepoBrowser"), "icon_folderActionOpen"));
         $strReturn .= $this->objToolkit->genericAdminList(generateSystemid(), $this->getLang("wysiwygRepoBrowser"), "", $strAction, $intCounter++);
     }
     $strReturn .= $this->objToolkit->listFooter();
     return $strReturn;
 }
 /**
  * Checks if the references of the source object is correctly set after validation
  */
 public function testObjectValidator()
 {
     $objModule = class_module_system_module::getModuleByName("news");
     if ($objModule == null) {
         return;
     }
     $objNews = new class_module_news_news();
     $objForm = new class_admin_formgenerator("news", $objNews);
     $objForm->generateFieldsFromObject();
     $objSourceObjectBefore = $objForm->getObjSourceobject();
     $arrFieldsBefore = $objForm->getArrFields();
     $objForm->validateForm();
     $objSourceObjectAfter = $objForm->getObjSourceobject();
     $arrFieldsAfter = $objForm->getArrFields();
     //Now check if the reference to the source object before validation is the same as after
     foreach ($objForm->getArrFields() as $intIndex => $objField) {
         if ($arrFieldsAfter != null) {
             $this->assertTrue($arrFieldsBefore[$intIndex]->getObjSourceObject() === $arrFieldsAfter[$intIndex]->getObjSourceObject());
             if ($arrFieldsBefore[$intIndex]->getObjSourceObject() != null) {
                 $this->assertTrue($arrFieldsBefore[$intIndex]->getObjSourceObject() === $objSourceObjectBefore);
                 $this->assertTrue($arrFieldsBefore[$intIndex]->getObjSourceObject() === $objSourceObjectAfter);
             }
             if ($arrFieldsAfter[$intIndex]->getObjSourceObject() != null) {
                 $this->assertTrue($arrFieldsAfter[$intIndex]->getObjSourceObject() === $objSourceObjectBefore);
                 $this->assertTrue($arrFieldsAfter[$intIndex]->getObjSourceObject() === $objSourceObjectAfter);
             }
         }
     }
     $this->assertTrue($objSourceObjectAfter === $objSourceObjectBefore);
 }
Пример #5
0
 public function testFileSync()
 {
     echo "test mediamanager...\n";
     if (class_module_system_module::getModuleByName("samplecontent") == null || !is_file(_realpath_ . "/files/images/samples/IMG_3000.JPG")) {
         return;
     }
     $objFilesystem = new class_filesystem();
     $objFilesystem->folderCreate(_filespath_ . "/images/autotest");
     $objFilesystem->fileCopy(_filespath_ . "/images/samples/IMG_3000.JPG", _filespath_ . "/images/autotest/IMG_3000.jpg");
     $objFilesystem->fileCopy(_filespath_ . "/images/samples/IMG_3000.JPG", _filespath_ . "/images/autotest/IMG_3000.png");
     $objFilesystem->fileCopy(_filespath_ . "/images/samples/IMG_3000.JPG", _filespath_ . "/images/autotest/PA021805.JPG");
     $objFilesystem->fileCopy(_filespath_ . "/images/samples/IMG_3000.JPG", _filespath_ . "/images/autotest/test.txt");
     $objRepo = new class_module_mediamanager_repo();
     $objRepo->setStrPath(_filespath_ . "/images/autotest");
     $objRepo->setStrTitle("autotest repo");
     $objRepo->setStrViewFilter(".jpg,.png");
     $objRepo->updateObjectToDb();
     $objRepo->syncRepo();
     $arrFiles = class_module_mediamanager_file::loadFilesDB($objRepo->getSystemid());
     $this->assertEquals(3, count($arrFiles));
     foreach ($arrFiles as $objOneFile) {
         $objOneFile->deleteObjectFromDatabase();
     }
     $objRepo->deleteObjectFromDatabase();
     $arrFiles = $objFilesystem->getFilelist(_filespath_ . "/images/autotest");
     $this->assertEquals(1, count($arrFiles));
     $this->assertEquals("test.txt", array_values($arrFiles)[0]);
 }
 /**
  * @inheritDoc
  */
 public function generateFieldsFromObject()
 {
     parent::generateFieldsFromObject();
     $objNews = $this->getObjSourceobject();
     if ($objNews->getSystemid() != class_module_system_module::getModuleByName("news")->getSystemid()) {
         //search the languages maintained
         $objLanguageManager = class_module_languages_languageset::getLanguagesetForSystemid($objNews->getSystemid());
         if ($objLanguageManager != null) {
             $arrMaintained = $objLanguageManager->getArrLanguageSet();
             $arrDD = array();
             foreach ($arrMaintained as $strLanguageId => $strSystemid) {
                 $objLanguage = new class_module_languages_language($strLanguageId);
                 $arrDD[$strSystemid] = $this->getLang("lang_" . $objLanguage->getStrName(), "languages");
             }
             class_module_languages_admin::enableLanguageSwitch();
             class_module_languages_admin::setArrLanguageSwitchEntries($arrDD);
             class_module_languages_admin::setStrOnChangeHandler("window.location='" . class_link::getLinkAdminHref("news", "editNews") . (class_module_system_setting::getConfigValue("_system_mod_rewrite_") == "true" ? "?" : "&") . "systemid='+this.value+'&pe=" . class_carrier::getInstance()->getParam("pe") . "';");
             class_module_languages_admin::setStrActiveKey($objNews->getSystemid());
         }
     }
     $arrCats = class_module_news_category::getObjectList();
     if (count($arrCats) > 0) {
         $arrKeyValues = array();
         /** @var class_module_news_category $objOneCat */
         foreach ($arrCats as $objOneCat) {
             $arrKeyValues[$objOneCat->getSystemid()] = $objOneCat->getStrDisplayName();
         }
         $this->getField("cats")->setStrLabel($this->getLang("commons_categories"))->setArrKeyValues($arrKeyValues);
     }
     if (class_module_system_setting::getConfigValue("_news_news_datetime_") == "true") {
         $this->addField(new class_formentry_datetime($this->getStrFormname(), "objDateStart", $objNews), "datestart")->setBitMandatory(true)->setStrLabel($this->getLang("form_news_datestart"));
         $this->addField(new class_formentry_datetime($this->getStrFormname(), "objDateEnd", $objNews), "dateend")->setStrLabel($this->getLang("form_news_dateend"));
         $this->addField(new class_formentry_datetime($this->getStrFormname(), "objDateSpecial", $objNews), "datespecial")->setStrLabel($this->getLang("form_news_datespecial"));
     }
 }
 /**
  * @see interface_admin_systemtast::executeTask()
  * @return string
  */
 public function executeTask()
 {
     if (!class_module_system_module::getModuleByName("stats")->rightEdit()) {
         return $this->getLang("commons_error_permissions");
     }
     $objBrowscap = new class_browscap();
     $objBrowscap->updateBrowscap();
     return $this->objToolkit->getTextRow($this->getLang("browscapupdate_end"));
 }
 /**
  * Loads the navigation-class and passes control
  *
  * @return string
  */
 public function loadData()
 {
     $strReturn = "";
     $objNaviModule = class_module_system_module::getModuleByName("navigation");
     if ($objNaviModule != null) {
         $objNavigation = $objNaviModule->getPortalInstanceOfConcreteModule($this->arrElementData);
         $strReturn = $objNavigation->action();
     }
     return $strReturn;
 }
 /**
  * @see interface_admin_systemtask::executeTask()
  * @return string
  */
 public function executeTask()
 {
     if (!class_module_system_module::getModuleByName("workflows")->rightRight1()) {
         return $this->getLang("commons_error_permissions");
     }
     $objWorkflowController = new class_workflows_controller();
     $objWorkflowController->scheduleWorkflows();
     $objWorkflowController->runWorkflows();
     return "";
 }
 /**
  * @see interface_admin_systemtast::executeTask()
  * @return string
  */
 public function executeTask()
 {
     if (!class_module_system_module::getModuleByName("stats")->rightEdit()) {
         return $this->getLang("commons_error_permissions");
     }
     $strReturn = "";
     $objWorker = new class_module_stats_worker("");
     $objWorker->hostnameLookupResetHostnames();
     $strReturn .= $this->objToolkit->getTextRow($this->getLang("worker_lookupReset_end"));
     return $strReturn;
 }
 public function testObjectIndexerPerformance()
 {
     if (class_module_system_module::getModuleByName("news") === null) {
         return;
     }
     $arrNewsIds = array();
     echo "Indexing without deferred indexer...\n";
     class_module_system_changelog::$bitChangelogEnabled = false;
     $intTimeStart = microtime(true);
     $intQueriesStart = class_db::getInstance()->getNumber();
     for ($intI = 0; $intI < 15; $intI++) {
         $objNews = new class_module_news_news();
         $objNews->setStrTitle("demo 1");
         $objNews->setStrIntro("intro demo news");
         $objNews->setStrText("text demo news");
         $objNews->updateObjectToDb();
         $arrNewsIds[] = $objNews->getSystemid();
     }
     echo "Queries pre indexing: ", class_db::getInstance()->getNumber() - $intQueriesStart . " \n";
     $objHandler = new class_module_search_request_endprocessinglistener();
     $objHandler->handleEvent(class_system_eventidentifier::EVENT_SYSTEM_REQUEST_AFTERCONTENTSEND, array());
     $intTimeEnd = microtime(true);
     $time = $intTimeEnd - $intTimeStart;
     echo "Object updates: ", sprintf('%f', $time), " sec.\n";
     echo "Queries total: ", class_db::getInstance()->getNumber() - $intQueriesStart . " \n";
     echo "\nIndexing with deferred indexer...\n";
     $objConfig = class_module_system_setting::getConfigByName("_search_deferred_indexer_");
     $objConfig->setStrValue("true");
     $objConfig->updateObjectToDb();
     $intTimeStart = microtime(true);
     $intQueriesStart = class_db::getInstance()->getNumber();
     for ($intI = 0; $intI < 15; $intI++) {
         $objNews = new class_module_news_news();
         $objNews->setStrTitle("demo 1");
         $objNews->setStrIntro("intro demo news");
         $objNews->setStrText("text demo news");
         $objNews->updateObjectToDb();
         $arrNewsIds[] = $objNews->getSystemid();
     }
     echo "Queries pre indexing: ", class_db::getInstance()->getNumber() - $intQueriesStart . " \n";
     echo "Triggering queue update event...\n";
     $objHandler = new class_module_search_request_endprocessinglistener();
     $objHandler->handleEvent(class_system_eventidentifier::EVENT_SYSTEM_REQUEST_AFTERCONTENTSEND, array());
     $intTimeEnd = microtime(true);
     $time = $intTimeEnd - $intTimeStart;
     echo "Object updates: ", sprintf('%f', $time), " sec.\n";
     echo "Queries total: ", class_db::getInstance()->getNumber() - $intQueriesStart . " \n";
     $objConfig = class_module_system_setting::getConfigByName("_search_deferred_indexer_");
     $objConfig->setStrValue("false");
     $objConfig->updateObjectToDb();
     foreach ($arrNewsIds as $strNewsId) {
         class_objectfactory::getInstance()->getObject($strNewsId)->deleteObjectFromDatabase();
     }
 }
 /**
  * This callback is triggered on a users' first login into the system.
  * You may use this method to install a widget as a default widget to
  * a users dashboard.
  *
  * @param string $strUserid
  *
  * @return bool
  */
 public function onFistLogin($strUserid)
 {
     if (class_module_system_module::getModuleByName("system") !== null && class_module_system_aspect::getAspectByName("content") !== null) {
         $objDashboard = new class_module_dashboard_widget();
         $objDashboard->setStrColumn("column2");
         $objDashboard->setStrUser($strUserid);
         $objDashboard->setStrClass(__CLASS__);
         return $objDashboard->updateObjectToDb(class_module_dashboard_widget::getWidgetsRootNodeForUser($strUserid, class_module_system_aspect::getAspectByName("content")->getSystemid()));
     }
     return true;
 }
 /**
  * @see interface_admin_systemtask::executeTask()
  * @return string
  */
 public function executeTask()
 {
     if (!class_module_system_module::getModuleByName("system")->rightRight2()) {
         return $this->getLang("commons_error_permissions");
     }
     if (class_carrier::getInstance()->getObjDB()->importDb($this->getParam("dbImportFile"))) {
         return $this->objToolkit->getTextRow($this->getLang("systemtask_dbimport_success"));
     } else {
         return $this->objToolkit->getTextRow($this->getLang("systemtask_dbimport_error"));
     }
 }
Пример #14
0
 /**
  * Removes the elements / modules handled by the current installer.
  * Use the reference param to add a human readable logging.
  *
  * @param string &$strReturn
  *
  * @return bool
  */
 public function remove(&$strReturn)
 {
     //delete the module-node
     $strReturn .= "Deleting the module-registration...\n";
     $objModule = class_module_system_module::getModuleByName($this->objMetadata->getStrTitle(), true);
     if (!$objModule->deleteObjectFromDatabase()) {
         $strReturn .= "Error deleting module, aborting.\n";
         return false;
     }
     return true;
 }
Пример #15
0
 /**
  * Constructor doing the usual setup things
  */
 private function __construct()
 {
     $this->objDb = class_carrier::getInstance()->getObjDb();
     $this->objSession = class_carrier::getInstance()->getObjSession();
     if (count($this->objDb->getTables()) > 0) {
         $objModule = class_module_system_module::getModuleByName("system");
         if ($objModule !== null && version_compare($objModule->getStrVersion(), "4.3.1") < 0) {
             $this->bitChangelog = false;
         }
     }
 }
 /**
  * Loads the news-class and passes control
  *
  * @return string
  */
 public function loadData()
 {
     $strReturn = "";
     //Load the data
     $objNewsModule = class_module_system_module::getModuleByName("news");
     if ($objNewsModule != null) {
         $objNews = $objNewsModule->getPortalInstanceOfConcreteModule($this->arrElementData);
         $strReturn = $objNews->action();
     }
     return $strReturn;
 }
 public function update()
 {
     $strReturn = "";
     //check installed version and to which version we can update
     $arrModule = class_module_system_module::getPlainModuleData($this->objMetadata->getStrTitle(), false);
     $strReturn .= "Version found:\n\t Module: " . $arrModule["module_name"] . ", Version: " . $arrModule["module_version"] . "\n\n";
     $arrModule = class_module_system_module::getPlainModuleData($this->objMetadata->getStrTitle(), false);
     if ($arrModule["module_version"] == "4.0") {
         $strReturn = "Updating 4.0 to 4.1...\n";
         $strReturn .= "Updating module-versions...\n";
         $this->updateModuleVersion("dashboard", "4.1");
     }
     $arrModule = class_module_system_module::getPlainModuleData($this->objMetadata->getStrTitle(), false);
     if ($arrModule["module_version"] == "4.1") {
         $strReturn .= "Updating 4.1 to 4.2...\n";
         $strReturn .= "Updating module-versions...\n";
         $this->updateModuleVersion("dashboard", "4.2");
     }
     $arrModule = class_module_system_module::getPlainModuleData($this->objMetadata->getStrTitle(), false);
     if ($arrModule["module_version"] == "4.2") {
         $strReturn .= "Updating 4.2 to 4.3...\n";
         $strReturn .= "Updating module-versions...\n";
         $this->updateModuleVersion("dashboard", "4.3");
     }
     $arrModule = class_module_system_module::getPlainModuleData($this->objMetadata->getStrTitle(), false);
     if ($arrModule["module_version"] == "4.3") {
         $strReturn .= "Updating 4.3 to 4.4...\n";
         $strReturn .= "Updating module-versions...\n";
         $this->updateModuleVersion("dashboard", "4.4");
     }
     $arrModule = class_module_system_module::getPlainModuleData($this->objMetadata->getStrTitle(), false);
     if ($arrModule["module_version"] == "4.4") {
         $strReturn .= "Updating 4.4 to 4.5...\n";
         $strReturn .= "Updating module-versions...\n";
         $this->updateModuleVersion("dashboard", "4.5");
     }
     $arrModule = class_module_system_module::getPlainModuleData($this->objMetadata->getStrTitle(), false);
     if ($arrModule["module_version"] == "4.5") {
         $strReturn .= "Updating 4.5 to 4.6...\n";
         $strReturn .= "Updating module-versions...\n";
         $this->updateModuleVersion("dashboard", "4.6");
     }
     $arrModule = class_module_system_module::getPlainModuleData($this->objMetadata->getStrTitle(), false);
     if ($arrModule["module_version"] == "4.6") {
         $strReturn .= "Updating to 4.7...\n";
         $strReturn .= "Updating module-versions...\n";
         $this->updateModuleVersion("dashboard", "4.7");
     }
     $arrModule = class_module_system_module::getPlainModuleData($this->objMetadata->getStrTitle(), false);
     if ($arrModule["module_version"] == "4.7") {
         $strReturn .= $this->update_47_475();
     }
     return $strReturn . "\n\n";
 }
 /**
  * This callback is triggered on a users' first login into the system.
  * You may use this method to install a widget as a default widget to
  * a users dashboard.
  *
  * @param $strUserid
  *
  * @return bool
  */
 public function onFistLogin($strUserid)
 {
     if (class_module_system_module::getModuleByName("system") !== null && class_module_system_aspect::getAspectByName("management") !== null) {
         $objDashboard = new class_module_dashboard_widget();
         $objDashboard->setStrColumn("column1");
         $objDashboard->setStrUser($strUserid);
         $objDashboard->setStrClass(__CLASS__);
         $objDashboard->setStrContent("a:2:{s:3:\"php\";s:7:\"checked\";s:6:\"kajona\";s:7:\"checked\";}");
         return $objDashboard->updateObjectToDb(class_module_dashboard_widget::getWidgetsRootNodeForUser($strUserid, class_module_system_aspect::getAspectByName("management")->getSystemid()));
     }
     return true;
 }
 /**
  * Validates if the search module is installed with a supported index
  * @return bool
  */
 private static function isIndexAvailable()
 {
     if (self::$isIndexAvailable === null) {
         $objSearch = class_module_system_module::getModuleByName("search");
         if ($objSearch != null && version_compare($objSearch->getStrVersion(), "4.4", ">=")) {
             self::$isIndexAvailable = true;
         } else {
             self::$isIndexAvailable = false;
         }
     }
     return self::$isIndexAvailable;
 }
 /**
  * @see interface_admin_systemtask::executeTask()
  * @return string
  */
 public function executeTask()
 {
     if (!class_module_system_module::getModuleByName("ldap")->rightEdit()) {
         return $this->getLang("commons_error_permissions");
     }
     $objUsersources = new class_usersources_source_ldap();
     $bitSync = $objUsersources->updateUserData();
     if ($bitSync) {
         return $this->objToolkit->getTextRow($this->getLang("systemtask_ldapsync_success"));
     } else {
         return $this->objToolkit->getTextRow($this->getLang("systemtask_ldapsync_error"));
     }
 }
 /**
  * @see interface_admin_systemtask::executeTask()
  * @return string
  */
 public function executeTask()
 {
     if (!class_module_system_module::getModuleByName("system")->rightRight2()) {
         return $this->getLang("commons_error_permissions");
     }
     //try to load and update the systemrecord
     if (validateSystemid($this->getParam("systemstatus_systemid"))) {
         $objRecord = new class_module_system_common($this->getParam("systemstatus_systemid"));
         $objRecord->setIntRecordStatus($this->getParam("systemstatus_status"));
         $objRecord->updateObjectToDb();
         return $this->objToolkit->getTextRow($this->getLang("systemtask_status_success"));
     }
     return $this->objToolkit->getTextRow($this->getLang("systemtask_status_error"));
 }
Пример #22
0
 /**
  * Number of rating for the current file
  *
  * @see interface_sortable_rating
  * @return int
  *
  * @todo: with php5.4, ths could be moved to traits
  */
 public function getIntRatingHits()
 {
     $intHits = 0;
     $objModule = class_module_system_module::getModuleByName("rating");
     if ($objModule != null) {
         $objRating = class_module_rating_rate::getRating($this->getSystemid());
         if ($objRating != null) {
             $intHits = $objRating->getIntHits();
         } else {
             return 0;
         }
     }
     return $intHits;
 }
Пример #23
0
 public function testPortal()
 {
     echo "generating all pages existing to find notices...\n";
     $arrPages = class_module_pages_page::getAllPages();
     $objModule = class_module_system_module::getModuleByName("pages");
     /** @var $objModuleRequested class_module_pages_portal */
     $objModuleRequested = $objModule->getPortalInstanceOfConcreteModule();
     /** @var class_module_pages_page $objOnePage */
     foreach ($arrPages as $objOnePage) {
         echo "generating page " . $objOnePage->getStrName() . "\n";
         $objModuleRequested->setParam("page", $objOnePage->getStrName());
         $objModuleRequested->action("");
     }
 }
 /**
  * This generic method is called in case of dispatched events.
  * The first param is the name of the event, the second argument is an array of
  * event-specific arguments.
  * Make sure to return a matching boolean value, indicating if the event-process was successful or not. The event source may
  * depend on a valid return value.
  *
  * @param string $strEventIdentifier
  * @param array $arrArguments
  *
  * @return bool
  */
 public function handleEvent($strEventIdentifier, array $arrArguments)
 {
     /** @var class_request_entrypoint_enum $objEntrypoint */
     $objEntrypoint = $arrArguments[0];
     if ($objEntrypoint->equals(class_request_entrypoint_enum::INDEX()) && class_carrier::getInstance()->getParam("admin") == "") {
         //process stats request
         $objStats = class_module_system_module::getModuleByName("stats");
         if ($objStats != null) {
             //Collect Data
             $objLanguage = new class_module_languages_language();
             $objStats = new class_module_stats_worker();
             $objStats->createStatsEntry(getServer("REMOTE_ADDR"), time(), class_carrier::getInstance()->getParam("page"), rtrim(getServer("HTTP_REFERER"), "/"), getServer("HTTP_USER_AGENT"), $objLanguage->getPortalLanguage());
         }
     }
 }
 public function getNavigationEntries()
 {
     $arrData = $this->getElementContent($this->getSystemid());
     $arrData["repo_id"] = $arrData["download_id"];
     $arrData["repo_elementsperpage"] = $arrData["download_amount"];
     $arrData["repo_template"] = $arrData["download_template"];
     $objDownloadsModule = class_module_system_module::getModuleByName("mediamanager");
     if ($objDownloadsModule != null) {
         /** @var $objDownloads class_module_mediamanager_portal */
         $objDownloads = $objDownloadsModule->getPortalInstanceOfConcreteModule($arrData);
         $arrReturn = $objDownloads->getNavigationNodes();
         return $arrReturn;
     }
     return false;
 }
 /**
  * @see interface_admin_systemtask::executeTask()
  * @return string
  */
 public function executeTask()
 {
     if (!class_module_system_module::getModuleByName("system")->rightRight2()) {
         return $this->getLang("commons_error_permissions");
     }
     $strReturn = "";
     $this->intMaxWidth = (int) $this->getParam("intMaxWidth");
     $this->intMaxHeight = (int) $this->getParam("intMaxHeight");
     $this->recursiveImageProcessing($this->strPicsPath);
     //build the return string
     $strReturn .= $this->getLang("systemtask_compresspicuploads_done") . "<br />";
     $strReturn .= $this->getLang("systemtask_compresspicuploads_found") . ": " . $this->intFilesTotal . "<br />";
     $strReturn .= $this->getLang("systemtask_compresspicuploads_processed") . ": " . $this->intFilesProcessed;
     return $strReturn;
 }
Пример #27
0
 /**
  * @see interface_admin_systemtask::executeTask()
  * @return string
  */
 public function executeTask()
 {
     if (!class_module_system_module::getModuleByName("system")->rightRight2()) {
         return $this->getLang("commons_error_permissions");
     }
     $arrToExclude = array();
     if ($this->getParam("excludeTables") == "1") {
         $arrToExclude = $this->arrTablesToExlucde;
     }
     if (class_carrier::getInstance()->getObjDB()->dumpDb($arrToExclude)) {
         return $this->objToolkit->getTextRow($this->getLang("systemtask_dbexport_success"));
     } else {
         return $this->objToolkit->getTextRow($this->getLang("systemtask_dbexport_error"));
     }
 }
 /**
  * @see interface_admin_systemtask::executeTask()
  * @return string
  */
 public function executeTask()
 {
     if (!class_module_system_module::getModuleByName("system")->rightRight2()) {
         return $this->getLang("commons_error_permissions");
     }
     //increase the cachebuster, so browsers are forced to reload JS and CSS files
     $objCachebuster = class_module_system_setting::getConfigByName("_system_browser_cachebuster_");
     $objCachebuster->setStrValue((int) $objCachebuster->getStrValue() + 1);
     $objCachebuster->updateObjectToDb();
     if (class_cache::flushCache($this->getParam("cacheSource"))) {
         return $this->objToolkit->getTextRow($this->getLang("systemtask_flushcache_success"));
     } else {
         return $this->objToolkit->getTextRow($this->getLang("systemtask_flushcache_error"));
     }
 }
 /**
  * @see interface_admin_systemtast::executeTask()
  * @return string
  */
 public function executeTask()
 {
     if (!class_module_system_module::getModuleByName("search")->rightEdit()) {
         return $this->getLang("commons_error_permissions");
     }
     $objWorker = new class_module_search_indexwriter();
     if (!class_carrier::getInstance()->getObjSession()->sessionIsset($this->STR_SESSION_KEY)) {
         //fetch all records to be indexed
         $strQuery = "SELECT system_id FROM " . _dbprefix_ . "system WHERE system_deleted = 0";
         $arrRows = class_carrier::getInstance()->getObjDB()->getPArray($strQuery, array());
         $arrIds = array();
         foreach ($arrRows as $arrOneRow) {
             $arrIds[] = $arrOneRow["system_id"];
         }
         $objWorker->clearIndex();
         class_carrier::getInstance()->getObjSession()->setSession($this->STR_SESSION_KEY, $arrIds);
         $this->setParam("totalCount", count($arrIds));
     }
     $arrIds = class_carrier::getInstance()->getObjSession()->getSession($this->STR_SESSION_KEY);
     if (count($arrIds) == 0) {
         class_carrier::getInstance()->getObjSession()->sessionUnset($this->STR_SESSION_KEY);
         return $this->objToolkit->getTextRow($this->getLang("worker_indexrebuild_end", array($objWorker->getNumberOfDocuments(), $objWorker->getNumberOfContentEntries())));
     }
     $intMax = 0;
     foreach ($arrIds as $intKey => $strOneValue) {
         $objObject = class_objectfactory::getInstance()->getObject($strOneValue);
         if ($objObject != null) {
             $objWorker->indexObject($objObject);
         }
         unset($arrIds[$intKey]);
         if ($intMax++ > 500) {
             break;
         }
     }
     class_carrier::getInstance()->getObjSession()->setSession($this->STR_SESSION_KEY, $arrIds);
     //and create a small progress-info
     $intTotal = $this->getParam("totalCount");
     $floatOnePercent = 100 / $intTotal;
     //and multiply it with the already processed records
     $intLookupsDone = ((int) $intTotal - count($arrIds)) * $floatOnePercent;
     $intLookupsDone = round($intLookupsDone, 2);
     if ($intLookupsDone < 0) {
         $intLookupsDone = 0;
     }
     $this->setStrProgressInformation($this->getLang("worker_indexrebuild", array($objWorker->getNumberOfDocuments(), $objWorker->getNumberOfContentEntries())));
     $this->setStrReloadParam("&totalCount=" . $this->getParam("totalCount"));
     return $intLookupsDone;
 }
 /**
  * Loads the postacomment-class and passes control
  *
  * @return string
  */
 public function loadData()
 {
     $strReturn = "";
     //Load the data
     $objPostacommentModule = class_module_system_module::getModuleByName("postacomment");
     if ($objPostacommentModule != null) {
         //action-filter set within the element?
         if (trim($this->arrElementData["char2"]) != "") {
             if ($this->getParam("action") != $this->arrElementData["char2"]) {
                 return "";
             }
         }
         $objPostacomment = $objPostacommentModule->getPortalInstanceOfConcreteModule($this->arrElementData);
         $strReturn = $objPostacomment->action();
     }
     return $strReturn;
 }