Montego Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   This topic is locked: you cannot edit posts or make replies.
Author Message
hicux
Newbie
Newbie



Joined: Jan 30, 2009
Posts: 92
Location: NL

PostPosted: Wed Jul 18, 2012 8:09 pm Reply with quote

Resource: Download 2.51

http://sourceforge.net/projects/kcfinder/files/KCFinder/

Note: The first one who implemented was nuken at trickoutnews.com with an old version.

Follow the steps for this new version

1. Open folder modules/Downloads/admin/DownloadAdd.php

Search for
Code:
echo '<br />';
OpenTable();
echo '<form action="' . $admin_file . '.php" method="post">';
echo '<table align="center" cellpadding="2" cellspacing="2" border="0" width="90%">';
echo '<tr><td bgcolor="' . $bgcolor2 . '">' . _DL_TITLE . ':</td><td><input type="text" name="title" size="50" maxlength="100" /></td></tr>';
echo '<tr><td bgcolor="' . $bgcolor2 . '">' . _DL_URL . ':</td><td><input type="text" name="url" size="50" maxlength="255" value="" /></td></tr>';
echo '<tr><td bgcolor="' . $bgcolor2 . '">' . _DL_CATEGORY . ':</td><td><select name="cat"><option value="0">' . _DL_NONE . '</option>';
$result2 = $db->sql_query('SELECT `cid`, `parentid`, `title` FROM `' . $prefix . '_nsngd_categories` ORDER BY `parentid`, `title`');
while ($cidinfo = $db->sql_fetchrow($result2)) {
   $cidtitle = htmlspecialchars($cidinfo['title'], ENT_QUOTES, _CHARSET);
   if ($cidinfo['parentid'] != 0) $cidtitle = getparent($cidinfo['parentid'], $cidtitle);
   echo '<option value="' . $cidinfo['cid'] . '">' . $cidtitle . '</option>';
}


Replace it

Code:
echo '<br />';
OpenTable();
$_SESSION['KCFINDER'] = array();
$_SESSION['KCFINDER']['disabled'] = false;
echo '<script type="text/javascript">
function openKCFinder(field) {
    window.KCFinder = {
        callBack: function(url) {
            window.KCFinder = null;
            field.value = url;
        }
    };
    window.open("modules/Downloads/kcfinder/browse.php?type=files&dir=files/public", "kcfinder_textbox",
        "status=0, toolbar=0, location=0, menubar=0, directories=0, " +
        "resizable=1, scrollbars=0, width=800, height=600"
    );
}
</script>';
echo '<form action="' . $admin_file . '.php" method="post">';
echo '<table align="center" cellpadding="2" cellspacing="2" border="0" width="90%">';
echo '<tr><td bgcolor="' . $bgcolor2 . '">' . _DL_TITLE . ':</td><td><input type="text" name="title" size="50" maxlength="100" /></td></tr>';
echo '<tr><td bgcolor="' . $bgcolor2 . '">' . _DL_URL . ':</td><td><input type="text" readonly="readonly" onclick="openKCFinder(this)" name="url" size="50" maxlength="255" value="Click here and select a file double clicking on it" style="width:600px;cursor:pointer" /></td></tr>';
echo '<tr><td bgcolor="' . $bgcolor2 . '">' . _DL_CATEGORY . ':</td><td><select name="cat"><option value="0">' . _DL_NONE . '</option>';
$result2 = $db->sql_query('SELECT `cid`, `parentid`, `title` FROM `' . $prefix . '_nsngd_categories` ORDER BY `parentid`, `title`');
while ($cidinfo = $db->sql_fetchrow($result2)) {
   $cidtitle = htmlspecialchars($cidinfo['title'], ENT_QUOTES, _CHARSET);
   if ($cidinfo['parentid'] != 0) $cidtitle = getparent($cidinfo['parentid'], $cidtitle);
   echo '<option value="' . $cidinfo['cid'] . '">' . $cidtitle . '</option>';
}


Note: After doing this you don't need to make anyother modification

2. Extract the whole package you downloaded from the source and create a folder kcfinder (no capitals). Upload it to modules/Downloads/

3. Files you need to modify

config.php

Replace the whole config with



