public function install()
 {
     $strReturn = "";
     $objManager = new class_orm_schemamanager();
     $strReturn .= "Installing table templatepacks...\n";
     $objManager->createTable("class_module_packagemanager_template");
     //register the module
     $this->registerModule("packagemanager", _packagemanager_module_id_, "", "class_module_packagemanager_admin.php", $this->objMetadata->getStrVersion(), true);
     $strReturn .= "Registering system-constants...\n";
     $this->registerConstant("_packagemanager_defaulttemplate_", "default", class_module_system_setting::$int_TYPE_STRING, _packagemanager_module_id_);
     $strReturn .= "Initial templatepack sync...\n";
     class_module_packagemanager_template::syncTemplatepacks();
     $arrPacks = class_module_packagemanager_template::getObjectList();
     if (count($arrPacks) > 0) {
         //search the default package
         foreach ($arrPacks as $objOnePack) {
             if ($objOnePack->getStrName() == "default") {
                 $objOnePack->setIntRecordStatus(1);
                 $objOnePack->updateObjectToDb();
             }
         }
     }
     $strReturn .= "Setting aspect assignments...\n";
     if (class_module_system_aspect::getAspectByName("management") != null) {
         $objModule = class_module_system_module::getModuleByName($this->objMetadata->getStrTitle());
         $objModule->setStrAspect(class_module_system_aspect::getAspectByName("management")->getSystemid());
         $objModule->updateObjectToDb();
     }
     return $strReturn;
 }
 public function install()
 {
     $strReturn = "";
     $strReturn .= "Installing table packageserver_log...\n";
     $arrFields = array();
     $arrFields["log_id"] = array("char20", false);
     $arrFields["log_query"] = array("text", true);
     $arrFields["log_ip"] = array("char254", true);
     $arrFields["log_hostname"] = array("char254", true);
     $arrFields["log_date"] = array("long", true);
     if (!$this->objDB->createTable("packageserver_log", $arrFields, array("log_id"), array("log_date"), false)) {
         $strReturn .= "An error occurred! ...\n";
     }
     //register the module
     $this->registerModule("packageserver", _packageserver_module_id_, "class_module_packageserver_portal.php", "class_module_packageserver_admin.php", $this->objMetadata->getStrVersion(), true);
     $strReturn .= "creating package-upload-repository...\n";
     $objFilesytem = new class_filesystem();
     $objFilesytem->folderCreate("/files/packages");
     $objRepo = new class_module_mediamanager_repo();
     $objRepo->setStrPath("/files/packages");
     $objRepo->setStrViewFilter(".zip");
     $objRepo->setStrUploadFilter(".zip");
     $objRepo->setStrTitle("Packageserver packages");
     $objRepo->updateObjectToDb();
     class_carrier::getInstance()->getObjRights()->addGroupToRight(class_module_system_setting::getConfigValue("_guests_group_id_"), $objRepo->getSystemid(), class_rights::$STR_RIGHT_RIGHT2);
     $strReturn .= "Registering system-constants...\n";
     $this->registerConstant("_packageserver_repo_id_", "", class_module_system_setting::$int_TYPE_STRING, _packageserver_module_id_);
     $strReturn .= "Setting aspect assignments...\n";
     if (class_module_system_aspect::getAspectByName("content") != null) {
         $objModule = class_module_system_module::getModuleByName($this->objMetadata->getStrTitle());
         $objModule->setStrAspect(class_module_system_aspect::getAspectByName("content")->getSystemid());
         $objModule->updateObjectToDb();
     }
     return $strReturn;
 }
 public function install()
 {
     $strReturn = "";
     $objManager = new class_orm_schemamanager();
     $strReturn .= "Installing table rating...\n";
     $objManager->createTable("class_module_rating_rate");
     $strReturn .= "Installing table rating_history...\n";
     $arrFields = array();
     $arrFields["rating_history_id"] = array("char20", false);
     $arrFields["rating_history_rating"] = array("char20", true);
     $arrFields["rating_history_user"] = array("char20", true);
     $arrFields["rating_history_timestamp"] = array("int", true);
     $arrFields["rating_history_value"] = array("double", true);
     if (!$this->objDB->createTable("rating_history", $arrFields, array("rating_history_id"))) {
         $strReturn .= "An error occurred! ...\n";
     }
     //register the module
     $strSystemID = $this->registerModule("rating", _rating_modul_id_, "class_module_rating_portal.php", "", $this->objMetadata->getStrVersion(), false, "class_module_rating_portal_xml.php");
     $strReturn .= "Module registered. Module-ID: " . $strSystemID . " \n";
     $strReturn .= "Setting aspect assignments...\n";
     if (class_module_system_aspect::getAspectByName("content") != null) {
         $objModule = class_module_system_module::getModuleByName($this->objMetadata->getStrTitle());
         $objModule->setStrAspect(class_module_system_aspect::getAspectByName("content")->getSystemid());
         $objModule->updateObjectToDb();
     }
     return $strReturn;
 }
 public function install()
 {
     $strReturn = "";
     $objManager = new class_orm_schemamanager();
     $strReturn .= "Installing table votings_voting...\n";
     $objManager->createTable("class_module_votings_voting");
     $strReturn .= "Installing table votings_answer...\n";
     $objManager->createTable("class_module_votings_answer");
     //register the module
     $strSystemID = $this->registerModule($this->objMetadata->getStrTitle(), _votings_module_id_, "class_module_votings_portal.php", "class_module_votings_admin.php", $this->objMetadata->getStrVersion(), true);
     //modify default rights to allow guests to vote
     $strReturn .= "Modifying modules' rights node...\n";
     class_carrier::getInstance()->getObjRights()->addGroupToRight(class_module_system_setting::getConfigValue("_guests_group_id_"), $strSystemID, "right1");
     $strReturn .= "Registering votings-element...\n";
     if (class_module_pages_element::getElement("votings") == null) {
         $objElement = new class_module_pages_element();
         $objElement->setStrName("votings");
         $objElement->setStrClassAdmin("class_element_votings_admin.php");
         $objElement->setStrClassPortal("class_element_votings_portal.php");
         $objElement->setIntCachetime(-1);
         $objElement->setIntRepeat(1);
         $objElement->setStrVersion($this->objMetadata->getStrVersion());
         $objElement->updateObjectToDb();
         $strReturn .= "Element registered...\n";
     } else {
         $strReturn .= "Element already installed!...\n";
     }
     $strReturn .= "Setting aspect assignments...\n";
     if (class_module_system_aspect::getAspectByName("content") != null) {
         $objModule = class_module_system_module::getModuleByName($this->objMetadata->getStrTitle());
         $objModule->setStrAspect(class_module_system_aspect::getAspectByName("content")->getSystemid());
         $objModule->updateObjectToDb();
     }
     return $strReturn;
 }
 /**
  * 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_aspect::getAspectByName("content") !== null) {
         $objDashboard = new class_module_dashboard_widget();
         $objDashboard->setStrColumn("column2");
         $objDashboard->setStrUser($strUserid);
         $objDashboard->setStrClass(__CLASS__);
         $objDashboard->setStrContent("a:1:{s:7:\"content\";s:1460:\"Welcome to Kajona V4!<br /><br  />Kajona is developed by volunteers all over the world - show them your support by liking Kajona on facebook or donating a beer.<div id=\"fb-root\"></div><script>(function(d, s, id) {  var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = \"//connect.facebook.net/en_US/all.js#appId=141503865945925&xfbml=1\"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script><div class=\"fb-like\" data-href=\"https://www.facebook.com/pages/Kajona%C2%B3/156841314360532\" data-send=\"false\" data-layout=\"button_count\" data-width=\"60\" data-show-faces=\"false\"></div><form action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\"><input type=\"hidden\" name=\"cmd\" value=\"_donations\" /> <input type=\"hidden\" name=\"business\" value=\"donate@kajona.de\" /> <input type=\"hidden\" name=\"item_name\" value=\"Kajona Development\" /> <input type=\"hidden\" name=\"no_shipping\" value=\"0\" /> <input type=\"hidden\" name=\"no_note\" value=\"1\" /> <input type=\"hidden\" name=\"currency_code\" value=\"EUR\" /> <input type=\"hidden\" name=\"tax\" value=\"0\" /> <input type=\"hidden\" name=\"bn\" value=\"PP-DonationsBF\" /> <input type=\"image\" border=\"0\" src=\"https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif\" name=\"submit\" alt=\"PayPal - The safer, easier way to pay online!\" /> <img height=\"1\" width=\"1\" border=\"0\" alt=\"\" src=\"https://www.paypal.com/en_US/i/scr/pixel.gif\" /></form>\";}");
         return $objDashboard->updateObjectToDb(class_module_dashboard_widget::getWidgetsRootNodeForUser($strUserid, class_module_system_aspect::getAspectByName("content")->getSystemid()));
     }
     return true;
 }
 /**
  * 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("column3");
         $objDashboard->setStrUser($strUserid);
         $objDashboard->setStrClass(__CLASS__);
         $objDashboard->setStrContent("a:1:{s:8:\"nrofrows\";s:1:\"1\";}");
         return $objDashboard->updateObjectToDb(class_module_dashboard_widget::getWidgetsRootNodeForUser($strUserid, class_module_system_aspect::getAspectByName("management")->getSystemid()));
     }
     return true;
 }
 /**
  *
  * @param string $strEventName
  * @param array $arrArguments
  *
  * @return bool
  */
 public function handleEvent($strEventName, array $arrArguments)
 {
     //unwrap arguments
     list($strSystemid, $strSourceClass) = $arrArguments;
     if ($strSourceClass == "class_module_system_aspect") {
         //if we have just one aspect remaining, set this one as default
         if (class_module_system_aspect::getObjectCount() == 1) {
             /** @var class_module_system_aspect[] $arrObjAspects */
             $arrObjAspects = class_module_system_aspect::getObjectList();
             $objOneAspect = $arrObjAspects[0];
             $objOneAspect->setBitDefault(1);
             return $objOneAspect->updateObjectToDb();
         }
     }
     return true;
 }
 public function testEventHandler()
 {
     self::$bitHandled = false;
     $objAspect = new class_module_system_aspect();
     $objAspect->setStrName("test");
     $objAspect->updateObjectToDb();
     class_core_eventdispatcher::getInstance()->addListener(class_system_eventidentifier::EVENT_SYSTEM_STATUSCHANGED, new class_test_statuchangedhandler($objAspect->getSystemid(), $this));
     $this->assertTrue(!self::$bitHandled);
     $objAspect->setIntRecordStatus(0);
     $this->assertTrue(!self::$bitHandled);
     $objAspect->updateObjectToDb();
     $this->assertTrue(self::$bitHandled);
     $objAspect->deleteObjectFromDatabase();
 }
 public function install()
 {
     $strReturn = "";
     $objSchemamanager = new class_orm_schemamanager();
     //faqs cat-------------------------------------------------------------------------------------
     $strReturn .= "Installing table faqs_category...\n";
     $objSchemamanager->createTable("class_module_faqs_category");
     //faqs----------------------------------------------------------------------------------
     $strReturn .= "Installing table faqs...\n";
     $objSchemamanager->createTable("class_module_faqs_faq");
     //register the module
     $this->registerModule("faqs", _faqs_module_id_, "class_module_faqs_portal.php", "class_module_faqs_admin.php", $this->objMetadata->getStrVersion(), true);
     //Table for page-element
     $strReturn .= "Installing faqs-element table...\n";
     $arrFields = array();
     $arrFields["content_id"] = array("char20", false);
     $arrFields["faqs_category"] = array("char20", true);
     $arrFields["faqs_template"] = array("char254", true);
     if (!$this->objDB->createTable("element_faqs", $arrFields, array("content_id"))) {
         $strReturn .= "An error occurred! ...\n";
     }
     //Register the element
     $strReturn .= "Registering faqs-element...\n";
     //check, if not already existing
     $objElement = class_module_pages_element::getElement("faqs");
     if ($objElement == null) {
         $objElement = new class_module_pages_element();
         $objElement->setStrName("faqs");
         $objElement->setStrClassAdmin("class_element_faqs_admin.php");
         $objElement->setStrClassPortal("class_element_faqs_portal.php");
         $objElement->setIntCachetime(3600);
         $objElement->setIntRepeat(1);
         $objElement->setStrVersion($this->objMetadata->getStrVersion());
         $objElement->updateObjectToDb();
         $strReturn .= "Element registered...\n";
     } else {
         $strReturn .= "Element already installed!...\n";
     }
     $strReturn .= "Setting aspect assignments...\n";
     if (class_module_system_aspect::getAspectByName("content") != null) {
         $objModule = class_module_system_module::getModuleByName($this->objMetadata->getStrTitle());
         $objModule->setStrAspect(class_module_system_aspect::getAspectByName("content")->getSystemid());
         $objModule->updateObjectToDb();
     }
     return $strReturn;
 }
