Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Sat, Nov 8, 9:36 PM

in-portal

Index: trunk/admin/editor/cmseditor/editor/filemanager/browser/default/connectors/php/connector.php
===================================================================
--- trunk/admin/editor/cmseditor/editor/filemanager/browser/default/connectors/php/connector.php (revision 2815)
+++ trunk/admin/editor/cmseditor/editor/filemanager/browser/default/connectors/php/connector.php (revision 2816)
@@ -1 +1 @@
-<?php /* * FCKeditor - The text editor for internet * Copyright (C) 2003-2004 Frederico Caldeira Knabben * * Licensed under the terms of the GNU Lesser General Public License: * http://www.opensource.org/licenses/lgpl-license.php * * For further information visit: * http://www.fckeditor.net/ * * File Name: connector.php * This is the File Manager Connector for PHP. * * Version: 2.0 RC3 * Modified: 2005-02-08 11:48:55 * * File Authors: * Frederico Caldeira Knabben (fredck@fckeditor.net) */ include('config.php') ; include('util.php') ; include('io.php') ; include('basexml.php') ; include('commands.php') ; // Get the "UserFiles" path. $GLOBALS["UserFilesPath"] = '' ; if ( isset( $Config['UserFilesPath'] ) ) $GLOBALS["UserFilesPath"] = $Config['UserFilesPath'] ; else if ( isset( $_GET['ServerPath'] ) ) $GLOBALS["UserFilesPath"] = $_GET['ServerPath'] ; else $GLOBALS["UserFilesPath"] = '/UserFiles/' ; if ( ! ereg( '/$', $GLOBALS["UserFilesPath"] ) ) $GLOBALS["UserFilesPath"] .= '/' ; // Map the "UserFiles" path to a local directory. //$GLOBALS["UserFilesDirectory"] = GetRootPath() . str_replace( '/', '\\', $GLOBALS["UserFilesPath"] ) ; $GLOBALS["UserFilesDirectory"] = GetRootPath() . $GLOBALS["UserFilesPath"] ; DoResponse() ; function DoResponse() { if ($_GET['Command'] != 'GetCmsTree') { if ( !isset( $_GET['Command'] ) || !isset( $_GET['Type'] ) || !isset( $_GET['CurrentFolder'] ) ) return ; } // Get the main request informaiton. $sCommand = $_GET['Command'] ; $sResourceType = $_GET['Type'] ; $sCurrentFolder = $_GET['CurrentFolder'] ; // Check if it is an allowed type. if ($sCommand != 'GetCmsTree') { if ( !in_array( $sResourceType, array('Files','Images','Flash','Media', 'Documents' ) ) ) return ; } // Check the current folder syntax (must begin and start with a slash). if ( ! ereg( '/$', $sCurrentFolder ) ) $sCurrentFolder .= '/' ; if ( strpos( $sCurrentFolder, '/' ) !== 0 ) $sCurrentFolder = '/' . $sCurrentFolder ; // File Upload doesn't have to Return XML, so it must be intercepted before anything. if ( $sCommand == 'FileUpload' ) { FileUpload( $sResourceType, $sCurrentFolder ) ; return ; } // Prevent the browser from caching the result. // Date in the past header('Expires: Mon, 26 Jul 1997 05:00:00 GMT') ; // always modified header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT') ; // HTTP/1.1 header('Cache-Control: no-store, no-cache, must-revalidate') ; header('Cache-Control: post-check=0, pre-check=0', false) ; // HTTP/1.0 header('Pragma: no-cache') ; // Set the response format. header( 'Content-Type:text/xml; charset=utf-8' ) ; CreateXmlHeader( $sCommand, $sResourceType, $sCurrentFolder ) ; // Execute the required command. switch ( $sCommand ) { case 'GetCmsTree' : GetCmsTree() ; break; case 'GetFolders' : GetFolders( $sResourceType, $sCurrentFolder ) ; break ; case 'GetFoldersAndFiles' : GetFoldersAndFiles( $sResourceType, $sCurrentFolder ) ; break ; case 'CreateFolder' : CreateFolder( $sResourceType, $sCurrentFolder ) ; break ; } CreateXmlFooter() ; exit ; } ?>
\ No newline at end of file
+<?php /* * FCKeditor - The text editor for internet * Copyright (C) 2003-2004 Frederico Caldeira Knabben * * Licensed under the terms of the GNU Lesser General Public License: * http://www.opensource.org/licenses/lgpl-license.php * * For further information visit: * http://www.fckeditor.net/ * * File Name: connector.php * This is the File Manager Connector for PHP. * * Version: 2.0 RC3 * Modified: 2005-02-08 11:48:55 * * File Authors: * Frederico Caldeira Knabben (fredck@fckeditor.net) */ include('config.php') ; include('util.php') ; include('io.php') ; include('basexml.php') ; include('commands.php') ; // Get the "UserFiles" path. $GLOBALS["UserFilesPath"] = '' ; if ( isset( $Config['UserFilesPath'] ) ) $GLOBALS["UserFilesPath"] = $Config['UserFilesPath'] ; else if ( isset( $_GET['ServerPath'] ) ) $GLOBALS["UserFilesPath"] = $_GET['ServerPath'] ; else $GLOBALS["UserFilesPath"] = '/UserFiles/' ; if ( ! ereg( '/$', $GLOBALS["UserFilesPath"] ) ) $GLOBALS["UserFilesPath"] .= '/' ; // Map the "UserFiles" path to a local directory. //$GLOBALS["UserFilesDirectory"] = GetRootPath() . str_replace( '/', '\\', $GLOBALS["UserFilesPath"] ) ; $GLOBALS["UserFilesDirectory"] = GetRootPath() . $GLOBALS["UserFilesPath"] ; DoResponse() ; function DoResponse() { if ($_GET['Command'] != 'GetCmsTree') { if ( !isset( $_GET['Command'] ) || !isset( $_GET['Type'] ) || !isset( $_GET['CurrentFolder'] ) ) return ; } // Get the main request informaiton. $sCommand = $_GET['Command'] ; $sResourceType = $_GET['Type'] ; $sCurrentFolder = $_GET['CurrentFolder'] ; // Check if it is an allowed type. if ($sCommand != 'GetCmsTree') { if ( !in_array( $sResourceType, array('Files','Images','Flash','Media', 'Documents' ) ) ) return ; } // Check the current folder syntax (must begin and start with a slash). if ( ! ereg( '/$', $sCurrentFolder ) ) $sCurrentFolder .= '/' ; if ( strpos( $sCurrentFolder, '/' ) !== 0 ) $sCurrentFolder = '/' . $sCurrentFolder ; // File Upload doesn't have to Return XML, so it must be intercepted before anything. if ( $sCommand == 'FileUpload' ) { FileUpload( $sResourceType, $sCurrentFolder ) ; return ; } // Prevent the browser from caching the result. // Date in the past header('Expires: Mon, 26 Jul 1997 05:00:00 GMT') ; // always modified header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT') ; // HTTP/1.1 header('Cache-Control: no-store, no-cache, must-revalidate') ; header('Cache-Control: post-check=0, pre-check=0', false) ; // HTTP/1.0 header('Pragma: no-cache') ; // Set the response format. header( 'Content-Type:text/xml; charset=utf-8' ) ; CreateXmlHeader( $sCommand, $sResourceType, $sCurrentFolder ) ; // Execute the required command. switch ( $sCommand ) { case 'GetCmsTree' : GetCmsTree() ; break; case 'GetFolders' : GetFolders( $sResourceType, $sCurrentFolder ) ; break ; case 'GetFoldersAndFiles' : GetFoldersAndFiles( $sResourceType, $sCurrentFolder ) ; break ; case 'CreateFolder' : CreateFolder( $sResourceType, $sCurrentFolder ) ; break ; } CreateXmlFooter() ; exit; } ?>
\ No newline at end of file
Property changes on: trunk/admin/editor/cmseditor/editor/filemanager/browser/default/connectors/php/connector.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.1
\ No newline at end of property
+1.2
\ No newline at end of property
Index: trunk/admin/editor/cmseditor/editor/filemanager/browser/default/connectors/php/commands.php
===================================================================
--- trunk/admin/editor/cmseditor/editor/filemanager/browser/default/connectors/php/commands.php (revision 2815)
+++ trunk/admin/editor/cmseditor/editor/filemanager/browser/default/connectors/php/commands.php (revision 2816)
@@ -1 +1 @@
-<?php /* * FCKeditor - The text editor for internet * Copyright (C) 2003-2004 Frederico Caldeira Knabben * * Licensed under the terms of the GNU Lesser General Public License: * http://www.opensource.org/licenses/lgpl-license.php * * For further information visit: * http://www.fckeditor.net/ * * File Name: commands.php * This is the File Manager Connector for ASP. * * Version: 2.0 RC3 * Modified: 2005-02-19 16:02:38 * * File Authors: * Frederico Caldeira Knabben (fredck@fckeditor.net) */ function GetFolders( $resourceType, $currentFolder ) { // Map the virtual path to the local server path. $sServerDir = ServerMapFolder( $resourceType, $currentFolder ) ; // Open the "Folders" node. echo "<Folders>" ; $oCurrentFolder = opendir( $sServerDir ) ; while ( $sFile = readdir( $oCurrentFolder ) ) { if ( $sFile != '.' && $sFile != '..' && $sFile != 'CVS' && is_dir( $sServerDir . $sFile ) ) echo '<Folder name="' . ConvertToXmlAttribute( $sFile ) . '" />' ; } closedir( $oCurrentFolder ) ; // Close the "Folders" node. echo "</Folders>" ; } /* function GetCmsTree() { $conn = GetADODbConnection(); $query="SELECT st.* , wb.eng_content AS page_title FROM structure_templates st LEFT JOIN working_blocks AS wb ON (st.st_id = wb.template_id) AND (wb.block_type = 3) WHERE st_id != '5' AND st_path != '/cms' GROUP BY st_id ORDER BY st_lastupdate desc"; $rs = $conn->Execute($query); if ($rs && !$rs->EOF) { $ret = "<CmsPages>"; while($rs && !$rs->EOF) { $ret.= '<CmsPage path="'.BASE_PATH.'/index.php?t='.$rs->fields['st_path'].'" title="'.$rs->fields['page_title'].'" />'; //echo $rs->fields['page_title']."<br>"; $rs->MoveNext(); } $ret.= '</CmsPages>'; echo $ret; } } */ function GetCmsTree() { global $Config; $ret = "<CmsPages>"; if (isset($Config['K4Mode'])) { $ret.= K4ReadCmsTree(0); } else { $ret.= ReadCmsTree(0); } $ret.= "</CmsPages>"; echo $ret; } function K4ReadCmsTree($cat_id, $level = 0) { $application =& kApplication::Instance(); $application->Init(); $query = 'SELECT Path, Title FROM '.TABLE_PREFIX.'Pages'; $pages = $application->DB->Query($query); $res = ''; foreach ($pages as $page) { $page_path = $page['Path'].'.html'; $title = $page['Title'].' ('.$page_path.')'; $res .= '<CmsPage path="'.$page_path.'" title="'.$prefix.htmlspecialchars($title,ENT_QUOTES).'" serverpath="'.BASE_PATH.'/" />'; } return $res; } function ReadCmsTree($st_id, $level = 0) { $conn = GetADODbConnection(); $query = "SELECT value FROM config WHERE name = 'default_lang_prefix'"; $rs = $conn->Execute($query); if ($rs && !$rs->EOF) { $default_lang_prefix = $rs->fields['value']; } $query = "SELECT value FROM config WHERE name = 'cms_direct_mode'"; $rs = $conn->Execute($query); if ($rs && !$rs->EOF) { $cms_mode = $rs->fields['value']; } $query = "SELECT value FROM config WHERE name = 'email_templates_folder_id'"; $rs = $conn->Execute($query); if ($rs && !$rs->EOF) { $email_templates_folder_id = $rs->fields['value']; } /* $query = "SELECT value FROM config WHERE name = 'custom_cms'"; $rs = $conn->Execute($query); if ($rs && !$rs->EOF) { $custom_cms = $rs->fields['value']; } */ if ( $email_templates_folder_id == "" ) $email_templates_folder_id = 0; if ( $cms_mode == 1 ) { $query = " SELECT st.*, IF(lb.".$default_lang_prefix."_content='' OR lb.".$default_lang_prefix."_content IS NULL, st.st_path, lb.".$default_lang_prefix."_content ) AS page_title FROM structure_templates AS st LEFT JOIN live_blocks AS lb ON (st.st_id = lb.template_id) AND (lb.block_type = 3) WHERE st.st_parent_id = ".$st_id." AND st_id != ".$email_templates_folder_id." AND st_path != '/cms' ORDER BY st.st_order"; } else { $query = " SELECT st.*, IF(wb.".$default_lang_prefix."_content='' OR wb.".$default_lang_prefix."_content IS NULL, st.st_path, wb.".$default_lang_prefix."_content ) AS page_title FROM structure_templates AS st LEFT JOIN working_blocks AS wb ON (st.st_id = wb.template_id) AND (wb.block_type = 3) WHERE st.st_parent_id = ".$st_id." AND st_id != ".$email_templates_folder_id." AND st_path != '/cms%' ORDER BY st.st_order"; } //echo $query." <br>"; $rs = $conn->Execute($query); if ($rs && !$rs->EOF) { while ($rs && !$rs->EOF) { $page_path = ltrim($rs->fields['st_path'], '/'); //$page_path = SERVER_NAME.BASE_PATH.'/index.php?t='.$page_path; //$page_path = $page_path; $prefix=''; for ($i = 0; $i < $level; $i++) $prefix .= '--'; if ($level > 0) $prefix=$prefix.'- '; // $page = ereg_replace("&","&amp;",$rs->fields['page_title']); // $page = ereg_replace("\"","&quot;",$page); // $page = ereg_replace("'","&#039;",$page); // $page = ereg_replace("<","&lt;",$page); // $page = ereg_replace(">","&gt;",$page); // echo $page." <br>"; $page = htmlentities($rs->fields['page_title'],ENT_QUOTES); $page = ereg_replace("&atilde;","a",$page); $res .= '<CmsPage path="'.$page_path.'" title="'.$prefix.$page.'" st_id="'.$rs->fields['st_id'].'" serverpath="'.BASE_PATH.'/index.php?t=" />'; $res .= ReadCmsTree($rs->fields['st_id'], $level+1); $rs->MoveNext(); } return $res; } } function GetFoldersAndFiles( $resourceType, $currentFolder ) { // Map the virtual path to the local server path. $sServerDir = ServerMapFolder( $resourceType, $currentFolder ) ; // Initialize the output buffers for "Folders" and "Files". $sFolders = '<Folders>' ; $sFiles = '<Files>' ; $oCurrentFolder = opendir( $sServerDir ) ; while ( $sFile = readdir( $oCurrentFolder ) ) { if ( $sFile != '.' && $sFile != '..' && $sFile != 'CVS') { if ( is_dir( $sServerDir . $sFile ) ) $sFolders .= '<Folder name="' . ConvertToXmlAttribute( $sFile ) . '" />' ; else { $iFileSize = filesize( $sServerDir . $sFile ) ; if ( $iFileSize > 0 ) { $iFileSize = round( $iFileSize / 1024 ) ; if ( $iFileSize < 1 ) $iFileSize = 1 ; } $sFiles .= '<File name="' . ConvertToXmlAttribute( $sFile ) . '" size="' . $iFileSize . '" />' ; } } } echo $sFolders ; // Close the "Folders" node. echo '</Folders>' ; echo $sFiles ; // Close the "Files" node. echo '</Files>' ; } function CreateFolder( $resourceType, $currentFolder ) { $sErrorNumber = '0' ; $sErrorMsg = '' ; if ( isset( $_GET['NewFolderName'] ) ) { $sNewFolderName = $_GET['NewFolderName'] ; // Map the virtual path to the local server path of the current folder. $sServerDir = ServerMapFolder( $resourceType, $currentFolder ) ; if ( is_writable( $sServerDir ) ) { $sServerDir .= $sNewFolderName ; $sErrorMsg = CreateServerFolder( $sServerDir ) ; switch ( $sErrorMsg ) { case '' : $sErrorNumber = '0' ; break ; case 'Invalid argument' : case 'No such file or directory' : $sErrorNumber = '102' ; // Path too long. break ; default : $sErrorNumber = '110' ; break ; } } else $sErrorNumber = '103' ; } else $sErrorNumber = '102' ; // Create the "Error" node. echo '<Error number="' . $sErrorNumber . '" originalDescription="' . ConvertToXmlAttribute( $sErrorMsg ) . '" />' ; } function FileUpload( $resourceType, $currentFolder ) { $sErrorNumber = '0' ; $sFileName = '' ; if ( isset( $_FILES['NewFile'] ) && !is_null( $_FILES['NewFile']['tmp_name'] ) ) { $oFile = $_FILES['NewFile'] ; // Map the virtual path to the local server path. $sServerDir = ServerMapFolder( $resourceType, $currentFolder ) ; // Get the uploaded file name. $sFileName = $oFile['name'] ; $sOriginalFileName = $sFileName ; $sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) ) ; global $Config ; $arAllowed = $Config['AllowedExtensions'][$resourceType] ; $arDenied = $Config['DeniedExtensions'][$resourceType] ; if ( ( count($arAllowed) == 0 || in_array( $sExtension, $arAllowed ) ) && ( count($arDenied) == 0 || !in_array( $sExtension, $arDenied ) ) ) { $iCounter = 0 ; while ( true ) { $sFilePath = $sServerDir . $sFileName ; if ( is_file( $sFilePath ) ) { $iCounter++ ; $sFileName = RemoveExtension( $sOriginalFileName ) . '(' . $iCounter . ').' . $sExtension ; $sErrorNumber = '201' ; } else { move_uploaded_file( $oFile['tmp_name'], $sFilePath ) ; if ( is_file( $sFilePath ) ) { $oldumask = umask(0) ; chmod( $sFilePath, 0777 ) ; umask( $oldumask ) ; } break ; } } } else $sErrorNumber = '202' ; } else $sErrorNumber = '202' ; echo '<script type="text/javascript">' ; echo 'window.parent.frames["frmUpload"].OnUploadCompleted(' . $sErrorNumber . ',"' . str_replace( '"', '\\"', $sFileName ) . '") ;' ; echo '</script>' ; exit ; } ?>
\ No newline at end of file
+<?php /* * FCKeditor - The text editor for internet * Copyright (C) 2003-2004 Frederico Caldeira Knabben * * Licensed under the terms of the GNU Lesser General Public License: * http://www.opensource.org/licenses/lgpl-license.php * * For further information visit: * http://www.fckeditor.net/ * * File Name: commands.php * This is the File Manager Connector for ASP. * * Version: 2.0 RC3 * Modified: 2005-02-19 16:02:38 * * File Authors: * Frederico Caldeira Knabben (fredck@fckeditor.net) */ function GetFolders( $resourceType, $currentFolder ) { // Map the virtual path to the local server path. $sServerDir = ServerMapFolder( $resourceType, $currentFolder ) ; // Open the "Folders" node. echo "<Folders>" ; $oCurrentFolder = opendir( $sServerDir ) ; while ( $sFile = readdir( $oCurrentFolder ) ) { if ( $sFile != '.' && $sFile != '..' && $sFile != 'CVS' && is_dir( $sServerDir . $sFile ) ) echo '<Folder name="' . ConvertToXmlAttribute( $sFile ) . '" />' ; } closedir( $oCurrentFolder ) ; // Close the "Folders" node. echo "</Folders>" ; } /* function GetCmsTree() { $conn = GetADODbConnection(); $query="SELECT st.* , wb.eng_content AS page_title FROM structure_templates st LEFT JOIN working_blocks AS wb ON (st.st_id = wb.template_id) AND (wb.block_type = 3) WHERE st_id != '5' AND st_path != '/cms' GROUP BY st_id ORDER BY st_lastupdate desc"; $rs = $conn->Execute($query); if ($rs && !$rs->EOF) { $ret = "<CmsPages>"; while($rs && !$rs->EOF) { $ret.= '<CmsPage path="'.BASE_PATH.'/index.php?t='.$rs->fields['st_path'].'" title="'.$rs->fields['page_title'].'" />'; //echo $rs->fields['page_title']."<br>"; $rs->MoveNext(); } $ret.= '</CmsPages>'; echo $ret; } } */ function GetCmsTree() { global $Config; $ret = "<CmsPages>"; if (isset($Config['K4Mode'])) { $ret.= K4ReadCmsTree(0); } else { $ret.= ReadCmsTree(0); } $ret.= "</CmsPages>"; echo $ret; } function K4ReadCmsTree($cat_id, $level = 0) { $application =& kApplication::Instance(); $application->Init(); $query = 'SELECT Path, Title FROM '.TABLE_PREFIX.'Pages'; $pages = $application->DB->Query($query); $res = ''; foreach ($pages as $page) { $page_path = $page['Path'].'.html'; $title = $page['Title'].' ('.$page_path.')'; $res .= '<CmsPage path="'.$page_path.'" title="'.$prefix.htmlspecialchars($title,ENT_QUOTES).'" serverpath="'.BASE_PATH.'/" />'; } return $res; } function ReadCmsTree($st_id, $level = 0) { $conn = GetADODbConnection(); $query = "SELECT value FROM config WHERE name = 'default_lang_prefix'"; $rs = $conn->Execute($query); if ($rs && !$rs->EOF) { $default_lang_prefix = $rs->fields['value']; } $query = "SELECT value FROM config WHERE name = 'cms_direct_mode'"; $rs = $conn->Execute($query); if ($rs && !$rs->EOF) { $cms_mode = $rs->fields['value']; } $query = "SELECT value FROM config WHERE name = 'email_templates_folder_id'"; $rs = $conn->Execute($query); if ($rs && !$rs->EOF) { $email_templates_folder_id = $rs->fields['value']; } /* $query = "SELECT value FROM config WHERE name = 'custom_cms'"; $rs = $conn->Execute($query); if ($rs && !$rs->EOF) { $custom_cms = $rs->fields['value']; } */ if ( $email_templates_folder_id == "" ) $email_templates_folder_id = 0; if ( $cms_mode == 1 ) { $query = " SELECT st.*, IF(lb.".$default_lang_prefix."_content='' OR lb.".$default_lang_prefix."_content IS NULL, st.st_path, lb.".$default_lang_prefix."_content ) AS page_title FROM structure_templates AS st LEFT JOIN live_blocks AS lb ON (st.st_id = lb.template_id) AND (lb.block_type = 3) WHERE st.st_parent_id = ".$st_id." AND st_id != ".$email_templates_folder_id." AND st_path != '/cms' ORDER BY st.st_order"; } else { $query = " SELECT st.*, IF(wb.".$default_lang_prefix."_content='' OR wb.".$default_lang_prefix."_content IS NULL, st.st_path, wb.".$default_lang_prefix."_content ) AS page_title FROM structure_templates AS st LEFT JOIN working_blocks AS wb ON (st.st_id = wb.template_id) AND (wb.block_type = 3) WHERE st.st_parent_id = ".$st_id." AND st_id != ".$email_templates_folder_id." AND st_path != '/cms%' ORDER BY st.st_order"; } //echo $query." <br>"; $rs = $conn->Execute($query); if ($rs && !$rs->EOF) { while ($rs && !$rs->EOF) { $page_path = ltrim($rs->fields['st_path'], '/'); //$page_path = SERVER_NAME.BASE_PATH.'/index.php?t='.$page_path; //$page_path = $page_path; $prefix=''; for ($i = 0; $i < $level; $i++) $prefix .= '--'; if ($level > 0) $prefix=$prefix.'- '; $page = ereg_replace("&","&amp;",$rs->fields['page_title']); $page = ereg_replace("\"","&quot;",$page); $page = ereg_replace("'","&#039;",$page); $page = ereg_replace("<","&lt;",$page); $page = ereg_replace(">","&gt;",$page); // echo $page." <br>"; //$page = htmlentities($rs->fields['page_title'],ENT_QUOTES); $page = $rs->fields['page_title']; $page = ereg_replace("&atilde;","a",$page); $res .= '<CmsPage path="'.$page_path.'" title="'.$prefix.$page.'" st_id="'.$rs->fields['st_id'].'" serverpath="'.BASE_PATH.'/index.php?t=" />'; $res .= ReadCmsTree($rs->fields['st_id'], $level+1); $rs->MoveNext(); } return $res; } } /* $res .= '<CmsPage> <path><![CDATA['.$page_path.']]></path> <title><![CDATA['.$prefix.$page.']]></title> <st_id><![CDATA['.$rs->fields['st_id'].']]></st_id> <serverpath><![CDATA['.BASE_PATH.'/index.php?t=.]]></serverpath> </CmsPage>'; */ function GetFoldersAndFiles( $resourceType, $currentFolder ) { // Map the virtual path to the local server path. $sServerDir = ServerMapFolder( $resourceType, $currentFolder ) ; // Initialize the output buffers for "Folders" and "Files". $sFolders = '<Folders>' ; $sFiles = '<Files>' ; $oCurrentFolder = opendir( $sServerDir ) ; while ( $sFile = readdir( $oCurrentFolder ) ) { if ( $sFile != '.' && $sFile != '..' && $sFile != 'CVS') { if ( is_dir( $sServerDir . $sFile ) ) $sFolders .= '<Folder name="' . ConvertToXmlAttribute( $sFile ) . '" />' ; else { $iFileSize = filesize( $sServerDir . $sFile ) ; if ( $iFileSize > 0 ) { $iFileSize = round( $iFileSize / 1024 ) ; if ( $iFileSize < 1 ) $iFileSize = 1 ; } $sFiles .= '<File name="' . ConvertToXmlAttribute( $sFile ) . '" size="' . $iFileSize . '" />' ; } } } echo $sFolders ; // Close the "Folders" node. echo '</Folders>' ; echo $sFiles ; // Close the "Files" node. echo '</Files>' ; } function CreateFolder( $resourceType, $currentFolder ) { $sErrorNumber = '0' ; $sErrorMsg = '' ; if ( isset( $_GET['NewFolderName'] ) ) { $sNewFolderName = $_GET['NewFolderName'] ; // Map the virtual path to the local server path of the current folder. $sServerDir = ServerMapFolder( $resourceType, $currentFolder ) ; if ( is_writable( $sServerDir ) ) { $sServerDir .= $sNewFolderName ; $sErrorMsg = CreateServerFolder( $sServerDir ) ; switch ( $sErrorMsg ) { case '' : $sErrorNumber = '0' ; break ; case 'Invalid argument' : case 'No such file or directory' : $sErrorNumber = '102' ; // Path too long. break ; default : $sErrorNumber = '110' ; break ; } } else $sErrorNumber = '103' ; } else $sErrorNumber = '102' ; // Create the "Error" node. echo '<Error number="' . $sErrorNumber . '" originalDescription="' . ConvertToXmlAttribute( $sErrorMsg ) . '" />' ; } function FileUpload( $resourceType, $currentFolder ) { $sErrorNumber = '0' ; $sFileName = '' ; if ( isset( $_FILES['NewFile'] ) && !is_null( $_FILES['NewFile']['tmp_name'] ) ) { $oFile = $_FILES['NewFile'] ; // Map the virtual path to the local server path. $sServerDir = ServerMapFolder( $resourceType, $currentFolder ) ; // Get the uploaded file name. $sFileName = $oFile['name'] ; $sOriginalFileName = $sFileName ; $sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) ) ; global $Config ; $arAllowed = $Config['AllowedExtensions'][$resourceType] ; $arDenied = $Config['DeniedExtensions'][$resourceType] ; if ( ( count($arAllowed) == 0 || in_array( $sExtension, $arAllowed ) ) && ( count($arDenied) == 0 || !in_array( $sExtension, $arDenied ) ) ) { $iCounter = 0 ; while ( true ) { $sFilePath = $sServerDir . $sFileName ; if ( is_file( $sFilePath ) ) { $iCounter++ ; $sFileName = RemoveExtension( $sOriginalFileName ) . '(' . $iCounter . ').' . $sExtension ; $sErrorNumber = '201' ; } else { move_uploaded_file( $oFile['tmp_name'], $sFilePath ) ; if ( is_file( $sFilePath ) ) { $oldumask = umask(0) ; chmod( $sFilePath, 0777 ) ; umask( $oldumask ) ; } break ; } } } else $sErrorNumber = '202' ; } else $sErrorNumber = '202' ; echo '<script type="text/javascript">' ; echo 'window.parent.frames["frmUpload"].OnUploadCompleted(' . $sErrorNumber . ',"' . str_replace( '"', '\\"', $sFileName ) . '") ;' ; echo '</script>' ; exit ; } ?>
\ No newline at end of file
Property changes on: trunk/admin/editor/cmseditor/editor/filemanager/browser/default/connectors/php/commands.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.13
\ No newline at end of property
+1.14
\ No newline at end of property

Event Timeline