function process(Mobile_API_Request $request) { $current_user = $this->getActiveUser(); $query = $request->get('query'); $nextPage = 0; $queryResult = false; if (preg_match("/(.*) LIMIT[^;]+;/i", $query)) { $queryResult = vtws_query($query, $current_user); } else { // Implicit limit and paging $query = rtrim($query, ";"); $currentPage = intval($request->get('page', 0)); $FETCH_LIMIT = Mobile::config('API_RECORD_FETCH_LIMIT'); $startLimit = $currentPage * $FETCH_LIMIT; $queryWithLimit = sprintf("%s LIMIT %u,%u;", $query, $startLimit, $FETCH_LIMIT + 1); $queryResult = vtws_query($queryWithLimit, $current_user); // Determine paging $hasNextPage = count($queryResult) > $FETCH_LIMIT; if ($hasNextPage) { array_pop($queryResult); // Avoid sending next page record now $nextPage = $currentPage + 1; } } $records = array(); if (!empty($queryResult)) { foreach ($queryResult as $recordValues) { $records[] = $this->processQueryResultRecord($recordValues, $current_user); } } $result = array('records' => $records, 'nextPage' => $nextPage); $response = new Mobile_API_Response(); $response->setResult($result); return $response; }
function getUserInfo() { $uid = intval($this->Get['uid']); if ($uid < 1) { $uid = MEMBER_ID; } $is_follow = false; $is_blacklist = false; if ($uid > 0) { $member = Mobile::convert($this->TopicLogic->GetMember($uid)); if (empty($member)) { $error_code = 400; } else { if ($member['uid'] != MEMBER_ID) { $is_follow = chk_follow(MEMBER_ID, $member['uid']); if (!$is_follow) { Mobile::logic('friend'); $FriendLogic = new FriendLogic(); $is_blacklist = $FriendLogic->check($member['uid']); } } } } else { Mobile::show_message(400); } include template('user_info'); }
function ModuleObject($config) { $this->MasterObject($config); $this->CacheConfig = jconf::get('cache'); Mobile::is_login(); $this->Execute(); }
public function init_flow_handle(Flow $flow) { if (Mobile::is_mobile()) { $vars = $flow->vars(); mb_convert_variables('utf-8', 'utf-8,SJIS-win', $vars); $flow->vars($vars); } }
/** * * @return boolean */ private static function isMobileDevice() { $res = false; if (isset($_SESSION['ismobiledevice'])) { $res = $_SESSION['ismobiledevice']; } else { $res = Mobile::isMobileDevice(); } return $res; }
function viewController() { $smarty = new vtigerCRM_Smarty(); foreach ($this->parameters as $k => $v) { $smarty->assign($k, $v); } $smarty->assign("IS_SAFARI", Mobile::isSafari()); $smarty->assign("SKIN", Mobile::config('Default.Skin')); return $smarty; }
public static function checkGetMobile() { if (isset($_GET['tomobile'])) { if ($_GET['tomobile'] == 1) { Mobile::setMobile(1); } if ($_GET['tomobile'] == 0) { Mobile::setMobile(0); } } }
private function m_not_mobile(&$src, Template $template) { while (Tag::setof($tag, $src, 'm:not_mobile')) { if (!Mobile::is_mobile()) { $src = str_replace($tag->plain(), $tag->value(), $src); } else { $src = str_replace($tag->plain(), '', $src); } } $src = $template->parse_vars($src); }
public static function both($act, $arr = array()) { if (count($arr) > 0) { extract($arr); } if (Mobile::isMob()) { $pathname = self::explodeSlash($act); if (!@(include $pathname)) { self::desk($act, $arr); } } else { self::desk($act, $arr); } }
public function __construct($_variables) { // load parent parent::__construct($_variables); // define class variables $_array = array("mobileplatform" => Mobile::isMobilePlatform(), "ordertimerange" => $this->__config->get('ordertimerange'), "timezone" => $this->__config->get('timezone'), "cachefolder" => $this->__config->get('cachefolder')); // load class variables $this->loadClassVariables($_array); // load the order html PageMainData::getOrdersHTML(); // load the page html PageMainHTML::html(); // render page $this->createPage(); }
/** * @param $customer_id * @param $total * @return mixed */ public function add_order($customer_id, $delivery_id, $total) { $detect = new Mobile(); $device_type = $detect->isMobile() ? $detect->isTablet() ? 'tablet' : 'phone' : 'computer'; $np_city_ref = Arr::get($_POST, 'np_city_ref'); $np_address_ref = Arr::get($_POST, 'np_address_ref'); $city = Arr::get($_POST, 'city'); $address = Arr::get($_POST, 'address'); if ($delivery_id = 1) { $obj_city = ORM::factory('Novaposhta_City', ['Ref' => $np_city_ref]); if ($obj_city->loaded()) { $city = $obj_city->DescriptionRu; } $obj_warehouse = ORM::factory('Novaposhta_Warehouse', ['Ref' => $np_address_ref]); if ($obj_warehouse->loaded()) { $address = $obj_warehouse->DescriptionRu; } } $obj_order = ORM::factory('Shop_Order'); $obj_order->customer_id = $customer_id; $obj_order->delivery_id = $delivery_id; $obj_order->total = $total; $obj_order->checked = 0; $obj_order->device_type = $device_type; $obj_order->oblast = Arr::get($_POST, 'oblast'); $obj_order->region = Arr::get($_POST, 'region'); $obj_order->city = $city; $obj_order->address = $address; $obj_order->np_city_ref = $np_city_ref; $obj_order->np_address_ref = $np_address_ref; $obj_order->postcode = Arr::get($_POST, 'postcode'); $obj_order->save(); $obj_order->number = $obj_order->id . Text::random('nozero', 4); $obj_order->save(); return $obj_order->id; }
function Main() { $uid = intval($this->Get['uid']); $param = array('limit' => Mobile::config("perpage_def"), 'uid' => $uid); $ret = Mobile::convert($this->MTagLogic->getTagList($param)); if (is_array($ret)) { $tag_list = $ret['tag_list']; $list_count = $ret['list_count']; $total_record = $ret['total_record']; $max_id = $ret['max_id']; } else { Mobile::show_message($ret); } include template('tag_list'); }
function searchUser() { Mobile::logic('member'); $MemberLogic = new MemberLogic(); $q = trim($this->Get['q']); if (empty($q)) { Mobile::error("No Data", 400); } $param = array('limit' => Mobile::config("perpage_member"), 'nickname' => $q, 'max_id' => $this->Get['max_id']); $ret = $MemberLogic->getMemberList($param); if (is_array($ret)) { Mobile::output($ret); } else { Mobile::error("No Data", $ret); } }
function getHistoryList() { $uid = intval($this->Get['uid']); if (empty($uid)) { Mobile::show_message(300); } $info = Mobile::convert($this->MyPmLogic->getHistoryList(MEMBER_ID, $uid, array("per_page_num" => Mobile::config("perpage_pm")))); if (!empty($info)) { $pm_list = $info['pm_list']; $current_page = empty($info['current_page']) ? 1 : $info['current_page']; $next_page = $current_page + 1; $total_page = intval($info['total_page']); $list_count = count($info['pm_list']); } else { Mobile::show_message(400); } include template('pm_list'); }
public function __construct($mainClass, $DbSetting, $WebSetting, $timezone, $js, $css, $nameSpaceForApps) { parent::__construct($mainClass); //start session if needed //if(!$this->is_session_started()) // init whats needed //kalau ga perlu bisa dihilangkan tergantung kebutuhan //set globals global $activeLang; //set the active lang dynamically $this->activeLang = $activeLang; $this->setGlobalVariables($WebSetting); //Initialize DB // DbChooser::setDBSelected(); //DB setting di access di overwrite spy bisa ada choosernya... //$skolahDB = DbChooser::getDBSelected(); //$DbSetting = $this->arrDBSetting[$skolahDB]; global $DbSetting; $this->setDB($DbSetting); //overwrite global variable to set photopath for different schools global $photo_path; global $photo_url; define('_PHOTOPATH', $photo_path); define('_PHOTOURL', $photo_url); //Init Template $this->setTemplate($WebSetting); //Init Web Parameter $this->setParams(); //Init Timezone $this->setTimezone($timezone); //Init Mobile Check in untuk menentukan default $this->setHardwareType(); if ($this->getHardwareType() == "mobile") { Mobile::setMobile(1); } //cek to mobile get Mobile::checkGetMobile(); //$nameSpaceForApps $this->setNameSpacesForApps($nameSpaceForApps); //add css and js $this->template->addFilesToHead($js); $this->template->addFilesToHead($css); //run it //$this->run(); }
function getListing($user) { function useSortBySettings($a, $b) { global $displayed_modules; $posA = $displayed_modules[$a['name']]; $posB = $displayed_modules[$b['name']]; if ($posA == $posB) { return 0; } return $posA < $posB ? -1 : 1; } //settings information global $displayed_modules, $current_language, $app_strings; $modulewsids = Mobile_WS_Utils::getEntityModuleWSIds(); // Disallow modules unset($modulewsids['Users']); include_once dirname(__FILE__) . '/../../Mobile.Config.php'; $CRM_Version = Mobile::config('crm_version'); if ($CRM_Version != '5.2.1') { //we use this class only for privilege purposes on types $listresult = vtws_listtypes(null, $user, 'en_us'); } else { $listresult = vtws_listtypes($user); } $listing = array(); foreach ($listresult['types'] as $index => $modulename) { if (!isset($modulewsids[$modulename])) { continue; } if (in_array($modulename, $displayed_modules)) { $listing[] = array('id' => $modulewsids[$modulename], 'name' => $modulename, 'isEntity' => $listresult['information'][$modulename]['isEntity'], 'label' => getTranslatedString($modulename, $modulename), 'singular' => getTranslatedString('SINGLE_' . $modulename, $modulename)); } } //make sure the active modules are displayed in the order of the $displayed_modules settings entry in MobileSettings.config.php $displayed_modules = array_flip($displayed_modules); usort($listing, 'useSortBySettings'); return $listing; }
public static function __import__() { $agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null; if (strpos($agent, 'DoCoMo') !== false) { self::$carrier = 'docomo'; } else { if (strpos($agent, 'SoftBank') !== false || strpos($agent, 'Vodafone')) { self::$carrier = 'softbank'; } else { if (strpos($agent, 'KDDI') !== false) { self::$carrier = 'au'; } else { self::$carrier = null; } } } if (self::is_mobile()) { ini_set('session.use_cookies', 'off'); ini_set('session.use_only_cookies', 0); ini_set('session.use_trans_sid', '1'); } }
<?php //****************************************** //設定 //テンプレートファイル指定 $tempfile = "med/06/" . basename(__FILE__, ".php") . ".html"; //設定終了 //****************************************** require "../../php/Mobile.class.php"; $obj = new Mobile(); $obj->filename = $temp . $tempfile; $obj->main();
<?php if (@$magic != "0xDEADBEEF") { die("This file cannot be executed directly"); } if (@is_dir("setup")) { $error = new Error("Setup directory exists. You either haven't installed your guestbook, or forgot to delete the setup folder."); die($error->showError()); } if (!file_exists("data.php")) { $error = new Error("Data file doesn't exist. Have you installed your guestbook yet?"); die($error->showError()); } require_once 'configuration.php'; if ($config['offline']) { $error = new Error($config['offlineMessage']); die($error->showError()); } include_once 'classes/mobile/mobile.class.php'; if (Mobile::isMobile($_SERVER['HTTP_USER_AGENT'])) { $config['guestbookTheme'] = $config['mobileTheme']; }
<?php if ($this->Code != "at_my" && $this->Code != "comment_my") { ?> g_middle_nav_toolbar <?php } else { ?> g_middle_nav_toolbar_message <?php } ?> "> <?php if ($this->Code == "home") { ?> <?php echo Mobile::convert($GLOBALS['_J']['member']['nickname']); } elseif ($this->Code == "at_my" || $this->Code == "comment_my") { ?> <?php $tab_msg_actives[$this->Code] = "g_middle_chute_on"; ?> <div class="g_middle_chute"> <ul> <li class="<?php echo $tab_msg_actives['at_my']; ?> " onclick="changeMessageTab(TAB_MESSAGE_AT);">@我</li> <li class="s <?php echo $tab_msg_actives['comment_my']; ?> " onclick="changeMessageTab(TAB_MESSAGE_COMMENT);">评论</li> </ul> </div> <?php } elseif ($this->Module == "search") { ?> <?php
<img src="../pixmaps/top/logo_siem.png" border="0" style="margin:10px 0"> <table align="center" cellspacing='0' cellpadding='0' style="width:300px;background-color:#eeeeee;border-color:#dedede;opacity:0.5;border-radius: 8px;-moz-border-radius: 8px;-webkit-border-radius: 8px;"> <tr id="fullsrc" style="display:none"><td><img src="../pixmaps/1x1.png" height="22px" border="0"></td><tr> <tr><td> <ul id="menu"> <li class="button1"><a href="#" ref="status" style="background-image: url('../pixmaps/mobile/icon-status.png');"></a><label>Status</label></li> <li class="button2"><a href="#" ref="alarms" style="background-image: url('../pixmaps/mobile/icon-alarm.png');"></a><label>Alarms</label></li> <li class="button3"><a href="#" ref="tickets" style="background-image: url('../pixmaps/mobile/icon-ticket.png');"></a><label>Tickets</label></li> <li class="button5"><a href="#" ref="unique_siem" style="background-image: url('../pixmaps/mobile/icon-siem_events.png');"></a><label>SIEM</label></li> <li class="button6"><a href="#" ref="logout" style="background-image: url('../pixmaps/mobile/icon-exit.png');"></a><label>Logout</label></li> </ul> </td></tr> </table> <div style='border-top: 1px solid #8CC12D; margin: 130px 10px 0px 10px;'> <span style="margin: 2px 0; float: left; font-size: 10px; color: #CCCCCC;">© Copyright 2012 AlienVault, Inc. - Schema Version <?php echo Mobile::get_version(); ?> </span> </div> </div> <div id="main" class="additional-block"> <div id="ajax"> <div style="padding-top:10px"><img src='../pixmaps/loading3.gif' align="absmiddle"/> <?php echo _("Loading remote content, please wait"); ?> </div> </div> </div> </div> </div>
/** * Update the document * @param object $source_obj * @param object $obj * @param bool $manual_updated * @return object */ function updateDocument($source_obj, $obj, $manual_updated = FALSE) { if (!$manual_updated && !checkCSRF()) { return new Object(-1, 'msg_invalid_request'); } if (!$source_obj->document_srl || !$obj->document_srl) { return new Object(-1, 'msg_invalied_request'); } if (!$obj->status && $obj->is_secret == 'Y') { $obj->status = 'SECRET'; } if (!$obj->status) { $obj->status = 'PUBLIC'; } // Call a trigger (before) $output = ModuleHandler::triggerCall('document.updateDocument', 'before', $obj); if (!$output->toBool()) { return $output; } // begin transaction $oDB =& DB::getInstance(); $oDB->begin(); $oModuleModel = getModel('module'); if (!$obj->module_srl) { $obj->module_srl = $source_obj->get('module_srl'); } $module_srl = $obj->module_srl; $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); $document_config = $oModuleModel->getModulePartConfig('document', $module_srl); if (!$document_config) { $document_config = new stdClass(); } if (!isset($document_config->use_history)) { $document_config->use_history = 'N'; } $bUseHistory = $document_config->use_history == 'Y' || $document_config->use_history == 'Trace'; if ($bUseHistory) { $args = new stdClass(); $args->history_srl = getNextSequence(); $args->document_srl = $obj->document_srl; $args->module_srl = $module_srl; if ($document_config->use_history == 'Y') { $args->content = $source_obj->get('content'); } $args->nick_name = $source_obj->get('nick_name'); $args->member_srl = $source_obj->get('member_srl'); $args->regdate = $source_obj->get('last_update'); $args->ipaddress = $source_obj->get('ipaddress'); $output = executeQuery("document.insertHistory", $args); } else { $obj->ipaddress = $source_obj->get('ipaddress'); } // List variables if ($obj->comment_status) { $obj->commentStatus = $obj->comment_status; } if (!$obj->commentStatus) { $obj->commentStatus = 'DENY'; } if ($obj->commentStatus == 'DENY') { $this->_checkCommentStatusForOldVersion($obj); } if ($obj->allow_trackback != 'Y') { $obj->allow_trackback = 'N'; } if ($obj->homepage) { $obj->homepage = removeHackTag($obj->homepage); if (!preg_match('/^[a-z]+:\\/\\//i', $obj->homepage)) { $obj->homepage = 'http://' . $obj->homepage; } } if ($obj->notify_message != 'Y') { $obj->notify_message = 'N'; } // can modify regdate only manager $grant = Context::get('grant'); if (!$grant->manager) { unset($obj->regdate); } // Serialize the $extra_vars if (!is_string($obj->extra_vars)) { $obj->extra_vars = serialize($obj->extra_vars); } // Remove the columns for automatic saving unset($obj->_saved_doc_srl); unset($obj->_saved_doc_title); unset($obj->_saved_doc_content); unset($obj->_saved_doc_message); $oDocumentModel = getModel('document'); // Set the category_srl to 0 if the changed category is not exsiting. if ($source_obj->get('category_srl') != $obj->category_srl) { $category_list = $oDocumentModel->getCategoryList($obj->module_srl); if (!$category_list[$obj->category_srl]) { $obj->category_srl = 0; } } // Change the update order $obj->update_order = getNextSequence() * -1; // Hash the password if it exists if ($obj->password) { $obj->password = getModel('member')->hashPassword($obj->password); } // If an author is identical to the modifier or history is used, use the logged-in user's information. $logged_info = Context::get('logged_info'); if (Context::get('is_logged') && !$manual_updated && $module_info->use_anonymous != 'Y') { if ($source_obj->get('member_srl') == $logged_info->member_srl) { $obj->member_srl = $logged_info->member_srl; $obj->user_name = htmlspecialchars_decode($logged_info->user_name); $obj->nick_name = htmlspecialchars_decode($logged_info->nick_name); $obj->email_address = $logged_info->email_address; $obj->homepage = $logged_info->homepage; } } // For the document written by logged-in user however no nick_name exists if ($source_obj->get('member_srl') && !$obj->nick_name) { $obj->member_srl = $source_obj->get('member_srl'); $obj->user_name = $source_obj->get('user_name'); $obj->nick_name = $source_obj->get('nick_name'); $obj->email_address = $source_obj->get('email_address'); $obj->homepage = $source_obj->get('homepage'); } // If the tile is empty, extract string from the contents. $obj->title = htmlspecialchars($obj->title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); settype($obj->title, "string"); if ($obj->title == '') { $obj->title = cut_str(strip_tags($obj->content), 20, '...'); } // If no tile extracted from the contents, leave it untitled. if ($obj->title == '') { $obj->title = 'Untitled'; } // Remove XE's own tags from the contents. $obj->content = preg_replace('!<\\!--(Before|After)(Document|Comment)\\(([0-9]+),([0-9]+)\\)-->!is', '', $obj->content); // if use editor of nohtml, Remove HTML tags from the contents. if (!$manual_updated) { if (Mobile::isFromMobilePhone() && $obj->use_editor != 'Y') { if ($obj->use_html != 'Y') { $obj->content = htmlspecialchars($obj->content, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); } $obj->content = nl2br($obj->content); } else { $oEditorModel = getModel('editor'); $editor_config = $oEditorModel->getEditorConfig($obj->module_srl); if (strpos($editor_config->sel_editor_colorset, 'nohtml') !== FALSE) { $obj->content = preg_replace('/\\<br(\\s*)?\\/?\\>/i', PHP_EOL, $obj->content); $obj->content = htmlspecialchars($obj->content, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); $obj->content = str_replace(array("\r\n", "\r", "\n"), '<br />', $obj->content); } } } // Change not extra vars but language code of the original document if document's lang_code is different from author's setting. if ($source_obj->get('lang_code') != Context::getLangType()) { // Change not extra vars but language code of the original document if document's lang_code doesn't exist. if (!$source_obj->get('lang_code')) { $lang_code_args = new stdClass(); $lang_code_args->document_srl = $source_obj->get('document_srl'); $lang_code_args->lang_code = Context::getLangType(); $output = executeQuery('document.updateDocumentsLangCode', $lang_code_args); } else { $extra_content = new stdClass(); $extra_content->title = $obj->title; $extra_content->content = $obj->content; $document_args = new stdClass(); $document_args->document_srl = $source_obj->get('document_srl'); $document_output = executeQuery('document.getDocument', $document_args); $obj->title = $document_output->data->title; $obj->content = $document_output->data->content; } } // Remove iframe and script if not a top adminisrator in the session. if ($logged_info->is_admin != 'Y') { $obj->content = removeHackTag($obj->content); } // if temporary document, regdate is now setting if ($source_obj->get('status') == $this->getConfigStatus('temp')) { $obj->regdate = date('YmdHis'); } // Fix encoding of non-BMP UTF-8 characters. $obj->title = utf8_mbencode($obj->title); $obj->content = utf8_mbencode($obj->content); // Insert data into the DB $output = executeQuery('document.updateDocument', $obj); if (!$output->toBool()) { $oDB->rollback(); return $output; } // Remove all extra variables $extra_vars = array(); if (Context::get('act') != 'procFileDelete') { $this->deleteDocumentExtraVars($source_obj->get('module_srl'), $obj->document_srl, null, Context::getLangType()); // Insert extra variables if the document successfully inserted. $extra_keys = $oDocumentModel->getExtraKeys($obj->module_srl); if (count($extra_keys)) { foreach ($extra_keys as $idx => $extra_item) { $value = NULL; if (isset($obj->{'extra_vars' . $idx})) { $tmp = $obj->{'extra_vars' . $idx}; if (is_array($tmp)) { $value = implode('|@|', $tmp); } else { $value = trim($tmp); } } else { if (isset($obj->{$extra_item->name})) { $value = trim($obj->{$extra_item->name}); } } if ($value == NULL) { continue; } $extra_vars[$extra_item->name] = $value; $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, $idx, $value, $extra_item->eid); } } // Inert extra vars for multi-language support of title and contents. if ($extra_content->title) { $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -1, $extra_content->title, 'title_' . Context::getLangType()); } if ($extra_content->content) { $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -2, $extra_content->content, 'content_' . Context::getLangType()); } } // Update the category if the category_srl exists. if ($source_obj->get('category_srl') != $obj->category_srl || $source_obj->get('module_srl') == $logged_info->member_srl) { if ($source_obj->get('category_srl') != $obj->category_srl) { $this->updateCategoryCount($obj->module_srl, $source_obj->get('category_srl')); } if ($obj->category_srl) { $this->updateCategoryCount($obj->module_srl, $obj->category_srl); } } // Call a trigger (after) if ($obj->update_log_setting === 'Y') { $obj->extra_vars = serialize($extra_vars); if ($this->grant->manager) { $obj->is_admin = 'Y'; } $update_output = $this->insertDocumentUpdateLog($obj, $source_obj); if (!$update_output->toBool()) { $oDB->rollback(); return $update_output; } } ModuleHandler::triggerCall('document.updateDocument', 'after', $obj); // commit $oDB->commit(); // Remove the thumbnail file FileHandler::removeDir(sprintf('files/thumbnails/%s', getNumberingPath($obj->document_srl, 3))); $output->add('document_srl', $obj->document_srl); //remove from cache Rhymix\Framework\Cache::delete('document_item:' . getNumberingPath($obj->document_srl) . $obj->document_srl); return $output; }
function mobile_area($mobile) { require_cache(HDPHP_EXTEND_PATH . "Org/Mobile/Mobile.class.php"); return Mobile::area($mobile); }
/** * @brief mobile comment delete **/ function triggerMobileexDeleteComment(&$comment) { $oMobileexModel =& getModel('mobileex'); $oMobile =& Mobile::getInstance(); $is_mobile = $oMobile->ismobile; $args = $comment; $output = $oMobileexModel->getMobileComment($args->comment_srl); if ($output->data) { executeQuery('mobileex.deleteMobileComment', $args); } return new Object(); }
/** * Fix the comment * @param object $obj * @param bool $is_admin * @param bool $manual_updated * @return object */ function updateComment($obj, $is_admin = FALSE, $manual_updated = FALSE) { if (!$manual_updated && !checkCSRF()) { return new Object(-1, 'msg_invalid_request'); } if (!is_object($obj)) { $obj = new stdClass(); } $obj->__isupdate = TRUE; // call a trigger (before) $output = ModuleHandler::triggerCall('comment.updateComment', 'before', $obj); if (!$output->toBool()) { return $output; } // create a comment model object $oCommentModel = getModel('comment'); // get the original data $source_obj = $oCommentModel->getComment($obj->comment_srl); if (!$source_obj->getMemberSrl()) { $obj->member_srl = $source_obj->get('member_srl'); $obj->user_name = $source_obj->get('user_name'); $obj->nick_name = $source_obj->get('nick_name'); $obj->email_address = $source_obj->get('email_address'); $obj->homepage = $source_obj->get('homepage'); } // check if permission is granted if (!$is_admin && !$source_obj->isGranted()) { return new Object(-1, 'msg_not_permitted'); } if ($obj->password) { $obj->password = getModel('member')->hashPassword($obj->password); } if ($obj->homepage) { $obj->homepage = removeHackTag($obj->homepage); if (!preg_match('/^[a-z]+:\\/\\//i', $obj->homepage)) { $obj->homepage = 'http://' . $obj->homepage; } } // set modifier's information if logged-in and posting author and modifier are matched. if (Context::get('is_logged')) { $logged_info = Context::get('logged_info'); if ($source_obj->member_srl == $logged_info->member_srl) { $obj->member_srl = $logged_info->member_srl; $obj->user_name = $logged_info->user_name; $obj->nick_name = $logged_info->nick_name; $obj->email_address = $logged_info->email_address; $obj->homepage = $logged_info->homepage; } } // if nick_name of the logged-in author doesn't exist if ($source_obj->get('member_srl') && !$obj->nick_name) { $obj->member_srl = $source_obj->get('member_srl'); $obj->user_name = $source_obj->get('user_name'); $obj->nick_name = $source_obj->get('nick_name'); $obj->email_address = $source_obj->get('email_address'); $obj->homepage = $source_obj->get('homepage'); } if (!$obj->content) { $obj->content = $source_obj->get('content'); } // remove XE's wn tags from contents $obj->content = preg_replace('!<\\!--(Before|After)(Document|Comment)\\(([0-9]+),([0-9]+)\\)-->!is', '', $obj->content); if (Mobile::isFromMobilePhone()) { if ($obj->use_html != 'Y') { $obj->content = htmlspecialchars($obj->content, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); } $obj->content = nl2br($obj->content); } // remove iframe and script if not a top administrator on the session if ($logged_info->is_admin != 'Y') { $obj->content = removeHackTag($obj->content); } // begin transaction $oDB = DB::getInstance(); $oDB->begin(); // Update $output = executeQuery('comment.updateComment', $obj); if (!$output->toBool()) { $oDB->rollback(); return $output; } // call a trigger (after) if ($output->toBool()) { $trigger_output = ModuleHandler::triggerCall('comment.updateComment', 'after', $obj); if (!$trigger_output->toBool()) { $oDB->rollback(); return $trigger_output; } } // commit $oDB->commit(); $output->add('comment_srl', $obj->comment_srl); return $output; }
echo $topic['replys']; ?> ) <?php } else { ?> 评论 <?php } ?> </span></p></a> </footer> </article> <?php } } ?> </div> <?php if ($list_count == Mobile::config('perpage_mblog')) { ?> <?php if ($this->Module == 'topic') { ?> <?php if ($this->Code == 'tag') { ?> <div class="wb_more" onclick='getMoreMBlogList({"max_tid":<?php echo $max_tid; ?> , "next_page":<?php echo $next_page; ?> , "code":"tag", "tag_key":"<?php echo $tag_key;
/** * when display mode is HTML, prepare code before print. * @param string $output compiled template string * @return void */ function prepareToPrint(&$output) { if (Context::getResponseMethod() != 'HTML') { return; } if (__DEBUG__ == 3) { $start = getMicroTime(); } // move <style ..></style> in body to the header $output = preg_replace_callback('!<style(.*?)>(.*?)<\\/style>!is', array($this, '_moveStyleToHeader'), $output); // move <link ..></link> in body to the header $output = preg_replace_callback('!<link(.*?)/>!is', array($this, '_moveLinkToHeader'), $output); // move <meta ../> in body to the header $output = preg_replace_callback('!<meta(.*?)(?:\\/|)>!is', array($this, '_moveMetaToHeader'), $output); // change a meta fine(widget often put the tag like <!--Meta:path--> to the content because of caching) $output = preg_replace_callback('/<!--(#)?Meta:([a-z0-9\\_\\-\\/\\.\\@]+)-->/is', array($this, '_transMeta'), $output); // handles a relative path generated by using the rewrite module if (Context::isAllowRewrite()) { $url = parse_url(Context::getRequestUri()); $real_path = $url['path']; $pattern = '/src=("|\'){1}(\\.\\/)?(files\\/attach|files\\/cache|files\\/faceOff|files\\/member_extra_info|modules|common|widgets|widgetstyle|layouts|addons)\\/([^"\']+)\\.(jpg|jpeg|png|gif)("|\'){1}/s'; $output = preg_replace($pattern, 'src=$1' . $real_path . '$3/$4.$5$6', $output); $pattern = '/href=("|\'){1}(\\?[^"\']+)/s'; $output = preg_replace($pattern, 'href=$1' . $real_path . '$2', $output); if (Context::get('vid')) { $pattern = '/\\/' . Context::get('vid') . '\\?([^=]+)=/is'; $output = preg_replace($pattern, '/?$1=', $output); } } // prevent the 2nd request due to url(none) of the background-image $output = preg_replace('/url\\((["\']?)none(["\']?)\\)/is', 'none', $output); if (is_array(Context::get('INPUT_ERROR'))) { $INPUT_ERROR = Context::get('INPUT_ERROR'); $keys = array_keys($INPUT_ERROR); $keys = '(' . implode('|', $keys) . ')'; $output = preg_replace_callback('@(<input)([^>]*?)\\sname="' . $keys . '"([^>]*?)/?>@is', array(&$this, '_preserveValue'), $output); $output = preg_replace_callback('@<select[^>]*\\sname="' . $keys . '".+</select>@isU', array(&$this, '_preserveSelectValue'), $output); $output = preg_replace_callback('@<textarea[^>]*\\sname="' . $keys . '".+</textarea>@isU', array(&$this, '_preserveTextAreaValue'), $output); } if (__DEBUG__ == 3) { $GLOBALS['__trans_content_elapsed__'] = getMicroTime() - $start; } // Remove unnecessary information $output = preg_replace('/member\\_\\-([0-9]+)/s', 'member_0', $output); // set icon $oAdminModel = getAdminModel('admin'); $favicon_url = $oAdminModel->getFaviconUrl(); $mobicon_url = $oAdminModel->getMobileIconUrl(); Context::set('favicon_url', $favicon_url); Context::set('mobicon_url', $mobicon_url); // convert the final layout Context::set('content', $output); $oTemplate = TemplateHandler::getInstance(); if (Mobile::isFromMobilePhone()) { $this->_loadMobileJSCSS(); $output = $oTemplate->compile('./common/tpl', 'mobile_layout'); } else { $this->_loadJSCSS(); $output = $oTemplate->compile('./common/tpl', 'common_layout'); } // replace the user-defined-language $oModuleController = getController('module'); $oModuleController->replaceDefinedLangCode($output); }
/** * excute the member method specified by $act variable * @return boolean true : success false : fail * */ function proc() { // pass if stop_proc is true if ($this->stop_proc) { debugPrint($this->message, 'ERROR'); return FALSE; } // trigger call $triggerOutput = ModuleHandler::triggerCall('moduleObject.proc', 'before', $this); if (!$triggerOutput->toBool()) { $this->setError($triggerOutput->getError()); $this->setMessage($triggerOutput->getMessage()); return FALSE; } // execute an addon(call called_position as before_module_proc) $called_position = 'before_module_proc'; $oAddonController = getController('addon'); $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc"); if (FileHandler::exists($addon_file)) { include $addon_file; } if (isset($this->xml_info->action->{$this->act}) && method_exists($this, $this->act)) { // Check permissions if ($this->module_srl && !$this->grant->access) { $this->stop("msg_not_permitted_act"); return FALSE; } // integrate skin information of the module(change to sync skin info with the target module only by seperating its table) $is_default_skin = !Mobile::isFromMobilePhone() && $this->module_info->is_skin_fix == 'N' || Mobile::isFromMobilePhone() && $this->module_info->is_mskin_fix == 'N'; $usedSkinModule = !($this->module == 'page' && ($this->module_info->page_type == 'OUTSIDE' || $this->module_info->page_type == 'WIDGET')); if ($usedSkinModule && $is_default_skin && $this->module != 'admin' && strpos($this->act, 'Admin') === false && $this->module == $this->module_info->module) { $dir = Mobile::isFromMobilePhone() ? 'm.skins' : 'skins'; $valueName = Mobile::isFromMobilePhone() ? 'mskin' : 'skin'; $oModuleModel = getModel('module'); $skinType = Mobile::isFromMobilePhone() ? 'M' : 'P'; $skinName = $oModuleModel->getModuleDefaultSkin($this->module, $skinType); if ($this->module == 'page') { $this->module_info->{$valueName} = $skinName; } else { $isTemplatPath = strpos($this->getTemplatePath(), '/tpl/') !== FALSE; if (!$isTemplatPath) { $this->setTemplatePath(sprintf('%s%s/%s/', $this->module_path, $dir, $skinName)); } } } $oModuleModel = getModel('module'); $oModuleModel->syncSkinInfoToModuleInfo($this->module_info); Context::set('module_info', $this->module_info); // Run $output = $this->{$this->act}(); } else { return FALSE; } // trigger call $triggerOutput = ModuleHandler::triggerCall('moduleObject.proc', 'after', $this); if (!$triggerOutput->toBool()) { $this->setError($triggerOutput->getError()); $this->setMessage($triggerOutput->getMessage()); return FALSE; } // execute an addon(call called_position as after_module_proc) $called_position = 'after_module_proc'; $oAddonController = getController('addon'); $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc"); if (FileHandler::exists($addon_file)) { include $addon_file; } if (is_a($output, 'Object') || is_subclass_of($output, 'Object')) { $this->setError($output->getError()); $this->setMessage($output->getMessage()); if (!$output->toBool()) { return FALSE; } } // execute api methos of the module if view action is and result is XMLRPC or JSON if ($this->module_info->module_type == 'view') { if (Context::getResponseMethod() == 'XMLRPC' || Context::getResponseMethod() == 'JSON') { $oAPI = getAPI($this->module_info->module, 'api'); if (method_exists($oAPI, $this->act)) { $oAPI->{$this->act}($this); } } } return TRUE; }
/** * 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); }
public function mobile() { $userid = self::get_user(); $mobile = new Mobile($userid); $mobdata = $mobile->currentmobile(); $this->mobiledata = $mobdata->fetch_object(); // echo "<pre>"; // print_r($this->mobiledata);exit; }