• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP kohana类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getAudioInfo

 public static function getAudioInfo($path)
 {
     if (!is_file($path)) {
         kohana::log('debug', 'Asked for audio info on non-existant file: "' . $path . '"');
         return FALSE;
     }
     $id3 = new getID3();
     $info = $id3->analyze($path);
     if (!empty($info['error'])) {
         kohana::log('debug', 'Unable to analyze "' . $path . '" because ' . implode(' - ', $info['error']));
         return FALSE;
     }
     switch ($info['audio']['dataformat']) {
         case 'wav':
             return array('type' => $info['audio']['dataformat'], 'compression' => number_format($info['audio']['compression_ratio'], 4), 'channels' => $info['audio']['channels'], 'rates' => $info['audio']['streams'][0]['sample_rate'], 'byterate' => $info['audio']['bitrate'], 'bits' => $info['audio']['bits_per_sample'], 'size' => $info['filesize'], 'length' => number_format($info['playtime_seconds'], 4));
         case 'mp1':
             return array('type' => $info['audio']['dataformat'], 'compression' => number_format($info['audio']['compression_ratio'], 4), 'channels' => $info['audio']['channels'], 'rates' => $info['audio']['streams'][0]['sample_rate'], 'byterate' => $info['audio']['bitrate'], 'bits' => $info['audio']['bits_per_sample'], 'size' => $info['filesize'], 'length' => number_format($info['playtime_seconds'], 4));
         case 'mp3':
             return array('type' => $info['audio']['dataformat'], 'compression' => number_format($info['audio']['compression_ratio'], 4), 'channels' => $info['audio']['channels'], 'rates' => $info['audio']['sample_rate'], 'byterate' => $info['audio']['bitrate'], 'bits' => NULL, 'size' => $info['filesize'], 'length' => number_format($info['playtime_seconds'], 4));
         case 'ogg':
             return array('type' => $info['audio']['dataformat'], 'compression' => number_format($info['audio']['compression_ratio'], 4), 'channels' => $info['audio']['channels'], 'rates' => $info['audio']['sample_rate'], 'byterate' => $info['audio']['bitrate'], 'bits' => NULL, 'size' => $info['filesize'], 'length' => number_format($info['playtime_seconds'], 4));
         default:
             kohana::log('error', 'Unhandled media type(' . $info['audio']['dataformat'] . ') for file ' . $path);
     }
     return FALSE;
 }
开发者ID:swk,项目名称:bluebox,代码行数:26,代码来源:MediaLib.php


示例2: prepare_connection

 /**
  * Hook to prepare the database connection. Performs 2 tasks.
  *   1) Initialises the search path, unless configured not to do this (e.g. if this is set at db level).
  *   2) If this is a report request, sets the connection to read only.
  */
 public static function prepare_connection()
 {
     $uri = URI::instance();
     // we havent to proceed futher if a setup call was made
     if ($uri->segment(1) == 'setup_check') {
         return;
     }
     // continue to init the system
     //
     // add schema to the search path
     //
     $_schema = Kohana::config('database.default.schema');
     $query = '';
     if (!empty($_schema) && kohana::config('indicia.apply_schema') !== false) {
         $query = "SET search_path TO {$_schema}, public, pg_catalog;\n";
     }
     // Force a read only connection for reporting.
     if ($uri->segment(1) == 'services' && $uri->segment(2) == 'report') {
         $query .= "SET default_transaction_read_only TO true;\n";
     }
     if (!empty($query)) {
         $db = Database::instance();
         $db->query($query);
     }
 }
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:30,代码来源:init.php


