Exemplo n.º 1
0
 public function initItem()
 {
     global $user, $neux;
     parent::initItem();
     $my_messaging_settings = UserConfig::get($user->id)->MESSAGING_SETTINGS;
     $lastVisitedTimestamp = isset($my_messaging_settings['last_box_visit']) ? (int) $my_messaging_settings['last_box_visit'] : 0;
     $query = "SELECT SUM(mkdate > :time AND readed = 0) AS num_new,\n                         SUM(readed = 0) AS num_unread,\n                         SUM(readed = 1) AS num_read\n                  FROM message_user\n                  WHERE snd_rec = 'rec' AND user_id = :user_id AND deleted = 0";
     $statement = DBManager::get()->prepare($query);
     $statement->bindValue(':time', $lastVisitedTimestamp);
     $statement->bindValue(':user_id', $GLOBALS['user']->id);
     $statement->execute();
     list($neux, $neum, $altm) = $statement->fetch(PDO::FETCH_NUM);
     $this->setBadgeNumber($neum);
     if ($neux > 0) {
         $tip = sprintf(ngettext('Sie haben %d neue ungelesene Nachricht', 'Sie haben %d neue ungelesene Nachrichten', $neux), $neux);
     } else {
         if ($neum > 1) {
             $tip = sprintf(ngettext('Sie haben %d ungelesene Nachricht', 'Sie haben %d ungelesene Nachrichten', $neum), $neum);
         } else {
             if ($altm > 1) {
                 $tip = sprintf(ngettext('Sie haben %d alte empfangene Nachricht', 'Sie haben %d alte empfangene Nachrichten', $altm), $altm);
             } else {
                 $tip = _('Sie haben keine alten empfangenen Nachrichten');
             }
         }
     }
     $this->setImage(Icon::create('mail', 'navigation', ["title" => $tip]));
 }
Exemplo n.º 2
0
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     PageLayout::setHelpKeyword('Basis.Terminkalender');
     $this->settings = UserConfig::get($GLOBALS['user']->id)->getValue('CALENDAR_SETTINGS');
     if (!is_array($this->settings)) {
         $this->settings = Calendar::getDefaultUserSettings();
     }
     URLHelper::bindLinkParam('atime', $this->atime);
     $this->atime = Request::int('atime', time());
     $this->category = Request::int('category');
     $this->last_view = Request::option('last_view', $this->settings['view']);
     $this->action = $action;
     $this->restrictions = $this->category ? array('STUDIP_CATEGORY' => $this->category) : null;
     if ($this->category) {
         URLHelper::bindLinkParam('category', $this->category);
     }
     $self = Request::option('self');
     //   var_dump($_SESSION['SessSemName'], $self); exit;
     if (!$self && $_SESSION['SessSemName']['class'] == 'sem') {
         $this->range_id = Request::option('cid');
         Navigation::activateItem('/course/calendar');
     } else {
         $this->range_id = Request::option('range_id', $GLOBALS['user']->id);
         Navigation::activateItem('/calendar/calendar');
         URLHelper::bindLinkParam('range_id', $this->range_id);
     }
     URLHelper::bindLinkParam('last_view', $this->last_view);
 }
Exemplo n.º 3
0
 /**
  * Display a user's calendar settings
  */
 public function index_action()
 {
     $calendar_user_control_data = (array) UserConfig::get($GLOBALS['user']->id)->getValue('CALENDAR_SETTINGS');
     foreach ($calendar_user_control_data as $key => $value) {
         $this->{$key} = $value;
     }
 }
Exemplo n.º 4
0
 public function __construct()
 {
     parent::__construct();
     $top = new Navigation($this->getDisplayTitle(), PluginEngine::getURL($this, array('view' => 'tiles'), "presenting/overview"));
     $top->setImage(Icon::create($this->getPluginURL() . "/assets/topicon.svg"));
     $overview = new Navigation($this->getDisplayTitle(), PluginEngine::getURL($this, array(), "presenting/overview"));
     $top->addSubNavigation("presenting", $overview);
     $overview->addSubNavigation("overview", new AutoNavigation(_('Übersicht'), PluginEngine::getURL($this, array(), "presenting/overview")));
     $overview->addSubNavigation("all", new AutoNavigation(_('Alle Plugins'), PluginEngine::getURL($this, array(), "presenting/all")));
     $overview->addSubNavigation("tools", new AutoNavigation(_('Tools'), PluginEngine::getURL($this, array(), "tools/sidebar_graphics_generator")));
     if ($GLOBALS['perm']->have_perm("autor")) {
         $top->addSubNavigation("myplugins", new Navigation(_("Meine Plugins"), PluginEngine::getURL($this, array(), "myplugins/overview")));
     }
     if ($GLOBALS['perm']->have_perm("user")) {
         $last_visit = UserConfig::get($GLOBALS['user']->id)->getValue("last_pluginmarket_visit");
         if ($last_visit) {
             $badge_number = MarketPlugin::countBySql("publiclyvisible = 1 AND approved = 1 AND published > ?", array($last_visit));
             if ($badge_number > 0) {
                 $top->setBadgeNumber($badge_number);
             }
         }
     }
     if ($GLOBALS['perm']->have_perm("root")) {
         $approving = new Navigation(_("Qualitätssicherung"), PluginEngine::getURL($this, array(), "approving/overview"));
         $top->addSubNavigation("approving", $approving);
     }
     Navigation::addItem("/pluginmarket", $top);
     $loginlink = new Navigation($this->getDisplayTitle(), PluginEngine::getURL($this, array(), "presenting/overview"));
     $loginlink->setDescription(_("Laden Sie hier Plugins für Ihr Stud.IP herunter"));
     Navigation::addItem("/login/pluginmarket", $loginlink);
     NotificationCenter::addObserver($this, "triggerFollowingStudips", "PluginReleaseDidUpdateCode");
 }
