/** * Constructor to create a valid object * * @param string $strSystemid (use "" on new objects) */ public function __construct($strSystemid = "") { if (class_module_system_setting::getConfigValue("_tags_defaultprivate_") == "true") { $this->intPrivate = 1; } parent::__construct($strSystemid); }
/** * @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")); } }
/** * @return string * @autoTestable * @permissions view */ protected function actionBrowserChooser() { $strReturn = ""; if ($this->getParam("CKEditorFuncNum") != "") { $strReturn .= "<script type=\"text/javascript\">window.opener.KAJONA.admin.folderview.selectCallbackCKEditorFuncNum = " . (int) $this->getParam("CKEditorFuncNum") . ";</script>"; } $intCounter = 1; $strReturn .= $this->objToolkit->listHeader(); if (class_module_system_module::getModuleByName("pages") !== null) { $strAction = $this->objToolkit->listButton(class_link::getLinkAdmin("pages", "pagesFolderBrowser", "&pages=1&form_element=" . $this->getParam("form_element") . "&bit_link=1", $this->getLang("wysiwygPagesBrowser"), $this->getLang("wysiwygPagesBrowser"), "icon_folderActionOpen")); $strReturn .= $this->objToolkit->genericAdminList(generateSystemid(), $this->getLang("wysiwygPagesBrowser"), "", $strAction, $intCounter++); } $strRepoId = class_module_system_setting::getConfigValue("_mediamanager_default_filesrepoid_"); if (validateSystemid($strRepoId) && class_module_system_module::getModuleByName("mediamanager") !== null && class_objectfactory::getInstance()->getObject($strRepoId) !== null) { $strAction = $this->objToolkit->listButton(class_link::getLinkAdmin("mediamanager", "folderContentFolderviewMode", "&systemid=" . $strRepoId . "&form_element=" . $this->getParam("form_element") . "&bit_link=1", $this->getLang("wysiwygFilesBrowser"), $this->getLang("wysiwygFilesBrowser"), "icon_folderActionOpen")); $strReturn .= $this->objToolkit->genericAdminList(generateSystemid(), $this->getLang("wysiwygFilesBrowser"), "", $strAction, $intCounter++); } $strRepoId = class_module_system_setting::getConfigValue("_mediamanager_default_imagesrepoid_"); if (validateSystemid($strRepoId) && class_module_system_module::getModuleByName("mediamanager") !== null && class_objectfactory::getInstance()->getObject($strRepoId) !== null) { $strAction = $this->objToolkit->listButton(class_link::getLinkAdmin("mediamanager", "folderContentFolderviewMode", "&systemid=" . $strRepoId . "&form_element=" . $this->getParam("form_element") . "&bit_link=1", $this->getLang("wysiwygImagesBrowser"), $this->getLang("wysiwygImagesBrowser"), "icon_folderActionOpen")); $strReturn .= $this->objToolkit->genericAdminList(generateSystemid(), $this->getLang("wysiwygImagesBrowser"), "", $strAction, $intCounter++); } if (class_module_system_module::getModuleByName("mediamanager") !== null) { $strAction = $this->objToolkit->listButton(class_link::getLinkAdmin("mediamanager", "folderContentFolderviewMode", "&form_element=" . $this->getParam("form_element") . "&bit_link=1", $this->getLang("wysiwygRepoBrowser"), $this->getLang("wysiwygRepoBrowser"), "icon_folderActionOpen")); $strReturn .= $this->objToolkit->genericAdminList(generateSystemid(), $this->getLang("wysiwygRepoBrowser"), "", $strAction, $intCounter++); } $strReturn .= $this->objToolkit->listFooter(); return $strReturn; }
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; }
/** * Returns a list of all packages available. * By default a json-encoded array-like structure. * * @return string|json * @permissions view * @xml */ protected function actionList() { $arrPackages = array(); $intNrOfFiles = 0; $intStart = $this->ensureNumericValue($this->getParam("start"), null); $intEnd = $this->ensureNumericValue($this->getParam("end"), null); $strTypeFilter = $this->isValidCategoryFilter($this->getParam("type")) ? $this->getParam("type") : false; $strNameFilter = trim($this->getParam("title")) != "" ? trim($this->getParam("title")) : false; if ($this->isValidPagingParameter($intStart) && $this->isValidPagingParameter($intEnd)) { if ($intEnd >= $intStart) { $intNrOfFiles = $this->getAllPackagesCount(class_module_system_setting::getConfigValue("_packageserver_repo_id_"), $strTypeFilter, $strNameFilter); $arrDBFiles = $this->getAllPackages(class_module_system_setting::getConfigValue("_packageserver_repo_id_"), $strTypeFilter, $intStart, $intEnd, $strNameFilter); //error-handling: a new filter and a offset is passed. but maybe the passed offset is no longer valid for the new filter criteria if (count($arrDBFiles) == 0 && $intNrOfFiles > 0) { $arrDBFiles = $this->getAllPackages(class_module_system_setting::getConfigValue("_packageserver_repo_id_"), $strTypeFilter, 0, $intNrOfFiles, $strNameFilter); } $objManager = new class_module_packagemanager_manager(); foreach ($arrDBFiles as $objOneFile) { try { $objMetadata = $objManager->getPackageManagerForPath($objOneFile->getStrFilename()); $arrPackages[] = array("systemid" => $objOneFile->getSystemid(), "title" => $objMetadata->getObjMetadata()->getStrTitle(), "version" => $objMetadata->getObjMetadata()->getStrVersion(), "description" => $objMetadata->getObjMetadata()->getStrDescription(), "type" => $objMetadata->getObjMetadata()->getStrType()); } catch (class_exception $objEx) { } } class_module_packageserver_log::generateDlLog($strNameFilter !== false ? $strNameFilter : "", isset($_SERVER["REMOTE_ADDR"]) ? $_SERVER["REMOTE_ADDR"] : "::1", urldecode($this->getParam("domain"))); class_response_object::getInstance()->setStrResponseType(class_http_responsetypes::STR_TYPE_JSON); } } $result = array(); $result['numberOfTotalItems'] = $intNrOfFiles; $result['items'] = $arrPackages; $result['protocolVersion'] = self::PROTOCOL_VERSION; $strReturn = json_encode($result); 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; }
/** * Sends the requested file to the browser * @return string */ public function actionDownload() { //Load filedetails if (validateSystemid($this->getSystemid())) { /** @var $objFile class_module_mediamanager_file */ $objFile = class_objectfactory::getInstance()->getObject($this->getSystemid()); //Succeeded? if ($objFile instanceof class_module_mediamanager_file && $objFile->getIntRecordStatus() == "1" && $objFile->getIntType() == class_module_mediamanager_file::$INT_TYPE_FILE) { //Check rights if ($objFile->rightRight2()) { //Log the download class_module_mediamanager_logbook::generateDlLog($objFile); //Send the data to the browser $strBrowser = getServer("HTTP_USER_AGENT"); //Check the current browsertype if (uniStrpos($strBrowser, "IE") !== false) { //Internet Explorer class_response_object::getInstance()->addHeader("Content-type: application/x-ms-download"); class_response_object::getInstance()->addHeader("Content-type: x-type/subtype\n"); class_response_object::getInstance()->addHeader("Content-type: application/force-download"); class_response_object::getInstance()->addHeader("Content-Disposition: attachment; filename=" . preg_replace('/\\./', '%2e', saveUrlEncode(trim(basename($objFile->getStrFilename()))), substr_count(basename($objFile->getStrFilename()), '.') - 1)); } else { //Good: another browser vendor class_response_object::getInstance()->addHeader("Content-Type: application/octet-stream"); class_response_object::getInstance()->addHeader("Content-Disposition: attachment; filename=" . saveUrlEncode(trim(basename($objFile->getStrFilename())))); } //Common headers class_response_object::getInstance()->addHeader("Expires: Mon, 01 Jan 1995 00:00:00 GMT"); class_response_object::getInstance()->addHeader("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); class_response_object::getInstance()->addHeader("Pragma: no-cache"); class_response_object::getInstance()->addHeader("Content-description: JustThum-Generated Data\n"); class_response_object::getInstance()->addHeader("Content-Length: " . filesize(_realpath_ . $objFile->getStrFilename())); //End Session $this->objSession->sessionClose(); class_response_object::getInstance()->sendHeaders(); //Loop the file $ptrFile = @fopen(_realpath_ . $objFile->getStrFilename(), 'rb'); fpassthru($ptrFile); @fclose($ptrFile); ob_flush(); flush(); return ""; } else { class_response_object::getInstance()->setStrStatusCode(class_http_statuscodes::SC_FORBIDDEN); } } else { class_response_object::getInstance()->setStrStatusCode(class_http_statuscodes::SC_NOT_FOUND); } } else { class_response_object::getInstance()->setStrStatusCode(class_http_statuscodes::SC_NOT_FOUND); } //if we reach up here, something gone wrong :/ class_response_object::getInstance()->setStrRedirectUrl(str_replace(array("_indexpath_", "&"), array(_indexpath_, "&"), class_link::getLinkPortalHref(class_module_system_setting::getConfigValue("_pages_errorpage_")))); class_response_object::getInstance()->sendHeaders(); class_response_object::getInstance()->sendContent(); return ""; }
/** * 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->formInputFileSelector($this->getStrEntryName(), $this->getStrLabel(), $this->getStrValue(), class_module_system_setting::getConfigValue("_mediamanager_default_filesrepoid_")); return $strReturn; }
/** * Triggers the workflow engine * * @xml * @return string */ protected function actionTrigger() { class_carrier::getInstance()->getObjSession()->setBitBlockDbUpdate(true); if ($this->getParam("authkey") == class_module_system_setting::getConfigValue("_workflows_trigger_authkey_")) { $objWorkflowController = new class_workflows_controller(); $objWorkflowController->scheduleWorkflows(); $objWorkflowController->runWorkflows(); return "<message>Execution successful</message>"; } class_response_object::getInstance()->setStrStatusCode(class_http_statuscodes::SC_UNAUTHORIZED); return "<message><error>Not authorized</error></message>"; }
/** * 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) { $arrConstants = array("_indexpath_", "_webpath_", "_system_browser_cachebuster_", "_gentime_"); $arrValues = array(_indexpath_, _webpath_, class_module_system_setting::getConfigValue("_system_browser_cachebuster_"), date("d.m.y H:i", time())); $arrConstants[] = "_packagemanager_defaulttemplate_"; $arrValues[] = class_module_system_setting::getConfigValue("_packagemanager_defaulttemplate_"); if (defined("_skinwebpath_")) { $arrConstants[] = "_skinwebpath_"; $arrValues[] = _skinwebpath_; } return str_replace($arrConstants, $arrValues, $strContent); }
/** * Returns the contents of the info-block * * @return mixed */ public function getArrContent() { $strOldTimezone = date_default_timezone_get(); $objLang = class_carrier::getInstance()->getObjLang(); $arrReturn = array(); $arrReturn[] = array($objLang->getLang("time_phptimestamp", "system"), time()); $arrReturn[] = array($objLang->getLang("time_systemtimezone", "system"), date_default_timezone_get()); $arrReturn[] = array($objLang->getLang("time_localsystemtime", "system"), timeToString(time())); date_default_timezone_set("UTC"); $arrReturn[] = array($objLang->getLang("time_systemtime_UTC", "system"), date('Y-m-d H:i:s')); $arrReturn[] = array($objLang->getLang("time_systemzone_manual_setting", "system"), class_module_system_setting::getConfigValue("_system_timezone_")); date_default_timezone_set($strOldTimezone); return $arrReturn; }
/** * Generic list of all packages available on the local filesystem * @return string * @permissions view * @autoTestable */ protected function actionOpenFolder() { if (validateSystemid(class_module_system_setting::getConfigValue("_packageserver_repo_id_"))) { if ($this->getSystemid() == "") { $this->setSystemid(class_module_system_setting::getConfigValue("_packageserver_repo_id_")); } $objIterator = new class_array_section_iterator(class_module_mediamanager_file::getFileCount($this->getSystemid(), false, false, true)); $objIterator->setPageNumber($this->getParam("pv")); $objIterator->setArraySection(class_module_mediamanager_file::loadFilesDB($this->getSystemid(), false, false, $objIterator->calculateStartPos(), $objIterator->calculateEndPos(), true)); } else { $objIterator = new class_array_section_iterator(class_module_mediamanager_file::getFlatPackageListCount(false, false)); $objIterator->setPageNumber($this->getParam("pv")); $objIterator->setArraySection(class_module_mediamanager_file::getFlatPackageList(false, false, $objIterator->calculateStartPos(), $objIterator->calculateEndPos())); } return $this->renderList($objIterator); }
/** * Creates a graph-instance either based on the current config or * based on the passed param * * @param string $strType * * @throws class_exception * @return interface_graph */ public static function getGraphInstance($strType = "") { if ($strType == "") { if (class_module_system_setting::getConfigValue("_system_graph_type_") != "") { $strType = class_module_system_setting::getConfigValue("_system_graph_type_"); } else { $strType = "jqplot"; } } $strClassname = "class_graph_" . $strType; $strPath = class_resourceloader::getInstance()->getPathForFile("/system/" . $strClassname . ".php"); if ($strPath !== false) { $objReflection = new ReflectionClass($strClassname); if (!$objReflection->isAbstract() && $objReflection->implementsInterface("interface_graph")) { return $objReflection->newInstance(); } } throw new class_exception("Requested charts-plugin " . $strType . " not existing", class_exception::$level_FATALERROR); }
/** * @param string $strEventName * @param array $arrArguments * * @return bool */ public function handleEvent($strEventName, array $arrArguments) { if (count(self::$arrToDelete) == 0 && count(self::$arrToIndex) == 0) { return true; } //clean and reduce arrays to avoid logical duplicates foreach (self::$arrToDelete as $strOneId => $strObject) { if (isset(self::$arrToIndex[$strOneId])) { unset(self::$arrToIndex[$strOneId]); } } $strConfigValue = class_module_system_setting::getConfigValue("_search_deferred_indexer_"); if ($strConfigValue !== null && $strConfigValue == "true") { $this->processDeferred(); } else { $this->processDirectly(); } self::$arrToDelete = array(); self::$arrToIndex = array(); return true; }
public function testUnreadCount() { $strText = generateSystemid() . " autotest"; $objMessageHandler = new class_module_messaging_messagehandler(); $objMessageHandler->sendMessage($strText, new class_module_user_group(class_module_system_setting::getConfigValue("_admins_group_id_")), new class_messageprovider_exceptions()); $bitFound = false; $objGroup = new class_module_user_group(class_module_system_setting::getConfigValue("_admins_group_id_")); $arrUsers = $objGroup->getObjSourceGroup()->getUserIdsForGroup(); $arrMessages = class_module_messaging_message::getObjectList($arrUsers[0]); $intUnread = class_module_messaging_message::getNumberOfMessagesForUser($arrUsers[0], true); $this->assertTrue($intUnread > 0); $this->flushDBCache(); foreach ($arrMessages as $objOneMessage) { if ($objOneMessage->getStrBody() == $strText && $objOneMessage->getStrMessageProvider() == "class_messageprovider_exceptions") { $bitFound = true; $objOneMessage->setBitRead(true); $objOneMessage->updateObjectToDb(); $this->assertEquals($intUnread - 1, class_module_messaging_message::getNumberOfMessagesForUser($arrUsers[0], true)); $objOneMessage->deleteObjectFromDatabase(); } } $this->assertTrue($bitFound); $this->flushDBCache(); }
echo "+-------------------------------------------------------------------------------+\n"; echo "| Kajona Debug Subsystem |\n"; echo "| |\n"; echo "| Delete all tables |\n"; echo "| |\n"; echo "+-------------------------------------------------------------------------------+\n"; if (issetPost("dodelete")) { $strUsername = getPost("username"); $strPassword = getPost("password"); $objUsersource = new class_module_user_sourcefactory(); $objUser = $objUsersource->getUserByUsername($strUsername); echo "Authenticating user...\n"; if ($objUsersource->authenticateUser($strUsername, $strPassword)) { echo " ... authenticated.\n"; $arrGroupIds = $objUser->getArrGroupIds(); if (in_array(class_module_system_setting::getConfigValue("_admins_group_id_"), $arrGroupIds)) { echo "User is member of admin-group.\n"; $arrTables = class_carrier::getInstance()->getObjDB()->getTables(); foreach ($arrTables as $strOneTable) { $strQuery = "DROP TABLE " . $strOneTable; echo " executing " . $strQuery . "\n"; class_carrier::getInstance()->getObjDB()->_pQuery($strQuery, array()); } } else { echo "User is not a member of the admin-group!\n"; } } else { echo "Authentication failed!\n"; } } else { $arrTables = class_carrier::getInstance()->getObjDB()->getTables();
<?php /*"****************************************************************************************************** * (c) 2007-2015 by Kajona, www.kajona.de * * Published under the GNU LGPL v2.1, see /system/licence_lgpl.txt * *-------------------------------------------------------------------------------------------------------* * $Id$ * ********************************************************************************************************/ /* * This files specified a list of "excluded groups". * All group-ids specified are non-editable while editing group assignments. * This may be used to block privilege escalations in special scenarios. * The groups are removed from the assignment-table unless you are a super-admin. * * Provide a comma-separated list of group-ids. */ $config["blockedgroups"] = "" . class_module_system_setting::getConfigValue("_admins_group_id_");
/** * Does the hard work: installs the module and registers needed constants * * @return string */ public function install() { $strReturn = ""; if (class_module_system_module::getModuleByName("mediamanager") == null) { return "Mediamanger not installed, skipping element\n"; } //fetch navifolder-id $strNaviFolderId = ""; $arrFolder = class_module_pages_folder::getFolderList(); foreach ($arrFolder as $objOneFolder) { if ($objOneFolder->getStrName() == "mainnavigation") { $strNaviFolderId = $objOneFolder->getSystemid(); } } $strReturn .= "Creating new downloads...\n"; $objDownloads = new class_module_mediamanager_repo(); $objDownloads->setStrTitle("Sample downloads"); $objDownloads->setStrPath("/files/downloads"); $objDownloads->updateObjectToDb(); $strDownloadsID = $objDownloads->getSystemid(); $objDownloads->syncRepo(); $strReturn .= "Adding download-permissions for guests...\n"; class_carrier::getInstance()->getObjRights()->addGroupToRight(class_module_system_setting::getConfigValue("_guests_group_id_"), $objDownloads->getSystemid(), "right2"); $strReturn .= "Adding rating-permissions for guests...\n"; class_carrier::getInstance()->getObjRights()->addGroupToRight(class_module_system_setting::getConfigValue("_guests_group_id_"), $objDownloads->getSystemid(), "right3"); $strReturn .= "Creating new downloads page...\n"; $objPage = new class_module_pages_page(); $objPage->setStrName("downloads"); $objPage->setStrBrowsername("Downloads"); $objPage->setStrTemplate("standard.tpl"); $objPage->updateObjectToDb($strNaviFolderId); $strDownloadsPageId = $objPage->getSystemid(); $strReturn .= "ID of new page: " . $strDownloadsPageId . "\n"; $strReturn .= "Adding pagelement to new page\n"; $objPagelement = new class_module_pages_pageelement(); if (class_module_pages_element::getElement("downloads") != null) { $objPagelement->setStrPlaceholder("special_news|guestbook|downloads|gallery|galleryRandom|form|tellafriend|maps|search|navigation|faqs|postacomment|votings|userlist|rssfeed|tagto|portallogin|portalregistration|portalupload|directorybrowser|lastmodified|tagcloud|downloadstoplist|flash|mediaplayer|tags|eventmanager"); $objPagelement->setStrName("special"); $objPagelement->setStrElement("downloads"); $objPagelement->updateObjectToDb($strDownloadsPageId); $strElementId = $objPagelement->getSystemid(); $strQuery = "UPDATE " . _dbprefix_ . "element_downloads\n SET download_id = ?,\n download_template = ?\n WHERE content_id = ? "; if ($this->objDB->_pQuery($strQuery, array($strDownloadsID, "downloads.tpl", $strElementId))) { $strReturn .= "downloads element created.\n"; } else { $strReturn .= "Error creating downloads element.\n"; } } $strReturn .= "Adding headline-element to new page\n"; if (class_module_pages_element::getElement("row") != null) { $objPagelement = new class_module_pages_pageelement(); $objPagelement->setStrPlaceholder("headline_row"); $objPagelement->setStrName("headline"); $objPagelement->setStrElement("row"); $objPagelement->updateObjectToDb($strDownloadsPageId); $strElementId = $objPagelement->getSystemid(); $strQuery = "UPDATE " . _dbprefix_ . "element_paragraph\n SET paragraph_title = ?\n WHERE content_id = ?"; if ($this->objDB->_pQuery($strQuery, array("Downloads", $strElementId))) { $strReturn .= "Headline element created.\n"; } else { $strReturn .= "Error creating headline element.\n"; } } return $strReturn; }
/** * Checks if a given user-id is granted the passed permission for the passed systemid. * * @param string $strUserid * @param string $strPermission * @param string $strSystemid * * @return bool */ public function checkPermissionForUserId($strUserid, $strPermission, $strSystemid) { if ($strSystemid == "") { return false; } if ($this->bitTestMode) { return true; } $arrGroupIds = array(); if (validateSystemid($strUserid)) { if ($strUserid == $this->objSession->getUserID()) { $arrGroupIds = $this->objSession->getGroupIdsAsArray(); } else { $objUser = new class_module_user_user($strUserid); $arrGroupIds = $objUser->getArrGroupIds(); } } else { if (validateSystemid($this->objSession->getUserID())) { $arrGroupIds = $this->objSession->getGroupIdsAsArray(); } else { $arrGroupIds[] = class_module_system_setting::getConfigValue("_guests_group_id_"); } } foreach ($arrGroupIds as $strOneGroupId) { if ($this->checkPermissionForGroup($strOneGroupId, $strPermission, $strSystemid)) { return true; } } return false; }
/** * Sends, finally, the mail * * @return bool */ public function sendMail() { $bitReturn = false; //Do we have all neccessary arguments? if (count($this->arrayTo) > 0) { $bitReturn = true; } if ($bitReturn) { //Building the mail $strTo = implode(", ", $this->arrayTo); //Sender if ($this->strSender == "") { //try to load the current users' mail adress if (validateSystemid(class_carrier::getInstance()->getObjSession()->getUserID())) { $objUser = new class_module_user_user(class_carrier::getInstance()->getObjSession()->getUserID()); if (checkEmailaddress($objUser->getStrEmail())) { $this->strSender = $objUser->getStrEmail(); } } } if ($this->strSender == "" || class_module_system_setting::getConfigValue("_system_email_forcesender_") == "true") { $this->strSender = class_module_system_setting::getConfigValue("_system_email_defaultsender_"); } if ($this->strSender != "") { //build the from-arguments if ($this->strSenderName != "") { $strFrom = $this->encodeText($this->strSenderName) . " <" . $this->strSender . ">"; } else { $strFrom = $this->strSender; } $this->arrHeader[] = "From: " . $strFrom . $this->strEndOfLine; $this->arrHeader[] = "Reply-To: " . $this->strSender . $this->strEndOfLine; } //cc if (count($this->arrayCc) > 0) { $this->arrHeader[] = "Cc: " . implode(", ", $this->arrayCc) . $this->strEndOfLine; } //bcc if (count($this->arrayBcc) > 0) { $this->arrHeader[] = "Bcc: " . implode(", ", $this->arrayBcc) . $this->strEndOfLine; } //Kajona Headers to avoid being marked as spam $this->arrHeader[] = "X-Mailer: Kajona Mailer V4" . $this->strEndOfLine; $this->arrHeader[] = "Message-ID: <" . generateSystemid() . "_kajona@" . getServer("SERVER_NAME") . ">" . $this->strEndOfLine; //header for multipartmails? $strBoundary = generateSystemid(); if ($this->bitMultipart || $this->bitFileAttached) { $this->arrHeader[] = 'MIME-Version: 1.0' . $this->strEndOfLine; //file attached? if ($this->bitFileAttached) { $this->arrHeader[] = "Content-Type: multipart/related; boundary=\"" . $strBoundary . "\"" . $this->strEndOfLine; } else { $this->arrHeader[] = "Content-Type: multipart/alternative; boundary=\"" . $strBoundary . "\"" . $this->strEndOfLine; } } //generate the mail-body $strBody = ""; //multipart mail using html? if ($this->bitMultipart) { //multipart encoded mail $strBoundaryAlt = generateSystemid(); //if a file should attached, a splitter is needed here if ($this->bitFileAttached) { $strBody .= "--" . $strBoundary . $this->strEndOfLine; $strBody .= "Content-Type: multipart/alternative; boundary=\"" . $strBoundaryAlt . "\"" . $this->strEndOfLine; } else { //no new boundary-section, use old boundary instead $strBoundaryAlt = $strBoundary; } //place a body for strange mail-clients $strBody .= "This is a multi-part message in MIME format." . $this->strEndOfLine . $this->strEndOfLine; //text-version $strBody .= "--" . $strBoundaryAlt . $this->strEndOfLine; $strBody .= "Content-Type: text/plain; charset=UTF-8" . $this->strEndOfLine; $strText = strip_tags($this->strText == "" ? str_replace(array("<br />", "<br />"), array("\n", "\n"), $this->strHtml) : $this->strText); if (function_exists("quoted_printable_encode")) { $strBody .= "Content-Transfer-Encoding: quoted-printable" . $this->strEndOfLine . $this->strEndOfLine; $strBody .= quoted_printable_encode($strText); } else { $strBody .= "Content-Transfer-Encoding: 8bit" . $this->strEndOfLine . $this->strEndOfLine; $strBody .= $strText; } $strBody .= $this->strEndOfLine . $this->strEndOfLine; //html-version if ($this->strHtml != "") { $strBody .= "--" . $strBoundaryAlt . $this->strEndOfLine; $strBody .= "Content-Type: text/html; charset=UTF-8" . $this->strEndOfLine; $strBody .= "Content-Transfer-Encoding: 8bit" . $this->strEndOfLine . $this->strEndOfLine; $strBody .= $this->strHtml; $strBody .= $this->strEndOfLine . $this->strEndOfLine; } if ($this->bitFileAttached) { $strBody .= "--" . $strBoundaryAlt . "--" . $this->strEndOfLine . $this->strEndOfLine; } } else { $this->arrHeader[] = "Content-Type: text/plain; charset=UTF-8" . $this->strEndOfLine; if (function_exists("quoted_printable_encode")) { $this->arrHeader[] = "Content-Transfer-Encoding: quoted-printable" . $this->strEndOfLine; $strBody .= quoted_printable_encode($this->strText); } else { $strBody .= $this->strText; } } //any files to place in the mail body? if ($this->bitFileAttached) { foreach ($this->arrFiles as $arrOneFile) { $strFileContents = chunk_split(base64_encode(file_get_contents($arrOneFile["filename"]))); //place file in mailbody $strBody .= "--" . $strBoundary . $this->strEndOfLine; $strBody .= "Content-Type: " . $arrOneFile["mimetype"] . "; name=\"" . basename($arrOneFile["filename"]) . "\"" . $this->strEndOfLine; $strBody .= "Content-Transfer-Encoding: base64" . $this->strEndOfLine; if ($arrOneFile["inline"] === true) { $strBody .= "Content-Disposition: inline; filename=\"" . basename($arrOneFile["filename"]) . "\"" . $this->strEndOfLine; $strBody .= "Content-ID: <" . basename($arrOneFile["filename"]) . ">" . $this->strEndOfLine . $this->strEndOfLine; } else { $strBody .= "Content-Disposition: attachment; filename=\"" . basename($arrOneFile["filename"]) . "\"" . $this->strEndOfLine . $this->strEndOfLine; } $strBody .= $strFileContents; $strBody .= $this->strEndOfLine . $this->strEndOfLine; } } //finish mail if ($this->bitFileAttached || $this->bitMultipart) { $strBody .= "--" . $strBoundary . "--" . $this->strEndOfLine . $this->strEndOfLine; } //send mail // in some cases, the optional param "-f test@kajona.de" may be added as mail()s' 5th param class_logger::getInstance()->addLogRow("sent mail to " . $strTo, class_logger::$levelInfo); $bitReturn = mail($strTo, $this->encodeText($this->strSubject), $strBody, implode("", $this->arrHeader)); } return $bitReturn; }
/** * Dumps the current db * Takes care of holding just the defined number of dumps in the filesystem, defined by _system_dbdump_amount_ * * @param array $arrTablesToExclude specify a set of tables not to be included in the dump * * @return bool */ public function dumpDb($arrTablesToExclude = array()) { if (!$this->bitConnected) { $this->dbconnect(); } // Check, how many dumps to keep $objFilesystem = new class_filesystem(); $arrFiles = $objFilesystem->getFilelist(_projectpath_ . "/dbdumps/", array(".sql", ".gz")); while (count($arrFiles) >= class_module_system_setting::getConfigValue("_system_dbdump_amount_")) { $strFile = array_shift($arrFiles); if (!$objFilesystem->fileDelete(_projectpath_ . "/dbdumps/" . $strFile)) { class_logger::getInstance(class_logger::DBLOG)->addLogRow("Error deleting old db-dumps", class_logger::$levelWarning); return false; } $arrFiles = $objFilesystem->getFilelist(_projectpath_ . "/dbdumps/", array(".sql", ".gz")); } $strTargetFilename = _projectpath_ . "/dbdumps/dbdump_" . time() . ".sql"; $arrTables = $this->getTables(); $arrTablesFinal = array(); if (count($arrTablesToExclude) > 0) { foreach ($arrTables as $strOneTable) { if (!in_array(uniStrReplace(_dbprefix_, "", $strOneTable), $arrTablesToExclude)) { $arrTablesFinal[] = $strOneTable; } } } else { $arrTablesFinal = $arrTables; } $bitDump = $this->objDbDriver->dbExport($strTargetFilename, $arrTablesFinal); if ($bitDump == true) { $objGzip = new class_gzip(); try { if (!$objGzip->compressFile($strTargetFilename, true)) { class_logger::getInstance(class_logger::DBLOG)->addLogRow("Failed to compress (gzip) the file " . basename($strTargetFilename) . "", class_logger::$levelWarning); } } catch (class_exception $objExc) { $objExc->processException(); } } if ($bitDump) { class_logger::getInstance(class_logger::DBLOG)->addLogRow("DB-Dump " . basename($strTargetFilename) . " created", class_logger::$levelInfo); } else { class_logger::getInstance(class_logger::DBLOG)->addLogRow("Error creating " . basename($strTargetFilename), class_logger::$levelError); } return $bitDump; }
/** * Saves the rights passed by form * * @throws class_exception * @return string "" in case of success * @permissions right * @xml */ protected function actionSaveRights() { class_response_object::getInstance()->setStrResponseType(class_http_responsetypes::STR_TYPE_JSON); $arrRequest = json_decode($this->getParam("json")); //Collecting & sorting the passed values $strSystemid = $this->getSystemid(); $objRights = class_carrier::getInstance()->getObjRights(); if ($this->getParam("systemid") == "0") { $objTarget = new class_module_system_common("0"); $objTarget->setStrSystemid("0"); $strSystemid = "0"; } else { $objTarget = class_objectfactory::getInstance()->getObject($this->getSystemid()); } //Special case: The root-record. if (!$objTarget->rightRight()) { return $this->objToolkit->warningBox($this->getLang("commons_error_permissions"), "alert-danger"); } //Inheritance? if ($arrRequest->bitInherited) { $intInherit = 1; } else { $intInherit = 0; } //Modified RootRecord? Here Inheritance is NOT allowed! if ($strSystemid == "0") { $intInherit = 0; } $strAdminsGroupId = class_module_system_setting::getConfigValue("_admins_group_id_"); $strView = $strAdminsGroupId; $strEdit = $strAdminsGroupId; $strDelete = $strAdminsGroupId; $strRight = $strAdminsGroupId; $strRight1 = $strAdminsGroupId; $strRight2 = $strAdminsGroupId; $strRight3 = $strAdminsGroupId; $strRight4 = $strAdminsGroupId; $strRight5 = $strAdminsGroupId; $strChangelog = $strAdminsGroupId; foreach ($arrRequest->arrConfigs as $strOneCfg) { $arrRow = explode(",", $strOneCfg); if ($arrRow[1] == $strAdminsGroupId) { continue; } switch ($arrRow[0]) { case "1": $strView .= "," . $arrRow[1]; break; case "2": $strEdit .= "," . $arrRow[1]; break; case "3": $strDelete .= "," . $arrRow[1]; break; case "4": $strRight .= "," . $arrRow[1]; break; case "5": $strRight1 .= "," . $arrRow[1]; break; case "6": $strRight2 .= "," . $arrRow[1]; break; case "7": $strRight3 .= "," . $arrRow[1]; break; case "8": $strRight4 .= "," . $arrRow[1]; break; case "9": $strRight5 .= "," . $arrRow[1]; break; case "10": $strChangelog .= "," . $arrRow[1]; break; } } $arrReturn = array("inherit" => $intInherit, "view" => $strView, "edit" => $strEdit, "delete" => $strDelete, "right" => $strRight, "right1" => $strRight1, "right2" => $strRight2, "right3" => $strRight3, "right4" => $strRight4, "right5" => $strRight5, "changelog" => $strChangelog); //Pass to right-class if ($objRights->setRights($arrReturn, $strSystemid)) { $strReturn = $this->objToolkit->warningBox($this->getLang("permissions_success"), "alert-success"); } else { $strReturn = $this->objToolkit->warningBox($this->getLang("fehler_setzen"), "alert-danger"); } return json_encode(array("message" => $strReturn)); }
/** * @param interface_model|class_root $objListEntry * * @return string */ protected function renderDeleteAction(interface_model $objListEntry) { if ($objListEntry->rightDelete() && $this->getObjModule()->rightDelete()) { if (class_module_system_setting::getConfigValue("_packagemanager_defaulttemplate_") == $objListEntry->getStrName()) { return $this->objToolkit->listButton(class_adminskin_helper::getAdminImage("icon_deleteDisabled", $this->getLang("pack_active_no_delete"))); } else { return $this->objToolkit->listDeleteButton($objListEntry->getStrDisplayName(), $this->getLang("delete_question"), class_link::getLinkAdminHref($this->getArrModule("modul"), "deleteTemplate", "&systemid=" . $objListEntry->getSystemid() . "")); } } return ""; }
/** * Saves the memberships passed by param * * @return string "" in case of success * @permissions edit */ protected function actionSaveMembership() { $objUser = new class_module_user_user($this->getSystemid()); $objUsersources = new class_module_user_sourcefactory(); $objSourcesytem = $objUsersources->getUsersource($objUser->getStrSubsystem()); $arrGroups = $objSourcesytem->getAllGroupIds(); $arrUserGroups = $objUser->getArrGroupIds(); //validate possible blocked groups $objConfig = class_config::getInstance("blockedgroups.php"); $arrBlockedGroups = explode(",", $objConfig->getConfig("blockedgroups")); //Searching for groups to enter foreach ($arrGroups as $strSingleGroup) { $objGroup = new class_module_user_group($strSingleGroup); //skipped for blocked groups, those won't be updated if (!$this->isGroupEditable($objGroup)) { continue; } if ($this->getParam($strSingleGroup) != "") { //add the user to this group if (!in_array($strSingleGroup, $arrUserGroups)) { $objGroup->getObjSourceGroup()->addMember($objUser->getObjSourceUser()); } else { //user is already in the group, remove the marker foreach ($arrUserGroups as $strKey => $strValue) { if ($strValue == $strSingleGroup) { $arrUserGroups[$strKey] = null; } } } } } //check, if the current user is member of the admin-group. //if not, remain the admin-group as-is if (!class_carrier::getInstance()->getObjSession()->isSuperAdmin()) { $intKey = array_search(class_module_system_setting::getConfigValue("_admins_group_id_"), $arrUserGroups); if ($intKey !== false) { $arrUserGroups[$intKey] = null; } foreach ($arrBlockedGroups as $strOneGroup) { $intKey = array_search($strOneGroup, $arrUserGroups); if ($intKey !== false) { $arrUserGroups[$intKey] = null; } } } //loop the users' list in order to remove unwanted relations foreach ($arrUserGroups as $strValue) { if (validateSystemid($strValue)) { $objGroup = new class_module_user_group($strValue); $objGroup->getObjSourceGroup()->removeMember($objUser->getObjSourceUser()); } } if ($this->getParam("folderview")) { $this->adminReload(class_link::getLinkAdminHref($this->getArrModule("modul"), "list", "&peClose=1&blockAction=1")); } else { $this->adminReload(class_link::getLinkAdminHref($this->getArrModule("modul"), "list")); } }
/** * Does the hard work: installs the module and registers needed constants * * @return string */ public function install() { if (class_module_system_module::getModuleByName("mediamanager") == null) { return "Mediamanger not installed, skipping element\n"; } $strReturn = ""; //fetch navifolder-id $strNaviFolderId = ""; $arrFolder = class_module_pages_folder::getFolderList(); foreach ($arrFolder as $objOneFolder) { if ($objOneFolder->getStrName() == "mainnavigation") { $strNaviFolderId = $objOneFolder->getSystemid(); } } $strReturn .= "Creating new gallery...\n"; $objGallery = new class_module_mediamanager_repo(); $objGallery->setStrTitle("Sample Gallery"); $objGallery->setStrPath(_filespath_ . "/images/samples"); $objGallery->setStrUploadFilter(".jpg,.png,.gif,.jpeg"); $objGallery->setStrViewFilter(".jpg,.png,.gif,.jpeg"); $objGallery->updateObjectToDb(); $objGallery->syncRepo(); $strGalleryID = $objGallery->getSystemid(); $strReturn .= "Modify rights to allow guests to rate images...\n"; class_carrier::getInstance()->getObjRights()->addGroupToRight(class_module_system_setting::getConfigValue("_guests_group_id_"), $objGallery->getSystemid(), "right3"); $strReturn .= "Creating new gallery page...\n"; $objPage = new class_module_pages_page(); $objPage->setStrName("gallery"); $objPage->setStrBrowsername("Gallery"); $objPage->setStrTemplate("standard.tpl"); $objPage->updateObjectToDb($strNaviFolderId); $strGalleryPageId = $objPage->getSystemid(); $strReturn .= "ID of new page: " . $strGalleryPageId . "\n"; $strReturn .= "Adding pagelement to new page\n"; if (class_module_pages_element::getElement("gallery") != null) { $objPagelement = new class_module_pages_pageelement(); $objPagelement->setStrPlaceholder("special_news|guestbook|downloads|gallery|galleryRandom|form|tellafriend|maps|search|navigation|faqs|postacomment|votings|userlist|rssfeed|tagto|portallogin|portalregistration|portalupload|directorybrowser|lastmodified|tagcloud|downloadstoplist|flash|mediaplayer|tags|eventmanager"); $objPagelement->setStrName("special"); $objPagelement->setStrElement("gallery"); $objPagelement->updateObjectToDb($strGalleryPageId); $strElementId = $objPagelement->getSystemid(); $strQuery = "UPDATE " . _dbprefix_ . "element_gallery\n SET gallery_id = ?,\n gallery_mode = ?,\n gallery_template = ?,\n gallery_maxh_d = ?,\n gallery_maxw_d = ?,\n gallery_imagesperpage = ?,\n gallery_text = ?,\n gallery_text_x = ?,\n gallery_text_y = ?\n WHERE content_id = ? "; if ($this->objDB->_pQuery($strQuery, array($strGalleryID, 0, "gallery_imagelightbox.tpl", 600, 600, 0, "(c) kajona.de", 5, 15, $strElementId))) { $strReturn .= "Gallery element created.\n"; } else { $strReturn .= "Error creating Gallery element.\n"; } } $strReturn .= "Adding headline-element to new page\n"; if (class_module_pages_element::getElement("row") != null) { $objPagelement = new class_module_pages_pageelement(); $objPagelement->setStrPlaceholder("headline_row"); $objPagelement->setStrName("headline"); $objPagelement->setStrElement("row"); $objPagelement->updateObjectToDb($strGalleryPageId); $strElementId = $objPagelement->getSystemid(); $strQuery = "UPDATE " . _dbprefix_ . "element_paragraph\n SET paragraph_title = ?\n WHERE content_id = ?"; if ($this->objDB->_pQuery($strQuery, array("Gallery", $strElementId))) { $strReturn .= "Headline element created.\n"; } else { $strReturn .= "Error creating headline element.\n"; } } $strReturn .= "Adding paragraph-element to new page\n"; if (class_module_pages_element::getElement("paragraph") != null) { $objPagelement = new class_module_pages_pageelement(); $objPagelement->setStrPlaceholder("text_paragraph"); $objPagelement->setStrName("text"); $objPagelement->setStrElement("paragraph"); $objPagelement->updateObjectToDb($strGalleryPageId); $strElementId = $objPagelement->getSystemid(); $arrParams = array(); if ($this->strContentLanguage == "de") { $arrParams[] = ""; $arrParams[] = "Alle Beispielbilder © by kajona.de"; $arrParams[] = $strElementId; } else { $arrParams[] = ""; $arrParams[] = "All sample images © by kajona.de"; $arrParams[] = $strElementId; } $strQuery = "UPDATE " . _dbprefix_ . "element_paragraph\n SET paragraph_title = ?,\n paragraph_content = ?\n WHERE content_id = ?"; if ($this->objDB->_pQuery($strQuery, $arrParams)) { $strReturn .= "Paragraph element created.\n"; } else { $strReturn .= "Error creating paragraph element.\n"; } } return $strReturn; }
/** * Creates a table filled with the sessions currently registered. * Returned structure: * <sessions> * <session> * <username></username> * <loginstatus></loginstatus> * <releasetime></releasetime> * <activity></activity> * </session> * </sessions> * * @return string * @permissions right1 */ protected function actionSystemSessions() { $strReturn = ""; //check needed rights $arrSessions = class_module_system_session::getAllActiveSessions(); $strReturn .= "<sessions>"; foreach ($arrSessions as $objOneSession) { $strReturn .= "<session>"; $strUsername = ""; if ($objOneSession->getStrUserid() != "") { $objUser = new class_module_user_user($objOneSession->getStrUserid()); $strUsername = $objUser->getStrUsername(); } $strLoginStatus = ""; if ($objOneSession->getStrLoginstatus() == class_module_system_session::$LOGINSTATUS_LOGGEDIN) { $strLoginStatus = $this->getLang("session_loggedin"); } else { $strLoginStatus = $this->getLang("session_loggedout"); } //find out what the user is doing... $strLastUrl = $objOneSession->getStrLasturl(); if (uniStrpos($strLastUrl, "?") !== false) { $strLastUrl = uniSubstr($strLastUrl, uniStrpos($strLastUrl, "?")); } $strActivity = ""; if (uniStrpos($strLastUrl, "admin=1") !== false) { $strActivity .= $this->getLang("session_admin"); foreach (explode("&", $strLastUrl) as $strOneParam) { $arrUrlParam = explode("=", $strOneParam); if ($arrUrlParam[0] == "module") { $strActivity .= $arrUrlParam[1]; } } } else { $strActivity .= $this->getLang("session_portal"); if ($strLastUrl == "") { $strActivity .= class_module_system_setting::getConfigValue("_pages_indexpage_"); } else { foreach (explode("&", $strLastUrl) as $strOneParam) { $arrUrlParam = explode("=", $strOneParam); if ($arrUrlParam[0] == "page") { $strActivity .= $arrUrlParam[1]; } } if ($strActivity == $this->getLang("session_portal") && uniSubstr($strLastUrl, 0, 5) == "image") { $strActivity .= $this->getLang("session_portal_imagegeneration"); } } } $strReturn .= "<username>" . xmlSafeString($strUsername) . "</username>"; $strReturn .= "<loginstatus>" . xmlSafeString($strLoginStatus) . "</loginstatus>"; $strReturn .= "<releasetime>" . xmlSafeString(timeToString($objOneSession->getIntReleasetime())) . "</releasetime>"; $strReturn .= "<activity>" . xmlSafeString($strActivity) . "</activity>"; $strReturn .= "</session>"; } $strReturn .= "</sessions>"; return $strReturn; }
/** * Renders the button to open the records' change history. In most cases, this is done in a overlay. * To open the change-history, the permission "right3" on the system-module is required. * * @param class_model|interface_model $objListEntry * * @return string */ protected function renderChangeHistoryAction(class_model $objListEntry) { if (class_module_system_setting::getConfigValue("_system_changehistory_enabled_") == "true" && $objListEntry instanceof interface_versionable && $objListEntry->rightChangelog()) { return $this->objToolkit->listButton(class_link::getLinkAdminDialog("system", "genericChangelog", "&systemid=" . $objListEntry->getSystemid() . "&folderview=1", $this->getLang("commons_edit_history"), $this->getLang("commons_edit_history"), "icon_history", $objListEntry->getStrDisplayName())); } return ""; }
/** * Creates a raw Link for the portal (just the href) * * @param string $strPageI * @param string $strPageE * @param string $strAction * @param string $strParams * @param string $strSystemid * @param string $strLanguage * @param string $strSeoAddon Only used if using mod_rewrite * @return string */ public static function getLinkPortalHref($strPageI, $strPageE = "", $strAction = "", $strParams = "", $strSystemid = "", $strLanguage = "", $strSeoAddon = "") { $strReturn = ""; $bitInternal = true; //return "#" if neither an internal nor an external page is set if ($strPageI == "" && $strPageE == "") { return "#"; } //Internal links are more important than external links! if ($strPageI == "" && $strPageE != "") { $bitInternal = false; } //create an array out of the params if ($strSystemid != "") { $strParams .= "&systemid=" . $strSystemid; $strSystemid = ""; } $arrParams = self::parseParamsString($strParams, $strSystemid); // any anchors set to the page? $strAnchor = ""; if (uniStrpos($strPageI, "#") !== false) { //get anchor, remove anchor from link $strAnchor = urlencode(uniSubstr($strPageI, uniStrpos($strPageI, "#") + 1)); $strPageI = uniSubstr($strPageI, 0, uniStrpos($strPageI, "#")); } //urlencoding $strPageI = urlencode($strPageI); $strAction = urlencode($strAction); //more than one language installed? if ($strLanguage == "" && self::getIntNumberOfPortalLanguages() > 1) { $strLanguage = self::getStrPortalLanguage(); } else { if ($strLanguage != "" && self::getIntNumberOfPortalLanguages() <= 1) { $strLanguage = ""; } } $strHref = ""; if ($bitInternal) { //check, if we could use mod_rewrite $bitRegularLink = true; if (class_module_system_setting::getConfigValue("_system_mod_rewrite_") == "true") { $strAddKeys = ""; //used later to add seo-relevant keywords $objPage = class_module_pages_page::getPageByName($strPageI); if ($objPage !== null) { if ($strLanguage != "") { $objPage->setStrLanguage($strLanguage); $objPage->initObject(); } $strAddKeys = $objPage->getStrSeostring() . ($strSeoAddon != "" && $objPage->getStrSeostring() != "" ? "-" : "") . urlSafeString($strSeoAddon); if (uniStrlen($strAddKeys) > 0 && uniStrlen($strAddKeys) <= 2) { $strAddKeys .= "__"; } //trim string $strAddKeys = uniStrTrim($strAddKeys, 100, ""); if ($strLanguage != "") { $strHref .= $strLanguage . "/"; } $strPath = $objPage->getStrPath(); if ($strPath == "") { $objPage->updatePath(); $strPath = $objPage->getStrPath(); $objPage->updateObjectToDb(); } if ($strPath != "") { $strHref .= $strPath . "/"; } } //ok, here we go. schema for rewrite_links: pagename.addKeywords.action.systemid.language.html //but: special case: just pagename & language if ($strAction == "" && $strSystemid == "" && $strAddKeys == "") { $strHref .= $strPageI . ".html"; } elseif ($strAction == "" && $strSystemid == "") { $strHref .= $strPageI . ($strAddKeys == "" ? "" : "." . $strAddKeys) . ".html"; } elseif ($strAction != "" && $strSystemid == "") { $strHref .= $strPageI . "." . $strAddKeys . "." . $strAction . ".html"; } else { $strHref .= $strPageI . "." . $strAddKeys . "." . $strAction . "." . $strSystemid . ".html"; } //params? if (count($arrParams) > 0) { $strHref .= "?" . implode("&", $arrParams); } // add anchor if given if ($strAnchor != "") { $strHref .= "#" . $strAnchor; } //plus the domain as a prefix $strHref = "_webpath_" . "/" . $strHref; $bitRegularLink = false; } if ($bitRegularLink) { $strHref = "_indexpath_" . "?" . ($strPageI != "" ? "page=" . $strPageI : "") . "" . ($strSystemid != "" ? "&systemid=" . $strSystemid : "") . ($strAction != "" ? "&action=" . $strAction : "") . ($strLanguage != "" ? "&language=" . $strLanguage : "") . (count($arrParams) > 0 ? "&" . implode("&", $arrParams) : "") . ($strAnchor != "" ? "#" . $strAnchor : "") . ""; } } else { $strHref = $strPageE; } $strReturn .= $strHref; return $strReturn; }
* $Id$ * ********************************************************************************************************/ /* Usage: Define as many elements as wanted using the $arrGlobal["nameOfPlaceholder"] = "Value of placeholder"; schema. To have the elements included in the pages, define the placeholders in the templates! In the example above, the templates should provide a placeholder like %%nameOfPlaceholder%% At the time of generation, this placeholder will be replaced by the specified content: Value of placeholder */ $arrGlobal["copyright"] = "powered by <a href=\"http://www.kajona.de\" target=\"_blank\" title=\"Kajona CMS - empowering your content\">Kajona</a>"; //---Kajona head parts, please leave them as they are---------------------------------------------------- $arrGlobal["kajona_head"] = " <script type=\"text/javascript\" src=\"" . _webpath_ . "/templates/default/js/jquery/jquery.min.js?" . class_module_system_setting::getConfigValue("_system_browser_cachebuster_") . "\"></script>\n"; $arrGlobal["kajona_head"] .= " <script type=\"text/javascript\">KAJONA_WEBPATH = '" . _webpath_ . "'; KAJONA_BROWSER_CACHEBUSTER = '" . class_module_system_setting::getConfigValue("_system_browser_cachebuster_") . "';</script>\n"; $arrGlobal["kajona_head"] .= " <script type=\"text/javascript\" src=\"" . _webpath_ . class_resourceloader::getInstance()->getCorePathForModule("module_system") . "/module_system/system/scripts/loader.js?" . class_module_system_setting::getConfigValue("_system_browser_cachebuster_") . "\"></script>\n"; $arrGlobal["kajona_head"] .= " <script type=\"text/javascript\" src=\"" . _webpath_ . "/templates/default/js/kajona.js?" . class_module_system_setting::getConfigValue("_system_browser_cachebuster_") . "\"></script>\n"; $arrGlobal["kajona_head"] .= " <meta http-equiv=\"content-language\" content=\"" . $this->getStrPortalLanguage() . "\" />\n"; $arrGlobal["kajona_head"] .= " <meta name=\"generator\" content=\"Kajona, www.kajona.de\" />"; /* The next placeholder is used as an extra separator for the page-title. In some scenarios, modules may add additional texts to the current title, e.g. the name of a news. In this case, you can define a separator. This may lead to s.th. like "New Kajona version released | Welcome | Kajona" instead of "Welcome | Kajona". Feel free to modify the following line. */ $arrGlobal["kajonaTitleSeparator"] = " | ";
/** * Counts the number of records currently locked in the database * * @return int */ public static function getLockedRecordsCount() { $strQuery = "SELECT COUNT(*) FROM " . _dbprefix_ . "system WHERE system_lock_time > ?"; $arrRow = class_carrier::getInstance()->getObjDB()->getPRow($strQuery, array(time() - (int) class_module_system_setting::getConfigValue("_system_lock_maxtime_"))); return $arrRow["COUNT(*)"]; }