public function test()
 {
     $objDB = class_carrier::getInstance()->getObjDB();
     echo "\tmodul_guestbook...\n";
     echo "creating a new guestbook, moderated...\n";
     $objGuestbook = new class_module_guestbook_guestbook();
     $objGuestbook->setStrGuestbookTitle("test guestbook");
     $objGuestbook->setIntGuestbookModerated(1);
     $objGuestbook->updateObjectToDb();
     $strGBId = $objGuestbook->getSystemid();
     echo "adding a new post...\n";
     $objPost = new class_module_guestbook_post();
     $objPost->setStrGuestbookPostName("subject");
     $objPost->setStrGuestbookPostText("test");
     $objPost->updateObjectToDb($strGBId);
     $objDB->flushQueryCache();
     $this->assertEquals(0, count(class_module_guestbook_post::getPosts($strGBId, true)), __FILE__ . " check nr of posts portal");
     $this->assertEquals(1, count(class_module_guestbook_post::getPosts($strGBId)), __FILE__ . " check nr of posts total");
     echo "setting guestbook non-moderated...\n";
     $objGuestbook->setIntGuestbookModerated(0);
     $objGuestbook->updateObjectToDb();
     $objDB->flushQueryCache();
     echo "adding a new post...\n";
     $objPost = new class_module_guestbook_post();
     $objPost->setStrGuestbookPostName("subject2");
     $objPost->setStrGuestbookPostText("test2");
     $objPost->updateObjectToDb($strGBId);
     $this->assertEquals(1, count(class_module_guestbook_post::getPosts($strGBId, true)), __FILE__ . " check nr of posts portal");
     $this->assertEquals(2, count(class_module_guestbook_post::getPosts($strGBId)), __FILE__ . " check nr of posts total");
     $objDB->flushQueryCache();
     echo "deleting the guestbook...\n";
     $objGuestbook->deleteObjectFromDatabase();
 }
 /**
  * Triggers the "real" creation of the report and wraps the code inline into a xml-structure
  *
  * @return string
  * @permissions view
  */
 protected function actionGetReport()
 {
     $strPlugin = $this->getParam("plugin");
     $strReturn = "";
     $objPluginManager = new class_pluginmanager(class_module_stats_admin::$STR_PLUGIN_EXTENSION_POINT, "/admin/statsreports");
     $objPlugin = null;
     foreach ($objPluginManager->getPlugins(array(class_carrier::getInstance()->getObjDB(), $this->objToolkit, $this->getObjLang())) as $objOneReport) {
         if (uniStrReplace("class_stats_report_", "", get_class($objOneReport)) == $strPlugin) {
             $objPlugin = $objOneReport;
             break;
         }
     }
     if ($objPlugin !== null && $objPlugin instanceof interface_admin_statsreports) {
         //get date-params as ints
         $intStartDate = mktime(0, 0, 0, $this->objDateStart->getIntMonth(), $this->objDateStart->getIntDay(), $this->objDateStart->getIntYear());
         $intEndDate = mktime(0, 0, 0, $this->objDateEnd->getIntMonth(), $this->objDateEnd->getIntDay(), $this->objDateEnd->getIntYear());
         $objPlugin->setEndDate($intEndDate);
         $objPlugin->setStartDate($intStartDate);
         $objPlugin->setInterval($this->intInterval);
         $arrImage = $objPlugin->getReportGraph();
         if (!is_array($arrImage)) {
             $arrImage = array($arrImage);
         }
         foreach ($arrImage as $strImage) {
             if ($strImage != "") {
                 $strReturn .= $this->objToolkit->getGraphContainer($strImage);
             }
         }
         $strReturn .= $objPlugin->getReport();
         $strReturn = "<content><![CDATA[" . $strReturn . "]]></content>";
     }
     return $strReturn;
 }
 public function execute()
 {
     $objDB = class_carrier::getInstance()->getObjDB();
     $objDB->dumpDb();
     //trigger again
     return false;
 }
 /**
  * Overwritten in order to load key-value pairs declared by annotations
  */
 protected function updateValue()
 {
     parent::updateValue();
     if ($this->getObjSourceObject() != null && $this->getStrSourceProperty() != "") {
         $objReflection = new class_reflection($this->getObjSourceObject());
         //try to find the matching source property
         $arrProperties = $objReflection->getPropertiesWithAnnotation(self::STR_DDVALUES_ANNOTATION);
         $strSourceProperty = null;
         foreach ($arrProperties as $strPropertyName => $strValue) {
             if (uniSubstr(uniStrtolower($strPropertyName), uniStrlen($this->getStrSourceProperty()) * -1) == $this->getStrSourceProperty()) {
                 $strSourceProperty = $strPropertyName;
             }
         }
         if ($strSourceProperty == null) {
             return;
         }
         $strDDValues = $objReflection->getAnnotationValueForProperty($strSourceProperty, self::STR_DDVALUES_ANNOTATION);
         if ($strDDValues !== null && $strDDValues != "") {
             $arrDDValues = array();
             foreach (explode(",", $strDDValues) as $strOneKeyVal) {
                 $strOneKeyVal = uniSubstr(trim($strOneKeyVal), 1, -1);
                 $arrOneKeyValue = explode("=>", $strOneKeyVal);
                 $strKey = trim($arrOneKeyValue[0]) == "" ? " " : trim($arrOneKeyValue[0]);
                 if (count($arrOneKeyValue) == 2) {
                     $strValue = class_carrier::getInstance()->getObjLang()->getLang(trim($arrOneKeyValue[1]), $this->getObjSourceObject()->getArrModule("modul"));
                     if ($strValue == "!" . trim($arrOneKeyValue[1]) . "!") {
                         $strValue = $arrOneKeyValue[1];
                     }
                     $arrDDValues[$strKey] = $strValue;
                 }
             }
             $this->setArrKeyValues($arrDDValues);
         }
     }
 }
 /**
  * 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;
 }
Example #6
0
 public function debugHelper()
 {
     echo "<pre>";
     echo "<b>Kajona V4 Debug Subsystem</b>\n\n";
     if (getGet("debugfile") != "") {
         echo "Loading path for " . getGet("debugfile") . "\n";
         $strPath = array_search(getGet("debugfile"), class_resourceloader::getInstance()->getFolderContent("/debug", array(".php")));
         if ($strPath !== false) {
             echo "Passing request to " . $strPath . "\n\n";
             include _realpath_ . $strPath;
         }
     } else {
         echo "Searching for debug-scripts available...\n";
         $arrFiles = class_resourceloader::getInstance()->getFolderContent("/debug", array(".php"));
         echo "<ul>";
         foreach ($arrFiles as $strPath => $strOneFile) {
             echo "<li><a href='?debugfile=" . $strOneFile . "' >" . $strOneFile . "</a> <br />" . $strPath . "</li>";
         }
         echo "</ul>";
     }
     $arrTimestampEnde = gettimeofday();
     $intTimeUsed = ($arrTimestampEnde['sec'] * 1000000 + $arrTimestampEnde['usec'] - ($this->arrTimestampStart['sec'] * 1000000 + $this->arrTimestampStart['usec'])) / 1000000;
     echo "\n\n<b>PHP-Time:</b>                              " . number_format($intTimeUsed, 6) . " sec \n";
     echo "<b>Queries db/cachesize/cached/fired:</b>     " . class_carrier::getInstance()->getObjDB()->getNumber() . "/" . class_carrier::getInstance()->getObjDB()->getCacheSize() . "/" . class_carrier::getInstance()->getObjDB()->getNumberCache() . "/" . (class_carrier::getInstance()->getObjDB()->getNumber() - class_carrier::getInstance()->getObjDB()->getNumberCache()) . "\n";
     echo "<b>Templates cached:</b>                      " . class_carrier::getInstance()->getObjTemplate()->getNumberCacheSize() . " \n";
     echo "<b>Memory/Max Memory:</b>                     " . bytesToString(memory_get_usage()) . "/" . bytesToString(memory_get_peak_usage()) . " \n";
     echo "<b>Classes Loaded:</b>                        " . class_classloader::getInstance()->getIntNumberOfClassesLoaded() . " \n";
     echo "<b>Cache requests/hits/saves/cachesize:</b>   " . class_cache::getIntRequests() . "/" . class_cache::getIntHits() . "/" . class_cache::getIntSaves() . "/" . class_cache::getIntCachesize() . " \n";
     echo "</pre>";
 }
 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;
 }
 /**
  * @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"));
     }
 }
 /**
  * This method is called, when the widget should generate it's content.
  * Return the complete content using the methods provided by the base class.
  * Do NOT use the toolkit right here!
  *
  * @return string
  */
 public function getWidgetOutput()
 {
     if (!class_module_system_module::getModuleByName("system")->rightView() || !class_carrier::getInstance()->getObjSession()->isSuperAdmin()) {
         return $this->getLang("commons_error_permissions");
     }
     $strReturn = "<style type=\"text/css\">\n            .adminwidget_systemcheck .ok {\n                color: green;\n            }\n            .adminwidget_systemcheck .nok {\n                color: red;\n                font-weight: bold;\n            }\n        </style>";
     //check wich infos to produce
     if ($this->getFieldValue("php") == "checked") {
         $strReturn .= $this->widgetText($this->getLang("systemcheck_php_safemode") . (ini_get("safe_mode") ? $this->getLang("commons_yes") : $this->getLang("commons_no")));
         $strReturn .= $this->widgetText($this->getLang("systemcheck_php_urlfopen") . (ini_get("allow_url_fopen") ? $this->getLang("commons_yes") : $this->getLang("commons_no")));
         $strReturn .= $this->widgetText($this->getLang("systemcheck_php_regglobal") . (ini_get("register_globals") ? "<span class=\"nok\">" . $this->getLang("commons_yes") . "</span>" : "<span class=\"ok\">" . $this->getLang("commons_no") . "</span>"));
         $strReturn .= $this->widgetSeparator();
     }
     if ($this->getFieldValue("kajona") == "checked") {
         $arrFilesAvailable = array("/installer.php", "/debug.php", "/v3_v4_postupdate.php");
         foreach ($arrFilesAvailable as $strOneFile) {
             $strReturn .= $this->widgetText($strOneFile . " " . $this->getLang("systemcheck_kajona_filepresent") . (is_file(_realpath_ . $strOneFile) ? " <span class=\"nok\">" . $this->getLang("commons_yes") . "</span>" : " <span class=\"ok\">" . $this->getLang("commons_no") . "</span>"));
         }
         $strReturn .= $this->widgetText($this->getLang("systemcheck_kajona_writeper") . " /project/system/config/config.php " . (is_writable(_realpath_ . "/project/system/config/config.php") ? "<span class=\"nok\">" . $this->getLang("commons_yes") . "</span>" : "<span class=\"ok\">" . $this->getLang("commons_no") . "</span>"));
         $strReturn .= $this->widgetText($this->getLang("systemcheck_kajona_writeper") . " /project/log/ " . (is_writable(_realpath_ . "/project/log/") ? "<span class=\"ok\">" . $this->getLang("commons_yes") . "</span>" : "<span class=\"nok\">" . $this->getLang("commons_no") . "</span>"));
         $strReturn .= $this->widgetText($this->getLang("systemcheck_kajona_writeper") . " /project/dbdumps/ " . (is_writable(_realpath_ . "/project/dbdumps/") ? "<span class=\"ok\">" . $this->getLang("commons_yes") . "</span>" : "<span class=\"nok\">" . $this->getLang("commons_no") . "</span>"));
         $strReturn .= $this->widgetText($this->getLang("systemcheck_kajona_writeper") . " /project/temp " . (is_writable(_realpath_ . "/project/temp") ? "<span class=\"ok\">" . $this->getLang("commons_yes") . "</span>" : "<span class=\"nok\">" . $this->getLang("commons_no") . "</span>"));
         $strReturn .= $this->widgetText($this->getLang("systemcheck_kajona_writeper") . " " . _images_cachepath_ . " " . (is_writable(_realpath_ . "/" . _images_cachepath_) ? "<span class=\"ok\">" . $this->getLang("commons_yes") . "</span>" : "<span class=\"nok\">" . $this->getLang("commons_no") . "</span>"));
         foreach (class_classloader::getCoreDirectories() as $strOneCore) {
             $strReturn .= $this->widgetText($this->getLang("systemcheck_kajona_writeper") . " /" . $strOneCore . " " . (is_writable(_realpath_ . "/" . $strOneCore) ? "<span class=\"ok\">" . $this->getLang("commons_yes") . "</span>" : "<span class=\"nok\">" . $this->getLang("commons_no") . "</span>"));
         }
     }
     return "<div class=\"adminwidget_systemcheck\">" . $strReturn . "</div>";
 }
 /**
  * Validates a news start/end/archive date for a correct logical order.
  *
  *
  * @param class_model $objObject - the model object to the given form
  * @return bool
  */
 public function validateObject(class_model $objObject)
 {
     $objLang = class_carrier::getInstance()->getObjLang();
     $strModuleName = $objObject->getArrModule("modul");
     if ($objObject instanceof class_module_news_news) {
         //validate: $objStartDate < $objSpecialDate < $objEndDate
         $objStartDate = $objObject->getObjStartDate();
         $objEndDate = $objObject->getObjEndDate();
         $objSpecialDate = $objObject->getObjSpecialDate();
         $strLabelStartDate = $objLang->getLang("form_" . $objObject->getArrModule("modul") . "_datestart", $strModuleName);
         $strLabelEndDate = $objLang->getLang("form_" . $objObject->getArrModule("modul") . "_dateend", $strModuleName);
         $strLabelSpecialDate = $objLang->getLang("form_" . $objObject->getArrModule("modul") . "_datespecial", $strModuleName);
         if ($objStartDate != null && $objEndDate != null) {
             if (class_objectvalidator_helper::compareDates($objStartDate, $objEndDate) === 1) {
                 $this->addValidationError("startdate", $objLang->getLang("commons_object_validator_datecompare_validationmessage_before", $strModuleName, array($strLabelStartDate, $strLabelEndDate)));
             }
         }
         if ($objSpecialDate != null && $objEndDate != null) {
             if (class_objectvalidator_helper::compareDates($objSpecialDate, $objEndDate) === 1) {
                 $this->addValidationError("startdate", $objLang->getLang("commons_object_validator_datecompare_validationmessage_before", $strModuleName, array($strLabelSpecialDate, $strLabelEndDate)));
             }
         }
         if ($objStartDate != null && $objSpecialDate != null) {
             if (class_objectvalidator_helper::compareDates($objStartDate, $objSpecialDate) === 1) {
                 $this->addValidationError("startdate", $objLang->getLang("commons_object_validator_datecompare_validationmessage_before", $strModuleName, array($strLabelStartDate, $strLabelSpecialDate)));
             }
         }
     } else {
         return false;
     }
     return count($this->getArrValidationMessages()) == 0;
 }
 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;
 }
