Example #1
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();
         }
     }
 }
 public function afterStoreCallback()
 {
     if ($this->isDirty()) {
         //add notification to writer of review
         if (!$this->review['host_id'] && $this->review['user_id'] !== $this['user_id']) {
             PersonalNotifications::add($this->review['user_id'], URLHelper::getURL("plugins.php/lernmarktplatz/market/discussion/" . $this['review_id'] . "#comment_" . $this->getId()), sprintf(_("%s hat einen Kommentar zu Ihrem Review geschrieben."), $this['host_id'] ? LernmarktplatzUser::find($this['user_id'])->name : get_fullname($this['user_id'])), "comment_" . $this->getId(), Icon::create("support", "clickable"));
         }
         //add notification to all users of this servers who discussed this review but are neither the new
         //commentor nor the writer of the review
         $statement = DBManager::get()->prepare("\n                SELECT user_id\n                FROM lernmarktplatz_comments\n                WHERE review_id = :review_id\n                    AND host_id IS NULL\n                GROUP BY user_id\n            ");
         $statement->execute(array('review_id' => $this->review->getId()));
         foreach ($statement->fetchAll(PDO::FETCH_COLUMN, 0) as $user_id) {
             if (!in_array($user_id, array($this->review['user_id'], $this['user_id']))) {
                 PersonalNotifications::add($user_id, URLHelper::getURL("plugins.php/lernmarktplatz/market/discussion/" . $this['review_id'] . "#comment_" . $this->getId()), sprintf(_("%s hat auch einen Kommentar geschrieben."), $this['host_id'] ? LernmarktplatzUser::find($this['user_id'])->name : get_fullname($this['user_id'])), "comment_" . $this->getId(), Icon::create("support", "clickable"));
             }
         }
         //only push if the comment is from this server and the material-server is different
         if (!$this['host_id']) {
             $myHost = LernmarktplatzHost::thisOne();
             $data = array();
             $data['host'] = array('name' => $myHost['name'], 'url' => $myHost['url'], 'public_key' => $myHost['public_key']);
             $data['data'] = $this->toArray();
             $data['data']['foreign_comment_id'] = $data['data']['comment_id'];
             unset($data['data']['comment_id']);
             unset($data['data']['id']);
             unset($data['data']['user_id']);
             unset($data['data']['host_id']);
             $user_description_datafield = DataField::find(get_config("LERNMARKTPLATZ_USER_DESCRIPTION_DATAFIELD")) ?: DataField::findOneBySQL("name = ?", array(get_config("LERNMARKTPLATZ_USER_DESCRIPTION_DATAFIELD")));
             if ($user_description_datafield) {
                 $datafield_entry = DatafieldEntryModel::findOneBySQL("range_id = ? AND datafield_id = ?", array($this['user_id'], $user_description_datafield->getId()));
             }
             $data['user'] = array('user_id' => $this['user_id'], 'name' => get_fullname($this['user_id']), 'avatar' => Avatar::getAvatar($this['user_id'])->getURL(Avatar::NORMAL), 'description' => $datafield_entry ? $datafield_entry['content'] : null);
             $statement = DBManager::get()->prepare("\n                    SELECT host_id\n                    FROM lernmarktplatz_comments\n                    WHERE review_id = :review_id\n                        AND host_id IS NOT NULL\n                    GROUP BY host_id\n                ");
             $statement->execute(array('review_id' => $this->review->getId()));
             $hosts = $statement->fetchAll(PDO::FETCH_COLUMN, 0);
             if ($this->review['host_id'] && !in_array($this->review['host_id'], $hosts)) {
                 $hosts[] = $this->review['host_id'];
             }
             if ($this->review->material['host_id'] && !in_array($this->review->material['host_id'], $hosts)) {
                 $hosts[] = $this->review->material['host_id'];
             }
             foreach ($hosts as $host_id) {
                 $remote = new LernmarktplatzHost($host_id);
                 if (!$remote->isMe()) {
                     $review_id = $this->review['foreign_review_id'] ?: $this->review->getId();
                     if ($this->review['foreign_review_id']) {
                         if ($this->review->host_id === $remote->getId()) {
                             $host_hash = null;
                         } else {
                             $host_hash = md5($this->review->host['public_key']);
                         }
                     } else {
                         $host_hash = md5($myHost['public_key']);
                     }
                     $remote->pushDataToEndpoint("add_comment/" . $review_id . "/" . $host_hash, $data);
                 }
             }
         }
     }
 }
