Example #1
0
 static function previewForm($formData)
 {
     $form = new Template($formData, "test1uploadpreview.tpl", false);
     $form->encode = false;
     $form->output();
     return $form->output;
 }
Example #2
0
 public function display()
 {
     $rolelist = new Template();
     $rolelist->load("role_list");
     $actions = ActionList::get("rolelist");
     if (isset($_POST['insert'])) {
         $role = new Role();
         $role->name = $_POST['insert'];
         $role->insert();
     }
     if (isset($_GET['delete'])) {
         $role = new Role();
         $role->ID = $_GET['delete'];
         $role->delete();
     }
     $table = new Table();
     $id = new TableColumn("id", Language::DirectTranslate("ID"));
     $id->autoWidth = true;
     $name = new TableColumn("name", Language::DirectTranslate("NAME"));
     $table->columns->add($id);
     $table->columns->add($name);
     $table->name = "{'dbprefix'}roles";
     $table->actions = "rolelist";
     $table->orderBy = "name";
     $table->cacheName = "rolelist";
     $rolelist->assign_var("TABLE", $table->getCode());
     $rolelist->output();
 }
Example #3
0
 protected function upload()
 {
     $template = new Template();
     $template->load("upload");
     $template->assign_var("REFERRER", $_POST['referrer']);
     $template->show_if("SHOW_MEDIALIBARY", false);
     if (!file_exists(Settings::getInstance()->get("root") . "content/uploads" . $_SESSION['dir'])) {
         mkdir(Settings::getInstance()->get("root") . "content/uploads" . $_SESSION['dir']);
     }
     if (FileServer::upload(Settings::getInstance()->get("root") . "content/uploads" . $_SESSION['dir'], $_FILES['file'])) {
         $name = $_FILES['file']['name'];
         $template->assign_var("MESSAGE", str_replace("{FILENAME}", $name, Language::DirectTranslate("FILE_UPLOADED")));
         $path_info = pathinfo(Settings::getInstance()->get("root") . "content/uploads" . $_SESSION['dir'] . "/" . $name);
         if (strtolower($path_info['extension'] == 'jpg') or strtolower($path_info['extension'] == 'jpeg') or strtolower($path_info['extension'] == 'gif') or strtolower($path_info['extension'] == 'png') or strtolower($path_info['extension'] == 'bmp')) {
             $template->show_if("SHOW_MEDIALIBARY", true);
             $template->assign_var("URL", UrlRewriting::GetUrlByAlias("admin/media/addimage"));
             $template->assign_var("FILE_PATH", Settings::getInstance()->get("host") . "content/uploads" . $_SESSION['dir'] . "/" . $name);
         }
     } else {
         if (FileServer::$uploadFailure != "") {
             $template->assign_var("MESSAGE", FileServer::$uploadFailure);
         } else {
             $template->assign_var("MESSAGE", Language::DirectTranslate("FILE_NOT_UPLOADED"));
         }
     }
     $template->output();
 }
Example #4
0
 public function display()
 {
     $template = new Template();
     $template->load("plugins");
     $plugins = new PluginList();
     $plugins->loadAll();
     foreach ($plugins->plugins as $plugin) {
         $index = $template->add_loop_item("PLUGINS");
         if (isset($_GET['activate']) && $_GET['activate'] == $plugin->path) {
             $plugin->activate();
         } elseif (isset($_GET['deactivate']) && $_GET['deactivate'] == $plugin->path) {
             $plugin->deactivate();
         }
         $template->assign_loop_var("PLUGINS", $index, "NAME", htmlentities($plugin->name));
         $template->assign_loop_var("PLUGINS", $index, "PATH", htmlentities($plugin->path));
         $template->assign_loop_var("PLUGINS", $index, "DESCRIPTION", htmlentities($plugin->getDescription()));
         $template->assign_loop_var("PLUGINS", $index, "VERSION", $plugin->version);
         $template->assign_loop_var("PLUGINS", $index, "AUTHORLINK", $plugin->authorLink);
         $template->assign_loop_var("PLUGINS", $index, "AUTHORNAME", htmlentities($plugin->authorName));
         $template->assign_loop_var("PLUGINS", $index, "LICENSE", htmlentities($plugin->license));
         $template->assign_loop_var("PLUGINS", $index, "LICENSEURL", htmlentities($plugin->licenseUrl));
         if ($plugin->isActivated()) {
             $myurl = UrlRewriting::GetUrlByAlias($this->page->alias, "deactivate=" . urlencode($plugin->path));
             $disable = Language::DirectTranslateHtml("DISABLE");
             $template->assign_loop_var("PLUGINS", $index, "ACTIVATIONLINK", "<a href=\"" . $myurl . "\">" . $disable . "</a>");
         } else {
             $myurl = UrlRewriting::GetUrlByAlias($this->page->alias, "activate=" . urlencode($plugin->path));
             $enable = Language::DirectTranslateHtml("ENABLE");
             $template->assign_loop_var("PLUGINS", $index, "ACTIVATIONLINK", "<a href=\"" . $myurl . "\">" . $enable . "</a>");
         }
     }
     $template->assign_var("HOST", Settings::getValue("host"));
     $template->assign_var("APIKEY", Settings::getValue("apikey"));
     $template->output();
 }
Example #5
0
 function display()
 {
     $host = Settings::getInstance()->get("host");
     $template = new Template();
     $template->load("dashboard");
     $template->assign_var("COLUMNS", $this->getColumnsCode());
     $template->output();
 }
Example #6
0
 public function show()
 {
     //        $url = '';
     //        $request_url = (isset($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : '';
     //        $script_url = (isset($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : '';
     //        // Get our url path and trim the / of the left and the right
     //        if ($request_url != $script_url) {
     //            $url = trim(preg_replace('/' . str_replace('/', '\/', str_replace('index.php', '', $script_url)) . '/', '',
     //                $request_url, 1), '/');
     //        }
     //        $url = preg_replace('/\?.*/', '', $url); // Strip query string
     $url = explode('/', $_SERVER['REQUEST_URI']);
     if (count($url) == 4) {
         $urldir = escape($url[count($url) - 2]);
         $url = escape($url[count($url) - 1]);
     } else {
         $urldir = "";
         $url = escape($url[count($url) - 1]);
     }
     /*
      * TODO sjekk REQUEST_URI for antall. Hvis X, så betyr det at det er en subpost
      */
     /*
      * TODO eller... fortsett som før og bare list X category posts i get_pages()
      */
     if ($url && $urldir) {
         $file = SCORPION_DIR_CONTENT . $urldir . '/' . $url;
     } elseif ($url) {
         if ($url == strtolower($this->get_config('index'))) {
             $file = SCORPION_DIR_CONTENT . 'index';
         } elseif (strstr($url, 'admin')) {
             Redirect::to(SCORPION_DIR_ADMIN . 'index.php');
             die;
         } else {
             $file = SCORPION_DIR_CONTENT . $url;
         }
     } else {
         $file = SCORPION_DIR_CONTENT . 'index';
     }
     if (is_dir($file)) {
         $file = SCORPION_DIR_CONTENT . $url . '/index' . SCORPION_CONTENT_EXT;
     } else {
         $file .= SCORPION_CONTENT_EXT;
     }
     if (file_exists($file)) {
         $content = file_get_contents($file);
     } else {
         $content = file_get_contents(SCORPION_DIR_CONTENT . '404' . SCORPION_CONTENT_EXT);
         header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
     }
     $navigation = $this->generate_navigation();
     $meta = $this->read_file_meta($content);
     $content = $this->parse_content($content);
     $website = new Template($this->get_theme_path());
     $codes = array('header_title' => $this->get_config('header_title'), 'header_slogan' => $this->get_config('header_slogan'), 'meta' => $meta, 'content' => $content, 'navigation' => $navigation, 'comments' => "--Comments--", 'addcomment' => "--Add comment--", 'theme_path' => $this->get_theme_path(), 'theme_url' => $this->base_url() . '/' . basename(SCORPION_DIR_THEMES) . '/' . $this->get_config('theme'), 'base_url' => $this->base_url(), 'visitor' => $_SERVER['REMOTE_ADDR'], 'date' => date("d.m.Y H:i:s"), 'date_year' => date("Y"));
     $website->set($codes);
     $website->output();
 }
