function show($view, $loc, $title = '')
 {
     $template = new template('imagemanagermodule', $view, $loc);
     $uilevel = 99;
     // MAX
     if (exponent_sessions_isset("uilevel")) {
         $uilevel = exponent_sessions_get("uilevel");
     }
     $template->assign('show', defined('SELECTOR') || $uilevel > UILEVEL_PREVIEW ? 1 : 0);
     if (!defined('SYS_FILES')) {
         include_once BASE . 'subsystems/files.php';
     }
     $directory = 'files/imagemanagermodule/' . $loc->src;
     if (!file_exists(BASE . $directory)) {
         $err = exponent_files_makeDirectory($directory);
         if ($err != SYS_FILES_SUCCESS) {
             $template->assign('noupload', 1);
             $template->assign('uploadError', $err);
         }
     }
     global $db;
     $location = serialize($loc);
     if (!isset($_SESSION['image_cache'][$location])) {
         $items = $db->selectObjects("imagemanageritem", "location_data='" . serialize($loc) . "'");
         $_SESSION['image_cache'][$location] = $items;
     } else {
         $items = $_SESSION['image_cache'][$location];
     }
     $files = $db->selectObjectsIndexedArray("file", "directory='{$directory}'");
     $template->assign('items', $items);
     $template->assign('files', $files);
     $template->assign('moduletitle', $title);
     $template->register_permissions(array('administrate', 'post', 'edit', 'delete'), $loc);
     $template->output();
 }
 function show($view, $loc = null, $title = '')
 {
     $ui_levels = exponent_sessions_get('uilevels');
     if (count($ui_levels)) {
         $template = new template('UISwitchermodule', $view, $loc);
         $template->assign('levels', $ui_levels);
         $default = exponent_sessions_isset('uilevel') ? exponent_sessions_get('uilevel') : max(array_keys($ui_levels));
         $template->assign('default_level', $default);
         $template->output();
     }
 }
 function show($view, $loc = null, $title = '')
 {
     $template = new template('previewmodule', $view, $loc);
     $level = 99;
     if (exponent_sessions_isset('uilevel')) {
         $level = exponent_sessions_get('uilevel');
     }
     $template->assign('editMode', exponent_sessions_loggedIn() && $level != UILEVEL_PREVIEW);
     $template->assign('title', $title);
     $template->assign('previewMode', $level == UILEVEL_PREVIEW);
     $template->output($view);
 }