Exemplo n.º 5
0
 /**
  * Liefert die vorhandenen Nachrichten eines Ordners des
  * autorisierten Nutzers zurück.
  *
  * @get /user/:user_id/:box/:folder_id
  */
 public function showFolder($user_id, $box, $folder_id)
 {
     $settings = \UserConfig::get($user_id)->MESSAGING_SETTINGS ?: array();
     $type = substr($box, 0, -3);
     if ($folder_id != 0 && (!isset($settings['folder'][$type][$folder_id]) || $settings['folder'][$type][$folder_id] === 'dummy')) {
         $this->notFound();
     }
     // only your messages!
     if ($user_id !== self::currentUser()) {
         $this->error(401);
     }
     // get all messages in the user's folder
     $ids = self::folder($user_id, $box === 'inbox' ? 'rec' : 'snd', $folder_id);
     $total = count($ids);
     $ids = array_slice($ids, $this->offset, $this->limit, true);
     $messages = array();
     if (sizeof($ids)) {
         foreach (\Message::findMany($ids) as $msg) {
             $url = $this->urlf('/message/%s', array($msg->id));
             $messages[$url] = $this->messageToJSON($msg);
         }
     }
     $this->etag(md5(serialize($messages)));
     return $this->paginated($messages, $total, compact('user_id', 'box', 'folder_id'));
 }
Exemplo n.º 6
0
 /**
  * Sends the collected messages from sendingMail as e-mail.
  */
 function bulkSend()
 {
     // if nothing to do, return
     if (empty($this->bulk_mail)) {
         return;
     }
     // send a mail, for each language one
     foreach ($this->bulk_mail as $lang_data) {
         foreach ($lang_data as $data) {
             $mail = new StudipMail();
             $mail->setSubject($data['title']);
             foreach ($data['users'] as $user_id => $to) {
                 $mail->addRecipient($to, get_fullname($user_id), 'Bcc');
             }
             $mail->setReplyToEmail('')->setBodyText($data['text']);
             if (strlen($data['reply_to'])) {
                 $mail->setSenderEmail($data['reply_to'])->setSenderName($snd_fullname);
             }
             $user_cfg = UserConfig::get($user_id);
             if ($user_cfg->getValue('MAIL_AS_HTML')) {
                 $mail->setBodyHtml($mailhtml);
             }
             if ($GLOBALS["ENABLE_EMAIL_ATTACHMENTS"]) {
                 foreach (get_message_attachments($data['message_id']) as $attachment) {
                     $mail->addStudipAttachment($attachment['dokument_id']);
                 }
             }
             $mail->send();
         }
     }
 }
Exemplo n.º 7
0
 function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     Navigation::activateItem("/pluginmarket/presenting");
     if ($GLOBALS['perm']->have_perm("user")) {
         $config = UserConfig::get($GLOBALS['user']->id);
         $this->last_pluginmarket_visit = $config->getValue("last_pluginmarket_visit") ?: time();
         $_SESSION['last_pluginmarket_visit'] = time();
         $config->store("last_pluginmarket_visit", $_SESSION['last_pluginmarket_visit']);
     }
     PageLayout::addScript($this->plugin->getPluginURL() . "/assets/studiptable.js");
     PageLayout::addScript($this->plugin->getPluginURL() . "/assets/pluginmarket.js");
     $tags_statement = DBManager::get()->prepare("\n            SELECT pluginmarket_tags.tag, COUNT(*) AS number\n            FROM pluginmarket_tags\n                INNER JOIN pluginmarket_plugins ON (pluginmarket_plugins.plugin_id = pluginmarket_tags.plugin_id)\n            WHERE pluginmarket_tags. proposal = '0'\n                AND pluginmarket_plugins.approved = 1\n                AND pluginmarket_plugins.publiclyvisible = 1\n            GROUP BY pluginmarket_tags.tag\n            ORDER BY number DESC, RAND()\n            LIMIT 25\n        ");
     $tags_statement->execute();
     $this->tags = $tags_statement->fetchAll(PDO::FETCH_ASSOC);
     // Set view
     $_SESSION['pluginmarket']['view'] = Request::get('view') ?: $_SESSION['pluginmarket']['view'];
     if (!isset($_SESSION['pluginmarket']['view'])) {
         $_SESSION['pluginmarket']['view'] = 'tiles';
     }
     // Sidebar
     $sidebar = Sidebar::Get();
     // Create search widget
     $searchWidget = new SearchWidget($this->url_for('presenting/all'));
     $searchWidget->addNeedle(_('Suche'), 'search', true);
     $sidebar->addWidget($searchWidget);
     // Create cloud
     $tagWidget = new LinkCloudWidget();
     $tagWidget->setTitle(_("Beliebte Tags"));
     foreach ($this->tags as $tag) {
         $tagWidget->addLink($tag['tag'], $this->url_for('presenting/all', array('tag' => $tag['tag'])), $tag['number']);
     }
     $sidebar->addWidget($tagWidget);
     // Create view widget
     if ($action != 'details') {
         $viewWidget = new ViewsWidget();
         $viewWidget->addLink(_('Kacheln'), URLHelper::getLink('', array('view' => 'tiles')))->setActive($_SESSION['pluginmarket']['view'] == 'tiles');
         $viewWidget->addLink(_('Liste'), $this->url_for('presenting/all', array('view' => 'list')))->setActive($_SESSION['pluginmarket']['view'] == 'list');
         $sidebar->addWidget($viewWidget);
     }
     // Create versionfilter widget
     $versionWidget = new OptionsWidget();
     $versionWidget->setTitle(_('Stud.IP Version'));
     // Create options for all studip versions
     $_SESSION['pluginmarket']['version'] = Request::submitted('version') ? Request::get('version') : $_SESSION['pluginmarket']['version'];
     $options[] = "<option value='" . URLHelper::getLink('', array('version' => 0)) . "'>" . _('Alle Versionen') . "</option>";
     foreach (array_reverse(PluginMarket::getStudipReleases()) as $version) {
         $options[] = "<option value='" . URLHelper::getLink('', array('version' => $version)) . "' " . ($_SESSION['pluginmarket']['version'] == $version ? "SELECTED" : "") . ">{$version}</option>";
     }
     $versionWidget->addElement(new WidgetElement('<select style="width: 100%" onchange="location = this.options[this.selectedIndex].value;">' . join("", $options) . '</select>'));
     // Add checkbox to ignore older releases (use invese logic to be applied on startup)
     $sidebar->addWidget($versionWidget, 'comments');
 }
