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

PHP ModuleHandler类代码示例

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

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



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

示例1: getInstance

 /**
  * Get single instance of ModuleHandler
  */
 public static function getInstance()
 {
     if (!isset(self::$_instance)) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
开发者ID:tareqy,项目名称:Caracal,代码行数:10,代码来源:module_handler.php


示例2: init

 function init()
 {
     // forbit access if the user is not an administrator
     if (!$this->grant->manager && !$this->grant->is_admin) {
         return $this->stop("msg_is_not_administrator");
     }
     // change into administration layout
     //$this->setTemplatePath('./modules/cympusadmin/tpl');
     $this->setLayoutPath('./modules/cympusadmin/tpl');
     $this->setLayoutFile(_CYMPUSADMIN_LAYOUT_);
     Context::loadLang(_XE_PATH_ . 'modules/cympusadmin/lang/');
     if ($this->grant->is_admin) {
         // parse admin menu
         $oXmlParser = new XmlParser();
         $xml_obj = $oXmlParser->loadXmlFile('./modules/cympusadmin/conf/' . _CYMPUSADMIN_MENU_);
         $admin_menu = cympusadmin::getMenu($xml_obj->menu->item);
         Context::set('cympusadmin_menu', $admin_menu);
     } else {
         $output = ModuleHandler::triggerCall('cympusadmin.getManagerMenu', 'before', $manager_menu);
         if (!$output->toBool()) {
             return $output;
         }
         Context::set('cympusadmin_menu', $manager_menu);
     }
     $news = getNewsFromAgency();
     Context::set('news', $news);
     Context::set('admin_bar', 'false');
     $oModuleModel =& getModel('module');
     $module_info = $oModuleModel->getModuleInfoXml('cympusadmin');
     Context::set('cympus_modinfo', $module_info);
     return new Object();
 }
开发者ID:WEN2ER,项目名称:nurigo,代码行数:32,代码来源:cympusadmin.class.php


示例3: __construct

 /**
  * Constructor
  */
 protected function __construct()
 {
     global $section, $action;
     parent::__construct(__FILE__);
     // register backend
     if (class_exists('backend')) {
         $backend = backend::getInstance();
         $import_menu = $backend->getMenu('shop_import');
         if (!is_null($import_menu)) {
             $import_menu->addChild(null, new backend_MenuItem($this->getLanguageConstant('menu_import_items'), url_GetFromFilePath($this->path . 'images/import.svg'), window_Open('shop_import_items', 350, $this->getLanguageConstant('title_import_items'), true, true, backend_UrlMake($this->name, 'import')), 6));
             $import_menu->addChild(null, new backend_MenuItem($this->getLanguageConstant('menu_import_english'), url_GetFromFilePath($this->path . 'images/import.svg'), window_Open('shop_import_items', 350, $this->getLanguageConstant('title_import_items'), true, true, backend_UrlMake($this->name, 'import_english')), 6));
         }
     }
     // register delivery method and create menu items
     if (ModuleHandler::is_loaded('backend') && ModuleHandler::is_loaded('shop')) {
         require_once 'units/method.php';
         require_once 'units/pickup_method.php';
         Paid_DeliveryMethod::getInstance($this);
         Pickup_DeliveryMethod::getInstance($this);
     }
     if (ModuleHandler::is_loaded('head_tag') && $section == 'shop' && $action == 'checkout') {
         $head_tag = head_tag::getInstance();
         $head_tag->addTag('script', array('src' => url_GetFromFilePath($this->path . 'include/pikaday.js'), 'type' => 'text/javascript'));
         $head_tag->addTag('link', array('href' => url_GetFromFilePath($this->path . 'include/pikaday.css'), 'rel' => 'stylesheet', 'type' => 'text/css'));
         $head_tag->addTag('link', array('href' => url_GetFromFilePath($this->path . 'include/checkout.css'), 'rel' => 'stylesheet', 'type' => 'text/css'));
     }
     if (ModuleHandler::is_loaded('backend') && ModuleHandler::is_loaded('head_tag') && $section == 'backend') {
         $head_tag = head_tag::getInstance();
         $head_tag->addTag('script', array('src' => url_GetFromFilePath($this->path . 'include/backend.js'), 'type' => 'text/javascript'));
     }
     // connect transaction handling event
     Events::connect('shop', 'transaction-completed', 'on_transaction_completed', $this);
 }
开发者ID:Way2CU,项目名称:AleyDafna-Shop,代码行数:36,代码来源:aley_dafna.php


示例4: dispMemberSignUpForm

 function dispMemberSignUpForm()
 {
     $oMemberModel =& getModel('member');
     if ($oMemberModel->isLogged()) {
         return $this->stop('msg_already_logged');
     }
     $trigger_output = ModuleHandler::triggerCall('member.dispMemberSignUpForm', 'before', $this->member_config);
     if (!$trigger_output->toBool()) {
         return $trigger_output;
     }
     if ($this->member_config->enable_join != 'Y') {
         return $this->stop('msg_signup_disabled');
     }
     $oMemberAdminView =& getAdminView('member');
     $formTags = $oMemberAdminView->_getMemberInputTag($member_info);
     Context::set('formTags', $formTags);
     $member_config = $oMemberModel->getMemberConfig();
     Context::set('member_config', $member_config);
     global $lang;
     $identifierForm->title = $lang->{$member_config->identifier};
     $identifierForm->name = $member_config->identifier;
     $identifierForm->value = $member_info->{$member_config->identifier};
     Context::set('identifierForm', $identifierForm);
     // Set a template file
     $this->setTemplateFile('signup_form');
 }
开发者ID:relip,项目名称:xe-core,代码行数:26,代码来源:member.mobile.php


示例5: database_initialize

/**
 * Perform database initialization.
 *
 * @param boolean $create_database
 * @return boolean
 */
function database_initialize($create_database)
{
    global $db, $db_config, $data_path;
    $result = false;
    $database_exists = false;
    $sql_file = 'units/database/init.sql';
    $xml_file = $data_path . 'system_init.xml';
    if (!file_exists($sql_file) || !file_exists($xml_file)) {
        trigger_error('Can not initialize database, missing configuration!', E_USER_ERROR);
        return $result;
    }
    // make a log entry
    trigger_error('Initializing database: ' . $db_config['name'], E_USER_NOTICE);
    // get initialization SQL
    $sql = file_get_contents($sql_file);
    // create database if needed
    if ($create_database) {
        try {
            $db->create($db_config['name']);
            $db->select($db_config['name']);
            $database_exists = true;
        } catch (Exception $error) {
            $database_exists = false;
        }
    } else {
        $database_exists = true;
    }
    // create database
    if ($database_exists && $db->multi_query($sql)) {
        $module_manager = ModuleManager::getInstance();
        $module_handler = ModuleHandler::getInstance();
        $admin_manager = UserManager::getInstance();
        // populate tables
        $raw_data = file_get_contents($xml_file);
        $data = new XMLParser($raw_data, $xml_file);
        $data->parse();
        // go over XML file and insert data
        foreach ($data->document->tagChildren as $item) {
            switch ($item->tagName) {
                case 'module':
                    // insert data
                    $module_manager->insertData(array('name' => $item->tagAttrs['name'], 'order' => $item->tagAttrs['order'], 'preload' => $item->tagAttrs['preload'] == 'yes' ? 1 : 0, 'active' => 1));
                    // initialize module
                    $module = $module_handler->_loadModule($item->tagAttrs['name']);
                    if (!is_null($module)) {
                        $module->onInit();
                    }
                    break;
                case 'user':
                    $salt = hash('sha256', UserManager::SALT . strval(time()));
                    $password = hash_hmac('sha256', $item->tagAttrs['password'], $salt);
                    $admin_manager->insertData(array('username' => $item->tagAttrs['username'], 'password' => $password, 'fullname' => $item->tagAttrs['fullname'], 'level' => $item->tagAttrs['level'], 'verified' => 1, 'salt' => $salt));
                    break;
            }
        }
        // set result
        $result = true;
    }
    return $result;
}
开发者ID:tareqy,项目名称:Caracal,代码行数:66,代码来源:common.php


示例6: getCommentMenu

 /**
  * display the pop-up menu of the post
  * Print, scrap, vote-up(recommen), vote-down(non-recommend), report features added
  * @return void
  */
 function getCommentMenu()
 {
     // get the post's id number and the current login information
     $comment_srl = Context::get('target_srl');
     $mid = Context::get('cur_mid');
     $logged_info = Context::get('logged_info');
     $act = Context::get('cur_act');
     // array values for menu_list, "comment post, target, url"
     $menu_list = array();
     // call a trigger
     ModuleHandler::triggerCall('comment.getCommentMenu', 'before', $menu_list);
     $oCommentController =& getController('comment');
     // feature that only member can do
     if ($logged_info->member_srl) {
         $oCommentModel =& getModel('comment');
         $columnList = array('comment_srl', 'module_srl', 'member_srl', 'ipaddress');
         $oComment = $oCommentModel->getComment($comment_srl, false, $columnList);
         $module_srl = $oComment->get('module_srl');
         $member_srl = $oComment->get('member_srl');
         $oModuleModel =& getModel('module');
         $comment_config = $oModuleModel->getModulePartConfig('document', $module_srl);
         if ($comment_config->use_vote_up != 'N' && $member_srl != $logged_info->member_srl) {
             // Add a vote-up button for positive feedback
             $url = sprintf("doCallModuleAction('comment','procCommentVoteUp','%s')", $comment_srl);
             $oCommentController->addCommentPopupMenu($url, 'cmd_vote', '', 'javascript');
         }
         if ($comment_config->use_vote_down != 'N' && $member_srl != $logged_info->member_srl) {
             // Add a vote-down button for negative feedback
             $url = sprintf("doCallModuleAction('comment','procCommentVoteDown','%s')", $comment_srl);
             $oCommentController->addCommentPopupMenu($url, 'cmd_vote_down', '', 'javascript');
         }
         // Add the report feature against abused posts
         $url = sprintf("doCallModuleAction('comment','procCommentDeclare','%s')", $comment_srl);
         $oCommentController->addCommentPopupMenu($url, 'cmd_declare', '', 'javascript');
     }
     // call a trigger (after)
     ModuleHandler::triggerCall('comment.getCommentMenu', 'after', $menu_list);
     // find a comment by IP matching if an administrator.
     if ($logged_info->is_admin == 'Y') {
         $oCommentModel =& getModel('comment');
         $oComment = $oCommentModel->getComment($comment_srl);
         if ($oComment->isExists()) {
             // Find a post of the corresponding ip address
             $url = getUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_target', 'ipaddress', 'search_keyword', $oComment->getIpAddress());
             $oCommentController->addCommentPopupMenu($url, 'cmd_search_by_ipaddress', $icon_path, 'TraceByIpaddress');
             $url = sprintf("var params = new Array(); params['ipaddress_list']='%s'; exec_xml('spamfilter', 'procSpamfilterAdminInsertDeniedIP', params, completeCallModuleAction)", $oComment->getIpAddress());
             $oCommentController->addCommentPopupMenu($url, 'cmd_add_ip_to_spamfilter', '', 'javascript');
         }
     }
     // Changing a language of pop-up menu
     $menus = Context::get('comment_popup_menu_list');
     $menus_count = count($menus);
     for ($i = 0; $i < $menus_count; $i++) {
         $menus[$i]->str = Context::getLang($menus[$i]->str);
     }
     // get a list of final organized pop-up menus
     $this->add('menus', $menus);
 }
开发者ID:relip,项目名称:xe-core,代码行数:63,代码来源:comment.model.php


示例7: dispBoardMessage

 function dispBoardMessage($msg_code)
 {
     $msg = Context::getLang($msg_code);
     $oMessageObject =& ModuleHandler::getModuleInstance('message', 'mobile');
     $oMessageObject->setError(-1);
     $oMessageObject->setMessage($msg);
     $oMessageObject->dispMessage();
     $this->setTemplatePath($oMessageObject->getTemplatePath());
     $this->setTemplateFile($oMessageObject->getTemplateFile());
 }
开发者ID:google-code-backups,项目名称:xe-board,代码行数:10,代码来源:board.mobile.php


示例8: getCommentMenu

 /**
  * @brief 선택된 게시물의 팝업메뉴 표시
  *
  * 인쇄, 스크랩, 추천, 비추천, 신고 기능 추가
  **/
 function getCommentMenu()
 {
     // 요청된 게시물 번호와 현재 로그인 정보 구함
     $comment_srl = Context::get('target_srl');
     $mid = Context::get('cur_mid');
     $logged_info = Context::get('logged_info');
     $act = Context::get('cur_act');
     // menu_list 에 "표시할글,target,url" 을 배열로 넣는다
     $menu_list = array();
     // trigger 호출
     ModuleHandler::triggerCall('comment.getCommentMenu', 'before', $menu_list);
     $oCommentController =& getController('comment');
     // 회원이어야만 가능한 기능
     if ($logged_info->member_srl) {
         // 추천 버튼 추가
         $url = sprintf("doCallModuleAction('comment','procCommentVoteUp','%s')", $comment_srl);
         $oCommentController->addCommentPopupMenu($url, 'cmd_vote', './modules/document/tpl/icons/vote_up.gif', 'javascript');
         // 비추천 버튼 추가
         $url = sprintf("doCallModuleAction('comment','procCommentVoteDown','%s')", $comment_srl);
         $oCommentController->addCommentPopupMenu($url, 'cmd_vote_down', './modules/document/tpl/icons/vote_down.gif', 'javascript');
         // 신고 기능 추가
         $url = sprintf("doCallModuleAction('comment','procCommentDeclare','%s')", $comment_srl);
         $oCommentController->addCommentPopupMenu($url, 'cmd_declare', './modules/document/tpl/icons/declare.gif', 'javascript');
     }
     // trigger 호출 (after)
     ModuleHandler::triggerCall('comment.getCommentMenu', 'after', $menu_list);
     // 관리자일 경우 ip로 글 찾기
     if ($logged_info->is_admin == 'Y') {
         $oCommentModel =& getModel('comment');
         $oComment = $oCommentModel->getComment($comment_srl);
         if ($oComment->isExists()) {
             // ip주소에 해당하는 글 찾기
             $url = getUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_target', 'ipaddress', 'search_keyword', $oComment->get('ipaddress'));
             $icon_path = './modules/member/tpl/images/icon_management.gif';
             $oCommentController->addCommentPopupMenu($url, 'cmd_search_by_ipaddress', $icon_path, 'TraceByIpaddress');
             $url = sprintf("var params = new Array(); params['ipaddress']='%s'; exec_xml('spamfilter', 'procSpamfilterAdminInsertDeniedIP', params, completeCallModuleAction)", $oComment->getIpAddress());
             $oCommentController->addCommentPopupMenu($url, 'cmd_add_ip_to_spamfilter', './modules/document/tpl/icons/declare.gif', 'javascript');
         }
     }
     // 팝업메뉴의 언어 변경
     $menus = Context::get('comment_popup_menu_list');
     $menus_count = count($menus);
     for ($i = 0; $i < $menus_count; $i++) {
         $menus[$i]->str = Context::getLang($menus[$i]->str);
     }
     // 최종적으로 정리된 팝업메뉴 목록을 구함
     $this->add('menus', $menus);
 }
开发者ID:hottaro,项目名称:xpressengine,代码行数:53,代码来源:comment.model.php


示例9: init

 function init($module = null)
 {
     // change into administration layout
     $config = getModel('cympusadmin')->getConfig();
     $args = new stdClass();
     $args->module = 'cympusadmin';
     $module_list = getModel('module')->getModuleSrlList($args);
     if (!empty($module_list)) {
         foreach ($module_list as $module_info) {
             $cympus_module_info = $module_info;
         }
     }
     $module_path = './modules/cympusadmin/';
     $template_path = sprintf("%sskins/%s/", $module_path, $cympus_module_info->skin);
     if (!is_dir($template_path) || !$cympus_module_info->skin) {
         $config->admin_skins = 'default';
         $template_path = sprintf("%sskins/%s/", $module_path, $cympus_module_info->skin);
     }
     if ($module) {
         $module->setLayoutPath($template_path);
         $module->setLayoutFile(_CYMPUSADMIN_LAYOUT_);
     } else {
         $this->setLayoutPath($template_path);
         $this->setLayoutFile(_CYMPUSADMIN_LAYOUT_);
     }
     Context::loadLang(_XE_PATH_ . 'modules/cympusadmin/lang/');
     $logged_info = Context::get('logged_info');
     if ($logged_info->is_admin == 'Y') {
         // parse admin menu
         $oXmlParser = new XmlParser();
         $xml_obj = $oXmlParser->loadXmlFile('./modules/cympusadmin/conf/' . _CYMPUSADMIN_MENU_);
         $admin_menu = cympusadmin::getMenu($xml_obj->menu->item);
         Context::set('cympusadmin_menu', $admin_menu);
     } else {
         $output = ModuleHandler::triggerCall('cympusadmin.getManagerMenu', 'before', $manager_menu);
         if (!$output->toBool()) {
             return $output;
         }
         Context::set('cympusadmin_menu', $manager_menu);
     }
     $news = getNewsFromAgency();
     Context::set('news', $news);
     Context::set('admin_bar', 'false');
     $oModuleModel = getModel('module');
     $module_info = $oModuleModel->getModuleInfoXml('cympusadmin');
     Context::set('cympus_modinfo', $module_info);
     return new Object();
 }
开发者ID:bjrambo,项目名称:nurigo,代码行数:48,代码来源:cympusadmin.class.php


示例10: getTextyleCustomMenu

 /**
  * @brief get textyle custom menu
  **/
 function getTextyleCustomMenu()
 {
     static $custom_menu = null;
     if (is_null($custom_menu)) {
         $oModuleModel =& getModel('module');
         $config = $oModuleModel->getModuleConfig('textyle');
         $custom_menu->hidden_menu = $config->hidden_menu;
         if (!$custom_menu->hidden_menu) {
             $custom_menu->hidden_menu = array();
         }
         $custom_menu->attached_menu = $config->attached_menu;
         if (!$custom_menu->attached_menu) {
             $custom_menu->attached_menu = array();
         }
     }
     $output = ModuleHandler::triggerCall('textyle.getTextyleCustomMenu', 'after', $custom_menu);
     if (!$output->toBool()) {
         return $output;
     }
     return $custom_menu;
 }
开发者ID:google-code-backups,项目名称:xe-textyle,代码行数:24,代码来源:textyle.model.php


示例11: dispPlanetAdminAdditionalSetup

 /**
  * @brief additional configuration support
  **/
 function dispPlanetAdminAdditionalSetup()
 {
     $output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'before', $content);
     $output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'after', $content);
     Context::set('setup_content', $content);
     // 템플릿  파일 지정
     $this->setTemplateFile('additional_setup');
 }
