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


PHP cmsConfig类代码示例

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


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

示例1: uploadWithPreset

 public function uploadWithPreset($name, $preset_name)
 {
     $config = cmsConfig::getInstance();
     $uploader = new cmsUploader();
     $result = $uploader->upload($name, $this->allowed_extensions);
     if ($result['success']) {
         if (!$uploader->isImage($result['path'])) {
             $result['success'] = false;
             $result['error'] = LANG_UPLOAD_ERR_MIME;
         }
     }
     if (!$result['success']) {
         if (!empty($result['path'])) {
             $uploader->remove($result['path']);
         }
         return $result;
     }
     $preset = $this->model->getPresetByName($preset_name);
     if (!$preset) {
         return array('success' => false, 'error' => '');
     }
     $path = $uploader->resizeImage($result['path'], array('width' => $preset['width'], 'height' => $preset['height'], 'square' => $preset['is_square'], 'quality' => $preset['is_watermark'] && $preset['wm_image'] ? 100 : $preset['quality']));
     $image = array('path' => $path, 'url' => $config->upload_host . '/' . $path);
     if ($preset['is_watermark'] && $preset['wm_image']) {
         img_add_watermark($image['path'], $preset['wm_image']['original'], $preset['wm_origin'], $preset['wm_margin'], $preset['quality']);
     }
     $result['image'] = $image;
     @unlink($result['path']);
     unset($result['path']);
     return $result;
 }
开发者ID:pin-git,项目名称:icms2,代码行数:31,代码来源:frontend.php

示例2: start

 public function start()
 {
     $config = cmsConfig::getInstance();
     $this->memcache = new Memcache();
     $this->memcache->connect($config->cache_host, $config->cache_port) or die('Memcache connect error');
     return true;
 }
开发者ID:asphix,项目名称:icms2,代码行数:7,代码来源:cachememory.php

示例3: run

 public function run()
 {
     $template = cmsTemplate::getInstance();
     $config = cmsConfig::getInstance();
     $user = cmsUser::getInstance();
     $contact_id = $this->request->get('contact_id') or cmsCore::error404();
     $content = $this->request->get('content') or cmsCore::error404();
     $csrf_token = $this->request->get('csrf_token');
     // Проверяем валидность
     $is_valid = is_numeric($contact_id) && cmsForm::validateCSRFToken($csrf_token, false);
     if (!$is_valid) {
         $result = array('error' => true, 'message' => '');
         $template->renderJSON($result);
     }
     $contact = $this->model->getContact($user->id, $contact_id);
     // Контакт существует?
     if (!$contact) {
         $result = array('error' => true, 'message' => '');
         $template->renderJSON($result);
     }
     // Контакт не в игноре у отправителя?
     if ($contact['is_ignored']) {
         $result = array('error' => true, 'message' => LANG_PM_CONTACT_IS_IGNORED);
         $template->renderJSON($result);
     }
     // Отправитель не в игноре у контакта?
     if ($this->model->isContactIgnored($contact_id, $user->id)) {
         $result = array('error' => true, 'message' => LANG_PM_YOU_ARE_IGNORED);
         $template->renderJSON($result);
     }
     // Контакт принимает сообщения от этого пользователя?
     if (!$user->isPrivacyAllowed($contact, 'messages_pm')) {
         $result = array('error' => true, 'message' => LANG_PM_CONTACT_IS_PRIVATE);
         $template->renderJSON($result);
     }
     //
     // Отправляем сообщение
     //
     $content_html = cmsEventsManager::hook('html_filter', $content);
     if (!$content_html) {
         $template->renderJSON(array('error' => false, 'date' => false, 'message' => false));
     }
     $this->setSender($user->id);
     $this->addRecipient($contact_id);
     $message_id = $this->sendMessage($content_html);
     //
     // Отправляем уведомление на почту
     //
     $user_to = cmsCore::getModel('users')->getUser($contact_id);
     if (!$user_to['is_online']) {
         $this->sendNoticeEmail('messages_new');
     }
     //
     // Получаем и рендерим добавленное сообщение
     //
     $message = $this->model->getMessage($message_id);
     $message_html = $template->render('message', array('messages' => array($message), 'user' => $user), new cmsRequest(array(), cmsRequest::CTX_INTERNAL));
     // Результат
     $template->renderJSON(array('error' => false, 'date' => date($config->date_format, time()), 'message' => $message_html));
 }
