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


PHP Kohana::lang方法代码示例

本文整理汇总了PHP中Kohana::lang方法的典型用法代码示例。如果您正苦于以下问题:PHP Kohana::lang方法的具体用法?PHP Kohana::lang怎么用?PHP Kohana::lang使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Kohana的用法示例。


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

示例1: index

 public function index($feedtype = 'rss2')
 {
     if (!Kohana::config('settings.allow_feed')) {
         throw new Kohana_404_Exception();
     }
     if ($feedtype != 'atom' and $feedtype != 'rss2') {
         throw new Kohana_404_Exception();
     }
     // How Many Items Should We Retrieve?
     $limit = (isset($_GET['l']) and !empty($_GET['l']) and (int) $_GET['l'] <= 200) ? (int) $_GET['l'] : 20;
     // Start at which page?
     $page = (isset($_GET['p']) and !empty($_GET['p']) and (int) $_GET['p'] >= 1) ? (int) $_GET['p'] : 1;
     $page_position = $page == 1 ? 0 : $page * $limit;
     // Query position
     $site_url = url::base();
     // Cache the Feed with subdomain in the cache name if mhi is set
     $subdomain = '';
     if (substr_count($_SERVER["HTTP_HOST"], '.') > 1 and Kohana::config('config.enable_mhi') == TRUE) {
         $subdomain = substr($_SERVER["HTTP_HOST"], 0, strpos($_SERVER["HTTP_HOST"], '.'));
     }
     $cache = Cache::instance();
     $feed_items = $cache->get($subdomain . '_feed_' . $limit . '_' . $page);
     if ($feed_items == NULL) {
         // Cache is Empty so Re-Cache
         $incidents = ORM::factory('incident')->where('incident_active', '1')->orderby('incident_date', 'desc')->limit($limit, $page_position)->find_all();
         $items = array();
         foreach ($incidents as $incident) {
             $categories = array();
             foreach ($incident->category as $category) {
                 $categories[] = (string) $category->category_title;
             }
             $item = array();
             $item['id'] = $incident->id;
             $item['title'] = $incident->incident_title;
             $item['link'] = $site_url . 'reports/view/' . $incident->id;
             $item['description'] = $incident->incident_description;
             $item['date'] = $incident->incident_date;
             $item['categories'] = $categories;
             if ($incident->location_id != 0 and $incident->location->longitude and $incident->location->latitude) {
                 $item['point'] = array($incident->location->latitude, $incident->location->longitude);
                 $items[] = $item;
             }
         }
         $cache->set($subdomain . '_feed_' . $limit . '_' . $page, $items, array('feed'), 3600);
         // 1 Hour
         $feed_items = $items;
     }
     $feedpath = $feedtype == 'atom' ? 'feed/atom/' : 'feed/';
     header('Content-Type: application/' . ($feedtype == 'atom' ? 'atom' : 'rss') . '+xml; charset=utf-8');
     $view = new View('feed/' . $feedtype);
     $view->feed_title = Kohana::config('settings.site_name');
     $view->site_url = $site_url;
     $view->georss = 1;
     // this adds georss namespace in the feed
     $view->feed_url = $site_url . $feedpath;
     $view->feed_date = gmdate("D, d M Y H:i:s T", time());
     $view->feed_description = Kohana::lang('ui_admin.incident_feed') . ' ' . Kohana::config('settings.site_name');
     $view->items = $feed_items;
     $view->render(TRUE);
 }
开发者ID:Dirichi,项目名称:Ushahidi_Web,代码行数:60,代码来源:feed.php

示例2: envoyer

 /**
  * Methode : page envoyer le mailing
  */
 public function envoyer()
 {
     if ($_POST) {
         $texte = $this->input->post('texte');
         $format = $this->input->post('format');
         $sujet = $this->input->post('sujet');
         $format = $format == 1 ? TRUE : FALSE;
         $users = $this->user->select();
         $nbr_envois = 0;
         foreach ($users as $user) {
             if ($format) {
                 $view = new View('mailing/template');
                 $view->name = ucfirst(mb_strtolower($user->username));
                 $view->content = $texte;
                 $message = $view->render();
             } else {
                 $message = $texte;
             }
             if (email::send($user->email, Kohana::config('email.from'), $sujet, $message, $format)) {
                 $nbr_envois++;
             }
         }
         return url::redirect('mailing?msg=' . urlencode(Kohana::lang('mailing.send_valide', number_format($nbr_envois))));
     } else {
         return parent::redirect_erreur('mailing');
     }
 }
