示例#1
0
function run()
{
    global $layout;
    global $DB;
    global $website;
    global $theme;
    $out = '';
    switch ($_REQUEST['act']) {
        case "copy_from_template_zones":
            // return template sections and (textarea) properties for a content id
            $template = new template();
            $template->load($_REQUEST['template']);
            $zones = array();
            for ($ts = 0; $ts < count($template->sections); $ts++) {
                $title = $theme->t($template->sections[$ts]['name']);
                if ($title == '#main#') {
                    $title = t(238, 'Main content');
                }
                $zones[] = array('type' => 'section', 'code' => $template->sections[$ts]['code'], 'title' => $title);
            }
            for ($ps = 0; $ps < count($template->properties); $ps++) {
                // ignore non-textual properties
                if (!in_array($template->properties[$ps]->type, array("text", "textarea", "rich_textarea"))) {
                    continue;
                }
                $zones[] = array('type' => 'property', 'code' => $template->properties[$ps]->id, 'title' => $theme->t($template->properties[$ps]->name));
            }
            echo json_encode($zones);
            core_terminate();
            break;
    }
}
示例#2
0
 /**
  * @param $view
  * @return \template
  */
 protected function getTemplate($view)
 {
     $template = new \template();
     $template->setFile(strtok($view, '/'));
     $template->load(strtok('/'));
     return $template;
 }
 function index($params)
 {
     $tpl = new template("includes/v");
     $tpl->load("filters.html", true, true);
     $tpl->setv("formtitle", "Работа с почтовыми фильтрами");
     $tpl->show();
 }
 function index($params)
 {
     $subcategory = DB_DataObject::factory("subcategory");
     $tpl = new template("includes/v");
     $tpl->load("subcategories.html", true, true);
     $tpl->setv("formtitle", "Работа с категориями");
     $tpl->show();
 }
 function index($params)
 {
     $tpl = new template("includes/v");
     $tpl->load("configs.html", true, true);
     $tpl->setv("formtitle", "Редактирование настроек");
     $json = new Services_JSON();
     $config = $json->decode(file::load("data/config.ini"));
     $tpl->setv(array("itemnum" => $config->itemnum, "daynum" => $config->daynum, "email" => $config->email, "emailpassword" => $config->emailpassword, "emailserver" => $config->emailserver, "outputdir" => $config->outputdir, "numthumbs" => $config->numthumbs, "logemail" => $config->logemail));
     $tpl->show();
 }
示例#6
0
文件: services.php 项目: laiello/xiv
 function send_template_mail($to, $subject, $template, $headers = null)
 {
     $this->using('template');
     $param =& $this->using('param');
     $tpl = new template();
     $template = explode('/', $template);
     $tpl->load(TM_TEMPLATES_DIR . C_TEMPLATE . '/layout/views/' . $template[0] . '/' . $template[1]);
     $tpl->set($param->get_params(), true);
     $message = $tpl->output();
     $this->send_mail($to, $subject, $message, null, $headers);
 }
示例#7
0
 /**
  * Processes a template and display the output.
  *
  * @param   string          $view_file
  * @param   array           $tpl_vars  (Optional)
  * @return  string
  */
 public function display($view_file, $tpl_vars = null)
 {
     if (file_exists($this->_P . $view_file)) {
         $body = file_get_contents($this->_P . $view_file);
         $body = str_replace('/VIEW_PATH/', $this->_P, $body);
         $this->_T->load($body);
         if (is_array($tpl_vars)) {
             $this->_T->set($tpl_vars);
         }
         $this->_T->display();
     }
 }
 function makeCategory($config, $subcategory)
 {
     print "Make subcategory {$subcategory['id']} page...\n";
     if (!is_dir($outputdir = "{$config->outputdir}/{$subcategory['folder']}")) {
         mkdir($outputdir);
     }
     $item = DB_DataObject::factory("item");
     $categDays = $item->getDays();
     $pager =& Pager::factory(array("mode" => "Jumping", "perPage" => $config->daynum, "delta" => 10, "itemData" => $categDays, "append" => false, "path" => "../", "fileName" => "{$subcategory['folder']}/index%d.html"));
     for ($i = 1; $i <= $pager->numPages(); $i++) {
         $tpl = new template();
         $tpl->load("templates/category.html", true, true);
         $tpl->setv("category_name", $subcategory["name"]);
         PagesGenerator::getCategories($tpl, "../");
         $data = $pager->getPageData($i);
         $links = $pager->getLinks($i);
         $tpl->setBlock("pages");
         $tpl->setv("pages", $links["all"]);
         foreach ($data as $day) {
             $res = $item->getItemsForDayCateg($subcategory["id"], $day[0], $config->itemnum);
             $res1 = $item->getItemsForDayCateg($subcategory["id"], $day[0], $config->itemnum, true);
             if (sizeof($res) == 0 && sizeof($res1) == 0) {
                 continue;
             }
             $tpl->setBlock("forday");
             $tpl->setv("date", date("Y-m-d", strtotime($day[0])));
             if (sizeof($res) > 0) {
                 foreach ($res as $row) {
                     $tpl->setBlock("rows");
                     $tpl->setv($row);
                     $tpl->parseBlock();
                 }
             }
             if (sizeof($res1) > 0) {
                 $numthumbs = 0;
                 foreach ($res1 as $row) {
                     $tpl->setBlock("thumb");
                     $tpl->setv($row);
                     $tpl->parseBlock();
                     if (++$numthumbs >= $config->numthumbs) {
                         $tpl->parse("rowthumbs");
                         $numthumbs = 0;
                     }
                 }
             }
             $tpl->parse("forday");
         }
         file::save("{$config->outputdir}/{$subcategory['folder']}/index{$i}.html", $tpl->get());
     }
 }
