Example #1
0
function startpage_redirect($page_code)
{
    switch ($page_code) {
        case 1:
        case 2:
            $jump_page = "dispatch.php/my_courses";
            break;
        case 3:
            $jump_page = "dispatch.php/calendar/schedule";
            break;
        case 4:
            $jump_page = "dispatch.php/contact";
            break;
        case 5:
            $jump_page = "dispatch.php/calendar/single";
            break;
        case 6:
            // redirect to global blubberstream
            // or no redirection if blubber isn't active
            if (PluginEngine::getPlugin("Blubber")) {
                $jump_page = "plugins.php/blubber/streams/global";
            }
            break;
    }
    page_close();
    header("location: {$jump_page}");
    exit;
}
Example #2
0
 function before_filter(&$action, &$args)
 {
     if (Request::option('auswahl')) {
         Request::set('cid', Request::option('auswahl'));
     }
     parent::before_filter($action, $args);
     checkObject();
     $this->institute = Institute::findCurrent();
     if (!$this->institute) {
         throw new CheckObjectException(_('Sie haben kein Objekt gewählt.'));
     }
     $this->institute_id = $this->institute->id;
     //set visitdate for institute, when coming from meine_seminare
     if (Request::option('auswahl')) {
         object_set_visit($this->institute_id, "inst");
     }
     //gibt es eine Anweisung zur Umleitung?
     if (Request::get('redirect_to')) {
         $query_parts = explode('&', stristr(urldecode($_SERVER['QUERY_STRING']), 'redirect_to'));
         list(, $where_to) = explode('=', array_shift($query_parts));
         $new_query = $where_to . '?' . join('&', $query_parts);
         page_close();
         $new_query = preg_replace('/[^:0-9a-z+_\\-.#?&=\\/]/i', '', $new_query);
         header('Location: ' . URLHelper::getURL($new_query, array('cid' => $this->institute_id)));
         die;
     }
     PageLayout::setHelpKeyword("Basis.Einrichtungen");
     PageLayout::setTitle($this->institute->getFullName() . " - " . _("Kurzinfo"));
     Navigation::activateItem('/course/main/info');
 }
Example #3
0
function print_error($errstr, $predef)
{
    $exp_error['predef'] = $predef;
    $exp_error['errorstr'] = $errstr;
    display_directory($exp_error);
    page_close();
    exit;
}
Example #4
0
 public function redirect($url, $shutdown = TRUE)
 {
     $url = str_replace('&', '&', $url);
     header('HTTP/1.1 302 Moved Temporarily');
     header('Location:' . $url);
     if ($shutdown) {
         page_close();
         exit;
     }
 }
