Пример #1
0
 function __construct($item_type, $item_dir, $view = "Default")
 {
     include_once SMARTY_PATH . 'Smarty.class.php';
     // Set up the Smarty template variable we wrap around.
     $this->tpl = new Smarty();
     $this->tpl->error_reporting = error_reporting() & ~E_NOTICE & ~E_WARNING;
     //FIXME this disables bad template code reporting 3.x
     $this->tpl->error_unassigned = true;
     // display notice when accessing unassigned variable, if warnings turned on
     //		$this->tpl->debugging = DEVELOPMENT;  // Opens up the debug console
     //Some (crappy) wysiwyg editors use php as their default initializer
     //FJD - this might break some editors...we'll see.
     $this->tpl->php_handling = SMARTY::PHP_REMOVE;
     $this->tpl->caching = false;
     $this->tpl->cache_dir = BASE . 'tmp/cache';
     $this->tpl->setPluginsDir(array(SMARTY_PATH . 'plugins', BASE . 'framework/plugins'));
     //autoload filters
     $this->tpl->autoload_filters = array('post' => array('includemiscfiles'));
     $this->viewfile = expTemplate::getViewFile($item_type, $item_dir, $view);
     $this->viewdir = realpath(dirname($this->viewfile));
     $this->module = $item_dir;
     $this->view = substr(basename($this->viewfile), 0, -4);
     //fix for the wamp/lamp issue
     //checks necessary in case a file from /views/ is used
     //should go away, the stuff should be put into a CoreModule
     //then this can be simplified
     //TODO: generate this through $this->viewfile using find BASE/THEME_ABSOLUTE and replace with ""
     //		if($item_type != "") {
     //			$this->langdir .= $item_type . "/";
     //		}
     //		if($item_dir != "") {
     //			$this->langdir .= $item_dir . "/";
     //		}
     //		$this->langdir .= "views/";
     $this->tpl->template_dir = $this->viewdir;
     $this->tpl->compile_dir = BASE . 'tmp/views_c';
     $this->tpl->compile_id = md5($this->viewfile);
     $this->tpl->assign("__view", $this->view);
     $this->tpl->assign("__redirect", expHistory::getLastNotEditable());
 }
Пример #2
0
 function controlToHTML($name)
 {
     if ($this->next . $this->back . $this->cancel == "") {
         return "";
     }
     $html = "";
     if ($this->back != "") {
         $html .= '<input type="submit" name="nextback" value="' . $this->back . '"';
         //if ($this->disabled) $html .= " disabled";
         $html .= ' onclick="if (checkRequired(this.form)) ';
         if ($this->validateJS != "") {
             $html .= '{ if (' . $this->validateJS . ') { return true; } else { return false; } }';
         } else {
             $html .= '{ return true; }';
         }
         $html .= ' else { return false; }"';
         $html .= ' />';
     }
     if ($this->next != "") {
         $html .= '<input type="submit" name="nextback" value="' . $this->next . '"';
         if ($this->disabled) {
             $html .= " disabled";
         }
         $html .= ' onclick="if (checkRequired(this.form)) ';
         if ($this->validateJS != "") {
             $html .= '{ if (' . $this->validateJS . ') { return true; } else { return false; } }';
         } else {
             $html .= '{ return true; }';
         }
         $html .= ' else { return false; }"';
         $html .= ' />';
     }
     if ($this->cancel != "") {
         $html .= '<input type="button" value="' . $this->cancel . '"';
         $html .= ' onclick="document.location.href=\'' . expHistory::getLastNotEditable() . '\'"';
         $html .= ' />';
     }
     return $html;
 }
