本文整理汇总了PHP中FileHandler类的典型用法代码示例。如果您正苦于以下问题:PHP FileHandler类的具体用法?PHP FileHandler怎么用?PHP FileHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FileHandler类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getPoint
/**
* @brief Get the points
*/
function getPoint($member_srl, $from_db = false)
{
$member_srl = abs($member_srl);
// Get from instance memory
if (!$from_db && $this->pointList[$member_srl]) {
return $this->pointList[$member_srl];
}
// Get from file cache
$path = sprintf(_XE_PATH_ . 'files/member_extra_info/point/%s', getNumberingPath($member_srl));
$cache_filename = sprintf('%s%d.cache.txt', $path, $member_srl);
if (!$from_db && file_exists($cache_filename)) {
return $this->pointList[$member_srl] = trim(FileHandler::readFile($cache_filename));
}
// Get from the DB
$args = new stdClass();
$args->member_srl = $member_srl;
$output = executeQuery('point.getPoint', $args);
if (isset($output->data->member_srl)) {
$point = (int) $output->data->point;
$this->pointList[$member_srl] = $point;
if (!is_dir($path)) {
FileHandler::makeDir($path);
}
FileHandler::writeFile($cache_filename, $point);
return $point;
}
return 0;
}
开发者ID:kimkucheol,项目名称:xe-core,代码行数:31,代码来源:point.model.php
示例2: convert
public function convert($to, $from)
{
$fileHandler = new FileHandler('fiat/bitcoinindex/' . strtolower($to) . '_' . strtolower($from) . '.json');
if ($GLOBALS['cached'] == false || $fileHandler->lastTimeModified() >= 3600) {
// updates every 1 minute
$data = array();
$data = curlCall($this->_url . '/v0.1/conversions/' . strtolower($from) . '/' . strtolower($to));
// /v0.1/conversions/:from/:to
$fileHandler->write(json_encode($data));
return $data;
}
return json_decode($fileHandler->read(), true);
}
开发者ID:ctubio,项目名称:cryptoGlance-web-app,代码行数:13,代码来源:bitcoinindex.php
示例3: recompileCache
/**
* @brief 캐시 파일 재생성
**/
function recompileCache()
{
// widget 정보를 담은 캐시 파일 삭제
FileHandler::removeFilesInDir("./files/cache/widget");
// widget 생성 캐시 파일 삭제
FileHandler::removeFilesInDir("./files/cache/widget_cache");
}
开发者ID:hottaro,项目名称:xpressengine,代码行数:10,代码来源:widget.class.php
示例4: moduleInstall
/**
* @brief Implement if additional tasks are necessary when installing
*/
function moduleInstall()
{
// Register action forward (to use in administrator mode)
$oModuleController = getController('module');
// Add the default editor component
$oEditorController = getAdminController('editor');
$oEditorController->insertComponent('colorpicker_text', true);
$oEditorController->insertComponent('colorpicker_bg', true);
$oEditorController->insertComponent('emoticon', true);
$oEditorController->insertComponent('url_link', true);
$oEditorController->insertComponent('image_link', true);
$oEditorController->insertComponent('multimedia_link', true);
$oEditorController->insertComponent('quotation', true);
$oEditorController->insertComponent('table_maker', true);
$oEditorController->insertComponent('poll_maker', true);
$oEditorController->insertComponent('image_gallery', true);
// Create a directory to use in the editor module
FileHandler::makeDir('./files/cache/editor');
// 2007. 10. 17 Add a trigger to delete automatically saved document whenever the document(insert or update) is modified
$oModuleController->insertTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after');
$oModuleController->insertTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after');
// 2007. 10. 23 Add an editor trigger on the module addition setup
$oModuleController->insertTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before');
// 2009. 04. 14 Add a trigger from compiled codes of the editor component
$oModuleController->insertTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before');
return new Object();
}
开发者ID:rhymix,项目名称:rhymix,代码行数:30,代码来源:editor.class.php
示例5: moduleInstall
/**
* Implement if additional tasks are necessary when installing
*
* @return Object
*/
function moduleInstall()
{
// Register action forward (to use in administrator mode)
$oModuleController = getController('module');
// Save the default settings for attachments
$config = new stdClass();
$config->allowed_filesize = '2';
$config->allowed_attach_size = '2';
$config->allowed_filetypes = '*.*';
$oModuleController->insertModuleConfig('file', $config);
// Generate a directory for the file module
FileHandler::makeDir('./files/attach/images');
FileHandler::makeDir('./files/attach/binaries');
// 2007. 10. 17 Create a trigger to insert, update, delete documents and comments
$oModuleController->insertTrigger('document.insertDocument', 'file', 'controller', 'triggerCheckAttached', 'before');
$oModuleController->insertTrigger('document.insertDocument', 'file', 'controller', 'triggerAttachFiles', 'after');
$oModuleController->insertTrigger('document.updateDocument', 'file', 'controller', 'triggerCheckAttached', 'before');
$oModuleController->insertTrigger('document.updateDocument', 'file', 'controller', 'triggerAttachFiles', 'after');
$oModuleController->insertTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after');
$oModuleController->insertTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before');
$oModuleController->insertTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after');
$oModuleController->insertTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before');
$oModuleController->insertTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after');
$oModuleController->insertTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after');
// 2009. 6. 9 Delete all the attachements when auto-saved document is deleted
$oModuleController->insertTrigger('editor.deleteSavedDoc', 'file', 'controller', 'triggerDeleteAttached', 'after');
// 2007. 10. 17 Create a trigger to delete all the attachements when the module is deleted
$oModuleController->insertTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after');
// 2007. 10. 19 Call a trigger to set up the file permissions before displaying
$oModuleController->insertTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before');
return new Object();
}
开发者ID:rubythonode,项目名称:xe-core,代码行数:37,代码来源:file.class.php
示例6: getNewsFromAgency
function getNewsFromAgency()
{
//Retrieve recent news and set them into context
$newest_news_url = sprintf("http://www.xeshoppingmall.com/?module=newsagency&act=getNewsagencyArticle&inst=notice&top=6&loc=%s", _XE_LOCATION_);
$cache_file = sprintf("%sfiles/cache/nstore_news.%s.cache.php", _XE_PATH_, _XE_LOCATION_);
if (!file_exists($cache_file) || filemtime($cache_file) + 60 * 60 < time()) {
// Considering if data cannot be retrieved due to network problem, modify filemtime to prevent trying to reload again when refreshing textmessageistration page
// Ensure to access the textmessageistration page even though news cannot be displayed
FileHandler::writeFile($cache_file, '');
FileHandler::getRemoteFile($newest_news_url, $cache_file, null, 1, 'GET', 'text/html', array('REQUESTURL' => getFullUrl('')));
}
if (file_exists($cache_file)) {
$oXml = new XmlParser();
$buff = $oXml->parse(FileHandler::readFile($cache_file));
$item = $buff->zbxe_news->item;
if ($item) {
if (!is_array($item)) {
$item = array($item);
}
foreach ($item as $key => $val) {
$obj = null;
$obj->title = $val->body;
$obj->date = $val->attrs->date;
$obj->url = $val->attrs->url;
$news[] = $obj;
}
return $news;
}
}
}
开发者ID:umjinsun12,项目名称:dngshin,代码行数:30,代码来源:functions.php
示例7: dispInstallIntroduce
/**
* @brief Display license messages
*/
function dispInstallIntroduce()
{
$install_config_file = FileHandler::getRealPath('./config/install.config.php');
if (file_exists($install_config_file)) {
include $install_config_file;
if (is_array($install_config)) {
foreach ($install_config as $k => $v) {
$v = $k == 'db_table_prefix' ? $v . '_' : $v;
Context::set($k, $v, true);
}
unset($GLOBALS['__DB__']);
Context::set('install_config', true, true);
$oInstallController = getController('install');
$output = $oInstallController->procInstall();
if (!$output->toBool()) {
return $output;
}
header("location: ./");
Context::close();
exit;
}
}
Context::set('l', Context::getLangType());
$this->setTemplateFile('introduce');
}
开发者ID:Gunmania,项目名称:xe-core,代码行数:28,代码来源:install.view.php
示例8: procAuthenticationAdminConfig
function procAuthenticationAdminConfig()
{
$args = Context::getRequestVars();
if (!trim(strip_tags($args->agreement))) {
$agreement_file = _XE_PATH_ . 'files/authentication/agreement_' . Context::get('lang_type') . '.txt';
FileHandler::removeFile($agreement_file);
$args->agreement = NULL;
}
// check agreement value exist
if ($args->agreement) {
$agreement_file = _XE_PATH_ . 'files/authentication/agreement_' . Context::get('lang_type') . '.txt';
$output = FileHandler::writeFile($agreement_file, $args->agreement);
unset($args->agreement);
}
if (!$args->sender_no) {
$args->sender_no = NULL;
}
if (!$args->message_content) {
$args->message_content = NULL;
}
if (!$args->list) {
$args->list = NULL;
}
if (!$args->cellphone_fieldname) {
$args->cellphone_fieldname = NULL;
}
// save module configuration.
$oModuleController = getController('module');
$output = $oModuleController->updateModuleConfig('authentication', $args);
$this->setMessage('success_saved');
$redirectUrl = getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAuthenticationAdminConfig');
$this->setRedirectUrl($redirectUrl);
}
开发者ID:umjinsun12,项目名称:dngshin,代码行数:33,代码来源:authentication.admin.controller.php
示例9: dispPageIndex
/**
* @brief 일반 요청시 출력
**/
function dispPageIndex()
{
// 템플릿에서 사용할 변수를 Context::set()
if ($this->module_srl) {
Context::set('module_srl', $this->module_srl);
}
// 캐시 파일 지정
$cache_file = sprintf("%sfiles/cache/page/%d.%s.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getLangType());
$interval = (int) $this->module_info->page_caching_interval;
if ($interval > 0) {
if (!file_exists($cache_file)) {
$mtime = 0;
} else {
$mtime = filemtime($cache_file);
}
if ($mtime + $interval * 60 > time()) {
$page_content = FileHandler::readFile($cache_file);
} else {
$oWidgetController =& getController('widget');
$page_content = $oWidgetController->transWidgetCode($this->module_info->content);
FileHandler::writeFile($cache_file, $page_content);
}
} else {
if (file_exists($cache_file)) {
FileHandler::removeFile($cache_file);
}
$page_content = $this->module_info->content;
}
Context::set('module_info', $this->module_info);
Context::set('page_content', $page_content);
$this->setTemplateFile('content');
}
开发者ID:hottaro,项目名称:xpressengine,代码行数:35,代码来源:page.view.php
示例10: deleteModuleFiles
/**
* @brief 특정 모두의 첨부파일 모두 삭제
**/
function deleteModuleFiles($module_srl)
{
// 전체 첨부파일 목록을 구함
$args->module_srl = $module_srl;
$output = executeQueryArray('file.getModuleFiles', $args);
if (!$output) {
return $output;
}
$files = $output->data;
// DB에서 삭제
$args->module_srl = $module_srl;
$output = executeQuery('file.deleteModuleFiles', $args);
if (!$output->toBool()) {
return $output;
}
// 실제 파일 삭제 (일단 약속에 따라서 한번에 삭제)
FileHandler::removeDir(sprintf("./files/attach/images/%s/", $module_srl));
FileHandler::removeDir(sprintf("./files/attach/binaries/%s/", $module_srl));
// DB에서 구한 파일 목록을 삭제
$path = array();
$cnt = count($files);
for ($i = 0; $i < $cnt; $i++) {
$uploaded_filename = $files[$i]->uploaded_filename;
FileHandler::removeFile($uploaded_filename);
$path_info = pathinfo($uploaded_filename);
if (!in_array($path_info['dirname'], $path)) {
$path[] = $path_info['dirname'];
}
}
// 해당 글의 첨부파일 디렉토리 삭제
for ($i = 0; $i < count($path); $i++) {
FileHandler::removeBlankDir($path[$i]);
}
return $output;
}
开发者ID:hottaro,项目名称:xpressengine,代码行数:38,代码来源:file.admin.controller.php
示例11: getThumbnailPath
/**
* Returns the path to the thumbnail image
*
* If a thumbnail does not already exist, it is generated,
* written to disk and then the new path is returned
*
* @param int $width
* @param int $height
* @param string $thumbnail_type
* @return mixed|string
*/
public function getThumbnailPath($width = 80, $height = 0, $thumbnail_type = '')
{
// If signiture height setting is omitted, create a square
if (!$height) {
$height = $width;
}
// get thumbail generation info on the doc module configuration.
if (!in_array($thumbnail_type, array('crop', 'ratio'))) {
$thumbnail_type = 'ratio';
}
// Define thumbnail information
$thumbnail_path = sprintf('files/cache/thumbnails/%s', getNumberingPath($this->unique_identifier, 3));
$thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type);
// If thumbnail was already created, return path to it
if (is_file($thumbnail_file)) {
return $thumbnail_file;
}
// Retrieve info about original image: path and extension
$source_file = $this->full_image_path;
$ext = pathinfo($source_file, PATHINFO_EXTENSION);
// Create thumbnail
$output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, $ext, $thumbnail_type);
if ($output) {
return $thumbnail_file;
} else {
return '';
}
}
开发者ID:haegyung,项目名称:xe-module-shop,代码行数:39,代码来源:ShopThumbnail.php
示例12: moduleUpdate
/**
* @brief 업데이트 실행
**/
function moduleUpdate()
{
if (!is_dir("./files/member_extra_info/new_message_flags")) {
FileHandler::makeDir('./files/member_extra_info/new_message_flags');
}
return new Object(0, 'success_updated');
}
开发者ID:hottaro,项目名称:xpressengine,代码行数:10,代码来源:communication.class.php
示例13: _getWidgetContent
function _getWidgetContent()
{
// Arrange a widget ryeolro
if ($this->module_info->mcontent) {
$cache_file = sprintf("%sfiles/cache/page/%d.%s.m.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getLangType());
$interval = (int) $this->module_info->page_caching_interval;
if ($interval > 0) {
if (!file_exists($cache_file) || filesize($cache_file) < 1) {
$mtime = 0;
} else {
$mtime = filemtime($cache_file);
}
if ($mtime + $interval * 60 > $_SERVER['REQUEST_TIME']) {
$page_content = FileHandler::readFile($cache_file);
$page_content = preg_replace('@<\\!--#Meta:@', '<!--Meta:', $page_content);
} else {
$oWidgetController = getController('widget');
$page_content = $oWidgetController->transWidgetCode($this->module_info->mcontent);
FileHandler::writeFile($cache_file, $page_content);
}
} else {
if (file_exists($cache_file)) {
FileHandler::removeFile($cache_file);
}
$page_content = $this->module_info->mcontent;
}
} else {
$page_content = $this->module_info->content;
}
return $page_content;
}
开发者ID:rhymix,项目名称:rhymix,代码行数:31,代码来源:page.mobile.php
示例14: _getWidgetContent
function _getWidgetContent()
{
// Arrange a widget ryeolro
if ($this->module_info->mcontent) {
$cache_file = sprintf("%sfiles/cache/page/%d.%s.m.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getLangType());
$interval = (int) $this->module_info->page_caching_interval;
if ($interval > 0) {
if (!file_exists($cache_file) || filesize($cache_file) < 1) {
$mtime = 0;
} else {
$mtime = filemtime($cache_file);
}
if ($mtime + $interval * 60 > time()) {
$page_content = FileHandler::readFile($cache_file);
$page_content = preg_replace('@<\\!--#Meta:@', '<!--Meta:', $page_content);
} else {
$oWidgetController =& getController('widget');
$page_content = $oWidgetController->transWidgetCode($this->module_info->mcontent);
FileHandler::writeFile($cache_file, $page_content);
}
} else {
if (file_exists($cache_file)) {
FileHandler::removeFile($cache_file);
}
$page_content = $this->module_info->mcontent;
}
} else {
preg_match_all('!(<img)([^\\>]*)(widget=)([^\\>]*?)(\\>)!is', $this->module_info->content, $matches);
$page_content = '';
for ($i = 0, $c = count($matches[0]); $i < $c; $i++) {
$page_content .= preg_replace('/ style\\=\\"([^\\"]+)\\" /i', ' style="overflow:hidden;clear:both;margin:0 0 20px 0; _margin-right:10px;" ', $matches[0][$i]) . "\n\n";
}
}
return $page_content;
}
开发者ID:relip,项目名称:xe-core,代码行数:35,代码来源:page.mobile.php
示例15: moduleInstall
/**
* @brief 설치시 추가 작업이 필요할시 구현
**/
function moduleInstall()
{
// action forward에 등록 (관리자 모드에서 사용하기 위함)
$oModuleController =& getController('module');
// 첨부파일의 기본 설정 저장
$config->allowed_filesize = '2';
$config->allowed_attach_size = '2';
$config->allowed_filetypes = '*.*';
$oModuleController->insertModuleConfig('file', $config);
// file 모듈에서 사용할 디렉토리 생성
FileHandler::makeDir('./files/attach/images');
FileHandler::makeDir('./files/attach/binaries');
// 2007. 10. 17 글/댓글의 입력/수정/삭제에 대한 trigger 등록
$oModuleController->insertTrigger('document.insertDocument', 'file', 'controller', 'triggerCheckAttached', 'before');
$oModuleController->insertTrigger('document.insertDocument', 'file', 'controller', 'triggerAttachFiles', 'after');
$oModuleController->insertTrigger('document.updateDocument', 'file', 'controller', 'triggerCheckAttached', 'before');
$oModuleController->insertTrigger('document.updateDocument', 'file', 'controller', 'triggerAttachFiles', 'after');
$oModuleController->insertTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after');
$oModuleController->insertTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before');
$oModuleController->insertTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after');
$oModuleController->insertTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before');
$oModuleController->insertTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after');
$oModuleController->insertTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after');
// 2009. 6. 9 자동저장문서 삭제시 첨부 파일도 같이 삭제
$oModuleController->insertTrigger('editor.deleteSavedDoc', 'file', 'controller', 'triggerDeleteAttached', 'after');
// 2007. 10. 17 모듈이 삭제될때 등록된 첨부파일도 모두 삭제하는 트리거 추가
$oModuleController->insertTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after');
// 2007. 10. 19 출력하기 전에 file 권한등을 세팅하는 트리거 호출
$oModuleController->insertTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before');
return new Object();
}
开发者ID:hottaro,项目名称:xpressengine,代码行数:34,代码来源:file.class.php
示例16: procRssAdminInsertConfig
/**
* @brief RSS 전체피드 설정
**/
function procRssAdminInsertConfig()
{
$oModuleModel =& getModel('module');
$total_config = $oModuleModel->getModuleConfig('rss');
$config_vars = Context::getRequestVars();
$config_vars->feed_document_count = (int) $config_vars->feed_document_count;
if (!$config_vars->use_total_feed) {
$alt_message = 'msg_invalid_request';
}
if (!in_array($config_vars->use_total_feed, array('Y', 'N'))) {
$config_vars->open_rss = 'Y';
}
if ($config_vars->image || $config_vars->del_image) {
$image_obj = $config_vars->image;
$config_vars->image = $total_config->image;
// 삭제 요청에 대한 변수를 구함
if ($config_vars->del_image == 'Y' || $image_obj) {
FileHandler::removeFile($config_vars->image);
$config_vars->image = '';
$total_config->image = '';
}
// 정상적으로 업로드된 파일이 아니면 무시
if ($image_obj['tmp_name'] && is_uploaded_file($image_obj['tmp_name'])) {
// 이미지 파일이 아니어도 무시 (swf는 패스~)
$image_obj['name'] = Context::convertEncodingStr($image_obj['name']);
if (!preg_match("/\\.(jpg|jpeg|gif|png)\$/i", $image_obj['name'])) {
$alt_message = 'msg_rss_invalid_image_format';
} else {
// 경로를 정해서 업로드
$path = './files/attach/images/rss/';
// 디렉토리 생성
if (!FileHandler::makeDir($path)) {
$alt_message = 'msg_error_occured';
} else {
$filename = $path . $image_obj['name'];
// 파일 이동
if (!move_uploaded_file($image_obj['tmp_name'], $filename)) {
$alt_message = 'msg_error_occured';
} else {
$config_vars->image = $filename;
}
}
}
}
}
if (!$config_vars->image && $config_vars->del_image != 'Y') {
$config_vars->image = $total_config->image;
}
$output = $this->setFeedConfig($config_vars);
if (!$alt_message) {
$alt_message = 'success_updated';
}
$alt_message = Context::getLang($alt_message);
Context::set('msg', $alt_message);
$this->setLayoutPath('./common/tpl');
$this->setLayoutFile('default_layout.html');
$this->setTemplatePath($this->module_path . 'tpl');
$this->setTemplateFile("top_refresh.html");
}
开发者ID:hottaro,项目名称:xpressengine,代码行数:62,代码来源:rss.admin.controller.php
示例17: save
public static function save($filename, $data = array())
{
$base = array('version' => null, 'data' => null);
$version = AppData::first();
$base['version'] = array('schema' => $version->schema_version, 'data' => $version->data_version, 'seq' => $version->data_sequence_no, 'built' => date('Y-m-d H:i:s'));
$base['data'] = $data;
file_put_contents(FileHandler::path() . $filename . '.json', json_encode($base));
}
开发者ID:kidaa,项目名称:ffxivcrafting,代码行数:8,代码来源:FileHandler.php
示例18: pluginInstall
function pluginInstall($args)
{
// mkdir
FileHandler::makeDir(sprintf(_XE_PATH_ . "files/epay/%s/log", $args->plugin_srl));
// copy files
FileHandler::copyFile(_XE_PATH_ . 'modules/epay/plugins/payplus6/.htaccess', sprintf(_XE_PATH_ . "files/epay/%s/.htaccess", $args->plugin_srl));
FileHandler::copyFile(_XE_PATH_ . 'modules/epay/plugins/payplus6/readme.txt', sprintf(_XE_PATH_ . "files/epay/%s/readme.txt", $args->plugin_srl));
}
开发者ID:bjrambo,项目名称:nurigo,代码行数:8,代码来源:payplus6.plugin.php
示例19: getLicenseFromAgency
function getLicenseFromAgency($prodid, &$has_license = TRUE, &$expiration = NULL)
{
$has_license = TRUE;
$oLicenseModel =& getModel('license');
$config = $oLicenseModel->getModuleConfig();
if ($prodid == 'nstore') {
$user_id = $config->user_id;
$serial_number = $config->serial_number;
} else {
if ($prodid == 'nstore_digital') {
$user_id = $config->d_user_id;
$serial_number = $config->d_serial_number;
} else {
$user_id = $config->e_user_id;
$serial_number = $config->e_serial_number;
}
}
$cache_file = $this->checkLicense($prodid, $user_id, $serial_number);
if (file_exists($cache_file)) {
$oXml = new XmlParser();
$buff = $oXml->parse(FileHandler::readFile($cache_file));
// user
$userObj = $buff->drm->user;
if ($userObj) {
$user = $userObj->body;
if ($user != $user_id) {
$this->checkLicense($prodid, $user_id, $serial_number, TRUE);
return TRUE;
}
}
// serial
$serialObj = $buff->drm->serial;
if ($serialObj) {
$serial = $serialObj->body;
if ($serial != $serial_number) {
$this->checkLicense($prodid, $user_id, $serial_number, TRUE);
return TRUE;
}
}
// license
$licenseObj = $buff->drm->license;
if ($licenseObj) {
$license = $licenseObj->body;
if ($license == 'none') {
$url = getUrl('act', 'dispLicenseAdminConfig');
Context::set(sprintf('%s_MESSAGE_TYPE', strtoupper($prodid)), 'error');
Context::set(sprintf('%s_MESSAGE', strtoupper($prodid)), Context::getLang('not_registered'));
$has_license = FALSE;
}
}
// expiration
$expirationObj = $buff->drm->expiration;
if ($expirationObj) {
$expiration = $expirationObj->body;
}
}
return FALSE;
}
开发者ID:WEN2ER,项目名称:nurigo,代码行数:58,代码来源:license.model.php
示例20: loadXmlFile
/**
* Load a xml file specified by a filename and parse it to Return the resultant data object
* @param string $filename a file path of file
* @return array Returns a data object containing data extracted from a xml file or NULL if a specified file does not exist
*/
function loadXmlFile($filename)
{
if (!file_exists($filename)) {
return;
}
$buff = FileHandler::readFile($filename);
$oXmlParser = new XmlParser();
return $oXmlParser->parse($buff);
}
开发者ID:kimkucheol,项目名称:xe-core,代码行数:14,代码来源:XmlParser.class.php
注:本文中的FileHandler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论