Example #5
0
function doit()
{
    global $sess, $HTTP_POST_VARS, $mytrail, $auth;
    if ($HTTP_POST_VARS['field_subject'] == "") {
        form(true);
        page_close();
        exit;
    }
    if (!defined("TALK_INC")) {
        include "messages/talk.inc";
    }
    talk($auth->auth['uname'], $mytrail['userid'], $HTTP_POST_VARS['field_subject'], $HTTP_POST_VARS['field_message'], $mytrail['id']);
    header("Location: " . $sess->url($mytrail['path']));
}
Example #6
0
function display_done()
{
    global $kat, $auth, $uid, $perm, $sess;
    if (!defined("COMMON_PERMISSIONS_INC")) {
        include "commonapi/common_permissions.inc";
    }
    /*
     auth_preauth() will authenticatge the user since logon_now_as is registered and set to true
    */
    page_close();
    page_open(array("sess" => "Linktrail_Session", "auth" => "Linktrail_Auth", "perm" => "Linktrail_Perm"));
    $caps = get_caps($perm, '/');
    if (!defined("LAY_MYPAGE_INC")) {
        include "layout/lay_mypage.inc";
    }
    if (!defined("LAY_DIRECTORY_INC")) {
        include "layout/lay_directory.inc";
    }
    $pl = build_pathlist($kat, false);
    $plf = build_pathlist($kat, true);
    $restriction_list = build_restriction_list($kat);
    //$username = $auth->auth['uname'];
    $in_login = false;
    include "template.inc";
    include "commonheader2.html";
    $tpl = new Template(APPLICATION_HOME . "/templates/login", "keep");
    $tpl->set_file(array("main" => "regdone.html"));
    //$tpl->set_var("IWANTTO", print_mypage_iwantto($caps, $auth->auth['uname']));
    $tpl->set_var("USERNAME", $auth->auth['uname']);
    $tpl->set_var("MYPAGEURL", $sess->url(build_good_url("/Experts/" . $auth->auth['uname'])));
    $tpl->set_var("SETTINGSURL", $sess->url(build_good_url("/Experts/" . $auth->auth['uname'] . '/Settings')));
    $tpl->set_var("TOURURL", $sess->url("/Tour/"));
    $tpl->set_var("IWANTTO", print_iwantto('/', $caps));
    $tpl->set_var("HOME_URL", $sess->url("/"));
    $tpl->parse("main", "main");
    $tpl->p("main");
    include "commonfooter2.html";
    page_close();
    exit;
}
Example #7
0
function check_edit_perms()
{
    global $sess, $auth;
    $ok = false;
    if ($_ENV["edit_requires"]) {
        foreach (explode(",", $_ENV["edit_requires"]) as $need) {
            if ($sess->have_perm($need)) {
                $ok = true;
            }
        }
    } else {
        $ok = true;
    }
    $_ENV["show_edit"] = $ok;
    if (!$ok) {
        if ($auth) {
            $usrnm = $auth->auth["uname"];
            $p = $auth->auth["perm"];
        }
        echo "<h3>Permission Denied</h1>\n";
        echo "<p class=error>User {$usrnm} does not have sufficient access privileges for this {$cmd} {$submit} operation on this page</p>\n";
        echo "<p>{$usrnm} has {$p} rights</p>";
        page_close();
        exit;
    }
}
 function start()
 {
     global $smarty, $lang_str, $lang_set, $page_attributes, $config, $sess;
     global $sess_page_controler_domain_id;
     /* check if admin have perms to manage user */
     if ($this->check_perms_to_user) {
         if (!$this->check_perms_to_user()) {
             page_close();
             die("You haven't permissions to manage user '" . $this->user_id->get_username() . "@" . $this->user_id->get_realm() . "'");
         }
     }
     /* check if admin have perms to manage domain */
     if ($this->check_perms_to_domain) {
         if (!$this->check_perms_to_domain()) {
             page_close();
             die("You haven't permissions to manage domain with id:'" . $this->domain_id . "'");
         }
     }
     /* do not allow change parameters of default domain */
     if ($this->domain_id == '0') {
         $sess_page_controler_domain_id = null;
         page_close();
         die("Change parameters of default domain is not possible");
     }
     /* make code portable - if magic_quotes_gpc is set to on, strip slashes */
     if (get_magic_quotes_gpc()) {
         function stripslashes_deep($value)
         {
             $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value);
             return $value;
         }
         $_POST = array_map('stripslashes_deep', $_POST);
         $_GET = array_map('stripslashes_deep', $_GET);
         $_REQUEST = array_map('stripslashes_deep', $_REQUEST);
         $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
     }
     /* translate chars '<', '>', etc. to &lt; &gt; etc.. */
     if ($this->perform_hack_protect) {
         $this->hack_protection();
     }
     /* propagate user_id and reference to this to all application units */
     foreach ($this->apu_objects as $key => $val) {
         $this->apu_objects[$key]->user_id = $this->user_id;
         $this->apu_objects[$key]->domain_id = $this->domain_id;
         $this->apu_objects[$key]->controler =& $this;
     }
     /* run all init methods */
     foreach ($this->apu_objects as $key => $val) {
         $this->apu_objects[$key]->init();
     }
     if (!empty($this->post_init)) {
         call_user_func_array($this->post_init, array(&$this));
     }
     /* determine actions of all application units 
     		   and check if some APU needs validate form or send header 'location'
     		 */
     $this->_determine_actions();
     /* call post_determine_action methods for each APU */
     $this->_post_determine_actions();
     /* create html form by all application units */
     $this->_create_html_form();
     /* validate html form */
     $form_valid = $this->_validate_html_form();
     /* if form(s) valid, execute actions of all application units */
     if ($form_valid) {
         $this->_execute_actions();
     } else {
         $this->_form_invalid();
         $this->_form_load_defaults();
     }
     /** get messages **/
     $this->_get_messages();
     /** assign values and form(s) to smarty **/
     $this->_smarty_assign();
     $smarty->assign_by_ref('parameters', $page_attributes);
     $smarty->assign_by_ref('lang_str', $lang_str);
     $smarty->assign_by_ref('lang_set', $lang_set);
     $smarty->assign_by_ref('come_from_admin_interface', $this->come_from_admin_interface);
     if (is_object($this->user_id)) {
         $smarty->assign_by_ref('user_auth', $this->user_id->to_smarty());
     }
     $cfg = new stdclass();
     $cfg->img_src_path = $config->img_src_path;
     $cfg->js_src_path = $config->js_src_path;
     $cfg->style_src_path = $config->style_src_path;
     $cfg->user_pages_path = $config->user_pages_path;
     $cfg->admin_pages_path = $config->admin_pages_path;
     $cfg->domains_path = $config->domains_path;
     $smarty->assign_by_ref("cfg", $cfg);
     //page atributes - get user real name
     $page_attributes['errors'] =& $this->errors;
     $page_attributes['message'] =& $this->messages;
     /* obtain list of required javascripts */
     foreach ($this->apu_objects as $val) {
         $this->required_javascript = array_merge($this->required_javascript, $val->get_required_javascript());
     }
     $this->required_javascript = array_unique($this->required_javascript);
     /* ----------------------- HTML begin ---------------------- */
     if (!isset($page_attributes['required_javascript']) or !is_array($page_attributes['required_javascript'])) {
         $page_attributes['required_javascript'] = array();
     }
     $page_attributes['required_javascript'] = array_merge($page_attributes['required_javascript'], $this->required_javascript);
     print_html_head($page_attributes);
     print_html_body_begin($page_attributes);
     $smarty->display($this->template_name);
     print_html_body_end($page_attributes);
     if (count($this->js_after_document)) {
         echo "\n<script type=\"text/javascript\" language=\"JavaScript\">\n<!--\n";
         foreach ($this->js_after_document as $v) {
             echo $v;
         }
         echo "\n// -->\n</script>\n";
     }
     echo "</html>\n";
     page_close();
 }
