Index: trunk/admin/editor/cmseditor/editor/filemanager/browser/default/connectors/php/commands.php
===================================================================
diff -u -r6797 -r7373
--- trunk/admin/editor/cmseditor/editor/filemanager/browser/default/connectors/php/commands.php (.../commands.php) (revision 6797)
+++ trunk/admin/editor/cmseditor/editor/filemanager/browser/default/connectors/php/commands.php (.../commands.php) (revision 7373)
@@ -32,65 +32,43 @@
$aFolders[] = $sFile;
//echo '' ;
}
-
+
if (count($aFolders) > 0) {
natcasesort($aFolders);
foreach($aFolders AS $k=>$v) {
echo '' ;
- }
+ }
}
-
-
+
+
closedir( $oCurrentFolder ) ;
// Close the "Folders" node.
echo "" ;
}
-function ValidateAdminSid()
-{
- $conn = GetADODbConnection();
- $session_time = GetConfigValue('ses_timeout')+0;
- $sid = ($_COOKIE['admin_sid'])?$_COOKIE['admin_sid']:$_COOKIE['sid'];
- $sql = "SELECT count( sd.sid )
- FROM session_data AS sd
- LEFT JOIN sessions AS s ON s.sid = sd.sid
- WHERE sd.`name` = 'admin_mode'
- AND sd.`value` = '1'
- AND sd.sid = '".$sid."'
- AND s.expire + '".$session_time."' > unix_timestamp()";
- if ($conn->GetOne($sql) > 0) {
- return true;
-}
-
-function ValidateUserSid()
-{
- $conn = GetADODbConnection();
- $session_time = GetConfigValue('ses_timeout')+0;
- $sid = $_COOKIE['sid'];
- $sql = "SELECT count( sd.sid )
- FROM sessions
- sid = '".$sid."'
- AND expire + '".$session_time."' > unix_timestamp()";
- }
- if ($conn->GetOne($sql) > 0)
- return true;
-}
-
function ValidateSID()
-{ global $Config;
+{
if (isset($Config['K4Mode']))
return true;
else {
- if ($Config['validate_type'] == 'user')
- return ValidateUserSid();
- elseif ($Config['validate_type'] == 'admin')
- return ValidateAdminSid();
- else
+ $conn = GetADODbConnection();
+ $session_time = GetConfigValue('ses_timeout')+0;
+ $sid = $_COOKIE['admin_sid'];
+ $sql = "SELECT count( sd.sid )
+ FROM session_data AS sd
+ LEFT JOIN sessions AS s ON s.sid = sd.sid
+ WHERE sd.`name` = 'admin_mode'
+ AND sd.`value` = '1'
+ AND sd.sid = '".$sid."'
+ AND s.expire + '".$session_time."' > unix_timestamp()";
+ if ($conn->GetOne($sql) > 0) {
+ return true;
+ } else {
echo "SESSION Validation FALSE";
-
+ }
}
return false;
-}
+}
function GetCmsTree()
{
@@ -133,6 +111,7 @@
if ($rs && !$rs->EOF)
{
$default_lang_prefix = $rs->fields['value'];
+ $lang_prefix = GetLangFromSid();
}
$query = "SELECT value FROM config WHERE name = 'cms_direct_mode'";
$rs = $conn->Execute($query);
@@ -165,12 +144,11 @@
if (!$system_tpl_ids)
$system_tpl_ids = '0';
if ( $cms_mode == 1 ) {
- //$lang_prefix = $this->Application->GetVar('lang_prefix');
$query = "
SELECT st.*,
- IF(lb.".$default_lang_prefix."_content='' OR lb.".$default_lang_prefix."_content IS NULL,
+ IF(lb.".$lang_prefix."_content='' OR lb.".$lang_prefix."_content IS NULL,
st.st_path,
- lb.".$default_lang_prefix."_content
+ lb.".$lang_prefix."_content
) AS page_title
FROM
structure_templates AS st
@@ -181,7 +159,7 @@
WHERE st.st_parent_id = ".$st_id."
AND st_id != ".$email_templates_folder_id."
AND st.st_id NOT IN ($system_tpl_ids)
- AND st_path != '/cms'" . $filter . "
+ AND st_path != '/cms' " . $filter . "
ORDER BY st.st_order";
}
else {
@@ -197,13 +175,14 @@
working_blocks AS wb
ON
(st.st_id = wb.template_id) AND (wb.block_type = 3)
- WHERE st.st_parent_id = ".$st_id."
+ WHERE
+ st.st_parent_id = ".$st_id."
AND st_id != ".$email_templates_folder_id."
AND st.st_id NOT IN ($system_tpl_ids)
- AND st_path != '/cms%'" . $filter . "
+ AND st_path != '/cms%' " . $filter . "
ORDER BY st.st_order";
}
-// echo $query."
";
+
$rs = $conn->Execute($query);
if ($rs && !$rs->EOF)
{
@@ -217,7 +196,7 @@
$prefix .= '--';
if ($level > 0)
$prefix=$prefix.'- ';
-/*
+/*
$page = ereg_replace("&","&",$rs->fields['page_title']);
$page = ereg_replace("\"",""",$page);
$page = ereg_replace("'","'",$page);
@@ -258,13 +237,12 @@
function GetFoldersAndFiles( $resourceType, $currentFolder, $aParams = array('name','asc'))
{
- global $Config ;
// Map the virtual path to the local server path.
if (isset($Config['K4Mode']))
$date_format = "m/d/Y h:i A";
- else
+ else
$date_format = GetConfigValue('date_format').' '.GetConfigValue('time_format');
-
+
$sServerDir = ServerMapFolder( $resourceType, $currentFolder ) ;
// Initialize the output buffers for "Folders" and "Files".
$aFolders = array();
@@ -287,7 +265,7 @@
{
$size = round( $iFileSize / 1024 );
$aFileSizes[] = ($size < 1)? 1:$size;// round( $iFileSize / 1024 ) ;
- } else
+ } else
$aFileSizes[] = $iFileSize;
$aFiles[] = $sFile;
$aFileDate[] = filectime($sServerDir.$sFile);
@@ -305,11 +283,11 @@
}
foreach($aFolders AS $k=>$v) {
$sFolders .= '' ;
- }
+ }
}
if (count($aFiles) > 0) {
- if ($aParams[0] == 'name')
- {
+ if ($aParams[0] == 'name')
+ {
natcasesort($aFiles);
if ($aParams[1] == 'desc')
{
@@ -337,7 +315,7 @@
$sFiles .= '' ;
}
}
- }
+ }
/* while ( $sFile = readdir( $oCurrentFolder ) )
{
if ( $sFile != '.' && $sFile != '..' && $sFile != 'CVS')
@@ -355,8 +333,8 @@
$sFiles .= '' ;
}
}
-*/
-
+*/
+
if ($aParams[1] == "desc")
{
echo $sFiles ;
@@ -425,7 +403,7 @@
$sql = "UPDATE live_blocks SET ".$lang_prefix."_content = replace(".$lang_prefix."_content,'".$original_str."','".$new_str."')";
$conn->Execute($sql);
}
-
+
}
function RenameFile( $resourceType, $currentFolder , $aFilenames = array())
@@ -440,15 +418,15 @@
{
$sErrorNumber = '204' ;
} else {
- if ( ( count($arAllowed) == 0 || in_array( strtolower($sExtension), $arAllowed ) ) && ( count($arDenied) == 0 || !in_array( strtoupper($sExtension), $arDenied ) ) )
+ if ( ( count($arAllowed) == 0 || in_array( $sExtension, $arAllowed ) ) && ( count($arDenied) == 0 || !in_array( $sExtension, $arDenied ) ) )
{
if (rename($sServerDir.$aFilenames[0],$sServerDir.$aFilenames[1])) {
if (isset($Config['K4Mode'])) {
// Update CMS Blocks
} else
UpdateCmsBlocksK3($resourceType,$currentFolder,$aFilenames[0],$aFilenames[1]);
$sErrorNumber = "0";
- } else
+ } else
$sErrorNumber = '205' ;
} else
$sErrorNumber = '203' ;
@@ -470,7 +448,7 @@
// Get the uploaded file name.
$sFileName = $oFile['name'] ;
$sOriginalFileName = $sFileName ;
- $sExtension = strtolower(substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) ) );
+ $sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) ) ;
global $Config ;
$arAllowed = $Config['AllowedExtensions'][$resourceType] ;
$arDenied = $Config['DeniedExtensions'][$resourceType] ;
@@ -529,19 +507,19 @@
return;
$conn = GetADODbConnection();
$aLangs = array();
- $multilang = GetConfigValue('multilingual_mode');
+ $multilang = GetConfigValue('multilingual_mode');
$def_lang_prefix = GetConfigValue('default_lang_prefix');
- if ($multilang)
+ if ($multilang)
{
$query="SELECT lang_prefix FROM lang ORDER BY lang_id";
$rs = $conn->Execute($query);
while ($rs && !$rs->EOF) {
$aLangs[] = $rs->fields['lang_prefix'];
$rs->MoveNext();
- }
- } else
+ }
+ } else
$aLangs[] = $def_lang_prefix;
- $sErrorNumber = 230;
+ $sErrorNumber = 230;
if ($confirm == 1) {
DeleteConfirmedFiles($resourceType, $currentFolder, $aFiles);
echo '' ;
@@ -553,9 +531,9 @@
continue;
$deleted_file = $Config['UserFilesPathNoBase'].$resourceType.$currentFolder.addslashes($v);
for($i=0; $i 0) {
+ $add_sql.= " lb1.".$aLangs[$i]."_content LIKE '%".$deleted_file."%' OR";
+
+ if (strlen($add_sql) > 0) {
$add_sql = rtrim($add_sql," OR");
$sql = "SELECT lb1.template_id, lb2.".$def_lang_prefix."_content FROM live_blocks AS lb1
LEFT JOIN live_blocks AS lb2 ON lb2.template_id = lb1.template_id AND lb2.block_num = 20
@@ -567,7 +545,7 @@
$page = @html_entity_decode($page,ENT_NOQUOTES,'UTF-8');
$page = @htmlspecialchars($page);
$ret_xml.= '' ;
- $rs->MoveNext();
+ $rs->MoveNext();
}
}
}
@@ -580,4 +558,13 @@
}
}
+
+function GetLangFromSid() {
+ $sid = $_COOKIE['admin_sid'];
+ $conn = GetADODbConnection();
+ $sql = "SELECT value FROM session_data WHERE name = 'old_translation_language' AND sid = $sid";
+ $translation_language = $conn->GetOne($sql);
+ return $translation_language;
+}
+
?>