Example #10
0
 public function testTagAssignmentRemoval()
 {
     //related to checkin #6111
     $objTag = new class_module_tags_tag();
     $objTag->setStrName(generateSystemid());
     $objTag->updateObjectToDb();
     $objAspect = new class_module_system_aspect();
     $objAspect->setStrName(generateSystemid());
     $objAspect->updateObjectToDb();
     $objTag->assignToSystemrecord($objAspect->getSystemid());
     $this->flushDBCache();
     $this->assertEquals(count($objTag->getArrAssignedRecords()), 1);
     $this->assertEquals(count(class_module_tags_tag::getTagsForSystemid($objAspect->getSystemid())), 1);
     $objTag->removeFromSystemrecord($objAspect->getSystemid(), "");
     $this->flushDBCache();
     $this->assertEquals(count($objTag->getArrAssignedRecords()), 0);
     $this->assertEquals(count(class_module_tags_tag::getTagsForSystemid($objAspect->getSystemid())), 0);
     $objTag->deleteObjectFromDatabase();
     $objAspect->deleteObjectFromDatabase();
 }
 public function testIndexEvent()
 {
     if (class_module_system_module::getModuleByName("tags") == null || class_module_system_module::getModuleByName("system") == null) {
         return;
     }
     $strSearchKey1 = generateSystemid();
     $objAspect = new class_module_system_aspect();
     $objAspect->setStrName($strSearchKey1);
     $objAspect->updateObjectToDb();
     $objSearchCommons = new class_module_search_commons();
     $objSearchParams = new class_module_search_search();
     $objSearchParams->setStrQuery($strSearchKey1);
     $arrResult = $objSearchCommons->doIndexedSearch($objSearchParams, null);
     $this->assertEquals(count($arrResult), 1);
     $this->assertEquals($arrResult[0]->getObjObject()->getStrSystemid(), $objAspect->getStrSystemid());
     $strSearchKey2 = generateSystemid();
     $objTag = new class_module_tags_tag();
     $objTag->setStrName($strSearchKey2);
     $objTag->updateObjectToDb();
     $objSearchParams = new class_module_search_search();
     $objSearchParams->setStrQuery($strSearchKey2);
     $arrResult = $objSearchCommons->doIndexedSearch($objSearchParams, null);
     $this->assertEquals(count($arrResult), 1);
     $this->assertEquals($arrResult[0]->getObjObject()->getStrSystemid(), $objTag->getStrSystemid());
     $objTag->assignToSystemrecord($objAspect->getStrSystemid());
     $arrResult = $objSearchCommons->doIndexedSearch($objSearchParams, null);
     $this->assertEquals(count($arrResult), 2);
     $objSearchParams->setStrInternalFilterModules(_system_modul_id_);
     $arrResult = $objSearchCommons->doIndexedSearch($objSearchParams, null);
     $this->assertEquals(count($arrResult), 1);
     $this->assertEquals($arrResult[0]->getObjObject()->getStrSystemid(), $objAspect->getStrSystemid());
     $objTag->removeFromSystemrecord($objAspect->getStrSystemid());
     //the aspect itself should not be found any more
     $objSearchParams = new class_module_search_search();
     $objSearchParams->setStrQuery($strSearchKey2);
     $arrResult = $objSearchCommons->doIndexedSearch($objSearchParams, null);
     $this->assertEquals(count($arrResult), 1);
     $this->assertEquals($arrResult[0]->getObjObject()->getStrSystemid(), $objTag->getStrSystemid());
     $objAspect->deleteObjectFromDatabase();
     $objTag->deleteObjectFromDatabase();
 }
 /**
  * Renderes the content of a single widget.
  *
  * @return string
  * @permissions view
  */
 protected function actionGetWidgetContent()
 {
     //load the aspect and close the session afterwards
     class_module_system_aspect::getCurrentAspect();
     $objWidgetModel = new class_module_dashboard_widget($this->getSystemid());
     if ($objWidgetModel->rightView()) {
         $objConcreteWidget = $objWidgetModel->getConcreteAdminwidget();
         if (!$objConcreteWidget->getBitBlockSessionClose()) {
             class_carrier::getInstance()->getObjSession()->sessionClose();
         }
         //disable the internal changelog
         class_module_system_changelog::$bitChangelogEnabled = false;
         class_response_object::getInstance()->setStrResponseType(class_http_responsetypes::STR_TYPE_JSON);
         $strReturn = json_encode($objConcreteWidget->generateWidgetOutput());
     } else {
         class_response_object::getInstance()->setStrStatusCode(class_http_statuscodes::SC_UNAUTHORIZED);
         $strReturn = "<message><error>" . xmlSafeString($this->getLang("commons_error_permissions")) . "</error></message>";
     }
     return $strReturn;
 }
 public function install()
 {
     $strReturn = "";
     $objManager = new class_orm_schemamanager();
     $strReturn .= "Installing table news_category...\n";
     $objManager->createTable("class_module_news_category");
     $strReturn .= "Installing table news...\n";
     $objManager->createTable("class_module_news_news");
     $strReturn .= "Installing table news_feed...\n";
     $objManager->createTable("class_module_news_feed");
     //register the module
     $this->registerModule("news", _news_module_id_, "class_module_news_portal.php", "class_module_news_admin.php", $this->objMetadata->getStrVersion(), true, "class_module_news_portal_xml.php");
     $strReturn .= "Installing news-element table...\n";
     $objManager->createTable("class_element_news_admin");
     //Register the element
     $strReturn .= "Registering news-element...\n";
     //check, if not already existing
     if (class_module_pages_element::getElement("news") == null) {
         $objElement = new class_module_pages_element();
         $objElement->setStrName("news");
         $objElement->setStrClassAdmin("class_element_news_admin.php");
         $objElement->setStrClassPortal("class_element_news_portal.php");
         $objElement->setIntCachetime(3600);
         $objElement->setIntRepeat(1);
         $objElement->setStrVersion($this->objMetadata->getStrVersion());
         $objElement->updateObjectToDb();
         $strReturn .= "Element registered...\n";
     } else {
         $strReturn .= "Element already installed!...\n";
     }
     $strReturn .= "Setting aspect assignments...\n";
     if (class_module_system_aspect::getAspectByName("content") != null) {
         $objModule = class_module_system_module::getModuleByName($this->objMetadata->getStrTitle());
         $objModule->setStrAspect(class_module_system_aspect::getAspectByName("content")->getSystemid());
         $objModule->updateObjectToDb();
     }
     $strReturn .= "Registering config settings...\n";
     $this->registerConstant("_news_news_datetime_", "false", class_module_system_setting::$int_TYPE_BOOL, _news_module_id_);
     return $strReturn;
 }
 public function install()
 {
     $strReturn = "";
     //Stats table -----------------------------------------------------------------------------------
     $strReturn .= "Installing table stats...\n";
     $arrFields = array();
     $arrFields["stats_id"] = array("char20", false);
     $arrFields["stats_ip"] = array("char20", true);
     $arrFields["stats_hostname"] = array("char254", true);
     $arrFields["stats_date"] = array("int", true);
     $arrFields["stats_page"] = array("char254", true);
     $arrFields["stats_language"] = array("char10", true);
     $arrFields["stats_referer"] = array("char254", true);
     $arrFields["stats_browser"] = array("char254", true);
     $arrFields["stats_session"] = array("char100", true);
     if (!$this->objDB->createTable("stats_data", $arrFields, array("stats_id"), array("stats_date", "stats_hostname", "stats_page", "stats_referer", "stats_browser"), false)) {
         $strReturn .= "An error occurred! ...\n";
     }
     $strReturn .= "Installing table ip2country...\n";
     $arrFields = array();
     $arrFields["ip2c_ip"] = array("char20", false);
     $arrFields["ip2c_name"] = array("char100", false);
     if (!$this->objDB->createTable("stats_ip2country", $arrFields, array("ip2c_ip"), array(), false)) {
         $strReturn .= "An error occurred! ...\n";
     }
     //register module
     $this->registerModule("stats", _stats_modul_id_, "class_module_stats_portal.php", "class_module_stats_admin.php", $this->objMetadata->getStrVersion(), true, "", "class_module_stats_admin_xml.php");
     $strReturn .= "Registering system-constants...\n";
     //Number of rows in the login-log
     $this->registerConstant("_stats_duration_online_", "300", class_module_system_setting::$int_TYPE_INT, _stats_modul_id_);
     $this->registerConstant("_stats_exclusionlist_", _webpath_, class_module_system_setting::$int_TYPE_STRING, _stats_modul_id_);
     $strReturn .= "Setting aspect assignments...\n";
     if (class_module_system_aspect::getAspectByName("management") != null) {
         $objModule = class_module_system_module::getModuleByName($this->objMetadata->getStrTitle());
         $objModule->setStrAspect(class_module_system_aspect::getAspectByName("management")->getSystemid());
         $objModule->updateObjectToDb();
     }
     $strReturn .= $this->extractBrowscap();
     return $strReturn;
 }
 public function install()
 {
     $strReturn = "Installing " . $this->objMetadata->getStrTitle() . "...\n";
     $objManager = new class_orm_schemamanager();
     $strReturn .= "Installing table navigation...\n";
     $objManager->createTable("class_module_navigation_point");
     //register the module
     $this->registerModule("navigation", _navigation_modul_id_, "class_module_navigation_portal.php", "class_module_navigation_admin.php", $this->objMetadata->getStrVersion(), true);
     $strReturn .= "Installing navigation-element table...\n";
     $objManager->createTable("class_element_navigation_admin");
     //Register the element
     $strReturn .= "Registering navigation-element...\n";
     //check, if not already existing
     $objElement = null;
     try {
         $objElement = class_module_pages_element::getElement("navigation");
     } catch (class_exception $objEx) {
     }
     if ($objElement == null) {
         $objElement = new class_module_pages_element();
         $objElement->setStrName("navigation");
         $objElement->setStrClassAdmin("class_element_navigation_admin.php");
         $objElement->setStrClassPortal("class_element_navigation_portal.php");
         $objElement->setIntCachetime(3600);
         $objElement->setIntRepeat(0);
         $objElement->setStrVersion($this->objMetadata->getStrVersion());
         $objElement->updateObjectToDb();
         $strReturn .= "Element registered...\n";
     } else {
         $strReturn .= "Element already installed!...\n";
     }
     $strReturn .= "Setting aspect assignments...\n";
     if (class_module_system_aspect::getAspectByName("content") != null) {
         $objModule = class_module_system_module::getModuleByName($this->objMetadata->getStrTitle());
         $objModule->setStrAspect(class_module_system_aspect::getAspectByName("content")->getSystemid());
         $objModule->updateObjectToDb();
     }
     return $strReturn;
 }
 public function install()
 {
     $strReturn = "";
     $objManager = new class_orm_schemamanager();
     $strReturn .= "Installing table guestbook_book...\n";
     $objManager->createTable("class_module_guestbook_guestbook");
     $strReturn .= "Installing table guestbook_post...\n";
     $objManager->createTable("class_module_guestbook_post");
     //register the module
     $this->registerModule("guestbook", _guestbook_module_id_, "class_module_guestbook_portal.php", "class_module_guestbook_admin.php", $this->objMetadata->getStrVersion(), true);
     //Table for page-element
     $strReturn .= "Installing guestbook-element table...\n";
     $objManager->createTable("class_element_guestbook_admin");
     //Register the element
     $strReturn .= "Registering guestbook-element...\n";
     //check, if not already existing
     $objElement = class_module_pages_element::getElement("guestbook");
     if ($objElement === null) {
         $objElement = new class_module_pages_element();
         $objElement->setStrName("guestbook");
         $objElement->setStrClassAdmin("class_element_guestbook_admin.php");
         $objElement->setStrClassPortal("class_element_guestbook_portal.php");
         $objElement->setIntCachetime(3600);
         $objElement->setIntRepeat(1);
         $objElement->setStrVersion($this->objMetadata->getStrVersion());
         $objElement->updateObjectToDb();
         $strReturn .= "Element registered...\n";
     } else {
         $strReturn .= "Element already installed!...\n";
     }
     $strReturn .= "Setting aspect assignments...\n";
     if (class_module_system_aspect::getAspectByName("content") != null) {
         $objModule = class_module_system_module::getModuleByName($this->objMetadata->getStrTitle());
         $objModule->setStrAspect(class_module_system_aspect::getAspectByName("content")->getSystemid());
         $objModule->updateObjectToDb();
     }
     return $strReturn;
 }