示例#9
0
 function login_form($message = "")
 {
     $tpl = new template("templates/");
     $tpl->load("login.html");
     $tpl->set_block("form");
     $tpl->set_variable("AppTitle", traducir_cadena("AppTitle"));
     $tpl->set_variable("AdminModule", traducir_cadena("AdminModule"));
     $tpl->set_variable("Institute", traducir_cadena("Institute"));
     $tpl->set_variable("WelcomeAdmin", traducir_cadena("WelcomeAdmin"));
     $tpl->set_variable("message", traducir_cadena($message));
     $tpl->set_variable("user", traducir_cadena("user"));
     $tpl->set_variable("password", traducir_cadena("password"));
     $tpl->parse_block("form");
     return $tpl->get();
 }
示例#10
0
 function login_form($message = "", $clave_examen = "")
 {
     $tpl = new template("templates/");
     $tpl->load("form.html");
     $tpl->set_block("form");
     $tpl->set_variable("AppTitle", traducir_cadena("AppTitle"));
     $tpl->set_variable("ExamModule", traducir_cadena("ExamModule"));
     $tpl->set_variable("Institute", traducir_cadena("Institute"));
     $tpl->set_variable("WelcomeExam", traducir_cadena("WelcomeExam"));
     $tpl->set_variable("Instructions", traducir_cadena("Instructions"));
     $tpl->set_variable("message", $message);
     $tpl->set_variable("txtsessionid", traducir_cadena("txtsessionid"));
     $sessionid = rand();
     $tpl->set_variable("randval", $sessionid);
     $tpl->set_variable("txtstudentid", traducir_cadena("txtstudentid"));
     $tpl->set_variable("txtidexamen", $clave_examen);
     $tpl->set_variable("txtquestionpaperid", traducir_cadena("txtquestionpaperid"));
     $tpl->set_variable("txtsubmit", traducir_cadena("txtsubmit"));
     $tpl->set_variable("txtreset", traducir_cadena("txtreset"));
     $tpl->set_variable("password", traducir_cadena("password"));
     $tpl->parse_block("form");
     return $tpl->get();
 }