开发者ID:eondcom,项目名称:xe-package-planet,代码行数:11,代码来源:planet.admin.view.php


示例12: dispMemberSignUpForm

 /**
  * @brief Display member join form
  */
 function dispMemberSignUpForm()
 {
     //setcookie for redirect url in case of going to member sign up
     setcookie("XE_REDIRECT_URL", $_SERVER['HTTP_REFERER']);
     $member_config = $this->member_config;
     $oMemberModel = getModel('member');
     // Get the member information if logged-in
     if ($oMemberModel->isLogged()) {
         return $this->stop('msg_already_logged');
     }
     // call a trigger (before)
     $trigger_output = ModuleHandler::triggerCall('member.dispMemberSignUpForm', 'before', $member_config);
     if (!$trigger_output->toBool()) {
         return $trigger_output;
     }
     // Error appears if the member is not allowed to join
     if ($member_config->enable_join != 'Y') {
         return $this->stop('msg_signup_disabled');
     }
     $oMemberAdminView = getAdminView('member');
     $formTags = $oMemberAdminView->_getMemberInputTag($member_info);
     Context::set('formTags', $formTags);
     global $lang;
     $identifierForm = new stdClass();
     $identifierForm->title = $lang->{$member_config->identifier};
     $identifierForm->name = $member_config->identifier;
     $identifierForm->value = $member_info->{$member_config->identifier};
     Context::set('identifierForm', $identifierForm);
     $this->addExtraFormValidatorMessage();
     // Set a template file
     $this->setTemplateFile('signup_form');
 }