Example #9
0
function first_decision($userid) {
    $vis_cmd = Request::option('vis_cmd');
    $vis_state = Request::option('vis_state');
    $user_language = getUserLanguagePath($userid);

    if ($vis_cmd == "apply" && ($vis_state == "global" || $vis_state == "yes" || $vis_state == "no")) {
        $query = "UPDATE auth_user_md5 SET visible = ? WHERE user_id = ?";
        $statement = DBManager::get()->prepare($query);
        $statement->execute(array($vis_state, $userid));
        return;
    }

    $query = "SELECT visible FROM auth_user_md5 WHERE user_id = ?";
    $statement = DBManager::get()->prepare($query);
    $statement->execute(array($userid));
    $visiblity = $statement->fetchColumn();

    if ($visiblity != 'unknown') {
        return;
    }

    PageLayout::setTitle(_('Bitte wählen Sie Ihren Sichtbarkeitsstatus aus!'));
    PageLayout::setTabNavigation(NULL);

    // avoid recursion when loading the header
    $GLOBALS['USER_VISIBILITY_CHECK'] = false;

    $template = $GLOBALS['template_factory']->open("../locale/$user_language/LC_HELP/visibility_decision.php");
    $template->set_layout('layouts/base_without_infobox');

    echo $template->render();
    page_close();
    die;
}
Example #10
0
function simple_send($userdata)
{
    global $HTTP_POST_VARS, $auth;
    if ($HTTP_POST_VARS['field_subject'] == "" and $HTTP_POST_VARS['field_message'] == "") {
        display_form(false, "", true);
        page_close();
        exit;
        //there is a header(Location: mypage) after this funtion so don't exit this one!
    } else {
        if (!defined("TALK_INC")) {
            include "messages/talk.inc";
        }
        talk($auth->auth['uname'], $userdata['User_ID'], $HTTP_POST_VARS['field_subject'], $HTTP_POST_VARS['field_message']);
    }
}
Example #11
0
 /**
  *
  */
 function auth_loginform()
 {
     if (Request::isXhr()) {
         if (Request::isDialog()) {
             header('X-Location: ' . URLHelper::getURL($_SERVER['REQUEST_URI']));
             page_close();
             die;
         }
         throw new AccessDeniedException();
     }
     // first of all init I18N because seminar_open is not called here...
     global $_language_path;
     // set up dummy user environment
     if ($GLOBALS['user']->id !== 'nobody') {
         $GLOBALS['user'] = new Seminar_User('nobody');
         $GLOBALS['perm'] = new Seminar_Perm();
         $GLOBALS['auth'] = $this;
     }
     if (!$_SESSION['_language']) {
         $_SESSION['_language'] = get_accepted_languages();
     }
     if (!$_SESSION['_language']) {
         $_SESSION['_language'] = $GLOBALS['DEFAULT_LANGUAGE'];
     }
     // init of output via I18N
     $_language_path = init_i18n($_SESSION['_language']);
     include 'config.inc.php';
     // load the default set of plugins
     PluginEngine::loadPlugins();
     if (Request::get('loginname') && !$_COOKIE[get_class($GLOBALS['sess'])]) {
         $login_template = $GLOBALS['template_factory']->open('nocookies');
     } else {
         if (isset($this->need_email_activation)) {
             $this->unauth();
             header('Location: ' . URLHelper::getURL('activate_email.php?cancel_login=1&key=&uid=' . $this->need_email_activation));
             page_close();
             die;
         } else {
             unset($_SESSION['semi_logged_in']);
             // used by email activation
             $login_template = $GLOBALS['template_factory']->open('loginform');
             $login_template->set_attribute('loginerror', isset($this->auth["uname"]) && $this->error_msg);
             $login_template->set_attribute('error_msg', $this->error_msg);
             $login_template->set_attribute('uname', isset($this->auth["uname"]) ? $this->auth["uname"] : Request::username('loginname'));
             $login_template->set_attribute('self_registration_activated', $GLOBALS['ENABLE_SELF_REGISTRATION']);
         }
     }
     PageLayout::setHelpKeyword('Basis.AnmeldungLogin');
     $header_template = $GLOBALS['template_factory']->open('header');
     $header_template->current_page = _('Login');
     $header_template->link_params = array('cancel_login' => 1);
     include 'lib/include/html_head.inc.php';
     echo $header_template->render();
     echo $login_template->render();
     include 'lib/include/html_end.inc.php';
     page_close();
 }
Example #12
0
 /**
 *
 */
 function printError () {
     page_close();
     exit;
 }
