本文整理汇总了PHP中AWS_APP::config方法的典型用法代码示例。如果您正苦于以下问题:PHP AWS_APP::config方法的具体用法?PHP AWS_APP::config怎么用?PHP AWS_APP::config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AWS_APP
的用法示例。
在下文中一共展示了AWS_APP::config方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_email
public function action_email($action, $email, $link, $data = array(), $server = 'master')
{
if (!H::valid_email($email)) {
$user_info = $this->model('account')->get_user_info_by_uid($email);
if ($user_info['email_settings'][$action] == 'N') {
return false;
}
$email = $user_info['email'];
}
if (!$email) {
return false;
}
$email_message = (array) AWS_APP::config()->get('email_message');
foreach ($email_message[$action] as $key => $val) {
${$key} = str_replace('[#user_name#]', $data['user_name'], $val);
${$key} = str_replace('[#site_name#]', get_setting('site_name'), ${$key});
foreach ($data as $k => $v) {
${$key} = str_replace('[#' . $k . '#]', $data[$k], ${$key});
}
}
if (in_array($action, array('VALID_EMAIL', 'INVITE_REG', 'FIND_PASSWORD'))) {
return $this->send($email, $subject, $message, $link, null, $server);
} else {
return $this->insert('mail_queue', array('send_to' => $email, 'subject' => $subject, 'message' => $this->get_mail_template($user_info['user_name'], $subject, $message, $link)));
}
}
示例2: run_action
public function run_action()
{
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
// Date in the past
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
// always modified
header('Cache-Control: no-cache, must-revalidate');
// HTTP/1.1
header('Pragma: no-cache');
// HTTP/1.0
@set_time_limit(0);
if ($call_actions = $this->model('crond')->start()) {
foreach ($call_actions as $call_action) {
if ($plugins = AWS_APP::plugins()->parse('crond', 'main', $call_action)) {
foreach ($plugins as $plugin_file) {
include $plugin_file;
}
}
$call_function = $call_action;
$this->model('crond')->{$call_function}();
}
}
if (AWS_APP::config()->get('system')->debug) {
TPL::output('global/debuger.tpl.htm');
}
}
示例3: init
/**
* 系统初始化
*/
private static function init()
{
set_exception_handler(array('AWS_APP', 'exception_handle'));
self::$config = load_class('core_config');
self::$db = load_class('core_db');
self::$plugins = load_class('core_plugins');
self::$settings = self::model('setting')->get_settings();
if ((!defined('G_SESSION_SAVE') or G_SESSION_SAVE == 'db') and get_setting('db_version') > 20121123) {
Zend_Session::setSaveHandler(new Zend_Session_SaveHandler_DbTable(array('name' => get_table('sessions'), 'primary' => 'id', 'modifiedColumn' => 'modified', 'dataColumn' => 'data', 'lifetimeColumn' => 'lifetime')));
self::$session_type = 'db';
}
Zend_Session::setOptions(array('name' => G_COOKIE_PREFIX . '_Session', 'cookie_domain' => G_COOKIE_DOMAIN));
if (G_SESSION_SAVE == 'file' and G_SESSION_SAVE_PATH) {
Zend_Session::setOptions(array('save_path' => G_SESSION_SAVE_PATH));
}
Zend_Session::start();
self::$session = new Zend_Session_Namespace(G_COOKIE_PREFIX . '_Anwsion');
if ($default_timezone = get_setting('default_timezone')) {
date_default_timezone_set($default_timezone);
}
if ($img_url = get_setting('img_url')) {
define('G_STATIC_URL', $img_url);
} else {
define('G_STATIC_URL', base_url() . '/static');
}
if (self::config()->get('system')->debug) {
if ($cornd_timer = self::cache()->getGroup('crond')) {
foreach ($cornd_timer as $cornd_tag) {
if ($cornd_runtime = self::cache()->get($cornd_tag)) {
AWS_APP::debug_log('crond', 0, 'Tag: ' . str_replace('crond_timer_', '', $cornd_tag) . ', Last run time: ' . date('Y-m-d H:i:s', $cornd_runtime));
}
}
}
}
}
示例4: setup
public function setup()
{
if ($this->notify_action_details = AWS_APP::config()->get('notification')->action_details) {
foreach ($this->notify_action_details as $key => $val) {
$this->notify_actions[] = $key;
}
}
}
示例5: sql_action
public function sql_action()
{
$sql_file = ROOT_PATH . 'app/upgrade/db/' . str_replace('.', '', $_GET['id']) . '.sql';
if (file_exists($sql_file)) {
$sql_query = file_get_contents($sql_file);
}
if (trim($sql_query)) {
$sql_query .= "\n\nUPDATE `[#DB_PREFIX#]system_setting` SET `value` = 's:8:\"" . ($_GET['id'] + 1) . "\";' WHERE `varname` = 'db_version';";
header('Content-type: text/plain; charset=UTF-8');
echo str_replace(array('[#DB_PREFIX#]', '[#DB_ENGINE#]'), array(AWS_APP::config()->get('database')->prefix, $this->db_engine), $sql_query);
die;
}
}
示例6: run_query
public function run_query($sql_query)
{
$sql_query = str_replace("\n", "\r", $sql_query);
if ($db_table_querys = explode(";\r", str_replace(array('[#DB_PREFIX#]', '[#DB_ENGINE#]'), array(AWS_APP::config()->get('database')->prefix, $this->db_engine), $sql_query))) {
foreach ($db_table_querys as $_sql) {
if ($query_string = trim(str_replace(array("\r", "\n", "\t"), '', $_sql))) {
try {
$this->db()->query($query_string);
} catch (Exception $e) {
return "<b>SQL:</b> <i>{$query_string}</i><br /><b>错误描述:</b> " . $e->getMessage();
}
}
}
}
}
示例7: save_slide_action
public function save_slide_action()
{
if (!$_POST['title']) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('请填写幻灯片标题')));
}
if (!$_POST['category']) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('请选择幻灯片分类')));
}
if ($_POST['id']) {
$slide_info = $this->model('slide')->get_slide_by_id($_POST['id']);
if (!$slide_info) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('指定幻灯片不存在')));
}
}
if ($slide_info) {
$this->model('slide')->save_slide($slide_info['id'], $_POST['title'], $_POST['description'], $_POST['link'], $_POST['category']);
$id = $slide_info['id'];
} else {
$id = $this->model('slide')->save_slide(null, $_POST['title'], $_POST['description'], $_POST['link']);
if (!$id) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('保存失败')));
}
}
if ($_FILES['img']['name']) {
AWS_APP::upload()->initialize(array('allowed_types' => 'jpg,jpeg,png,gif', 'upload_path' => get_setting('upload_dir') . '/slide', 'is_image' => TRUE))->do_upload('img');
if (AWS_APP::upload()->get_error()) {
switch (AWS_APP::upload()->get_error()) {
default:
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('错误代码') . ': ' . AWS_APP::upload()->get_error()));
break;
case 'upload_invalid_filetype':
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('文件类型无效')));
break;
}
}
$upload_data = AWS_APP::upload()->data();
if (!$upload_data) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('上传失败, 请与管理员联系')));
}
foreach (AWS_APP::config()->get('image')->slide_thumbnail as $key => $val) {
$thumb_file[$key] = $upload_data['file_path'] . $id . "-" . $key . '.jpg';
AWS_APP::image()->initialize(array('quality' => 90, 'source_image' => $upload_data['full_path'], 'new_image' => $thumb_file[$key], 'width' => $val['w'], 'height' => $val['h']))->resize();
}
@unlink($upload_data['full_path']);
}
H::ajax_json_output(AWS_APP::RSM(array('url' => get_js_url('/admin/slide/list/')), 1, null));
}
示例8: fetch_menu_list
public function fetch_menu_list($select_id)
{
$admin_menu = (array) AWS_APP::config()->get('admin_menu');
if (!$admin_menu) {
return false;
}
foreach ($admin_menu as $m_id => $menu) {
if ($menu['children']) {
foreach ($menu['children'] as $c_id => $c_menu) {
if ($select_id == $c_menu['id']) {
$admin_menu[$m_id]['children'][$c_id]['select'] = true;
$admin_menu[$m_id]['select'] = true;
}
}
}
}
return $admin_menu;
}
示例9: get
/**
* GET
* @param $key
*/
public function get($key)
{
if (AWS_APP::config()->get('system')->debug) {
list($usec, $sec) = explode(' ', microtime());
$start_time = (double) $usec + (double) $sec;
}
if (!$key) {
return false;
}
$result = $this->cache_factory->load($this->cachePrefix . $key);
if (AWS_APP::config()->get('system')->debug) {
list($usec, $sec) = explode(' ', microtime());
$end_time = (double) $usec + (double) $sec;
$stime = sprintf("%06f", $end_time - $start_time);
AWS_APP::debug_log('cache', $stime, 'Get Cache: ' . str_replace($this->groupPrefix, '', $key) . ', result type: ' . gettype($result));
}
return $result;
}
示例10: index_action
public function index_action()
{
$this->crumb(AWS_APP::lang()->_t('概述'), 'admin/main/');
if (!defined('IN_SAE')) {
$writable_check = array('cache' => is_really_writable(ROOT_PATH . 'cache/'), 'tmp' => is_really_writable(ROOT_PATH . './tmp/'), get_setting('upload_dir') => is_really_writable(get_setting('upload_dir')));
TPL::assign('writable_check', $writable_check);
}
TPL::assign('users_count', $this->model('system')->count('users'));
TPL::assign('users_valid_email_count', $this->model('system')->count('users', 'valid_email = 1'));
TPL::assign('question_count', $this->model('system')->count('question'));
TPL::assign('answer_count', $this->model('system')->count('answer'));
TPL::assign('question_count', $this->model('system')->count('question'));
TPL::assign('question_no_answer_count', $this->model('system')->count('question', 'answer_count = 0'));
TPL::assign('best_answer_count', $this->model('system')->count('question', 'best_answer > 0'));
TPL::assign('topic_count', $this->model('system')->count('topic'));
TPL::assign('attach_count', $this->model('system')->count('attach'));
TPL::assign('approval_question_count', $this->model('publish')->count('approval', "type = 'question'"));
TPL::assign('approval_answer_count', $this->model('publish')->count('approval', "type = 'answer'"));
$admin_menu = (array) AWS_APP::config()->get('admin_menu');
$admin_menu[0]['select'] = true;
TPL::assign('menu_list', $admin_menu);
TPL::output('admin/index');
}
示例11: avatar_upload_action
function avatar_upload_action()
{
AWS_APP::upload()->initialize(array('allowed_types' => 'jpg,jpeg,png,gif', 'upload_path' => get_setting('upload_dir') . '/avatar/' . $this->model('account')->get_avatar($this->user_id, '', 1), 'is_image' => TRUE, 'max_size' => get_setting('upload_avatar_size_limit'), 'file_name' => $this->model('account')->get_avatar($this->user_id, '', 2), 'encrypt_name' => FALSE))->do_upload('user_avatar');
if (AWS_APP::upload()->get_error()) {
switch (AWS_APP::upload()->get_error()) {
default:
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('错误代码') . ': ' . AWS_APP::upload()->get_error()));
break;
case 'upload_invalid_filetype':
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('文件类型无效')));
break;
case 'upload_invalid_filesize':
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('文件尺寸过大, 最大允许尺寸为 %s KB', get_setting('upload_size_limit'))));
break;
}
}
if (!($upload_data = AWS_APP::upload()->data())) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('上传失败, 请与管理员联系')));
}
if ($upload_data['is_image'] == 1) {
foreach (AWS_APP::config()->get('image')->avatar_thumbnail as $key => $val) {
$thumb_file[$key] = $upload_data['file_path'] . $this->model('account')->get_avatar($this->user_id, $key, 2);
AWS_APP::image()->initialize(array('quality' => 90, 'source_image' => $upload_data['full_path'], 'new_image' => $thumb_file[$key], 'width' => $val['w'], 'height' => $val['h']))->resize();
}
}
$update_data['avatar_file'] = $this->model('account')->get_avatar($this->user_id, null, 1) . basename($thumb_file['min']);
// 更新主表
$this->model('account')->update_users_fields($update_data, $this->user_id);
if (!$this->model('integral')->fetch_log($this->user_id, 'UPLOAD_AVATAR')) {
$this->model('integral')->process($this->user_id, 'UPLOAD_AVATAR', round(get_setting('integral_system_config_profile') * 0.2), '上传头像');
}
H::ajax_json_output(AWS_APP::RSM(array('preview' => get_setting('upload_url') . '/avatar/' . $this->model('account')->get_avatar($this->user_id, null, 1) . basename($thumb_file['max'])), 1, null));
}
示例12: save_user_action
public function save_user_action()
{
if ($_POST['uid']) {
if (!($user_info = $this->model('account')->get_user_info_by_uid($_POST['uid']))) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('用户不存在')));
}
if ($user_info['group_id'] == 1 and !$this->user_info['permission']['is_administortar']) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('你没有权限编辑管理员账号')));
}
if ($_POST['user_name'] != $user_info['user_name'] and $this->model('account')->get_user_info_by_username($_POST['user_name'])) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('用户名已存在')));
}
if ($_POST['email'] != $user_info['email'] and $this->model('account')->get_user_info_by_username($_POST['email'])) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('E-mail 已存在')));
}
if ($_FILES['user_avatar']['name']) {
AWS_APP::upload()->initialize(array('allowed_types' => 'jpg,jpeg,png,gif', 'upload_path' => get_setting('upload_dir') . '/avatar/' . $this->model('account')->get_avatar($user_info['uid'], '', 1), 'is_image' => TRUE, 'max_size' => get_setting('upload_avatar_size_limit'), 'file_name' => $this->model('account')->get_avatar($user_info['uid'], '', 2), 'encrypt_name' => FALSE))->do_upload('user_avatar');
if (AWS_APP::upload()->get_error()) {
switch (AWS_APP::upload()->get_error()) {
default:
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('错误代码') . ': ' . AWS_APP::upload()->get_error()));
break;
case 'upload_invalid_filetype':
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('文件类型无效')));
break;
case 'upload_invalid_filesize':
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('文件尺寸过大, 最大允许尺寸为 %s KB', get_setting('upload_size_limit'))));
break;
}
}
if (!($upload_data = AWS_APP::upload()->data())) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('上传失败, 请与管理员联系')));
}
if ($upload_data['is_image'] == 1) {
foreach (AWS_APP::config()->get('image')->avatar_thumbnail as $key => $val) {
$thumb_file[$key] = $upload_data['file_path'] . $this->model('account')->get_avatar($user_info['uid'], $key, 2);
AWS_APP::image()->initialize(array('quality' => 90, 'source_image' => $upload_data['full_path'], 'new_image' => $thumb_file[$key], 'width' => $val['w'], 'height' => $val['h']))->resize();
}
}
$update_data['avatar_file'] = $this->model('account')->get_avatar($user_info['uid'], null, 1) . basename($thumb_file['min']);
}
if ($_POST['email']) {
$update_data['email'] = htmlspecialchars($_POST['email']);
}
$update_data['invitation_available'] = intval($_POST['invitation_available']);
$verify_apply = $this->model('verify')->fetch_apply($user_info['uid']);
if ($verify_apply) {
$update_data['verified'] = $_POST['verified'];
if (!$update_data['verified']) {
$this->model('verify')->decline_verify($user_info['uid']);
} else {
if ($update_data['verified'] != $verify_apply['type']) {
$this->model('verify')->update_apply($user_info['uid'], null, null, null, null, $update_data['verified']);
}
}
} else {
if ($_POST['verified']) {
$verified_id = $this->model('verify')->add_apply($user_info['uid'], null, null, $_POST['verified']);
$this->model('verify')->approval_verify($verified_id);
}
}
$update_data['valid_email'] = intval($_POST['valid_email']);
$update_data['forbidden'] = intval($_POST['forbidden']);
$update_data['group_id'] = intval($_POST['group_id']);
if ($update_data['group_id'] == 1 and !$this->user_info['permission']['is_administortar']) {
unset($update_data['group_id']);
}
$update_data['province'] = htmlspecialchars($_POST['province']);
$update_data['city'] = htmlspecialchars($_POST['city']);
$update_data['job_id'] = intval($_POST['job_id']);
$update_data['mobile'] = htmlspecialchars($_POST['mobile']);
$update_data['sex'] = intval($_POST['sex']);
$this->model('account')->update_users_fields($update_data, $user_info['uid']);
if ($_POST['delete_avatar']) {
$this->model('account')->delete_avatar($user_info['uid']);
}
if ($_POST['password']) {
$this->model('account')->update_user_password_ingore_oldpassword($_POST['password'], $user_info['uid'], fetch_salt(4));
}
$this->model('account')->update_users_attrib_fields(array('signature' => htmlspecialchars($_POST['signature']), 'qq' => htmlspecialchars($_POST['qq']), 'homepage' => htmlspecialchars($_POST['homepage'])), $user_info['uid']);
if ($_POST['user_name'] != $user_info['user_name']) {
$this->model('account')->update_user_name($_POST['user_name'], $user_info['uid']);
}
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('用户资料更新成功')));
} else {
$_POST['user_name'] = trim($_POST['user_name']);
$_POST['email'] = trim($_POST['email']);
$_POST['password'] = trim($_POST['password']);
$_POST['group_id'] = intval($_POST['group_id']);
if (!$_POST['user_name']) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('请输入用户名')));
}
if ($this->model('account')->check_username($_POST['user_name'])) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('用户名已经存在')));
}
if ($this->model('account')->check_email($_POST['email'])) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('E-Mail 已经被使用, 或格式不正确')));
}
if (strlen($_POST['password']) < 6 or strlen($_POST['password']) > 16) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('密码长度不符合规则')));
//.........这里部分代码省略.........
示例13: publish_question_action
public function publish_question_action()
{
if (!$this->user_info['permission']['publish_question']) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('你没有权限发布问题')));
}
if ($this->user_info['integral'] < 0 and get_setting('integral_system_enabled') == 'Y') {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('你的剩余积分已经不足以进行此操作')));
}
if (!$_POST['question_content']) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('请输入问题标题')));
}
if (get_setting('category_enable') == 'N') {
$_POST['category_id'] = 1;
}
if (!$_POST['category_id']) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('请选择问题分类')));
}
if (cjk_strlen($_POST['question_content']) < 5) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('问题标题字数不得少于 5 个字')));
}
if (get_setting('question_title_limit') > 0 and cjk_strlen($_POST['question_content']) > get_setting('question_title_limit')) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('问题标题字数不得大于 %s 字节', get_setting('question_title_limit'))));
}
if (!$this->user_info['permission']['publish_url'] and FORMAT::outside_url_exists($_POST['question_detail'])) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('你所在的用户组不允许发布站外链接')));
}
if (human_valid('question_valid_hour') and !AWS_APP::captcha()->is_validate($_POST['seccode_verify'])) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('请填写正确的验证码')));
}
if ($_POST['topics']) {
foreach ($_POST['topics'] as $key => $topic_title) {
$topic_title = trim($topic_title);
if (!$topic_title) {
unset($_POST['topics'][$key]);
} else {
$_POST['topics'][$key] = $topic_title;
}
}
if (get_setting('question_topics_limit') and sizeof($_POST['topics']) > get_setting('question_topics_limit')) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('单个问题话题数量最多为 %s 个, 请调整话题数量', get_setting('question_topics_limit'))));
}
}
if (!$_POST['topics'] and get_setting('new_question_force_add_topic') == 'Y') {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('请为问题添加话题')));
}
if (!$this->model('publish')->insert_attach_is_self_upload($_POST['question_detail'], $_POST['attach_ids'])) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('只允许插入当前页面上传的附件')));
}
if ($_POST['weixin_media_id']) {
$_POST['weixin_media_id'] = base64_decode($_POST['weixin_media_id']);
$weixin_pic_url = AWS_APP::cache()->get('weixin_pic_url_' . md5($_POST['weixin_media_id']));
if (!$weixin_pic_url) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('图片已过期或 media_id 无效')));
}
$file = $this->model('openid_weixin_weixin')->get_file($_POST['weixin_media_id']);
if (!$file) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('远程服务器忙')));
}
if (is_array($file) and $file['errmsg']) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('获取图片失败,错误为: %s', $file['errmsg'])));
}
AWS_APP::upload()->initialize(array('allowed_types' => get_setting('allowed_upload_types'), 'upload_path' => get_setting('upload_dir') . '/questions/' . gmdate('Ymd'), 'is_image' => TRUE, 'max_size' => get_setting('upload_size_limit')));
AWS_APP::upload()->do_upload($_POST['weixin_media_id'] . '.jpg', $file);
$upload_error = AWS_APP::upload()->get_error();
if ($upload_error) {
switch ($upload_error) {
default:
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('保存图片失败,错误为 %s' . $upload_error)));
break;
case 'upload_invalid_filetype':
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('保存图片失败,本站不允许上传 jpeg 格式的图片')));
break;
case 'upload_invalid_filesize':
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('图片尺寸过大, 最大允许尺寸为 %s KB', get_setting('upload_size_limit'))));
break;
}
}
$upload_data = AWS_APP::upload()->data();
if (!$upload_data) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('保存图片失败,请与管理员联系')));
}
foreach (AWS_APP::config()->get('image')->attachment_thumbnail as $key => $val) {
$thumb_file[$key] = $upload_data['file_path'] . $val['w'] . 'x' . $val['h'] . '_' . basename($upload_data['full_path']);
AWS_APP::image()->initialize(array('quality' => 90, 'source_image' => $upload_data['full_path'], 'new_image' => $thumb_file[$key], 'width' => $val['w'], 'height' => $val['h']))->resize();
}
$this->model('publish')->add_attach('question', $upload_data['orig_name'], $_POST['attach_access_key'], time(), basename($upload_data['full_path']), true);
}
// !注: 来路检测后面不能再放报错提示
if (!valid_post_hash($_POST['post_hash'])) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('页面停留时间过长,或内容已提交,请刷新页面')));
}
$this->model('draft')->delete_draft(1, 'question', $this->user_id);
if ($this->publish_approval_valid()) {
$this->model('publish')->publish_approval('question', array('question_content' => $_POST['question_content'], 'question_detail' => $_POST['question_detail'], 'category_id' => $_POST['category_id'], 'topics' => $_POST['topics'], 'anonymous' => $_POST['anonymous'], 'attach_access_key' => $_POST['attach_access_key'], 'ask_user_id' => $_POST['ask_user_id'], 'permission_create_topic' => $this->user_info['permission']['create_topic']), $this->user_id, $_POST['attach_access_key']);
H::ajax_json_output(AWS_APP::RSM(array('url' => get_js_url('/publish/wait_approval/')), 1, null));
} else {
$question_id = $this->model('publish')->publish_question($_POST['question_content'], $_POST['question_detail'], $_POST['category_id'], $this->user_id, $_POST['topics'], $_POST['anonymous'], $_POST['attach_access_key'], $_POST['ask_user_id'], $this->user_info['permission']['create_topic']);
if ($_POST['_is_mobile']) {
if ($weixin_user = $this->model('openid_weixin_weixin')->get_user_info_by_uid($this->user_id)) {
if ($weixin_user['location_update'] > time() - 7200) {
//.........这里部分代码省略.........
示例14: associate_avatar
public function associate_avatar($uid, $headimgurl)
{
if ($headimgurl) {
if (!($user_info = $this->model('account')->get_user_info_by_uid($uid))) {
return false;
}
if ($user_info['avatar_file']) {
return false;
}
if ($avatar_stream = curl_get_contents($headimgurl, 1)) {
$avatar_location = get_setting('upload_dir') . '/avatar/' . $this->model('account')->get_avatar($uid, '', 1) . $this->model('account')->get_avatar($uid, '', 2);
$avatar_dir = str_replace(basename($avatar_location), '', $avatar_location);
if (!is_dir($avatar_dir)) {
make_dir($avatar_dir);
}
if (@file_put_contents($avatar_location, $avatar_stream)) {
foreach (AWS_APP::config()->get('image')->avatar_thumbnail as $key => $val) {
$thumb_file[$key] = $avatar_dir . $this->model('account')->get_avatar($uid, $key, 2);
AWS_APP::image()->initialize(array('quality' => 90, 'source_image' => $avatar_location, 'new_image' => $thumb_file[$key], 'width' => $val['w'], 'height' => $val['h']))->resize();
}
$avatar_file = $this->model('account')->get_avatar($uid, null, 1) . basename($thumb_file['min']);
}
}
}
if ($avatar_file) {
return $this->model('account')->update('users', array('avatar_file' => $avatar_file), 'uid = ' . intval($uid));
}
}
示例15: get_feature_pic_url
/**
* 获取专题图片指定尺寸的完整url地址
* @param string $size 三种图片尺寸 max(100px)|mid(50px)|min(32px)
* @param string $pic_file 某一尺寸的图片文件名
* @return string 取出专题图片的完整url地址
*/
function get_feature_pic_url($size = null, $pic_file = null)
{
if (!$pic_file) {
return false;
} else {
if ($size) {
$pic_file = str_replace(AWS_APP::config()->get('image')->feature_thumbnail['min']['w'] . '_' . AWS_APP::config()->get('image')->feature_thumbnail['min']['h'], AWS_APP::config()->get('image')->feature_thumbnail[$size]['w'] . '_' . AWS_APP::config()->get('image')->feature_thumbnail[$size]['h'], $pic_file);
}
}
return get_setting('upload_url') . '/feature/' . $pic_file;
}