示例3: register

 public static function register($driver, $hook)
 {
     $driverName = Telephony::getDriverName();
     if (!$driverName or $driverName == 'none') {
         return true;
     } elseif (!class_exists($driverName)) {
         Kohana::log('error', 'Telephony -> Unable to register the dialplan driver \'' . $driverName . '\'');
         return false;
     }
     $hookClass = $driverName . '_' . $driver . '_Driver';
     if (!class_exists($hookClass)) {
         Kohana::log('error', 'Telephony -> Unable to register the dialplan hook \'' . $driver . '\'(' . $hookClass . ')');
         return false;
     }
     if (empty(self::$dialplanSections)) {
         kohana::log('debug', 'Telephony -> EVAL ' . $driverName . '::getDialplanSections();');
         $sections = eval('return ' . $driverName . '::getDialplanSections();');
         if (is_array($sections)) {
             self::$dialplanSections = $sections;
         }
     }
     if (!in_array($hook, self::$dialplanSections)) {
         //Logger::ExceptionByCaller();
         throw new Exception('The hook ' . $hook . ' is not a recognized telephony global hook. (While trying to register callback ' . $driver . ')');
     }
     // Register event as _telephony.action with the callback array as the callback
     Event::add('_telephony.' . $hook, array($hookClass, $hook));
     Kohana::log('debug', 'Telephony -> Added hook for _telephony.' . $hook . ' to call ' . $hookClass . '::' . $hook);
     return TRUE;
 }
开发者ID:swk,项目名称:bluebox,代码行数:30,代码来源:dialplan.php


示例4: log_error

 /**
  * Standardise the dumping of an exception message into the kohana log. E.g.
  * try {
  *	   ... code that throws exception ...
  * } catch (Exception $e) {
  *   error::log_error('Error occurred whilst running some code', $e);
  * }
  *
  * @param string $msg A description of where the error occurred.
  * $param object $e The exception object.
  */
 public static function log_error($msg, $e)
 {
     kohana::log('error', '#' . $e->getCode() . ': ' . $msg . '. ' . $e->getMessage() . ' at line ' . $e->getLine() . ' in file ' . $e->getFile());
     // Double check the log threshold to avoid unnecessary work.
     if (kohana::config('config.log_threshold') == 4) {
         $trace = $e->getTrace();
         $output = "Stack trace:\n";
         for ($i = 0; $i < count($trace); $i++) {
             if (array_key_exists('file', $trace[$i])) {
                 $file = $trace[$i]['file'];
             } else {
                 $file = 'Unknown file';
             }
             if (array_key_exists('line', $trace[$i])) {
                 $line = $trace[$i]['line'];
             } else {
                 $line = 'Unknown';
             }
             if (array_key_exists('function', $trace[$i])) {
                 $function = $trace[$i]['function'];
             } else {
                 $function = 'Unknown function';
             }
             $output .= "\t" . $file . ' - line ' . $line . ' - ' . $function . "\n";
         }
         kohana::log('debug', $output);
     }
 }
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:39,代码来源:error.php


示例5: echo_test

 public static function echo_test()
 {
     $featureCode = new FeatureCode();
     $featureCode['name'] = 'Echo Test';
     $featureCode['registry'] = array('feature' => 'echo');
     $featureCode->save();
     try {
         $location = Doctrine::getTable('Location')->findAll();
         if (!$location->count()) {
             throw Exception('Could not find location id');
         }
         $location_id = arr::get($location, 0, 'location_id');
         $number = new Number();
         $number['user_id'] = users::getAttr('user_id');
         $number['number'] = '9999';
         $number['location_id'] = $location_id;
         $number['registry'] = array('ignoreFWD' => '0', 'ringtype' => 'ringing', 'timeout' => 20);
         $dialplan = array('terminate' => array('transfer' => 0, 'voicemail' => 0, 'action' => 'hangup'));
         $number['dialplan'] = $dialplan;
         $number['class_type'] = 'FeatureCodeNumber';
         $number['foreign_id'] = $featureCode['feature_code_id'];
         $context = Doctrine::getTable('Context')->findOneByName('Outbound Routes');
         $number['NumberContext']->fromArray(array(0 => array('context_id' => $context['context_id'])));
         $numberType = Doctrine::getTable('NumberType')->findOneByClass('FeatureCodeNumber');
         if (empty($numberType['number_type_id'])) {
             return FALSE;
         }
         $number['NumberPool']->fromArray(array(0 => array('number_type_id' => $numberType['number_type_id'])));
         $number->save();
         return $number['number_id'];
     } catch (Exception $e) {
         kohana::log('error', 'Unable to initialize device number: ' . $e->getMessage());
         throw $e;
     }
 }