Example #13
0
/**
 * This function "selects" a Veranstaltung to work with it
 *
 * The following variables will bet set:
 *   $SessionSeminar                 Veranstaltung id<br>
 *   $SessSemName[0]                 Veranstaltung name<br>
 *   $SessSemName[1]                 Veranstaltung id<br>
 *   $SessSemName[2]                 Veranstaltung ort (room)<br>
 *   $SessSemName[3]                 Veranstaltung Untertitel (subtitle)<br>
 *   $SessSemName[4]                 Veranstaltung start_time (the Semester start_time)<br>
 *   $SessSemName[5]                 Veranstaltung institut_id (the home-intitute)<br>
 *   $SessSemName["art"]             Veranstaltung type in alphanumeric form<br>
 *   $SessSemName["art_num"]         Veranstaltung type in numeric form<br>
 *   $SessSemName["art_generic"]     Veranstaltung generic type in alhanumeric form (self description)<br>
 *   $SessSemName["class"]               Veranstaltung class (sem or inst, in this function always sem)<br>
 *   $SessSemName["header_line"]     the header-line to use on every page of the Veranstaltung<br>
 *
 * @param string $sem_id the id of the Veranstaltung
 *
 * @return boolean  true if successful
 *
 */
function selectSem($sem_id)
{
    global $perm, $SEM_TYPE, $SEM_TYPE_MISC_NAME, $SessionSeminar, $SessSemName, $SemUserStatus, $rechte, $auth;
    closeObject();
    $SessionSeminar = $sem_id;
    $course = Course::findCurrent();
    if ($course) {
        $rechte = $perm->have_studip_perm("tutor", $course["Seminar_id"]);
        if (!($SemUserStatus = $perm->get_studip_perm($course["Seminar_id"]))) {
            $SemUserStatus = "nobody";
            if ($course['lesezugriff'] > 0 || !get_config('ENABLE_FREE_ACCESS')) {
                // redirect to login page if user is not logged in
                $auth->login_if($auth->auth["uid"] == "nobody");
                throw new AccessDeniedException();
            }
        }
        $SessionSeminar = $course["Seminar_id"];
        $SessSemName[0] = $course["Name"];
        $SessSemName[1] = $course["Seminar_id"];
        $SessSemName[3] = $course["Untertitel"];
        $SessSemName[4] = $course["start_time"];
        $SessSemName[5] = $course["Institut_id"];
        $SessSemName["art_generic"] = _("Veranstaltung");
        $SessSemName["class"] = "sem";
        $SessSemName["art_num"] = $course["status"];
        if ($SEM_TYPE[$row["status"]]["name"] == $SEM_TYPE_MISC_NAME) {
            $SessSemName["art"] = _("Veranstaltung");
        } else {
            $SessSemName["art"] = $SEM_TYPE[$row["status"]]["name"];
        }
        $SessSemName["header_line"] = $course->getFullname();
        $_SESSION['SessionSeminar'] =& $SessionSeminar;
        $_SESSION['SessSemName'] =& $SessSemName;
        URLHelper::addLinkParam('cid', $SessionSeminar);
        // if the aux data is forced for this seminar forward all user that havent made an input to this site
        if ($course["aux_lock_rule_forced"] && !$perm->have_studip_perm('tutor', $course["Seminar_id"]) && !in_array($_SERVER['PATH_INFO'], array('/course/members/additional_input', '/course/change_view'))) {
            $statement = DBManager::get()->prepare("SELECT 1 FROM datafields_entries WHERE range_id = ? AND sec_range_id = ? LIMIT 1");
            $statement->execute(array($GLOBALS['user']->id, $course["Seminar_id"]));
            if (!$statement->rowCount()) {
                header('location: ' . URLHelper::getURL('dispatch.php/course/members/additional_input'));
                page_close();
                die;
            }
        }
        return true;
    } else {
        $SessionSeminar = null;
        return false;
    }
}
Example #14
0
function DEPRECATED_sf_header_redirect($url_location, $shutdown = true)
{
    global $area;
    $url_location = str_replace('&amp;', '&', $url_location);
    header('HTTP/1.1 302 Moved Temporarily');
    header('Location:' . $url_location);
    if ($shutdown) {
        if ($area != 'logout') {
            page_close();
        }
        exit;
    }
}
Example #15
0
function del($id, $act_as_admin = false, $quick = false)
{
    global $sess, $mytrail, $auth;
    if (!defined("DIRECTORY_NOTIFICATION_INC")) {
    }
    include "messages/directory_notification.inc";
    rm_object((int) $id, true);
    if ($act_as_admin) {
        send_admin_notification($mytrail, LTMSG_TRAILDEL);
    }
    //TODO: add reason
    if (!$quick) {
        page_close();
        include "directory/edit/del-confirmation.html";
        exit;
    } else {
        page_close();
        Header("Location: " . $sess->url(build_good_url(parent_path($mytrail['path']))));
    }
}
Example #16
0
            if ($cacount) {
                printf("<td>&nbsp;&nbsp;<a href=%s>Recipient Access</a></td>", $sess->url("postfix_recip_access.php") . $sess->add_query(array("domain" => $domain)));
            }
            echo "</tr>\n";
        }
    }
}
$sql = "select distinct EmailDomain from ServiceLocation where Location in ({$Locations}) order by EmailDomain";
# echo $sql;
echo "<table cellspacing=2>\n";
$db = new DB_hotspot();
$pf = new DB_postfix();
if ($perm->have_perm("admin")) {
    #	echo "<a href=".$sess->url("mailq.php").">Mail Queue</a><br>";
    $sql = "select distinct EmailDomain from ServiceLocation order by EmailDomain";
    ListDomains($db, $sql, "HotSpot Domains");
    $sql = "select domain from postfix_virtual_domains";
    ListDomains($pf, $sql, "Local Mailbox Domains");
    $sql = "select domain, destination from postfix_transport";
    $pf->query($sql);
    echo "<tr><td colspan=4><h3>Domain Routing</h3></td></tr>\n";
    while ($pf->next_record()) {
        echo "<tr><td>" . $pf->f(0) . "</td><td colspan=3> is set up to route to " . $pf->f(1) . "</td></tr>\n";
    }
}
echo "</table>\n";
if (!$count) {
    echo "<h4>You have no email domains to administer here.</h4>";
}
page_close(array());
Example #17
0
function sf_header_redirect($url_location, $shutdown = true)
{
    global $area;
    echo $url_location;
    $url_location = str_replace('&amp;', '&', $url_location);
    //header ('HTTP/1.1 302 Moved Temporarily');
    header("HTTP/1.1 301 Moved Permanently");
    header('Location:' . $url_location);
    if ($shutdown) {
        if ($area != 'logout') {
            page_close();
        }
        exit;
    }
}
 function after_filter($action, $args)
 {
     page_close();
 }