Example #7
0
 /**
  * Prints the page based on a data array and a template file
  * @param string the name of the template to use
  * @param array an array of data for the template engine
  * @return string
  * @access public
  */
 function render($file, $data = '')
 {
     require_once 'template.class.php';
     $template = new Template('templates/' . $file);
     if (is_array($data)) {
         $template->replaceTags($data);
     }
     return $template->output();
 }
Example #8
0
 /**
  * Display screen shown on logging off
  * @param SSP_template $tpl - main template
  * @param string $userId - user id of memeber logging off
  * @param string $returnPage - url of previous page
  */
 public function displayLogOffScreen($tpl, $userId, $returnPage)
 {
     // displays the logoff screen
     //
     // parameters
     // $tpl - object - main template object
     $content = array("homePath" => $this->cfg->siteRoot, "logonPath" => $returnPage, "title" => "Logged off");
     $logoff = new Template($content, "logoff.tpl");
     $tpl->setData("content", $logoff->output());
     return $tpl->output();
 }
Example #9
0
 function render($view = false)
 {
     // get the page details stored in the database
     $this->requestAllPages();
     // define the rendering template
     if (!$this->data['template']) {
         $this->data['template'] = LISTINGS_TEMPLATE;
     }
     // display the page
     Template::output($this->data);
 }
Example #10
0
 public function view($file, $data = array())
 {
     $view = $this->dir . DS . 'Views' . DS . $file . '.phtml';
     $profile = new Template($view);
     foreach ($data as $key => $assign) {
         $profile->set($key, $assign);
     }
     //$layout = new Template($this->dir .DS."layout".DS."layout.phtml");
     //$layout->set("content", $profile->output());
     echo $profile->render($profile->output());
     // return $view->render();
 }
 public function display()
 {
     $language = new Language($_GET['language']);
     if (isset($_POST['translation'])) {
         $language->updateTranslation($_GET['token'], $_POST['translation']);
         Cache::clear("language");
     }
     $template = new Template();
     $template->load("translationtokeneditor");
     $template->assign_var("ORIGINAL", Language::DirectTranslate($_GET['token']));
     $template->assign_var("TRANSLATION", $language->getString($_GET['token']));
     $template->output();
 }
Example #12
0
 public function display()
 {
     $userlist = new Template();
     $userlist->load("user_list");
     $userlist->assign_var("URL", $this->page->GetUrl());
     if (isset($_POST['insert'])) {
         $user = new User();
         $user->name = $_POST['name'];
         $user->role = $_POST['new_user_role'];
         $user->email = $_POST['email'];
         if (!$user->insert($_POST['password'])) {
             $userlist->assign_var("MSG", Language::DirectTranslateHtml("USER_NOT_CREATED"));
         }
     }
     if (isset($_GET['delete'])) {
         $user = new User();
         $user->id = $_GET['delete'];
         if (!$user->delete()) {
             $userlist->assign_var("MSG", Language::DirectTranslateHtml("USER_NOT_DELETED"));
         }
     }
     $userlist->assign_var("MSG", "");
     Cache::clear("tables", "userlist");
     $table = new Table();
     $id = new TableColumn("id", Language::DirectTranslate("ID"));
     $id->autoWidth = true;
     $name = new TableColumn("name", Language::DirectTranslate("NAME"));
     $role = new TableColumn("role", Language::DirectTranslate("ROLE"), "IFNULL((SELECT name FROM {'dbprefix'}roles WHERE id = {'dbprefix'}user.role),'')");
     $email = new TableColumn("email", Language::DirectTranslate("EMAIL"));
     $created = new TableColumn("create_timestamp", Language::DirectTranslate("CREATED_ON"));
     $created->autoWidth = true;
     $access = new TableColumn("last_access_timestamp", Language::DirectTranslate("LAST_ACCESS"));
     $access->autoWidth = true;
     $table->columns->add($id);
     $table->columns->add($name);
     $table->columns->add($role);
     $table->columns->add($email);
     $table->columns->add($created);
     $table->columns->add($access);
     $table->name = "{'dbprefix'}user";
     $table->actions = "userlist";
     $table->orderBy = "name";
     $table->cacheName = "userlist";
     $userlist->assign_var("TABLE", $table->getCode());
     $roles = new RoleSelector();
     $roles->hideSpecialRoles = true;
     $roles->name = "new_user_role";
     $userlist->assign_var("ROLES", $roles->getCode());
     $userlist->output();
 }
Example #13
0
 public function display()
 {
     $template = new Template();
     $template->load("message");
     if (ImageServer::insert($_POST['path'], $_POST['name'], $_POST['description'])) {
         $template->assign_var("MESSAGE", Language::DirectTranslateHtml("IMAGE_ADDED"));
         $redirect = UrlRewriting::GetUrlByAlias("admin/home", "dir=" . urlencode($_SESSION['dir']));
         if (isset($_POST['referrer'])) {
             $redirect = $_POST['referrer'];
         }
         echo "<script type='text/javascript'>setTimeout('window.location.href= \\'" . $redirect . "\\'', 1000)</script>";
     } else {
         $template->assign_var("MESSAGE", Language::DirectTranslateHtml("IMAGE_NOT_ADDED"));
     }
     $template->output();
 }
Example #14
0
 public function display()
 {
     $template = new Template();
     if (!isset($_GET['delete'])) {
         $template->load("menu_delete");
         $template->assign_var("CANCELURL", "javascript:history.back()");
         $template->assign_var("DELETEURL", $this->page->GetUrl("menu=" . urlencode($_GET['menu']) . "&delete=true"));
     } else {
         $template->load("message");
         if (Menu::delete(DataBase::Current()->EscapeString($_GET['menu']))) {
             $template->assign_var("MESSAGE", Language::DirectTranslate("MENU_DELETED"));
         } else {
             $template->assign_var("MESSAGE", Language::DirectTranslate("MENU_NOT_DELETED"));
         }
     }
     $template->output();
 }
Example #15
0
 public function output($data = null, $document = false)
 {
     $locale = $this->getLocale();
     $data = new Hook\DataFunction(new \SplObjectStorage(), $data, $locale, $this->baseDir);
     $headers = [];
     $this->registerProperties($this->getBasicProperties($data, $locale, $headers));
     //To be a valid XML document it must have a root element, automatically wrap it in <template> to ensure it does
     $template = new Template($this->isFile ? $this->template : '<template>' . $this->template . '</template>');
     $rules = (new Sheet($this->tss, $this->baseDir, $template->getPrefix()))->parse();
     foreach ($rules as $rule) {
         $hook = new Hook\Rule($rule->properties, new Hook\PseudoMatcher($rule->pseudo, $data), $data);
         foreach ($this->registeredProperties as $properties) {
             $hook->registerProperties($properties);
         }
         $template->addHook($rule->query, $hook);
     }
     $output = $template->output($document);
     return (object) ['headers' => $headers, 'body' => $output];
 }
