当前位置: 首页>>代码示例>>PHP>>正文


PHP oneof函数代码示例

本文整理汇总了PHP中oneof函数的典型用法代码示例。如果您正苦于以下问题:PHP oneof函数的具体用法?PHP oneof怎么用?PHP oneof使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了oneof函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get

 /**
  * get config entry
  * @param $name
  * @return mixed
  */
 public function get($name)
 {
     if (oneof($name, 'pref', 'spam', 'data', 'min')) {
         trigger_error("Usage of config value env/{$name} is deprecated.", E_USER_DEPRECATED);
     }
     return $this->config[$name];
 }
开发者ID:frogsystem,项目名称:legacy-bridge,代码行数:12,代码来源:ConfigEnv.php

示例2: __construct

 /**
  * Function: __construct
  * Parse the URL and to determine what to do.
  *
  * Parameters:
  *     $controller - The controller to use.
  */
 private function __construct($controller)
 {
     $this->controller = $controller;
     $config = Config::current();
     $this->action =& $_GET['action'];
     if (isset($_GET['feed'])) {
         $this->feed = true;
     }
     # Parse the current URL and extract information.
     $parse = parse_url($config->url);
     fallback($parse["path"], "/");
     if (isset($controller->base)) {
         $parse["path"] = trim($parse["path"], "/") . "/" . trim($controller->base, "/") . "/";
     }
     $this->safe_path = str_replace("/", "\\/", $parse["path"]);
     $this->request = $parse["path"] == "/" ? $_SERVER['REQUEST_URI'] : preg_replace("/{$this->safe_path}?/", "", $_SERVER['REQUEST_URI'], 1);
     $this->arg = array_map("urldecode", explode("/", trim($this->request, "/")));
     if (method_exists($controller, "parse")) {
         $controller->parse($this);
     }
     Trigger::current()->call("parse_url", $this);
     $this->try[] = isset($this->action) ? oneof($this->action, "index") : (!substr_count($this->arg[0], "?") ? oneof(@$this->arg[0], "index") : "index");
     # Guess the action initially.
     # This is only required because of the view_site permission;
     # it has to know if they're viewing /login, in which case
     # it should allow the page to display.
     fallback($this->action, end($this->try));
 }
开发者ID:relisher,项目名称:chyrp,代码行数:35,代码来源:Route.php

示例3: main_index

 public function main_index($main)
 {
     $config = Config::current();
     if ($config->disable_aggregation or time() - $config->last_aggregation < $config->aggregate_every * 60) {
         return;
     }
     $aggregates = (array) $config->aggregates;
     if (empty($aggregates)) {
         return;
     }
     foreach ($aggregates as $name => $feed) {
         $xml_contents = preg_replace(array("/<(\\/?)dc:date>/", "/xmlns=/"), array("<\\1date>", "a="), get_remote($feed["url"]));
         $xml = simplexml_load_string($xml_contents, "SimpleXMLElement", LIBXML_NOCDATA);
         if ($xml === false) {
             continue;
         }
         # Flatten namespaces recursively
         $this->flatten($xml);
         $items = array();
         if (isset($xml->entry)) {
             foreach ($xml->entry as $entry) {
                 array_unshift($items, $entry);
             }
         } elseif (isset($xml->item)) {
             foreach ($xml->item as $item) {
                 array_unshift($items, $item);
             }
         } else {
             foreach ($xml->channel->item as $item) {
                 array_unshift($items, $item);
             }
         }
         foreach ($items as $item) {
             $date = oneof(@$item->pubDate, @$item->date, @$item->updated, 0);
             $updated = strtotime($date);
             if ($updated > $feed["last_updated"]) {
                 # Get creation date ('created' in Atom)
                 $created = @$item->created ? strtotime($item->created) : 0;
                 if ($created <= 0) {
                     $created = $updated;
                 }
                 # Construct the post data from the user-defined XPath mapping:
                 $data = array("aggregate" => $name);
                 foreach ($feed["data"] as $attr => $field) {
                     $field = !empty($field) ? $this->parse_field($field, $item) : "";
                     $data[$attr] = is_string($field) ? $field : YAML::dump($field);
                 }
                 if (isset($data["title"]) or isset($data["name"])) {
                     $clean = sanitize(oneof(@$data["title"], @$data["name"]));
                 }
                 Post::add($data, $clean, null, $feed["feather"], $feed["author"], false, "public", datetime($created), datetime($updated));
                 $aggregates[$name]["last_updated"] = $updated;
             }
         }
     }
     $config->set("aggregates", $aggregates);
     $config->set("last_aggregation", time());
 }