Example #17
0
 function testCopySystemStatus()
 {
     $objAspect = new class_module_system_aspect();
     $objAspect->setStrName("copytest");
     $objAspect->updateObjectToDb();
     $strSysid = $objAspect->getSystemid();
     $objAspect->setIntRecordStatus(0);
     $objAspect->updateObjectToDb();
     $objAspect->copyObject();
     $strCopyId = $objAspect->getSystemid();
     $objAspect = new class_module_system_aspect($strSysid);
     $objCopy = new class_module_system_aspect($strCopyId);
     $this->assertEquals($objAspect->getStrName(), $objCopy->getStrName());
     $this->assertEquals($objAspect->getStrPrevId(), $objCopy->getStrPrevId());
     $this->assertEquals($objAspect->getIntRecordStatus(), $objCopy->getIntRecordStatus());
     $this->assertEquals($objAspect->getStrRecordClass(), $objCopy->getStrRecordClass());
     $this->assertNotEquals($objAspect->getSystemid(), $objCopy->getSystemid());
 }
Example #18
0
 public function testPrevIdHandling()
 {
     $objAspect = new class_module_system_aspect();
     $objAspect->setStrName("autotest");
     $bitThrown = false;
     try {
         $objAspect->updateObjectToDb("invalid");
     } catch (class_exception $objEx) {
         $bitThrown = true;
     }
     $this->assertTrue($bitThrown);
     $this->assertTrue($objAspect->getSystemid() == "");
     $this->assertTrue(!validateSystemid($objAspect->getSystemid()));
     $this->assertTrue(!validateSystemid($objAspect->getStrPrevId()));
     $this->assertTrue($objAspect->updateObjectToDb());
     $this->assertTrue($objAspect->getSystemid() != "");
     $this->assertTrue(validateSystemid($objAspect->getSystemid()));
     $this->assertTrue(validateSystemid($objAspect->getStrPrevId()));
 }
 function testTreeSortBehaviour()
 {
     $objDB = class_carrier::getInstance()->getObjDB();
     //test the setToPos
     echo "\tposition handling...\n";
     //create 10 test records
     $objAspect = new class_module_system_aspect();
     //new base-node
     $objAspect->updateObjectToDb();
     $strBaseNodeId = $objAspect->getSystemid();
     $arrNodes = array();
     for ($intI = 1; $intI <= 10; $intI++) {
         $objAspect = new class_module_system_aspect();
         $objAspect->updateObjectToDb($strBaseNodeId);
         $arrNodes[] = $objAspect->getSystemid();
     }
     //initial movings
     $objAspect = new class_module_system_aspect($arrNodes[1]);
     $objAspect->setPosition("upwards");
     $arrNodes = $objDB->getPArray("SELECT system_id FROM " . _dbprefix_ . "system WHERE system_prev_id = ? ORDER BY system_sort ASC", array($strBaseNodeId));
     echo "\trelative shiftings...\n";
     //move the third to the first pos
     $objAspect = new class_module_system_aspect($arrNodes[2]["system_id"]);
     $objAspect->setPosition("upwards");
     $objAspect->setPosition("upwards");
     $objAspect->setPosition("upwards");
     //next one should be with no effect
     $objAspect->setPosition("upwards");
     $objDB->flushQueryCache();
     $arrNodesAfter = $objDB->getPArray("SELECT system_id FROM " . _dbprefix_ . "system WHERE system_prev_id = ? ORDER BY system_sort ASC", array($strBaseNodeId));
     $this->assertEquals($arrNodesAfter[0]["system_id"], $arrNodes[2]["system_id"], __FILE__ . " checkPositionShitftingByRelativeShift");
     $this->assertEquals($arrNodesAfter[1]["system_id"], $arrNodes[0]["system_id"], __FILE__ . " checkPositionShitftingByRelativeShift");
     $this->assertEquals($arrNodesAfter[2]["system_id"], $arrNodes[1]["system_id"], __FILE__ . " checkPositionShitftingByRelativeShift");
     //moving by set pos
     echo "\tabsolute shifting..\n";
     $objDB->flushQueryCache();
     $arrNodes = $objDB->getPArray("SELECT system_id FROM " . _dbprefix_ . "system WHERE system_prev_id = ? ORDER BY system_sort ASC", array($strBaseNodeId));
     $objDB->flushQueryCache();
     $objAspect = new class_module_system_aspect($arrNodes[2]["system_id"]);
     $objAspect->setAbsolutePosition(1);
     $arrNodesAfter = $objDB->getPArray("SELECT system_id FROM " . _dbprefix_ . "system WHERE system_prev_id = ? ORDER BY system_sort ASC", array($strBaseNodeId));
     $this->assertEquals($arrNodesAfter[0]["system_id"], $arrNodes[2]["system_id"], __FILE__ . " checkPositionShitftingByAbsoluteShift");
     $this->assertEquals($arrNodesAfter[1]["system_id"], $arrNodes[0]["system_id"], __FILE__ . " checkPositionShitftingByAbsoluteShift");
     $this->assertEquals($arrNodesAfter[2]["system_id"], $arrNodes[1]["system_id"], __FILE__ . " checkPositionShitftingByAbsoluteShift");
     //and back...
     $objDB->flushQueryCache();
     $objAspect = new class_module_system_aspect($arrNodes[2]["system_id"]);
     $objAspect->setAbsolutePosition(3);
     $objDB->flushQueryCache();
     $arrNodesAfter = $objDB->getPArray("SELECT system_id FROM " . _dbprefix_ . "system WHERE system_prev_id = ? ORDER BY system_sort ASC", array($strBaseNodeId));
     $this->assertEquals($arrNodesAfter[0]["system_id"], $arrNodes[0]["system_id"], __FILE__ . " checkPositionShitftingByAbsoluteShift");
     $this->assertEquals($arrNodesAfter[1]["system_id"], $arrNodes[1]["system_id"], __FILE__ . " checkPositionShitftingByAbsoluteShift");
     $this->assertEquals($arrNodesAfter[2]["system_id"], $arrNodes[2]["system_id"], __FILE__ . " checkPositionShitftingByAbsoluteShift");
     //deleting all records created
     foreach ($arrNodes as $arrOneNode) {
         $objAspect = new class_module_system_aspect($arrOneNode["system_id"]);
         $objAspect->deleteObjectFromDatabase();
     }
     $objAspect = new class_module_system_aspect($strBaseNodeId);
     $objAspect->deleteObjectFromDatabase();
 }
 /**
  * @return string
  * @throws class_exception
  * @permissions edit
  */
 protected function actionSwitchToUser()
 {
     $strReturn = "";
     if (class_module_system_module::getModuleByName("system")->rightEdit() && class_carrier::getInstance()->getObjSession()->isSuperAdmin()) {
         //reset the aspect
         $strAddon = "";
         $objDefaultAspect = class_module_system_aspect::getDefaultAspect();
         if ($objDefaultAspect !== null) {
             $strAddon = "&aspect=" . $objDefaultAspect->getSystemid();
         }
         $objNewUser = new class_module_user_user($this->getSystemid());
         if ($this->objSession->switchSessionToUser($objNewUser)) {
             class_admin_helper::flushActionNavigationCache();
             $this->adminReload(class_link::getLinkAdminHref("dashboard", "", $strAddon));
             return "";
         } else {
             throw new class_exception("session switch failed", class_exception::$level_ERROR);
         }
     } else {
         $strReturn .= $this->getLang("commons_error_permissions");
     }
     return $strReturn;
 }
 /**
  * Renders the list of aspects available
  *
  * @param string $strLastModule
  * @param string $strLastAction
  * @param string $strLastSystemid
  *
  * @return string
  * @todo param handling? remove params?
  */
 public function getAspectChooser($strLastModule, $strLastAction, $strLastSystemid)
 {
     $strTemplateID = $this->objTemplate->readTemplate("/elements.tpl", "aspect_chooser");
     $strTemplateRowID = $this->objTemplate->readTemplate("/elements.tpl", "aspect_chooser_entry");
     $arrTemplate = array();
     $arrTemplate["options"] = "";
     //process rows
     $strCurrentId = class_module_system_aspect::getCurrentAspectId();
     $arrAspects = class_module_system_aspect::getActiveObjectList();
     $intNrOfAspects = 0;
     foreach ($arrAspects as $objSingleAspect) {
         if ($objSingleAspect->rightView()) {
             $arrSubtemplate = array();
             //start on dashboard since the current module may not be visible in another aspect
             $arrSubtemplate["value"] = getLinkAdminHref("dashboard", "", "&aspect=" . $objSingleAspect->getSystemid());
             $arrSubtemplate["name"] = $objSingleAspect->getStrDisplayName();
             $arrSubtemplate["selected"] = $strCurrentId == $objSingleAspect->getSystemid() ? "selected=\"selected\"" : "";
             $arrTemplate["options"] .= $this->objTemplate->fillTemplate($arrSubtemplate, $strTemplateRowID);
             $intNrOfAspects++;
         }
     }
     if ($arrTemplate["options"] == "" || $intNrOfAspects < 2) {
         return "";
     }
     return $this->objTemplate->fillTemplate($arrTemplate, $strTemplateID);
 }
 public function install()
 {
     $strReturn = "";
     $objManager = new class_orm_schemamanager();
     // System table ---------------------------------------------------------------------------------
     $strReturn .= "Installing table system...\n";
     $arrFields = array();
     $arrFields["system_id"] = array("char20", false);
     $arrFields["system_prev_id"] = array("char20", false);
     $arrFields["system_module_nr"] = array("int", false);
     $arrFields["system_sort"] = array("int", true);
     $arrFields["system_owner"] = array("char20", true);
     $arrFields["system_create_date"] = array("long", true);
     $arrFields["system_lm_user"] = array("char20", true);
     $arrFields["system_lm_time"] = array("int", true);
     $arrFields["system_lock_id"] = array("char20", true);
     $arrFields["system_lock_time"] = array("int", true);
     $arrFields["system_status"] = array("int", true);
     $arrFields["system_class"] = array("char254", true);
     $arrFields["system_comment"] = array("char254", true);
     $arrFields["system_deleted"] = array("int", true);
     if (!$this->objDB->createTable("system", $arrFields, array("system_id"), array("system_prev_id", "system_module_nr", "system_sort", "system_owner", "system_create_date", "system_status", "system_lm_time", "system_lock_time", "system_deleted"))) {
         $strReturn .= "An error occurred! ...\n";
     }
     //Rights table ----------------------------------------------------------------------------------
     $strReturn .= "Installing table system_right...\n";
     $arrFields = array();
     $arrFields["right_id"] = array("char20", false);
     $arrFields["right_inherit"] = array("int", true);
     $arrFields["right_view"] = array("text", true);
     $arrFields["right_edit"] = array("text", true);
     $arrFields["right_delete"] = array("text", true);
     $arrFields["right_right"] = array("text", true);
     $arrFields["right_right1"] = array("text", true);
     $arrFields["right_right2"] = array("text", true);
     $arrFields["right_right3"] = array("text", true);
     $arrFields["right_right4"] = array("text", true);
     $arrFields["right_right5"] = array("text", true);
     $arrFields["right_changelog"] = array("text", true);
     if (!$this->objDB->createTable("system_right", $arrFields, array("right_id"))) {
         $strReturn .= "An error occurred! ...\n";
     }
     // Modul table ----------------------------------------------------------------------------------
     $strReturn .= "Installing table system_module...\n";
     $objManager->createTable("class_module_system_module");
     // Date table -----------------------------------------------------------------------------------
     $strReturn .= "Installing table system_date...\n";
     $arrFields = array();
     $arrFields["system_date_id"] = array("char20", false);
     $arrFields["system_date_start"] = array("long", true);
     $arrFields["system_date_end"] = array("long", true);
     $arrFields["system_date_special"] = array("long", true);
     if (!$this->objDB->createTable("system_date", $arrFields, array("system_date_id"), array("system_date_start", "system_date_end", "system_date_special"))) {
         $strReturn .= "An error occurred! ...\n";
     }
     // Config table ---------------------------------------------------------------------------------
     $strReturn .= "Installing table system_config...\n";
     $arrFields = array();
     $arrFields["system_config_id"] = array("char20", false);
     $arrFields["system_config_name"] = array("char254", true);
     $arrFields["system_config_value"] = array("char254", true);
     $arrFields["system_config_type"] = array("int", true);
     $arrFields["system_config_module"] = array("int", true);
     if (!$this->objDB->createTable("system_config", $arrFields, array("system_config_id"))) {
         $strReturn .= "An error occurred! ...\n";
     }
     // User table -----------------------------------------------------------------------------------
     $strReturn .= "Installing table user...\n";
     $arrFields = array();
     $arrFields["user_id"] = array("char20", false);
     $arrFields["user_username"] = array("char254", true);
     $arrFields["user_subsystem"] = array("char254", true);
     $arrFields["user_logins"] = array("int", true);
     $arrFields["user_lastlogin"] = array("int", true);
     $arrFields["user_active"] = array("int", true);
     $arrFields["user_admin"] = array("int", true);
     $arrFields["user_portal"] = array("int", true);
     $arrFields["user_deleted"] = array("int", true);
     $arrFields["user_admin_skin"] = array("char254", true);
     $arrFields["user_admin_language"] = array("char254", true);
     $arrFields["user_admin_module"] = array("char254", true);
     $arrFields["user_authcode"] = array("char20", true);
     $arrFields["user_items_per_page"] = array("int", true);
     if (!$this->objDB->createTable("user", $arrFields, array("user_id"), array("user_username", "user_subsystem", "user_active", "user_deleted"))) {
         $strReturn .= "An error occurred! ...\n";
     }
     // User table kajona subsystem  -----------------------------------------------------------------
     $strReturn .= "Installing table user_kajona...\n";
     $arrFields = array();
     $arrFields["user_id"] = array("char20", false);
     $arrFields["user_pass"] = array("char254", true);
     $arrFields["user_salt"] = array("char20", true);
     $arrFields["user_email"] = array("char254", true);
     $arrFields["user_forename"] = array("char254", true);
     $arrFields["user_name"] = array("char254", true);
     $arrFields["user_street"] = array("char254", true);
     $arrFields["user_postal"] = array("char254", true);
     $arrFields["user_city"] = array("char254", true);
     $arrFields["user_tel"] = array("char254", true);
     $arrFields["user_mobile"] = array("char254", true);
     $arrFields["user_date"] = array("long", true);
     if (!$this->objDB->createTable("user_kajona", $arrFields, array("user_id"))) {
         $strReturn .= "An error occurred! ...\n";
     }
     // User group table -----------------------------------------------------------------------------
     $strReturn .= "Installing table user_group...\n";
     $arrFields = array();
     $arrFields["group_id"] = array("char20", false);
     $arrFields["group_name"] = array("char254", true);
     $arrFields["group_subsystem"] = array("char254", true);
     if (!$this->objDB->createTable("user_group", $arrFields, array("group_id"), array("group_name", "group_subsystem"))) {
         $strReturn .= "An error occurred! ...\n";
     }
     $strReturn .= "Installing table user_group_kajona...\n";
     $arrFields = array();
     $arrFields["group_id"] = array("char20", false);
     $arrFields["group_desc"] = array("char254", true);
     if (!$this->objDB->createTable("user_group_kajona", $arrFields, array("group_id"))) {
         $strReturn .= "An error occurred! ...\n";
     }
     // User group_members table ---------------------------------------------------------------------
     $strReturn .= "Installing table user_kajona_members...\n";
     $arrFields = array();
     $arrFields["group_member_group_kajona_id"] = array("char20", false);
     $arrFields["group_member_user_kajona_id"] = array("char20", false);
     if (!$this->objDB->createTable("user_kajona_members", $arrFields, array("group_member_group_kajona_id", "group_member_user_kajona_id"))) {
         $strReturn .= "An error occurred! ...\n";
     }
     // User log table -------------------------------------------------------------------------------
     $strReturn .= "Installing table user_log...\n";
     $arrFields = array();
     $arrFields["user_log_id"] = array("char20", false);
     $arrFields["user_log_userid"] = array("char254", true);
     $arrFields["user_log_date"] = array("long", true);
     $arrFields["user_log_status"] = array("int", true);
     $arrFields["user_log_ip"] = array("char20", true);
     $arrFields["user_log_sessid"] = array("char20", true);
     $arrFields["user_log_enddate"] = array("long", true);
     if (!$this->objDB->createTable("user_log", $arrFields, array("user_log_id"), array("user_log_sessid"))) {
         $strReturn .= "An error occurred! ...\n";
     }
     // Sessionmgtm ----------------------------------------------------------------------------------
     $strReturn .= "Installing table session...\n";
     $arrFields = array();
     $arrFields["session_id"] = array("char20", false);
     $arrFields["session_phpid"] = array("char254", true);
     $arrFields["session_userid"] = array("char20", true);
     $arrFields["session_groupids"] = array("text", true);
     $arrFields["session_releasetime"] = array("int", true);
     $arrFields["session_loginstatus"] = array("char254", true);
     $arrFields["session_loginprovider"] = array("char20", true);
     $arrFields["session_lasturl"] = array("char500", true);
     if (!$this->objDB->createTable("session", $arrFields, array("session_id"), array("session_phpid", "session_releasetime", "session_userid"))) {
         $strReturn .= "An error occurred! ...\n";
     }
     // caching --------------------------------------------------------------------------------------
     $strReturn .= "Installing table cache...\n";
     $arrFields = array();
     $arrFields["cache_id"] = array("char20", false);
     $arrFields["cache_source"] = array("char254", true);
     $arrFields["cache_hash1"] = array("char254", true);
     $arrFields["cache_hash2"] = array("char254", true);
     $arrFields["cache_language"] = array("char20", true);
     $arrFields["cache_content"] = array("longtext", true);
     $arrFields["cache_leasetime"] = array("int", true);
     $arrFields["cache_hits"] = array("int", true);
     if (!$this->objDB->createTable("cache", $arrFields, array("cache_id"), array("cache_source", "cache_hash1", "cache_leasetime", "cache_language"), false)) {
         $strReturn .= "An error occurred! ...\n";
     }
     //languages -------------------------------------------------------------------------------------
     $strReturn .= "Installing table languages...\n";
     $objManager->createTable("class_module_languages_language");
     $strReturn .= "Installing table languages_languageset...\n";
     $arrFields = array();
     $arrFields["languageset_id"] = array("char20", false);
     $arrFields["languageset_language"] = array("char20", true);
     $arrFields["languageset_systemid"] = array("char20", true);
     if (!$this->objDB->createTable("languages_languageset", $arrFields, array("languageset_id", "languageset_systemid"))) {
         $strReturn .= "An error occurred! ...\n";
     }
     //aspects --------------------------------------------------------------------------------------
     $strReturn .= "Installing table aspects...\n";
     $objManager->createTable("class_module_system_aspect");
     //changelog -------------------------------------------------------------------------------------
     $strReturn .= "Installing table changelog...\n";
     $this->installChangeTables();
     //messages
     $strReturn .= "Installing table messages...\n";
     $objManager->createTable("class_module_messaging_message");
     $objManager->createTable("class_module_messaging_config");
     //Now we have to register module by module
     //The Systemkernel
     $this->registerModule("system", _system_modul_id_, "", "class_module_system_admin.php", $this->objMetadata->getStrVersion(), true, "", "class_module_system_admin_xml.php");
     //The Rightsmodule
     $this->registerModule("right", _system_modul_id_, "", "class_module_right_admin.php", $this->objMetadata->getStrVersion(), false);
     //The Usermodule
     $this->registerModule("user", _user_modul_id_, "", "class_module_user_admin.php", $this->objMetadata->getStrVersion(), true);
     //languages
     $this->registerModule("languages", _languages_modul_id_, "class_modul_languages_portal.php", "class_module_languages_admin.php", $this->objMetadata->getStrVersion(), true);
     //messaging
     $this->registerModule("messaging", _messaging_module_id_, "", "class_module_messaging_admin.php", $this->objMetadata->getStrVersion(), true);
     //Registering a few constants
     $strReturn .= "Registering system-constants...\n";
     //And the default skin
     $this->registerConstant("_admin_skin_default_", "kajona_v4", class_module_system_setting::$int_TYPE_STRING, _user_modul_id_);
     //and a few system-settings
     $this->registerConstant("_system_portal_disable_", "false", class_module_system_setting::$int_TYPE_BOOL, _system_modul_id_);
     $this->registerConstant("_system_portal_disablepage_", "", class_module_system_setting::$int_TYPE_PAGE, _system_modul_id_);
     //New in 3.0: Number of db-dumps to hold
     $this->registerConstant("_system_dbdump_amount_", 5, class_module_system_setting::$int_TYPE_INT, _system_modul_id_);
     //new in 3.0: mod-rewrite on / off
     $this->registerConstant("_system_mod_rewrite_", "false", class_module_system_setting::$int_TYPE_BOOL, _system_modul_id_);
     //New Constant: Max time to lock records
     $this->registerConstant("_system_lock_maxtime_", 7200, class_module_system_setting::$int_TYPE_INT, _system_modul_id_);
     //Email to send error-reports
     $this->registerConstant("_system_admin_email_", $this->objSession->getSession("install_email"), class_module_system_setting::$int_TYPE_STRING, _system_modul_id_);
     $this->registerConstant("_system_email_defaultsender_", $this->objSession->getSession("install_email"), class_module_system_setting::$int_TYPE_STRING, _system_modul_id_);
     $this->registerConstant("_system_email_forcesender_", "false", class_module_system_setting::$int_TYPE_BOOL, _system_modul_id_);
     //3.0.2: user are allowed to change their settings?
     $this->registerConstant("_user_selfedit_", "true", class_module_system_setting::$int_TYPE_BOOL, _user_modul_id_);
     //3.1: nr of rows in admin
     $this->registerConstant("_admin_nr_of_rows_", 15, class_module_system_setting::$int_TYPE_INT, _system_modul_id_);
     $this->registerConstant("_admin_only_https_", "false", class_module_system_setting::$int_TYPE_BOOL, _system_modul_id_);
     //3.1: remoteloader max cachtime --> default 60 min
     $this->registerConstant("_remoteloader_max_cachetime_", 60 * 60, class_module_system_setting::$int_TYPE_INT, _system_modul_id_);
     //3.2: max session duration
     $this->registerConstant("_system_release_time_", 3600, class_module_system_setting::$int_TYPE_INT, _system_modul_id_);
     //3.4: cache buster to be able to flush the browsers cache (JS and CSS files)
     $this->registerConstant("_system_browser_cachebuster_", 0, class_module_system_setting::$int_TYPE_INT, _system_modul_id_);
     //3.4: Adding constant _system_graph_type_ indicating the chart-engine to use
     $this->registerConstant("_system_graph_type_", "jqplot", class_module_system_setting::$int_TYPE_STRING, _system_modul_id_);
     //3.4: Enabling or disabling the internal changehistory
     $this->registerConstant("_system_changehistory_enabled_", "false", class_module_system_setting::$int_TYPE_BOOL, _system_modul_id_);
     $this->registerConstant("_system_timezone_", "", class_module_system_setting::$int_TYPE_STRING, _system_modul_id_);
     //Creating the admin & guest groups
     $objAdminGroup = new class_module_user_group();
     $objAdminGroup->setStrName("Admins");
     $objAdminGroup->updateObjectToDb();
     $strReturn .= "Registered Group Admins...\n";
     $objGuestGroup = new class_module_user_group();
     $objGuestGroup->setStrName("Guests");
     $objGuestGroup->updateObjectToDb();
     $strReturn .= "Registered Group Guests...\n";
     //Systemid of guest-user & admin group
     $strGuestID = $objGuestGroup->getSystemid();
     $strAdminID = $objAdminGroup->getSystemid();
     $this->registerConstant("_guests_group_id_", $strGuestID, class_module_system_setting::$int_TYPE_STRING, _user_modul_id_);
     $this->registerConstant("_admins_group_id_", $strAdminID, class_module_system_setting::$int_TYPE_STRING, _user_modul_id_);
     //Create an root-record for the tree
     //So, lets generate the record
     $strQuery = "INSERT INTO " . _dbprefix_ . "system\n                     ( system_id, system_prev_id, system_module_nr, system_create_date, system_lm_time, system_status, system_sort, system_class) VALUES\n                     (?, ?, ?, ?, ?, ?, ?, ?)";
     //Send the query to the db
     $this->objDB->_pQuery($strQuery, array(0, 0, _system_modul_id_, class_date::getCurrentTimestamp(), time(), 1, 1, "class_module_system_common"));
     //BUT: We have to modify the right-record of the root node, too
     $strGroupsAll = $strGuestID . "," . $strAdminID;
     $strGroupsAdmin = $strAdminID;
     $strQuery = "INSERT INTO " . _dbprefix_ . "system_right\n            (right_id, right_inherit, right_view, right_edit, right_delete, right_right, right_right1, right_right2, right_right3, right_right4, right_right5, right_changelog) VALUES\n            (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
     $this->objDB->_pQuery($strQuery, array(0, 0, $strGroupsAll, $strGroupsAdmin, $strGroupsAdmin, $strGroupsAdmin, $strGroupsAdmin, $strGroupsAdmin, $strGroupsAdmin, $strGroupsAdmin, $strGroupsAdmin, $strGroupsAdmin));
     $this->objDB->flushQueryCache();
     $strReturn .= "Modified root-rights....\n";
     class_carrier::getInstance()->getObjRights()->rebuildRightsStructure();
     $strReturn .= "Rebuilt rights structures...\n";
     //Creating an admin-user
     $strUsername = "******";
     $strPassword = "******";
     $strEmail = "";
     //Login-Data given from installer?
     if ($this->objSession->getSession("install_username") !== false && $this->objSession->getSession("install_username") != "" && $this->objSession->getSession("install_password") !== false && $this->objSession->getSession("install_password") != "") {
         $strUsername = $this->objSession->getSession("install_username");
         $strPassword = $this->objSession->getSession("install_password");
         $strEmail = $this->objSession->getSession("install_email");
     }
     //create a default language
     $strReturn .= "Creating new default-language\n";
     $objLanguage = new class_module_languages_language();
     if ($this->strContentLanguage == "de") {
         $objLanguage->setStrName("de");
     } else {
         $objLanguage->setStrName("en");
     }
     $objLanguage->setBitDefault(true);
     $objLanguage->updateObjectToDb();
     $strReturn .= "ID of new language: " . $objLanguage->getSystemid() . "\n";
     //the admin-language
     $strAdminLanguage = $this->objSession->getAdminLanguage();
     //creating a new default-aspect
     $strReturn .= "Registering new default aspects...\n";
     $objAspect = new class_module_system_aspect();
     $objAspect->setStrName("content");
     $objAspect->setBitDefault(true);
     $objAspect->updateObjectToDb();
     class_module_system_aspect::setCurrentAspectId($objAspect->getSystemid());
     $objAspect = new class_module_system_aspect();
     $objAspect->setStrName("management");
     $objAspect->updateObjectToDb();
     $objUser = new class_module_user_user();
     $objUser->setStrUsername($strUsername);
     $objUser->setIntActive(1);
     $objUser->setIntAdmin(1);
     $objUser->setStrAdminlanguage($strAdminLanguage);
     $objUser->updateObjectToDb();
     $objUser->getObjSourceUser()->setStrPass($strPassword);
     $objUser->getObjSourceUser()->setStrEmail($strEmail);
     $objUser->getObjSourceUser()->updateObjectToDb();
     $strReturn .= "Created User Admin: <strong>Username: "******", Password: ***********</strong> ...\n";
     //The Admin should belong to the admin-Group
     $objAdminGroup->getObjSourceGroup()->addMember($objUser->getObjSourceUser());
     $strReturn .= "Registered Admin in Admin-Group...\n";
     $strReturn .= "Assigning modules to default aspects...\n";
     $objModule = class_module_system_module::getModuleByName("system");
     $objModule->setStrAspect(class_module_system_aspect::getAspectByName("management")->getSystemid());
     $objModule->updateObjectToDb();
     $objModule = class_module_system_module::getModuleByName("user");
     $objModule->setStrAspect(class_module_system_aspect::getAspectByName("management")->getSystemid());
     $objModule->updateObjectToDb();
     $objModule = class_module_system_module::getModuleByName("languages");
     $objModule->setStrAspect(class_module_system_aspect::getAspectByName("management")->getSystemid());
     $objModule->updateObjectToDb();
     $strReturn .= "Trying to copy the *.root files to top-level...\n";
     $arrFiles = array("index.php", "image.php", "xml.php", ".htaccess", "v3_v4_postupdate.php");
     foreach ($arrFiles as $strOneFile) {
         if (!file_exists(_realpath_ . "/" . $strOneFile) && is_file(class_resourceloader::getInstance()->getCorePathForModule("module_system", true) . "/module_system/" . $strOneFile . ".root")) {
             if (!copy(class_resourceloader::getInstance()->getCorePathForModule("module_system", true) . "/module_system/" . $strOneFile . ".root", _realpath_ . "/" . $strOneFile)) {
                 $strReturn .= "<b>Copying " . $strOneFile . ".root to top level failed!!!</b>";
             }
         }
     }
     $strReturn .= "Setting messaging to pos 1 in navigation.../n";
     $objModule = class_module_system_module::getModuleByName("messaging");
     $objModule->setAbsolutePosition(1);
     return $strReturn;
 }
 /**
  * Validates if the requested module is valid for the current aspect.
  * If necessary, the current aspect is updated.
  *
  * @return void
  */
 private function validateAndUpdateCurrentAspect()
 {
     if (_xmlLoader_ === true || $this->getArrModule("template") == "/folderview.tpl") {
         return;
     }
     $objModule = $this->getObjModule();
     $strCurrentAspect = class_module_system_aspect::getCurrentAspectId();
     if ($objModule != null && $objModule->getStrAspect() != "") {
         $arrAspects = explode(",", $objModule->getStrAspect());
         if (count($arrAspects) == 1 && $arrAspects[0] != $strCurrentAspect) {
             $objAspect = new class_module_system_aspect($arrAspects[0]);
             if ($objAspect->rightView()) {
                 class_module_system_aspect::setCurrentAspectId($arrAspects[0]);
             }
         }
     }
 }
 /**
  * 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_aspect::getAspectByName("content") !== null) {
         $objDashboard = new class_module_dashboard_widget();
         $objDashboard->setStrColumn("column3");
         $objDashboard->setStrUser($strUserid);
         $objDashboard->setStrClass(__CLASS__);
         $objDashboard->setStrContent("a:2:{s:7:\"feedurl\";s:39:\"http://www.kajona.de/kajona_news_en.rss\";s:5:\"posts\";s:1:\"4\";}");
         return $objDashboard->updateObjectToDb(class_module_dashboard_widget::getWidgetsRootNodeForUser($strUserid, class_module_system_aspect::getAspectByName("content")->getSystemid()));
     }
     return true;
 }
 /**
  * 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("stats") !== null && class_module_system_aspect::getAspectByName("management") !== null) {
         $objDashboard = new class_module_dashboard_widget();
         $objDashboard->setStrColumn("column2");
         $objDashboard->setStrUser($strUserid);
         $objDashboard->setStrClass(__CLASS__);
         $objDashboard->setStrContent("a:5:{s:7:\"current\";s:7:\"checked\";s:3:\"day\";s:7:\"checked\";s:4:\"last\";s:7:\"checked\";s:6:\"nrLast\";s:1:\"4\";s:5:\"chart\";s:7:\"checked\";}");
         return $objDashboard->updateObjectToDb(class_module_dashboard_widget::getWidgetsRootNodeForUser($strUserid, class_module_system_aspect::getAspectByName("management")->getSystemid()));
     }
     return true;
 }
 /**
  * Wrapper to getCurrentAspect(), returning the ID of the aspect currently selected.
  * If no aspect is selected, an empty string is returned.
  *
  * @return string
  */
 public static function getCurrentAspectId()
 {
     $objAspect = class_module_system_aspect::getCurrentAspect();
     if ($objAspect != null) {
         return $objAspect->getSystemid();
     } else {
         return "";
     }
 }
 public function testLogicalDelete()
 {
     class_orm_base::setObjHandleLogicalDeletedGlobal(class_orm_deletedhandling_enum::INCLUDED());
     $intCountTotal = class_module_system_aspect::getObjectCount();
     class_orm_base::setObjHandleLogicalDeletedGlobal(class_orm_deletedhandling_enum::EXCLUDED());
     $intCountActive = class_module_system_aspect::getObjectCount();
     class_orm_base::setObjHandleLogicalDeletedGlobal(class_orm_deletedhandling_enum::EXCLUSIVE());
     $intCountDeleted = class_module_system_aspect::getObjectCount();
     class_orm_base::setObjHandleLogicalDeletedGlobal(class_orm_deletedhandling_enum::EXCLUDED());
     echo "Creating aspect\n";
     $objAspect1 = new class_module_system_aspect();
     $objAspect1->setStrName("Dummy");
     $objAspect1->updateObjectToDb();
     $objAspect = new class_module_system_aspect();
     $objAspect->setStrName("logical delete");
     $objAspect->updateObjectToDb();
     $strAspectId = $objAspect->getSystemid();
     $this->assertEquals($intCountActive + 2, class_module_system_aspect::getObjectCount());
     $arrAspects = class_module_system_aspect::getObjectList();
     $arrAspects = array_filter($arrAspects, function (class_module_system_aspect $objAspect) use($strAspectId) {
         return $objAspect->getSystemid() == $strAspectId;
     });
     $this->assertEquals(1, count($arrAspects));
     echo "Deleting logically\n";
     $this->assertEquals($objAspect->getIntRecordDeleted(), 0);
     $objAspect->deleteObject();
     $this->assertEquals($objAspect->getIntRecordDeleted(), 1);
     $this->assertEquals($objAspect->getIntSort(), -1);
     class_orm_base::setObjHandleLogicalDeletedGlobal(class_orm_deletedhandling_enum::EXCLUDED());
     echo "Loading non-deleted only\n";
     $this->assertEquals($intCountActive + 1, class_module_system_aspect::getObjectCount());
     $arrAspects = class_module_system_aspect::getObjectList();
     $arrAspects = array_filter($arrAspects, function (class_module_system_aspect $objAspect) use($strAspectId) {
         return $objAspect->getSystemid() == $strAspectId;
     });
     $this->assertEquals(0, count($arrAspects));
     echo "Loading deleted only\n";
     class_orm_base::setObjHandleLogicalDeletedGlobal(class_orm_deletedhandling_enum::EXCLUSIVE());
     $arrAspects = class_module_system_aspect::getObjectList();
     $arrAspects = array_filter($arrAspects, function (class_module_system_aspect $objAspect) use($strAspectId) {
         return $objAspect->getSystemid() == $strAspectId;
     });
     $this->assertEquals($intCountDeleted + 1, class_module_system_aspect::getObjectCount());
     $this->assertEquals(1, count($arrAspects));
     echo "Loading mixed deleted and non-deleted\n";
     class_orm_base::setObjHandleLogicalDeletedGlobal(class_orm_deletedhandling_enum::INCLUDED());
     $arrAspects = class_module_system_aspect::getObjectList();
     $arrAspects = array_filter($arrAspects, function (class_module_system_aspect $objAspect) use($strAspectId) {
         return $objAspect->getSystemid() == $strAspectId;
     });
     $this->assertEquals($intCountTotal + 2, class_module_system_aspect::getObjectCount());
     $this->assertEquals(1, count($arrAspects));
     echo "Deleting from database\n";
     $objAspect->deleteObjectFromDatabase();
     class_orm_base::setObjHandleLogicalDeletedGlobal(class_orm_deletedhandling_enum::EXCLUDED());
     echo "Loading non-deleted only\n";
     $this->assertEquals($intCountActive + 1, class_module_system_aspect::getObjectCount());
     $arrAspects = class_module_system_aspect::getObjectList();
     $arrAspects = array_filter($arrAspects, function (class_module_system_aspect $objAspect) use($strAspectId) {
         return $objAspect->getSystemid() == $strAspectId;
     });
     $this->assertEquals(0, count($arrAspects));
     echo "Loading deleted only\n";
     class_orm_base::setObjHandleLogicalDeletedGlobal(class_orm_deletedhandling_enum::EXCLUSIVE());
     $arrAspects = class_module_system_aspect::getObjectList();
     $arrAspects = array_filter($arrAspects, function (class_module_system_aspect $objAspect) use($strAspectId) {
         return $objAspect->getSystemid() == $strAspectId;
     });
     $this->assertEquals($intCountDeleted, class_module_system_aspect::getObjectCount());
     $this->assertEquals(0, count($arrAspects));
     echo "Deleting dummy node directly\n";
     $objAspect1->deleteObjectFromDatabase();
     echo "Loading non-deleted only\n";
     class_orm_base::setObjHandleLogicalDeletedGlobal(class_orm_deletedhandling_enum::EXCLUDED());
     $this->assertEquals($intCountActive, class_module_system_aspect::getObjectCount());
     echo "Loading deleted only\n";
     class_orm_base::setObjHandleLogicalDeletedGlobal(class_orm_deletedhandling_enum::EXCLUSIVE());
     $this->assertEquals($intCountDeleted, class_module_system_aspect::getObjectCount());
 }
 public function install()
 {
     $strReturn = "Installing " . $this->objMetadata->getStrTitle() . "...\n";
     $objManager = new class_orm_schemamanager();
     $strReturn .= "Installing table pages...\n";
     $objManager->createTable("class_module_pages_page");
     $strReturn .= "Installing table page_folder...\n";
     $objManager->createTable("class_module_pages_folder");
     //folder_properties
     $strReturn .= "Installing table page_properties...\n";
     $arrFields = array();
     $arrFields["pageproperties_id"] = array("char20", false);
     $arrFields["pageproperties_browsername"] = array("char254", true);
     $arrFields["pageproperties_keywords"] = array("char254", true);
     $arrFields["pageproperties_description"] = array("char254", true);
     $arrFields["pageproperties_template"] = array("char254", true);
     $arrFields["pageproperties_seostring"] = array("char254", true);
     $arrFields["pageproperties_language"] = array("char20", true);
     $arrFields["pageproperties_alias"] = array("char254", true);
     $arrFields["pageproperties_path"] = array("char254", true);
     $arrFields["pageproperties_target"] = array("char254", true);
     if (!$this->objDB->createTable("page_properties", $arrFields, array("pageproperties_id", "pageproperties_language"), array("pageproperties_language"))) {
         $strReturn .= "An error occurred! ...\n";
     }
     $strReturn .= "Installing table element...\n";
     $objManager->createTable("class_module_pages_element");
     $strReturn .= "Installing table page_element...\n";
     $objManager->createTable("class_module_pages_pageelement");
     //Now we have to register module by module
     //the pages
     $this->registerModule("pages", _pages_modul_id_, "class_module_pages_portal.php", "class_module_pages_admin.php", $this->objMetadata->getStrVersion(), true);
     //The pages_content
     $this->registerModule("pages_content", _pages_content_modul_id_, "", "class_module_pages_content_admin.php", $this->objMetadata->getStrVersion(), false);
     $strReturn .= "Registering system-constants...\n";
     $this->registerConstant("_pages_templatechange_", "false", class_module_system_setting::$int_TYPE_BOOL, _pages_modul_id_);
     $this->registerConstant("_pages_indexpage_", "index", class_module_system_setting::$int_TYPE_PAGE, _pages_modul_id_);
     $this->registerConstant("_pages_errorpage_", "error", class_module_system_setting::$int_TYPE_PAGE, _pages_modul_id_);
     $this->registerConstant("_pages_defaulttemplate_", "standard.tpl", class_module_system_setting::$int_TYPE_STRING, _pages_modul_id_);
     //2.1.1: overall cachetime
     $this->registerConstant("_pages_cacheenabled_", "true", class_module_system_setting::$int_TYPE_BOOL, _pages_modul_id_);
     //2.1.1: possibility, to create new pages disabled
     $this->registerConstant("_pages_newdisabled_", "false", class_module_system_setting::$int_TYPE_BOOL, _pages_modul_id_);
     //portaleditor
     $this->registerConstant("_pages_portaleditor_", "true", class_module_system_setting::$int_TYPE_BOOL, _pages_modul_id_);
     $strReturn .= "Shifting pages to third position...\n";
     $objModule = class_module_system_module::getModuleByName("pages");
     $objModule->setAbsolutePosition(3);
     //Table for paragraphes
     $strReturn .= "Installing paragraph table...\n";
     $objManager->createTable("class_element_paragraph_admin");
     //Register the element
     $strReturn .= "Registering paragraph...\n";
     //check, if not already existing
     $objElement = null;
     try {
         $objElement = class_module_pages_element::getElement("paragraph");
     } catch (class_exception $objEx) {
     }
     if ($objElement == null) {
         $objElement = new class_module_pages_element();
         $objElement->setStrName("paragraph");
         $objElement->setStrClassAdmin("class_element_paragraph_admin.php");
         $objElement->setStrClassPortal("class_element_paragraph_portal.php");
         $objElement->setIntCachetime(3600 * 24 * 30);
         $objElement->setIntRepeat(1);
         $objElement->setStrVersion($this->objMetadata->getStrVersion());
         $objElement->updateObjectToDb();
         $strReturn .= "Element registered...\n";
     } else {
         $strReturn .= "Element already installed!...\n";
     }
     $strReturn .= "Registering row...\n";
     //check, if not already existing
     $objElement = null;
     try {
         $objElement = class_module_pages_element::getElement("row");
     } catch (class_exception $objEx) {
     }
     if ($objElement == null) {
         $objElement = new class_module_pages_element();
         $objElement->setStrName("row");
         $objElement->setStrClassAdmin("class_element_row_admin.php");
         $objElement->setStrClassPortal("class_element_row_portal.php");
         $objElement->setIntCachetime(3600 * 24 * 30);
         $objElement->setIntRepeat(0);
         $objElement->setStrVersion($this->objMetadata->getStrVersion());
         $objElement->updateObjectToDb();
         $strReturn .= "Element registered...\n";
     } else {
         $strReturn .= "Element already installed!...\n";
     }
     //Table for images
     $strReturn .= "Installing image table...\n";
     $objManager->createTable("class_element_image_admin");
     //Register the element
     $strReturn .= "Registering image...\n";
     //check, if not already existing
     $objElement = null;
     try {
         $objElement = class_module_pages_element::getElement("image");
     } catch (class_exception $objEx) {
     }
     if ($objElement == null) {
         $objElement = new class_module_pages_element();
         $objElement->setStrName("image");
         $objElement->setStrClassAdmin("class_element_image_admin.php");
         $objElement->setStrClassPortal("class_element_image_portal.php");
         $objElement->setIntCachetime(3600 * 24 * 30);
         $objElement->setIntRepeat(1);
         $objElement->setStrVersion($this->objMetadata->getStrVersion());
         $objElement->updateObjectToDb();
         $strReturn .= "Element registered...\n";
     } else {
         $strReturn .= "Element already installed!...\n";
     }
     $strReturn .= "Installing universal element table...\n";
     $arrFields = array();
     $arrFields["content_id"] = array("char20", false);
     $arrFields["char1"] = array("char254", true);
     $arrFields["char2"] = array("char254", true);
     $arrFields["char3"] = array("char254", true);
     $arrFields["int1"] = array("int", true);
     $arrFields["int2"] = array("int", true);
     $arrFields["int3"] = array("int", true);
     $arrFields["text"] = array("text", true);
     if (!$this->objDB->createTable("element_universal", $arrFields, array("content_id"))) {
         $strReturn .= "An error occurred! ...\n";
     }
     $strReturn .= "Setting aspect assignments...\n";
     if (class_module_system_aspect::getAspectByName("content") != null) {
         $objModule = class_module_system_module::getModuleByName($this->objMetadata->getStrTitle());
         $objModule->setStrAspect(class_module_system_aspect::getAspectByName("content")->getSystemid());
         $objModule->updateObjectToDb();
     }
     return $strReturn;
 }
 public function testLockExceptionOnSort()
 {
     $objAspect = new class_module_system_aspect();
     $objAspect->setStrName("test");
     $objAspect->updateObjectToDb();
     $strAspectId = $objAspect->getSystemid();
     $objUser1 = new class_module_user_user();
     $objUser1->setStrUsername(generateSystemid());
     $objUser1->setIntActive(1);
     $objUser1->updateObjectToDb();
     $this->assertTrue(class_carrier::getInstance()->getObjSession()->loginUser($objUser1));
     $objAspect->getLockManager()->lockRecord();
     $this->assertTrue($objAspect->getLockManager()->isLockedByCurrentUser());
     $objUser2 = new class_module_user_user();
     $objUser2->setStrUsername(generateSystemid());
     $objUser2->setIntActive(1);
     $objUser2->updateObjectToDb();
     $this->assertTrue(class_carrier::getInstance()->getObjSession()->loginUser($objUser2));
     $this->assertTrue(!$objAspect->getLockManager()->isLockedByCurrentUser());
     $intSort = $objAspect->getIntSort();
     $objException = null;
     try {
         $objAspect->setAbsolutePosition(4);
     } catch (class_exception $objEx) {
         $objException = $objEx;
     }
     $this->assertNotNull($objException);
     $this->assertEquals($intSort, $objAspect->getIntSort());
     class_carrier::getInstance()->getObjSession()->logout();
     $objAspect = new class_module_system_aspect($strAspectId);
     $objAspect->deleteObjectFromDatabase();
     $objUser1->deleteObjectFromDatabase();
     $objUser2->deleteObjectFromDatabase();
 }
 /**
  * Deletes an aspect
  *
  * @throws class_exception
  * @return string
  */
 protected function actionDeleteAspect()
 {
     $objAspect = new class_module_system_aspect($this->getSystemid());
     if ($objAspect->rightDelete() && $objAspect->rightRight5()) {
         if (!$objAspect->deleteObject()) {
             throw new class_exception("Error deleting aspect", class_exception::$level_ERROR);
         }
         $this->adminReload(class_link::getLinkAdminHref($this->getArrModule("modul"), "aspects"));
     } else {
         return $this->getLang("commons_error_permissions");
     }
     return "";
 }