function __do_response_reply_count($response) { global $config, $speak, $segment; $e = File::E($response->path); $replies = count(glob(COMMENT . DS . '*_*_' . Date::slug($response->id) . '.{txt,hold}', GLOB_NOSORT | GLOB_BRACE)); $t = Jot::icon('reply-all') . ' ' . $replies; $tt = array('title' => $replies . ' ' . ($replies === 1 ? $speak->{$segment[0] . '_reply'} : $speak->{$segment[0] . '_replies'})); echo ($e === 'hold' || $replies === 0 ? Cell::span($t, $tt) : Cell::a($config->manager->slug . '/' . $segment[0] . '?filter=parent%3A' . $response->id, $t, null, $tt)) . ' · '; }
<h4><i class="fa fa-comments"></i> <?php echo $speak->responses; ?> </h4> <?php if ($responses = glob(RESPONSE . DS . '*', GLOB_ONLYDIR)) { ?> <ul> <?php foreach ($responses as $response) { ?> <?php $s = File::B($response); ?> <li><?php echo Cell::a($config->manager->slug . '/' . $s, isset($speak->{$s}) ? $speak->{$s} : Text::parse($s, '->title'), null, array('data-tooltip' => Text::parse(count(glob($response . DS . '*.txt', GLOB_NOSORT)) . ' ' . $speak->approved . ', ' . count(glob($response . DS . '*.hold', GLOB_NOSORT)) . ' ' . $speak->pending, '->text'))); ?> (<?php echo count(glob($response . DS . '*.*', GLOB_NOSORT)); ?> )</li> <?php } ?> </ul> <?php } ?> </div> <div class="grid span-2"> <h4><i class="fa fa-users"></i> <?php
$menus[$speak->error] = array('icon' => 'exclamation-triangle', 'url' => $config->manager->slug . '/error', 'count' => $total, 'stack' => 9.130000000000001); } } if ($config->page_type !== '404' && $config->is->post) { $type = $config->page_type; $id = $config->{$type}->id; $text = Config::speak($type); $text_repair = Config::speak('manager._this_', array($speak->edit, $text)); $text_kill = Config::speak('manager._this_', array($speak->delete, $text)); $bars[$text] = array('icon' => 'plus', 'url' => $config->manager->slug . '/' . $type . '/ignite', 'description' => Config::speak('manager.title_new_', $text), 'stack' => 9.029999999999999); $bars[$speak->edit] = array('icon' => 'pencil', 'url' => $config->manager->slug . '/' . $type . '/repair/id:' . $id, 'description' => $text_repair, 'stack' => 9.039999999999999); $bars[$speak->delete] = array('icon' => 'times', 'url' => $config->manager->slug . '/' . $type . '/kill/id:' . $id, 'description' => $text_kill, 'stack' => 9.050000000000001); } else { $link = Cell::a($config->manager->slug . '/article/ignite', Config::speak('manager.title_new_', $speak->article)); $link .= ' · '; $link .= Cell::a($config->manager->slug . '/page/ignite', Config::speak('manager.title_new_', $speak->page)); $bars[$speak->add] = array('icon' => 'plus', 'url' => $config->manager->slug . '/article/ignite', 'description' => $link, 'stack' => 9.029999999999999); } Config::merge('manager_menu', $menus); Config::merge('manager_bar', $bars); }); } // Loading frontend task(s) and route(s) Weapon::add('routes_before', function () use($config, $speak) { require __DIR__ . DS . 'workers' . DS . 'task.comment.ignite.php'; require __DIR__ . DS . 'workers' . DS . 'route.login.php'; }); // Add log in/out link in shield footer function do_footer_manager_link($content, $path) { global $config, $speak;
</p> <?php } ?> <p><time class="text-fade" datetime="<?php echo $page->date->W3C; ?> "><?php echo Jot::icon('clock-o') . ' ' . $page->date->FORMAT_3; ?> </time><?php if (isset($page->total_comments)) { $t = Jot::icon('comments') . ' ' . $page->total_comments; ?> · <?php echo $page->total_comments === 0 ? Cell::span($t) : Cell::a($config->manager->slug . '/comment?filter=post%3A' . $page->id, $t); } ?> </p> <?php if ($page->css) { ?> <pre><code><?php echo substr(Text::parse($page->css, '->encoded_html'), 0, $config->excerpt->length); if (strlen($page->css) > $config->excerpt->length) { echo $config->excerpt->suffix; } ?> </code></pre> <?php }
<table class="table-bordered table-full-width"> <tbody> <?php $origins = array(Jot::icon('database', 'fw') . ' ' . $speak->site => '.', Jot::icon('file-text', 'fw') . ' ' . $speak->article => str_replace(CARGO . DS, "", ARTICLE), Jot::icon('file', 'fw') . ' ' . $speak->page => str_replace(CARGO . DS, "", PAGE), Jot::icon('magnet', 'fw') . ' ' . $speak->extend => str_replace(CARGO . DS, "", EXTEND), Jot::icon('comments', 'fw') . ' ' . $speak->comment => str_replace(CARGO . DS, "", COMMENT), Jot::icon('cogs', 'fw') . ' ' . $speak->config => str_replace(CARGO . DS, "", STATE), Jot::icon('briefcase', 'fw') . ' ' . $speak->asset => str_replace(CARGO . DS, "", ASSET), Jot::icon('shield', 'fw') . ' ' . $speak->shield => str_replace(CARGO . DS, "", SHIELD), Jot::icon('plug', 'fw') . ' ' . $speak->plugin => str_replace(CARGO . DS, "", PLUGIN)); ?> <?php foreach ($origins as $title => $origin) { ?> <tr> <td><?php echo $title; ?> </td> <td class="td-icon"> <?php echo Cell::a($config->url_current . '/origin:' . File::url($origin), Jot::icon('download'), null, array('title' => $speak->download)); ?> </td> </tr> <?php } ?> </tbody> </table> </div> <div class="tab-content hidden" id="tab-content-2"> <h3><?php echo $speak->restore; ?> </h3> <?php
<p><?php echo Config::speak('notify_not_available', $speak->config); ?> </p> <?php } ?> </div> <div class="tab-content hidden" id="tab-content-2"> <p class="about-author"> <?php echo Cell::strong($speak->author . ':') . ' ' . Text::parse($file->author, '->encoded_html'); if (isset($file->url) && $file->url !== '#') { ?> <?php echo Cell::a($file->url, Jot::icon('external-link-square'), '_blank', array('class' => array('about-url', 'help'), 'title' => $speak->link, 'rel' => 'nofollow')); ?> <?php } ?> </p> <h3 class="about-title"><?php echo $file->title; if (isset($file->version)) { ?> <code class="about-version"><?php echo $file->version; ?> </code><?php } ?>
// Ignite if (strpos($config->url_path, '/id:') === false) { Weapon::add('SHIPMENT_REGION_BOTTOM', function () { echo '<script>(function($){$.slug(\'title\',\'slug\',\'-\')})(DASHBOARD.$);</script>'; }, 11); } if ($id && ($post = call_user_func('Get::' . $segment, $id, array('content', 'excerpt', 'tags')))) { $extension_o = '.' . File::E($post->path); if (!Guardian::happy(1) && Guardian::get('author') !== $post->author) { Shield::abort(); } if (!File::exist(CUSTOM . DS . Date::slug($post->date->unix) . $extension_o)) { $post->css_raw = $config->defaults->{$segment . '_css'}; $post->js_raw = $config->defaults->{$segment . '_js'}; } $title = $speak->editing . ': ' . ($post->state !== 'drafted' ? Cell::a($post->url, $post->title, true) : $post->title) . $config->title_separator . $config->manager->title; } else { if ($id !== false) { Shield::abort(); // File not found! } $post = Mecha::O(array('id' => "", 'path' => "", 'state' => 'drafted', 'date' => array('W3C' => ""), 'kind' => array(), 'slug' => "", 'title_raw' => $config->defaults->{$segment . '_title'}, 'link_raw' => "", 'description_raw' => "", 'author_raw' => Guardian::get('author'), 'content_type_raw' => $config->html_parser->active, 'fields_raw' => array(), 'content_raw' => $config->defaults->{$segment . '_content'}, 'css_raw' => $config->defaults->{$segment . '_css'}, 'js_raw' => $config->defaults->{$segment . '_js'})); $title = Config::speak('manager.title_new_', $speak->{$segment}) . $config->title_separator . $config->manager->title; } $G = array('data' => Mecha::A($post)); Config::set(array('page_title' => $title, 'page' => $post, 'html_parser' => array('active' => $post->content_type_raw), 'cargo' => 'repair.post.php')); if ($request = Request::post()) { Guardian::checkToken($request['token']); // Check for invalid time pattern if (isset($request['date']) && trim($request['date']) !== "" && !preg_match('#^\\d{4,}\\-\\d{2}\\-\\d{2}T\\d{2}\\:\\d{2}\\:\\d{2}\\+\\d{2}\\:\\d{2}$#', $request['date'])) { Notify::error($speak->notify_invalid_time_pattern);
global $config, $speak, $parent; $s = Asset::loaded($config->protocol . ICON_LIBRARY_PATH) ? '<i class="fa fa-times-circle"></i> ' : ""; echo ' <a href="' . $post->url . '" class="btn btn-reject btn-reject-reply"' . ($parent === false ? ' style="display:none;"' : "") . '>' . $s . $speak->cancel . '</a>'; } Weapon::add('comment_footer', 'do_response_reply', 20.1); Weapon::add('comment_form_button_after', 'do_response_reply_x'); Weapon::add('shell_before', 'do_response_reply_css'); Weapon::add('SHIPMENT_REGION_BOTTOM', 'do_response_reply_js'); // No JavaScript if ($parent !== false) { Guardian::memorize('parent', $parent); if ($response = Get::commentAnchor($parent)) { Weapon::add('chunk_before', function ($G) use($speak, $parent, $response) { if (File::N($G['data']['path']) === 'comment.form') { $prefix = File::B(File::D($response->path)); $to = Config::speak($prefix . '_reply_to_', Cell::a('#' . $prefix . '-' . $parent, $response->name)); echo Cell::h4($to); } }); } } // Error if ($s = Request::post('parent', false)) { Filter::add('guardian:kick', function ($url) use($config, $s) { if (!Notify::errors()) { return $url; } $ss = explode('#', $url, 2); return $config->url_current . HTTP::query('reply', $s) . '#' . $ss[1]; }); }
$units = array('name', 'email', 'url', 'message', 'content_type'); foreach ($units as $k => $v) { Weapon::add('tab_content_1_before', function ($page, $segment) use($config, $speak, $v) { include __DIR__ . DS . 'unit' . DS . 'form' . DS . $v . '.php'; }, $k + 1); } Weapon::add('tab_content_2_before', function ($page, $segment) use($config, $speak) { $segment = $segment[0]; include __DIR__ . DS . 'unit' . DS . 'form' . DS . 'fields[].php'; }, 1); File::write($config->{'__total_' . $segment . 's'})->saveTo(LOG . DS . $segment . 's.total.log', 0600); if ($id && ($response = call_user_func('Get::' . $segment, $id, array('message')))) { if (!Guardian::happy(1)) { Shield::abort(); } $title = $speak->editing . ': ' . ($response->permalink !== '#' ? Cell::a($response->permalink, $speak->{$segment}, true) : $speak->{$segment}) . $config->title_separator . $config->manager->title; } else { if ($id !== false) { Shield::abort(); // File not found! } $response = Mecha::O(array('id' => "", 'path' => "", 'post' => "", 'parent' => "", 'state' => 'pending', 'date' => array('W3C' => ""), 'name_raw' => Guardian::get('author'), 'email' => Guardian::get('email'), 'url_raw' => "", 'status_raw' => Guardian::get('status_raw'), 'content_type_raw' => $config->html_parser->active, 'fields_raw' => array(), 'message_raw' => "")); $title = Config::speak('manager.title_new_', $speak->{$segment}) . $config->title_separator . $config->manager->title; } $G = array('data' => Mecha::A($response)); Config::set(array('page_title' => $title, 'page' => $response, 'html_parser' => array('active' => $response->content_type_raw), 'cargo' => 'repair.response.php')); if ($request = Request::post()) { $request = Filter::apply('request:__' . $segment, $request, $id); Guardian::checkToken($request['token']); $rid = $id ? $id : time(); $request['post'] = Request::post('post');
* -------------- */ // Add default article footer link(s) Weapon::add('article_footer', function ($article) use($config, $speak) { $e = File::E($article->path); $comments = count(glob(COMMENT . DS . Date::slug($article->id) . '_*_*.{txt,hold}', GLOB_NOSORT | GLOB_BRACE)); $t = Jot::icon('comments') . ' ' . $comments; $tt = array('title' => $comments . ' ' . ($comments === 1 ? $speak->comment : $speak->comments)); $comments = ($e === 'draft' || $comments === 0 ? Cell::span($t, $tt) : Cell::a($config->manager->slug . '/comment?filter=post%3A' . $article->id, $t, null, $tt)) . ' · '; $status = Mecha::alter($e, array('draft' => Jot::span('info', Jot::icon('clock-o') . ' ' . $speak->draft) . ' · ', 'archive' => Jot::span('info', Jot::icon('history') . ' ' . $speak->archive) . ' · '), ""); echo $comments . $status . Cell::a($config->manager->slug . '/article/repair/id:' . $article->id, $speak->edit) . ' / ' . Cell::a($config->manager->slug . '/article/kill/id:' . $article->id, $speak->delete); }, 20); // Add default page footer link(s) Weapon::add('page_footer', function ($page) use($config, $speak) { $status = Mecha::alter(File::E($page->path), array('draft' => Jot::span('info', Jot::icon('clock-o') . ' ' . $speak->draft) . ' · ', 'archive' => Jot::span('info', Jot::icon('history') . ' ' . $speak->archive) . ' · '), ""); echo $status . Cell::a($config->manager->slug . '/page/repair/id:' . $page->id, $speak->edit) . ' / ' . Cell::a($config->manager->slug . '/page/kill/id:' . $page->id, $speak->delete); }, 20); /** * Backend Route(s) * ---------------- * * Load the routes. * */ Weapon::add('plugins_after', function () use($config, $speak, $segment) { // loading cargo ... require __DIR__ . DS . 'workers' . DS . 'cargo.php'; if ($detour = File::exist(__DIR__ . DS . 'workers' . DS . 'route.' . $segment . '.php')) { require $detour; } }, 1);
} ?> <?php } ?> <?php if ($q_path) { ?> <tr> <?php $__ = array(); $___ = explode('/', $q_path); foreach ($___ as $_) { array_pop($___); $t = end($___); $__[] = Cell::a($asset_url . '/1' . str_replace('&', '&', HTTP::query(array('path' => $___ ? implode('/', $___) : false, 'q' => false))), $t ? $t : '..'); } ?> <td colspan="3"><?php echo implode(' » ', array_reverse($__)) . ' » ' . File::B($q_path); ?> </td> <td class="td-icon"><?php echo Jot::a('accept', $config->url_path . $q_path_parent_, Jot::icon('folder-open'), array('title' => $speak->exit . '…')); ?> </td> <td class="td-icon"><?php echo Jot::a('destruct', $asset_url_kill . $q_path . $q_path_parent_, Jot::icon('times'), array('title' => $speak->delete)); ?> </td> </tr>
<?php $c_path = SHIELD . DS . $the_shield_folder . DS; $c_url = $config->manager->slug . '/shield/' . $the_shield_folder; $c_url_kill = $c_url . '/kill/file:'; $c_url_repair = $c_url . '/repair/file:'; include DECK . DS . 'workers' . DS . 'unit.explorer.1.php'; ?> </div> <div class="tab-content hidden" id="tab-content-1-2"> <p class="about-author"> <?php echo Cell::strong($speak->author . ':') . ' ' . Text::parse($the_shield_info['author'], '->encoded_html'); if (isset($the_shield_info['url']) && $the_shield_info['url'] !== '#') { ?> <?php echo Cell::a($the_shield_info['url'], Jot::icon('external-link-square'), '_blank', array('class' => array('about-url', 'help'), 'title' => $speak->link, 'rel' => 'nofollow')); ?> <?php } ?> </p> <h3 class="about-title"><?php echo $the_shield_info['title']; if (isset($the_shield_info['version'])) { ?> <code class="about-version"><?php echo $the_shield_info['version']; ?> </code><?php } ?>