Example #3
0
function plugin_newpage_action()
{
    global $vars;
    $qm = get_qm();
    if (PKWK_READONLY) {
        die_message($qm->m['fmt_err_pkwk_readonly']);
    }
    if ($vars['page'] == '') {
        $retvars['msg'] = $qm->m['plg_newpage']['label'];
        $retvars['body'] = plugin_newpage_convert();
        if (preg_match('/id="([^"]+)"/', $retvars['body'], $ms)) {
            $domid = $ms[1];
            //jquery ライブラリの読み込み
            $qt = get_qt();
            $qt->setv('jquery_include', true);
            $addscript = <<<EOS
<script type="text/javascript">
jQuery(function(){
\tjQuery("#{$domid}").focus().select();
});
</script>
EOS;
            $qt->appendv_once('plugin_select_fsize', 'beforescript', $addscript);
        }
        return $retvars;
    } else {
        $page = strip_bracket($vars['page']);
        $r_page = rawurlencode(isset($vars['refer']) ? get_fullname($page, $vars['refer']) : $page);
        $r_refer = rawurlencode($vars['refer']);
        pkwk_headers_sent();
        header('Location: ' . get_script_uri() . '?cmd=read&page=' . $r_page . '&refer=' . $r_refer);
        exit;
    }
}
 public function afterStoreCallback()
 {
     if (!$this->material['host_id'] && $this->material['user_id'] !== $GLOBALS['user']->id) {
         PersonalNotifications::add($this->material['user_id'], URLHelper::getURL("plugins.php/lernmarktplatz/market/details/" . $this->material->getId() . "#review_" . $this->getId()), $this->isNew() ? sprintf(_("%s hat ein Review zu '%s' geschrieben."), $this['host_id'] ? LernmarktplatzUser::find($this['user_id'])->name : get_fullname($this['user_id']), $this->material['name']) : sprintf(_("%s hat ein Review zu '%s' verändert."), $this['host_id'] ? LernmarktplatzUser::find($this['user_id'])->name : get_fullname($this['user_id']), $this->material['name']), "review_" . $this->getId(), Icon::create("support", "clickable"));
     }
     //only push if the comment is from this server and the material-server is different
     if ($this->material['host_id'] && !$this['host_id'] && $this->isDirty()) {
         $remote = new LernmarktplatzHost($this->material['host_id']);
         $myHost = LernmarktplatzHost::thisOne();
         $data = array();
         $data['host'] = array('name' => $myHost['name'], 'url' => $myHost['url'], 'public_key' => $myHost['public_key']);
         $data['data'] = $this->toArray();
         $data['data']['foreign_review_id'] = $data['data']['review_id'];
         unset($data['data']['review_id']);
         unset($data['data']['id']);
         unset($data['data']['user_id']);
         unset($data['data']['host_id']);
         $user_description_datafield = DataField::find(get_config("LERNMARKTPLATZ_USER_DESCRIPTION_DATAFIELD")) ?: DataField::findOneBySQL("name = ?", array(get_config("LERNMARKTPLATZ_USER_DESCRIPTION_DATAFIELD")));
         if ($user_description_datafield) {
             $datafield_entry = DatafieldEntryModel::findOneBySQL("range_id = ? AND datafield_id = ?", array($this['user_id'], $user_description_datafield->getId()));
         }
         $data['user'] = array('user_id' => $this['user_id'], 'name' => get_fullname($this['user_id']), 'avatar' => Avatar::getAvatar($this['user_id'])->getURL(Avatar::NORMAL), 'description' => $datafield_entry ? $datafield_entry['content'] : null);
         if (!$remote->isMe()) {
             $remote->pushDataToEndpoint("add_review/" . $this->material['foreign_material_id'], $data);
         }
     }
 }
function plugin_newpage_action()
{
    global $vars;
    $_btn_edit = _('Edit');
    $_msg_newpage = _('New page');
    // if (PKWK_READONLY) die_message('PKWK_READONLY prohibits editing');
    if (auth::check_role('readonly')) {
        die_message(_('PKWK_READONLY prohibits editing'));
    }
    if (auth::is_check_role(PKWK_CREATE_PAGE)) {
        die_message(_('PKWK_CREATE_PAGE prohibits editing'));
    }
    if ($vars['page'] == '') {
        $retvars['msg'] = $_msg_newpage;
        $retvars['body'] = plugin_newpage_convert();
        return $retvars;
    } else {
        $page = strip_bracket($vars['page']);
        if (isset($vars['refer'])) {
            $r_page = get_fullname($page, $vars['refer']);
            $r_refer = 'refer=' . $vars['refer'];
        } else {
            $r_page = $page;
            $r_refer = '';
        }
        pkwk_headers_sent();
        header('Location: ' . get_page_location_uri($r_page, $r_refer));
        exit;
    }
}
Example #6
0
 function user($userid, $action, $page)
 {
     $userid = $this->home_model->check_user_existance($userid);
     $return = $this->global_function->initialize('user', TRUE, $userid);
     $username = $return['username'];
     if ($userid != FALSE) {
         $return['sidebar_stats'] = $this->home_model->get_sidebar_stats($userid);
         $return['badges'] = $this->home_model->get_badges($userid);
         if ($action == 'following') {
             $return['main'] = $this->home_model->get_user_following($userid, $page, $username);
             $return['content_type'] = 'people';
             $return['body_title'] = get_fullname($userid, FALSE) . '\'s Following';
         } elseif ($action == 'followers') {
             $return['main'] = $this->home_model->get_user_followers($userid, $page, $username);
             $return['content_type'] = 'people';
             $return['body_title'] = get_fullname($userid, FALSE) . '\'s Followers';
         } elseif ($action == '') {
             $return['main'] = $this->home_model->get_user_timeline($userid, $page);
             $return['body_title'] = get_fullname($userid, FALSE) . '\'s Activities';
         } elseif ($action == 'followings') {
             redirect('/' . $userid . '/following');
         } elseif ($action == 'follower') {
             redirect('/' . $userid . '/followers');
         } else {
             redirect('/' . $userid);
         }
         $this->global_function->load_view($return);
     } else {
         $this->global_function->load_view($return, TRUE, 404);
     }
 }