开发者ID:ezioms,项目名称:RpgEditor,代码行数:30,代码来源:mailing.php

示例3: index

 function index()
 {
     $this->template->content = new View('members/dashboard');
     $this->template->content->title = Kohana::lang('ui_admin.dashboard');
     $this->template->this_page = 'dashboard';
     // User
     $this->template->content->user = $this->user;
     // User Reputation Score
     $this->template->content->reputation = reputation::calculate($this->user->id);
     // Get Badges
     $this->template->content->badges = Badge_Model::users_badges($this->user->id);
     // Retrieve Dashboard Counts...
     // Total Reports
     $this->template->content->reports_total = ORM::factory('incident')->where("user_id", $this->user->id)->count_all();
     // Total Unapproved Reports
     $this->template->content->reports_unapproved = ORM::factory('incident')->where('incident_active', '0')->where("user_id", $this->user->id)->count_all();
     // Total Checkins
     $this->template->content->checkins = ORM::factory('checkin')->where("user_id", $this->user->id)->count_all();
     // Total Alerts
     $this->template->content->alerts = ORM::factory('alert')->where("user_id", $this->user->id)->count_all();
     // Total Votes
     $this->template->content->votes = ORM::factory('rating')->where("user_id", $this->user->id)->count_all();
     // Total Votes Positive
     $this->template->content->votes_up = ORM::factory('rating')->where("user_id", $this->user->id)->where("rating", "1")->count_all();
     // Total Votes Negative
     $this->template->content->votes_down = ORM::factory('rating')->where("user_id", $this->user->id)->where("rating", "-1")->count_all();
     // Get reports for display
     $this->template->content->incidents = ORM::factory('incident')->where("user_id", $this->user->id)->limit(5)->orderby('incident_dateadd', 'desc')->find_all();
     // To support the "welcome" or "not enough info on user" form
     if ($this->user->public_profile == 1) {
         $this->template->content->profile_public = TRUE;
         $this->template->content->profile_private = FALSE;
     } else {
         $this->template->content->profile_public = FALSE;
         $this->template->content->profile_private = TRUE;
     }
     $this->template->content->hidden_welcome_fields = array('email' => $this->user->email, 'notify' => $this->user->notify, 'color' => $this->user->color, 'password' => '', 'needinfo' => 0);
     /*
     // Javascript Header
     $this->template->flot_enabled = TRUE;
     $this->template->js = new View('admin/dashboard_js');
     // Graph
     $this->template->js->all_graphs = Incident_Model::get_incidents_by_interval('ALL',NULL,NULL,'all');
     $this->template->js->current_date = date('Y') . '/' . date('m') . '/01';
     */
     // Javascript Header
     $this->template->protochart_enabled = TRUE;
     $this->template->js = new View('admin/stats_js');
     $this->template->content->failure = '';
     // Build dashboard chart
     // Set the date range (how many days in the past from today?)
     // Default to one year if invalid or not set
     $range = (isset($_GET['range']) and preg_match('/^\\d+$/', $_GET['range']) > 0) ? (int) $_GET['range'] : 365;
     // Phase 3 - Invoke Kohana's XSS cleaning mechanism just incase an outlier wasn't caught
     $range = $this->input->xss_clean($range);
     $incident_data = Incident_Model::get_number_reports_by_date($range, $this->user->id);
     $data = array('Reports' => $incident_data);
     $options = array('xaxis' => array('mode' => '"time"'));
     $this->template->content->report_chart = protochart::chart('report_chart', $data, $options, array('Reports' => 'CC0000'), 410, 310);
 }
开发者ID:nemmy,项目名称:Ushahidi_Web,代码行数:60,代码来源:dashboard.php