Code:
$_CONFIG = array(

    'disabled' => true,
    'denyZipDownload' => true,
    'denyUpdateCheck' => false,
    'denyExtensionRename' => false,

    'theme' => "oxygen",

    'uploadURL' => "upload",
    'uploadDir' => "",

    'dirPerms' => 0755,
    'filePerms' => 0644,

    'access' => array(

        'files' => array(
            'upload' => true,
            'delete' => true,
            'copy' => true,
            'move' => true,
            'rename' => true
        ),

        'dirs' => array(
            'create' => true,
            'delete' => true,
            'rename' => true
        )
    ),

    'deniedExts' => "exe com msi bat php phps phtml php3 php4 cgi pl",

    'types' => array(

        // CKEditor & FCKEditor types
        'files'   =>  "",
        'flash'   =>  "swf",
        'images'  =>  "*img",

        // TinyMCE types
        'file'    =>  "",
        'media'   =>  "swf flv avi mpg mpeg qt mov wmv asf rm",
        'image'   =>  "*img",
    ),

    'filenameChangeChars' => array(/*
        ' ' => "_",
        ':' => "."
    */),

    'dirnameChangeChars' => array(/*
        ' ' => "_",
        ':' => "."
    */),

    'mime_magic' => "",

    'maxImageWidth' => 0,
    'maxImageHeight' => 0,

    'thumbWidth' => 100,
    'thumbHeight' => 100,

    'thumbsDir' => ".thumbs",

    'jpegQuality' => 90,

    'cookieDomain' => "",
    'cookiePath' => "",
    'cookiePrefix' => 'KCFINDER_',

    // THE FOLLOWING SETTINGS CANNOT BE OVERRIDED WITH SESSION CONFIGURATION
    '_check4htaccess' => true,
    //'_tinyMCEPath' => "/tiny_mce",

    '_sessionVar' => &$_SESSION['KCFINDER'],
    //'_sessionLifetime' => 30,
    //'_sessionDir' => "/full/directory/path",

   '_sessionDomain' => "",
    '_sessionPath' => "/",
);


Open in the file file.js inside these folders js\browser

file.js

Search for line 156 until 231

Replace with

Code:
browser.returnFile = function(file) {

    var fileURL = file.substr
        ? file : browser.dir + '/' + file.data('name');
    fileURL = 'modules/Downloads/kcfinder/upload/' + _.escapeDirs(fileURL);

    if (this.opener.CKEditor) {
        this.opener.CKEditor.object.tools.callFunction(this.opener.CKEditor.funcNum, fileURL, '');
        window.close();

    } else if (this.opener.FCKeditor) {
        window.opener.SetUrl(fileURL) ;
        window.close() ;

    } else if (this.opener.TinyMCE) {
        var win = tinyMCEPopup.getWindowArg('window');
        win.document.getElementById(tinyMCEPopup.getWindowArg('input')).value = fileURL;
        if (win.getImageData) win.getImageData();
        if (typeof(win.ImageDialog) != "undefined") {
            if (win.ImageDialog.getImageData)
                win.ImageDialog.getImageData();
            if (win.ImageDialog.showPreviewImage)
                win.ImageDialog.showPreviewImage(fileURL);
        }
        tinyMCEPopup.close();

    } else if (this.opener.callBack) {

        if (window.opener && window.opener.KCFinder) {
            this.opener.callBack(fileURL);
            window.close();
        }

        if (window.parent && window.parent.KCFinder) {
            var button = $('#toolbar a[href="kcact:maximize"]');
            if (button.hasClass('selected'))
                this.maximize(button);
            this.opener.callBack(fileURL);
        }

    } else if (this.opener.callBackMultiple) {
        if (window.opener && window.opener.KCFinder) {
            this.opener.callBackMultiple([fileURL]);
            window.close();
        }

        if (window.parent && window.parent.KCFinder) {
            var button = $('#toolbar a[href="kcact:maximize"]');
            if (button.hasClass('selected'))
                this.maximize(button);
            this.opener.callBackMultiple([fileURL]);
        }

    }
};

browser.returnFiles = function(files) {
    if (this.opener.callBackMultiple && files.length) {
        var rfiles = [];
        $.each(files, function(i, file) {
            rfiles[i] = browser.dir + '/' + $(file).data('name');
            rfiles[i] = 'modules/Downloads/kcfinder/upload/' + _.escapeDirs(rfiles[i]);
        });
        this.opener.callBackMultiple(rfiles);
        if (window.opener) window.close()
    }
};