Example #7
0
 /**
  * Set the posting denoted by the passed topic_id as liked for the
  * currently logged in user
  * 
  * @param string $topic_id
  */
 static function like($topic_id)
 {
     $stmt = DBManager::get()->prepare("REPLACE INTO\n            forum_likes (topic_id, user_id)\n            VALUES (?, ?)");
     $stmt->execute(array($topic_id, $GLOBALS['user']->id));
     // get posting owner
     $data = ForumEntry::getConstraints($topic_id);
     // notify owner of posting about the like
     setTempLanguage($data['user_id']);
     $notification = get_fullname($GLOBALS['user']->id) . _(' gefällt einer deiner Forenbeiträge!');
     restoreLanguage();
     PersonalNotifications::add($data['user_id'], PluginEngine::getURL('coreforum/index/index/' . $topic_id . '?highlight_topic=' . $topic_id . '#' . $topic_id), $notification, $topic_id, Icon::create('forum', 'clickable')->asImagePath(40));
 }
Example #8
0
 function Studip_User($user)
 {
     $fields = self::get_fields();
     foreach ($fields as $field) {
         if (isset($user[$field])) {
             $this->{$field} = $user[$field];
         }
     }
     if (isset($this->id)) {
         $this->fullname = get_fullname($this->id);
     }
 }
 /**
  * Check validity of page
  *
  * @access static
  * @param string $page
  * @param array $options
  * @return $options
  */
 function check_page($page, $current)
 {
     $page = get_fullname($page, $current);
     if (!is_page($page)) {
         sonots::mythrow('Page "' . htmlspecialchars($page) . '" does not exist.');
         return;
     }
     if (!check_readable($page, FALSE, FALSE)) {
         sonots::mythrow('Page "' . htmlspecialchars($page) . '" is not readable.');
         return;
     }
     return $page;
 }
Example #10
0
 /**
  * Notifies the user with Stud.IP-message that/he/she was mentioned in a
  * blubber-posting.
  * @param type $posting
  */
 public function mention($posting)
 {
     $messaging = new messaging();
     setTempLanguage($this->getId());
     $url = $GLOBALS['ABSOLUTE_URI_STUDIP'] . "plugins.php/blubber/streams/thread/" . $posting['root_id'] . ($posting['context_type'] === "course" ? '?cid=' . $posting['Seminar_id'] : "");
     $body = sprintf(gettext("%s hat Sie in einem Blubber erwähnt. Zum Beantworten klicken auf Sie auf folgenen Link:\n\n%s\n"), get_fullname(), $url);
     if ($posting['context_type'] === "course" && !$GLOBALS['perm']->have_studip_perm("user", $posting['Seminar_id'], $this->getId())) {
         $body .= "\n\n" . _("Sie sind noch kein Mitglied der zugehörigen Veranstaltung. Melden Sie sich erst hier an, damit Sie den Blubber sehen können: ") . ($GLOBALS['SEM_CLASS'][$GLOBALS['SEM_TYPE'][Course::find($posting['Seminar_id'])->status]['class']]['studygroup_mode'] ? $GLOBALS['ABSOLUTE_URI_STUDIP'] . "dispatch.php/course/studygroup/details/" . $posting['Seminar_id'] : $GLOBALS['ABSOLUTE_URI_STUDIP'] . "dispatch.php/course/details?sem_id=" . $posting['Seminar_id']);
     }
     $mention_text = _("Sie wurden erwähnt.");
     restoreLanguage();
     $messaging->insert_message($body, $this['username'], $GLOBALS['user']->id, null, null, null, null, $mention_text);
 }