示例#11
0
    $template->assign("SITE_TITLE", "Startseite");
    $tmpl = $template->display(true);
    $tmpl = $template->operators();
    echo $tmpl;
} else {
    // Handelt es sich um einen Link eines Moduls
    $module = new CHECK_MODULE($page);
    $check_module = $module->check();
    // Manuel angelegte Seite überprüfen
    $check_page = false;
    if ($check_module == false) {
        $check_page = $url_parser->check_page();
    }
    if ($check_module) {
        // Modul init.php laden und includen
        require_once $module->get_init();
    } elseif ($check_page) {
        $template = new template();
        $template->load($check_page);
        $tmpl = $template->display(true);
        $tmpl = $template->operators();
        echo $tmpl;
    } else {
        $template = new template();
        $template->load("404_error");
        $template->assign("SITE_TITLE", "Seite nicht gefunden");
        $tmpl = $template->display(true);
        $tmpl = $template->operators();
        echo $tmpl;
    }
}
示例#12
0
        $template->setFile('0_polls.tpl');
        $template->load('LIST_LINE');
        $template->tag('question', $poll_arr['poll_quest']);
        $template->tag('url', $poll_arr['poll_url']);
        $template->tag('all_votes', $poll_arr['all_votes']);
        $template->tag('participants', $poll_arr['poll_participants']);
        $template->tag('type', $poll_arr['poll_type']);
        $template->tag('start_date', $poll_arr['poll_start']);
        $template->tag('end_date', $poll_arr['poll_end']);
        $template = $template->display();
        $list_lines .= $template;
    }
    // Get Template
    $template = new \template();
    $template->setFile('0_polls.tpl');
    $template->load('LIST_BODY');
    $template->tag('polls', $list_lines);
    $template->tag('order_question', get_poll_list_order('question', $_GET['sort'], $_GET['order']));
    $template->tag('order_all_votes', get_poll_list_order('all_votes', $_GET['sort'], $_GET['order'], 0));
    $template->tag('order_participants', get_poll_list_order("participants", $_GET['sort'], $_GET['order'], 0));
    $template->tag('order_type', get_poll_list_order('type', $_GET['sort'], $_GET['order']));
    $template->tag('order_start_date', get_poll_list_order('start_date', $_GET['sort'], $_GET['order'], 0));
    $template->tag('order_end_date', get_poll_list_order('end_date', $_GET['sort'], $_GET['order'], 0));
    $template->tag('arrow_question', get_poll_list_arrows('question', $_GET['sort'], $_GET['order']));
    $template->tag('arrow_all_votes', get_poll_list_arrows('all_votes', $_GET['sort'], $_GET['order']));
    $template->tag('arrow_participants', get_poll_list_arrows('participants', $_GET['sort'], $_GET['order']));
    $template->tag('arrow_type', get_poll_list_arrows('type', $_GET['sort'], $_GET['order']));
    $template->tag('arrow_start_date', get_poll_list_arrows('start_date', $_GET['sort'], $_GET['order']));
    $template->tag('arrow_end_date', get_poll_list_arrows('end_date', $_GET['sort'], $_GET['order']));
    $template = $template->display();
}
示例#13
0
function run()
{
    global $user;
    global $layout;
    global $DB;
    global $website;
    $out = '';
    $item = new template();
    switch ($_REQUEST['act']) {
        case 'json':
        case 1:
            // json data retrieval & operations
            switch ($_REQUEST['oper']) {
                case 'del':
                    // remove rows
                    $ids = $_REQUEST['ids'];
                    foreach ($ids as $id) {
                        $item->load($id);
                        $item->delete();
                    }
                    echo json_encode(true);
                    break;
                default:
                    // list or search
                    // we have to merge the theme templates with the custom private templates (which are defined in the DB)
                    // as we don't expect a lot of templates, we will always return the whole dataset
                    // for this reason, paginate is useless
                    $orderby = $_REQUEST['sidx'] . ' ' . $_REQUEST['sord'];
                    if (isset($_REQUEST['quicksearch'])) {
                        $dataset = template::search($orderby, array('quicksearch' => $_REQUEST['quicksearch']));
                    } else {
                        $dataset = template::search($orderby);
                    }
                    $total = count($dataset);
                    $out = array();
                    $permissions = array(0 => '<img src="img/icons/silk/world.png" align="absmiddle" /> ' . t(69, 'Published'), 1 => '<img src="img/icons/silk/world_dawn.png" align="absmiddle" /> ' . t(70, 'Private'), 2 => '<img src="img/icons/silk/world_night.png" align="absmiddle" /> ' . t(81, 'Hidden'));
                    if (empty($dataset)) {
                        $rows = 0;
                    } else {
                        $rows = count($dataset);
                    }
                    for ($i = 0; $i < $rows; $i++) {
                        $out[$i] = array(0 => $dataset[$i]['id'], 1 => $dataset[$i]['title'], 2 => $dataset[$i]['theme'], 3 => $permissions[$dataset[$i]['permission']], 4 => $dataset[$i]['enabled'] == 1 ? '<img src="img/icons/silk/accept.png" />' : '<img src="img/icons/silk/cancel.png" />');
                    }
                    navitable::jqgridJson($out, 1, 0, PHP_INT_MAX, $total);
                    break;
            }
            core_terminate();
            break;
        case 'load':
        case 2:
            // edit/new form
            if (!empty($_REQUEST['id'])) {
                if (is_numeric($_REQUEST['id'])) {
                    $item->load(intval($_REQUEST['id']));
                } else {
                    $item->load_from_theme($_REQUEST['id']);
                }
            }
            if (isset($_REQUEST['form-sent'])) {
                $item->load_from_post();
                try {
                    $item->save();
                    if (!empty($_REQUEST['property-enabled'])) {
                        $enableds = array_values($_REQUEST['property-enabled']);
                    } else {
                        $enableds = array();
                    }
                    property::reorder("template", $item->id, $_REQUEST['template-properties-order'], $enableds);
                    $layout->navigate_notification(t(53, "Data saved successfully."), false, false, 'fa fa-check');
                } catch (Exception $e) {
                    $layout->navigate_notification($e->getMessage(), true, true);
                }
                users_log::action($_REQUEST['fid'], $item->id, 'save', $item->title, json_encode($_REQUEST));
            } else {
                users_log::action($_REQUEST['fid'], $item->id, 'load', $item->title);
            }
            $out = templates_form($item);
            break;
        case 'save_template_file':
            // save template html
            if (!empty($_REQUEST['id'])) {
                $item->load(intval($_REQUEST['id']));
            }
            $data = $_REQUEST['templates-file-edit-area'];
            $data = str_replace("\r\n", "\r", $data);
            $x = file_put_contents(NAVIGATE_PRIVATE . '/' . $website->id . '/templates/' . $item->file, $data);
            echo json_encode($x > 0);
            session_write_close();
            exit;
            break;
        case 4:
            // remove
            if (!empty($_REQUEST['id'])) {
                $item->load(intval($_REQUEST['id']));
                if ($item->delete() > 0) {
                    $layout->navigate_notification(t(55, 'Item removed successfully.'), false);
                    $out = templates_list();
                } else {
                    $layout->navigate_notification(t(56, 'Unexpected error.'), false);
                    $out = webdictionary_list();
                }
                users_log::action($_REQUEST['fid'], $item->id, $item->title, 'remove');
            }
            break;
        case 'template_property_load':
            $property = new property();
            if (!empty($_REQUEST['id'])) {
                if (is_numeric($_REQUEST['id'])) {
                    $property->load(intval($_REQUEST['id']));
                } else {
                    $property->load_from_theme($_REQUEST['id'], null, 'template', $_REQUEST['template']);
                }
            }
            header('Content-type: text/json');
            $types = property::types();
            $property->type_text = $types[$property->type];
            echo json_encode($property);
            session_write_close();
            exit;
            break;
        case 'template_property_save':
            // save property details
            $property = new property();
            if (!empty($_REQUEST['property-id'])) {
                $property->load(intval($_REQUEST['property-id']));
            }
            $property->load_from_post();
            $property->save();
            header('Content-type: text/json');
            $types = property::types();
            $property->type_text = $types[$property->type];
            echo json_encode($property);
            session_write_close();
            exit;
            break;
        case 'template_property_remove':
            // remove property
            $property = new property();
            if (!empty($_REQUEST['property-id'])) {
                $property->load(intval($_REQUEST['property-id']));
            }
            $property->delete();
            session_write_close();
            exit;
            break;
        case 0:
            // list / search result
        // list / search result
        default:
            $out = templates_list();
            break;
    }
    return $out;
}
/**
 * Parse special Navigate CMS tags like:
 * <ul>
 * <li>&lt;nv object="include" file="" id="" /&gt;</li>
 * <li>curly bracket tags {{nv object=""}}</li>
 * </ul>
 *
 * Generate the final HTML code for these special tags or convert them
 * to a simpler nv tags.
 *
 * @param $html
 * @return mixed
 */
