本文整理汇总了PHP中Context::loadLang方法的典型用法代码示例。如果您正苦于以下问题:PHP Context::loadLang方法的具体用法?PHP Context::loadLang怎么用?PHP Context::loadLang使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Context
的用法示例。
在下文中一共展示了Context::loadLang方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: sprintf
/**
* @brief getInstance
**/
function &getInstance()
{
static $instance = null;
if (!$instance) {
$browserType = mobileXE::getBrowserType();
if (!$browserType) {
return;
}
$class_file = sprintf('%saddons/mobile/classes/%s.class.php', _XE_PATH_, $browserType);
require_once $class_file;
// 모바일 언어설정 로드(쿠키가 안되어 생각해낸 방법...-캐시파일 재생성을 클릭하면 초기화된다..)
$this->lang = FileHandler::readFile('./files/cache/addons/mobile/setLangType/personal_settings/' . md5(trim($_SERVER['HTTP_USER_AGENT']) . trim($_SERVER['HTTP_PHONE_NUMBER']) . trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])) . '.php');
if ($this->lang) {
$lang_supported = Context::get('lang_supported');
$this->lang = str_replace(array('<?php /**', '**/ ?>'), array('', ''), $this->lang);
if (isset($lang_supported[$this->lang])) {
Context::setLangType($this->lang);
}
}
Context::loadLang(_XE_PATH_ . 'addons/mobile/lang');
$instance = new wap();
$mobilePage = (int) Context::get('mpage');
if (!$mobilePage) {
$mobilePage = 1;
}
$instance->setMobilePage($mobilePage);
}
return $instance;
}
示例3: sprintf
/**
* @brief getInstance
*/
function &getInstance()
{
static $instance = null;
if (!$instance) {
$browserType = mobileXE::getBrowserType();
if (!$browserType) {
return;
}
$class_file = sprintf('%saddons/mobile/classes/%s.class.php', _XE_PATH_, $browserType);
require_once $class_file;
// Download mobile language settings (cookies, not willing to come up when you click create cache file ...- is initialized ..)
$this->lang = FileHandler::readFile('./files/cache/addons/mobile/setLangType/personal_settings/' . md5(trim($_SERVER['HTTP_USER_AGENT']) . trim($_SERVER['HTTP_PHONE_NUMBER']) . trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])) . '.php');
if ($this->lang) {
$lang_supported = Context::get('lang_supported');
$this->lang = str_replace(array('<?php /**', '**/ ?>'), array('', ''), $this->lang);
if (isset($lang_supported[$this->lang])) {
Context::setLangType($this->lang);
}
}
Context::loadLang(_XE_PATH_ . 'addons/mobile/lang');
$instance = new wap();
$mobilePage = (int) Context::get('mpage');
if (!$mobilePage) {
$mobilePage = 1;
}
$instance->setMobilePage($mobilePage);
}
return $instance;
}
示例4: _compileInfo
function _compileInfo($skin)
{
$oSocialxeModel =& getModel('socialxe');
// 언어 로드
Context::loadLang($this->widget_path . 'lang');
// 서비스 목록
$provider_list = $oSocialxeModel->getProviderList();
Context::set('provider_list', $provider_list);
// 서비스 로그인 상태
$logged_provider = $oSocialxeModel->loggedProviderList();
$logged_count = count($logged_provider);
foreach ($provider_list as $provider) {
$provider_is_logged[$provider] = $oSocialxeModel->isLogged($provider);
}
if (!isset($provider_is_logged)) {
$provider_is_logged = array();
}
Context::set('provider_is_logged', $provider_is_logged);
Context::set('logged_provider', $logged_provider);
Context::set('logged_count', $logged_count);
// 로그인한 서비스의 닉네임들
foreach ($logged_provider as $provider) {
$nick_names[$provider] = $oSocialxeModel->getProviderNickName($provider);
}
Context::set('nick_names', $nick_names);
// 대표 계정
$master_provider = $oSocialxeModel->getMasterProvider();
Context::set('master_provider', $master_provider);
// 대표 계정의 프로필 이미지
$profile_image = $oSocialxeModel->getProfileImage();
Context::set('profile_image', $profile_image);
// 대표 계정의 닉네임
$nick_name = $oSocialxeModel->getNickName();
Context::set('nick_name', $nick_name);
// 부계정
$slave_provider = $oSocialxeModel->getSlaveProvider();
Context::set('slave_provider', $slave_provider);
// 부계정의 프로필 이미지
$slave_profile_image = $oSocialxeModel->getSlaveProfileImage();
Context::set('slave_profile_image', $slave_profile_image);
// 부계정의 닉네임
$slave_nick_name = $oSocialxeModel->getSlaveNickName();
Context::set('slave_nick_name', $slave_nick_name);
// 자동 로그인 키
$auto_login_key = $oSocialxeModel->getAutoLoginKey();
Context::set('auto_login_key', $auto_login_key);
// 자동 로그인 키 요청 주소
$auto_login_key_url = $oSocialxeModel->getAutoLoginKeyUrl();
Context::set('auto_login_key_url', $auto_login_key_url);
// 템플릿의 스킨 경로를 지정 (skin, colorset에 따른 값을 설정)
$tpl_path = sprintf('%sskins/%s', $this->widget_path, $skin);
Context::set('skin', $skin);
// 템플릿 파일을 지정
$tpl_file = 'info';
// 템플릿 컴파일
$oTemplate =& TemplateHandler::getInstance();
return $oTemplate->compile($tpl_path, $tpl_file);
}
示例5: transHTML
/**
* @brief 에디터 컴포넌트가 별도의 고유 코드를 이용한다면 그 코드를 html로 변경하여 주는 method
*
* 이미지나 멀티미디어, 설문등 고유 코드가 필요한 에디터 컴포넌트는 고유코드를 내용에 추가하고 나서
* DocumentModule::transContent() 에서 해당 컴포넌트의 transHtml() method를 호출하여 고유코드를 html로 변경
**/
function transHTML($xml_obj)
{
// 지정된 옵션을 구함
$ccl_title = $xml_obj->attrs->ccl_title;
$ccl_use_mark = $xml_obj->attrs->ccl_use_mark;
$ccl_allow_commercial = $xml_obj->attrs->ccl_allow_commercial;
$ccl_allow_modification = $xml_obj->attrs->ccl_allow_modification;
// 가로/ 세로 크기를 구함
preg_match_all('/(width|height)([^[:digit:]]+)([^;^"^\']*)/i', $xml_obj->attrs->style, $matches);
$width = trim($matches[3][0]);
if (!$width) {
$width = "90%";
}
$height = trim($matches[3][1]);
if (!$height) {
$height = "50";
}
// 언어파일을 읽음
Context::loadLang($this->component_path . '/lang');
$default_title = Context::getLang('ccl_default_title');
if (!$ccl_title) {
$ccl_title = $default_title;
}
$default_message = Context::getLang('ccl_default_message');
$option = Context::getLang('ccl_options');
// 영리 이용 체크
if ($ccl_allow_commercial == 'N') {
$opt1 = '-nc';
} else {
$opt1 = '';
}
// 수정 표시 체크
if ($ccl_allow_modification == 'N') {
$opt2 = '-nd';
} elseif ($ccl_allow_modification == 'SA') {
$opt2 = '-sa';
} else {
$opt2 = '';
}
// 버전
$version = '/3.0';
// 언어에 따른 설정
$lang_type = Context::getLangType();
if ($lang_type != 'en') {
$lang_file = 'deed.' . strtolower($lang_file);
}
// 마크 이용시
$ccl_image = '';
if ($ccl_use_mark == "Y") {
$ccl_image = sprintf('
<a rel="license" href="http://creativecommons.org/licenses/by%s%s%s" onclick="window.open(this.href); return false;"><img src="http://i.creativecommons.org/l/by%s%s%s/88x31.png" alt="Creative Commons License" style="margin-bottom:5px;border:0;" /></a><br />', $opt1, $opt2, $version, $opt1, $opt2, $version);
}
// 결과물 생성
$text = $ccl_image . sprintf($default_message, $opt1, $opt2, $version, '', $ccl_title, $option['ccl_allow_commercial'][$ccl_allow_commercial], $option['ccl_allow_modification'][$ccl_allow_modification], $version);
$style = sprintf('<style type="text/css">.cc_license { clear:both; margin:20px auto 20px auto; padding:8px; width:%s;border:1px solid #c0c0c0; color:#808080; text-align:center; } .cc_license legend { font-weight:bold; } .cc_license a { color:#404040; text-decoration:none; } .cc_license a:hover { text-decoration:underline; </style>', $width);
$output = sprintf('%s<fieldset class="cc_license"><legend>%s</legend>%s</fieldset>', $style, $ccl_title, $text);
return $output;
}
示例6: search_address
/**
* @brief naver map open api에서 주소를 찾는 함수
**/
function search_address()
{
$address = Context::get('address');
if (!$address) {
return new Object(-1, 'msg_not_exists_addr');
}
Context::loadLang($this->component_path . "lang");
// 지정된 서버에 요청을 시도한다
$address = urlencode(iconv("UTF-8", "EUC-KR", $address));
$query_string = sprintf('/api/geocode.php?key=%s&query=%s', $this->api_key, $address);
$fp = fsockopen('maps.naver.com', 80, $errno, $errstr);
if (!$fp) {
return new Object(-1, 'msg_fail_to_socket_open');
}
fputs($fp, "GET {$query_string} HTTP/1.0\r\n");
fputs($fp, "Host: maps.naver.com\r\n\r\n");
$buff = '';
while (!feof($fp)) {
$str = fgets($fp, 1024);
if (trim($str) == '') {
$start = true;
}
if ($start) {
$buff .= trim($str);
}
}
fclose($fp);
$buff = trim(iconv("EUC-KR", "UTF-8", $buff));
$buff = str_replace('<?xml version="1.0" encoding="euc-kr" ?>', '', $buff);
$oXmlParser = new XmlParser();
$xml_doc = $oXmlParser->parse($buff);
//If a Naver OpenApi Error message exists.
if ($xml_doc->error->error_code->body || $xml_doc->error->message->body) {
return new Object(-1, 'NAVER OpenAPI Error' . "\n" . 'Code : ' . $xml_doc->error->error_code->body . "\n" . 'Message : ' . $xml_doc->error->message->body);
}
if ($xml_doc->geocode->total->body == 0) {
return new Object(-1, 'msg_no_result');
}
$addrs = $xml_doc->geocode->item;
if (!is_array($addrs)) {
$addrs = array($addrs);
}
$addrs_count = count($addrs);
$address_list = array();
for ($i = 0; $i < $addrs_count; $i++) {
$item = $addrs[$i];
$address_list[] = sprintf("%s,%s,%s", $item->point->x->body, $item->point->y->body, $item->address->body);
}
$this->add("address_list", implode("\n", $address_list));
}
示例7: 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();
}
示例8: getAdminFTPList
/**
* Add file list to Object after ftp connect
* @return void|Object
*/
function getAdminFTPList()
{
Context::loadLang('./modules/autoinstall/lang');
set_time_limit(5);
require_once _XE_PATH_ . 'libs/ftp.class.php';
$ftp_info = Context::getRequestVars();
if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) {
return new Object(-1, 'msg_ftp_invalid_auth_info');
}
$this->pwd = $ftp_info->ftp_root_path;
if (!$ftp_info->ftp_host) {
$ftp_info->ftp_host = "127.0.0.1";
}
if (!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port)) {
$ftp_info->ftp_port = "21";
}
if ($ftp_info->sftp == 'Y') {
if (!function_exists(ssh2_sftp)) {
return new Object(-1, 'disable_sftp_support');
}
return $this->getSFTPList();
}
$oFtp = new ftp();
if ($oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) {
if ($oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) {
$_list = $oFtp->ftp_rawlist($this->pwd);
$oFtp->ftp_quit();
} else {
return new Object(-1, 'msg_ftp_invalid_auth_info');
}
}
$list = array();
if ($_list) {
foreach ($_list as $k => $v) {
$src = null;
$src->data = $v;
$res = Context::convertEncoding($src);
$v = $res->data;
if (strpos($v, 'd') === 0 || strpos($v, '<DIR>')) {
$list[] = substr(strrchr($v, ' '), 1) . '/';
}
}
} else {
return new Object(-1, 'msg_ftp_no_directory');
}
$this->add('list', $list);
}
示例9: init
/**
* @brief initialization
*
* board_extend module can be divided into general use and admin use.\n
**/
function init()
{
Context::loadLang(_XE_PATH_ . 'modules/board/lang');
// module_srl이 있으면 미리 체크하여 존재하는 모듈이면 module_info 세팅
$module_srl = Context::get('module_srl');
if (!$module_srl && $this->module_srl) {
$module_srl = $this->module_srl;
Context::set('module_srl', $module_srl);
}
// module model 객체 생성
$oModuleModel =& getModel('module');
// module_srl이 넘어오면 해당 모듈의 정보를 미리 구해 놓음
if ($module_srl) {
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
if (!$module_info) {
Context::set('module_srl', '');
$this->act = 'list';
} else {
ModuleModel::syncModuleToSite($module_info);
$this->module_info = $module_info;
Context::set('module_info', $module_info);
}
}
if ($module_info && $module_info->module != 'board') {
return $this->stop("msg_invalid_request");
}
// 모듈 카테고리 목록을 구함
$module_category = $oModuleModel->getModuleCategories();
Context::set('module_category', $module_category);
// 템플릿 경로 지정 (board의 경우 tpl에 관리자용 템플릿 모아놓음)
$template_path = sprintf("%stpl/", $this->module_path);
$this->setTemplatePath($template_path);
// 정렬 옵션을 세팅
foreach ($this->order_target as $key) {
$order_target[$key] = Context::getLang($key);
}
$order_target['list_order'] = Context::getLang('document_srl');
$order_target['update_order'] = Context::getLang('last_update');
Context::set('order_target', $order_target);
}
示例10: getModuleListInSitemap
/**
* @brief when menu add in sitemap, select module list
* this menu showing with trigger
* @param int $site_srl
* @return array
*/
function getModuleListInSitemap($site_srl = 0)
{
$oModuleModel = getModel('module');
$moduleList = array('page');
$output = $oModuleModel->getModuleListByInstance($site_srl);
if (is_array($output->data)) {
foreach ($output->data as $value) {
if ($value->instanceCount > 1) {
$moduleList[] = $value->module;
}
}
}
// after trigger
$output = ModuleHandler::triggerCall('menu.getModuleListInSitemap', 'after', $moduleList);
if (!$output->toBool()) {
return $output;
}
$localModuleList = array_unique($moduleList);
$oAutoinstallModel = getModel('autoinstall');
// get have instance
$remotePackageList = $oAutoinstallModel->getHaveInstance(array('path'));
$remoteModuleList = array();
foreach ($remotePackageList as $package) {
if (strpos($package->path, './modules/') !== 0) {
continue;
}
$pathInfo = explode('/', $package->path);
$remoteModuleList[] = $pathInfo[2];
}
// all module list
$allModuleList = FileHandler::readDir('./modules', '/^([a-zA-Z0-9_-]+)$/');
// union have instance and all module list
$haveInstance = array_intersect($remoteModuleList, $allModuleList);
$haveDirectory = array_intersect($localModuleList, $allModuleList);
// union
$moduleList = array_unique(array_merge($haveDirectory, $haveInstance));
$moduleInfoList = array();
Context::loadLang('modules/page/lang');
if (is_array($moduleList)) {
foreach ($moduleList as $value) {
$moduleInfo = $oModuleModel->getModuleInfoXml($value);
if ($value == 'page') {
$pageTypeName = Context::getLang('page_type_name');
$moduleInfo->title = $pageTypeName['ARTICLE'];
$moduleInfoList['ARTICLE'] = $moduleInfo;
$wModuleInfo = clone $moduleInfo;
unset($wModuleInfo->default_skin, $wModuleInfo->default_mskin);
$wModuleInfo->title = $pageTypeName['WIDGET'];
$wModuleInfo->no_skin = 'Y';
$moduleInfoList['WIDGET'] = $wModuleInfo;
$oModuleInfo = clone $moduleInfo;
unset($oModuleInfo->default_skin, $oModuleInfo->default_mskin);
$oModuleInfo->title = $pageTypeName['OUTSIDE'];
$oModuleInfo->no_skin = 'Y';
$moduleInfoList['OUTSIDE'] = $oModuleInfo;
} else {
$moduleInfoList[$value] = $moduleInfo;
}
}
}
return $moduleInfoList;
}
示例11: array
<?php
if (!defined("__XE__")) {
exit;
}
?>
<!--#Meta:modules/admin/tpl/js/config.js--><?php
$__tmp = array('modules/admin/tpl/js/config.js', '', '', '');
Context::loadFile($__tmp);
unset($__tmp);
Context::loadLang('');
?>
<!--#Meta:modules/session/tpl/js/session.js--><?php
$__tmp = array('modules/session/tpl/js/session.js', '', '', '');
Context::loadFile($__tmp);
unset($__tmp);
?>
<div class="x_page-header">
<h1><?php
echo $__Context->lang->menu_gnb_sub['adminConfigurationFtp'];
?>
<a class="x_icon-question-sign" href="./admin/help/index.html#UMAN_config_ftp" target="_blank"><?php
echo $__Context->lang->help;
?>
</a></h1>
</div>
<?php
if ($__Context->XE_VALIDATOR_MESSAGE && $__Context->XE_VALIDATOR_ID == 'modules/admin/tpl/config_ftp/1') {
?>
<div class="message <?php
echo $__Context->XE_VALIDATOR_MESSAGE_TYPE;
示例12: ModuleHandler
<?php
/* Copyright (C) NAVER <http://www.navercorp.com> */
/**
* @file exchange_content.addon.php
* @brief Addon for change content matched pattern's
* @author [NAVER](http://www.navercorp.com) (<developers@xpressengine.com)
*/
if (!defined('__XE__')) {
exit;
}
if ($called_position == "before_display_content") {
}
if ($called_position == "before_module_proc" && Context::get('download_wanna_reply') != "") {
Context::loadLang(_XE_PATH_ . 'addons/download_wanna_reply/lang');
$oModuleHandler = new ModuleHandler();
$oModuleHandler->error = Context::getLang('msg_download_wanna_reply');
$oModuleHandler->displayContent($this);
Context::close();
exit;
}
if ($called_position == "after_module_proc") {
$oDocument = Context::get('oDocument');
// 글이 없는 경우 처리하지 않음
if (!$oDocument) {
return;
}
$logged_info = Context::get('logged_info');
if ($logged_info) {
// 본인이 작성한 글은 다운로드 가능
if ($logged_info->member_srl == $oDocument->variables['member_srl']) {
示例13: require_once
<?php
if(!defined('__DEBUG__')) define('__DEBUG__', 1);
if(!defined('__XE__')) define('__XE__', TRUE);
if(!defined('__ZBXE__')) define('__ZBXE__', TRUE);
if(!defined('_XE_PATH_')) define('_XE_PATH_', realpath(dirname(__FILE__) . '/../../../../') . '/');
require_once(_XE_PATH_ . 'config/config.inc.php');
require_once(_XE_PATH_ . 'modules/shop/libs/autoload/autoload.php');
// Delete any cache files
FileHandler::removeFilesInDir(_XE_PATH_ . 'files/cache');
$oContext = Context::getInstance();
Context::setLangType('en');
// Load common language files, for the error messages to be displayed
Context::loadLang(_XE_PATH_.'common/lang/');
/* End of file Bootstrap.php */
/* Location: ./modules/shop/tests/lib/Bootstrap.php */
示例14: mobileFileUpload
/**
* @brief file upload
**/
function mobileFileUpload()
{
$oFileModel =& getModel('file');
$oFileController =& getController('file');
$oMobileexModel =& getModel('mobileex');
$mobileex_config = $oMobileexModel->getMobileexConfig($this->module_srl);
// after upload set template
$this->setTemplatePath($this->module_path . 'tpl');
$this->setTemplateFile("after_upload");
// file lang load
Context::loadLang('./modules/file/lang');
$module_srl = $this->module_srl;
$file_info = Context::get('Filedata');
$upload_type = Context::get('upload_type');
$upload_target_srl = intval(Context::get('uploadTargetSrl'));
if (!$upload_target_srl) {
$upload_target_srl = intval(Context::get('upload_target_srl'));
}
// mobile document check
if ($upload_target_srl && Context::get('document_srl')) {
$mobile_check = $oMobileexModel->getMobileDocument($upload_target_srl);
if (!$mobile_check->data) {
Context::set('msg', Context::getLang('msg_not_mobile_document'));
return;
}
}
if (!$upload_target_srl) {
$upload_target_srl = getNextSequence();
}
// file exist check
if (!$file_info['tmp_name'] || !is_uploaded_file($file_info['tmp_name'])) {
Context::set('msg', Context::getLang('msg_no_file'));
return;
}
// grant check
$allow_fileupload = $oMobileexModel->getUploadGrant($module_srl, $upload_type);
if (!$allow_fileupload) {
Context::set('msg', Context::getLang('msg_not_fileupload_grant'));
return;
}
// file ext check
$allow_filetype = $oMobileexModel->getAllowedFileType($file_info, $module_srl);
if (!$allow_filetype->allowed) {
$msg = strtoupper(str_replace('.', '', $allow_filetype->file_ext)) . " " . Context::getLang('msg_not_allowed_filetype');
Context::set('msg', $msg);
return;
}
// get file type
$imglist = "GIF|PNG|JPG|JPEG";
if (!eregi(strtoupper(str_replace('.', '', $allow_filetype->file_ext)), $imglist)) {
$is_img = 'N';
} else {
$is_img = 'Y';
}
$img_resize_width = (int) $mobileex_config->img_resize_width;
$img_resize_height = (int) $mobileex_config->img_resize_height;
if ($img_resize_width > 0 || $img_resize_height > 0) {
$img_resize_use = true;
} else {
$img_resize_use = false;
}
if ($is_img == 'N' || $is_img == 'Y' && !$img_resize_use) {
// file size check
$allow_filesize = $oMobileexModel->getAllowedFileSize(filesize($file_info['tmp_name']), $module_srl, $upload_target_srl, $upload_type);
if (!$allow_filesize->allowed_filesize || !$allow_filesize->allowed_attach_size) {
if (!$allow_filesize->allowed_filesize) {
Context::set('msg', Context::getLang('msg_not_allowed_filesize'));
} else {
if (!$allow_filesize->allowed_attach_size) {
Context::set('msg', Context::getLang('msg_not_allowed_attach_size'));
}
}
return;
}
}
//insert file
// A workaround for Firefox upload bug
if (preg_match('/^=\\?UTF-8\\?B\\?(.+)\\?=$/i', $file_info['name'], $match)) {
$file_info['name'] = base64_decode(strtr($match[1], ':', '/'));
}
// upload path
if (preg_match("/\\.(jpe?g|gif|png|wm[va]|mpe?g|avi|swf|flv|mp[1-4]|as[fx]|wav|midi?|moo?v|qt|r[am]{1,2}|m4v)\$/i", $file_info['name'])) {
// direct 파일에 해킹을 의심할 수 있는 확장자가 포함되어 있으면 바로 삭제함
$file_info['name'] = preg_replace('/\\.(php|phtm|html?|cgi|pl|exe|jsp|asp|inc)/i', '$0-x', $file_info['name']);
$file_info['name'] = str_replace(array('<', '>'), array('%3C', '%3E'), $file_info['name']);
$path = sprintf("./files/attach/images/%s/%s", $module_srl, getNumberingPath($upload_target_srl, 3));
// special character to '_'
// change to md5 file name. because window php bug. window php is not recognize unicode character file name - by cherryfilter
$ext = substr(strrchr($file_info['name'], '.'), 1);
//$_filename = preg_replace('/[#$&*?+%"\']/', '_', $file_info['name']);
$_filename = md5(crypt(rand(1000000, 900000), rand(0, 100))) . '.' . $ext;
$filename = $path . $_filename;
$idx = 1;
while (file_exists($filename)) {
$filename = $path . preg_replace('/\\.([a-z0-9]+)$/i', '_' . $idx . '.$1', $_filename);
$idx++;
}
//.........这里部分代码省略.........
示例15: dispMemberSpammer
/**
* Spammer manage popup
*
* @return void
**/
function dispMemberSpammer()
{
if (!Context::get('is_logged')) {
return new Object(-1, 'msg_not_permitted');
}
$member_srl = Context::get('member_srl');
$module_srl = Context::get('module_srl');
// check grant
$oModuleModel = getModel('module');
$columnList = array('module_srl', 'module');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
if (!$grant->manager) {
return new Object(-1, 'msg_not_permitted');
}
$oMemberModel = getModel('member');
Context::loadLang('modules/document/lang/');
Context::set('spammer_info', $oMemberModel->getMemberInfoByMemberSrl($member_srl));
Context::set('module_srl', $module_srl);
// Select Pop-up layout
$this->setLayoutPath('./common/tpl');
$this->setLayoutFile('popup_layout');
$this->setTemplatePath($this->module_path . 'tpl');
$this->setTemplateFile('spammer');
}