Example #11
0
 /**
  * Create/Update the linked posting for the passed issue_id
  * 
  * @param string $seminar_id
  * @param string $issue_id    issue id to link to
  * @param string $title       (new) title of the posting
  * @param string $content     (new) content of the posting
  */
 static function setThreadForIssue($seminar_id, $issue_id, $title, $content)
 {
     if ($topic_id = self::getThreadIdForIssue($issue_id)) {
         // update
         ForumEntry::update($topic_id, $title ?: _('Ohne Titel'), $content);
     } else {
         // create
         // make sure the forum is set up properly
         ForumEntry::checkRootEntry($seminar_id);
         $topic_id = md5(uniqid(rand()));
         ForumEntry::insert(array('topic_id' => $topic_id, 'seminar_id' => $seminar_id, 'user_id' => $GLOBALS['user']->id, 'name' => $title ?: _('Ohne Titel'), 'content' => $content, 'author' => get_fullname($GLOBALS['user']->id), 'author_host' => getenv('REMOTE_ADDR')), $seminar_id);
         $stmt = DBManager::get()->prepare("INSERT INTO forum_entries_issues\n                (issue_id, topic_id) VALUES (?, ?)");
         $stmt->execute(array($issue_id, $topic_id));
     }
 }
Example #12
0
/**
 *
 * @param unknown_type $group_field
 * @param unknown_type $groups
 */
function get_group_names($group_field, $groups)
{
    global $SEM_TYPE, $SEM_CLASS;
    $groupcount = 1;
    if ($group_field == 'sem_tree_id') {
        $the_tree = TreeAbstract::GetInstance("StudipSemTree", array("build_index" => true));
    }
    if ($group_field == 'sem_number') {
        $all_semester = SemesterData::GetSemesterArray();
    }
    foreach ($groups as $key => $value) {
        switch ($group_field) {
            case 'sem_number':
                $ret[$key] = $all_semester[$key]['name'];
                break;
            case 'sem_tree_id':
                if ($the_tree->tree_data[$key]) {
                    //$ret[$key] = $the_tree->getShortPath($key);
                    $ret[$key][0] = $the_tree->tree_data[$key]['name'];
                    $ret[$key][1] = $the_tree->getShortPath($the_tree->tree_data[$key]['parent_id']);
                } else {
                    //$ret[$key] = _("keine Studienbereiche eingetragen");
                    $ret[$key][0] = _("keine Studienbereiche eingetragen");
                    $ret[$key][1] = '';
                }
                break;
            case 'sem_status':
                $ret[$key] = $SEM_TYPE[$key]["name"] . " (" . $SEM_CLASS[$SEM_TYPE[$key]["class"]]["name"] . ")";
                break;
            case 'not_grouped':
                $ret[$key] = _("keine Gruppierung");
                break;
            case 'gruppe':
                $ret[$key] = _("Gruppe") . " " . $groupcount;
                $groupcount++;
                break;
            case 'dozent_id':
                $ret[$key] = get_fullname($key, 'no_title_short');
                break;
            default:
                $ret[$key] = 'unknown';
                break;
        }
    }
    return $ret;
}
Example #13
0
    /**
    * constructor
    *
    * do not use directly, call TreeAbstract::GetInstance("StudipLitList", $range_id)
    * @access private
    */
    function StudipLitList($range_id) {
        DbView::addView('literatur');

        if ($GLOBALS['LIT_LIST_FORMAT_TEMPLATE']){
            $this->format_default = $GLOBALS['LIT_LIST_FORMAT_TEMPLATE'];
        }
        $this->range_id = $range_id;
        $this->range_type = get_object_type($range_id);
        if ($this->range_type == "user"){
            $this->root_name = get_fullname($range_id);
        } else {
            $object_name = get_object_name($range_id, $this->range_type);
            $this->root_name = $object_name['type'] . ": " . $object_name['name'];
        }
        $this->cat_element = new StudipLitCatElement();
        parent::TreeAbstract(); //calling the baseclass constructor
    }