Exemplo n.º 8
0
 function __construct($user = null)
 {
     if ($user instanceof User) {
         $this->user = $user;
     } else {
         $this->user = User::find($user);
     }
     if (!isset($this->user)) {
         $this->user = new User();
         $this->user->user_id = 'nobody';
     }
     $this->cfg = UserConfig::get($this->user->user_id);
     $this->last_online_time = $this->get_last_action();
 }
Exemplo n.º 9
0
 /**
  * Show the user configuration for one parameter
  *
  * @param   string $user_id
  * @param   string $field
  *
  * @return  array()
  */
 public static function showUserConfiguration($user_id, $field)
 {
     $uconfig = UserConfig::get($user_id);
     $config = Config::get();
     $data = $config->getMetadata($field);
     if (!count($data)) {
         $data['field'] = $field;
         $data['type'] = 'string';
         $data['description'] = 'missing in table `config`';
     }
     $data['value'] = $uconfig->{$field};
     $data['fullname'] = User::find($user_id)->getFullname();
     return $data;
 }
 function down()
 {
     DBManager::get()->execute("ALTER TABLE `event_data` CHANGE `author_id` `autor_id` VARCHAR(32) NOT NULL");
     DBManager::get()->execute("ALTER TABLE `calendar_event` DROP `mkdate`");
     $replace = array('list' => 'showlist', 'day' => 'showday', 'week' => 'showweek', 'month' => 'showmonth', 'year' => 'showyear');
     $default_settings = array('view' => 'week', 'start' => '9', 'end' => '20', 'step_day' => '900', 'step_week' => '1800', 'type_week' => 'LONG', 'delete' => '0', 'step_week_group' => '3600', 'step_day_group' => '3600');
     $res = DBManager::get()->query("SELECT user_id FROM `user_config` WHERE field = 'CALENDAR_SETTINGS'");
     foreach ($res as $row) {
         $config = UserConfig::get($row['user_id']);
         $settings = $config->getValue('CALENDAR_SETTINGS');
         if (isset($settings['view'])) {
             $default_settings['view'] = $replace[$settings['view']];
             $config->store('CALENDAR_SETTINGS', $default_settings);
         }
     }
 }
Exemplo n.º 11
0
function check_terms($userid, $_language_path) {

    if (Request::get('i_accept_the_terms') == "yes") {
        UserConfig::get($userid)->store('TERMS_ACCEPTED', 1);
        return;
    }

    if ($GLOBALS['auth']->auth['uid'] != 'nobody' && !empty($GLOBALS['user']) && !$GLOBALS['user']->cfg->getValue('TERMS_ACCEPTED'))
    {
?>

<table align="center" border="0" cellpadding="1" cellspacing="0">
    <tr>
        <td class="table_header_bold">
            <?= Icon::create('door-enter', 'info_alt')->asImg() ?>
            <b><?=_("Nutzungsbedingungen")?></b>
        </td>
    </tr>
    <tr>
        <td class="blank">
        <p><br><?=_("Stud.IP ist ein Open Source Projekt und steht unter der Gnu General Public License (GPL). Das System befindet sich in der ständigen Weiterentwicklung.")?></p>
        <p><?=_("Um den vollen Funktionsumfang von Stud.IP nutzen zu können, müssen Sie sich am System anmelden.")?><br>
        <?=_("Das hat viele Vorzüge:")?></p>
        <ul>
            <li><?=_("Zugriff auf Ihre Daten von jedem internetfähigen Rechner weltweit,")?></li>
            <li><?=_("Anzeige neuer Mitteilungen oder Dateien seit Ihrem letzten Besuch,")?></li>
            <li><?=_("Ein eigenes Profil im System,")?></li>
            <li><?=_("die Möglichkeit anderen Personen Nachrichten zu schicken oder mit ihnen zu chatten,")?></li>
            <li><?=_("und vieles mehr.")?></li>
        </ul>
        <p><?=_("Mit der Anmeldung werden die nachfolgenden Nutzungsbedingungen akzeptiert:")?></p>
        <? include("locale/$_language_path/LC_HELP/pages/nutzung.html"); ?>
        <p align="center">
        <a href="<?= URLHelper::getLink(Request::url(), array('i_accept_the_terms' => 'yes')) ?>"><b><?=_("Ich erkenne die Nutzungsbedingungen an")?></b></a>
        </p>
        <br>
        </td>
    </tr>
</table>

<?php
    include ('lib/include/html_end.inc.php');
    die;
    }
}
Exemplo n.º 12
0
 /**
  * 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'));
 }
Exemplo n.º 13
0
 /**
  * Returns the formatted list of skip links
  *
  * @return string the formatted list of skip links
  */
 public static function getHTML()
 {
     $html = '';
     if (UserConfig::get($GLOBALS['user']->id)->getValue('SKIPLINKS_ENABLE') && $GLOBALS['auth']->is_authenticated() && sizeof(self::$links)) {
         Navigation::addItem('/skiplinks', new Navigation(''));
         uasort(self::$links, create_function('$a, $b', 'return $a["position"] > $b["position"];'));
         $i = 1;
         $position = 0;
         $overwriteable = false;
         foreach (self::$links as $link) {
             $navigation = new Navigation($link['name'], $link['url']);
             $path = '/skiplinks/' . $i++;
             Navigation::addItem($path, $navigation);
             $position = $link['position'];
             $overwriteable = $link['overwriteable'];
         }
         $navigation = Navigation::getItem('/skiplinks');
         $html = $GLOBALS['template_factory']->render('skiplinks', compact('navigation'));
     }
     return $html;
 }