Example #19
0
    </select>
    </td>
    <td>
      <INPUT name="txtRestriction" size="20" value="/">
    </td>
  </tr>  

  <tr>
    <td>
      Date
    </td>
    <td>
     Language
    </td>
  </tr>  
  <tr>
    <td>
      <INPUT name="txtDate" value = "&lt;<?php echo(strftime("%Y-%m-%d")); ?>" >
    </td>
    <td>
      <INPUT name="txtLanguage" size="20" value="3">
    </td>
  </tr>  
 
</table>
</form>
<? } ?>
</body>
</html>
<?php page_close(); ?>
 function action_export(&$errors)
 {
     global $data, $smarty, $config;
     $this->controler->set_timezone();
     $opt = $this->prepare_opt_param_for_get_acc_entries();
     $opt['limit_query'] = false;
     if ($config->acc_use_cdr_table) {
         if (false === ($this->acc_res = $data->get_cdr_entries($this->user_id, $opt, $errors))) {
             return false;
         }
     } else {
         if (false === ($this->acc_res = $data->get_acc_entries($this->user_id, $opt, $errors))) {
             return false;
         }
     }
     if ($this->opt['convert_sip_addresses_to_phonenumbers']) {
         $this->convert_sip_addresses_to_phonenumbers();
     }
     header("Content-Type: text/plain\n");
     header("Content-Transfer-Encoding: 8bit\n");
     Header("Content-Disposition: attachment;filename=calls.csv");
     $smarty->assign_by_ref($this->opt['smarty_result'], $this->acc_res);
     $smarty->display($this->opt['cvs_export_template']);
     page_close();
     exit;
 }