Example #14
0
function plugin_newpage_action()
{
    global $vars, $_btn_edit, $_msg_newpage;
    if (PKWK_READONLY) {
        die_message('PKWK_READONLY prohibits editing');
    }
    if ($vars['page'] == '') {
        $retvars['msg'] = $_msg_newpage;
        $retvars['body'] = plugin_newpage_convert();
        return $retvars;
    } else {
        $page = strip_bracket($vars['page']);
        $r_page = rawurlencode(isset($vars['refer']) ? get_fullname($page, $vars['refer']) : $page);
        $r_refer = rawurlencode($vars['refer']);
        pkwk_headers_sent();
        header('Location: ' . get_script_uri() . '?cmd=read&page=' . $r_page . '&refer=' . $r_refer);
        exit;
    }
}
Example #15
0
function plugin_lastmod_inline()
{
    global $vars;
    global $WikiName, $BracketName;
    $args = func_get_args();
    if ($args[0]) {
        if (preg_match("/^({$WikiName}|\\[\\[{$BracketName}\\]\\])\$/", $args[0])) {
            $_page = get_fullname(strip_bracket($args[0]), $vars["page"]);
        } else {
            return FALSE;
        }
    } else {
        $_page = $vars["page"];
    }
    if (!is_page($_page)) {
        return FALSE;
    }
    return format_date(get_filetime($_page));
}
Example #16
0
function plugin_lastmod_inline()
{
    global $vars, $WikiName, $BracketName;
    $args = func_get_args();
    $page = $args[0];
    if ($page == '') {
        $page = $vars['page'];
        // Default: page itself
    } else {
        if (preg_match("/^({$WikiName}|{$BracketName})\$/", strip_bracket($page))) {
            $page = get_fullname(strip_bracket($page), $vars['page']);
        } else {
            return false;
        }
    }
    if (!is_page($page)) {
        return false;
    }
    return format_date(get_filetime($page));
}
Example #17
0
 function initialize($page, $condition = FALSE, $id = NULL)
 {
     $username = $this->get_username();
     $this->redirect_for_capability($username);
     $this->add_pageview($username, uri_string());
     $return['username'] = $username;
     $return['fullname'] = get_fullname($username, FALSE);
     $return['pageid'] = uri_string();
     $return['placeholder'] = 'Quizzes';
     $return['fileid'] = $page;
     $return['status'] = '';
     $return['page_type'] = '';
     $return['oel'] = FALSE;
     $return['session'] = $username == '' ? FALSE : TRUE;
     if ($page == 'About' || $page == 'FAQ' || $page == 'tour' || $page == 'business') {
         $return['oel'] = TRUE;
     }
     if ($page == "people" || $page == "find") {
         $return['content_type'] = $page;
         if ($page == "find") {
             $page = "quizzes";
         }
         $return['title'] = ucfirst($page);
     } elseif ($condition == FALSE) {
         $return['content_type'] = $page;
         $return['title'] = ucfirst($page);
         $return['userid'] = $username;
     } else {
         if (is_numeric($id)) {
             $return['content_type'] = "quiz";
             $return['title'] = get_title($id, FALSE);
             $return['quizid'] = $id;
         } else {
             $return['content_type'] = "user";
             $return['title'] = get_fullname($id, FALSE);
             $return['userid'] = $id;
         }
     }
     $return['sidebar_type'] = $return['content_type'];
     return $return;
 }
Example #18
0
 function add_action($category_id)
 {
     ForumPerm::check('add_area', $this->getId());
     $new_id = md5(uniqid(rand()));
     if (Request::isXhr()) {
         $name = studip_utf8decode(Request::get('name', _('Kein Titel')));
         $content = studip_utf8decode(Request::get('content'));
     } else {
         $name = Request::get('name', _('Kein Titel'));
         $content = Request::get('content');
     }
     ForumEntry::insert(array('topic_id' => $new_id, 'seminar_id' => $this->getId(), 'user_id' => $GLOBALS['user']->id, 'name' => $name, 'content' => $content, 'author' => get_fullname($GLOBALS['user']->id), 'author_host' => getenv('REMOTE_ADDR')), $this->getId());
     ForumCat::addArea($category_id, $new_id);
     if (Request::isXhr()) {
         $this->set_layout(null);
         $this->entry = array_pop(ForumEntry::parseEntries(array(ForumEntry::getEntry($new_id))));
         $this->visitdate = ForumVisit::getLastVisit($this->getId());
     } else {
         $this->redirect(PluginEngine::getLink('coreforum/index/index/'));
     }
 }
 function before_filter(&$action, &$args)
 {
     // Rewrite action?
     $this->actions = words('manifest details assets navigation icon polyfill');
     if (in_array($action, $this->actions)) {
         $args = array($action);
         $action = 'index';
     }
     // Initialize plugin stub
     if (!isset($_SESSION['plugin-generator'])) {
         $author = sprintf('%s <%s>', get_fullname($GLOBALS['auth']->auth['uid']), Helper::get_email($GLOBALS['auth']->auth['uid']));
         $_SESSION['plugin-generator']['plugin'] = Generator::getDefaults();
         $_SESSION['plugin-generator']['passed'] = array_fill_keys(array_keys($this->actions), false);
     }
     $this->plugin = $_SESSION['plugin-generator']['plugin'];
     // Initialize controller
     parent::before_filter($action, $args);
     $this->set_layout($GLOBALS['template_factory']->open('layouts/base'));
     PageLayout::setTitle('Plugin-Generator');
     Navigation::activateItem('/tools/plugingenerator');
 }
 public static function mention($markup, $matches)
 {
     $mention = $matches[0];
     $thread_id = self::$mention_thread_id;
     $username = stripslashes(substr($mention, 1));
     if ($username[0] !== '"') {
         $user_id = get_userid($username);
     } else {
         $name = substr($username, 1, strlen($username) - 2);
         $db = DBManager::get();
         $user_id = $db->query("SELECT user_id FROM auth_user_md5 WHERE CONCAT(Vorname, ' ', Nachname) = " . $db->quote($name) . " " . "")->fetch(PDO::FETCH_COLUMN, 0);
     }
     $thread = new ForumPosting($thread_id);
     if (!$thread->isNew() && $user_id && $user_id !== $GLOBALS['user']->id) {
         $user = new User($user_id);
         $messaging = new messaging();
         $url = $GLOBALS['ABSOLUTE_URI_STUDIP'] . "plugins.php/blubber/forum/thread/" . $thread_id . ($thread['context_type'] === "course" ? '?cid=' . $thread['Seminar_id'] : "");
         $messaging->insert_message(sprintf(_("%s hat Sie in einem Blubber erwähnt. Zum Beantworten klicken auf Sie auf folgenen Link:\n\n%s\n"), get_fullname(), $url), get_username($user_id), $GLOBALS['user']->id, null, null, null, null, _("Sie wurden erwähnt."));
         DBManager::get()->exec("INSERT IGNORE INTO blubber_mentions " . "SET user_id = " . DBManager::get()->quote($user_id) . ", " . "topic_id = " . DBManager::get()->quote($thread_id) . ", " . "mkdate = UNIX_TIMESTAMP() " . "");
         return '[' . $user['Vorname'] . " " . $user['Nachname'] . ']' . $GLOBALS['ABSOLUTE_URI_STUDIP'] . "about.php?username=" . $user['username'] . ' ';
     } else {
         return stripslashes($mention);
     }
 }
