/** * 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 ""; }
/** * @return string * @permissions view,right1 */ protected function actionSaveRegisterForEvent() { $strReturn = ""; $objEvent = new class_module_eventmanager_event($this->getSystemid()); class_module_pages_portal::registerAdditionalTitle($objEvent->getStrTitle()); $bitIsLoggedin = false; $bitIsParticipant = false; if ($this->objSession->isLoggedin() && $this->objTemplate->containsSection($this->objTemplate->readTemplate("/module_eventmanager/" . $this->arrElementData["char1"]), "event_register_loggedin")) { $bitIsLoggedin = true; if ($objEvent->isParticipant($this->objSession->getUserID())) { $bitIsParticipant = true; } } $arrErrors = array(); //what to do? $objTextValidator = new class_text_validator(); $objMailValidator = new class_email_validator(); if (!$bitIsLoggedin && !$objTextValidator->validate($this->getParam("forename"), 3)) { $arrErrors[] = $this->getLang("noForename"); } if (!$bitIsLoggedin && !$objTextValidator->validate($this->getParam("lastname"), 3)) { $arrErrors[] = $this->getLang("noLastname"); } if (!$bitIsLoggedin && !$objMailValidator->validate($this->getParam("email"))) { $arrErrors[] = $this->getLang("invalidEmailadress"); } //Check captachcode if (!$bitIsLoggedin && ($this->getParam("form_captcha") == "" || $this->getParam("form_captcha") != $this->objSession->getCaptchaCode())) { $arrErrors[] = $this->getLang("commons_captcha"); } if (count($arrErrors) != 0) { return $this->actionRegisterForEvent($arrErrors); } if ($objEvent->getIntLimitGiven() == "1" && $objEvent->getIntParticipantsLimit() <= class_module_eventmanager_participant::getActiveParticipantsCount($this->getSystemid())) { $strMessage = $this->getLang("participantLimitReached"); $strWrapperID = $this->objTemplate->readTemplate("/module_eventmanager/" . $this->arrElementData["char1"], "event_register_message"); $strReturn = $this->objTemplate->fillTemplate(array("title" => $objEvent->getStrTitle(), "message" => $strMessage), $strWrapperID); return $strReturn; } if ($bitIsParticipant) { $objParticipant = class_module_eventmanager_participant::getParticipantByUserid($this->objSession->getUserID(), $objEvent->getSystemid()); } else { $objParticipant = new class_module_eventmanager_participant(); } //here we go, create the complete event registration $objParticipant->setStrComment($this->getParam("comment")); if ($bitIsLoggedin) { $objParticipant->setStrUserId($this->objSession->getUserID()); $objParticipant->setIntParticipationStatus($this->getParam("participant_status")); } else { $objParticipant->setStrForename($this->getParam("forename")); $objParticipant->setStrLastname($this->getParam("lastname")); $objParticipant->setStrPhone($this->getParam("phone")); $objParticipant->setStrEmail($this->getParam("email")); } $objParticipant->updateObjectToDb($this->getSystemid()); if ($bitIsParticipant) { $strMessage = $this->getLang("participantUpdateMessage"); $strWrapperID = $this->objTemplate->readTemplate("/module_eventmanager/" . $this->arrElementData["char1"], "event_register_message"); return $this->objTemplate->fillTemplate(array("title" => $objEvent->getStrTitle(), "message" => $strMessage), $strWrapperID); } $objParticipant->setIntRecordStatus(0); $objParticipant->updateObjectToDb(); $objMail = new class_mail(); $objMail->setSubject($this->getLang("registerMailSubject")); $strBody = $this->getLang("registerMailBodyIntro"); $strBody .= $objEvent->getStrTitle() . "<br />"; $strBody .= dateToString($objEvent->getObjStartDate(), true) . "<br />"; $strBody .= $objEvent->getStrLocation() . "<br />"; $strBody .= "\n"; $strTemp = class_link::getLinkPortalHref($this->getPagename(), "", "participantConfirmation", "&participantId=" . $objParticipant->getSystemid(), $this->getSystemid(), "", $objEvent->getStrTitle()); $strBody .= html_entity_decode("<a href=\"" . $strTemp . "\">" . $strTemp . "</a>"); $objScriptlet = new class_scriptlet_helper(); $strBody = $objScriptlet->processString($strBody); $objMail->setHtml($strBody); $objMail->addTo($objParticipant->getStrEmail()); $objMail->sendMail(); $strMessage = $this->getLang("participantSuccessMail"); $strWrapperID = $this->objTemplate->readTemplate("/module_eventmanager/" . $this->arrElementData["char1"], "event_register_message"); $strReturn .= $this->objTemplate->fillTemplate(array("title" => $objEvent->getStrTitle(), "message" => $strMessage), $strWrapperID); return $strReturn; }
/** * saves a post in the database and returns the post as html. * In case of missing fields, the form is returned again * * @return string * @permissons right1 */ protected function actionSavePost() { $strXMLContent = ""; //validate needed fields if (!$this->validateForm()) { //Create form to reenter values $strTemplateID = $this->objTemplate->readTemplate("/module_postacomment/" . $this->getParam("comment_template"), "postacomment_form"); $arrForm = array(); $arrForm["formaction"] = class_link::getLinkPortalHref($this->getPagename(), "", "postComment", "", $this->getSystemid()); $arrForm["comment_name"] = $this->getParam("comment_name"); $arrForm["comment_subject"] = $this->getParam("comment_subject"); $arrForm["comment_message"] = $this->getParam("comment_message"); $arrForm["comment_template"] = $this->getParam("comment_template"); $arrForm["comment_systemid"] = $this->getParam("comment_systemid"); $arrForm["comment_page"] = $this->getParam("comment_page"); $arrForm["validation_errors"] = $this->strErrors; foreach ($arrForm as $strKey => $strValue) { if (uniStrpos($strKey, "comment_") !== false) { $arrForm[$strKey] = htmlspecialchars($strValue, ENT_QUOTES, "UTF-8", false); } } //texts $arrForm["postacomment_write_new"] = $this->getLang("postacomment_write_new"); $arrForm["form_name_label"] = $this->getLang("form_name_label"); $arrForm["form_subject_label"] = $this->getLang("form_subject_label"); $arrForm["form_message_label"] = $this->getLang("form_message_label"); $arrForm["form_captcha_label"] = $this->getLang("commons_captcha"); $arrForm["form_captcha_reload_label"] = $this->getLang("commons_captcha_reload"); $arrForm["form_submit_label"] = $this->getLang("form_submit_label"); $strXMLContent .= $this->fillTemplate($arrForm, $strTemplateID); } else { //save the post to the db //pageid or systemid to filter? $strSystemidfilter = $this->getParam("comment_systemid"); if (class_module_pages_page::getPageByName($this->getParam("comment_page")) !== null) { $strPagefilter = class_module_pages_page::getPageByName($this->getParam("comment_page"))->getSystemid(); } else { $strPagefilter = ""; } $objPost = new class_module_postacomment_post(); $objPost->setStrUsername($this->getParam("comment_name")); $objPost->setStrTitle($this->getParam("comment_subject")); $objPost->setStrComment($this->getParam("comment_message")); $objPost->setStrAssignedPage($strPagefilter); $objPost->setStrAssignedSystemid($strSystemidfilter); $objPost->setStrAssignedLanguage($this->getStrPortalLanguage()); $objPost->updateObjectToDb(); $this->flushPageFromPagesCache($this->getPagename()); $strMailtext = $this->getLang("new_comment_mail") . "\r\n\r\n" . $objPost->getStrComment() . "\r\n"; $strMailtext .= class_link::getLinkAdminHref("postacomment", "edit", "&systemid=" . $objPost->getSystemid(), false); $objMessageHandler = new class_module_messaging_messagehandler(); $arrGroups = array(); $allGroups = class_module_user_group::getObjectList(); foreach ($allGroups as $objOneGroup) { if (class_rights::getInstance()->checkPermissionForGroup($objOneGroup->getSystemid(), class_rights::$STR_RIGHT_EDIT, $this->getObjModule()->getSystemid())) { $arrGroups[] = $objOneGroup; } } $objMessageHandler->sendMessage($strMailtext, $arrGroups, new class_messageprovider_postacomment()); //reinit post -> encoded entities $objPost->initObject(); //load the post as a new post to add it at top of the list $arrOnePost = array(); $arrOnePost["postacomment_post_name"] = $objPost->getStrUsername(); $arrOnePost["postacomment_post_subject"] = $objPost->getStrTitle(); $arrOnePost["postacomment_post_message"] = $objPost->getStrComment(); $arrOnePost["postacomment_post_systemid"] = $objPost->getSystemid(); $arrOnePost["postacomment_post_date"] = timeToString($objPost->getIntDate(), true); $strTemplateID = $this->objTemplate->readTemplate("/module_postacomment/" . $this->getParam("comment_template"), "postacomment_post"); $strXMLContent .= $this->objTemplate->fillTemplate($arrOnePost, $strTemplateID); } class_response_object::getInstance()->setStrResponseType(class_http_responsetypes::STR_TYPE_JSON); return $strXMLContent; }
/** * Creates a form to edit a users data * * @return string */ private function editUserData() { $arrErrors = array(); $bitForm = true; //what to do? if ($this->getParam("submitUserForm") != "") { if ($this->getParam("password") != "") { if ($this->getParam("password") != $this->getParam("password2")) { $arrErrors[] = $this->getLang("passwordsUnequal"); } } $objValidator = new class_email_validator(); if (!$objValidator->validate($this->getParam("email"))) { $arrErrors[] = $this->getLang("invalidEmailadress"); } if (count($arrErrors) == 0) { $bitForm = false; } } if ($bitForm) { if ($this->arrElementData["portallogin_editmode"] == 1) { $strTemplateID = $this->objTemplate->readTemplate("/element_portallogin/" . $this->arrElementData["portallogin_template"], "portallogin_userdataform_complete"); } else { $strTemplateID = $this->objTemplate->readTemplate("/element_portallogin/" . $this->arrElementData["portallogin_template"], "portallogin_userdataform_minimal"); } $arrTemplate = array(); $objUser = new class_module_user_user($this->objSession->getUserID()); if ($objUser->getObjSourceUser()->isEditable() && $objUser->getStrSubsystem() == "kajona" && $objUser->getObjSourceUser() instanceof class_usersources_user_kajona) { $arrTemplate["username"] = $objUser->getStrUsername(); $arrTemplate["email"] = $objUser->getObjSourceUser()->getStrEmail(); $arrTemplate["forename"] = $objUser->getObjSourceUser()->getStrForename(); $arrTemplate["name"] = $objUser->getObjSourceUser()->getStrName(); $arrTemplate["street"] = $objUser->getObjSourceUser()->getStrStreet(); $arrTemplate["postal"] = $objUser->getObjSourceUser()->getStrPostal(); $arrTemplate["city"] = $objUser->getObjSourceUser()->getStrCity(); $arrTemplate["phone"] = $objUser->getObjSourceUser()->getStrTel(); $arrTemplate["mobile"] = $objUser->getObjSourceUser()->getStrMobile(); $arrTemplate["portallogin_elsystemid"] = $this->arrElementData["content_id"]; $objDate = new class_date($objUser->getObjSourceUser()->getLongDate()); $arrTemplate["date_day"] = $objDate->getIntDay(); $arrTemplate["date_month"] = $objDate->getIntMonth(); $arrTemplate["date_year"] = $objDate->getIntYear(); $arrTemplate["formaction"] = class_link::getLinkPortalHref($this->getPagename(), "", "portalEditProfile"); $arrTemplate["formErrors"] = ""; if (count($arrErrors) > 0) { foreach ($arrErrors as $strOneError) { $strErrTemplate = $this->objTemplate->readTemplate("/element_portallogin/" . $this->arrElementData["portallogin_template"], "errorRow"); $arrTemplate["formErrors"] .= "" . $this->fillTemplate(array("error" => $strOneError), $strErrTemplate); } } return $this->fillTemplate($arrTemplate, $strTemplateID); } else { return "Login provider not supported."; } } else { $objUser = new class_module_user_user($this->objSession->getUserID()); if ($objUser->getObjSourceUser() instanceof class_usersources_user_kajona) { $objUser->getObjSourceUser()->setStrEmail($this->getParam("email")); $objUser->getObjSourceUser()->setStrForename($this->getParam("forename")); $objUser->getObjSourceUser()->setStrName($this->getParam("name")); $objUser->getObjSourceUser()->setStrPass($this->getParam("password")); if ($this->arrElementData["portallogin_editmode"] == 1) { $objUser->getObjSourceUser()->setStrStreet($this->getParam("street")); $objUser->getObjSourceUser()->setStrPostal($this->getParam("postal")); $objUser->getObjSourceUser()->setStrCity($this->getParam("city")); $objUser->getObjSourceUser()->setStrTel($this->getParam("phone")); $objUser->getObjSourceUser()->setStrMobile($this->getParam("mobile")); $objDate = new class_date(); $objDate->setIntDay($this->getParam("date_day")); $objDate->setIntMonth($this->getParam("date_month")); $objDate->setIntYear($this->getParam("date_year")); $objUser->getObjSourceUser()->setLongDate($objDate->getLongTimestamp()); } $objUser->getObjSourceUser()->updateObjectToDb(); } $this->portalReload(class_link::getLinkPortalHref($this->getPagename())); } return ""; }
/** * Returns a list of available placeholders & elements on this page * * @return string * @permissions edit */ protected function actionList() { $strReturn = ""; class_module_languages_admin::enableLanguageSwitch(); $objPage = new class_module_pages_page($this->getSystemid()); //get infos about the page $arrToolbarEntries = array(); $arrToolbarEntries[0] = "<a href=\"" . class_link::getLinkAdminHref("pages", "editPage", "&systemid=" . $this->getSystemid()) . "\">" . class_adminskin_helper::getAdminImage("icon_edit") . $this->getLang("contentToolbar_pageproperties") . "</a>"; $arrToolbarEntries[1] = "<a href=\"" . class_link::getLinkAdminHref("pages_content", "list", "&systemid=" . $this->getSystemid()) . "\">" . class_adminskin_helper::getAdminImage("icon_page") . $this->getLang("contentToolbar_content") . "</a>"; $arrToolbarEntries[2] = "<a href=\"" . class_link::getLinkPortalHref($objPage->getStrName(), "", "", "&preview=1", "", $this->getLanguageToWorkOn()) . "\" target=\"_blank\">" . class_adminskin_helper::getAdminImage("icon_lens") . $this->getLang("contentToolbar_preview") . "</a>"; if ($objPage->getIntType() != class_module_pages_page::$INT_TYPE_ALIAS) { $strReturn .= $this->objToolkit->getContentToolbar($arrToolbarEntries, 1); } $arrInfoRows = array(array($this->getLang("template"), $objPage->getStrTemplate()), array($this->getLang("lastuserTitle"), $objPage->getLastEditUser()), array($this->getLang("lasteditTitle"), timeToString($objPage->getIntLmTime()))); $strReturn .= $this->objToolkit->dataTable(null, $arrInfoRows); $strReturn .= $this->objToolkit->divider(); //try to load template, otherwise abort $strTemplateID = null; try { $strTemplateID = $this->objTemplate->readTemplate("/module_pages/" . $objPage->getStrTemplate(), "", false, true); } catch (class_exception $objException) { $strReturn .= $this->getLang("templateNotLoaded") . "<br />"; } //Load elements on template, master-page special case! if ($objPage->getStrName() == "master") { $arrElementsOnTemplate = $this->objTemplate->getElements($strTemplateID, 1); } else { $arrElementsOnTemplate = $this->objTemplate->getElements($strTemplateID, 0); } //Language-dependant loading of elements, if installed $arrElementsOnPage = class_module_pages_pageelement::getElementsOnPage($this->getSystemid(), false, $this->getLanguageToWorkOn()); //save a copy of the array to be able to check against all values later on $arrElementsOnPageCopy = $arrElementsOnPage; //Loading all Elements installed on the system ("RAW"-Elements) $arrElementsInSystem = class_module_pages_element::getObjectList(); //So, loop through the placeholders and check, if there's any element already belonging to this one $intI = 0; if (is_array($arrElementsOnTemplate) && count($arrElementsOnTemplate) > 0) { //Iterate over every single placeholder provided by the template foreach ($arrElementsOnTemplate as $arrOneElementOnTemplate) { $strOutputAtPlaceholder = ""; //Do we have one or more elements already in db at this placeholder? $bitHit = false; //Iterate over every single element-type provided by the placeholder foreach ($arrElementsOnPage as $intArrElementsOnPageKey => $objOneElementOnPage) { //Check, if its the same placeholder $bitSamePlaceholder = false; if ($arrOneElementOnTemplate["placeholder"] == $objOneElementOnPage->getStrPlaceholder()) { $bitSamePlaceholder = true; } if ($bitSamePlaceholder) { $bitHit = true; //try to unlock the record $objOneElementOnPage->getLockManager()->unlockRecord(); $strActions = $this->getActionIcons($objOneElementOnPage); //Put all Output together $strOutputAtPlaceholder .= $this->objToolkit->simpleAdminList($objOneElementOnPage, $strActions, $intI++); //remove the element from the array unset($arrElementsOnPage[$intArrElementsOnPageKey]); } } //Check, if one of the elements in the placeholder is allowed to be used multiple times foreach ($arrOneElementOnTemplate["elementlist"] as $arrSingleElementOnTemplateplaceholder) { /** @var class_module_pages_element $objOneElementInSystem */ foreach ($arrElementsInSystem as $objOneElementInSystem) { if ($objOneElementInSystem->getStrName() == $arrSingleElementOnTemplateplaceholder["element"]) { if ($objOneElementInSystem->getIntRepeat() == 1 || $bitHit === false) { //So, the Row for a new element: element is repeatable or not yet created $strActions = $this->objToolkit->listButton(class_link::getLinkAdmin("pages_content", "new", "&placeholder=" . $arrOneElementOnTemplate["placeholder"] . "&element=" . $arrSingleElementOnTemplateplaceholder["element"] . "&systemid=" . $this->getSystemid(), "", $this->getLang("element_anlegen"), "icon_new")); $strOutputAtPlaceholder .= $this->objToolkit->genericAdminList("", $objOneElementInSystem->getStrDisplayName(), "", $strActions, $intI++); } else { //element not repeatable. //Is there already one element installed? if not, then it IS allowed to create a new one $bitOneInstalled = false; foreach ($arrElementsOnPageCopy as $objOneElementToCheck) { if ($arrOneElementOnTemplate["placeholder"] == $objOneElementToCheck->getStrPlaceholder() && $arrSingleElementOnTemplateplaceholder["element"] == $objOneElementToCheck->getStrElement()) { $bitOneInstalled = true; } } if (!$bitOneInstalled) { //So, the Row for a new element $strActions = $this->objToolkit->listButton(class_link::getLinkAdmin("pages_content", "new", "&placeholder=" . $arrOneElementOnTemplate["placeholder"] . "&element=" . $arrSingleElementOnTemplateplaceholder["element"] . "&systemid=" . $this->getSystemid(), "", $this->getLang("element_anlegen"), "icon_new")); $strOutputAtPlaceholder .= $this->objToolkit->genericAdminList("", $objOneElementInSystem->getStrDisplayName(), "", $strActions, $intI++); } } } } } if ((int) uniStrlen($strOutputAtPlaceholder) > 0) { $arrSinglePlaceholder = explode("_", $arrOneElementOnTemplate["placeholder"]); if (count($arrSinglePlaceholder) == 2) { $strOutputAtPlaceholder .= $this->objToolkit->formHeadline($arrSinglePlaceholder[0]); } $strListId = generateSystemid(); $strReturn .= $this->objToolkit->dragableListHeader($strListId, true); $strReturn .= $strOutputAtPlaceholder; $strReturn .= $this->objToolkit->dragableListFooter($strListId); } } } else { $strReturn .= $this->getLang("element_liste_leer"); } //if there are any page-elements remaining, print a warning and print the elements row if (count($arrElementsOnPage) > 0) { $strReturn .= $this->objToolkit->divider(); $strReturn .= $this->objToolkit->warningBox($this->getLang("warning_elementsremaining")); $strReturn .= $this->objToolkit->listHeader(); //minimized actions now, plz. this ain't being a real element anymore! foreach ($arrElementsOnPage as $objOneElement) { $strActions = ""; $strActions .= $this->objToolkit->listDeleteButton($objOneElement->getStrDisplayName(), $this->getLang("element_loeschen_frage"), class_link::getLinkAdminHref("pages_content", "deleteElementFinal", "&systemid=" . $objOneElement->getSystemid() . ($this->getParam("pe") == "" ? "" : "&peClose=" . $this->getParam("pe")))); //Put all Output together $strReturn .= $this->objToolkit->genericAdminList("", $objOneElement->getStrDisplayName() . $this->getLang("placeholder") . $objOneElement->getStrPlaceholder(), "", $strActions, $intI++); } $strReturn .= $this->objToolkit->listFooter(); } $strReturn .= $this->objToolkit->getTableOfContents("h2"); return $strReturn; }
/** * Renders a single element of the file-strip * @param class_module_mediamanager_file $objCurFile * @return string */ private function renderFileStripEntry(class_module_mediamanager_file $objCurFile) { $arrTemplate = array("file_detail_href" => class_link::getLinkPortalHref($this->getPagename(), "", "fileDetails", "", $objCurFile->getSystemid(), $this->getStrPortalLanguage(), $objCurFile->getStrName()), "file_name" => $objCurFile->getStrName(), "file_systemid" => $objCurFile->getStrSystemid(), "file_filename" => $objCurFile->getStrFilename(), "file_elementid" => $this->arrElementData["content_id"]); $strStripTemplate = $this->objTemplate->readTemplate("/module_mediamanager/" . $this->arrElementData["repo_template"], "filedetail_strip"); return $this->objTemplate->fillTemplate($arrTemplate, $strStripTemplate); }
/** * Returns a single view of a single voting. * The mode is choosen from the element-config. * * @return string * @permissions view */ public function actionList() { $strReturn = ""; //load the associated voting $objVoting = new class_module_votings_voting($this->arrElementData["char1"]); //view-permissions given? if ($objVoting->rightView()) { $strVotingContent = ""; if ($this->arrElementData["int1"] == 0) { //voting mode //permissions sufficient? if ($objVoting->rightRight1()) { //check the start n end dates $objDateStart = $objVoting->getObjStartDate(); $objDateEnd = $objVoting->getObjEndDate(); $bitDatesAllow = true; if ($objDateStart != null && $objDateStart->getLongTimestamp() > class_date::getCurrentTimestamp()) { $bitDatesAllow = false; } if ($objDateEnd != null && $objDateEnd->getLongTimestamp() < class_date::getCurrentTimestamp()) { $bitDatesAllow = false; } //already voted before? if (in_array($objVoting->getSystemid(), $this->arrCookieValues)) { $strVotingContent = $this->getLang("error_voted"); } else { if (!$bitDatesAllow) { $strVotingContent = $this->getLang("error_dates"); } else { $strAnswers = ""; $strAnswerTemplateID = $strListTemplateID = $this->objTemplate->readTemplate("/module_votings/" . $this->arrElementData["char2"], "voting_voting_option"); //load the list of answers /** @var class_module_votings_answer $objOneAnswer */ foreach (class_module_votings_answer::getObjectList($objVoting->getSystemid()) as $objOneAnswer) { if ($objOneAnswer->getIntRecordStatus() == 0) { continue; } $arrTemplate = array(); $arrTemplate["voting_systemid"] = $objVoting->getSystemid(); $arrTemplate["answer_systemid"] = $objOneAnswer->getSystemid(); $arrTemplate["answer_text"] = $objOneAnswer->getStrText(); $strAnswers .= $this->fillTemplate($arrTemplate, $strAnswerTemplateID); } //create the wrapper $strFormTemplateID = $strListTemplateID = $this->objTemplate->readTemplate("/module_votings/" . $this->arrElementData["char2"], "voting_voting"); $arrTemplate = array(); $arrTemplate["voting_answers"] = $strAnswers; $arrTemplate["voting_systemid"] = $objVoting->getSystemid(); $arrTemplate["voting_action"] = class_link::getLinkPortalHref($this->getPagename(), "", "submitVoting"); $strVotingContent .= $this->fillTemplate($arrTemplate, $strFormTemplateID); } } } else { $strVotingContent = $this->getLang("commons_error_permissions"); } } else { if ($this->arrElementData["int1"] == 1) { //result mode $strAnswers = ""; $intTotalVotes = 0; $strAnswerTemplateID = $this->objTemplate->readTemplate("/module_votings/" . $this->arrElementData["char2"], "voting_result_answer"); //first run to sum up /** @var class_module_votings_answer $objOneAnswer */ foreach (class_module_votings_answer::getObjectList($objVoting->getSystemid()) as $objOneAnswer) { if ($objOneAnswer->getIntRecordStatus() == 0) { continue; } $intTotalVotes += $objOneAnswer->getIntHits(); } /** @var class_module_votings_answer $objOneAnswer */ foreach (class_module_votings_answer::getObjectList($objVoting->getSystemid()) as $objOneAnswer) { if ($objOneAnswer->getIntRecordStatus() == 0) { continue; } $arrTemplate = array(); $arrTemplate["answer_text"] = $objOneAnswer->getStrText(); $arrTemplate["answer_hits"] = $objOneAnswer->getIntHits(); $arrTemplate["answer_systemid"] = $objOneAnswer->getSystemid(); $arrTemplate["answer_percent"] = "0"; if ($objOneAnswer->getIntHits() > 0) { $arrTemplate["answer_percent"] = (int) (100 / ($intTotalVotes / $objOneAnswer->getIntHits())); } $strAnswers .= $this->fillTemplate($arrTemplate, $strAnswerTemplateID); } $strResultTemplateID = $this->objTemplate->readTemplate("/module_votings/" . $this->arrElementData["char2"], "voting_result"); $arrTemplate = array(); $arrTemplate["voting_answers"] = $strAnswers; $arrTemplate["voting_hits"] = $intTotalVotes; $strVotingContent .= $this->fillTemplate($arrTemplate, $strResultTemplateID); } } $strListTemplateID = $this->objTemplate->readTemplate("/module_votings/" . $this->arrElementData["char2"], "voting_wrapper"); $arrTemplate = array(); $arrTemplate["voting_systemid"] = $objVoting->getSystemid(); $arrTemplate["voting_title"] = $objVoting->getStrTitle(); $arrTemplate["voting_content"] = $strVotingContent; $strReturn .= $this->fillTemplate($arrTemplate, $strListTemplateID); } else { $strReturn = $this->getLang("commons_error_permissions"); } return $strReturn; }
/** * Returns a list of comments. * * @return string * @permissions view */ protected function actionList() { $strReturn = ""; $strPosts = ""; $strForm = ""; $strNewButton = ""; //pageid or systemid to filter? $strSystemidfilter = ""; $strPagefilter = $this->strPagefilter; if ($this->getSystemid() != "") { $strSystemidfilter = $this->getSystemid(); } if ($strPagefilter === null && class_module_pages_page::getPageByName($this->getPagename()) !== null) { $strPagefilter = class_module_pages_page::getPageByName($this->getPagename())->getSystemid(); } $intNrOfPosts = isset($this->arrElementData["int1"]) ? $this->arrElementData["int1"] : 0; //Load all posts $objArraySectionIterator = new class_array_section_iterator(class_module_postacomment_post::getNumberOfPostsAvailable(true, $strPagefilter, $strSystemidfilter, $this->getStrPortalLanguage())); $objArraySectionIterator->setIntElementsPerPage($intNrOfPosts); $objArraySectionIterator->setPageNumber((int) ($this->getParam("pvPAC") != "" ? $this->getParam("pvPAC") : 1)); $objArraySectionIterator->setArraySection(class_module_postacomment_post::loadPostList(true, $strPagefilter, $strSystemidfilter, $this->getStrPortalLanguage(), $objArraySectionIterator->calculateStartPos(), $objArraySectionIterator->calculateEndPos())); //params to add? $strAdd = ""; if ($this->getParam("action") != "") { $strAdd .= "&action=" . $this->getParam("action"); } if ($this->getParam("systemid") != "") { $strAdd .= "&systemid=" . $this->getParam("systemid"); } if ($this->getParam("pv") != "") { $strAdd .= "&pv=" . $this->getParam("pv"); } $arrComments = $this->objToolkit->simplePager($objArraySectionIterator, $this->getLang("commons_next"), $this->getLang("commons_back"), "", $this->getPagename(), $strAdd, "pvPAC"); $strTemplateID = $this->objTemplate->readTemplate("/module_postacomment/" . $this->arrElementData["char1"], "postacomment_post"); if (!$objArraySectionIterator->valid()) { $strPosts .= $this->getLang("postacomment_empty"); } //Check rights /** @var class_module_postacomment_post $objOnePost */ foreach ($objArraySectionIterator as $objOnePost) { if ($objOnePost->rightView()) { $strOnePost = ""; $arrOnePost = array(); $arrOnePost["postacomment_post_name"] = $objOnePost->getStrUsername(); $arrOnePost["postacomment_post_subject"] = $objOnePost->getStrTitle(); $arrOnePost["postacomment_post_message"] = $objOnePost->getStrComment(); $arrOnePost["postacomment_post_systemid"] = $objOnePost->getSystemid(); $arrOnePost["postacomment_post_date"] = timeToString($objOnePost->getIntDate(), true); //ratings available? if ($objOnePost->getFloatRating() !== null) { /** @var $objRating class_module_rating_portal */ $objRating = class_module_system_module::getModuleByName("rating")->getPortalInstanceOfConcreteModule(); $arrOnePost["postacomment_post_rating"] = $objRating->buildRatingBar($objOnePost->getFloatRating(), $objOnePost->getIntRatingHits(), $objOnePost->getSystemid(), $objOnePost->isRateableByUser(), $objOnePost->rightRight2()); } $strOnePost .= $this->objTemplate->fillTemplate($arrOnePost, $strTemplateID, false); //Add pe code $arrPeConfig = array("pe_module" => "postacomment", "pe_action_edit" => "edit", "pe_action_edit_params" => "&systemid=" . $objOnePost->getSystemid(), "pe_action_new" => "", "pe_action_new_params" => "", "pe_action_delete" => "delete", "pe_action_delete_params" => "&systemid=" . $objOnePost->getSystemid()); $strPosts .= class_element_portal::addPortalEditorCode($strOnePost, $objOnePost->getSystemid(), $arrPeConfig); } } //Create form if ($this->getObjModule()->rightRight1()) { $strTemplateID = $this->objTemplate->readTemplate("/module_postacomment/" . $this->arrElementData["char1"], "postacomment_form"); $arrForm = array(); if ($this->getParam("comment_name") == "" && $this->objSession->isLoggedin()) { $this->setParam("comment_name", $this->objSession->getUsername()); } $arrForm["formaction"] = class_link::getLinkPortalHref($this->getPagename(), "", "postComment", "", $this->getSystemid()); $arrForm["comment_name"] = $this->getParam("comment_name"); $arrForm["comment_subject"] = $this->getParam("comment_subject"); $arrForm["comment_message"] = $this->getParam("comment_message"); $arrForm["comment_template"] = $this->arrElementData["char1"]; $arrForm["comment_systemid"] = $this->getSystemid(); $arrForm["comment_page"] = $this->getPagename(); $arrForm["validation_errors"] = $this->strErrors; foreach ($arrForm as $strKey => $strValue) { if (uniStrpos($strKey, "comment_") !== false) { $arrForm[$strKey] = htmlspecialchars($strValue, ENT_QUOTES, "UTF-8", false); } } $strForm .= $this->objTemplate->fillTemplate($arrForm, $strTemplateID, false); //button to show the form $strTemplateNewButtonID = $this->objTemplate->readTemplate("/module_postacomment/" . $this->arrElementData["char1"], "postacomment_new_button"); $strNewButton = $this->objTemplate->fillTemplate(array("comment_systemid" => $this->getSystemid()), $strTemplateNewButtonID, false); } //add sourrounding list template $strTemplateID = $this->objTemplate->readTemplate("/module_postacomment/" . $this->arrElementData["char1"], "postacomment_list"); //link to the post-form & pageview links $arrTemplate = array(); $arrTemplate["postacomment_forward"] = $arrComments["strForward"]; $arrTemplate["postacomment_pages"] = $arrComments["strPages"]; $arrTemplate["postacomment_back"] = $arrComments["strBack"]; $arrTemplate["postacomment_form"] = $strForm; $arrTemplate["postacomment_new_button"] = $strNewButton; $arrTemplate["postacomment_systemid"] = $this->getSystemid(); $arrTemplate["postacomment_list"] = $strPosts; $strReturn .= $this->fillTemplate($arrTemplate, $strTemplateID); return $strReturn; }
/** * Invokes the element to do the work * If enabled, passes to addPortalEditorCode(). This adds the element-based pe-code. * If modules want to create pe code, they have to call the static method addPortalEditorCode * on their own! * * @return string */ public function getElementOutput() { $strReturn = ""; //load the data from the database $this->arrElementData = array_merge($this->getElementContent($this->objElementData->getSystemid()), $this->arrElementData); //wrap all in a try catch block try { if (class_module_system_setting::getConfigValue("_pages_portaleditor_") == "true" && $this->objSession->isAdmin() && class_carrier::getInstance()->getObjSession()->getSession("pe_disable") != "true") { //Check needed rights $objElement = class_objectfactory::getInstance()->getObject($this->getSystemid()); if ($objElement->rightEdit()) { $arrConfig = array(); $arrConfig["pe_module"] = ""; $arrConfig["pe_action"] = ""; if ($this->getArrModule("pe_module") != "") { $arrConfig["pe_module"] = $this->getArrModule("pe_module"); } if ($this->getArrModule("pe_action") != "") { $arrConfig["pe_action"] = $this->getArrModule("pe_action"); } $strReturn = $this->addPortalEditorCode($this->loadData(), $this->getSystemid(), $arrConfig, $this->arrElementData["page_element_ph_element"]); } else { $strReturn = $this->loadData(); $strReturn = preg_replace('/data-kajona-editable=\\"([a-zA-Z0-9#_]*)\\"/i', "", $strReturn); } } else { $strReturn = $this->loadData(); //strip the data-editable values - no use case for regular page views $strReturn = preg_replace('/data-kajona-editable=\\"([a-zA-Z0-9#_]*)\\"/i', "", $strReturn); } } catch (class_exception $objEx) { //An error occurred during content generation. redirect to error page $objEx->processException(); //if available, show the error-page. on debugging-environments, the exception processing already die()d the process. if ($this->getPagename() != class_module_system_setting::getConfigValue("_pages_errorpage_")) { $this->portalReload(class_link::getLinkPortalHref(class_module_system_setting::getConfigValue("_pages_errorpage_"))); } $strReturn = $objEx->getMessage(); } //add an anchor to jump to, but exclude navigation-elements $strReturn = $this->getAnchorTag() . $strReturn; //apply element-based scriptlets $objScriptlets = new class_scriptlet_helper(); $strReturn = $objScriptlets->processString($strReturn, interface_scriptlet::BIT_CONTEXT_PORTAL_ELEMENT); return $strReturn; }
/** * Creates the detailed-view of news * * @return string */ protected function actionNewsDetail() { $strReturn = ""; /** @var $objNews class_module_news_news */ $objNews = class_objectfactory::getInstance()->getObject($this->getSystemid()); if ($objNews != null && $objNews instanceof class_module_news_news && $objNews->rightView() && $objNews->getIntRecordStatus() == "1") { //see if we should generate a redirect instead if ($objNews->getIntRedirectEnabled() == "1" && $objNews->getStrRedirectPage() != "") { $this->portalReload(class_link::getLinkPortalHref($objNews->getStrRedirectPage())); return "<script type='text/javascript'>window.location.replace('" . class_link::getLinkPortalHref($objNews->getStrRedirectPage()) . "');</script>"; } //Load record $objMapper = new class_template_mapper($objNews); $objMapper->addPlaceholder("news_back_link", "<a href=\"javascript:history.back();\">" . $this->getLang("news_zurueck") . "</a>"); $objMapper->addPlaceholder("news_start_date", dateToString($objNews->getObjStartDate(), false)); $objMapper->addPlaceholder("news_id", $objNews->getSystemid()); $objMapper->addPlaceholder("news_title", $objNews->getStrTitle()); $objMapper->addPlaceholder("news_intro", $objNews->getStrIntro()); $objMapper->addPlaceholder("news_text", $objNews->getStrText()); //postacomment $arrPAC = $this->loadPostacomments($objNews->getSystemid(), $objNews->getStrImage() != "" ? "news_detail_image" : "news_detail"); if ($arrPAC != null) { $objMapper->addPlaceholder("news_nrofcomments", $arrPAC["nrOfComments"]); $objMapper->addPlaceholder("news_commentlist", $arrPAC["commentList"]); } //ratings if ($objNews->getFloatRating() !== null) { /** @var $objRating class_module_rating_portal */ $objRating = class_module_system_module::getModuleByName("rating")->getPortalInstanceOfConcreteModule(); $objMapper->addPlaceholder("news_rating", $objRating->buildRatingBar($objNews->getFloatRating(), $objNews->getIntRatingHits(), $objNews->getSystemid(), $objNews->isRateableByUser(), $objNews->rightRight3())); } //categories $objMapper->addPlaceholder("news_categories", $this->renderCategoryTitles($objNews)); //load template section with or without image? if ($objNews->getStrImage() != "") { $objMapper->addPlaceholder("news_image", urlencode($objNews->getStrImage())); $strReturn .= $objMapper->writeToTemplate("/module_news/" . $this->arrElementData["news_template"], "news_detail_image"); } else { $strReturn .= $objMapper->writeToTemplate("/module_news/" . $this->arrElementData["news_template"], "news_detail"); } //Add pe code $arrPeConfig = array("pe_module" => "news", "pe_action_edit" => "editNews", "pe_action_edit_params" => "&systemid=" . $this->getSystemid()); $strReturn = class_element_portal::addPortalEditorCode($strReturn, $objNews->getSystemid(), $arrPeConfig); //and count the hit $objNews->increaseHits(); //set the name of the current news to the page-title via class_pages class_module_pages_portal::registerAdditionalTitle($objNews->getStrTitle()); } else { $strReturn = $this->getLang("commons_error_permissions"); } return $strReturn; }
/** * Handles the loading of a page, more in a functional than in an oop style * * @throws class_exception * @return string the generated page * @permissions view */ protected function actionGeneratePage() { //Determine the pagename $objPageData = $this->getPageData(); //react on portaleditor commands //pe to display, or pe to disable? if ($this->getParam("pe") == "false") { $this->objSession->setSession("pe_disable", "true"); } if ($this->getParam("pe") == "true") { $this->objSession->setSession("pe_disable", "false"); } //if using the pe, the cache shouldn't be used, otherwise strange things might happen. //the system could frighten your cat or eat up all your cheese with marshmallows... //get the current state of the portal editor $bitPeRequested = false; if (class_module_system_setting::getConfigValue("_pages_portaleditor_") == "true" && $this->objSession->getSession("pe_disable") != "true" && $this->objSession->isAdmin() && $objPageData->rightEdit()) { $bitPeRequested = true; } //If we reached up till here, we can begin loading the elements to fill if ($bitPeRequested) { $arrElementsOnPage = class_module_pages_pageelement::getElementsOnPage($objPageData->getSystemid(), false, $this->getStrPortalLanguage()); } else { $arrElementsOnPage = class_module_pages_pageelement::getElementsOnPage($objPageData->getSystemid(), true, $this->getStrPortalLanguage()); } //If there's a master-page, load elements on that, too $objMasterData = class_module_pages_page::getPageByName("master"); $bitEditPermissionOnMasterPage = false; if ($objMasterData != null) { if ($bitPeRequested) { $arrElementsOnMaster = class_module_pages_pageelement::getElementsOnPage($objMasterData->getSystemid(), false, $this->getStrPortalLanguage()); } else { $arrElementsOnMaster = class_module_pages_pageelement::getElementsOnPage($objMasterData->getSystemid(), true, $this->getStrPortalLanguage()); } //and merge them $arrElementsOnPage = array_merge($arrElementsOnPage, $arrElementsOnMaster); if ($objMasterData->rightEdit()) { $bitEditPermissionOnMasterPage = true; } } //Load the template from the filesystem to get the placeholders $strTemplateID = $this->objTemplate->readTemplate("/module_pages/" . $objPageData->getStrTemplate(), "", false, true); //bit include the masters-elements!! $arrRawPlaceholders = array_merge($this->objTemplate->getElements($strTemplateID, 0), $this->objTemplate->getElements($strTemplateID, 1)); $arrPlaceholders = array(); //and retransform foreach ($arrRawPlaceholders as $arrOneRawPlaceholder) { $arrPlaceholders[] = $arrOneRawPlaceholder["placeholder"]; } //Initialize the caches internal cache :) class_cache::fillInternalCache("class_element_portal", $this->getPagename(), null, $this->getStrPortalLanguage()); //try to load the additional title from cache $strAdditionalTitleFromCache = ""; $intMaxCacheDuration = 0; $objCachedTitle = class_cache::getCachedEntry(__CLASS__, $this->getPagename(), $this->generateHash2Sum(), $this->getStrPortalLanguage()); if ($objCachedTitle != null) { $strAdditionalTitleFromCache = $objCachedTitle->getStrContent(); self::$strAdditionalTitle = $strAdditionalTitleFromCache; } //copy for the portaleditor $arrPlaceholdersFilled = array(); //Iterate over all elements and pass control to them //Get back the filled element //Build the array to fill the template $arrTemplate = array(); /** @var class_module_pages_pageelement $objOneElementOnPage */ foreach ($arrElementsOnPage as $objOneElementOnPage) { //element really available on the template? if (!in_array($objOneElementOnPage->getStrPlaceholder(), $arrPlaceholders)) { //next one, plz continue; } else { //create a protocol of placeholders filled //remove from pe-additional-array, pe code is injected by element directly $arrPlaceholdersFilled[] = array("placeholder" => $objOneElementOnPage->getStrPlaceholder(), "name" => $objOneElementOnPage->getStrName(), "element" => $objOneElementOnPage->getStrElement(), "repeatable" => $objOneElementOnPage->getIntRepeat()); } //Build the class-name for the object /** @var class_element_portal $objElement */ $objElement = $objOneElementOnPage->getConcretePortalInstance(); //let the element do the work and earn the output if (!isset($arrTemplate[$objOneElementOnPage->getStrPlaceholder()])) { $arrTemplate[$objOneElementOnPage->getStrPlaceholder()] = ""; } //cache-handling. load element from cache. //if the element is re-generated, save it back to cache. if (class_module_system_setting::getConfigValue("_pages_cacheenabled_") == "true" && $this->getParam("preview") != "1" && $objPageData->getStrName() != class_module_system_setting::getConfigValue("_pages_errorpage_")) { $strElementOutput = ""; //if the portaleditor is disabled, do the regular cache lookups in storage. otherwise regenerate again and again :) if ($bitPeRequested) { $strElementOutput = $objElement->getElementOutput(); } else { //pe not to be taken into account --> full support of caching $strElementOutput = $objElement->getElementOutputFromCache(); if ($objOneElementOnPage->getIntCachetime() > $intMaxCacheDuration) { $intMaxCacheDuration = $objOneElementOnPage->getIntCachetime(); } if ($strElementOutput === false) { $strElementOutput = $objElement->getElementOutput(); $objElement->saveElementToCache($strElementOutput); } } } else { $strElementOutput = $objElement->getElementOutput(); } //if element is disabled & the pe is requested, wrap the content if ($bitPeRequested && $objOneElementOnPage->getIntRecordStatus() == 0) { $arrPeElement = array(); $arrPeElement["title"] = $this->getLang("pe_inactiveElement", "pages") . " (" . $objOneElementOnPage->getStrElement() . ")"; $strElementOutput = $this->objToolkit->getPeInactiveElement($arrPeElement); $strElementOutput = class_element_portal::addPortalEditorSetActiveCode($strElementOutput, $objElement->getSystemid(), array()); } $arrTemplate[$objOneElementOnPage->getStrPlaceholder()] .= $strElementOutput; } //pe-code to add new elements on unfilled placeholders --> only if pe is visible? if ($bitPeRequested) { //loop placeholders on template in order to remove already filled ones not being repeatable $arrRawPlaceholdersForPe = $arrRawPlaceholders; foreach ($arrPlaceholdersFilled as $arrOnePlaceholder) { foreach ($arrRawPlaceholdersForPe as &$arrOneRawPlaceholder) { if ($arrOneRawPlaceholder["placeholder"] == $arrOnePlaceholder["placeholder"]) { foreach ($arrOneRawPlaceholder["elementlist"] as $intElementKey => $arrOneRawElement) { if ($arrOnePlaceholder["element"] == $arrOneRawElement["element"]) { if (uniSubstr($arrOneRawElement["name"], 0, 5) == "master") { $arrOneRawPlaceholder["elementlist"][$intElementKey] = null; } else { if ($arrOnePlaceholder["repeatable"] == "0") { $arrOneRawPlaceholder["elementlist"][$intElementKey] = null; } } } } } } } //array is now set up. loop again to create new-buttons $arrPePlaceholdersDone = array(); $arrPeNewButtons = array(); foreach ($arrRawPlaceholdersForPe as $arrOneRawPlaceholderForPe) { $strPeNewPlaceholder = $arrOneRawPlaceholderForPe["placeholder"]; foreach ($arrOneRawPlaceholderForPe["elementlist"] as $arrOnePeNewElement) { if ($arrOnePeNewElement == null) { continue; } //check if the linked element exists $objPeNewElement = class_module_pages_element::getElement($arrOnePeNewElement["element"]); if ($objPeNewElement == null) { continue; } //placeholder processed before? $strArrayKey = $strPeNewPlaceholder . $objPeNewElement->getStrName(); if (in_array($strArrayKey, $arrPePlaceholdersDone)) { continue; } else { $arrPePlaceholdersDone[] = $strArrayKey; } //create and register the button to add a new element if (!isset($arrPeNewButtons[$strPeNewPlaceholder])) { $arrPeNewButtons[$strPeNewPlaceholder] = ""; } if (uniStripos($strArrayKey, "master") !== false) { $strLink = ""; if ($objMasterData !== null) { $strLink = class_element_portal::getPortaleditorNewCode($objMasterData->getSystemid(), $strPeNewPlaceholder, $objPeNewElement); } } else { $strLink = class_element_portal::getPortaleditorNewCode($objPageData->getSystemid(), $strPeNewPlaceholder, $objPeNewElement); } $arrPeNewButtons[$strPeNewPlaceholder] .= $strLink; } } //loop pe-new code in order to add the wrappers and assign the code to the matching placeholder foreach ($arrPeNewButtons as $strPlaceholderName => $strNewButtons) { if (!isset($arrTemplate[$strPlaceholderName])) { $arrTemplate[$strPlaceholderName] = ""; } if ($strNewButtons != "") { $strNewButtons = class_element_portal::getPortaleditorNewWrapperCode($strPlaceholderName, $strNewButtons); } $arrTemplate[$strPlaceholderName] .= $strNewButtons; } // add placeholder wrapping foreach ($arrTemplate as $strPlaceholder => $strContent) { $arrTemplate[$strPlaceholder] = class_carrier::getInstance()->getObjToolkit("portal")->getPePlaceholderWrapper($strPlaceholder, $strContent); } } //check if the additional title has to be saved to the cache if (self::$strAdditionalTitle != "" && self::$strAdditionalTitle != $strAdditionalTitleFromCache) { $objCacheEntry = class_cache::getCachedEntry(__CLASS__, $this->getPagename(), $this->generateHash2Sum(), $this->getStrPortalLanguage(), true); $objCacheEntry->setStrContent(self::$strAdditionalTitle); $objCacheEntry->setIntLeasetime(time() + $intMaxCacheDuration); $objCacheEntry->updateObjectToDb(); } $arrTemplate["description"] = $objPageData->getStrDesc(); $arrTemplate["keywords"] = $objPageData->getStrKeywords(); $arrTemplate["title"] = $objPageData->getStrBrowsername(); $arrTemplate["additionalTitle"] = self::$strAdditionalTitle; $arrTemplate["canonicalUrl"] = class_link::getLinkPortalHref($objPageData->getStrName(), "", $this->getParam("action"), "", $this->getParam("systemid")); //Include the $arrGlobal Elements $arrGlobal = array(); $strPath = class_resourceloader::getInstance()->getPathForFile("/portal/global_includes.php"); if ($strPath !== false) { include _realpath_ . $strPath; } $arrTemplate = array_merge($arrTemplate, $arrGlobal); //fill the template. the template was read before $strPageContent = $this->fillTemplate($arrTemplate, $strTemplateID); $strPageContent = $this->renderPortalEditorCode($objPageData, $bitEditPermissionOnMasterPage, $strPageContent); //insert the copyright headers. Due to our licence, you are NOT allowed to remove those lines. $strHeader = "<!--\n"; $strHeader .= "Website powered by Kajona Open Source Content Management Framework\n"; $strHeader .= "For more information about Kajona see http://www.kajona.de\n"; $strHeader .= "-->\n"; $intBodyPos = uniStripos($strPageContent, "</head>"); $intPosXml = uniStripos($strPageContent, "<?xml"); if ($intBodyPos !== false) { $intBodyPos += 0; $strPageContent = uniSubstr($strPageContent, 0, $intBodyPos) . $strHeader . uniSubstr($strPageContent, $intBodyPos); } else { if ($intPosXml !== false) { $intBodyPos = uniStripos($strPageContent, "?>"); $intBodyPos += 2; $strPageContent = uniSubstr($strPageContent, 0, $intBodyPos) . $strHeader . uniSubstr($strPageContent, $intBodyPos); } else { $strPageContent = $strHeader . $strPageContent; } } return $strPageContent; }
/** * Returns a list of folders in the pages-database * * @return String * @permissions view * @autoTestable */ protected function actionPagesFolderBrowser() { $strReturn = ""; $intCounter = 1; $this->setArrModuleEntry("template", "/folderview.tpl"); if ($this->getParam("CKEditorFuncNum") != "") { $strReturn .= "<script type=\"text/javascript\">window.opener.KAJONA.admin.folderview.selectCallbackCKEditorFuncNum = " . (int) $this->getParam("CKEditorFuncNum") . ";</script>"; } //param init $bitPages = $this->getParam("pages") != "" ? true : false; $bitPageAliases = $this->getParam("pagealiases") != "" ? true : false; $bitPageelements = $this->getParam("elements") == "false" ? false : true; $bitFolder = $this->getParam("folder") != "" ? true : false; $strSystemid = $this->getSystemid() != "" ? $this->getSystemid() : class_module_system_module::getModuleByName("pages")->getSystemid(); $strElement = $this->getParam("form_element") != "" ? $this->getParam("form_element") : "ordner_name"; $strPageid = $this->getParam("pageid") != "" ? $this->getParam("pageid") : "0"; $strLinkAddon = "" . ($bitPages ? "&pages=1" : "") . ($bitFolder ? "&folder=1" : "") . ($this->getParam("bit_link") != "" ? "&bit_link=1" : "") . (!$bitPageelements ? "&elements=false" : "") . ($bitPageAliases ? "&pagealiases=1" : ""); $arrFolder = class_module_pages_folder::getFolderList($strSystemid); $objFolder = new class_module_pages_folder($strSystemid); $strLevelUp = ""; if (validateSystemid($strSystemid) && $strSystemid != $this->getObjModule()->getSystemid()) { $strLevelUp = $objFolder->getPrevId(); } //but: when browsing pages the current level should be kept if ($strPageid != "0") { $strLevelUp = $strSystemid; } $strReturn .= $this->objToolkit->formHeader(""); $strAction = $this->objToolkit->listButton("<a href=\"#\" title=\"" . $this->getLang("select_page") . "\" rel=\"tooltip\" onclick=\"KAJONA.admin.folderview.selectCallback([['" . $strElement . "', '" . _indexpath_ . "?page='+\$('#quickselect').val()]]);\">" . class_adminskin_helper::getAdminImage("icon_accept") . "</a>"); $strReturn .= $this->objToolkit->formInputPageSelector("quickselect", $this->getLang("folderview_quickselect"), "", "", false, false, $strAction); $strReturn .= $this->objToolkit->formClose(false); $strReturn .= $this->objToolkit->listHeader(); //Folder to jump one level up if (!$bitPages || $strLevelUp != "" || $bitFolder) { $strAction = $this->objToolkit->listButton($strSystemid != "0" && $strLevelUp != "" || $strPageid != "0" ? class_link::getLinkAdmin($this->getArrModule("modul"), "pagesFolderBrowser", "&systemid=" . $strLevelUp . $strLinkAddon . "&form_element=" . $strElement . ($this->getParam("bit_link") != "" ? "&bit_link=1" : ""), $this->getLang("commons_one_level_up"), $this->getLang("commons_one_level_up"), "icon_folderActionLevelup") : " "); if ($strSystemid == $this->getObjModule()->getSystemid() && (!$bitPages || $bitFolder)) { $strAction .= $this->objToolkit->listButton("<a href=\"#\" title=\"" . $this->getLang("commons_accept") . "\" rel=\"tooltip\" onclick=\"KAJONA.admin.folderview.selectCallback([['" . $strElement . "_id', '" . $this->getObjModule()->getSystemid() . "'], ['" . $strElement . "', '']]);\">" . class_adminskin_helper::getAdminImage("icon_accept")); } $strReturn .= $this->objToolkit->genericAdminList(generateSystemid(), "..", getImageAdmin("icon_folderOpen"), $strAction, $intCounter++); } if (count($arrFolder) > 0 && $strPageid == "0") { foreach ($arrFolder as $objSingleFolder) { if ($bitPages && !$bitFolder) { $strAction = $this->objToolkit->listButton(class_link::getLinkAdmin($this->getArrModule("modul"), "pagesFolderBrowser", "&systemid=" . $objSingleFolder->getSystemid() . "&form_element=" . $strElement . $strLinkAddon, $this->getLang("pages_ordner_oeffnen"), $this->getLang("pages_ordner_oeffnen"), "icon_folderActionOpen")); $strReturn .= $this->objToolkit->simpleAdminList($objSingleFolder, $strAction, $intCounter++); } else { $strAction = $this->objToolkit->listButton(class_link::getLinkAdmin($this->getArrModule("modul"), "pagesFolderBrowser", "&systemid=" . $objSingleFolder->getSystemid() . "&form_element=" . $strElement . $strLinkAddon, $this->getLang("pages_ordner_oeffnen"), $this->getLang("pages_ordner_oeffnen"), "icon_folderActionOpen")); $strAction .= $this->objToolkit->listButton("<a href=\"#\" title=\"" . $this->getLang("commons_accept") . "\" rel=\"tooltip\" onclick=\"KAJONA.admin.folderview.selectCallback([['" . $strElement . "_id', '" . $objSingleFolder->getSystemid() . "'], ['" . $strElement . "', '" . $objSingleFolder->getStrName() . "']]); \">" . class_adminskin_helper::getAdminImage("icon_accept")); $strReturn .= $this->objToolkit->simpleAdminList($objSingleFolder, $strAction, $intCounter++); } } } $strReturn .= $this->objToolkit->listFooter(); //Pages could be sent too if ($bitPages && $strPageid == "0") { $arrPages = class_module_pages_folder::getPagesInFolder($strSystemid); if (count($arrPages) > 0) { $strReturn .= $this->objToolkit->listHeader(); /** @var $objSinglePage class_module_pages_page */ foreach ($arrPages as $objSinglePage) { $arrSinglePage = array(); //Should we generate a link ? if ($this->getParam("bit_link") != "") { $arrSinglePage["name2"] = class_link::getLinkPortalHref($objSinglePage->getStrName(), "", "", "", "", $this->getLanguageToWorkOn()); } else { $arrSinglePage["name2"] = $objSinglePage->getStrName(); } if ($objSinglePage->getIntType() == class_module_pages_page::$INT_TYPE_ALIAS) { if (count(class_module_pages_folder::getPagesInFolder($objSinglePage->getSystemid())) == 0) { $strAction = getImageAdmin("icon_treeBranchOpenDisabled"); } else { $strAction = $this->objToolkit->listButton(class_link::getLinkAdmin($this->getArrModule("modul"), "pagesFolderBrowser", "&systemid=" . $objSinglePage->getSystemid() . "&form_element=" . $strElement . $strLinkAddon, $this->getLang("page_sublist"), $this->getLang("page_sublist"), "icon_treeBranchOpen")); } if ($bitPageAliases) { $strAction .= $this->objToolkit->listButton("<a href=\"#\" title=\"" . $this->getLang("select_page") . "\" rel=\"tooltip\" onclick=\"KAJONA.admin.folderview.selectCallback([['" . $strElement . "_id', '" . $objSinglePage->getSystemid() . "'],['" . $strElement . "', '" . $arrSinglePage["name2"] . "']]);\">" . class_adminskin_helper::getAdminImage("icon_accept") . "</a>"); } $strReturn .= $this->objToolkit->simpleAdminList($objSinglePage, $strAction, $intCounter++); } else { if (count(class_module_pages_folder::getPagesInFolder($objSinglePage->getSystemid())) == 0) { $strAction = getImageAdmin("icon_treeBranchOpenDisabled"); } else { $strAction = $this->objToolkit->listButton(class_link::getLinkAdmin($this->getArrModule("modul"), "pagesFolderBrowser", "&systemid=" . $objSinglePage->getSystemid() . "&form_element=" . $strElement . $strLinkAddon, $this->getLang("page_sublist"), $this->getLang("page_sublist"), "icon_treeBranchOpen")); } if ($bitPageelements) { $strAction .= $this->objToolkit->listButton(class_link::getLinkAdmin($this->getArrModule("modul"), "pagesFolderBrowser", "&systemid=" . $strSystemid . "&form_element=" . $strElement . "&pageid=" . $objSinglePage->getSystemid() . ($this->getParam("bit_link") != "" ? "&bit_link=1" : "") . ($bitPages ? "&pages=1" : "") . ($bitPageAliases ? "&pagealiases=1" : ""), $this->getLang("seite_oeffnen"), $this->getLang("seite_oeffnen"), "icon_folderActionOpen")); } $strAction .= $this->objToolkit->listButton("<a href=\"#\" title=\"" . $this->getLang("select_page") . "\" rel=\"tooltip\" onclick=\"KAJONA.admin.folderview.selectCallback([['" . $strElement . "_id', '" . $objSinglePage->getSystemid() . "'],['" . $strElement . "', '" . $arrSinglePage["name2"] . "']]);\">" . class_adminskin_helper::getAdminImage("icon_accept") . "</a>"); $strReturn .= $this->objToolkit->simpleAdminList($objSinglePage, $strAction, $intCounter++); } } $strReturn .= $this->objToolkit->listFooter(); } } //Load the list of pagelements available on the page if ($strPageid != "0") { $strReturn .= $this->objToolkit->divider(); $arrPageelements = class_module_pages_pageelement::getElementsOnPage($strPageid, true, $this->getLanguageToWorkOn()); $objPage = new class_module_pages_page($strPageid); if (count($arrPageelements) > 0) { $strReturn .= $this->objToolkit->listHeader(); /** @var class_module_pages_pageelement $objOnePageelement */ foreach ($arrPageelements as $objOnePageelement) { $arrSinglePage = array(); //Should we generate a link ? if ($this->getParam("bit_link") != "") { $arrSinglePage["name2"] = class_link::getLinkPortalHref($objPage->getStrName(), "", "", "", "", $this->getLanguageToWorkOn()) . "#" . $objOnePageelement->getSystemid(); } else { $arrSinglePage["name2"] = $objPage->getStrName() . "#" . $objOnePageelement->getSystemid(); } $strAction = $this->objToolkit->listButton("<a href=\"#\" title=\"" . $this->getLang("seite_uebernehmen") . "\" rel=\"tooltip\" onclick=\"KAJONA.admin.folderview.selectCallback([['" . $strElement . "', '" . $arrSinglePage["name2"] . "']]);\">" . class_adminskin_helper::getAdminImage("icon_accept") . "</a>"); $strReturn .= $this->objToolkit->simpleAdminList($objOnePageelement, $strAction, $intCounter++); } $strReturn .= $this->objToolkit->listFooter(); } } return $strReturn; }
/** * Creates an email to send to a friend * @return void */ private function sendForm() { //load url the user visited before $strUrl = $this->getHistory(2); $arrUrl = explode("&", $strUrl); $strPage = ""; $strSystemid = ""; $strParams = ""; $strAction = ""; foreach ($arrUrl as $arrOnePart) { $arrPair = explode("=", $arrOnePart); if ($arrPair[0] == "page") { $strPage = $arrPair[1]; } else { if ($arrPair[0] == "systemid") { $strSystemid = $arrPair[1]; } else { if ($arrPair[0] == "action") { $strAction = $arrPair[1]; } else { if ($arrPair[0] != "language") { $strParams .= "&" . $arrPair[0] . "=" . $arrPair[1]; } } } } } $strHref = getLinkPortalHref($strPage, "", $strAction, $strParams, $strSystemid, $this->getStrPortalLanguage()); $arrMessage = array(); $arrMessage["tellafriend_url"] = "<a href=\"" . $strHref . "\">" . $strHref . "</a>"; $arrMessage["tellafriend_receiver_name"] = htmlStripTags($this->getParam("tellafriend_receiver_name")); $arrMessage["tellafriend_sender_name"] = htmlStripTags($this->getParam("tellafriend_sender_name")); $arrMessage["tellafriend_message"] = htmlStripTags($this->getParam("tellafriend_message")); $strMailTemplateID = $this->objTemplate->readTemplate("/element_tellafriend/" . $this->arrElementData["tellafriend_template"], "email_html"); $strEmailBody = $this->fillTemplate($arrMessage, $strMailTemplateID); $objScriptlet = new class_scriptlet_helper(); $strEmailBody = $objScriptlet->processString($strEmailBody); //TODO: check if we have to remove critical characters here? $strSubject = $this->fillTemplate(array("tellafriend_sender_name" => htmlStripTags($this->getParam("tellafriend_sender_name"))), $this->objTemplate->readTemplate("/element_tellafriend/" . $this->arrElementData["tellafriend_template"], "email_subject")); //TODO: check if we have to remove critical characters here? $objEmail = new class_mail(); $objEmail->setSender($this->getParam("tellafriend_sender")); $objEmail->setSenderName($this->getParam("tellafriend_sender_name")); $objEmail->addTo($this->getParam("tellafriend_receiver")); $objEmail->setSubject($strSubject); $objEmail->setHtml($strEmailBody); if ($objEmail->sendMail()) { $this->portalReload(class_link::getLinkPortalHref($this->arrElementData["tellafriend_success"])); } else { $this->portalReload(class_link::getLinkPortalHref($this->arrElementData["tellafriend_error"])); } }
/** * Creates a form to collect a users data * * @return string */ private function editUserData() { $arrErrors = array(); $bitForm = true; //what to do? if ($this->getParam("submitUserForm") != "") { $objTextValidator = new class_text_validator(); $objEmailValidator = new class_email_validator(); if ($this->getParam("password") == "" || $this->getParam("password") != $this->getParam("password2")) { $arrErrors[] = $this->getLang("pr_passwordsUnequal"); } if (!$objTextValidator->validate($this->getParam("username"))) { $arrErrors[] = $this->getLang("pr_noUsername"); } //username already existing? if ($objTextValidator->validate($this->getParam("username")) && count(class_module_user_user::getAllUsersByName($this->getParam("username"))) > 0) { $arrErrors[] = $this->getLang("pr_usernameGiven"); } if (!$objEmailValidator->validate($this->getParam("email"))) { $arrErrors[] = $this->getLang("pr_invalidEmailadress"); } //Check captachcode if ($this->getParam("form_captcha") == "" || $this->getParam("form_captcha") != $this->objSession->getCaptchaCode()) { $arrErrors[] = $this->getLang("pr_captcha"); } if (count($arrErrors) == 0) { $bitForm = false; } } if ($bitForm) { $strTemplateID = $this->objTemplate->readTemplate("/element_portalregistration/" . $this->arrElementData["portalregistration_template"], "portalregistration_userdataform"); $arrTemplate = array(); $arrTemplate["username"] = $this->getParam("username"); $arrTemplate["email"] = $this->getParam("email"); $arrTemplate["forename"] = $this->getParam("forename"); $arrTemplate["name"] = $this->getParam("name"); $arrTemplate["formaction"] = class_link::getLinkPortalHref($this->getPagename(), "", "portalCreateAccount"); $arrTemplate["formErrors"] = ""; if (count($arrErrors) > 0) { foreach ($arrErrors as $strOneError) { $strErrTemplate = $this->objTemplate->readTemplate("/element_portalregistration/" . $this->arrElementData["portalregistration_template"], "errorRow"); $arrTemplate["formErrors"] .= "" . $this->fillTemplate(array("error" => $strOneError), $strErrTemplate); } } return $this->fillTemplate($arrTemplate, $strTemplateID); } else { //create new user, inactive $objUser = new class_module_user_user(); $objUser->setStrUsername($this->getParam("username")); $objUser->setIntActive(0); $objUser->setIntAdmin(0); $objUser->setIntPortal(1); $objUser->setStrSubsystem("kajona"); $strAuthcode = generateSystemid(); $objUser->setStrAuthcode($strAuthcode); if ($objUser->updateObjectToDb()) { $objSourceuser = $objUser->getObjSourceUser(); $objSourceuser->setStrEmail($this->getParam("email")); $objSourceuser->setStrForename($this->getParam("forename")); $objSourceuser->setStrName($this->getParam("name")); $objSourceuser->setStrPass($this->getParam("password")); $objSourceuser->updateObjectToDb(); //group assignments $objGroup = new class_module_user_group($this->arrElementData["portalregistration_group"]); $objGroup->getObjSourceGroup()->addMember($objUser->getObjSourceUser()); //and to the guests to avoid conflicts $objGroup = new class_module_user_group(class_module_system_setting::getConfigValue("_guests_group_id_")); $objGroup->getObjSourceGroup()->addMember($objUser->getObjSourceUser()); //create a mail to allow the user to activate itself $strMailContent = $this->getLang("pr_email_body"); $strTemp = getLinkPortalHref($this->getPagename(), "", "portalCompleteRegistration", "&authcode=" . $strAuthcode, $objUser->getSystemid()); $strMailContent .= html_entity_decode("<a href=\"" . $strTemp . "\">" . $strTemp . "</a>"); $strMailContent .= $this->getLang("pr_email_footer"); $objScriptlets = new class_scriptlet_helper(); $strMailContent = $objScriptlets->processString($strMailContent); $objMail = new class_mail(); $objMail->setSubject($this->getLang("pr_email_subject")); $objMail->setHtml($strMailContent); $objMail->addTo($this->getParam("email")); $objMail->sendMail(); } return $this->getLang("pr_register_suc"); } }
/** * Creates a forward / backward pager out of the passed array * * @param class_array_section_iterator $objArraySectionIterator * @param string $strForward text for the forwardlink * @param string $strBack text for the backwardslink * @param string $strAction action on the targetpage * @param string $strPage title of the targetpage * @param string $strAdd additional params * @param string $strPvParam the param used to create the pagenumber-entries * @param string $strTemplate if passed, the pager will render all links using the passed template (if the sections are present). Expected sections: pager_fwd, pager_back, pager_entry, pager_entry_active * * @return mixed array containing the created data: * return => [strForward] = link to the next page * [strBack] = link to the previous page * [strPages] = Pager ( [0][1] ...) */ public function simplePager($objArraySectionIterator, $strForward = "next", $strBack = "back", $strAction = "list", $strPage = "", $strAdd = "", $strPvParam = "pv", $strTemplate = "") { $arrReturn = array("arrData" => array(), "strForward" => "", "strBack" => "", "strPages" => ""); //read the template-sections, of given $bitTemplate = false; $strFwdId = ""; $strBackId = ""; $strEntryId = ""; $strEntryActiveId = ""; if ($strTemplate != "") { $strTemplateIdentifier = $this->objTemplate->readTemplate($strTemplate); $bitTemplate = $this->objTemplate->containsSection($strTemplateIdentifier, "pager_fwd") && $this->objTemplate->containsSection($strTemplateIdentifier, "pager_back") && $this->objTemplate->containsSection($strTemplateIdentifier, "pager_entry") && $this->objTemplate->containsSection($strTemplateIdentifier, "pager_entry_active"); $strFwdId = $this->objTemplate->readTemplate($strTemplate, "pager_fwd"); $strBackId = $this->objTemplate->readTemplate($strTemplate, "pager_back"); $strEntryId = $this->objTemplate->readTemplate($strTemplate, "pager_entry"); $strEntryActiveId = $this->objTemplate->readTemplate($strTemplate, "pager_entry_active"); } $strLinkPages = ""; $strLinkForward = ""; $strLinkBack = ""; $arrReturn["arrData"] = array(); $intPage = $objArraySectionIterator->getPageNumber(); //FowardLink if ($intPage < $objArraySectionIterator->getNrOfPages()) { if ($bitTemplate) { $strLinkForward = $this->objTemplate->fillTemplate(array("pageHref" => class_link::getLinkPortalHref($strPage, "", $strAction, "&" . $strPvParam . "=" . ($intPage + 1) . $strAdd)), $strFwdId); } else { $strLinkForward = class_link::getLinkPortal($strPage, "", null, $strForward, $strAction, "&" . $strPvParam . "=" . ($intPage + 1) . $strAdd); } } //BackLink if ($intPage > 1) { if ($bitTemplate) { $strLinkBack = $this->objTemplate->fillTemplate(array("pageHref" => class_link::getLinkPortalHref($strPage, "", $strAction, "&" . $strPvParam . "=" . ($intPage - 1) . $strAdd)), $strBackId); } else { $strLinkBack = class_link::getLinkPortal($strPage, "", null, $strBack, $strAction, "&" . $strPvParam . "=" . ($intPage - 1) . $strAdd); } } //just load the current +-6 pages and the first/last +-3 $intCounter2 = 1; for ($intI = 1; $intI <= $objArraySectionIterator->getNrOfPages(); $intI++) { $bitDisplay = false; if ($intCounter2 <= 3) { $bitDisplay = true; } elseif ($intCounter2 >= $objArraySectionIterator->getNrOfPages() - 3) { $bitDisplay = true; } elseif ($intCounter2 >= $intPage - 6 && $intCounter2 <= $intPage + 6) { $bitDisplay = true; } if ($bitDisplay) { if ($bitTemplate) { if ($intI == $intPage) { $strLinkPages .= $this->objTemplate->fillTemplate(array("pageHref" => class_link::getLinkPortalHref($strPage, "", $strAction, "&" . $strPvParam . "=" . $intI . $strAdd), "pageNumber" => $intI), $strEntryActiveId); } else { $strLinkPages .= $this->objTemplate->fillTemplate(array("pageHref" => class_link::getLinkPortalHref($strPage, "", $strAction, "&" . $strPvParam . "=" . $intI . $strAdd), "pageNumber" => $intI), $strEntryId); } } else { if ($intI == $intPage) { $strLinkPages .= " <strong>" . class_link::getLinkPortal($strPage, "", null, "[" . $intI . "]", $strAction, "&" . $strPvParam . "=" . $intI . $strAdd) . "</strong>"; } else { $strLinkPages .= " " . class_link::getLinkPortal($strPage, "", null, "[" . $intI . "]", $strAction, "&" . $strPvParam . "=" . $intI . $strAdd); } } } $intCounter2++; } if ($objArraySectionIterator->getNrOfPages() > 1) { $arrReturn["strForward"] = $strLinkForward; $arrReturn["strBack"] = $strLinkBack; $arrReturn["strPages"] = $strLinkPages; } return $arrReturn; }
/** * Generates a link opening in a popup in portal-area * * @param string $strPageI * @param string $strPageE * @param string $strAction * @param string $strParams * @param string $strSystemid * @param string $strTitle * @param int|string $intWidth * @param int|string $intHeight * * @return string */ public static function getLinkPortalPopup($strPageI, $strPageE, $strAction = "", $strParams = "", $strSystemid = "", $strTitle = "", $intWidth = "500", $intHeight = "500") { $strLink = class_link::getLinkPortalHref($strPageI, $strPageE, $strAction, $strParams, $strSystemid); $strLink = "<a href=\"{$strLink}\" onclick=\"return !window.open('" . $strLink . "','" . $strTitle . "','scrollbars=yes,resizable=yes,width=" . $intWidth . ",height=" . $intHeight . "')\" title=\"" . $strTitle . "\">" . $strTitle . "</a>"; return $strLink; }
/** * Will be kept for legacy compatibility * * @param bool $bitJsonResponse * * @return string */ private function doUpload($bitJsonResponse = false) { $strReturn = ""; //prepare the folder to be used as a target-folder for the upload $objFilemanagerRepo = new class_module_mediamanager_repo($this->arrElementData["char2"]); $objDownloadfolder = null; //add a special subfolder? $strPath = $objFilemanagerRepo->getStrPath(); if ($this->getParam("portaluploadDlfolder") != "") { /** @var $objDownloadfolder class_module_mediamanager_file */ $objDownloadfolder = class_objectfactory::getInstance()->getObject($this->getParam("portaluploadDlfolder")); //check if the folder is within the current repo /** @var $objTemp class_module_mediamanager_file */ $objTemp = $objDownloadfolder; while (validateSystemid($objTemp->getSystemid()) && ($objTemp instanceof class_module_mediamanager_file || $objTemp instanceof class_module_mediamanager_repo)) { if ($objTemp->getSystemid() == $this->arrElementData["char2"]) { $strPath = $objDownloadfolder->getStrFilename(); break; } $objTemp = class_objectfactory::getInstance()->getObject($objTemp->getPrevId()); } } //upload the file... if ($objFilemanagerRepo->rightRight1()) { //Handle the fileupload $arrSource = $this->getParam("portaluploadFile"); $strTarget = $strPath . "/" . createFilename($arrSource["name"]); $objFilesystem = new class_filesystem(); if ($objFilesystem->isWritable($strPath)) { //Check file for correct filters $arrAllowed = explode(",", $objFilemanagerRepo->getStrUploadFilter()); $strSuffix = uniStrtolower(uniSubstr($arrSource["name"], uniStrrpos($arrSource["name"], "."))); if ($objFilemanagerRepo->getStrUploadFilter() == "" || in_array($strSuffix, $arrAllowed)) { if ($objFilesystem->copyUpload($strTarget, $arrSource["tmp_name"])) { //upload was successfull. try to sync the downloads-archive. if ($objDownloadfolder != null && $objDownloadfolder instanceof class_module_mediamanager_file) { class_module_mediamanager_file::syncRecursive($objDownloadfolder->getSystemid(), $objDownloadfolder->getStrFilename()); } else { $objFilemanagerRepo->syncRepo(); } $this->flushCompletePagesCache(); if ($bitJsonResponse) { return true; } //reload the site to display the new file if (validateSystemid($this->getParam("portaluploadDlfolder"))) { $this->portalReload(class_link::getLinkPortalHref($this->getPagename(), "", "mediaFolder", "uploadSuccess=1", $this->getParam("portaluploadDlfolder"))); } else { $this->portalReload(class_link::getLinkPortalHref($this->getPagename(), "", "", $this->getAction(), "uploadSuccess=1", $this->getSystemid())); } } else { $strReturn .= $this->uploadForm($this->getLang("portaluploadCopyUploadError")); } } else { @unlink($arrSource["tmp_name"]); $strReturn .= $this->uploadForm($this->getLang("portaluploadFilterError")); } } else { $strReturn .= $this->uploadForm($this->getLang("portaluploadNotWritableError")); } } else { $strReturn .= $this->getLang("commons_error_permissions"); } return $strReturn; }
/** * Creates a raw Link for the portal (just the href) * * @deprecated * * @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 */ function getLinkPortalHref($strPageI, $strPageE = "", $strAction = "", $strParams = "", $strSystemid = "", $strLanguage = "", $strSeoAddon = "") { return class_link::getLinkPortalHref($strPageI, $strPageE, $strAction, $strParams, $strSystemid, $strLanguage, $strSeoAddon); }
/** * This method triggers the internal processing. * It may be overridden if required, e.g. to implement your own action-handling. * By default, the method to be called is set up out of the action-param passed. * Example: The action requested is named "newPage". Therefore, the framework tries to * call actionNewPage(). If now method matching the schema is found, nothing is done. * <b> Please note that this is different from the admin-handling! </b> In the case of admin-classes, * an exception is thrown. But since there could be many modules on a single page, not each module * may be triggered. * Since Kajona 4.0, the check on declarative permissions via annotations is supported. * Therefore the list of permissions, named after the "permissions" annotation are validated against * the module currently loaded. * * * @param string $strAction * * @see class_rights::validatePermissionString * @throws class_exception * @return string * @since 3.4 */ public function action($strAction = "") { if ($strAction != "") { $this->setAction($strAction); } $strAction = $this->getAction(); //search for the matching method - build method name $strMethodName = "action" . uniStrtoupper($strAction[0]) . uniSubstr($strAction, 1); $objAnnotations = new class_reflection(get_class($this)); if (method_exists($this, $strMethodName)) { //validate the permissions required to call this method, the xml-part is validated afterwards $strPermissions = $objAnnotations->getMethodAnnotationValue($strMethodName, "@permissions"); if ($strPermissions !== false) { if (validateSystemid($this->getSystemid()) && class_objectfactory::getInstance()->getObject($this->getSystemid()) != null) { $objObjectToCheck = class_objectfactory::getInstance()->getObject($this->getSystemid()); } else { $objObjectToCheck = $this->getObjModule(); } if (!class_carrier::getInstance()->getObjRights()->validatePermissionString($strPermissions, $objObjectToCheck)) { $this->strOutput = $this->getLang("commons_error_permissions"); //redirect to the error page if ($this->getPagename() != class_module_system_setting::getConfigValue("_pages_errorpage_")) { $this->portalReload(class_link::getLinkPortalHref(class_module_system_setting::getConfigValue("_pages_errorpage_"), "")); return ""; } class_response_object::getInstance()->setStrStatusCode(class_http_statuscodes::SC_UNAUTHORIZED); throw new class_exception("you are not authorized/authenticated to call this action", class_exception::$level_ERROR); } } if (_xmlLoader_ === true) { //check it the method is allowed for xml-requests $objAnnotations = new class_reflection(get_class($this)); if (!$objAnnotations->hasMethodAnnotation($strMethodName, "@xml") && substr(get_class($this), -3) != "xml") { throw new class_exception("called method " . $strMethodName . " not allowed for xml-requests", class_exception::$level_FATALERROR); } } $this->strOutput = $this->{$strMethodName}(); } else { if (_xmlLoader_ === true) { $objReflection = new ReflectionClass($this); throw new class_exception("called method " . $strMethodName . " not existing for class " . $objReflection->getName(), class_exception::$level_FATALERROR); } //try to load the list-method $strListMethodName = "actionList"; if (method_exists($this, $strListMethodName)) { $strPermissions = $objAnnotations->getMethodAnnotationValue($strListMethodName, "@permissions"); if ($strPermissions !== false) { if (validateSystemid($this->getSystemid()) && class_objectfactory::getInstance()->getObject($this->getSystemid()) != null) { $objObjectToCheck = class_objectfactory::getInstance()->getObject($this->getSystemid()); } else { $objObjectToCheck = $this->getObjModule(); } if (!class_carrier::getInstance()->getObjRights()->validatePermissionString($strPermissions, $objObjectToCheck)) { $this->strOutput = $this->getLang("commons_error_permissions"); throw new class_exception("you are not authorized/authenticated to call this action", class_exception::$level_ERROR); } } $this->strOutput = $this->{$strListMethodName}(); } else { $objReflection = new ReflectionClass($this); throw new class_exception("called method " . $strMethodName . " not existing for class " . $objReflection->getName(), class_exception::$level_ERROR); } } return $this->strOutput; }