Exemplo n.º 14
0
 public static function getUserTrackerData()
 {
     $entities = array("character", "corporation", "alliance", "faction", "ship", "item", "system", "region");
     $entlist = array();
     foreach ($entities as $ent) {
         Db::execute("update zz_users_config set locker = 'tracker_{$ent}' where locker = '{$ent}'");
         $result = UserConfig::get("tracker_{$ent}");
         $part = array();
         if ($result != null) {
             foreach ($result as $row) {
                 switch ($ent) {
                     case "system":
                         $row["solarSystemID"] = $row["id"];
                         $row["solarSystemName"] = $row["name"];
                         $sunType = Db::queryField("SELECT sunTypeID FROM ccp_systems WHERE solarSystemID = :id", "sunTypeID", array(":id" => $row["id"]));
                         $row["sunTypeID"] = $sunType;
                         break;
                     case "item":
                         $row["typeID"] = $row["id"];
                         $row["shipName"] = $row["name"];
                         break;
                     case "ship":
                         $row["shipTypeID"] = $row["id"];
                         $row["{$ent}Name"] = $row["name"];
                         break;
                     default:
                         $row["{$ent}ID"] = $row["id"];
                         $row["{$ent}Name"] = $row["name"];
                         break;
                 }
                 $part[] = $row;
             }
         }
         $entlist[$ent] = $part;
     }
     return $entlist;
 }
Exemplo n.º 15
0
 public function overview_action()
 {
     if (Navigation::hasItem("/lernmarktplatz/overview")) {
         Navigation::activateItem("/lernmarktplatz/overview");
     }
     $tag_matrix_entries_number = 9;
     $tag_subtags_number = 6;
     if (Request::get("disable_maininfo")) {
         UserConfig::get($GLOBALS['user']->id)->store("LERNMARKTPLATZ_DISABLE_MAININFO", 1);
         $this->redirect("market/overview");
     }
     if (Request::get("tags")) {
         $tags = $this->tag_history = explode(",", Request::get("tags"));
         $this->without_tags = array();
         $tag_to_search_for = array_pop($tags);
         foreach (LernmarktplatzTag::findBest($tag_matrix_entries_number, true) as $related_tag) {
             if ($related_tag['tag_hash'] !== $this->tag_history[0]) {
                 $this->without_tags[] = $related_tag['tag_hash'];
             }
         }
         //array_shift($this->tag_history);
         foreach ($tags as $tag) {
             foreach (LernmarktplatzTag::findRelated($tag, $this->without_tags, $tag_subtags_number, true) as $related_tag) {
                 $this->without_tags[] = $related_tag['tag_hash'];
             }
         }
         $this->more_tags = LernmarktplatzTag::findRelated($tag_to_search_for, $this->without_tags, $tag_subtags_number);
         $this->materialien = LernmarktplatzMaterial::findByTagHash($tag_to_search_for);
     } elseif (Request::get("search")) {
         $this->materialien = LernmarktplatzMaterial::findByText(Request::get("search"));
     } elseif (Request::get("tag")) {
         $this->materialien = LernmarktplatzMaterial::findByTag(Request::get("tag"));
     } else {
         $this->best_nine_tags = LernmarktplatzTag::findBest($tag_matrix_entries_number);
     }
 }
Exemplo n.º 16
0
 /**
  * returns schedule for a given user and semester
  *
  * @get /user/:user_id/schedule/:semester_id
  * @get /user/:user_id/schedule
  */
 public function getSchedule($user_id, $semester_id = NULL)
 {
     if ($user_id !== $GLOBALS['user']->id) {
         $this->error(401);
     }
     $semdata = new \SemesterData();
     $current_semester = isset($semester_id) ? $semdata->getSemesterData($semester_id) : $semdata->getCurrentSemesterData();
     if (!$current_semester) {
         $this->notFound('No such semester.');
     }
     $schedule_settings = \UserConfig::get($user_id)->SCHEDULE_SETTINGS;
     $days = $schedule_settings['glb_days'];
     $entries = \CalendarScheduleModel::getEntries($user_id, $current_semester, $schedule_settings['glb_start_time'], $schedule_settings['glb_end_time'], $days, $visible = false);
     $json = array();
     foreach ($entries as $number_of_day => $schedule_of_day) {
         $entries = array();
         foreach ($schedule_of_day->entries as $entry) {
             $entries[$entry['id']] = self::entryToJson($entry);
         }
         $json[$number_of_day + 1] = $entries;
     }
     $this->etag(md5(serialize($json)));
     return $json;
 }