Пример #3
0
 function controlToHTML($name)
 {
     if ($this->submit . $this->reset . $this->cancel == "") {
         return "";
     }
     if (empty($this->id)) {
         $this->id = $name;
     }
     $html = "";
     if ($this->submit != "") {
         $html .= '<button type="submit" id="' . $this->id . 'Submit" class="submit button awesome ' . BTN_SIZE . ' ' . BTN_COLOR;
         if ($this->disabled) {
             $html .= " disabled";
         }
         $html .= '" type="submit" value="' . $this->submit . '"';
         if ($this->disabled) {
             $html .= " disabled";
         }
         $html .= ' onclick="if (checkRequired(this.form)';
         if (isset($this->onclick)) {
             $html .= ' ' . $this->onclick;
         }
         $html .= ') ';
         if ($this->validateJS != "") {
             $html .= '{ if (' . $this->validateJS . ') { return true; } else { return false; } }';
         } else {
             $html .= '{ return true; }';
         }
         $html .= ' else { return false; }"';
         $html .= ' />';
         $html .= $this->submit;
         $html .= ' </button>';
     }
     //if ($this->reset != "") $html .= '<input class="button" type="reset" value="' . $this->reset . '"' . ($this->disabled?" disabled":"") . ' />';
     if ($this->cancel != "") {
         if ($this->returntype == "") {
             $html .= '<button type="cancel" class="cancel button awesome ' . BTN_SIZE . ' ' . BTN_COLOR . '" onclick="document.location.href=\'' . expHistory::getLastNotEditable() . '\'; return false;"';
         } else {
             $html .= '<button type="cancel" class="cancel button awesome ' . BTN_SIZE . ' ' . BTN_COLOR . '" onclick="document.location.href=\'' . expHistory::getLast($this->returntype) . '\'; return false;"';
         }
         $html .= '>';
         $html .= $this->cancel;
         $html .= '</button>';
     }
     expCSS::pushToHead(array("unique" => "button", "corecss" => "button"));
     return $html;
 }
Пример #4
0
        //		$buttons = "<input name=\"submitSubmit\" class=\"button\" type=\"submit\" value=\"Save\" onclick=\"if (checkRequired(this.form)) { if (validate(this.form)) { return true; } else { return false; } } else { return false; }\" /> ";
        $buttons = '<button name="submitSubmit" type="submit" id="' . $_GET['id'] . 'Submit" class="submit button awesome ' . BTN_SIZE . ' ' . BTN_COLOR;
        $buttons .= '" type="submit" value="' . "Save" . '"';
        $buttons .= ' onclick="if (checkRequired(this.form)) { if (validate(this.form)) { return true; } else { return false; } } else { return false; }"';
        $buttons .= ' />';
        $buttons .= "Save";
        $buttons .= ' </button>';
        //		$buttons .= "<input name=\"submitNew\" class=\"button\" type=\"submit\" value=\"Save as New Event\" onclick=\"if (checkRequired(this.form)) { if (validate(this.form)) { return true; } else { return false; } } else { return false; }\" /> ";
        $buttons .= '<button name="submitNew" type="submit" id="' . $_GET['id'] . 'Submit" class="submit button awesome ' . BTN_SIZE . ' ' . BTN_COLOR;
        $buttons .= '" type="submit" value="' . "Save as New Event" . '"';
        $buttons .= ' onclick="if (checkRequired(this.form)) { if (validate(this.form)) { return true; } else { return false; } } else { return false; }"';
        $buttons .= ' />';
        $buttons .= "Save as New Event";
        $buttons .= ' </button>';
        //		$buttons .= "<input class=\"button\" type=\"button\" value=\"Cancel\" onclick=\"document.location.href='".expHistory::getLastNotEditable()."'\" /> ";
        $buttons .= '<button type="cancel" class="cancel button awesome ' . BTN_SIZE . ' ' . BTN_COLOR . '" onclick="document.location.href=\'' . expHistory::getLastNotEditable() . '\'; return false;"';
        $buttons .= '>';
        $buttons .= "Cancel";
        $buttons .= '</button>';
        //		$buttons .= "</div>";
        $form->register(null, '', new htmlcontrol($buttons));
    }
    $form->validationScript = PATH_RELATIVE . 'framework/modules-1/calendarmodule/assets/js/postedit.validate.js';
    //FIXME This is not working
    $template = new template('calendarmodule', '_form_edit', $loc);
    $template->assign('form_html', $form->toHTML());
    $template->assign('is_edit', $item == null ? 0 : 1);
    $template->output();
} else {
    echo SITE_403_HTML;
}
Пример #5
0
<?php