Example #21
0
 function set($arr, $page)
 {
     global $WikiName;
     list(, $alias, , $name, $this->anchor) = $this->splice($arr);
     if ($name == '' && $this->anchor == '') {
         return FALSE;
     }
     if ($name == '' || !preg_match('/^' . $WikiName . '$/', $name)) {
         if ($alias == '') {
             $alias = $name . $this->anchor;
         }
         if ($name != '') {
             $name = get_fullname($name, $page);
             if (!is_pagename($name)) {
                 return FALSE;
             }
         }
     }
     return parent::setParam($page, $name, '', 'pagename', $alias);
 }
Example #22
0
 public function save_review_action($plugin_id)
 {
     if (!Request::isPost()) {
         throw new Exception("Wrong method, use POST.");
     }
     $this->marketplugin = MarketPlugin::find($plugin_id);
     if (!$this->marketplugin) {
         throw new Exception("Unknown plugin.");
     }
     $reviews = MarketReview::findBySQL("plugin_id = ? AND user_id = ?", array($plugin_id, $GLOBALS['user']->id));
     if (count($reviews)) {
         $this->review = $reviews[0];
     } else {
         $this->review = new MarketReview();
         $this->review['plugin_id'] = $plugin_id;
         $this->review['user_id'] = $GLOBALS['user']->id;
     }
     $data = Request::getArray("data");
     $this->review['review'] = trim($data['review']) ?: null;
     if ($data['rating'] <= 5 && $data['rating'] >= 0) {
         $this->review['rating'] = $data['rating'];
     } else {
         throw new Exception("Rating is not in accepted range.");
     }
     $this->review->store();
     PersonalNotifications::add($this->marketplugin['user_id'], PluginEngine::getURL($this->plugin, array(), "presenting/details/" . $plugin_id), sprintf(_("Ihr Plugin %s wurde von %s bewertet."), $this->marketplugin['name'], get_fullname($GLOBALS['user']->id)), null, Assets::image_path("icons/blue/star.svg"));
     PageLayout::postMessage(MessageBox::success(_("Review/Bewertung wurde gespeichert.")));
     $this->redirect('presenting/details/' . $plugin_id);
 }
Example #23
0
echo $courseset ? $courseset->getPrivate() ? ' checked="checked"' : '' : 'checked';
?>
/>
            <?php 
echo _('Dieses Anmeldeset soll nur für mich selbst und alle Administratoren sichtbar und benutzbar sein.');
?>
        <?  endif ?>
        <? if ($courseset) : ?>
        <label class="caption">
            <?php 
echo _('Besitzer des Anmeldesets:');
?>
        </label>
        <div>
        <?php 
echo htmlReady(get_fullname($courseset->getUserId()));
?>
        </div>
        <? endif ;?>
        <label for="institutes" class="caption">
            <?php 
