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


PHP FileUtil::getRealPath方法代码示例

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


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

示例1: install

	/**
	 * @see	wcf\system\package\plugin\IPackageInstallationPlugin::install()
	 */
	public function install() {
		parent::install();
		
		// get installation path of package
		$sql = "SELECT	packageDir
			FROM	wcf".WCF_N."_package
			WHERE	packageID = ?";
		$statement = WCF::getDB()->prepareStatement($sql);
		$statement->execute(array($this->installation->getPackageID()));
		$packageDir = $statement->fetchArray();
		$packageDir = $packageDir['packageDir'];
		
		// get relative path of script
		$path = FileUtil::getRealPath(WCF_DIR.$packageDir);
		
		// reset WCF cache
		CacheHandler::getInstance()->flushAll();
		
		// run script
		$this->run($path.$this->instruction['value']);
		
		// delete script
		if (@unlink($path.$this->instruction['value'])) {
			// delete file log entry
			$sql = "DELETE FROM	wcf".WCF_N."_package_installation_file_log
				WHERE		packageID = ?
						AND filename = ?";
			$statement = WCF::getDB()->prepareStatement($sql);
			$statement->execute(array(
				$this->installation->getPackageID(),
				$this->instruction['value']
			));
		}
	}
开发者ID:0xLeon,项目名称:WCF,代码行数:37,代码来源:ScriptPackageInstallationPlugin.class.php