function cms_pagefooter()
{
    // debug("cms_pagefooter", "start", "delayed");
    $navbar = pslNew("NavBar");
    $output = $navbar->getNavBar('navbarFooter');
    $output = getFooter();
    page_close();
    return $output;
}
 function start()
 {
     global $smarty, $lang_str, $lang_set, $page_attributes, $config;
     try {
         /* check if admin have perms to manage user */
         if ($this->check_perms_to_user) {
             if (!$this->check_perms_to_user()) {
                 page_close();
                 die("You haven't permissions to manage user '" . $this->user_id->get_username() . "@" . $this->user_id->get_realm() . "'");
             }
         }
         /* check if admin have perms to manage domain */
         if ($this->check_perms_to_domain) {
             if (!$this->check_perms_to_domain()) {
                 page_close();
                 die("You haven't permissions to manage domain with id:'" . $this->domain_id . "'");
             }
         }
         /* do not allow change parameters of default domain */
         if ($this->domain_id == '0') {
             $_SESSION['page_controler_domain_id'] = null;
             page_close();
             die("Change parameters of default domain is not possible");
         }
         /* make code portable - if magic_quotes_gpc is set to on, strip slashes */
         if (get_magic_quotes_gpc()) {
             function stripslashes_deep($value)
             {
                 $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value);
                 return $value;
             }
             $_POST = array_map('stripslashes_deep', $_POST);
             $_GET = array_map('stripslashes_deep', $_GET);
             $_REQUEST = array_map('stripslashes_deep', $_REQUEST);
             $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
         }
         /* translate chars '<', '>', etc. to &lt; &gt; etc.. */
         if ($this->perform_hack_protect) {
             $this->hack_protection();
         }
         /* propagate user_id and reference to this to all application units */
         foreach ($this->apu_objects as $key => $val) {
             $this->apu_objects[$key]->user_id = $this->user_id;
             $this->apu_objects[$key]->domain_id = $this->domain_id;
             $this->apu_objects[$key]->controler =& $this;
         }
         /* run all init methods */
         foreach ($this->apu_objects as $key => $val) {
             $this->apu_objects[$key]->init();
         }
         if (!empty($this->post_init)) {
             call_user_func_array($this->post_init, array(&$this));
         }
         /* determine actions of all application units 
              and check if some APU needs validate form or send header 'location'
            */
         $this->_determine_actions();
         /* call post_determine_action methods for each APU */
         $this->_post_determine_actions();
         /* create html form by all application units */
         $this->_create_html_form();
         /* validate html form */
         $form_valid = $this->_validate_html_form();
         /* if form(s) valid, execute actions of all application units */
         if ($form_valid) {
             $this->_execute_actions();
         } else {
             $this->_form_invalid();
             $this->_form_load_defaults();
         }
         /** get messages **/
         $this->_get_messages();
         /** assign values and form(s) to smarty **/
         $this->_smarty_assign();
         if (is_object($this->user_id)) {
             $smarty->assign('user_auth', $this->user_id->to_smarty());
         }
         $cfg = new stdclass();
         $cfg->img_src_path = $config->img_src_path;
         $cfg->js_src_path = $config->js_src_path;
         $cfg->style_src_path = $config->style_src_path;
         $cfg->user_pages_path = $config->user_pages_path;
         $cfg->admin_pages_path = $config->admin_pages_path;
         $cfg->domains_path = $config->domains_path;
         $smarty->assign("cfg", $cfg);
         //page atributes - get user real name
         $page_attributes['errors'] =& $this->errors;
         $page_attributes['message'] =& $this->messages;
         /* obtain list of required javascripts */
         foreach ($this->apu_objects as $val) {
             $this->required_javascript = array_merge($this->required_javascript, $val->get_required_javascript());
         }
         $js_files = array();
         if (isset($page_attributes['required_javascript']) and is_array($page_attributes['required_javascript'])) {
             $js_files = $page_attributes['required_javascript'];
         }
         $js_files = array_merge($js_files, $this->required_javascript);
         foreach ($js_files as $k => $file) {
             if (preg_match("/^module:(?P<module>[-_0-9a-z]+):(?P<file>.+)\$/i", $file, $matches)) {
                 $js_files[$k] = $this->js_from_mod_getter($matches['module'], $matches['file']);
             }
         }
         $page_attributes['required_javascript'] = array_unique($js_files);
         $smarty->assign('parameters', $page_attributes);
         $smarty->assign('lang_str', $lang_str);
         $smarty->assign('lang_set', $lang_set);
         $smarty->assign('come_from_admin_interface', $this->come_from_admin_interface);
         /* ----------------------- HTML begin ---------------------- */
         print_html_head($page_attributes);
         print_html_body_begin($page_attributes);
         $smarty->display($this->template_name);
         print_html_body_end($page_attributes);
         if (count($this->js_after_document)) {
             echo "\n<script type=\"text/javascript\" language=\"JavaScript\">\n<!--\n";
             foreach ($this->js_after_document as $v) {
                 echo $v;
             }
             echo "\n// -->\n</script>\n";
         }
         echo "</html>\n";
         page_close();
     } catch (PearErrorException $e) {
         global $serwebLog;
         //if custom log function is defined, use it for log errors
         if (!empty($config->custom_log_function)) {
             $log_message = $e->pear_err->getMessage() . " - " . $e->pear_err->getUserInfo();
             call_user_func($config->custom_log_function, PEAR_LOG_ALERT, $log_message, $e->getFile(), $e->getLine());
         } elseif ($serwebLog) {
             $log_message = "file: " . $e->getFile() . ":" . $e->getLine() . ": " . $e->pear_err->getMessage() . " - " . $e->pear_err->getUserInfo();
             //remove endlines from the log message
             $log_message = str_replace(array("\n", "\r"), "", $log_message);
             $log_message = ereg_replace("[[:space:]]{2,}", " ", $log_message);
             $serwebLog->log($log_message, PEAR_LOG_ALERT);
         }
         // @todo: display some pretty screen explaining there is
         // unexpected error.
         // But for now just let the exception unhandled
         throw $e;
     }
     // All DB transactions should be commited now. If there is any
     // transacton in progress - most probably because of an error that
     // throwed exception - rollback the transaction.
     if ($GLOBALS['data']->is_transaction_in_progress()) {
         $GLOBALS['data']->transaction_rollback();
     }
 }
 function getContent($args = null, $raw = false)
 {
     global $SEM_TYPE, $SEM_CLASS;
     $this->group_by_fields = array(array('name' => _("Semester"), 'group_field' => 'sem_number'), array('name' => _("Bereich"), 'group_field' => 'bereich'), array('name' => _("Lehrende"), 'group_field' => 'fullname', 'unique_field' => 'username'), array('name' => _("Typ"), 'group_field' => 'status'), array('name' => _("Einrichtung"), 'group_field' => 'Institut', 'unique_field' => 'Institut_id'));
     // initialise data
     $this->sem_browse_data = array('start_item_id' => $this->getRootStartItemId(), 'do_search' => '0', 'type' => 'all', 'sem' => 'all', 'withkids' => '0', 'show_result' => '0');
     // Daten aus config übernehmen
     $this->sem_browse_data['group_by'] = $this->config->getValue('Main', 'grouping');
     $level_change = $args['start_item_id'];
     $this->search_obj = new StudipSemSearchHelper(null, true);
     $semester = new SemesterData();
     $all_semester = $semester->getAllSemesterData();
     array_unshift($all_semester, 0);
     $switch_time = mktime(0, 0, 0, date('m'), date('d') + 7 * $this->config->getValue('Main', 'semswitch'), date('Y'));
     // get current semester
     $current_sem = get_sem_num($switch_time) + 1;
     switch ($this->config->getValue('Main', 'semstart')) {
         case 'previous':
             if (isset($all_semester[$current_sem - 1])) {
                 $current_sem--;
             }
             break;
         case 'next':
             if (isset($all_semester[$current_sem + 1])) {
                 $current_sem++;
             }
             break;
         case 'current':
             break;
         default:
             if (isset($all_semester[$this->config->getValue('Main', 'semstart')])) {
                 $current_sem = $this->config->getValue('Main', 'semstart');
             }
     }
     $this->sem_number = array($current_sem);
     $this->sem_browse_data['sem'] = $current_sem;
     $sem_classes = (array) $this->config->getValue('Main', 'semclasses');
     $sem_types_order = (array) $this->config->getValue('ReplaceTextSemType', 'order');
     $sem_types_visbility = (array) $this->config->getValue('ReplaceTextSemType', 'visibility');
     foreach ($sem_types_order as $type_id) {
         if ($sem_types_visbility[$type_id] && in_array($GLOBALS['SEM_TYPE'][$type_id]['class'], $sem_classes)) {
             $this->sem_browse_data['sem_status'][] = $type_id;
         }
     }
     $this->module_params = $this->getModuleParams($this->approved_params);
     if (!$this->module_params['reset_search']) {
         $this->sem_browse_data = array_merge($this->sem_browse_data, $this->module_params);
     }
     $sem_status = is_array($this->sem_browse_data['sem_status']) ? $this->sem_browse_data['sem_status'] : false;
     $params = $this->sem_browse_data;
     // delete array of semester data from the search object's parameters
     $params['sem_status'] = false;
     if ($this->config->getValue('Main', 'mode') == 'show_sem_range') {
         $params['scope_choose'] = $this->sem_browse_data['start_item_id'];
     } else {
         $params['range_choose'] = $this->sem_browse_data['start_item_id'];
     }
     if ($this->sem_browse_data['sem'] == 'all') {
         $this->sem_number = array_keys($all_semester);
     } else {
         if (isset($this->sem_browse_data['sem'])) {
             $this->sem_number = array((int) $this->sem_browse_data['sem']);
         }
     }
     // set params for search object
     $this->search_obj->setParams($params, true);
     if ($this->sem_browse_data['do_search'] == 1) {
         $this->search_obj->doSearch();
         $search_result = $this->search_obj->getSearchResultAsArray();
         if (count($search_result)) {
             $this->sem_browse_data['search_result'] = array_flip($search_result);
         } else {
             $this->sem_browse_data['search_result'] = array();
         }
         $this->sem_browse_data['show_result'] = '1';
         $this->sem_browse_data['show_entries'] = false;
     } else {
         if ($this->config->getValue('Main', 'mode') == 'show_sem_range') {
             $this->get_sem_range($this->sem_browse_data['start_item_id'], $this->sem_browse_data['withkids'] == 1);
         } else {
             //($this->config->getValue('Main', 'mode') == 'show_sem_range_tree') {
             $this->get_sem_range_tree($this->sem_browse_data['start_item_id'], $this->sem_browse_data['withkids'] == 1);
         }
     }
     $this->sem_dates = $all_semester;
     $this->sem_dates[0] = array('name' => sprintf(_("vor dem %s"), $this->sem_dates[1]['name']));
     // reorganize the $SEM_TYPE-array
     foreach ($GLOBALS['SEM_CLASS'] as $key_class => $class) {
         $i = 0;
         foreach ($GLOBALS['SEM_TYPE'] as $key_type => $type) {
             if ($type['class'] == $key_class) {
                 $i++;
                 $this->sem_types_position[$key_type] = $i;
             }
         }
     }
     if ($this->sem_browse_data['xls_export']) {
         $tmp_file = basename($this->createResultXls());
         if ($tmp_file) {
             ob_end_clean();
             header('Location: ' . getDownloadLink($tmp_file, _("ErgebnisVeranstaltungssuche.xls"), 4));
             page_close();
             die;
         }
     }
     $this->global_markers['URL_SEARCH_PARAMS'] = '';
     $search_params = $this->module_params;
     $param_key = 'ext_' . strtolower($this->name);
     foreach ($search_params as $key => $value) {
         $this->global_markers['URL_SEARCH_PARAMS'] .= "&{$param_key}[{$key}]=" . urlencode($value);
     }
     $this->global_markers['URL_PERSONDETAILS'] = $this->getLinkToModule('LinkInternPersondetails');
     $this->global_markers['URL_LECTUREDETAILS'] = $this->getLinkToModule('LinkInternLecturedetails');
     $this->global_markers['URL_LEVEL_NO_COURSES'] = $this->getLinkToModule('LinkInternTree');
     $this->global_markers['URL_LEVEL_COURSES'] = $this->getLinkToModule('LinkInternShowCourses');
     $this->global_markers['CURRENT_SEMESTER'] = ExternModule::ExtHtmlReady($all_semester[$this->sem_number[0]]['name']);
     if (trim($this->config->getValue('TemplateSimpleSearch', 'template'))) {
         $content['SEM_BROWSER']['SIMPLE_SEARCH'] = $this->elements['TemplateSimpleSearch']->toString(array('content' => $this->getContentSimpleSearch(), 'subpart' => 'SIMPLE_SEARCH'));
     }
     if (trim($this->config->getValue('TemplateExtendedSearch', 'template'))) {
         $content['SEM_BROWSER']['EXTENDED_SEARCH'] = $this->elements['TemplateExtendedSearch']->toString(array('content' => $this->getContentExtendedSearch(), 'subpart' => 'EXTENDED_SEARCH'));
     }
     if (trim($this->config->getValue('TemplateTree', 'template'))) {
         $content['SEM_BROWSER']['TREE'] = $this->elements['TemplateTree']->toString(array('content' => $this->getContentTree(), 'subpart' => 'TREE'));
     }
     if (trim($this->config->getValue('TemplateResult', 'template')) && $this->sem_browse_data['show_result'] == '1') {
         $content['SEM_BROWSER']['RESULT'] = $this->elements['TemplateResult']->toString(array('content' => $this->getContentResult(), 'subpart' => 'RESULT'));
     }
     // set super global markers
     $content['__GLOBAL__'] = $this->global_markers;
     return $content;
 }