Example #16
0
 public static function forgotPassword(Db $db, $email, $pathtoTemplates = "templates/")
 {
     if (!self::emailExists($db, $email)) {
         return false;
     }
     $siteUrl = Constants::SITE_URL;
     $siteName = Constants::SITE_NAME;
     $newPass = UUID::generate();
     $newPassHash = md5($newPass);
     $pq = "update users set passhash = ? where email like ? limit 1";
     $db->preparedQuery($pq, array($newPassHash, $email), "ss");
     $plainMessage = "Your password has been reset to:\n\n{$newPass}\n\nPlease use this temporary password to log into the site and change it to a new, secure password of your choosing on the Edit Profile page.\n\nYou can follow this link:\n{$siteUrl}" . "admin/login.php?email={$email}&from=settings.php\n\nFrom: Automailer\n";
     $htmlMessage = EmailHelper::getEmailPara("Your password has been reset to:") . EmailHelper::getEmailPara("{$newPass}") . EmailHelper::getEmailPara("Please use this temporary password to log into the site and change it to a new, secure password of your choosing on the Edit Profile page.") . EmailHelper::getEmailPara("You can follow this link: <a style='color:#6666ff;' href='{$siteUrl}" . "admin/login.php?email={$email}&from=settings.php'>{$siteUrl}" . "login.php?email={$email}&from=settings.php</a>") . EmailHelper::getEmailPara("From: Automailer");
     $tHtml = new Template($pathtoTemplates . "mailers/holder.tpl.html");
     $tHtml->insertSlot("TITLE", "{$siteName} - Forgot Password");
     $tHtml->insertSlot("CONTENT", $htmlMessage);
     // do NOT error here, the password has been reset, dont return false so they think it has not
     @EmailHelper::sendHtmlEmail($tHtml->output(), $plainMessage, Constants::EMAIL_INFO, $email, "[{$siteName}] password reset");
     return true;
 }
Example #17
0
 public function display()
 {
     $template = new Template();
     $template->load("menu_new");
     $template->show_if("NOTSUCCEEDED", isset($_POST['name']) == false);
     $template->show_if("SUCCEEDED", false);
     if ($_GET['blank'] == true) {
         $template->assign_var("URL", UrlRewriting::GetUrlByAlias("admin/newmenu", "blank=true"));
     } else {
         $template->assign_var("URL", UrlRewriting::GetUrlByAlias("admin/newmenu"));
     }
     if (isset($_POST['name'])) {
         $template->show_if("SUCCEEDED", true);
         $id = Menu::create($_POST['name'], $_SESSION['dir']);
         if (!$id) {
             $template->load("message");
             $template->assign_var("MESSAGE", Language::DirectTranslate("MENU_NOT_CREATED"));
         }
     }
     $template->output();
 }
Example #18
0
    public function display()
    {
        $contentpath = Settings::getInstance()->get("root") . "content/articles/" . $_SESSION['dir'] . "/";
        if (isset($_POST['name'])) {
            if (FileServer::IsValidFoldername($_POST['name'])) {
                FileServer::createFolder($contentpath, $_POST['name']);
                ?>
            <script language="JavaScript"><!--
                window.location.href="<?php 
                echo UrlRewriting::GetUrlByAlias("admin/home", "dir=" . $_SESSION['dir'] . "/" . $_POST['name']);
                ?>
";
            // --></script> 
            <?php 
            } else {
                echo Language::DirectTranslateHtml("INVALID_FOLDERNAME");
            }
        }
        $template = new Template();
        $template->load("new_folder");
        $template->output();
    }
Example #19
0
 public function display()
 {
     $template = new Template();
     $template->load("new_form");
     $template->show_if("SUCCEEDED", false);
     $template->show_if("NOTSUCCEEDED", isset($_POST['name']) == false);
     if ($_GET['blank'] == true) {
         $url = UrlRewriting::GetUrlByAlias("admin/newform", "blank=true");
     } else {
         $url = UrlRewriting::GetUrlByAlias("admin/newform");
     }
     $template->assign_var("URL", $url);
     if (isset($_POST['name'])) {
         $template->show_if("SUCCEEDED");
         $id = Form::create($_POST['name'], $_SESSION['dir']);
         if (!$id) {
             $template->load("message");
             $template->assign_var("MESSAGE", $language->getString("FORM_NOT_CREATED"));
         }
     }
     $template->output();
 }
Example #20
0
 public function display()
 {
     $page = new Page();
     $page->loadProperties(DataBase::Current()->EscapeString($_GET['site']));
     $host = Settings::getInstance()->get("host");
     if (!isset($_GET['delete'])) {
         $template = new Template();
         $template->load("site_delete");
         $template->assign_var("TITLE", $page->title);
         $home = UrlRewriting::GetUrlByAlias("admin/home");
         $template->assign_var("SITESURL", $home);
         $delete = UrlRewriting::GetUrlByAlias("admin/pagedelete", "site=" . urlencode($_GET['site']) . "&delete=true");
         $template->assign_var("DELETEURL", $delete);
         $template->output();
     } else {
         if ($page->delete()) {
             $template = new Template();
             $template->load("message");
             $message = str_ireplace("{VAR:TITLE}", $page->title, Language::GetGlobal()->getString("PAGE_DELETED"));
             $template->assign_var("MESSAGE", $message);
             $template->output();
         }
     }
 }
