Beispiel #1
0
 function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     // Remove cid
     URLHelper::removeLinkParam('cid');
     unset($_SESSION['SessionSeminar']);
     $this->set_layout($GLOBALS['template_factory']->open('layouts/base_without_infobox'));
     Navigation::activateItem('/profile/index');
     URLHelper::addLinkParam('username', Request::username('username'));
     PageLayout::setHelpKeyword('Basis.Homepage');
     SkipLinks::addIndex(_('Benutzerprofil'), 'user_profile', 100);
     $this->user = User::findCurrent();
     // current logged in user
     $this->perm = $GLOBALS['perm'];
     // perms of current logged in user
     $this->current_user = User::findByUsername(Request::username('username', $this->user->username));
     // current selected user
     // get additional informations to selected user
     $this->profile = new ProfileModel($this->current_user->user_id, $this->user->user_id);
     // set the page title depending on user selection
     if ($this->current_user['user_id'] == $this->user->id && !$this->current_user['locked']) {
         PageLayout::setTitle(_('Mein Profil'));
         UserConfig::get($this->user->id)->store('PROFILE_LAST_VISIT', time());
     } elseif ($this->current_user['user_id'] && ($this->perm->have_perm('root') || !$this->current_user['locked'] && get_visibility_by_id($this->current_user['user_id']))) {
         PageLayout::setTitle(_('Profil') . ' - ' . $this->current_user->getFullname());
         object_add_view($this->current_user->user_id);
     } else {
         PageLayout::setTitle(_('Profil'));
         $action = 'not_available';
     }
 }
Beispiel #2
0
 /**
  * Determine whether this navigation item is active.
  */
 public function isActive()
 {
     $active = parent::isActive();
     if ($active) {
         URLHelper::addLinkParam('username', Request::username('username'));
     }
     return $active;
 }
Beispiel #3
0
 /**
  * this action is the main action of the schedule-controller, setting the environment for the timetable,
  * accepting a comma-separated list of days.
  *
  * @param  string  a list of an arbitrary mix of the numbers 0-6, separated with a comma (e.g. 1,2,3,4,5 (for Monday to Friday, the default))
  */
 function index_action($days = false)
 {
     if ($GLOBALS['perm']->have_perm('admin')) {
         $inst_mode = true;
     }
     $my_schedule_settings = $GLOBALS['user']->cfg->SCHEDULE_SETTINGS;
     // set the days to be displayed
     if ($days === false) {
         if (Request::getArray('days')) {
             $this->days = array_keys(Request::getArray('days'));
         } else {
             $this->days = array(0, 1, 2, 3, 4, 5, 6);
         }
     } else {
         $this->days = explode(',', $days);
     }
     // try to find the correct institute-id
     $institute_id = Request::option('institute_id', $SessSemName[1] ? $SessSemName[1] : Request::option('cid', false));
     if (!$institute_id) {
         $institute_id = $GLOBALS['user']->cfg->MY_INSTITUTES_DEFAULT;
     }
     if (!$institute_id || in_array(get_object_type($institute_id), words('inst fak')) === false) {
         throw new Exception(sprintf(_('Kann Einrichtungskalendar nicht anzeigen!' . 'Es wurde eine ungültige Instituts-Id übergeben (%s)!', $institute_id)));
     }
     // load semester-data and current semester
     $semdata = new SemesterData();
     $this->semesters = $semdata->getAllSemesterData();
     if (Request::option('semester_id')) {
         $this->current_semester = $semdata->getSemesterData(Request::option('semester_id'));
     } else {
         $this->current_semester = $semdata->getCurrentSemesterData();
     }
     $this->entries = (array) CalendarInstscheduleModel::getInstituteEntries($GLOBALS['user']->id, $this->current_semester, 8, 20, $institute_id, $this->days);
     Navigation::activateItem('/course/main/schedule');
     PageLayout::setHelpKeyword('Basis.TerminkalenderStundenplan');
     PageLayout::setTitle($GLOBALS['SessSemName']['header_line'] . ' - ' . _('Veranstaltungs-Stundenplan'));
     $zoom = Request::int('zoom', 0);
     $this->controller = $this;
     $this->calendar_view = new CalendarWeekView($this->entries, 'instschedule');
     $this->calendar_view->setHeight(40 + 20 * $zoom);
     $this->calendar_view->setRange($my_schedule_settings['glb_start_time'], $my_schedule_settings['glb_end_time']);
     $this->calendar_view->groupEntries();
     // if enabled, group entries with same start- and end-date
     URLHelper::addLinkParam('zoom', $zoom);
     URLHelper::addLinkParam('semester_id', $this->current_semester['semester_id']);
     $style_parameters = array('whole_height' => $this->calendar_view->getOverallHeight(), 'entry_height' => $this->calendar_view->getHeight());
     $factory = new Flexi_TemplateFactory($this->dispatcher->trails_root . '/views');
     PageLayout::addStyle($factory->render('calendar/stylesheet', $style_parameters));
     if (Request::option('printview')) {
         PageLayout::addStylesheet('print.css');
     } else {
         PageLayout::addStylesheet('print.css', array('media' => 'print'));
     }
 }
