Exemplo n.º 1
0
 function onEcho(&$PAGE)
 {
     if ($this->parent->layout == 2 || $this->parent->servingFile) {
         return;
     }
     # don't mess with ajax
     # Happens just after the template has been parsed (note it received the page as a STRING now), after this, is ECHO and DIE
     ###### -> Construct should add this module to the onEcho array
     if (!$this->devDisable) {
         $thereAreErrors = false;
         if ($this->devCheckHTML || isset($_REQUEST['dev_test'])) {
             if (!function_exists('checkHTML')) {
                 include CONS_PATH_INCLUDE . "checkHTML.php";
             }
             $log = checkHTML($PAGE, false);
             if (count($log) > 0) {
                 $thereAreErrors = true;
                 $this->log[] = implode("<br/>", $log);
                 // for dev_test
             }
             unset($log);
         }
         if (isset($_REQUEST['dev_test'])) {
             if (count($this->parent->log) > 0 || count($this->parent->warning) > 0) {
                 # failed basic test , log it
                 $_SESSION['affbidevut'][2][] = $this->parent->context_str . $this->parent->action . " Reports errors:";
                 foreach ($this->parent->log as $log) {
                     $_SESSION['affbidevut'][2][] = $log;
                 }
                 foreach ($this->parent->warning as $log) {
                     $_SESSION['affbidevut'][2][] = $log;
                 }
             }
             $this->unitTest();
         } else {
             $qs = $this->parent->action . ".html?" . arrayToString(false, array("login", "gfc", "haveinfo", "password", "debugmode", "nosession", "nocache", "dev_html"));
             $totalTime = scriptTime() * 1000;
             // ###############################---
             // ## This is the info strip that stays on top of the site:
             array_unshift($this->log, number_format($totalTime, 2) . "ms (" . CONS_AFF_DATABASECONNECTOR . ": " . number_format($this->parent->dbo->dbt, 2) . "ms, framework: " . number_format($this->overheadTime, 2) . " ms), SQL(s): " . $this->parent->dbo->dbc . ", caches: " . number_format($this->parent->cachetime / 1000) . "ms main, " . number_format($this->parent->cachetimeObj / 1000) . "ms obj" . (isset($this->parent->storage['CORE_CACHECONTROL']) ? " avg: " . number_format($this->parent->storage['CORE_CACHECONTROL'][0] / 1000) . "s factor " . number_format($this->parent->storage['CORE_CACHECONTROL'][1], 2) : "") . " (" . $_SESSION[CONS_SESSION_LANG] . ") (" . ($this->devCheckHTML ? "<a style='color:#" . $this->textColor . "' href='{$qs}&dev_html=0'><strong>checkHTML</strong> is on</a>" : "<a style='color:#" . $this->textColor . "' href='{$qs}&dev_html=1'><strong>checkHTML</strong> is off</a>") . ") (" . ($thereAreErrors ? "<strong><a style='color:#" . $this->textColor . "' href='?dev_log=1'>Errors!</a></strong>" : "no errors") . ") (<a style='color:#" . $this->textColor . "' href='?debugmode=true&nosession=true&nocache=true'>RESET</a>)" . " (<a style='color:#" . $this->textColor . "' href='?dev_help=1'>DEVELOPER OPTIONS</a>) (<a style='color:#" . $this->textColor . "' href=\"" . $qs . "&dev_disable=1\">disable</a>)" . ($this->parent->cacheControl->contentFromCache ? " CACHED CONTENT" : ""));
             // ###############################---
             $pl = strlen($PAGE);
             $tp = new CKTemplate();
             $tp->fetch(CONS_PATH_SYSTEM . "plugins/" . $this->name . "/payload/overlay.html");
             $tp->assign("AFFBIDEV_CONTENT", implode("<br/>", $this->log) . (count($this->parent->warning) != 0 ? "<br/>Warnings:" . implode("<br/>", $this->parent->warning) : ""));
             $arrowColor = $this->parent->cacheControl->contentFromCache ? "#000099" : ($thereAreErrors ? "#BB0000" : "#000000");
             $tp->assign("ARROWCOLOR", $arrowColor);
             $tp->assign("ARROWSIZE", $thereAreErrors ? 20 : 12);
             $PAGE = str_replace("</body>", $tp->techo() . "</body>", $PAGE);
             if (strlen($PAGE) == $pl) {
                 $this->log[] = "WARNING: no /body on page";
                 $PAGE .= $tp->techo();
             }
             $PAGE .= "<!-- bi_dev output logs. To stop this output, disable bi_dev";
             $PAGE .= "\nDbLOG:\n" . implode("\n", $this->parent->dbo->log);
             $C = $_SESSION;
             unset($C['prescia_cache']);
             // the cache can contain whole HTML that would cause havok
             $PAGE .= "\n" . print_r($C, 1) . "\n";
             $PAGE .= "-->";
         }
     }
 }