Example #12
0
 /**
  * Default constructor
  */
 public function __construct()
 {
     // Try to overwrite PHP memory-limit so large images can be processed, too
     if (class_carrier::getInstance()->getObjConfig()->getPhpIni("memory_limit") < 128) {
         @ini_set("memory_limit", "128M");
     }
 }
 /**
  * Generates a new entry in the log-table
  *
  * @param string $strSeachterm
  *
  * @return bool
  * @static
  */
 public static function generateLogEntry($strSeachterm)
 {
     $objLanguage = new class_module_languages_language();
     $strLanguage = $objLanguage->getStrPortalLanguage();
     $strQuery = "INSERT INTO " . _dbprefix_ . "search_log \n                    (search_log_id, search_log_date, search_log_query, search_log_language) VALUES\n                    (?, ?, ?, ? )";
     return class_carrier::getInstance()->getObjDB()->_pQuery($strQuery, array(generateSystemid(), (int) time(), $strSeachterm, $strLanguage));
 }
 private function checkSingleLevel($strParentId, &$arrReturn)
 {
     $objRights = class_carrier::getInstance()->getObjRights();
     $arrParentRights = $objRights->getArrayRights($strParentId);
     //load the sub-ordinate nodes
     $objCommon = new class_module_system_common();
     $arrChildNodes = $objCommon->getChildNodesAsIdArray($strParentId);
     foreach ($arrChildNodes as $strOneChildId) {
         if (!$objRights->isInherited($strOneChildId)) {
             $arrChildRights = $objRights->getArrayRights($strOneChildId);
             $bitIsDifferent = false;
             foreach ($arrChildRights as $strPermission => $arrOneChildPermission) {
                 if ($strPermission == class_rights::$STR_RIGHT_INHERIT) {
                     continue;
                 }
                 if (count(array_diff($arrChildRights[$strPermission], $arrParentRights[$strPermission])) != 0) {
                     $bitIsDifferent = true;
                     break;
                 }
             }
             if (!$bitIsDifferent) {
                 $arrReturn[] = class_objectfactory::getInstance()->getObject($strOneChildId);
                 $objRights->setInherited(true, $strOneChildId);
             }
         }
         $this->checkSingleLevel($strOneChildId, $arrReturn);
     }
 }
 /**
  * Searches for languagesets containing the current systemid. either as a language or a referenced record.
  * Called whenever a records was deleted using the common methods.
  * Implement this method to be notified when a record is deleted, e.g. to to additional cleanups afterwards.
  * There's no need to register the listener, this is done automatically.
  * Make sure to return a matching boolean-value, otherwise the transaction may be rolled back.
  *
  * @param string $strEventName
  * @param array $arrArguments
  *
  * @return bool
  */
 public function handleEvent($strEventName, array $arrArguments)
 {
     //unwrap arguments
     list($strSystemid, $strSourceClass) = $arrArguments;
     if ($strSourceClass == "class_module_languages_language") {
         //if we have just one language remaining, set this one as default
         $arrObjLanguages = class_module_languages_language::getObjectList();
         if (count($arrObjLanguages) == 1) {
             $objOneLanguage = $arrObjLanguages[0];
             $objOneLanguage->setBitDefault(1);
             $objOneLanguage->updateObjectToDb();
         }
         //check if the current active one was deleted. if, then reset. #kajona trace id 613
         $objLanguage = new class_module_languages_language();
         $arrLangs = class_module_languages_language::getObjectList();
         $arrFiltered = array_filter($arrLangs, function (class_module_languages_language $objSingleLang) use($objLanguage) {
             return $objSingleLang->getStrName() == $objLanguage->getAdminLanguage();
         });
         if (count($arrFiltered) == 0 && count($arrLangs) > 0) {
             $objLanguage->setStrAdminLanguageToWorkOn($arrLangs[0]->getStrName());
         }
     }
     //fire a plain query on the database, much faster then searching for matching records
     $strQuery = "DELETE FROM " . _dbprefix_ . "languages_languageset\n                  WHERE languageset_language = ?\n                     OR languageset_systemid = ?";
     class_carrier::getInstance()->getObjDB()->_pQuery($strQuery, array($strSystemid, $strSystemid));
     return true;
 }