开发者ID:noxowl,项目名称:Yojouhankai-Module-Member,代码行数:35,代码来源:member.view.php


示例13: restoreTrash

 /**
  * Restore document from trash module, called by trash module
  * This method is passived
  * @param object|array $originObject
  * @return object
  */
 function restoreTrash($originObject)
 {
     if (is_array($originObject)) {
         $originObject = (object) $originObject;
     }
     $oDocumentController = getController('document');
     $oDocumentModel = getModel('document');
     $oDB =& DB::getInstance();
     $oDB->begin();
     //DB restore
     $output = $oDocumentController->insertDocument($originObject, false, true, false);
     if (!$output->toBool()) {
         return new Object(-1, $output->getMessage());
     }
     //FILE restore
     $oDocument = $oDocumentModel->getDocument($originObject->document_srl);
     // If the post was not temorarily saved, set the attachment's status to be valid
     if ($oDocument->hasUploadedFiles() && $originObject->member_srl != $originObject->module_srl) {
         $args = new stdClass();
         $args->upload_target_srl = $oDocument->document_srl;
         $args->isvalid = 'Y';
         $output = executeQuery('file.updateFileValid', $args);
     }
     // call a trigger (after)
     if ($output->toBool()) {
         $trigger_output = ModuleHandler::triggerCall('document.restoreTrash', 'after', $originObject);
         if (!$trigger_output->toBool()) {
             $oDB->rollback();
             return $trigger_output;
         }
     }
     // commit
     $oDB->commit();
     return new Object(0, 'success');
 }