Exemplo n.º 2
0
<?php

if (!$core->authControl->checkPermission('bi_adm', 'can_monitor')) {
    $core->fastClose(403);
}
// We use the same scripts as in the list.html to handle ajax lists, get them
$listHTML = new CKTemplate($core->template);
$listHTML->fetch(CONS_PATH_SYSTEM . "plugins/" . $this->name . "/payload/template/list.html");
$core->template->assign("commonscript", $listHTML->get("_commonScripts"));
unset($listHTML);
$monitorXML = $this->getMonitorArray();
$monitorTP = $core->template->get("_monitorLists");
$temp = "";
$getOnlyThis = isset($_REQUEST['filter']) && is_numeric($_REQUEST['filter']) ? $_REQUEST['filter'] : -1;
if (is_array($monitorXML)) {
    // 	now perform sql queries COUNTING items we are monitoring
    $c = 0;
    foreach ($monitorXML as $monitoredItem) {
        if ($getOnlyThis == -1 || $getOnlyThis == $c) {
            if (!isset($monitoredItem['monitor_level'])) {
                $monitoredItem['monitor_level'] = 'low';
            }
            $outputData = array("frommonitor" => $c, "module" => $monitoredItem['module'], "level" => $monitoredItem['monitor_level'], "title" => isset($monitoredItem['monitor_text_plural']) ? $monitoredItem['monitor_text_plural'] : (isset($monitoredItem['monitor_text']) ? $monitoredItem['monitor_text'] : $monitoredItem['module']));
            $temp .= $monitorTP->techo($outputData);
        }
        $c++;
    }
    $core->template->assign("_monitorLists", $temp);
}
Exemplo n.º 3
0
function echoCalendar(&$containerTP, $width = 0, $month = 0, $year = 0, $highlights = array(), $dayborder = 0, $prevquery = "", $nextquery = "", $divname = "inlinecalendar")
{
    /*
      width should be divisible by 7
      highlights is an array, each with the following:
     	'day' => # day
     	'title' => title on the cell (if nothing, will use the day #)
     	'link' => link if click on the cell (if nothing, no link)
     	'class' => (optional) class for the cell
      dayborder is the number in pixels of border (+margin +padding) you will use on each cell
    */
    $tp = new CKTemplate($containerTP);
    if (!is_file(CONS_PATH_SETTINGS . "defaults/calendar.html")) {
        return "echoCalendar: File not found";
    }
    $tp->fetch(CONS_PATH_SETTINGS . "defaults/calendar.html");
    if ($month == 0) {
        $month = date("m");
    }
    if ($year == 0) {
        $year = date("Y");
    }
    $width = 7 * floor($width / 7);
    $widthDay = floor($width / 7) - 2 * $dayborder;
    $month = (int) $month;
    $year = (int) $year;
    if ($year < 100) {
        $year += 2000;
    }
    if ($month < 10) {
        $month = "0" . $month;
    }
    $initDay = $year . "-" . $month . "-01";
    $endDate = datecalc($initDay, 0, 1);
    $monthLine = $tp->get("_line");
    $dayTp = $tp->get("_day");
    $temp = "";
    // <-- main
    $tempL = "";
    // <-- a line
    $column = date("w", tomktime($initDay));
    // where this month starts
    $today = date("Y-m-d");
    $daysOnPreviousMonth = $column;
    while ($daysOnPreviousMonth > 0) {
        $tempL .= $dayTp->techo(array('class' => 'calendarDayEmpty', "title" => "&nbsp;", "widthday" => $widthDay));
        $daysOnPreviousMonth--;
    }
    while (datecompare($endDate, $initDay)) {
        // while we are within the month (loop will increase initDay)
        $isWeekend = $column == 0 || $column == 6;
        $isToday = $initDay == $today;
        $day = substr($initDay, 8, 2);
        // the following line will put the appropriate class on the day depending on start/end of the project, weekend or deadline
        $output = array("class" => $isToday ? "calendarDayToday" : ($isWeekend ? "calendarDayWeekend" : "calendarDayNormal"), "title" => (int) $day, "widthday" => $widthDay);
        // now we check if we have a highlight
        foreach ($highlights as $high) {
            if ($high['day'] == $day) {
                $output['class'] = isset($high['class']) && $high['class'] != '' ? $high['class'] : "calendarDayHighlight";
                $output['title'] = isset($high['title']) ? $high['title'] : (int) $day;
                if (isset($high['link']) && $high['link'] != '') {
                    $output['title'] = "<a href=\"" . $high['link'] . "\">" . $output['title'] . "</a>";
                }
            }
        }
        $tempL .= $dayTp->techo($output);
        if ($column == 6) {
            // end of a line
            $temp .= $monthLine->techo(array("_day" => $tempL));
            // <-- echo line
            $tempL = "";
        }
        $column++;
        if ($column >= 7) {
            $column = 0;
        }
        $initDay = datecalc($initDay, 0, 0, 1);
    }
    if ($column != 0) {
        // we might not have finished the last line ... check it:
        for ($column = $column; $column < 7; $column++) {
            $tempL .= $dayTp->techo(array('class' => 'calendarDayEmpty', "title" => "", "widthday" => $widthDay));
        }
        $temp .= $monthLine->techo(array("_day" => $tempL));
        // <-- echo line
        $tempL = "";
    }
    $tp->assign("width", $width);
    $tp->assign("month", $month);
    $tp->assign("year", $year);
    $tp->assign("widthday", $widthDay);
    $tp->assign("_line", $temp);
    $tp->assign("calendar", $divname);
    if ($prevquery != '' && $nextquery != '') {
        $tp->assign("ajaxcommandprev", $prevquery);
        $tp->assign("ajaxcommandnext", $nextquery);
    } else {
        $tp->assign("_prevnext");
    }
    return $tp->techo();
}
Exemplo n.º 4
0
 function showTemplate()
 {
     if (count($this->log) > 0) {
         $output = "";
         foreach ($this->log as $saida) {
             $output .= $saida . "\n<br/>";
         }
         $file = $this->debugFile;
         if ($this->debugFile == '' || !is_file($file)) {
             if (is_file(CONS_PATH_PAGES . $_SESSION['CODE'] . "/template/_debugarea.html")) {
                 $file = CONS_PATH_PAGES . $_SESSION['CODE'] . "/template/_debugarea.html";
             } else {
                 $file = CONS_PATH_SETTINGS . "defaults/_debugarea.html";
             }
         }
         $tp = new CKTemplate($this->template);
         $tp->fetch($file);
         $tp->assign("CORE_DEBUG", $output);
         $tp->assign("CORE_DEBUGWARNING", $this->loglevel);
         // CONS_LOGGING_...
         $this->template->constants['CORE_DEBUG'] = $tp->techo();
         unset($tp);
     }
     if (!is_object($this->template) || get_class($this->template) != "CKTemplate") {
         return;
         // huh, no template? oh well
     }
     # Echo dimconfig if something should be outputed
     $data = $this->cacheControl->getCachedContent('dimconfig_auto');
     if ($data === false) {
         $data = $this->dimconfig;
         $dimconfigMD = unserialize(cReadFile(CONS_PATH_CACHE . $_SESSION['CODE'] . "/meta/_dimconfig.dat"));
         foreach ($data as $name => $content) {
             if (isset($dimconfigMD[$name])) {
                 if ($dimconfigMD[$name][CONS_XML_TIPO] == CONS_TIPO_UPLOAD) {
                     $FirstfileName = CONS_FMANAGER . $dimconfigMD[$name]['location'];
                     $path = explode("/", $FirstfileName);
                     $fileName = array_pop($path);
                     $path = implode("/", $path) . "/";
                     $hasFile = locateAnyFile($FirstfileName, $ext);
                     if (isset($dimconfigMD[$name][CONS_XML_THUMBNAILS])) {
                         // images
                         $imgs = count($dimconfigMD[$name][CONS_XML_THUMBNAILS]);
                         for ($c = 1; $c <= $imgs; $c++) {
                             $fnamedata = $name . "_" . $c;
                             $data[$fnamedata] = $FirstfileName;
                             $data[$fnamedata . "w"] = "";
                             $data[$fnamedata . "h"] = "";
                             $data[$fnamedata . "t"] = "";
                             $data[$fnamedata . "tr"] = "";
                             $data[$fnamedata . "s"] = "";
                             if ($hasFile) {
                                 $data[$fnamedata] = $FirstfileName;
                                 $popped = explode("/", $FirstfileName);
                                 $data[$fnamedata . "filename"] = array_pop($popped);
                                 if (in_array(strtolower($ext), array("jpg", "gif", "png", "jpeg", "swf"))) {
                                     // image/flash
                                     $h = getimagesize($FirstfileName);
                                     $data[$fnamedata . "w"] = $h[0];
                                     $data[$fnamedata . "h"] = $h[1];
                                     $data[$fnamedata . "s"] = humanSize(filesize($FirstfileName));
                                     if (in_array(strtolower($ext), array("jpg", "gif", "png", "jpeg"))) {
                                         $data[$fnamedata . "t"] = "<img src=\"" . $FirstfileName . "\" width='" . $h[0] . "' height='" . $h[1] . "' alt='' />";
                                         $data[$fnamedata . "tr"] = "<img src=\"" . $FirstfileName . "\" width='100%' height='100%' alt='' />";
                                     } else {
                                         if (strtolower($ext) == "swf") {
                                             $data[$fnamedata . "t"] = str_replace("{FILE}", $FirstfileName, str_replace("{H}", $h[1], str_replace("{W}", $h[0], SWF_OBJECT)));
                                             $data[$fnamedata . "tr"] = $data[$fnamedata . "t"];
                                         }
                                     }
                                 }
                             }
                         }
                     } else {
                         if ($hasFile) {
                             $fnamedata = $name . "_1";
                             $data[$fnamedata] = $FirstfileName;
                             $data[$fnamedata . "s"] = humanSize(filesize($FirstfileName));
                             $popped = explode("/", $FirstfileName);
                             $data[$fnamedata . "filename"] = array_pop($popped);
                         } else {
                             $fnamedata = $name . "_1";
                             $data[$fnamedata] = "";
                             $data[$fnamedata . "t"] = "";
                             $data[$fnamedata . "tr"] = "";
                             $data[$fnamedata . "s"] = "";
                         }
                     }
                     $this->template->fill($data);
                 } else {
                     $data[$name] = $content;
                 }
             } else {
                 $data[$name] = $content;
             }
         }
         $this->cacheControl->addCachedContent('dimconfig_auto', $data, true);
     }
     $this->template->fill($data);
     $this->template->constants['CHARSET'] = $this->charset;
     if ($this->doctype == "html" || CONS_BROWSER == "IE" && CONS_BROWSER_VERSION < 9) {
         $this->template->assign("_DOCTYPEXML");
     }
     # metadata - fill default values if not set yet (plugins can set)
     if ($this->layout != 2) {
         if ((!isset($this->template->constants['METAKEYS']) || $this->template->constants['METAKEYS'] == '') && $this->dimconfig['metakeys'] != '') {
             $this->template->constants['METAKEYS'] = $this->dimconfig['metakeys'];
         }
         if ((!isset($this->template->constants['METADESC']) || $this->template->constants['METADESC'] == '') && $this->dimconfig['metadesc'] != '') {
             $this->template->constants['METADESC'] = $this->dimconfig['metadesc'];
         }
         // METAS
         if ($this->template->constants['CANONICAL'] == '') {
             $this->template->constants['CANONICAL'] = "http://" . $_SESSION['CANONICAL'] . $this->context_str . $this->action . ".html";
             if (isset($_REQUEST['id'])) {
                 $this->template->constants['CANONICAL'] .= "?id=" . $_REQUEST['id'];
             }
         }
         $metadata = $this->template->constants['METATAGS'];
         if (CONS_PATH_PAGES . $_SESSION['CODE'] . "/template/_meta.xml") {
             $metadata .= cReadFile(CONS_PATH_PAGES . $_SESSION['CODE'] . "/template/_meta.xml");
         }
         $metadata .= "\t<link rel=\"canonical\" href=\"" . $this->template->constants['CANONICAL'] . "\" />\n";
         if ($this->template->constants['METAKEYS'] != '') {
             $metadata .= "\t<meta name=\"keywords\" content=\"" . str_replace("\"", "", $this->template->constants['METAKEYS']) . "\"/>\n";
         }
         if ($this->template->constants['METADESC'] != '') {
             $metadata .= "\t<meta name=\"description\" content=\"" . str_replace("\"", "", $this->template->constants['METADESC']) . "\"/>\n";
             $metadata .= "\t<meta property=\"og:description\" content=\"" . str_replace("\"", "", $this->template->constants['METADESC']) . "\"/>\n";
         }
         $metadata .= "\t<meta property=\"og:type\" content=\"website\" />\n";
         $metadata .= "\t<meta property=\"og:title\" content=\"" . str_replace("\"", "", $this->template->constants['PAGE_TITLE']) . "\" />\n";
         $metadata .= "\t<meta property=\"og:url\" content=\"" . $this->template->constants['CANONICAL'] . "\" />\n";
         if (isset($this->template->constants['METAFIGURE']) && $this->template->constants['METAFIGURE'] != "") {
             if ($this->template->constants['METAFIGURE'][0] != '/') {
                 $this->template->constants['METAFIGURE'] = "/" . $this->template->constants['METAFIGURE'];
             }
             $metadata .= "\t<meta property=\"og:image\" content=\"http://" . $_SESSION['CANONICAL'] . $this->template->constants['METAFIGURE'] . "\" />\n";
             $metadata .= "\t<link rel=\"image_src\" href=\"http://" . $_SESSION['CANONICAL'] . $this->template->constants['METAFIGURE'] . "\" />\n";
         }
         $favfile = CONS_PATH_PAGES . $_SESSION['CODE'] . "/files/favicon";
         if (locateFile($favfile, $ext)) {
             $favfile = CONS_INSTALL_ROOT . $favfile;
             $metadata .= "\t<link rel=\"shortcut icon\" href=\"/favicon." . $ext . "\" />\n";
         } else {
             if (CONS_DEFAULT_FAVICON) {
                 $favfile = "favicon";
                 if (locateFile($favfile, $ext)) {
                     $favfile = CONS_INSTALL_ROOT . $favfile;
                     $metadata .= "\t<link rel=\"shortcut icon\" href=\"/favicon." . $ext . "\" />\n";
                 }
             }
         }
         // Alternate Language and domains versions (only on root index)
         if ($this->context_str == "/" && $this->action == "index") {
             if (CONS_USE_I18N) {
                 $langs = explode(",", CONS_POSSIBLE_LANGS);
                 foreach ($langs as $lang) {
                     if ($lang != $_SESSION[CONS_SESSION_LANG]) {
                         if (count($this->languageTL) > 0) {
                             foreach ($this->languageTL as $fl => $ln) {
                                 if ($ln == $lang) {
                                     $metadata .= "\t<link rel=\"alternate\" hreflang=\"{$lang}\" href=\"/{$fl}/index.html\"/>\n";
                                     break;
                                 }
                             }
                         } else {
                             $metadata .= "\t<link rel=\"alternate\" hreflang=\"{$lang}\" href=\"" . $this->template->constants['CANONICAL'] . "?lang={$lang}\"/>\n";
                         }
                     }
                 }
             }
             foreach ($this->parseRewrite as $domain => $settings) {
                 if ($domain != $this->domain) {
                     $metadata .= "\t<link rel=\"alternate\" hreflang=\"" . ($settings[0] == '' ? CONS_DEFAULT_LANG : $settings[0]) . "\" href=\"http://" . $domain . "\"/>\n";
                 }
             }
         }
         $this->template->constants['METATAGS'] = $metadata;
     }
     $this->removeAutoTags($this->template);
     // print version
     if ($this->template->get("printver") == '') {
         $printVersion = arrayToString($_GET, array("layout"));
         $printVersion .= "&layout=1";
         $this->template->assign("printver", $this->action . ".html?" . $printVersion);
     }
     return $this->template->techo();
 }