##################################################
#
# Copyright (c) 2004-2011 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 "BASE" "." */
// Initialize the Exponent Framework
require_once 'exponent.php';
//Fire off the login form via an exponent action.
expSession::set('redirecturl', expHistory::getLastNotEditable());
redirect_to(array("controller" => "login", "action" => "showlogin"));
Пример #6
0
        if (empty($from)) {
            $from = trim(SMTP_FROMADDRESS);
        }
        if (empty($from_name)) {
            $from_name = trim(ORGANIZATION_NAME);
        }
        $headers = array("MIME-Version" => "1.0", "Content-type" => "text/html; charset=" . LANG_CHARSET);
        if (count($emaillist)) {
            //This is an easy way to remove duplicates
            $emaillist = array_flip(array_flip($emaillist));
            $emaillist = array_map('trim', $emaillist);
            $mail = new expMail();
            $mail->quickSend(array('headers' => $headers, 'html_message' => $emailHtml, "text_message" => $emailText, 'to' => $emaillist, 'from' => array(trim($from) => $from_name), 'subject' => $f->subject));
        }
    }
    // clear the users post data from the session.
    expSession::un_set('formmodule_data_' . $f->id);
    //If is a new post show response, otherwise redirect to the flow.
    if (!isset($_POST['data_id'])) {
        $template = new template("formbuilder", "_view_response");
        $template->assign("backlink", expHistory::getLastNotEditable());
        $template->assign("response_html", $f->response);
        $template->output();
    } else {
        flash('message', gt('Record was updated!'));
        //        expHistory::back();
        expHistory::returnTo('editable');
    }
} else {
    echo SITE_403_HTML;
}
Пример #7
0
        // Get support flags
        $mod->supportsSources = $module->hasSources() ? 1 : 0;
        $mod->supportsViews = $module->hasViews() ? 1 : 0;
        // Get a list of views
        $mod->views = expTemplate::listModuleViews($moduleclass);
        natsort($mod->views);
        // if (!$haveclass) {
        //  $js_init .=  exponent_javascript_class($mod,'Module');
        //  $js_init .=  "var modules = new Array();\r\n";
        //  $js_init .=  "var modnames = new Array();\r\n\r\n";
        //  $haveclass = true;
        // }
        // $js_init .=  "modules.push(" . exponent_javascript_object($mod,"Module") . ");\r\n";
        // $js_init .=  "modnames.push('" . $moduleclass . "');\r\n";
        $modules[$moduleclass] = $mod;
        $mods[$moduleclass] = $module->name();
    }
    //$js_init .= "\r\n</script>";
    array_multisort(array_map('strtolower', $mods), $mods);
    if (!key_exists($container->internal->mod, $mods) && !empty($container->id)) {
        $template->assign('error', gt('The module you are trying to edit is inactive. Please contact your administrator to activate this module.'));
    }
    $template->assign('user', $user);
    $template->assign('json_obj', json_encode($modules));
    $template->assign('modules', $mods);
    $template->assign('loc', $loc);
    $template->assign('back', expHistory::getLastNotEditable());
    $template->output();
} else {
    echo SITE_403_HTML;
}
 public function install_extension_finish()
 {
     $sessid = session_id();
     if (!file_exists(BASE . "tmp/extensionuploads/{$sessid}") || !is_dir(BASE . "tmp/extensionuploads/{$sessid}")) {
         //				$template = new template('administrationmodule','_upload_finalSummary',$loc);
         //				$template->assign('nofiles',1);
         $nofiles = 1;
     } else {
         $success = array();
         foreach (array_keys(expFile::listFlat(BASE . "tmp/extensionuploads/{$sessid}", true, null, array(), BASE . "tmp/extensionuploads/{$sessid}")) as $file) {
             if ($file != '/archive.tar' && $file != '/archive.tar.gz' && $file != 'archive.tar.bz2' && $file != '/archive.zip') {
                 expFile::makeDirectory(dirname($file));
                 $success[$file] = copy(BASE . "tmp/extensionuploads/{$sessid}" . $file, BASE . substr($file, 1));
                 if (basename($file) == 'views_c') {
                     chmod(BASE . substr($file, 1), 0777);
                 }
             }
         }
         $del_return = expFile::removeDirectory(BASE . "tmp/extensionuploads/{$sessid}");
         //FIXME shouldn't use echo
         echo $del_return;
         //			ob_start();
         //			include(BASE . 'framework/modules-1/administrationmodule/actions/installtables.php');
         //			ob_end_clean();
         self::install_dbtables();
         //				$template = new template('administrationmodule','_upload_finalSummary',$loc);
         //				$template->assign('nofiles',0);
         $nofiles = 0;
         //				$template->assign('success',$success);
         //				$template->assign('redirect',expHistory::getLastNotEditable());
     }
     //			$template->output();
     assign_to_template(array('nofiles' => $nofiles, 'success' => $success, 'redirect' => expHistory::getLastNotEditable()));
 }