示例4: index

 public function index()
 {
     $this->template = "";
     $this->auto_render = FALSE;
     // First is IMAP PHP Library Installed?
     $modules = new Modulecheck();
     if ($modules->isLoaded('imap')) {
         // If SSL Enabled
         $ssl = Kohana::config('settings.email_ssl') == true ? "/ssl" : "";
         // Do not validate certificates (TLS/SSL server)
         //$novalidate = strtolower(Kohana::config('settings.email_servertype')) == "imap" ? "/novalidate-cert" : "";
         $novalidate = "/novalidate-cert";
         // If POP3 Disable TLS
         $notls = strtolower(Kohana::config('settings.email_servertype')) == "pop3" ? "/notls" : "";
         $service = "{" . Kohana::config('settings.email_host') . ":" . Kohana::config('settings.email_port') . "/" . Kohana::config('settings.email_servertype') . $notls . $ssl . $novalidate . "}";
         // Connected!
         if (@imap_open($service, Kohana::config('settings.email_username'), Kohana::config('settings.email_password'), 0, 1)) {
             echo json_encode(array("status" => "success", "message" => Kohana::lang('ui_main.success')));
         } else {
             echo json_encode(array("status" => "error", "message" => Kohana::lang('ui_main.error') . " - " . imap_last_error()));
         }
     } else {
         echo json_encode(array("status" => "error", "message" => Kohana::lang('ui_main.error') . " - " . Kohana::lang('ui_admin.error_imap')));
     }
 }
开发者ID:kjgarza,项目名称:ushahidi,代码行数:25,代码来源:test_email.php

示例5: index

 /**
  * Displays all reports.
  */
 public function index()
 {
     $this->template->header->this_page = Kohana::lang('ui_admin.feeds');
     $this->template->content = new View('feeds');
     // Pagination
     $pagination = new Pagination(array('query_string' => 'page', 'items_per_page' => (int) Kohana::config('settings.items_per_page'), 'total_items' => ORM::factory('feed_item')->count_all()));
     $feeds = ORM::factory('feed_item')->orderby('item_date', 'desc')->find_all((int) Kohana::config('settings.items_per_page'), $pagination->sql_offset);
     $this->template->content->feeds = $feeds;
     //Set default as not showing pagination. Will change below if necessary.
     $this->template->content->pagination = '';
     // Pagination and Total Num of Report Stats
     if ($pagination->total_items == 1) {
         $plural = '';
     } else {
         $plural = 's';
     }
     if ($pagination->total_items > 0) {
         $current_page = $pagination->sql_offset / (int) Kohana::config('settings.items_per_page') + 1;
         $total_pages = ceil($pagination->total_items / (int) Kohana::config('settings.items_per_page'));
         if ($total_pages > 1) {
             // If we want to show pagination
             $this->template->content->pagination_stats = Kohana::lang('ui_admin.showing_page') . ' ' . $current_page . ' ' . Kohana::lang('ui_admin.of') . ' ' . $total_pages . ' ' . Kohana::lang('ui_admin.pages');
             $this->template->content->pagination = $pagination;
         } else {
             // If we don't want to show pagination
             $this->template->content->pagination_stats = $pagination->total_items . ' ' . Kohana::lang('ui_admin.feeds');
         }
     } else {
         $this->template->content->pagination_stats = $pagination->total_items . ' ' . Kohana::lang('ui_admin.feeds');
     }
     /*$icon_html = array();
     		$icon_html[1] = "<img src=\"".url::base()."media/img/image.png\">"; //image
     		$icon_html[2] = "<img src=\"".url::base()."media/img/video.png\">"; //video
     		$icon_html[3] = ""; //audio
     		$icon_html[4] = ""; //news
     		$icon_html[5] = ""; //podcast
     		
     		//Populate media icon array
     		$this->template->content->media_icons = array();
     		foreach($incidents as $incident)
     		{
     			$incident_id = $incident->id;
     			if(ORM::factory('media')
                    ->where('incident_id', $incident_id)->count_all() > 0)
     			{
     				$medias = ORM::factory('media')
                               ->where('incident_id', $incident_id)->find_all();
     				
     				//Modifying a tmp var prevents Kohona from throwing an error
     				$tmp = $this->template->content->media_icons;
     				$tmp[$incident_id] = '';
     				
     				foreach($medias as $media)
     				{
     					$tmp[$incident_id] .= $icon_html[$media->media_type];
     					$this->template->content->media_icons = $tmp;
     				}
     			}
     		}*/
 }
开发者ID:surflightroy,项目名称:Ushahidi_Web,代码行数:63,代码来源:feeds.php