Beispiel #4
0
 /**
  * Shows the current restrictions for course participation.
  */
 function index_action()
 {
     URLHelper::addLinkParam('return_to_dialog', Request::isDialog());
     $this->sidebar = Sidebar::get();
     $this->sidebar->setImage("sidebar/seminar-sidebar.png");
     if ($GLOBALS['perm']->have_perm('admin')) {
         $list = new SelectorWidget();
         $list->setUrl("?#admin_top_links");
         $list->setSelectParameterName("cid");
         foreach (AdminCourseFilter::get()->getCoursesForAdminWidget() as $seminar) {
             $list->addElement(new SelectElement($seminar['Seminar_id'], $seminar['Name']), 'select-' . $seminar['Seminar_id']);
         }
         $list->setSelection($this->course_id);
         $this->sidebar->addWidget($list);
     }
     $this->all_domains = UserDomain::getUserDomains();
     $this->seminar_domains = array_map(function ($d) {
         return $d->getId();
     }, UserDomain::getUserDomainsForSeminar($this->course_id));
     $this->current_courseset = CourseSet::getSetForCourse($this->course_id);
     $this->activated_admission_rules = AdmissionRule::getAvailableAdmissionRules();
     if (!$this->current_courseset) {
         $available_coursesets = new SimpleCollection();
         foreach (CourseSet::getCoursesetsByInstituteId($this->course->institut_id) as $cs) {
             $cs = new CourseSet($cs['set_id']);
             if ($cs->isUserAllowedToAssignCourse($this->user_id, $this->course_id)) {
                 $available_coursesets[] = array('id' => $cs->getId(), 'name' => $cs->getName(), 'chdate' => $cs->chdate, 'my_own' => $cs->getUserId() === $GLOBALS['user']->id);
             }
         }
         foreach (CourseSet::getglobalCoursesets() as $cs) {
             $cs = new CourseSet($cs['set_id']);
             if ($cs->isUserAllowedToAssignCourse($this->user_id, $this->course_id)) {
                 $available_coursesets[] = array('id' => $cs->getId(), 'name' => $cs->getName(), 'chdate' => $cs->chdate, 'my_own' => $cs->getUserId() === $GLOBALS['user']->id);
             }
         }
         $available_coursesets = $available_coursesets->findBy('chdate', strtotime('-1 year'), '>');
         $available_coursesets->orderBy('name');
         $this->available_coursesets = $available_coursesets;
         PageLayout::postMessage(MessageBox::info(_("Für diese Veranstaltung sind keine Anmelderegeln festgelegt. Die Veranstaltung ist damit für alle Nutzer zugänglich.")));
     } else {
         if ($this->current_courseset->isSeatDistributionEnabled() && !$this->course->admission_turnout) {
             PageLayout::postMessage(MessageBox::info(_("Diese Veranstaltung ist teilnahmebeschränkt, aber die maximale Teilnehmeranzahl ist nicht gesetzt.")));
         }
     }
     $lockdata = LockRules::getObjectRule($this->course_id);
     if ($lockdata['description'] && LockRules::CheckLockRulePermission($this->course_id, $lockdata['permission'])) {
         PageLayout::postMessage(MessageBox::info(formatLinks($lockdata['description'])));
     }
 }
Beispiel #5
0
 /**
  * common tasks for all actions
  *
  * @param String $action Action that has been called
  * @param Array  $args   List of arguments
  */
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     // user must have root permission
     $GLOBALS['perm']->check('root');
     //setting title and navigation
     PageLayout::setTitle(_('Verwaltung von Ferien'));
     Navigation::activateItem('/admin/locations/holidays');
     // Extract and bind filter option
     $this->filter = Request::option('filter');
     if ($this->filter) {
         URLHelper::addLinkParam('filter', $this->filter);
     }
     $this->setSidebar();
 }