browser.returnThumbnails = function(files) {
    if (this.opener.callBackMultiple) {
        var rfiles = [];
        var j = 0;
        $.each(files, function(i, file) {
            if ($(file).data('thumb')) {
                rfiles[j] = browser.dir + '/' + $(file).data('name');
                rfiles[j] = 'modules/Downloads/kcfinder/upload/' + _.escapeDirs(rfiles[j++]);


That's all folks!

Thanks to nuke and montego for their amazing work. Wink
 
View user's profile Send private message Visit poster's website
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Thu Jul 19, 2012 6:45 am Reply with quote

Very cool! Thanks hicux (and nuken). I know the RN Team is working on replacing the FCKeditor with CKeditor as well as creating a more generalized tool for file uploads. Cannot recall right now if this was the one... But, it is definitely on the Downloads roadmap to provide this capability integrated right into the admin area. So, thank you!

_________________
“To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins 
View user's profile Send private message Visit poster's website
hicux
Newbie
Newbie



Joined: Jan 30, 2009
Posts: 92
Location: NL

PostPosted: Thu Jul 19, 2012 7:26 am Reply with quote

Actually I requested something like this long time ago but nobody wanted to listen to me. What I wanted to do was:

Something Similar like Club Module has. Take a look and let me know:

Code:
function get($fid) {
    global $prefix, $db, $module_name, $sitename;
    $fid = intval($fid);
    if (isset($fid)) {
       $num = $db->sql_numrows($db->sql_query("SELECT fid FROM ".$prefix."_club_files WHERE fid='$fid'"));
       if ($num == 1) {
//allow mod rewrite
                      list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));
//end allow mod re write

         if (!isset($_SERVER['PHP_AUTH_USER'])) {
            header('WWW-Authenticate: Basic realm="Club"');
             header('HTTP/1.0 401 Unauthorized');
             echo _USELOGIN;
             exit;
         } else {
              $username = $_SERVER['PHP_AUTH_USER'];
              $password = md5($_SERVER['PHP_AUTH_PW']);
              $num = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_club_members WHERE nickname='$username' AND password='$password'"));
              if ($num == 1) {
                $db->sql_query("UPDATE ".$prefix."_club_files SET hits=hits+1 WHERE fid='$fid'");
                $row = $db->sql_fetchrow($db->sql_query("select filename from ".$prefix."_club_files where fid='$fid'"));
               Header("Location: modules/$module_name/files/$row[filename]");
               exit;
              } else {
                header('WWW-Authenticate: Basic realm="Club"');
                header('HTTP/1.0 401 Unauthorized');
                include("header.php");
                title("$sitename Club");
                OpenTable();
               echo "<center><b>"._CLUBERROR."</b><br /><br />"._PASSWORDINCORRECT."<br /><br />"._GOBACK."</center>";
               CloseTable();
               include("footer.php");
               die();
            }
         }
       } else {
         include("header.php");
         title("$sitename Club");
         OpenTable();
         echo "<center><b>"._CLUBERROR."</b><br /><br />"._FILENOTEXIST."<br /><br />"._GOBACK."</center>";
         CloseTable();
         include("footer.php");
         die();
       }
    } else {
      include("header.php");
      title("$sitename Club");
      OpenTable();
 
View user's profile Send private message Visit poster's website
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Fri Jul 20, 2012 9:03 am Reply with quote

hicux wrote:
Take a look and let me know


hicux, not really sure what I am looking at to be honest. Sorry. Can you please explain what you're wanting/needing in words?

Thanks,
Rob
 
View user's profile Send private message Visit poster's website
Palbin
Newbie
Newbie



Joined: Nov 26, 2007
Posts: 25

PostPosted: Sat Jul 21, 2012 1:01 pm Reply with quote

You can use the new elFinder that comes with nukeWYSIWYG that we released over at http://nukeseo.com/. I would recommend that over an additional application.
 
View user's profile Send private message
hicux
Newbie
Newbie



Joined: Jan 30, 2009
Posts: 92
Location: NL

PostPosted: Sat Jul 21, 2012 4:39 pm Reply with quote

Check your pm Montengo and Palbin, I know what you mean.
 
View user's profile Send private message Visit poster's website
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Sat Jul 21, 2012 7:16 pm Reply with quote

I agree with Palbin. I have no time to really try and support yet another tool when the RN team has already taking on the task of supporting another. Don't really know what else to discuss, therefore, closing this thread.

_________________
“To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins 
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   This topic is locked: you cannot edit posts or make replies.

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 4 Hours
 
Forums ©
linear-bunch