function smarty_block_permissions($params, $content, &$smarty, &$repeat)
{
    if ($content) {
        $uilevel = 99;
        // MAX
        if (exponent_sessions_isset("uilevel")) {
            $uilevel = exponent_sessions_get("uilevel");
        }
        if (defined("PREVIEW_READONLY")) {
            $uilevel = -1;
        }
        $blocklevel = isset($params['level']) ? $params['level'] : 0;
        if ($blocklevel == UILEVEL_PERMISSIONS && substr($smarty->_tpl_vars['__loc']->src, 0, 5) == "@uid_") {
            return "";
        } else {
            if ($blocklevel <= $uilevel) {
                return $content;
            } else {
                return "";
            }
        }
    }
}
#
# 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
#
##################################################
include_once dirname(realpath(__FILE__)) . '/exponent.php';
include_once dirname(realpath(__FILE__)) . '/subsystems/image.php';
$w = isset($_GET['w']) ? $_GET['w'] : 200;
$h = isset($_GET['h']) ? $_GET['h'] : 50;
$name = isset($_GET['name']) ? $_GET['name'] : 'capcha_string';
if (exponent_sessions_isset($name)) {
    $str = exponent_sessions_get($name);
} else {
    $str = strtoupper(substr(md5(rand()), 17, 6));
    exponent_sessions_set($name, $str);
}
if (intval($w) > 0 && intval($h > 0)) {
    $img = exponent_image_captcha($w, $h, $str);
}
if ($img) {
    $sizeinfo = array('mime' => 'image/png');
    ob_end_clean();
    exponent_image_output($img, $sizeinfo);
}
 function toHTML($form_id)
 {
     // Form validation script
     if ($this->validationScript != "") {
         $this->scripts[] = $this->validationScript;
         $this->controls["submit"]->validateJS = "validate(this.form)";
     }
     // Persistent Form Data extension
     $formError = "";
     if (exponent_sessions_isset("last_POST")) {
         // We have cached POST data.  Use it to update defaults.
         $last_POST = exponent_sessions_get("last_POST");
         foreach (array_keys($this->controls) as $name) {
             // may need to look to control a la parseData
             $this->controls[$name]->default = @$last_POST[$name];
         }
         $formError = @$last_POST['_formError'];
         exponent_sessions_unset("last_POST");
     }
     $html = "<!-- Form Object '" . $this->name . "' -->\r\n";
     $html = "<!-- initialize eXp.Forms namespace -->\r\n";
     $html .= "<script type=\"text/javascript\" src=\"" . PATH_RELATIVE . "subsystems/forms/lib/js/initNS.js\"></script>\r\n";
     $html .= "<script type=\"text/javascript\" src=\"" . PATH_RELATIVE . "subsystems/forms/js/inputfilters.js.php\"></script>\r\n";
     foreach ($this->scripts as $name => $script) {
         $html .= "<script type=\"text/javascript\" src=\"{$script}\"></script>\r\n";
     }
     $html .= $formError;
     $html .= "<form name=\"" . $this->name . "\" method=\"" . $this->method . "\" action=\"" . $this->action . "\" enctype=\"" . $this->enctype . "\">\r\n";
     foreach ($this->meta as $name => $value) {
         $html .= "<input type=\"hidden\" name=\"{$name}\" id=\"{$name}\" value=\"{$value}\" />\r\n";
     }
     $html .= "<table cellspacing=\"0\" cellpadding=\"5\" width=\"100%\">\r\n";
     $rank = 0;
     foreach ($this->controlIdx as $name) {
         $html .= "<tr><td valign=\"top\">" . $this->controlLbl[$name] . "</td><td style='padding-left: 5px;' valign=\"top\">";
         $html .= $this->controls[$name]->controlToHTML($name) . "\r\n";
         $html .= "<td>";
         if ($rank != count($this->controlIdx) - 1) {
             $html .= '<a href="?module=formbuilder&action=order_controls&p=' . $form_id . '&a=' . $rank . '&b=' . ($rank + 1) . '">';
             $html .= "<img border='0' src='" . ICON_RELATIVE . "down.png' />";
             $html .= '</a>';
         } else {
             $html .= "<img src='" . ICON_RELATIVE . "down.disabled.png' />";
         }
         $html .= "&nbsp;";
         if ($rank != 0) {
             $html .= '<a href="?module=formbuilder&action=order_controls&p=' . $form_id . '&a=' . $rank . '&b=' . ($rank - 1) . '">';
             $html .= "<img border='0' src='" . ICON_RELATIVE . "up.png' />";
             $html .= '</a>';
         } else {
             $html .= "<img src='" . ICON_RELATIVE . "up.disabled.png' />";
         }
         $html .= "&nbsp;&nbsp;";
         if (!$this->controls[$name]->_readonly) {
             $html .= '<a href="?module=formbuilder&action=edit_control&id=' . $this->controls[$name]->_id . '&form_id=' . $form_id . '">';
             $html .= '<img border="0" src="' . ICON_RELATIVE . 'edit.png" />';
             $html .= '</a>';
         } else {
             $html .= '<img border="0" src="' . ICON_RELATIVE . 'edit.disabled.png" />';
         }
         $html .= '&nbsp;';
         if (!$this->controls[$name]->_readonly && $this->controls[$name]->_controltype != 'htmlcontrol') {
             $html .= '<a href="?module=formbuilder&action=delete_control&id=' . $this->controls[$name]->_id . '" onClick="return confirm(\'Are you sure you want to delete this control? All data associated with it will be removed from the database!\');">';
         } else {
             $html .= '<a href="?module=formbuilder&action=delete_control&id=' . $this->controls[$name]->_id . '" onClick="return confirm(\'Are you sure you want to delete this?\');">';
         }
         $html .= '<img border="0" src="' . ICON_RELATIVE . 'delete.png" />';
         $html .= '</a>';
         $html .= "</td>";
         $html .= "</td></tr>";
         $rank++;
     }
     $html .= "<tr><td width='5%'></td><td wdith='90%'><td></td width='5%'></tr>\r\n";
     $html .= "</table>\r\n";
     $html .= "</form>\r\n";
     return $html;
 }