开发者ID:conory,项目名称:rhymix,代码行数:41,代码来源:document.admin.controller.php


示例14: deleteMaterial

 function deleteMaterial($material_srl)
 {
     if (strpos($material_srl, ',') === false) {
         $args->material_srl = $material_srl;
     } else {
         $args->material_srls = $material_srl;
     }
     $output = executeQuery('material.deleteMaterial', $args);
     // delete thumnail image
     $oFileModel =& getModel('file');
     $file_list = array();
     if (strpos(',', $material_srl) === false) {
         $file_list = $oFileModel->getFiles($material_srl);
     } else {
         $material_srls = explode(',', $material_srl);
         foreach ($material_srls as $srl) {
             $files = $oFileModel->getFiles($srl);
             if ($files) {
                 $file_list = array_merge($file_list, $files);
             }
         }
     }
     if (count($file_list)) {
         foreach ($file_list as $k => $file) {
             $ext = substr(strrchr($file->source_filename, '.'), 1);
             $_filename = sprintf("%s%s.%%s.%s", preg_replace("/\\/[^\\/]*\$/", "/", $file->uploaded_filename), $material_srl, $ext);
             $s_filename = sprintf($_filename, 'S');
             $l_filename = sprintf($_filename, 'L');
             FileHandler::removeFile($s_filename);
             FileHandler::removeFile($l_filename);
         }
     }
     $obj->document_srl = $material_srl;
     // trigger 호출 (after)
     if ($output->toBool()) {
         $trigger_output = ModuleHandler::triggerCall('material.deleteMaterial', 'after', $obj);
         if (!$trigger_output->toBool()) {
             return $trigger_output;
         }
     }
     return $output;
 }