开发者ID:eadz,项目名称:chyrp,代码行数:58,代码来源:aggregator.php

示例4: display_error

function display_error($string)
{
    $thumbnail = imagecreatetruecolor(oneof(@$_GET['max_width'], 100), 18);
    imagestring($thumbnail, 1, 5, 5, $string, imagecolorallocate($thumbnail, 255, 255, 255));
    header("Content-type: image/png");
    header("Content-Disposition: inline; filename=error.png");
    imagepng($thumbnail);
    exit;
}
开发者ID:betsyzhang,项目名称:chyrp,代码行数:9,代码来源:thumb.php

示例5: __construct

 /**
  * Function: __construct
  * See Also:
  *     <Model::grab>
  */
 public function __construct($group_id = null, $options = array())
 {
     $options["left_join"][] = array("table" => "permissions", "where" => "group_id = groups.id");
     $options["select"][] = "groups.*";
     $options["select"][] = "permissions.id AS permissions";
     parent::grab($this, $group_id, $options);
     $this->permissions = (array) oneof(@$this->permissions, array());
     if ($this->no_results) {
         return false;
     }
     Trigger::current()->filter($this, "group");
 }
开发者ID:betsyzhang,项目名称:chyrp,代码行数:17,代码来源:Group.php

示例6: add

 /**
  * Function: add
  * Adds a type to the database.
  *
  * Calls the add_type trigger with the inserted type.
  *
  * Parameters:
  *     $name - The title of the new type.
  *     $description - The description of the new type.
  *
  * Returns:
  *     $type - The newly created type.
  *
  * See Also:
  *     <update>
  */
 static function add($name, $description = "", $color = "0a0a0a", $clean = null, $url = null)
 {
     $sql = SQL::current();
     $clean = oneof($clean, sanitize($name));
     $sql->insert("types", array("name" => $name, "description" => $description, "color" => $color, "clean" => $clean, "url" => oneof($url, self::check_url($clean))));
     $type = new self($sql->latest());
     Trigger::current()->call("add_type", $type);
     if (module_enabled("cacher")) {
         Modules::$instances["cacher"]->regenerate();
     }
     return $type;
 }
开发者ID:vito,项目名称:chyrp-site,代码行数:28,代码来源:Type.php

示例7: add

 /**
  * Function: add
  * Adds a page to the database.
  *
  * Calls the @add_page@ trigger with the new <Page>.
  *
  * Parameters:
  *     $title - The Title for the new page.
  *     $body - The Body for the new page.
  *     $body - The <User> or <User.id> of the page's author.
  *     $parent_id - The ID of the new page's parent page (0 for none).
  *     $show_in_list - Whether or not to show it in the pages list.
  *     $list_order - The order of the page in the list.
  *     $clean - The clean URL.
  *     $url - The unique URL.
  *     $created_at - The new page's "created" timestamp.
  *     $updated_at - The new page's "last updated" timestamp.
  *
  * Returns:
  *     The newly created <Page>.
  *
  * See Also:
  *     <update>
  */
 static function add($title, $body, $user = null, $parent_id = 0, $show_in_list = true, $list_order = 0, $clean = "", $url = "", $created_at = null, $updated_at = "0000-00-00 00:00:00")
 {
     $user_id = $user instanceof User ? $user->id : $user;
     $sql = SQL::current();
     $visitor = Visitor::current();
     $trigger = Trigger::current();
     $new_values = array("title" => $title, "body" => $body, "user_id" => oneof($user_id, $visitor->id), "parent_id" => oneof($parent_id, 0), "show_in_list" => oneof($show_in_list, true), "list_order" => oneof($list_order, 0), "clean" => oneof($clean, sanitize($title)), "url" => oneof($url, self::check_url($clean)), "created_at" => oneof($created_at, datetime()), "updated_at" => oneof($updated_at, "0000-00-00 00:00:00"));
     $trigger->filter($new_values, "before_add_page");
     $sql->insert("pages", $new_values);
     $page = new self($sql->latest());
     $trigger->call("add_page", $page);
     return $page;
 }
开发者ID:homebru,项目名称:bandb,代码行数:37,代码来源:Page.php