Exemplo n.º 17
0
 /**
  *
  * @param $message
  * @param $rec_uname
  * @param $user_id
  * @param $time
  * @param $tmp_message_id
  * @param $set_deleted
  * @param $signature
  * @param $subject
  * @param $force_email
  * @param $priority
  */
 function insert_message($message, $rec_uname, $user_id = '', $time = '', $tmp_message_id = '', $set_deleted = '', $signature = '', $subject = '', $force_email = '', $priority = 'normal', $tags = null)
 {
     global $user;
     $my_messaging_settings = UserConfig::get($user->id)->MESSAGING_SETTINGS;
     // wenn kein subject uebergeben
     $subject = $subject ?: _('Ohne Betreff');
     $email_request = $this->send_as_email ?: $my_messaging_settings['send_as_email'];
     // wenn keine zeit uebergeben
     $time = $time ?: time();
     // wenn keine id uebergeben
     $tmp_message_id = $tmp_message_id ?: md5(uniqid('321losgehtes', true));
     // wenn keine user_id uebergeben
     $user_id = $user_id ?: $user->id;
     # send message now
     if ($user_id != '____%system%____') {
         // real-user message
         $snd_user_id = $user_id;
         $set_deleted = $set_deleted ?: $my_messaging_settings['save_snd'] != '1';
         // don't save sms in outbox
     } else {
         // system-message
         $set_deleted = '1';
         // system-signatur
         $snd_user_id = '____%system%____';
         setTempLanguage();
         $message .= $this->sig_string;
         $message .= _('Diese Nachricht wurde automatisch vom Stud.IP-System generiert. Sie können darauf nicht antworten.');
         restoreLanguage();
     }
     // Setzen der Message-ID als Range_ID für angehängte Dateien
     if (isset($this->provisonal_attachment_id) && $GLOBALS['ENABLE_EMAIL_ATTACHMENTS']) {
         $query = "UPDATE dokumente SET range_id = ?, description = '' WHERE dokument_id = ?";
         $statement = DBManager::get()->prepare($query);
         foreach (get_message_attachments($this->provisonal_attachment_id, true) as $attachment) {
             $statement->execute(array($tmp_message_id, $attachment['dokument_id']));
         }
     }
     // insert message
     $query = "INSERT INTO message (message_id, autor_id, subject, message, priority, mkdate)\n                  VALUES (?, ?, ?, ?, ?, UNIX_TIMESTAMP())";
     $statement = DBManager::get()->prepare($query);
     $statement->execute(array($tmp_message_id, $snd_user_id, $subject, $message, $priority));
     // insert snd
     $insert_tags = DBManager::get()->prepare("\n            INSERT IGNORE INTO message_tags\n            SET message_id = :message_id,\n                user_id = :user_id,\n                tag = :tag,\n                chdate = UNIX_TIMESTAMP(),\n                mkdate = UNIX_TIMESTAMP()\n        ");
     $query = "INSERT INTO message_user (message_id, user_id, snd_rec, deleted, mkdate)\n                  VALUES (?, ?, 'snd', ?, UNIX_TIMESTAMP())";
     $statement = DBManager::get()->prepare($query);
     $statement->execute(array($tmp_message_id, $snd_user_id, $set_deleted ? 1 : 0));
     if ($tags) {
         is_array($tags) || ($tags = explode(" ", (string) $tags));
         foreach ($tags as $tag) {
             $insert_tags->execute(array('message_id' => $tmp_message_id, 'user_id' => $snd_user_id, 'tag' => strtolower($tag)));
         }
     }
     // heben wir kein array bekommen, machen wir einfach eins ...
     if (!is_array($rec_uname)) {
         $rec_uname = array($rec_uname);
     }
     // wir bastelen ein neues array, das die user_id statt des user_name enthaelt
     $rec_id = array();
     foreach ($rec_uname as $one) {
         $rec_id[] = User::findByUsername($one)->user_id;
     }
     $rec_id = array_filter($rec_id);
     // wir gehen das eben erstellt array durch und schauen, ob irgendwer was weiterleiten moechte.
     // diese user_id schreiben wir in ein tempraeres array
     foreach ($rec_id as $one) {
         $tmp_forward_id = User::find($this->get_forward_id($one))->user_id;
         if ($tmp_forward_id) {
             $rec_id[] = $tmp_forward_id;
         }
     }
     // wir mergen die eben erstellten arrays und entfernen doppelte eintraege
     $rec_id = array_unique($rec_id);
     // hier gehen wir alle empfaenger durch, schreiben das in die db und schicken eine mail
     $query = "INSERT INTO message_user (message_id, user_id, snd_rec, mkdate)\n                   VALUES (?, ?, 'rec', UNIX_TIMESTAMP())";
     $insert = DBManager::get()->prepare($query);
     $snd_name = $user_id != '____%system%____' ? User::find($user_id)->getFullName() . ' (' . User::find($user_id)->username . ')' : 'Stud.IP-System';
     foreach ($rec_id as $one) {
         $insert->execute(array($tmp_message_id, $one));
         if ($GLOBALS['MESSAGING_FORWARD_AS_EMAIL']) {
             // mail to original receiver
             $mailstatus_original = $this->user_wants_email($one);
             if ($mailstatus_original == 2 || $mailstatus_original == 3 && $email_request == 1 || $force_email) {
                 $this->sendingEmail($one, $snd_user_id, $message, $subject, $tmp_message_id);
             }
         }
         if ($tags) {
             foreach ($tags as $tag) {
                 $insert_tags->execute(array('message_id' => $tmp_message_id, 'user_id' => $one, 'tag' => strtolower($tag)));
             }
         }
     }
     // Obtain all users that should receive a notification
     $user_ids = $rec_id;
     if (is_object($GLOBALS['user'])) {
         $user_ids = array_diff($user_ids, array($GLOBALS['user']->id));
     }
     // Create notifications
     PersonalNotifications::add($user_ids, URLHelper::getUrl("dispatch.php/messages/read/{$tmp_message_id}", array('cid' => null)), sprintf(_('Sie haben eine Nachricht von %s erhalten!'), $snd_name), 'message_' . $tmp_message_id, Icon::create('mail', 'clickable')->asImagePath(80));
     return sizeof($rec_id);
 }
