本文整理汇总了PHP中Ckfinder_Connector_Utils_XmlNode类的典型用法代码示例。如果您正苦于以下问题:PHP Ckfinder_Connector_Utils_XmlNode类的具体用法?PHP Ckfinder_Connector_Utils_XmlNode怎么用?PHP Ckfinder_Connector_Utils_XmlNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Ckfinder_Connector_Utils_XmlNode类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendResponse
/**
* send response
* @access public
*
*/
function sendResponse()
{
$xml =& CKFinder_Connector_Core_Factory::getInstance("Core_Xml");
$this->_connectorNode =& $xml->getConnectorNode();
$this->checkConnector();
if ($this->mustCheckRequest()) {
$this->checkRequest();
}
$resourceTypeName = $this->_currentFolder->getResourceTypeName();
if (!empty($resourceTypeName)) {
$this->_connectorNode->addAttribute("resourceType", $this->_currentFolder->getResourceTypeName());
}
if ($this->mustAddCurrentFolderNode()) {
$_currentFolder = new Ckfinder_Connector_Utils_XmlNode("CurrentFolder");
$this->_connectorNode->addChild($_currentFolder);
$_currentFolder->addAttribute("path", CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($this->_currentFolder->getClientPath()));
$this->_errorHandler->setCatchAllErros(true);
$_url = $this->_currentFolder->getUrl();
$_currentFolder->addAttribute("url", is_null($_url) ? "" : CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($_url));
$this->_errorHandler->setCatchAllErros(false);
$_currentFolder->addAttribute("acl", $this->_currentFolder->getAclMask());
}
$this->buildXml();
$_oErrorNode =& $xml->getErrorNode();
$_oErrorNode->addAttribute("number", "0");
echo $this->_connectorNode->asXML();
exit;
}
示例2: buildXml
function buildXml()
{
// A "must have", checking whether the connector is enabled and the basic parameters (like current folder) are safe.
$this->checkConnector();
$this->checkRequest();
// Checking ACL permissions, we're just getting an information about a file, so FILE_VIEW permission seems to be ok.
if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_VIEW)) {
$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
}
// Make sure we actually received a file name
if (!isset($_GET["fileName"])) {
$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
}
$fileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($_GET["fileName"]);
$resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
// Use the resource type configuration object to check whether the extension of a file to check is really allowed.
if (!$resourceTypeInfo->checkExtension($fileName)) {
$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_EXTENSION);
}
// Make sure that the file name is really ok and has not been sent by a hacker
if (!CKFinder_Connector_Utils_FileSystem::checkFileName($fileName) || $resourceTypeInfo->checkIsHiddenFile($fileName)) {
$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
}
$filePath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $fileName);
if (!file_exists($filePath) || !is_file($filePath)) {
$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FILE_NOT_FOUND);
}
//set session values to be check by process.php upon returning from pixlr.com
$maketoken = md5(session_id());
$_SESSION['pixlr']['token'] = substr($maketoken, 0, 16);
$_SESSION['pixlr']['ImagePath'] = $filePath;
$_SESSION['pixlr']['clientImagePath'] = $this->_currentFolder->getUrl();
// ie: /CMSfiles/images/subdirectory/
$_SESSION['pixlr']['fileName'] = $fileName;
$_SESSION['pixlr']['return'] = $_SERVER['HTTP_REFERER'];
$thumbFolder = $this->_currentFolder->getThumbsServerPath();
$_SESSION['pixlr']['thumbLocation'] = $thumbFolder . $fileName;
//get the client-side absolute path to the image being edited
$absolute_filePath = "http://" . $_SERVER['HTTP_HOST'] . $_SESSION['pixlr']['clientImagePath'] . $_SESSION['pixlr']['fileName'];
//get teh directory this plugin is in so we can return to the process.php script in this folder
$pluginFolder = dirname(__FILE__);
//the directory holding this plugin
//make the directory a client-side absolute URL
$clientPluginFolder = preg_replace("@" . $_SERVER['DOCUMENT_ROOT'] . "@", "http://" . $_SERVER['HTTP_HOST'], $pluginFolder);
//parameters to send to pixlr.com
$pixlr_params = array("referrer" => $_SERVER['HTTP_HOST'], "loc" => "en", "exit" => $_SERVER['HTTP_REFERER'] != "" ? urlencode($_SERVER['HTTP_REFERER']) : "http://www.pixlr.com", "image" => $absolute_filePath, "title" => $fileName, "method" => "GET", "target" => urlencode($clientPluginFolder . "/process.php?token=" . $_SESSION['pixlr']['token']), "locktarget" => "TRUE", "locktitle" => "TRUE", "locktype" => "TRUE", "lockquality" => "80");
$pixlr_link = "http://www.pixlr.com/editor?";
foreach ($pixlr_params as $key => $val) {
$pixlr_link .= $key . "=" . $val . "&";
}
$pixlr_link = rtrim($pixlr_link, "&");
$oNode = new Ckfinder_Connector_Utils_XmlNode("Pixlr");
$oNode->addAttribute("pixlr_link", $pixlr_link);
$this->_connectorNode->addChild($oNode);
}
示例3: buildXml
function buildXml()
{
// A "must have", checking whether the connector is enabled and the basic parameters (like current folder) are safe.
$this->checkConnector();
$this->checkRequest();
// Checking ACL permissions, we're just getting an information about a file, so FILE_VIEW permission seems to be ok.
if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_VIEW)) {
$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
}
// Make sure we actually received a file name
if (!isset($_GET["fileName"])) {
$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
}
$fileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($_GET["fileName"]);
$resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
// Use the resource type configuration object to check whether the extension of a file to check is really allowed.
if (!$resourceTypeInfo->checkExtension($fileName)) {
$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_EXTENSION);
}
// Make sure that the file name is really ok and has not been sent by a hacker
if (!CKFinder_Connector_Utils_FileSystem::checkFileName($fileName) || $resourceTypeInfo->checkIsHiddenFile($fileName)) {
$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
}
$filePath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $fileName);
if (!file_exists($filePath) || !is_file($filePath)) {
$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FILE_NOT_FOUND);
}
$size = filesize($filePath);
// *** The main part of this plugin ****
// Adding a <FileSize> element to the XML response.
//$oNode = new Ckfinder_Connector_Utils_XmlNode("FileSize");
//$oNode->addAttribute("size", $size);
//$this->_connectorNode->addChild($oNode);
$myNode = new Ckfinder_Connector_Utils_XmlNode("MyMessage");
$myNode->addAttribute("message", "Hello world!");
$this->_connectorNode->addChild($myNode);
}
示例4: buildXml
/**
* handle request and build XML
* @access protected
*
*/
function buildXml()
{
$this->checkConnector();
$this->checkRequest();
if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_VIEW)) {
$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
}
$resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
if (!isset($_GET["fileName"])) {
$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
}
$fileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($_GET["fileName"]);
if (!CKFinder_Connector_Utils_FileSystem::checkFileName($fileName) || $resourceTypeInfo->checkIsHiddenFile($fileName)) {
$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
}
if (!$resourceTypeInfo->checkExtension($fileName, false)) {
$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
}
$filePath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $fileName);
if (!file_exists($filePath) || !is_file($filePath)) {
$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FILE_NOT_FOUND);
}
list($width, $height) = getimagesize($filePath);
$oNode = new Ckfinder_Connector_Utils_XmlNode("ImageInfo");
$oNode->addAttribute("width", $width);
$oNode->addAttribute("height", $height);
$this->_connectorNode->addChild($oNode);
}
示例5: raiseError
/**
* Send error message to the browser. If error number is set to 1, $text (custom error message) will be displayed
* Don't call this function directly
*
* @access public
* @param int $number error number
* @param string $text Custom error message (optional)
*/
public function raiseError($number, $text = false)
{
$this->_errorNode->addAttribute("number", intval($number));
if (false != $text) {
$this->_errorNode->addAttribute("text", $text);
}
echo $this->_connectorNode->asXML();
}