Example #16
0
 /**
  * @return void
  */
 public function testDateToString()
 {
     class_carrier::getInstance()->getObjLang()->setStrTextLanguage("de");
     if (class_carrier::getInstance()->getObjLang()->getLang("dateStyleShort", "system") != "d.m.Y") {
         return;
     }
     $this->assertEquals("15.05.2013", dateToString(new class_date(20130515122324), false));
     $this->assertEquals("15.05.2013 12:23:24", dateToString(new class_date(20130515122324), true));
     $this->assertEquals("15.05.2013", dateToString(new class_date("20130515122324"), false));
     $this->assertEquals("15.05.2013 12:23:24", dateToString(new class_date("20130515122324"), true));
     $this->assertEquals("15.05.2013", dateToString(20130515122324, false));
     $this->assertEquals("15.05.2013 12:23:24", dateToString(20130515122324, true));
     $this->assertEquals("15.05.2013", dateToString("20130515122324", false));
     $this->assertEquals("15.05.2013 12:23:24", dateToString("20130515122324", true));
     $this->assertEquals("", dateToString(null));
     $this->assertEquals("", dateToString(""));
     $this->assertEquals("", dateToString("asdfsfdsfdsfds"));
     class_carrier::getInstance()->getObjLang()->setStrTextLanguage("en");
     if (class_carrier::getInstance()->getObjLang()->getLang("dateStyleShort", "system") != "m/d/Y") {
         return;
     }
     $this->assertEquals("05/15/2013", dateToString(new class_date(20130515122324), false));
     $this->assertEquals("05/15/2013 12:23:24", dateToString(new class_date(20130515122324), true));
     $this->assertEquals("05/15/2013", dateToString(new class_date("20130515122324"), false));
     $this->assertEquals("05/15/2013 12:23:24", dateToString(new class_date("20130515122324"), true));
     $this->assertEquals("05/15/2013", dateToString(20130515122324, false));
     $this->assertEquals("05/15/2013 12:23:24", dateToString(20130515122324, true));
     $this->assertEquals("05/15/2013", dateToString("20130515122324", false));
     $this->assertEquals("05/15/2013 12:23:24", dateToString("20130515122324", true));
 }
 /**
  * @param string $formErrors
  *
  * @return string
  */
 private function uploadForm($formErrors = "")
 {
     $strReturn = "";
     //validate the rights
     $objFilemanagerRepo = new class_module_mediamanager_repo($this->arrElementData["char2"]);
     if ($objFilemanagerRepo->rightRight1()) {
         $strTemplateID = $this->objTemplate->readTemplate("/element_portalupload/" . $this->arrElementData["char1"], "portalupload_uploadform");
         $strDlFolderId = "";
         if ($this->getParam("action") == "mediaFolder") {
             $strDlFolderId = $this->getParam("systemid");
         }
         $arrTemplate = array();
         $arrTemplate["portaluploadDlfolder"] = $strDlFolderId;
         // check if there was an successfull upload before
         if ($this->getParam("uploadSuccess") == "1") {
             $arrTemplate["portaluploadSuccess"] = $this->getLang("portaluploadSuccess");
         }
         $arrTemplate["formErrors"] = $formErrors;
         $strAllowedFileRegex = uniStrReplace(array(".", ","), array("", "|"), $objFilemanagerRepo->getStrUploadFilter());
         $arrTemplate["formAction"] = class_link::getLinkPortalHref($this->getPagename(), "", $this->getAction(), "", $strDlFolderId);
         $arrTemplate["maxFileSize"] = class_carrier::getInstance()->getObjConfig()->getPhpMaxUploadSize();
         $arrTemplate["acceptFileTypes"] = $strAllowedFileRegex != "" ? "/(\\.|\\/)(" . $strAllowedFileRegex . ")\$/i" : "''";
         $arrTemplate["elementId"] = $this->arrElementData["content_id"];
         $arrTemplate["mediamanagerRepoId"] = $objFilemanagerRepo->getSystemid();
         $strReturn .= $this->fillTemplate($arrTemplate, $strTemplateID);
     } else {
         $strReturn .= $this->getLang("commons_error_permissions");
     }
     return $strReturn;
 }
 /**
  * Returns a textual representation of the formentries' value.
  * May contain html, but should be stripped down to text-only.
  *
  * @return string
  */
 public function getValueAsText()
 {
     if ($this->getStrValue()) {
         return class_carrier::getInstance()->getObjLang()->getLang("commons_yes", "system");
     } else {
         return class_carrier::getInstance()->getObjLang()->getLang("commons_no", "system");
     }
 }
 /**
  * This method is called, when the widget should generate it's content.
  * Return the complete content using the methods provided by the base class.
  * Do NOT use the toolkit right here!
  *
  * @return string
  */
 public function getWidgetOutput()
 {
     $strReturn = "";
     $strReturn .= $this->widgetText($this->getLang("workflows_intro"));
     $strReturn .= $this->widgetText(class_module_workflows_workflow::getPendingWorkflowsForUserCount(array_merge(array(class_carrier::getInstance()->getObjSession()->getUserID()), class_carrier::getInstance()->getObjSession()->getGroupIdsAsArray())));
     $strReturn .= $this->widgetText(getLinkAdmin("workflows", "myList", "", $this->getLang("workflows_show")));
     return $strReturn;
 }
 /**
  * Handles the event as dispatched by the request-dispatcher
  *
  * @param string $strEventName
  * @param array $arrArguments
  *
  * @return bool|void
  */
 public function handleEvent($strEventName, array $arrArguments)
 {
     $objSession = class_carrier::getInstance()->getObjSession();
     if (isset($_SERVER["PHP_AUTH_USER"]) && isset($_SERVER["PHP_AUTH_PW"]) && !$objSession->isLoggedin()) {
         $objSession->login($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"]);
     }
     return true;
 }
 /**
  * Default constructor
  */
 public function __construct()
 {
     //load the external objects
     $this->objDB = class_carrier::getInstance()->getObjDB();
     $this->objLang = class_carrier::getInstance()->getObjLang();
     $this->objToolkit = class_carrier::getInstance()->getObjToolkit("admin");
     $this->objSystemCommon = new class_module_system_common();
 }
 /**
  * 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;
     if ($strSourceClass == "class_module_pages_page") {
         return class_carrier::getInstance()->getObjDB()->_pQuery("DELETE FROM " . _dbprefix_ . "page_properties WHERE pageproperties_id = ?", array($strSystemid));
     }
     return true;
 }
 /**
  * Constructor
  */
 public function __construct(class_db $objDB, class_toolkit_admin $objToolkit, class_lang $objTexts)
 {
     $this->objTexts = $objTexts;
     $this->objToolkit = $objToolkit;
     $this->objDB = $objDB;
     if (class_carrier::getInstance()->getObjConfig()->getPhpIni("memory_limit") < 30) {
         @ini_set("memory_limit", "30M");
     }
 }
 /**
  * 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;
     if ($strSourceClass == "class_module_faqs_category") {
         return class_carrier::getInstance()->getObjDB()->_pQuery("DELETE FROM " . _dbprefix_ . "faqs_member WHERE faqsmem_category = ? ", array($strSystemid));
     }
     return true;
 }
 /**
  * Overwritten base method, processes the hidden fields, too.
  */
 protected function updateValue()
 {
     $arrParams = class_carrier::getAllParams();
     if (isset($arrParams[$this->getStrEntryName() . "_id"])) {
         $this->setStrValue($arrParams[$this->getStrEntryName() . "_id"]);
     } else {
         $this->setStrValue($this->getValueFromObject());
     }
 }
 /**
  * Renders the field itself.
  * In most cases, based on the current toolkit.
  *
  * @return string
  */
 public function renderField()
 {
     $objToolkit = class_carrier::getInstance()->getObjToolkit("admin");
     $strReturn = "";
     if ($this->getStrHint() != null) {
         $strReturn .= $objToolkit->formTextRow($this->getStrHint());
     }
     $strReturn .= $objToolkit->formInputTextArea($this->getStrEntryName(), $this->getStrLabel(), $this->getStrValue(), $this->bitLarge ? "input-large" : "", $this->getBitReadonly(), $this->getIntNumberOfRows());
     return $strReturn;
 }
 /**
  * Processes the content.
  * Make sure to return the string again, otherwise the output will remain blank.
  *
  * @param string $strContent
  *
  * @return string
  */
 public function processContent($strContent)
 {
     $objLang = class_carrier::getInstance()->getObjLang();
     $arrTemp = array();
     preg_match_all("#\\[lang,([A-Za-z0-9_]+),([0-9A-Za-z_]+)\\]#i", $strContent, $arrTemp);
     foreach ($arrTemp[0] as $intKey => $strSearchString) {
         $strContent = uniStrReplace($strSearchString, $objLang->getLang($arrTemp[1][$intKey], $arrTemp[2][$intKey]), $strContent);
     }
     return $strContent;
 }
 /**
  * Renders the field itself.
  * In most cases, based on the current toolkit.
  *
  * @return string
  */
 public function renderField()
 {
     $objToolkit = class_carrier::getInstance()->getObjToolkit("admin");
     $strReturn = "";
     if ($this->getStrHint() != null) {
         $strReturn .= $objToolkit->formTextRow($this->getStrHint());
     }
     $strReturn .= $objToolkit->formInputCheckboxArray($this->getStrEntryName(), $this->getStrLabel(), $this->intType, $this->arrKeyValues, $this->getStrValue(), $this->bitInline, $this->getBitReadonly());
     return $strReturn;
 }
 /**
  * Renders the field itself.
  * In most cases, based on the current toolkit.
  *
  * @return string
  */
 public function renderField()
 {
     $objToolkit = class_carrier::getInstance()->getObjToolkit("admin");
     $strReturn = "";
     if ($this->getStrHint() != null) {
         $strReturn .= $objToolkit->formTextRow($this->getStrHint());
     }
     $strReturn .= $objToolkit->formInputSubmit($this->getStrLabel(), $this->getStrValue(), $this->getStrEventhandler(), $this->getBitReadonly());
     return $strReturn;
 }
 /**
  * Renders the field itself.
  * In most cases, based on the current toolkit.
  *
  * @return string
  */
 public function renderField()
 {
     $objToolkit = class_carrier::getInstance()->getObjToolkit("admin");
     $strReturn = "";
     if ($this->getStrHint() != null) {
         $strReturn .= $objToolkit->formTextRow($this->getStrHint());
     }
     $strReturn .= $objToolkit->formInputPageSelector($this->getStrEntryName(), $this->getStrLabel(), $this->getStrValue());
     return $strReturn;
 }