示例8: format_dialogue

 public function format_dialogue($text, $post = null)
 {
     if (isset($post)) {
         $post->dialogue_unformatted = $text;
     }
     $split = explode("\n", $text);
     $return = '<ul class="dialogue">';
     $count = 0;
     $my_name = "";
     $links = array();
     foreach ($split as $line) {
         # Remove the timstamps
         $line = preg_replace("/[ ]?[\\[|\\(]?[0-9]{1,2}:[0-9]{2}(:[0-9]{2})?[ ]?(pm|am)?[\\]|\\)]?[ ]?/i", "", $line);
         preg_match("/(<?)(.+)(:|>)\\s*(.+)/i", $line, $matches);
         if (empty($matches)) {
             continue;
         }
         if (preg_match("/\\s*\\(([^\\)]+)\\)\$/", $matches[2], $attribution)) {
             if ($attribution[1] == "me") {
                 $my_name = $matches[2] = str_replace($attribution[0], "", $matches[2]);
             } else {
                 $matches[2] = str_replace($attribution[0], "", $matches[2]);
                 $links[$matches[2]] = $attribution[1];
             }
         }
         $link = oneof(@$links[$matches[2]], "");
         $me = $my_name == $matches[2] ? " me" : "";
         $username = $matches[1] . $matches[2] . $matches[3];
         $class = $count % 2 ? "even" : "odd";
         $return .= '<li class="' . $class . $me . '">';
         if (!empty($link)) {
             $return .= '<span class="label">' . $matches[1] . '<a href="' . $link . '">' . fix($matches[2], false) . '</a>' . $matches[3] . '</span> ' . $matches[4] . "\n";
         } else {
             $return .= '<span class="label">' . fix($username, false) . '</span> ' . $matches[4] . "\n";
         }
         $return .= '</li>';
         $count++;
     }
     $return .= "</ul>";
     # If they're previewing.
     if (!isset($post)) {
         $return = preg_replace("/(<li class=\"(even|odd) me\"><span class=\"label\">)(.+)(<\\/span> (.+)\n<\\/li>)/", "\\1<strong>\\3</strong>\\4", $return);
     }
     return $return;
 }
开发者ID:eadz,项目名称:chyrp,代码行数:45,代码来源:chat.php

示例9: __construct

 /**
  * Function: __construct
  * Prepares an array for pagination.
  *
  * Parameters:
  *     $array - The array to paginate.
  *     $per_page - Number of items per page.
  *     $name - The name of the $_GET parameter to use for determining the current page.
  *     $model - If this is true, each item in $array that gets shown on the page will be
  *              initialized as a model of whatever is passed as the second argument to $array.
  *              The first argument of $array is expected to be an array of IDs.
  *     $page - Page number to start at.
  *
  * Returns:
  *     A paginated array of length $per_page or smaller.
  */
 public function __construct($array, $per_page = 5, $name = "page", $model = null, $page = null)
 {
     self::$names[] = $name;
     $this->array = (array) $array;
     $this->per_page = $per_page;
     $this->name = $name;
     $this->model = fallback($model, count($this->array) == 2 and is_array($this->array[0]) and is_string($this->array[1]) and class_exists($this->array[1]));
     if ($model) {
         list($this->array, $model_name) = $this->array;
     }
     $this->total = count($this->array);
     $this->page = oneof($page, @$_GET[$name], 1);
     if ($this->per_page != 0) {
         $this->pages = ceil($this->total / $this->per_page);
     } else {
         $this->pages = 0;
     }
     $offset = ($this->page - 1) * $this->per_page;
     $this->result = array();
     if ($model) {
         for ($i = $offset; $i < $offset + $this->per_page; $i++) {
             if (isset($this->array[$i])) {
                 $this->result[] = new $model_name(null, array("read_from" => $this->array[$i]));
             }
         }
     } else {
         $this->result = array_slice($this->array, $offset, $this->per_page);
     }
     $shown_dates = array();
     if ($model) {
         foreach ($this->result as &$result) {
             if (isset($result->created_at)) {
                 $pinned = (isset($result->pinned) and $result->pinned);
                 $shown = in_array(when("m-d-Y", $result->created_at), $shown_dates);
                 $result->first_of_day = (!$pinned and !$shown and !AJAX);
                 if (!$pinned and !$shown) {
                     $shown_dates[] = when("m-d-Y", $result->created_at);
                 }
             }
         }
     }
     $this->paginated = $this->paginate = $this->list =& $this->result;
 }
