Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Sun, Feb 2, 3:40 PM

in-portal

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 1480)
+++ trunk/admin/editor/cmseditor/editor/filemanager/browser/default/connectors/php/commands.php (revision 1481)
@@ -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 != '..' && 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() { $ret = "<CmsPages>"; $ret.= ReadCmsTree(0); $ret.= "</CmsPages>"; echo $ret; } function ReadCmsTree($st_id, $level = 0) { $conn = GetADODbConnection(); $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']; } if ( $email_templates_folder_id == "" ) $email_templates_folder_id = 0; if ( $cms_mode == 1 ) { $query = " SELECT st.st_path AS page_title, st.* FROM structure_templates AS st WHERE st.st_parent_id = ".$st_id." AND st_id != ".$email_templates_folder_id." AND st_path != '/cms'"; } else { $query = "SELECT st.*, wb.eng_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'"; } //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.'- '; $res .= '<CmsPage path="'.$page_path.'" title="'.$prefix.htmlspecialchars($rs->fields['page_title']).'" 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 != '..' ) { 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 != '..' && 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() { $ret = "<CmsPages>"; $ret.= ReadCmsTree(0); $ret.= "</CmsPages>"; echo $ret; } function ReadCmsTree($st_id, $level = 0) { $conn = GetADODbConnection(); $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']; } if ( $email_templates_folder_id == "" ) $email_templates_folder_id = 0; if ( $cms_mode == 1 ) { $query = " SELECT st.*, IF(lb.eng_content='' OR lb.eng_content IS NULL, st.st_path, lb.eng_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.eng_content='' OR wb.eng_content IS NULL, st.st_path, wb.eng_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.'- '; $res .= '<CmsPage path="'.$page_path.'" title="'.$prefix.htmlspecialchars($rs->fields['page_title'],ENT_QUOTES).'" 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 != '..' ) { 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.3
\ No newline at end of property
+1.4
\ No newline at end of property

Event Timeline