Exemplo n.º 18
0
    $app->notFound();
}
$parameters = Util::convertUriToParameters();
@($page = max(1, $parameters["page"]));
global $loadGroupShips;
// Can't think of another way to do this just yet
$loadGroupShips = $key == "group";
$limit = 50;
$parameters["limit"] = $limit;
$parameters["page"] = $page;
$detail = call_user_func($map[$key]["details"], $id, $parameters);
//$totalKills = isset($detail["shipsDestroyed"]) ? $detail["shipsDestroyed"] : 0;
//$totalLosses = isset($detail["shipsLost"]) ? $detail["shipsLost"] : 0;
$pageName = isset($detail[$map[$key]["column"] . "Name"]) ? $detail[$map[$key]["column"] . "Name"] : "???";
$columnName = $map[$key]["column"] . "ID";
$mixedKills = $pageType == "overview" && $map[$key]["mixed"] && UserConfig::get("mixKillsWithLosses", true);
$mixed = $pageType == "overview" ? Kills::getKills($parameters) : array();
$kills = $pageType == "kills" ? Kills::getKills($parameters) : array();
$losses = $pageType == "losses" ? Kills::getKills($parameters) : array();
if ($pageType != "solo" || $key == "faction") {
    $soloKills = array();
    //$soloCount = 0;
} else {
    $soloParams = $parameters;
    if (!isset($parameters["kills"]) || !isset($parameters["losses"])) {
        $soloParams["mixed"] = true;
    }
    $soloKills = Kills::getKills($soloParams);
    //$soloCount = Db::queryField("select count(killID) count from zz_participants where " . $map[$key]["column"] . "ID = :id and isVictim = 1 and number_involved = 1", "count", array(":id" => $id), 3600);
}
//$soloPages = ceil($soloCount / $limit);
Exemplo n.º 19
0
            </label>
        </td>
    </tr>
    <? endif ?>

    <tr>
        <td>
            <label for="expiration_date"><?php 
echo _('Ablaufdatum');
?>
:</label>
        </td>
        <td colspan="2">
            <input class="user_form" type="text"
                   name="expiration_date" id="expiration_date"
                   value="<? if (UserConfig::get($user['user_id'])->EXPIRATION_DATE) echo strftime('%x', UserConfig::get($user['user_id'])->EXPIRATION_DATE); ?>">
            <label>
                <input type="checkbox" onchange="jQuery('input[name=expiration_date]').val('');" name="expiration_date_delete" value="1">
                <?php 
echo _('löschen');
?>
            </label>
        </td>
    </tr>
</tbody>

<? if (in_array($user['perms'], words('autor tutor dozent'))) : ?>
<tbody>
    <tr class="header-row">
        <th colspan="3" class="toggle-indicator">
            <a class="toggler"><b><?php 
Exemplo n.º 20
0
?>
    </div>
    <div id="barBottommiddle">
        <?php 
echo $current_page != "" ? htmlReady($current_page) : "";
?>
        <?php 
echo $public_hint ? '(' . htmlReady($public_hint) . ')' : '';
?>
    </div>
    <!-- Dynamische Links ohne Icons -->
    <div id="barBottomright">
        <ul>
            <? if (is_object($GLOBALS['perm']) && PersonalNotifications::isActivated() && $GLOBALS['perm']->have_perm("autor")) : ?>
            <? $notifications = PersonalNotifications::getMyNotifications() ?>
            <? $lastvisit = (int) UserConfig::get($GLOBALS['user']->id)->getValue('NOTIFICATIONS_SEEN_LAST_DATE') ?>
            <li id="notification_container"<?php 
echo count($notifications) > 0 ? ' class="hoverable"' : "";
?>
>
                <? foreach ($notifications as $notification) {
                    if ($notification['mkdate'] > $lastvisit) {
                        $alert = true;
                    }
                } ?>
                <div id="notification_marker"<?php 
echo $alert ? ' class="alert"' : "";
?>
 title="<?php 
echo _("Benachrichtigungen");
?>
Exemplo n.º 21
0
 /**
  * Sets the background-color of the notification-number to blue, so it does
  * not annoy the user anymore. But he/she is still able to see the notificaion-list.
  * Just sets a unix-timestamp in the user-config NOTIFICATIONS_SEEN_LAST_DATE.
  */
 public function notifications_seen_action()
 {
     UserConfig::get($GLOBALS['user']->id)->store('NOTIFICATIONS_SEEN_LAST_DATE', time());
     $this->render_text(time());
 }