function cms_pagefooter()
{
    // debug("cms_pagefooter", "start", "delayed");
    $output = getFooter();
    page_close();
    return $output;
}
Example #25
0
    default:
        $requires = "admin";
        break;
    case "menu":
        $requires = "admin";
        break;
}
if (!$perm->have_perm($requires)) {
    echo "Access Denied";
} else {
    $db = new $_ENV["DatabaseClass"]();
    $v = urldecode($val);
    $i = urldecode($index);
    // Get Old Value
    $db->query("SELECT {$col} FROM {$table} WHERE {$key}='{$i}'");
    if ($db->next_record()) {
        $oldval = $db->f(0);
    }
    // Set New Value
    $db->query("UPDATE {$table} SET {$col}='{$v}' WHERE {$key}='{$i}'");
    EventLog("Cell Edit by " . $auth->auth["uname"], $sql);
    // Get New Value
    $db->query("SELECT {$col} FROM {$table} WHERE {$key}='{$i}'");
    if ($db->next_record()) {
        echo $db->f(0);
    } else {
        echo $oldval;
    }
}
page_close(array("silent" => "silent"));
Example #26
0
function ewiki_page_phplib_logout($id = 0, $data = 0)
{
    global $auth;
    $auth->logout();
    page_close();
    /**
    *    return(  "<h1>Logout</h1> 
     You have been logged in as <b>".$auth->auth["uname"]."</b> with
     <b>".$auth->auth["perm"]."</b> permission.You have been logged out.");
    */
    return "<h1>Logout</h1> You have been logged out.";
}
Example #27
0
File: scm.php Project: ratbird/hope
 /**
  * After filter, closes the page.
  *
  * @param String $action Name of the action that has been invoked
  * @param Array  $args   Arguments that were passed to the action method
  */
 public function after_filter($action, $args)
 {
     parent::after_filter($action, $args);
     if (Request::isXhr()) {
         $this->response->add_header('X-Title', PageLayout::getTitle());
     }
     page_close();
 }