开发者ID:swk,项目名称:bluebox,代码行数:35,代码来源:FeatureCodeManager.php


示例6: __construct

 public function __construct()
 {
     // Hook into routing, but not if running unit tests
     if (!in_array(MODPATH . 'phpUnit', kohana::config('config.modules'))) {
         Event::add('system.routing', array($this, 'check'));
     }
 }
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:7,代码来源:login.php


示例7: rename

 public function rename($id)
 {
     access::verify_csrf();
     $tag = ORM::factory("tag", $id);
     if (!$tag->loaded) {
         kohana::show_404();
     }
     $form = tag::get_rename_form($tag);
     $valid = $form->validate();
     if ($valid) {
         $new_name = $form->rename_tag->inputs["name"]->value;
         $new_tag = ORM::factory("tag")->where("name", $new_name)->find();
         if ($new_tag->loaded) {
             $form->rename_tag->inputs["name"]->add_error("in_use", 1);
             $valid = false;
         }
     }
     if ($valid) {
         $old_name = $tag->name;
         $tag->name = $new_name;
         $tag->save();
         $message = t("Renamed tag %old_name to %new_name", array("old_name" => $old_name, "new_name" => $tag->name));
         message::success($message);
         log::success("tags", $message);
         print json_encode(array("result" => "success", "location" => url::site("admin/tags"), "tag_id" => $tag->id, "new_tagname" => html::clean($tag->name)));
     } else {
         print json_encode(array("result" => "error", "form" => $form->__toString()));
     }
 }
开发者ID:Okat,项目名称:gallery3,代码行数:29,代码来源:admin_tags.php


示例8: testDateOutOfRange

 /** 
  * Test that a basic date out of range test works.
  */
 public function testDateOutOfRange()
 {
     // Need a test rule we can use to check it works
     $ruleArr = array('verification_rule:title' => 'test', 'verification_rule:test_type' => 'PeriodWithinYear', 'verification_rule:error_message' => 'test error', 'metaFields:metadata' => "Tvk=TESTKEY\nStartDate=0801\nEndDate=0831", 'metaFields:data' => "");
     $rule = ORM::Factory('verification_rule');
     $rule->set_submission_data($ruleArr, false);
     if (!$rule->submit()) {
         echo kohana::debug($rule->getAllErrors());
         throw new exception('Failed to create test rule');
     }
     try {
         $response = data_entry_helper::http_post($this->request, array('sample' => json_encode(array('sample:survey_id' => 1, 'sample:date' => '12/09/2012', 'sample:entered_sref' => 'SU1234', 'sample:entered_sref_system' => 'osgb')), 'occurrences' => json_encode(array(array('occurrence:taxa_taxon_list_id' => $this->ttl->id))), 'rule_types' => json_encode(array('PeriodWithinYear'))));
         $errors = json_decode($response['output'], true);
         $this->assertTrue(is_array($errors), 'Errors list not returned');
         $this->assertTrue(isset($errors[0]['taxa_taxon_list_id']) && $errors[0]['taxa_taxon_list_id'] === $this->ttl->id, 'Incorrect taxa_taxon_list_id returned');
         $this->assertTrue(isset($errors[0]['message']) && $errors[0]['message'] === 'test error', 'Incorrect message returned');
         foreach ($rule->verification_rule_metadata as $m) {
             $m->delete();
         }
         $rule->delete();
     } catch (Exception $e) {
         foreach ($rule->verification_rule_metadata as $m) {
             $m->delete();
         }
         $rule->delete();
     }
 }
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:30,代码来源:data_cleanerTest.php


