#
# Exponent is free software; you can redistribute
# it and/or modify it under the terms of the GNU
# General Public License as published by the Free
# Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# GPL: http://www.gnu.org/licenses/gpl.txt
#
##################################################
// Part of the User Management category
if (!defined('EXPONENT')) {
    exit('');
}
if (exponent_permissions_check('user_management', exponent_core_makeLocation('AdministrationModule'))) {
    exponent_flow_set(SYS_FLOW_PROTECTED, SYS_FLOW_ACTION);
    $db->delete('sessionticket', 'last_active < ' . (time() - SESSION_TIMEOUT));
    if (!defined('SYS_USERS')) {
        require_once BASE . 'subsystems/users.php';
    }
    if (!defined('SYS_DATETIME')) {
        require_once BASE . 'subsystems/datetime.php';
    }
    $sessions = $db->selectObjects('sessionticket');
    for ($i = 0; $i < count($sessions); $i++) {
        $sessions[$i]->user = exponent_users_getUserById($sessions[$i]->uid);
        $sessions[$i]->duration = exponent_datetime_duration($sessions[$i]->last_active, $sessions[$i]->start_time);
    }
    $template = new template('AdministrationModule', '_sessionmanager', $loc);
    $template->assign('sessions', $sessions);
    $template->assign('user', $user);
# Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# GPL: http://www.gnu.org/licenses/gpl.txt
#
##################################################
define('SCRIPT_EXP_RELATIVE', '');
define('SCRIPT_FILENAME', 'popup.php');
ob_start();
// Initialize the Exponent Framework
require_once 'exponent.php';
// Initialize the Theme Subsystem
if (!defined('SYS_THEME')) {
    require_once BASE . 'subsystems/theme.php';
}
$loc = exponent_core_makeLocation(isset($_GET['module']) ? $_GET['module'] : '', isset($_GET['src']) ? $_GET['src'] : '', isset($_GET['int']) ? $_GET['int'] : '');
$SYS_FLOW_REDIRECTIONPATH = 'popup';
if (exponent_theme_inAction()) {
    exponent_theme_runAction();
} else {
    if (isset($_GET['module']) && isset($_GET['view'])) {
        exponent_flow_set(SYS_FLOW_PUBLIC, SYS_FLOW_SECTIONAL);
        $mod = new $_GET['module']();
        $mod->show($_GET['view'], $loc, isset($_GET['title']) ? $_GET['title'] : '');
    }
}
$str = ob_get_contents();
ob_end_clean();
$template = new standalonetemplate('popup_' . (isset($_GET['template']) ? $_GET['template'] : 'general'));
$template->assign('output', $str);
$template->output();
 function show($view, $loc = null)
 {
     global $db;
     if (!defined("SYS_FORMS")) {
         require_once BASE . "subsystems/forms.php";
     }
     exponent_forms_initialize();
     $i18n = exponent_lang_loadFile('modules/formmodule/class.php');
     if (defined("PREVIEW_READONLY") && !defined("SELECTOR")) {
         // Pass
     } else {
         $f = null;
         $f = $db->selectObject("formbuilder_form", "location_data='" . serialize($loc) . "'");
         if (!$f) {
             //Create a form if it's missing...
             $f->name = "New Form";
             $f->description = "";
             $f->location_data = serialize($loc);
             $f->table_name = "";
             $f->is_email = 0;
             $f->is_saved = 0;
             $f->submitbtn = $i18n['default_submit'];
             $f->resetbtn = $i18n['default_reset'];
             $f->response = $i18n['default_response'];
             $f->subject = $i18n['default_subject'];
             $frmid = $db->insertObject($f, "formbuilder_form");
             //Create Default Report;
             $rpt->name = $i18n['default_report'];
             $rpt->description = "";
             $rpt->location_data = $f->location_data;
             $rpt->text = "";
             $rpt->column_names = "";
             $rpt->form_id = $frmid;
             $db->insertObject($rpt, "formbuilder_report");
             $f->id = $frmid;
         }
         global $SYS_FLOW_REDIRECTIONPATH;
         exponent_flow_set(SYS_FLOW_PUBLIC, SYS_FLOW_ACTION);
         $SYS_FLOW_REDIRECTIONPATH = "editfallback";
         exponent_flow_set(SYS_FLOW_PUBLIC, SYS_FLOW_ACTION);
         $SYS_FLOW_REDIRECTIONPATH = "exponent_default";
         $floc = unserialize($f->location_data);
         $controls = $db->selectObjects("formbuilder_control", "form_id=" . $f->id);
         if (!defined("SYS_SORTING")) {
             require_once BASE . "subsystems/sorting.php";
         }
         usort($controls, "exponent_sorting_byRankAscending");
         $form = new form();
         foreach ($controls as $c) {
             $ctl = unserialize($c->data);
             $ctl->_id = $c->id;
             $ctl->_readonly = $c->is_readonly;
             $form->register($c->name, $c->caption, $ctl);
         }
         $form->register(uniqid(""), "", new htmlcontrol("<br /><br />"));
         $form->register("submit", "", new buttongroupcontrol($f->submitbtn, $f->resetbtn, ""));
         $form->meta("action", "submit_form");
         $form->meta("m", $floc->mod);
         $form->meta("s", $floc->src);
         $form->meta("i", $floc->int);
         $form->meta("id", $f->id);
         $formmsg = '';
         $form->location(exponent_core_makeLocation("formbuilder", $floc->src, $floc->int));
         if (count($controls) == 0) {
             $form->controls['submit']->disabled = true;
             $formmsg .= $i18n['blank_form'] . '<br>';
         }
         if ($f->is_saved == 0 && $f->is_email == 0) {
             $form->controls['submit']->disabled = true;
             $formmsg .= $i18n['no_actions'];
         }
         $template = new template("formmodule", $view, $loc);
         $template->assign("formmsg", $formmsg);
         $template->assign("form_html", $form->toHTML($f->id));
         $template->assign("form", $f);
         $template->register_permissions(array("administrate", "editform", "editformsettings", "editreport", "viewdata", "editdata", "deletedata"), $loc);
         $template->output();
     }
 }
#
# This file is part of Exponent
#
# Exponent is free software; you can redistribute
# it and/or modify it under the terms of the GNU
# General Public License as published by the Free
# Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# GPL: http://www.gnu.org/licenses/gpl.txt
#
##################################################
if (!defined('EXPONENT')) {
    exit('');
}
exponent_flow_set(SYS_FLOW_PUBLIC, SYS_FLOW_ACTION);
$template = new template('weblogmodule', '_view_page', $loc);
$config = $db->selectObject('weblogmodule_config', "location_data='" . serialize($loc) . "'");
if ($config == null) {
    $config->allow_comments = 1;
    $config->items_per_page = 10;
}
if (isset($_GET['single'])) {
    $config->items_per_page = 1;
}
$where = "location_data='" . serialize($loc) . "' AND (is_draft = 0 OR poster = " . ($user ? $user->id : -1) . ")";
if (!exponent_permissions_check('view_private', $loc)) {
    $where .= ' AND is_private = 0';
}
$total = $db->countObjects('weblog_post', $where);
$posts = $db->selectObjects('weblog_post', $where . ' ORDER BY posted DESC ' . $db->limit($config->items_per_page, $_GET['page'] * $config->items_per_page));
function exponent_theme_mainContainer()
{
    if (!AUTHORIZED_SECTION) {
        // Set this so that a login on an Auth Denied page takes them back to the previously Auth-Denied page
        exponent_flow_set(SYS_FLOW_PROTECTED, SYS_FLOW_SECTIONAL);
        echo SITE_403_HTML;
        return;
    }
    if (PUBLIC_SECTION) {
        exponent_flow_set(SYS_FLOW_PUBLIC, SYS_FLOW_SECTIONAL);
    } else {
        exponent_flow_set(SYS_FLOW_PROTECTED, SYS_FLOW_SECTIONAL);
    }
    #	if (exponent_sessions_isset("themeopt_override")) {
    #		$config = exponent_sessions_get("themeopt_override");
    exponent_theme_showSectionalModule("ContainerModule", "Default", "", "@section");
    #	} else {
    #		exponent_theme_showSectionalModule("ContainerModule","Default","","@section");
    #	}
}