Exemplo n.º 22
0
    $type = $map[$key]['column'];
    $detail = Info::getInfoDetails("{$type}ID", $id);
    if (isset($detail['valid']) && $detail['valid'] == false) {
        $app->notFound();
    }
} catch (Exception $ex) {
    $app->render('error.html', array('message' => "There was an error fetching information for the {$key} you specified."));
    return;
}
$pageName = isset($detail[$map[$key]['column'] . 'Name']) ? $detail[$map[$key]['column'] . 'Name'] : '???';
if ($pageName == '???' && !$mdb->exists('information', ['id' => $id])) {
    return $app->render('404.html', array('message' => 'This entity is not in our database.'), 404);
    die;
}
$columnName = $map[$key]['column'] . 'ID';
$mixedKills = $pageType == 'overview' && $map[$key]['mixed'] && UserConfig::get('mixKillsWithLosses', true);
$mixed = $pageType == 'overview' ? Kills::getKills($parameters) : array();
$kills = $pageType == 'kills' ? Kills::getKills($parameters) : array();
$losses = $pageType == 'losses' ? Kills::getKills($parameters) : array();
if ($pageType != 'solo' || $key == 'faction') {
    $soloKills = array();
    //$soloCount = 0;
} else {
    $soloParams = $parameters;
    if (!isset($parameters['kills']) || !isset($parameters['losses'])) {
        $soloParams['mixed'] = true;
    }
    $soloKills = Kills::getKills($soloParams);
}
//$soloPages = ceil($soloCount / $limit);
$solo = Kills::mergeKillArrays($soloKills, array(), $limit, $columnName, $id);
Exemplo n.º 23
0
 /**
  * send out the notification messages for the passed topic. The contents
  * and a link directly to the topic are added to the messages.
  * 
  * @param string $topic_id
  */
 static function notify($topic_id)
 {
     // send message to all abo-users
     $db = DBManager::get();
     $messaging = new ForumBulkMail();
     // $messaging = new Messaging();
     // get all parent topic-ids, to find out which users to notify
     $path = ForumEntry::getPathToPosting($topic_id);
     // fetch all users to notify, exlcude current user
     $stmt = $db->prepare("SELECT DISTINCT user_id\n            FROM forum_abo_users\n            WHERE topic_id IN (:topic_ids)\n                AND user_id != :user_id");
     $stmt->bindParam(':topic_ids', array_keys($path), StudipPDO::PARAM_ARRAY);
     $stmt->bindParam(':user_id', $GLOBALS['user']->id);
     $stmt->execute();
     // get details for topic
     $topic = ForumEntry::getConstraints($topic_id);
     $template_factory = new Flexi_TemplateFactory(dirname(__FILE__) . '/../views');
     $template = $template_factory->open('index/_mail_notification');
     // notify users
     while ($data = $stmt->fetch(PDO::FETCH_ASSOC)) {
         $user_id = $data['user_id'];
         // create subject and content
         setTempLanguage(get_userid($user_id));
         // check if user wants an email for all or selected messages only
         $force_email = false;
         if ($messaging->user_wants_email($user_id)) {
             $force_email = true;
         }
         $parent_id = ForumEntry::getParentTopicId($topic['topic_id']);
         setTempLanguage($data['user_id']);
         $notification = sprintf(_("%s hat einen Beitrag geschrieben"), $topic['anonymous'] ? _('Anonym') : $topic['author']);
         restoreLanguage();
         PersonalNotifications::add($user_id, UrlHelper::getUrl('plugins.php/coreforum/index/index/' . $topic['topic_id'] . '#' . $topic['topic_id'], array('cid' => $topic['seminar_id']), true), $notification, "forumposting_" . $topic['topic_id'], Icon::create('forum', 'clickable')->asImagePath(40));
         if ($force_email) {
             $title = implode(' >> ', ForumEntry::getFlatPathToPosting($topic_id));
             $subject = addslashes(_('[Forum]') . ' ' . ($title ?: _('Neuer Beitrag')));
             $htmlMessage = $template->render(compact('user_id', 'topic', 'path'));
             $textMessage = trim(kill_format($htmlMessage));
             $userWantsHtml = UserConfig::get($user_id)->getValue('MAIL_AS_HTML');
             StudipMail::sendMessage(User::find($user_id)->email, $subject, addslashes($textMessage), $userWantsHtml ? $htmlMessage : null);
         }
         restoreLanguage();
     }
     $messaging->bulkSend();
 }
