Ejemplo n.º 1
0
function exponent_modules_getJSValidationFile($module, $formname)
{
    $validationFile = exponent_core_resolveFilePaths("modules", $module, "js", $formname . ".validate.js");
    if ($validationFile != false) {
        return $validationFile;
    } else {
        return "";
    }
}
Ejemplo n.º 2
0
 function __autoload($class)
 {
     global $auto_dirs;
     foreach ($auto_dirs as $auto_dir) {
         $classFile = exponent_core_resolveFilePaths($auto_dir, "", "", $class . ".php");
         if ($classFile != false) {
             include_once array_pop($classFile);
             return;
         }
     }
 }
function smarty_postfilter_includeMiscFiles($compiledsource, &$smarty)
{
    ob_start();
    //CSS
    $myCSS = exponent_core_resolveFilePaths("guess", $smarty->_tpl_vars['__name'], "css", $smarty->_tpl_vars['__view'] . "*");
    if ($myCSS != false) {
        foreach ($myCSS as $myCSSFile) {
            echo "<link rel='stylesheet' type='text/css' href='" . exponent_core_abs2rel($myCSSFile) . "'></link>";
        }
    }
    //JavaScript
    $myJS = exponent_core_resolveFilePaths("guess", $smarty->_tpl_vars['__name'], "js", $smarty->_tpl_vars['__view'] . "*");
    if ($myJS != false) {
        foreach ($myJS as $myJSFile) {
            echo "<script type='text/javascript' src='" . exponent_core_abs2rel($myJSFile) . "'></script>";
        }
    }
    $html = ob_get_contents();
    ob_end_clean();
    return $html . $compiledsource;
}
<?php

##################################################
#
# Copyright (c) 2004-2006 OIC Group, Inc.
# Written and Designed by James Hunt
#
# 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
#
##################################################
define('SCRIPT_EXP_RELATIVE', '');
define('SCRIPT_FILENAME', 'mod_preview.php');
// Initialize the Exponent Framework
include_once 'exponent.php';
$i18n = exponent_lang_loadFile('mod_preview.php');
$SYS_FLOW_REDIRECTIONPATH = 'previewreadonly';
$previewFile = exponent_core_resolveFilePaths("", "", "", "module_preview.php");
if ($previewFile != false) {
    include_once array_shift($previewFile);
} else {
    echo $i18n['no_preview'];
}
Ejemplo n.º 5
0
 function form($object)
 {
     global $user;
     $i18n = exponent_lang_loadFile('datatypes/calendar.php');
     if (!defined('SYS_FORMS')) {
         require_once BASE . 'subsystems/forms.php';
     }
     exponent_forms_initialize();
     $form = new form();
     if (!isset($object->id)) {
         $object->title = '';
         $object->body = '';
         $object->eventdate = null;
         $object->eventdate->id = 0;
         $object->eventdate->date = time();
         $object->eventstart = time();
         $object->eventend = time() + 3600;
         $object->is_allday = 0;
         $object->is_recurring = 0;
     } else {
         $form->meta('id', $object->id);
     }
     $form->addScript("switchControl", exponent_core_abs2rel(array_shift(exponent_core_resolveFilePaths("forms", "", "js", "switchControl"))));
     $form->register('title', $i18n['title'], new textcontrol($object->title));
     $form->register('body', $i18n['body'], new htmleditorcontrol($object->body));
     $form->register(null, '', new htmlcontrol('<hr size="1" />'));
     if ($object->is_recurring == 1) {
         $form->register(null, '', new htmlcontrol($i18n['remove_warning'], false));
     }
     $form->register('eventdate', $i18n['eventdate'], new PopupDateTimeControl($object->eventdate->date, '', false));
     $cb = new checkboxcontrol($object->is_allday, true);
     #Warning: when the box returns true, we have to switch OFF the time controls
     $cb->jsHooks = array('onClick' => 'Exponent.Forms.switchControl(\'eventstart_TimeControl\', this.checked ? false : true); Exponent.Forms.switchControl(\'eventend_TimeControl\', this.checked ? false : true);');
     $form->register('is_allday', $i18n['is_allday'], $cb);
     #Warning: when the box returns true, we have to switch OFF the time controls
     $form->register('eventstart', $i18n['eventstart'], new TimeControl($object->eventstart, $object->is_allday ? false : true));
     $form->register('eventend', $i18n['eventend'], new TimeControl($object->eventend, $object->is_allday ? false : true));
     if (!isset($object->id)) {
         $customctl = file_get_contents(BASE . 'modules/CalendarModule/form.part');
         $datectl = new PopupDateTimeControl($object->eventstart + 365 * 86400, '', false);
         $customctl = str_replace('%%UNTILDATEPICKER%%', $datectl->controlToHTML('untildate'), $customctl);
         $form->register('recur', $i18n['recurrence'], new customcontrol($customctl));
     } else {
         if ($object->is_recurring == 1) {
             // Edit applies to one or more...
             $template = new template('CalendarModule', '_recur_dates');
             global $db;
             $eventdates = $db->selectObjects('eventdate', 'event_id=' . $object->id);
             if (!defined('SYS_SORTING')) {
                 require_once BASE . 'subsystems/sorting.php';
             }
             if (!function_exists('exponent_sorting_byDateAscending')) {
                 function exponent_sorting_byDateAscending($a, $b)
                 {
                     return $a->date > $b->date ? 1 : -1;
                 }
             }
             //Pathos Compatibility::this is deprecated
             if (@defined(PATHOS)) {
                 if (!function_exists('pathos_sorting_byDateAscending')) {
                     function pathos_sorting_byDateAscending($a, $b)
                     {
                         return exponent_sorting_byDateAscending($a, $b);
                     }
                 }
             }
             //End Pathos Compatibility
             usort($eventdates, 'exponent_sorting_byDateAscending');
             if (isset($object->eventdate)) {
                 $template->assign('checked_date', $object->eventdate);
             }
             $template->assign('dates', $eventdates);
             $form->register(null, '', new htmlcontrol('<hr size="1"/>' . $i18n['recurrence_warning']));
             $form->register(null, '', new htmlcontrol('<table cellspacing="0" cellpadding="2" width="100%">' . $template->render() . '</table>'));
             $form->meta('date_id', $object->eventdate->id);
             // Will be 0 if we are creating.
         }
     }
     $form->register('submit', '', new buttongroupcontrol($i18n['save'], '', $i18n['cancel']));
     return $form;
 }