Example #21
0
File: Flow.php Project: hisaboh/w2t
 /**
  * URLのパターンからTemplateを切り替える
  * @param array $urlconf
  */
 public function handler(array $urlconf = array())
 {
     $params = array();
     foreach ($urlconf as $pattern => $conf) {
         if (is_int($pattern)) {
             $pattern = $conf;
             $conf = null;
         }
         if (preg_match("/" . str_replace(array("\\/", "/", "__SLASH__"), array("__SLASH__", "\\/", "\\/"), $pattern) . "/", $this->args(), $params)) {
             if ($conf !== null) {
                 if (is_array($conf)) {
                     if (isset($conf["class"])) {
                         $this->class = $conf["class"];
                     }
                     if (isset($conf["method"])) {
                         $this->method = $conf["method"];
                     }
                     if (isset($conf["template"])) {
                         $this->template = $conf["template"];
                     }
                     if (isset($conf["name"])) {
                         $this->name = $conf["name"];
                     }
                 } else {
                     $this->dict($conf);
                 }
             }
             self::$match_pattern = empty($this->name) ? $params[0] : $this->name;
             if (!empty($this->class)) {
                 if (false !== strrpos($this->class, ".") || !class_exists($this->class)) {
                     $this->class = Rhaco::import($this->class);
                 }
                 if (empty($this->method) && !empty($pattern)) {
                     $method_patterns = array();
                     $patterns = explode("/", $pattern);
                     if ($patterns[0] == "^") {
                         array_shift($patterns);
                     }
                     foreach ($patterns as $p) {
                         if (!preg_match("/[\\w_]/", $p)) {
                             break;
                         }
                         $method_patterns[] = $p;
                     }
                     if (!empty($method_patterns)) {
                         $this->method = implode("_", $method_patterns);
                     }
                 }
             }
             if (empty($this->method) && !empty($this->template)) {
                 $obj = new self();
                 $obj->copy_module($this, true);
                 $obj->template($this->template);
             } else {
                 $method = empty($this->method) ? "index" : $this->method;
                 if (!method_exists($this->class, $method)) {
                     throw new Exception("Not found " . $this->class . "::" . $method);
                 }
                 array_shift($params);
                 try {
                     $class = $this->class;
                     $action = new $class();
                     $action->copy_module($this, true);
                     if ($action instanceof self) {
                         $action->handled();
                     }
                     $obj = call_user_func_array(array($action, $method), $params);
                 } catch (Exception $e) {
                     Log::debug($e);
                     $on_error = Rhaco::def("core.Flow@on_error");
                     if ($on_error === null) {
                         throw $e;
                     }
                     if (isset($on_error[0])) {
                         Http::status_header((int) $on_error[0]);
                     }
                     if (isset($on_error[2])) {
                         Http::redirect($on_error[2]);
                     }
                     if (isset($on_error[1])) {
                         $template = new Template();
                         $template->output($on_error[1]);
                     }
                     exit;
                 }
             }
             if ($obj instanceof self) {
                 $obj = $obj->templ();
             }
             if (!$obj instanceof Template) {
                 throw new Exception("Forbidden " . $this->args());
             }
             $obj->path($this->path());
             $obj->url($this->url());
             $this->templ = $obj;
             if (!$this->isTemplate()) {
                 $this->template($obj->filename());
             }
             if (!$this->isTemplate()) {
                 $cs = explode(".", $this->class);
                 $class = array_pop($cs);
                 $class = implode("/", $cs) . (!empty($cs) ? "/" : "") . strtolower($class[0]) . substr($class, 1);
                 $this->template($class . "/" . $method . ".html");
             }
             return $this;
         }
     }
     throw new Exception("no match pattern");
 }
$fh = fopen(BASE . $directory . "/" . $file->filename, "r");
for ($x = 0; $x < $_POST["rowstart"]; $x++) {
    $lineInfo = fgetcsv($fh, 2000, $_POST["delimiter"]);
}
$colNames = array("none" => $i18n['col_none'], "username" => $i18n['col_username'], "password" => $i18n['col_password'], "firstname" => $i18n['col_firstname'], "lastname" => $i18n['col_lastname'], "email" => $i18n['col_email']);
//Check to see if the line got split, otherwise throw an error
if ($lineInfo == null) {
    $post['_formError'] = sprintf($i18n['delimiter_error'], $_POST["delimiter"]);
    exponent_sessions_set("last_POST", $post);
    header("Location: " . $_SERVER['HTTP_REFERER']);
    exit("");
} else {
    //initialize the for stuff
    exponent_forms_initialize();
    //Setup the mete data (hidden values)
    $form = new form();
    $form->meta("module", "importer");
    $form->meta("action", "page");
    $form->meta("page", "process");
    $form->meta("rowstart", $_POST["rowstart"]);
    $form->meta("importer", "usercsv");
    $form->meta("filename", $directory . "/" . $file->filename);
    $form->meta("delimiter", $_POST["delimiter"]);
    for ($i = 0; $i < count($lineInfo); $i++) {
        $form->register("column[{$i}]", $lineInfo[$i], new dropdowncontrol("none", $colNames));
    }
    $form->register("submit", "", new buttongroupcontrol($i18n['submit'], "", $i18n['cancel']));
    $template = new Template("importer", "_usercsv_form_mapping");
    $template->assign("form_html", $form->tohtml());
    $template->output();
}
Example #23
0
  function fillCustomers($tmp_src, $table, $json, $userdetails, $tmp_src_subitems=0) {
   $block_no         = new Template($this->viewroot, $tmp_src->returnloop('block_no'));
   $block_no=$block_no->output();
   
   $block_norows     = new Template($this->viewroot, $tmp_src->returnloop('block_norows'));
   $block_norows=$block_norows->output();
   
   $checkbox_th      = new Template($this->viewroot, $tmp_src->returnloop('checkbox_th'));
   $checkbox_td      = new Template($this->viewroot, $tmp_src->returnloop('checkbox_td'));
   
   $loop_table_row   = new Template($this->viewroot, $tmp_src->returnloop('loop_table_row'));
   
   $block_dir = array();
   $block_dir[0]     = new Template($this->viewroot, $tmp_src->returnloop('block_dir0'));
   $block_dir[1]     = new Template($this->viewroot, $tmp_src->returnloop('block_dir1'));
   
   $block_dir[0] = $block_dir[0]->output();
   $block_dir[1] = $block_dir[1]->output();
   
   $loopdata = "";
   $loopdata.=$checkbox_th->output();
   
   $cols = array();
   $cols[] = 'ID';
   $cols[] = 'Date';
   $cols[] = 'Phone';
   $cols[] = 'Market';
   $cols[] = 'DesiredRooms';
   $cols[] = 'HouseTypes';
   $cols[] = 'Districts';
   $cols[] = 'User';
   $cols[] = 'MaxCost';
   $cols[] = 'Firstname';
   $cols[] = 'Surname';
   
   $districts    = $this->model->getList('districts');
   $housetypes   = $this->model->getList('housetypes');
   $desiredrooms = $this->model->getList('desiredrooms');
   
   $emptyinfo = file_get_contents($this->viewroot.'/templates/emptyinfo.htt');
   $c = 0;
   
//           ajax_echo_r ($json);
//   ajax_echo_r ($table[1]);
   
   $thistable = "";
   if (sizeof($table)) {
    $thisidcolumnname = $json->tablename."_ID";
//          echo $thisidcolumnname."<br>";
    foreach ($table as $item) {
     $loop_table_row->reload();
     $thisrow   = "";
     $checkbox_td->reload();
     $checkbox_td->fill('%checked%' , 'checked'            );
     $checkbox_td->fill('%id%'      , $item->$thisidcolumnname );
     $thisrow.=$checkbox_td->output();
     
     $loop_table_row->fill(           "%ID%", $item->ID);
     $loop_table_row->fill( "%calldiretion%", $block_dir[$item->DirectionID]);
     
     $item->Districts = "";
     $ids = explode(";",$item->DistrictIDs);
     foreach ($ids as $id_itm) {
      if ($id_itm) {
       $id = substr($id_itm, strpos($id_itm, "_")+1);
       if ($item->Districts) $item->Districts .= ", ";
       $item->Districts .= $districts[$id]->Description;
      }
     }
     
     $item->HouseTypes = "";
     $ids = explode(";",$item->HouseTypeIDs);
     foreach ($ids as $id_itm) {
      if ($id_itm) {
       $id = substr($id_itm, strpos($id_itm, "_")+1);
       if ($id) {
        if ($item->HouseTypes) $item->HouseTypes .= ", ";
        $item->HouseTypes .= $housetypes[$id]->Description;
       }
      }
     }
     
     $item->DesiredRooms = "";
     $ids = explode(";",$item->DesiredRoomsIDs);
     foreach ($ids as $id_itm) {
      if ($id_itm) {
       $id = substr($id_itm, strpos($id_itm, "_")+1);
       if ($item->DesiredRooms) $item->DesiredRooms .= ", ";
       $item->DesiredRooms .= $desiredrooms[$id]->Description;
      }
     }
     
     foreach ($cols as $cv) {
      $k=$cv;
      $v = $item->$k;
      if ($k && ($k!='CustomerID')) {
       if ($k==$json->tablename."_AuxInfo") {
        if (trim($v)=="") $v=$emptyinfo;
       }
       
       switch ($cv) {
        case ('MaxCost'):
         $loop_table_row->fill(  "%".$k."%", formatCost($v));
        break;
        default:
         $loop_table_row->fill(  "%".$k."%", (((int)$v==0) && ((string)(int)$v==$v) && ($k!='Cost'))?$block_no:($v));
        break;
       }
      }
     }
     $loop_table_row->fillloop('loop_table_cell',$thisrow);
//             $loop_table_row->fill("%c%",  ($c%2) + ((date_timestamp_get(date_create($item->DateTarget))<date_timestamp_get(date_create()) )?0:2) );
     $loop_table_row->fill("%c%",  $c%2);
     
//             echo (date_timestamp_get(date_create($item->DateTarget))."-".date_timestamp_get(date_create())."<br>");
     
     if ($tmp_src_subitems) {
      if ($json->r_viewmode=='objects') {
       $objects = $this->fillCustomers(clone $tmp_src_subitems, $item->subitems, $json, $userdetails);
      } else {
       $objects = $this->fillObjects  (clone $tmp_src_subitems, $item->subitems, $json, $userdetails);
      }
      $loop_table_row->fill("%objects%",  $objects->output());
     }
     
     $loop_table_row->fill("%id%"           , $item->ID             );
     $loop_table_row->fill("%tablename%"    , $json->tablename      );
     
     $thistable.=$loop_table_row->output();
     $c++;
    }
   } else {
    /*
    $thisrow   = "";
    $thisrow.=$block_norows;
    $loop_table_row->fillloop('loop_table_cell',$thisrow);
    $loop_table_row->fill("%c%",  $c%2);
    $thistable.=$loop_table_row->output();
    */
    $tmp_src->fillloop('loop_table', $block_norows);
   }
   
   $tmp_src->removeloop('loop_table');
   
   $tmp_src->fillloop('loop_table_row',$thistable);
   
   $tmp_src->fillloop(     "block_no","" );
   $tmp_src->fillloop( "block_norows","" );
   $tmp_src->fillloop(   "block_dir0","" );
   $tmp_src->fillloop(   "block_dir1","" );
   
   
   $tmp_src->fill("%numrows%",sizeof($table[1]));          
   
   return $tmp_src;
  }