echo _('Einrichtungszuordnung:');
?>
            <span class="required">*</span>
        </label>
        <? if (!$instant_course_set_view) : ?>
            <div id="institutes">
            <?php 
if ($myInstitutes) {
    ?>
                <?php 
 function init($base, $refer = '', $config = NULL, $relative = '', $createProxy = '')
 {
     $base = trim($base);
     $refer = trim($refer);
     $relative = trim($relative);
     $createProxy = trim($createProxy);
     if ($refer == '') {
         $refer = $base;
     }
     if ($base == '') {
         $base = $refer;
     }
     // Compat
     if ($base == '') {
         $this->error = 'Base not specified';
         return FALSE;
     } else {
         if (!is_pagename($refer)) {
             $this->error = 'Invalid page name: ' . $refer;
             return FALSE;
         }
     }
     $absolute = get_fullname($relative, $base);
     if (is_pagename($absolute)) {
         $base = $absolute;
     }
     $this->base = $base;
     $this->refer = $refer;
     $this->createProxy = $createProxy;
     if ($config !== NULL && !$this->loadConfig($config)) {
         return FALSE;
     }
     return TRUE;
 }
 function check_page()
 {
     global $vars;
     if (empty($this->inclpage)) {
         $this->error = "No page is specified.";
         return;
     }
     $current = $vars['page'];
     $this->inclpage = get_fullname($this->inclpage, $current);
     if (!$this->is_page($this->inclpage)) {
         $this->error = "{$this->inclpage} does not eixst.";
         return;
     }
     if (!$this->check_readable($this->inclpage, false, false)) {
         $this->error = "{$this->inclpage} is not readable.";
         return;
     }
     if (isset($this->visited[$this->inclpage])) {
         $this->error = "{$this->inclpage} is already included.";
         return;
     }
 }
Example #26
0
                    }
                }
            }
            ?>
            <tr>
                <td width="33%"><?php 
echo htmlReady($date['date']);
?>
</td>
                <td width="33%"><?php 
echo htmlReady($date['title']);
?>
</td>
                <td width="33%">
                    <? foreach ($date['related_persons'] as $key => $user_id) {
                        echo ($key > 0 ? ", " : "").htmlReady(get_fullname($user_id));
                    } ?>
                </td>
            </tr>
            <? if ($date['description']) : ?>
            <tr>
                <td>&nbsp;</td>
                <td colspan="2"><?php 
echo formatReady($date['description']);
?>
</td>
            </tr>
        <? endif ?>
        <? endforeach ?>

    </table>
Example #27
0
 /**
  * Gets the name of the range. Copied somewhere from Stud.IP...
  * @access  public
  * @param   string   $rangeID         the rangeID
  * @param   boolean  $html_decode     (optional)
  * @return  string                    The name of the range
  */
 function getRangename($rangeID, $html_decode = true)
 {
     global $user;
     if ($rangeID == "studip") {
         return _("Systemweite Evaluationen");
     }
     $o_type = get_object_type($rangeID, array('sem', 'user', 'inst'));
     if (in_array($o_type, array('sem', 'inst', 'fak'))) {
         $name = getHeaderLine($rangeID);
         if ($name != NULL) {
             if ($html_decode) {
                 $rangename = decodeHTML($name);
             } else {
                 $rangename = $name;
             }
         } else {
             $rangename = _("Kein Titel gefunden.");
         }
         return $rangename;
     }
     if ($o_type != 'user') {
         $user_id = get_userid($rangeID);
     } else {
         $user_id = $rangeID;
     }
     if ($user_id != $user->id) {
         $rangename = _("Profil: ") . get_fullname($user_id, 'full', 1) . " (" . get_username($user_id) . ")";
     } else {
         $rangename = _("Profil");
     }
     return $rangename;
 }