示例6: notify_admins

 public function notify_admins($subject = NULL, $message = NULL)
 {
     // Don't show the exceptions for this operation to the user. Log them
     // instead
     try {
         if ($subject && $message) {
             $settings = kohana::config('settings');
             $from = array();
             $from[] = $settings['site_email'];
             $from[] = $settings['site_name'];
             $users = ORM::factory('user')->where('notify', 1)->find_all();
             foreach ($users as $user) {
                 if ($user->has(ORM::factory('role', 'admin'))) {
                     $address = $user->email;
                     $message .= "\n\n\n\n~~~~~~~~~~~~\n" . Kohana::lang('notifications.admin_footer') . "\n" . url::base() . "\n\n" . Kohana::lang('notifications.admin_login_url') . "\n" . url::base() . "admin";
                     if (!email::send($address, $from, $subject, $message, FALSE)) {
                         Kohana::log('error', "email to {$address} could not be sent");
                     }
                 }
             }
         } else {
             Kohana::log('error', "email to {$address} could not be sent\n\t\t\t\t - Missing Subject or Message");
         }
     } catch (Exception $e) {
         Kohana::log('error', "An exception occured " . $e->__toString());
     }
 }
开发者ID:kjgarza,项目名称:ushahidi,代码行数:27,代码来源:notifications.php

示例7: _send_email_alert

 /**
  * Sends an email alert
  */
 public static function _send_email_alert($post)
 {
     // Email Alerts, Confirmation Code
     $alert_email = $post->alert_email;
     $alert_lon = $post->alert_lon;
     $alert_lat = $post->alert_lat;
     $alert_radius = $post->alert_radius;
     $alert_code = text::random('alnum', 20);
     $settings = kohana::config('settings');
     $to = $alert_email;
     $from = array();
     $from[] = $settings['alerts_email'] ? $settings['alerts_email'] : $settings['site_email'];
     $from[] = $settings['site_name'];
     $subject = $settings['site_name'] . " " . Kohana::lang('alerts.verification_email_subject');
     $message = Kohana::lang('alerts.confirm_request') . url::site() . 'alerts/verify?c=' . $alert_code . "&e=" . $alert_email;
     if (email::send($to, $from, $subject, $message, TRUE) == 1) {
         $alert = ORM::factory('alert');
         $alert->alert_type = self::EMAIL_ALERT;
         $alert->alert_recipient = $alert_email;
         $alert->alert_code = $alert_code;
         $alert->alert_lon = $alert_lon;
         $alert->alert_lat = $alert_lat;
         $alert->alert_radius = $alert_radius;
         if (isset($_SESSION['auth_user'])) {
             $alert->user_id = $_SESSION['auth_user']->id;
         }
         $alert->save();
         self::_add_categories($alert, $post);
         return TRUE;
     }
     return FALSE;
 }
开发者ID:rabbit09,项目名称:Taarifa_Web,代码行数:35,代码来源:alert.php

示例8: AvailLink

 public static function AvailLink($hostname, $servicedesc, $start, $end)
 {
     $config = new Config_Model();
     $config->read_config();
     $hostname = urlencode($hostname);
     $servicedesc = urlencode($servicedesc);
     $smon = date('m', $start);
     $sday = date('d', $start);
     $syear = date('Y', $start);
     $shour = date('G', $start);
     $smin = date('i', $start);
     $ssec = date('s', $start);
     $emon = date('m', $end);
     $eday = date('d', $end);
     $eyear = date('Y', $end);
     $ehour = date('G', $end);
     $emin = date('i', $end);
     $esec = date('s', $end);
     $nagios_base = $config->conf['nagios_base'];
     if ($servicedesc == "Host+Perfdata") {
         print "<a href=\"{$nagios_base}/avail.cgi?show_log_entries=&host={$hostname}&timeperiod=custom&smon={$smon}&sday={$sday}&syear={$syear}&shour={$shour}&smin={$smin}&ssec={$ssec}&emon={$emon}&eday={$eday}&eyear={$eyear}&ehour={$ehour}&emin={$emin}&esec={$esec}&rpttimeperiod=&assumeinitialstates=yes&assumestateretention=yes&assumestatesduringnotrunning=yes&includesoftstates=yes&initialassumedservicestate=6&backtrack=4\"";
     } else {
         print "<a href=\"{$nagios_base}/avail.cgi?show_log_entries=&host={$hostname}&service={$servicedesc}&timeperiod=custom&smon={$smon}&sday={$sday}&syear={$syear}&shour={$shour}&smin={$smin}&ssec={$ssec}&emon={$emon}&eday={$eday}&eyear={$eyear}&ehour={$ehour}&emin={$emin}&esec={$esec}&rpttimeperiod=&assumeinitialstates=yes&assumestateretention=yes&assumestatesduringnotrunning=yes&includesoftstates=yes&initialassumedservicestate=6&backtrack=4\"";
     }
     print " title=\"" . Kohana::lang('common.nagios-avail-link-title') . "\"><img src=\"" . url::base() . "media/images/trends.gif\" ></a>\n";
 }