Example #24
0
 /**
  * Parse the template file, add the TinyMCE configuration and print it to the screen
  */
 public function output()
 {
     // Rich text editor configuration
     if (is_array($GLOBALS['TL_RTE']) && !empty($GLOBALS['TL_RTE'])) {
         $this->base = $this->Environment->base;
         $this->uploadPath = $GLOBALS['TL_CONFIG']['uploadPath'];
         // Fallback to English if the user language is not supported
         $this->language = file_exists(TL_ROOT . '/plugins/tinyMCE/langs/' . $GLOBALS['TL_LANGUAGE'] . '.js') ? $GLOBALS['TL_LANGUAGE'] : 'en';
         foreach ($GLOBALS['TL_RTE'] as $file => $fields) {
             $arrRteFields = array();
             foreach ($fields as $field) {
                 $arrRteFields[] = $field['id'];
             }
             $this->rteFields = implode(',', $arrRteFields);
             // TinyMCE
             $this->ceFields = $fields;
             // Other RTEs
             $strFile = sprintf('%s/system/config/%s.php', TL_ROOT, $file);
             if (!file_exists($strFile)) {
                 throw new Exception(sprintf('Cannot find editor configuration file "%s.php"', $file));
             }
             ob_start();
             include $strFile;
             $this->rteConfig .= ob_get_contents();
             ob_end_clean();
         }
     }
     // Style sheets
     if (is_array($GLOBALS['TL_CSS']) && !empty($GLOBALS['TL_CSS'])) {
         $strStyleSheets = '';
         foreach (array_unique($GLOBALS['TL_CSS']) as $stylesheet) {
             list($stylesheet, $media) = explode('|', $stylesheet);
             $strStyleSheets .= '<link rel="stylesheet" href="' . $this->addStaticUrlTo($stylesheet) . '" media="' . ($media != '' ? $media : 'all') . '">' . "\n";
         }
         $this->stylesheets = $strStyleSheets;
     }
     // JavaScripts
     if (is_array($GLOBALS['TL_JAVASCRIPT']) && !empty($GLOBALS['TL_JAVASCRIPT'])) {
         $strJavaScripts = '';
         foreach (array_unique($GLOBALS['TL_JAVASCRIPT']) as $javascript) {
             $strJavaScripts .= '<script src="' . $this->addStaticUrlTo($javascript) . '"></script>' . "\n";
         }
         $this->javascripts = $strJavaScripts;
     }
     // MooTools scripts (added at the page bottom)
     if (is_array($GLOBALS['TL_MOOTOOLS']) && !empty($GLOBALS['TL_MOOTOOLS'])) {
         $strMootools = '';
         foreach (array_unique($GLOBALS['TL_MOOTOOLS']) as $script) {
             $strMootools .= "\n" . trim($script) . "\n";
         }
         $this->mootools = $strMootools;
     }
     $strBuffer = $this->parse();
     // HOOK: add custom output filter
     if (isset($GLOBALS['TL_HOOKS']['outputBackendTemplate']) && is_array($GLOBALS['TL_HOOKS']['outputBackendTemplate'])) {
         foreach ($GLOBALS['TL_HOOKS']['outputBackendTemplate'] as $callback) {
             $this->import($callback[0]);
             $strBuffer = $this->{$callback}[0]->{$callback}[1]($strBuffer, $this->strTemplate);
         }
     }
     // Add the browser and OS classes (see #3074)
     $ua = $this->Environment->agent;
     $strBuffer = str_replace('__ua__', $ua->class, $strBuffer);
     $this->strBuffer = $strBuffer;
     parent::output();
 }
