Admin's section router - admin/index.php
001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020 021 022 023 024 025 026 027 028 029 030 031 032 033 034 035 036 037 038 039 040 041 042 043 044 045 046 047 048 049 050 051 052 053 054 055 056 057 058 059 060 061 062 063 064 065 066 067 068 069 070 071 072 073 074 075 076 077 078 079 | <?php defined('START') or die; # For Licence and Disclaimer of this code, see http://coresky.net/license $RIGHT = date('e H:i') . '<br>' . date('l j M'); $MESS = $LEFT = ''; if ($sky->ajax) { require $adm->get_file(); $sky->tail(); } $top_html = '<!doctype html><html><head><title>%TITLE%</title><link href="favicon.ico" rel="shortcut icon" type="image/x-icon" />'; $top_html .= js(['pub/jquery.min.js', '~/wing.js', '~/admin.js']) . css(['~/wing.css', '~/admin.css']) . '%HEAD%</head><body'; $the_sky = ", the <b>`SKY.`</b> app, see " . a('www.coresky.net') . ', years 2012-' . date('Y'); $btm_html = '<hr>' . tag(a("<b>$sky->s_title</b>", 2 == $user->auth ? 'http://' . _PUBLIC : LINK) . $the_sky, 'style="margin:0 0 10px 0;float:right"'); if (2 == $user->auth): if (!$adm_lref = Admin::section($sky->lref, 'auth')) { $user->u_uri_front = $sky->lref; ############### #$adm->t_log->add("entered from $sky->lref"); } if ('logout' == PAGE) $user->logout(); if ('main' == PAGE && 3 == $sky->val && ($pid = $sky->v2 ? $sky->v2 : 1) != $user->pid) Admin::top_menu($pid); for ($i = $j = 0, $menu = '', $cnt = count($adm->cr), $allowed = []; $adm->rows && $i <= $cnt; $i++ < $cnt and $allowed[$j] = true) { if ($i && 0 == $i % $adm->rows) $menu .= '</td><td>'; if ($i == $cnt) $menu .= sprintf(Admin::button, 'Exit', 'logout', ' exit'); else $menu .= sprintf(Admin::button, str_replace(' ', ' ', $adm->names[$j = $adm->cr[$i]]), $p = $adm->uris[$j], PAGE == $p ? ' active' : ''); } $dev = DEV ? '<br>' . a(tag('DEV.SKY.', '', 'strong'), '?get_dev') : '<br><small>production</small>'; $color = in_array($user->pid, $adm->cr) ? sql('+select if(tmemo="","","pink") from memory where id=4') : ''; $top_html .= '><div id="fix-top"><table cellpadding="0" id="top" style="margin-bottom:-5px;width:100%;background:' . $color . '">' . td([ [a(tag(strtoupper(_PUBLIC), '', 'strong'), $user->u_uri_front, DEV ? '' : 'class="red-link"') . $dev, 'id="logo"'], $menu, [tag('%RIGHT%') . sprintf("online: $sky->s_online<br><b>$user->login</b> (%s)", $PROFILES[$user->pid]), 'width="99%"'], ]); $top_html .= '</table><hr>%TOP%' . js("sky.mrow = $adm->rows"); if ($file = $adm->get_file()) { $title = $TOP = $adm->_title; require $file; # can be used: $TOP $LMENU $LEFT $RIGHT $MESS $HEAD $JUMP } else { $adm_lref or jump($adm->first_page); $title = $TOP = "404 Not found"; echo "<h1>$title - $adm->_title</h1>"; } $s = '<td valign="top"'; if (isset($LMENU)) { $m = menu($sky->val, $LMENU, "?$sky->page=%s"); $s .= 'id="lmenu"><div>' . "$m<div id=\"left\">%LEFT%</div></div><div style=\"width:150px\"></div></td>$s"; $TOP = a('◄', "javascript:sky.lmenu()", 'class="nodec"') . " $TOP"; } $html = ob_get_clean(); $TOP = tag(pad() . a('▲', 'javascript:sky.head()', 'class="nodec"') . a('▼', 'javascript:sky.tail()', 'class="nodec"')) . $TOP; echo strtr($top_html, [ '%TITLE%' => html("Admin > $title"), '%HEAD%' => (@$JUMP ? sprintf('<meta http-equiv="refresh" content="%d%s" />', $JUMP[0], @$JUMP[1] ? ";url=$JUMP[1]" : '') : '') . @$HEAD, '%TOP%' => $TOP . '<hr></div><table id="layout"><tr>' . strtr($s, ['%LEFT%' => $LEFT]) . 'id="content">', '%RIGHT%' => $RIGHT, ]); isset($front) ? $front->label($html) : print($html); echo "</td></tr></table>$btm_html" . tag($MESS, 'id="message" style="display:none; position:absolute"'); else: # form if ($_POST) $user->login(); $top_html .= (is_file(WWW . 'img/a.png') ? ' style="background:url(img/a.png)"' : '') . '><table id="layout"><tr><td align="center">'; $top_html .= Admin::form($_POST, [ 'login' => ['hidden', $user->login], tag(" user > <b>$user->login</b> < ", 'style="background:#777;font-size:17px"', 'span') . ' <input size="7" name="password" autofocus placeholder="password" />' . '<input type="submit" value="go" />' ]); echo strtr($top_html, ['%TITLE%' => 'Admin login form', '%HEAD%' => '']) . "</td></tr></table>$btm_html"; endif; $sky->tail(); echo '</body></html>'; |
News
7 Jan 2013 GMT Project SKY. started
18 Oct 2018 GMT null-site MVC updated
11 Oct 2018 GMT App MED.CRM.SKY. published.
Core SKY.
SKY. status
Current version: 1.001
Coresky records: 22
Local (DEV) records: 89
Web (all) records: 105
Download: dev.php
Coresky records: 22
Local (DEV) records: 89
Web (all) records: 105
Download: dev.php