示例9: createExtension

 public static function createExtension()
 {
     Event::$data += array('voicemail_password' => self::generatePin(), 'voicemail_timezone' => kohana::config('locale.timezone'), 'voicemail_email_all_messages' => empty(Event::$data['user']['email_address']) ? 0 : 1, 'voicemail_delete_file' => 0, 'voicemail_attach_audio_file' => 1, 'voicemail_email_address' => empty(Event::$data['user']['email_address']) ? '' : Event::$data['user']['email_address']);
     extract(Event::$data);
     Doctrine::getTable('Voicemail')->getRecordListener()->get('MultiTenant')->setOption('disabled', TRUE);
     $name_append = '';
     if (!empty($owner_name)) {
         $name_append = ' for ' . $owner_name;
     }
     try {
         $voicemail = new Voicemail();
         $voicemail['name'] = 'VM ' . $extension . $name_append;
         $voicemail['mailbox'] = $extension;
         $voicemail['password'] = $voicemail_password;
         $voicemail['account_id'] = $account_id;
         $voicemail['plugins'] = array('timezone' => array('timezone' => $voicemail_timezone));
         $voicemail['registry'] = array('email_all_messages' => $voicemail_email_all_messages, 'delete_file' => $voicemail_delete_file, 'attach_audio_file' => $voicemail_attach_audio_file, 'email_address' => $voicemail_email_address);
         $voicemail->save();
         $plugin = array('voicemail' => array('mwi_box' => $voicemail['voicemail_id']));
         $device['plugins'] = arr::merge($device['plugins'], $plugin);
     } catch (Exception $e) {
         Doctrine::getTable('Voicemail')->getRecordListener()->get('MultiTenant')->setOption('disabled', FALSE);
         kohana::log('error', 'Unable to generate voicemail for device: ' . $e->getMessage());
         throw $e;
     }
     Doctrine::getTable('Voicemail')->getRecordListener()->get('MultiTenant')->setOption('disabled', FALSE);
 }
开发者ID:swk,项目名称:bluebox,代码行数:27,代码来源:Voicemails.php


示例10: rename

 public function rename($id)
 {
     access::verify_csrf();
     $tag = ORM::factory("tag", $id);
     if (!$tag->loaded) {
         kohana::show_404();
     }
     // Don't use a form as the form is dynamically created in the js
     $post = new Validation($_POST);
     $post->add_rules("name", "required", "length[1,64]");
     $valid = $post->validate();
     if ($valid) {
         $new_name = $this->input->post("name");
         $new_tag = ORM::factory("tag")->where("name", $new_name)->find();
         if ($new_tag->loaded) {
             $error_msg = t("There is already a tag with that name");
             $valid = false;
         }
     } else {
         $error_msg = $post->errors();
         $error_msg = $error_msg[0];
     }
     if ($valid) {
         $old_name = $tag->name;
         $tag->name = $new_name;
         $tag->save();
         $message = t("Renamed tag %old_name to %new_name", array("old_name" => $old_name, "new_name" => $tag->name));
         message::success($message);
         log::success("tags", $message);
         print json_encode(array("result" => "success", "location" => url::site("admin/tags"), "tag_id" => $tag->id, "new_tagname" => html::clean($tag->name)));
     } else {
         print json_encode(array("result" => "error", "message" => (string) $error_msg));
     }
 }
开发者ID:scarygary,项目名称:gallery3,代码行数:34,代码来源:admin_tags.php


