| 1 | <?php |
|---|
| 2 | /* |
|---|
| 3 | * FCKeditor - The text editor for Internet - http://www.fckeditor.net |
|---|
| 4 | * Copyright (C) 2003-2007 Frederico Caldeira Knabben |
|---|
| 5 | * |
|---|
| 6 | * == BEGIN LICENSE == |
|---|
| 7 | * |
|---|
| 8 | * Licensed under the terms of any of the following licenses at your |
|---|
| 9 | * choice: |
|---|
| 10 | * |
|---|
| 11 | * - GNU General Public License Version 2 or later (the "GPL") |
|---|
| 12 | * http://www.gnu.org/licenses/gpl.html |
|---|
| 13 | * |
|---|
| 14 | * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") |
|---|
| 15 | * http://www.gnu.org/licenses/lgpl.html |
|---|
| 16 | * |
|---|
| 17 | * - Mozilla Public License Version 1.1 or later (the "MPL") |
|---|
| 18 | * http://www.mozilla.org/MPL/MPL-1.1.html |
|---|
| 19 | * |
|---|
| 20 | * == END LICENSE == |
|---|
| 21 | * |
|---|
| 22 | * Configuration file for the File Manager Connector for PHP. |
|---|
| 23 | */ |
|---|
| 24 | |
|---|
| 25 | global $Config; |
|---|
| 26 | |
|---|
| 27 | /* Load in the configuation file */ |
|---|
| 28 | require_once( '../../../../../../../configuration.php' ); |
|---|
| 29 | /* Load Joomla's DB Class */ |
|---|
| 30 | define(_VALID_MOS, "0"); |
|---|
| 31 | require_once( '../../../../../../../includes/database.php' ); |
|---|
| 32 | /* Create a new Instance */ |
|---|
| 33 | $database = new database( $mosConfig_host, $mosConfig_user, $mosConfig_password, $mosConfig_db, $mosConfig_dbprefix, $mosConfig_offline ); |
|---|
| 34 | |
|---|
| 35 | //need to check if back end user has already logged in |
|---|
| 36 | |
|---|
| 37 | $expired_time = time() - $mosConfig_lifetime; |
|---|
| 38 | |
|---|
| 39 | $ip = md5($_SERVER['REMOTE_ADDR']); |
|---|
| 40 | $sql ='select ips.session_id from #__session ips ' |
|---|
| 41 | . 'join #__session uip on uip.session_id = ips.username ' |
|---|
| 42 | . 'join #__users usr on usr.id = uip.userid ' |
|---|
| 43 | . 'where ips.session_id =\'' .$ip . '\' and usr.gid > 18 ' |
|---|
| 44 | . 'and uip.time > ' .$expired_time; |
|---|
| 45 | |
|---|
| 46 | $database->setQuery( $sql ); |
|---|
| 47 | $ip_recorded_for_jusr = $database->loadResult(); |
|---|
| 48 | |
|---|
| 49 | if(isset($ip_recorded_for_jusr)) |
|---|
| 50 | { |
|---|
| 51 | $Config['Enabled'] = true; |
|---|
| 52 | } |
|---|
| 53 | else |
|---|
| 54 | { |
|---|
| 55 | $Config['Enabled'] = false; |
|---|
| 56 | } |
|---|
| 57 | $Config['Enabled'] = true; |
|---|
| 58 | |
|---|
| 59 | /* Need to access the database to get the image path */ |
|---|
| 60 | $sql = "SELECT params FROM #__mambots WHERE name = 'JoomlaFCK'"; |
|---|
| 61 | $database->setQuery( $sql ); |
|---|
| 62 | $result = $database->loadResult(); |
|---|
| 63 | preg_match('/imagePath=(.*)\n/', $result, $location, PREG_OFFSET_CAPTURE); |
|---|
| 64 | $imagePath = $location[1][0]; |
|---|
| 65 | |
|---|
| 66 | |
|---|
| 67 | |
|---|
| 68 | |
|---|
| 69 | |
|---|
| 70 | |
|---|
| 71 | // Path to user files relative to the document root. |
|---|
| 72 | $Config['UserFilesPath'] = $mosConfig_live_site . $imagePath; |
|---|
| 73 | |
|---|
| 74 | // Fill the following value it you prefer to specify the absolute path for the |
|---|
| 75 | // user files directory. Useful if you are using a virtual directory, symbolic |
|---|
| 76 | // link or alias. Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'. |
|---|
| 77 | // Attention: The above 'UserFilesPath' must point to the same directory. |
|---|
| 78 | $Config['UserFilesAbsolutePath'] = $mosConfig_absolute_path . $imagePath; |
|---|
| 79 | // Due to security issues with Apache modules, it is recommended to leave the |
|---|
| 80 | // following setting enabled. |
|---|
| 81 | $Config['ForceSingleExtension'] = true ; |
|---|
| 82 | |
|---|
| 83 | // Perform additional checks for image files |
|---|
| 84 | // if set to true, validate image size (using getimagesize) |
|---|
| 85 | $Config['SecureImageUploads'] = true; |
|---|
| 86 | |
|---|
| 87 | // What the user can do with this connector |
|---|
| 88 | $Config['ConfigAllowedCommands'] = array('QuickUpload', 'FileUpload', 'GetFolders', 'GetFoldersAndFiles', 'CreateFolder') ; |
|---|
| 89 | |
|---|
| 90 | // Allowed Resource Types |
|---|
| 91 | $Config['ConfigAllowedTypes'] = array('File', 'Image', 'Flash', 'Media') ; |
|---|
| 92 | |
|---|
| 93 | // For security, HTML is allowed in the first Kb of data for files having the |
|---|
| 94 | // following extensions only. |
|---|
| 95 | $Config['HtmlExtensions'] = array("html", "htm", "xml", "xsd", "txt", "js") ; |
|---|
| 96 | |
|---|
| 97 | /* |
|---|
| 98 | Configuration settings for each Resource Type |
|---|
| 99 | |
|---|
| 100 | - AllowedExtensions: the possible extensions that can be allowed. |
|---|
| 101 | If it is empty then any file type can be uploaded. |
|---|
| 102 | - DeniedExtensions: The extensions that won't be allowed. |
|---|
| 103 | If it is empty then no restrictions are done here. |
|---|
| 104 | |
|---|
| 105 | For a file to be uploaded it has to fulfill both the AllowedExtensions |
|---|
| 106 | and DeniedExtensions (that's it: not being denied) conditions. |
|---|
| 107 | |
|---|
| 108 | - FileTypesPath: the virtual folder relative to the document root where |
|---|
| 109 | these resources will be located. |
|---|
| 110 | Attention: It must start and end with a slash: '/' |
|---|
| 111 | |
|---|
| 112 | - FileTypesAbsolutePath: the physical path to the above folder. It must be |
|---|
| 113 | an absolute path. |
|---|
| 114 | If it's an empty string then it will be autocalculated. |
|---|
| 115 | Useful if you are using a virtual directory, symbolic link or alias. |
|---|
| 116 | Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'. |
|---|
| 117 | Attention: The above 'FileTypesPath' must point to the same directory. |
|---|
| 118 | Attention: It must end with a slash: '/' |
|---|
| 119 | |
|---|
| 120 | - QuickUploadPath: the virtual folder relative to the document root where |
|---|
| 121 | these resources will be uploaded using the Upload tab in the resources |
|---|
| 122 | dialogs. |
|---|
| 123 | Attention: It must start and end with a slash: '/' |
|---|
| 124 | |
|---|
| 125 | - QuickUploadAbsolutePath: the physical path to the above folder. It must be |
|---|
| 126 | an absolute path. |
|---|
| 127 | If it's an empty string then it will be autocalculated. |
|---|
| 128 | Useful if you are using a virtual directory, symbolic link or alias. |
|---|
| 129 | Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'. |
|---|
| 130 | Attention: The above 'QuickUploadPath' must point to the same directory. |
|---|
| 131 | Attention: It must end with a slash: '/' |
|---|
| 132 | |
|---|
| 133 | NOTE: by default, QuickUploadPath and QuickUploadAbsolutePath point to |
|---|
| 134 | "userfiles" directory to maintain backwards compatibility with older versions of FCKeditor. |
|---|
| 135 | This is fine, but you in some cases you will be not able to browse uploaded files using file browser. |
|---|
| 136 | Example: if you click on "image button", select "Upload" tab and send image |
|---|
| 137 | to the server, image will appear in FCKeditor correctly, but because it is placed |
|---|
| 138 | directly in /userfiles/ directory, you'll be not able to see it in built-in file browser. |
|---|
| 139 | The more expected behaviour would be to send images directly to "image" subfolder. |
|---|
| 140 | To achieve that, simply change |
|---|
| 141 | $Config['QuickUploadPath']['Image'] = $Config['UserFilesPath'] ; |
|---|
| 142 | $Config['QuickUploadAbsolutePath']['Image'] = $Config['UserFilesAbsolutePath'] ; |
|---|
| 143 | into: |
|---|
| 144 | $Config['QuickUploadPath']['Image'] = $Config['FileTypesPath']['Image'] ; |
|---|
| 145 | $Config['QuickUploadAbsolutePath']['Image'] = $Config['FileTypesAbsolutePath']['Image'] ; |
|---|
| 146 | |
|---|
| 147 | */ |
|---|
| 148 | |
|---|
| 149 | $Config['AllowedExtensions']['File'] = array('7z', 'aiff', 'asf', 'avi', 'bmp', 'csv', 'doc', 'fla', 'flv', 'gif', 'gz', 'gzip', 'jpeg', 'jpg', 'mid', 'mov', 'mp3', 'mp4', 'mpc', 'mpeg', 'mpg', 'ods', 'odt', 'pdf', 'png', 'ppt', 'pxd', 'qt', 'ram', 'rar', 'rm', 'rmi', 'rmvb', 'rtf', 'sdc', 'sitd', 'swf', 'sxc', 'sxw', 'tar', 'tgz', 'tif', 'tiff', 'txt', 'vsd', 'wav', 'wma', 'wmv', 'xls', 'xml', 'zip') ; |
|---|
| 150 | $Config['DeniedExtensions']['File'] = array() ; |
|---|
| 151 | $Config['FileTypesPath']['File'] = $Config['UserFilesPath'] . 'file/' ; |
|---|
| 152 | $Config['FileTypesAbsolutePath']['File']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'file/' ; |
|---|
| 153 | $Config['QuickUploadPath']['File'] = $Config['UserFilesPath'] ; |
|---|
| 154 | $Config['QuickUploadAbsolutePath']['File']= $Config['UserFilesAbsolutePath'] ; |
|---|
| 155 | |
|---|
| 156 | $Config['AllowedExtensions']['Image'] = array('bmp','gif','jpeg','jpg','pdf','png') ; |
|---|
| 157 | $Config['DeniedExtensions']['Image'] = array() ; |
|---|
| 158 | $Config['FileTypesPath']['Image'] = $Config['UserFilesPath'] . '' ; |
|---|
| 159 | $Config['FileTypesAbsolutePath']['Image']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'' ; |
|---|
| 160 | $Config['QuickUploadPath']['Image'] = $Config['UserFilesPath'] ; |
|---|
| 161 | $Config['QuickUploadAbsolutePath']['Image']= $Config['UserFilesAbsolutePath'] ; |
|---|
| 162 | |
|---|
| 163 | $Config['AllowedExtensions']['Flash'] = array('swf','flv') ; |
|---|
| 164 | $Config['DeniedExtensions']['Flash'] = array() ; |
|---|
| 165 | $Config['FileTypesPath']['Flash'] = $Config['UserFilesPath'] . 'flash/' ; |
|---|
| 166 | $Config['FileTypesAbsolutePath']['Flash']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'flash/' ; |
|---|
| 167 | $Config['QuickUploadPath']['Flash'] = $Config['UserFilesPath'] ; |
|---|
| 168 | $Config['QuickUploadAbsolutePath']['Flash']= $Config['UserFilesAbsolutePath'] ; |
|---|
| 169 | |
|---|
| 170 | $Config['AllowedExtensions']['Media'] = array('aiff', 'asf', 'avi', 'bmp', 'fla', 'flv', 'gif', 'jpeg', 'jpg', 'mid', 'mov', 'mp3', 'mp4', 'mpc', 'mpeg', 'mpg', 'png', 'qt', 'ram', 'rm', 'rmi', 'rmvb', 'swf', 'tif', 'tiff', 'wav', 'wma', 'wmv') ; |
|---|
| 171 | $Config['DeniedExtensions']['Media'] = array() ; |
|---|
| 172 | $Config['FileTypesPath']['Media'] = $Config['UserFilesPath'] . 'media/' ; |
|---|
| 173 | $Config['FileTypesAbsolutePath']['Media']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'media/' ; |
|---|
| 174 | $Config['QuickUploadPath']['Media'] = $Config['UserFilesPath'] ; |
|---|
| 175 | $Config['QuickUploadAbsolutePath']['Media']= $Config['UserFilesAbsolutePath'] ; |
|---|
| 176 | |
|---|
| 177 | ?> |
|---|