<?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); }
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" => " ", "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(); }
<?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);
} $ppage = new CKTemplate($this->template); $ppage->tbreak($ilt[$rssId]); for ($c = 0; $c < $n; $c++) { $dados = $this->dbo->fetch_assoc($r); $rssItem = array("title" => $dados[$it[$rssId]], "description" => $dados[$idesc[$rssId]], "date" => $dateField != "" ? gmdate("D, d M Y H:i:s", tomktime($dados[$dateField])) . " GMT" : $NOWdate, "link" => $ppage->techo($dados)); if (!isset($category[$rssId]) || $category[$rssId] != "") { if ($hasCategory) { $rssItem['category'] = $dados[$category[$rssId]]; } } $mylist[] = $rssItem; } $rssId++; } function datesort($a, $b) { return datecompare($a['date'], $b['date']) ? 1 : -1; } uksort($mylist, "datesort"); $obj = $rssTemplate->get("_itens"); $temp = ""; $exclude = !$hasCategory ? array("_category") : array(); foreach ($mylist as $item) { $temp .= $obj->techo($item, $exclude); } $rssTemplate->assign("_itens", $temp); if ($echoHeader) { header("Content-Type:application/rss+xml"); } return $rssTemplate->techo();
if ($innerFile != "") { if ($file != "") { $mail->assignFile("CONTENT", $innerFile); } else { $mail->fetch($innerFile); } # no template, but we have a file } } else { if ($file == "") { $mail->tbreak("{CONTENT} "); # no template nor file if (is_file(CONS_PATH_SETTINGS . "defaults/automail.html")) { $smh = new CKTemplate($this->template); $smh->fetch(CONS_PATH_SETTINGS . "defaults/automail.html"); $objField = $smh->get("_field"); $temp = ""; foreach ($_POST as $name => $data) { if ($name != "haveinfo") { $temp .= $objField->techo(array('name' => $name, 'content' => nl2br($data))); } } $smh->assign("_field", $temp); $template = $smh->techo(); unset($smh); unset($objField); } else { foreach ($_POST as $name => $data) { if ($name != "haveinfo") { if (strpos($data, "\n") !== false) { $template .= "<strong>{$name}</strong>: <br/><blockquote>" . nl2br($data) . "</blockquote>\n";
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; }