Example #28
0
 /**
  * Callback function being called after an action is executed.
  *
  * @param string Name of the action to perform.
  * @param array  An array of arguments to the action.
  *
  * @return void
  */
 function after_filter($action, $args)
 {
     parent::after_filter($action, $args);
     if (Request::isXhr() && !isset($this->response->headers['X-Title']) && PageLayout::hasTitle()) {
         $this->response->add_header('X-Title', PageLayout::getTitle());
     }
     if ($this->with_session) {
         page_close();
     }
 }
Example #29
0
                    break;
                case "insert":
                    $db3 = new DB_SourceWell();
                    $db_user = $db->f("user");
                    $db_version = $db->f("version");
                    $db3->query("INSERT history SET appid='{$db_appid}', user_his='{$db_user}', creation_his='{$db_modification}', version_his='{$db_version}'");
                    // echo "<p>INSERT history SET appid='$db_appid', user_his='$db_user', creation_his='$db_modification', version_his='$db_version'\n";
                    $timestamp = mktimestamp($db_modification);
                    $title = "History date is updated to " . timestr($timestamp) . "\n";
                    $bx->box_title($title);
                    break;
                default:
                    $be->box_full($t->translate("Error"), $t->translate("Invalid action"));
                    break;
            }
            $bx->box_end();
            $i++;
        }
    }
    if ($i < 1) {
        $msg = $t->translate("All dates are consistent");
        $bi->box_full($t->translate("Check Date"), $msg);
    }
}
?>
<!-- end content -->

<?php 
require "./include/footer.inc";
@page_close();
Example #30
0
    function throwError($status, $message, $file = '', $line = '')
    {

        $this->errors[$status][] = new Error($status, $message, $file, $line);
        $this->status |= $status;
        reset($this->errors[$status]);
        if ($status == ErrorHandler::ERROR_FATAL) {
            echo '<b>';
            while ($error = $this->nextError(ErrorHandler::ERROR_FATAL)) {
                echo '<br />' . $error->getMessage();
            }
            echo '</b><br />';
            page_close();
            exit;
        }
    }