$docRoot = getenv("DOCUMENT_ROOT");
require_once $docRoot . "/mobi-config/mobi_web_constants.php";
require WEBROOT . "page_builder/security.php";
require WEBROOT . "page_builder/page_header.php";
require WEBROOT . "libraries/libraries_lib.php";
ssl_required();
$username = get_username();
$ask_us_lists = array('Art, Architecture &amp; Planning' => '*****@*****.**', 'Engineering &amp; Computer Science' => '*****@*****.**', 'Humanities' => '*****@*****.**', 'Management &amp; Business' => '*****@*****.**', 'Science' => '*****@*****.**', 'Social Sciences' => '*****@*****.**', 'General' => '*****@*****.**', 'Circulation' => '*****@*****.**', 'Technical Help' => '*****@*****.**');
$consultation_lists = array('General' => '*****@*****.**', 'Art, Architecture &amp; Planning' => '*****@*****.**', 'Engineering &amp; Computer Science' => '*****@*****.**', 'GIS' => '*****@*****.**', 'Humanities' => '*****@*****.**', 'Management &amp; Business' => '*****@*****.**', 'Science' => '*****@*****.**', 'Social Sciences' => '*****@*****.**');
$required_text = '';
$missing_fields = array();
if ($_REQUEST['ask_type']) {
    // user submitted a question
    $ask_type = $_REQUEST['ask_type'];
    $fullname = get_fullname();
    $name_parts = explode(' ', $fullname);
    $first_name = $name_parts[0];
    $last_name = end($name_parts);
    $email = "{$username}@mit.edu";
    $server = $_SERVER['SERVER_NAME'];
    $additional_headers = "From: {$fullname} <{$username}@{$server}>";
    $additional_headers .= "\r\n" . "Reply-To: {$email}";
    $additional_headers .= "\r\n" . 'Cc: lisah@mit.edu';
    $topic = $_REQUEST['topic'] or missing_input('topic', $missing_fields);
    $status = $_REQUEST['status'] or missing_input('status', $missing_fields);
    $department = $_REQUEST['department'] or missing_input('department', $missing_fields);
    $contact_phone = $_REQUEST['phone'];
    if ($ask_type == 'form') {
        $recipient = $ask_us_lists[$topic];
        $subject = $_REQUEST['subject'] or missing_input('subject', $missing_fields);
Example #29
0
function plugin_include_convert()
{
    global $script, $vars, $get, $post, $menubar, $_msg_include_restrict;
    static $included = array();
    static $count = 1;
    if (func_num_args() == 0) {
        return PLUGIN_INCLUDE_USAGE . '<br />' . "\n";
    }
    // $menubar will already be shown via menu plugin
    if (!isset($included[$menubar])) {
        $included[$menubar] = true;
    }
    // Loop yourself
    $root = isset($vars['page']) ? $vars['page'] : '';
    $included[$root] = true;
    // Get arguments
    $args = func_get_args();
    // strip_bracket() is not necessary but compatible
    $page = isset($args[0]) ? get_fullname(strip_bracket(array_shift($args)), $root) : '';
    $with_title = PLUGIN_INCLUDE_WITH_TITLE;
    if (isset($args[0])) {
        switch (strtolower(array_shift($args))) {
            case 'title':
                $with_title = true;
                break;
            case 'notitle':
                $with_title = false;
                break;
        }
    }
    $s_page = htmlsc($page);
    $r_page = rawurlencode($page);
    $link = '<a href="' . $script . '?' . $r_page . '">' . $s_page . '</a>';
    // Read link
    // I'm stuffed
    if (isset($included[$page])) {
        return '#include(): Included already: ' . $link . '<br />' . "\n";
    }
    if (!is_page($page)) {
        return '#include(): No such page: ' . $s_page . '<br />' . "\n";
    }
    if ($count > PLUGIN_INCLUDE_MAX) {
        return '#include(): Limit exceeded: ' . $link . '<br />' . "\n";
    } else {
        ++$count;
    }
    // One page, only one time, at a time
    $included[$page] = true;
    // Include A page, that probably includes another pages
    $get['page'] = $post['page'] = $vars['page'] = $page;
    if (check_readable($page, false, false)) {
        $body = convert_html(get_source($page));
    } else {
        $body = str_replace('$1', $page, $_msg_include_restrict);
    }
    $get['page'] = $post['page'] = $vars['page'] = $root;
    // Put a title-with-edit-link, before including document
    if ($with_title) {
        $link = '<a href="' . $script . '?cmd=edit&amp;page=' . $r_page . '">' . $s_page . '</a>';
        if ($page == $menubar) {
            $body = '<span align="center"><h5 class="side_label">' . $link . '</h5></span><small>' . $body . '</small>';
        } else {
            $body = '<h1>' . $link . '</h1>' . "\n" . $body . "\n";
        }
    }
    return $body;
}
Example #30
0
    ));
    echo $pagination->render();
?>
<br><br>

<? foreach ($images as $image) : ?>
    <div style="float: left; width: 250px; border: 1px solid gray; padding: 5px; text-align: center; font-weight: bold; margin: 5px;">
        <a href="<?php 
echo URLHelper::getLink('dispatch.php/profile?username='******'user_id']));
?>
">
            <img border="0" src="<?php 
echo $GLOBALS['DYNAMIC_CONTENT_URL'] . '/user/' . $image['file'];
?>
">
            <br>
            <?php 
echo get_fullname($image['user_id'], 'full', true);
?>
<br>
            <?php 
echo date('d.m.Y', $image['time']);
?>
        </a>
    </div>
<? endforeach ?>

<br style="clear: both">
<br>
<?php 
echo $pagination->render();