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


PHP XenForo_Helper_File::getInternalDataPath方法代码示例

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


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

示例1: getSitemapFileName

 public function getSitemapFileName($setId, $counter, $compressed = false)
 {
     $path = XenForo_Helper_File::getInternalDataPath() . '/sitemaps';
     if (!XenForo_Helper_File::createDirectory($path, true)) {
         throw new XenForo_Exception("Sitemap directory {$path} could not be created");
     }
     return "{$path}/sitemap-{$setId}-{$counter}.xml" . ($compressed ? '.gz' : '');
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:8,代码来源:Sitemap.php

示例2: ConvertFilename

 public static function ConvertFilename(&$attachmentFile)
 {
     $xf_code_root = XenForo_Application::getInstance()->getRootDir();
     $internal_data = XenForo_Helper_File::getInternalDataPath();
     $internal_data_uri = self::getInternalDataUrl();
     if ($internal_data_uri && strpos($attachmentFile, $internal_data) === 0) {
         $attachmentFile = str_replace($internal_data, $internal_data_uri, $attachmentFile);
         return true;
     } else {
         if (strpos($attachmentFile, $xf_code_root) === 0) {
             $attachmentFile = str_replace($xf_code_root, '', $attachmentFile);
             return true;
         } else {
             return false;
         }
     }
 }
开发者ID:Xon,项目名称:XenForo-AttachmentImprovements,代码行数:17,代码来源:AttachmentHelper.php

示例3: getImagePath

 /**
  * Gets the path to an image in the file system image cache
  *
  * @param array $image
  *
  * @return string
  */
 public function getImagePath(array $image)
 {
     return sprintf('%s/image_cache/%d/%d-%s.data', XenForo_Helper_File::getInternalDataPath(), floor($image['image_id'] / 1000), $image['image_id'], $image['url_hash']);
 }
开发者ID:Sywooch,项目名称:forums,代码行数:11,代码来源:ImageProxy.php

示例4: __construct

 protected function __construct()
 {
     $this->_path = XenForo_Helper_File::getInternalDataPath() . '/templates';
 }
开发者ID:namgiangle90,项目名称:tokyobaito,代码行数:4,代码来源:FileHandler.php

示例5: isInstalled

 public function isInstalled()
 {
     return file_exists(XenForo_Helper_File::getInternalDataPath() . '/install-lock.php') && file_exists(XenForo_Application::getInstance()->getConfigDir() . '/config.php');
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:4,代码来源:Install.php

示例6: actionUpdate

    public function actionUpdate()
    {
        //########################################
        // Update each attachment because
        // the pixel width is over maxWidth
        // setting in options.
        //########################################
        // get user group permissions
        if (!XenForo_Visitor::getInstance()->hasPermission('imageResizerGroupID', 'imageResizerID')) {
            throw $this->getNoPermissionResponseException();
        }
        // get options from Admin CP -> Options -> Image Resizer -> Default Image Processor
        $imPecl = XenForo_Application::get('options')->imageLibrary['class'];
        // check option
        if ($imPecl != 'imPecl') {
            return $this->responseError(new XenForo_Phrase('imageresizer_imagemagick_with_pecl_required'));
        }
        // get options from Admin CP -> Options -> Image Resizer -> Maximum Width
        $maximumWidth = XenForo_Application::get('options')->imageResizerMaximumWidth;
        // check option
        if ($maximumWidth == 0) {
            return $this->responseError(new XenForo_Phrase('imageresizer_maximum_width_in_options_not_set'));
        }
        // get options from Admin CP -> Options -> Image Resizer -> Maximum Height
        $maximumHeight = XenForo_Application::get('options')->imageResizerMaximumHeight;
        // check option
        if ($maximumHeight == 0) {
            return $this->responseError(new XenForo_Phrase('imageresizer_maximum_height_in_options_not_set'));
        }
        // get limit
        $limit = $this->_input->filterSingle('limit', XenForo_Input::UINT);
        // verify limit set
        if ($limit == '') {
            return $this->responseError(new XenForo_Phrase('imageresizer_limit_switch_missing_in_url'));
        }
        //########################################
        // start update process
        //########################################
        // get internalDataPath
        $internalDataPath = XenForo_Helper_File::getInternalDataPath();
        // get data path
        $externalDataPath = XenForo_Helper_File::getExternalDataPath();
        // get database
        $db = XenForo_Application::get('db');
        // run query
        $attachments = $db->fetchAll("\n\t\tSELECT xf_attachment_data.*, xf_attachment.*, xf_user.username\n\t\tFROM xf_attachment_data\n\t\tINNER JOIN xf_attachment ON xf_attachment.data_id = xf_attachment_data.data_id\n\t\tINNER JOIN xf_user ON xf_user.user_id = xf_attachment_data.user_id\n\t\tWHERE xf_attachment.unassociated = 0\n\t\tAND xf_attachment.content_type = 'post'\n\t\tAND\t(xf_attachment_data.width > " . $maximumWidth . "\n\t\tOR xf_attachment_data.height > " . $maximumHeight . ")\n\t\tORDER BY xf_attachment_data.width DESC, xf_attachment_data.data_id DESC\n\t\tLIMIT " . $limit . "\n\t\t");
        foreach ($attachments as $k => $v) {
            // clear variable
            $skip = '';
            //#####################################
            // define last folder name
            // 0-999 are stored in the 0 directory
            // 1000-1999 stored in the 1 directory etc
            //#####################################
            $dataId = $v['data_id'];
            $fileHash = $v['file_hash'];
            $lastFolder = floor($dataId / 1000);
            //#####################################
            // define attachment full path
            //#####################################
            // attachment path
            $attachmentFullPath = $internalDataPath . '/attachments/' . $lastFolder . '/' . $dataId . '-' . $fileHash . '.data';
            // throw error if file missing
            if (!file_exists($attachmentFullPath)) {
                throw new XenForo_Exception(new XenForo_Phrase('imageresizer_attachment_missing_from_file_directory') . ' ' . $attachmentFullPath, true);
            }
            //#####################################
            // get file information
            //#####################################
            // get size
            $filesize = filesize($attachmentFullPath);
            // get dimensions
            list($width, $height) = getimagesize($attachmentFullPath);
            //#####################################
            // If file information is different
            // than information in database, update
            // database first.
            //#####################################
            // verify database information is correct
            if ($filesize != $v['file_size'] or $width != $v['width'] or $height != $v['height']) {
                // run query
                $db->query('
				UPDATE xf_attachment_data SET
					file_size = "' . $filesize . '",
					width = "' . $width . '",
					height = "' . $height . '"
				WHERE data_id = ?
				', $dataId);
                // skip resize
                $skip = 'yes';
            }
            // resize if required
            if ($skip != 'yes') {
                //#####################################
                // Database information is correct,
                // resize image.
                //#####################################
                // get options from Admin CP -> Options -> Image Resizer -> Maximum Width
                $maximumWidth = XenForo_Application::get('options')->imageResizerMaximumWidth;
                // get options from Admin CP -> Options -> Image Resizer -> Maximum Height
//.........这里部分代码省略.........
开发者ID:Sywooch,项目名称:forums,代码行数:101,代码来源:ImageResizer.php

示例7: stepMedia

    public function stepMedia($start, array $options)
    {
        $options = array_merge(array('path' => XenForo_Helper_File::getInternalDataPath() . '/xfru/useralbums/images', 'limit' => 5, 'max' => false), $options);
        $sDb = $this->_sourceDb;
        if ($options['max'] === false) {
            $options['max'] = $sDb->fetchOne('
				SELECT MAX(image_id)
				FROM xfr_useralbum_image
			');
        }
        $userAlbumsMoreInstalled = '';
        if (XenForo_Application::isRegistered('addOns')) {
            $addOns = XenForo_Application::get('addOns');
            if (!empty($addOns['XfRuUserAlbumsMore'])) {
                $userAlbumsMoreInstalled = ', album.selected_users';
            }
        }
        $media = $sDb->fetchAll($sDb->limit('
				SELECT image.*, data.*,
				album.album_id, album.album_type, album.moderation
				' . $userAlbumsMoreInstalled . '
				FROM xfr_useralbum_image AS image
				INNER JOIN xfr_useralbum_image_data AS data ON
					(image.data_id = data.data_id)
				INNER JOIN xfr_useralbum AS album ON
					(image.album_id = album.album_id)
				WHERE image.image_id > ' . $sDb->quote($start) . '
					AND image.unassociated = 0
					AND data.attach_count > 0
				ORDER BY image.image_id
			', $options['limit']));
        if (!$media) {
            return true;
        }
        $next = 0;
        $total = 0;
        foreach ($media as $item) {
            $next = $item['image_id'];
            $user = $sDb->fetchRow('
				SELECT user_id, username
				FROM xf_user
				WHERE user_id = ?
			', $item['user_id']);
            if (!$user) {
                continue;
            }
            $success = $this->_importMedia($item, $options);
            if ($success) {
                $total++;
            } else {
                continue;
            }
        }
        $this->_session->incrementStepImportTotal($total);
        return array($next, $options, $this->_getProgressOutput($next, $options['max']));
    }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:56,代码来源:XFRUserAlbums.php

示例8: deleteTemporaryFiles

 public function deleteTemporaryFiles($bibleId)
 {
     $internalDataPath = XenForo_Helper_File::getInternalDataPath();
     $path = $internalDataPath . DIRECTORY_SEPARATOR . 'bibles' . DIRECTORY_SEPARATOR . $bibleId;
     if (is_dir($path)) {
         $files = scandir($path);
         foreach ($files as $file) {
             if (!is_dir($file)) {
                 @unlink($path . "/" . $file);
             }
         }
         @rmdir($path);
     }
 }
开发者ID:ThemeHouse-XF,项目名称:Biblea,代码行数:14,代码来源:Bible.php

示例9: getAttachmentDataFilePath

 /**
  * Gets the full path to this attachment's data.
  *
  * @param array $data Attachment data info
  *
  * @return string
  */
 public function getAttachmentDataFilePath(array $data)
 {
     return XenForo_Helper_File::getInternalDataPath() . '/attachments/' . floor($data['data_id'] / 1000) . "/{$data['data_id']}-{$data['file_hash']}.data";
 }
开发者ID:hahuunguyen,项目名称:DTUI_201105,代码行数:11,代码来源:Attachment.php

示例10: getThumbnailPath

 /**
  * Gets the path to an thumbnail in the file system thumbnail cache
  *
  * @param array $thumbnail
  *
  * @return string
  */
 public function getThumbnailPath(array $thumbnail)
 {
     return sprintf('%s/thumbnail_cache/%d/%d-%s.data', XenForo_Helper_File::getInternalDataPath(), floor($thumbnail['thumbnail_id'] / 1000), $thumbnail['thumbnail_id'], $thumbnail['url_hash']);
 }
开发者ID:darkearl,项目名称:projectT122015,代码行数:11,代码来源:ThumbnailProxy.php

示例11: getAttachmentDataFilePath

 /**
  * Gets the full path to this attachment's data.
  *
  * @param array $data Attachment data info
  * @param string Internal data path
  *
  * @return string
  */
 public function getAttachmentDataFilePath(array $data, $internalDataPath = null)
 {
     if ($internalDataPath === null) {
         $internalDataPath = XenForo_Helper_File::getInternalDataPath();
     }
     return sprintf('%s/attachments/%d/%d-%s.data', $internalDataPath, floor($data['data_id'] / 1000), $data['data_id'], $data['file_hash']);
 }
开发者ID:namgiangle90,项目名称:tokyobaito,代码行数:15,代码来源:Attachment.php

示例12: getAlbumThumbnailFilePath

 public function getAlbumThumbnailFilePath($albumId, $original = false)
 {
     if ($original) {
         return sprintf('%s/xengallery/originals/album/%d/%d.jpg', XenForo_Helper_File::getInternalDataPath(), floor($albumId / 1000), $albumId);
     } else {
         return sprintf('%s/xengallery/album/%d/%d.jpg', XenForo_Helper_File::getExternalDataPath(), floor($albumId / 1000), $albumId);
     }
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:8,代码来源:Album.php

示例13: actionImportForm

 public function actionImportForm()
 {
     $this->_checkCsrfFromToken($this->_request->getParam('_xfToken'));
     $input = $this->_input->filter(array('options' => XenForo_Input::ARRAY_SIMPLE, 'mode' => XenForo_Input::STRING));
     $xenOptions = XenForo_Application::get('options');
     $input['options'] = array_merge(array('start_row' => 0, 'row_count' => $xenOptions->th_userImpEx_batchImportUsers, 'filename' => ''), $input['options']);
     $userModel = $this->_getUserModel();
     if ($input['mode'] == 'upload') {
         $upload = XenForo_Upload::getUploadedFile('upload');
         if (!$upload) {
             return $this->responseError(new XenForo_Phrase('th_please_upload_valid_users_xml_file_userimpex'));
         }
         $document = $this->getHelper('Xml')->getXmlFromFile($upload);
         $users = $userModel->getUsersFromXml($document);
     } elseif ($input['mode'] == 'uploadcsv') {
         if (!$input['options']['filename']) {
             $upload = XenForo_Upload::getUploadedFile('uploadcsv');
             if (!$upload) {
                 return $this->responseError(new XenForo_Phrase('th_please_upload_valid_users_csv_file_userimpex'));
             }
             $tempFile = $upload->getTempFile();
             if ($input['options']['row_count']) {
                 $internalDataPath = XenForo_Helper_File::getInternalDataPath();
                 XenForo_Helper_File::createDirectory($internalDataPath . '/userimpex/');
                 $filename = $internalDataPath . '/userimpex/' . XenForo_Application::$time . '.csv';
                 copy($tempFile, $filename);
             } else {
                 $filename = $tempFile;
             }
         } else {
             $filename = $input['options']['filename'];
         }
         $users = $this->getHelper('ThemeHouse_UserImpEx_ControllerHelper_Csv')->getCsvFromFile($filename, $input['options']['start_row'], $input['options']['row_count']);
         if (count($users) == $input['options']['row_count']) {
             $input['options']['start_row'] = $input['options']['start_row'] + $input['options']['row_count'];
             $input['options']['filename'] = $filename;
         } else {
             unset($input['options']['start_row'], $input['options']['row_count']);
         }
     } else {
         $users = $this->_input->filterSingle('users', XenForo_Input::ARRAY_SIMPLE);
     }
     $userCount = count($users);
     $users = $userModel->massImportUsers($users);
     $usersImported = $userCount - count($users);
     /* @var $userChangeLogModel XenForo_Model_UserChangeLog */
     $userChangeLogModel = $this->getModelFromCache('XenForo_Model_UserChangeLog');
     $fields = array();
     foreach ($users as $user) {
         foreach ($user as $fieldName => $fieldValue) {
             if (!isset($fields[$fieldName])) {
                 $field = array('field' => $fieldName, 'old_value' => '', 'new_value' => '');
                 $field = $userChangeLogModel->prepareField($field);
                 $fields[$fieldName] = $field['name'];
             }
         }
     }
     $viewParams = array('options' => $input['options'], 'mode' => $input['mode'], 'users' => $users, 'usersImported' => $usersImported, 'fields' => $fields);
     if (!$users && empty($input['options']['filename'])) {
         return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildAdminLink('users/list'));
     }
     return $this->responseView('ThemeHouse_UserImpEx_ViewAdmin_User_ImportForm', 'th_user_import_form_userimpex', $viewParams);
 }
开发者ID:ThemeHouse-XF,项目名称:UserImpEx,代码行数:63,代码来源:User.php

示例14: execute

 public function execute(array $deferred, array $data, $targetRunTime, &$status)
 {
     $data = array_merge(array('position' => 0, 'count' => 0, 'imported' => XenForo_Application::$time), $data);
     if (empty($data['bible_id'])) {
         return false;
     }
     $db = XenForo_Application::getDb();
     /* @var $bibleModel ThemeHouse_Bible_Model_Bible */
     $bibleModel = XenForo_Model::create('ThemeHouse_Bible_Model_Bible');
     /* @var $bookModel ThemeHouse_Bible_Model_Book */
     $bookModel = XenForo_Model::create('ThemeHouse_Bible_Model_Book');
     /* @var $verseModel ThemeHouse_Bible_Model_Verse */
     $verseModel = XenForo_Model::create('ThemeHouse_Bible_Model_Verse');
     $internalDataPath = XenForo_Helper_File::getInternalDataPath();
     $path = $internalDataPath . DIRECTORY_SEPARATOR . 'bibles' . DIRECTORY_SEPARATOR . $data['bible_id'];
     if (!file_exists($path) || !is_dir($path)) {
         return false;
     }
     $mappedFilename = $path . DIRECTORY_SEPARATOR . $data['bible_id'] . '_utf8_mapped_to_NRSVA.txt';
     $utf8Filename = $path . DIRECTORY_SEPARATOR . $data['bible_id'] . '_utf8.txt';
     $mappingFilename = $path . DIRECTORY_SEPARATOR . $data['bible_id'] . '_mapping_to_NRSVA.txt';
     if (file_exists($mappedFilename)) {
         $handle = fopen($mappedFilename, 'r');
     } elseif (file_exists($utf8Filename)) {
         $handle = fopen($utf8Filename, 'r');
     }
     $bibleInfo = array();
     $columns = array();
     $fields = array('name', 'copyright', 'abbreviation', 'language', 'note');
     if (isset($handle)) {
         $position = 0;
         while ($row = fgets($handle)) {
             $row = explode("\t", rtrim($row, "\r\n"));
             if (empty($row[0])) {
                 // do nothing
             } elseif (substr($row[0], 0, 1) != '#') {
                 fseek($handle, $position);
                 break;
             } elseif (in_array(substr($row[0], 1), $fields)) {
                 if (!empty($row[1])) {
                     $key = substr(array_shift($row), 1);
                     $bibleInfo[$key] = implode(',', $row);
                 } else {
                     $bibleInfo[substr($row[0], 1)] = '';
                 }
             } elseif (substr($row[0], 1) == 'columns') {
                 array_shift($row);
                 $columns = $row;
             }
             $position = ftell($handle);
         }
     }
     $bibleId = $data['bible_id'];
     $bible = $bibleModel->getBibleById($bibleId);
     $bookNamesFilename = $path . '/book_names.txt';
     if (!file_exists($bookNamesFilename)) {
         return false;
     }
     $bookIndexes = array();
     $bookNamesHandle = fopen($bookNamesFilename, 'r');
     while ($row = fgets($bookNamesHandle)) {
         $row = explode("\t", rtrim($row, "\r\n"));
         if (empty($row[0])) {
             continue;
         }
         $bookIndexes[$row[0]] = $row[1];
     }
     fclose($bookNamesHandle);
     $bookNameIds = array();
     if ($data['position'] == 0 || $bibleInfo && !$bible) {
         $bibleDw = XenForo_DataWriter::create('ThemeHouse_Bible_DataWriter_Bible');
         if ($bible) {
             $bibleDw->setExistingData($bible);
         } else {
             $bibleDw->set('bible_id', $bibleId);
         }
         if (strpos($bibleInfo['name'], ':') !== false) {
             $title = trim(substr($bibleInfo['name'], strpos($bibleInfo['name'], ':') + 2));
         } else {
             $title = $bibleInfo['name'];
         }
         $bibleDw->setExtraData(ThemeHouse_Bible_DataWriter_Bible::DATA_TITLE, $title);
         $bibleDw->bulkSet($bibleInfo);
         $bibleDw->save();
         $bible = $bibleDw->getMergedData();
         if ($bible) {
             $htmlFilename = $path . DIRECTORY_SEPARATOR . $bibleId . '.html';
             if (file_exists($htmlFilename)) {
                 $html = file_get_contents($htmlFilename);
                 preg_match('#<body>(.*)</body>#s', $html, $matches);
                 if (!empty($matches[1])) {
                     $html = $matches[1];
                 }
             } else {
                 $html = '';
             }
             $title = $bibleModel->getTemplateTitle(array('bible_id' => $bibleId));
             /* @var $templateModel XenForo_Model_Template */
             $templateModel = XenForo_Model::create('XenForo_Model_Template');
             $template = $templateModel->getTemplateInStyleByTitle($title);
//.........这里部分代码省略.........
开发者ID:ThemeHouse-XF,项目名称:Biblea,代码行数:101,代码来源:Import.php

示例15: logException

 public static function logException($e, $rollbackTransactions = true, $messagePrefix = '')
 {
     $isValidArg = $e instanceof Exception || $e instanceof Throwable;
     if (!$isValidArg) {
         throw new Exception("logException requires an Exception or a Throwable");
     }
     try {
         $db = XenForo_Application::getDb();
         if ($db->getConnection()) {
             if ($rollbackTransactions) {
                 @XenForo_Db::rollbackAll($db);
             }
             $dbVersionId = @$db->fetchOne("SELECT option_value FROM xf_option WHERE option_id = 'currentVersionId'");
             if ($dbVersionId && $dbVersionId != XenForo_Application::$versionId) {
                 // do not log errors when an upgrade is pending
                 return;
             }
             if (!file_exists(XenForo_Helper_File::getInternalDataPath() . '/install-lock.php')) {
                 // install hasn't finished yet, don't write
                 return;
             }
             $rootDir = XenForo_Application::getInstance()->getRootDir();
             $file = $e->getFile();
             if (strpos($file, $rootDir) === 0) {
                 $file = substr($file, strlen($rootDir));
                 if (strlen($file) && ($file[0] == '/' || $file[0] == '\\')) {
                     $file = substr($file, 1);
                 }
             }
             $requestPaths = XenForo_Application::get('requestPaths');
             $request = array('url' => $requestPaths['fullUri'], '_GET' => $_GET, '_POST' => $_POST);
             // don't log passwords
             foreach ($request['_POST'] as $key => &$value) {
                 if (strpos($key, 'password') !== false || $key == '_xfToken') {
                     $value = '********';
                 }
             }
             $db->insert('xf_error_log', array('exception_date' => XenForo_Application::$time, 'user_id' => XenForo_Visitor::hasInstance() ? XenForo_Visitor::getUserId() : null, 'ip_address' => XenForo_Helper_Ip::getBinaryIp(), 'exception_type' => get_class($e), 'message' => $messagePrefix . $e->getMessage(), 'filename' => $file, 'line' => $e->getLine(), 'trace_string' => $e->getTraceAsString(), 'request_state' => serialize($request)));
         }
     } catch (Exception $e) {
     }
 }
开发者ID:darkearl,项目名称:projectT122015,代码行数:42,代码来源:Error.php


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