Example #25
0
 /**
  * Parse the template file, replace insert tags and print it to the screen
  */
 public function output()
 {
     global $objPage;
     // Ignore certain URL parameters
     $arrIgnore = array('id', 'file', 'token', 'page', 'day', 'month', 'year');
     if ($GLOBALS['TL_CONFIG']['useAutoItem']) {
         $arrIgnore[] = 'auto_item';
     }
     if ($GLOBALS['TL_CONFIG']['addLanguageToUrl']) {
         $arrIgnore[] = 'language';
     }
     $strParams = '';
     // Rebuild the URL to eliminate duplicate parameters
     foreach (array_keys($_GET) as $key) {
         if (!in_array($key, $arrIgnore)) {
             if ($GLOBALS['TL_CONFIG']['useAutoItem'] && in_array($key, $GLOBALS['TL_AUTO_ITEM'])) {
                 $strParams .= '/' . \Input::get($key);
             } else {
                 $strParams .= '/' . $key . '/' . \Input::get($key);
             }
         }
     }
     $strUrl = $this->generateFrontendUrl($objPage->row(), $strParams);
     // Add the page number
     if (isset($_GET['page'])) {
         $strUrl .= ($GLOBALS['TL_CONFIG']['disableAlias'] ? '&page=' : '?page=') . \Input::get('page');
     }
     $this->keywords = '';
     $arrKeywords = array_map('trim', explode(',', $GLOBALS['TL_KEYWORDS']));
     // Add the meta keywords
     if (strlen($arrKeywords[0])) {
         $this->keywords = str_replace(array("\n", "\r", '"'), array(' ', '', ''), implode(', ', array_unique($arrKeywords)));
     }
     // Parse the template
     $strBuffer = str_replace(' & ', ' &amp; ', $this->parse());
     // HOOK: add custom output filters
     if (isset($GLOBALS['TL_HOOKS']['outputFrontendTemplate']) && is_array($GLOBALS['TL_HOOKS']['outputFrontendTemplate'])) {
         foreach ($GLOBALS['TL_HOOKS']['outputFrontendTemplate'] as $callback) {
             $this->import($callback[0]);
             $strBuffer = $this->{$callback}[0]->{$callback}[1]($strBuffer, $this->strTemplate);
         }
     }
     $intCache = null;
     // Cache the page if it is not protected
     if (empty($_POST) && !BE_USER_LOGGED_IN && !FE_USER_LOGGED_IN && !$_SESSION['DISABLE_CACHE'] && !isset($_SESSION['LOGIN_ERROR']) && ($GLOBALS['TL_CONFIG']['cacheMode'] == 'both' || $GLOBALS['TL_CONFIG']['cacheMode'] == 'server') && intval($objPage->cache) > 0 && !$objPage->protected) {
         // If the request string is empty, use a special cache tag which considers the page language
         if (\Environment::get('request') == '' || \Environment::get('request') == 'index.php') {
             $strCacheKey = \Environment::get('base') . 'empty.' . $objPage->language;
         } else {
             $strCacheKey = \Environment::get('base') . $strUrl;
         }
         // HOOK: add custom logic
         if (isset($GLOBALS['TL_HOOKS']['getCacheKey']) && is_array($GLOBALS['TL_HOOKS']['getCacheKey'])) {
             foreach ($GLOBALS['TL_HOOKS']['getCacheKey'] as $callback) {
                 $this->import($callback[0]);
                 $strCacheKey = $this->{$callback}[0]->{$callback}[1]($strCacheKey);
             }
         }
         // Replace insert tags for caching
         $strBuffer = $this->replaceInsertTags($strBuffer, true);
         $intCache = intval($objPage->cache) + time();
         $lb = $GLOBALS['TL_CONFIG']['minifyMarkup'] ? '' : "\n";
         $strMd5CacheKey = md5($strCacheKey);
         // Create the cache file
         $objFile = new \File('system/cache/html/' . substr($strMd5CacheKey, 0, 1) . '/' . $strMd5CacheKey . '.html');
         $objFile->write('<?php' . " /* {$strCacheKey} */ \$expire = {$intCache}; \$content = '{$this->strContentType}'; ?>\n");
         /**
          * Copyright notice
          *
          * ACCORDING TO THE LESSER GENERAL PUBLIC LICENSE (LGPL),YOU ARE NOT
          * PERMITTED TO RUN CONTAO WITHOUT THIS COPYRIGHT NOTICE. CHANGING,
          * REMOVING OR OBSTRUCTING IT IS PROHIBITED BY LAW!
          */
         $objFile->append(preg_replace('/([ \\t]*<title[^>]*>)\\n*/', "<!--\n\n" . "\tThis website is powered by Contao Open Source CMS :: Licensed under GNU/LGPL\n" . "\tCopyright ©2005-" . date('Y') . " by Leo Feyer :: Extensions are copyright of their respective owners\n" . "\tVisit the project website at http://www.contao.org for more information\n\n" . "//-->{$lb}\$1", $this->minifyHtml($strBuffer), 1), '');
         $objFile->close();
     }
     // Send cache headers
     if (!headers_sent()) {
         if ($intCache !== null && ($GLOBALS['TL_CONFIG']['cacheMode'] == 'both' || $GLOBALS['TL_CONFIG']['cacheMode'] == 'browser')) {
             header('Cache-Control: public, max-age=' . ($intCache - time()));
             header('Expires: ' . gmdate('D, d M Y H:i:s', $intCache) . ' GMT');
             header('Last-Modified: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT');
             header('Pragma: public');
         } else {
             header('Cache-Control: no-cache');
             header('Cache-Control: pre-check=0, post-check=0', false);
             header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
             header('Expires: Fri, 06 Jun 1975 15:10:00 GMT');
             header('Pragma: no-cache');
         }
     }
     // Replace insert tags and then re-replace the request_token tag in case a form element has been loaded via insert tag
     $this->strBuffer = $this->replaceInsertTags($strBuffer);
     $this->strBuffer = str_replace(array('{{request_token}}', '[{]', '[}]'), array(REQUEST_TOKEN, '{{', '}}'), $this->strBuffer);
     // Index page if searching is allowed and there is no back end user
     if ($GLOBALS['TL_CONFIG']['enableSearch'] && $objPage->type == 'regular' && !BE_USER_LOGGED_IN && !$objPage->noSearch) {
         // Index protected pages if enabled
         if ($GLOBALS['TL_CONFIG']['indexProtected'] || !FE_USER_LOGGED_IN && !$objPage->protected) {
             $arrData = array('url' => $strUrl, 'content' => $this->strBuffer, 'title' => $objPage->pageTitle ?: $objPage->title, 'protected' => $objPage->protected ? '1' : '', 'groups' => $objPage->groups, 'pid' => $objPage->id, 'language' => $objPage->language);
             \Search::indexPage($arrData);
         }
     }
     parent::output();
 }
