Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Wed, Jul 16, 5:46 AM

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 3321)
+++ trunk/admin/editor/cmseditor/editor/filemanager/browser/default/connectors/php/commands.php (revision 3322)
@@ -1,317 +1,317 @@
-<?php
+<?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>';
+ $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';
+
+ $query = 'SELECT Path, Title FROM '.TABLE_PREFIX.'Pages ORDER By Title';
$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.'/" />';
+ $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 ) {
+*/
+ 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
+ ) AS page_title
+ FROM
structure_templates AS st
LEFT JOIN
- live_blocks AS lb
+ 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."
+ 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.*,
+ 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
+ ) AS page_title
+ FROM
structure_templates AS st
LEFT JOIN
- working_blocks AS wb
+ 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."
+ 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;
+ 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='';
+ $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 ;
}
?>
Property changes on: trunk/admin/editor/cmseditor/editor/filemanager/browser/default/connectors/php/commands.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.15
\ No newline at end of property
+1.16
\ No newline at end of property

Event Timeline