function nvweb_template_parse_special($html)
{
    global $website;
    global $current;
    // find <pre> and <code> tags, save its contents and leave a placeholder to restore the content later
    $tags_pre = nvweb_tags_extract($html, 'pre', false, true, 'UTF-8');
    for ($t = count($tags_pre); $t--; $t >= 0) {
        $tag = $tags_pre[$t];
        if (empty($tag)) {
            continue;
        }
        $tag_uid = uniqid('nv-tags-pre-');
        $current['delayed_tags_pre'][$tag_uid] = $tag['full_tag'];
        $html = substr_replace($html, '<!--#' . $tag_uid . '#-->', $tag['offset'], strlen($tag['full_tag']));
    }
    $tags_code = nvweb_tags_extract($html, 'code', false, true, 'UTF-8');
    for ($t = count($tags_code); $t--; $t >= 0) {
        $tag = $tags_code[$t];
        if (empty($tag)) {
            continue;
        }
        $tag_uid = uniqid('nv-tags-code-');
        $current['delayed_tags_code'][$tag_uid] = $tag['full_tag'];
        $html = substr_replace($html, '<!--#' . $tag_uid . '#-->', $tag['offset'], strlen($tag['full_tag']));
    }
    $changed = false;
    // translate "{{nv object='list' " tags to "<nv object='list' " version
    preg_match_all("/{{nv\\s object=[\"']list[\"'] ([^}]+)}}/ixsm", $html, $curly_tags);
    for ($c = 0; $c < count($curly_tags[0]); $c++) {
        if (stripos($curly_tags[0], 'object="list"')) {
            $tmp = str_ireplace(array('{{nv object="list" ', '}}'), array('<nv object="list" ', '>'), $curly_tags[0][$c]);
            $html = str_ireplace($curly_tags[0][$c], $tmp, $html);
        } else {
            $tmp = str_ireplace(array("{{nv object='list' ", '}}'), array('<nv object="list" ', '>'), $curly_tags[0][$c]);
            $html = str_ireplace($curly_tags[0][$c], $tmp, $html);
        }
        $changed = true;
    }
    // translate "{{/nv}}" tags to "</nv>" version
    $html = str_ireplace('{{/nv}}', '</nv>', $html);
    // translate "{{nvlist_conditional }}" tags to "<nvlist_conditional >" version
    preg_match_all("/{{nvlist_conditional \\s([^}]+)}}/ixsm", $html, $curly_tags);
    for ($c = 0; $c < count($curly_tags[0]); $c++) {
        $tmp = str_replace(array('{{nvlist_conditional ', '}}'), array('<nvlist_conditional ', '>'), $curly_tags[0][$c]);
        $html = str_ireplace($curly_tags[0][$c], $tmp, $html);
        $changed = true;
    }
    // translate "{{/nvlist_conditional}}" tags to "</nvlist_conditional>" version
    $html = str_ireplace('{{/nvlist_conditional}}', '</nvlist_conditional>', $html);
    // translate "{{nv }}" tags to "<nv />" version
    preg_match_all("/{{nv\\s([^}]+)}}/ixsm", $html, $curly_tags);
    for ($c = 0; $c < count($curly_tags[0]); $c++) {
        $tmp = str_replace(array('{{nv ', '}}'), array('<nv ', ' />'), $curly_tags[0][$c]);
        $html = str_ireplace($curly_tags[0][$c], $tmp, $html);
        $changed = true;
    }
    // translate "{{nvlist }}" tags to "<nvlist />" version
    preg_match_all("/{{nvlist\\s([^}]+)}}/ixsm", $html, $curly_tags);
    for ($c = 0; $c < count($curly_tags[0]); $c++) {
        $tmp = str_replace(array('{{nvlist ', '}}'), array('<nvlist ', ' />'), $curly_tags[0][$c]);
        $html = str_ireplace($curly_tags[0][$c], $tmp, $html);
        $changed = true;
    }
    if ($changed) {
        return nvweb_template_parse_special($html);
    }
    // parse includes (we must do it before parsing list or search)
    $tags = nvweb_tags_extract($html, 'nv', true, true, 'UTF-8');
    foreach ($tags as $tag) {
        $content = '';
        $changed = false;
        $tag['length'] = strlen($tag['full_tag']);
        if ($tag['attributes']['object'] == 'include') {
            $tid = $tag['attributes']['id'];
            $file = $tag['attributes']['file'];
            if (!empty($tid)) {
                $template = new template();
                $template->load($tid);
                if ($template->website == $website->id) {
                    $content = file_get_contents(NAVIGATE_PRIVATE . '/' . $website->id . '/templates/' . $template->file);
                }
            } else {
                if (!empty($file)) {
                    $content = file_get_contents(NAVIGATE_PATH . '/themes/' . $website->theme . '/' . $file);
                }
            }
            $html = substr_replace($html, $content, $tag['offset'], $tag['length']);
            $changed = true;
        }
        // if an object="include" has been found, we need to restart the parse_special tags function
        // as it may contain other "includes" or "{{nv" tags that need transformation
        if ($changed) {
            $html = nvweb_template_parse_special($html);
            break;
        }
    }
    return $html;
}
示例#15
0
<?php