开发者ID:asphix,项目名称:icms2,代码行数:60,代码来源:send.php

示例4: displayEditor

    public function displayEditor($field_id, $content = '')
    {
        $lang = cmsConfig::get('language');
        $user = cmsUser::getInstance();
        cmsTemplate::getInstance()->addCSS('wysiwyg/ckeditor/samples/sample.css');
        cmsTemplate::getInstance()->addJS('wysiwyg/ckeditor/ckeditor.js');
        $dom_id = str_replace(array('[', ']'), array('_', ''), $field_id);
        echo html_textarea($field_id, $content, array('id' => $dom_id));
        ?>
<script type="text/javascript" >

            <?php 
        if ($user->is_admin) {
            ?>

            $(document).ready(function(){
                CKEDITOR.replace('<?php 
            echo $dom_id;
            ?>
',{
                });
            });

            <?php 
        }
        ?>
        </script>
    <?php 
    }
开发者ID:vityapro,项目名称:cms,代码行数:29,代码来源:ckeditor.wysiwyg.class.php

示例5: getInput

 public function getInput($value)
 {
     if ($value) {
         if (is_array($value)) {
             if (!empty($value['date'])) {
                 $value = sprintf('%s %02d:%02d', $value['date'], $value['hours'], $value['mins']);
             }
         }
     }
     $this->data['show_time'] = $this->getOption('show_time');
     $this->data['date'] = $value ? date(cmsConfig::getInstance()->date_format, strtotime($value)) : '';
     if ($this->data['show_time']) {
         if (!$value) {
             $this->data['hours'] = 0;
             $this->data['mins'] = 0;
         } else {
             list($this->data['hours'], $this->data['mins']) = explode(':', date('H:i', strtotime($value)));
         }
         $this->data['fname_date'] = $this->element_name . '[date]';
         $this->data['fname_hours'] = $this->element_name . '[hours]';
         $this->data['fname_mins'] = $this->element_name . '[mins]';
     } else {
         $this->data['fname_date'] = $this->element_name;
     }
     return parent::getInput($value);
 }
开发者ID:dgolovanev,项目名称:icms2,代码行数:26,代码来源:date.php

示例6: __construct

 public function __construct($name = '')
 {
     $this->site_config = cmsConfig::getInstance();
     if ($name) {
         $this->setName($name);
     } else {
         $device_type = cmsRequest::getDeviceType();
         $template = $this->site_config->template;
         // шаблон в зависимости от девайса
         if ($device_type !== 'desktop') {
             $device_template = cmsConfig::get('template_' . $device_type);
             if ($device_template) {
                 $template = $device_template;
             }
         }
         // шаблон админки, можем определить только тут
         $controller = cmsCore::getInstance()->uri_controller;
         if ($controller === 'admin' && $this->site_config->template_admin) {
             $template = $this->site_config->template_admin;
         }
         $this->setName($template);
     }
     $this->options = $this->getOptions();
     $this->setInheritNames($this->getInheritTemplates());
     $this->title = $this->site_config->sitename;
     $is_no_def_meta = isset($this->site_config->is_no_meta) ? $this->site_config->is_no_meta : false;
     if (!$is_no_def_meta) {
         $this->metakeys = $this->site_config->metakeys;
         $this->metadesc = $this->site_config->metadesc;
     }
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:31,代码来源:template.php

示例7: displayEditor

    public function displayEditor($field_id, $content = '')
    {
        $lang = cmsConfig::get('language');
        $user = cmsUser::getInstance();
        cmsTemplate::getInstance()->addJS('wysiwyg/tinymce/tinymce.min.js');
        $dom_id = str_replace(array('[', ']'), array('_', ''), $field_id);
        echo html_textarea($field_id, $content, array('id' => $dom_id));
        ?>
<script type="text/javascript" >
$(document).ready(function(){
 	tinymce.init({mode : "exact", 
	              elements : "<?php 
        echo $field_id;
        ?>
",
				  language : "ru",
				 plugins: [
         "link image lists media responsivefilemanager "
   ],
    relative_urls: false,
   
    filemanager_title:"Responsive Filemanager",
    external_filemanager_path:"/filemanager/",
    external_plugins: { "filemanager" : "/filemanager/plugin.min.js"},
    
				  image_advtab: true,
   toolbar1: "undo redo | bold italic underline | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | styleselect",
   toolbar2: "| responsivefilemanager | image | media | link unlink anchor | "
	   			  
				  });
				  });
</script>
<?php 
    }
开发者ID:comaw,项目名称:hashtag,代码行数:34,代码来源:wysiwyg.class.php

示例8: __construct

 function __construct($request)
 {
     parent::__construct($request);
     $config = cmsConfig::getInstance();
     $this->name = str_replace('backend', '', $this->name);
     $this->root_path = $config->root_path . 'system/controllers/' . $this->name . '/backend/';
 }
开发者ID:asphix,项目名称:icms2,代码行数:7,代码来源:backend.php

示例9: clean

 public function clean($key)
 {
     if (!cmsConfig::get('cache_enabled')) {
         return false;
     }
     return $this->cacher->clean($key);
 }
开发者ID:asphix,项目名称:icms2,代码行数:7,代码来源:cache.php

示例10: addContentType

 public function addContentType($ctype)
 {
     $id = $this->insert('content_types', $ctype);
     $config = cmsConfig::getInstance();
     // получаем структуру таблиц для хранения контента данного типа
     $content_table_struct = $this->getContentTableStruct();
     $fields_table_struct = $this->getFieldsTableStruct();
     $props_table_struct = $this->getPropsTableStruct();
     $props_bind_table_struct = $this->getPropsBindTableStruct();
     $props_values_table_struct = $this->getPropsValuesTableStruct();
     // создаем таблицы
     $table_name = $this->table_prefix . $ctype['name'];
     $this->db->createTable($table_name, $content_table_struct);
     $this->db->createTable("{$table_name}_fields", $fields_table_struct, $config->db_engine);
     $this->db->createCategoriesTable("{$table_name}_cats");
     $this->db->createCategoriesBindsTable("{$table_name}_cats_bind");
     $this->db->createTable("{$table_name}_props", $props_table_struct, $config->db_engine);
     $this->db->createTable("{$table_name}_props_bind", $props_bind_table_struct, $config->db_engine);
     $this->db->createTable("{$table_name}_props_values", $props_values_table_struct, $config->db_engine);
     //
     // добавляем стандартные поля
     //
     // заголовок
     $this->addContentField($ctype['name'], array('name' => 'title', 'title' => LANG_TITLE, 'type' => 'caption', 'ctype_id' => $id, 'is_in_list' => 1, 'is_in_item' => 1, 'is_in_filter' => 1, 'is_fixed' => 1, 'is_fixed_type' => 1, 'is_system' => 0, 'options' => array('label_in_list' => 'none', 'label_in_item' => 'none', 'min_length' => 3, 'max_length' => 100, 'is_required' => true)), true);
     // дата публикации
     $this->addContentField($ctype['name'], array('name' => 'date_pub', 'title' => LANG_DATE_PUB, 'type' => 'date', 'ctype_id' => $id, 'is_in_list' => 1, 'is_in_item' => 1, 'is_in_filter' => 1, 'is_fixed' => 1, 'is_fixed_type' => 1, 'is_system' => 1, 'options' => array('label_in_list' => 'none', 'label_in_item' => 'left', 'show_time' => true)), true);
     // автор
     $this->addContentField($ctype['name'], array('name' => 'user', 'title' => LANG_AUTHOR, 'type' => 'user', 'ctype_id' => $id, 'is_in_list' => 1, 'is_in_item' => 1, 'is_in_filter' => 0, 'is_fixed' => 1, 'is_fixed_type' => 1, 'is_system' => 1, 'options' => array('label_in_list' => 'none', 'label_in_item' => 'left')), true);
     // фотография
     $this->addContentField($ctype['name'], array('name' => 'photo', 'title' => LANG_PHOTO, 'type' => 'image', 'ctype_id' => $id, 'is_in_list' => 1, 'is_in_item' => 1, 'is_fixed' => 1, 'options' => array('size_teaser' => 'small', 'size_full' => 'normal', 'sizes' => array('micro', 'small', 'normal', 'big'))), true);
     // описание
     $this->addContentField($ctype['name'], array('name' => 'content', 'title' => LANG_DESCRIPTION, 'type' => 'text', 'ctype_id' => $id, 'is_in_list' => 1, 'is_in_item' => 1, 'is_fixed' => 1, 'options' => array('label_in_list' => 'none', 'label_in_item' => 'none')), true);
     cmsCache::getInstance()->clean("content.types");
     return $id;
 }
开发者ID:wrootlocal,项目名称:icms2,代码行数:35,代码来源:model.php

示例11: run

 public function run($do = false)
 {
     $updater = new cmsUpdater();
     $update = $updater->checkUpdate();
     if ($update == cmsUpdater::UPDATE_NOT_AVAILABLE) {
         cmsUser::addSessionMessage(LANG_CP_UPDATE_NOT_AVAILABLE);
         $this->redirectToAction('update');
     }
     if ($update == cmsUpdater::UPDATE_CHECK_ERROR || empty($update['version'])) {
         cmsUser::addSessionMessage(LANG_CP_UPDATE_CHECK_FAIL, 'error');
         $this->redirectToAction('update');
     }
     if (!function_exists('curl_init')) {
         cmsUser::addSessionMessage(LANG_CP_UPDATE_DOWNLOAD_FAIL, 'error');
         $this->redirectToAction('update');
     }
     $url = $update['url'];
     $package_name = basename($url);
     $destination = cmsConfig::get('upload_path') . 'installer/' . $package_name;
     $result = file_save_from_url($url, $destination);
     if ($result === false) {
         cmsUser::addSessionMessage(LANG_CP_UPDATE_DOWNLOAD_FAIL, 'error');
         $this->redirectToAction('update');
     }
     $this->redirectToAction('install', false, array('package_name' => $package_name));
 }
开发者ID:asphix,项目名称:icms2,代码行数:26,代码来源:update_install.php

示例12: run

 public function run($user)
 {
     $cfg = cmsConfig::getInstance();
     $dest_dir = $cfg->upload_path . "u{$user['id']}";
     files_remove_directory($dest_dir);
     return $user;
 }
开发者ID:asphix,项目名称:icms2,代码行数:7,代码来源:user_delete.php

示例13: processUpload

 public function processUpload($album_id)
 {
     $config = cmsConfig::getInstance();
     $uploader = new cmsUploader();
     $result = $uploader->upload('qqfile');
     if (!$result['success']) {
         cmsTemplate::getInstance()->renderJSON($result);
         $this->halt();
     }
     $preset = array('width' => 600, 'height' => 460, 'is_square' => false, 'is_watermark' => false);
     if (!empty($this->options['preset'])) {
         $preset = cmsCore::getModel('images')->getPresetByName($this->options['preset']);
     }
     $result['paths'] = array('big' => $uploader->resizeImage($result['path'], array('width' => $preset['width'], 'height' => $preset['height'], 'square' => $preset['is_square'])), 'normal' => $uploader->resizeImage($result['path'], array('width' => 160, 'height' => 160, 'square' => true)), 'small' => $uploader->resizeImage($result['path'], array('width' => 64, 'height' => 64, 'square' => true)), 'original' => $result['url']);
     if ($preset['is_watermark'] && !empty($preset['wm_image'])) {
         $images_controller = cmsCore::getController('images');
         $images_controller->addWatermark($result['paths']['big'], $preset['wm_image']['original'], $preset['wm_origin'], $preset['wm_margin']);
     }
     $result['filename'] = basename($result['path']);
     if (empty($this->options['is_origs'])) {
         @unlink($result['path']);
         unset($result['paths']['original']);
     }
     unset($result['path']);
     $result['url'] = $config->upload_host . '/' . $result['paths']['small'];
     $result['id'] = $this->model->addPhoto($album_id, $result['paths']);
     cmsTemplate::getInstance()->renderJSON($result);
     $this->halt();
 }
开发者ID:asphix,项目名称:icms2,代码行数:29,代码来源:upload.php

示例14: store

 public function store($value, $is_submitted, $old_value = null)
 {
     $config = cmsConfig::getInstance();
     $files_model = cmsCore::getModel('files');
     if ($value) {
         $file = cmsModel::yamlToArray($old_value);
         $path = $config->upload_path . $file['path'];
         @unlink($path);
         $files_model->deleteFile($file['id']);
         $old_value = null;
     }
     $uploader = new cmsUploader();
     if (!$uploader->isUploaded($this->name)) {
         return $old_value;
     }
     $allowed_extensions = $this->getOption('extensions');
     $max_size_mb = $this->getOption('max_size_mb');
     if (!trim($allowed_extensions)) {
         $allowed_extensions = false;
     }
     if (!$max_size_mb) {
         $max_size_mb = 0;
     }
     $result = $uploader->upload($this->name, $allowed_extensions, $max_size_mb * 1048576);
     if (!$result['success']) {
         if (!empty($result['path'])) {
             $uploader->remove($result['path']);
         }
         cmsUser::addSessionMessage($result['error'], 'error');
         return null;
     }
     $file = $files_model->registerFile($result['url'], $result['name']);
     return array('id' => $file['id'], 'url_key' => $file['url_key'], 'name' => $result['name'], 'size' => $result['size'], 'path' => $result['url']);
 }
开发者ID:asphix,项目名称:icms2,代码行数:34,代码来源:file.php

示例15: run

 public function run()
 {
     if (cmsUser::isLogged()) {
         $this->redirectToHome();
     }
     $email = $this->request->get('login_email');
     $password = $this->request->get('login_password');
     $remember = (bool) $this->request->get('remember');
     $back_url = $this->request->has('back') ? $this->request->get('back') : false;
     $is_site_offline = !cmsConfig::get('is_site_on');
     if ($this->request->has('submit')) {
         $is_captcha_valid = true;
         if (cmsUser::sessionGet('is_auth_captcha') && $this->options['auth_captcha']) {
             $is_captcha_valid = cmsEventsManager::hook('captcha_validate', $this->request);
         }
         if ($is_captcha_valid) {
             cmsUser::sessionUnset('is_auth_captcha');
             $logged_id = cmsUser::login($email, $password, $remember);
             if ($logged_id) {
                 if ($is_site_offline) {
                     $userSession = cmsUser::sessionGet('user');
                     if (!$userSession['is_admin']) {
                         cmsUser::addSessionMessage(LANG_LOGIN_ADMIN_ONLY, 'error');
                         cmsUser::logout();
                         $this->redirectBack();
                     }
                 }
                 cmsEventsManager::hook('auth_login', $logged_id);
                 $is_back = $this->request->get('is_back');
                 if ($is_back) {
                     $this->redirectBack();
                 }
                 if ($back_url) {
                     $this->redirect($back_url);
                 } else {
                     $this->redirectToHome();
                 }
             }
         }
         if ($this->options['auth_captcha'] && !$is_site_offline) {
             cmsUser::sessionSet('is_auth_captcha', true);
         }
         if ($is_captcha_valid) {
             cmsUser::addSessionMessage(LANG_LOGIN_ERROR, 'error');
             if ($is_site_offline) {
                 $this->redirectBack();
             }
         } else {
             cmsUser::addSessionMessage(LANG_CAPTCHA_ERROR, 'error');
         }
     }
     if ($back_url) {
         cmsUser::addSessionMessage(LANG_LOGIN_REQUIRED, 'error');
     }
     if (cmsUser::sessionGet('is_auth_captcha')) {
         $captcha_html = cmsEventsManager::hook('captcha_html');
     }
     return cmsTemplate::getInstance()->render('login', array('back_url' => $back_url, 'captcha_html' => isset($captcha_html) ? $captcha_html : false));
 }
开发者ID:asphix,项目名称:icms2,代码行数:59,代码来源:login.php


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