Example #26
0
				   <span id="meeting_time" style="position:absolute; z-index:8; left:330px; top:259px;padding:0; margin:7px 0 0 5px; display:block; font-weight:bold;">' . $meet_time . '</span>

				   <span id="arrival_date_time" style="position:absolute; z-index:9; left:120px; top:312px;padding:0; margin:7px 0 0 5px; display:block; font-weight:bold;">' . $arrive_date . '</span>
				   <span id="meeting_time" style="position:absolute; z-index:8; left:300px; top:312px;padding:0; margin:7px 0 0 5px; display:block; font-weight:bold;">' . $arrive_time . '</span>
				   <span id="flight" style="position:absolute; z-index:11; left:438px; top:312px;padding:0; margin:7px 0 0 5px; display:block; font-weight:bold;"><?php echo $row["flight"]; ?>' . $flight . '</span>

				   <span id="amount" style="position:absolute; z-index:11; left:115px; top:364px;padding:0; margin:7px 0 0 5px; display:block; font-weight:bold;width:100px;">' . $amount . '</span>
				   <span id="comment" style="position:absolute; z-index:14; left:43px; top:763px;padding:0; margin:7px 0 0 5px; display:block; font-weight:bold; width:490px; height:50px;white-space:wrap; overflow:hidden;">' . $comment . '</span>
				   
				   <span id="cash" style="position:absolute; z-index:12; left:121px; top:435px;padding:0; margin:7px 0 0 5px; display:block; font-weight:bold;">' . $cash . '</span>

				   <span id="eft" style="position:absolute; z-index:13; left:215px; top:438px;padding:0; margin:7px 0 0 5px; display:block; font-weight:bold;">' . $eft . '</span>

				   <span id="cc" style="position:absolute; z-index:14; left:338px; top:438px;padding:0; margin:7px 0 0 5px; display:block; font-weight:bold;">' . $cc . '</span>
			   </div>
		   </div>
       </div>';
    }
    if ($error) {
        $t = new Template("templates/print/print_report_time.tpl.html");
        $t->insertSlot("VALID", urlencode($error));
        //$t->insertSlot("RESULTS", "$results");
    } else {
        $t->insertSlot("RESULTS", $results);
        $t->insertSlot("VALID", "valid");
    }
    $t->insertSlot("DESC", $desc);
    $t->insertSlot("TITLE", "Report-" . date("Y-m-d"));
    echo $t->output() . '';
    echo ' <br/><br/><br/><br/><br/><br/>';
}
Example #27
0
 /**
  * Parse the template file, replace insert tags and print it to the screen
  */
 public function output()
 {
     global $objPage;
     // Ignore certain URL parameters
     $arrIgnore = array('id', 'file', 'token', 'day', 'month', 'year');
     if ($GLOBALS['TL_CONFIG']['useAutoItem']) {
         $arrIgnore[] = 'auto_item';
     }
     if ($GLOBALS['TL_CONFIG']['addLanguageToUrl']) {
         $arrIgnore[] = 'language';
     }
     $strParams = '';
     $arrPageParams = array();
     // Rebuild the URL to eliminate duplicate parameters
     foreach (array_keys($_GET) as $key) {
         if (!in_array($key, $arrIgnore)) {
             if (preg_match('/^page/', $key)) {
                 $arrPageParams[] = $key;
                 continue;
                 // see #4141
             }
             if ($GLOBALS['TL_CONFIG']['useAutoItem'] && in_array($key, $GLOBALS['TL_AUTO_ITEM'])) {
                 $strParams .= '/' . \Input::get($key);
             } else {
                 $strParams .= '/' . $key . '/' . \Input::get($key);
             }
         }
     }
     $strUrl = $this->generateFrontendUrl($objPage->row(), $strParams);
     sort($arrPageParams);
     // see #4141
     $strGlue = !$GLOBALS['TL_CONFIG']['disableAlias'] && strpos($strUrl, '?') === false ? '?' : '&';
     // Re-add the page numbers
     foreach ($arrPageParams as $key) {
         $strUrl .= $strGlue . $key . '=' . \Input::get($key);
         $strGlue = '&';
     }
     $this->keywords = '';
     $arrKeywords = array_map('trim', explode(',', $GLOBALS['TL_KEYWORDS']));
     // Add the meta keywords
     if (strlen($arrKeywords[0])) {
         $this->keywords = str_replace(array("\n", "\r", '"'), array(' ', '', ''), implode(', ', array_unique($arrKeywords)));
     }
     // Parse the template
     $strBuffer = str_replace(' & ', ' &amp; ', $this->parse());
     // HOOK: add custom output filters
     if (isset($GLOBALS['TL_HOOKS']['outputFrontendTemplate']) && is_array($GLOBALS['TL_HOOKS']['outputFrontendTemplate'])) {
         foreach ($GLOBALS['TL_HOOKS']['outputFrontendTemplate'] as $callback) {
             $this->import($callback[0]);
             $strBuffer = $this->{$callback}[0]->{$callback}[1]($strBuffer, $this->strTemplate);
         }
     }
     $intCache = null;
     // Cache the page if it is not protected
     if (!isset($_GET['file']) && !isset($_GET['token']) && empty($_POST) && !BE_USER_LOGGED_IN && !FE_USER_LOGGED_IN && !$_SESSION['DISABLE_CACHE'] && !isset($_SESSION['LOGIN_ERROR']) && ($GLOBALS['TL_CONFIG']['cacheMode'] == 'both' || $GLOBALS['TL_CONFIG']['cacheMode'] == 'server') && intval($objPage->cache) > 0 && !$objPage->protected) {
         // If the request string is empty, use a special cache tag which considers the page language
         if (\Environment::get('request') == '' || \Environment::get('request') == 'index.php') {
             $strCacheKey = \Environment::get('base') . 'empty.' . $objPage->language;
         } else {
             $strCacheKey = \Environment::get('base') . $strUrl;
         }
         // HOOK: add custom logic
         if (isset($GLOBALS['TL_HOOKS']['getCacheKey']) && is_array($GLOBALS['TL_HOOKS']['getCacheKey'])) {
             foreach ($GLOBALS['TL_HOOKS']['getCacheKey'] as $callback) {
                 $this->import($callback[0]);
                 $strCacheKey = $this->{$callback}[0]->{$callback}[1]($strCacheKey);
             }
         }
         // Store mobile pages separately
         if ($objPage->mobileLayout && \Environment::get('agent')->mobile) {
             $strCacheKey .= '.mobile';
         }
         // Replace insert tags for caching
         $strBuffer = $this->replaceInsertTags($strBuffer);
         $strBuffer = $this->replaceDynamicScriptTags($strBuffer);
         // see #4203
         $intCache = intval($objPage->cache) + time();
         $strMd5CacheKey = md5($strCacheKey);
         // Create the cache file
         $objFile = new \File('system/cache/html/' . substr($strMd5CacheKey, 0, 1) . '/' . $strMd5CacheKey . '.html');
         $objFile->write('<?php' . " /* {$strCacheKey} */ \$expire = {$intCache}; \$content = '{$this->strContentType}'; ?>\n");
         $objFile->append($this->minifyHtml($strBuffer), '');
         $objFile->close();
     }
     // Send cache headers
     if (!headers_sent()) {
         if ($intCache !== null && ($GLOBALS['TL_CONFIG']['cacheMode'] == 'both' || $GLOBALS['TL_CONFIG']['cacheMode'] == 'browser')) {
             header('Cache-Control: public, max-age=' . ($intCache - time()));
             header('Expires: ' . gmdate('D, d M Y H:i:s', $intCache) . ' GMT');
             header('Last-Modified: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT');
             header('Pragma: public');
         } else {
             header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
             header('Pragma: no-cache');
             header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
             header('Expires: Fri, 06 Jun 1975 15:10:00 GMT');
         }
     }
     // Replace insert tags and then re-replace the request_token tag in case a form element has been loaded via insert tag
     $this->strBuffer = $this->replaceInsertTags($strBuffer, false);
     $this->strBuffer = str_replace(array('{{request_token}}', '[{]', '[}]'), array(REQUEST_TOKEN, '{{', '}}'), $this->strBuffer);
     $this->strBuffer = $this->replaceDynamicScriptTags($this->strBuffer);
     // see #4203
     // Index page if searching is allowed and there is no back end user
     if ($GLOBALS['TL_CONFIG']['enableSearch'] && $objPage->type == 'regular' && !BE_USER_LOGGED_IN && !$objPage->noSearch) {
         // Index protected pages if enabled
         if ($GLOBALS['TL_CONFIG']['indexProtected'] || !FE_USER_LOGGED_IN && !$objPage->protected) {
             $arrData = array('url' => $strUrl, 'content' => $this->strBuffer, 'title' => $objPage->pageTitle ?: $objPage->title, 'protected' => $objPage->protected ? '1' : '', 'groups' => $objPage->groups, 'pid' => $objPage->id, 'language' => $objPage->language);
             \Search::indexPage($arrData);
         }
     }
     parent::output();
 }