开发者ID:TheProjecter,项目名称:xe-material,代码行数:42,代码来源:material.controller.php


示例15: declaredDocument

 /**
  * Report posts
  * @param int $document_srl
  * @param string $declare_message
  * @return void|Object
  */
 function declaredDocument($document_srl, $declare_message = '')
 {
     // Fail if session information already has a reported document
     if ($_SESSION['declared_document'][$document_srl]) {
         return new Object(-1, 'failed_declared');
     }
     // Check if previously reported
     $args = new stdClass();
     $args->document_srl = $document_srl;
     $output = executeQuery('document.getDeclaredDocument', $args);
     if (!$output->toBool()) {
         return $output;
     }
     $declared_count = $output->data->declared_count ? $output->data->declared_count : 0;
     $trigger_obj = new stdClass();
     $trigger_obj->document_srl = $document_srl;
     $trigger_obj->declared_count = $declared_count;
     // Call a trigger (before)
     $trigger_output = ModuleHandler::triggerCall('document.declaredDocument', 'before', $trigger_obj);
     if (!$trigger_output->toBool()) {
         return $trigger_output;
     }
     // Get the original document
     $oDocumentModel = getModel('document');
     $oDocument = $oDocumentModel->getDocument($document_srl, false, false);
     // Pass if the author's IP address is as same as visitor's.
     if ($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR']) {
         $_SESSION['declared_document'][$document_srl] = true;
         return new Object(-1, 'failed_declared');
     }
     // Check if document's author is a member.
     if ($oDocument->get('member_srl')) {
         // Create a member model object
         $oMemberModel = getModel('member');
         $member_srl = $oMemberModel->getLoggedMemberSrl();
         // Pass after registering a session if author's information is same as the currently logged-in user's.
         if ($member_srl && $member_srl == abs($oDocument->get('member_srl'))) {
             $_SESSION['declared_document'][$document_srl] = true;
             return new Object(-1, 'failed_declared');
         }
     }
     // Use member_srl for logged-in members and IP address for non-members.
     $args = new stdClass();
     if ($member_srl) {
         $args->member_srl = $member_srl;
     } else {
         $args->ipaddress = $_SERVER['REMOTE_ADDR'];
     }
     $args->document_srl = $document_srl;
     $args->declare_message = trim(htmlspecialchars($declare_message));
     $output = executeQuery('document.getDocumentDeclaredLogInfo', $args);
     // Pass after registering a sesson if reported/declared documents are in the logs.
     if ($output->data->count) {
         $_SESSION['declared_document'][$document_srl] = true;
         return new Object(-1, 'failed_declared');
     }
     // begin transaction
     $oDB =& DB::getInstance();
     $oDB->begin();
     // Add the declared document
     if ($declared_count > 0) {
         $output = executeQuery('document.updateDeclaredDocument', $args);
     } else {
         $output = executeQuery('document.insertDeclaredDocument', $args);
     }
     if (!$output->toBool()) {
         $oDB->rollback();
         return $output;
     }
     // Leave logs
     $output = executeQuery('document.insertDocumentDeclaredLog', $args);
     if (!$output->toBool()) {
         $oDB->rollback();
         return $output;
     }
     $this->add('declared_count', $declared_count + 1);
     // Call a trigger (after)
     $trigger_obj->declared_count = $declared_count + 1;
     ModuleHandler::triggerCall('document.declaredDocument', 'after', $trigger_obj);
     // commit
     $oDB->commit();
     // Leave in the session information
     $_SESSION['declared_document'][$document_srl] = true;
     $this->setMessage('success_declared');
 }