function exponent_theme_runAction()
{
    if (exponent_theme_inAction()) {
        if (!AUTHORIZED_SECTION) {
            echo SITE_403_HTML;
            //	return;
        }
        if (exponent_sessions_isset("themeopt_override")) {
            $config = exponent_sessions_get("themeopt_override");
            echo "<a class='mngmntlink sitetemplate_mngmntlink' href='" . $config['mainpage'] . "'>" . $config['backlinktext'] . "</a><br /><br />";
        }
        global $db, $user;
        $loc = null;
        $loc->mod = $_REQUEST['module'];
        $loc->src = isset($_REQUEST['src']) ? $_REQUEST['src'] : "";
        $loc->int = isset($_REQUEST['int']) ? $_REQUEST['int'] : "";
        $actfile = exponent_core_resolveFilePaths("modules", $_REQUEST['module'], "action", $_REQUEST['action']);
        if ($actfile != false) {
            include_once array_pop($actfile);
        } else {
            $i18n = exponent_lang_loadFile('subsystems/theme.php');
            echo SITE_404_HTML . '<br /><br /><hr size="1" />';
            echo sprintf($i18n['no_action'], strip_tags($_REQUEST['module']), strip_tags($_REQUEST['action']));
            echo '<br />';
        }
    }
}
Example #8
0
 function toHTML()
 {
     // Form validation script
     if ($this->validationScript != "") {
         $this->scripts[] = $this->validationScript;
         $this->controls["submit"]->validateJS = "validate(this.form)";
     }
     // Persistent Form Data extension
     $formError = "";
     if (exponent_sessions_isset("last_POST")) {
         // We have cached POST data.  Use it to update defaults.
         $last_POST = exponent_sessions_get("last_POST");
         foreach (array_keys($this->controls) as $name) {
             // may need to look to control a la parseData
             $this->controls[$name]->default = @$last_POST[$name];
             $this->controls[$name]->inError = 1;
             // Status flag for controls that need to do some funky stuff.
         }
         $formError = @$last_POST['_formError'];
         exponent_sessions_unset("last_POST");
     }
     $html = "<!-- Form Object '" . $this->name . "' -->\r\n";
     $html .= "<script type=\"text/javascript\" src=\"" . PATH_RELATIVE . "subsystems/forms/js/inputfilters.js.php\"></script>\r\n";
     foreach ($this->scripts as $name => $script) {
         $html .= "<script type=\"text/javascript\" src=\"{$script}\"></script>\r\n";
     }
     $html .= '<div class="error">' . $formError . '</div>';
     $html .= "<form name=\"" . $this->name . "\" method=\"" . $this->method . "\" action=\"" . $this->action . "\" enctype=\"" . $this->enctype . "\">\r\n";
     foreach ($this->meta as $name => $value) {
         $html .= "<input type=\"hidden\" name=\"{$name}\" id=\"{$name}\" value=\"{$value}\" />\r\n";
     }
     $html .= "<table cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">\r\n";
     foreach ($this->controlIdx as $name) {
         $html .= $this->controls[$name]->toHTML($this->controlLbl[$name], $name) . "\r\n";
     }
     $html .= "<tr><td width='5%'></td><td width='95%'></td></tr>\r\n";
     $html .= "</table>\r\n";
     $html .= "</form>\r\n";
     return $html;
 }
