private function rec($id) { $find = $this->perform(Fx::service_context()->namespace['construct_db'], array('parent' => $id)); foreach ($find as $v) { $active = isset($this->path[0]) && $this->path[0]['id'] == $v['id'] ? ' class="active"' : ''; if ($active == '' && Fx::context()->struct_db[$v['object']]['show_wood'] < 1) { continue; } $elem = Fx::db()->find($v['object'], array('id' => $v['id'])); if (!isset($elem[0])) { continue; } $elem = $elem[0]; $name = isset($elem['name']) && $elem['name'] !== '' ? $elem['name'] : 'undefiend-' . $v['id']; $this->result[] = '<li>'; $this->result[] = '<a' . $active . ' href="?mode=project&id=' . $v['id'] . '">' . $name . '</a>'; if ($active != '') { $item = array_shift($this->path); if (Fx::context()->struct_db[$item['object']]['show_wood'] > 0) { $this->result[] = '<ul>'; $this->rec($item['id']); $this->result[] = '</ul>'; } } $this->result[] = '</li>'; } }
$twig->addExtension(new Twig_Extension_Debug()); require_once Fx::service_context()->config['folder']['template'] . '/main.php'; $render = ''; foreach (Fx::context()->template as $v) { $filePHP = Fx::service_context()->config['folder']['template'] . '/php/' . $v . '.php'; $fileHTML = 'twig/' . $v . '.twig'; if (file_exists($filePHP)) { require_once $filePHP; $render .= $twig->render($fileHTML, (array) Fx::context()); } else { throw new Exception("Error Processing Request", 404); } } if (isset($_GET['show']) && $_GET['show'] == 'glob') { header('Content-Type: text/html'); debug(Fx::context()); } else { echo $render; } break; } } catch (Exception $e) { switch ($e->getCode()) { case 404: header("HTTP/1.0 404 Not Found"); header("Status: 404 Not Found"); $errorPage = '404.html'; if (file_exists($errorPage)) { require_once $errorPage; } else { echo '<h1>404</h1><p>Not found</p>';
<?php access(0); // Root Fx::context()->users = Fx::db()->find(Fx::service_context()->namespace['user']);
<?php Fx::context()->selfId = isset($_GET['id']) ? (int) $_GET['id'] : false; if (Fx::context()->selfId && !count(Fx::db()->find(Fx::service_context()->namespace['construct_db'], array('id' => Fx::context()->selfId)))) { throw new Exception('not found', 404); } // Левое меню require_once sys . '/template/php/project-menu.php'; $tables = Fx::db()->find(Fx::service_context()->namespace['struct_db']); $rowslist = Fx::db()->find(Fx::service_context()->namespace['struct_td']); $selfItem = Fx::db()->extract(Fx::db()->go(array('event' => 'find', 'from' => Fx::service_context()->namespace['construct_db'], 'where' => array('parent' => Fx::context()->selfId), 'order' => 'num'))); $rows = array(); foreach ($rowslist as $k => $v) { if (!isset($rows[$v['parent']])) { $rows[$v['parent']] = array(); } $rows[$v['parent']][$v['code']] = $v; } $tabl = array(); foreach ($tables as $v) { if (isset($rows[$v['id']])) { $v['rows'] = $rows[$v['id']]; } $tabl[$v['code']] = $v; } $selfList = array(); $selfList[] = '<ul class="js-sortable-list">'; foreach ($selfItem as $k => $j) { $id = $j['ref'] > 0 ? $j['ref'] : $j['id']; $item = Fx::db()->findOne($j['object'], array('id' => $id)); if (is_array($item)) {
<?php $leftMenu = Fx::db()->find(Fx::service_context()->namespace['struct_db']); $text = array('<h3>Объекты</h3><ul>'); foreach ($leftMenu as $v) { $active = isset($_GET['id']) && $_GET['id'] == $v['id'] ? ' class="active"' : ''; $text[] = '<li' . $active . '><a href="?mode=object&id=' . $v['id'] . '">' . $v['name'] . '</a></li>'; } Fx::context()->leftMenu .= implode("\n", $text) . '</ul>'; Fx::context()->leftMenu .= '<a href="?mode=object" class="btn mt_mini"><span class="btn-in">Создать объект</span></a>'; // Текущий объект $paramObject = ''; if (isset($_GET['id']) && is_numeric($_GET['id'])) { $id = $_GET['id']; $objectParam = Fx::db()->find(Fx::service_context()->namespace['struct_db'], array('id' => $id)); $td = Fx::db()->find(Fx::service_context()->namespace['struct_td'], array('parent' => $id)); if (is_array($objectParam) && is_array($td) && count($objectParam) && count($td)) { $len = count($td); $paramObject = array(); foreach ($td as $k => $v) { $paramObject[] = Fx::io()->buffer(sys . '/template/tpl/template/object_item.html', array('key' => $k, 'value' => $v, 'zIndex' => $len - $k, 'manifest' => $manifest)); } $paramObject = implode("\n", $paramObject); } else { throw new Exception('not found', 404); } }
<?php $GLOB['menu'] = array('project' => $lang['menu.project'], 'seo&page=robots' => $lang['menu.seo'], 'struct' => $lang['menu.struct'], 'setting' => $lang['menu.setting']); Fx::context()->url = array('home' => '/' . $config['folder']['sys'] . '/index.php'); //-> leftMenu Fx::context()->leftMenu = ''; $script_config = implode('', array('<script>', 'window.CONFIG_CKEDITOR = ' . json_encode($config['ckeditor_config']), '</script>'));
} $pathGist = sys . '/template/tpl/gist-elem/'; $tablParam = array(); $tableName = isset($_GET['name']) ? $_GET['name'] : ''; $objectValue = array(); if (isset($_GET['id']) && (int) $_GET['id'] > 0) { $selfObject = Fx::db()->find(Fx::service_context()->namespace['construct_db'], array('id' => (int) $_GET['id'])); if (count($selfObject)) { $tableName = $selfObject[0]['object']; $objectValue = Fx::db()->find($tableName, array('id' => $selfObject[0]['id'])); $objectValue = $objectValue[0]; } } if ($tableName != '') { $tabl = Fx::db()->find(Fx::service_context()->namespace['struct_db'], array('code' => $tableName)); $tablParam = $tabl[0]; } else { setSystemMessage('error', 'Не заданы параметры для редактирования'); load_url(); } $row = Fx::db()->find(Fx::service_context()->namespace['struct_td'], array('parent' => $tablParam['id'])); $result = array(); foreach ($row as $key => $v) { $result[] = loadParam($key, array('row' => $v, 'value' => isset($objectValue[$v['code']]) ? $objectValue[$v['code']] : ''), $manifest, $pathGist . $v['type'] . '.html'); } // Шаблоны $template = Fx::db()->find(Fx::service_context()->namespace['marker']); // Левое меню require_once sys . '/template/php/project-menu.php'; $isShowSystem = Fx::context()->struct_db[$tableName]['show_sistem'] == '1';
} } } } } if (isset($_GET['extension']) && $_GET['extension'] !== '' && $extView !== '') { $php = $extController; $tpl = $extView; } /** Рендерим страници */ try { if (file_exists($php)) { require_once $php; } ob_start(); require_once $tpl; Fx::context()->content = ob_get_contents(); ob_end_clean(); require_once 'template/main.html'; } catch (Exception $e) { Fx::context()->leftMenu = ''; $param = array('code' => $e->getCode(), 'message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()); if ($e->getCode() === 403) { $param['text'] = 'Доступ запрещен'; } if ($e->getCode() === 404) { $param['text'] = 'Такая страница не существует'; } Fx::context()->content = Fx::io()->buffer(sys . '/template/error.html', $param); require_once 'template/main.html'; }
<?php //TODO robots.txt //TODO sitemap.xml //TODO rewrite_url //TODO chpu_list //TODO page_status Fx::context()->menu = array('robots' => 'robots.txt', 'sitemap' => 'sitemap.xml', 'rewrite' => 'Редиректы', 'history_link' => 'Страници'); Fx::context()->page = isset($_GET['page']) ? $_GET['page'] : false;