Exemplo n.º 5
0
<?php

// this code is taken from default.php
$template = new CKTemplate($core->template);
$template->fetch(CONS_PATH_SYSTEM . "plugins/bi_adm/payload/template/skin/" . $this->skin . "/admframe.html");
$mObj = $template->get("_monitor");
// monitored items
if (is_file(CONS_PATH_PAGES . $_SESSION['CODE'] . "/_config/monitor.xml") && $core->authControl->checkPermission('bi_adm', 'can_monitor')) {
    // we have monitored items AND can see them
    $monitorXml = $this->getMonitorArray();
    // now perform sql queries COUNTING items we are monitoring
    $monitorTxt = "";
    $c = 0;
    $totalItems = 0;
    foreach ($monitorXml as $monitoredItem) {
        $monitoredModule = $core->loaded($monitoredItem['module'], true);
        $monitoredItem['sql'] = str_replace("\$id_user", $_SESSION[CONS_SESSION_ACCESS_USER]['id'], $monitoredItem['sql']);
        $sql = $monitoredModule->get_base_sql("(" . $monitoredItem['sql'] . ")", "", "");
        $sql['ORDER'] = array();
        $sql['SELECT'] = array("count(*) as myresult");
        if (!isset($monitoredItem['monitor_level'])) {
            $monitoredItem['monitor_level'] = 'warning';
        }
        $ok = $core->dbo->query($sql, $r, $n);
        if ($ok) {
            if ($n > 0) {
                list($n) = $core->dbo->fetch_row($r);
            }
            $monitorData = array('monitor' => $c, 'level' => $monitoredItem['monitor_level'], 'notifies' => $n, 'txt' => $n == 1 ? isset($monitoredItem['monitor_text']) ? $core->langOut($monitoredItem['monitor_text']) : '' : (isset($monitoredItem['monitor_text_plural']) ? $core->langOut($monitoredItem['monitor_text_plural']) : ''));
            $totalItems += $n;
            $monitorTxt .= $mObj->techo($monitorData);
Exemplo n.º 6
0
  | These functions are not used so often, so to reduce parse time from the PHP compiler, they where removed from the core.php
-*/
/* 	rss echos a rss XML
Expected data in the $data array (see rsstemplate.xml):
title, link, description, language
module, category, itemlinktemplate, itemtitle, itemdescription
*/
if (!isset($data['title']) || !isset($data['link']) || !isset($data['description']) || !isset($data['language']) || !isset($data['module']) || !isset($data['itemlinktemplate']) || !isset($data['itemtitle']) || !isset($data['itemdescription'])) {
    return false;
}
if ($data['link'] == '') {
    $data['link'] = "http://" . $this->domain . "/";
}
$NOWdate = gmdate("D, d M Y H:i:s") . " GMT";
$rssTemplate = new CKTemplate($this->template);
$rssTemplate->fetch(CONS_PATH_SETTINGS . "defaults/rsstemplate.xml");
$rssTemplate->fill($data);
$rssTemplate->assign("ABSOLUTE_URL", "http://" . $this->domain . "/");
$rssTemplate->assign("date", $NOWdate);
$rssTemplate->assign("year", date("Y"));
if ($imgtitle == "") {
    $rssTemplate->assign("_image");
}
$mylist = array();
$modules = explode(",", $data['module']);
$category = explode(",", isset($data['category']) ? $data['category'] : '');
$ilt = explode(",", $data['itemlinktemplate']);
$it = explode(",", $data['itemtitle']);
$idesc = explode(",", $data['itemdescription']);
if (count($modules) != count($ilt) && count($modules) != count($it) && count($module) != count($idesc)) {
    return false;
Exemplo n.º 7
0
function getuseravatar(&$template, &$params, $data, $processed = false)
{
    if ($processed) {
        return $data;
    }
    if ($data['image'] == 'n') {
        $params['excludes'][] = "_imageyes";
    } else {
        $params['excludes'][] = "_imageno";
        $data['image'] = CONS_PATH_PAGES . $_SESSION['CODE'] . "/files/users/t/image_" . $data['id_author'] . "_2";
        $ext = "";
        locateFile($data['image'], $ext);
    }
    if (isset($params['mainpost']) && $data['includehtml'] != '') {
        $file = "";
        if (is_file(CONS_PATH_PAGES . $_SESSION['CODE'] . "/template/" . $data['includehtml'])) {
            $file = CONS_PATH_PAGES . $_SESSION['CODE'] . "/template/" . $data['includehtml'];
        } else {
            if (is_file(CONS_PATH_PAGES . $_SESSION['CODE'] . "/template/" . $data['includehtml'] . ".html")) {
                $file = CONS_PATH_PAGES . $_SESSION['CODE'] . "/template/" . $data['includehtml'] . ".html";
            }
        }
        if ($file != '') {
            $tmpTP = new CKTemplate($params['core']->template);
            $tmpInner = new CKTemplate($params['core']->template);
            $tmpTP->append($data['content']);
            $tmpInner->fetch($file);
            $tmpTP->append($tmpInner);
            $params['core']->removeAutoTags($tmpTP);
            $data['content'] = $tmpTP;
        } else {
            $data['content'] .= "<br/><small>File not found: " . $data['includehtml'] . "</small>";
        }
    }
    return $data;
}
Exemplo n.º 8
0
<?php

// ------------------------ Prescia prepareMail. Will look for $name if cannot find $name_$lang
# prepareMail($name="",$fillArray=array()) {
$file = "";
$l = $_SESSION[CONS_SESSION_LANG];
if (is_file(CONS_PATH_PAGES . $_SESSION['CODE'] . "/mail/template_{$l}.html")) {
    $file = CONS_PATH_PAGES . $_SESSION['CODE'] . "/mail/template_{$l}.html";
} else {
    if (is_file(CONS_PATH_PAGES . $_SESSION['CODE'] . "/mail/template.html")) {
        $file = CONS_PATH_PAGES . $_SESSION['CODE'] . "/mail/template.html";
    }
}
$mail = new CKTemplate($this->template);
if ($file != "") {
    $mail->fetch($file);
}
if ($name != "") {
    $innerFile = CONS_PATH_PAGES . $_SESSION['CODE'] . "/mail/" . $name . "_{$l}.html";
    if (!is_file($innerFile)) {
        $innerFile = CONS_PATH_PAGES . $_SESSION['CODE'] . "/mail/" . $name . ".html";
        if (!is_file($innerFile)) {
            $innerFile = CONS_PATH_PAGES . $_SESSION['CODE'] . "/mail/" . $name;
            if (!is_file($innerFile)) {
                $this->errorControl->raise(183, $name);
                $innerFile = "";
            }
        }
    }
    if ($innerFile != "") {
        if ($file != "") {
Exemplo n.º 9
0
 function field_interface($field, $action, &$data)
 {
     if ($field == "permissions") {
         $output = "";
         $this->parent->loadPermissions();
         // makes sure it's loaded
         $perm = array();
         $allperm = $this->parent->permissionTemplate;
         // get default permission array
         if (isset($data['permissions']) && $data['permissions'] != "") {
             $perm = unserialize($data['permissions']);
         }
         // loads
         // merge with standard permissions to make sure we have ALL permissions (example: a new module was added and this group still don't have permissions set?)
         foreach ($perm as $name => $permission) {
             $allperm[$name] = $permission;
         }
         // if a permission is lacking, will not override, thus using default
         // load template
         $mytp = new CKTemplate($this->parent->template);
         $mytp->fetch(CONS_PATH_SYSTEM . "plugins/" . $this->name . "/payload/permission_field.html");
         $customPerm = $mytp->get("_custompermission");
         $objPerm = $mytp->get("_permission");
         foreach ($this->parent->modules as $name => $pmodule) {
             if ($pmodule->options[CONS_MODULE_SYSTEM]) {
                 continue;
             }
             // cannot edit system modules
             $locker = "ccccccccc";
             if ($pmodule->permissionOverride != "") {
                 $locker = $pmodule->permissionOverride;
                 $hasSOME = false;
                 for ($pos = 0; $pos < 9; $pos++) {
                     if ($pmodule->permissionOverride[$pos] == "c") {
                         $hasSOME = true;
                         break;
                     }
                 }
             }
             if ($hasSOME) {
                 $thisPermission = array('title' => $this->parent->langOut($name) . (defined("CONS_MODULE_PARTOF") && $pmodule->options[CONS_MODULE_PARTOF] != '' ? " (" . $this->parent->langOut($pmodule->options[CONS_MODULE_PARTOF]) . ")" : ""), 'module' => $name, 'mr_checked' => $allperm[$name][0] == "1" || $locker[0] == "a" ? true : "", 'mr_disabled' => $locker[0] != "c" ? "disabled" : "", 'mw_checked' => $allperm[$name][1] == "1" || $locker[1] == "a" ? true : "", 'mw_disabled' => $locker[1] != "c" ? "disabled" : "", 'me_checked' => $allperm[$name][2] == "1" || $locker[2] == "a" ? true : "", 'me_disabled' => $locker[2] != "c" ? "disabled" : "", 'gr_checked' => $allperm[$name][3] == "1" || $locker[3] == "a" ? true : "", 'gr_disabled' => $locker[3] != "c" ? "disabled" : "", 'gw_checked' => $allperm[$name][4] == "1" || $locker[4] == "a" ? true : "", 'gw_disabled' => $locker[4] != "c" ? "disabled" : "", 'ge_checked' => $allperm[$name][5] == "1" || $locker[5] == "a" ? true : "", 'ge_disabled' => $locker[5] != "c" ? "disabled" : "", 'or_checked' => $allperm[$name][6] == "1" || $locker[6] == "a" ? true : "", 'or_disabled' => $locker[6] != "c" ? "disabled" : "", 'ow_checked' => $allperm[$name][7] == "1" || $locker[7] == "a" ? true : "", 'ow_disabled' => $locker[7] != "c" ? "disabled" : "", 'oe_checked' => $allperm[$name][8] == "1" || $locker[8] == "a" ? true : "", 'oe_disabled' => $locker[8] != "c" ? "disabled" : "");
                 $output .= $objPerm->techo($thisPermission);
             }
             $pos = 9;
         }
         foreach ($this->parent->loadedPlugins as $pname => $plugin) {
             // stand alone plugins (no module)
             if (count($plugin->customPermissions) != 0) {
                 $pos = 9;
                 foreach ($plugin->customPermissions as $ptag => $pi18n) {
                     $thisPermission = array('title' => $pos == 9 ? $this->parent->langOut($pname) : '', 'pname' => 'c_' . $pname . "_" . $ptag, 'ptitle' => $pi18n, 'checked' => isset($allperm["plugin_" . $pname][$pos]) && $allperm["plugin_" . $pname][$pos] == '1' ? true : '');
                     $output .= $customPerm->techo($thisPermission);
                     $pos++;
                 }
             }
         }
         $mytp->assign("_permission", $output);
         $mytp->assign("_custompermission", "");
         $output = $mytp->techo();
         if ($output == '') {
             return false;
         }
         return $output;
     }
     return true;
 }