开发者ID:rhymix,项目名称:rhymix,代码行数:91,代码来源:document.controller.php


示例16: declaredComment

 /**
  * Report a blamed comment
  * @param $comment_srl
  * @return void
  */
 function declaredComment($comment_srl)
 {
     // Fail if session information already has a reported document
     if ($_SESSION['declared_comment'][$comment_srl]) {
         return new Object(-1, 'failed_declared');
     }
     // check if already reported
     $args = new stdClass();
     $args->comment_srl = $comment_srl;
     $output = executeQuery('comment.getDeclaredComment', $args);
     if (!$output->toBool()) {
         return $output;
     }
     $declared_count = $output->data->declared_count ? $output->data->declared_count : 0;
     $trigger_obj = new stdClass();
     $trigger_obj->comment_srl = $comment_srl;
     $trigger_obj->declared_count = $declared_count;
     // Call a trigger (before)
     $trigger_output = ModuleHandler::triggerCall('comment.declaredComment', 'before', $trigger_obj);
     if (!$trigger_output->toBool()) {
         return $trigger_output;
     }
     // get the original comment
     $oCommentModel = getModel('comment');
     $oComment = $oCommentModel->getComment($comment_srl, FALSE, FALSE);
     // failed if both ip addresses between author's and the current user are same.
     if ($oComment->get('ipaddress') == $_SERVER['REMOTE_ADDR']) {
         $_SESSION['declared_comment'][$comment_srl] = TRUE;
         return new Object(-1, 'failed_declared');
     }
     // if the comment author is a member
     if ($oComment->get('member_srl')) {
         // create the member model object
         $oMemberModel = getModel('member');
         $member_srl = $oMemberModel->getLoggedMemberSrl();
         // session registered if the author information matches to the current logged-in user's.
         if ($member_srl && $member_srl == $oComment->get('member_srl')) {
             $_SESSION['declared_comment'][$comment_srl] = TRUE;
             return new Object(-1, 'failed_declared');
         }
     }
     // If logged-in, use the member_srl. otherwise use the ipaddress.
     if ($member_srl) {
         $args->member_srl = $member_srl;
     } else {
         $args->ipaddress = $_SERVER['REMOTE_ADDR'];
     }
     $args->comment_srl = $comment_srl;
     $log_output = executeQuery('comment.getCommentDeclaredLogInfo', $args);
     // session registered if log info contains report log.
     if ($log_output->data->count) {
         $_SESSION['declared_comment'][$comment_srl] = TRUE;
         return new Object(-1, 'failed_declared');
     }
     // begin transaction
     $oDB =& DB::getInstance();
     $oDB->begin();
     // execute insert
     if ($output->data->declared_count > 0) {
         $output = executeQuery('comment.updateDeclaredComment', $args);
     } else {
         $output = executeQuery('comment.insertDeclaredComment', $args);
     }
     if (!$output->toBool()) {
         $oDB->rollback();
         return $output;
     }
     // leave the log
     $output = executeQuery('comment.insertCommentDeclaredLog', $args);
     // Call a trigger (after)
     $trigger_obj->declared_count = $declared_count + 1;
     $trigger_output = ModuleHandler::triggerCall('comment.declaredComment', 'after', $trigger_obj);
     if (!$trigger_output->toBool()) {
         $oDB->rollback();
         return $trigger_output;
     }
     $oDB->commit();
     // leave into the session information
     $_SESSION['declared_comment'][$comment_srl] = TRUE;
     $this->setMessage('success_declared');
 }