示例11: __construct

 /**
  * 构造方法
  */
 public function __construct($img_dir_name = '')
 {
     $upload_path = kohana::config('upload.directory');
     $this->img_dir_name = $img_dir_name ? $img_dir_name : $this->img_dir_name;
     $this->dir_name = $upload_path . '/' . $this->img_dir_name . '/';
     $this->no_img_file = $upload_path . '/no_img.gif';
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:10,代码来源:AttService.php


示例12: getDispositionForm

 public function getDispositionForm()
 {
     $faxprof = Input::instance()->post('faxprofile');
     $faxdisp = Doctrine::getTable('FaxDisposition')->find($faxprof['fxp_fxd_id']);
     if ($faxdisp) {
         $packageobj = Doctrine::getTable('package')->find($faxdisp['fxd_package_id']);
         if ($packageobj) {
             try {
                 if (!($package = Package_Catalog::getInstalledPackage($packageobj->name))) {
                     echo 'Package not ' . $packageobj->name . ' found.';
                     exit;
                 }
                 $formfile = $package['directory'] . '/views/' . $packageobj->name . '/' . $faxdisp['fxd_name'] . '.php';
                 kohana::Log('debug', 'Looking for view ' . $formfile);
                 if (file_exists($formfile)) {
                     $featureFormView = new View($packageobj->name . '/' . $faxdisp['fxd_name']);
                     kohana::Log('debug', 'View file found.');
                     if (isset($faxprof['fxp_id']) && !empty($faxprof['fxp_id']) && $faxprof['fxp_id'] != '') {
                         $faxprofobj = Doctrine::getTable('FaxProfile')->find($faxprof['fxp_id']);
                     } else {
                         $faxprofobj = new FaxProfile();
                     }
                     $featureFormView->set_global('faxprofile', $faxprofobj);
                     echo $featureFormView->render(TRUE);
                 } else {
                     kohana::Log('debug', 'View file not found.');
                 }
             } catch (Package_Catalog_Exception $e) {
                 echo 'Package not ' . $packageobj->name . ' found.';
             }
         }
     }
     exit;
 }
开发者ID:swk,项目名称:bluebox,代码行数:34,代码来源:fax.php


示例13: 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


示例14: _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


示例15: importConfigRoutes

 public static function importConfigRoutes()
 {
     $outboundPatterns = kohana::config('simpleroute.outbound_patterns');
     if (!is_array($outboundPatterns)) {
         return;
     }
     // This is the second work arround for the double loading issue... hmmm
     $createdPatterns = array();
     $simpleRoutes = array();
     foreach ($outboundPatterns as $outboundPattern) {
         if (empty($outboundPattern['name'])) {
             continue;
         }
         if (in_array($outboundPattern['name'], $createdPatterns)) {
             continue;
         }
         $createdPatterns[] = $outboundPattern['name'];
         if (empty($outboundPattern['patterns'])) {
             continue;
         }
         if (!is_array($outboundPattern['patterns'])) {
             $outboundPattern['patterns'] = array($outboundPattern['patterns']);
         }
         $simpleRoute =& $simpleRoutes[];
         $simpleRoute['name'] = $outboundPattern['name'];
         $simpleRoute['patterns'] = $outboundPattern['patterns'];
     }
     return $simpleRoutes;
 }
开发者ID:swk,项目名称:bluebox,代码行数:29,代码来源:SimpleRouteLib.php


示例16: subir

 /**
  * Sube la información en la categoria indicada
  *
  * @param array $datos Los datos recibitos por POST
  * @param string $categoria Categoria a la cual pertenece el envio
  * @return int  Retorna el ID del envio si hubo exito, sino retorna 0 o FALSE
  */
 public function subir(array $datos, $categoria)
 {
     $exito = FALSE;
     $categoria_id = ORM::factory("categoria")->where("nombre", "=", $categoria)->find()->id;
     // Si la categoria no existe en la base de datos sale con error
     if (!$categoria_id) {
         return FALSE;
     }
     // Hace la validacion
     if ($this->values($datos)->check()) {
         // Concatenamos los datos de las Actividades
         if ($categoria == "Actividades") {
             $pre = "<b>Lugar:</b> " . $datos['lugar'] . "<br>\n\t\t\t<b>Fecha:</b> " . $datos['fecha'] . "<br>\n\t\t\t<b>Hora:</b> " . $datos['hora'] . "<br><br>\n\t\t    ";
             $this->contenido = $pre . $datos['contenido'];
             echo kohana::debug($datos);
         }
         // Los datos han sido validados y los guardamos
         $this->save();
         // Guarda la relacion entre el envio y la categoria
         $contenido = ORM::factory("contenido");
         $contenido->envio_id = $this->id;
         // Obtiene el id de la categoria
         $contenido->categoria_id = $categoria_id;
         $contenido->save();
         $exito = $this->id;
     }
     // Llenamos los vectores con los valores que seran mostrados en los campos
     $this->errores = Arr::overwrite($this->errores, $this->validate()->errors(""));
     $this->formulario = Arr::overwrite($this->formulario, $datos);
     return $exito;
 }
开发者ID:reneegonam,项目名称:CoCo,代码行数:38,代码来源:envio.php


示例17: before

 public function before()
 {
     parent::before();
     $lang = $this->request->param('lang');
     // Make sure we have a valid language
     if (!in_array($lang, array_keys(Kohana::config('kohana')->languages))) {
         $this->request->action = 'error';
         throw new Kohana_Request_Exception('Unable to find a route to match the URI: :uri (specified language was not found in config)', array(':uri' => $this->request->uri));
     }
     I18n::$lang = $lang;
     if (isset($this->page_titles[$this->request->action])) {
         // Use the defined page title
         $title = $this->page_titles[$this->request->action];
     } else {
         // Use the page name as the title
         $title = ucwords(str_replace('_', ' ', $this->request->action));
     }
     $this->template->title = $title;
     if (!kohana::find_file('views', 'pages/' . $this->request->action)) {
         $this->request->action = 'error';
     }
     $this->template->content = View::factory('pages/' . $this->request->action);
     $this->template->set_global('request', $this->request);
     $this->template->meta_tags = array();
 }
开发者ID:bluehawk,项目名称:kohanaphp.com,代码行数:25,代码来源:page.php


示例18: create_nonce

 /**
  * Method to create a nonce, either from a service call (when the caller type is a website) or from the Warehouse
  * (when the caller type is an Indicia user.
  */
 public static function create_nonce($type, $website_id)
 {
     $nonce = sha1(time() . ':' . rand() . $_SERVER['REMOTE_ADDR'] . ':' . kohana::config('indicia.private_key'));
     $cache = new Cache();
     $cache->set($nonce, $website_id, $type, Kohana::config('indicia.nonce_life'));
     return $nonce;
 }
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:11,代码来源:MY_security.php


示例19: emailid

 public function emailid($user_id)
 {
     // Display a form that a vistor can use to contact a registered user.
     // If this page is disabled, show a 404 error.
     if (module::get_var("contactowner", "contact_user_link") != true) {
         kohana::show_404();
     }
     // Locate the record for the user specified by $user_id,
     //   use this to determine the user's name.
     $userDetails = ORM::factory("user")->where("id", $user_id)->find_all();
     // Make a new form with a couple of text boxes.
     $form = new Forge("contactowner/sendemail", "", "post", array("id" => "gContactOwnerSendForm"));
     $sendmail_fields = $form->group("contactOwner");
     $sendmail_fields->input("email_to")->label(t("To:"))->value($userDetails[0]->name);
     $sendmail_fields->input("email_from")->label(t("From:"))->value(user::active()->email);
     $sendmail_fields->input("email_subject")->label(t("Subject:"))->value("");
     $sendmail_fields->textarea("email_body")->label(t("Message:"))->value("");
     $sendmail_fields->hidden("email_to_id")->value($user_id);
     // Add a save button to the form.
     $sendmail_fields->submit("SendMessage")->value(t("Send"));
     // Set up and display the actual page.
     $template = new Theme_View("page.html", "Contact");
     $template->content = new View("contactowner_emailform.html");
     $template->content->sendmail_form = $form;
     print $template;
 }
开发者ID:needful,项目名称:gallery3-contrib,代码行数:26,代码来源:contactowner.php


示例20: _send_email_alert

 /**
  * Sends an email alert
  *
  * @param Validation_Core $post
  * @param Alert_Model $alert
  * @return bool 
  */
 public static function _send_email_alert($post, $alert)
 {
     if (!$post instanceof Validation_Core and !$alert instanceof Alert_Model) {
         throw new Kohana_Exception('Invalid parameter types');
     }
     // Email Alerts, Confirmation Code
     $alert_email = $post->alert_email;
     $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->alert_type = self::EMAIL_ALERT;
         $alert->alert_recipient = $alert_email;
         $alert->alert_code = $alert_code;
         if (isset($_SESSION['auth_user'])) {
             $alert->user_id = $_SESSION['auth_user']->id;
         }
         $alert->save();
         self::_add_categories($alert, $post);
         return TRUE;
     }
     return FALSE;
 }
开发者ID:neumicro,项目名称:Ushahidi_Web_Dev,代码行数:35,代码来源:alert.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP kshowPeer类代码示例发布时间:2022-05-23
下一篇:
PHP kernel类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap