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


PHP conf函数代码示例

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


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

示例1: get_member

 /**
  * Get list by member
  * 
  * @access  public
  * @param   int  $member_id  target member_id
  * @return  Response (html)
  * @throws  Exception in Controller_Base::controller_common_api
  * @see  Controller_Base::controller_common_api
  */
 public function get_member($member_id = null)
 {
     $this->api_accept_formats = array('html');
     $this->controller_common_api(function () use($member_id) {
         $member_id = \Input::get('member_id', 0) ?: $member_id;
         list($is_mypage, $member) = $member_id ? $this->check_auth_and_is_mypage($member_id, true) : array(null, false);
         list($limit, $page) = $this->common_get_pager_list_params(conf('articles.limit', 'album'), conf('articles.limit_max', 'album'));
         $data = Site_Model::get_album_images($limit, $page, get_uid(), $member, $is_mypage, null, $this->format != 'html');
         $data['liked_album_image_ids'] = conf('like.isEnabled') && \Auth::check() ? \Site_Model::get_liked_ids('album_image', $this->u->id, $data['list']) : array();
         if ($this->format == 'html') {
             if ($member) {
                 $data['member'] = $member;
             }
         } else {
             $list_array = array();
             foreach ($data['list'] as $key => $obj) {
                 $row = $obj->to_array();
                 $row['album']['member'] = \Model_Member::get_one_basic4id($obj->album->member_id);
                 $list_array[] = $row;
             }
             // json response
             $data = $list_array;
         }
         $this->set_response_body_api($data, $this->format == 'html' ? 'image/_parts/list' : null);
     });
 }
开发者ID:uzura8,项目名称:flockbird,代码行数:35,代码来源:api.php

示例2: __construct

 function __construct()
 {
     // check whether params are set
     $params = array('dbServer', 'dbUser', 'dbPassword', 'dbDatabase');
     $missingParams = array();
     foreach ($params as $param) {
         if (!conf($param)) {
             $missingParams[] = $param;
         }
     }
     if (count($missingParams)) {
         throw new Exception('Missing parameters for database connection.');
     }
     // initialize DB connection
     #var_dump($this->db->connect_errno);
     $this->db = @new \mysqli(conf('dbServer'), conf('dbUser'), conf('dbPassword'), conf('dbDatabase'));
     #var_dump($params,$this->db,$this->db->connect_errno);
     if (!$this->db or $this->db->connect_errno) {
         if ($this->db) {
             $info = $this->db->connect_error;
         } else {
             $info = 'Mysqli construction error';
         }
         throw new Exception('Database connection error');
     }
     $this->db->query("SET NAMES utf8");
     // finish init TODO
     $this->isInit = true;
 }
开发者ID:niwics,项目名称:go2rest,代码行数:29,代码来源:BaseHandler.php

示例3: post_upload

 /**
  * Upload images
  * 
  * @access  public
  * @return  Response (json|html)
  * @throws  Exception in Controller_Base::controller_common_api
  * @see  Controller_Base::controller_common_api
  */
 public function post_upload($parent_id = null)
 {
     $this->api_accept_formats = array('html', 'json');
     $this->api_not_check_csrf = true;
     $this->controller_common_api(function () use($parent_id) {
         $upload_type = 'img';
         $news = \News\Model_News::check_authority($parent_id);
         if (!in_array($this->format, array('html', 'json'))) {
             throw new HttpNotFoundException();
         }
         $thumbnail_size = \Input::post('thumbnail_size');
         if (!\Validation::_validation_in_array($thumbnail_size, array('M', 'S'))) {
             throw new \HttpInvalidInputException('Invalid input data');
         }
         $insert_target = \Input::post('insert_target');
         $is_insert_body_image = conf('image.isInsertBody', 'news');
         $options = \Site_Upload::get_upload_handler_options($this->u->id, true, false, 'nw', $parent_id, true, 'img', $is_insert_body_image);
         $uploadhandler = new \MyUploadHandler($options, false);
         \DB::start_transaction();
         $files = $uploadhandler->post(false);
         $files['files'] = \News\Model_NewsImage::save_images($parent_id, $files['files']);
         \DB::commit_transaction();
         $files['upload_type'] = $upload_type;
         $files['thumbnail_size'] = $thumbnail_size;
         $files['insert_target'] = $insert_target;
         $files['model'] = 'news';
         $this->set_response_body_api($files, $this->format == 'html' ? 'filetmp/_parts/upload_images' : null);
     });
 }
开发者ID:uzura8,项目名称:flockbird,代码行数:37,代码来源:api.php

示例4: before_delete

 public function before_delete(\Orm\Model $obj)
 {
     // delete profile image.
     if (conf('upload.types.img.types.m.save_as_album_image') && $obj->file_name && ($file = \Model_File::get4name($obj->file_name))) {
         $file->delete();
     }
 }
开发者ID:uzura8,项目名称:flockbird,代码行数:7,代码来源:deletemember.php

示例5: error_404

 public function error_404($message = '')
 {
     if ($this->ctx->hook('Response.404')) {
         return;
     }
     $this->error($message == '' ? conf('cms.sys-error-404', 'Page not found') : $message);
 }
开发者ID:restorer,项目名称:deprecated-zame-cms,代码行数:7,代码来源:response.php

示例6: send

 /**
  */
 function send(array $params = [], &$error_message = '')
 {
     $CRLF = "\r\n";
     $TAB = "\t";
     $params['charset'] = $params['charset'] ?: conf('charset') ?: $this->PARENT->DEFAULT_CHARSET ?: 'utf-8';
     $params['mailer_name'] = $params['mailer_name'] ?: $this->PARENT->DEFAULT_MAILER_NAME;
     $params['text'] = $params['text'] ?: 'Sorry, but you need an html mailer to read this mail.';
     $OB = '----=_OuterBoundary_000';
     $IB = '----=_InnerBoundery_001';
     $headers = 'MIME-Version: 1.0' . $CRLF;
     $headers .= $params['email_from'] ? 'From:' . $params['name_from'] . '<' . $params['email_from'] . '>' . $CRLF : '';
     $headers .= $params['email_to'] ? 'To:' . $params['name_to'] . '<' . $params['email_to'] . '>' . $CRLF : '';
     $headers .= $params['email_from'] ? 'Reply-To:' . $params['name_from'] . '<' . $params['email_from'] . '>' . $CRLF : '';
     $params['priority'] && ($headers .= 'X-Priority:' . intval($params['priority']) . $CRLF);
     $headers .= 'X-Mailer:' . $params['mailer_name'] . $CRLF;
     $headers .= 'Content-Type:multipart/mixed;' . $CRLF . $TAB . 'boundary="' . $OB . '"' . $CRLF;
     // Messages start with text/html alternatives in OB
     $msg = 'This is a multi-part message in MIME format.' . $CRLF;
     $msg .= $CRLF . '--' . $OB . $CRLF;
     if (strlen($params['text']) || strlen($params['html'])) {
         $msg .= 'Content-Type: multipart/alternative;' . $CRLF . $TAB . 'boundary="' . $IB . '"' . $CRLF . $CRLF;
     }
     // plaintext section
     if (strlen($params['text'])) {
         $msg .= $CRLF . '--' . $IB . $CRLF;
         $msg .= 'Content-Type: text/plain;' . $CRLF . $TAB . 'charset="' . $params['charset'] . '"' . $CRLF;
         $msg .= 'Content-Transfer-Encoding: quoted-printable' . $CRLF . $CRLF;
         // plaintext goes here
         $msg .= $params['text'] . $CRLF . $CRLF;
     }
     // html section
     if (strlen($params['html'])) {
         $msg .= $CRLF . '--' . $IB . $CRLF;
         $msg .= 'Content-Type: text/html;' . $CRLF . $TAB . 'charset="' . $params['charset'] . '"' . $CRLF;
         $msg .= 'Content-Transfer-Encoding: base64' . $CRLF . $CRLF;
         // html goes here
         $msg .= chunk_split(base64_encode($params['html'])) . $CRLF . $CRLF;
     }
     // end of IB
     if (strlen($params['text']) || strlen($params['html'])) {
         $msg .= $CRLF . '--' . $IB . '--' . $CRLF;
     }
     // attachments
     if ($this->ALLOW_ATTACHMENTS) {
         foreach ((array) $params['attaches'] as $att_file) {
             $file_name = basename($att_file);
             $msg .= $CRLF . '--' . $OB . $CRLF;
             $msg .= 'Content-Type: application/octetstream;' . $CRLF . $TAB . 'name="' . $file_name . '"' . $CRLF;
             $msg .= 'Content-Transfer-Encoding: base64' . $CRLF;
             $msg .= 'Content-Disposition: attachment;' . $CRLF . $TAB . 'filename="' . $file_name . '"' . $CRLF . $CRLF;
             // file goes here
             $msg .= chunk_split(base64_encode(@file_get_contents($att_file)));
             $msg .= $CRLF . $CRLF;
         }
     }
     // message ends
     $msg .= $CRLF . '--' . $OB . '--' . $CRLF;
     // Send composed email
     return mail($params['email_to'], $params['subject'], $msg, $headers, implode('', $params['mta_params']));
 }
开发者ID:yfix,项目名称:yf,代码行数:62,代码来源:yf_mail_driver_internal.class.php

示例7: move_from_file_tmp

 public static function move_from_file_tmp(Model_FileTmp $file_tmp, $new_filename_prefix = '', $upload_type = 'img')
 {
     $file = static::forge();
     $file->name = $file_tmp->name;
     if ($new_filename_prefix) {
         $file->name = Site_Upload::change_filename_prefix($file_tmp->name, $new_filename_prefix);
     }
     $file->filesize = $file_tmp->filesize;
     $file->original_filename = $file_tmp->original_filename;
     $file->type = $file_tmp->type;
     $file->member_id = $file_tmp->member_id;
     $file->user_type = $file_tmp->user_type;
     if (!is_null($file_tmp->exif)) {
         $file->exif = $file_tmp->exif;
     }
     if (!empty($file_tmp->shot_at)) {
         $file->shot_at = $file_tmp->shot_at;
     }
     $file->save();
     if (conf('upload.storageType') == 'db') {
         $file_bin = Model_FileBin::get4name($file_tmp->name);
         $file_bin->name = $file->name;
         $file_bin->save();
     } elseif (conf('upload.storageType') == 'S3') {
         Site_S3::move($file_tmp->name, $file->name, $upload_type);
     }
     $file_tmp->delete();
     return $file;
 }
开发者ID:uzura8,项目名称:flockbird,代码行数:29,代码来源:file.php

示例8: isTraining

function isTraining()
{
    if ('training' === conf('app.env')) {
        return true;
    }
    return false;
}
开发者ID:glennfriend,项目名称:tg-bot,代码行数:7,代码来源:bootstrap.php

示例9: __construct

 public function __construct()
 {
     parent::__construct();
     global $mobile_cfg;
     if ($mobile_cfg == null) {
         $mobile_cfg = (require_once APP_ROOT_PATH . "system/mobile_cfg/" . APP_TYPE . "/webnav_cfg.php");
     }
     check_install();
     //重新处理后台的语言加载机制,后台语言环境配置于后台config.php文件
     $langSet = conf('DEFAULT_LANG');
     // 定义当前语言
     define('LANG_SET', strtolower($langSet));
     // 读取项目公共语言包
     if (is_file(LANG_PATH . $langSet . '/common.php')) {
         L(include LANG_PATH . $langSet . '/common.php');
         $this->lang_pack = (require LANG_PATH . $langSet . '/common.php');
         if (!file_exists(APP_ROOT_PATH . "public/runtime/admin/lang.js")) {
             $str = "var LANG = {";
             foreach ($this->lang_pack as $k => $lang) {
                 $str .= "\"" . $k . "\":\"" . $lang . "\",";
             }
             $str = substr($str, 0, -1);
             $str .= "};";
             file_put_contents(APP_ROOT_PATH . "public/runtime/admin/lang.js", $str);
         }
     }
     es_session::close();
 }
开发者ID:macall,项目名称:jsd,代码行数:28,代码来源:BaseAction.class.php

示例10: update

 public function update()
 {
     $conf_res = M("Conf")->where("is_effect = 1 and is_conf = 1")->findAll();
     foreach ($conf_res as $k => $v) {
         conf($v['name'], $_REQUEST[$v['name']]);
         if ($v['name'] == 'URL_MODEL' && $v['value'] != $_REQUEST[$v['name']]) {
             clear_dir_file(get_real_path() . "public/runtime/app/data_caches/");
             clear_dir_file(get_real_path() . "public/runtime/app/tpl_caches/");
             clear_dir_file(get_real_path() . "public/runtime/app/tpl_compiled/");
             clear_dir_file(get_real_path() . "public/runtime/app/data_caches/");
             clear_dir_file(get_real_path() . "public/runtime/data/page_static_cache/");
             clear_dir_file(get_real_path() . "public/runtime/data/dynamic_avatar_cache/");
         }
     }
     //开始写入配置文件
     $sys_configs = M("Conf")->findAll();
     $config_str = "<?php\n";
     $config_str .= "return array(\n";
     foreach ($sys_configs as $k => $v) {
         $config_str .= "'" . $v['name'] . "'=>'" . addslashes($v['value']) . "',\n";
     }
     $config_str .= ");\n ?>";
     $filename = get_real_path() . "public/sys_config.php";
     if (!($handle = fopen($filename, 'w'))) {
         $this->error(l("OPEN_FILE_ERROR") . $filename);
     }
     if (fwrite($handle, $config_str) === FALSE) {
         $this->error(l("WRITE_FILE_ERROR") . $filename);
     }
     fclose($handle);
     save_log(l("CONF_UPDATED"), 1);
     //clear_cache();
     write_timezone();
     $this->success(L("UPDATE_SUCCESS"));
 }
开发者ID:BruceJi,项目名称:fanwe,代码行数:35,代码来源:ConfAction.class.php

示例11: action_detail

 /**
  * Thread detail
  * 
  * @access  public
  * @params  integer
  * @return  Response
  */
 public function action_detail($id = null)
 {
     $thread_id = (int) $id;
     $thread = Model_Thread::check_authority($thread_id);
     $this->check_browse_authority($thread->public_flag, $thread->member_id);
     // 既読処理
     if (\Auth::check()) {
         $this->change_notice_status2read($this->u->id, 'thread', $id);
     }
     // thread_image
     $images = Model_ThreadImage::get4thread_id($thread_id);
     // thread_comment
     $default_params = array('latest' => 1);
     list($limit, $is_latest, $is_desc, $since_id, $max_id) = $this->common_get_list_params($default_params, conf('view_params_default.detail.comment.limit_max'));
     list($list, $next_id, $all_comment_count) = Model_ThreadComment::get_list(array('thread_id' => $thread_id), $limit, $is_latest, $is_desc, $since_id, $max_id, null, false, true);
     // thread_like
     $is_liked_self = \Auth::check() ? Model_ThreadLike::check_liked($id, $this->u->id) : false;
     $title = array('name' => $thread->title);
     $header_info = array();
     $ogp_infos = array('title' => $thread->title, 'description' => $thread->body);
     if ($images) {
         $ogp_infos['image'] = \Site_Util::get_image_uri4image_list($images, 't', 'raw');
     }
     $this->set_title_and_breadcrumbs($title, array('thread' => term('thread', 'site.list')), null, 'thread', $header_info, false, false, $ogp_infos);
     $this->template->subtitle = \View::forge('_parts/detail_subtitle', array('thread' => $thread));
     $this->template->post_footer = \View::forge('_parts/comment/handlebars_template');
     $data = array('thread' => $thread, 'images' => $images, 'comments' => $list, 'all_comment_count' => $all_comment_count, 'comment_next_id' => $next_id, 'is_liked_self' => $is_liked_self, 'liked_ids' => conf('like.isEnabled') && \Auth::check() && $list ? \Site_Model::get_liked_ids('thread_comment', $this->u->id, $list) : array());
     $this->template->content = \View::forge('detail', $data);
 }
