View Single Post
  #2  
Old 10-19-2011, 01:05 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: ckfinder with ckeditor

X-Cart uses its own session handling routines.

Thus the modification will be a little bit more complex:

1. create a new file "<xcart_dir>/admin/file_manager.php"
PHP Code:
<?php
/* vim: set ts=4 sw=4 sts=4 et: */

require './auth.php';
require 
$xcart_dir.'/include/security.php';

if (
$login) {

    
func_setcookie('xcart_scookie'$XCART_SESSION_NAME);
    
func_setcookie('ckfinder_auth'md5($XCARTSESSID));

    
clearstatcache();

    include 
$xcart_dir.'/include/lib/ckfinder/ckfinder.php';

    
// You can use the "CKFinder" class to render CKFinder in a page:
    
$finder = new CKFinder() ;
    
$finder->BasePath '../include/lib/ckfinder/';  // The path for the installation of CKFinder (default = "/ckfinder/").
    
$finder->SelectFunction 'ShowFileInfo';
    
$finder->Create() ;
}

?>

2. upload the ckfinder distribution pack content into the "<xcart_dir>/include/lib/ckfinder" directory.

3. change certain parts of the "<xcart_dir>/include/lib/ckfinder/config.php" file as follows:
PHP Code:
...
function 
CheckAuthentication()
{
        
// WARNING : DO NOT simply return "true". By doing so, you are allowing
        // "anyone" to upload and list the files in your server. You must implement
        // some kind of session validation here. Even something very simple as...

        // return isset($_SESSION['IsAuthorized']) && $_SESSION['IsAuthorized'];

        // ... where $_SESSION['IsAuthorized'] is set to "true" as soon as the
        // user logs in your system. To be able to use session variables don't
        // forget to add session_start() at the top of this file.

        
global $_COOKIE;

        return isset(
$_COOKIE['xcart_scookie']) 
                && isset(
$_COOKIE['ckfinder_auth']) 
                && isset(
$_COOKIE[$_COOKIE['xcart_scookie']]) 
                && 
$_COOKIE['ckfinder_auth'] == md5($_COOKIE[$_COOKIE['xcart_scookie']]);
}
...
$baseUrl "userfiles/";
...
$baseDir dirname(__FILE__).'/userfiles/'

4. alter the "<xcart_dir>/skin/common_files/admin/menu_box.tpl" template and add:
Code:
<a href="{$catalogs.admin}/file_manager.php">{$lng.lbl_file_manager}</a>
right before e.g.:
Code:
<a href="{$catalogs.admin}/import.php">{$lng.lbl_import_export}</a>

5. add a new language variable "lbl_file_manager" via X-Cart languages section and specify its value.

After that you a new menu entry should appear under Tools menu -> "File manager".
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote