/** * Generate a HTML header, containing DOCTYPE, head- and meta-tags, JavaScript-includes and title. * @param string $Title * @param User $CurrentUser * @return string */ public static function HtmlHeader($Title = NULL, $CurrentUser = NULL) { global $lang; $Output = sprintf("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n\t\t<html xmlns=\"http://www.w3.org/1999/xhtml\">\n\n\t\t<head>\n\t\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n\t\t<meta name=\"language\" content=\"%5\$s\" />\n\t\t<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n\t\t\n\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\" title=\"CandyDoll DB\" />\n\t\t<link rel=\"shortcut icon\" href=\"favicon.ico\" />\n\t\t<link rel=\"icon\" href=\"favicon.ico\" />\n\t\t\n\t\t<script type=\"text/javascript\" src=\"js/jquery.min.js\"></script>\n\t\t<script type=\"text/javascript\" src=\"js/jquery.ba-outside-events.js\"></script>\n\t\t<script type=\"text/javascript\">\n\t\t\t//<![CDATA[\n\t\t\t\tvar ColorBoxI18N = {\n\t\t\t\t\tcurrent: '%6\$s',\n\t\t\t\t\tprevious: '%7\$s',\n\t\t\t\t\tnext: '%8\$s',\n\t\t\t\t\tclose: '%9\$s'\n\t\t\t\t};\n\t\t\t\tvar CacheDeletePermission = %11\$s;\n\t\t\t//]]>\n\t\t</script>\n\t\t<script type=\"text/javascript\" src=\"js/candydolldb.js\"></script>\n\n\t\t<title>CandyDoll DB v%1\$s%2\$s</title>\n\t\t</head>\n\n\t\t<body>\n\t\t\n\t\t<h1 class=\"Hidden\">CandyDollDB v%1\$s%2\$s</h1>\n\t\t%3\$s\n\t\t%10\$s\n\t\t\n\t\t<div id=\"Wrapper\">\n\t\t<div id=\"Header\">\n\t\t</div>\n\t\t\n\t\t<div id=\"ContentBG\">\n\t\t<div id=\"Content\">", CANDYDOLLDB_VERSION, $Title ? ' :: ' . htmlentities($Title) : NULL, Error::GenerateErrorList(), isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http', $CurrentUser != NULL ? $CurrentUser->getLanguage() : 'en', $lang->g('LabelColorBoxCurrent'), $lang->g('LabelColorBoxPrevious'), $lang->g('LabelColorBoxNext'), $lang->g('LabelColorBoxClose'), Info::GenerateInfoList(), !is_null($CurrentUser) && $CurrentUser->hasPermission(RIGHT_CACHE_DELETE) ? 'true' : 'false'); if ($CurrentUser != NULL) { $Output .= sprintf("\n\t\t\t<ul id=\"TopNavigation\">\n\t\t\t<li><a href=\"index.php\">%2\$s</a></li>\n\t\t\t<li><a href=\"#\">%3\$s</a>\n\t\t\n\t\t\t\t<ul>\n\t\t\t\t<li><a href=\"%15\$s\">%4\$s</a></li>\n\t\t\t\t<li><a href=\"%16\$s\">%5\$s</a></li>\n\t\t\t\t<li><a href=\"tag.php\">%6\$s</a></li>\n\t\t\t\t<li><a href=\"admin_panel.php\">%7\$s</a></li>\n\t\t\t\t<li><a href=\"%17\$s\">%8\$s</a></li>\n\t\t\t\t</ul>\n\t\t\n\t\t\t</li>\n\t\t\t<li><a href=\"user.php\">%9\$s</a>\n\t\t\t\n\t\t\t\t<ul>\n\t\t\t\t<li><a href=\"user_view.php?user_id=%1\$d\">%10\$s</a></li>\n\t\t\t\t</ul>\n\t\t\t\n\t\t\t</li>\n\t\t\t<li><a href=\"#\">%11\$s</a>\n\t\t\t\t\n\t\t\t\t<ul>\n\t\t\t\t<li><a href=\"%18\$s\">%12\$s</a></li>\n\t\t\t\t<li><a href=\"%19\$s\">%13\$s</a></li>\n\t\t\t\t</ul>\t\n\t\t\t\n\t\t\t</li>\n\t\t\t<li><a href=\"logout.php\">%14\$s</a></li>\n\t\t\t</ul>", $CurrentUser->getID(), $lang->g('NavigationHome'), $lang->g('NavigationFeatures'), $lang->g('NavigationImportXML'), $lang->g('NavigationNewModel'), $lang->g('NavigationManageTags'), $lang->g('NavigationAdminPanel'), $lang->g('NavigationMultiDownload'), $lang->g('NavigationUsers'), $lang->g('NavigationMyAccount'), $lang->g('NavigationSearch'), $lang->g('NavigationTagSearch'), $lang->g('NavigationDirtySets'), $lang->g('NavigationLogOut'), $CurrentUser->hasPermission(RIGHT_IMPORT_XML) ? 'import_xml.php' : '#', $CurrentUser->hasPermission(RIGHT_MODEL_ADD) ? 'model_view.php' : '#', $CurrentUser->hasPermission(RIGHT_EXPORT_ZIP_MULTI) ? 'download_multi.php' : '#', $CurrentUser->hasPermission(RIGHT_SEARCH_TAGS) ? 'search.php?q=' : '#', $CurrentUser->hasPermission(RIGHT_SEARCH_DIRTY) ? 'set_dirty.php' : '#'); } return $Output; }
public function setUser(User $user) { $this->user = $user; Zend_Registry::set("pimcore_user", $this->user); $this->setLanguage($this->user->getLanguage()); }
$torrent->download((int) $params[2], $params[3]); break; case validateRoute('GET', 'rss'): $rss = new Rss($db); $rss->renderRssFeed($_GET); die; break; case validateRoute('GET', 'watcher-rss'): $watching = new Watching($db); $watching->renderRssFeed($_GET); die; break; } /* Login check before the following routes */ $user->loginCheck(); L::setDefaultLanguage($user->getLanguage()); switch (true) { case validateRoute('GET', 'status'): /* IP change check and logging */ if ($user->getClass() < User::CLASS_MOVIE_STAR && ((int) $_GET["timeSinceLastCheck"] < 5100 || $user->getBrowserIp() !== $user->getIp())) { $user->logIp(); } /* Only update last access if user refreshed a page recently */ if ((int) $_GET["timeSinceLastCheck"] < 5100) { $user->updateLastAccess(); } httpResponse($user->getStatus()); break; case validateRoute('GET', 'rules'): $rules = new Rules($db); httpResponse($rules->query());
public function go() { header("Content-Type: text/html; charset=UTF-8"); // Import Libraries \framework\import("org.yeager.framework.tools.password"); \framework\import("org.yeager.ui.common"); \framework\import("org.yeager.ui.koala"); \framework\import("org.yeager.ui.icons"); \framework\import("org.yeager.framework.tools.password"); \framework\import("org.yeager.framework.tools.http.redirect"); \framework\import("org.yeager.framework.tools.http.byteserve"); \framework\import("org.yeager.core.versionable"); \framework\import("org.yeager.core.tree"); \framework\import("org.yeager.core.permissions"); \framework\import("org.yeager.core.privileges"); \framework\import("org.yeager.core.propertysettings"); \framework\import("org.yeager.core.properties"); \framework\import("org.yeager.core.history"); \framework\import("org.yeager.core.jsqueue"); \framework\import("org.yeager.core.tags"); \framework\import("org.yeager.core.comments"); \framework\import("org.yeager.core.cblock"); \framework\import("org.yeager.core.cblockmgr"); \framework\import("org.yeager.core.entrymasks"); \framework\import("org.yeager.core.page"); \framework\import("org.yeager.core.pagemgr"); \framework\import("org.yeager.core.file"); \framework\import("org.yeager.core.filemgr"); \framework\import("org.yeager.core.filetypes"); \framework\import("org.yeager.core.views"); \framework\import("org.yeager.core.mailing"); \framework\import("org.yeager.core.mailingmgr"); \framework\import("org.yeager.core.templates"); \framework\import("org.yeager.core.usergroups"); \framework\import("org.yeager.core.sites"); \framework\import("org.yeager.core.languages"); \framework\import("org.yeager.core.reftracker"); \framework\import("org.yeager.core.scheduler"); \framework\import("org.yeager.core.extensionmgr"); \framework\import("org.yeager.core.extensions"); \framework\import("org.yeager.core.fileprocessor"); \framework\import("org.yeager.core.cblockprocessor"); \framework\import("org.yeager.core.emailprocessor"); \framework\import("org.yeager.core.pageprocessor"); \framework\import("org.yeager.core.user"); \framework\import("org.yeager.core.usermgr"); \framework\import("org.yeager.core.tree"); \framework\import('org.yeager.core.updater'); \framework\import('org.yeager.core.archive'); // Set UTF8 for DB Singleton::YDB()->Execute("SET NAMES 'utf8';"); // Set ADODB-Fetchmode to ADODB_FETCH_ASSOC Singleton::YDB()->SetFetchMode(ADODB_FETCH_ASSOC); // Create instance of Koala class $koala = new Koala($this->yeager); $username = $this->session->getSessionVar("username"); $password = $this->session->getSessionVar("password"); Singleton::register("session", $this->session); Singleton::register("request", $this->request); Singleton::register("config", $this->config); Singleton::register("UserMgr", new UserMgr()); Singleton::register("guiUS", $this->request->parameters['us']); Singleton::register("guiLH", $this->request->parameters['lh']); // Get frontend timezone $this->frontendTimezone = (string) Singleton::config()->getVar('CONFIG/TIMEZONES/FRONTEND'); if (!$this->frontendTimezone) { $this->frontendTimezone = 'Europe/Berlin'; } $userID = Singleton::UserMgr()->validate($username, $password); Singleton::register("Usergroups", new Usergroups()); if (!$userID) { $userID = Singleton::UserMgr()->getAnonymousID(); $this->authenticated = false; } else { $this->authenticated = true; if ($userID != Singleton::UserMgr()->getAnonymousID()) { $this->session->setPSessionVar("username", $username); $this->session->setPSessionVar("password", $password); $this->session->setPSessionVar("userid", $userID); $this->session->setPSessionVar("isvalidated", true); } if ($this->session->getSessionVar('keepLoggedIn')) { $this->session->cookie_time = time() + 60 * 60 * 24 * 365; } else { $cookie_time = (int) Singleton::config()->getVar("CONFIG/SESSION/COOKIES/TIME"); $this->session->cookie_time = $cookie_time; } } // write roles to sessions for cachekey $user = new User($userID); $roles = $user->getUsergroupIDs(); if ($userID != Singleton::UserMgr()->getAnonymousID()) { $this->session->setPSessionVar("userroles", $roles); $this->session->setPSessionVar("userid", $userID); $this->session->setCookie("yg-userid", $userID); $roleHash = ""; foreach ($roles as $r) { $roleHash .= $r["ID"] . "x"; } $this->session->setCookie("yg-userroles", $roleHash); } elseif ($_COOKIE['yg-userid']) { // remove cookie if set $this->session->removeCookie("yg-userid"); $this->session->removeCookie("yg-userroles"); } $backendAllowed = $user->checkPermission('RBACKEND'); if ((!$this->authenticated || !$backendAllowed) && $this->frontendMode != 'true') { if ($this->page != 'responder' && ($this->request->parameters['handler'] != 'userLogin' || $this->request->parameters['handler'] != 'recoverLogin' || $this->request->parameters['handler'] != 'setNewPassword')) { $header = $_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden'; header($header); echo $header; die; } } $user_timezone = $user->properties->getValue('TIMEZONE'); $timezoneAbbreviations = timezone_abbreviations_list(); foreach ($timezoneAbbreviations as $timezoneAbbreviations_item) { foreach ($timezoneAbbreviations_item as $timezone_item) { if ($timezone_item['timezone_id'] == $user_timezone) { global $tz; $tz = $timezone_item; } } } Singleton::register("Tags", new Tags()); Singleton::register("cbMgr", new CblockMgr()); Singleton::register("fileMgr", new FileMgr()); Singleton::register("sites", new Sites()); Singleton::register("templates", new Templates()); Singleton::register("entrymasks", new Entrymasks()); Singleton::register("mailingMgr", new MailingMgr()); Singleton::register("comments", new Comments()); Singleton::register("filetypes", new Filetypes()); Singleton::register("views", new Views()); Singleton::register("app", $this); Singleton::register("koala", $koala); $versioninfo = new Updater(); $versionp = $versioninfo->current_version_string; $this->yeager_version = $versionp; $this->yeager_revision = substr(YEAGER_REVISION, 4, 7); //$this->yeager_date = YEAGER_DATE; // get page to display if (empty($this->page)) { $this->page = "default"; } if (empty($this->action)) { $this->action = $this->request->parameters['action']; } $this->base = $this->request->script_name . "/" . strtolower($this->applicationname); /* yeager */ $this->docpath = Singleton::config()->getVar('CONFIG/DIRECTORIES/DOCPATH'); $this->docabsolut = $this->baseabsolut = $this->request->prefix . "://" . $this->request->http_host . $this->docpath; $this->imgpath = $this->request->prefix . "://" . $this->request->http_host . $this->docpath . "ui/img/"; $this->doc = $this->app_httproot; $this->sid = $this->session->id; $this->sidparam = "sid=" . $this->sid; // Regular Expressions for URL parsing $internalprefix = str_replace('/', '\\/', Singleton::config()->getVar('CONFIG/REFTRACKER/INTERNALPREFIX')); $this->URLRegEx1 = '/(.*)' . $internalprefix . '([a-z]*)\\/([0-9]*)(\\/*)(.*)/'; $this->URLRegEx2 = '/(.*)' . $internalprefix . '([a-z]*)\\/([0-9]*)\\/([0-9]*)(\\/*)(.*)/'; $filesdir = Singleton::config()->getVar('CONFIG/DIRECTORIES/FILESDIR'); $filesdoc = Singleton::config()->getVar('CONFIG/DIRECTORIES/FILESDOC'); $userpicdir = Singleton::config()->getVar('CONFIG/DIRECTORIES/USERPICDIR'); $embeddedCblockFolder = (int) Singleton::config()->getVar("CONFIG/EMBEDDED_CBLOCKFOLDER"); if (strlen($filesdir) < 1) { $filesdir = "files/"; } if (strlen($userpicdir) < 1) { $userpicdir = $filesdir; } if (strlen($filesdoc) < 1) { $filesdoc = "/yeager/files/"; } if (strlen($embeddedCblockFolder) < 1 || $embeddedCblockFolder == 99999) { throw new Exception("No or wrong blindfolder configured!"); } $this->filesdir = $filesdir; $this->filesdoc = $filesdoc; $this->userpicdir = $userpicdir; $this->modules = Singleton::config()->getVars("CONFIG/MODULES"); $this->files_procs = array_merge(Singleton::config()->getVars("CONFIG/FILES_PROCESSORS"), Singleton::config()->getVars("CONFIG/FILE_PROCESSORS")); $this->page_procs = Singleton::config()->getVars("CONFIG/PAGE_PROCESSORS"); $this->cblock_procs = Singleton::config()->getVars("CONFIG/CBLOCK_PROCESSORS"); $this->email_procs = Singleton::config()->getVars("CONFIG/EMAIL_PROCESSORS"); $this->filesprocdir = (string) Singleton::config()->getVar("CONFIG/DIRECTORIES/FILES_PROCS"); $this->pageprocdir = (string) Singleton::config()->getVar("CONFIG/DIRECTORIES/PAGE_PROCS"); $this->cblockprocdir = (string) Singleton::config()->getVar("CONFIG/DIRECTORIES/CBLOCK_PROCS"); $this->emailprocdir = (string) Singleton::config()->getVar("CONFIG/DIRECTORIES/EMAIL_PROCS"); $this->templates = new Templates(); $this->templatedir = $this->approot . (string) Singleton::config()->getVar('CONFIG/DIRECTORIES/TEMPLATEDIR'); $this->templatedoc = (string) Singleton::config()->getVar('CONFIG/DIRECTORIES/TEMPLATEDOC'); $this->templatedirabsolut = $this->request->prefix . "://" . $this->request->http_host . $this->templatedoc; $this->extensiondir = (string) Singleton::config()->getVar('CONFIG/DIRECTORIES/EXTENSIONSDIR'); $this->extensiondoc = (string) Singleton::config()->getVar('CONFIG/DIRECTORIES/EXTENSIONSDOC'); $this->processordir = (string) Singleton::config()->getVar('CONFIG/DIRECTORIES/PROCESSORSDIR'); $this->webroot = "/" . rtrim(ltrim((string) Singleton::config()->getVar("CONFIG/DIRECTORIES/WEBROOT"), '/'), '/') . '/'; if ($this->webroot == "//") { $this->webroot = "/"; } $this->devmode = (string) Singleton::config()->getVar('CONFIG/DEVMODE'); $this->languages = new Languages(); $forceLangInclude = (string) Singleton::config()->getVar('CONFIG/PAGES/' . strtoupper($this->page) . '/FORCE_LANG_INCLUDE'); if ($this->frontendMode != 'true' || $forceLangInclude == 'true') { // Read default language from config-file if ($this->authenticated) { $user = new User(Singleton::UserMgr()->getCurrentUserID()); $langid = $user->getLanguage(); $langinfo = $this->languages->get($langid); $lang = $langinfo["CODE"]; } else { // Check if we have a language which matches the browser-language $browserLanguages = array(); $tmpBrowserLanguages = explode(',', strtoupper(str_replace(' ', '', $_SERVER["HTTP_ACCEPT_LANGUAGE"]))); foreach ($tmpBrowserLanguages as $tmpBrowserLanguage) { array_push($browserLanguages, substr($tmpBrowserLanguage, 0, 2)); } $browserLanguages = array_values(array_unique($browserLanguages)); foreach ($browserLanguages as $browserLanguage) { if (!$lang) { if (file_exists($this->approot . "ui/lang/" . $browserLanguage . ".php")) { $lang = $browserLanguage; } } } } // When everything fails, fallback to default language if (strlen($lang) < 1) { $defaultLanguage = Singleton::config()->getVar('CONFIG/DEFAULT_LANGUAGE'); $lang = $defaultLanguage ? $defaultLanguage : 'DE'; } require_once $this->approot . "ui/lang/" . $lang . ".php"; } $this->itext =& $itext; Singleton::register("itext", $itext); if (!is_readable($this->page_file) || is_dir($this->page_file)) { $this->error->raise("Page " . $this->page . "'s code (" . $this->page_file . ") not found.", ERR_DEBUG); } else { $this->error->raise("loading " . $this->page_file, ERR_DEBUG); if ($this->page_template != "") { require_once "libs/org/smarty/libs/Smarty.class.php"; $smarty = new Smarty(); $this->smarty = $smarty; $smarty->compile_check = true; $smarty->debugging = false; $smarty->use_sub_dirs = false; // FIXME move to installer @mkdir($this->tmpdir . 'templates_compile', 0700); @mkdir($this->tmpdir . 'templates_cache', 0700); $smarty->compile_dir = $this->tmpdir . 'templates_compile'; $smarty->cache_dir = $this->tmpdir . 'templates_cache'; $smarty->force_compile = (string) $this->config->getVar('CONFIG/CACHE/SMARTY_FORCECOMPILE'); $smarty->caching = 0; $smarty->load_filter('output', 'trimwhitespace'); $smarty->assign("yeager_version", $this->yeager_version); $smarty->assign("yeager_revision", $this->yeager_revision); //$smarty->assign("yeager_date",$this->yeager_date); $smarty->assign("lang", $lang); $smarty->assign("docabsolut", $this->docabsolut); $smarty->assign("baseabsolut", $this->baseabsolut); $smarty->assign("imgpath", $this->imgpath); $smarty->assign("internalprefix", (string) Singleton::config()->getVar('CONFIG/REFTRACKER/INTERNALPREFIX')); $smarty->assign("request_prefix", $this->request->prefix); $smarty->assign("extensiondoc", $this->extensiondoc); $smarty->assign("extensiondir", $this->extensiondir); $smarty->assign("is_authenticated", $this->authenticated); $smarty->assign("base", $this->base); $smarty->assign("page", $this->page); $smarty->assign("sid", $this->sid); $smarty->assign("sidparam", $this->sidparam); $smarty->assign("templatedir", $this->templatedir); $smarty->assign("templatedoc", $this->templatedoc); $smarty->assign("templatedirabsolut", $this->templatedirabsolut); $smarty->assign("approot", getRealpath($this->approot)); $smarty->assign("devmode", $this->devmode); $smarty->assign("webroot", $this->webroot); $smarty->assign("URLRegEx1", $this->URLRegEx1); require_once $this->approot . "libs/org/yeager/ui/smarty_modifiers.php"; } $smarty->assign("itext", $itext); Singleton::register("smarty", $smarty); if ($_SERVER['HTTP_X_YEAGER_AUTHENTICATION'] == 'suppress') { $authHeader = 'X-Yeager-Authenticated: delayed'; } else { $authHeader = 'X-Yeager-Authenticated: ' . ($this->authenticated ? 'true' : 'false'); } header($authHeader); if ($this->frontendMode == "true" && $this->cached) { // capture ob include_once $this->page_file; $output = ob_get_clean(); Singleton::FC()->write("output", $output); Singleton::FC()->flush(); echo $output; } else { include_once $this->page_file; } if ($this->frontendMode != 'true') { $koala->getQueuedCommands(); $koala->go(); } } }
<?php $userid = $this->request->parameters['userid']; $user = new User($userid); $userinfo = $user->get(); $userinfo['PROPS'] = $user->properties->getValues($userid); $userinfo['LANGUAGE'] = $user->getLanguage(); $userroles = $user->getUsergroups($userid); $languageMgr = new Languages(); $languages = $languageMgr->getList(); $userpicture = sUserMgr()->getUserImage($userid, 48, 48); if (!$userpicture) { $userpicture = $this->imgpath . 'content/temp_userpic.png'; } $koala->queueScript('Koala.windows[\'wid_' . $this->request->parameters['win_no'] . '\'].setUserHeader(\'' . $userpicture . '\',\'' . $userinfo['PROPS']['FIRSTNAME'] . ' ' . $userinfo['PROPS']['LASTNAME'] . '\',\'' . $userinfo['PROPS']['COMPANY'] . '\', \'' . $userinfo['ID'] . '\');'); $smarty->assign('userinfo', $userinfo); $smarty->assign('userroles', $userroles); $smarty->assign('userpicture', $userpicture); $smarty->assign("win_no", $this->request->parameters['win_no']); $smarty->display('file:' . $this->page_template);
/** * Update one User in the database * * @author Jonathan Sandoval <*****@*****.**> * @param User $User The User to update * @return boolean If was possible to update */ static function updateUser($User = null) { if ($User === null) { return false; } $tableUser = DatabaseManager::getNameTable('TABLE_USER'); $id = $User->getId(); $username = $User->getUsername(); $type = $User->getType(); $password = $User->getPassword(); $User->getIdChurch() == 0 ? $idChurch = 'null' : ($idChurch = $User->getIdChurch()); $offline = $User->getOffline(); $lastAct = $User->getLastActivityTime(); $language = $User->getLanguage(); $idPaperConfig = $User->getIdPaperConfig(); $ip = $User->getAddressIP(); $query = "UPDATE {$tableUser}\r\n SET username = '******', type = '{$type}', password = '******', \r\n idChurch = {$idChurch}, offline = {$offline}, language = '{$language}',\r\n lastActivityTime = '{$lastAct}', idPaperConfig = {$idPaperConfig}, \r\n addressIP = '{$ip}'\r\n WHERE {$tableUser}.id = {$id}"; return DatabaseManager::singleAffectedRow($query); }
/** * Build the reminder messages * * @param Tracker_DateReminder $reminder Reminder that will send notifications * @param Tracker_Artifact $artifact Artifact for which reminders will be sent * @param Array $messages Messages * @param User $user Receipient * * return Array */ protected function buildMessage(Tracker_DateReminder $reminder, Tracker_Artifact $artifact, &$messages, $user) { $mailManager = new MailManager(); $recipient = $user->getEmail(); $lang = $user->getLanguage(); $format = $mailManager->getMailPreferencesByUser($user); //We send multipart mail: html & text body in case of preferences set to html $htmlBody = ''; if ($format == Codendi_Mail_Interface::FORMAT_HTML) { $htmlBody .= $this->getBodyHtml($reminder, $artifact, $user, $lang); } $txtBody = $this->getBodyText($reminder, $artifact, $user, $lang); $subject = $this->getSubject($reminder, $artifact, $user); $headers = array(); $hash = md5($htmlBody . $txtBody . serialize($headers) . serialize($subject)); if (isset($messages[$hash])) { $messages[$hash]['recipients'][] = $recipient; } else { $messages[$hash] = array('headers' => $headers, 'htmlBody' => $htmlBody, 'txtBody' => $txtBody, 'subject' => $subject, 'recipients' => array($recipient)); } }
/** * Show and process edit settings page * * @param void * @return null */ function edit_settings() { $this->wireframe->print_button = false; if ($this->active_user->isNew()) { $this->httpError(HTTP_ERR_NOT_FOUND); } // if if (!$this->active_user->canEdit($this->logged_user)) { $this->httpError(HTTP_ERR_FORBIDDEN); } // if $config_options = array('format_date', 'format_time', 'time_timezone', 'time_dst', 'time_first_week_day', 'visual_editor', 'theme', 'default_assignments_filter', 'generate_daily_mail'); if (LOCALIZATION_ENABLED) { $config_options[] = 'language'; } // if $user_data = $this->request->post('user'); if (!is_array($user_data)) { $user_data = array_merge(array('auto_assign' => $this->active_user->getAutoAssign(), 'auto_assign_role_id' => $this->active_user->getAutoAssignRoleId(), 'auto_assign_permissions' => $this->active_user->getAutoAssignPermissions()), UserConfigOptions::getValues($config_options, $this->active_user)); if (LOCALIZATION_ENABLED) { if (!UserConfigOptions::hasValue('language', $this->active_user)) { $user_data['language'] = null; } // if } // if if (!UserConfigOptions::hasValue('time_dst', $this->active_user)) { $user_data['time_dst'] = null; } // if if (!UserConfigOptions::hasValue('format_date', $this->active_user)) { $user_data['format_date'] = null; } // if if (!UserConfigOptions::hasValue('format_time', $this->active_user)) { $user_data['format_time'] = null; } // if if (!UserConfigOptions::hasValue('theme', $this->active_user)) { $user_data['theme'] = null; } // if if (!UserConfigOptions::hasValue('default_assignments_filter', $this->active_user)) { $user_data['default_assignments_filter'] = null; } // if } // if $this->smarty->assign(array('user_data' => $user_data, 'default_dst_value' => (bool) ConfigOptions::getValue('time_dst'))); if ($this->request->isSubmitted()) { db_begin_work(); $display = $this->active_user->getDisplayName(); $user_data['role_id'] = $this->active_user->getRoleId(); // role cannot be changed $this->active_user->setAttributes($user_data); if ($this->active_user->canChangeRole($this->logged_user)) { $this->active_user->setAutoAssignData((bool) array_var($user_data, 'auto_assign'), (int) array_var($user_data, 'auto_assign_role_id'), array_var($user_data, 'auto_assign_permissions')); } // if $save = $this->active_user->save(); if ($save && !is_error($save)) { foreach ($config_options as $config_option) { if ($config_option == 'time_dst') { $value = array_var($user_data, $config_option) === '' ? '' : (bool) array_var($user_data, $config_option); } elseif ($config_option == 'visual_editor') { $value = (bool) array_var($user_data, $config_option); } elseif ($config_option == 'generate_daily_mail') { $value = (bool) array_var($user_data, $config_option); } elseif ($config_option == 'time_timezone' || $config_option == 'time_first_week_day' || $config_option == 'default_assignments_filter') { $value = (int) array_var($user_data, $config_option); } else { $value = trim(array_var($user_data, $config_option)); } // if if ($config_option == 'default_assignments_filter' && $value == 0) { $value = ''; // Reset to default } // if if ($value === '') { UserConfigOptions::removeValue($config_option, $this->active_user); } else { $display_localized_message = false; if (LOCALIZATION_ENABLED && $this->logged_user->getId() == $this->active_user->getId() && $user_data['language'] !== UserConfigOptions::getValue('language', $this->active_user)) { $display_localized_message = true; } // if UserConfigOptions::setValue($config_option, $value, $this->active_user); } // if } // foreach db_commit(); flash_success(lang(":display's settings have been updated", array('display' => $this->active_user->getDisplayName()), true, $display_localized_message === true ? $this->active_user->getLanguage() : null), null, true); $this->redirectToUrl($this->active_user->getViewUrl()); } else { db_rollback(); $this->smarty->assign('errors', $save); } // if } // if }
$userpicture = $internPrefix . 'userimage/' . $object . '/48x48?rnd=' . rand(); } else { $userpicture = $this->imgpath . 'content/temp_userpic.png'; } $titlename = trim($firstname . ' ' . $lastname); if (strlen($titlename) == 0) { $titlename = $itext['TXT_UNKNOWN']; } $koala->queueScript('Koala.windows[\'wid_' . $this->request->parameters['win_no'] . '\'].setUserHeader(\'' . $userpicture . '\', \'' . $titlename . '\', \'' . $company . '\', \'' . $object . '\');'); $languageMgr = new Languages(); $languages = $languageMgr->getList(); $smarty->assign('languages', $languages); $smarty->assign('timezones', getTimezones()); $smarty->assign('visibleProps', $visibleProps); $smarty->assign('timezone', $timezone); $smarty->assign('language', $currentUser->getLanguage()); $smarty->assign('dateformat', $dateformat); $smarty->assign('timeformat', $timeformat); $smarty->assign('weekstart', $weekstart); $smarty->assign('userpicture', $userpicture . '?rnd=' . rand()); $smarty->assign('email', $email); $smarty->assign('company', $company); $smarty->assign('department', $department); $smarty->assign('firstname', $firstname); $smarty->assign('lastname', $lastname); $smarty->assign('phone', $phone); $smarty->assign('fax', $fax); $smarty->assign('mobile', $mobile); $smarty->assign('website', $website); $smarty->assign('password', $password); }
function testGetLanguageShouldUserLanguageFactoryIfNotDefined() { $langFactory = new MockBaseLanguageFactory(); $langFactory->expectOnce('getBaseLanguage', array('fr_BE')); $user = new User(array('language_id' => 'fr_BE')); $user->setLanguageFactory($langFactory); $user->getLanguage(); }
$value = str_replace('\\n', "\n", $value); } //$properties->setValue($propertyItem['IDENTIFIER'], $value); } } } break; case 'user': // Get the user $user = new User($data[0]); $objectInfo = $user->get(); // Get old property value & check if change is needed if (strtoupper($property) == 'PASSWORD') { $oldvalue = $objectInfo['PASSWORD']; } elseif (strtoupper($property) == 'LANGUAGE') { $oldvalue = $user->getLanguage(); } else { $oldvalue = $user->properties->getValueInternal(strtoupper($property)); } $value = str_replace("\r", '', str_replace("\n", '\\n', $this->reponsedata[$property]->value)); if ($value == ' ') { $value = ''; } if ($oldvalue == $value) { // No update needed, henceforth break break; } // Special case for email (check for uniqueness) if ($property == 'email') { $tmpUserinfo = sUserMgr()->getByEmail($value, true); if ($tmpUserinfo) {