Ejemplo n.º 6
0
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 />';
        }
    }
}
Ejemplo n.º 7
0
function exponent_template_getViewConfigOptions($module, $view)
{
    $form_file = "";
    $filepath = array_shift(exponent_core_resolveFilePaths("modules", $module, "form", $view));
    if ($filepath != false) {
        $form_file = $filepath;
    }
    if ($form_file == "") {
        return array();
    }
    // no form file, no options
    $fh = fopen($form_file, "r");
    $options = array();
    while (($control_data = fgetcsv($fh, 65536, "\t")) !== false) {
        $data = array();
        foreach ($control_data as $d) {
            if ($d != "") {
                $data[] = $d;
            }
        }
        $options[$data[0]] = $data[1];
    }
    return $options;
}
Ejemplo n.º 8
0
function exponent_core_buildNameList($type, $name, $subtype, $subname)
{
    $nameList = array();
    $fileList = exponent_core_resolveFilePaths($type, $name, $subtype, $subname);
    if ($fileList != false) {
        foreach ($fileList as $file) {
            // exponent_core_resolveFilePaths() might also return directories
            if (basename($file) != "") {
                // just to make sure: do we have an extension ?
                // relying on there is only one dot in the filename
                $extension = strstr(basename($file), ".");
                $nameList[] = basename($file, $extension);
            } else {
                // don't know where this might be needed, but...
                $nameList[] = array_pop(explode("/", $file));
            }
        }
    }
    return $nameList;
}
# 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('');
}
$themes = array();
$themeFiles = exponent_core_resolveFilePaths("themes", "", "", "*Theme.php");
if ($themeFiles != false) {
    foreach ($themeFiles as $themeFile) {
        // Need to avoid the duplicate theme problem. e.g. it has been loaded before
        // needed because php4 does not have __autoload()
        $themeClass = basename($themeFile, ".php");
        if (!class_exists($themeClass)) {
            include_once $themeFile;
        }
        if (class_exists($themeClass)) {
            // Need to avoid instantiating non-existent classes.
            $t = new $themeClass();
            $themes[$themeClass] = $t->name();
        }
    }
}