Beispiel #6
0
 /**
  * Callback function being called before an action is executed. If this
  * function does not return FALSE, the action will be called, otherwise
  * an error will be generated and processing will be aborted. If this function
  * already #rendered or #redirected, further processing of the action is
  * withheld.
  *
  * @param string  Name of the action to perform.
  * @param array   An array of arguments to the action.
  *
  * @return bool
  */
 function before_filter(&$action, &$args)
 {
     global $user;
     parent::before_filter($action, $args);
     $zoom = Request::int('zoom');
     $this->my_schedule_settings = UserConfig::get($user->id)->SCHEDULE_SETTINGS;
     // bind zoom, show_hidden and semester_id for all actions, even preserving them after redirect
     if (isset($zoom)) {
         URLHelper::addLinkParam('zoom', Request::int('zoom'));
         $this->my_schedule_settings['zoom'] = Request::int('zoom');
         UserConfig::get($user->id)->store('SCHEDULE_SETTINGS', $this->my_schedule_settings);
     }
     URLHelper::bindLinkParam('semester_id', $this->current_semester['semester_id']);
     URLHelper::bindLinkParam('show_hidden', $this->show_hidden);
     PageLayout::setHelpKeyword('Basis.MyStudIPStundenplan');
     PageLayout::setTitle(_('Mein Stundenplan'));
 }
Beispiel #7
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'));
 }
Beispiel #8
0
 public function testGetLink()
 {
     URLHelper::addLinkParam('foo', '& ;');
     URLHelper::addLinkParam('bar', '"\'');
     $url = 'abc?a=%26&c="d#1';
     $expected = 'abc?foo=%26+%3B&amp;bar=%22%27&amp;a=%26&amp;c=%22d#1';
     $this->assertEquals($expected, URLHelper::getLink($url));
 }
Beispiel #9
0
 /**
  * Stores the account informations of a user
  */
 public function store_action()
 {
     $this->check_ticket();
     $errors = $info = $success = array();
     $logout = false;
     //erstmal die "unwichtigen" Daten
     $geschlecht = Request::int('geschlecht');
     if ($this->shallChange('user_info.geschlecht', 'gender', $geschlecht)) {
         $this->user->geschlecht = $geschlecht;
     }
     $title_front = Request::get('title_front') ?: Request::get('title_front_chooser');
     if ($this->shallChange('user_info.title_front', 'title', $title_front)) {
         $this->user->title_front = $title_front;
     }
     $title_rear = Request::get('title_rear') ?: Request::get('title_rear_chooser');
     if ($this->shallChange('user_info.title_rear', 'title', $title_rear)) {
         $this->user->title_rear = $title_rear;
     }
     if ($this->user->store()) {
         $success[] = _('Ihre persönlichen Daten wurden geändert.');
         // Inform the user about this change
         setTempLanguage($this->user->user_id);
         $this->postPrivateMessage(_("Ihre persönlichen Daten wurden geändert.\n"));
         restoreLanguage();
     }
     //nur nötig wenn der user selbst seine daten ändert
     if (!$this->restricted) {
         // Vorname verändert ?
         $vorname = trim(Request::get('vorname'));
         if ($this->shallChange('auth_user_md5.Vorname', 'name', $vorname)) {
             // Vorname nicht korrekt oder fehlend
             if (!$this->validator->ValidateName($vorname)) {
                 $errors[] = _('Der Vorname fehlt oder ist unsinnig!');
             } else {
                 $this->user->Vorname = $vorname;
                 $success[] = _('Ihr Vorname wurde geändert!');
             }
         }
         // Nachname verändert ?
         $nachname = trim(Request::get('nachname'));
         if ($this->shallChange('auth_user_md5.Nachname', 'name', $nachname)) {
             // Nachname nicht korrekt oder fehlend
             if (!$this->validator->ValidateName($nachname)) {
                 $errors[] = _('Der Nachname fehlt oder ist unsinnig!');
             } else {
                 $this->user->Nachname = $nachname;
                 $success[] = _('Ihr Nachname wurde geändert!');
             }
         }
         // Username
         $new_username = trim(Request::get('new_username'));
         if ($this->shallChange('auth_user_md5.username', 'username', $new_username)) {
             if (!$this->validator->ValidateUsername($new_username)) {
                 $errors[] = _('Der gewählte Benutzername ist nicht lang genug!');
             } else {
                 if ($check_uname = StudipAuthAbstract::CheckUsername($new_username) && $check_uname['found']) {
                     $errors[] = _('Der Benutzername wird bereits von einem anderen Benutzer verwendet. Bitte wählen Sie einen anderen Usernamen!');
                 } else {
                     $this->user->username = $new_username;
                     $success[] = _('Ihr Benutzername wurde geändert!');
                     URLHelper::addLinkParam('username', $this->user->username);
                     $logout = true;
                 }
             }
         }
         // Email
         $email1 = trim(Request::get('email1'));
         $email2 = trim(Request::get('email2'));
         if ($this->shallChange('auth_user_md5.Email', 'email', $email1)) {
             $auth = StudipAuthAbstract::GetInstance($this->user->auth_plugin ?: 'standard');
             $is_sso = $auth instanceof StudipAuthSSO;
             if (!$is_sso && !$auth->isAuthenticated($this->user->username, Request::get('password'))) {
                 $errors[] = _('Das aktuelle Passwort wurde nicht korrekt eingegeben.');
             } else {
                 if ($email1 !== $email2) {
                     $errors[] = _('Die Wiederholung der E-Mail-Adresse stimmt nicht mit Ihrer Eingabe überein.');
                 } else {
                     $result = edit_email($this->user, $email1);
                     $messages = explode('§', $result[1]);
                     if ($result[0]) {
                         $this->user->Email = $email1;
                         if (count($messages) < 2) {
                             $success[] = _('Ihre E-Mail-Adresse wurde geändert!');
                         }
                     }
                     for ($i = 0; $i < count($messages); $i += 2) {
                         $type = $messages[$i];
                         if ($type === 'msg') {
                             $type = 'success';
                         } else {
                             if ($type === 'error') {
                                 $type = 'errors';
                             }
                         }
                         ${$type}[] = $messages[$i + 1];
                     }
                 }
             }
         }
     }
     if (count($errors) > 0) {
         $this->reportErrorWithDetails(_('Bitte überprüfen Sie Ihre Eingaben:'), $errors);
     } else {
         if ($this->user->store()) {
             $this->reportSuccessWithDetails(_('Ihre Nutzerdaten wurden geändert.'), $success);
             if (count($info) > 0) {
                 $this->reportInfoWithDetails(_('Bitte beachten Sie:'), $info);
             }
         }
     }
     if ($logout) {
         $token = uniqid('logout', true);
         $this->flash['logout-token'] = $token;
         $this->redirect('settings/account/logout?token=' . $token);
     } else {
         $this->redirect('settings/account');
     }
 }