Exemplo n.º 24
0
    }
    if (@$domainChar['isExecutorCEO']) {
        $subdomain = modifyTicker($domainChar['alliTicker']) . ".{$baseAddr}";
        if (isset($bannerUpdates[$subdomain])) {
            $banner = $bannerUpdates[$subdomain];
            Db::execute('insert into zz_subdomains (subdomain, banner) values (:subdomain, :banner) on duplicate key update banner = :banner', array(':subdomain' => $subdomain, ':banner' => $banner));
            $error = "Banner updated for {$subdomain}, please wait 2 minutes for the change to take effect.";
        }
        $status = Db::queryRow('select adfreeUntil, banner from zz_subdomains where subdomain = :subdomain', array(':subdomain' => $subdomain), 0);
        $domainChar['adfreeUntil'] = @$status['adfreeUntil'];
        $domainChar['banner'] = @$status['banner'];
        $allis[] = $domainChar;
    }
    $showDisqus = Util::getPost('showDisqus');
    if ($showDisqus) {
        UserConfig::set('showDisqus', $showDisqus == 'true');
        $error = 'Disqus setting updated to ' . ($showDisqus ? ' display.' : ' not display.') . ' The next page load will reflect the change.';
    }
}
$data['domainCorps'] = $corps;
$data['domainAllis'] = $allis;
$data['domainChars'] = $domainChars;
$data['showDisqus'] = UserConfig::get('showDisqus', true);
$app->render('account.html', array('data' => $data, 'message' => $error, 'key' => $key, 'reqid' => $reqid));
function modifyTicker($ticker)
{
    $ticker = str_replace(' ', '_', $ticker);
    $ticker = preg_replace('/^\\./', 'dot.', $ticker);
    $ticker = preg_replace('/\\.$/', '.dot', $ticker);
    return strtolower($ticker);
}
Exemplo n.º 25
0
if ($load >= 20) {
    $uri = @$_SERVER['REQUEST_URI'];
    if ($uri != '') {
        $contents = $redis->get("cache:{$uri}");
        if ($contents !== false) {
            echo $contents;
            exit;
        }
        $_SERVER['requestDttm'] = $mdb->now();
        $qServer = new RedisQueue('queueServer');
        $qServer->push($_SERVER);
    }
}
// Theme
if (User::isLoggedIn()) {
    $theme = UserConfig::get('theme');
}
$app->config(array('templates.path' => $baseDir . 'templates/'));
// Error handling
$app->error(function (\Exception $e) use($app) {
    include 'view/error.php';
});
// Load the routes - always keep at the bottom of the require list ;)
include 'routes.php';
// Load twig stuff
include 'twig.php';
// Run the thing!
$app->run();
function getLoad()
{
    $output = array();
Exemplo n.º 26
0
 public static function getUserTrackerData()
 {
     $entities = array('character', 'corporation', 'alliance', 'faction', 'ship', 'item', 'system', 'region');
     $entlist = array();
     foreach ($entities as $ent) {
         $result = UserConfig::get("tracker_{$ent}");
         $part = array();
         if ($result != null) {
             foreach ($result as $row) {
                 switch ($ent) {
                     case 'system':
                         $row['solarSystemID'] = $row['id'];
                         $row['solarSystemName'] = $row['name'];
                         break;
                     case 'item':
                         $row['typeID'] = $row['id'];
                         $row['shipName'] = $row['name'];
                         break;
                     case 'ship':
                         $row['shipTypeID'] = $row['id'];
                         $row["{$ent}Name"] = $row['name'];
                         break;
                     default:
                         $row["{$ent}ID"] = $row['id'];
                         $row["{$ent}Name"] = $row['name'];
                         break;
                 }
                 $part[] = $row;
             }
         }
         $entlist[$ent] = $part;
     }
     return $entlist;
 }
Exemplo n.º 27
0
 /**
  * old style usage with $user_id, $key as params
  * still works but is deprecated
  * @param string $field
  * @return bool
  */
 function unsetValue($field)
 {
     $args = func_get_args();
     if (count($args) > 1) {
         list($user_id, $key) = $args;
         if ($user_id !== null && $key !== null) {
             $ret = UserConfig::get($user_id)->delete($key);
         }
         if ($user_id === null) {
             $ret = $this->delete($key);
         }
         trigger_error('deprecated use of ' . __METHOD__, E_USER_NOTICE);
         return $ret;
     }
     return $this->delete($field);
 }
Exemplo n.º 28
0
$twig->addGlobal('accountBalance', $accountBalance);
$twig->addGlobal('adFreeMonthCost', $adFreeMonthCost);
// Display a banner?
$banner = false;
// Db::queryField('select banner from zz_subdomains where (subdomain = :server or alias = :server)', 'banner', array(':server' => $_SERVER['SERVER_NAME']), 60);
if ($banner) {
    $banner = str_replace('http://i.imgur.com/', 'https://i.imgur.com/', $banner);
    $banner = str_replace('http://imgur.com/', 'https://imgur.com/', $banner);
    //$twig->addGlobal("headerImage", $banner);
}
$twig->addGlobal('showAds', $userShowAds);
$_SERVER['SERVER_NAME'] = 'zkillboard.com';
//Subdomains::getSubdomainParameters($_SERVER['SERVER_NAME']);
$twig->addGlobal('KillboardName', isset($killboardName) ? $killboardName : 'zKillboard');
// Set the style used side wide to the user selected one, or the config default
$twig->addGlobal('style', UserConfig::get('style', $style));
$twig->addExtension(new UserGlobals());
$twig->addFunction(new Twig_SimpleFunction('pageTimer', 'Util::pageTimer'));
$twig->addFunction(new Twig_SimpleFunction('queryCount', 'Db::getQueryCount'));
$twig->addFunction(new Twig_SimpleFunction('isActive', 'Util::isActive'));
$twig->addFunction(new Twig_SimpleFunction('pluralize', 'Util::pluralize'));
$twig->addFunction(new Twig_SimpleFunction('formatIsk', 'Util::formatIsk'));
$twig->addFunction(new Twig_SimpleFunction('shortNum', 'Util::formatIsk'));
$twig->addFunction(new Twig_SimpleFunction('shortString', 'Util::shortString'));
$twig->addFunction(new Twig_SimpleFunction('truncate', 'Util::truncate'));
$twig->addFunction(new Twig_SimpleFunction('chart', 'Chart::addChart'));
$twig->addFunction(new Twig_SimpleFunction('getMonth', 'Util::getMonth'));
$twig->addFunction(new Twig_SimpleFunction('getLongMonth', 'Util::getLongMonth'));
// IGB
$igb = false;
if (stristr(@$_SERVER['HTTP_USER_AGENT'], 'EVE-IGB')) {
Exemplo n.º 29
0
 /**
  * getWidgetUserConfig - retrieves user_config entry for widget newly added by a user
  *
  * @param string $id user_id
  * @param string $pluginName
  * 
  * @return object UserConfig
  */
 static function getWidgetUserConfig($id, $pluginName)
 {
     return UserConfig::get($id)->getValue($pluginName);
 }
Exemplo n.º 30
-1
        }
    }
    $ddcombine = Util::getPost("ddcombine");
    if (isset($ddcombine)) {
        UserConfig::set("ddcombine", $ddcombine);
    }
    $ddmonthyear = Util::getPost("ddmonthYear");
    if (isset($ddmonthyear)) {
        UserConfig::set("ddmonthyear", $ddmonthyear);
    }
    $useSummaryAccordion = Util::getPost("useSummaryAccordion");
    if (isset($useSummaryAccordion)) {
        UserConfig::set("useSummaryAccordion", $useSummaryAccordion);
    }
}
$data["entities"] = Account::getUserTrackerData();
$data["themes"] = Util::bootstrapThemes();
$data["viewthemes"] = Util::themesAvailable();
$data["apiKeys"] = Api::getKeys($userID);
$data["apiChars"] = Api::getCharacters($userID);
$charKeys = Api::getCharacterKeys($userID);
$charKeys = Info::addInfo($charKeys);
$data["apiCharKeys"] = $charKeys;
$data["userInfo"] = User::getUserInfo();
$data["currentTheme"] = UserConfig::get("theme", "default");
$data["timeago"] = UserConfig::get("timeago");
$data["ddcombine"] = UserConfig::get("ddcombine");
$data["ddmonthyear"] = UserConfig::get("ddmonthyear");
$data["useSummaryAccordion"] = UserConfig::get("useSummaryAccordion");
$data["sessions"] = User::getSessions($userID);
$app->render("account.html", array("data" => $data, "message" => $error, "key" => $key, "reqid" => $reqid));