开发者ID:rbarraud,项目名称:pnp4nagios,代码行数:26,代码来源:nagios.php

示例9: index

 function index()
 {
     $this->template->content = new View('admin/blocks');
     $this->template->content->title = Kohana::lang('ui_admin.blocks');
     // Get Registered Blocks
     if (!is_array($this->_registered_blocks)) {
         $this->_registered_blocks = array();
     }
     // Get Active Blocks
     $settings = ORM::factory('settings', 1);
     $active_blocks = $settings->blocks;
     $active_blocks = array_filter(explode("|", $active_blocks));
     // setup and initialize form field names
     $form = array('action' => '', 'block' => '');
     //	copy the form as errors, so the errors will be stored with keys corresponding to the form field names
     $errors = $form;
     $form_error = FALSE;
     $form_saved = FALSE;
     $form_action = "";
     if ($_POST) {
         $post = Validation::factory($_POST);
         //	 Add some filters
         $post->pre_filter('trim', TRUE);
         // Add some rules, the input field, followed by a list of checks, carried out in order
         $post->add_rules('action', 'required', 'alpha', 'length[1,1]');
         $post->add_rules('block', 'required', 'alpha_dash');
         if (!array_key_exists($post->block, $this->_registered_blocks)) {
             $post->add_error('block', 'exists');
         }
         if ($post->validate()) {
             // Activate a block
             if ($post->action == 'a') {
                 array_push($active_blocks, $post->block);
                 $settings->blocks = implode("|", $active_blocks);
                 $settings->save();
             } elseif ($post->action == 'd') {
                 $active_blocks = array_diff($active_blocks, array($post->block));
                 $settings->blocks = implode("|", $active_blocks);
                 $settings->save();
             }
         } else {
             $errors = arr::overwrite($errors, $post->errors('blocks'));
             $form_error = TRUE;
         }
     }
     // Sort the Blocks
     $sorted_blocks = blocks::sort($active_blocks, array_keys($this->_registered_blocks));
     $this->template->content->form = $form;
     $this->template->content->errors = $errors;
     $this->template->content->form_error = $form_error;
     $this->template->content->form_saved = $form_saved;
     $this->template->content->form_action = $form_action;
     $this->template->content->total_items = count($this->_registered_blocks);
     $this->template->content->registered_blocks = $this->_registered_blocks;
     $this->template->content->active_blocks = $active_blocks;
     $this->template->content->sorted_blocks = $sorted_blocks;
     // Javascript Header
     $this->template->tablerowsort_enabled = TRUE;
     $this->template->js = new View('admin/blocks_js');
 }
开发者ID:kjgarza,项目名称:ushahidi,代码行数:60,代码来源:blocks.php

示例10: i18n_stuff

 public function i18n_stuff()
 {
     $element = Event::$data;
     // skip the __form_object and already internationalized elements
     if ($element->name != '__form_object' and !in_array('i18nd', $element->attributes)) {
         // fetch label's i18n string, if not found use element's name
         if ($element->label and !in_array($element->type, array('button', 'submit'))) {
             if (Kohana::lang($this->i18n_labels . $element->name) == $this->i18n_labels . $element->name) {
                 $element->label = ucfirst($element->name);
             } else {
                 $element->label = Kohana::lang($this->i18n_labels . $element->name);
             }
         }
         // fetch button's i18n string, if not found use element's original value
         if (in_array($element->type, array('button', 'submit'))) {
             if (Kohana::lang($this->i18n_buttons . $element->name) == $this->i18n_buttons . $element->name) {
                 $element->value = ucfirst($element->value);
             } else {
                 $element->value = Kohana::lang($this->i18n_buttons . $element->name);
             }
         }
         // fetch error's i18n string, if not found use element's original error
         if ($element->error and $element->error_msg_class != 'comment') {
             if (Kohana::lang($this->i18n_errors . $element->error) == $this->i18n_errors . $element->error) {
                 $element->error = ucfirst($element->error);
             } else {
                 $element->error = Kohana::lang($this->i18n_errors . $element->error);
             }
         }
         // mark the element as internationalized
         $element->add_attribute('i18nd');
     }
 }
