예제 #1
0
# 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('');
}
if (exponent_permissions_check('configure', $loc)) {
    if (exponent_template_getModuleViewFile($loc->mod, '_configure', false) == TEMPLATE_FALLBACK_VIEW) {
        $template = new template('common', '_configure', $loc);
    } else {
        $template = new template($loc->mod, '_configure', $loc);
    }
    $hasConfig = 0;
    $submit = null;
    $form = null;
    if ($db->tableExists($_GET['module'] . '_config') && class_exists($_GET['module'] . '_config')) {
        $config = $db->selectObject($_GET['module'] . '_config', "location_data='" . serialize($loc) . "'");
        $form = call_user_func(array($_GET['module'] . '_config', 'form'), $config);
        if (isset($form->controls['submit'])) {
            $submit = $form->controls['submit'];
            $form->unregister('submit');
        }
        $hasConfig = 1;
예제 #2
0
# 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('');
}
if (exponent_permissions_check('administrate', $loc)) {
    if (exponent_template_getModuleViewFile($loc->mod, '_userpermissions', false) == TEMPLATE_FALLBACK_VIEW) {
        $template = new template('common', '_userpermissions', $loc);
    } else {
        $template = new template($loc->mod, '_userpermissions', $loc);
    }
    $template->assign('user_form', 1);
    if (!defined('SYS_USERS')) {
        include_once BASE . 'subsystems/users.php';
    }
    $users = array();
    $modclass = $loc->mod;
    $mod = new $modclass();
    $perms = $mod->permissions($loc->int);
    $have_users = 0;
    foreach (exponent_users_getAllUsers(0) as $u) {
        $have_users = 1;
예제 #3
0
 function template($module, $view = null, $loc = null, $caching = false)
 {
     // Set up the Smarty template variable we wrap around.
     $this->tpl = new Smarty();
     $this->tpl->php_handling = SMARTY_PHP_REMOVE;
     $this->tpl->plugins_dir[] = BASE . 'plugins';
     $this->viewfile = exponent_template_getModuleViewFile($module, $view);
     $this->viewparams = exponent_template_getViewParams($this->viewfile);
     //$this->viewdir = str_replace(BASE,'',realpath(dirname($this->viewfile)));
     $this->viewdir = realpath(dirname($this->viewfile));
     $this->view = substr(basename($this->viewfile), 0, -4);
     $this->tpl->template_dir = $this->viewdir;
     //fix for the wamp/lamp issue
     $this->langdir = "modules/" . $module . "/views/";
     //$this->langdir = $this->viewdir;
     //
     // Make way for i18n
     // $this->tpl->compile_dir = $this->viewdir."_c";
     $this->tpl->compile_dir = BASE . '/views_c';
     $this->tpl->compile_id = md5($this->viewfile);
     $expected_view = $this->viewfile == TEMPLATE_FALLBACK_VIEW ? $view : $this->view;
     $this->tpl->assign("__view", $expected_view);
     if ($loc == null) {
         $loc = exponent_core_makeLocation($module);
     }
     $this->tpl->assign("__loc", $loc);
     $this->tpl->assign("__redirect", exponent_flow_get());
     // View Config
     global $db;
     $container = $db->selectObject("container", "internal='" . serialize($loc) . "'");
     $this->viewconfig = $container && $container->view_data != "" ? unserialize($container->view_data) : array();
     $this->tpl->assign("__viewconfig", $this->viewconfig);
     //echo "<xmp>";
     //print_r($this);
     //echo "</xmp>";
 }
예제 #4
0
# 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("");
}
$mloc = exponent_core_makeLocation($_GET['orig_module'], $loc->src, $loc->int);
if (exponent_permissions_check('manage_categories', $mloc)) {
    exponent_flow_set(SYS_FLOW_PROTECTED, SYS_FLOW_ACTION);
    $categories = $db->selectObjects("category", "location_data='" . serialize($mloc) . "'");
    if (exponent_template_getModuleViewFile($mloc->mod, "_cat_manageCategories", false) == TEMPLATE_FALLBACK_VIEW) {
        $template = new template("categories", "_cat_manageCategories", $loc);
    } else {
        $template = new template($mloc->mod, "_cat_manageCategories", $loc);
    }
    if (!defined('SYS_SORTING')) {
        include_once BASE . 'subsystems/sorting.php';
    }
    usort($categories, "exponent_sorting_byRankAscending");
    $template->assign("origmodule", $_GET['orig_module']);
    $template->assign("categories", $categories);
    $template->output();
} else {
    echo SITE_403_HTML;
}
function smarty_function_viewfile($params, &$smarty)
{
    $view = exponent_template_getModuleViewFile($params['module'], $params['view']);
    $smarty->assign($params['var'], $view);
}