开发者ID:prych,项目名称:prych,代码行数:59,代码来源:Paginator.php

示例10: __construct

 /**
  * Function: __construct
  * The class constructor is private so there is only one connection.
  *
  * Parameters:
  *     $settings - Settings to load instead of the config.
  */
 private function __construct($settings = array())
 {
     if (!UPGRADING and !INSTALLING and !isset(Config::current()->sql)) {
         error(__("Error"), __("Database configuration is not set. Please run the upgrader."));
     }
     $database = !UPGRADING ? oneof(@Config::current()->sql, array()) : Config::get("sql");
     if (is_array($settings)) {
         fallback($database, $settings);
     } elseif ($settings === true) {
         $this->silence_errors = true;
     }
     if (!empty($database)) {
         foreach ($database as $setting => $value) {
             $this->{$setting} = $value;
         }
     }
     $this->connected = false;
     # We really don't need PDO anymore, since we have the two we supported with it hardcoded (kinda).
     # Keeping this here for when/if we decide to add support for more database engines, like Postgres and MSSQL.
     # if (class_exists("PDO") and (in_array("mysql", PDO::getAvailableDrivers()) or in_array("sqlite", PDO::getAvailableDrivers())))
     #     return $this->method = "pdo";
     if (isset($this->adapter)) {
         if ($this->adapter == "mysql" and class_exists("MySQLi")) {
             $this->method = "mysqli";
         } elseif ($this->adapter == "mysql" and function_exists("mysql_connect")) {
             $this->method = "mysql";
         } elseif (class_exists("PDO") and ($this->adapter == "sqlite" and in_array("sqlite", PDO::getAvailableDrivers()) or $this->adapter == "pgsql" and in_array("pgsql", PDO::getAvailableDrivers()))) {
             $this->method = "pdo";
         }
     } else {
         if (class_exists("MySQLi")) {
             $this->method = "mysqli";
         } elseif (function_exists("mysql_connect")) {
             $this->method = "mysql";
         } elseif (class_exists("PDO") and in_array("mysql", PDO::getAvailableDrivers())) {
             $this->method = "pdo";
         }
     }
 }
开发者ID:betsyzhang,项目名称:chyrp,代码行数:46,代码来源:SQL.php

示例11: login

 /**
  * Function: login
  * Process logging in. If the username and password are incorrect or if the user is already logged in, it will error.
  */
 public function login()
 {
     if (logged_in()) {
         error(__("Error"), __("You're already logged in."));
     }
     if (!empty($_POST)) {
         fallback($_POST['login']);
         fallback($_POST['password']);
         $trigger = Trigger::current();
         if ($trigger->exists("authenticate")) {
             return $trigger->call("authenticate");
         }
         if (!User::authenticate($_POST['login'], $_POST['password'])) {
             if (!count(User::find(array("where" => array("login" => $_POST['login']))))) {
                 Flash::warning(__("There is no user with that login name."));
             } else {
                 Flash::warning(__("Password incorrect."));
             }
         }
         if (!Flash::exists("warning")) {
             $user = new User(array("login" => $_POST['login']));
             $_SESSION['user_id'] = $user->id;
             $redirect = @$_SESSION['redirect_to'];
             unset($_SESSION['redirect_to']);
             Flash::notice(__("Logged in."), oneof($redirect, "/"));
         }
     }
     $this->display("forms/user/login", array(), __("Log In"));
 }
开发者ID:vito,项目名称:chyrp-site,代码行数:33,代码来源:Main.php

