function article_url() { if ($itm = IoC::resolve('article')) { $page = IoC::resolve('posts_page'); return Url::make($page->slug . '/' . $itm->slug); } return ''; }
protected function login() { if (Router::$IS_AJAX || Router::$IS_IFRAME) { $this->renderError('请先登录!'); } $backUrl = Url::getCurrentUrl(array('back-url' => null)); $url = Url::make('//uc.hqoj.net/login/', array('back-url' => $backUrl)); Url::redirect($url); }
public static function generate() { // create a dom xml object static::$document = new DOMDocument('1.0', 'UTF-8'); // create our rss feed $rss = static::element('rss', null, array('version' => '2.0', 'xmlns:atom' => 'http://www.w3.org/2005/Atom')); static::$document->appendChild($rss); // create channel $channel = static::element('channel'); $rss->appendChild($channel); // title $title = static::element('title', Config::get('metadata.sitename')); $channel->appendChild($title); // link $url = 'http://' . $_SERVER['HTTP_HOST']; $link = static::element('link', $url); $channel->appendChild($link); // description $description = static::element('description', Config::get('metadata.description')); $channel->appendChild($description); // laguage // http://www.rssboard.org/rss-language-codes $language = static::element('language', Config::get('application.language', 'en')); $channel->appendChild($language); $ttl = static::element('ttl', 60); $channel->appendChild($ttl); $docs = static::element('docs', 'http://blogs.law.harvard.edu/tech/rss'); $channel->appendChild($docs); $copyright = static::element('copyright', Config::get('metadata.sitename')); $channel->appendChild($copyright); // atom self link $atom = static::element('atom:link', null, array('href' => $url, 'rel' => 'self', 'type' => 'application/rss+xml')); $channel->appendChild($atom); // articles $params = array('status' => 'published', 'sortby' => 'id', 'sortmode' => 'desc'); foreach (Posts::list_all($params) as $post) { $item = static::element('item'); $channel->appendChild($item); // title $title = static::element('title', $post->title); $item->appendChild($title); // link $url = 'http://' . $_SERVER['HTTP_HOST'] . Url::make(IoC::resolve('posts_page')->slug . '/' . $post->slug); $link = static::element('link', $url); $item->appendChild($link); // description $description = static::element('description', $post->description); $item->appendChild($description); // date $date = static::element('pubDate', date(DATE_RSS, $post->created)); $item->appendChild($date); } // dump xml tree return static::$document->saveXML(); }
public static function extend($post) { if (is_array($post)) { $posts = array(); foreach ($post as $itm) { $posts[] = static::extend($itm); } return $posts; } if (is_object($post)) { $page = IoC::resolve('posts_page'); $post->url = Url::make($page->slug . '/' . $post->slug); return $post; } return false; }
public static function extend($page) { if (is_array($page)) { $pages = array(); foreach ($page as $itm) { $pages[] = static::extend($itm); } return $pages; } if (is_object($page)) { $uri = Request::uri(); $page->url = Url::make($page->slug); $page->active = strlen($uri) ? strpos($uri, $page->slug) !== false : $page->slug === 'posts'; return $page; } return false; }
public static function generate() { // create a dom xml object static::$document = new DOMDocument('1.0', 'UTF-8'); // create our rss feed $rss = static::element('rss', null, array('version' => '2.0')); static::$document->appendChild($rss); // create channel $channel = static::element('channel'); $rss->appendChild($channel); // title $title = static::element('title', Config::get('metadata.sitename')); $channel->appendChild($title); // link $link = static::element('link', 'http://' . $_SERVER['HTTP_HOST']); $channel->appendChild($link); // description $description = static::element('description', Config::get('metadata.description')); $channel->appendChild($description); // articles $params = array('status' => 'published', 'sortby' => 'id', 'sortmode' => 'desc'); foreach (Posts::list_all($params) as $post) { $item = static::element('item'); $channel->appendChild($item); // title $title = static::element('title', $post->title); $item->appendChild($title); // link $url = 'http://' . $_SERVER['HTTP_HOST'] . Url::make(IoC::resolve('posts_page')->slug . '/' . $post->slug); $link = static::element('link', $url); $item->appendChild($link); // description $description = static::element('description', $post->description); $item->appendChild($description); // date $date = static::element('pubDate', date(DATE_RSS, $post->created)); $item->appendChild($date); } // dump xml tree return static::$document->saveXML(); }
public static function extend($page) { if (is_array($page)) { $pages = array(); foreach ($page as $itm) { $pages[] = static::extend($itm); } return $pages; } if (is_object($page)) { $uri = Request::uri(); $page->url = Url::make($page->slug); $page->active = false; if ($current = IoC::resolve('page')) { if ($current->id == $page->id) { $page->active = true; } } return $page; } return false; }
<a href="<?php echo admin_url('pages'); ?> ">Return to pages</a> </p> </form> </section> <aside id="sidebar"> <h2>Editing</h2> <em>Some useful links.</em> <ul> <li><a href="<?php echo Url::make($page->slug); ?> ">View this page on your site</a></li> </ul> </aside> <script src="//ajax.googleapis.com/ajax/libs/mootools/1.4.1/mootools-yui-compressed.js"></script> <script>window.MooTools || document.write('<script src="<?php echo theme_url('assets/js/mootools.js'); ?> "><\/script>');</script> <script src="<?php echo theme_url('assets/js/helpers.js'); ?> "></script> <script>
public static function redirectIdioma($idioma) { Response::setRedirect(Url::make($idioma)); }
public static function recover_password() { $post = Input::post(array('email')); $errors = array(); if (filter_var($post['email'], FILTER_VALIDATE_EMAIL) === false) { $errors[] = 'Please enter a valid email address'; } else { if (($user = static::find(array('email' => $post['email']))) === false) { $errors[] = 'Account not found'; } } if (count($errors)) { Notifications::set('error', $errors); return false; } $hash = hash('md5', $user->id . $user->email . $user->password); $link = Url::build(array('path' => Url::make('admin/users/reset/' . $hash))); $subject = '[' . Config::get('metadata.sitename') . '] Password Reset'; $plain = 'You have requested to reset your password. To continue follow the link below. ' . $link; $headers = array('From' => 'no-reply@' . Input::server('http_host')); Email::send($user->email, $subject, $plain, $headers); Notifications::set('notice', 'We have sent you an email to confirm your password change.'); return true; }
public static function redirect($url) { static::header('Location', Url::make($url)); static::$status = 302; static::$content = ''; }
<?php if (($user = Users::authed()) !== false) { ?> <nav> <ul> <?php foreach (admin_menu() as $title => $url) { ?> <li <?php if (strpos(Url::current(), $url) !== false) { echo 'class="active"'; } ?> > <a href="<?php echo Url::make($url); ?> "><?php echo __('common.' . $title, $title); ?> </a> </li> <?php } ?> </ul> </nav> <p><?php echo __('common.logged_in_as', 'Logged in as'); ?>
function admin_url($url = '') { return Url::make(Config::get('application.admin_folder') . '/' . ltrim($url, '/')); }
public static function getStatusUrl($username, $remote, $problemCode, $result) { $url = Url::make('/status_list/', array('username' => $username, 'remote' => $remote, 'problem-code' => $problemCode, 'result' => $result)); return $url; }
<button name="delete" type="submit">Delete</button> <a href="<?php echo admin_url('posts'); ?> ">Return to posts</a> </p> </form> </section> <aside id="sidebar"> <h2>Editing</h2> <em>Some useful links.</em> <ul> <li><a href="<?php echo Url::make($page->slug . '/' . $article->slug); ?> ">View this post on your site</a></li> </ul> </aside> <script src="//ajax.googleapis.com/ajax/libs/mootools/1.4.1/mootools-yui-compressed.js"></script> <script>window.MooTools || document.write('<script src="<?php echo theme_url('assets/js/mootools.js'); ?> "><\/script>');</script> <script src="<?php echo theme_url('assets/js/helpers.js'); ?> "></script> <script src="<?php
<link rel="stylesheet" href="//sta.hqoj.net/js/plugin/kindeditor/plugins/code/prettify.css" /> <link type="text/css" href="//sta.hqoj.net/css/www/oj/doc_list.page.css" rel="stylesheet"> <div class="sidebar"> <div class="nav" id="sidebar-fixed" > <div class="menu"> <ul> <?php foreach ($this->docList as $docInfo) { ?> <li> <a <?php echo Request::getGET('doc-id') == $docInfo['id'] ? 'class="hover"' : ''; ?> href="<?php echo Url::make(Url::getCurrentUrl(), array('doc-id' => $docInfo['id'])); ?> "> <span class="text"><?php echo $docInfo['title']; ?> </span> </a> </li> <?php } ?> </ul> </div> </div> </div>
function rss_url() { return Url::make('rss'); }
public static function recover_password() { // verify Csrf token if (Csrf::verify(Input::post('token')) === false) { Notifications::set('error', 'Invalid token'); return false; } $post = Input::post(array('email')); $errors = array(); if (Validator::validate_email($post['email']) === false) { $errors[] = Lang::line('users.invalid_email', 'Please enter a valid email address'); } else { if (($user = static::find(array('email' => $post['email']))) === false) { $errors[] = Lang::line('users.invalid_account', 'Account not found'); } } if (count($errors)) { Notifications::set('error', $errors); return false; } $hash = hash('md5', $user->id . $user->email . $user->password); $link = Url::build(array('path' => Url::make('admin/users/reset/' . $hash))); $subject = '[' . Config::get('metadata.sitename') . '] ' . Lang::line('users.user_subject_recover', 'Password Reset'); $plain = Lang::line('users.user_email_recover', 'You have requested to reset your password. To continue follow the link below.') . $link; $headers = array('From' => 'no-reply@' . Input::server('http_host')); Email::send($user->email, $subject, $plain, $headers); Notifications::set('notice', Lang::line('users.user_notice_recover', 'We have sent you an email to confirm your password change.')); return true; }
echo __('users.password', 'Password'); ?> :</label> <input type="password" name="pass" id="pass"> <em><a href="<?php echo admin_url('users/amnesia'); ?> "><?php echo __('users.forgotten_password', 'Forgotten your password?'); ?> </a></em> </p> <p class="buttons"> <button type="submit"><?php echo __('users.login', 'Login'); ?> </button> <a href="<?php echo Url::make(); ?> ">Back to <?php echo Config::get('metadata.sitename'); ?> </a> </p> </fieldset> </form> </section>
<a href="/setup_uc_update/">会员中心</a> | <a href="<?php echo Url::make('//uc.hqoj.net/logout/', array('back-url' => Url::getCurrentUrl(array('back-url' => null)))); ?> ">退出</a> </div> <?php } else { ?> <div> <a href="<?php echo Url::make('//uc.hqoj.net/login/', array('back-url' => Url::getCurrentUrl(array('back-url' => null)))); ?> ">登录</a> | <a href="<?php echo Url::make('//uc.hqoj.net/register/', array('back-url' => Url::getCurrentUrl(array('back-url' => null)))); ?> ">注册</a> </div> <?php } ?> </td> </tr> </tbody> </table> </div> </div> <div class="module-wrap">