开发者ID:carriercomm,项目名称:billing_cart,代码行数:33,代码来源:auto_i18n.php

示例11: index

 public function index()
 {
     $route_data = Myroute::instance()->get();
     if ($_POST) {
         $site_next_flow = site::site_next_flow($this->current_flow);
         $submit_target = intval($this->input->post('submit_target'));
         if (Myroute::instance()->edit($_POST)) {
             //判断添加成功去向
             switch ($submit_target) {
                 case 2:
                     remind::set(Kohana::lang('o_global.update_success'), $site_next_flow['url'], 'success');
                 default:
                     remind::set(Kohana::lang('o_global.update_success'), 'site/route', 'success');
             }
         } else {
             remind::set(Kohana::lang('o_global.update_error'), 'site/route');
         }
     }
     $this->template->content = new View("site/route_edit");
     $this->template->content->is_modify = 0;
     if ($this->manager_is_admin == 1) {
         $this->template->content->is_modify = 1;
     }
     $this->template->content->data = $route_data;
     $this->template->content->site_id = $this->site_id;
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:26,代码来源:route.php

示例12: activate

 public function activate($validation_key)
 {
     if (!IN_PRODUCTION) {
         $profiler = new Profiler();
     }
     // TODO: Figure out where to store magic constants.
     if ($validation_key && strlen($validation_key) == 32) {
         $db = Database::instance();
         $email_users_set = $db->select('email_users.email', 'email_users.is_validated', 'user_details.public_api_key', 'user_details.private_api_key')->from('email_users')->join('user_details', array('email_users.user_id' => 'user_details.id'))->where('validation_key', $validation_key)->limit(1)->get();
         if (count($email_users_set)) {
             $email_user_row = null;
             foreach ($email_users_set as $row) {
                 $email_user_row = $row;
                 break;
             }
             if (!$email_user_row->is_validated) {
                 $db->from('email_users')->set('is_validated', '1')->set('validation_key', 'NULL', $disable_escaping = true)->where('email', $email_user_row->email)->update();
             }
             if ($email_user_row->public_api_key) {
                 $this->render_activation_succeeded_view(Kohana::lang('account_messages.activation.success_with_api_keys'));
             } else {
                 $this->render_activation_succeeded_view(Kohana::lang('account_messages.activation.success_without_api_keys'));
             }
         } else {
             $this->render_activation_failed_view(Kohana::lang('account_messages.activation.key_not_found'));
         }
     } else {
         $this->render_activation_failed_view(Kohana::lang('account_messages.activation.key_not_found'));
     }
 }
开发者ID:jverkoey,项目名称:uwdata.ca,代码行数:30,代码来源:account.php

示例13: do_active

 /**
  * 改变状态
  */
 function do_active($id)
 {
     //权限验证
     role::check('user_charge');
     if (!$id) {
         remind::set(Kohana::lang('o_global.bad_request'), 'user/user_charge');
     }
     $db = Database::instance();
     $data = array_shift($db->query('SELECT * FROM user_charge_order WHERE id=' . $id)->result_array(false));
     if ($data['id'] <= 0 || $data['status'] > 0) {
         remind::set(Kohana::lang('o_global.bad_request'), 'user/user_charge');
     }
     $logodata = array();
     $logodata['manager_id'] = $this->manager_id;
     $logodata['ip'] = tool::get_str_ip();
     $logodata['user_log_type'] = 27;
     $logodata['method'] = __CLASS__ . '::' . __METHOD__ . '()';
     $logodata['memo'] = "充值订单号:" . $data['order_num'] . ", 购买拍点数:" . $data['price'] . ", 充值金额:" . $data['money'];
     $sql = "UPDATE user_charge_order SET status=1 WHERE id='" . $id . "' ";
     if ($db->query($sql)) {
         //充值用户Money
         $sql_reward = "UPDATE users \r\n                            SET user_money = user_money+" . $data['price'] . "\r\n                            WHERE id='" . $data['user_id'] . "'\r\n                          ";
         $db->query($sql_reward);
         //操作log
         ulog::add($logodata);
         remind::set(Kohana::lang('o_global.update_success'), 'user/user_charge', 'success');
     } else {
         //操作log
         ulog::add($logodata, 1);
         remind::set(Kohana::lang('o_global.update_error'), 'user/user_charge', 'error');
     }
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:35,代码来源:user_charge.php

示例14: index

 /**
  * Displays all feeds.
  */
 public function index()
 {
     $this->template->header->this_page = Kohana::lang('ui_admin.feeds');
     $this->template->content = new View('feed/feeds');
     // Pagination
     $pagination = new Pagination(array('query_string' => 'page', 'items_per_page' => (int) Kohana::config('settings.items_per_page'), 'total_items' => ORM::factory('feed_item')->count_all()));
     $feeds = ORM::factory('feed_item')->orderby('item_date', 'desc')->find_all((int) Kohana::config('settings.items_per_page'), $pagination->sql_offset);
     $this->template->content->feeds = $feeds;
     //Set default as not showing pagination. Will change below if necessary.
     $this->template->content->pagination = '';
     // Pagination and Total Num of Report Stats
     $plural = $pagination->total_items == 1 ? '' : 's';
     if ($pagination->total_items > 0) {
         $current_page = $pagination->sql_offset / (int) Kohana::config('settings.items_per_page') + 1;
         $total_pages = ceil($pagination->total_items / (int) Kohana::config('settings.items_per_page'));
         if ($total_pages > 1) {
             // Paginate results
             $pagination_stats = Kohana::lang('ui_admin.showing_page') . ' ' . $current_page . ' ' . Kohana::lang('ui_admin.of') . ' ' . $total_pages . ' ' . Kohana::lang('ui_admin.pages');
             $this->template->content->pagination_stats = $pagination_stats;
             $this->template->content->pagination = $pagination;
         } else {
             // No pagination
             $this->template->content->pagination_stats = $pagination->total_items . ' ' . Kohana::lang('ui_admin.feeds');
         }
     } else {
         $this->template->content->pagination_stats = $pagination->total_items . ' ' . Kohana::lang('ui_admin.feeds');
     }
 }
开发者ID:niiyatii,项目名称:crowdmap,代码行数:31,代码来源:feeds.php

示例15: login

 /**
  * 用户登陆
  * @method POST
  */
 public function login()
 {
     $post = $this->get_data();
     $mobile = trim($post['mobile']);
     $zone_code = $post['zone_code'] ? trim($post['zone_code']) : ($post['zonecode'] ? trim($post['zonecode']) : '86');
     $zone_code = str_replace('+', '', $zone_code);
     $password = trim($post['password']);
     if (empty($mobile)) {
         $this->send_response(400, NULL, '40001:手机号为空');
     }
     if (!international::check_is_valid($zone_code, $mobile)) {
         $this->send_response(400, NULL, '40002:手机号码格式不对');
     }
     if ($password == "") {
         $this->send_response(400, NULL, '40003:密码为空');
     }
     $user = $this->model->get_user_by_mobile($zone_code, $mobile);
     if (!$user) {
         $this->send_response(400, NULL, Kohana::lang('user.mobile_not_register'));
     }
     if (!password_verify($password, $user['password'])) {
         $this->send_response(400, NULL, Kohana::lang('user.username_password_not_match'));
     }
     $token = $this->model->create_token(3600, TRUE, array('zone_code' => $user['zone_code'], 'mobile' => $user['mobile'], 'id' => (int) $user['id']));
     $this->send_response(200, array('id' => (int) $user['uid'], 'name' => $user['username'], 'avatar' => sns::getavatar($user['uid']), 'access_token' => $token['access_token'], 'refresh_token' => $token['refresh_token'], 'expires_in' => $token['expires_in']));
 }
开发者ID:momoim,项目名称:momo-api,代码行数:30,代码来源:user.php


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