/** * Converts the passed value to a formatted value. * In most scenarios, the value is written directly to the template. * * @param mixed $strValue * * @return string */ public function format($strValue) { if (validateSystemid($strValue)) { $objUser = new class_module_user_user($strValue); return $objUser->getStrDisplayName(); } return $strValue; }
/** * Returns a textual representation of the formentries' value. * May contain html, but should be stripped down to text-only. * * @return string */ public function getValueAsText() { if (validateSystemid($this->getStrValue())) { $objUser = new class_module_user_user($this->getStrValue()); return $objUser->getStrDisplayName(); } return ""; }
/** * Validates the passed chunk of data. * In most cases, this'll be a string-object. * * @param string $objValue * @return bool */ public function validate($objValue) { if (!parent::validate($objValue)) { return false; } //check if user exists and if it is the logged in user $objUser = new class_module_user_user($objValue); if ($objUser->getStrUsername() != "" && $objValue == class_carrier::getInstance()->getObjSession()->getUserID()) { return false; } return true; }
/** * Validates the passed chunk of data. * In most cases, this'll be a string-object. * * @param string $objValue * @return bool */ public function validate($objValue) { if (!parent::validate($objValue)) { return false; } //check if the user or usergroup exists $objUser = new class_module_user_user($objValue); $objUserGroup = new class_module_user_group($objValue); if ($objUser->getStrUsername() == "" && $objUserGroup->getStrName() == "") { return false; } if ($objUser->getIntDeleted() == 1) { return false; } return true; }
/** * Renders the list of available packages or any other kind of gui-representation * of the packageprovider. * * Whenever the provider is capable of uploading new packages, the copy & and upload process * should be triggered by the admin-class again. * So make sure links or forms point to * module = packagemanager * action = uploadPackage * provider = class_name * The provider will be called using the processPackageUpload method. * * @throws class_exception * @return string */ public function renderPackageList() { $objUser = new class_module_user_user(class_session::getInstance()->getUserID()); $intStart = ($this->getPageNumber() - 1) * $objUser->getIntItemsPerPage(); $intEnd = $intStart + $objUser->getIntItemsPerPage() - 1; $objToolkit = class_carrier::getInstance()->getObjToolkit("admin"); $objLang = class_carrier::getInstance()->getObjLang(); $objManager = new class_module_packagemanager_manager(); $objRemoteloader = $this->getRemoteloader(); $objRemoteloader->setStrQueryParams($this->buildQueryParams($intStart, $intEnd)); $strResponse = ""; try { $strResponse = $objRemoteloader->getRemoteContent(); } catch (class_exception $objEx) { return $objLang->getLang("package_remote_errorloading", self::$STR_MODULE_NAME); } $arrResponse = json_decode($strResponse, true); if ($arrResponse === null) { throw new class_exception("Error loading the remote package list. Got: <br />" . htmlToString($strResponse, true), class_exception::$level_ERROR); } $objRemoteParser = class_module_packagemanager_remoteparser_factory::getRemoteParser($arrResponse, $this->getPageNumber(), $intStart, $intEnd, get_class($this), "&name=" . urlencode($this->getParam("name")) . "&type=" . $this->getParam("type")); $arrPackages = $objRemoteParser->getArrPackages(); $strReturn = $this->createFilterCriteria(); $strReturn .= $objToolkit->listHeader(); if (!$this->containsItems($arrPackages)) { $strReturn .= $objToolkit->getTextRow($objLang->getLang("commons_list_empty", null)); } else { $intI = 0; foreach ($arrPackages as $arrOnePackage) { //check if already installed locally if ($objManager->getPackage($arrOnePackage["title"]) !== null) { $strAction = $objToolkit->listButton(getImageAdmin("icon_installDisabled", $objLang->getLang("package_noinstall_installed", self::$STR_MODULE_NAME))); } else { $strAction = $objToolkit->listButton(getLinkAdmin(self::$STR_MODULE_NAME, "uploadPackage", "provider=" . get_class($this) . "&systemid=" . $arrOnePackage["systemid"], $objLang->getLang("package_install", self::$STR_MODULE_NAME), $objLang->getLang("package_install", self::$STR_MODULE_NAME), "icon_install")); } $strIcon = "icon_module"; if ($arrOnePackage["type"] == "TEMPLATE") { $strIcon = "icon_dot"; } $arrOnePackage["version"] = $objLang->getLang("type_" . $arrOnePackage["type"], self::$STR_MODULE_NAME) . ", V " . $arrOnePackage["version"]; $strReturn .= $objToolkit->genericAdminList($arrOnePackage["systemid"], $arrOnePackage["title"], getImageAdmin($strIcon), $strAction, $intI++, $arrOnePackage["version"], $arrOnePackage["description"]); } } $strReturn .= $objToolkit->listFooter(); $strReturn .= $objRemoteParser->paginationFooter(); return $strReturn; }
/** * Removes the elements / modules handled by the current installer. * Use the reference param to add a human readable logging. * * @param string &$strReturn * * @return bool */ public function remove(&$strReturn) { //remove the workflow if (class_module_system_module::getModuleByName("workflows") !== null) { foreach (class_module_workflows_workflow::getWorkflowsForClass("class_workflow_ldap_sync") as $objOneWorkflow) { if (!$objOneWorkflow->deleteObjectFromDatabase()) { $strReturn .= "Error deleting workflow, aborting.\n"; return false; } } $objHandler = class_module_workflows_handler::getHandlerByClass("class_workflow_ldap_sync"); if (!$objHandler->deleteObjectFromDatabase()) { $strReturn .= "Error deleting workflow handler, aborting.\n"; return false; } } //fetch associated users foreach ($this->objDB->getPArray("SELECT * FROM " . _dbprefix_ . "user_ldap", array()) as $arrOneRow) { $objOneUser = new class_module_user_user($arrOneRow["user_ldap_id"]); echo "Deleting ldap user " . $objOneUser->getStrDisplayName() . "...\n"; $objOneUser->deleteObjectFromDatabase(); } //fetch associated groups foreach ($this->objDB->getPArray("SELECT * FROM " . _dbprefix_ . "user_group_ldap", array()) as $arrOneRow) { $objOneUser = new class_module_user_group($arrOneRow["group_ldap_id"]); echo "Deleting ldap group " . $objOneUser->getStrDisplayName() . "...\n"; $objOneUser->deleteObjectFromDatabase(); } //delete the module-node $strReturn .= "Deleting the module-registration...\n"; $objModule = class_module_system_module::getModuleByName($this->objMetadata->getStrTitle(), true); if (!$objModule->deleteObjectFromDatabase()) { $strReturn .= "Error deleting module, aborting.\n"; return false; } //delete the tables foreach (array("user_group_ldap", "user_ldap") as $strOneTable) { $strReturn .= "Dropping table " . $strOneTable . "...\n"; if (!$this->objDB->_pQuery("DROP TABLE " . $this->objDB->encloseTableName(_dbprefix_ . $strOneTable) . "", array())) { $strReturn .= "Error deleting table, aborting.\n"; return false; } } return true; }
/** * Initializes the internal kajona session * @return void */ public function initInternalSession() { $arrTables = $this->objDB->getTables(); if (!in_array(_dbprefix_ . "session", $arrTables) || class_module_system_setting::getConfigValue("_guests_group_id_") === null) { return; } $this->bitLazyLoaded = true; if ($this->getSession("KAJONA_INTERNAL_SESSID") !== false) { $this->objInternalSession = class_module_system_session::getSessionById($this->getSession("KAJONA_INTERNAL_SESSID")); if ($this->objInternalSession != null && $this->objInternalSession->isSessionValid()) { $this->objInternalSession->setIntReleasetime(time() + (int) class_module_system_setting::getConfigValue("_system_release_time_")); $this->objInternalSession->setStrLasturl(getServer("QUERY_STRING")); } else { $this->objInternalSession = null; } if ($this->objInternalSession != null) { return; } } //try to load the matching groups $strGroups = class_module_system_setting::getConfigValue("_guests_group_id_"); if (validateSystemid($this->getUserID())) { $this->objUser = new class_module_user_user($this->getUserID()); $strGroups = implode(",", $this->objUser->getArrGroupIds()); } $objSession = new class_module_system_session(); $objSession->setStrPHPSessionId($this->getSessionId()); $objSession->setStrUserid($this->getUserID()); $objSession->setStrGroupids($strGroups); $objSession->setIntReleasetime(time() + (int) class_module_system_setting::getConfigValue("_system_release_time_")); $objSession->setStrLasturl(getServer("QUERY_STRING")); $objSession->setSystemid(generateSystemid()); //this update is removed. the internal session validates on destruct, if an update or an insert is required //$objSession->updateObjectToDb(); $this->setSession("KAJONA_INTERNAL_SESSID", $objSession->getSystemid()); $this->objInternalSession = $objSession; }
/** * Sends a copy of the message to the user by mail * * @param class_module_messaging_message $objMessage * @param class_module_user_user $objUser * @return bool */ private function sendMessageByMail(class_module_messaging_message $objMessage, class_module_user_user $objUser) { $strOriginalLang = class_carrier::getInstance()->getObjLang()->getStrTextLanguage(); class_carrier::getInstance()->getObjLang()->setStrTextLanguage($objUser->getStrAdminlanguage()); $strSubject = $objMessage->getStrTitle() != "" ? $objMessage->getStrTitle() : class_carrier::getInstance()->getObjLang()->getLang("message_notification_subject", "messaging"); $strBody = class_carrier::getInstance()->getObjLang()->getLang("message_prolog", "messaging"); $strBody .= "\n\n" . class_link::getLinkAdminHref("messaging", "view", "&systemid=" . $objMessage->getSystemid(), false) . "\n\n"; $strBody .= $objMessage->getStrBody(); $objMail = new class_mail(); //try to get a matching sender and place it into the mail if (validateSystemid($objMessage->getStrSenderId())) { $objSenderUser = new class_module_user_user($objMessage->getStrSenderId()); $objValidator = new class_email_validator(); if ($objValidator->validate($objSenderUser->getStrEmail())) { $objMail->setSender($objSenderUser->getStrEmail()); } } $objMail->setSubject($strSubject); $objMail->setText($strBody); $objMail->addTo($objUser->getStrEmail()); class_carrier::getInstance()->getObjLang()->setStrTextLanguage($strOriginalLang); return $objMail->sendMail(); }
/** * @param class_admin_formgenerator $objForm * * @return bool */ protected function checkAdditionalEditData(class_admin_formgenerator $objForm) { $arrParams = class_carrier::getAllParams(); $bitPass = true; if (isset($arrParams["user_pass"])) { $bitPass = $this->checkPasswords($this->getParam("user_pass"), $this->getParam("user_pass2")); if (!$bitPass) { $objForm->addValidationError("password", $this->getLang("required_password_equal")); } } $arrUsers = class_module_user_user::getAllUsersByName($this->getParam("user_username")); if (count($arrUsers) > 0) { $objUser = $arrUsers[0]; if ($objUser->getSystemid() != $this->getSystemid()) { $objForm->addValidationError("user_username", $this->getLang("required_user_existing")); $bitPass = false; } } return $bitPass; }
/** * 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 ""; }
/** * @return string */ public function getReport() { $strReturn = ""; //Create Data-table $arrHeader = array(); $arrValues = array(); //Fetch data $arrStats = $this->getTopQueries(); //calc a few values $intSum = 0; foreach ($arrStats as $intHits) { $intSum += $intHits; } $intI = 0; $objUser = new class_module_user_user(class_session::getInstance()->getUserID()); foreach ($arrStats as $strKey => $intHits) { //Escape? if ($intI >= $objUser->getIntItemsPerPage()) { break; } $arrValues[$intI] = array(); $arrValues[$intI][] = $intI + 1; $arrValues[$intI][] = $strKey; $arrValues[$intI][] = $intHits; $arrValues[$intI][] = $this->objToolkit->percentBeam($intHits / $intSum * 100); $intI++; } //HeaderRow $arrHeader[] = "#"; $arrHeader[] = $this->objTexts->getLang("top_query_titel", "stats"); $arrHeader[] = $this->objTexts->getLang("top_query_gewicht", "stats"); $arrHeader[] = $this->objTexts->getLang("anteil", "stats"); $strReturn .= $this->objToolkit->dataTable($arrHeader, $arrValues); return $strReturn; }
/** * Creates the form to perform the current workflow-step * * @return string * @permissions view */ protected function actionShowUi() { $strReturn = ""; $objWorkflow = new class_module_workflows_workflow($this->getSystemid()); if ($objWorkflow->getIntState() != class_module_workflows_workflow::$INT_STATE_SCHEDULED || !$objWorkflow->getObjWorkflowHandler()->providesUserInterface()) { return $this->getLang("commons_error_permissions"); } $arrIdsToCheck = array_merge(array($this->objSession->getUserID()), $this->objSession->getGroupIdsAsArray()); $arrIdsOfTask = explode(",", $objWorkflow->getStrResponsible()); //ui given? current user responsible? //magic: the difference of the tasks' ids and the users' ids should be less than the count of the task-ids - then at least one id matches if ($objWorkflow->getObjWorkflowHandler()->providesUserInterface() && ($objWorkflow->getStrResponsible() == "" || count(array_diff($arrIdsOfTask, $arrIdsToCheck)) < count($arrIdsOfTask))) { $strCreator = ""; if (validateSystemid($objWorkflow->getStrOwner())) { $objUser = new class_module_user_user($objWorkflow->getStrOwner(), false); $strCreator .= $objUser->getStrUsername(); } $strInfo = $this->objToolkit->getTextRow($this->getLang("workflow_owner") . " " . $strCreator); $strResponsible = ""; foreach (explode(",", $objWorkflow->getStrResponsible()) as $strOneId) { if (validateSystemid($strOneId)) { if ($strResponsible != "") { $strResponsible .= ", "; } $objUser = new class_module_user_user($strOneId, false); if ($objUser->getStrUsername() != "") { $strResponsible .= $objUser->getStrUsername(); } else { $objGroup = new class_module_user_group($strOneId); $strResponsible .= $objGroup->getStrName(); } } } $arrHeader = array($this->getLang("workflow_general"), ""); $arrRow1 = array($this->getLang("workflow_owner"), $strCreator); $arrRow2 = array($this->getLang("workflow_responsible"), $strResponsible); $strReturn .= $this->objToolkit->dataTable($arrHeader, array($arrRow1, $arrRow2)); $strForm = $objWorkflow->getObjWorkflowHandler()->getUserInterface(); if ($strForm instanceof class_admin_formgenerator) { $strForm->addField(new class_formentry_hidden(null, null), "workflowid")->setStrValue($objWorkflow->getSystemid()); $strReturn .= $strForm->renderForm(class_link::getLinkAdminHref($this->getArrModule("modul"), "saveUI")); } else { $strReturn .= $this->objToolkit->formHeader(class_link::getLinkAdminHref($this->getArrModule("modul"), "saveUI")); $strReturn .= $strForm; $strReturn .= $this->objToolkit->formInputHidden("systemid", $objWorkflow->getSystemid()); $strReturn .= $this->objToolkit->formInputSubmit($this->getLang("commons_save")); $strReturn .= $this->objToolkit->formClose(); } } else { $strReturn .= $this->getLang("commons_error_permissions"); } return $strReturn; }
/** * @return string */ public function getStrEmail() { if (validateSystemid($this->getStrUserId())) { $objUser = new class_module_user_user($this->getStrUserId()); return $objUser->getStrEmail(); } return $this->strEmail; }
/** * 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; }
public function testLockExceptionOnSort() { $objAspect = new class_module_system_aspect(); $objAspect->setStrName("test"); $objAspect->updateObjectToDb(); $strAspectId = $objAspect->getSystemid(); $objUser1 = new class_module_user_user(); $objUser1->setStrUsername(generateSystemid()); $objUser1->setIntActive(1); $objUser1->updateObjectToDb(); $this->assertTrue(class_carrier::getInstance()->getObjSession()->loginUser($objUser1)); $objAspect->getLockManager()->lockRecord(); $this->assertTrue($objAspect->getLockManager()->isLockedByCurrentUser()); $objUser2 = new class_module_user_user(); $objUser2->setStrUsername(generateSystemid()); $objUser2->setIntActive(1); $objUser2->updateObjectToDb(); $this->assertTrue(class_carrier::getInstance()->getObjSession()->loginUser($objUser2)); $this->assertTrue(!$objAspect->getLockManager()->isLockedByCurrentUser()); $intSort = $objAspect->getIntSort(); $objException = null; try { $objAspect->setAbsolutePosition(4); } catch (class_exception $objEx) { $objException = $objEx; } $this->assertNotNull($objException); $this->assertEquals($intSort, $objAspect->getIntSort()); class_carrier::getInstance()->getObjSession()->logout(); $objAspect = new class_module_system_aspect($strAspectId); $objAspect->deleteObjectFromDatabase(); $objUser1->deleteObjectFromDatabase(); $objUser2->deleteObjectFromDatabase(); }
/** * @param array $arrErrors * * @return string * @permissions view,right1 */ protected function actionRegisterForEvent($arrErrors = array()) { $strReturn = ""; $objEvent = new class_module_eventmanager_event($this->getSystemid()); 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; } $bitIsLoggedin = 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())) { $objParticpant = class_module_eventmanager_participant::getParticipantByUserid($this->objSession->getUserID(), $objEvent->getSystemid()); $this->setParam("comment", $objParticpant->getStrComment()); $this->setParam("participant_status", $objParticpant->getIntParticipationStatus()); } } $objMapper = new class_template_mapper($objEvent); $objMapper->addPlaceholder("forename", $this->getParam("forename")); $objMapper->addPlaceholder("lastname", $this->getParam("lastname")); $objMapper->addPlaceholder("phone", $this->getParam("phone")); $objMapper->addPlaceholder("comment", $this->getParam("comment")); $objMapper->addPlaceholder("email", $this->getParam("email")); $objMapper->addPlaceholder("participant_status", $this->getParam("participant_status")); $objMapper->addPlaceholder("title", $objEvent->getStrTitle()); $objMapper->addPlaceholder("dateTimeFrom", dateToString($objEvent->getObjStartDate(), true)); $objMapper->addPlaceholder("dateFrom", dateToString($objEvent->getObjStartDate(), false)); $objMapper->addPlaceholder("dateTimeUntil", dateToString($objEvent->getObjEndDate(), true)); $objMapper->addPlaceholder("dateUntil", dateToString($objEvent->getObjEndDate(), false)); $objMapper->addPlaceholder("formaction", class_link::getLinkPortalHref($this->getPagename(), "", "saveRegisterForEvent", "", $this->getSystemid(), "", $objEvent->getStrTitle())); if ($bitIsLoggedin) { $objUser = new class_module_user_user($this->objSession->getUserID()); $objMapper->addPlaceholder("username", $objUser->getStrUsername()); } $strErrors = ""; if (count($arrErrors) > 0) { $strErrTemplate = $this->objTemplate->readTemplate("/module_eventmanager/" . $this->arrElementData["char1"], "error_row"); foreach ($arrErrors as $strOneError) { $strErrors .= "" . $this->objTemplate->fillTemplate(array("error" => $strOneError), $strErrTemplate); } } $objMapper->addPlaceholder("formErrors", $strErrors); $strReturn .= $objMapper->writeToTemplate("/module_eventmanager/" . $this->arrElementData["char1"], "event_register" . ($bitIsLoggedin ? "_loggedin" : "")); class_module_pages_portal::registerAdditionalTitle($objEvent->getStrTitle()); return $strReturn; }
/** * @param bool $intStart * @param bool $intEnd * * @return array */ private function getTopQueries($intStart = false, $intEnd = false) { $objUser = new class_module_user_user(class_session::getInstance()->getUserID()); $strQuery = "SELECT search_log_query, COUNT(*) as hits\n\t\t\t\t\t FROM " . _dbprefix_ . "search_log\n\t\t\t\t\t WHERE search_log_date > ?\n\t\t\t\t\t AND search_log_date <= ?\n\t\t\t\t GROUP BY search_log_query\n\t\t\t\t ORDER BY hits DESC"; if ($intStart !== false && $intEnd !== false) { $arrReturn = $this->objDB->getPArray($strQuery, array($this->intDateStart, $this->intDateEnd), $intStart, $intEnd); } else { $arrReturn = $this->objDB->getPArray($strQuery, array($this->intDateStart, $this->intDateEnd), 0, $objUser->getIntItemsPerPage() - 1); } return $arrReturn; }
/** * Prints a file as a detailed-view * and generates forward / backward links + a strip of prev / next files * * @param bool $bitRegisterAdditionalTitle * @return string */ protected function actionFileDetails($bitRegisterAdditionalTitle = true) { if (!$this->checkIfRequestedIdIsInElementsTree()) { return $this->actionList(); } $bitIsImage = false; //Load record $objFile = new class_module_mediamanager_file($this->getSystemid()); //common fields $arrDetailsTemplate = array(); $arrDetailsTemplate["file_name"] = $objFile->getStrName(); $arrDetailsTemplate["file_description"] = $objFile->getStrDescription(); $arrDetailsTemplate["file_subtitle"] = $objFile->getStrSubtitle(); $arrDetailsTemplate["file_filename"] = $objFile->getStrFilename(); $arrDetailsTemplate["file_size"] = bytesToString($objFile->getIntFileSize()); $arrDetailsTemplate["file_hits"] = $objFile->getIntHits(); $arrDetailsTemplate["file_systemid"] = $objFile->getSystemid(); $arrDetailsTemplate["file_elementid"] = $this->arrElementData["content_id"]; $arrDetailsTemplate["file_lmtime"] = timeToString(filemtime(_realpath_ . $objFile->getStrFilename())); if (validateSystemid($objFile->getOwnerId())) { $objUser = new class_module_user_user($objFile->getOwnerId()); $arrDetailsTemplate["file_owner"] = $objUser->getStrUsername(); } if ($objFile->rightRight2()) { $arrDetailsTemplate["file_link_href"] = _webpath_ . "/download.php?systemid=" . $objFile->getSystemid(); $arrDetailsTemplate["file_link"] = "<a href=\"" . _webpath_ . "/download.php?systemid=" . $objFile->getSystemid() . "\">" . $this->getLang("download_link") . "</a>"; } //if its an image, provide additional information $strSuffix = uniStrtolower(uniSubstr($objFile->getStrFilename(), uniStrrpos($objFile->getStrFilename(), "."))); if (in_array($strSuffix, $this->arrImageTypes) && isset($this->arrElementData["gallery_maxh_d"]) && isset($this->arrElementData["gallery_maxw_d"])) { $bitIsImage = true; $arrDetailsTemplate["image_src"] = $this->getImageUrl($objFile->getStrFilename(), $this->arrElementData["gallery_maxh_d"], $this->arrElementData["gallery_maxw_d"], $this->arrElementData["gallery_text"], $this->arrElementData["gallery_overlay"], $objFile->getSystemid(), $this->arrElementData["content_id"]); } $arrStripIds = $this->getNextPrevIds(); $arrDetailsTemplate["backlink"] = $arrStripIds["backward_1"] != "" ? class_link::getLinkPortal($this->getPagename(), "", "", $this->getLang("commons_back"), "fileDetails", "", $arrStripIds["backward_1"]) : ""; $arrDetailsTemplate["forwardlink"] = $arrStripIds["forward_1"] != "" ? class_link::getLinkPortal($this->getPagename(), "", "", $this->getLang("commons_next"), "fileDetails", "", $arrStripIds["forward_1"]) : ""; //next /prev 3 files for ($intI = 1; $intI <= 3; $intI++) { if ($arrStripIds["forward_" . $intI] != "") { $objCurFile = new class_module_mediamanager_file($arrStripIds["forward_" . $intI]); $arrDetailsTemplate["forwardlink_" . $intI] = $this->renderFileStripEntry($objCurFile); } if ($arrStripIds["backward_" . $intI] != "") { $objCurFile = new class_module_mediamanager_file($arrStripIds["backward_" . $intI]); $arrDetailsTemplate["backlink_" . $intI] = $this->renderFileStripEntry($objCurFile); } } //current file $arrDetailsTemplate["filestrip_current"] = $this->renderFileStripEntry($objFile); $arrDetailsTemplate["overview"] = getLinkPortal($this->getPagename(), "", "", $this->getLang("overview"), "mediaFolder", "", $objFile->getPrevId()); $arrDetailsTemplate["pathnavigation"] = $this->generatePathnavi(true); //ratings available? if ($objFile->getFloatRating() !== null) { /** @var $objRating class_module_rating_portal */ $objRating = class_module_system_module::getModuleByName("rating")->getPortalInstanceOfConcreteModule(); $arrDetailsTemplate["file_rating"] = $objRating->buildRatingBar($objFile->getFloatRating(), $objFile->getIntRatingHits(), $objFile->getSystemid(), $objFile->isRateableByUser(), $objFile->rightRight3()); } $strTemplateID = $this->objTemplate->readTemplate("/module_mediamanager/" . $this->arrElementData["repo_template"], "filedetail"); $strReturn = $this->fillTemplate($arrDetailsTemplate, $strTemplateID); //Add pe code $arrPeConfig = array("pe_module" => "mediamanager", "pe_action_edit" => "editFile", "pe_action_edit_params" => "&systemid=" . $objFile->getSystemid()); $strReturn = class_element_portal::addPortalEditorCode($strReturn, $objFile->getSystemid(), $arrPeConfig); //set the name of the current image to the page title via class_pages if ($bitRegisterAdditionalTitle) { class_module_pages_portal::registerAdditionalTitle($objFile->getStrName()); } //Update view counter if ($bitIsImage) { $objFile->increaseHits(); } return $this->addPortaleditorCode($strReturn); }
/** * @param string $strTargetURI If you pass null, no form-tags will be rendered. * @param int $intButtonConfig a list of buttons to attach to the end of the form. if you need more then the obligatory save-button, * pass them combined by a bitwise or, e.g. class_admin_formgenerator::BIT_BUTTON_SAVE | class_admin_formgenerator::$BIT_BUTTON_CANCEL * * @throws class_exception * @return string */ public function renderForm($strTargetURI, $intButtonConfig = 2) { $strReturn = ""; //add a hidden systemid-field if ($this->objSourceobject != null) { $objField = new class_formentry_hidden($this->strFormname, "systemid"); $objField->setStrEntryName("systemid")->setStrValue($this->objSourceobject->getSystemid())->setObjValidator(new class_systemid_validator()); $this->addField($objField); } $objToolkit = class_carrier::getInstance()->getObjToolkit("admin"); if ($strTargetURI !== null) { $strReturn .= $objToolkit->formHeader($strTargetURI, "", $this->strFormEncoding, $this->strOnSubmit); } $strReturn .= $objToolkit->getValidationErrors($this); $strHidden = ""; foreach ($this->arrFields as $objOneField) { if (in_array($objOneField->getStrEntryName(), $this->arrHiddenElements)) { $strHidden .= $objOneField->renderField(); } else { $strReturn .= $objOneField->renderField(); } } if ($strHidden != "") { $strReturn .= $objToolkit->formOptionalElementsWrapper($strHidden, $this->strHiddenGroupTitle, $this->bitHiddenElementsVisible); } if ($intButtonConfig & self::BIT_BUTTON_SUBMIT) { $strReturn .= $objToolkit->formInputSubmit(class_lang::getInstance()->getLang("commons_submit", "system"), "submitbtn"); } if ($intButtonConfig & self::BIT_BUTTON_SAVE) { $strReturn .= $objToolkit->formInputSubmit(class_lang::getInstance()->getLang("commons_save", "system"), "submitbtn"); } if ($intButtonConfig & self::BIT_BUTTON_CANCEL) { $strReturn .= $objToolkit->formInputSubmit(class_lang::getInstance()->getLang("commons_cancel", "system"), "cancelbtn"); } if ($intButtonConfig & self::BIT_BUTTON_CLOSE) { $strReturn .= $objToolkit->formInputSubmit(class_lang::getInstance()->getLang("commons_close", "system"), "closebtn"); } if ($intButtonConfig & self::BIT_BUTTON_DELETE) { $strReturn .= $objToolkit->formInputSubmit(class_lang::getInstance()->getLang("commons_delete", "system"), "deletebtn"); } if ($intButtonConfig & self::BIT_BUTTON_RESET) { $strReturn .= $objToolkit->formInputSubmit(class_lang::getInstance()->getLang("commons_reset", "system"), "reset", "", "cancelbutton"); } if ($intButtonConfig & self::BIT_BUTTON_CONTINUE) { $strReturn .= $objToolkit->formInputSubmit(class_lang::getInstance()->getLang("commons_continue", "system"), "continuebtn"); } if ($intButtonConfig & self::BIT_BUTTON_BACK) { $strReturn .= $objToolkit->formInputSubmit(class_lang::getInstance()->getLang("commons_back", "system"), "backbtn"); } if ($strTargetURI !== null) { $strReturn .= $objToolkit->formClose(); } if (count($this->arrFields) > 0) { reset($this->arrFields); do { $objField = current($this->arrFields); if (!$objField instanceof class_formentry_hidden && !$objField instanceof class_formentry_plaintext && !$objField instanceof class_formentry_headline && !$objField instanceof class_formentry_divider) { $strReturn .= $objToolkit->setBrowserFocus($objField->getStrEntryName()); break; } } while (next($this->arrFields) !== false); } //lock the record to avoid multiple edit-sessions - if in edit mode if ($this->objSourceobject != null && method_exists($this->objSourceobject, "getLockManager")) { $bitSkip = false; if ($this->getField("mode") != null && $this->getField("mode")->getStrValue() == "new") { $bitSkip = true; } if (!$bitSkip && !validateSystemid($this->objSourceobject->getSystemid())) { $bitSkip = true; } if (!$bitSkip) { if ($this->objSourceobject->getLockManager()->isAccessibleForCurrentUser()) { $this->objSourceobject->getLockManager()->lockRecord(); } else { $objUser = new class_module_user_user($this->objSourceobject->getLockManager()->getLockId()); throw new class_exception("Current record is already locked by user '" . $objUser->getStrDisplayName() . "'.\nCannot be locked for the current user", class_exception::$level_ERROR); } } } return $strReturn; }
/** * @return string */ public function getReport() { $strReturn = ""; //Create Data-table $arrHeader = array(); $arrValues = array(); //Fetch data $arrStats = $this->getTopVisitors(); //calc a few values $intSum = 0; foreach ($arrStats as $arrOneStat) { $intSum += $arrOneStat["anzahl"]; } $intI = 0; $objUser = new class_module_user_user(class_session::getInstance()->getUserID()); foreach ($arrStats as $arrOneStat) { //Escape? if ($intI >= $objUser->getIntItemsPerPage()) { break; } $arrValues[$intI] = array(); $arrValues[$intI][] = $intI + 1; if ($arrOneStat["stats_hostname"] != "" and $arrOneStat["stats_hostname"] != "na") { $arrValues[$intI][] = $arrOneStat["stats_hostname"]; } else { $arrValues[$intI][] = $arrOneStat["stats_ip"]; } $arrValues[$intI][] = $arrOneStat["anzahl"]; $arrValues[$intI][] = $this->objToolkit->percentBeam($arrOneStat["anzahl"] / $intSum * 100); $strUtraceLinkMap = "href=\"http://www.utrace.de/ip-adresse/" . $arrOneStat["stats_ip"] . "\" target=\"_blank\""; $strUtraceLinkText = "href=\"http://www.utrace.de/whois/" . $arrOneStat["stats_ip"] . "\" target=\"_blank\""; if ($arrOneStat["stats_ip"] != "127.0.0.1" && $arrOneStat["stats_ip"] != "::1") { $arrValues[$intI][] = class_link::getLinkAdminManual($strUtraceLinkMap, "", $this->objLang->getLang("login_utrace_showmap", "user"), "icon_earth") . " " . class_link::getLinkAdminManual($strUtraceLinkText, "", $this->objLang->getLang("login_utrace_showtext", "user"), "icon_text"); } else { $arrValues[$intI][] = getImageAdmin("icon_earthDisabled", $this->objLang->getLang("login_utrace_noinfo", "user")) . " " . getImageAdmin("icon_textDisabled", $this->objLang->getLang("login_utrace_noinfo", "user")); } $intI++; } //HeaderRow $arrHeader[] = "#"; $arrHeader[] = $this->objLang->getLang("top_visitor_titel", "stats"); $arrHeader[] = $this->objLang->getLang("commons_hits_header", "stats"); $arrHeader[] = $this->objLang->getLang("anteil", "stats"); $arrHeader[] = $this->objLang->getLang("login_utrace", "user"); $strReturn .= $this->objToolkit->dataTable($arrHeader, $arrValues); $strReturn .= $this->objToolkit->getTextRow($this->objLang->getLang("stats_hint_task", "stats")); return $strReturn; }
/** * Returns the name of the user who last edited the record * * @param string $strSystemid * * @throws class_exception * @return string */ public function getLastEditUser($strSystemid = "") { if ($strSystemid != "") { throw new class_exception("unsupported param @ " . __METHOD__, class_exception::$level_FATALERROR); } if (validateSystemid($this->getStrLmUser())) { $objUser = new class_module_user_user($this->getStrLmUser()); return $objUser->getStrDisplayName(); } else { return "System"; } }
private function loadPostLoginSite() { //any url to redirect? if ($this->objSession->getSession(self::SESSION_REFERER) != "" && $this->objSession->getSession(self::SESSION_REFERER) != "admin=1") { class_response_object::getInstance()->setStrRedirectUrl(_indexpath_ . "?" . $this->objSession->getSession(self::SESSION_REFERER)); $this->objSession->sessionUnset(self::SESSION_REFERER); $this->objSession->setSession(self::SESSION_LOAD_FROM_PARAMS, "true"); } else { //route to the default module $strModule = "dashboard"; if (class_session::getInstance()->isLoggedin()) { $objUser = new class_module_user_user(class_session::getInstance()->getUserID()); if ($objUser->getStrAdminModule() != "") { $strModule = $objUser->getStrAdminModule(); } } class_response_object::getInstance()->setStrRedirectUrl(class_link::getLinkAdminHref($strModule)); } }
/** * 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; }
/** * @return string */ public function getReport() { $strReturn = ""; $arrData = $this->getTotalUniqueHostsInInterval(); $arrLogs = array(); $intI = 0; $objUser = new class_module_user_user(class_session::getInstance()->getUserID()); foreach ($arrData as $arrOneLog) { if ($intI++ >= $objUser->getIntItemsPerPage()) { break; } $arrLogs[$intI][0] = $intI; $arrLogs[$intI][1] = $arrOneLog["log_hostname"]; $arrLogs[$intI][2] = $arrOneLog["anzahl"]; } //Create a data-table $arrHeader = array(); $arrHeader[0] = "#"; $arrHeader[1] = $this->objLang->getLang("packageservertopqueries_header_host", "packageserver"); $arrHeader[2] = $this->objLang->getLang("packageservertopqueries_header_requests", "packageserver"); $strReturn .= $this->objToolkit->dataTable($arrHeader, $arrLogs); return $strReturn; }
/** * @return string */ public function getStrUsername() { $objUser = new class_module_user_user($this->getStrUserId()); return $objUser->getStrDisplayName(); }
/** * Constructor * * @param $arrElements * * @return \class_array_iterator */ public function __construct($arrElements) { $objUser = new class_module_user_user(class_session::getInstance()->getUserID()); $this->intElementsPerPage = $objUser->getIntItemsPerPage(); $this->setArrElements($arrElements); }
/** * 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; }
/** * Returns the fully featured user-instance created by the matching subsystem. * * @param class_module_user_user $objLeightweightUser * * @throws class_exception * @return interface_usersources_user */ public function getSourceUser(class_module_user_user $objLeightweightUser) { if ($objLeightweightUser->getIntDeleted() == 1) { throw new class_exception("User was deleted, source user no longer available", class_exception::$level_ERROR); } $objSubsystem = $this->getUsersource($objLeightweightUser->getStrSubsystem()); $objPlainUser = $objSubsystem->getUserById($objLeightweightUser->getSystemid()); return $objPlainUser; }
/** * Returns the pages and their hits * * @return mixed */ public function getTopPages() { $objUser = new class_module_user_user(class_session::getInstance()->getUserID()); $strQuery = "SELECT stats_page as name, count(*) as anzahl, stats_language as language\n\t\t\t\t\t\tFROM " . _dbprefix_ . "stats_data\n\t\t\t\t\t\tWHERE stats_date > ?\n\t\t\t\t\t\t\t\tAND stats_date <= ?\n\t\t\t\t\t\tGROUP BY stats_page, stats_language\n\t\t\t\t\t\t\tORDER BY anzahl desc"; return $this->objDB->getPArray($strQuery, array($this->intDateStart, $this->intDateEnd), 0, $objUser->getIntItemsPerPage() - 1); }
/** * @param DOMElement $objElement * @param $objParent * @param $strClassName * @param $arrParameters * @param $strName * @return class_model */ private function createFixtureUser(DOMElement $objElement, $objParent, $strClassName, $arrParameters, $strName) { $strUserName = $arrParameters["strUsername"]; $objUser = new class_module_user_user(); $objUser->setIntActive(1); $objUser->setIntAdmin(1); $objUser->setStrUsername($strUserName); $objUser->updateObjectToDb(); $objSourceUser = $objUser->getObjSourceUser(); $objSourceUser->setStrPass($strUserName); $objSourceUser->setStrEmail("{$strUserName}@example"); $objSourceUser->setStrForename($strUserName . "_Forname"); $objSourceUser->setStrName($strUserName . "Lastname"); $objSourceUser->updateObjectToDb(); return $objUser; }