/** * */ function getDefaultConfig () { $config = array( "name" => '', /* "order" => '|0|1|2|3|4|5|6|7|8', "visible" => '|1|1|1|1|1|1|1|1|1', "aliases" => '||'._("Lebenslauf").'|'._("Schwerpunkte").'|'._("Lehrveranstaltungen").'|' ._("Aktuell").'|'._("Termine").'|'._("Publikationen").'|'._("Literaturlisten").'|', */ "order" => '|0|1|2|3|4|5|6|7', "visible" => '|1|1|1|1|1|1|1|1', "aliases" => '||'._("Lebenslauf").'|'._("Schwerpunkte").'|'._("Lehrveranstaltungen").'|' ._("Aktuell").'|'._("Termine").'|'._("Publikationen").'|', "showcontact" => '1', "showimage" => 'right', "wholesite" => '0', "nameformat" => '', "dateformat" => '%d. %b. %Y', "language" => '', "studiplink" => 'top', "urlcss" => '', "title" => _("MitarbeiterInnen"), "copyright" => htmlReady($GLOBALS['UNI_NAME_CLEAN'] . " ({$GLOBALS['UNI_CONTACT']})"), "author" => '' ); get_default_generic_datafields($config, "user"); return $config; }
/** * Mapping function where to find what * @param type $object the object * @param type $function the called function * @return string output */ private static function map($object, $function) { /** * If you want to add an object to the helper simply add to this array */ $mapping = array('User' => array('link' => function ($obj) { return URLHelper::getLink('dispatch.php/profile', array('username' => $obj->username)); }, 'name' => function ($obj) { return htmlReady($obj->getFullname()); }, 'avatar' => function ($obj) { return Avatar::getAvatar($obj->id, $obj->username)->getImageTag(Avatar::SMALL, array('title' => htmlReady($obj->getFullname('no_title')))); }), 'Course' => array('link' => function ($obj) { return URLHelper::getLink('seminar_main.php', array('auswahl' => $obj->id)); }, 'name' => function ($obj) { return htmlReady($obj->name); }, 'avatar' => function ($obj) { return CourseAvatar::getAvatar($obj->id)->getImageTag($size = CourseAvatar::SMALL, array('title' => htmlReady($obj->name))); })); /* * Some php magic to call the right function if it exists */ if ($object && $mapping[get_class($object)]) { return $mapping[get_class($object)][$function]($object); } return ""; }
/** * Highlights the given needle in given subject with the given format. * * @param String $needle Search for this string... * @param String $subject ...inside this string... * @param String $format ...and replace it with this string (regexp * syntax) * * @return String containing the subject with highlighted needle */ private function highlight($needle, $subject, $format = '<b>$0</b>') { $needle = htmlReady($needle); $subject = htmlReady($subject); $regexp = '/' . preg_quote($needle, '/') . '/i'; return preg_replace($regexp, $format, $subject); }
/** * This function is called before any output is generated or any other * actions are performed. Initializations happen here. * * @param $action Name of the action to perform * @param $args Arguments for the given action */ public function before_filter(&$action, &$args) { parent::before_filter($action, $args); $this->modules = array(); // Set Navigation PageLayout::setHelpKeyword("Basis.ProfileModules"); PageLayout::setTitle(_("Mehr Funktionen")); PageLayout::addSqueezePackage('lightbox'); Navigation::activateItem('/profile/modules'); // Get current user. $this->username = Request::username('username', $GLOBALS['user']->username); $this->user_id = get_userid($this->username); $this->plugins = array(); $blubber = PluginEngine::getPlugin('Blubber'); // Add blubber to plugin list so status can be updated. if ($blubber) { $this->plugins[] = $blubber; } // Get homepage plugins from database. $this->plugins = array_merge($this->plugins, PluginEngine::getPlugins('HomepagePlugin')); // Show info message if user is not on his own profile if ($this->user_id != $GLOBALS['user']->id) { $current_user = User::find($this->user_id); $message = sprintf(_('Daten von: %s %s (%s), Status: %s'), htmlReady($current_user->Vorname), htmlReady($current_user->Nachname), htmlReady($current_user->username), htmlReady($current_user->perms)); PageLayout::postMessage(MessageBox::info($message)); } $this->setupSidebar(); }
/** * get admin module links * * returns links add or remove a module from course * @access public * @return string returns html-code */ function getAdminModuleLinks() { global $connected_cms, $view, $search_key, $cms_select, $current_module; $output .= "<form method=\"POST\" action=\"" . URLHelper::getLink() . "\">\n"; $output .= CSRFProtection::tokenTag(); $output .= "<input type=\"HIDDEN\" name=\"view\" value=\"" . htmlReady($view) . "\">\n"; $output .= "<input type=\"HIDDEN\" name=\"search_key\" value=\"" . htmlReady($search_key) . "\">\n"; $output .= "<input type=\"HIDDEN\" name=\"cms_select\" value=\"" . htmlReady($cms_select) . "\">\n"; $output .= "<input type=\"HIDDEN\" name=\"module_type\" value=\"" . htmlReady($connected_cms[$this->cms_type]->content_module[$current_module]->getModuleType()) . "\">\n"; $output .= "<input type=\"HIDDEN\" name=\"module_id\" value=\"" . htmlReady($connected_cms[$this->cms_type]->content_module[$current_module]->getId()) . "\">\n"; $output .= "<input type=\"HIDDEN\" name=\"module_system_type\" value=\"" . htmlReady($this->cms_type) . "\">\n"; if ($connected_cms[$this->cms_type]->content_module[$current_module]->isConnected()) { $output .= " " . Button::create(_('Entfernen'), 'remove'); } elseif ($connected_cms[$this->cms_type]->content_module[$current_module]->isAllowed(OPERATION_WRITE)) { $output .= "<div align=\"left\"><input type=\"CHECKBOX\" value=\"1\" name=\"write_permission\" style=\"vertical-align:middle\">"; $output .= _("Mit Schreibrechten für alle Dozenten/Tutoren dieser Veranstaltung") . "<br>"; $output .= "<input type=\"CHECKBOX\" value=\"1\" style=\"vertical-align:middle\" name=\"write_permission_autor\">"; $output .= _("Mit Schreibrechten für alle Teilnehmer dieser Veranstaltung") . "</div>"; $output .= Button::create(_('Hinzufügen'), 'add') . "<br>"; } else { $output .= " " . Button::create(_('Hinzufügen'), 'add'); } $output .= "</form>"; return $output; // $output .= parent::getAdminModuleLinks(); }
/** * */ function getDefaultConfig () { $config = array( "name" => "", "order" => "|0|1", "visible" => "|1|1", "aliases" => "|"._("Datum")."|"._("Nachricht"), "width" => "|10%|90%", "widthpp" => "", "sort" => "|1|0", "wholesite" => "", "studiplink" => "top", "nameformat" => "", "dateformat" => "%d. %b. %Y", "language" => "", "urlcss" => "", "title" => _("News"), "nodatatext" => _("Keine aktuellen News"), "copyright" => htmlReady($GLOBALS['UNI_NAME_CLEAN'] . " ({$GLOBALS['UNI_CONTACT']})"), "author" => "", "showdateauthor" => "0", "notauthorlink" => "" ); return $config; }
public function testHtmlReady() { $pairs = array('abc' => 'abc', 'äöü' => 'äöü', '<' => '<', '"' => '"', "'" => ''', '&' => '&amp;', ''' => '&#039;', '' => '', NULL => NULL); foreach ($pairs as $string => $expected) { $this->assertEquals($expected, htmlReady($string)); } }
/** * helper_function for highlight($text, $highlight) * * @param string $text * @param array $highlight * @return string */ static function do_highlight($text, $highlight) { foreach ($highlight as $hl) { $text = preg_replace('/' . preg_quote(htmlReady($hl), '/') . '/i', '<span class="highlight">$0</span>', $text); } return $text; }
/** * */ function getDefaultConfig () { $config = array( "name" => "", "order" => "|0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15", "visible" => "|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1", "aliases" => "|"._("Untertitel:")." |"._("Lehrende")." |"._("Veranstaltungsart:") ." |"._("Veranstaltungstyp:")." |"._("Beschreibung:")." |"._("Ort:")." |"._("Semester:") ." |"._("Zeiten:")." |"._("Veranstaltungsnummer:")." |"._("Teilnehmende:") ." |"._("Voraussetzungen:")." |"._("Lernorganisation:")." |"._("Leistungsnachweis:") ." |"._("Bereichseinordnung:")." |"._("Sonstiges:")." |"._("ECTS-Punkte:"), "aliaspredisc" => _("Vorbesprechung:") . " ", "aliasfirstmeeting" => _("Erster Termin:") . " ", "headlinerow" => "1", "rangepathlevel" => "1", "studipinfo" => "1", "studiplink" => "top", "studiplinktarget" => "admin", "wholesite" => "", "nameformat" => "", "urlcss" => "", "title" => _("Veranstaltungsdaten"), "language" => "", "copyright" => htmlReady($GLOBALS['UNI_NAME_CLEAN'] . " ({$GLOBALS['UNI_CONTACT']})"), "author" => "" ); get_default_generic_datafields($config, "sem"); return $config; }
/** * Returns the display/rendered value of this datafield * * @param bool $entities Should html entities be encoded (defaults to true) * @return String containg the rendered value */ public function getDisplayValue($entities = true) { if ($entities) { return htmlReady($this->getValue(), true, true); } return $this->getValue(); }
public function render($variables = array()) { $attributes = array(); foreach ((array) $this->template_variables['attributes'] as $key => $value) { $attributes[] = sprintf('%s="%s"', htmlReady($key), htmlReady($value)); } $this->template_variables['attributes'] = implode(' ', $attributes) ?: ''; return parent::render($variables); }
/** * Markup-rule for hashtags. Inserts links to blubber-globalstream for each tag. * @param StudipFormat $markup * @param array $matches * @return string : marked-up text */ public static function markupHashtags($markup, $matches) { if (self::$course_hashes) { $url = URLHelper::getLink("plugins.php/Blubber/streams/forum", array('hash' => $matches[2], 'cid' => self::$course_hashes)); } else { $url = URLHelper::getLink("plugins.php/Blubber/streams/global", array('hash' => $matches[2])); } return $matches[1] . '<a href="' . $url . '" class="hashtag">#' . htmlReady($matches[2]) . '</a>'; }
function getColumnName($id, $print_view = false) { $res_obj = ResourceObject::Factory($this->show_columns[$id]); if (!$print_view) { $ret = '<a class="tree" href="' . URLHelper::getLink('?show_object=' . $this->show_columns[$id] . '&view=' . (Request::option('view') == 'openobject_group_schedule' ? 'openobject_schedule' : 'view_schedule')) . '">' . htmlReady($res_obj->getName()) . '</a>' . ($res_obj->getSeats() ? '<br>(' . $res_obj->getSeats() . ')' : ''); } else { $ret = '<span style="font-size:10pt;">' . htmlReady($res_obj->getName()) . '</span>'; } return $ret . chr(10); }
function getError($format = "clear") { if ($format == "clear") { return $this->error_msg; } else { for ($i = 0; $i < count($this->error_msg); ++$i) { $ret .= $this->error_msg[$i]['type'] . "§" . htmlReady($this->error_msg[$i]['msg']) . "§"; } return $ret; } }
/** * @return returns a HTML representation of this button. */ function __toString() { // add "button" to attribute @class @($this->attributes["class"] .= " button"); $attributes = array(); ksort($this->attributes); foreach ($this->attributes as $k => $v) { $attributes[] = sprintf(' %s="%s"', $k, htmlReady($v)); } return sprintf('<button type="reset"%s>%s</button>', join('', $attributes), htmlReady($this->label)); }
/** * */ function addContent($_content) { if (is_object($_content)) { $this->addHTMLContent($_content); } elseif (is_scalar($_content)) { $this->addHTMLContent(htmlReady((string) $_content)); } else { $this->addHTMLContent(""); } # trigger_error("Parameter muss ein Scalar sein (Inhalt = ". # ($_content === NULL ? "NULL": $_content) # .", Typ = <".$this->_name.">)", E_USER_ERROR); }
/** * Returns an overview of certain documents * * @param Array $documents Ids of the documents in question * @param mixed $open Array containing open states of documents * @return string Overview of documents as html, ready to be displayed */ function show_documents($documents, $open = null) { if (!is_array($documents)) { return; } if (!is_null($open) && !is_array($open)) { $open = null; } if (is_array($open)) { reset($open); $ank = key($open); } if (!empty($documents)) { $query = "SELECT {$GLOBALS['_fullname_sql']['full']} AS fullname, username, user_id,\n dokument_id, filename, filesize, downloads, protected, url, description,\n IF(IFNULL(name, '') = '', filename, name) AS t_name,\n GREATEST(a.chdate, a.mkdate) AS chdate\n FROM dokumente AS a\n LEFT JOIN auth_user_md5 USING (user_id)\n LEFT JOIN user_info USING (user_id)\n WHERE dokument_id IN (?)\n ORDER BY a.chdate DESC"; $statement = DBManager::get()->prepare($query); $statement->execute(array($documents)); $documents = $statement->fetchAll(PDO::FETCH_ASSOC); } foreach ($documents as $index => $document) { $type = empty($document['url']) ? 0 : 6; $is_open = is_null($open) || $open[$document['dokument_id']] ? 'open' : 'close'; $extension = getFileExtension($document['filename']); // Create icon $icon = sprintf('<a href="%s">%s</a>', GetDownloadLink($document['dokument_id'], $document['filename'], $type), GetFileIcon($extension, true)->asImg()); // Create open/close link $link = $is_open === 'open' ? URLHelper::getLink('#dok_anker', array('close' => $document['dokument_id'])) : URLHelper::getLink('#dok_anker', array('open' => $document['dokument_id'])); // Create title including filesize and number of downloads $size = $document['filesize'] > 1024 * 1024 ? sprintf('%u MB', round($document['filesize'] / 1024 / 1024)) : sprintf('%u kB', round($document['filesize'] / 1024)); $downloads = $document['downloads'] == 1 ? '1 ' . _('Download') : $document['downloads'] . ' ' . _('Downloads'); $title = sprintf('<a href="%s"%s class="tree">%s</a> (%s / %s)', $link, $ank == $document['dokument_id'] ? ' name="dok_anker"' : '', htmlReady(mila($document['t_name'])), $size, $downloads); // Create additional information $addon = sprintf('<a href="%s">%s</a> %s', URLHelper::getLink('dispatch.php/profile', array('username' => $document['username'])), $document['fullname'], date('d.m.Y H:i', $document['chdate'])); if ($document['protected']) { $addon = tooltipicon(_('Diese Datei ist urheberrechtlich geschützt!')) . ' ' . $addon; } if (!empty($document['url'])) { $addon .= ' ' . Icon::create('link-extern', 'clickable', ['title' => _('Diese Datei wird von einem externen Server geladen!')])->asImg(16); } // Attach created variables to document $documents[$index]['addon'] = $addon; $documents[$index]['extension'] = $extension; $documents[$index]['icon'] = $icon; $documents[$index]['is_open'] = $is_open; $documents[$index]['link'] = $link; $documents[$index]['title'] = $title; $documents[$index]['type'] = $type; } $template = $GLOBALS['template_factory']->open('user_activities/files-details'); $template->documents = $documents; return $template->render(); }
function get_highscore_list() { $db = new DB_Seminar("SELECT murmeln_highscore.*,username FROM murmeln_highscore LEFT JOIN auth_user_md5 USING(user_id) ORDER BY score DESC LIMIT 20"); $ret = '<ol>'; $maxscore = 0; while ($db->next_record()) { $ret .= '<li><b>' . $db->f('score') . '</b> - ' . ($db->f('username') ? '<a href="' . UrlHelper::getLink('about.php?username='******'username')) . '">' . htmlReady(get_fullname_from_uname($db->f('username'))) . '</a>' : htmlready($db->f('name'))) . '</li>'; $maxscore = $db->f('score'); } $ret .= '</ol>'; $db->query("DELETE FROM murmeln_highscore WHERE score < " . $maxscore); return $ret; }
/** * get admin module links * * returns links add or remove a module from course * @access public * @return string returns html-code */ function getAdminModuleLinks() { global $connected_cms, $view, $search_key, $cms_select, $current_module; if (!$connected_cms[$this->cms_type]->content_module[$current_module]->isDummy()) { $result = $connected_cms[$this->cms_type]->soap_client->getPath($connected_cms[$this->cms_type]->content_module[$current_module]->getId()); } if ($result) { $output .= "<i>Pfad: " . htmlReady($result) . "</i><br><br>"; } $output .= "<form method=\"POST\" action=\"" . URLHelper::getLink() . "\">\n"; $output .= CSRFProtection::tokenTag(); $output .= "<input type=\"HIDDEN\" name=\"view\" value=\"" . htmlReady($view) . "\">\n"; $output .= "<input type=\"HIDDEN\" name=\"search_key\" value=\"" . htmlReady($search_key) . "\">\n"; $output .= "<input type=\"HIDDEN\" name=\"cms_select\" value=\"" . htmlReady($cms_select) . "\">\n"; $output .= "<input type=\"HIDDEN\" name=\"module_type\" value=\"" . htmlReady($connected_cms[$this->cms_type]->content_module[$current_module]->getModuleType()) . "\">\n"; $output .= "<input type=\"HIDDEN\" name=\"module_id\" value=\"" . htmlReady($connected_cms[$this->cms_type]->content_module[$current_module]->getId()) . "\">\n"; $output .= "<input type=\"HIDDEN\" name=\"module_system_type\" value=\"" . htmlReady($this->cms_type) . "\">\n"; if ($connected_cms[$this->cms_type]->content_module[$current_module]->isConnected()) { $output .= " " . Button::create(_('Entfernen'), 'remove'); } elseif ($connected_cms[$this->cms_type]->content_module[$current_module]->isAllowed(OPERATION_WRITE)) { $output .= "<div align=\"left\">"; if ($connected_cms[$this->cms_type]->content_module[$current_module]->isAllowed(OPERATION_COPY) and !in_array($connected_cms[$this->cms_type]->content_module[$current_module]->module_type, array("lm", "htlm", "sahs", "cat", "crs", "dbk"))) { $output .= "<input type=\"CHECKBOX\" name=\"copy_object\" value=\"1\">"; $output .= _("Als Kopie anlegen") . " "; $output .= Icon::create('info-circle', 'inactive', ['title' => _('Wenn Sie diese Option wählen, wird eine identische Kopie als eigenständige Instanz des Lernmoduls erstellt. Anderenfalls wird ein Link zum Lernmodul gesetzt.')])->asImg(); $output .= "<br>"; } $output .= "<input type=\"RADIO\" name=\"write_permission\" value=\"none\" checked>"; $output .= _("Keine Schreibrechte") . " "; $output .= Icon::create('info-circle', 'inactive', ['title' => _('Nur der/die BesitzerIn des Lernmoduls hat Schreibzugriff für Inhalte und Struktur des Lernmoduls. Tutor/-innen und Lehrende können die Verknüpfung zur Veranstaltung wieder löschen.')])->asImg(); $output .= "<br>"; $output .= "<input type=\"RADIO\" name=\"write_permission\" value=\"dozent\">"; $output .= _("Mit Schreibrechten für alle Lehrenden dieser Veranstaltung") . " "; $output .= Icon::create('info-circle', 'inactive', ['title' => _('Lehrende haben Schreibzugriff für Inhalte und Struktur des Lernmoduls. Tutor/-innen und Lehrende können die Verknüpfung zur Veranstaltung wieder löschen.')])->asImg(); $output .= "<br>"; $output .= "<input type=\"RADIO\" name=\"write_permission\" value=\"tutor\">"; $output .= _("Mit Schreibrechten für alle Lehrenden und Tutor/-innen dieser Veranstaltung") . " "; $output .= Icon::create('info-circle', 'inactive', ['title' => _('Lehrende und Tutor/-innen haben Schreibzugriff für Inhalte und Struktur des Lernmoduls. Tutor/-innen und Lehrende können die Verknüpfung zur Veranstaltung wieder löschen.')])->asImg(); $output .= "<br>"; $output .= "<input type=\"RADIO\" name=\"write_permission\" value=\"autor\">"; $output .= _("Mit Schreibrechten für alle Personen dieser Veranstaltung") . " "; $output .= Icon::create('info-circle', 'inactive', ['title' => _('Lehrende, Tutor/-innen und Teilnehmer/-innen haben Schreibzugriff für Inhalte und Struktur des Lernmoduls. Tutor/-innen und Lehrende können die Verknüpfung zur Veranstaltung wieder löschen.')])->asImg(); $output .= "</div>"; $output .= "</div><br>" . Button::create(_('Hinzufügen'), 'add') . "<br>"; } else { $output .= " " . Button::create(_('Hinzufügen'), 'add'); } $output .= "</form>"; return $output; }
/** * @return returns a HTML representation of this hyperlink. */ function __toString() { // add "button" to attribute @class @($this->attributes["class"] .= " button"); // add tabindex of zero to make buttons accesible when tabbing if (!isset($this->attributes['tabindex'])) { $this->attributes['tabindex'] = '0'; } $attributes = array(); ksort($this->attributes); foreach ($this->attributes as $k => $v) { $attributes[] = sprintf(' %s="%s"', $k, htmlReady($v)); } // TODO: URLHelper...?! return sprintf('<a%s>%s</a>', join('', $attributes), htmlReady($this->label)); }
/** * createEvaluationHeader: generate the head of an evaluation (title and base text) * @param the evaluation * @returns a table row */ function createEvaluationHeader($eval, $votedNow, $votedEarlier) { $br = new HTMpty("br"); $tr = new HTM("tr"); $td = new HTM("td"); $td->attr("class", "table_row_even"); $table2 = new HTM("table"); $table2->attr("width", "100%"); $tr2 = new HTM("tr"); $td2 = new HTM("td"); $td2->attr("width", "90%"); $td2->attr("valign", "top"); if ($eval->isError()) { $td2->html(EvalCommon::createErrorReport($eval, _("Fehler"))); $td2->html($br); } $span = new HTM("span"); $span->attr("class", "eval_title"); $span->html(htmlReady($eval->getTitle())); $td2->cont($span); $td2->cont($br); $td2->cont($br); if ($votedNow) { $message = new HTML('div'); $message->_content = array((string) MessageBox::success(_("Vielen Dank für Ihre Teilnahme."))); $td2->cont($message); } elseif ($votedEarlier) { $message = new HTML('div'); $message->_content = array((string) MessageBox::info(_("Sie haben an dieser Evaluation bereits teilgenommen."))); $td2->cont($message); } else { $td2->html(formatReady($eval->getText())); $td2->cont($br); } $tr2->cont($td2); $td2 = new HTM("td"); $td2->attr("width", "250"); $td2->attr("valign", "top"); $td2->html(EvalShow::createInfoBox($eval, $votedNow || $votedEarlier)); $tr2->cont($td2); $table2->cont($tr2); $td->cont($table2); $tr->cont($td); return $tr; }
/** * Sets up the controller * * @param String $action Which action shall be invoked * @param Array $args Arguments passed to the action method */ public function before_filter(&$action, &$args) { // Abwärtskompatibilität, erst ab 1.1 bekannt if (!isset($GLOBALS['ALLOW_CHANGE_NAME'])) { $GLOBALS['ALLOW_CHANGE_NAME'] = TRUE; } parent::before_filter($action, $args); // Ensure user is logged in $GLOBALS['auth']->login_if($action !== 'logout' && $GLOBALS['auth']->auth['uid'] === 'nobody'); // extract username $username = Request::username('username', $GLOBALS['user']->username); $user = User::findByUsername($username); if (!$GLOBALS['perm']->have_profile_perm('user', $user->user_id)) { $username = $GLOBALS['user']->username; } else { $username = $user->username; URLHelper::addLinkParam('username', $username); } $this->about = new about($username, null); $this->about->get_user_details(); if (!$this->about->check) { $this->reportErrorWithDetails(_('Zugriff verweigert.'), array(_("Wahrscheinlich ist Ihre Session abgelaufen. Bitte " . "nutzen Sie in diesem Fall den untenstehenden Link, " . "um zurück zur Anmeldung zu gelangen.\n\n" . "Eine andere Ursache kann der Versuch des Zugriffs " . "auf Userdaten, die Sie nicht bearbeiten dürfen, sein. " . "Nutzen Sie den untenstehenden Link, um zurück auf " . "die Startseite zu gelangen."), sprintf(_('%s Hier%s geht es wieder zur Anmeldung beziehungsweise Startseite.'), '<a href="index.php">', '</a>'))); $this->render_nothing(); return; } $this->user = User::findByUsername($username); $this->restricted = $GLOBALS['perm']->get_profile_perm($this->user->user_id) !== 'user' && $username !== $GLOBALS['user']->username; $this->config = UserConfig::get($this->user->user_id); $this->validator = new email_validation_class(); # Klasse zum Ueberpruefen der Eingaben $this->validator->timeout = 10; // Default auth plugin to standard if (!$this->user->auth_plugin) { $this->user->auth_plugin = 'standard'; } PageLayout::addSqueezePackage('settings'); // Show info message if user is not on his own profile if ($username != $GLOBALS['user']->username) { $message = sprintf(_('Daten von: %s %s (%s), Status: %s'), htmlReady($this->user->Vorname), htmlReady($this->user->Nachname), $username, $this->user->perms); $this->reportInfo($message); } Sidebar::get()->setImage('sidebar/person-sidebar.png'); $this->set_layout($GLOBALS['template_factory']->open('layouts/base')); }
/** * Adding Stud.IP formatted code to the current page of the pdf. * Remember to call addPage first. * @param string $content Stud.IP formatted code */ public function addContent($content) { preg_match_all("#\\[comment(=.*)?\\](.*)\\[/comment\\]#msU", $content, $matches); if (count($matches[0])) { $endnote .= "<br><br>" . _("Kommentare") . "<hr>"; for ($i = 0; $i < count($matches[0]); $i++) { $endnote .= $i + 1 . ") " . htmlReady(substr($matches[1][$i], 1)) . ": " . htmlReady($matches[2][$i]) . "<br>"; } } $content = preg_replace("#\\[comment(=.*)?\\](.*)\\[/comment\\]#emsU", '$this->addEndnote("//1", "//2")', $content); $content = formatReady($content, true, true, true, null); $content = str_replace("<table", "<table border=\"1\"", $content); // Since TCPDF cannot handle missing images at all, the content needs // to be cleaned from those (see tickets #2957, #3329 and #3688) $content = preg_replace_callback('/<img[^>]+src="(.*?)"[^>]*>/', function ($match) { $url = $match[1]; // Detect possible html entities in url and remove them if (strpos($url, '&') !== false) { $url = html_entity_decode($url); } // Handle optional media proxy if (Config::GetInstance()->LOAD_EXTERNAL_MEDIA) { $parsed = parse_url($url); // Detect media proxy if (strpos($parsed['path'], 'media_proxy') !== false && strpos($parsed['query'], 'url=') !== false) { // Remove media proxy parse_str($parsed['query'], $parameters); $url = $parameters['url']; } } // Fetch headers from url, handle possible redirects do { $headers = get_headers($url, true); list(, $status) = explode(' ', $headers[0]); $url = $header['Location'] ?: $header['location'] ?: $url; } while (in_array($status, array(300, 301, 302, 303, 305, 307))); $status = $status ?: 404; // Replace image with link on error (and not internal), otherwise return sainitized // url return (!is_internal_url($url) || $status == 404) && $status >= 400 ? sprintf('[<a href="%s">%s</a>]', $url, basename($url)) : str_replace($match[1], $url, $match[0]); }, $content); $this->writeHTML($content . $endnote); }
/** * Administration page for help content */ function admin_overview_action() { // check permission if (!$GLOBALS['auth']->is_authenticated() || $GLOBALS['user']->id === 'nobody') { throw new AccessDeniedException(); } $GLOBALS['perm']->check('root'); // initialize PageLayout::setTitle(_('Verwalten von Hilfe-Texten')); PageLayout::setHelpKeyword('Basis.HelpContentAdmin'); // set navigation Navigation::activateItem('/admin/config/help_content'); if (Request::get('help_content_filter') == 'set') { $this->help_content_searchterm = Request::option('help_content_filter_term'); } if (Request::submitted('reset_filter')) { $this->help_content_searchterm = ''; } if (Request::submitted('apply_help_content_filter')) { if (Request::get('help_content_searchterm') and strlen(trim(Request::get('help_content_searchterm'))) < 3) { PageLayout::postMessage(MessageBox::error(_('Der Suchbegriff muss mindestens 3 Zeichen lang sein.'))); } if (strlen(trim(Request::get('help_content_searchterm'))) >= 3) { $this->help_content_searchterm = htmlReady(Request::get('help_content_searchterm')); $this->filter_text = sprintf(_('Angezeigt werden Hilfe-Texte zum Suchbegriff "%s".'), $this->help_content_searchterm); } } // load help content $this->help_contents = HelpContent::GetContentByFilter($this->help_content_searchterm); // save settings if (Request::submitted('save_help_content_settings')) { foreach ($this->help_contents as $help_content_id => $help_content) { // set status as chosen if (Request::get('help_content_status_' . $help_content_id) == '1' and !$this->help_contents[$help_content_id]->visible) { $this->help_contents[$help_content_id]->visible = 1; $this->help_contents[$help_content_id]->store(); } elseif (Request::get('help_content_status_' . $help_content_id) != '1' and $this->help_contents[$help_content_id]->visible) { $this->help_contents[$help_content_id]->visible = 0; $this->help_contents[$help_content_id]->store(); } } } }
/** * add user by importUsers * * adds new user and sets role-id * @access public * @param array user_data user-data * @param string role_id global role-id for new user * @return string user-id */ function addUser($user_data, $role_id) { foreach ($user_data as $key => $value) { $user_data[$key] = htmlReady(studip_utf8encode($user_data[$key])); } $usr_xml = "<Users>\n<User>\n<UDFDefinitions></UDFDefinitions>\n<Login>" . $user_data["login"] . "</Login>\n<Password Type=\"PLAIN\">" . $user_data["passwd"] . "</Password>\n<Firstname>" . $user_data["firstname"] . "</Firstname>\n<Lastname>" . $user_data["lastname"] . "</Lastname>\n<Title>" . $user_data["title"] . "</Title>\n<Gender>" . $user_data["gender"] . "</Gender>\n<Email>" . $user_data["email"] . "</Email>\n<Street>" . $user_data["street"] . "</Street>\n<PhoneHome>" . $user_data["phone_home"] . "</PhoneHome>\n<Role Id=\"" . $role_id . "\" Type=\"Global\"/>\n<Active>true</Active>\n<TimeLimitUnlimited>" . $user_data["time_limit_unlimited"] . "</TimeLimitUnlimited>\n<TimeLimitMessage>0</TimeLimitMessage>\n<ApproveDate>" . $user_data["approve_date"] . "</ApproveDate>\n<AgreeDate>" . $user_data["agree_date"] . "</AgreeDate>"; if ($user_data["user_skin"] != "" or $user_data["user_style"] != "") { $usr_xml .= "<Look Skin=\"" . $user_data["user_skin"] . "\" Style=\"" . $user_data["user_style"] . "\"/>"; } $usr_xml .= "<AuthMode type=\"" . $user_data["auth_mode"] . "\"/>\n<ExternalAccount>" . $user_data["external_account"] . "</ExternalAccount>\n</User>\n</Users>"; $param = array('sid' => $this->getSID(), 'folder_id' => -1, 'usr_xml' => $usr_xml, 'conflict_role' => 1, 'send_account_mail' => 0); $result = $this->call('importUsers', $param); $s = simplexml_load_string(studip_utf8encode($result)); if ((string) $s->rows->row->column[3] == "successful") { return (string) $s->rows->row->column[0]; } else { return false; } }
/** * */ function getDefaultConfig () { $config = array( "name" => "", "semstart" => "", "semrange" => "", "semswitch" => "", "wholesite" => "", "nameformat" => "", "language" => "", "urlcss" => "", "copyright" => htmlReady($GLOBALS['UNI_NAME_CLEAN'] . " ({$GLOBALS['UNI_CONTACT']})"), "author" => '', "defaultadr" => '0' ); return $config; }
/** * */ function getDefaultConfig () { global $SEM_TYPE, $SEM_CLASS; $config = array(); foreach ($SEM_CLASS as $class_index => $class) { foreach ($SEM_TYPE as $type_index => $type) { if ($type["class"] == $class_index) { $config["class_$class_index"] .= "|" . htmlReady($type["name"]) . " ({$class['name']})"; } } } foreach ($SEM_TYPE as $type_index => $foo) { $config['order'] .= "|$type_index"; $config['visibility'] .= "|1"; } return $config; }
public function profile_action() { PageLayout::addHeadElement("script", array('src' => $this->assets_url . "/javascripts/autoresize.jquery.min.js"), ""); PageLayout::addHeadElement("script", array('src' => $this->assets_url . "/javascripts/blubberforum.js"), ""); PageLayout::addHeadElement("script", array('src' => $this->assets_url . "/javascripts/formdata.js"), ""); if (Request::get("extern")) { $this->user = BlubberExternalContact::find(Request::get("user_id")); } else { $this->user = new BlubberUser(Request::get("user_id")); } PageLayout::setTitle(htmlReady($this->user->getName()) . " - Blubber"); PageLayout::addHeadElement("link", array('rel' => "alternate", 'type' => "application/atom+xml", 'href' => PluginEngine::getLink($this->plugin, array(), "forum/feed/" . $this->user->getId()), 'title' => "Blubber von " . get_fullname($user_id))); $this->threads = ForumPosting::getThreads(array('user_id' => $this->user->getId(), 'limit' => $this->max_threads + 1)); $this->more_threads = count($this->threads) > $this->max_threads; $this->course_id = $_SESSION['SessionSeminar']; if ($this->more_threads) { $this->threads = array_slice($this->threads, 0, $this->max_threads); } }
public function __construct($label, $id, $language = null) { $language = $language ?: $GLOBALS['user']->preferred_language; try { $query = "SELECT content\n FROM help_content\n WHERE content_id = :id AND language = :language\n ORDER BY version DESC\n LIMIT 1"; $statement = DBManager::get()->prepare($query); $statement->bindValue(':id', $id); $statement->bindValue(':language', $language); $statement->execute(); $text = $statement->fetchColumn() ?: sprintf('Unknown help id "%s"', $id); $content = sprintf('<strong>%s</strong><p>%s</p>', htmlReady($label), formatReady($text)); } catch (Exception $e) { if ($GLOBALS['user']->perms === 'root') { $content = 'DB-Error: please migrate'; } else { $content = ''; } } parent::__construct($content); }
/** * Entry point of the controller that displays the start page of Stud.IP * * @param string $action * @param string $widgetId * * @return void */ function index_action($action = false, $widgetId = null) { $this->left = WidgetHelper::getUserWidgets($GLOBALS['user']->id, 0); $this->right = WidgetHelper::getUserWidgets($GLOBALS['user']->id, 1); if (!(count($this->left) + count($this->right))) { WidgetHelper::setInitialPositions(); $this->left = WidgetHelper::getUserWidgets($GLOBALS['user']->id, 0); $this->right = WidgetHelper::getUserWidgets($GLOBALS['user']->id, 1); } WidgetHelper::setActiveWidget(Request::get('activeWidget')); $sidebar = Sidebar::get(); $sidebar->setImage('sidebar/home-sidebar.png'); $sidebar->setTitle(_("Meine Startseite")); $nav = new NavigationWidget(); $nav->setTitle(_('Sprungmarken')); foreach (array_merge($this->left, $this->right) as $widget) { $nav->addLink($widget->getPluginName(), $this->url_for('start#widget-' . $widget->widget_id)); } $sidebar->addWidget($nav); // Show action to add widget only if not all widgets have already been added. $actions = new ActionsWidget(); if (WidgetHelper::getAvailableWidgets($GLOBALS['user']->id)) { $actions->addLink(_('Neues Widget hinzufügen'), $this->url_for('start/add'), Icon::create('add', 'clickable'))->asDialog(); } $actions->addLink(_('Standard wiederherstellen'), $this->url_for('start/reset'), Icon::create('accept', 'clickable')); $sidebar->addWidget($actions); // Root may set initial positions if ($GLOBALS['perm']->have_perm('root')) { $settings = new ActionsWidget(); $settings->setTitle(_('Einstellungen')); $settings->addElement(new WidgetElement(_('Standard-Startseite bearbeiten:'))); foreach ($GLOBALS['perm']->permissions as $permission => $useless) { $settings->addElement(new LinkElement(ucfirst($permission), $this->url_for('start/edit_defaults/' . $permission), Icon::create('link-intern', 'clickable'), array('data-dialog' => ''))); } $sidebar->addWidget($settings); } if ($GLOBALS['perm']->get_perm() == 'user') { PageLayout::postMessage(MessageBox::info(_('Sie haben noch nicht auf Ihre Bestätigungsmail geantwortet.'), array(_('Bitte holen Sie dies nach, um Stud.IP Funktionen wie das Belegen von Veranstaltungen nutzen zu können.'), sprintf(_('Bei Problemen wenden Sie sich an: %s'), '<a href="mailto:' . $GLOBALS['UNI_CONTACT'] . '">' . $GLOBALS['UNI_CONTACT'] . '</a>')))); PageLayout::postMessage(MessageBox::info(sprintf(_('Haben Sie die Bestätigungsmail an Ihre Adresse "%s" nicht erhalten?'), htmlReady($GLOBALS['user']->Email)), array(Studip\LinkButton::create(_('Bestätigungsmail erneut verschicken'), $this->url_for('start/resend_validation_mail')) . ' ' . Studip\LinkButton::create(_('Email-Adresse ändern'), $this->url_for('start/edit_mail_address'), array('data-dialog' => "size=auto", 'title' => _('Email-Adresse')))))); } }