Example #28
0
    $tt->insertSlot("MAKE_VALUE", $make);
    $tt->insertSlot("REG_LABEL", FormFieldTexts::REG);
    $tt->insertSlot("REG_VALUE", $reg);
    $tt->insertSlot("COLOUR_LABEL", FormFieldTexts::COLOUR);
    $tt->insertSlot("COLOUR_VALUE", $colour);
    $tt->insertSlot("FLIGHT_LABEL", FormFieldTexts::FLIGHT);
    $tt->insertSlot("FLIGHT_VALUE", $flight);
    $tt->insertSlot("DEPART_LABEL", FormFieldTexts::DEPART);
    $tt->insertSlot("DEPART_VALUE", $depart);
    $tt->insertSlot("ARRIVE_LABEL", FormFieldTexts::ARRIVE);
    $tt->insertSlot("ARRIVE_VALUE", $arrive);
    $tt->insertSlot("MEET_LABEL", FormFieldTexts::SUGGESTED_MEETING_TIME);
    $tt->insertSlot("MEET_SELECTED_60", $suggested_time == 60 ? " selected" : "");
    $tt->insertSlot("MEET_SELECTED_75", $suggested_time == 75 ? " selected" : "");
    $tt->insertSlot("MEET_SELECTED_90", $suggested_time == 90 ? " selected" : "");
    $tt->insertSlot("MEET_SELECTED_105", $suggested_time == 105 ? " selected" : "");
    $tt->insertSlot("MEET_SELECTED_120", $suggested_time == 120 ? " selected" : "");
    $tt->insertSlot("MEET_SELECTED_180", $suggested_time == 180 ? " selected" : "");
    $tt->insertSlot("MEET_SELECTED_240", $suggested_time == 240 ? " selected" : "");
    $tt->insertSlot("PAY_LABEL", FormFieldTexts::PAY);
    $tt->insertSlot("PAY_SELECTED_0", $payment_methods_id == 0 ? " selected" : "");
    $tt->insertSlot("PAY_SELECTED_1", $payment_methods_id == 1 ? " selected" : "");
    $tt->insertSlot("PAY_SELECTED_2", $payment_methods_id == 2 ? " selected" : "");
    $tt->insertSlot("PAY_SELECTED_3", $payment_methods_id == 3 ? " selected" : "");
    $tt->insertSlot("ACCEPTED_TERMS_CHECKED", $accepted_terms ? " checked=\"checked\"" : "");
    $tt->insertSlot("FOCUS_ID", $focusId);
    $tt->insertSlot("SHOW_FORM_PAGE", $showFormPage);
    $tt->insertSlot("SHOW_PAYMENT_NOTE", (int) $payment_methods_id);
}
TemplateHelper::configurePage($t, Constants::SITE_NAME . " - Bookings", $tt->output(), $jsExtra);
echo $t->output();
Example #29
0
                $printRow .= "<a href=\"edit_booking.php?id={$bid}\">edit</a><br />";
            }
            $printRow .= "<a href=\"edit_booking.php?id={$bid}&clone=1\">clone</a>";
            $results .= sprintf($rowTemplate, $n % 2 == 0 ? "even" : "odd", $n, $bid, $row["surname"] . ", " . $row["name"], $emailImg . $email . "<br />" . $phoneImg . $row["phone"], $row["vehicle"] . " \"" . $row["reg"] . "\"", $row["flight"], "", $depart, "", $meet, "", $arrive, $row["payment"], $combo, $cdate, $printRow);
        }
        $results .= "</table>\n";
    }
    $message = "";
}
$tt->insertSlot("RESULTS", $results);
$tt->insertSlot("SEARCH_TEXT", $search_text);
$tt->insertSlot("NAME_STATUS", $name_status);
$tt->insertSlot("EMAIL_STATUS", $email_status);
$tt->insertSlot("PHONE_STATUS", $phone_status);
$tt->insertSlot("AMOUNT_STATUS", $amount_status);
$tt->insertSlot("COMMENT_STATUS", $comment_status);
$tt->insertSlot("MAKE_STATUS", $make_status);
$tt->insertSlot("PARKING_POINTS_STATUS", $parking_points_status);
$tt->insertSlot("REG_STATUS", $reg_status);
$tt->insertSlot("COLOUR_STATUS", $colour_status);
$tt->insertSlot("FLIGHT_STATUS", $flight_status);
$tt->insertSlot("DROPOFF_STATUS", $dropoff_status);
$tt->insertSlot("PICKUP_STATUS", $pickup_status);
$tt->insertSlot("RANGE_START_VALUE", $_POST ? $range_start : "");
$tt->insertSlot("RANGE_END_VALUE", $_POST ? $range_end : "");
$tt->insertSlot("MESSAGE", $error ? "<span class=\"feedback_negative\">{$error}</span>" : "<span class=\"feedback_positive\">{$message}</span>");
$tt->insertSlot("FOCUS_ID", $focusId);
// output
$jsExtra = JsWriter::scriptLink("js/jquery-1.4.2.min.js") . "\n" . JsWriter::scriptLink("js/report_search.js") . "\n" . JsWriter::scriptLink("js/datetimepicker_css.js");
TemplateHelper::configurePage($t, Constants::SITE_NAME . " - Report - search", $tt->output(), $jsExtra);
echo $t->output();
 /**
  * Parse the template file, add the TinyMCE configuration and print it to the screen
  *
  * @throws \Exception
  */
 public function output()
 {
     // User agent class (see #3074 and #6277)
     $this->ua = \Environment::get('agent')->class;
     // Style sheets
     if (!empty($GLOBALS['TL_CSS']) && is_array($GLOBALS['TL_CSS'])) {
         $strStyleSheets = '';
         foreach (array_unique($GLOBALS['TL_CSS']) as $stylesheet) {
             $options = \StringUtil::resolveFlaggedUrl($stylesheet);
             $strStyleSheets .= \Template::generateStyleTag($this->addStaticUrlTo($stylesheet), $options->media);
         }
         $this->stylesheets = $strStyleSheets;
     }
     // Add the debug style sheet
     if (\Config::get('debugMode')) {
         $this->stylesheets .= '<link rel="stylesheet" href="' . $this->addStaticUrlTo('assets/contao/css/debug.css') . '">' . "\n";
     }
     // JavaScripts
     if (!empty($GLOBALS['TL_JAVASCRIPT']) && is_array($GLOBALS['TL_JAVASCRIPT'])) {
         $strJavaScripts = '';
         foreach (array_unique($GLOBALS['TL_JAVASCRIPT']) as $javascript) {
             $options = \StringUtil::resolveFlaggedUrl($javascript);
             $strJavaScripts .= \Template::generateScriptTag($this->addStaticUrlTo($javascript), false, $options->async) . "\n";
         }
         $this->javascripts = $strJavaScripts;
     }
     // MooTools scripts (added at the page bottom)
     if (!empty($GLOBALS['TL_MOOTOOLS']) && is_array($GLOBALS['TL_MOOTOOLS'])) {
         $strMootools = '';
         foreach (array_unique($GLOBALS['TL_MOOTOOLS']) as $script) {
             $strMootools .= "\n" . trim($script) . "\n";
         }
         $this->mootools = $strMootools;
     }
     $strBuffer = $this->parse();
     // HOOK: add custom output filter
     if (isset($GLOBALS['TL_HOOKS']['outputBackendTemplate']) && is_array($GLOBALS['TL_HOOKS']['outputBackendTemplate'])) {
         foreach ($GLOBALS['TL_HOOKS']['outputBackendTemplate'] as $callback) {
             $this->import($callback[0]);
             $strBuffer = $this->{$callback[0]}->{$callback[1]}($strBuffer, $this->strTemplate);
         }
     }
     $this->strBuffer = $strBuffer;
     parent::output();
 }