exponent_modules_initialize();
// Initialize the Template Subsystem.
require_once BASE . 'subsystems/template.php';
// Initialize the Permissions Subsystem.
require_once BASE . 'subsystems/permissions.php';
// Initialize the Flow Subsystem.
if (!defined('SYS_FLOW')) {
    require_once BASE . 'subsystems/flow.php';
}
// Validate session
exponent_sessions_validate();
// Initialize permissions variables
exponent_permissions_initialize();
#$section = (exponent_sessions_isset('last_section') ? exponent_sessions_get('last_section') : SITE_DEFAULT_SECTION);
if (isset($_REQUEST['action']) && isset($_REQUEST['module'])) {
    $section = exponent_sessions_isset('last_section') ? exponent_sessions_get('last_section') : SITE_DEFAULT_SECTION;
} else {
    $section = isset($_REQUEST['section']) ? $_REQUEST['section'] : SITE_DEFAULT_SECTION;
}
$section = $db->selectObject('section', 'id=' . intval($section));
if (!NavigationModule::canView($section)) {
    define('AUTHORIZED_SECTION', 0);
} else {
    define('AUTHORIZED_SECTION', 1);
}
if (!NavigationModule::isPublic($section)) {
    define('PUBLIC_SECTION', 0);
} else {
    define('PUBLIC_SECTION', 1);
}
function eDebug($var)
# License, or (at your option) any later version.
#
# GPL: http://www.gnu.org/licenses/gpl.txt
#
##################################################
define('SCRIPT_EXP_RELATIVE', '');
define('SCRIPT_FILENAME', 'orphan_source_selector.php');
// Initialize the Exponent Framework
include_once 'exponent.php';
define('PREVIEW_READONLY', 1);
// for mods
define('SOURCE_SELECTOR', 2);
define('SELECTOR', 1);
$SYS_FLOW_REDIRECTIONPATH = 'source_selector';
$source_select = array();
if (exponent_sessions_isset('source_select')) {
    $source_select = exponent_sessions_get('source_select');
}
$count_orig = count($source_select);
if (isset($_REQUEST['vview'])) {
    $source_select['view'] = $_REQUEST['vview'];
} else {
    if (!isset($source_select['view'])) {
        $source_select['view'] = '_sourcePicker';
    }
}
if (isset($_REQUEST['vmod'])) {
    $source_select['module'] = $_REQUEST['vmod'];
} else {
    if (!isset($source_select['module'])) {
        $source_select['module'] = 'ContainerModule';
# GPL: http://www.gnu.org/licenses/gpl.txt
#
##################################################
define('SCRIPT_EXP_RELATIVE', 'modules/NavigationModule/actions/');
define('SCRIPT_FILENAME', 'edit_page.php');
ob_start();
include_once '../../../exponent.php';
if (!defined('SYS_THEME')) {
    include_once BASE . 'subsystems/theme.php';
}
$id = -1;
if (isset($_GET['sitetemplate_id'])) {
    exponent_sessions_set('sitetemplate_id', intval($_GET['sitetemplate_id']));
    $id = intval($_GET['sitetemplate_id']);
} else {
    if (exponent_sessions_isset('sitetemplate_id')) {
        $id = exponent_sessions_get('sitetemplate_id');
    }
}
$template = $db->selectObject('section_template', 'id=' . $id);
$page = $template && $template->subtheme != '' && is_readable(BASE . 'themes/' . DISPLAY_THEME . '/subthemes/' . $template->subtheme . '.php') ? 'themes/' . DISPLAY_THEME . '/subthemes/' . $template->subtheme . '.php' : 'themes/' . DISPLAY_THEME . '/index.php';
$i18n = exponent_lang_loadFile('modules/NavigationModule/actions/edit_page.php');
exponent_sessions_set('themeopt_override', array('src_prefix' => '@st' . $id, 'ignore_mods' => array('NavigationModule', 'LoginModule'), 'mainpage' => PATH_RELATIVE . 'modules/NavigationModule/actions/edit_page.php', 'backlinktext' => $i18n['back']));
#define('PREVIEW_READONLY',1);
$REDIRECTIONPATH = 'section_template';
if ($user && $user->is_acting_admin == 1) {
    if (is_readable(BASE . $page)) {
        include_once BASE . $page;
    } else {
        echo sprintf($i18n['err_not_readable'], BASE . $page);
    }
# License, or (at your option) any later version.
#
# GPL: http://www.gnu.org/licenses/gpl.txt
#
##################################################
if (!defined("EXPONENT")) {
    exit("");
}
// PERM CHECK
$source_select = array();
$module = "ContainerModule";
$view = "_sourcePicker";
$clickable_mods = null;
// Show all
$dest = null;
if (exponent_sessions_isset("source_select") && (defined("SOURCE_SELECTOR") || defined("CONTENT_SELECTOR"))) {
    $source_select = exponent_sessions_get("source_select");
    $view = $source_select["view"];
    $module = $source_select["module"];
    $clickable_mods = $source_select["showmodules"];
    $dest = $source_select['dest'];
}
if (isset($_SESSION['containers_cache'])) {
    unset($_SESSION['containers_cache']);
}
$orphans = array();
foreach ($db->selectObjects("locationref", "module='" . preg_replace('/[^A-Za-z0-9_]/', '', $_GET['module']) . "' AND refcount=0") as $orphan) {
    $obj = null;
    $loc = exponent_core_makeLocation($orphan->module, $orphan->source, $orphan->internal);
    if (class_exists($orphan->module)) {
        $modclass = $orphan->module;
#
# 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_sessions_isset('installer_config')) {
    $config = exponent_sessions_get('installer_config');
} else {
    $config = array('db_engine' => 'mysql', 'db_host' => 'localhost', 'db_port' => '3306', 'db_name' => '', 'db_user' => '', 'db_pass' => '', 'db_table_prefix' => 'exponent');
}
$i18n = exponent_lang_loadFile('install/pages/dbconfig.php');
?>
<h2 id="subtitle"><?php 
echo $i18n['subtitle'];
?>
</h2>

<form method="post" action="index.php">
<input type="hidden" name="page" value="dbcheck" />

<div class="form_section_header"><?php 
 function show($view, $loc = null, $title = '')
 {
     $i18n = exponent_lang_loadFile('modules/ContainerModule/class.php');
     $source_select = array();
     $clickable_mods = null;
     // Show all
     $dest = null;
     $singleview = '_container';
     $singlemodule = 'ContainerModule';
     if (exponent_sessions_isset('source_select') && defined('SELECTOR')) {
         $source_select = exponent_sessions_get('source_select');
         $singleview = $source_select['view'];
         $singlemodule = $source_select['module'];
         $clickable_mods = $source_select['showmodules'];
         if (!is_array($clickable_mods)) {
             $clickable_mods = null;
         }
         $dest = $source_select['dest'];
     }
     global $db;
     $container = null;
     if (!isset($this) || !isset($this->_hasParent) || $this->_hasParent == 0) {
         // Top level container.
         $container = $db->selectObject('container', "external='" . serialize(null) . "' AND internal='" . serialize($loc) . "'");
         if ($container == null) {
             $container->external = serialize(null);
             $container->internal = serialize($loc);
             $container->view = $view;
             $container->title = $title;
             $container->id = $db->insertObject($container, 'container');
         }
         if (!defined('PREVIEW_READONLY') || defined('SELECTOR')) {
             $view = $container->view;
         }
         $title = $container->title;
     }
     $template = new template('ContainerModule', $view, $loc);
     if ($dest) {
         $template->assign('dest', $dest);
     }
     $template->assign('singleview', $singleview);
     $template->assign('singlemodule', $singlemodule);
     $template->assign('top', $container);
     $containers = array();
     $container_key = serialize($loc);
     if (!isset($_SESSION['containers_cache'][$container_key])) {
         foreach ($db->selectObjects('container', "external='" . serialize($loc) . "'") as $c) {
             if ($c->is_private == 0 || exponent_permissions_check('view', exponent_core_makeLocation($loc->mod, $loc->src, $c->id))) {
                 $containers[$c->rank] = $c;
             }
         }
         $_SESSION['containers_cache'][$container_key] = serialize($containers);
     } else {
         $containers = unserialize($_SESSION['containers_cache'][$container_key]);
     }
     if (!defined('SYS_WORKFLOW')) {
         include_once BASE . 'subsystems/workflow.php';
     }
     ksort($containers);
     foreach (array_keys($containers) as $i) {
         $location = unserialize($containers[$i]->internal);
         $modclass = $location->mod;
         if (class_exists($modclass)) {
             $mod = new $modclass();
             ob_start();
             $mod->_hasParent = 1;
             $mod->show($containers[$i]->view, $location, $containers[$i]->title);
             $containers[$i]->output = trim(ob_get_contents());
             ob_end_clean();
             $policy = exponent_workflow_getPolicy($modclass, $location->src);
             $containers[$i]->info = array('module' => $mod->name(), 'source' => $location->src, 'hasContent' => $mod->hasContent(), 'hasSources' => $mod->hasSources(), 'hasViews' => $mod->hasViews(), 'class' => $modclass, 'supportsWorkflow' => $mod->supportsWorkflow() ? 1 : 0, 'workflowPolicy' => $policy ? $policy->name : '', 'workflowUsesDefault' => exponent_workflow_moduleUsesDefaultPolicy($location->mod, $location->src) ? 1 : 0, 'clickable' => $clickable_mods == null || in_array($modclass, $clickable_mods));
         } else {
             $containers[$i]->output = sprintf($i18n['mod_not_found'], $location->mod);
             $containers[$i]->info = array('module' => sprintf($i18n['unknown'], $location->mod), 'source' => $location->src, 'hasContent' => 0, 'hasSources' => 0, 'hasViews' => 0, 'class' => $modclass, 'supportsWorkflow' => 0, 'workflowPolicy' => '', 'workflowUsesDefault' => 0, 'clickable' => 0);
         }
         $containers[$i]->moduleLocation = $location;
         $cloc = null;
         $cloc->mod = $loc->mod;
         $cloc->src = $loc->src;
         $cloc->int = $containers[$i]->id;
         $containers[$i]->permissions = array('administrate' => exponent_permissions_check('administrate', $location) ? 1 : 0, 'configure' => exponent_permissions_check('configure', $location) ? 1 : 0);
     }
     $template->assign('containers', $containers);
     $template->assign('hasParent', isset($this) && isset($this->_hasParent) ? 1 : 0);
     $template->register_permissions(array('administrate', 'add_module', 'edit_module', 'delete_module', 'order_modules'), $loc);
     $template->output();
 }
Example #15
0
function exponent_flow_redirect($url_type = SYS_FLOW_NONE)
{
    global $SYS_FLOW_REDIRECTIONPATH;
    $access_level = exponent_sessions_loggedIn() ? SYS_FLOW_PROTECTED : SYS_FLOW_PUBLIC;
    // Fallback to the default redirection path in strange edge cases.
    if (!exponent_sessions_isset($SYS_FLOW_REDIRECTIONPATH . '_flow_last_' . $access_level)) {
        $SYS_FLOW_REDIRECTIONPATH = 'exponent_default';
    }
    $url = '';
    switch ($url_type) {
        case SYS_FLOW_NONE:
            $url = exponent_sessions_get($SYS_FLOW_REDIRECTIONPATH . '_flow_last_' . $access_level);
            break;
        case SYS_FLOW_SECTIONAL:
        case SYS_FLOW_ACTION:
            $url = exponent_sessions_get($SYS_FLOW_REDIRECTIONPATH . '_flow_' . $access_level . '_' . $url_type);
            break;
    }
    if ($url == '') {
        $url = URL_FULL . 'index.php?section=' . SITE_DEFAULT_SECTION;
    }
    if (DEVELOPMENT >= 2) {
        echo '<a href="' . $url . '">' . $url . '</a>';
    } else {
        header("Location: {$url}");
    }
    exit('Redirecting...');
}