ini_set('display_errors', 'on');
//informe d'errores
error_reporting(E_ALL);
include 'config.php';
require 'sys/helper.php';
//Session::ini_session();
$conf = Registry::getInstance();
$conf->Welcome = 'Hola';
//set
$msg = $conf->Welcome;
//get
unset($conf->Welcome);
//Coder::codear($conf);
template::load('home');
Core::init();
//crear class registry per tenir acces
//a traves fr sigleton
//a la configuració de l'aplicació
//al fitxer config.json en app
示例#16
0
function run()
{
    global $user;
    global $layout;
    global $DB;
    global $website;
    global $theme;
    $out = '';
    $item = new structure();
    switch ($_REQUEST['act']) {
        case 'load':
        case 'edit':
        case 2:
            // edit/new form
            if (!empty($_REQUEST['id'])) {
                $item->load(intval($_REQUEST['id']));
            }
            if (isset($_REQUEST['form-sent'])) {
                $item->load_from_post();
                try {
                    $item->save();
                    property::save_properties_from_post('structure', $item->id);
                    $item = $item->reload();
                    // reorder associated category elements
                    if (!empty($_POST['elements-order'])) {
                        $response = item::reorder($_POST['elements-order']);
                        if ($response !== true) {
                            throw new Exception($response);
                        }
                    }
                    $layout->navigate_notification(t(53, "Data saved successfully."), false, false, 'fa fa-check');
                } catch (Exception $e) {
                    $layout->navigate_notification($e->getMessage(), true, true);
                }
                if (!empty($item->id)) {
                    users_log::action($_REQUEST['fid'], $item->id, 'save', $item->dictionary[$website->languages_list[0]]['title'], json_encode($_REQUEST));
                }
            } else {
                if (!empty($item->id)) {
                    users_log::action($_REQUEST['fid'], $item->id, 'load', $item->dictionary[$website->languages_list[0]]['title']);
                }
            }
            $out = structure_form($item);
            break;
        case 3:
        case "reorder":
            $ok = structure::reorder($_REQUEST['parent'], $_REQUEST['children_order']);
            echo json_encode($ok);
            core_terminate();
            break;
        case "homepager":
            $node = $_REQUEST['node'];
            $website->homepage = $node;
            $ok = $website->save();
            echo json_encode($ok);
            core_terminate();
            break;
        case 4:
        case "remove":
            if (!empty($_REQUEST['id'])) {
                $item->load(intval($_REQUEST['id']));
                if ($item->delete() > 0) {
                    $layout->navigate_notification(t(55, 'Item removed successfully.'), false);
                    $structure = structure::hierarchy(-1);
                    // root level (0) including Web node (-1)
                    $out = structure_tree($structure);
                    users_log::action($_REQUEST['fid'], $item->id, 'remove');
                } else {
                    $layout->navigate_notification(t(56, 'Unexpected error.'), false);
                    $out = structure_form($item);
                }
            }
            break;
        case 95:
            // free path checking
            $path = $_REQUEST['path'];
            $id = $_REQUEST['id'];
            $DB->query('SELECT type, object_id, lang
	 					  FROM nv_paths
						 WHERE path = ' . protect($path) . '
						   AND website = ' . $website->id);
            $rs = $DB->result();
            echo json_encode($rs);
            core_terminate();
            break;
        case "category_path":
            // return category paths
            echo json_encode(path::loadElementPaths('structure', intval($_REQUEST['id'])));
            core_terminate();
            break;
        case 'json_find_item':
            // find items by its title
            // the items must have its own path (free OR not embedded to a category)
            $DB->query('
				SELECT SQL_CALC_FOUND_ROWS nvw.node_id as id, nvw.text as text
				  FROM nv_webdictionary nvw, nv_items nvi
				 WHERE nvw.node_type = "item"
				   AND nvw.node_id = nvi.id
				   AND nvw.subtype = "title"
				   AND (	nvi.association = "free" OR
				            (nvi.association = "category" AND nvi.embedding=0)
				   )
				   AND nvw.lang = ' . protect($_REQUEST['lang']) . '
				   AND nvw.website = ' . $website->id . '
				   AND nvw.website = nvi.website
				   AND nvw.text LIKE ' . protect('%' . $_REQUEST['title'] . '%') . '
		      ORDER BY nvw.text ASC
			     LIMIT ' . intval($_REQUEST['page_limit']) . '
			     OFFSET ' . max(0, intval($_REQUEST['page_limit']) * (intval($_REQUEST['page']) - 1)), 'array');
            $rows = $DB->result();
            $total = $DB->foundRows();
            echo json_encode(array('items' => $rows, 'totalCount' => $total));
            core_terminate();
            break;
        case "search_by_title":
            // json search title request (for "copy from" properties dialog)
            $DB->query('
				SELECT node_id as id, text as label, text as value
					  FROM nv_webdictionary
					 WHERE node_type = "structure"
					   AND subtype = "title"
					   AND lang = ' . protect($_REQUEST['lang']) . '
					   AND website = ' . $website->id . '
					   AND text LIKE ' . protect('%' . $_REQUEST['title'] . '%') . '
			      ORDER BY text ASC
				     LIMIT 30', 'array');
            echo json_encode($DB->result());
            core_terminate();
            break;
        case "copy_from_template_zones":
            // return template properties for a structure id
            $item = new structure();
            $item->load(intval($_REQUEST['id']));
            $template = new template();
            $template->load($item->template);
            $zones = array();
            for ($ps = 0; $ps < count($template->properties); $ps++) {
                // ignore non structure properties
                if (!isset($template->properties[$ps]->element) || $template->properties[$ps]->element != 'structure') {
                    continue;
                }
                // ignore non-textual properties
                if (!in_array($template->properties[$ps]->type, array("text", "textarea", "rich_textarea"))) {
                    continue;
                }
                $title = $template->properties[$ps]->name;
                if (!empty($theme)) {
                    $title = $theme->t($title);
                }
                $zones[] = array('type' => 'property', 'code' => $template->properties[$ps]->id, 'title' => $title);
            }
            echo json_encode($zones);
            core_terminate();
            break;
        case "raw_zone_content":
            // return raw item contents
            if ($_REQUEST['zone'] == 'property') {
                $DB->query('SELECT text
							  FROM nv_webdictionary
							 WHERE node_type = "property-structure"
							   AND subtype = ' . protect('property-' . $_REQUEST['section'] . '-' . $_REQUEST['lang']) . '
							   AND lang = ' . protect($_REQUEST['lang']) . '
							   AND website = ' . $website->id . '
							   AND node_id = ' . protect($_REQUEST['node_id']), 'array');
                $data = $DB->first();
                echo $data['text'];
            }
            core_terminate();
            break;
        case 'votes_reset':
            webuser_vote::remove_object_votes('structure', intval($_REQUEST['id']));
            echo 'true';
            core_terminate();
            break;
        case 'votes_by_webuser':
            if ($_POST['oper'] == 'del') {
                $ids = explode(',', $_POST['id']);
                for ($i = 0; $i < count($ids); $i++) {
                    if ($ids[$i] > 0) {
                        $vote = new webuser_vote();
                        $vote->load($ids[$i]);
                        $vote->delete();
                    }
                }
                webuser_vote::update_object_score('structure', $vote->object_id);
                echo 'true';
                core_terminate();
            }
            $max = intval($_GET['rows']);
            $page = intval($_GET['page']);
            $offset = ($page - 1) * $max;
            if ($_REQUEST['_search'] == 'false') {
                list($dataset, $total) = webuser_vote::object_votes_by_webuser('structure', intval($_REQUEST['id']), $_REQUEST['sidx'] . ' ' . $_REQUEST['sord'], $offset, $max);
            }
            $out = array();
            for ($i = 0; $i < count($dataset); $i++) {
                if (empty($dataset[$i])) {
                    continue;
                }
                $out[$i] = array(0 => $dataset[$i]['id'], 1 => core_ts2date($dataset[$i]['date'], true), 2 => $dataset[$i]['username']);
            }
            navitable::jqgridJson($out, $page, $offset, $max, $total);
            core_terminate();
            break;
        case 0:
            // tree / search result
        // tree / search result
        default:
            $structure = structure::hierarchy(-1);
            // root level (0) including Web node (-1)
            $out = structure_tree($structure);
            break;
    }
    return $out;
}
示例#17
0
 function __construct()
 {
     parent::__construct();
     //echo 'vista creada';
     $this->template = template::load('home');
 }
示例#18
0
            $poll_arr['poll_type3'] = '[]';
        }
        // Get Template
        $template = new \template();
        $template->setFile('0_polls.tpl');
        $template->load('APPLET_POLL_ANSWER_LINE');
        $template->tag('answer_id', $answer_arr['answer_id']);
        $template->tag('answer', $answer_arr['answer']);
        $template->tag('type', $poll_arr['poll_type2']);
        $template->tag('multiple', $poll_arr['poll_type3']);
        $template = $template->display();
        $antworten .= $template;
    }
    // Get Template
    $template = new \template();
    $template->setFile('0_polls.tpl');
    $template->load('APPLET_POLL_BODY');
    $template->tag('poll_id', $poll_arr['poll_id']);
    $template->tag('question', $poll_arr['poll_quest']);
    $template->tag('answers', $antworten);
    $template->tag('type', $poll_arr['poll_type_text']);
    $template = $template->display();
} else {
    // Get Template
    $template = new \template();
    $template->setFile('0_polls.tpl');
    $template->load('APPLET_NO_POLL');
    $template = $template->display();
}
echo $template;
unset($template);
示例#19
0
 public function load_template()
 {
     global $DB;
     global $website;
     $template = new template();
     if ($this->association == 'free' || $this->association == 'category' && $this->embedding == '0') {
         $template->load($this->template);
     } else {
         $category_template = $DB->query_single('template', 'nv_structure', ' id = ' . protect($this->category) . ' AND website = ' . $website->id);
         $template->load($category_template);
     }
     return $template;
 }
示例#20
0
<?php

ini_set('display_errors', 'on');
//activamos la comprobacion errores
error_reporting(E_ALL);
include 'config.php';
require 'sys/helper.php';
//echo $_SERVER['REQUEST_URI'];
session::session_ini();
$id = session::get('id');
//Coder::code($id);
$conf = registry::getInstance();
$conf->welcome = 'Hola';
//__set
$msg = $conf->welcome;
//__get
unset($conf->welcome);
//Coder::codear($msg);
//Coder::codear($conf);
template::load("article");
core::init();
?>

<!--

//crear footer.php en tpl y cargar $contents(body) Template::load("vista"); esta ruta tiene el body
//si queremos cambiar otra vista template $this->tpl = Template::load("vista");
//en pub estaran los css y sacaremos una ruta para sacar dichas css

-->
示例#21
0
文件: common.php 项目: laiello/xiv
 protected function render($overwrite = false)
 {
     $param =& $this->using('param');
     if ($overwrite || !isset($this->rendered)) {
         $this->rendered = '';
     }
     if (file_exists($this->template_file . '.tpl')) {
         $tpl = new template();
         $tpl->load($this->template_file);
         $tpl->set($param->get_params(), null, false);
         $this->rendered .= $tpl->output();
     } else {
         trigger_error('Block template \'' . $this->template_file . '\' is missing.', E_USER_ERROR);
     }
     return $this->rendered;
 }
示例#22
0
/**
 * Erstellt den Karteireiter zum Eintragen des Contents
 * 
 * Hier wird Aufgrund der XSD Vorlage des Templates ein Formular erstellt und mit den
 * entsprechenden Werten des XML Files vorausgefuellt. 
 * 
 */
function print_content()
{
    global $content_id, $sprache, $version, $user, $rechte, $filterstr;
    $content = new content();
    if (!$content->getContent($content_id, $sprache, $version)) {
        die($content->errormsg);
    }
    if ($content->gesperrt_uid != '' && $content->gesperrt_uid != $user) {
        $content->getSperrLog($content->contentsprache_id);
        echo "Dieser Content ist gesperrt von {$content->uid} seit {$content->start}!";
        if ($rechte->isBerechtigt('basis/cms_sperrfreigabe', null, 'su')) {
            echo '<br><br><form action="' . $_SERVER['PHP_SELF'] . '?content_id=' . $content_id . '&contentsprache_id=' . $content->contentsprache_id . '&sprache=' . $sprache . '&version=' . $version . '&action=content&method=content_sperrfreigabe&filter=' . implode(' ', $filterstr) . '" method="POST">';
            echo '<input type="submit" value="Freigabe erzwingen" name="freigeben">';
            echo '</form>';
        }
        return 0;
    }
    echo '<form action="' . $_SERVER['PHP_SELF'] . '?content_id=' . $content_id . '&contentsprache_id=' . $content->contentsprache_id . '&sprache=' . $sprache . '&version=' . $version . '&action=content&method=content_sperre&filter=' . implode(' ', $filterstr) . '" method="POST">';
    if ($content->gesperrt_uid == '') {
        echo '<input type="submit" value="Zur Bearbeitung sperren" name="sperren">';
    } else {
        echo '<input type="submit" value="Sperre Freigeben" name="freigeben">';
    }
    echo '</form>';
    if ($content->gesperrt_uid != '' && $content->gesperrt_uid == $user) {
        echo '<div>';
        $template = new template();
        $template->load($content->template_kurzbz);
        $xfp = new XSDFormPrinter();
        $xfp->getparams = '?content_id=' . $content_id . '&sprache=' . $sprache . '&version=' . $version . '&action=content&filter=' . implode(' ', $filterstr) . '';
        $xfp->output($template->xsd, $content->content);
        echo '</div>';
    }
    echo '
	<br>
	<h3>Vorschau</h3>';
    if ($content->sichtbar != true) {
        echo '<p style="color:red">(Unsichtbar im Livesystem)</p>';
    }
    //Bei Redirects wird die Vorschau nicht im IFrame gezeigt, da durch eventuelles weiterleiten durch
    // Javascript in der Vorschau die CMS Seite geschlossen wird.
    if ($content->template_kurzbz == 'redirect') {
        echo '<a href="content.php?content_id=' . $content_id . '&version=' . $version . '&sprache=' . $sprache . '&sichtbar&filter=' . implode(' ', $filterstr) . '" target="_blank">Vorschau in eigenem Fenster öffnen</a>';
    } else {
        echo '<iframe src="content.php?content_id=' . $content_id . '&version=' . $version . '&sprache=' . $sprache . '&filter=' . implode(' ', $filterstr) . '&sichtbar" style="width: 800px; height: 500px; border: 1px solid black;">';
    }
}