本文整理汇总了PHP中CONFIG函数的典型用法代码示例。如果您正苦于以下问题:PHP CONFIG函数的具体用法?PHP CONFIG怎么用?PHP CONFIG使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CONFIG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
public function show()
{
if ($this->params()->name) {
$this->user = User::where(['name' => $this->params()->name])->first();
} else {
$this->user = User::find($this->params()->id);
}
if (!$this->user) {
$this->redirectTo("/404");
} else {
if ($this->user->id == current_user()->id) {
$this->set_title('My profile');
} else {
$this->set_title($this->user->name . "'s profile");
}
}
if (current_user()->is_mod_or_higher()) {
# RP: Missing feature.
// $this->user_ips = $this->user->user_logs->order('created_at DESC').pluck('ip_addr').uniq
$this->user_ips = array_unique(UserLog::where(['user_id' => $this->user->id])->order('created_at DESC')->take()->getAttributes('ip_addr'));
}
$tag_types = CONFIG()->tag_types;
foreach (array_keys($tag_types) as $k) {
if (!preg_match('/^[A-Z]/', $k) || $k == 'General' || $k == 'Faults') {
unset($tag_types[$k]);
}
}
$this->tag_types = $tag_types;
$this->respondTo(array('html'));
}
示例2: envia_archivo_via_ftp
function envia_archivo_via_ftp($cadena, $nombre_archivo_remoto = "", $mensajes = 0)
{
$fp = fopen("temp.txt", "w");
if (fwrite($fp, utf8_encode($cadena))) {
$ftp_sitio = CONFIG("FE_RESPALDO_SITIO");
$ftp_usuario = CONFIG("FE_RESPALDO_SITIO_USUARIO");
$ftp_pass = CONFIG("FE_RESPALDO_SITIO_CLAVE");
$conn = ftp_connect($ftp_sitio) or die("Acceso incorrecto.. " . $ftp_sitio);
ftp_login($conn, $ftp_usuario, $ftp_pass);
ftp_chdir($conn, CONFIG("FE_RESPALDO_SITIO_DIR"));
//echo $ftp_sitio."--".$ftp_usuario."--".$ftp_pass."--".CONFIG("FE_RESPALDO_SITIO_DIR");
if (ftp_size($conn, $nombre_archivo_remoto) != -1) {
if ($mensajes) {
echo "Ya existe este envio, no se realizo nuevamente..";
}
} else {
if (ftp_put($conn, $nombre_archivo_remoto, "temp.txt", FTP_ASCII)) {
if ($mensajes) {
echo "Envio exitoso.... ok";
} else {
if ($mensajes) {
echo "Hubo un problema durante la transferencia ...";
}
}
}
}
ftp_close($conn);
}
fclose($fp);
}
示例3: index
public function index()
{
if (CONFIG()->skip_homepage) {
$this->redirectTo('post#index');
} else {
$this->post_count = Post::fast_count();
}
}
示例4: update_last_commented_at
public function update_last_commented_at()
{
# return if self.do_not_bump_post
$comment_count = self::connection()->selectValue("SELECT COUNT(*) FROM comments WHERE post_id = ?", $this->post_id);
if ($comment_count <= CONFIG()->comment_threshold) {
self::connection()->executeSql(["UPDATE posts SET last_commented_at = (SELECT created_at FROM comments WHERE post_id = :post_id ORDER BY created_at DESC LIMIT 1) WHERE posts.id = :post_id", 'post_id' => $this->post_id]);
}
}
示例5: store_sample_url
public function store_sample_url()
{
if (CONFIG()->use_pretty_image_urls) {
$path = "/sample/" . $this->_post->md5 . "/" . urlencode($this->_post->pretty_file_name(array('type' => 'sample'))) . ".jpg";
} else {
$path = "/data/sample/" . CONFIG()->sample_filename_prefix . $this->_post->md5 . ".jpg";
}
return CONFIG()->url_base . $path;
}
示例6: __construct
/**
* 构造函数
* @param mixed $path 放置文件夹
* @param mixed $usedate 是否生成日期目录
* @access public
*/
public function __construct($path = 'upload', $usedate = TRUE, $otherpath = '')
{
$this->path = CONFIG('otherconfig/static/dataurl') . $path;
$this->path = $otherpath ? $this->path . '/' . $otherpath . '/' : $this->path . '/';
if (!helper_file::checkdir($this->path)) {
helper_file::makedir($this->path);
}
$this->usedate = $usedate;
}
示例7: getInstance
/**
*
* @param type $dbType
* @return db_AdapterMysqli
*/
public static function getInstance(string $dbType = 'mysqli')
{
if (is_null(self::$instance)) {
if ($dbType == 'mysqli') {
self::$instance = new db_AdapterMysqli(CONFIG('1'));
}
}
return self::$instance;
}
示例8: dmail
public function dmail($recipient, $sender, $msg_title, $msg_body)
{
$recipients = self::normalize_address($recipient->email);
$subject = CONFIG()->app_name . " - Message received from " . $sender->name;
$this->body = $msg_body;
$this->sender = $sender;
$this->subject = $msg_title;
$this->to = $recipients;
$this->subject = $subject;
}
示例9: run
public function run()
{
Rails::systemExit()->register(function () {
if (!$this->finished) {
$this->active = false;
$this->data->success = false;
$this->data->error = "Couldn't finish successfuly";
$this->save();
}
});
# Ugly: set the current user ID to the one set in the batch, so history entries
# will be created as that user.
// $old_thread_user = Thread::current["danbooru-user"];
// $old_thread_user_id = Thread::current["danbooru-user_id"];
// $old_ip_addr = Thread::current["danbooru-ip_addr"];
// Thread::current["danbooru-user"] = User::find_by_id(self.user_id)
// Thread::current["danbooru-user_id"] = $this->user_id
// Thread::current["danbooru-ip_addr"] = $this->ip
$this->active = true;
$this->save();
$post = Post::create(['source' => $this->url, 'tags' => $this->tags, 'updater_user_id' => $this->user_id, 'updater_ip_addr' => $this->ip, 'user_id' => $this->user_id, 'ip_addr' => $this->ip, 'status' => "active"]);
if ($post->errors()->blank()) {
if (CONFIG()->dupe_check_on_upload && $post->image() && !$post->parent_id) {
$options = ['services' => SimilarImages::get_services("local"), 'type' => 'post', 'source' => $post];
$res = SimilarImages::similar_images($options);
if (!empty($res['posts'])) {
$post->tags = $post->tags() . " possible_duplicate";
$post->save();
}
}
$this->data->success = true;
$this->data->post_id = $post->id;
} elseif ($post->errors()->on('md5')) {
// $p = $post->errors();
$p = Post::where(['md5' => $post->md5])->first();
$this->data->success = false;
$this->data->error = "Post already exists";
$this->data->post_id = $p->id;
} else {
// p $post.errors
$this->data->success = false;
$this->data->error = $post->errors()->fullMessages(", ");
}
if ($this->data->success) {
$this->status = 'finished';
} else {
$this->status = 'error';
}
$this->active = false;
$this->save();
$this->finished = true;
// Thread::current["danbooru-user"] = old_thread_user
// Thread::current["danbooru-user_id"] = old_thread_user_id
// Thread::current["danbooru-ip_addr"] = old_ip_addr
}
示例10: get_service_icon
public static function get_service_icon($service)
{
if ($service == CONFIG()->local_image_service) {
$url = "/favicon.ico";
} elseif ($service == "gelbooru.com") {
# hack
$url = "/favicon-" . $service . ".png";
} else {
$url = "/favicon-" . $service . ".ico";
}
return $url;
}
示例11: coreRun
private static function coreRun()
{
define('CHARSET', CONFIG('charset'));
define('DEBUGSET', CONFIG('opendebug'));
ini_set('date.timezone', 'Asia/Shanghai');
header('Content-Type: text/html; charset=' . CHARSET);
spl_autoload_register('newAutoModel::autoload');
register_shutdown_function('newAutoModel::appSystemError');
set_error_handler('newAutoModel::errorExcption');
set_exception_handler('newAutoModel::errorExcption');
self::cacheCore();
}
示例12: create
public function create()
{
$this->response()->headers()->setContentType('text/javascript');
$this->setLayout(false);
if ($this->request()->isPost()) {
if (current_user()->tag_subscriptions->size() >= CONFIG()->max_tag_subscriptions) {
$this->tag_subscription = null;
} else {
$this->tag_subscription = TagSubscription::create(['user_id' => current_user()->id, 'tag_query' => '']);
}
}
}
示例13: create_instance
public static function create_instance(Post $post)
{
$image_store = Rails::services()->get('inflector')->camelize(CONFIG()->image_store);
$file = dirname(__FILE__) . '/' . $image_store . '.php';
if (!is_file($file)) {
throw new Exception(sprintf("File not found for image store configuration '%s'.", CONFIG()->image_store ?: '[empty value]'));
}
require_once $file;
$class = 'Post_ImageStore_' . $image_store;
$object = new $class();
$object->_post = $post;
return $object;
}
示例14: numbers_to_imoutos
public function numbers_to_imoutos($number)
{
if (!CONFIG()->show_homepage_imoutos) {
return;
}
$number = str_split($number);
$output = '<div style="margin-bottom: 1em;">' . "\r\n";
foreach ($number as $num) {
$output .= ' <img alt="' . $num . '" src="/images/' . $num . ".gif\" />\r\n";
}
$output .= " </div>\r\n";
return $output;
}
示例15: __construct
public function __construct()
{
$this->cache_config = CONFIG('cache/memory');
if ($this->cache_config['type']) {
$cache_name = strtolower('cache_' . $this->cache_config['type']);
$this->cacheObj = $cache_name::getInstance();
$this->cacheset = $this->cacheObj->check();
if (!$this->cacheset) {
debug("Can't not use this cache :" . $cache_name, '9999');
}
}
$this->pre = SA . '_';
return $this;
}