示例2: getData

 /**
  * @see	\wcf\system\option\IOptionType::getData()
  */
 public function getData(Option $option, $newValue)
 {
     $this->createUploadHandler($option);
     if ($this->uploadHandlers[$option->optionName] === null) {
         return '';
     }
     $files = $this->uploadHandlers[$option->optionName]->getFiles();
     $file = reset($files);
     // check if file has been uploaded
     if (!$file->getFilename()) {
         // if checkbox is checked, remove file
         if ($newValue) {
             @unlink($option->optionValue);
             return '';
         }
         // use old value
         return $option->optionValue;
     } else {
         if ($option->optionValue) {
             // delete old file first
             @unlink($option->optionValue);
         }
     }
     // determine location the file will be stored at
     $package = PackageCache::getInstance()->getPackage($option->packageID);
     $fileLocation = FileUtil::addTrailingSlash(FileUtil::getRealPath(WCF_DIR . $package->packageDir)) . $option->filelocation . '.' . $file->getFileExtension();
     // save file
     move_uploaded_file($file->getLocation(), $fileLocation);
     // return file location as the value to store in the database
     return $fileLocation;
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:34,代码来源:FileOptionType.class.php

示例3: install

 /**
  * @see	\wcf\system\package\plugin\IPackageInstallationPlugin::install()
  */
 public function install()
 {
     parent::install();
     $abbreviation = 'wcf';
     $path = '';
     if (isset($this->instruction['attributes']['application'])) {
         $abbreviation = $this->instruction['attributes']['application'];
     } else {
         if ($this->installation->getPackage()->isApplication) {
             $path = FileUtil::getRealPath(WCF_DIR . $this->installation->getPackage()->packageDir);
         }
     }
     if (empty($path)) {
         $dirConstant = strtoupper($abbreviation) . '_DIR';
         if (!defined($dirConstant)) {
             throw new SystemException("Cannot execute script-PIP, abbreviation '" . $abbreviation . "' is unknown");
         }
         $path = constant($dirConstant);
     }
     // reset WCF cache
     CacheHandler::getInstance()->flushAll();
     // run script
     $this->run($path . $this->instruction['value']);
     // delete script
     if (@unlink($path . $this->instruction['value'])) {
         // delete file log entry
         $sql = "DELETE FROM\twcf" . WCF_N . "_package_installation_file_log\n\t\t\t\tWHERE\t\tpackageID = ?\n\t\t\t\t\t\tAND filename = ?";
         $statement = WCF::getDB()->prepareStatement($sql);
         $statement->execute(array($this->installation->getPackageID(), $this->instruction['value']));
     }
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:34,代码来源:ScriptPackageInstallationPlugin.class.php

示例4: uninstall

	/**
	 * @see	wcf\system\package\plugin\IPackageInstallationPlugin::uninstall()
	 */
	public function uninstall() {
		// create ACP-templates list
		$templates = array();
		
		// get ACP-templates from log
		$sql = "SELECT	*
			FROM	wcf".WCF_N."_acp_template
			WHERE	packageID = ?";
		$statement = WCF::getDB()->prepareStatement($sql);
		$statement->execute(array($this->installation->getPackageID()));
		while ($row = $statement->fetchArray()) {
			// store acp template with suffix (_$packageID)
			$templates[] = 'acp/templates/'.$row['templateName'].'.tpl';
		}
		
		if (!empty($templates)) {
			// delete template files
			$packageDir = FileUtil::addTrailingSlash(FileUtil::getRealPath(WCF_DIR.$this->installation->getPackage()->packageDir));
			$deleteEmptyDirectories = $this->installation->getPackage()->isApplication;
			$this->installation->deleteFiles($packageDir, $templates, false, $deleteEmptyDirectories);
			
			// delete log entries
			parent::uninstall();
		}
	}
开发者ID:0xLeon,项目名称:WCF,代码行数:28,代码来源:ACPTemplatePackageInstallationPlugin.class.php

示例5: install

	/**
	 * @see	wcf\system\package\plugin\IPackageInstallationPlugin::install()
	 */
	public function install() {
		parent::install();
		
		// get package installation dir
		$dir = $this->installation->getPackage()->packageDir;
		if (empty($dir)) {
			if ($this->installation->getPackage()->isApplication == 1 && $this->installation->getPackage()->package != 'com.woltlab.wcf' && $this->installation->getAction() == 'install') {
				// application
				// prompt package dir
				$dir = $this->promptPackageDir();
			}
			
			// save package dir
			if (!empty($dir)) {
				$package = new Package($this->installation->getPackageID());
				$packageEditor = new PackageEditor($package);
				$packageEditor->update(array('packageDir' => $dir));
				
				$this->installation->getPackage()->packageDir = $dir;
			}
		}
		
		// absolute path to package dir
		$packageDir = FileUtil::addTrailingSlash(FileUtil::getRealPath(WCF_DIR.$dir));
		
		// extract files.tar to temp folder
		$sourceFile = $this->installation->getArchive()->extractTar($this->instruction['value'], 'files_');
		
		// create file handler
		$fileHandler = new FilesFileHandler($this->installation);
		
		// extract content of files.tar
		$fileInstaller = $this->installation->extractFiles($packageDir, $sourceFile, $fileHandler);
		
		// if this a an application, write config.inc.php for this package
		if ($this->installation->getPackage()->isApplication == 1 && $this->installation->getPackage()->package != 'com.woltlab.wcf' && $this->installation->getAction() == 'install') {
			// touch file
			$fileInstaller->touchFile(PackageInstallationDispatcher::CONFIG_FILE);
			
			// create file
			Package::writeConfigFile($this->installation->getPackageID());
			
			// log file
			$sql = "INSERT INTO	wcf".WCF_N."_package_installation_file_log
						(packageID, filename)
				VALUES		(?, 'config.inc.php')";
			$statement = WCF::getDB()->prepareStatement($sql);
			$statement->execute(array($this->installation->getPackageID()));
		}
		
		// delete temporary sourceArchive
		@unlink($sourceFile);
		
		// update acp style file
		StyleUtil::updateStyleFile();
	}
开发者ID:0xLeon,项目名称:WCF,代码行数:59,代码来源:FilePackageInstallationPlugin.class.php

示例6: deleteFolders

 /**
  * Deletes the folders of this template group.
  */
 public function deleteFolders()
 {
     // default template dir
     $folders = array(WCF_DIR . 'templates/' . $this->templateGroupFolderName);
     // get package dirs
     $sql = "SELECT\tpackageDir\n\t\t\tFROM\twcf" . WCF_N . "_package\n\t\t\tWHERE\tpackageDir <> ''";
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute();
     while ($row = $statement->fetchArray()) {
         $packageDir = FileUtil::getRealPath(WCF_DIR . $row['packageDir']);
         DirectoryUtil::getInstance($packageDir . 'templates/' . $this->templateGroupFolderName)->deleteAll();
     }
 }
开发者ID:ZerGabriel,项目名称:WCF,代码行数:16,代码来源:TemplateGroupEditor.class.php

示例7: getDirectory

 /**
  * Returns the directory of the application with the given abbrevation.
  * 
  * @param	string		$abbreviation
  * @return	string
  */
 public static function getDirectory($abbreviation)
 {
     if (static::$directories === null) {
         static::$directories = array();
         // read application directories
         $packageList = new PackageList();
         $packageList->getConditionBuilder()->add('package.isApplication = ?', array(1));
         $packageList->readObjects();
         foreach ($packageList as $package) {
             $abbr = Package::getAbbreviation($package->package);
             static::$directories[$abbr] = FileUtil::addTrailingSlash(FileUtil::getRealPath(WCF_DIR . $package->packageDir));
         }
     }
     if (!isset(static::$directories[$abbreviation])) {
         throw new SystemException("Unknown application '" . $abbreviation . "'");
     }
     return static::$directories[$abbreviation];
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:24,代码来源:Application.class.php

示例8: uninstall

 /**
  * Uninstalls the templates of this package.
  */
 public function uninstall()
 {
     // create templates list
     $templates = array();
     // get templates from log
     $sql = "SELECT\ttemplateName\n\t\t\tFROM\twcf" . WCF_N . "_template\n\t\t\tWHERE \tpackageID = ?";
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute(array($this->installation->getPackageID()));
     while ($row = $statement->fetchArray()) {
         $templates[] = 'templates/' . $row['templateName'] . '.tpl';
     }
     if (count($templates) > 0) {
         // delete template files
         $packageDir = FileUtil::addTrailingSlash(FileUtil::getRealPath(WCF_DIR . $this->installation->getPackage()->packageDir));
         $deleteEmptyDirectories = $this->installation->getPackage()->isApplication;
         $this->installation->deleteFiles($packageDir, $templates, false, $deleteEmptyDirectories);
         // delete log entries
         parent::uninstall();
     }
 }
开发者ID:ZerGabriel,项目名称:WCF,代码行数:23,代码来源:TemplatePackageInstallationPlugin.class.php

示例9: execute

 /**
  * @see wcf\action\IAction::execute()
  */
 public function execute()
 {
     parent::execute();
     // delete language cache and compiled templates as well
     LanguageFactory::getInstance()->deleteLanguageCache();
     $conditions = new PreparedStatementConditionBuilder();
     $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
     $conditions->add("isApplication = ?", array(1));
     // get package dirs
     $sql = "SELECT\tpackageDir\n\t\t\tFROM\twcf" . WCF_N . "_package\n\t\t\t" . $conditions;
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute($conditions->getParameters());
     while ($row = $statement->fetchArray()) {
         $packageDir = FileUtil::getRealPath(WCF_DIR . $row['packageDir']);
         try {
             CacheHandler::getInstance()->clear($packageDir . 'cache', '*.php');
         } catch (SystemException $e) {
         }
     }
     $this->executed();
     HeaderUtil::redirect(LinkHandler::getInstance()->getLink('CacheList'));
     exit;
 }
开发者ID:ZerGabriel,项目名称:WCF,代码行数:26,代码来源:CacheClearAction.class.php

示例10: resetCache

 /**
  * @see wcf\data\IEditableCachedObject::resetCache()
  */
 public static function resetCache()
 {
     // reset cache
     CacheHandler::getInstance()->clear(WCF_DIR . 'cache', 'cache.option-*.php');
     // reset options.inc.php files
     $sql = "SELECT\tpackage, packageID, packageDir\n\t\t\tFROM\twcf" . WCF_N . "_package\n\t\t\tWHERE\tisApplication = ?";
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute(array(1));
     while ($row = $statement->fetchArray()) {
         if ($row['package'] == 'com.woltlab.wcf') {
             $packageDir = WCF_DIR;
         } else {
             $packageDir = FileUtil::getRealPath(WCF_DIR . $row['packageDir']);
         }
         $filename = FileUtil::addTrailingSlash($packageDir) . self::FILENAME;
         if (file_exists($filename)) {
             if (!@touch($filename, 1)) {
                 if (!@unlink($filename)) {
                     self::rebuildFile($filename, $row['packageID']);
                 }
             }
         }
     }
 }
开发者ID:ZerGabriel,项目名称:WCF,代码行数:27,代码来源:OptionEditor.class.php

示例11: export


//.........这里部分代码省略.........
     $xml->beginDocument('variables', 'http://www.woltlab.com', 'http://www.woltlab.com/XSD/maelstrom/styleVariables.xsd');
     // get variables
     $sql = "SELECT\t\tvariable.variableName, value.variableValue\n\t\t\tFROM\t\twcf" . WCF_N . "_style_variable_value value\n\t\t\tLEFT JOIN\twcf" . WCF_N . "_style_variable variable\n\t\t\tON\t\t(variable.variableID = value.variableID)\n\t\t\tWHERE\t\tvalue.styleID = ?";
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute(array($this->styleID));
     while ($row = $statement->fetchArray()) {
         $xml->writeElement('variable', $row['variableValue'], array('name' => $row['variableName']));
     }
     // append variable list to style tar
     $styleTar->addString('variables.xml', $xml->endDocument());
     unset($string);
     if ($templates && $this->templateGroupID) {
         $templateGroup = new TemplateGroup($this->templateGroupID);
         // create templates tar
         $templatesTarName = FileUtil::getTemporaryFilename('templates', '.tar');
         $templatesTar = new TarWriter($templatesTarName);
         FileUtil::makeWritable($templatesTarName);
         // append templates to tar
         // get templates
         $sql = "SELECT\t\ttemplate.*, package.package\n\t\t\t\tFROM\t\twcf" . WCF_N . "_template template\n\t\t\t\tLEFT JOIN\twcf" . WCF_N . "_package package\n\t\t\t\tON\t\t(package.packageID = template.packageID)\n\t\t\t\tWHERE\t\ttemplate.templateGroupID = ?";
         $statement = WCF::getDB()->prepareStatement($sql);
         $statement->execute(array($this->templateGroupID));
         while ($row = $statement->fetchArray()) {
             $packageDir = 'com.woltlab.wcf';
             $package = null;
             if ($row['application'] != 'wcf') {
                 $application = ApplicationHandler::getInstance()->getApplication($row['application']);
                 $package = PackageCache::getInstance()->getPackage($application->packageID);
                 $packageDir = $package->package;
             } else {
                 $application = ApplicationHandler::getInstance()->getWCF();
                 $package = PackageCache::getInstance()->getPackage($application->packageID);
             }
             $filename = FileUtil::addTrailingSlash(FileUtil::getRealPath(WCF_DIR . $package->packageDir . 'templates/' . $templateGroup->templateGroupFolderName)) . $row['templateName'] . '.tpl';
             $templatesTar->add($filename, $packageDir, dirname($filename));
         }
         // append templates tar to style tar
         $templatesTar->create();
         $styleTar->add($templatesTarName, 'templates.tar', $templatesTarName);
         @unlink($templatesTarName);
     }
     if ($images && ($this->imagePath && $this->imagePath != 'images/')) {
         // create images tar
         $imagesTarName = FileUtil::getTemporaryFilename('images_', '.tar');
         $imagesTar = new TarWriter($imagesTarName);
         FileUtil::makeWritable($imagesTarName);
         // append images to tar
         $path = FileUtil::addTrailingSlash(WCF_DIR . $this->imagePath);
         if (file_exists($path) && is_dir($path)) {
             $handle = opendir($path);
             $regEx = new Regex('\\.(jpg|jpeg|gif|png|svg)$', Regex::CASE_INSENSITIVE);
             while (($file = readdir($handle)) !== false) {
                 if (is_file($path . $file) && $regEx->match($file)) {
                     $imagesTar->add($path . $file, '', $path);
                 }
             }
         }
         // append images tar to style tar
         $imagesTar->create();
         $styleTar->add($imagesTarName, 'images.tar', $imagesTarName);
         @unlink($imagesTarName);
     }
     // output file content
     $styleTar->create();
     // export as style package
     if (empty($packageName)) {
开发者ID:nick-strohm,项目名称:WCF,代码行数:67,代码来源:StyleEditor.class.php

示例12: promptPackageDir

 /**
  * Prompts for a text input for package directory (applies for applications only)
  * 
  * @return	\wcf\system\form\FormDocument
  */
 protected function promptPackageDir()
 {
     if (!PackageInstallationFormManager::findForm($this->queue, 'packageDir')) {
         $container = new GroupFormElementContainer();
         $packageDir = new TextInputFormElement($container);
         $packageDir->setName('packageDir');
         $packageDir->setLabel(WCF::getLanguage()->get('wcf.acp.package.packageDir.input'));
         $defaultPath = FileUtil::addTrailingSlash(FileUtil::unifyDirSeparator(dirname(WCF_DIR)));
         // check if there is already an application
         $sql = "SELECT\tCOUNT(*) AS count\n\t\t\t\tFROM\twcf" . WCF_N . "_package\n\t\t\t\tWHERE\tpackageDir = ?";
         $statement = WCF::getDB()->prepareStatement($sql);
         $statement->execute(array('../'));
         $row = $statement->fetchArray();
         if ($row['count']) {
             // use abbreviation
             $defaultPath .= strtolower(Package::getAbbreviation($this->getPackage()->package)) . '/';
         }
         $packageDir->setValue($defaultPath);
         $container->appendChild($packageDir);
         $document = new FormDocument('packageDir');
         $document->appendContainer($container);
         PackageInstallationFormManager::registerForm($this->queue, $document);
         return $document;
     } else {
         $document = PackageInstallationFormManager::getForm($this->queue, 'packageDir');
         $document->handleRequest();
         $packageDir = FileUtil::addTrailingSlash(FileUtil::getRealPath(FileUtil::unifyDirSeparator($document->getValue('packageDir'))));
         if ($packageDir === '/') {
             $packageDir = '';
         }
         if ($packageDir !== null) {
             // validate package dir
             if (file_exists($packageDir . 'global.php')) {
                 $document->setError('packageDir', WCF::getLanguage()->get('wcf.acp.package.packageDir.notAvailable'));
                 return $document;
             }
             // set package dir
             $packageEditor = new PackageEditor($this->getPackage());
             $packageEditor->update(array('packageDir' => FileUtil::getRelativePath(WCF_DIR, $packageDir)));
             // determine domain path, in some environments (e.g. ISPConfig) the $_SERVER paths are
             // faked and differ from the real filesystem path
             if (PACKAGE_ID) {
                 $wcfDomainPath = ApplicationHandler::getInstance()->getWCF()->domainPath;
             } else {
                 $sql = "SELECT\tdomainPath\n\t\t\t\t\t\tFROM\twcf" . WCF_N . "_application\n\t\t\t\t\t\tWHERE\tpackageID = ?";
                 $statement = WCF::getDB()->prepareStatement($sql);
                 $statement->execute(array(1));
                 $row = $statement->fetchArray();
                 $wcfDomainPath = $row['domainPath'];
             }
             $documentRoot = str_replace($wcfDomainPath, '', FileUtil::unifyDirSeparator(WCF_DIR));
             $domainPath = str_replace($documentRoot, '', $packageDir);
             // update application path
             $application = new Application($this->getPackage()->packageID);
             $applicationEditor = new ApplicationEditor($application);
             $applicationEditor->update(array('domainPath' => $domainPath, 'cookiePath' => $domainPath));
             // create directory and set permissions
             @mkdir($packageDir, 0777, true);
             FileUtil::makeWritable($packageDir);
         }
         return null;
     }
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:68,代码来源:PackageInstallationDispatcher.class.php

示例13: loadRuntimeApplication

 /**
  * Loads an application on runtime, do not use this outside the package installation.
  * 
  * @param	integer		$packageID
  */
 public static function loadRuntimeApplication($packageID)
 {
     $package = new Package($packageID);
     $application = new Application($packageID);
     $abbreviation = Package::getAbbreviation($package->package);
     $packageDir = FileUtil::getRealPath(WCF_DIR . $package->packageDir);
     self::$autoloadDirectories[$abbreviation] = $packageDir . 'lib/';
     self::$applications[$abbreviation] = $application;
     self::getTPL()->addApplication($abbreviation, $packageDir . 'acp/templates/');
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:15,代码来源:WCF.class.php

示例14: exportGalleryImages

 /**
  * Exports gallery images.
  */
 public function exportGalleryImages($offset, $limit)
 {
     $sourceVersion21 = version_compare($this->getPackageVersion('com.woltlab.gallery'), '2.1.0 Alpha 1', '>=');
     $destVersion21 = version_compare(\gallery\system\GALLERYCore::getInstance()->getPackage()->packageVersion, '2.1.0 Alpha 1', '>=');
     // build path to gallery image directories
     $sql = "SELECT\tpackageDir\n\t\t\tFROM\twcf" . $this->dbNo . "_package\n\t\t\tWHERE\tpackage = ?";
     $statement = $this->database->prepareStatement($sql, 1);
     $statement->execute(array('com.woltlab.gallery'));
     $packageDir = $statement->fetchColumn();
     $imageFilePath = FileUtil::getRealPath($this->fileSystemPath . '/' . $packageDir);
     // fetch image data
     $sql = "SELECT\t\t*\n\t\t\tFROM\t\tgallery" . $this->dbNo . "_image\n\t\t\tWHERE\t\timageID BETWEEN ? AND ?\n\t\t\tORDER BY\timageID";
     $statement = $this->database->prepareStatement($sql);
     $statement->execute(array($offset + 1, $offset + $limit));
     $imageIDs = $images = array();
     while ($row = $statement->fetchArray()) {
         $imageIDs[] = $row['imageID'];
         $images[$row['imageID']] = array('tmpHash' => $row['tmpHash'], 'userID' => $row['userID'], 'username' => $row['username'], 'albumID' => $row['albumID'], 'title' => $row['title'], 'description' => $row['description'], 'filename' => $row['filename'], 'fileExtension' => $row['fileExtension'], 'fileHash' => $row['fileHash'], 'filesize' => $row['filesize'], 'comments' => $row['comments'], 'views' => $row['views'], 'comments' => $row['comments'], 'cumulativeLikes' => $row['cumulativeLikes'], 'uploadTime' => $row['uploadTime'], 'creationTime' => $row['creationTime'], 'width' => $row['width'], 'creationTime' => $row['creationTime'], 'height' => $row['height'], 'orientation' => $row['orientation'], 'camera' => $row['camera'], 'location' => $row['location'], 'latitude' => $row['latitude'], 'longitude' => $row['longitude'], 'thumbnailX' => $row['thumbnailX'], 'thumbnailY' => $row['thumbnailY'], 'thumbnailHeight' => $row['thumbnailHeight'], 'thumbnailWidth' => $row['thumbnailWidth'], 'tinyThumbnailSize' => $row['tinyThumbnailSize'], 'smallThumbnailSize' => $row['smallThumbnailSize'], 'mediumThumbnailSize' => $row['mediumThumbnailSize'], 'largeThumbnailSize' => $row['largeThumbnailSize'], 'ipAddress' => $row['ipAddress'], 'enableComments' => $row['enableComments'], 'isDisabled' => $row['isDisabled'], 'isDeleted' => $row['isDeleted'], 'deleteTime' => $row['deleteTime'], 'exifData' => $row['exifData']);
         if ($sourceVersion21 && $destVersion21) {
             $images[$row['imageID']] = array_merge($images[$row['imageID']], array('enableSmilies' => $row['enableSmilies'], 'enableHtml' => $row['enableHtml'], 'enableBBCodes' => $row['enableBBCodes'], 'rawExifData' => $row['rawExifData'], 'hasEmbeddedObjects' => $row['hasEmbeddedObjects'], 'hasMarkers' => $row['hasMarkers'], 'showOrder' => $row['showOrder'], 'hasOriginalWatermark' => $row['hasOriginalWatermark']));
         }
     }
     if (empty($imageIDs)) {
         return;
     }
     // fetch tags
     $tags = $this->getTags('com.woltlab.gallery.image', $imageIDs);
     // fetch categories
     $categories = array();
     $conditionBuilder = new PreparedStatementConditionBuilder();
     $conditionBuilder->add('imageID IN (?)', array($imageIDs));
     $sql = "SELECT\t\t*\n\t\t\tFROM\t\tgallery" . $this->dbNo . "_image_to_category\n\t\t\t" . $conditionBuilder;
     $statement = $this->database->prepareStatement($sql);
     $statement->execute($conditionBuilder->getParameters());
     while ($row = $statement->fetchArray()) {
         if (!isset($categories[$row['imageID']])) {
             $categories[$row['imageID']] = array();
         }
         $categories[$row['imageID']][] = $row['categoryID'];
     }
     foreach ($images as $imageID => $imageData) {
         $additionalData = array('fileLocation' => $imageFilePath . '/userImages/' . substr($imageData['fileHash'], 0, 2) . '/' . $imageID . '-' . $imageData['fileHash'] . '.' . $imageData['fileExtension']);
         if (isset($categories[$imageID])) {
             $additionalData['categories'] = $categories[$imageID];
         }
         if (isset($tags[$imageID])) {
             $additionalData['tags'] = $tags[$imageID];
         }
         ImportHandler::getInstance()->getImporter('com.woltlab.gallery.image')->import($imageID, $imageData, $additionalData);
     }
 }
开发者ID:NurPech,项目名称:com.woltlab.wcf.exporter,代码行数:54,代码来源:WBB4xExporter.class.php

示例15: loadApplication

 /**
  * Loads an application.
  *
  * @param	wcf\data\application\Application		$application
  * @param	boolean						$isDependentApplication
  */
 protected function loadApplication(Application $application, $isDependentApplication = false)
 {
     $package = PackageCache::getInstance()->getPackage($application->packageID);
     $abbreviation = ApplicationHandler::getInstance()->getAbbreviation($application->packageID);
     $packageDir = util\FileUtil::getRealPath(WCF_DIR . $package->packageDir);
     self::$autoloadDirectories[$abbreviation] = $packageDir . 'lib/';
     $className = $abbreviation . '\\system\\' . strtoupper($abbreviation) . 'Core';
     if (class_exists($className) && util\ClassUtil::isInstanceOf($className, 'wcf\\system\\application\\IApplication')) {
         // include config file
         $configPath = $packageDir . PackageInstallationDispatcher::CONFIG_FILE;
         if (file_exists($configPath)) {
             require_once $configPath;
         } else {
             throw new exception\SystemException('Unable to load configuration for ' . $package->package);
         }
         // start application if not within ACP
         if (!class_exists('wcf\\system\\WCFACP', false)) {
             call_user_func(array($className, 'getInstance'));
         }
     } else {
         unset(self::$autoloadDirectories[$abbreviation]);
         throw new exception\SystemException("Unable to run '" . $package->package . "', '" . $className . "' is missing or does not implement 'wcf\\system\\application\\IApplication'.");
     }
     // load options
     $this->loadOptions($packageDir . 'options.inc.php', $application->packageID);
     // register template path in ACP
     if (class_exists('wcf\\system\\WCFACP', false)) {
         $this->getTPL()->addTemplatePath($application->packageID, $packageDir . 'acp/templates/');
     } else {
         if (!$isDependentApplication) {
             // assign base tag
             $this->getTPL()->assign('baseHref', $application->domainName . $application->domainPath);
         }
     }
     // register application
     self::$applications[$abbreviation] = $application;
 }
开发者ID:ZerGabriel,项目名称:WCF,代码行数:43,代码来源:WCF.class.php


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