开发者ID:uzura8,项目名称:flockbird,代码行数:36,代码来源:thread.php

示例12: index

 function index()
 {
     $data['install_scripts'] = array();
     $data['uninstall_scripts'] = array();
     // Get required modules from config
     $use_modules = conf('modules');
     // Collect install scripts from modules
     foreach (scandir(conf('module_path')) as $module) {
         // Skip everything that starts with a dot
         if (strpos($module, '.') === 0) {
             continue;
         }
         // Check if we need to uninstall this module
         if ($use_modules && !in_array($module, $use_modules)) {
             // Check if there is an uninstall script
             if (is_file(conf('module_path') . $module . '/scripts/uninstall.sh')) {
                 $data['uninstall_scripts'][$module] = conf('module_path') . $module . '/scripts/uninstall.sh';
             }
             continue;
         }
         // Check if there is a install script
         if (is_file(conf('module_path') . $module . '/scripts/install.sh')) {
             $data['install_scripts'][$module] = conf('module_path') . $module . '/scripts/install.sh';
         }
     }
     $obj = new View();
     $obj->view('install/install_script', $data);
 }
开发者ID:BillTheBest,项目名称:munkireport,代码行数:28,代码来源:install.php

示例13: webhook

 /**
  *  
  */
 protected function webhook()
 {
     $status = attrib('status');
     switch (strtolower($status)) {
         case 'on':
             put('根據測試, 必須夾帶 crt 檔案才能正確設定 web hook, 請手動設定.');
             /*
             $telegram = new \Telegram\Bot\Api(conf('bot.token'));
             $response = $telegram->setWebhook([
                 'url' => conf('bot.hook_file')
             ]);
             put( $response );
             */
             return;
         case 'off':
             // 該指令關閉 web hook, 通常用於開發環境
             $telegram = new \Telegram\Bot\Api(conf('bot.token'));
             $response = $telegram->removeWebhook();
             put($response->getDecodedBody());
             return;
         default:
             break;
     }
     put('fail');
 }
开发者ID:glennfriend,项目名称:tg-bot,代码行数:28,代码来源:Setting.php

示例14: _show_form

 /**
  * Login form
  */
 function _show_form()
 {
     // Already logged in users not needed to login again
     if (main()->USER_ID) {
         return js_redirect($this->DEF_REDIRECT_URL);
     }
     // Default resirect after login
     $_url_after_login = $this->DEF_REDIRECT_URL;
     // Process special redirect format
     if (!empty($_GET['go_url'])) {
         if (false !== ($pos1 = strpos($_GET['go_url'], ';'))) {
             $_GET['go_url'] = substr($_GET['go_url'], 0, $pos1) . '&action=' . substr($_GET['go_url'], $pos1 + 1);
         }
         $_url_after_login = './?object=' . str_replace(';', '&', $_GET['go_url']);
     } elseif (conf('_force_login_go_url')) {
         $_url_after_login = conf('_force_login_go_url');
     }
     if (strlen($_url_after_login) > 3 && !$_SESSION['user_go_url']) {
         if (substr($_url_after_login, 0, 3) == './?') {
             $_url_after_login = substr($_url_after_login, 3);
         }
         $_SESSION['user_go_url'] = $_url_after_login;
     }
     // To prevent multiple login forms displayed on one page
     conf('_login_form_displayed', true);
     return form(['form_action' => './?task=login'], ['class' => 'form-horizontal', 'legend' => 'Member Login', 'hide_empty' => 1])->validate(['__form_id__' => 'login_full_form', $this->LOGIN_FIELD => 'trim|required', 'password' => 'trim|required'])->login($this->LOGIN_FIELD, '', ['class' => 'input-medium', 'type' => $this->LOGIN_FIELD != 'login' ? $this->LOGIN_FIELD : 'text'])->password(['class' => 'input-medium'])->check_box('remember_me', '', ['no_label' => 1])->submit(['value' => 'Login', 'link_name' => 'Register', 'link_url' => './?object=register'])->container($this->oauth(['only_icons' => 1]), ['wide' => 0])->link('Retrieve lost password', './?object=get_pswd', ['class' => 'btn btn-mini btn-xs'])->hidden('action', null, ['value' => 'login']);
 }