开发者ID:kimkucheol,项目名称:xe-core,代码行数:86,代码来源:comment.controller.php


示例17: dispBoardAdminBoardAdditionSetup

 /**
  * @brief display the additional setup panel
  * additonal setup panel is for connecting the service modules with other modules
  **/
 function dispBoardAdminBoardAdditionSetup()
 {
     // sice content is obtained from other modules via call by reference, declare it first
     $content = '';
     // get the addtional setup trigger
     // the additional setup triggers can be used in many modules
     $output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'before', $content);
     $output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'after', $content);
     Context::set('setup_content', $content);
     // setup the template file
     $this->setTemplateFile('addition_setup');
 }
开发者ID:kimkucheol,项目名称:xe-core,代码行数:16,代码来源:board.admin.view.php


示例18: procRealModule

 /**
  * Get content of real module
  *
  * @param string $module module name
  * @param string $mid module id
  * @param string $skin skin name
  * @param string $skinType PC(P) or mobile(M)
  * @return string content of real module
  */
 private function procRealModule($module, $mid, $skin, $skinType)
 {
     // if form site design and preview module, find target module
     if ($module && !$mid) {
         $args = new stdClass();
         $args->module = $module;
         $output = executeQuery('layout.getOneModuleInstanceByModuleName', $args);
         if (!$output->toBool()) {
             throw new Exception($output->getMessage());
         }
         // if there is no module instance, error...
         if (!$output->data) {
             throw new Exception(Context::getLang('msg_unabled_preview'));
         }
         $mid = current($output->data)->mid;
     } elseif (!$module && !$mid) {
         $oModuleModel = getModel('module');
         $columnList = array('modules.mid', 'sites.index_module_srl');
         $startModuleInfo = $oModuleModel->getSiteInfo(0, $columnList);
         $mid = $startModuleInfo->mid;
     }
     $oModuleHandler = new ModuleHandler('', '', $mid, '', '');
     // Adhoc...
     $oModuleHandler->act = '';
     $oModuleHandler->init();
     // Adhoc...
     $oModuleHandler->module_info->use_mobile = 'Y';
     $oModuleHandler->module_info->is_skin_fix = 'Y';
     $oModuleHandler->module_info->is_mskin_fix = 'Y';
     if ($skinType == 'M') {
         Mobile::setMobile(TRUE);
         $oModuleHandler->module_info->mskin = $skin;
     } else {
         Mobile::setMobile(FALSE);
         $oModuleHandler->module_info->skin = $skin;
     }
     // Proc module
     $oModule = $oModuleHandler->procModule();
     if (!$oModule->toBool()) {
         throw new Exception(Context::getLang('not_support_layout_preview'));
     }
     // get module html
     require_once _XE_PATH_ . "classes/display/HTMLDisplayHandler.php";
     $handler = new HTMLDisplayHandler();
     return $handler->toDoc($oModule);
 }