示例12: parse

 public function parse($route)
 {
     $config = Config::current();
     if ($this->feed) {
         $this->post_limit = $config->feed_items;
     } else {
         $this->post_limit = $config->posts_per_page;
     }
     if (empty($route->arg[0]) and !isset($config->routes["/"])) {
         # If they're just at /, don't bother with all this.
         return $route->action = "index";
     }
     # Protect non-responder functions.
     if (in_array($route->arg[0], array("__construct", "parse", "display", "current"))) {
         show_404();
     }
     # Feed
     if (preg_match("/\\/feed\\/?\$/", $route->request)) {
         $this->feed = true;
         $this->post_limit = $config->feed_items;
         if ($route->arg[0] == "feed") {
             # Don't set $route->action to "feed" (bottom of this function).
             return $route->action = "index";
         }
     }
     # Feed with a title parameter
     if (preg_match("/\\/feed\\/([^\\/]+)\\/?\$/", $route->request, $title)) {
         $this->feed = true;
         $this->post_limit = $config->feed_items;
         $_GET['title'] = $title[1];
         if ($route->arg[0] == "feed") {
             # Don't set $route->action to "feed" (bottom of this function).
             return $route->action = "index";
         }
     }
     # Paginator
     if (preg_match_all("/\\/((([^_\\/]+)_)?page)\\/([0-9]+)/", $route->request, $page_matches)) {
         foreach ($page_matches[1] as $key => $page_var) {
             $_GET[$page_var] = (int) $page_matches[4][$key];
         }
         if ($route->arg[0] == $page_matches[1][0]) {
             # Don't fool ourselves into thinking we're viewing a page.
             return $route->action = isset($config->routes["/"]) ? $config->routes["/"] : "index";
         }
     }
     # Viewing a type
     if ($route->arg[0] == "type") {
         $_GET['url'] = $route->arg[1];
         return $route->action = "type";
     }
     # Viewing a type (backwards-compatible URL)
     if ($route->arg[0] == "browse") {
         $_GET['url'] = depluralize($route->arg[1]);
         return $route->action = "type";
     }
     # Viewing an extension
     if ($route->arg[0] == "view") {
         $_GET['url'] = $route->arg[1];
         $_GET['version'] = @$route->arg[2];
         return $route->action = "view";
     }
     # Downloading an extension
     if ($route->arg[0] == "download") {
         $_GET['url'] = $route->arg[1];
         $_GET['version'] = @$route->arg[2];
         return $route->action = "download";
     }
     # Loving an extension
     if ($route->arg[0] == "love") {
         $_GET['url'] = $route->arg[1];
         $_GET['version'] = @$route->arg[2];
         return $route->action = "love";
     }
     # Adding an extension
     if ($route->arg[0] == "new_extension") {
         $_GET['type'] = oneof(@$route->arg[1], "module");
         return $route->action = "new_extension";
     }
     # Adding a new version of an extension
     if ($route->arg[0] == "new_version") {
         $_GET['url'] = $route->arg[1];
         return $route->action = "new_version";
     }
     if (in_array($route->arg[0], array("edit_version", "delete_version", "edit_note", "delete_note", "delete_extension"))) {
         $_GET['id'] = $route->arg[1];
         return $route->action = $route->arg[0];
     }
     # Searching
     if ($route->arg[0] == "search") {
         if (isset($route->arg[1])) {
             $_GET['query'] = $route->arg[1];
         }
         return $route->action = "search";
     }
     # Viewing a tag
     if ($route->arg[0] == "tag") {
         $_GET['url'] = $route->arg[1];
         return $route->action = "tag";
     }
     # Custom pages added by Modules, Feathers, Themes, etc.
//.........这里部分代码省略.........
开发者ID:vito,项目名称:chyrp-site,代码行数:101,代码来源:controller.Extend.php

示例13: metaWeblog_editPost

 public function metaWeblog_editPost($args)
 {
     $this->auth($args[1], $args[2], 'edit');
     global $user;
     if (!Post::exists($args[0])) {
         return new IXR_Error(500, __("Post not found."));
     }
     # Support for extended body
     $body = $args[3]['description'];
     if (!empty($args[3]['mt_text_more'])) {
         $body .= '<!--more-->' . $args[3]['mt_text_more'];
     }
     # Add excerpt to body so it isn't lost
     if (!empty($args[3]['mt_excerpt'])) {
         $body = $args[3]['mt_excerpt'] . "\n\n" . $body;
     }
     if (trim($body) === '') {
         return new IXR_Error(500, __("Body can't be blank."));
     }
     $post = new Post($args[0], array('filter' => false));
     # More specific permission check
     if (!$post->editable($user)) {
         return new IXR_Error(500, __("You don't have permission to edit this post."));
     }
     # Enforce post status when necessary
     if (!$user->group->can('edit_own_post', 'edit_post')) {
         $status = 'draft';
     } else {
         if ($post->status !== 'public' and $post->status !== 'draft') {
             $status = $post->status;
         } else {
             $status = $args[4] ? 'public' : 'draft';
         }
     }
     $trigger = Trigger::current();
     $trigger->call('metaWeblog_editPost_preQuery', $args[3], $post);
     $post->update(array('title' => $args[3]['title'], 'body' => $body), null, null, $status, sanitize(oneof(@$args[3]['mt_basename'], $args[3]['title'])), oneof($this->convertFromDateCreated($args[3]), $post->created_at));
     $trigger->call('metaWeblog_editPost', $args[3], $post);
     return true;
 }
开发者ID:relisher,项目名称:chyrp,代码行数:40,代码来源:xmlrpc.php

示例14: exit

    exit("Chyrp requires PHP 5.1.3 or greater. Installation cannot continue.");
}
require_once INCLUDES_DIR . "/helpers.php";
require_once INCLUDES_DIR . "/lib/gettext/gettext.php";
require_once INCLUDES_DIR . "/lib/gettext/streams.php";
require_once INCLUDES_DIR . "/lib/YAML.php";
require_once INCLUDES_DIR . "/lib/PasswordHash.php";
require_once INCLUDES_DIR . "/class/Config.php";
require_once INCLUDES_DIR . "/class/SQL.php";
require_once INCLUDES_DIR . "/class/Model.php";
require_once INCLUDES_DIR . "/model/User.php";
# Prepare the Config interface.
$config = Config::current();
# Atlantic/Reykjavik is 0 offset. Set it so the timezones() function is
# always accurate, even if the server has its own timezone settings.
$default_timezone = oneof(ini_get("date.timezone"), "Atlantic/Reykjavik");
set_timezone($default_timezone);
# Sanitize all input depending on magic_quotes_gpc's enabled status.
sanitize_input($_GET);
sanitize_input($_POST);
sanitize_input($_COOKIE);
sanitize_input($_REQUEST);
$url = "http://chyrp.net/demos/" . $num;
$index = parse_url($url, PHP_URL_PATH) ? "/" . trim(parse_url($url, PHP_URL_PATH), "/") . "/" : "/";
$htaccess = "<IfModule mod_rewrite.c>\nRewriteEngine On\nRewriteBase {$index}\nRewriteCond %{REQUEST_FILENAME} !-f\n" . "RewriteCond %{REQUEST_FILENAME} !-d\nRewriteRule ^.+\$ index.php [L]\n</IfModule>";
$path = preg_quote($index, "/");
$htaccess_has_chyrp = (file_exists(MAIN_DIR . "/.htaccess") and preg_match("/<IfModule mod_rewrite\\.c>\n([\\s]*)RewriteEngine On\n([\\s]*)RewriteBase {$path}\n" . "([\\s]*)RewriteCond %\\{REQUEST_FILENAME\\} !-f\n([\\s]*)RewriteCond %\\{REQUEST_FILENAME\\}" . " !-d\n([\\s]*)RewriteRule \\^\\.\\+\\\$ index\\.php \\[L\\]\n([\\s]*)<\\/IfModule>/", file_get_contents(MAIN_DIR . "/.htaccess")));
$errors = array();
$installed = false;
if (file_exists(INCLUDES_DIR . "/config.yaml.php") and file_exists(MAIN_DIR . "/.htaccess")) {
    $sql = SQL::current(true);
开发者ID:vito,项目名称:chyrp-site,代码行数:31,代码来源:index.php

示例15: login

 /**
  * Function: login
  * Process logging in. If the username and password are incorrect or if the user is already logged in, it will error.
  */
 public function login()
 {
     if (logged_in()) {
         error(__("Error"), __("You're already logged in."));
     }
     if (!empty($_POST)) {
         fallback($_POST['login']);
         fallback($_POST['password']);
         $trigger = Trigger::current();
         if ($trigger->exists("authenticate")) {
             return $trigger->call("authenticate");
         }
         if (!User::authenticate($_POST['login'], $_POST['password'])) {
             Flash::warning(__("Incorrect username and/or password, please try again."));
         }
         if (!Flash::exists("warning")) {
             $user = new User(array("login" => $_POST['login']));
             $_SESSION['user_id'] = $user->id;
             if (!isset($redirect)) {
                 $redirect = oneof(@$_SESSION['redirect_to'], "/");
                 unset($_SESSION['redirect_to']);
             }
             Flash::notice(__("Logged in."), $redirect);
         }
     }
     $this->display("forms/user/login", array(), __("Log In"));
 }
开发者ID:betsyzhang,项目名称:chyrp,代码行数:31,代码来源:Main.php


注:本文中的oneof函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。