Beispiel #10
0
/**
 * This function "selects" an Einrichtung to work with it
 *
 * Note: Stud.IP treats Einrichtungen like Veranstaltungen, yu can see this
 * especially if you look at the variable names....
 *
 * The following variables will bet set:
 *   $SessionSeminar                 Einrichtung id<br>
 *   $SessSemName[0]                 Einrichtung name<br>
 *   $SessSemName[1]                 Einrichtung id<br>
 *   $SessSemName["art"]             Einrichtung type in alphanumeric form<br>
 *   $SessSemName["art_num"]         Einrichtung type in numeric form<br>
 *   $SessSemName["art_generic"]     Einrichtung generic type in alhanumeric form (self description)<br>
 *   $SessSemName["class"]               Einrichtung class (sem or inst, in this function always inst)<br>
 *   $SessSemName["header_line"]     the header-line to use on every page of the Einrichtung<br>
 *
 * @param string $inst_id the id of the Veranstaltung
 *
 * @return boolean  true if successful
 *
 */
function selectInst($inst_id)
{
    global $SessionSeminar, $SessSemName, $INST_TYPE, $SemUserStatus, $rechte, $perm, $auth;
    closeObject();
    if (!get_config('ENABLE_FREE_ACCESS') && !$perm->have_perm('user')) {
        // redirect to login page if user is not logged in
        $auth->login_if($auth->auth["uid"] == "nobody");
        throw new AccessDeniedException();
    }
    $SessionSeminar = $inst_id;
    $institute = Institute::findCurrent();
    if ($institute) {
        if (!($SemUserStatus = $perm->get_studip_perm($institute["Institut_id"]))) {
            $SemUserStatus = 'nobody';
        }
        $rechte = $perm->have_studip_perm("tutor", $institute["Institut_id"]);
        $SessionSeminar = $institute["Institut_id"];
        $SessSemName[0] = $institute["Name"];
        $SessSemName[1] = $institute["Institut_id"];
        $SessSemName["art_generic"] = _("Einrichtung");
        $SessSemName["art"] = $INST_TYPE[$row["type"]]["name"];
        if (!$SessSemName["art"]) {
            $SessSemName["art"] = $SessSemName["art_generic"];
        }
        $SessSemName["class"] = "inst";
        $SessSemName["is_fak"] = $institute["is_fak"];
        $SessSemName["art_num"] = $institute["type"];
        $SessSemName["fak"] = $institute["fakultaets_id"];
        $SessSemName["header_line"] = $institute->getFullname();
        $_SESSION['SessionSeminar'] =& $SessionSeminar;
        $_SESSION['SessSemName'] =& $SessSemName;
        URLHelper::addLinkParam('cid', $SessionSeminar);
        return true;
    } else {
        $SessionSeminar = null;
        return false;
    }
}
Beispiel #11
0
if (in_array(Request::get('view'), words('listnew listall export'))) {
    Navigation::activateItem('/course/wiki/' . $view);
} else {
    Navigation::activateItem('/course/wiki/show');
}
if (Request::option('wiki_comments') == "all") {
    // show all comments
    $show_wiki_comments = "all";
} elseif (Request::option('wiki_comments') == "none") {
    // don't show comments
    $show_wiki_comments = "none";
} else {
    // show comments as icons
    $show_wiki_comments = "icon";
}
URLHelper::addLinkParam('wiki_comments', $show_wiki_comments);
ob_start();
// ---------- Start of main WikiLogic
if ($view == "listall") {
    //
    // list all pages, default sorting = alphabetically
    //
    SkipLinks::addIndex(_("Alle Seiten"), 'main_content', 100);
    listPages("all", Request::option('sortby'));
} else {
    if ($view == "listnew") {
        //
        // list new pages, default sorting = newest first
        //
        SkipLinks::addIndex(_("Neue Seiten"), 'main_content', 100);
        listPages("new", Request::option('sortby'));
Beispiel #12
0
?>
                <?php 
echo Icon::create('upload', 'clickable')->asImg(['class' => "text-bottom upload"]);
?>
            </label>
        </div>
    </div>
<? endif ?>

<ul id="blubber_threads" class="profilestream" aria-live="polite" aria-relevant="additions">
    <? foreach ($threads as $thread) : ?>
    <?php 
echo $this->render_partial("streams/_blubber.php", array('thread' => $thread));
?>
    <? endforeach ?>
    <? if ($more_threads) : ?>
    <li class="more"><?php 
echo Assets::img("ajax_indicator_small.gif", array('alt' => "loading"));
?>
</li>
    <? endif ?>
</ul>

<?

$sidebar = Sidebar::get();
$sidebar->setImage("sidebar/blubber-sidebar");
$sidebar->setContextAvatar(Avatar::getAvatar($user->getId()));
URLHelper::addLinkParam('user_id', $user->getId());
$controller->addTagCloudWidgetToSidebar($tags, 'profile');
Beispiel #13
0
 /**
  * Displays page to add new or edit existing literature element
  */
 public function edit_element_action()
 {
     if (Request::option('reload')) {
         $this->reload = true;
     }
     if (Request::option('cmd') == "new_entry") {
         $_catalog_id = "new_entry";
     } else {
         $_catalog_id = Request::option('_catalog_id', "new_entry");
     }
     if (Request::option('return_range')) {
         $this->return_range = Request::option('return_range');
         URLHelper::addLinkParam('return_range', $this->return_range);
     }
     if ($_catalog_id == "new_entry") {
         $title = _("Literatureintrag anlegen");
     } else {
         $title = _("Literatureintrag bearbeiten");
     }
     PageLayout::setTitle($title);
     Navigation::activateItem('/tools/literature');
     //dump data into db if $_catalog_id points to a search result
     if ($_catalog_id[0] == "_") {
         $parts = explode("__", $_catalog_id);
         if ($fields = $_SESSION[$parts[0]][$parts[1]]) {
             $cat_element = new StudipLitCatElement();
             $cat_element->setValues($fields);
             $cat_element->setValue("catalog_id", "new_entry");
             $cat_element->setValue("user_id", "studip");
             if ($existing_element = $cat_element->checkElement()) {
                 $cat_element->setValue('catalog_id', $existing_element);
             }
             $cat_element->insertData();
             $_catalog_id = $cat_element->getValue("catalog_id");
             $_SESSION[$parts[0]][$parts[1]]['catalog_id'] = $_catalog_id;
             unset($cat_element);
         }
     }
     if (Request::option('cmd') == 'clone_entry') {
         $_the_element = StudipLitCatElement::GetClonedElement($_catalog_id);
         if ($_the_element->isNewEntry()) {
             $_msg = "msg§" . _("Der Eintrag wurde kopiert, Sie können die Daten jetzt ändern.") . "§";
             $_msg .= "info§" . _("Der kopierte Eintrag wurde noch nicht gespeichert.") . "§";
             //$old_cat_id = $_catalog_id;
             $_catalog_id = $_the_element->getValue('catalog_id');
         } else {
             $_msg = "error§" . _("Der Eintrag konnte nicht kopiert werden!.") . "§";
         }
     }
     if (!is_object($_the_element)) {
         $_the_element = new StudipLitCatElement($_catalog_id, true);
     }
     $_the_form = $_the_element->getFormObject();
     $_the_clipboard = StudipLitClipBoard::GetInstance();
     $_the_clip_form = $_the_clipboard->getFormObject();
     if (isset($old_cat_id) && $_the_clipboard->isInClipboard($old_cat_id)) {
         $_the_clipboard->deleteElement($old_cat_id);
         $_the_clipboard->insertElement($_catalog_id);
     }
     $_the_clip_form->form_fields['clip_cmd']['options'][] = array('name' => _("In Merkliste eintragen"), 'value' => 'ins');
     $_the_clip_form->form_fields['clip_cmd']['options'][] = array('name' => _("Markierten Eintrag bearbeiten"), 'value' => 'edit');
     if ($_the_form->IsClicked("reset") || Request::option('cmd') == "new_entry") {
         $_the_form->doFormReset();
     }
     if ($_the_form->IsClicked("delete") && $_catalog_id != "new_entry" && $_the_element->isChangeable()) {
         if ($_the_element->reference_count) {
             $_msg = "info§" . sprintf(_("Sie können diesen Eintrag nicht löschen, da er noch in %s Literaturlisten referenziert wird."), $_the_element->reference_count) . "§";
         } else {
             $_msg = "info§" . _("Wollen Sie diesen Eintrag wirklich löschen?") . "<br>" . LinkButton::createAccept(_('Ja'), URLHelper::getURL('?cmd=delete_element&_catalog_id=' . $_catalog_id), array('title' => _('löschen'))) . "&nbsp;" . LinkButton::createCancel(_('Abbrechen'), URLHelper::getURL('?_catalog_id=' . $_catalog_id), array('title' => _('abbrechen'))) . "§";
         }
     }
     if (Request::option('cmd') == "delete_element" && $_the_element->isChangeable() && !$_the_element->reference_count) {
         $_the_element->deleteElement();
         $this->reload = true;
     }
     if (Request::option('cmd') == "in_clipboard" && $_catalog_id != "new_entry") {
         $_the_clipboard->insertElement($_catalog_id);
         $this->reload = true;
     }
     if (Request::option('cmd') == "check_entry") {
         $lit_plugin_value = $_the_element->getValue('lit_plugin');
         $check_result = StudipLitSearch::CheckZ3950($_the_element->getValue('accession_number'));
         $content = "<div style=\"font-size:70%\"<b>" . _("Verfügbarkeit in externen Katalogen:") . "</b><br>";
         if (is_array($check_result)) {
             foreach ($check_result as $plugin_name => $ret) {
                 $content .= "<b>&nbsp;" . htmlReady(StudipLitSearch::GetPluginDisplayName($plugin_name)) . "&nbsp;</b>";
                 if ($ret['found']) {
                     $content .= _("gefunden") . "&nbsp;";
                     $_the_element->setValue('lit_plugin', $plugin_name);
                     if ($link = $_the_element->getValue("external_link")) {
                         $content .= formatReady(" [" . $_the_element->getValue("lit_plugin_display_name") . "]" . $link);
                     } else {
                         $content .= _("(Kein Link zum Katalog vorhanden.)");
                     }
                 } elseif (count($ret['error'])) {
                     $content .= '<span style="color:red;">' . htmlReady($ret['error'][0]['msg']) . '</span>';
                 } else {
                     $content .= _("<u>nicht</u> gefunden") . "&nbsp;";
                 }
                 $content .= "<br>";
             }
         }
         $content .= "</div>";
         $_the_element->setValue('lit_plugin', $lit_plugin_value);
         $_msg = "info§" . $content . "§";
     }
     if ($_the_form->IsClicked("send")) {
         $_the_element->setValuesFromForm();
         if ($_the_element->checkValues()) {
             $_the_element->insertData();
             $this->reload = true;
         }
     }
     if ($_the_clip_form->isClicked("clip_ok")) {
         if ($_the_clip_form->getFormFieldValue("clip_cmd") == "ins" && $_catalog_id != "new_entry") {
             $_the_clipboard->insertElement($_catalog_id);
         }
         if ($_the_clip_form->getFormFieldValue("clip_cmd") == "edit") {
             $marked = $_the_clip_form->getFormFieldValue("clip_content");
             if (count($marked) && $marked[0]) {
                 $_the_element->getElementData($marked[0]);
             }
         }
         $_the_clipboard->doClipCmd();
     }
     $_catalog_id = $_the_element->getValue("catalog_id");
     if (!$_the_element->isChangeable()) {
         PageLayout::postMessage(MessageBox::info(_('Sie haben diesen Eintrag nicht selbst vorgenommen, und dürfen ihn daher nicht verändern! Wenn Sie mit diesem Eintrag arbeiten wollen, können Sie sich eine persönliche Kopie erstellen.')));
     }
     $_msg .= $_the_element->msg;
     $_msg .= $_the_clipboard->msg;
     $this->msg = $_msg;
     $this->catalog_id = $_catalog_id;
     $this->element = $_the_element;
     $this->treeview = $_the_treeview;
     $this->tree = $_the_tree;
     $this->clipboard = $_the_clipboard;
     $this->clip_form = $_the_clip_form;
     $this->form = $_the_form;
 }
Beispiel #14
0
 /**
  * Widget controller to produce the formally known show_votes()
  *
  * @param String $range_id range id of the news to get displayed
  * @return array() Array of votes
  */
 function display_action($range_id)
 {
     if (!$range_id) {
         $this->set_status(400);
         return $this->render_nothing();
     }
     if (!StudipNews::haveRangePermission('view', $range_id, $GLOBALS['user']->id)) {
         $this->set_status(401);
         return $this->render_nothing();
     }
     // Check if user wrote a comment
     if (Request::submitted('accept') && trim(Request::get('comment_content')) && Request::isPost()) {
         CSRFProtection::verifySecurityToken();
         StudipComment::create(array('object_id' => Request::get('comsubmit'), 'user_id' => $GLOBALS['user']->id, 'content' => trim(Request::get('comment_content'))));
     }
     // Check if user wants to remove a announcement
     if ($news_id = Request::get('remove_news')) {
         $news = new StudipNews($news_id);
         $range = Request::get('news_range');
         if ($news->havePermission('unassign', $range)) {
             if (Request::get('confirm')) {
                 $news->deleteRange($range);
                 $news->store();
             } else {
                 $this->question = createQuestion(_('Ankündigung wirklich aus diesem Bereich entfernen?'), array('remove_news' => $news_id, 'news_range' => $range, 'confirm' => true));
             }
         }
     }
     // Check if user wants to delete an announcement
     if ($news_id = Request::get('delete_news')) {
         $news = new StudipNews($news_id);
         if ($news->havePermission('delete')) {
             if (Request::get('confirm')) {
                 $news->delete();
             } else {
                 $this->question = createQuestion(_('Ankündigung wirklich löschen?'), array('delete_news' => $news_id, 'confirm' => true));
             }
         }
     }
     $this->perm = StudipNews::haveRangePermission('edit', $range_id);
     $this->show_all_news = Request::get('nshow_all') && $this->perm;
     $news = StudipNews::GetNewsByRange($range_id, !$this->show_all_news);
     if ($this->show_all_news) {
         URLHelper::addLinkParam('nshow_all', 1);
     }
     $this->news = StudipNews::GetNewsByRange($range_id, !$this->show_all_news, true);
     $this->count_all_news = $this->show_all_news ? count($this->news) : count(StudipNews::GetNewsByRange($range_id, false));
     $this->rss_id = get_config('NEWS_RSS_EXPORT_ENABLE') ? StudipNews::GetRssIdFromRangeId($range_id) : false;
     $this->range = $range_id;
     $this->nobody = !$GLOBALS['user']->id || $GLOBALS['user']->id == 'nobody';
     $this->visit();
 }
Beispiel #15
0
$open = Request::option('open');
$close = Request::option('close');
$check_all = Request::option('check_all');

//Switch fuer die Ansichten
URLHelper::bindLinkParam('data', $folder_system_data);
if (Request::option('cmd') == 'tree') {
    URLHelper::removeLinkParam('data');
    $folder_system_data = array();
    $folder_system_data['cmd'] = 'tree';
    URLHelper::addLinkParam('data', $folder_system_data);
} elseif (Request::option('cmd') == 'all') {
    URLHelper::removeLinkParam('data');
    $folder_system_data = array();
    $folder_system_data['cmd'] = 'all';
    URLHelper::addLinkParam('data', $folder_system_data);
} elseif(!isset($folder_system_data['cmd'])) {
    $folder_system_data['cmd'] = 'all';
}

if (Request::option('orderby')) {
    $folder_system_data['orderby'] = Request::option('orderby');
}

///////////////////////////////////////////////////////////
//Zip-Download-Funktionen
///////////////////////////////////////////////////////////
if (Request::get('folderzip')) {
    $zip_file_id = createFolderZip(Request::option('folderzip'), true, true);
    if($zip_file_id){
        $query = "SELECT name FROM folder WHERE folder_id = ?";
Beispiel #16
0
use Studip\Button, Studip\LinkButton;

include('lib/seminar_open.php'); // initialise Stud.IP-Session


// -- here you have to put initialisations for the current page

if (Request::option('view') == 'extern_global') {
    $range_id = 'studip';
    URLHelper::addLinkParam('view', 'extern_global');
} else {
    $range_id = $SessSemName[1] ? $SessSemName[1] : '';
    URLHelper::addLinkParam('view', 'extern_inst');
}
URLHelper::addLinkParam('cid', $range_id);
$config_id = Request::option('config_id');
// when downloading a config, do it here and stop afterwards
if (Request::get('com') == 'download_config') {
    if ($range_id) {
        download_config($range_id, $config_id, Request::quoted('module'));
        page_close();
        exit;
    }
}

PageLayout::setTitle(_("Verwaltung externer Seiten"));

if ($range_id != 'studip') {
    Navigation::activateItem('/admin/institute/external');
    require_once 'lib/admin_search.inc.php';
Beispiel #17
0
 /**
  * Delete the submitted entry.
  * 
  * @param string $topic_id the entry to delete
  */
 function delete_entry_action($topic_id)
 {
     // get the page of the posting to be able to jump there again
     $page = ForumEntry::getPostingPage($topic_id);
     URLHelper::addLinkParam('page', $page);
     if (ForumPerm::hasEditPerms($topic_id) || ForumPerm::check('remove_entry', $this->getId(), $topic_id)) {
         $path = ForumEntry::getPathToPosting($topic_id);
         $topic = array_pop($path);
         $parent = array_pop($path);
         if ($topic_id != $this->getId()) {
             // only delete directly if passed by ajax, otherwise ask for confirmation
             if (Request::isXhr() || Request::get('approve_delete')) {
                 ForumEntry::delete($topic_id);
                 $this->flash['messages'] = array('success' => sprintf(_('Der Eintrag %s wurde gelöscht!'), $topic['name']));
             } else {
                 $this->flash['messages'] = array('info_html' => sprintf(_('Sind sie sicher dass Sie den Eintrag %s löschen möchten?'), $topic['name']) . '<br>' . \Studip\LinkButton::createAccept(_('Ja'), PluginEngine::getUrl('coreforum/index/delete_entry/' . $topic_id . '?approve_delete=1')) . \Studip\LinkButton::createCancel(_('Nein'), PluginEngine::getUrl('coreforum/index/index/' . ForumEntry::getParentTopicId($topic_id) . '/' . $page)));
             }
         } else {
             $this->flash['messages'] = array('success' => _('Sie können nicht die gesamte Veranstaltung löschen!'));
         }
     }
     if (Request::isXhr()) {
         $this->render_template('messages');
         $this->flash['messages'] = null;
     } else {
         $this->redirect(PluginEngine::getLink('coreforum/index/index/' . $parent['id'] . '/' . $page));
     }
 }
Beispiel #18
0
    echo '</td></tr></table></div> <br>';
}
function reenter_mail()
{
    echo _('Sollten Sie keine E-Mail erhalten haben, können Sie sich einen neuen Aktivierungsschlüssel zuschicken lassen. Geben Sie dazu Ihre gewünschte E-Mail-Adresse unten an:');
    echo '<form action="' . URLHelper::getLink() . '" method="post">' . CSRFProtection::tokenTag() . '<input type="hidden" name="uid" value="' . htmlReady(Request::option('uid')) . '">' . '<table><tr><td>' . _('E-Mail:') . '</td><td><input type="email" name="email1"></td></tr>' . '<tr><td>' . _('Wiederholung:') . '</td><td><input type="email" name="email2"></td></tr></table>' . Button::createAccept() . '</form>';
}
function mail_explain()
{
    echo _('Sie haben Ihre E-Mail-Adresse geändert. Um diese frei zu schalten müssen Sie den Ihnen an Ihre neue Adresse zugeschickten Aktivierungs Schlüssel im unten stehenden Eingabefeld eintragen.');
    echo '<br><form action="' . URLHelper::getLink() . '" method="post">' . CSRFProtection::tokenTag() . '<input type="text" name="key"><input name="uid" type="hidden" value="' . htmlReady(Request::option('uid')) . '"><br>' . Button::createAccept() . '</form><br><br>';
}
if (!Request::option('uid')) {
    header("Location: index.php");
}
URLHelper::addLinkParam('cancel_login', 1);
// set up user session
include 'lib/seminar_open.php';
// display header
PageLayout::setTitle(_('E-Mail Aktivierung'));
$uid = Request::option('uid');
if (Request::get('key') !== null) {
    $db = DBManager::get();
    $sth = $db->prepare("SELECT validation_key FROM auth_user_md5 WHERE user_id=?");
    $sth->execute(array($uid));
    $result = $sth->fetch();
    $key = $result['validation_key'];
    if (Request::quoted('key') == $key) {
        $sth = $db->prepare("UPDATE auth_user_md5 SET validation_key='' WHERE user_id=?");
        $sth->execute(array($uid));
        unset($_SESSION['semi_logged_in']);
Beispiel #19
0
 public function switch_action()
 {
     $default_view = $this->settings['view'] ?: 'week';
     $view = Request::option('last_view', $default_view);
     $this->range_id = Request::option('range_id', $GLOBALS['user']->id);
     $object_type = get_object_type($this->range_id);
     switch ($object_type) {
         case 'user':
             URLHelper::addLinkParam('cid', '');
             $this->redirect($this->url_for('calendar/single/' . $view . '/' . $this->range_id));
             break;
         case 'sem':
         case 'inst':
         case 'fak':
             URLHelper::addLinkParam('cid', $this->range_id);
             $this->redirect($this->url_for('calendar/single/' . $view . '/' . $this->range_id));
             break;
         case 'group':
             URLHelper::addLinkParam('cid', '');
             $this->redirect($this->url_for('calendar/group/' . $view . '/' . $this->range_id));
             break;
     }
 }