开发者ID:rubythonode,项目名称:xe-core,代码行数:55,代码来源:layout.view.php


示例19: IS

 /**
  * Search Result
  *
  * @return Object
  */
 function IS()
 {
     $oFile = getClass('file');
     $oModuleModel = getModel('module');
     $logged_info = Context::get('logged_info');
     // Check permissions
     if (!$this->grant->access) {
         return new Object(-1, 'msg_not_permitted');
     }
     $config = $oModuleModel->getModuleConfig('integration_search');
     if (!$config) {
         $config = new stdClass();
     }
     if (!$config->skin) {
         $config->skin = 'default';
         $template_path = sprintf('%sskins/%s', $this->module_path, $config->skin);
     } else {
         //check theme
         $config_parse = explode('|@|', $config->skin);
         if (count($config_parse) > 1) {
             $template_path = sprintf('./themes/%s/modules/integration_search/', $config_parse[0]);
         } else {
             $template_path = sprintf('%sskins/%s', $this->module_path, $config->skin);
         }
     }
     // Template path
     $this->setTemplatePath($template_path);
     $skin_vars = $config->skin_vars ? unserialize($config->skin_vars) : new stdClass();
     Context::set('module_info', $skin_vars);
     $target = $config->target;
     if (!$target) {
         $target = 'include';
     }
     if (empty($config->target_module_srl)) {
         $module_srl_list = array();
     } else {
         $module_srl_list = explode(',', $config->target_module_srl);
     }
     // https://github.com/xpressengine/xe-core/issues/1522
     // 검색 대상을 지정하지 않았을 때 검색 제한
     if ($target === 'include' && !count($module_srl_list)) {
         $oMessageObject = ModuleHandler::getModuleInstance('message');
         $oMessageObject->setError(-1);
         $oMessageObject->setMessage('msg_not_enabled');
         $oMessageObject->dispMessage();
         $this->setTemplatePath($oMessageObject->getTemplatePath());
         $this->setTemplateFile($oMessageObject->getTemplateFile());
         return;
     }
     // Set a variable for search keyword
     $is_keyword = Context::get('is_keyword');
     // Set page variables
     $page = (int) Context::get('page');
     if (!$page) {
         $page = 1;
     }
     // Search by search tab
     $where = Context::get('where');
     // Create integration search model object
     if ($is_keyword) {
         $oIS = getModel('integration_search');
         switch ($where) {
             case 'document':
                 $search_target = Context::get('search_target');
                 if (!in_array($search_target, array('title', 'content', 'title_content', 'tag'))) {
                     $search_target = 'title';
                 }
                 Context::set('search_target', $search_target);
                 $output = $oIS->getDocuments($target, $module_srl_list, $search_target, $is_keyword, $page, 10);
                 Context::set('output', $output);
                 $this->setTemplateFile("document", $page);
                 break;
             case 'comment':
                 $output = $oIS->getComments($target, $module_srl_list, $is_keyword, $page, 10);
                 Context::set('output', $output);
                 $this->setTemplateFile("comment", $page);
                 break;
             case 'trackback':
                 $search_target = Context::get('search_target');
                 if (!in_array($search_target, array('title', 'url', 'blog_name', 'excerpt'))) {
                     $search_target = 'title';
                 }
                 Context::set('search_target', $search_target);
                 $output = $oIS->getTrackbacks($target, $module_srl_list, $search_target, $is_keyword, $page, 10);
                 Context::set('output', $output);
                 $this->setTemplateFile("trackback", $page);
                 break;
             case 'multimedia':
                 $output = $oIS->getImages($target, $module_srl_list, $is_keyword, $page, 20);
                 Context::set('output', $output);
                 $this->setTemplateFile("multimedia", $page);
                 break;
             case 'file':
                 $output = $oIS->getFiles($target, $module_srl_list, $is_keyword, $page, 20);
                 Context::set('output', $output);
//.........这里部分代码省略.........
开发者ID:kimkucheol,项目名称:xe-core,代码行数:101,代码来源:integration_search.view.php



鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP ModuleInstaller类代码示例发布时间:2022-05-23
下一篇:
PHP ModuleGraph类代码示例发布时间: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