开发者ID:yfix,项目名称:yf,代码行数:30,代码来源:yf_login_form.class.php

示例15: _init

 public static function _init()
 {
     static::$_properties['name']['label'] = term('member.name');
     static::$_properties['name']['validation']['min_length'][] = conf('member.name.validation.length.min');
     static::$_properties['name']['validation']['max_length'][] = conf('member.name.validation.length.max');
     if (is_enabled('notice') && conf('mention.isEnabled', 'notice')) {
         static::$_properties['name']['validation']['match_pattern'][] = sprintf('/^(%s)$/u', conf('member.name.validation.match_patterns.register'));
         $method = conf('member.name.validation.blacklist.method');
         if (is_callable($method)) {
             static::$_properties['name']['validation']['not_in_array'][] = call_user_func($method);
         }
     }
     static::$_properties['register_type']['validation']['in_array'][] = Site_Member::get_accept_member_register_types();
     $sex_options = Site_Form::get_form_options4config('term.member.sex.options');
     static::$_properties['sex']['label'] = term('member.sex.label');
     static::$_properties['sex']['form']['options'] = $sex_options;
     static::$_properties['sex']['validation']['in_array'][] = array_keys($sex_options);
     $options_public_flag = Site_Util::get_public_flags();
     static::$_properties['sex_public_flag']['label'] = sprintf('%sの%s', term('member.sex.label'), term('public_flag.label'));
     static::$_properties['sex_public_flag']['form'] = Site_Form::get_public_flag_configs();
     static::$_properties['sex_public_flag']['validation']['in_array'][] = $options_public_flag;
     static::$_properties['birthyear']['label'] = term('member.birthyear');
     $options = Form_Util::get_year_options(conf('member.profile.birthday.year_from'), conf('member.profile.birthday.year_to'));
     static::$_properties['birthyear']['form']['options'] = $options;
     static::$_properties['birthyear']['validation']['in_array'][] = array_keys($options);
     static::$_properties['birthyear_public_flag']['label'] = sprintf('%sの%s', term('member.birthyear'), term('public_flag.label'));
     static::$_properties['birthyear_public_flag']['form'] = Site_Form::get_public_flag_configs();
     static::$_properties['birthyear_public_flag']['validation']['in_array'][] = $options_public_flag;
     static::$_properties['birthday']['label'] = term('member.birthday');
     static::$_properties['birthday_public_flag']['label'] = sprintf('%sの%s', term('member.birthday'), term('public_flag.label'));
     static::$_properties['birthday_public_flag']['form'] = Site_Form::get_public_flag_configs();
     static::$_properties['birthday_public_flag']['validation']['in_array'][] = $options_public_flag;
     static::$_properties['invite_member_id'] = Util_Orm::get_relational_numeric_key_prop(false);
 }
开发者ID:uzura8,项目名称:flockbird,代码行数:34,代码来源:member.php


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