function do_private_post($content, $results) { global $config, $speak; $results = Mecha::O($results); $results = $config->is->post ? Get::postHeader($results->path, POST . DS . $config->page_type, '/', $config->page_type . ':') : false; if ($results === false) { return $speak->plugin_private_post->description; } $s = isset($results->fields->pass) ? $results->fields->pass : ""; if (strpos($s, ':') !== false) { $s = explode(':', $s, 2); if (isset($s[1])) { $speak->plugin_private_post->hint = ltrim($s[1]); } // override password hint $s = $s[0]; } $hash = md5($s . PRIVATE_POST_SALT); $html = Notify::read(false) . '<div class="overlay--' . File::B(__DIR__) . '"></div><form class="form--' . File::B(__DIR__) . '" action="' . $config->url . '/' . File::B(__DIR__) . '/do:access" method="post">' . NL; $html .= TAB . Form::hidden('token', Guardian::token()) . NL; $html .= TAB . Form::hidden('_', $hash) . NL; $html .= TAB . Form::hidden('kick', $config->url_current) . NL; $html .= TAB . '<p>' . $speak->plugin_private_post->hint . '</p>' . NL; $html .= TAB . '<p>' . Form::text('access', "", $speak->password . '…', array('autocomplete' => 'off')) . ' ' . Form::button($speak->submit, null, 'submit') . '</p>' . NL; $html .= '</form>' . O_END; if ($results && isset($results->fields->pass) && trim($results->fields->pass) !== "") { if (!Guardian::happy() && Session::get('is_allow_post_access') !== $hash) { return $html; } } return $content; }
/** * Default Shortcut Variable(s) * ---------------------------- */ public static function cargo() { $config = Config::get(); $token = Guardian::token(); $results = array('config' => $config, 'speak' => $config->speak, 'articles' => $config->articles, 'article' => $config->article, 'pages' => $config->pages, 'page' => $config->page, 'pager' => $config->pagination, 'manager' => Guardian::happy(), 'token' => $token, 'messages' => Notify::read(false), 'message' => Notify::read(false)); Session::set(Guardian::$token, $token); unset($config, $token); self::$lot = array_merge(self::$lot, $results); return self::$lot; }
/** * Default Shortcut Variable(s) * ---------------------------- */ public static function cargo() { $config = Config::get(); $token = Guardian::token(); $message = Notify::read(); $results = array('config' => $config, 'speak' => $config->speak, 'articles' => $config->articles, 'article' => $config->article, 'pages' => $config->pages, 'page' => $config->page, 'responses' => $config->responses, 'response' => $config->response, 'files' => $config->files, 'file' => $config->file, 'pager' => $config->pagination, 'manager' => Guardian::happy(), 'token' => $token, 'messages' => $message); Session::set(Guardian::$token, $token); Session::set(Notify::$message, $message); unset($config, $token, $message); return array_merge($results, self::$lot); }
}); } // `<a class="text-error">` Jot::add('a', function ($kind = 'default', $href = null, $text = "", $attr = array(), $indent = 0) { $attr['href'] = Converter::url($href); if (!isset($attr['class'])) { $attr['class'] = array(); } $attr['class'] = array_merge(array('text-' . $kind), (array) $attr['class']); return Cell::unit('a', $text, $attr, $indent); }); // File uploader Jot::add('uploader', function ($action, $accept = null, $fields = array()) { $speak = Config::speak(); $html = Cell::begin('form', array('class' => array('form-ignite', 'form-upload'), 'action' => Converter::url($action), 'method' => 'post', 'enctype' => 'multipart/form-data')) . NL; $html .= Form::hidden('token', Guardian::token(), array(), 1) . NL; foreach ($fields as $name => $value) { $html .= Form::hidden($name, $value, array(), 1) . NL; } $html .= Cell::begin('span', array('class' => array('input-outer', 'btn', 'btn-default')), 1) . NL; $html .= Cell::unit('span', Jot::icon('folder-open') . ' ' . $speak->manager->placeholder_file, array(), 2) . NL; $html .= Form::file('file', array('title' => $speak->manager->placeholder_file, 'data' => array('icon-ready' => 'fa fa-check', 'icon-error' => 'fa fa-times', 'accepted-extensions' => $accept)), 2) . NL; $html .= Cell::end() . ' ' . Jot::button('action:cloud-upload', $speak->upload) . NL; $html .= Cell::end(); return $html; }); // File finder Jot::add('finder', function ($action, $name = 'q', $fields = array()) { $html = Cell::begin('form', array('class' => 'form-ignite form-find', 'action' => Converter::url($action), 'method' => 'get')) . NL; foreach ($fields as $key => $value) { $html .= Form::hidden($key, $value) . NL;