/** * Invokes the installer, if given. * The installer itself is capable of detecting whether an update or a plain installation is required. * * @throws class_exception * @return string */ public function installOrUpdate() { $strReturn = ""; if (uniStrpos($this->getObjMetadata()->getStrPath(), "core") === false) { throw new class_exception("Current module not located at /core*.", class_exception::$level_ERROR); } if (!$this->isInstallable()) { throw new class_exception("Current module isn't installable, not all requirements are given", class_exception::$level_ERROR); } //search for an existing installer $objFilesystem = new class_filesystem(); $arrInstaller = $objFilesystem->getFilelist($this->objMetadata->getStrPath() . "/installer/", array(".php")); if ($arrInstaller === false) { $strReturn .= "Updating default template pack...\n"; $this->updateDefaultTemplate(); class_cache::flushCache(); return $strReturn; } //proceed with elements foreach ($arrInstaller as $strOneInstaller) { //skip samplecontent files if (uniStrpos($strOneInstaller, "element") !== false) { class_logger::getInstance(class_logger::PACKAGEMANAGEMENT)->addLogRow("triggering updateOrInstall() on installer " . $strOneInstaller . ", all requirements given", class_logger::$levelInfo); //trigger update or install $strName = uniSubstr($strOneInstaller, 0, -4); /** @var $objInstaller interface_installer */ $objInstaller = new $strName(); $strReturn .= $objInstaller->installOrUpdate(); } } $strReturn .= "Updating default template pack...\n"; $this->updateDefaultTemplate(); return $strReturn; }
public function setAbsolutePosition($intNewPosition, $arrRestrictionModules = false) { class_logger::getInstance()->addLogRow("move " . $this->objSource->getSystemid() . " to new pos " . $intNewPosition, class_logger::$levelInfo); $this->objDB->flushQueryCache(); //No caching here to allow multiple shiftings per request $arrElements = $this->objSource->getSortedElementsAtPlaceholder(); //more than one record to set? if (count($arrElements) <= 1) { return; } //senseless new pos? if ($intNewPosition <= 0 || $intNewPosition > count($arrElements)) { return; } $intCurPos = $this->objSource->getIntSort(); if ($intNewPosition == $intCurPos) { return; } //searching the current element to get to know if element should be sorted up- or downwards $bitSortDown = false; $bitSortUp = false; if ($intNewPosition < $intCurPos) { $bitSortUp = true; } else { $bitSortDown = true; } //sort up? if ($bitSortUp) { //move the record to be shifted to the wanted pos $strQuery = "UPDATE " . _dbprefix_ . "system\n\t\t\t\t\t\t\t\tSET system_sort=?\n\t\t\t\t\t\t\t\tWHERE system_id=?"; $this->objDB->_pQuery($strQuery, array((int) $intNewPosition, $this->objSource->getSystemid())); //start at the pos to be reached and move all one down for ($intI = $intNewPosition; $intI < $intCurPos; $intI++) { //break for errors created on version pre 4.0 if ($this->objSource->getSystemid() == $arrElements[$intI - 1]["system_id"]) { continue; } $strQuery = "UPDATE " . _dbprefix_ . "system\n SET system_sort=?\n WHERE system_id=?"; $this->objDB->_pQuery($strQuery, array($intI + 1, $arrElements[$intI - 1]["system_id"])); } } if ($bitSortDown) { //move the record to be shifted to the wanted pos $strQuery = "UPDATE " . _dbprefix_ . "system\n\t\t\t\t\t\t\t\tSET system_sort=?\n\t\t\t\t\t\t\t\tWHERE system_id=?"; $this->objDB->_pQuery($strQuery, array((int) $intNewPosition, $this->objSource->getSystemid())); //start at the pos to be reached and move all one up for ($intI = $intCurPos + 1; $intI <= $intNewPosition; $intI++) { //break for errors created on version pre 4.0 if ($this->objSource->getSystemid() == $arrElements[$intI - 1]["system_id"]) { continue; } $strQuery = "UPDATE " . _dbprefix_ . "system\n SET system_sort= ?\n WHERE system_id=?"; $this->objDB->_pQuery($strQuery, array($intI - 1, $arrElements[$intI - 1]["system_id"])); } } //flush the cache $this->objSource->flushCompletePagesCache(); $this->objDB->flushQueryCache(); $this->objSource->setIntSort($intNewPosition); }
/** * Processes the content. * Make sure to return the string again, otherwise the output will remain blank. * * @param string $strContent * * @return string */ public function processContent($strContent) { $arrMatches = array(); if (preg_match_all("/(\\![A-Za-z0-9_\\-]*)\\!/", $strContent, $arrMatches) != 0) { foreach ($arrMatches[0] as $strOneHit) { if ($strOneHit != "!!") { class_logger::getInstance("langentries.log")->addLogRow("missing lang-entry >" . $strOneHit . "< found!", class_logger::$levelWarning); } } } return $strContent; }
/** * Calls the scriptlets in order to process additional tags and in order to enrich the content. * * @param string $strContent the content to process * @param int $intContext context-selector used to find the matching scriptlets to apply. if not given, all contexts are applied - worst case! * * @return string * @see interface_scriptlet */ public function processString($strContent, $intContext = null) { $arrScriptletFiles = class_resourceloader::getInstance()->getFolderContent("/system/scriptlets", array(".php")); foreach ($arrScriptletFiles as $strPath => $strOneScriptlet) { $strOneScriptlet = uniSubstr($strOneScriptlet, 0, -4); /** @var $objScriptlet interface_scriptlet */ $objScriptlet = new $strOneScriptlet(); if ($objScriptlet instanceof interface_scriptlet && ($intContext == null || $intContext & $objScriptlet->getProcessingContext())) { $strContent = $objScriptlet->processContent($strContent); class_logger::getInstance("scriptlets.log")->addLogRow("processing call to " . $strOneScriptlet . ", filter: " . $intContext, class_logger::$levelInfo); } } return $strContent; }
public function testCustomLogLevel() { class_carrier::getInstance()->getObjConfig()->setDebug('debuglogging_overwrite', array('test_logger_custom.log' => 1)); $objLogger = class_logger::getInstance('test_logger_custom.log'); $this->assertInstanceOf('class_logger', $objLogger); $this->assertEquals(1, $objLogger->getIntLogLevel()); $objLogger->addLogRow("test log row 3", class_logger::$levelInfo); $objLogger->addLogRow("test log row 2", class_logger::$levelWarning); $objLogger->addLogRow("test log row 1", class_logger::$levelError); $this->assertFileExists(_realpath_ . _projectpath_ . "/log/test_logger_custom.log"); $this->assertTrue(uniStripos($objLogger->getLogFileContent(), 'test log row 3') === false); $this->assertTrue(uniStripos($objLogger->getLogFileContent(), 'test log row 2') === false); $this->assertTrue(uniStripos($objLogger->getLogFileContent(), 'test log row 1') !== false); }
/** * Updates the current state to the database * * @param bool $strPrevId * * @return bool */ public function updateObjectToDb($strPrevId = false) { //new one or existing one? if ($this->getSystemid() == "") { $strSystemid = generateSystemid(); $this->setSystemid($strSystemid); } else { //remove old records $strQuery = "DELETE FROM " . _dbprefix_ . "languages_languageset WHERE languageset_id = ?"; $this->objDB->_pQuery($strQuery, array($this->getSystemid())); } class_logger::getInstance()->addLogRow("updating languageset " . $this->getSystemid(), class_logger::$levelInfo); $arrValues = array(); foreach ($this->arrLanguageSet as $strLanguage => $strSystemid) { $arrValues[] = array($this->getSystemid(), $strLanguage, $strSystemid); } return $this->objDB->multiInsert("languages_languageset", array("languageset_id", "languageset_language", "languageset_systemid"), $arrValues); }
/** * Copies the extracted(!) package from the temp-folder * to the target-folder. * In most cases, this is either located at /core or at /templates. * The original should be deleted afterwards. * * @throws class_exception * @return void */ public function move2Filesystem() { $strSource = $this->objMetadata->getStrPath(); if (!is_dir(_realpath_ . $strSource)) { throw new class_exception("current package " . $strSource . " is not a folder.", class_exception::$level_ERROR); } $objFilesystem = new class_filesystem(); $objFilesystem->chmod($this->getStrTargetPath(), 0777); class_logger::getInstance(class_logger::PACKAGEMANAGEMENT)->addLogRow("moving " . $strSource . " to " . $this->getStrTargetPath(), class_logger::$levelInfo); $objFilesystem->folderCopyRecursive($strSource, $this->getStrTargetPath(), true); $this->objMetadata->setStrPath($this->getStrTargetPath()); $objFilesystem->chmod($this->getStrTargetPath()); $objFilesystem->folderDeleteRecursive($strSource); //shift the cache buster $objSetting = class_module_system_setting::getConfigByName("_system_browser_cachebuster_"); if ($objSetting != null) { $objSetting->setStrValue((int) $objSetting->getStrValue() + 1); $objSetting->updateObjectToDb(); } }
/** * The real "download" or "upload" should be handled right here. * All packages have to be downloaded to /project/temp in order to be processed afterwards. * * @return string the filename of the package downloaded */ public function processPackageUpload() { //fetch the upload, validate a few settings and copy the package to /project/temp $arrSource = class_carrier::getInstance()->getParam("provider_local_file"); $strTarget = "/project/temp/" . generateSystemid() . ".zip"; $objFilesystem = new class_filesystem(); //Check file for correct filters $strSuffix = uniStrtolower(uniSubstr($arrSource["name"], uniStrrpos($arrSource["name"], "."))); if (in_array($strSuffix, array(".zip"))) { if ($objFilesystem->copyUpload($strTarget, $arrSource["tmp_name"])) { class_logger::getInstance(class_logger::PACKAGEMANAGEMENT)->addLogRow("uploaded package " . $arrSource["name"] . " to " . $strTarget, class_logger::$levelInfo); class_resourceloader::getInstance()->flushCache(); class_classloader::getInstance()->flushCache(); class_reflection::flushCache(); return $strTarget; } } class_logger::getInstance(class_logger::PACKAGEMANAGEMENT)->addLogRow("error in uploaded package " . $arrSource["name"] . " either wrong format or not writeable target folder", class_logger::$levelInfo); @unlink($arrSource["tmp_name"]); return null; }
/** * Adds a rating-value to the record saved in the db * * @param float $floatRating * * @return bool */ public function saveRating($floatRating) { if ($floatRating < 0 || !$this->isRateableByCurrentUser() || $floatRating > class_module_rating_rate::$intMaxRatingValue) { return false; } $floatRatingOriginal = $floatRating; $objRatingAlgo = new class_module_rating_algo_gaussian(); $floatRating = $objRatingAlgo->doRating($this, $floatRating); class_logger::getInstance()->addLogRow("updated rating of record " . $this->getSystemid() . ", added " . $floatRating, class_logger::$levelInfo); //update the values to remain consistent $this->setFloatRating($floatRating); $this->setIntHits($this->getIntHits() + 1); //save a hint in the history table //if($this->objSession->getUserID() != "") { $strInsert = "INSERT INTO " . $this->objDB->encloseTableName(_dbprefix_ . "rating_history") . "\n \t (rating_history_id, rating_history_rating, rating_history_user, rating_history_timestamp, rating_history_value) VALUES\n \t (?, ?, ?, ?, ?)"; $this->objDB->_pQuery($strInsert, array(generateSystemid(), $this->getSystemid(), $this->objSession->getUserID(), (int) time(), $floatRatingOriginal)); //} //and save it in a cookie $objCookie = new class_cookie(); $objCookie->setCookie(class_module_rating_rate::RATING_COOKIE, getCookie(class_module_rating_rate::RATING_COOKIE) . $this->getSystemid() . ","); //flush the page-cache to have all pages rendered using the correct values $this->flushCompletePagesCache(); return true; }
/** * This method tries to change the value of a property for a given interval. * Therefore the records at the start / end date are loaded and adjusted. * All changes within the interval will be removed. * Example: * Time: 0 1 2 3 4 5 6 * Old: x y y z u * New: x w w z u * --> w was injected from 1 to 4, including. * * @param string $strSystemid * @param string $strAction * @param string $strProperty * @param null|string $strPrevid * @param string $strClass * @param null|string $strUser * @param string $strNewValue * @param class_date $objStartDate * @param class_date $objEndDate * * @return void */ public static function changeValueForInterval($strSystemid, $strAction, $strProperty, $strPrevid, $strClass, $strUser, $strNewValue, class_date $objStartDate, class_date $objEndDate) { class_logger::getInstance()->addLogRow("changed time-based history-entry: " . $strSystemid . "/" . $strProperty . " to " . $strNewValue . " from " . $objStartDate . " until " . $objEndDate, class_logger::$levelWarning); $strQuery = "SELECT *\n FROM " . _dbprefix_ . self::getTableForClass($strClass) . "\n WHERE change_systemid = ?\n AND change_property = ?\n AND change_date <= ?\n ORDER BY change_date DESC"; $arrStartRow = class_carrier::getInstance()->getObjDB()->getPRow($strQuery, array($strSystemid, $strProperty, $objStartDate->getLongTimestamp())); $strQuery = "SELECT *\n FROM " . _dbprefix_ . self::getTableForClass($strClass) . "\n WHERE change_systemid = ?\n AND change_property = ?\n AND change_date >= ?\n ORDER BY change_date ASC"; $arrEndRow = class_carrier::getInstance()->getObjDB()->getPRow($strQuery, array($strSystemid, $strProperty, $objEndDate->getLongTimestamp())); //drop all changes between the start / end date $strQuery = "DELETE FROM " . _dbprefix_ . self::getTableForClass($strClass) . "\n WHERE change_systemid = ?\n AND change_property = ?\n AND change_date >= ?\n AND change_date <= ?"; class_carrier::getInstance()->getObjDB()->_pQuery($strQuery, array($strSystemid, $strProperty, $objStartDate->getLongTimestamp(), $objEndDate->getLongTimestamp())); //adjust the start-row, see if the dates are matching (update vs insert) $strQuery = "INSERT INTO " . _dbprefix_ . self::getTableForClass($strClass) . "\n (change_id,\n change_date,\n change_systemid,\n change_system_previd,\n change_user,\n change_class,\n change_action,\n change_property,\n change_oldvalue,\n change_newvalue) VALUES\n (?,?,?,?,?,?,?,?,?,?)"; class_carrier::getInstance()->getObjDB()->_pQuery($strQuery, array(generateSystemid(), $objStartDate->getLongTimestamp(), $strSystemid, $strPrevid, $strUser, $strClass, $strAction, $strProperty, isset($arrStartRow["change_newvalue"]) ? $arrStartRow["change_newvalue"] : "", $strNewValue)); //adjust the end-row, update vs insert $strQuery = "INSERT INTO " . _dbprefix_ . self::getTableForClass($strClass) . "\n (change_id,\n change_date,\n change_systemid,\n change_system_previd,\n change_user,\n change_class,\n change_action,\n change_property,\n change_oldvalue,\n change_newvalue) VALUES\n (?,?,?,?,?,?,?,?,?,?)"; class_carrier::getInstance()->getObjDB()->_pQuery($strQuery, array(generateSystemid(), $objEndDate->getLongTimestamp(), $strSystemid, $strPrevid, $strUser, $strClass, $strAction, $strProperty, $strNewValue, isset($arrEndRow["change_oldvalue"]) ? $arrEndRow["change_oldvalue"] : "")); class_carrier::getInstance()->getObjDB()->flushQueryCache(); }
/** * Tries to save the passed cropping. * The following params are needed: * action = saveCropping * folder = the files' location * file = the file to crop * systemid = the repo-id * intX * intY * intWidth * intHeight * @return string * @permissions edit */ protected function actionSaveCropping() { $strReturn = ""; $strFile = $this->getParam("file"); $objImage = new class_image2(); $objImage->setUseCache(false); $objImage->load($strFile); $objImage->addOperation(new class_image_crop($this->getParam("intX"), $this->getParam("intY"), $this->getParam("intWidth"), $this->getParam("intHeight"))); if ($objImage->save($strFile)) { class_logger::getInstance()->addLogRow("cropped file " . $strFile, class_logger::$levelInfo); $strReturn .= "<message>" . xmlSafeString($this->getLang("xml_cropping_success")) . "</message>"; } else { class_response_object::getInstance()->setStrStatusCode(class_http_statuscodes::SC_UNAUTHORIZED); $strReturn .= "<message><error>" . xmlSafeString($this->getLang("commons_error_permissions")) . "</error></message>"; } return $strReturn; }
/** * Deletes a record from the SystemTable * * @param string $strSystemid * @param bool $bitRight * @param bool $bitDate * @return bool * @todo: remove first params, is always the current systemid. maybe mark as protected, currently only called by the test-classes * * * @todo find ussages and make private * */ public final function deleteSystemRecord($strSystemid, $bitRight = true, $bitDate = true) { $bitResult = true; //Start a tx before deleting anything $this->objDB->transactionBegin(); $strQuery = "DELETE FROM " . _dbprefix_ . "system WHERE system_id = ?"; $bitResult = $bitResult && $this->objDB->_pQuery($strQuery, array($strSystemid)); if ($bitRight) { $strQuery = "DELETE FROM " . _dbprefix_ . "system_right WHERE right_id = ?"; $bitResult = $bitResult && $this->objDB->_pQuery($strQuery, array($strSystemid)); } if ($bitDate) { $strQuery = "DELETE FROM " . _dbprefix_ . "system_date WHERE system_date_id = ?"; $bitResult = $bitResult && $this->objDB->_pQuery($strQuery, array($strSystemid)); } //end tx if ($bitResult) { $this->objDB->transactionCommit(); class_logger::getInstance()->addLogRow("deleted system-record with id " . $strSystemid, class_logger::$levelInfo); } else { $this->objDB->transactionRollback(); class_logger::getInstance()->addLogRow("deletion of system-record with id " . $strSystemid . " failed", class_logger::$levelWarning); } //flush the cache $this->flushCompletePagesCache(); return $bitResult; }
/** * Imports the given db-dump to the database * * @param string $strFilename * * @return bool */ public function dbImport($strFilename) { $strFilename = _realpath_ . $strFilename; $strCommand = $this->strRestoreBin . " " . $this->strUsername . "/" . $this->strPass . " FILE='" . $strFilename . "'"; $intTemp = ""; system($strCommand, $intTemp); class_logger::getInstance(class_logger::DBLOG)->addLogRow($this->strRestoreBin . " exited with code " . $intTemp, class_logger::$levelInfo); return $intTemp == 0; }
/** * Writes rights to the database. * Wrapper to the recursive function class_rights::setRightsRecursive($arrRights, $strSystemid) * * @param mixed $arrRights * @param string $strSystemid * * @see setRightsRecursive($arrRights, $strSystemid) * @throws class_exception * @return bool */ public function setRights($arrRights, $strSystemid) { //start a new tx $this->flushRightsCache(); $this->objDb->transactionBegin(); $objInstance = class_objectfactory::getInstance()->getObject($strSystemid); if ($objInstance !== null && $objInstance instanceof interface_versionable) { $arrCurrPermissions = $this->getPlainRightRow($strSystemid); //create a changehistory entry $objLog = new class_module_system_changelog(); $arrChanges = array(array("property" => "rightInherit", "oldvalue" => $arrCurrPermissions[self::$STR_RIGHT_INHERIT], "newvalue" => $arrRights[self::$STR_RIGHT_INHERIT]), array("property" => "rightView", "oldvalue" => $arrCurrPermissions[self::$STR_RIGHT_VIEW], "newvalue" => $arrRights[self::$STR_RIGHT_VIEW]), array("property" => "rightEdit", "oldvalue" => $arrCurrPermissions[self::$STR_RIGHT_EDIT], "newvalue" => $arrRights[self::$STR_RIGHT_EDIT]), array("property" => "rightDelete", "oldvalue" => $arrCurrPermissions[self::$STR_RIGHT_DELETE], "newvalue" => $arrRights[self::$STR_RIGHT_DELETE]), array("property" => "rightRight", "oldvalue" => $arrCurrPermissions[self::$STR_RIGHT_RIGHT], "newvalue" => $arrRights[self::$STR_RIGHT_RIGHT]), array("property" => "rightRight1", "oldvalue" => $arrCurrPermissions[self::$STR_RIGHT_RIGHT1], "newvalue" => $arrRights[self::$STR_RIGHT_RIGHT1]), array("property" => "rightRight2", "oldvalue" => $arrCurrPermissions[self::$STR_RIGHT_RIGHT2], "newvalue" => $arrRights[self::$STR_RIGHT_RIGHT2]), array("property" => "rightRight3", "oldvalue" => $arrCurrPermissions[self::$STR_RIGHT_RIGHT3], "newvalue" => $arrRights[self::$STR_RIGHT_RIGHT3]), array("property" => "rightRight4", "oldvalue" => $arrCurrPermissions[self::$STR_RIGHT_RIGHT4], "newvalue" => $arrRights[self::$STR_RIGHT_RIGHT4]), array("property" => "rightRight5", "oldvalue" => $arrCurrPermissions[self::$STR_RIGHT_RIGHT5], "newvalue" => $arrRights[self::$STR_RIGHT_RIGHT5]), array("property" => "rightChangelog", "oldvalue" => $arrCurrPermissions[self::$STR_RIGHT_CHANGELOG], "newvalue" => $arrRights[self::$STR_RIGHT_CHANGELOG])); $objLog->processChanges($objInstance, "editPermissions", $arrChanges); } $bitSave = $this->setRightsRecursive($arrRights, $strSystemid); if ($bitSave) { $this->objDb->transactionCommit(); class_logger::getInstance()->addLogRow("saving rights of record " . $strSystemid . " succeeded", class_logger::$levelInfo); } else { $this->objDb->transactionRollback(); class_logger::getInstance()->addLogRow("saving rights of record " . $strSystemid . " failed", class_logger::$levelError); throw new class_exception("saving rights of record " . $strSystemid . " failed", class_exception::$level_ERROR); } return $bitSave; }
/** * Deletes a user from the systems * * @throws class_exception * @return bool */ public function deleteObject() { if ($this->objSession->getUserID() == $this->getSystemid()) { throw new class_exception("You can't delete yourself", class_exception::$level_FATALERROR); } class_logger::getInstance(class_logger::USERSOURCES)->addLogRow("deleted user with id " . $this->getSystemid() . " (" . $this->getStrUsername() . " / " . $this->getStrName() . "," . $this->getStrForename() . ")", class_logger::$levelWarning); $this->getObjSourceUser()->deleteUser(); $strQuery = "UPDATE " . _dbprefix_ . "user SET user_deleted = 1, user_active = 0 WHERE user_id = ?"; $bitReturn = $this->objDB->_pQuery($strQuery, array($this->getSystemid())); //call other models that may be interested class_core_eventdispatcher::getInstance()->notifyGenericListeners(class_system_eventidentifier::EVENT_SYSTEM_RECORDDELETED, array($this->getSystemid(), get_class($this))); return $bitReturn; }
/** * Sets the position of systemid using a given value. * * @param int $intNewPosition * @param array|bool $arrRestrictionModules If an array of module-ids is passed, the determination of siblings will be limited to the module-records matching one of the module-ids * * @throws class_exception * @return void */ public function setAbsolutePosition($intNewPosition, $arrRestrictionModules = false) { class_logger::getInstance()->addLogRow("move " . $this->objSource->getSystemid() . " to new pos " . $intNewPosition, class_logger::$levelInfo); $this->objDB->flushQueryCache(); //validate if object is sortable if (!$this->objSource->getLockManager()->isAccessibleForCurrentUser()) { throw new class_exception("Object is locked", class_exception::$level_ERROR); } $arrParams = array(); $arrParams[] = $this->objSource->getPrevId(); $strWhere = ""; if ($arrRestrictionModules && is_array($arrRestrictionModules)) { $arrMarks = array(); foreach ($arrRestrictionModules as $strOneId) { $arrMarks[] = "?"; $arrParams[] = $strOneId; } $strWhere = "AND system_module_nr IN ( " . implode(", ", $arrMarks) . " )"; } //Load all elements on the same level, so at first get the prev id $strQuery = "SELECT *\n FROM " . _dbprefix_ . "system\n WHERE system_prev_id=? AND system_id != '0'\n AND system_deleted = 0\n " . $strWhere . "\n ORDER BY system_sort ASC, system_comment ASC"; //No caching here to allow multiple shiftings per request $arrElements = $this->objDB->getPArray($strQuery, $arrParams, null, null, false); //more than one record to set? if (count($arrElements) <= 1) { return; } //senseless new pos? if ($intNewPosition <= 0 || $intNewPosition > count($arrElements)) { return; } $intCurPos = $this->objSource->getIntSort(); if ($intNewPosition == $intCurPos) { return; } //searching the current element to get to know if element should be sorted up- or downwards $bitSortDown = false; $bitSortUp = false; if ($intNewPosition < $intCurPos) { $bitSortUp = true; } else { $bitSortDown = true; } //sort up? if ($bitSortUp) { //move the record to be shifted to the wanted pos $strQuery = "UPDATE " . _dbprefix_ . "system\n SET system_sort=?\n WHERE system_id=?"; $this->objDB->_pQuery($strQuery, array((int) $intNewPosition, $this->objSource->getSystemid())); //start at the pos to be reached and move all one down for ($intI = $intNewPosition; $intI < $intCurPos; $intI++) { $strQuery = "UPDATE " . _dbprefix_ . "system\n SET system_sort=?\n WHERE system_id=?"; $this->objDB->_pQuery($strQuery, array($intI + 1, $arrElements[$intI - 1]["system_id"])); } } if ($bitSortDown) { //move the record to be shifted to the wanted pos $strQuery = "UPDATE " . _dbprefix_ . "system\n SET system_sort=?\n WHERE system_id=?"; $this->objDB->_pQuery($strQuery, array((int) $intNewPosition, $this->objSource->getSystemid())); //start at the pos to be reached and move all one up for ($intI = $intCurPos + 1; $intI <= $intNewPosition; $intI++) { $strQuery = "UPDATE " . _dbprefix_ . "system\n SET system_sort= ?\n WHERE system_id=?"; $this->objDB->_pQuery($strQuery, array($intI - 1, $arrElements[$intI - 1]["system_id"])); } } //flush the cache $this->objSource->flushCompletePagesCache(); class_carrier::getInstance()->flushCache(class_carrier::INT_CACHE_TYPE_DBQUERIES | class_carrier::INT_CACHE_TYPE_ORMCACHE); $this->objSource->setIntSort($intNewPosition); }
/** * @return bool */ public function updateDefaultTemplate() { $objFilesystem = new class_filesystem(); class_logger::getInstance(class_logger::PACKAGEMANAGEMENT)->addLogRow("updating default template from /" . $this->objMetadata->getStrPath(), class_logger::$levelInfo); if (is_dir(_realpath_ . "/" . $this->objMetadata->getStrPath() . "/templates/default/js")) { $objFilesystem->folderCopyRecursive($this->objMetadata->getStrPath() . "/templates/default/js", "/templates/default/js", true); } if (is_dir(_realpath_ . "/" . $this->objMetadata->getStrPath() . "/templates/default/css")) { $objFilesystem->folderCopyRecursive($this->objMetadata->getStrPath() . "/templates/default/css", "/templates/default/css", true); } if (is_dir(_realpath_ . "/" . $this->objMetadata->getStrPath() . "/templates/default/pics")) { $objFilesystem->folderCopyRecursive($this->objMetadata->getStrPath() . "/templates/default/pics", "/templates/default/pics", true); } return true; }
/** * Imports the given db-dump to the database * * @param string $strFilename * * @return bool */ public function dbImport($strFilename) { $strFilename = _realpath_ . $strFilename; if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { $strCommand = "SET \"PGPASSWORD={$this->strPass}\" && "; } else { $strCommand = "PGPASSWORD=\"" . $this->strPass . "\" "; } $strCommand .= $this->strRestoreBin . " -q -h" . $this->strHost . " -U" . $this->strUsername . " -p" . $this->intPort . " " . $this->strDbName . " < \"" . $strFilename . "\""; $intTemp = ""; $strResult = system($strCommand, $intTemp); class_logger::getInstance(class_logger::DBLOG)->addLogRow($this->strRestoreBin . " exited with code " . $intTemp, class_logger::$levelInfo); return $intTemp == 0; }
/** * @see interface_admin_systemtask::getSubmitParams() * @return string */ public function getSubmitParams() { $arrFile = $this->getParam("pageimport_file"); $strError = ""; $objFilesystem = new class_filesystem(); $strTarget = "/import_" . generateSystemid() . ".xml"; $strSuffix = uniStrtolower(uniSubstr($arrFile["name"], uniStrrpos($arrFile["name"], "."))); if ($strSuffix == ".xml") { if ($objFilesystem->copyUpload($strTarget, $arrFile["tmp_name"])) { class_logger::getInstance()->addLogRow("uploaded file " . $strTarget, class_logger::$levelInfo); } else { $strError = "upload"; } } else { $strError = "suffix"; } return "&pageimport_file=" . $strTarget . "&pageimport_error=" . $strError . "&pageimport_replace=" . $this->getParam("pageimport_replace"); }
/** * Makes a copy of the current element and saves it attached to the given page. * This copy includes the records in the elements' foreign tables * * @param string $strNewPage * @param bool $bitChangeTitle * * @throws class_exception * @return class_module_pages_pageelement the new element or null in case of an error */ public function copyObject($strNewPage = "", $bitChangeTitle = true, $bitCopyChilds = true) { class_logger::getInstance()->addLogRow("copy pageelement " . $this->getSystemid(), class_logger::$levelInfo); $this->objDB->transactionBegin(); //fetch all values to insert after the general copy process - mainly the foreign table $objElement = $this->getConcreteAdminInstance(); $arrElementData = $objElement->loadElementData(); //duplicate the current elements - afterwards $this is the new element parent::copyObject($strNewPage, $bitChangeTitle, $bitCopyChilds); //copy the old contents into the new elements $objElement = $this->getConcreteAdminInstance(); $arrNewElementData = $objElement->loadElementData(); $arrElementData["content_id"] = $arrNewElementData["content_id"]; $arrElementData["page_element_id"] = $arrNewElementData["page_element_id"]; $arrElementData["system_id"] = $arrNewElementData["system_id"]; $objElement->setArrParamData($arrElementData); //try to find setters to inject the values $objAnnotation = new class_reflection($objElement); $arrMappedProperties = $objAnnotation->getPropertiesWithAnnotation(class_orm_base::STR_ANNOTATION_TABLECOLUMN); foreach ($arrElementData as $strColumn => $strValue) { foreach ($arrMappedProperties as $strPropertyname => $strAnnotation) { $strMappedColumn = uniSubstr($strAnnotation, uniStrpos($strAnnotation, ".") + 1); if ($strColumn == $strMappedColumn) { $objSetter = $objAnnotation->getSetter($strPropertyname); if ($objSetter != null) { call_user_func_array(array($objElement, $objSetter), array($strValue)); } } } } $objElement->doBeforeSaveToDb(); $objElement->updateForeignElement(); $objElement->doAfterSaveToDb(); $this->objDB->transactionCommit(); return $this; }
/** * Encrypts the password, e.g. in order to be validated during logins * * @param string $strPassword * @param string $strSalt * @param bool $bitMD5Encryption * * @return string */ public static function encryptPassword($strPassword, $strSalt = "", $bitMD5Encryption = false) { if ($bitMD5Encryption) { class_logger::getInstance(class_logger::USERSOURCES)->addLogRow("usage of old md5-encrypted password!", class_logger::$levelWarning); return md5($strPassword); } if ($strSalt == "") { return sha1($strPassword); } else { return sha1(md5($strSalt) . $strPassword); } }
/** * Deletes the given group * * @return bool */ public function deleteGroup() { class_logger::getInstance()->addLogRow("deleted ldap group with id " . $this->getSystemid(), class_logger::$levelInfo); $strQuery = "DELETE FROM " . _dbprefix_ . "user_group_ldap WHERE group_ldap_id=?"; class_core_eventdispatcher::getInstance()->notifyGenericListeners(class_system_eventidentifier::EVENT_SYSTEM_RECORDDELETED, array($this->getSystemid(), get_class($this))); return $this->objDB->_pQuery($strQuery, array($this->getSystemid())); }
/** * 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; }
/** * Runs a single workflow. * @param class_module_workflows_workflow $objOneWorkflow */ public function runSingleWorkflow($objOneWorkflow) { $objHandler = $objOneWorkflow->getObjWorkflowHandler(); if ($objOneWorkflow->getIntState() != class_module_workflows_workflow::$INT_STATE_SCHEDULED) { return; } //trigger the workflow class_logger::getInstance(self::STR_LOGFILE)->addLogRow("executing workflow " . $objOneWorkflow->getSystemid(), class_logger::$levelInfo); if ($objHandler->execute()) { //handler executed successfully. shift to state 'executed' $objOneWorkflow->setIntState(class_module_workflows_workflow::$INT_STATE_EXECUTED); class_logger::getInstance(self::STR_LOGFILE)->addLogRow(" execution finished, new state: executed", class_logger::$levelInfo); } else { //handler failed to execute. reschedule. $objHandler->schedule(); $objOneWorkflow->setIntState(class_module_workflows_workflow::$INT_STATE_SCHEDULED); class_logger::getInstance(self::STR_LOGFILE)->addLogRow(" execution finished, new state: scheduled", class_logger::$levelInfo); } $objOneWorkflow->setIntRuns($objOneWorkflow->getIntRuns() + 1); $objOneWorkflow->updateObjectToDb(); }
/** * Renames a constant in the database. * * @param string $strNewName * * @return bool */ public function renameConstant($strNewName) { class_logger::getInstance()->addLogRow("renamed constant " . $this->getStrName() . " to " . $strNewName, class_logger::$levelInfo); $strQuery = "UPDATE " . _dbprefix_ . "system_config\n SET system_config_name = ? WHERE system_config_name = ?"; $bitReturn = $this->objDB->_pQuery($strQuery, array($strNewName, $this->getStrName())); $this->strName = $strNewName; return $bitReturn; }
/** * Imports the given dump * * @param string $strFilename * * @return bool */ public function importDb($strFilename) { if (!$this->bitConnected) { $this->dbconnect(); } //gz file? $bitGzip = false; if (substr($strFilename, -3) == ".gz") { $bitGzip = true; //try to decompress $objGzip = new class_gzip(); try { if ($objGzip->decompressFile(_projectpath_ . "/dbdumps/" . $strFilename)) { $strFilename = substr($strFilename, 0, strlen($strFilename) - 3); } else { class_logger::getInstance(class_logger::DBLOG)->addLogRow("Failed to decompress (gzip) the file " . basename($strFilename) . "", class_logger::$levelWarning); return false; } } catch (class_exception $objExc) { $objExc->processException(); return false; } } $bitImport = $this->objDbDriver->dbImport(_projectpath_ . "/dbdumps/" . $strFilename); //Delete source unzipped file? if ($bitGzip) { $objFilesystem = new class_filesystem(); $objFilesystem->fileDelete(_projectpath_ . "/dbdumps/" . $strFilename); } if ($bitImport) { class_logger::getInstance(class_logger::DBLOG)->addLogRow("DB-DUMP " . $strFilename . " was restored", class_logger::$levelWarning); } else { class_logger::getInstance(class_logger::DBLOG)->addLogRow("Error restoring DB-DUMP " . $strFilename, class_logger::$levelError); } return $bitImport; }
/** * @param $strText * @param $strModule * @param $strArea * * @return string * @deprecated use getLang() instead */ public function getText($strText, $strModule, $strArea) { class_logger::getInstance(class_logger::SYSTEMLOG)->addLogRow("deprecated class_lang::getText call, params: " . $strText . ", " . $strModule . ", " . $strArea, class_logger::$levelWarning); return $this->getLang($strText, $strModule); }
/** * Executes a systemtask. * Returns the progress-info or the error-/success message and the reload-infos using a * custom xml-structure: * <statusinfo></statusinfo><reloadurl></reloadurl> * * @return string * @permissions right2 */ protected function actionExecuteSystemTask() { $strReturn = ""; $strTaskOutput = ""; if ($this->getParam("task") != "") { //include the list of possible tasks //TODO: move to common helper, see class_module_system_admin $arrFiles = class_resourceloader::getInstance()->getFolderContent("/admin/systemtasks/", array(".php"), false, function ($strOneFile) { if ($strOneFile != "class_systemtask_base.php" && $strOneFile != "interface_admin_systemtask.php") { $strOneFile = uniSubstr($strOneFile, 0, -4); $strOneFile = new $strOneFile(); if ($strOneFile instanceof interface_admin_systemtask) { return true; } } return false; }, function (&$strOneFile) { $strOneFile = uniSubstr($strOneFile, 0, -4); $strOneFile = new $strOneFile(); }); //search for the matching task /** @var interface_admin_systemtask|class_systemtask_base $objTask */ foreach ($arrFiles as $objTask) { //instantiate the current task if ($objTask->getStrInternalTaskname() == $this->getParam("task")) { class_logger::getInstance(class_logger::ADMINTASKS)->addLogRow("executing task " . $objTask->getStrInternalTaskname(), class_logger::$levelWarning); //let the work begin... $strTempOutput = trim($objTask->executeTask()); //progress information? if ($objTask->getStrProgressInformation() != "") { $strTaskOutput .= $objTask->getStrProgressInformation(); } if (is_numeric($strTempOutput) && ($strTempOutput >= 0 && $strTempOutput <= 100)) { $strTaskOutput .= "<br />" . $this->getLang("systemtask_progress") . "<br />" . $this->objToolkit->percentBeam($strTempOutput, 400); } else { $strTaskOutput .= $strTempOutput; } //create response-content $strReturn .= "<statusinfo>" . $strTaskOutput . "</statusinfo>\n"; //reload requested by worker? if ($objTask->getStrReloadUrl() != "") { $strReturn .= "<reloadurl>" . ("&task=" . $this->getParam("task") . $objTask->getStrReloadParam()) . "</reloadurl>"; } break; } } } return $strReturn; }
/** * Creates a form to enter the new password of the account to reset. * * @return string */ private function newPwdForm() { $strReturn = ""; if ($this->getParam("reset") != "" && getPost("reset") != "") { //try to load the user $objUser = new class_module_user_user($this->getParam("systemid")); if ($objUser->getStrAuthcode() != "" && $objUser->getStrAuthcode() == $this->getParam("authcode") && $objUser->getStrUsername() != "") { //check the submitted passwords. $strPass1 = trim($this->getParam("portallogin_password1")); $strPass2 = trim($this->getParam("portallogin_password2")); $objValidator = new class_text_validator(); if ($strPass1 == $strPass2 && $objValidator->validate($strPass1)) { if ($objUser->getObjSourceUser()->isPasswordResettable() && method_exists($objUser->getObjSourceUser(), "setStrPass")) { $objUser->getObjSourceUser()->setStrPass($strPass1); $objUser->getObjSourceUser()->updateObjectToDb(); } $objUser->setStrAuthcode(""); $objUser->updateObjectToDb(); class_logger::getInstance(class_logger::USERSOURCES)->addLogRow("changed password of user " . $objUser->getStrUsername(), class_logger::$levelInfo); $strReturn .= $this->getLang("resetSuccess"); } else { $strReturn .= $this->getLang("resetError"); } } else { $strReturn .= $this->getLang("resetError"); } } else { $strTemplateID = $this->objTemplate->readTemplate("/element_portallogin/" . $this->arrElementData["portallogin_template"], "portallogin_newpwdform"); $arrTemplate = array(); //check sysid & authcode $objUser = new class_module_user_user($this->getParam("systemid")); if ($objUser->getStrAuthcode() != "" && $objUser->getStrAuthcode() == $this->getParam("authcode")) { $arrTemplate["portallogin_action"] = "portalResetPwd"; $arrTemplate["portallogin_systemid"] = $this->getParam("systemid"); $arrTemplate["portallogin_authcode"] = $this->getParam("authcode"); $arrTemplate["portallogin_resetHint"] = "portalLoginReset"; $arrTemplate["portallogin_elsystemid"] = $this->arrElementData["content_id"]; $arrTemplate["action"] = class_link::getLinkPortalHref($this->getPagename()); $strReturn .= $this->fillTemplate($arrTemplate, $strTemplateID); } else { $strReturn .= "Permission Error"; } } return $strReturn; }
/** * Creates a form in order to change the password - if the authcode is valid * * @return string */ protected function actionPwdReset() { $strReturn = ""; if (!validateSystemid($this->getParam("systemid"))) { return $this->getLang("login_change_error", "user"); } $objUser = new class_module_user_user($this->getParam("systemid")); if ($objUser->getStrAuthcode() != "" && $this->getParam("authcode") == $objUser->getStrAuthcode() && $objUser->getStrUsername() != "") { if ($this->getParam("reset") == "") { //Loading a small form to change the password $strTemplateID = $this->objTemplate->readTemplate("/elements.tpl", "login_form"); $arrTemplate = array(); $strForm = ""; $strForm .= $this->objToolkit->getTextRow($this->getLang("login_password_form_intro", "user")); $strForm .= $this->objToolkit->formHeader(class_link::getLinkAdminHref($this->getArrModule("modul"), "pwdReset")); $strForm .= $this->objToolkit->formInputText("username", $this->getLang("login_loginUser", "user"), "", "inputTextShort"); $strForm .= $this->objToolkit->formInputPassword("password1", $this->getLang("login_loginPass", "user"), "", "inputTextShort"); $strForm .= $this->objToolkit->formInputPassword("password2", $this->getLang("login_loginPass2", "user"), "", "inputTextShort"); $strForm .= $this->objToolkit->formInputSubmit($this->getLang("login_changeButton", "user"), "", "", "inputSubmitShort"); $strForm .= $this->objToolkit->formInputHidden("reset", "reset"); $strForm .= $this->objToolkit->formInputHidden("authcode", $this->getParam("authcode")); $strForm .= $this->objToolkit->formInputHidden("systemid", $this->getParam("systemid")); $strForm .= $this->objToolkit->formClose(); $arrTemplate["form"] = $strForm; $arrTemplate["loginTitle"] = $this->getLang("login_loginTitle", "user"); $arrTemplate["loginJsInfo"] = $this->getLang("login_loginJsInfo", "user"); $arrTemplate["loginCookiesInfo"] = $this->getLang("login_loginCookiesInfo", "user"); //An error occurred? if ($this->getParam("loginerror") == 1) { $arrTemplate["error"] = $this->getLang("login_loginError", "user"); } $strReturn = $this->objTemplate->fillTemplate($arrTemplate, $strTemplateID); } else { //check the submitted passwords. $strPass1 = trim($this->getParam("password1")); $strPass2 = trim($this->getParam("password2")); if ($strPass1 == $strPass2 && checkText($strPass1, 3, 200) && $objUser->getStrUsername() == $this->getParam("username")) { if ($objUser->getObjSourceUser()->isPasswordResettable() && method_exists($objUser->getObjSourceUser(), "setStrPass")) { $objUser->getObjSourceUser()->setStrPass($strPass1); $objUser->getObjSourceUser()->updateObjectToDb(); } $objUser->setStrAuthcode(""); $objUser->updateObjectToDb(); class_logger::getInstance()->addLogRow("changed password of user " . $objUser->getStrUsername(), class_logger::$levelInfo); $strReturn .= $this->getLang("login_change_success", "user"); } else { $strReturn .= $this->getLang("login_change_error", "user"); } } } else { $strReturn .= $this->getLang("login_change_error", "user"); } return $strReturn; }