push prod
115
.gitignore
vendored
Normal file
@ -0,0 +1,115 @@
|
||||
#### GENERAL ####
|
||||
.htpasswd
|
||||
.htaccess
|
||||
*.zip
|
||||
*.sql
|
||||
*.tar.gz
|
||||
*.gzip
|
||||
download/*
|
||||
log/*
|
||||
/www/modules/gamification/
|
||||
upload/*
|
||||
*sitemap.xml
|
||||
|
||||
#### IMAGES ####
|
||||
img/*/*
|
||||
!img/index.php
|
||||
!img/*/index.php
|
||||
|
||||
#### ADMIN ####
|
||||
adm/backups/*
|
||||
adm/export/*
|
||||
adm/import/*
|
||||
adm/autoupgrade/*
|
||||
adm/backups/*
|
||||
!adm/backups/index.php
|
||||
|
||||
#### CACHE ####
|
||||
themes/*/cache/
|
||||
cache/smarty/cache/*
|
||||
!cache/smarty/cache/index.php
|
||||
cache/smarty/compile/*
|
||||
!cache/smarty/compile/index.php
|
||||
cache/class_index.php
|
||||
cache/tcpdf/*
|
||||
!cache/tcpdf/index.php
|
||||
tools/smarty*/cache/*.php
|
||||
!tools/smarty*/cache/index.php
|
||||
|
||||
#### CONFIG ####
|
||||
config/settings.*.php
|
||||
config/xml/*.xml
|
||||
config/settings.inc.php
|
||||
config/settings.old.php
|
||||
config/xml/*.xml
|
||||
modules/*/config*.xml
|
||||
|
||||
#### THEME ####
|
||||
themes/default/cache/*.js
|
||||
themes/default/cache/*.css
|
||||
themes/default-bootstrap/cache/*.js
|
||||
themes/default-bootstrap/cache/*.css
|
||||
|
||||
tools/smarty*/compile/*.php
|
||||
!tools/smarty*/compile/index.php
|
||||
themes/default/modules/*/*.php
|
||||
!themes/default/modules/*/index.php
|
||||
themes/default/lang/*.php
|
||||
!themes/default/lang/index.php
|
||||
themes/default-bootstrap/modules/*/*.php
|
||||
!themes/default-bootstrap/modules/*/index.php
|
||||
themes/default-bootstrap/lang/*.php
|
||||
!themes/default-bootstrap/lang/index.php
|
||||
|
||||
#### TRADUCTIONS ####
|
||||
translations/*
|
||||
themes/default-bootstrap/lang/*
|
||||
themes/default-bootstrap/modules/*/translations/*.php
|
||||
!themes/default-bootstrap/modules/*/translations/index.php
|
||||
!translations/*.gzip
|
||||
|
||||
#### MAILS ####
|
||||
mails/*
|
||||
!/mails/en
|
||||
!mails/fr
|
||||
modules/*/mails/*
|
||||
!modules/*/mails/en
|
||||
|
||||
#### OTHER ####
|
||||
.buildpath
|
||||
.project
|
||||
.settings
|
||||
.idea
|
||||
.svn
|
||||
.DS_Store
|
||||
.sass-cache
|
||||
config.codekit
|
||||
*.sublime-project
|
||||
*.sublime-workspace
|
||||
.zfs/
|
||||
|
||||
import
|
||||
|
||||
.cache/
|
||||
L4
|
||||
_themes
|
||||
*.pdf
|
||||
adm.php
|
||||
|
||||
modules/**/log/*
|
||||
modules/**/logs/*
|
||||
modules/homeslider/images/*
|
||||
!modules/homeslider/images/index.php
|
||||
modules/giftcard/img/*
|
||||
!modules/giftcard/img/index.php
|
||||
modules/devspepresse/images/*
|
||||
!modules/devspepresse/images/index.php
|
||||
modules/devspehomeblocks/images/*
|
||||
!modules/devspehomeblocks/images/index.php
|
||||
modules/belvg_blockconstructor/img/*
|
||||
!modules/belvg_blockconstructor/img/index.php
|
||||
modules/ganalyticscom/debug/*
|
||||
!modules/ganalyticscom/debug/index.php
|
||||
modules/boixmenugaranciaimage/images/*
|
||||
!modules/boixmenugaranciaimage/images/index.php
|
||||
modules/psblog/uploads/*
|
64
.htaccess_save
Executable file
@ -0,0 +1,64 @@
|
||||
|
||||
|
||||
# ~~start~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again
|
||||
# .htaccess automaticaly generated by PrestaShop e-commerce open-source solution
|
||||
# http://www.prestashop.com - http://www.prestashop.com/forums
|
||||
|
||||
|
||||
<IfModule mod_security.c>
|
||||
SecFilterEngine Off
|
||||
SecFilterScanPOST Off
|
||||
</IfModule>
|
||||
<IfModule mod_rewrite.c>
|
||||
|
||||
# Disable Multiviews
|
||||
Options -Multiviews
|
||||
|
||||
RewriteEngine on
|
||||
|
||||
RewriteCond %{HTTP_HOST} ^garanciabeauty.castor.planet-service.net$
|
||||
RewriteRule . - [E=REWRITEBASE:/]
|
||||
RewriteRule ^api/?(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]
|
||||
|
||||
|
||||
# Images
|
||||
RewriteCond %{HTTP_HOST} ^garanciabeauty.castor.planet-service.net$
|
||||
RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$1$2$3.jpg [L]
|
||||
RewriteCond %{HTTP_HOST} ^garanciabeauty.castor.planet-service.net$
|
||||
RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$1$2$3$4.jpg [L]
|
||||
RewriteCond %{HTTP_HOST} ^garanciabeauty.castor.planet-service.net$
|
||||
RewriteRule ^([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$1$2$3$4$5.jpg [L]
|
||||
RewriteCond %{HTTP_HOST} ^garanciabeauty.castor.planet-service.net$
|
||||
RewriteRule ^([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg [L]
|
||||
RewriteCond %{HTTP_HOST} ^garanciabeauty.castor.planet-service.net$
|
||||
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg [L]
|
||||
RewriteCond %{HTTP_HOST} ^garanciabeauty.castor.planet-service.net$
|
||||
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg [L]
|
||||
RewriteCond %{HTTP_HOST} ^garanciabeauty.castor.planet-service.net$
|
||||
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg [L]
|
||||
RewriteCond %{HTTP_HOST} ^garanciabeauty.castor.planet-service.net$
|
||||
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg [L]
|
||||
RewriteCond %{HTTP_HOST} ^garanciabeauty.castor.planet-service.net$
|
||||
RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2$3.jpg [L]
|
||||
RewriteCond %{HTTP_HOST} ^garanciabeauty.castor.planet-service.net$
|
||||
RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2.jpg [L]
|
||||
# AlphaImageLoader for IE and fancybox
|
||||
RewriteCond %{HTTP_HOST} ^garanciabeauty.castor.planet-service.net$
|
||||
RewriteRule ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 [L]
|
||||
|
||||
# Dispatcher
|
||||
RewriteCond %{REQUEST_FILENAME} -s [OR]
|
||||
RewriteCond %{REQUEST_FILENAME} -l [OR]
|
||||
RewriteCond %{REQUEST_FILENAME} -d
|
||||
RewriteCond %{HTTP_HOST} ^garanciabeauty.castor.planet-service.net$
|
||||
RewriteRule ^.*$ - [NC,L]
|
||||
RewriteCond %{HTTP_HOST} ^garanciabeauty.castor.planet-service.net$
|
||||
RewriteRule ^.*$ %{ENV:REWRITEBASE}index.php [NC,L]
|
||||
</IfModule>
|
||||
|
||||
#If rewrite mod isn't enabled
|
||||
ErrorDocument 404 /index.php?controller=404
|
||||
|
||||
# ~~end~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again
|
||||
|
||||
|
29
404.php
Executable file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
require_once(dirname(__FILE__).'/config/config.inc.php');
|
||||
Tools::displayFileAsDeprecated();
|
||||
Controller::getController('PageNotFoundController')->run();
|
41
BO/ajax-tab.php
Executable file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require(_PS_ADMIN_DIR_.'/../config/config.inc.php');
|
||||
require(_PS_ADMIN_DIR_.'/functions.php');
|
||||
|
||||
// For retrocompatibility with "tab" parameter
|
||||
if (!isset($_GET['controller']) && isset($_GET['tab']))
|
||||
$_GET['controller'] = strtolower($_GET['tab']);
|
||||
if (!isset($_POST['controller']) && isset($_POST['tab']))
|
||||
$_POST['controller'] = strtolower($_POST['tab']);
|
||||
if (!isset($_REQUEST['controller']) && isset($_REQUEST['tab']))
|
||||
$_REQUEST['controller'] = strtolower($_REQUEST['tab']);
|
||||
// Retrocompatibility with 1.4
|
||||
$_REQUEST['ajaxMode'] = $_POST['ajaxMode'] = $_GET['ajaxMode'] = $_REQUEST['ajax'] = $_POST['ajax'] = $_GET['ajax'] = 1;
|
||||
|
||||
Dispatcher::getInstance()->dispatch();
|
230
BO/ajax.php
Executable file
@ -0,0 +1,230 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
include(_PS_ADMIN_DIR_.'/../config/config.inc.php');
|
||||
/* Getting cookie or logout */
|
||||
require_once(_PS_ADMIN_DIR_.'/init.php');
|
||||
|
||||
$context = Context::getContext();
|
||||
|
||||
if (Tools::isSubmit('changeParentUrl'))
|
||||
echo '<script type="text/javascript">parent.parent.document.location.href = "'.addslashes(urldecode(Tools::getValue('changeParentUrl'))).'";</script>';
|
||||
if (Tools::isSubmit('installBoughtModule'))
|
||||
{
|
||||
$file = false;
|
||||
while ($file === false OR file_exists(_PS_MODULE_DIR_.$file))
|
||||
$file = uniqid();
|
||||
$file = _PS_MODULE_DIR_.$file.'.zip';
|
||||
$sourceFile = 'http://addons.prestashop.com/iframe/getboughtfile.php?id_order_detail='.Tools::getValue('id_order_detail').'&token='.Tools::getValue('token');
|
||||
if (!copy($sourceFile, $file))
|
||||
{
|
||||
if (!($content = file_get_contents($sourceFile)))
|
||||
die(displayJavascriptAlert('Access denied: Please download your module directly from PrestaShop Addons website'));
|
||||
elseif (!file_put_contents($file, $content))
|
||||
die(displayJavascriptAlert('Local error: your module directory is not writable'));
|
||||
}
|
||||
$first6 = fread($fd = fopen($file, 'r'), 6);
|
||||
if (!strncmp($first6, 'Error:', 6))
|
||||
{
|
||||
$displayJavascriptAlert = displayJavascriptAlert(fread($fd, 1024));
|
||||
fclose($fd);
|
||||
unlink($file);
|
||||
die($displayJavascriptAlert);
|
||||
}
|
||||
fclose($fd);
|
||||
if (!Tools::ZipExtract($file, _PS_MODULE_DIR_))
|
||||
{
|
||||
unlink($file);
|
||||
die(displayJavascriptAlert('Cannot unzip file'));
|
||||
}
|
||||
unlink($file);
|
||||
die(displayJavascriptAlert('Module copied to disk'));
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('ajaxReferrers'))
|
||||
{
|
||||
require(_PS_CONTROLLER_DIR_.'admin/AdminReferrersController.php');
|
||||
}
|
||||
|
||||
if (Tools::getValue('page') == 'prestastore' AND @fsockopen('addons.prestashop.com', 80, $errno, $errst, 3))
|
||||
readfile('http://addons.prestashop.com/adminmodules.php?lang='.$context->language->iso_code);
|
||||
|
||||
if (Tools::isSubmit('getAvailableFields') AND Tools::isSubmit('entity'))
|
||||
{
|
||||
$jsonArray = array();
|
||||
$import = new AdminImportController();
|
||||
|
||||
$fields = $import->getAvailableFields(true);
|
||||
foreach ($fields AS $field)
|
||||
$jsonArray[] = '{"field":"'.addslashes($field).'"}';
|
||||
die('['.implode(',', $jsonArray).']');
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('ajaxProductPackItems'))
|
||||
{
|
||||
$jsonArray = array();
|
||||
$products = Db::getInstance()->executeS('
|
||||
SELECT p.`id_product`, pl.`name`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
NATURAL LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
WHERE pl.`id_lang` = '.(int)(Tools::getValue('id_lang')).'
|
||||
'.Shop::addSqlRestrictionOnLang('pl').'
|
||||
AND p.`id_product` NOT IN (SELECT DISTINCT id_product_pack FROM `'._DB_PREFIX_.'pack`)
|
||||
AND p.`id_product` != '.(int)(Tools::getValue('id_product')));
|
||||
|
||||
foreach ($products AS $packItem)
|
||||
$jsonArray[] = '{"value": "'.(int)($packItem['id_product']).'-'.addslashes($packItem['name']).'", "text":"'.(int)($packItem['id_product']).' - '.addslashes($packItem['name']).'"}';
|
||||
die('['.implode(',', $jsonArray).']');
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('ajaxStates') AND Tools::isSubmit('id_country'))
|
||||
{
|
||||
$states = Db::getInstance()->executeS('
|
||||
SELECT s.id_state, s.name
|
||||
FROM '._DB_PREFIX_.'state s
|
||||
LEFT JOIN '._DB_PREFIX_.'country c ON (s.`id_country` = c.`id_country`)
|
||||
WHERE s.id_country = '.(int)(Tools::getValue('id_country')).' AND s.active = 1 AND c.`contains_states` = 1
|
||||
ORDER BY s.`name` ASC');
|
||||
|
||||
if (is_array($states) AND !empty($states))
|
||||
{
|
||||
$list = '';
|
||||
if (Tools::getValue('no_empty') != true)
|
||||
{
|
||||
$empty_value = (Tools::isSubmit('empty_value')) ? Tools::getValue('empty_value') : '----------';
|
||||
$list = '<option value="0">'.Tools::htmlentitiesUTF8($empty_value).'</option>'."\n";
|
||||
}
|
||||
|
||||
foreach ($states AS $state)
|
||||
$list .= '<option value="'.(int)($state['id_state']).'"'.((isset($_GET['id_state']) AND $_GET['id_state'] == $state['id_state']) ? ' selected="selected"' : '').'>'.$state['name'].'</option>'."\n";
|
||||
}
|
||||
else
|
||||
$list = 'false';
|
||||
|
||||
die($list);
|
||||
}
|
||||
|
||||
if (Tools::getValue('form_language_id'))
|
||||
{
|
||||
if (!($context->cookie->employee_form_lang = (int)(Tools::getValue('form_language_id'))))
|
||||
die ('Error while updating cookie.');
|
||||
die ('Form language updated.');
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('submitTrackClickOnHelp'))
|
||||
{
|
||||
$label = Tools::getValue('label');
|
||||
$version = Tools::getValue('version');
|
||||
|
||||
if (!empty($label) && !empty($version))
|
||||
HelpAccess::trackClick($label, $version);
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('toggleScreencast'))
|
||||
{
|
||||
if (Validate::isLoadedObject($context->employee))
|
||||
{
|
||||
$context->employee->bo_show_screencast = !$context->employee->bo_show_screencast;
|
||||
$context->employee->update();
|
||||
}
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('getChildrenCategories') && Tools::isSubmit('id_category_parent'))
|
||||
{
|
||||
$children_categories = Category::getChildrenWithNbSelectedSubCat(Tools::getValue('id_category_parent'), Tools::getValue('selectedCat'), Context::getContext()->language->id, null, Tools::getValue('use_shop_context'));
|
||||
die(Tools::jsonEncode($children_categories));
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('getNotifications'))
|
||||
{
|
||||
$notification = new Notification;
|
||||
die(Tools::jsonEncode($notification->getLastElements()));
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('updateElementEmployee') && Tools::getValue('updateElementEmployeeType'))
|
||||
{
|
||||
$notification = new Notification;
|
||||
die($notification->updateEmployeeLastElement(Tools::getValue('updateElementEmployeeType')));
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('searchCategory'))
|
||||
{
|
||||
$q = Tools::getValue('q');
|
||||
$limit = Tools::getValue('limit');
|
||||
$results = Db::getInstance()->executeS(
|
||||
'SELECT c.`id_category`, cl.`name`
|
||||
FROM `'._DB_PREFIX_.'category` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category`'.Shop::addSqlRestrictionOnLang('cl').')
|
||||
WHERE cl.`id_lang` = '.(int)$context->language->id.' AND c.`level_depth` <> 0
|
||||
AND cl.`name` LIKE \'%'.pSQL($q).'%\'
|
||||
GROUP BY c.id_category
|
||||
ORDER BY c.`position`
|
||||
LIMIT '.(int)$limit);
|
||||
if ($results)
|
||||
foreach ($results as $result)
|
||||
echo trim($result['name']).'|'.(int)$result['id_category']."\n";
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('getParentCategoriesId') && $id_category = Tools::getValue('id_category'))
|
||||
{
|
||||
$category = new Category((int)$id_category);
|
||||
$results = Db::getInstance()->executeS('SELECT `id_category` FROM `'._DB_PREFIX_.'category` c WHERE c.`nleft` < '.(int)$category->nleft.' AND c.`nright` > '.(int)$category->nright.'');
|
||||
$output = array();
|
||||
foreach ($results as $result)
|
||||
$output[] = $result;
|
||||
|
||||
die(Tools::jsonEncode($output));
|
||||
}
|
||||
|
||||
/* Update attribute */
|
||||
if (Tools::isSubmit('ajaxUpdateTaxRule'))
|
||||
{
|
||||
$id_tax_rule = Tools::getValue('id_tax_rule');
|
||||
$tax_rules = new TaxRule((int)$id_tax_rule);
|
||||
$output = array();
|
||||
foreach ($tax_rules as $key => $result)
|
||||
$output[$key] = $result;
|
||||
die(Tools::jsonEncode($output));
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('getZones'))
|
||||
{
|
||||
$zones = Zone::getZones();
|
||||
$html = '<select id="zone_to_affect" name="zone_to_affect">';
|
||||
foreach ($zones as $z)
|
||||
{
|
||||
$html .= '<option value="'.$z['id_zone'].'">'.$z['name'].'</option>';
|
||||
}
|
||||
$html .= '</select>';
|
||||
$array = array('hasError' => false, 'errors' => '', 'data' => $html);
|
||||
die(Tools::jsonEncode($html));
|
||||
}
|
||||
|
||||
function displayJavascriptAlert($s)
|
||||
{
|
||||
echo '<script type="text/javascript">alert(\''.addslashes($s).'\');</script>';
|
||||
}
|
69
BO/ajax_products_list.php
Executable file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
include(_PS_ADMIN_DIR_.'/../config/config.inc.php');
|
||||
/* Getting cookie or logout */
|
||||
require_once(_PS_ADMIN_DIR_.'/init.php');
|
||||
|
||||
$query = Tools::getValue('q', false);
|
||||
if (!$query OR $query == '' OR strlen($query) < 1)
|
||||
die();
|
||||
|
||||
/*
|
||||
* In the SQL request the "q" param is used entirely to match result in database.
|
||||
* In this way if string:"(ref : #ref_pattern#)" is displayed on the return list,
|
||||
* they are no return values just because string:"(ref : #ref_pattern#)"
|
||||
* is not write in the name field of the product.
|
||||
* So the ref pattern will be cut for the search request.
|
||||
*/
|
||||
if($pos = strpos($query, ' (ref:'))
|
||||
$query = substr($query, 0, $pos);
|
||||
|
||||
$excludeIds = Tools::getValue('excludeIds', false);
|
||||
if ($excludeIds && $excludeIds != 'NaN')
|
||||
$excludeIds = implode(',', array_map('intval', explode(',', $excludeIds)));
|
||||
else
|
||||
$excludeIds = '';
|
||||
|
||||
// Excluding downloadable products from packs because download from pack is not supported
|
||||
$excludeVirtuals = (bool)Tools::getValue('excludeVirtuals', false);
|
||||
$exclude_packs = (bool)Tools::getValue('exclude_packs', false);
|
||||
|
||||
$sql = 'SELECT p.`id_product`, `reference`, pl.name
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.id_product = p.id_product AND pl.id_lang = '.(int)Context::getContext()->language->id.Shop::addSqlRestrictionOnLang('pl').')
|
||||
WHERE (pl.name LIKE \'%'.pSQL($query).'%\' OR p.reference LIKE \'%'.pSQL($query).'%\')'.
|
||||
(!empty($excludeIds) ? ' AND p.id_product NOT IN ('.$excludeIds.') ' : ' ').
|
||||
($excludeVirtuals ? 'AND p.id_product NOT IN (SELECT pd.id_product FROM `'._DB_PREFIX_.'product_download` pd WHERE (pd.id_product = p.id_product))' : '').
|
||||
($exclude_packs ? 'AND (p.cache_is_pack IS NULL OR p.cache_is_pack = 0)' : '');
|
||||
|
||||
$items = Db::getInstance()->executeS($sql);
|
||||
|
||||
if ($items)
|
||||
foreach ($items AS $item)
|
||||
echo trim($item['name']).(!empty($item['reference']) ? ' (ref: '.$item['reference'].')' : '').'|'.(int)($item['id_product'])."\n";
|
||||
|
54
BO/ajaxfilemanager/_ajax_get_details_listing.php
Executable file
@ -0,0 +1,54 @@
|
||||
<div id="content">
|
||||
<table class="tableList" id="tableList" cellpadding="0" cellspacing="0" border="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="5"><a href="#" class="check_all" id="tickAll" title="<?php echo TIP_SELECT_ALL; ?>" onclick="checkAll(this);"> </a></th>
|
||||
<th width="10" class="fileColumns"> </th>
|
||||
<th class="docName"><?php echo LBL_NAME; ?></th>
|
||||
<th width="70" class="fileColumns"><?php echo LBL_SIZE; ?></th>
|
||||
<th class="fileColumns"><?php echo LBL_MODIFIED; ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="fileList">
|
||||
<?php
|
||||
$count = 1;
|
||||
$css = "";
|
||||
//list all documents (files and folders) under this current folder,
|
||||
//<?php echo appendQueryString(appendQueryString(CONFIG_URL_FILEnIMAGE_MANAGER, "path=" . $file['path']), makeQueryString(array('path')));
|
||||
foreach($fileList as $file)
|
||||
{
|
||||
$css = ($css == "" || $css == "even"?"odd":"even");
|
||||
$strDisabled = ($file['is_writable']?"":" disabled");
|
||||
$strClass = ($file['is_writable']?"left":" leftDisabled");
|
||||
if($file['type'] == 'file')
|
||||
{
|
||||
|
||||
?>
|
||||
<tr class="<?php echo $css; ?>" id="row<?php echo $count; ?>" >
|
||||
<td align="center" id="tdz<?php echo $count; ?>"><span id="flag<?php echo $count; ?>" class="<?php echo $file['flag']; ?>"> </span><input type="checkbox" name="check[]" id="cb<?php echo $count; ?>" value="<?php echo $file['path']; ?>" <?php echo $strDisabled; ?> />
|
||||
</td>
|
||||
<td align="center" class="fileColumns" id="tdst<?php echo $count; ?>"> <a id="a<?php echo $count; ?>" href="<?php echo $file['path']; ?>" target="_blank"><span class="<?php echo $file['cssClass']; ?>"> </span></a></td>
|
||||
<td class="<?php echo $strClass; ?> docName" id="tdnd<?php echo $count; ?>"><?php echo $file['name']; ?></td>
|
||||
<td class="docInfo" id="tdrd<?php echo $count; ?>"><?php echo transformFileSize($file['size']); ?></td>
|
||||
<td class="docInfo" id="tdth<?php echo $count; ?>"><?php echo @date(DATE_TIME_FORMAT,$file['mtime']); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}else
|
||||
{
|
||||
?>
|
||||
<tr class="<?php echo $css; ?>" id="row<?php echo $count; ?>" >
|
||||
<td align="center" id="tdz<?php echo $count; ?>"><span id="flag<?php echo $count; ?>" class="<?php echo $file['flag']; ?>"> </span><input type="checkbox" name="check[]" id="cb<?php echo $count; ?>" value="<?php echo $file['path']; ?>" <?php echo $strDisabled; ?>/>
|
||||
</td>
|
||||
<td lign="center" class="fileColumns" id="tdst<?php echo $count; ?>"> <a id="a<?php echo $count; ?>" href="<?php echo $file['path']; ?>" <?php echo $file['cssClass'] == 'filePicture'?'rel="ajaxPhotos"':''; ?> ><span class="<?php echo ($file['file']||$file['subdir']?$file['cssClass']:"folderEmpty"); ?>"> </span></a></td>
|
||||
<td class="<?php echo $strClass; ?> docName" id="tdnd<?php echo $count; ?>"><?php echo $file['name']; ?></td>
|
||||
<td class="docInfo" id="tdrd<?php echo $count; ?>"> </td>
|
||||
<td class="docInfo" id="tdth<?php echo $count; ?>"><?php echo @date(DATE_TIME_FORMAT,$file['mtime']); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
37
BO/ajaxfilemanager/_ajax_get_thumbnail_listing.php
Executable file
@ -0,0 +1,37 @@
|
||||
<div id="content">
|
||||
<?php
|
||||
|
||||
$count = 1;
|
||||
$thumbnailBaseUrl = appendQueryString(CONFIG_URL_IMG_THUMBNAIL, makeQueryString(array('path')));
|
||||
foreach($fileList as $file)
|
||||
|
||||
{
|
||||
?>
|
||||
<dl class="thumbnailListing" id="dl<?php echo $count; ?>">
|
||||
<dt id="dt<?php echo $count; ?>" class="<?php echo ($file['type'] == 'folder' && empty($file['file']) && empty($file['subdir'])?'folderEmpty':$file['cssClass']); ?>" class="<?php echo $file['cssClass']; ?>">
|
||||
<?php
|
||||
switch($file['cssClass'])
|
||||
{
|
||||
case 'filePicture':
|
||||
echo '<a id="thumbUrl' . $count . '" rel="thumbPhotos" href="' . $file['path'] . '">';
|
||||
echo '<img src="' . appendQueryString($thumbnailBaseUrl, 'path=' . $file['path']) . '" id="thumbImg' . $count . '"></a>' . "\n";
|
||||
break;
|
||||
case 'fileFlash':
|
||||
case 'fileVideo':
|
||||
case 'fileMusic':
|
||||
break;
|
||||
default:
|
||||
echo ' ';
|
||||
}
|
||||
?>
|
||||
|
||||
</dt>
|
||||
<dd id="dd<?php echo $count; ?>" class="thumbnailListing_info"><span id="flag<?php echo $count; ?>" class="<?php echo $file['flag']; ?>"> </span><input id="cb<?php echo $count; ?>" type="checkbox" name="check[]" <?php echo ($file['is_writable']?'':'disabled'); ?> class="radio" value="<?php echo $file['path']; ?>" />
|
||||
<a <?php echo ($file['cssClass']== 'filePicture'?'rel="orgImg"':''); ?> href="<?php echo $file['path']; ?>" title="<?php echo $file['name']; ?>" id="a<?php echo $count; ?>"><?php echo shortenFileName($file['name']); ?></a></dd>
|
||||
|
||||
</dl>
|
||||
<?php
|
||||
$count++;
|
||||
}
|
||||
?>
|
||||
</div>
|
19
BO/ajaxfilemanager/_ajax_load_folders.php
Executable file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
if (!defined('_PS_ADMIN_DIR_'))
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
?>
|
||||
<select class="input inputSearch" name="search_folder" id="search_folder">
|
||||
<?php
|
||||
|
||||
foreach(getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v)
|
||||
{
|
||||
?>
|
||||
<option value="<?php echo $v; ?>" ><?php echo shortenFileName($k, 30); ?></option>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
</select>
|
691
BO/ajaxfilemanager/_ajaxfilemanager.php
Executable file
@ -0,0 +1,691 @@
|
||||
<?php
|
||||
if (!defined('_PS_ADMIN_DIR_'))
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
/**
|
||||
* file manager platform
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
//$session->gc();
|
||||
require_once(CLASS_SESSION_ACTION);
|
||||
$sessionAction = new SessionAction();
|
||||
if(CONFIG_LOAD_DOC_LATTER)
|
||||
{
|
||||
$fileList = array();
|
||||
$folderInfo = array('path'=>getCurrentFolderPath());
|
||||
}else
|
||||
{
|
||||
require_once(CLASS_MANAGER);
|
||||
|
||||
|
||||
$manager = new manager();
|
||||
$manager->setSessionAction($sessionAction);
|
||||
$fileList = $manager->getFileList();
|
||||
$folderInfo = $manager->getFolderInfo();
|
||||
}
|
||||
if(CONFIG_SYS_THUMBNAIL_VIEW_ENABLE)
|
||||
{
|
||||
$views = array(
|
||||
'detail'=>LBL_BTN_VIEW_DETAILS,
|
||||
'thumbnail'=>LBL_BTN_VIEW_THUMBNAIL,
|
||||
);
|
||||
}else
|
||||
{
|
||||
$views = array(
|
||||
'detail'=>LBL_BTN_VIEW_DETAILS,
|
||||
);
|
||||
}
|
||||
|
||||
if(!empty($_GET['view']))
|
||||
{
|
||||
switch($_GET['view'])
|
||||
{
|
||||
case 'detail':
|
||||
case 'thumbnail':
|
||||
$view = $_GET['view'];
|
||||
break;
|
||||
default:
|
||||
$view = CONFIG_DEFAULT_VIEW;
|
||||
}
|
||||
}else
|
||||
{
|
||||
$view = CONFIG_DEFAULT_VIEW;
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" debug="true">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Ajax File Manager</title>
|
||||
<script type="text/javascript" src="jscripts/ajaxfilemanager_c.js"></script>
|
||||
<!--<script type="text/javascript" src="jscripts/jquery.js"></script>
|
||||
<script type="text/javascript" src="jscripts/form.js"></script>
|
||||
<script type="text/javascript" src="jscripts/select.js"></script>
|
||||
<script type="text/javascript" src="jscripts/thickbox.js"></script>
|
||||
<script type="text/javascript" src="jscripts/calendar.js"></script>
|
||||
<script type="text/javascript" src="jscripts/contextmenu.js"></script>
|
||||
<script type="text/javascript" src="jscripts/media.js"></script>
|
||||
<script type="text/javascript" src="jscripts/ajaxfileupload.js"></script>
|
||||
<script type="text/javascript" src="jscripts/ajaxfilemanager.js"></script>-->
|
||||
<script type="text/javascript">
|
||||
var globalSettings = {'upload_init':false};
|
||||
var queryString = '<?php echo Tools::safeOutput(makeQueryString(array('path'))); ?>';
|
||||
var paths = {'root':'<?php echo addTrailingSlash(backslashToSlash(CONFIG_SYS_ROOT_PATH)); ?>', 'root_title':'<?php echo LBL_FOLDER_ROOT; ?>'};
|
||||
var parentFolder = {};
|
||||
var urls = {
|
||||
'upload':'<?php echo CONFIG_URL_UPLOAD; ?>',
|
||||
'preview':'<?php echo CONFIG_URL_PREVIEW; ?>',
|
||||
'cut':'<?php echo CONFIG_URL_CUT; ?>',
|
||||
'copy':'<?php echo CONFIG_URL_COPY; ?>',
|
||||
'paste':'<?php echo CONFIG_URL_FILE_PASTE; ?>',
|
||||
'delete':'<?php echo CONFIG_URL_DELETE; ?>',
|
||||
'rename':'<?php echo CONFIG_URL_SAVE_NAME; ?>',
|
||||
'thumbnail':'<?php echo CONFIG_URL_IMG_THUMBNAIL; ?>',
|
||||
'create_folder':'<?php echo CONFIG_URL_CREATE_FOLDER; ?>',
|
||||
'text_editor':'<?php echo CONFIG_URL_TEXT_EDITOR; ?>',
|
||||
'image_editor':'<?php echo CONFIG_URL_IMAGE_EDITOR; ?>',
|
||||
'download':'<?php echo CONFIG_URL_DOWNLOAD; ?>',
|
||||
'present':'<?php echo Tools::safeOutput(getCurrentUrl()); ?>',
|
||||
'home':'<?php echo CONFIG_URL_HOME; ?>',
|
||||
'view':'<?php echo CONFIG_URL_LIST_LISTING; ?>'
|
||||
};
|
||||
var permits = {'del':<?php echo (CONFIG_OPTIONS_DELETE?1:0); ?>, 'cut':<?php echo (CONFIG_OPTIONS_CUT?'1':'0'); ?>, 'copy':<?php echo (CONFIG_OPTIONS_COPY?1:0); ?>, 'newfolder':<?php echo (CONFIG_OPTIONS_NEWFOLDER?1:0); ?>, 'rename':<?php echo (CONFIG_OPTIONS_RENAME?1:0); ?>, 'upload':<?php echo (CONFIG_OPTIONS_UPLOAD?1:0); ?>, 'edit':<?php echo (CONFIG_OPTIONS_EDITABLE?1:0); ?>, 'view_only':<?php echo (CONFIG_SYS_VIEW_ONLY?1:0); ?>};
|
||||
var currentFolder = {};
|
||||
var warningDelete = '<?php echo WARNING_DELETE; ?>';
|
||||
var newFile = {'num':1, 'label':'<?php echo FILE_LABEL_SELECT; ?>', 'upload':'<?php echo FILE_LBL_UPLOAD; ?>'};
|
||||
var counts = {'new_file':1};
|
||||
var thickbox = {'width':'<?php echo CONFIG_THICKBOX_MAX_WIDTH; ?>',
|
||||
'height':'<?php echo CONFIG_THICKBOX_MAX_HEIGHT; ?>',
|
||||
'next':'<?php echo THICKBOX_NEXT; ?>',
|
||||
'previous':'<?php echo THICKBOX_PREVIOUS; ?>',
|
||||
'close':'<?php echo THICKBOX_CLOSE; ?>'
|
||||
|
||||
};
|
||||
|
||||
var tb_pathToImage = "theme/<?php echo CONFIG_THEME_NAME; ?>/images/loadingAnimation.gif";
|
||||
var msgInvalidFolderName = '<?php echo ERR_FOLDER_FORMAT; ?>';
|
||||
var msgInvalidFileName = '<?php echo ERR_FILE_NAME_FORMAT; ?>';
|
||||
var msgInvalidExt = '<?php echo ERR_FILE_TYPE_NOT_ALLOWED; ?>';
|
||||
var msgNotPreview = '<?php echo PREVIEW_NOT_PREVIEW; ?>';
|
||||
|
||||
var warningCutPaste = '<?php echo WARNING_CUT_PASTE; ?>';
|
||||
var warningCopyPaste = '<?php echo WARNING_COPY_PASTE; ?>';
|
||||
var warningDel = '<?php echo WARNING_DELETE; ?>';
|
||||
var warningNotDocSelected = '<?php echo ERR_NOT_DOC_SELECTED; ?>';
|
||||
var noFileSelected = '<?php echo ERR_NOT_FILE_SELECTED; ?>';
|
||||
var unselectAllText = '<?php echo TIP_UNSELECT_ALL; ?>';
|
||||
var selectAllText = '<?php echo TIP_SELECT_ALL; ?>';
|
||||
var action = '<?php echo $sessionAction->getAction(); ?>';
|
||||
var numFiles = <?php echo $sessionAction->count(); ?>;
|
||||
var warningCloseWindow = '<?php echo WARING_WINDOW_CLOSE; ?>';
|
||||
var numRows = 0;
|
||||
|
||||
var wordCloseWindow = '<?php echo LBL_ACTION_CLOSE; ?>';
|
||||
var wordPreviewClick = '<?php echo LBL_CLICK_PREVIEW; ?>';
|
||||
|
||||
var searchRequired = false;
|
||||
var supporedPreviewExts = '<?php echo CONFIG_VIEWABLE_VALID_EXTS; ?>';
|
||||
var supportedUploadExts = '<?php echo CONFIG_UPLOAD_VALID_EXTS; ?>'
|
||||
var elementId = <?php echo (!empty($_GET['elementId'])?"'" . Tools::safeOutput($_GET['elementId']) . "'":'null'); ?>;
|
||||
var files = {};
|
||||
$(document).ready(
|
||||
function()
|
||||
{
|
||||
jQuery(document).bind('keypress', function(event) {
|
||||
var code=event.charCode || event.keyCode;
|
||||
if(code && code == 13) {// if enter is pressed
|
||||
event.preventDefault(); //prevent browser from following the actual href
|
||||
};
|
||||
});
|
||||
if(typeof(cancelSelectFile) != 'undefined')
|
||||
{
|
||||
$('#linkClose').show();
|
||||
}
|
||||
$('input[@name=view]').each(
|
||||
function()
|
||||
{
|
||||
|
||||
if(this.value == '<?php echo $view; ?>')
|
||||
{
|
||||
this.checked = true;
|
||||
}else
|
||||
{
|
||||
this.checked = false;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
popUpCal.clearText = '<?php echo CALENDAR_CLEAR; ?>';
|
||||
popUpCal.closeText = '<?php echo CALENDAR_CLOSE; ?>';
|
||||
popUpCal.prevText = '<?php echo CALENDAR_PREVIOUS; ?>';
|
||||
popUpCal.nextText = '<?php echo CALENDAR_NEXT; ?>';
|
||||
popUpCal.currentText = '<?php echo CALENDAR_CURRENT; ?>';
|
||||
popUpCal.buttonImageOnly = true;
|
||||
popUpCal.dayNames = new Array('<?php echo CALENDAR_SUN; ?>','<?php echo CALENDAR_MON; ?>','<?php echo CALENDAR_TUE; ?>','<?php echo CALENDAR_WED; ?>','<?php echo CALENDAR_THU; ?>','<?php echo CALENDAR_FRI; ?>','<?php echo CALENDAR_SAT; ?>');
|
||||
popUpCal.monthNames = new Array('<?php echo CALENDAR_JAN; ?>','<?php echo CALENDAR_FEB; ?>','<?php echo CALENDAR_MAR; ?>','<?php echo CALENDAR_APR; ?>','<?php echo CALENDAR_MAY; ?>','<?php echo CALENDAR_JUN; ?>','<?php echo CALENDAR_JUL; ?>','<?php echo CALENDAR_AUG; ?>','<?php echo CALENDAR_SEP; ?>','<?php echo CALENDAR_OCT; ?>','<?php echo CALENDAR_NOV; ?>','<?php echo CALENDAR_DEC; ?>');
|
||||
popUpCal.dateFormat = 'YMD-';
|
||||
$('.inputMtime').calendar({autoPopUp:'both', buttonImage:'theme/<?php echo CONFIG_THEME_NAME; ?>/images/standard/date_picker.png'});
|
||||
|
||||
|
||||
initAfterListingLoaded();
|
||||
//addMoreFile();
|
||||
|
||||
} );
|
||||
|
||||
|
||||
</script>
|
||||
<?php
|
||||
if(file_exists(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'jscripts' . DIRECTORY_SEPARATOR . 'for_' . CONFIG_EDITOR_NAME . ".js")
|
||||
{
|
||||
?>
|
||||
<script type="text/javascript" src="jscripts/<?php echo 'for_' . CONFIG_EDITOR_NAME . '.js'; ?>"></script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<link rel="stylesheet" type="text/css" href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/template.css" />
|
||||
<link rel="stylesheet" type="text/css" href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/jquery-calendar.css" />
|
||||
<link rel="stylesheet" href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/thickbox.css" type="text/css" media="screen" />
|
||||
<!--[if IE 6]>
|
||||
<link href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/ie6.css" type="text/css" rel="Stylesheet" media="screen">
|
||||
<![endif]-->
|
||||
</head>
|
||||
<body style="background-color:#E8E8E8;">
|
||||
<div id="wrapper">
|
||||
<div id="header">
|
||||
<dl id="currentFolderInfo">
|
||||
<dt><?php echo LBL_CURRENT_FOLDER_PATH; ?></dt>
|
||||
<dd id="currentFolderPath"><?php echo $folderInfo['path']; ?></dd>
|
||||
</dl>
|
||||
<div id="viewList">
|
||||
|
||||
|
||||
<label><?php echo LBL_BTN_VIEW_OPTIONS; ?></label>
|
||||
<?php
|
||||
foreach($views as $k=>$v)
|
||||
{
|
||||
?>
|
||||
<input type="radio" name="view" class="radio" onclick="changeView(this);" value="<?php echo $k; ?>" <?php echo ($k==$view?'checked':''); ?>> <?php echo $v; ?>
|
||||
|
||||
<?php
|
||||
}
|
||||
?></div>
|
||||
<ul id="actionHeader">
|
||||
<li><a href="#" id="actionRefresh" onclick="return windowRefresh();"><span><?php echo LBL_ACTION_REFRESH; ?></span></a></li>
|
||||
<li><a href="#" id="actionSelectAll" class="check_all" onclick="return checkAll(this);"><span><?php echo LBL_ACTION_SELECT_ALL; ?></span></a></li>
|
||||
<?php
|
||||
if(CONFIG_OPTIONS_DELETE)
|
||||
{
|
||||
?>
|
||||
<li><a href="#" id="actionDelete" onclick="return deleteDocuments();"><span><?php echo LBL_ACTION_DELETE; ?></span></a></li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if(CONFIG_OPTIONS_CUT)
|
||||
{
|
||||
?>
|
||||
<li><a href="#" id="actionCut" onclick="return cutDocuments('<?php echo ERR_NOT_DOC_SELECTED_FOR_CUT; ?>');"><span><?php echo LBL_ACTION_CUT; ?></span></a></li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if(CONFIG_OPTIONS_COPY)
|
||||
{
|
||||
?>
|
||||
<li><a href="#" id="actionCopy" onclick="return copyDocuments('<?php echo ERR_NOT_DOC_SELECTED_FOR_COPY; ?>');"><span><?php echo LBL_ACTION_COPY; ?></span></a></li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if(CONFIG_OPTIONS_CUT || CONFIG_OPTIONS_COPY)
|
||||
{
|
||||
?>
|
||||
<li><a href="#" id="actionPaste" onclick="return pasteDocuments('<?php echo ERR_NOT_DOC_SELECTED_FOR_PASTE; ?>');"><span><?php echo LBL_ACTION_PASTE; ?></span></a></li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
if(CONFIG_OPTIONS_NEWFOLDER)
|
||||
{
|
||||
?>
|
||||
<li><a id="actionNewFolder" href="#" onclick="return newFolderWin(this);"><span><?php echo LBL_BTN_NEW_FOLDER; ?></span></a></li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if(CONFIG_OPTIONS_UPLOAD)
|
||||
{
|
||||
?>
|
||||
<li><a id="actionUpload" href="#" onclick="return uploadFileWin(this);"><span><?php echo LBL_BTN_UPLOAD; ?></span></a></li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- <li><a href="#" id="actionClose" onclick="closeWindow('<?php echo IMG_WARING_WIN_CLOSE; ?>');"><?php echo IMG_BTN_CLOSE; ?></a></li>-->
|
||||
<li><a href="#" class="thickbox" id="actionInfo" onclick="return infoWin(this);"><span>Info</span></a></li>
|
||||
<!-- thest functions will be added in the near future
|
||||
<li ><a href="#" id="actionZip"><span>Zip</span></a><li>
|
||||
<li ><a href="#" id="actionUnzip"><span>Unzip</span></a><li>-->
|
||||
</ul>
|
||||
<form action="" method="post" name="formAction" id="formAction"><input type="hidden" name="currentFolderPath" id="currentFolderPathVal" value="" /><select name="selectedDoc[]" id="selectedDoc" style="display:none;" multiple="multiple"></select><input type="hidden" name="action_value" value="" id="action_value" /></form>
|
||||
</div>
|
||||
|
||||
<div id="body">
|
||||
|
||||
|
||||
<div id="rightCol">
|
||||
<?php
|
||||
if(CONFIG_LOAD_DOC_LATTER )
|
||||
{
|
||||
$currentPath = getCurrentFolderPath();
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
parentFolder = {path:'<?php echo getParentFolderPath($currentPath); ?>'};
|
||||
currentFolder = {'friendly_path':'<?php echo transformFilePath($currentPath); ?>'};
|
||||
$(document).ready(
|
||||
function()
|
||||
{
|
||||
var url = getUrl('view', false, false, false);
|
||||
$('#rightCol').empty();
|
||||
ajaxStart('#rightCol');
|
||||
|
||||
$('#rightCol').load(url,
|
||||
{},
|
||||
function(){
|
||||
ajaxStop('#rightCol img.ajaxLoadingImg');
|
||||
urls.present = getUrl('home', true, true);
|
||||
initAfterListingLoaded();
|
||||
});
|
||||
}
|
||||
);
|
||||
</script>
|
||||
<?php
|
||||
}else
|
||||
{
|
||||
include_once(CONFIG_URL_LIST_LISTING);
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div id="leftCol">
|
||||
|
||||
|
||||
|
||||
<fieldset id="folderFieldSet" >
|
||||
|
||||
<legend><?php echo LBL_FOLDER_INFO; ?></legend>
|
||||
<table cellpadding="0" cellspacing="0" class="tableSummary" id="folderInfo">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><?php echo LBL_FOLDER_PATH; ?></th>
|
||||
<td colspan="3" id="folderPath"><?php echo transformFilePath($folderInfo['path']); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo LBL_FOLDER_CREATED; ?></th>
|
||||
<td colspan="3" id="folderCtime"><?php echo (!empty($folderInfo['ctime'])?date(DATE_TIME_FORMAT,$folderInfo['ctime']):' ') ; ?></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo LBL_FOLDER_MODIFIED; ?></th>
|
||||
<td colspan="3" id="folderMtime"><?php echo (!empty($folderInfo['mtime'])?date(DATE_TIME_FORMAT,$folderInfo['mtime']):' '); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo LBL_FOLDER_SUDDIR; ?></th>
|
||||
<td colspan="3" id="folderSubdir"><?php echo (isset($folderInfo['subdir'])?$folderInfo['subdir']:" "); ?></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo LBL_FOLDER_FIELS; ?></th>
|
||||
<td colspan="3" id="folderFile"><?php echo (isset($folderInfo['file'])?$folderInfo['file']:' '); ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th><?php echo LBL_FOLDER_WRITABLE; ?></th>
|
||||
<td id="folderWritable"><span class="<?php echo (isset($folderInfo['is_readable'])?($folderInfo['is_readable']?'flagYes':'flagNo'):' '); ?>"> </span></td>
|
||||
<th><?php echo LBL_FOLDER_READABLE; ?></th>
|
||||
<td id="folderReadable"><span class="<?php echo (isset($folderInfo['is_writable'])?($folderInfo['is_writable']?'flagYes':'flagNo'):' '); ?>"> </span></td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
<fieldset id="fileFieldSet" style="display:none" >
|
||||
<legend><?php echo LBL_FILE_INFO; ?></legend>
|
||||
<table cellpadding="0" cellspacing="0" class="tableSummary" id="fileInfo">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><?php echo LBL_FILE_NAME; ?></th>
|
||||
<td colspan="3" id="fileName"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo LBL_FILE_CREATED; ?></th>
|
||||
<td colspan="3" id="fileCtime"></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo LBL_FILE_MODIFIED; ?></th>
|
||||
<td colspan="3" id="fileMtime"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo LBL_FILE_SIZE; ?></th>
|
||||
<td colspan="3" id="fileSize"></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo LBL_FILE_TYPE; ?></th>
|
||||
<td colspan="3" id="fileType"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo LBL_FILE_WRITABLE; ?></th>
|
||||
<td id="fileWritable"><span class="flagYes"> </span></td>
|
||||
<th><?php echo LBL_FILE_READABLE; ?></th>
|
||||
<td id="fileReadable"><span class="flagNo"> </span></td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p class="searchButtons" id="returnCurrentUrl">
|
||||
|
||||
<span class="right" id="linkSelect">
|
||||
<input type="button" value="<?php echo MENU_SELECT; ?>" id="selectCurrentUrl" class="button">
|
||||
</span>
|
||||
|
||||
</p>
|
||||
</fieldset>
|
||||
|
||||
|
||||
|
||||
<fieldset class="boxSearch">
|
||||
<legend><?php echo LBL_SEARCH; ?></legend>
|
||||
|
||||
|
||||
|
||||
<table cellpadding="0" cellspacing="0" class="tableSearch">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<b><?php echo LBL_SEARCH_NAME; ?></b> <br />
|
||||
<input type="text" class="input inputSearch" name="search_name" id="search_name" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td >
|
||||
<b><?php echo LBL_SEARCH_FOLDER; ?></b><br />
|
||||
<span id="searchFolderContainer">
|
||||
<?php
|
||||
if(CONFIG_LOAD_DOC_LATTER)
|
||||
{
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(
|
||||
function()
|
||||
{
|
||||
ajaxStart('#searchFolderContainer');
|
||||
$('#searchFolderContainer').load('<?php echo CONFIG_URL_LOAD_FOLDERS; ?>');
|
||||
}
|
||||
);
|
||||
</script>
|
||||
<?php
|
||||
}else
|
||||
{
|
||||
?>
|
||||
<select class="input inputSearch" name="search_folder" id="search_folder">
|
||||
<?php
|
||||
|
||||
foreach(getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v)
|
||||
{
|
||||
?>
|
||||
<option value="<?php echo $v; ?>" <?php echo (removeTrailingSlash(backslashToSlash(($folderInfo['path']))) == removeTrailingSlash(backslashToSlash(($v)))?' selected="selected"':''); ?>><?php echo shortenFileName($k, 30); ?></option>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
</select>
|
||||
<?php
|
||||
}
|
||||
?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<b><?php echo LBL_SEARCH_MTIME; ?></b><br />
|
||||
<input type="text" class="input inputMtime" name="search_mtime_from" id="search_mtime_from" value="<?php echo (!empty($_GET['search_mtime_from'])?Tools::safeOutput($_GET['search_mtime_from']):''); ?>" />
|
||||
<span class="leftToRightArrow"> </span>
|
||||
<input type="text" class="input inputMtime" name="search_mtime_to" id="search_mtime_to" value="<?php echo (!empty($_GET['search_mtime_to'])?Tools::safeOutput($_GET['search_mtime_to']):''); ?>" />
|
||||
</td></tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<b><?php echo LBL_SEARCH_RECURSIVELY; ?></b>
|
||||
<input type="radio" name="search_recursively" value="1" id="search_recursively_1" class="radio" <?php echo (!empty($_GET['search_recursively'])?'checked="checked"':''); ?> /> <?php echo LBL_RECURSIVELY_YES; ?>
|
||||
<input type="radio" name="search_recursively" value="0" id="search_recursively_0" class="radio" <?php echo (empty($_GET['search_recursively'])?'checked="checked"':''); ?> /> <?php echo LBL_RECURSIVELY_NO; ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
<p class="searchButtons">
|
||||
<span class="left" id="linkClose" style="display:none">
|
||||
<input type="button" value="<?php echo LBL_ACTION_CLOSE; ?>" onclick="return cancelSelectFile();" class="button">
|
||||
</span>
|
||||
<span class="right" id="linkSearch">
|
||||
<input type="button" value="<?php echo BTN_SEARCH; ?>" onclick="return search();" class="button">
|
||||
</span>
|
||||
|
||||
</p>
|
||||
</fieldset>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
|
||||
|
||||
|
||||
<div id="ajaxLoading" style="display:none"><img class="ajaxLoadingImg" src="theme/<?php echo CONFIG_THEME_NAME; ?>/images/ajaxLoading.gif" /></div>
|
||||
<div id="winUpload" style="display:none">
|
||||
<div class="jqmContainer">
|
||||
<div class="jqmHeader">
|
||||
<a href="#" onclick="tb_remove();"><?php echo LBL_ACTION_CLOSE; ?></a>
|
||||
</div>
|
||||
<div class="jqmBody">
|
||||
<form id="formUpload" name="formUpload" method="post" enctype="multipart/form-data" action="">
|
||||
<table class="tableForm" cellpadding="0" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2"><?php echo FILE_FORM_TITLE; ?><a class="action" href="#" title="<?php echo FILE_LBL_MORE; ?>" onclick="return addMoreFile();"><span class="addMore"> </span></a></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="fileUploadBody">
|
||||
<tr style="display:none">
|
||||
<th><label><?php echo FILE_LABEL_SELECT; ?></label></th>
|
||||
<td><input type="file" class="input" name="file" /> <input type="button" class="button" value="<?php echo FILE_LBL_UPLOAD; ?>" /> <a href="#" class="action" title="Cancel" style="display:none" ><span class="cancel"> </span></a> <span class="uploadProcessing" style="display:none"> <span></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div id="winNewFolder" style="display:none">
|
||||
<div class="jqmContainer">
|
||||
<div class="jqmHeader">
|
||||
<a href="#" onclick="tb_remove();"><?php echo LBL_ACTION_CLOSE; ?></a>
|
||||
</div>
|
||||
<div class="jqmBody">
|
||||
<form id="formNewFolder" name="formNewFolder" method="post" action="">
|
||||
<input type="hidden" name="currentFolderPath" value="" id="currentNewfolderPath" />
|
||||
<table class="tableForm" cellpadding="0" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2"><?php echo FOLDER_FORM_TITLE; ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><label><?php echo FOLDER_LBL_TITLE; ?></label></th>
|
||||
<td><input type="text" name="new_folder" id="new_folder" value="" class="input"></td>
|
||||
</tr>
|
||||
|
||||
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<td><input type="button" value="<?php echo FOLDER_LBL_CREATE; ?>" class="button" onclick="return doCreateFolder();" /></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div id="winPlay" style="display:none">
|
||||
<div class="jqmContainer">
|
||||
<div class="jqmHeader">
|
||||
<a href="#" onclick="closeWinPlay();"><?php echo LBL_ACTION_CLOSE; ?></a>
|
||||
</div>
|
||||
<div class="jqmBody">
|
||||
<div id="playGround"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="winRename" style="display:none">
|
||||
<div class="jqmContainer">
|
||||
<div class="jqmHeader">
|
||||
<a href="#" onclick="tb_remove();"><?php echo LBL_ACTION_CLOSE; ?></a>
|
||||
</div>
|
||||
<div class="jqmBody">
|
||||
<form id="formRename" name="formRename" method="post" action="">
|
||||
<input type="hidden" name="original_path" id="original_path" />
|
||||
<input type="hidden" name="num" id="renameNum" value="" />
|
||||
<table class="tableForm" cellpadding="0" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2"><?php echo RENAME_FORM_TITLE; ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><label><?php echo RENAME_NEW_NAME; ?></label></th>
|
||||
<td><input type="name" id="renameName" class="input" name="name" style="width:250px" />
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<td><input type="button" value="<?php echo RENAME_LBL_RENAME; ?>" class="button" onclick="return doRename();" /></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div id="winInfo" style="display:none">
|
||||
<div class="jqmContainer">
|
||||
<div class="jqmHeader">
|
||||
<a href="#" onclick="tb_remove();"><?php echo LBL_ACTION_CLOSE; ?></a>
|
||||
</div>
|
||||
<div class="jqmBody">
|
||||
<table class="tableInfo" cellpadding="0" cellspacing="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th nowrap>
|
||||
<label>Author:</label>
|
||||
</th>
|
||||
<td>
|
||||
<a href="mailto:cailongqun@yahoo.com.cn">Logan Cai</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th nowrap>
|
||||
<label>Template Designer:</label>
|
||||
</th>
|
||||
<td>
|
||||
<a href="mailto:Gabriel@4v.com.br">Gabriel</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th nowrap>
|
||||
<label>Official Website:</label>
|
||||
</th>
|
||||
<td>
|
||||
<a href="http://www.phpletter.com">http://www.phpletter.com</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th nowrap>
|
||||
<label>Support Forum:</label>
|
||||
</th>
|
||||
<td>
|
||||
<a href="http://www.phpletter.com/forum/">http://www.phpletter.com/forum/</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th nowrap>
|
||||
<label>©Copyright:</label>
|
||||
</th>
|
||||
<td>
|
||||
All copyright declarations in the source must remain unchange. Please contact us if you need to make changes to it, in order to avoid any Legal Issues.
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div id="contextMenu" style="display:none">
|
||||
<ul>
|
||||
<li><a href="#" class="contentMenuItem" id="menuSelect"><?php echo MENU_SELECT; ?></a></li>
|
||||
<li><a href="#" class="contentMenuItem" id="menuPreview"><?php echo MENU_PREVIEW; ?></a></li>
|
||||
<li><a href="#" class="contentMenuItem" id="menuDownload"><?php echo MENU_DOWNLOAD; ?></a></li>
|
||||
<li><a href="#" class="contentMenuItem" id="menuRename"><?php echo MENU_RENAME; ?></a></li>
|
||||
<li><a href="#" class="contentMenuItem" id="menuEdit"><?php echo MENU_EDIT; ?></a></li>
|
||||
<li><a href="#" class="contentMenuItem" id="menuCut"><?php echo MENU_CUT; ?></a></li>
|
||||
<li><a href="#" class="contentMenuItem" id="menuCopy"><?php echo MENU_COPY; ?></a></li>
|
||||
<li><a href="#" class="contentMenuItem" id="menuPaste"><?php echo MENU_PASTE; ?></a></li>
|
||||
<li><a href="#" class="contentMenuItem" id="menuDelete"><?php echo MENU_DELETE; ?></a></li>
|
||||
<li><a href="#" class="contentMenuItem" id="menuPlay"><?php echo MENU_PLAY; ?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
80
BO/ajaxfilemanager/ajax_create_folder.php
Executable file
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
/**
|
||||
* create a folder
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
if (!defined('_PS_ADMIN_DIR_'))
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
@ob_start();
|
||||
$safe_post = array();
|
||||
foreach ($_POST AS $key => $value)
|
||||
$safe_post[Tools::safeOutput($key)] = Tools::safeOutput($value);
|
||||
displayArray($safe_post);
|
||||
writeInfo(@ob_get_clean());
|
||||
echo "{";
|
||||
$error = "";
|
||||
$info = "";
|
||||
/* $_POST['new_folder'] = substr(md5(time()), 1, 5);
|
||||
$_POST['currentFolderPath'] = "../../uploaded/";*/
|
||||
if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_NEWFOLDER)
|
||||
{
|
||||
$error = SYS_DISABLED;
|
||||
}
|
||||
elseif(empty($_POST['new_folder']))
|
||||
{
|
||||
$error = ERR_FOLDER_NAME_EMPTY;
|
||||
}elseif(!preg_match("/^[a-zA-Z0-9_\- ]+$/", $_POST['new_folder']))
|
||||
{
|
||||
$error = ERR_FOLDER_FORMAT;
|
||||
}else if(empty($_POST['currentFolderPath']) || !isUnderRoot($_POST['currentFolderPath']))
|
||||
{
|
||||
$error = ERR_FOLDER_PATH_NOT_ALLOWED;
|
||||
}
|
||||
elseif(file_exists(addTrailingSlash($_POST['currentFolderPath']) . $_POST['new_folder']))
|
||||
{
|
||||
$error = ERR_FOLDER_EXISTS;
|
||||
}else
|
||||
{
|
||||
include_once(CLASS_FILE);
|
||||
$file = new file();
|
||||
if($file->mkdir(addTrailingSlash($_POST['currentFolderPath']) . $_POST['new_folder'], 0775))
|
||||
{
|
||||
include_once(CLASS_MANAGER);
|
||||
$manager = new manager(addTrailingSlash($_POST['currentFolderPath']) . $_POST['new_folder'], false);
|
||||
$pathInfo = $manager->getFolderInfo(addTrailingSlash($_POST['currentFolderPath']) . $_POST['new_folder']);
|
||||
foreach($pathInfo as $k=>$v)
|
||||
{
|
||||
switch ($k)
|
||||
{
|
||||
|
||||
|
||||
case "ctime";
|
||||
case "mtime":
|
||||
case "atime":
|
||||
$v = date(DATE_TIME_FORMAT, $v);
|
||||
break;
|
||||
case 'name':
|
||||
$info .= sprintf(", %s:'%s'", 'short_name', shortenFileName($v));
|
||||
break;
|
||||
case 'cssClass':
|
||||
$v = 'folderEmpty';
|
||||
break;
|
||||
}
|
||||
$info .= sprintf(", %s:'%s'", $k, $v);
|
||||
}
|
||||
}else
|
||||
{
|
||||
$error = ERR_FOLDER_CREATION_FAILED;
|
||||
}
|
||||
//$error = "For security reason, folder creation function has been disabled.";
|
||||
}
|
||||
echo "error:'" . $error . "'";
|
||||
echo $info;
|
||||
echo "}";
|
||||
?>
|
81
BO/ajaxfilemanager/ajax_delete_file.php
Executable file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
/**
|
||||
* delete selected files
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/April/2007
|
||||
*
|
||||
*/
|
||||
if (!defined('_PS_ADMIN_DIR_'))
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
$error = "";
|
||||
if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_DELETE)
|
||||
{
|
||||
$error = SYS_DISABLED;
|
||||
}
|
||||
elseif(!empty($_GET['delete']))
|
||||
{//delete the selected file from context menu
|
||||
if(!file_exists($_GET['delete']))
|
||||
{
|
||||
$error = ERR_FILE_NOT_AVAILABLE;
|
||||
}
|
||||
elseif(!isUnderRoot($_GET['delete']))
|
||||
{
|
||||
$error = ERR_FOLDER_PATH_NOT_ALLOWED;
|
||||
}else
|
||||
{
|
||||
include_once(CLASS_FILE);
|
||||
$file = new file();
|
||||
if(is_dir($_GET['delete'])
|
||||
&& isValidPattern(CONFIG_SYS_INC_DIR_PATTERN, getBaseName($_GET['delete']))
|
||||
&& !isInvalidPattern(CONFIG_SYS_EXC_DIR_PATTERN, getBaseName($_GET['delete'])))
|
||||
{
|
||||
$file->delete(addTrailingSlash(backslashToSlash($_GET['delete'])));
|
||||
}elseif(is_file($_GET['delete'])
|
||||
&& isValidPattern(CONFIG_SYS_INC_FILE_PATTERN, getBaseName($_GET['delete']))
|
||||
&& !isInvalidPattern(CONFIG_SYS_EXC_FILE_PATTERN, getBaseName($_GET['delete']))
|
||||
)
|
||||
{
|
||||
$file->delete(($_GET['delete']));
|
||||
}
|
||||
}
|
||||
}else
|
||||
{
|
||||
if(!isset($_POST['selectedDoc']) || !is_array($_POST['selectedDoc']) || sizeof($_POST['selectedDoc']) < 1)
|
||||
{
|
||||
$error = ERR_NOT_FILE_SELECTED;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
include_once(CLASS_FILE);
|
||||
$file = new file();
|
||||
|
||||
foreach($_POST['selectedDoc'] as $doc)
|
||||
{
|
||||
if(file_exists($doc) && isUnderRoot($doc))
|
||||
{
|
||||
if(is_dir($doc)
|
||||
&& isValidPattern(CONFIG_SYS_INC_DIR_PATTERN, $doc)
|
||||
&& !isInvalidPattern(CONFIG_SYS_EXC_DIR_PATTERN, $doc))
|
||||
{
|
||||
$file->delete(addTrailingSlash(backslashToSlash($doc)));
|
||||
}elseif(is_file($doc)
|
||||
&& isValidPattern(CONFIG_SYS_INC_FILE_PATTERN, $doc)
|
||||
&& !isInvalidPattern(CONFIG_SYS_EXC_FILE_PATTERN, $doc)
|
||||
)
|
||||
{
|
||||
$file->delete($doc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo "{error:'" . $error . "'}";
|
||||
?>
|
35
BO/ajaxfilemanager/ajax_download.php
Executable file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* delete selected files
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/April/2007
|
||||
*
|
||||
*/
|
||||
if (!defined('_PS_ADMIN_DIR_'))
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
if(!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path']) && isUnderRoot($_GET['path']))
|
||||
{
|
||||
|
||||
$path = $_GET['path'];
|
||||
//check if the file size
|
||||
$fileSize = @filesize($path);
|
||||
|
||||
if($fileSize > getMemoryLimit())
|
||||
{//larger then the php memory limit, redirect to the file
|
||||
|
||||
header('Location: ' . $path);
|
||||
exit;
|
||||
}else
|
||||
{//open it up and send out with php
|
||||
downloadFile($path);
|
||||
|
||||
}
|
||||
}else
|
||||
{
|
||||
die(ERR_DOWNLOAD_FILE_NOT_FOUND);
|
||||
}
|
||||
?>
|
120
BO/ajaxfilemanager/ajax_editor_reset.php
Executable file
@ -0,0 +1,120 @@
|
||||
<?php
|
||||
/**
|
||||
* reset the image
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
if (!defined('_PS_ADMIN_DIR_'))
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
if(!isset($_POST['path']))
|
||||
{
|
||||
$_POST['path'] = "uploaded/Winter.jpg" . "?" . makeQueryString(array('path'));
|
||||
//for crop
|
||||
$_POST['mode'] = "crop";
|
||||
$_POST['x'] = 100;
|
||||
$_POST['y'] = 100;
|
||||
$imageInfo = @GetImageSize($_POST['path']);
|
||||
$_POST['width'] = $imageInfo[0];
|
||||
$_POST['height'] = $imageInfo[1];
|
||||
|
||||
}
|
||||
initSessionHistory($_POST['path']);
|
||||
|
||||
echo "{";
|
||||
$error = "";
|
||||
$info = "";
|
||||
|
||||
if(empty($_POST['path']))
|
||||
{
|
||||
$error = IMG_SAVE_EMPTY_PATH;
|
||||
}elseif(!file_exists($_POST['path']))
|
||||
{
|
||||
$error = IMG_SAVE_NOT_EXISTS;
|
||||
}else if(!isUnderRoot($_POST['path']))
|
||||
{
|
||||
$error = IMG_SAVE_PATH_DISALLOWED;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!empty($_POST['mode']))
|
||||
{
|
||||
|
||||
include_once(CLASS_IMAGE);
|
||||
$image = new Image();
|
||||
$image->loadImage($_POST['path']);
|
||||
|
||||
switch($_POST['mode'])
|
||||
{
|
||||
case "resize":
|
||||
if(!$image->resize($_POST['width'], $_POST['height'], (!empty($_POST['constraint'])?true:false)))
|
||||
{
|
||||
$error = IMG_SAVE_RESIZE_FAILED;
|
||||
}
|
||||
break;
|
||||
case "crop":
|
||||
if(!$image->cropToDimensions($_POST['x'], $_POST['y'], (int)($_POST['x']) + (int)($_POST['width']), (int)($_POST['y']) + (int)($_POST['height'])))
|
||||
{
|
||||
$error = IMG_SAVE_CROP_FAILED;
|
||||
}
|
||||
|
||||
break;
|
||||
case "flip":
|
||||
if(!$image->flip($_POST['flip_angle']))
|
||||
{
|
||||
$error = IMG_SAVE_FLIP_FAILED;
|
||||
}
|
||||
break;
|
||||
case "rotate":
|
||||
if(!$image->rotate((int)($_POST['angle'])))
|
||||
{
|
||||
$error = IMG_SAVE_ROTATE_FAILED;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$error = IMG_SAVE_UNKNOWN_MODE;
|
||||
}
|
||||
if(empty($error))
|
||||
{
|
||||
|
||||
$sessionNewPath = $session->getSessionDir() . uniqid(md5(time())) . "." . getFileExt($_POST['path']);
|
||||
if(!@copy($_POST['path'], $sessionNewPath))
|
||||
{
|
||||
$error = IMG_SAVE_BACKUP_FAILED;
|
||||
}else
|
||||
{
|
||||
addSessionHistory($_POST['path'], $sessionNewPath);
|
||||
if($image->saveImage($_POST['path']))
|
||||
{
|
||||
$imageInfo = $image->getFinalImageInfo();
|
||||
$info .= ",width:" . $imageInfo['width'] . "\n";
|
||||
$info .= ",height:" . $imageInfo['height'] . "\n";
|
||||
$info .= ",size:'" . transformFileSize($imageInfo['size']) . "'\n";
|
||||
}else
|
||||
{
|
||||
$error = IMG_SAVE_FAILED;
|
||||
}
|
||||
}
|
||||
}else
|
||||
{
|
||||
//$image->DestroyImages();
|
||||
}
|
||||
}else
|
||||
{
|
||||
$error = IMG_SAVE_UNKNOWN_MODE;
|
||||
}
|
||||
}
|
||||
|
||||
echo "error:'" . $error . "'\n";
|
||||
if(isset($image) && is_object($image))
|
||||
{
|
||||
$image->DestroyImages();
|
||||
}
|
||||
echo $info;
|
||||
echo ",history:" . sizeof($_SESSION[$_POST['path']]) . "\n";
|
||||
echo "}";
|
||||
?>
|
37
BO/ajaxfilemanager/ajax_file_copy.php
Executable file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* copy file
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
if (!defined('_PS_ADMIN_DIR_'))
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
$error = "";
|
||||
$info = '';
|
||||
if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_COPY)
|
||||
{
|
||||
$error = SYS_DISABLED;
|
||||
}
|
||||
elseif(!isset($_POST['selectedDoc']) || !is_array($_POST['selectedDoc']) || sizeof($_POST['selectedDoc']) < 1)
|
||||
{
|
||||
$error = ERR_NOT_DOC_SELECTED_FOR_COPY;
|
||||
}
|
||||
elseif(empty($_POST['currentFolderPath']) || !isUnderRoot($_POST['currentFolderPath']))
|
||||
{
|
||||
$error = ERR_FOLDER_PATH_NOT_ALLOWED;
|
||||
}else
|
||||
{
|
||||
require_once(CLASS_SESSION_ACTION);
|
||||
$sessionAction = new SessionAction();
|
||||
$sessionAction->setAction($_POST['action_value']);
|
||||
$sessionAction->setFolder($_POST['currentFolderPath']);
|
||||
$sessionAction->set($_POST['selectedDoc']);
|
||||
$info = ',num:' . sizeof($_POST['selectedDoc']);
|
||||
}
|
||||
echo "{error:'" . $error . "'\n" . $info . "}";
|
||||
?>
|
38
BO/ajaxfilemanager/ajax_file_cut.php
Executable file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* cut file
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
if (!defined('_PS_ADMIN_DIR_'))
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
|
||||
$error = "";
|
||||
$info = '';
|
||||
if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_CUT)
|
||||
{
|
||||
$error = SYS_DISABLED;
|
||||
}
|
||||
elseif(!isset($_POST['selectedDoc']) || !is_array($_POST['selectedDoc']) || sizeof($_POST['selectedDoc']) < 1)
|
||||
{
|
||||
$error = ERR_NOT_DOC_SELECTED_FOR_CUT;
|
||||
}
|
||||
elseif(empty($_POST['currentFolderPath']) || !isUnderRoot($_POST['currentFolderPath']))
|
||||
{
|
||||
$error = ERR_FOLDER_PATH_NOT_ALLOWED;
|
||||
}else
|
||||
{
|
||||
require_once(CLASS_SESSION_ACTION);
|
||||
$sessionAction = new SessionAction();
|
||||
$sessionAction->setAction($_POST['action_value']);
|
||||
$sessionAction->setFolder($_POST['currentFolderPath']);
|
||||
$sessionAction->set($_POST['selectedDoc']);
|
||||
$info = ',num:' . sizeof($_POST['selectedDoc']);
|
||||
}
|
||||
echo "{error:'" . $error . "'\n" . $info . "}";
|
||||
?>
|
142
BO/ajaxfilemanager/ajax_file_paste.php
Executable file
@ -0,0 +1,142 @@
|
||||
<?
|
||||
include_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
if (!defined('_PS_ADMIN_DIR_'))
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
$error = '';
|
||||
$fileMoved = array();
|
||||
$unmovedDocDueToSamePath = array();
|
||||
if(CONFIG_SYS_VIEW_ONLY || (!CONFIG_OPTIONS_CUT && !CONFIG_OPTIONS_COPY))
|
||||
{
|
||||
$error = SYS_DISABLED;
|
||||
}
|
||||
elseif(empty($_GET['current_folder_path']))
|
||||
{
|
||||
$error = ERR_NOT_DEST_FOLDER_SPECIFIED;
|
||||
}elseif(!file_exists($_GET['current_folder_path']) || !is_dir($_GET['current_folder_path']))
|
||||
{
|
||||
$error = ERR_DEST_FOLDER_NOT_FOUND;
|
||||
}elseif(!isUnderRoot($_GET['current_folder_path']))
|
||||
{
|
||||
$error = ERR_DEST_FOLDER_NOT_ALLOWED;
|
||||
}else
|
||||
{
|
||||
|
||||
include_once(CLASS_MANAGER);
|
||||
include_once(CLASS_SESSION_ACTION);
|
||||
$sessionAction = new SessionAction();
|
||||
include_once(DIR_AJAX_INC . "class.manager.php");
|
||||
$manager = new manager();
|
||||
$manager->setSessionAction($sessionAction);
|
||||
$selectedDocuments = $sessionAction->get();
|
||||
|
||||
$destFolderPath = addTrailingSlash(backslashToSlash($_GET['current_folder_path']));
|
||||
|
||||
|
||||
if(sizeof($selectedDocuments))
|
||||
{
|
||||
//get all files within the destination folder
|
||||
$allDocs = array();
|
||||
if(($fh = @opendir($_GET['current_folder_path'])))
|
||||
{
|
||||
while(($file = readdir($fh)) && $file != '.' && $file != '..')
|
||||
{
|
||||
$allDocs[] = getRealPath($destFolderPath . $file);
|
||||
}
|
||||
}
|
||||
closedir($fh);
|
||||
include_once(CLASS_FILE);
|
||||
$file = new file();
|
||||
//check if all files are allowed to cut or copy
|
||||
|
||||
foreach($selectedDocuments as $doc)
|
||||
{
|
||||
if(file_exists($doc) && isUnderRoot($doc) )
|
||||
{
|
||||
|
||||
if( array_search(getRealPath($doc), $allDocs) === false || CONFIG_OVERWRITTEN)
|
||||
{
|
||||
if(CONFIG_OVERWRITTEN)
|
||||
{
|
||||
$file->delete($doc);
|
||||
}
|
||||
if($file->copyTo($doc, $_GET['current_folder_path']))
|
||||
{
|
||||
|
||||
$finalPath = $destFolderPath . basename($doc);
|
||||
$objFile = new file($finalPath);
|
||||
$tem = $objFile->getFileInfo();
|
||||
$obj = new manager($finalPath, false);
|
||||
|
||||
$fileType = $obj->getFileType($finalPath, (is_dir($finalPath)?true:false));
|
||||
|
||||
foreach($fileType as $k=>$v)
|
||||
{
|
||||
$tem[$k] = $v;
|
||||
}
|
||||
|
||||
/* foreach ($folderInfo as $k=>$v)
|
||||
{
|
||||
$tem['i_' . $k] = $v;
|
||||
}
|
||||
if($folderInfo['type'] == 'folder' && empty($folderInfo['subdir']) && empty($folderInfo['file']))
|
||||
{
|
||||
$tem['cssClass'] = 'folderEmpty';
|
||||
}*/
|
||||
|
||||
$tem['final_path'] = $finalPath;
|
||||
$tem['path'] = backslashToSlash($finalPath);
|
||||
$tem['type'] = (is_dir($finalPath)?'folder':'file');
|
||||
$tem['size'] = @transformFileSize($tem['size']);
|
||||
$tem['ctime'] = date(DATE_TIME_FORMAT, $tem['ctime']);
|
||||
$tem['mtime'] = date(DATE_TIME_FORMAT, $tem['mtime']);
|
||||
$tem['flag'] = 'noFlag';
|
||||
$tem['url'] = getFileUrl($doc);
|
||||
|
||||
$manager = null;
|
||||
if($sessionAction->getAction() == "cut")
|
||||
{
|
||||
$file->delete($doc);
|
||||
}
|
||||
$fileMoved[sizeof($fileMoved)] = $tem;
|
||||
$tem = null;
|
||||
}
|
||||
}else
|
||||
{
|
||||
$unmovedDocDueToSamePath[] = $doc;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$sessionAction->set(array());
|
||||
}
|
||||
if(sizeof($unmovedDocDueToSamePath) == sizeof($selectedDocuments))
|
||||
{
|
||||
$error = ERR_DEST_FOLDER_NOT_ALLOWED;
|
||||
}elseif(sizeof($unmovedDocDueToSamePath))
|
||||
{
|
||||
foreach($unmovedDocDueToSamePath as $v)
|
||||
{
|
||||
$error .= sprintf(ERR_UNABLE_TO_MOVE_TO_SAME_DEST, $v) . "\r\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo "{'error':'" . $error . "', 'unmoved_files':" . sizeof($unmovedDocDueToSamePath) . ", 'files':{";
|
||||
foreach($fileMoved as $i=>$file)
|
||||
{
|
||||
|
||||
echo ($i>0?', ':' ') . $i . ": { ";
|
||||
$j = 0;
|
||||
foreach($file as $k=>$v)
|
||||
{
|
||||
echo ($j++ > 0? ", ":'') . "'" . $k . "':'" . $v . "'";
|
||||
|
||||
}
|
||||
echo "} ";
|
||||
}
|
||||
echo "} }";
|
||||
|
||||
?>
|
91
BO/ajaxfilemanager/ajax_file_upload.php
Executable file
@ -0,0 +1,91 @@
|
||||
<?php
|
||||
/**
|
||||
* processing the uploaded files
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
if (!defined('_PS_ADMIN_DIR_'))
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
|
||||
sleep(3);
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
echo "{";
|
||||
$error = "";
|
||||
$info = "";
|
||||
|
||||
include_once(CLASS_UPLOAD);
|
||||
$upload = new Upload();
|
||||
|
||||
$upload->setInvalidFileExt(explode(",", CONFIG_UPLOAD_INVALID_EXTS));
|
||||
if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_UPLOAD)
|
||||
{
|
||||
$error = SYS_DISABLED;
|
||||
}
|
||||
elseif(empty($_GET['folder']) || !isUnderRoot($_GET['folder']))
|
||||
{
|
||||
$error = ERR_FOLDER_PATH_NOT_ALLOWED;
|
||||
}else if(!$upload->isFileUploaded('file'))
|
||||
{
|
||||
$error = ERR_FILE_NOT_UPLOADED;
|
||||
}else if(!$upload->moveUploadedFile($_GET['folder']))
|
||||
{
|
||||
$error = ERR_FILE_MOVE_FAILED;
|
||||
}
|
||||
elseif(!$upload->isPermittedFileExt(explode(",", CONFIG_UPLOAD_VALID_EXTS)))
|
||||
{
|
||||
$error = ERR_FILE_TYPE_NOT_ALLOWED;
|
||||
}elseif(defined('CONFIG_UPLOAD_MAXSIZE') && CONFIG_UPLOAD_MAXSIZE && $upload->isSizeTooBig(CONFIG_UPLOAD_MAXSIZE))
|
||||
{
|
||||
$error = sprintf(ERROR_FILE_TOO_BID, transformFileSize(CONFIG_UPLOAD_MAXSIZE));
|
||||
}else
|
||||
{
|
||||
include_once(CLASS_FILE);
|
||||
$path = $upload->getFilePath();
|
||||
$obj = new file($path);
|
||||
$tem = $obj->getFileInfo();
|
||||
if(sizeof($tem))
|
||||
{
|
||||
include_once(CLASS_MANAGER);
|
||||
|
||||
$manager = new manager($upload->getFilePath(), false);
|
||||
|
||||
$fileType = $manager->getFileType($upload->getFileName());
|
||||
|
||||
foreach($fileType as $k=>$v)
|
||||
{
|
||||
$tem[$k] = $v;
|
||||
}
|
||||
|
||||
$tem['path'] = backslashToSlash($path);
|
||||
$tem['type'] = "file";
|
||||
$tem['size'] = transformFileSize($tem['size']);
|
||||
$tem['ctime'] = date(DATE_TIME_FORMAT, $tem['ctime']);
|
||||
$tem['mtime'] = date(DATE_TIME_FORMAT, $tem['mtime']);
|
||||
$tem['short_name'] = shortenFileName($tem['name']);
|
||||
$tem['flag'] = 'noFlag';
|
||||
$obj->close();
|
||||
foreach($tem as $k=>$v)
|
||||
{
|
||||
$info .= sprintf(", %s:'%s'", $k, $v);
|
||||
}
|
||||
|
||||
$info .= sprintf(", url:'%s'", getFileUrl($path));
|
||||
$info .= sprintf(", tipedit:'%s'", TIP_DOC_RENAME);
|
||||
|
||||
|
||||
}else
|
||||
{
|
||||
$error = ERR_FILE_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
echo "error:'" . $error . "'";
|
||||
echo $info;
|
||||
echo "}";
|
||||
|
||||
?>
|
141
BO/ajaxfilemanager/ajax_get_file_listing.php
Executable file
@ -0,0 +1,141 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* the php script used to get the list of file or folders under a specific folder
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
if (!defined('_PS_ADMIN_DIR_'))
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
|
||||
if(!isset($manager))
|
||||
{
|
||||
/**
|
||||
* this is part of script for processing file paste
|
||||
*/
|
||||
//$_GET = $_POST;
|
||||
include_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
include_once(CLASS_PAGINATION);
|
||||
$pagination = new pagination(false);
|
||||
if(!empty($_GET['search']))
|
||||
{
|
||||
include_once(CLASS_SEARCH);
|
||||
|
||||
$search = new Search($_GET['search_folder']);
|
||||
$search->addSearchKeyword('recursive', @$_GET['search_recursively']);
|
||||
$search->addSearchKeyword('mtime_from', @$_GET['search_mtime_from']);
|
||||
$search->addSearchKeyword('mtime_to', @$_GET['search_mtime_to']);
|
||||
$search->addSearchKeyword('size_from', @$_GET['search_size_from']);
|
||||
$search->addSearchKeyword('size_to', @$_GET['search_size_to']);
|
||||
$search->addSearchKeyword('recursive', @$_GET['search_recursively']);
|
||||
$search->addSearchKeyword('name', @$_GET['search_name']);
|
||||
$search->doSearch();
|
||||
$fileList = $search->getFoundFiles();
|
||||
$folderInfo = $search->getRootFolderInfo();
|
||||
|
||||
}else
|
||||
{
|
||||
include_once(CLASS_MANAGER);
|
||||
include_once(CLASS_SESSION_ACTION);
|
||||
$sessionAction = new SessionAction();
|
||||
include_once(DIR_AJAX_INC . "class.manager.php");
|
||||
|
||||
$manager = new manager();
|
||||
$manager->setSessionAction($sessionAction);
|
||||
|
||||
$fileList = $manager->getFileList();
|
||||
$folderInfo = $manager->getFolderInfo();
|
||||
|
||||
}
|
||||
$pagination->setUrl(CONFIG_URL_FILEnIMAGE_MANAGER);
|
||||
|
||||
}else
|
||||
{
|
||||
include_once(CLASS_PAGINATION);
|
||||
$pagination = new pagination(false);
|
||||
}
|
||||
|
||||
|
||||
$pagination->setTotal(sizeof($fileList));
|
||||
$pagination->setFirstText(PAGINATION_FIRST);
|
||||
$pagination->setPreviousText(PAGINATION_PREVIOUS);
|
||||
$pagination->setNextText(PAGINATION_NEXT);
|
||||
$pagination->setLastText(PAGINATION_LAST);
|
||||
$pagination->setLimit(!empty($_GET['limit'])?(int)($_GET['limit']):CONFIG_DEFAULT_PAGINATION_LIMIT);
|
||||
echo $pagination->getPaginationHTML();
|
||||
echo "<script type=\"text/javascript\">\n";
|
||||
|
||||
echo "parentFolder = {path:'" . getParentFolderPath($folderInfo['path']). "'};\n";
|
||||
echo 'currentFolder ={';
|
||||
$count =1;
|
||||
foreach($folderInfo as $k=>$v)
|
||||
{
|
||||
echo ($count++ == 1?'':',') . "'" . $k . "':'" . ($k=='ctime'|| $k=='mtime'?date(DATE_TIME_FORMAT, $v):$v) . "'";
|
||||
|
||||
}
|
||||
echo "};\n";
|
||||
$fileList = array_slice($fileList, $pagination->getPageOffset(), $pagination->getLimit());
|
||||
echo 'numRows = ' . sizeof($fileList) . ";\n";
|
||||
echo "files = {\n";
|
||||
$count = 1;
|
||||
|
||||
|
||||
foreach($fileList as $file)
|
||||
{
|
||||
echo (($count > 1)?",":'').$count++ . ":{";
|
||||
$j = 1;
|
||||
foreach($file as $k=>$v)
|
||||
{
|
||||
|
||||
if($k == 'ctime' || $k == 'mtime')
|
||||
{
|
||||
$v = @date(DATE_TIME_FORMAT, $v);
|
||||
}
|
||||
if($k == 'size')
|
||||
{
|
||||
$v = transformFileSize($v);
|
||||
}
|
||||
echo (($j++ > 1)?",":'') . "'" . $k . "':'" . $v . "'";
|
||||
}
|
||||
echo (($j++ > 1)?",":'') . "'url':'" . getFileUrl($file['path']) . "'";
|
||||
echo "}\n";
|
||||
}
|
||||
echo "};</script>\n";
|
||||
if(!empty($_GET['view']))
|
||||
{
|
||||
switch($_GET['view'])
|
||||
{
|
||||
case 'detail':
|
||||
case 'thumbnail':
|
||||
case 'text':
|
||||
$view = $_GET['view'];
|
||||
break;
|
||||
default:
|
||||
$view = CONFIG_DEFAULT_VIEW;
|
||||
}
|
||||
}else
|
||||
{
|
||||
$view = CONFIG_DEFAULT_VIEW;
|
||||
}
|
||||
switch($view)
|
||||
{
|
||||
case 'text':
|
||||
//list file name only
|
||||
include_once(DIR_AJAX_ROOT . '_ajax_get_text_listing.php');
|
||||
break;
|
||||
case 'thumbnail':
|
||||
//list file with thumbnail
|
||||
include_once(DIR_AJAX_ROOT . '_ajax_get_thumbnail_listing.php');
|
||||
break;
|
||||
case 'detail':
|
||||
default:
|
||||
include_once(DIR_AJAX_ROOT . '_ajax_get_details_listing.php');
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
17
BO/ajaxfilemanager/ajax_get_folder_listing.php
Executable file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
if (!defined('_PS_ADMIN_DIR_'))
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
echo '{';
|
||||
$count = 1;
|
||||
foreach(getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v)
|
||||
{
|
||||
|
||||
|
||||
echo (($count > 1)?', ':''). "'" . $v . "':'" . $k . "'";
|
||||
$count++;
|
||||
}
|
||||
echo "}";
|
||||
?>
|
212
BO/ajaxfilemanager/ajax_image_editor.php
Executable file
@ -0,0 +1,212 @@
|
||||
<?php
|
||||
if (!defined('_PS_ADMIN_DIR_'))
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
/**
|
||||
* Ajax image editor platform
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE)
|
||||
{
|
||||
die(SYS_DISABLED);
|
||||
}
|
||||
//$session->gc();
|
||||
$_GET['path'] = empty($_GET['path'])?CONFIG_SYS_ROOT_PATH . "ajax_image_editor_demo.jpg":$_GET['path'];
|
||||
if(!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path']) && isUnderRoot($_GET['path']))
|
||||
{
|
||||
$path = $_GET['path'];
|
||||
}else
|
||||
{
|
||||
die(IMG_GEN_IMG_NOT_EXISTS);
|
||||
}
|
||||
require_once(CLASS_HISTORY);
|
||||
$history = new History($path, $session);
|
||||
if(CONFIG_SYS_DEMO_ENABLE)
|
||||
{
|
||||
$sessionImageInfo = $history->getLastestRestorable();
|
||||
$originalSessionImageInfo = $history->getOriginalImage();
|
||||
if(sizeof($originalSessionImageInfo))
|
||||
{
|
||||
$path = backslashToSlash($session->getSessionDir() . $originalSessionImageInfo['info']['name']);
|
||||
}
|
||||
}
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "class.image.php");
|
||||
$image = new Image();
|
||||
|
||||
$imageInfo = $image->getImageInfo($path);
|
||||
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="author" content="Logan Cai" />
|
||||
<meta name="website" content="http://www.phpletter.com" />
|
||||
<script type="text/javascript" src="jscripts/ajaximageeditor_c.js"></script>
|
||||
<!--
|
||||
<script type="text/javascript" src="jscripts/jquery.js"></script>
|
||||
<script type="text/javascript" src="jscripts/form.js"></script>
|
||||
<script type="text/javascript" src="jscripts/select.js"></script>
|
||||
<script type="text/javascript" src="jscripts/jqModal.js"></script>
|
||||
<script type="text/javascript" src="jscripts/rotate.js"></script>
|
||||
<script type="text/javascript" src="jscripts/interface.js"></script>
|
||||
|
||||
-->
|
||||
<script type="text/javascript" src="jscripts/ajaximageeditor.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var imageHistory = false;
|
||||
var currentFolder = '<?php echo removeTrailingSlash(backslashToSlash(dirname($path))); ?>';
|
||||
var warningLostChanges = '<?php echo IMG_WARNING_LOST_CHANAGES; ?>';
|
||||
var warningReset = '<?php echo IMG_WARNING_REST; ?>';
|
||||
var warningResetEmpty = '<?php echo IMG_WARNING_EMPTY_RESET; ?>';
|
||||
var warningEditorClose = '<?php echo IMG_WARING_WIN_CLOSE; ?>';
|
||||
var warningUndoImage = '<?php echo IMG_WARNING_UNDO; ?>';
|
||||
var warningFlipHorizotal = '<?php echo IMG_WARING_FLIP_H; ?>';
|
||||
var warningFlipVertical = '<?php echo IMG_WARING_FLIP_V; ?>';
|
||||
var numSessionHistory = <?php echo $history->getNumRestorable(); ?>;
|
||||
var noChangeMadeBeforeSave = '<?php echo IMG_WARNING_NO_CHANGE_BEFORE_SAVE; ?>';
|
||||
var warningInvalidNewName = '<?php echo IMG_SAVE_AS_ERR_NAME_INVALID; ?>';
|
||||
var wordCloseWindow = '<?php echo LBL_ACTION_CLOSE; ?>';
|
||||
var warningNoFolderSelected = '<?php echo IMG_SAVE_AS_NOT_FOLDER_SELECTED; ?>';
|
||||
var urlGetFolderList = '<?php echo appendQueryString(CONFIG_URL_GET_FOLDER_LIST, makeQueryString(array('path'))); ?>';
|
||||
$(document).ready(
|
||||
function()
|
||||
{
|
||||
$('#windowSaveAs').jqm();
|
||||
$('#image_mode').val('');
|
||||
$('#angle').val(0);
|
||||
$(getImageElement()).clone().appendTo("#hiddenImage");
|
||||
changeMode();
|
||||
initDisabledButtons(true);
|
||||
}
|
||||
);
|
||||
|
||||
</script>
|
||||
<link href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/ajaximageeditor.css" type="text/css" rel="stylesheet" />
|
||||
<link href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/jqModal.css" type="text/css" rel="stylesheet" />
|
||||
<title>Ajax Image Editor</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
//displayArray($_SESSION);
|
||||
|
||||
?>
|
||||
<div id="controls">
|
||||
<fieldset id="modes">
|
||||
<legend>Modes</legend>
|
||||
<form name="formAction" id="formAction" method="post" action="<?php echo appendQueryString(CONFIG_URL_IMAGE_UNDO, makeQueryString(array('path'))); ?>">
|
||||
<input type="hidden" name="file_path" id="file_path" value="<?php echo Tools::safeOutput($_GET['path']); ?>" />
|
||||
|
||||
<p><label><?php echo IMG_MODE_RESIZE; ?></label> <input type="radio" name="mode" value="resize" class="input" checked="checked" onclick="return changeMode();"/>
|
||||
<label><?php echo IMG_MODE_CROP; ?></label> <input type="radio" name="mode" value="crop" class="input" onclick="return changeMode();" />
|
||||
<label><?php echo IMG_MODE_ROTATE; ?></label> <input type="radio" name="mode" value="rotate" class="input" onclick="return changeMode();" />
|
||||
<label><?php echo IMG_MODE_FLIP; ?></label> <input type="radio" name="mode" value="flip" class="input" onclick="return changeMode();" />
|
||||
<label><?php echo IMG_CHECKBOX_CONSTRAINT; ?></label> <input type="checkbox" name="constraint" id="constraint" value="1" class="input" onclick="return toggleConstraint();" />
|
||||
<!-- <label>Watermark:</label> <input type="radio" name="mode" value="watermark" class="input" onclick="return false;" />-->
|
||||
|
||||
<button id="actionRotateLeft" class="disabledButton" onclick="return leftRotate();" disabled><?php echo IMG_BTN_ROTATE_LEFT; ?></button>
|
||||
<button id="actionRotateRight" class="disabledButton" onclick="return rightRotate();" disabled><?php echo IMG_BTN_ROTATE_RIGHT; ?></button>
|
||||
<button id="actionFlipH" class="disabledButton" onclick="return flipHorizontal();" disabled><?php echo IMG_BTN_FLIP_H; ?></button>
|
||||
<button id="actionFlipV" class="disabledButton" onclick="return flipVertical();" disabled><?php echo IMG_BTN_FLIP_V; ?></button>
|
||||
<button id="actionReset" class="button" onclick="return resetEditor();"><?php echo IMG_BTN_RESET; ?></button>
|
||||
<button id="actionUndo" class="button" onclick="return undoImage();"><?php echo IMG_BTN_UNDO; ?></button>
|
||||
<button id="actionSave" class="button" onclick="return saveImage();"><?php echo IMG_BTN_SAVE; ?></button>
|
||||
<button id="actionSaveAs" class="button" onclick="return saveAsImagePre();"><?php echo IMG_BTN_SAVE_AS; ?></button>
|
||||
<button id="actionClose" class="button" onclick="return editorClose();"><?php echo IMG_BTN_CLOSE; ?></button></p>
|
||||
</form>
|
||||
</fieldset>
|
||||
<fieldset id="imageInfo">
|
||||
<legend id="imageInfoLegend"><?php echo IMG_INFO; ?></legend>
|
||||
<form name="formImageInfo" action="<?php echo appendQueryString(CONFIG_URL_IMAGE_SAVE, makeQueryString(array('path'))); ?>" method="post" id="formImageInfo">
|
||||
<p><input type="hidden" name="mode" id="image_mode" value="" />
|
||||
<input type="hidden" name="new_name" id="hidden_new_name" value="" />
|
||||
<input type="hidden" name="save_to" id="hidden_save_to" value="" />
|
||||
<input type="hidden" name="path" id="path" value="<?php echo Tools::safeOutput($_GET['path']); ?>" />
|
||||
<input type="hidden" name="flip_angle" id="flip_angle" value="" />
|
||||
<label><?php echo IMG_LBL_WIDTH; ?></label> <input type="text" name="width" id="width" value="" class="input imageInput" />
|
||||
<label><?php echo IMG_LBL_HEIGHT; ?></label> <input type="text" name="height" id="height" value="" class="input imageInput" />
|
||||
<label><?php echo IMG_LBL_X; ?></label> <input type="text" name="x" id="x" value="" class="input imageInput"/>
|
||||
<label><?php echo IMG_LBL_Y; ?></label> <input type="text" name="y" id="y" value="" class="input imageInput"/>
|
||||
<!-- <b>Percentage:</b> <input type="text" name="percentage" id="percentage" value="" class="input imageInput"/>-->
|
||||
<label><?php echo IMG_LBL_RATIO; ?></label> <input type="text" name="ratio" id="ratio" value="" class="input imageInput"/>
|
||||
<label><?php echo IMG_LBL_ANGLE; ?></label> <input type="text" name="angle" id="angle" value="" class="input imageInput" />
|
||||
|
||||
</p>
|
||||
</form>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div id="imageArea">
|
||||
<div id="imageContainer">
|
||||
<img src="<?php echo $path; ?>" name="<?php echo basename($path); ?>" width="<?php echo $imageInfo['width']; ?>" height="<?php echo $imageInfo['height']; ?>" />
|
||||
</div>
|
||||
<div id="resizeMe">
|
||||
<div id="resizeSE"></div>
|
||||
<div id="resizeE"></div>
|
||||
<div id="resizeNE"></div>
|
||||
<div id="resizeN"></div>
|
||||
<div id="resizeNW"></div>
|
||||
<div id="resizeW"></div>
|
||||
<div id="resizeSW"></div>
|
||||
<div id="resizeS"></div>
|
||||
<img id="loading" style="display:none;" src="theme/<?php echo CONFIG_THEME_NAME; ?>/images/ajaxLoading.gif" />
|
||||
</div>
|
||||
</div>
|
||||
<div id="hiddenImage">
|
||||
</div>
|
||||
<div id="windowSaveAs" class="jqmWindow" style="display:none">
|
||||
<a href="#" class="jqmClose" id="windowSaveClose"><?php echo LBL_ACTION_CLOSE; ?></a>
|
||||
<form id="formSaveAs" name="formSaveAs" action="" method="post">
|
||||
<table class="tableForm" cellpadding="0" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2"><?php echo IMG_LBL_SAVE_AS; ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>
|
||||
<label><?php echo IMG_LBL_NEW_NAME; ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="text" id="new_name" class="input" name="new_name" value="" /> .<?php echo getFileExt($path); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<label><?php echo IMG_LBL_SAVE_TO; ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<select class="input" name="save_to" id="save_to"></select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
</th>
|
||||
<td>
|
||||
<span class="comments">*</span>
|
||||
<?php echo IMG_NEW_NAME_COMMENTS; ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<td><input type="button" class="button" value="<?php echo IMG_BTN_SAVE_AS; ?>" onclick="return saveAsImage();" /></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
198
BO/ajaxfilemanager/ajax_image_save.php
Executable file
@ -0,0 +1,198 @@
|
||||
<?php
|
||||
if (!defined('_PS_ADMIN_DIR_'))
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
/**
|
||||
* image save function
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
|
||||
|
||||
$error = "";
|
||||
$info = "";
|
||||
if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE)
|
||||
{
|
||||
$error = SYS_DISABLED;
|
||||
}
|
||||
elseif(empty($_POST['path']))
|
||||
{
|
||||
$error = IMG_SAVE_EMPTY_PATH;
|
||||
}elseif(!file_exists($_POST['path']))
|
||||
{
|
||||
$error = IMG_SAVE_NOT_EXISTS;
|
||||
}elseif(!isUnderRoot($_POST['path']))
|
||||
{
|
||||
$error = IMG_SAVE_PATH_DISALLOWED;
|
||||
}elseif(($sessionDir = $session->getSessionDir()) == '')
|
||||
{
|
||||
$error = SESSION_PERSONAL_DIR_NOT_FOUND;
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once(CLASS_HISTORY);
|
||||
$history = new History($_POST['path'], $session);
|
||||
if(!empty($_POST['mode']))
|
||||
{
|
||||
//get the original image which is the lastest session image if any when the system is in demo
|
||||
$lastestSessionImageInfo = $history->getLastestRestorable();
|
||||
if(sizeof($lastestSessionImageInfo) && CONFIG_SYS_DEMO_ENABLE)
|
||||
{
|
||||
$originalSessionImageInfo = $history->getOriginalImage();
|
||||
if(sizeof($originalSessionImageInfo))
|
||||
{
|
||||
$originalImage = $sessionDir . $originalSessionImageInfo['info']['name'];
|
||||
}
|
||||
}
|
||||
if(empty($originalImage))
|
||||
{
|
||||
$originalImage = $_POST['path'];
|
||||
}
|
||||
|
||||
include_once(CLASS_IMAGE);
|
||||
$image = new Image();
|
||||
if($image->loadImage($originalImage))
|
||||
{
|
||||
|
||||
switch($_POST['mode'])
|
||||
{
|
||||
case "resize":
|
||||
if(!$image->resize($_POST['width'], $_POST['height'], (!empty($_POST['constraint'])?true:false)))
|
||||
{
|
||||
$error = IMG_SAVE_RESIZE_FAILED;
|
||||
}
|
||||
break;
|
||||
case "crop":
|
||||
if(!$image->crop($_POST['x'], $_POST['y'], $_POST['width'], $_POST['height']))
|
||||
{
|
||||
$error = IMG_SAVE_CROP_FAILED;
|
||||
}
|
||||
break;
|
||||
case "flip":
|
||||
if(!$image->flip($_POST['flip_angle']))
|
||||
{
|
||||
$error = IMG_SAVE_FLIP_FAILED;
|
||||
}
|
||||
break;
|
||||
case "rotate":
|
||||
|
||||
if(!$image->rotate((int)($_POST['angle'])))
|
||||
{
|
||||
$error = IMG_SAVE_ROTATE_FAILED;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
$error = IMG_SAVE_UNKNOWN_MODE;
|
||||
}
|
||||
|
||||
|
||||
if(empty($error))
|
||||
{
|
||||
$sessionNewPath = $sessionDir . uniqid(md5(time())) . "." . getFileExt($_POST['path']);
|
||||
if(!@copy($originalImage, $sessionNewPath))
|
||||
{//keep a copy under the session folder
|
||||
$error = IMG_SAVE_BACKUP_FAILED;
|
||||
}else
|
||||
{
|
||||
|
||||
$isSaveAsRequest = (!empty($_POST['new_name']) && !empty($_POST['save_to'])?true:false);
|
||||
//save the modified image
|
||||
$sessionImageInfo = array('name'=>basename($sessionNewPath), 'restorable'=>1);
|
||||
$history->add($sessionImageInfo);
|
||||
if(CONFIG_SYS_DEMO_ENABLE)
|
||||
{//demo only
|
||||
if(isset($originalSessionImageInfo) && sizeof($originalSessionImageInfo))
|
||||
{
|
||||
$imagePath = $sessionDir . $originalSessionImageInfo['info']['name'];
|
||||
}else
|
||||
{
|
||||
$imagePath = $sessionDir . uniqid(md5(time())) . "." . getFileExt($_POST['path']);
|
||||
}
|
||||
}else
|
||||
{
|
||||
if($isSaveAsRequest)
|
||||
{//save as request
|
||||
//check save to folder if exists
|
||||
$imagePath = addTrailingSlash(backslashToSlash($_POST['save_to'])) . $_POST['new_name'] . "." . getFileExt($_POST['path']);
|
||||
if(!file_exists($_POST['save_to']) || !is_dir($_POST['save_to']))
|
||||
{
|
||||
$error = IMG_SAVE_AS_FOLDER_NOT_FOUND;
|
||||
}elseif(file_exists($imagePath))
|
||||
{
|
||||
$error = IMG_SAVE_AS_NEW_IMAGE_EXISTS;
|
||||
}elseif(!preg_match("/^[a-zA-Z0-9_\- ]+$/", $_POST['new_name']))
|
||||
{
|
||||
$error = IMG_SAVE_AS_ERR_NAME_INVALID;
|
||||
}
|
||||
|
||||
}else
|
||||
{//save request
|
||||
$imagePath = $originalImage;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if($image->saveImage($imagePath))
|
||||
{
|
||||
|
||||
if(CONFIG_SYS_DEMO_ENABLE)
|
||||
{
|
||||
if(!isset($originalSessionImageInfo) || !sizeof($originalSessionImageInfo))
|
||||
{//keep this original image information on session for future reference if demo only
|
||||
$originalSessionImageInfo = array('name'=>basename($imagePath), 'restorable'=>0, 'is_original'=>1);
|
||||
$history->add($originalSessionImageInfo);
|
||||
}
|
||||
}
|
||||
$imageInfo = $image->getFinalImageInfo();
|
||||
}else
|
||||
{
|
||||
$error = IMG_SAVE_FAILED;
|
||||
|
||||
}
|
||||
if(isset($imageInfo))
|
||||
{
|
||||
$info .= ",width:" . $imageInfo['width'] . "";
|
||||
$info .= ",height:" . $imageInfo['height'] . "";
|
||||
$info .= ",size:'" . transformFileSize($imageInfo['size']) . "'";
|
||||
if($isSaveAsRequest)
|
||||
{
|
||||
$info .= ",save_as:'1'";
|
||||
}else
|
||||
{
|
||||
$info .= ",save_as:'0'";
|
||||
}
|
||||
$info .= ",folder_path:'" . dirname($imagePath) . "'";
|
||||
$info .= ",path:'" . backslashToSlash($imagePath) . "'";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}else
|
||||
{
|
||||
$error = IMG_SAVE_IMG_OPEN_FAILED;
|
||||
}
|
||||
|
||||
}else
|
||||
{
|
||||
$error = IMG_SAVE_UNKNOWN_MODE;
|
||||
}
|
||||
}
|
||||
echo "{";
|
||||
echo "error:'" . $error . "'";
|
||||
if(isset($image) && is_object($image))
|
||||
{
|
||||
$image->DestroyImages();
|
||||
}
|
||||
echo $info;
|
||||
echo ",history:" . (isset($history) && is_object($history)?($history->getNumRestorable()):0) . "";
|
||||
echo "}";
|
||||
|
||||
|
||||
?>
|
37
BO/ajaxfilemanager/ajax_image_thumbnail.php
Executable file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
if (!defined('_PS_ADMIN_DIR_'))
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
/**
|
||||
* ajax preview
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/April/2007
|
||||
*
|
||||
*/
|
||||
include_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
if(!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path']))
|
||||
{
|
||||
include_once(CLASS_IMAGE);
|
||||
$image = new Image(true);
|
||||
if($image->loadImage($_GET['path']))
|
||||
{
|
||||
if($image->resize(CONFIG_IMG_THUMBNAIL_MAX_X, CONFIG_IMG_THUMBNAIL_MAX_Y, true, true))
|
||||
{
|
||||
$image->showImage();
|
||||
}else
|
||||
{
|
||||
echo PREVIEW_NOT_PREVIEW . ".";
|
||||
}
|
||||
}else
|
||||
{
|
||||
echo PREVIEW_NOT_PREVIEW . "..";
|
||||
}
|
||||
|
||||
|
||||
}else
|
||||
{
|
||||
echo PREVIEW_NOT_PREVIEW . "...";
|
||||
}
|
||||
|
98
BO/ajaxfilemanager/ajax_image_undo.php
Executable file
@ -0,0 +1,98 @@
|
||||
<?php
|
||||
if (!defined('_PS_ADMIN_DIR_'))
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
/**
|
||||
* ajax image undo function
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
require_once(CLASS_HISTORY);
|
||||
$history = new History($_POST['file_path'], $session);
|
||||
$lastestSessionImageInfo = $history->getLastestRestorable();
|
||||
echo "{";
|
||||
$error = "";
|
||||
$info = "";
|
||||
if(CONFIG_SYS_VIEW_ONLY)
|
||||
{
|
||||
$error = SYS_DISABLED;
|
||||
}
|
||||
elseif(empty($_POST['file_path']))
|
||||
{
|
||||
$error = IMG_SAVE_EMPTY_PATH;
|
||||
}elseif(!file_exists($_POST['file_path']))
|
||||
{
|
||||
$error = IMG_SAVE_NOT_EXISTS;
|
||||
}elseif(!isUnderRoot($_POST['file_path']))
|
||||
{
|
||||
$error = IMG_SAVE_PATH_DISALLOWED;
|
||||
}else if(!sizeof($lastestSessionImageInfo))
|
||||
{
|
||||
$error = IMG_UNDO_NO_HISTORY_AVAIALBE;
|
||||
}
|
||||
else
|
||||
{
|
||||
//get the original image which is the lastest session image if any when the system is in demo
|
||||
$sessionImage = $session->getSessionDir() . $lastestSessionImageInfo['name'];
|
||||
$originalSessionImageInfo = $history->getOriginalImage();
|
||||
if(CONFIG_SYS_DEMO_ENABLE && sizeof($originalSessionImageInfo))
|
||||
{
|
||||
$originalImage = $session->getSessionDir() . $originalSessionImageInfo['info']['name'];
|
||||
}else
|
||||
{
|
||||
$originalImage = $_POST['file_path'];
|
||||
}
|
||||
|
||||
include_once(CLASS_IMAGE);
|
||||
$image = new Image();
|
||||
if($image->loadImage($sessionImage))
|
||||
{
|
||||
$imageInfo = $image->getOriginalImageInfo();
|
||||
if(!@copy($sessionImage, $originalImage))
|
||||
{
|
||||
$error = IMG_UNDO_COPY_FAILED;
|
||||
}else
|
||||
{
|
||||
|
||||
//remove the session image
|
||||
if(@unlink($sessionImage))
|
||||
{
|
||||
$history->restore();
|
||||
}
|
||||
//only one left, remove the session original if demo
|
||||
|
||||
if($history->getNumRestorable() == 0 && CONFIG_SYS_DEMO_ENABLE && sizeof($originalSessionImageInfo))
|
||||
{
|
||||
@unlink($session->getSessionDir() . $originalSessionImageInfo['info']['name']);
|
||||
$originalImage = $_POST['file_path'];
|
||||
}
|
||||
}
|
||||
$imagePath = $originalImage;
|
||||
|
||||
}else
|
||||
{
|
||||
$error = IMG_SAVE_IMG_OPEN_FAILED;
|
||||
}
|
||||
if(isset($imageInfo))
|
||||
{
|
||||
$info .= ",width:" . $imageInfo['width'] . "\n";
|
||||
$info .= ",height:" . $imageInfo['height'] . "\n";
|
||||
$info .= ",size:'" . transformFileSize($imageInfo['size']) . "'\n";
|
||||
$info .= ",path:'" . backslashToSlash($imagePath) . "'\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
echo "error:'" . $error . "'\n";
|
||||
if(isset($image) && is_object($image))
|
||||
{
|
||||
$image->DestroyImages();
|
||||
}
|
||||
echo $info;
|
||||
echo ",history:" . ($history->getNumRestorable()) . "\n";
|
||||
echo "}";
|
||||
?>
|
69
BO/ajaxfilemanager/ajax_login.php
Executable file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
if (!defined('_PS_ADMIN_DIR_'))
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
/**
|
||||
* access control login form
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/April/2007
|
||||
*
|
||||
*/
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
//Code added to adjust for local admin rights.
|
||||
if(!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] === false) {
|
||||
|
||||
if(isset($_POST['username']))
|
||||
{
|
||||
if($auth->login())
|
||||
{
|
||||
header('Location: ' . appendQueryString(CONFIG_URL_HOME, makeQueryString()));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$_SESSION['ajax_user'] = true;
|
||||
header('Location: ' . appendQueryString(CONFIG_URL_HOME, makeQueryString()));
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link type="text/css" href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/login.css" rel="stylesheet" />
|
||||
<title><?php echo LOGIN_PAGE_TITLE; ?></title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="container">
|
||||
<div id="content">
|
||||
<form name="frmLogin" method="post" action="">
|
||||
<table class="adminLoginTable" cellpadding="0" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2"><?php echo LOGIN_FORM_TITLE; ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th class="padTop"><label><?php echo LOGIN_USERNAME; ?> </label></th>
|
||||
<td class="padTop"><input type="text" value="" class="input" name="username" id="username" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><label><?php echo LOGIN_PASSWORD; ?> </label></th>
|
||||
<td><input type="password" value="" class="input" name="password" id="password" /></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td><input type="submit" class="button" value="Login" /></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
62
BO/ajaxfilemanager/ajax_preview.php
Executable file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
if (!defined('_PS_ADMIN_DIR_'))
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
/**
|
||||
* ajax preview
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/April/2007
|
||||
*
|
||||
*/
|
||||
include_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
echo getRealPath($_GET['path']);
|
||||
if(!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path']))
|
||||
{
|
||||
|
||||
include_once(CLASS_MANAGER);
|
||||
$manager = new manager($_GET['path'], false);
|
||||
$fileTypes = $manager->getFileType(basename($_GET['path']));
|
||||
if($fileTypes['preview'])
|
||||
{
|
||||
switch($fileTypes['fileType'])
|
||||
{
|
||||
case "image":
|
||||
$imageInfo = @getimagesize($_GET['path']);
|
||||
if(!empty($imageInfo[0]) && !empty($imageInfo[1]))
|
||||
{
|
||||
$thumInfo = getThumbWidthHeight($imageInfo[0], $imageInfo[1], 400, 135);
|
||||
printf("<img src=\"%s\" width=\"%s\" height=\"%s\" />", getFileUrl($_GET['path']), $thumInfo['width'], $thumInfo['height']);
|
||||
|
||||
}else
|
||||
{
|
||||
echo PREVIEW_IMAGE_LOAD_FAILED;
|
||||
}
|
||||
|
||||
break;
|
||||
case "txt":
|
||||
if(($fp = @fopen($_GET['path'], 'r')))
|
||||
{
|
||||
echo @fread($fp, @filesize($_GET['path']));
|
||||
@fclose($fp);
|
||||
}else
|
||||
{
|
||||
echo PREVIEW_OPEN_FAILED . ".";
|
||||
}
|
||||
break;
|
||||
|
||||
case "video":
|
||||
break;
|
||||
}
|
||||
}else
|
||||
{
|
||||
echo PREVIEW_NOT_PREVIEW . "..";
|
||||
}
|
||||
|
||||
}else
|
||||
{
|
||||
echo PREVIEW_NOT_PREVIEW . "...";
|
||||
}
|
||||
|
||||
?>
|
61
BO/ajaxfilemanager/ajax_save_as_form.php
Executable file
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
if (!defined('_PS_ADMIN_DIR_'))
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Untitled Document</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<a href="#" class="jqmClose" id="windowSaveClose"><?php echo IMG_BTN_CANCEL; ?></a>
|
||||
<form id="formSaveAs" name="formSaveAs" action="" method="post">
|
||||
<table class="tableForm" cellpadding="0" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2"><?php echo IMG_LBL_SAVE_AS; ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>
|
||||
<label><?php echo IMG_LBL_NEW_NAME; ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="text" id="new_name" class="input" name="new_name" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<label><?php echo IMG_LBL_SAVE_TO; ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<select class="input" name="save_to">
|
||||
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
</th>
|
||||
<td>
|
||||
<span class="comments">*</span>
|
||||
<?php echo IMG_NEW_NAME_COMMENTS; ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<td><input type="button" class="button" value="<?php echo IMG_BTN_SAVE_AS; ?>" onclick="return saveAsImage();" /></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
83
BO/ajaxfilemanager/ajax_save_name.php
Executable file
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
if (!defined('_PS_ADMIN_DIR_'))
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
/**
|
||||
* ajax save name
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
$error = '';
|
||||
$fileInfo = array();
|
||||
if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_RENAME)
|
||||
{
|
||||
$error = SYS_DISABLED;
|
||||
}
|
||||
elseif(empty($_POST['name']))
|
||||
{
|
||||
$error = ERR_RENAME_EMPTY;
|
||||
}elseif(!preg_match("/^[a-zA-Z0-9 _\-.]+$/", $_POST['name']))
|
||||
{
|
||||
$error = ERR_RENAME_FORMAT;
|
||||
}elseif(empty($_POST['original_path']) || !file_exists($_POST['original_path']))
|
||||
{
|
||||
$error = ERR_RENAME_FILE_NOT_EXISTS;
|
||||
}elseif(substr(slashToBackslash(removeTrailingSlash($_POST['original_path'])), strrpos(slashToBackslash(removeTrailingSlash($_POST['original_path'])), "/") + 1) == $_POST['name'])
|
||||
{
|
||||
$error = ERR_NO_CHANGES_MADE;
|
||||
}elseif(file_exists(addTrailingSlash(getParentPath($_POST['original_path'])) . $_POST['name']))
|
||||
{
|
||||
$error = ERR_RENAME_EXISTS;
|
||||
}elseif(is_file($_POST['original_path']) && !isValidExt($_POST['name'], explode(",", CONFIG_UPLOAD_VALID_EXTS), explode(",", CONFIG_UPLOAD_INVALID_EXTS)))
|
||||
{
|
||||
$error = ERR_RENAME_FILE_TYPE_NOT_PERMITED;
|
||||
}elseif(!rename(removeTrailingSlash($_POST['original_path']), addTrailingSlash(getParentPath($_POST['original_path'])) . $_POST['name']))
|
||||
{
|
||||
$error = ERR_RENAME_FAILED;
|
||||
}else
|
||||
{
|
||||
//update record of session if image exists in session for cut or copy
|
||||
include_once(CLASS_SESSION_ACTION);
|
||||
$sessionAction = new SessionAction();
|
||||
$selectedDocuments = $sessionAction->get();
|
||||
if(removeTrailingSlash($sessionAction->getFolder()) == getParentPath($_POST['original_path']) && sizeof($selectedDocuments))
|
||||
{
|
||||
if(($key = array_search(basename($_POST['original_path']), $selectedDocuments)) !== false)
|
||||
{
|
||||
$selectedDocuments[$key] = $_POST['name'];
|
||||
$sessionAction->set($selectedDocuments);
|
||||
|
||||
}
|
||||
|
||||
}elseif(removeTrailingSlash($sessionAction->getFolder()) == removeTrailingSlash($_POST['original_path']))
|
||||
{
|
||||
$sessionAction->setFolder($_POST['original_path']);
|
||||
}
|
||||
$path = addTrailingSlash(getParentPath($_POST['original_path'])) . $_POST['name'];
|
||||
if(is_file($path))
|
||||
{
|
||||
include_once(CLASS_FILE);
|
||||
$file = new file($path);
|
||||
$fileInfo = $file->getFileInfo();
|
||||
}else
|
||||
{
|
||||
include_once(CLASS_MANAGER);
|
||||
$manager = new manager($path, false);
|
||||
$fileInfo = $manager->getFolderInfo();
|
||||
}
|
||||
}
|
||||
|
||||
echo "{";
|
||||
echo "error:'" . $error . "' ";
|
||||
foreach ($fileInfo as $k=>$v)
|
||||
{
|
||||
echo "," . $k . ":'" . $v . "' ";
|
||||
}
|
||||
echo "}";
|
||||
|
||||
|
||||
?>
|
92
BO/ajaxfilemanager/ajax_save_text.php
Executable file
@ -0,0 +1,92 @@
|
||||
<?php
|
||||
if (!defined('_PS_ADMIN_DIR_'))
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
/**
|
||||
* ajax save name
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
$error = '';
|
||||
$path = addTrailingSlash(backslashToSlash($_POST['folder'])) . $_POST['name'];
|
||||
if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE)
|
||||
{
|
||||
$error = SYS_DISABLED;
|
||||
}
|
||||
elseif(isset($_POST['save_as_request']))
|
||||
{
|
||||
if(!preg_match('/^[a-zA-Z0-9_\-.]+$/', $_POST['name']))
|
||||
{
|
||||
$error = TXT_SAVE_AS_ERR_NAME_INVALID;
|
||||
}elseif(array_search(strtolower(getFileExt($_POST['name'])), getValidTextEditorExts()) === false)
|
||||
{
|
||||
$error = TXT_DISALLOWED_EXT;
|
||||
}elseif(!isUnderRoot($_POST['folder']))
|
||||
{
|
||||
$error = ERR_FOLDER_PATH_NOT_ALLOWED;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if(!empty($_POST['save_as_request']))
|
||||
{//save as request
|
||||
if(file_exists($path))
|
||||
{
|
||||
$error = TXT_FILE_EXIST;
|
||||
}else
|
||||
{
|
||||
if(($fp = @fopen($path, 'w+')) !== false)
|
||||
{
|
||||
if(@fwrite($fp, $_POST['text']))
|
||||
{
|
||||
@fclose($fp);
|
||||
}else
|
||||
{
|
||||
$error = TXT_CONTENT_WRITE_FAILED;
|
||||
}
|
||||
}else
|
||||
{
|
||||
$error = TXT_CREATE_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}else
|
||||
{
|
||||
if(!file_exists($path))
|
||||
{
|
||||
$error = TXT_FILE_NOT_EXIST;
|
||||
}else
|
||||
{
|
||||
if(($fp = @fopen($path, 'w')) !== false)
|
||||
{
|
||||
if(@fwrite($fp, $_POST['text']))
|
||||
{
|
||||
@fclose($fp);
|
||||
}else
|
||||
{
|
||||
$error = TXT_CONTENT_UPDATE_FAILED;
|
||||
}
|
||||
}else
|
||||
{
|
||||
$error = TXT_FILE_OPEN_FAILED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}else
|
||||
{
|
||||
$error = TXT_UNKNOWN_REQUEST;
|
||||
}
|
||||
echo "{";
|
||||
echo "error:'" . Tools::safeOutput($error) . "',\n";
|
||||
echo "path:'" . Tools::safeOutput($path) . "'";
|
||||
echo "}";
|
||||
|
||||
?>
|
170
BO/ajaxfilemanager/ajax_text_editor.php
Executable file
@ -0,0 +1,170 @@
|
||||
<?php
|
||||
if (!defined('_PS_ADMIN_DIR_'))
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
/**
|
||||
* Ajax image editor platform
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE)
|
||||
{
|
||||
die(SYS_DISABLED);
|
||||
}
|
||||
//$session->gc();
|
||||
$_GET['path'] = empty($_GET['path'])?CONFIG_SYS_ROOT_PATH . "ajax_image_editor_demo.jpg":$_GET['path'];
|
||||
if(!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path']) && isUnderRoot($_GET['path']))
|
||||
{
|
||||
$path = $_GET['path'];
|
||||
}else
|
||||
{
|
||||
die(TXT_FILE_NOT_FOUND);
|
||||
}
|
||||
if(file_exists(DIR_AJAX_EDIT_AREA . "reg_syntax" . DIRECTORY_SEPARATOR . getFileExt($path) . ".js"))
|
||||
{
|
||||
$syntax = getFileExt($path);
|
||||
}else
|
||||
{
|
||||
switch (getFileExt($path))
|
||||
{
|
||||
case 'htm':
|
||||
$syntax = 'html';
|
||||
break;
|
||||
default:
|
||||
$syntax = 'basic';
|
||||
}
|
||||
}
|
||||
if(array_search(getFileExt($path), getValidTextEditorExts())=== false)
|
||||
{
|
||||
die(TXT_DISALLOWED_EXT);
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="author" content="Logan Cai" />
|
||||
<meta name="website" content="http://www.phpletter.com" />
|
||||
<script type="text/javascript" src="jscripts/ajaxtexteditor_c.js"></script>
|
||||
<!--<script type="text/javascript" src="jscripts/jquery.js"></script>
|
||||
<script type="text/javascript" src="jscripts/form.js"></script>
|
||||
<script type="text/javascript" src="jscripts/select.js"></script>
|
||||
<script type="text/javascript" src="jscripts/jqModal.js"></script>
|
||||
<script type="text/javascript" src="jscripts/ajaxtexteditor.js"></script>
|
||||
-->
|
||||
<script type="text/javascript" src="jscripts/edit_area/edit_area_full.js"></script>
|
||||
<script type="text/javascript">
|
||||
var warningExtNotSelected = '<?php echo TXT_EXT_NOT_SELECTED; ?>';
|
||||
var urlGetFolderList = '<?php echo appendQueryString(CONFIG_URL_GET_FOLDER_LIST, makeQueryString(array('path'))); ?>';
|
||||
var warningInvalidName = '<?php echo TXT_SAVE_AS_ERR_NAME_INVALID; ?>';
|
||||
var waringFolderNotSelected = '<?php echo TXT_DEST_FOLDER_NOT_SELECTED; ?>';
|
||||
var currentFolder = '<?php echo dirname($path); ?>';
|
||||
var currentName = '<?php echo basename($path); ?>';
|
||||
|
||||
jQuery(document).ready(
|
||||
function()
|
||||
{
|
||||
editAreaLoader.init({
|
||||
id: "content" // id of the textarea to transform
|
||||
,start_highlight: false // if start with highlight
|
||||
,allow_resize: "both"
|
||||
,gecko_spellcheck:true
|
||||
,allow_toggle: true
|
||||
,toolbar:"search, go_to_line, fullscreen, |, undo, redo, |, select_font,|, highlight, reset_highlight, |, save, save_as"
|
||||
,save_callback:"save"
|
||||
,save_as_callback:"save_as"
|
||||
,language: "<?php echo (file_exists(DIR_AJAX_EDIT_AREA . 'langs' . DIRECTORY_SEPARATOR .CONFIG_LANG_INDEX . ".js")?CONFIG_LANG_INDEX:'en'); ?>"
|
||||
,syntax: "<?php echo $syntax; ?>"
|
||||
});
|
||||
jQuery('#windowSaveAs').jqm();
|
||||
jQuery('#windowProcessing').jqm({modal:true});
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<link href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/ajaxtexteditor.css" type="text/css" rel="stylesheet" />
|
||||
<link href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/jqModal.css" type="text/css" rel="stylesheet" />
|
||||
<title>Ajax Text Editor</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="pageBody">
|
||||
<textarea name="content" id="content" style="height:500px; width: 97%;"><?php echo getFileContent($path); ?></textarea>
|
||||
</div>
|
||||
<div id="windowProcessing" class="jqmWindow" style="display:none">
|
||||
<form name="frmProcessing" id="frmProcessing" method="post" action="<?php echo appendQueryString(CONFIG_URL_SAVE_TEXT, makeQueryString(array('path')));?>">
|
||||
<input type="hidden" name="folder" id="folder" value="<?php echo dirname($path); ?>" />
|
||||
<input type="hidden" name="name" id="name" value="<?php echo basename($path); ?>" />
|
||||
<input type="hidden" name="save_as_request" id="save_as_request" value="0" />
|
||||
<div style="display:none"><textarea name="text" id="text"></textarea></div>
|
||||
</form>
|
||||
<a href="#" class="jqmClose" id="windowSaveClose"><?php echo IMG_BTN_CANCEL; ?></a>
|
||||
<p><img src="theme/<?php echo CONFIG_THEME_NAME; ?>/images/loading.gif" /></p>
|
||||
</div>
|
||||
<div id="windowSaveAs" class="jqmWindow" style="display:none">
|
||||
<a href="#" class="jqmClose" id="windowSaveClose"><?php echo IMG_BTN_CANCEL; ?></a>
|
||||
<form id="formSaveAs" name="formSaveAs" action="" method="post">
|
||||
<table class="tableForm" cellpadding="0" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2"><?php echo IMG_LBL_SAVE_AS; ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>
|
||||
<label><?php echo IMG_LBL_NEW_NAME; ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="text" id="new_name" class="input" name="new_name" value="" />
|
||||
. <select id="ext" name="ext">
|
||||
<?php
|
||||
foreach(getValidTextEditorExts() as $v)
|
||||
{
|
||||
?>
|
||||
<option value="<?php echo $v; ?>" <?php echo (strtolower($v) == strtolower(getFileExt($path))?'selected':''); ?>><?php echo $v; ?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<label><?php echo IMG_LBL_SAVE_TO; ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<select class="input" name="save_to" id="save_to">
|
||||
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
</th>
|
||||
<td>
|
||||
<span class="comments">*</span>
|
||||
<?php echo IMG_NEW_NAME_COMMENTS; ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<td><input type="button" class="button" value="<?php echo IMG_BTN_SAVE_AS; ?>" onclick="return do_save_as();" /></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</body></html>
|
||||
|
691
BO/ajaxfilemanager/ajaxfilemanager.php
Executable file
@ -0,0 +1,691 @@
|
||||
<?php
|
||||
if (!defined('_PS_ADMIN_DIR_'))
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
/**
|
||||
* file manager platform
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
//$session->gc();
|
||||
require_once(CLASS_SESSION_ACTION);
|
||||
$sessionAction = new SessionAction();
|
||||
if(CONFIG_LOAD_DOC_LATTER)
|
||||
{
|
||||
$fileList = array();
|
||||
$folderInfo = array('path'=>getCurrentFolderPath());
|
||||
}else
|
||||
{
|
||||
require_once(CLASS_MANAGER);
|
||||
|
||||
|
||||
$manager = new manager();
|
||||
$manager->setSessionAction($sessionAction);
|
||||
$fileList = $manager->getFileList();
|
||||
$folderInfo = $manager->getFolderInfo();
|
||||
}
|
||||
if(CONFIG_SYS_THUMBNAIL_VIEW_ENABLE)
|
||||
{
|
||||
$views = array(
|
||||
'detail'=>LBL_BTN_VIEW_DETAILS,
|
||||
'thumbnail'=>LBL_BTN_VIEW_THUMBNAIL,
|
||||
);
|
||||
}else
|
||||
{
|
||||
$views = array(
|
||||
'detail'=>LBL_BTN_VIEW_DETAILS,
|
||||
);
|
||||
}
|
||||
|
||||
if(!empty($_GET['view']))
|
||||
{
|
||||
switch($_GET['view'])
|
||||
{
|
||||
case 'detail':
|
||||
case 'thumbnail':
|
||||
$view = $_GET['view'];
|
||||
break;
|
||||
default:
|
||||
$view = CONFIG_DEFAULT_VIEW;
|
||||
}
|
||||
}else
|
||||
{
|
||||
$view = CONFIG_DEFAULT_VIEW;
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" debug="true">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Ajax File Manager</title>
|
||||
<script type="text/javascript" src="jscripts/ajaxfilemanager_c.js"></script>
|
||||
<!--<script type="text/javascript" src="jscripts/jquery.js"></script>
|
||||
<script type="text/javascript" src="jscripts/form.js"></script>
|
||||
<script type="text/javascript" src="jscripts/select.js"></script>
|
||||
<script type="text/javascript" src="jscripts/thickbox.js"></script>
|
||||
<script type="text/javascript" src="jscripts/calendar.js"></script>
|
||||
<script type="text/javascript" src="jscripts/contextmenu.js"></script>
|
||||
<script type="text/javascript" src="jscripts/media.js"></script>
|
||||
<script type="text/javascript" src="jscripts/ajaxfileupload.js"></script>
|
||||
<script type="text/javascript" src="jscripts/ajaxfilemanager.js"></script>-->
|
||||
<script type="text/javascript">
|
||||
var globalSettings = {'upload_init':false};
|
||||
var queryString = '<?php echo Tools::safeOutput(makeQueryString(array('path'))); ?>';
|
||||
var paths = {'root':'<?php echo addTrailingSlash(backslashToSlash(CONFIG_SYS_ROOT_PATH)); ?>', 'root_title':'<?php echo LBL_FOLDER_ROOT; ?>'};
|
||||
var parentFolder = {};
|
||||
var urls = {
|
||||
'upload':'<?php echo CONFIG_URL_UPLOAD; ?>',
|
||||
'preview':'<?php echo CONFIG_URL_PREVIEW; ?>',
|
||||
'cut':'<?php echo CONFIG_URL_CUT; ?>',
|
||||
'copy':'<?php echo CONFIG_URL_COPY; ?>',
|
||||
'paste':'<?php echo CONFIG_URL_FILE_PASTE; ?>',
|
||||
'delete':'<?php echo CONFIG_URL_DELETE; ?>',
|
||||
'rename':'<?php echo CONFIG_URL_SAVE_NAME; ?>',
|
||||
'thumbnail':'<?php echo CONFIG_URL_IMG_THUMBNAIL; ?>',
|
||||
'create_folder':'<?php echo CONFIG_URL_CREATE_FOLDER; ?>',
|
||||
'text_editor':'<?php echo CONFIG_URL_TEXT_EDITOR; ?>',
|
||||
'image_editor':'<?php echo CONFIG_URL_IMAGE_EDITOR; ?>',
|
||||
'download':'<?php echo CONFIG_URL_DOWNLOAD; ?>',
|
||||
'present':'<?php echo Tools::safeOutput(getCurrentUrl()); ?>',
|
||||
'home':'<?php echo CONFIG_URL_HOME; ?>',
|
||||
'view':'<?php echo CONFIG_URL_LIST_LISTING; ?>'
|
||||
};
|
||||
var permits = {'del':<?php echo (CONFIG_OPTIONS_DELETE?1:0); ?>, 'cut':<?php echo (CONFIG_OPTIONS_CUT?'1':'0'); ?>, 'copy':<?php echo (CONFIG_OPTIONS_COPY?1:0); ?>, 'newfolder':<?php echo (CONFIG_OPTIONS_NEWFOLDER?1:0); ?>, 'rename':<?php echo (CONFIG_OPTIONS_RENAME?1:0); ?>, 'upload':<?php echo (CONFIG_OPTIONS_UPLOAD?1:0); ?>, 'edit':<?php echo (CONFIG_OPTIONS_EDITABLE?1:0); ?>, 'view_only':<?php echo (CONFIG_SYS_VIEW_ONLY?1:0); ?>};
|
||||
var currentFolder = {};
|
||||
var warningDelete = '<?php echo WARNING_DELETE; ?>';
|
||||
var newFile = {'num':1, 'label':'<?php echo FILE_LABEL_SELECT; ?>', 'upload':'<?php echo FILE_LBL_UPLOAD; ?>'};
|
||||
var counts = {'new_file':1};
|
||||
var thickbox = {'width':'<?php echo CONFIG_THICKBOX_MAX_WIDTH; ?>',
|
||||
'height':'<?php echo CONFIG_THICKBOX_MAX_HEIGHT; ?>',
|
||||
'next':'<?php echo THICKBOX_NEXT; ?>',
|
||||
'previous':'<?php echo THICKBOX_PREVIOUS; ?>',
|
||||
'close':'<?php echo THICKBOX_CLOSE; ?>'
|
||||
|
||||
};
|
||||
|
||||
var tb_pathToImage = "theme/<?php echo CONFIG_THEME_NAME; ?>/images/loadingAnimation.gif";
|
||||
var msgInvalidFolderName = '<?php echo ERR_FOLDER_FORMAT; ?>';
|
||||
var msgInvalidFileName = '<?php echo ERR_FILE_NAME_FORMAT; ?>';
|
||||
var msgInvalidExt = '<?php echo ERR_FILE_TYPE_NOT_ALLOWED; ?>';
|
||||
var msgNotPreview = '<?php echo PREVIEW_NOT_PREVIEW; ?>';
|
||||
|
||||
var warningCutPaste = '<?php echo WARNING_CUT_PASTE; ?>';
|
||||
var warningCopyPaste = '<?php echo WARNING_COPY_PASTE; ?>';
|
||||
var warningDel = '<?php echo WARNING_DELETE; ?>';
|
||||
var warningNotDocSelected = '<?php echo ERR_NOT_DOC_SELECTED; ?>';
|
||||
var noFileSelected = '<?php echo ERR_NOT_FILE_SELECTED; ?>';
|
||||
var unselectAllText = '<?php echo TIP_UNSELECT_ALL; ?>';
|
||||
var selectAllText = '<?php echo TIP_SELECT_ALL; ?>';
|
||||
var action = '<?php echo $sessionAction->getAction(); ?>';
|
||||
var numFiles = <?php echo $sessionAction->count(); ?>;
|
||||
var warningCloseWindow = '<?php echo WARING_WINDOW_CLOSE; ?>';
|
||||
var numRows = 0;
|
||||
|
||||
var wordCloseWindow = '<?php echo LBL_ACTION_CLOSE; ?>';
|
||||
var wordPreviewClick = '<?php echo LBL_CLICK_PREVIEW; ?>';
|
||||
|
||||
var searchRequired = false;
|
||||
var supporedPreviewExts = '<?php echo CONFIG_VIEWABLE_VALID_EXTS; ?>';
|
||||
var supportedUploadExts = '<?php echo CONFIG_UPLOAD_VALID_EXTS; ?>'
|
||||
var elementId = <?php echo (!empty($_GET['elementId'])?"'" . Tools::safeOutput($_GET['elementId']) . "'":'null'); ?>;
|
||||
var files = {};
|
||||
$(document).ready(
|
||||
function()
|
||||
{
|
||||
jQuery(document).bind('keypress', function(event) {
|
||||
var code=event.charCode || event.keyCode;
|
||||
if(code && code == 13) {// if enter is pressed
|
||||
event.preventDefault(); //prevent browser from following the actual href
|
||||
};
|
||||
});
|
||||
if(typeof(cancelSelectFile) != 'undefined')
|
||||
{
|
||||
$('#linkClose').show();
|
||||
}
|
||||
$('input[@name=view]').each(
|
||||
function()
|
||||
{
|
||||
|
||||
if(this.value == '<?php echo $view; ?>')
|
||||
{
|
||||
this.checked = true;
|
||||
}else
|
||||
{
|
||||
this.checked = false;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
popUpCal.clearText = '<?php echo CALENDAR_CLEAR; ?>';
|
||||
popUpCal.closeText = '<?php echo CALENDAR_CLOSE; ?>';
|
||||
popUpCal.prevText = '<?php echo CALENDAR_PREVIOUS; ?>';
|
||||
popUpCal.nextText = '<?php echo CALENDAR_NEXT; ?>';
|
||||
popUpCal.currentText = '<?php echo CALENDAR_CURRENT; ?>';
|
||||
popUpCal.buttonImageOnly = true;
|
||||
popUpCal.dayNames = new Array('<?php echo CALENDAR_SUN; ?>','<?php echo CALENDAR_MON; ?>','<?php echo CALENDAR_TUE; ?>','<?php echo CALENDAR_WED; ?>','<?php echo CALENDAR_THU; ?>','<?php echo CALENDAR_FRI; ?>','<?php echo CALENDAR_SAT; ?>');
|
||||
popUpCal.monthNames = new Array('<?php echo CALENDAR_JAN; ?>','<?php echo CALENDAR_FEB; ?>','<?php echo CALENDAR_MAR; ?>','<?php echo CALENDAR_APR; ?>','<?php echo CALENDAR_MAY; ?>','<?php echo CALENDAR_JUN; ?>','<?php echo CALENDAR_JUL; ?>','<?php echo CALENDAR_AUG; ?>','<?php echo CALENDAR_SEP; ?>','<?php echo CALENDAR_OCT; ?>','<?php echo CALENDAR_NOV; ?>','<?php echo CALENDAR_DEC; ?>');
|
||||
popUpCal.dateFormat = 'YMD-';
|
||||
$('.inputMtime').calendar({autoPopUp:'both', buttonImage:'theme/<?php echo CONFIG_THEME_NAME; ?>/images/standard/date_picker.png'});
|
||||
|
||||
|
||||
initAfterListingLoaded();
|
||||
//addMoreFile();
|
||||
|
||||
} );
|
||||
|
||||
|
||||
</script>
|
||||
<?php
|
||||
if(file_exists(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'jscripts' . DIRECTORY_SEPARATOR . 'for_' . CONFIG_EDITOR_NAME . ".js")
|
||||
{
|
||||
?>
|
||||
<script type="text/javascript" src="jscripts/<?php echo 'for_' . CONFIG_EDITOR_NAME . '.js'; ?>"></script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<link rel="stylesheet" type="text/css" href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/template.css" />
|
||||
<link rel="stylesheet" type="text/css" href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/jquery-calendar.css" />
|
||||
<link rel="stylesheet" href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/thickbox.css" type="text/css" media="screen" />
|
||||
<!--[if IE 6]>
|
||||
<link href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/ie6.css" type="text/css" rel="Stylesheet" media="screen">
|
||||
<![endif]-->
|
||||
</head>
|
||||
<body style="background-color:#E8E8E8;">
|
||||
<div id="wrapper">
|
||||
<div id="header">
|
||||
<dl id="currentFolderInfo">
|
||||
<dt><?php echo LBL_CURRENT_FOLDER_PATH; ?></dt>
|
||||
<dd id="currentFolderPath"><?php echo $folderInfo['path']; ?></dd>
|
||||
</dl>
|
||||
<div id="viewList">
|
||||
|
||||
|
||||
<label><?php echo LBL_BTN_VIEW_OPTIONS; ?></label>
|
||||
<?php
|
||||
foreach($views as $k=>$v)
|
||||
{
|
||||
?>
|
||||
<input type="radio" name="view" class="radio" onclick="changeView(this);" value="<?php echo $k; ?>" <?php echo ($k==$view?'checked':''); ?>> <?php echo $v; ?>
|
||||
|
||||
<?php
|
||||
}
|
||||
?></div>
|
||||
<ul id="actionHeader">
|
||||
<li><a href="#" id="actionRefresh" onclick="return windowRefresh();"><span><?php echo LBL_ACTION_REFRESH; ?></span></a></li>
|
||||
<li><a href="#" id="actionSelectAll" class="check_all" onclick="return checkAll(this);"><span><?php echo LBL_ACTION_SELECT_ALL; ?></span></a></li>
|
||||
<?php
|
||||
if(CONFIG_OPTIONS_DELETE)
|
||||
{
|
||||
?>
|
||||
<li><a href="#" id="actionDelete" onclick="return deleteDocuments();"><span><?php echo LBL_ACTION_DELETE; ?></span></a></li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if(CONFIG_OPTIONS_CUT)
|
||||
{
|
||||
?>
|
||||
<li><a href="#" id="actionCut" onclick="return cutDocuments('<?php echo ERR_NOT_DOC_SELECTED_FOR_CUT; ?>');"><span><?php echo LBL_ACTION_CUT; ?></span></a></li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if(CONFIG_OPTIONS_COPY)
|
||||
{
|
||||
?>
|
||||
<li><a href="#" id="actionCopy" onclick="return copyDocuments('<?php echo ERR_NOT_DOC_SELECTED_FOR_COPY; ?>');"><span><?php echo LBL_ACTION_COPY; ?></span></a></li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if(CONFIG_OPTIONS_CUT || CONFIG_OPTIONS_COPY)
|
||||
{
|
||||
?>
|
||||
<li><a href="#" id="actionPaste" onclick="return pasteDocuments('<?php echo ERR_NOT_DOC_SELECTED_FOR_PASTE; ?>');"><span><?php echo LBL_ACTION_PASTE; ?></span></a></li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
if(CONFIG_OPTIONS_NEWFOLDER)
|
||||
{
|
||||
?>
|
||||
<li><a id="actionNewFolder" href="#" onclick="return newFolderWin(this);"><span><?php echo LBL_BTN_NEW_FOLDER; ?></span></a></li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if(CONFIG_OPTIONS_UPLOAD)
|
||||
{
|
||||
?>
|
||||
<li><a id="actionUpload" href="#" onclick="return uploadFileWin(this);"><span><?php echo LBL_BTN_UPLOAD; ?></span></a></li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- <li><a href="#" id="actionClose" onclick="closeWindow('<?php echo IMG_WARING_WIN_CLOSE; ?>');"><?php echo IMG_BTN_CLOSE; ?></a></li>-->
|
||||
<li><a href="#" class="thickbox" id="actionInfo" onclick="return infoWin(this);"><span>Info</span></a></li>
|
||||
<!-- thest functions will be added in the near future
|
||||
<li ><a href="#" id="actionZip"><span>Zip</span></a><li>
|
||||
<li ><a href="#" id="actionUnzip"><span>Unzip</span></a><li>-->
|
||||
</ul>
|
||||
<form action="" method="post" name="formAction" id="formAction"><input type="hidden" name="currentFolderPath" id="currentFolderPathVal" value="" /><select name="selectedDoc[]" id="selectedDoc" style="display:none;" multiple="multiple"></select><input type="hidden" name="action_value" value="" id="action_value" /></form>
|
||||
</div>
|
||||
|
||||
<div id="body">
|
||||
|
||||
|
||||
<div id="rightCol">
|
||||
<?php
|
||||
if(CONFIG_LOAD_DOC_LATTER )
|
||||
{
|
||||
$currentPath = getCurrentFolderPath();
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
parentFolder = {path:'<?php echo getParentFolderPath($currentPath); ?>'};
|
||||
currentFolder = {'friendly_path':'<?php echo transformFilePath($currentPath); ?>'};
|
||||
$(document).ready(
|
||||
function()
|
||||
{
|
||||
var url = getUrl('view', false, false, false);
|
||||
$('#rightCol').empty();
|
||||
ajaxStart('#rightCol');
|
||||
|
||||
$('#rightCol').load(url,
|
||||
{},
|
||||
function(){
|
||||
ajaxStop('#rightCol img.ajaxLoadingImg');
|
||||
urls.present = getUrl('home', true, true);
|
||||
initAfterListingLoaded();
|
||||
});
|
||||
}
|
||||
);
|
||||
</script>
|
||||
<?php
|
||||
}else
|
||||
{
|
||||
include_once(CONFIG_URL_LIST_LISTING);
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div id="leftCol">
|
||||
|
||||
|
||||
|
||||
<fieldset id="folderFieldSet" >
|
||||
|
||||
<legend><?php echo LBL_FOLDER_INFO; ?></legend>
|
||||
<table cellpadding="0" cellspacing="0" class="tableSummary" id="folderInfo">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><?php echo LBL_FOLDER_PATH; ?></th>
|
||||
<td colspan="3" id="folderPath"><?php echo transformFilePath($folderInfo['path']); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo LBL_FOLDER_CREATED; ?></th>
|
||||
<td colspan="3" id="folderCtime"><?php echo (!empty($folderInfo['ctime'])?date(DATE_TIME_FORMAT,$folderInfo['ctime']):' ') ; ?></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo LBL_FOLDER_MODIFIED; ?></th>
|
||||
<td colspan="3" id="folderMtime"><?php echo (!empty($folderInfo['mtime'])?date(DATE_TIME_FORMAT,$folderInfo['mtime']):' '); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo LBL_FOLDER_SUDDIR; ?></th>
|
||||
<td colspan="3" id="folderSubdir"><?php echo (isset($folderInfo['subdir'])?$folderInfo['subdir']:" "); ?></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo LBL_FOLDER_FIELS; ?></th>
|
||||
<td colspan="3" id="folderFile"><?php echo (isset($folderInfo['file'])?$folderInfo['file']:' '); ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th><?php echo LBL_FOLDER_WRITABLE; ?></th>
|
||||
<td id="folderWritable"><span class="<?php echo (isset($folderInfo['is_readable'])?($folderInfo['is_readable']?'flagYes':'flagNo'):' '); ?>"> </span></td>
|
||||
<th><?php echo LBL_FOLDER_READABLE; ?></th>
|
||||
<td id="folderReadable"><span class="<?php echo (isset($folderInfo['is_writable'])?($folderInfo['is_writable']?'flagYes':'flagNo'):' '); ?>"> </span></td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
<fieldset id="fileFieldSet" style="display:none" >
|
||||
<legend><?php echo LBL_FILE_INFO; ?></legend>
|
||||
<table cellpadding="0" cellspacing="0" class="tableSummary" id="fileInfo">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><?php echo LBL_FILE_NAME; ?></th>
|
||||
<td colspan="3" id="fileName"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo LBL_FILE_CREATED; ?></th>
|
||||
<td colspan="3" id="fileCtime"></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo LBL_FILE_MODIFIED; ?></th>
|
||||
<td colspan="3" id="fileMtime"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo LBL_FILE_SIZE; ?></th>
|
||||
<td colspan="3" id="fileSize"></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo LBL_FILE_TYPE; ?></th>
|
||||
<td colspan="3" id="fileType"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo LBL_FILE_WRITABLE; ?></th>
|
||||
<td id="fileWritable"><span class="flagYes"> </span></td>
|
||||
<th><?php echo LBL_FILE_READABLE; ?></th>
|
||||
<td id="fileReadable"><span class="flagNo"> </span></td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p class="searchButtons" id="returnCurrentUrl">
|
||||
|
||||
<span class="right" id="linkSelect">
|
||||
<input type="button" value="<?php echo MENU_SELECT; ?>" id="selectCurrentUrl" class="button">
|
||||
</span>
|
||||
|
||||
</p>
|
||||
</fieldset>
|
||||
|
||||
|
||||
|
||||
<fieldset class="boxSearch">
|
||||
<legend><?php echo LBL_SEARCH; ?></legend>
|
||||
|
||||
|
||||
|
||||
<table cellpadding="0" cellspacing="0" class="tableSearch">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<b><?php echo LBL_SEARCH_NAME; ?></b> <br />
|
||||
<input type="text" class="input inputSearch" name="search_name" id="search_name" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td >
|
||||
<b><?php echo LBL_SEARCH_FOLDER; ?></b><br />
|
||||
<span id="searchFolderContainer">
|
||||
<?php
|
||||
if(CONFIG_LOAD_DOC_LATTER)
|
||||
{
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(
|
||||
function()
|
||||
{
|
||||
ajaxStart('#searchFolderContainer');
|
||||
$('#searchFolderContainer').load('<?php echo CONFIG_URL_LOAD_FOLDERS; ?>');
|
||||
}
|
||||
);
|
||||
</script>
|
||||
<?php
|
||||
}else
|
||||
{
|
||||
?>
|
||||
<select class="input inputSearch" name="search_folder" id="search_folder">
|
||||
<?php
|
||||
|
||||
foreach(getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v)
|
||||
{
|
||||
?>
|
||||
<option value="<?php echo $v; ?>" <?php echo (removeTrailingSlash(backslashToSlash(($folderInfo['path']))) == removeTrailingSlash(backslashToSlash(($v)))?' selected="selected"':''); ?>><?php echo shortenFileName($k, 30); ?></option>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
</select>
|
||||
<?php
|
||||
}
|
||||
?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<b><?php echo LBL_SEARCH_MTIME; ?></b><br />
|
||||
<input type="text" class="input inputMtime" name="search_mtime_from" id="search_mtime_from" value="<?php echo (!empty($_GET['search_mtime_from'])?Tools::safeOutput($_GET['search_mtime_from']):''); ?>" />
|
||||
<span class="leftToRightArrow"> </span>
|
||||
<input type="text" class="input inputMtime" name="search_mtime_to" id="search_mtime_to" value="<?php echo (!empty($_GET['search_mtime_to'])?Tools::safeOutput($_GET['search_mtime_to']):''); ?>" />
|
||||
</td></tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<b><?php echo LBL_SEARCH_RECURSIVELY; ?></b>
|
||||
<input type="radio" name="search_recursively" value="1" id="search_recursively_1" class="radio" <?php echo (!empty($_GET['search_recursively'])?'checked="checked"':''); ?> /> <?php echo LBL_RECURSIVELY_YES; ?>
|
||||
<input type="radio" name="search_recursively" value="0" id="search_recursively_0" class="radio" <?php echo (empty($_GET['search_recursively'])?'checked="checked"':''); ?> /> <?php echo LBL_RECURSIVELY_NO; ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
<p class="searchButtons">
|
||||
<span class="left" id="linkClose" style="display:none">
|
||||
<input type="button" value="<?php echo LBL_ACTION_CLOSE; ?>" onclick="return cancelSelectFile();" class="button">
|
||||
</span>
|
||||
<span class="right" id="linkSearch">
|
||||
<input type="button" value="<?php echo BTN_SEARCH; ?>" onclick="return search();" class="button">
|
||||
</span>
|
||||
|
||||
</p>
|
||||
</fieldset>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
|
||||
|
||||
|
||||
<div id="ajaxLoading" style="display:none"><img class="ajaxLoadingImg" src="theme/<?php echo CONFIG_THEME_NAME; ?>/images/ajaxLoading.gif" /></div>
|
||||
<div id="winUpload" style="display:none">
|
||||
<div class="jqmContainer">
|
||||
<div class="jqmHeader">
|
||||
<a href="#" onclick="tb_remove();"><?php echo LBL_ACTION_CLOSE; ?></a>
|
||||
</div>
|
||||
<div class="jqmBody">
|
||||
<form id="formUpload" name="formUpload" method="post" enctype="multipart/form-data" action="">
|
||||
<table class="tableForm" cellpadding="0" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2"><?php echo FILE_FORM_TITLE; ?><a class="action" href="#" title="<?php echo FILE_LBL_MORE; ?>" onclick="return addMoreFile();"><span class="addMore"> </span></a></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="fileUploadBody">
|
||||
<tr style="display:none">
|
||||
<th><label><?php echo FILE_LABEL_SELECT; ?></label></th>
|
||||
<td><input type="file" class="input" name="file" /> <input type="button" class="button" value="<?php echo FILE_LBL_UPLOAD; ?>" /> <a href="#" class="action" title="Cancel" style="display:none" ><span class="cancel"> </span></a> <span class="uploadProcessing" style="display:none"> <span></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div id="winNewFolder" style="display:none">
|
||||
<div class="jqmContainer">
|
||||
<div class="jqmHeader">
|
||||
<a href="#" onclick="tb_remove();"><?php echo LBL_ACTION_CLOSE; ?></a>
|
||||
</div>
|
||||
<div class="jqmBody">
|
||||
<form id="formNewFolder" name="formNewFolder" method="post" action="">
|
||||
<input type="hidden" name="currentFolderPath" value="" id="currentNewfolderPath" />
|
||||
<table class="tableForm" cellpadding="0" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2"><?php echo FOLDER_FORM_TITLE; ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><label><?php echo FOLDER_LBL_TITLE; ?></label></th>
|
||||
<td><input type="text" name="new_folder" id="new_folder" value="" class="input"></td>
|
||||
</tr>
|
||||
|
||||
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<td><input type="button" value="<?php echo FOLDER_LBL_CREATE; ?>" class="button" onclick="return doCreateFolder();" /></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div id="winPlay" style="display:none">
|
||||
<div class="jqmContainer">
|
||||
<div class="jqmHeader">
|
||||
<a href="#" onclick="closeWinPlay();"><?php echo LBL_ACTION_CLOSE; ?></a>
|
||||
</div>
|
||||
<div class="jqmBody">
|
||||
<div id="playGround"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="winRename" style="display:none">
|
||||
<div class="jqmContainer">
|
||||
<div class="jqmHeader">
|
||||
<a href="#" onclick="tb_remove();"><?php echo LBL_ACTION_CLOSE; ?></a>
|
||||
</div>
|
||||
<div class="jqmBody">
|
||||
<form id="formRename" name="formRename" method="post" action="">
|
||||
<input type="hidden" name="original_path" id="original_path" />
|
||||
<input type="hidden" name="num" id="renameNum" value="" />
|
||||
<table class="tableForm" cellpadding="0" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2"><?php echo RENAME_FORM_TITLE; ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><label><?php echo RENAME_NEW_NAME; ?></label></th>
|
||||
<td><input type="name" id="renameName" class="input" name="name" style="width:250px" />
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<td><input type="button" value="<?php echo RENAME_LBL_RENAME; ?>" class="button" onclick="return doRename();" /></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div id="winInfo" style="display:none">
|
||||
<div class="jqmContainer">
|
||||
<div class="jqmHeader">
|
||||
<a href="#" onclick="tb_remove();"><?php echo LBL_ACTION_CLOSE; ?></a>
|
||||
</div>
|
||||
<div class="jqmBody">
|
||||
<table class="tableInfo" cellpadding="0" cellspacing="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th nowrap>
|
||||
<label>Author:</label>
|
||||
</th>
|
||||
<td>
|
||||
<a href="mailto:cailongqun@yahoo.com.cn">Logan Cai</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th nowrap>
|
||||
<label>Template Designer:</label>
|
||||
</th>
|
||||
<td>
|
||||
<a href="mailto:Gabriel@4v.com.br">Gabriel</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th nowrap>
|
||||
<label>Official Website:</label>
|
||||
</th>
|
||||
<td>
|
||||
<a href="http://www.phpletter.com">http://www.phpletter.com</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th nowrap>
|
||||
<label>Support Forum:</label>
|
||||
</th>
|
||||
<td>
|
||||
<a href="http://www.phpletter.com/forum/">http://www.phpletter.com/forum/</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th nowrap>
|
||||
<label>©Copyright:</label>
|
||||
</th>
|
||||
<td>
|
||||
All copyright declarations in the source must remain unchange. Please contact us if you need to make changes to it, in order to avoid any Legal Issues.
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div id="contextMenu" style="display:none">
|
||||
<ul>
|
||||
<li><a href="#" class="contentMenuItem" id="menuSelect"><?php echo MENU_SELECT; ?></a></li>
|
||||
<li><a href="#" class="contentMenuItem" id="menuPreview"><?php echo MENU_PREVIEW; ?></a></li>
|
||||
<li><a href="#" class="contentMenuItem" id="menuDownload"><?php echo MENU_DOWNLOAD; ?></a></li>
|
||||
<li><a href="#" class="contentMenuItem" id="menuRename"><?php echo MENU_RENAME; ?></a></li>
|
||||
<li><a href="#" class="contentMenuItem" id="menuEdit"><?php echo MENU_EDIT; ?></a></li>
|
||||
<li><a href="#" class="contentMenuItem" id="menuCut"><?php echo MENU_CUT; ?></a></li>
|
||||
<li><a href="#" class="contentMenuItem" id="menuCopy"><?php echo MENU_COPY; ?></a></li>
|
||||
<li><a href="#" class="contentMenuItem" id="menuPaste"><?php echo MENU_PASTE; ?></a></li>
|
||||
<li><a href="#" class="contentMenuItem" id="menuDelete"><?php echo MENU_DELETE; ?></a></li>
|
||||
<li><a href="#" class="contentMenuItem" id="menuPlay"><?php echo MENU_PLAY; ?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
0
BO/ajaxfilemanager/debug.html
Executable file
48
BO/ajaxfilemanager/inc/class.auth.php
Executable file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* the purpose I added this class is to make the file system much flexible
|
||||
* for customization.
|
||||
* Actually, this is a kind of interface and you should modify it to fit your system
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 4/August/2007
|
||||
*/
|
||||
class Auth
|
||||
{
|
||||
var $__loginIndexInSession = 'ajax_user';
|
||||
function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function Auth()
|
||||
{
|
||||
$this->__construct();
|
||||
}
|
||||
/**
|
||||
* check if the user has logged
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function isLoggedIn()
|
||||
{
|
||||
return (!empty($_SESSION[$this->__loginIndexInSession])?true:false);
|
||||
}
|
||||
/**
|
||||
* validate the username & password
|
||||
* @return boolean
|
||||
*
|
||||
*/
|
||||
function login()
|
||||
{
|
||||
if($_POST['username'] == CONFIG_LOGIN_USERNAME && $_POST['password'] == CONFIG_LOGIN_PASSWORD)
|
||||
{
|
||||
$_SESSION[$this->__loginIndexInSession] = true;
|
||||
return true;
|
||||
}else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
436
BO/ajaxfilemanager/inc/class.file.php
Executable file
@ -0,0 +1,436 @@
|
||||
<?php
|
||||
/**
|
||||
* file modification
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/April/2007
|
||||
*
|
||||
*/
|
||||
class file
|
||||
{
|
||||
var $fileInfo = "";
|
||||
var $filePath = "";
|
||||
var $fileStat = "";
|
||||
var $mask = '0775';
|
||||
var $debug = false;
|
||||
var $errors = array();
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
* @param string $path the path to a file or folder
|
||||
*/
|
||||
function __construct($path = null)
|
||||
{
|
||||
if(!is_null($path))
|
||||
{
|
||||
if(file_exists($path))
|
||||
{
|
||||
$this->filePath = $path;
|
||||
if(is_file($this->filePath))
|
||||
{
|
||||
$this->fileStat = @stat($path);
|
||||
$this->fileInfo['size'] = $this->fileStat[7];
|
||||
$this->fileInfo['atime'] = $this->fileStat[8];
|
||||
$this->fileInfo['ctime'] = $this->fileStat[10];
|
||||
$this->fileInfo['mtime'] = $this->fileStat[9];
|
||||
$this->fileInfo['path'] = $path;
|
||||
$this->fileInfo['name'] = basename($path);
|
||||
$this->fileInfo['is_writable'] = $this->isWritable();
|
||||
$this->fileInfo['is_readable'] = $this->isReadable();
|
||||
}elseif(is_dir($this->filePath))
|
||||
{
|
||||
$this->fileStat = @stat($path);
|
||||
$this->fileInfo['name'] = basename($path);
|
||||
$this->fileInfo['path'] = $path;
|
||||
$this->fileInfo['atime'] = $this->fileStat[8];
|
||||
$this->fileInfo['ctime'] = $this->fileStat[10];
|
||||
$this->fileInfo['mtime'] = $this->fileStat[9];
|
||||
$this->fileInfo['is_writable'] = $this->isWritable();
|
||||
$this->fileInfo['is_readable'] = $this->isReadable();
|
||||
}
|
||||
}else
|
||||
{
|
||||
trigger_error('No such file exists. ' . $path, E_USER_NOTICE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* contructor
|
||||
*
|
||||
* @param string $path
|
||||
*/
|
||||
function file($path=null)
|
||||
{
|
||||
$this->__construct($path);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* check if a file or folder writable
|
||||
*
|
||||
* @param file path $path
|
||||
* @return boolean
|
||||
*/
|
||||
function isWritable($path=null)
|
||||
{
|
||||
$path = (is_null($path)?$this->filePath:$path);
|
||||
if (DIRECTORY_SEPARATOR == "\\")
|
||||
{
|
||||
$path = slashToBackslash($path);
|
||||
if(is_file($path))
|
||||
{
|
||||
$fp = @fopen($path,'ab');
|
||||
if($fp)
|
||||
{
|
||||
@fclose($fp);
|
||||
return true;
|
||||
}
|
||||
}elseif(is_dir($path))
|
||||
{
|
||||
$path = addTrailingSlash($path);
|
||||
$tmp = uniqid(time());
|
||||
if (@touch($path . $tmp))
|
||||
{
|
||||
@unlink($path . $tmp);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}else
|
||||
{
|
||||
return @is_writable(slashToBackslash($path));
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Returns true if the files is readable.
|
||||
*
|
||||
* @return boolean true if the files is readable.
|
||||
*/
|
||||
function isReadable($path =null)
|
||||
{
|
||||
$path = is_null($path)?$this->filePath:$path;
|
||||
return @is_readable(slashToBackslash($path));
|
||||
}
|
||||
/**
|
||||
* change the modified time
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $time
|
||||
* @return boolean
|
||||
*/
|
||||
function setLastModified($path=null, $time)
|
||||
{
|
||||
$path = is_null($path)?$this->filePath:$path;
|
||||
$time = is_null($time)?time():$time;
|
||||
return @touch(slashToBackslash($path), $time);
|
||||
}
|
||||
|
||||
/**
|
||||
* create a new folder
|
||||
*
|
||||
* @path the path for the new folder
|
||||
* @mask
|
||||
* @dirOwner
|
||||
* @return boolean
|
||||
*/
|
||||
function mkdir($path = null, $mask=null, $dirOwner='')
|
||||
{
|
||||
$path = is_null($path)?$this->filePath:$path;
|
||||
if(!file_exists($path))
|
||||
{
|
||||
$mask = is_null($mask)?$this->mask:$mask;
|
||||
$status = @mkdir(slashToBackslash($path));
|
||||
if ($mask)
|
||||
{
|
||||
@chmod(slashToBackslash($path), intval($mask, 8));
|
||||
}
|
||||
if($dirOwner)
|
||||
{
|
||||
$this->chown(slashToBackslash($path), $dirOwner);
|
||||
}
|
||||
return $status;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
/**
|
||||
* change the own of a file or folder
|
||||
*
|
||||
* @param the file path $path
|
||||
* @param $owner
|
||||
*/
|
||||
function chown($path, $owner)
|
||||
{
|
||||
if(!empty($owner))
|
||||
{
|
||||
$owners = explode(":", $owner);
|
||||
if(!empty($owners[0]))
|
||||
@chown($path, $owners[0]);
|
||||
if(!empty($owners[1]))
|
||||
@chgrp($path, $owner[1]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy a file, or recursively copy a folder and its contents
|
||||
* @author Aidan Lister <aidan@php.net>
|
||||
* @author Paul Scott
|
||||
* @version 1.0.1
|
||||
* @param string $source Source path
|
||||
* @param string $dest Destination path
|
||||
* @return bool Returns TRUE on success, FALSE on failure
|
||||
*/
|
||||
function copyTo($source, $dest)
|
||||
{
|
||||
$source = removeTrailingSlash(backslashToSlash($source));
|
||||
$dest = removeTrailingSlash(backslashToSlash($dest));
|
||||
if(!file_exists($dest) || !is_dir($dest))
|
||||
{
|
||||
if(!$this->mkdir($dest))
|
||||
{
|
||||
$this->_debug('Unable to create folder (' . $dest . ")");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Copy in to your self?
|
||||
if (getAbsPath($source) == getAbsPath($dest))
|
||||
{
|
||||
$this->_debug('Unable to copy itself. source: ' . getAbsPath($source) . "; dest: " . getAbsPath($dest));
|
||||
return false;
|
||||
}
|
||||
// Simple copy for a file
|
||||
if (is_file($source))
|
||||
{
|
||||
$dest = addTrailingSlash($dest) . (basename($source));
|
||||
if(file_exists($dest))
|
||||
{
|
||||
return false;
|
||||
}else {
|
||||
|
||||
return copy($source, $dest);
|
||||
}
|
||||
|
||||
|
||||
}elseif(is_dir($source))
|
||||
{
|
||||
// Loop through the folder
|
||||
if(file_exists(addTrailingSlash($dest) . basename($source)))
|
||||
{
|
||||
return false;
|
||||
}else
|
||||
{
|
||||
if(!file_exists(addTrailingSlash($dest) . basename($source)) || !is_dir(addTrailingSlash($dest) . basename($source)))
|
||||
{
|
||||
if(!$this->mkdir(addTrailingSlash($dest) . basename($source)))
|
||||
{
|
||||
$this->_debug('Unable to create folder (' . addTrailingSlash($dest) . basename($source) . ")");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$handle = opendir($source);
|
||||
while(false !== ($readdir = readdir($handle)))
|
||||
{
|
||||
if($readdir != '.' && $readdir != '..')
|
||||
{
|
||||
$path = addTrailingSlash($source).'/'.$readdir;
|
||||
$this->copyTo($path, addTrailingSlash($dest) . basename($source));
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* get next available file name
|
||||
*
|
||||
* @param string $fileToMove the path of the file will be moved to
|
||||
* @param string $destFolder the path of destination folder
|
||||
* @return string
|
||||
*/
|
||||
function getNextAvailableFileName($fileToMove, $destFolder)
|
||||
{
|
||||
|
||||
$folderPath = addslashes(backslashToSlash(getParentPath($fileToMove)));
|
||||
$destFolder = addslashes(backslashToSlash(getParentPath($destFolder)));
|
||||
$finalPath = $destFolder . basename($fileToMove);
|
||||
if(file_exists($fileToMove))
|
||||
{
|
||||
if(is_file())
|
||||
{
|
||||
$fileExt = getFileExt($fileToMove);
|
||||
$fileBaseName = basename($fileToMove, '.' . $fileExt);
|
||||
$count = 1;
|
||||
while(file_exists($destFolder . $fileBaseName . $count . "." . $fileExt))
|
||||
{
|
||||
$count++;
|
||||
}
|
||||
$filePath = $destFolder . $fileBaseName . $count . "." . $fileExt;
|
||||
}elseif(is_dir())
|
||||
{
|
||||
$folderName = basename($fileToMove);
|
||||
$count = 1;
|
||||
while(file_exists($destFolder . $folderName . $count))
|
||||
{
|
||||
$count++;
|
||||
}
|
||||
$filePath = $destFolder . $fileBaseName . $count;
|
||||
}
|
||||
|
||||
}
|
||||
return $finalPath;
|
||||
}
|
||||
/**
|
||||
* get file information
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getFileInfo()
|
||||
{
|
||||
return $this->fileInfo;
|
||||
}
|
||||
/**
|
||||
* close
|
||||
*
|
||||
*/
|
||||
function close()
|
||||
{
|
||||
$this->fileInfo = null;
|
||||
$this->fileStat = null;
|
||||
}
|
||||
/**
|
||||
* delete a file or a folder and all contents within that folder
|
||||
*
|
||||
* @param string $path
|
||||
* @return boolean
|
||||
*/
|
||||
function delete($path = null)
|
||||
{
|
||||
$path = is_null($path)?$this->filePath:$path;
|
||||
if(file_exists($path))
|
||||
{
|
||||
if(is_file($path))
|
||||
{
|
||||
return @unlink($path);
|
||||
}elseif(is_dir($path))
|
||||
{
|
||||
return $this->__recursive_remove_directory($path);
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* empty a folder
|
||||
*
|
||||
* @param string $path
|
||||
* @return boolean
|
||||
*/
|
||||
function emptyFolder($path)
|
||||
{
|
||||
$path = is_null($path)?$this->filePath:"";
|
||||
if(file_exists($path) && is_dir($path))
|
||||
{
|
||||
return $this->__recursive_remove_directory($path, true);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function _debug($info)
|
||||
{
|
||||
if($this->debug)
|
||||
{
|
||||
echo $info . "<br>\n";
|
||||
}else
|
||||
{
|
||||
$this->errors[] = $info;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* recursive_remove_directory( directory to delete, empty )
|
||||
* expects path to directory and optional TRUE / FALSE to empty
|
||||
* of course PHP has to have the rights to delete the directory
|
||||
* you specify and all files and folders inside the directory
|
||||
*
|
||||
* to use this function to totally remove a directory, write:
|
||||
* recursive_remove_directory('path/to/directory/to/delete');
|
||||
* to use this function to empty a directory, write:
|
||||
* recursive_remove_directory('path/to/full_directory',TRUE);
|
||||
* @param string $directory
|
||||
* @param boolean $empty
|
||||
* @return boolean
|
||||
*/
|
||||
function __recursive_remove_directory($directory, $empty=FALSE)
|
||||
{
|
||||
// if the path has a slash at the end we remove it here
|
||||
if(substr($directory,-1) == '/')
|
||||
{
|
||||
$directory = substr($directory,0,-1);
|
||||
}
|
||||
|
||||
// if the path is not valid or is not a directory ...
|
||||
if(!file_exists($directory) || !is_dir($directory))
|
||||
{
|
||||
// ... we return false and exit the function
|
||||
return FALSE;
|
||||
|
||||
// ... if the path is not readable
|
||||
}elseif(!is_readable($directory))
|
||||
{
|
||||
// ... we return false and exit the function
|
||||
return FALSE;
|
||||
|
||||
// ... else if the path is readable
|
||||
}else{
|
||||
|
||||
// we open the directory
|
||||
$handle = @opendir($directory);
|
||||
|
||||
// and scan through the items inside
|
||||
while (FALSE !== ($item = @readdir($handle)))
|
||||
{
|
||||
// if the filepointer is not the current directory
|
||||
// or the parent directory
|
||||
if($item != '.' && $item != '..')
|
||||
{
|
||||
// we build the new path to delete
|
||||
$path = $directory.'/'.$item;
|
||||
|
||||
// if the new path is a directory
|
||||
if(is_dir($path)) {
|
||||
// we call this function with the new path
|
||||
$this->__recursive_remove_directory($path);
|
||||
|
||||
// if the new path is a file
|
||||
}else{
|
||||
// we remove the file
|
||||
@unlink($path);
|
||||
}
|
||||
}
|
||||
}
|
||||
// close the directory
|
||||
@closedir($handle);
|
||||
|
||||
// if the option to empty is not set to true
|
||||
if($empty == FALSE)
|
||||
{
|
||||
// try to delete the now empty directory
|
||||
if(!@rmdir($directory))
|
||||
{
|
||||
// return false if not possible
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
// return success
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
155
BO/ajaxfilemanager/inc/class.history.php
Executable file
@ -0,0 +1,155 @@
|
||||
<?php
|
||||
/**
|
||||
* class history
|
||||
* this class used to keep records of any changed to uploaded images under a session
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
class History
|
||||
{
|
||||
var $history = array(); //keep all changes
|
||||
var $path = ''; //path to the iamge
|
||||
var $session = null;
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
* @param string $path the path to the image
|
||||
* @param object $session an instance of session class
|
||||
*/
|
||||
function __construct($path, &$session)
|
||||
{
|
||||
$this->path = $path;
|
||||
$this->session = &$session;
|
||||
if(!isset($_SESSION[$this->path]))
|
||||
{
|
||||
$_SESSION[$this->path] = array();
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
* @param string $path the path to the image
|
||||
* @param object $session an instance of session class
|
||||
*/
|
||||
function History($path, &$session)
|
||||
{
|
||||
$this->__construct($path, $session);
|
||||
}
|
||||
|
||||
/**
|
||||
* keep tracks of each changes made to an image
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $info array('name', 'restorable', 'is_original')
|
||||
*/
|
||||
function add($info)
|
||||
{
|
||||
$_SESSION[$this->path][] = $info;
|
||||
}
|
||||
/**
|
||||
* get the lastest changes for restore
|
||||
*
|
||||
* @return array array('name', 'restorable', 'is_original')
|
||||
*/
|
||||
function getNumRestorable()
|
||||
{
|
||||
$output = 0;
|
||||
if(isset($_SESSION[$this->path]) && is_array($_SESSION[$this->path]))
|
||||
{
|
||||
foreach($_SESSION[$this->path] as $k=>$v)
|
||||
{
|
||||
if(!empty($v['restorable']) && empty($v['is_original']))
|
||||
{
|
||||
if(file_exists($this->session->getSessionDir() . $v['name']))
|
||||
{
|
||||
$output++;
|
||||
}else
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the path of image which keep the lastest changes
|
||||
*
|
||||
* @return return empty array when failed
|
||||
*/
|
||||
function getLastestRestorable()
|
||||
{
|
||||
if(isset($_SESSION[$this->path]) && is_array($_SESSION[$this->path]) && sizeof($_SESSION[$this->path]))
|
||||
{
|
||||
$sessionImages = array_reverse($_SESSION[$this->path], true);
|
||||
$lastestKey = '';
|
||||
foreach($sessionImages as $k=>$v)
|
||||
{
|
||||
if($v['restorable'] && empty($v['is_original']) && file_exists($this->session->getSessionDir() . $v['name']))
|
||||
{
|
||||
return $sessionImages[$k];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return array();
|
||||
|
||||
}
|
||||
/**
|
||||
* get the original image which is kept in the session folder
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getOriginalImage()
|
||||
{
|
||||
$outputs = array();
|
||||
if(isset($_SESSION[$this->path]) && is_array($_SESSION[$this->path]))
|
||||
{
|
||||
$sessionImages = array_reverse($_SESSION[$this->path], true);
|
||||
foreach($sessionImages as $k=>$v)
|
||||
{
|
||||
if(!empty($v['is_original']))
|
||||
{
|
||||
if(file_exists($this->session->getSessionDir() . $v['name']))
|
||||
{
|
||||
return array('info'=>$_SESSION[$this->path][$k], 'key'=>$k);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return $outputs;
|
||||
|
||||
}
|
||||
/**
|
||||
* remove the lastest restorable state
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function restore()
|
||||
{
|
||||
if(isset($_SESSION[$this->path]) && is_array($_SESSION[$this->path]) && sizeof($_SESSION[$this->path]))
|
||||
{
|
||||
$sessionImages = array_reverse($_SESSION[$this->path], true);
|
||||
$lastestKey = '';
|
||||
foreach($sessionImages as $k=>$v)
|
||||
{
|
||||
if($v['restorable'] && empty($v['is_original']))
|
||||
{
|
||||
unset($_SESSION[$k]);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
789
BO/ajaxfilemanager/inc/class.image.php
Executable file
@ -0,0 +1,789 @@
|
||||
<?php
|
||||
/**
|
||||
* this class provide functions to edit an image, e.g. resize, rotate, flip, crop
|
||||
* @author Logan Cai cailongqun [at] yahoo [dot] com [dot] cn
|
||||
* @link www.phpletter.com
|
||||
* @version 0.9
|
||||
* @since 14/May/2007
|
||||
* @name Image
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
class Image
|
||||
{
|
||||
var $_debug = false;
|
||||
var $_errors = array();
|
||||
var $gdInfo = array(); //keep all information of GD extension
|
||||
var $_imgOrig = null; //the hanlder of original image
|
||||
var $_imgFinal = null; //the handler of final image
|
||||
var $imageFile = null;
|
||||
var $transparentColorRed = null;
|
||||
var $transparentColorGreen = null;
|
||||
var $transparentColorBlue = null;
|
||||
var $chmod = 0755;
|
||||
var $_imgInfoOrig = array(
|
||||
'name'=>'',
|
||||
'ext'=>'',
|
||||
'size'=>'',
|
||||
'width'=>'',
|
||||
'height'=>'',
|
||||
'type'=>'',
|
||||
'path'=>'',
|
||||
);
|
||||
var $_imgInfoFinal = array(
|
||||
'name'=>'',
|
||||
'ext'=>'',
|
||||
'size'=>'',
|
||||
'width'=>'',
|
||||
'height'=>'',
|
||||
'type'=>'',
|
||||
'path'=>'',
|
||||
);
|
||||
var $_imgQuality = 90;
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
* @param boolean $debug
|
||||
* @return Image
|
||||
*/
|
||||
|
||||
function __construct($debug = false)
|
||||
{
|
||||
$this->enableDebug($debug);
|
||||
$this->gdInfo = $this->getGDInfo();
|
||||
}
|
||||
function Image($debug = false)
|
||||
{
|
||||
$this->__construct($debug);
|
||||
}
|
||||
/**
|
||||
* enable to debug
|
||||
*
|
||||
* @param boolean $value
|
||||
*/
|
||||
function enableDebug($value)
|
||||
{
|
||||
$this->_debug = ($value?true:false);
|
||||
}
|
||||
/**
|
||||
* check if debug enable
|
||||
* @return boolean
|
||||
*/
|
||||
function _isDebugEnable()
|
||||
{
|
||||
return $this->_debug;
|
||||
}
|
||||
|
||||
/**
|
||||
* append to errors array and shown the each error when the debug turned on
|
||||
*
|
||||
* @param string $string
|
||||
* @return void
|
||||
* @access private
|
||||
* @copyright this function originally come from Andy's php
|
||||
*/
|
||||
function _debug($value)
|
||||
{
|
||||
$this->_errors[] = $value;
|
||||
if ($this->_debug)
|
||||
{
|
||||
echo $value . "<br />\n";
|
||||
}
|
||||
}
|
||||
/**
|
||||
* show erros
|
||||
*
|
||||
*/
|
||||
function showErrors()
|
||||
{
|
||||
if(sizeof($this->_errors))
|
||||
{
|
||||
foreach($this->_errors as $error)
|
||||
{
|
||||
echo $error . "<br />\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Load an image from the file system.
|
||||
*
|
||||
* @param string $filename
|
||||
* @return bool
|
||||
* @access public
|
||||
* @copyright this function originally come from Andy's php
|
||||
*/
|
||||
function loadImage($filename)
|
||||
{
|
||||
$ext = strtolower($this->_getExtension($filename));
|
||||
$func = 'imagecreatefrom' . ($ext == 'jpg' ? 'jpeg' : $ext);
|
||||
if (!$this->_isSupported($filename, $ext, $func, false)) {
|
||||
return false;
|
||||
}
|
||||
if($ext == "gif")
|
||||
{
|
||||
// the following part gets the transparency color for a gif file
|
||||
// this code is from the PHP manual and is written by
|
||||
// fred at webblake dot net and webmaster at webnetwizard dotco dotuk, thanks!
|
||||
$fp = @fopen($filename, "rb");
|
||||
$result = @fread($fp, 13);
|
||||
$colorFlag = ord(substr($result,10,1)) >> 7;
|
||||
$background = ord(substr($result,11));
|
||||
if ($colorFlag) {
|
||||
$tableSizeNeeded = ($background + 1) * 3;
|
||||
$result = @fread($fp, $tableSizeNeeded);
|
||||
$this->transparentColorRed = ord(substr($result, $background * 3, 1));
|
||||
$this->transparentColorGreen = ord(substr($result, $background * 3 + 1, 1));
|
||||
$this->transparentColorBlue = ord(substr($result, $background * 3 + 2, 1));
|
||||
}
|
||||
fclose($fp);
|
||||
// -- here ends the code related to transparency handling
|
||||
}
|
||||
$this->_imgOrig = @$func($filename);
|
||||
if ($this->_imgOrig == null) {
|
||||
$this->_debug("The image could not be created from the '$filename' file using the '$func' function.");
|
||||
return false;
|
||||
}else
|
||||
{
|
||||
$this->imageFile = $filename;
|
||||
$this->_imgInfoOrig = array(
|
||||
'name'=>basename($filename),
|
||||
'ext'=>$ext,
|
||||
'size'=>filesize($filename),
|
||||
'path'=>$filename,
|
||||
);
|
||||
$imgInfo = $this->_getImageInfo($filename);
|
||||
if(sizeof($imgInfo))
|
||||
{
|
||||
foreach($imgInfo as $k=>$v)
|
||||
{
|
||||
$this->_imgInfoOrig[$k] = $v;
|
||||
$this->_imgInfoFinal[$k] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load an image from a string (eg. from a database table)
|
||||
*
|
||||
* @param string $string
|
||||
* @return bool
|
||||
* @access public
|
||||
* @copyright this function originally come from Andy's php
|
||||
*/
|
||||
function loadImageFromString($string)
|
||||
{
|
||||
$this->imageFile = $filename;
|
||||
$this->_imgOrig = imagecreatefromstring($string);
|
||||
if (!$this->_imgOrig) {
|
||||
$this->_debug('The image (supplied as a string) could not be created.');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Save the modified image
|
||||
*
|
||||
* @param string $filename
|
||||
* @param int $quality
|
||||
* @param string $forcetype
|
||||
* @return bool
|
||||
* @access public
|
||||
* @copyright this function originally come from Andy's php
|
||||
*/
|
||||
function saveImage($filename, $quality = 90, $forcetype = '')
|
||||
{
|
||||
if ($this->_imgFinal == null) {
|
||||
$this->_debug('No changes intend to be made.');
|
||||
return false;
|
||||
}
|
||||
|
||||
$ext = ($forcetype == '') ? $this->_getExtension($filename) : strtolower($forcetype);
|
||||
$func = 'image' . ($ext == 'jpg' ? 'jpeg' : $ext);
|
||||
if (!$this->_isSupported($filename, $ext, $func, true))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
$saved = false;
|
||||
switch($ext)
|
||||
{
|
||||
case 'gif':
|
||||
if ($this->gdInfo['Truecolor Support'] && imageistruecolor($this->_imgFinal))
|
||||
{
|
||||
imagetruecolortopalette($this->_imgFinal, false, 255);
|
||||
}
|
||||
case 'png':
|
||||
$saved = $func($this->_imgFinal, $filename);
|
||||
break;
|
||||
case 'jpg':
|
||||
$saved = $func($this->_imgFinal, $filename, $quality);
|
||||
break;
|
||||
}
|
||||
|
||||
if ($saved === false)
|
||||
{
|
||||
$this->_debug("The image could not be saved to the '$filename' file as the file type '$ext' using the '$func' function.");
|
||||
return false;
|
||||
}else
|
||||
{
|
||||
$this->_imgInfoFinal['size'] = @filesize($filename);
|
||||
@chmod($filename, intval($this->chmod, 8));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Shows the masked image without any saving
|
||||
*
|
||||
* @param string $type
|
||||
* @param int $quality
|
||||
* @return bool
|
||||
* @access public
|
||||
* @copyright this function originally come from Andy's php
|
||||
*/
|
||||
function showImage($type = '', $quality = '')
|
||||
{
|
||||
if ($this->_imgFinal == null) {
|
||||
$this->_debug('There is no cropped image to show.');
|
||||
return false;
|
||||
}
|
||||
$type = (!empty($type)?$type:$this->_imgInfoOrig['ext']);
|
||||
$quality = (!empty($quality)?$quality:$this->_imgQuality);
|
||||
|
||||
$type = strtolower($type);
|
||||
$func = 'image' . ($type == 'jpg' ? 'jpeg' : $type);
|
||||
$head = 'image/' . ($type == 'jpg' ? 'jpeg' : $type);
|
||||
|
||||
if (!$this->_isSupported('[showing file]', $type, $func, false)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
header("Content-type: $head");
|
||||
switch($type)
|
||||
{
|
||||
case 'gif':
|
||||
if ($this->gdInfo['Truecolor Support'] && imageistruecolor($this->_imgFinal))
|
||||
{
|
||||
@imagetruecolortopalette($this->_imgFinal, false, 255);
|
||||
}
|
||||
case 'png':
|
||||
$func($this->_imgFinal);
|
||||
break;
|
||||
case 'jpg':
|
||||
$func($this->_imgFinal, '', $quality);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for cropping image
|
||||
*
|
||||
* @param int $dst_x
|
||||
* @param int $dst_y
|
||||
* @param int $dst_w
|
||||
* @param int $dst_h
|
||||
* @return bool
|
||||
* @access public
|
||||
* @copyright this function originally come from Andy's php
|
||||
*/
|
||||
function crop($dst_x, $dst_y, $dst_w, $dst_h)
|
||||
{
|
||||
if ($this->_imgOrig == null) {
|
||||
$this->_debug('The original image has not been loaded.');
|
||||
return false;
|
||||
}
|
||||
if (($dst_w <= 0) || ($dst_h <= 0)) {
|
||||
$this->_debug('The image could not be cropped because the size given is not valid.');
|
||||
return false;
|
||||
}
|
||||
if (($dst_w > imagesx($this->_imgOrig)) || ($dst_h > imagesy($this->_imgOrig))) {
|
||||
$this->_debug('The image could not be cropped because the size given is larger than the original image.');
|
||||
return false;
|
||||
}
|
||||
$this->_createFinalImageHandler($dst_w, $dst_h);
|
||||
if ($this->gdInfo['Truecolor Support'])
|
||||
{
|
||||
if(!@imagecopyresampled($this->_imgFinal, $this->_imgOrig, 0, 0, $dst_x, $dst_y, $dst_w, $dst_h, $dst_w, $dst_h))
|
||||
{
|
||||
$this->_debug('Unable crop the image.');
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
{
|
||||
if(!@imagecopyresized($this->_imgFinal, $this->_imgOrig, 0, 0, $dst_x, $dst_y, $dst_w, $dst_h, $dst_w, $dst_h))
|
||||
{
|
||||
$this->_debug('Unable crop the image.');
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
$this->_imgInfoFinal['width'] = $dst_w;
|
||||
$this->_imgInfoFinal['height'] = $dst_h;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resize the Image in the X and/or Y direction
|
||||
* If either is 0 it will be scaled proportionally
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param mixed $new_x
|
||||
* @param mixed $new_y
|
||||
* @param boolean $constraint keep to resize the image proportionally
|
||||
* @param boolean $unchangeIfsmaller keep the orignial size if the orignial smaller than the new size
|
||||
*
|
||||
*
|
||||
* @return mixed none or PEAR_error
|
||||
*/
|
||||
function resize( $new_x, $new_y, $constraint= false, $unchangeIfsmaller=false)
|
||||
{
|
||||
if(!$this->_imgOrig)
|
||||
{
|
||||
$this->_debug('No image fould.');
|
||||
return false;
|
||||
}
|
||||
|
||||
$new_x = (int)($new_x);
|
||||
$new_y = (int)($new_y);
|
||||
if($new_x <=0 || $new_y <= 0)
|
||||
{
|
||||
$this->_debug('either of new width or height can be zeor or less.');
|
||||
}else
|
||||
{
|
||||
|
||||
if($constraint)
|
||||
{
|
||||
if($new_x < 1 && $new_y < 1)
|
||||
{
|
||||
$new_x = $this->_imgInfoOrig['width'];
|
||||
$new_y = $this->_imgInfoOrig['height'];
|
||||
}elseif($new_x < 1)
|
||||
{
|
||||
$new_x = floor($new_y / $this->_imgInfoOrig['height'] * $this->_imgInfoOrig['width']);
|
||||
|
||||
}elseif($new_y < 1)
|
||||
{
|
||||
$new_y = floor($new_x / $this->_imgInfoOrig['width'] * $this->_imgInfoOrig['height']);
|
||||
}else
|
||||
{
|
||||
$scale = min($new_x/$this->_imgInfoOrig['width'], $new_y/$this->_imgInfoOrig['height']) ;
|
||||
$new_x = floor($scale*$this->_imgInfoOrig['width']);
|
||||
$new_y = floor($scale*$this->_imgInfoOrig['height']);
|
||||
}
|
||||
}
|
||||
if($unchangeIfsmaller)
|
||||
{
|
||||
if($this->_imgInfoOrig['width'] < $new_x && $this->_imgInfoOrig['height'] < $new_y )
|
||||
{
|
||||
$new_x = $this->_imgInfoOrig['width'];
|
||||
$new_y = $this->_imgInfoOrig['height'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(is_null($this->_imgOrig))
|
||||
{
|
||||
$this->loadImage($filePath);
|
||||
}
|
||||
if(sizeof($this->_errors) == 0)
|
||||
{
|
||||
return $this->_resize($new_x, $new_y);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
} // End resize
|
||||
/**
|
||||
* resize the image and return the thumbnail image details array("width"=>, "height"=>, "name")
|
||||
*
|
||||
* @param string $fileName
|
||||
* @param int $new_x the thumbnail width
|
||||
* @param int $new_y the thumbnail height
|
||||
* @param string $mode can be save, view and both
|
||||
* @return unknown
|
||||
*/
|
||||
function _resize( $new_x, $new_y)
|
||||
{
|
||||
$this->_createFinalImageHandler($new_x, $new_y);
|
||||
// hacks fot transparency of png24 files
|
||||
if ($this->_imgInfoOrig['type'] == 'png')
|
||||
{
|
||||
@imagealphablending($this->_imgFinal, false);
|
||||
if(function_exists('ImageCopyResampled'))
|
||||
{
|
||||
@ImageCopyResampled($this->_imgFinal, $this->_imgOrig, 0, 0, 0, 0, $new_x, $new_y, $this->_imgInfoOrig['width'], $this->_imgInfoOrig['height']);
|
||||
} else {
|
||||
@ImageCopyResized($this->_imgFinal, $this->_imgOrig, 0, 0, 0, 0, $new_x, $new_y, $this->_imgInfoOrig['width'], $this->_imgInfoOrig['height']);
|
||||
}
|
||||
@imagesavealpha($this->_imgFinal, true);
|
||||
|
||||
}else
|
||||
{//for the rest image
|
||||
if(function_exists('ImageCopyResampled'))
|
||||
{
|
||||
@ImageCopyResampled($this->_imgFinal, $this->_imgOrig, 0, 0, 0, 0, $new_x, $new_y, $this->_imgInfoOrig['width'], $this->_imgInfoOrig['height']);
|
||||
} else {
|
||||
@ImageCopyResized($this->_imgFinal, $this->_imgOrig, 0, 0, 0, 0, $new_x, $new_y, $this->_imgInfoOrig['width'], $this->_imgInfoOrig['height']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->_imgInfoFinal['width'] = $new_x;
|
||||
$this->_imgInfoFinal['height'] = $new_y;
|
||||
$this->_imgInfoFinal['name'] = basename($this->_imgInfoOrig['name']);
|
||||
$this->_imgInfoFinal['path'] = $this->_imgInfoOrig['path'];
|
||||
if($this->_imgFinal)
|
||||
{
|
||||
return true;
|
||||
}else
|
||||
{
|
||||
$this->_debug('Unable to resize the image on the fly.');
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Get the extension of a file name
|
||||
*
|
||||
* @param string $file
|
||||
* @return string
|
||||
* @copyright this function originally come from Andy's php
|
||||
*/
|
||||
function _getExtension($file)
|
||||
{
|
||||
$ext = '';
|
||||
if (strrpos($file, '.')) {
|
||||
$ext = strtolower(substr($file, (strrpos($file, '.') ? strrpos($file, '.') + 1 : strlen($file)), strlen($file)));
|
||||
}
|
||||
return $ext;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate whether image reading/writing routines are valid.
|
||||
*
|
||||
* @param string $filename
|
||||
* @param string $extension
|
||||
* @param string $function
|
||||
* @param bool $write
|
||||
* @return bool
|
||||
* @access private
|
||||
* @copyright this function originally come from Andy's php
|
||||
*/
|
||||
function _isSupported($filename, $extension, $function, $write = false)
|
||||
{
|
||||
|
||||
$giftype = ($write) ? ' Create Support' : ' Read Support';
|
||||
$support = strtoupper($extension) . ($extension == 'gif' ? $giftype : ' Support');
|
||||
|
||||
if (!isset($this->gdInfo[$support]) || $this->gdInfo[$support] == false) {
|
||||
$request = ($write) ? 'saving' : 'reading';
|
||||
$this->_debug("Support for $request the file type '$extension' cannot be found.");
|
||||
return false;
|
||||
}
|
||||
if (!function_exists($function)) {
|
||||
$request = ($write) ? 'save' : 'read';
|
||||
$this->_debug("The '$function' function required to $request the '$filename' file cannot be found.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* flip image horizotally or vertically
|
||||
*
|
||||
* @param string $direction
|
||||
* @return boolean
|
||||
*/
|
||||
function flip($direction="horizontal")
|
||||
{
|
||||
$this->_createFinalImageHandler($this->_imgInfoOrig['width'], $this->_imgInfoOrig['height']);
|
||||
if($direction != "vertical")
|
||||
{
|
||||
$dst_x = 0;
|
||||
$dst_y = 0;
|
||||
$src_x = $this->_imgInfoOrig['width'] -1;
|
||||
$src_y = 0;
|
||||
$dst_w = $this->_imgInfoOrig['width'];
|
||||
$dst_h = $this->_imgInfoOrig['height'];
|
||||
$src_w = 0 - $this->_imgInfoOrig['width'];
|
||||
$src_h = $this->_imgInfoOrig['height'];
|
||||
|
||||
}else
|
||||
{
|
||||
$dst_x = 0;
|
||||
$dst_y = 0;
|
||||
$src_x = 0;
|
||||
$src_y = $this->_imgInfoOrig['height'] - 1;
|
||||
$dst_w = $this->_imgInfoOrig['width'];
|
||||
$dst_h = $this->_imgInfoOrig['height'];
|
||||
$src_w = $this->_imgInfoOrig['width'];
|
||||
$src_h = 0 - $this->_imgInfoOrig['height'];
|
||||
}
|
||||
if(function_exists('ImageCopyResampled')){
|
||||
ImageCopyResampled($this->_imgFinal, $this->_imgOrig, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
|
||||
} else {
|
||||
ImageCopyResized($this->_imgFinal, $this->_imgOrig, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
|
||||
}
|
||||
$this->_imgInfoFinal['width'] = $dst_w;
|
||||
$this->_imgInfoFinal['height'] = $dst_h;
|
||||
$this->_imgInfoFinal['name'] = basename($this->imageFile);
|
||||
$this->_imgInfoFinal['path'] = $this->imageFile;
|
||||
if($this->_imgFinal)
|
||||
{
|
||||
return true;
|
||||
}else
|
||||
{
|
||||
$this->_debug('Unable to resize the image on the fly.');
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
* flip vertically
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function flipVertical()
|
||||
{
|
||||
return $this->flip('vertical');
|
||||
}
|
||||
/**
|
||||
* flip horizontal
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function flipHorizontal()
|
||||
{
|
||||
return $this->flip('horizontal');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get the GD version information
|
||||
*
|
||||
* @param bool $versionOnly
|
||||
* @return array
|
||||
* @access private
|
||||
* @copyright this function originally come from Andy's php
|
||||
*/
|
||||
function getGDInfo($versionOnly = false)
|
||||
{
|
||||
$outputs = array();
|
||||
if (function_exists('gd_info'))
|
||||
{
|
||||
$outputs = gd_info();
|
||||
} else
|
||||
{
|
||||
$gd = array(
|
||||
'GD Version' => '',
|
||||
'GIF Read Support' => false,
|
||||
'GIF Create Support' => false,
|
||||
'JPG Support' => false,
|
||||
'PNG Support' => false,
|
||||
'FreeType Support' => false,
|
||||
'FreeType Linkage' => '',
|
||||
'T1Lib Support' => false,
|
||||
'WBMP Support' => false,
|
||||
'XBM Support' => false
|
||||
);
|
||||
ob_start();
|
||||
phpinfo();
|
||||
$buffer = ob_get_contents();
|
||||
ob_end_clean();
|
||||
foreach (explode("\n", $buffer) as $line) {
|
||||
$line = array_map('trim', (explode('|', strip_tags(str_replace('</td>', '|', $line)))));
|
||||
if (isset($gd[$line[0]])) {
|
||||
if (strtolower($line[1]) == 'enabled') {
|
||||
$gd[$line[0]] = true;
|
||||
} else {
|
||||
$gd[$line[0]] = $line[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
$outputs = $gd;
|
||||
}
|
||||
|
||||
if (isset($outputs['JIS-mapped Japanese Font Support'])) {
|
||||
unset($outputs['JIS-mapped Japanese Font Support']);
|
||||
}
|
||||
if (function_exists('imagecreatefromgd')) {
|
||||
$outputs['GD Support'] = true;
|
||||
}
|
||||
if (function_exists('imagecreatefromgd2')) {
|
||||
$outputs['GD2 Support'] = true;
|
||||
}
|
||||
if (preg_match('/^(bundled|2)/', $outputs['GD Version'])) {
|
||||
$outputs['Truecolor Support'] = true;
|
||||
} else {
|
||||
$outputs['Truecolor Support'] = false;
|
||||
}
|
||||
if ($outputs['GD Version'] != '') {
|
||||
$match = array();
|
||||
if (preg_match('/([0-9\.]+)/', $outputs['GD Version'], $match)) {
|
||||
$foo = explode('.', $match[0]);
|
||||
$outputs['Version'] = array('major' => isset($foo[0])?$foo[0]:'', 'minor' => isset($foo[1])?$foo[1]:'', 'patch' => isset($foo[2])?$foo:"");
|
||||
}
|
||||
}
|
||||
|
||||
return ($versionOnly) ? $outputs['Version'] : $outputs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy the resources used by the images.
|
||||
*
|
||||
* @param bool $original
|
||||
* @return void
|
||||
* @access public
|
||||
* @copyright this function originally come from Andy's php
|
||||
*/
|
||||
function DestroyImages($original = true)
|
||||
{
|
||||
if(!is_null($this->_imgFinal))
|
||||
{
|
||||
@imagedestroy($this->_imgFinal);
|
||||
}
|
||||
$this->_imgFinal = null;
|
||||
if ($original && !is_null($this->_imgOrig)) {
|
||||
@imagedestroy($this->_imgOrig);
|
||||
$this->_imgOrig = null;
|
||||
}
|
||||
}
|
||||
|
||||
function getImageInfo($imagePath)
|
||||
{
|
||||
return $this->_getImageInfo($imagePath);
|
||||
}
|
||||
/**
|
||||
* get image information, e.g. width, height, type
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
function _getImageInfo($imagePath)
|
||||
{
|
||||
$outputs = array();
|
||||
$imageInfo = @GetImageSize($imagePath);
|
||||
if ($imageInfo && is_array($imageInfo))
|
||||
{
|
||||
switch($imageInfo[2]){
|
||||
case 1:
|
||||
$type = 'gif';
|
||||
break;
|
||||
case 2:
|
||||
$type = 'jpeg';
|
||||
break;
|
||||
case 3:
|
||||
$type = 'png';
|
||||
break;
|
||||
case 4:
|
||||
$type = 'swf';
|
||||
break;
|
||||
case 5:
|
||||
$type = 'psd';
|
||||
case 6:
|
||||
$type = 'bmp';
|
||||
case 7:
|
||||
case 8:
|
||||
$type = 'tiff';
|
||||
default:
|
||||
$type = '';
|
||||
}
|
||||
$outputs['width'] = $imageInfo[0];
|
||||
$outputs['height'] = $imageInfo[1];
|
||||
$outputs['type'] = $type;
|
||||
$outputs['ext'] = $this->_getExtension($imagePath);
|
||||
} else {
|
||||
$this->_debug('Unable locate the image or read images information.');
|
||||
}
|
||||
return $outputs;
|
||||
|
||||
}
|
||||
function rotate($angle, $bgColor=0)
|
||||
{
|
||||
$angle = (int)($angle) -360;
|
||||
while($angle <0)
|
||||
{
|
||||
$angle += 360;
|
||||
}
|
||||
|
||||
|
||||
if($this->_imgFinal = imagerotate($this->_imgOrig, $angle))
|
||||
{
|
||||
return true;
|
||||
}else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* get the original image info
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getOriginalImageInfo()
|
||||
{
|
||||
return $this->_imgInfoOrig;
|
||||
}
|
||||
/**
|
||||
* return the final image info
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getFinalImageInfo()
|
||||
{
|
||||
if($this->_imgInfoFinal['width'] == '')
|
||||
{
|
||||
if(is_null($this->_imgFinal))
|
||||
{
|
||||
$this->_imgInfoFinal = $this->_imgInfoOrig;
|
||||
}else
|
||||
{
|
||||
$this->_imgInfoFinal['width'] = @imagesx($this->_imgFinal);
|
||||
$this->_imgInfoFinal['height'] = @imagesy($this->_imgFinal);
|
||||
}
|
||||
}
|
||||
return $this->_imgInfoFinal;
|
||||
}
|
||||
|
||||
/**
|
||||
* create final image handler
|
||||
*
|
||||
* @access private
|
||||
* @param $dst_w width
|
||||
* @param $dst_h height
|
||||
* @return boolean
|
||||
* @copyright original from noname at nivelzero dot ro
|
||||
*/
|
||||
function _createFinalImageHandler($dst_w, $dst_h)
|
||||
{
|
||||
if(function_exists('ImageCreateTrueColor'))
|
||||
{
|
||||
$this->_imgFinal = @ImageCreateTrueColor($dst_w,$dst_h);
|
||||
} else {
|
||||
$this->_imgFinal = @ImageCreate($dst_w,$dst_h);
|
||||
}
|
||||
if (!is_null($this->transparentColorRed) && !is_null($this->transparentColorGreen) && !is_null($this->transparentColorBlue)) {
|
||||
|
||||
$transparent = @imagecolorallocate($targetImageIdentifier, $this->transparentColorRed, $this->transparentColorGreen, $this->transparentColorBlue);
|
||||
@imagefilledrectangle($this->_imgFinal, 0, 0, $dst_w, $dst_h, $transparent);
|
||||
@imagecolortransparent($this->_imgFinal, $transparent);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
373
BO/ajaxfilemanager/inc/class.manager.php
Executable file
@ -0,0 +1,373 @@
|
||||
<?php
|
||||
/**
|
||||
* file listing
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/April/2007
|
||||
*
|
||||
*/
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "class.file.php");
|
||||
class manager
|
||||
{
|
||||
var $currentFolderPath;
|
||||
var $sessionAction = null; //object to session action
|
||||
var $flags = array('no'=>'noFlag', 'cut'=>'cutFlag', 'copy'=>'copyFlag');
|
||||
var $forceFolderOnTop = false; //forced to have folder shown on the top of the list
|
||||
var $currentFolderInfo = array(
|
||||
'name'=>'',
|
||||
'subdir'=>0,
|
||||
'file'=>0,
|
||||
'ctime'=>'',
|
||||
'mtime'=>'',
|
||||
'is_readable'=>'',
|
||||
'is_writable'=>'',
|
||||
'size'=>0,
|
||||
'path'=>'',
|
||||
'type'=>'folder',
|
||||
'flag'=>'noFlag',
|
||||
'friendly_path'=>'',
|
||||
);
|
||||
|
||||
var $lastVisitedFolderPathIndex = 'ajax_last_visited_folder';
|
||||
var $folderPathIndex = "path";
|
||||
var $calculateSubdir = true;
|
||||
var $fileTypes = array(
|
||||
array(array("exe", "com"), "fileExe", SEARCH_TYPE_EXE, 0),
|
||||
array(array("gif", "jpg", "png", "bmp", "tif"), "filePicture", SEARCH_TYPE_IMG, 1),
|
||||
array(array("zip", "sit", "rar", "gz", "tar"), "fileZip", SEARCH_TYPE_ARCHIVE, 0),
|
||||
array(array("htm", "html", "php", "jsp", "asp", 'js', 'css'), "fileCode", SEARCH_TYPE_HTML, 1),
|
||||
array(array("mov", "ram", "rm", "asx", "dcr", "wmv"), "fileVideo", SEARCH_TYPE_VIDEO, 1),
|
||||
array(array("mpg", "avi", "asf", "mpeg"), "fileVideo", SEARCH_TYPE_MOVIE, 1),
|
||||
array(array("aif", "aiff", "wav", "mp3", "wma"), "fileMusic", SEARCH_TYPE_MUSIC, 1),
|
||||
array(array("swf", 'flv'), "fileFlash", SEARCH_TYPE_FLASH, 1),
|
||||
array(array("ppt"), "filePPT", SEARCH_TYPE_PPT, 0),
|
||||
array(array("rtf"), "fileRTF", SEARCH_TYPE_DOC, 0),
|
||||
array(array("doc"), "fileWord", SEARCH_TYPE_WORD, 0),
|
||||
array(array("pdf"), "fileAcrobat", SEARCH_TYPE_PDF, 0),
|
||||
array(array("xls", "csv"), "fileExcel", SEARCH_TYPE_EXCEL, 0),
|
||||
array(array("txt"), "fileText", SEARCH_TYPE_TEXT, 1),
|
||||
array(array("xml", "xsl", "dtd"), "fileXml", SEARCH_TYPE_XML, 1)
|
||||
);
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @path the path to a folder
|
||||
* @calculateSubdir force to get the subdirectories information
|
||||
*/
|
||||
function __construct($path = null, $calculateSubdir=true)
|
||||
{
|
||||
|
||||
$this->calculateSubdir = $calculateSubdir;
|
||||
if(defined('CONFIG_SYS_FOLDER_SHOWN_ON_TOP'))
|
||||
{
|
||||
$this->forceFolderOnTop = CONFIG_SYS_FOLDER_SHOWN_ON_TOP;
|
||||
}
|
||||
if(!is_null($path))
|
||||
{
|
||||
$this->currentFolderPath = $path;
|
||||
|
||||
}elseif(isset($_GET[$this->folderPathIndex]) && file_exists($_GET[$this->folderPathIndex]) && !is_file($_GET[$this->folderPathIndex]) )
|
||||
{
|
||||
$this->currentFolderPath = $_GET[$this->folderPathIndex];
|
||||
}
|
||||
elseif(isset($_SESSION[$this->lastVisitedFolderPathIndex]) && file_exists($_SESSION[$this->lastVisitedFolderPathIndex]) && !is_file($_SESSION[$this->lastVisitedFolderPathIndex]))
|
||||
{
|
||||
$this->currentFolderPath = $_SESSION[$this->lastVisitedFolderPathIndex];
|
||||
}else
|
||||
{
|
||||
$this->currentFolderPath = CONFIG_SYS_DEFAULT_PATH;
|
||||
}
|
||||
|
||||
$this->currentFolderPath = (isUnderRoot($this->currentFolderPath)?backslashToSlash((addTrailingSlash($this->currentFolderPath))):CONFIG_SYS_DEFAULT_PATH);
|
||||
|
||||
if($this->calculateSubdir)
|
||||
{// keep track of this folder path in session
|
||||
$_SESSION[$this->lastVisitedFolderPathIndex] = $this->currentFolderPath;
|
||||
}
|
||||
if(is_dir($this->currentFolderPath))
|
||||
{
|
||||
$file = new file($this->currentFolderPath);
|
||||
$folderInfo = $file->getFileInfo();
|
||||
if(sizeof($folderInfo))
|
||||
{
|
||||
$this->currentFolderInfo['name']=basename($this->currentFolderPath);
|
||||
$this->currentFolderInfo['subdir']=0;
|
||||
$this->currentFolderInfo['file']=0;
|
||||
$this->currentFolderInfo['ctime']=$folderInfo['ctime'];
|
||||
$this->currentFolderInfo['mtime']=$folderInfo['mtime'];
|
||||
$this->currentFolderInfo['is_readable']=$folderInfo['is_readable'];
|
||||
$this->currentFolderInfo['is_writable']=$folderInfo['is_writable'];
|
||||
$this->currentFolderInfo['path'] = $this->currentFolderPath;
|
||||
$this->currentFolderInfo['friendly_path'] = transformFilePath($this->currentFolderPath);
|
||||
$this->currentFolderInfo['type'] = "folder";
|
||||
$this->currentFolderInfo['cssClass']='folder';
|
||||
|
||||
//$this->currentFolderInfo['flag'] = $folderInfo['flag'];
|
||||
}
|
||||
}
|
||||
if($calculateSubdir && !file_exists($this->currentFolderPath))
|
||||
{
|
||||
die(ERR_FOLDER_NOT_FOUND . $this->currentFolderPath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function setSessionAction(&$session)
|
||||
{
|
||||
$this->sessionAction = $session;
|
||||
}
|
||||
/**
|
||||
* constructor
|
||||
*/
|
||||
function manager($path = null, $calculateSubdir=true)
|
||||
{
|
||||
$this->__construct($path, $calculateSubdir);
|
||||
}
|
||||
/**
|
||||
* get current folder path
|
||||
* @return string
|
||||
*/
|
||||
function getCurrentFolderPath()
|
||||
{
|
||||
return $this->currentFolderPath;
|
||||
}
|
||||
/**
|
||||
* get the list of files and folders under this current fold
|
||||
* @return array
|
||||
*/
|
||||
function getFileList()
|
||||
{
|
||||
$outputs = array();
|
||||
$files = array();
|
||||
$folders = array();
|
||||
$tem = array();
|
||||
$dirHandler = @opendir($this->currentFolderPath);
|
||||
if($dirHandler)
|
||||
{
|
||||
while(false !== ($file = readdir($dirHandler)))
|
||||
{
|
||||
if($file != '.' && $file != '..')
|
||||
{
|
||||
$flag = $this->flags['no'];
|
||||
|
||||
if($this->sessionAction->getFolder() == $this->currentFolderPath)
|
||||
{//check if any flag associated with this folder or file
|
||||
$folder = addTrailingSlash(backslashToSlash($this->currentFolderPath));
|
||||
if(in_array($folder . $file, $this->sessionAction->get()))
|
||||
{
|
||||
if($this->sessionAction->getAction() == "copy")
|
||||
{
|
||||
$flag = $this->flags['copy'];
|
||||
}else
|
||||
{
|
||||
$flag = $this->flags['cut'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$path=$this->currentFolderPath.$file;
|
||||
if(is_dir($path) && isListingDocument($path) )
|
||||
{
|
||||
$this->currentFolderInfo['subdir']++;
|
||||
if(!$this->calculateSubdir)
|
||||
{
|
||||
}else
|
||||
{
|
||||
|
||||
$folder = $this->getFolderInfo($path);
|
||||
$folder['flag'] = $flag;
|
||||
$folders[$file] = $folder;
|
||||
$outputs[$file] = $folders[$file];
|
||||
}
|
||||
|
||||
|
||||
}elseif(is_file($path) && isListingDocument($path))
|
||||
{
|
||||
|
||||
$obj = new file($path);
|
||||
$tem = $obj->getFileInfo();
|
||||
if(sizeof($tem))
|
||||
{
|
||||
$fileType = $this->getFileType($file);
|
||||
foreach($fileType as $k=>$v)
|
||||
{
|
||||
$tem[$k] = $v;
|
||||
}
|
||||
$this->currentFolderInfo['size'] += $tem['size'];
|
||||
$this->currentFolderInfo['file']++;
|
||||
$tem['path'] = backslashToSlash($path);
|
||||
$tem['type'] = "file";
|
||||
$tem['flag'] = $flag;
|
||||
$files[$file] = $tem;
|
||||
$outputs[$file] = $tem;
|
||||
$tem = array();
|
||||
$obj->close();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if($this->forceFolderOnTop)
|
||||
{
|
||||
uksort($folders, "strnatcasecmp");
|
||||
uksort($files, "strnatcasecmp");
|
||||
$outputs = array();
|
||||
foreach($folders as $v)
|
||||
{
|
||||
$outputs[] = $v;
|
||||
}
|
||||
foreach ($files as $v)
|
||||
{
|
||||
$outputs[] = $v;
|
||||
}
|
||||
}else
|
||||
{
|
||||
uksort($outputs, "strnatcasecmp");
|
||||
}
|
||||
|
||||
@closedir($dirHandler);
|
||||
}else
|
||||
{
|
||||
trigger_error('Unable to locate the folder ' . $this->currentFolderPath, E_NOTICE);
|
||||
}
|
||||
return $outputs;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get current or the specified dir information
|
||||
*
|
||||
* @param string $path
|
||||
* @return array
|
||||
*/
|
||||
function getFolderInfo($path=null)
|
||||
{
|
||||
if(is_null($path))
|
||||
{
|
||||
return $this->currentFolderInfo;
|
||||
}else
|
||||
{
|
||||
$obj = new manager($path, false);
|
||||
$obj->setSessionAction($this->sessionAction);
|
||||
$obj->getFileList();
|
||||
return $obj->getFolderInfo();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* return the file type of a file.
|
||||
*
|
||||
* @param string file name
|
||||
* @return array
|
||||
*/
|
||||
function getFileType($fileName, $checkIfDir = false)
|
||||
{
|
||||
|
||||
$ext = strtolower($this->_getExtension($fileName, $checkIfDir));
|
||||
|
||||
foreach ($this->fileTypes as $fileType)
|
||||
{
|
||||
if(in_array($ext, $fileType[0]))
|
||||
{
|
||||
return array("cssClass" => $fileType[1], "fileType" => $fileType[2], "preview" => $fileType[3], 'test'=>5);
|
||||
}
|
||||
}
|
||||
if(!empty($fileName))
|
||||
{//this is folder
|
||||
if(empty($ext))
|
||||
{
|
||||
if(is_dir($fileName))
|
||||
{
|
||||
|
||||
return array("cssClass" => ($checkIfDir && $this->isDirEmpty($fileName)?'folderEmpty':"folder") , "fileType" => "Folder", "preview" => 0, 'test'=>1);
|
||||
}else
|
||||
{
|
||||
return array("cssClass" => "fileUnknown", "fileType" => SEARCH_TYPE_UNKNOWN, "preview" => 0, 'test'=>2);
|
||||
}
|
||||
}else
|
||||
{
|
||||
return array("cssClass" => "fileUnknown", "fileType" => SEARCH_TYPE_UNKNOWN, "preview" => 0, 'test'=>3, 'ext'=>$ext , 'filename'=>$fileName);
|
||||
}
|
||||
|
||||
}else
|
||||
{//this is unknown file
|
||||
return array("cssClass" => "fileUnknown", "fileType" => SEARCH_TYPE_UNKNOWN, "preview" => 0, 'test'=>4);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* return the predefined file types
|
||||
*
|
||||
* @return arrray
|
||||
*/
|
||||
function getFileTypes()
|
||||
{
|
||||
return $this->fileTypes;
|
||||
}
|
||||
/**
|
||||
* print out the file types
|
||||
*
|
||||
*/
|
||||
function printFileTypes()
|
||||
{
|
||||
foreach($fileTypes as $fileType)
|
||||
{
|
||||
if(isset($fileType[0]) && is_array($fileType[0]))
|
||||
{
|
||||
foreach($fileType[0] as $type)
|
||||
{
|
||||
echo $type. ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the extension of a file name
|
||||
*
|
||||
* @param string $file
|
||||
* @return string
|
||||
* @copyright this function originally come from Andy's php
|
||||
*/
|
||||
function _getExtension($file, $checkIfDir = false)
|
||||
{
|
||||
if($checkIfDir && file_exists($file) && is_dir($file))
|
||||
{
|
||||
return '';
|
||||
}else
|
||||
{
|
||||
return @substr(@strrchr($file, "."), 1);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function isDirEmpty($path)
|
||||
{
|
||||
$dirHandler = @opendir($path);
|
||||
if($dirHandler)
|
||||
{
|
||||
while(false !== ($file = readdir($dirHandler)))
|
||||
{
|
||||
if($file != '.' && $file != '..')
|
||||
{
|
||||
@closedir($dirHandler);
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@closedir($dirHandler);
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
?>
|
584
BO/ajaxfilemanager/inc/class.pagination.php
Executable file
@ -0,0 +1,584 @@
|
||||
<?php
|
||||
/**
|
||||
* Pagination Class
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @since 27/Nov/20006
|
||||
*
|
||||
*/
|
||||
class pagination
|
||||
{
|
||||
var $totalItems = 0;
|
||||
var $itemsPerPage = 30;
|
||||
var $currentPage = 1;
|
||||
var $friendlyUrl = false;
|
||||
var $baseUrl = "";
|
||||
var $pageIndex = "page";
|
||||
var $groupLimit = 5;
|
||||
var $excludedQueryStrings = array();
|
||||
var $totalPages = 0;
|
||||
var $url = "";
|
||||
var $previousText = "Previous";
|
||||
var $nextText = "Next";
|
||||
var $lastText = "Last";
|
||||
var $firstText = "First";
|
||||
var $limitIndex ='limit';
|
||||
var $limits = array(5, 10, 20, 30, 50, 80, 150, 999);
|
||||
|
||||
|
||||
/**
|
||||
* Contructor
|
||||
*
|
||||
* @param boolean $friendlyUrl set the returned url
|
||||
* as search engine friendly or Normal Url
|
||||
*/
|
||||
function pagination($friendlyUrl=false)
|
||||
{
|
||||
$this->friendlyUrl = $friendlyUrl;
|
||||
$this->__resetCurrentPage();
|
||||
}
|
||||
|
||||
/**
|
||||
* set maximum number of items per page
|
||||
*
|
||||
* @param integer $value maximum number of items per page
|
||||
*/
|
||||
function setLimit($value)
|
||||
{
|
||||
$this->itemsPerPage = (int)($value);
|
||||
}
|
||||
/**
|
||||
* get maximum number of items per page
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
function getLimit()
|
||||
{
|
||||
return $this->itemsPerPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* set the total number of items
|
||||
*
|
||||
* @param integer $value the total number of items
|
||||
*/
|
||||
function setTotal($value)
|
||||
{
|
||||
$this->totalItems = (int)($value);
|
||||
}
|
||||
/**
|
||||
* get the total number of items
|
||||
*
|
||||
* @return integer total number of items
|
||||
*/
|
||||
function getTotal()
|
||||
{
|
||||
return $this->totalItems;
|
||||
}
|
||||
/**
|
||||
* get total pages will be used to display all records
|
||||
*
|
||||
*/
|
||||
function getTotalPages()
|
||||
{
|
||||
|
||||
$output = floor(($this->totalItems / $this->itemsPerPage ));
|
||||
if($this->totalItems % $this->itemsPerPage)
|
||||
{
|
||||
$output++;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the index of URL Query String
|
||||
*
|
||||
* @param string $value e.g. page
|
||||
*/
|
||||
function setPageIndex($value)
|
||||
{
|
||||
$this->pageIndex = $value;
|
||||
$this->__resetCurrentPage();
|
||||
}
|
||||
|
||||
|
||||
function getPageIndex()
|
||||
{
|
||||
return $this->pageIndex;
|
||||
}
|
||||
/**
|
||||
* initiate or reset the current page number
|
||||
*
|
||||
*/
|
||||
function __resetCurrentPage()
|
||||
{
|
||||
$this->currentPage = ((isset($_GET[$this->pageIndex]) && (int)($_GET[$this->pageIndex]) > 0)?(int)($_GET[$this->pageIndex]):1);
|
||||
}
|
||||
|
||||
/**
|
||||
* set the base url used in the links, default is $PHP_SELF
|
||||
*
|
||||
* @param string $value the base url
|
||||
*/
|
||||
function setUrl($value="")
|
||||
{
|
||||
if(empty($value))
|
||||
{
|
||||
if($this->friendlyUrl)
|
||||
{
|
||||
$this->url = "http://" . $_SERVER['HTTP_HOST'] . "/";
|
||||
}else
|
||||
{
|
||||
$this->url = $_SERVER['PHP_SELF'];
|
||||
}
|
||||
}else
|
||||
{
|
||||
$this->url = $value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* get the base url variable
|
||||
*
|
||||
* @return string the base url
|
||||
*/
|
||||
function getUrl()
|
||||
{
|
||||
|
||||
if(empty($this->url))
|
||||
{
|
||||
$this->setUrl();
|
||||
|
||||
}
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
/**
|
||||
* set base url for pagination links after exculed those keys
|
||||
* identified on excluded query strings
|
||||
*/
|
||||
function __setBaseUrl()
|
||||
{
|
||||
|
||||
if(empty($this->url))
|
||||
{
|
||||
$this->getUrl();
|
||||
}
|
||||
|
||||
if($this->friendlyUrl)
|
||||
{
|
||||
$this->baseUrl = $this->getUrl();
|
||||
}else
|
||||
{
|
||||
|
||||
$appendingQueryStrings = array();
|
||||
$this->excludedQueryStrings[$this->pageIndex] =$this->pageIndex;
|
||||
foreach($_GET as $k=>$v)
|
||||
{
|
||||
if((array_search($k, $this->excludedQueryStrings) === false ))
|
||||
{
|
||||
$appendingQueryStrings[$k] = $k . "=" . $v;
|
||||
}
|
||||
}
|
||||
if(sizeof($appendingQueryStrings))
|
||||
{
|
||||
$this->baseUrl = $this->__appendQueryString($this->url, implode("&", $appendingQueryStrings));
|
||||
}else
|
||||
{
|
||||
$this->baseUrl = $this->getUrl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* get base url for pagination links aftr excluded those key
|
||||
* identified on excluded query strings
|
||||
*
|
||||
*/
|
||||
function __getBaseUrl()
|
||||
{
|
||||
|
||||
if(empty($this->baseUrl))
|
||||
{
|
||||
|
||||
$this->__setBaseUrl();
|
||||
}
|
||||
return $this->baseUrl;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get the first item number
|
||||
*
|
||||
* @return interger the first item number displayed within current page
|
||||
*/
|
||||
function getFirstItem()
|
||||
{
|
||||
$output = 0;
|
||||
$temStartItemNumber = (($this->currentPage - 1) * $this->itemsPerPage + 1);
|
||||
if($this->totalItems && $temStartItemNumber <= $this->totalItems )
|
||||
{
|
||||
|
||||
$output = $temStartItemNumber;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
/**
|
||||
* get the last item number displayed within current page
|
||||
*
|
||||
* @return interger the last item number
|
||||
*/
|
||||
function getLastItem()
|
||||
{
|
||||
$output = 0;
|
||||
$temEndItemNumber = (($this->currentPage) * $this->itemsPerPage);
|
||||
if($this->totalItems)
|
||||
{
|
||||
if($temEndItemNumber <= $this->totalItems)
|
||||
{
|
||||
$output = $temEndItemNumber;
|
||||
}else
|
||||
{
|
||||
$output = $this->totalItems;
|
||||
}
|
||||
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
/**
|
||||
* set page groupings limit
|
||||
* used for previous 1 2 3 4 5 next
|
||||
*
|
||||
* @param unknown_type $value
|
||||
*/
|
||||
function setGroupLimit($value)
|
||||
{
|
||||
$this->groupLimit = (int)($value);
|
||||
}
|
||||
/**
|
||||
* get page grouping limit
|
||||
*
|
||||
* @return integer the page grouping limit
|
||||
*/
|
||||
function getGroupLimit()
|
||||
{
|
||||
return $this->groupLimit;
|
||||
}
|
||||
/**
|
||||
* get the page offset number
|
||||
* used for Query . e.g SELECT SQL_CALC_FOUND_ROWS *
|
||||
* FROM mytable LIMIT getPageOffset(), getItemsPerPage()
|
||||
*
|
||||
* @return iner
|
||||
*/
|
||||
function getPageOffset()
|
||||
{
|
||||
return (($this->currentPage - 1) * $this->itemsPerPage);
|
||||
}
|
||||
/**
|
||||
* get the last url if any
|
||||
* @return string the last url
|
||||
*/
|
||||
function getLastUrl()
|
||||
{
|
||||
|
||||
$url = "";
|
||||
$totalPages = $this->getTotalPages();
|
||||
if($this->currentPage < $totalPages)
|
||||
{
|
||||
$url = $this->__getBaseUrl();
|
||||
|
||||
if($this->friendlyUrl)
|
||||
{
|
||||
$url .= $this->pageIndex . $totalPages . "/";
|
||||
}else
|
||||
{
|
||||
$url = $this->__appendQueryString($url, $this->pageIndex . "=" . $totalPages);
|
||||
}
|
||||
$url = sprintf('<a href="%s" class="pagination_last"><span>%s</span></a>',
|
||||
$url,
|
||||
$this->lastText);
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* get the first url if any
|
||||
* @return string the first url
|
||||
*/
|
||||
|
||||
function getFirstUrl()
|
||||
{
|
||||
$url = "";
|
||||
if($this->currentPage > 1)
|
||||
{
|
||||
$url = $this->__getBaseUrl();
|
||||
if($this->friendlyUrl)
|
||||
{
|
||||
$url .= $this->pageIndex . "1/";
|
||||
}else
|
||||
{
|
||||
$url = $this->__appendQueryString($url, $this->pageIndex . "=1");
|
||||
}
|
||||
$url = sprintf('<a href="%s" class="pagination_first"><span>%s</span></a>',
|
||||
$url,
|
||||
$this->firstText);
|
||||
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the previous page url if anywhere
|
||||
*
|
||||
* @param array $excludedQueryStrings excluded the value from $_GET
|
||||
* @return string the previous page url
|
||||
*/
|
||||
function getPreviousUrl()
|
||||
{
|
||||
$url = "";
|
||||
if($this->currentPage > 1 && $this->totalItems > 0 )
|
||||
{
|
||||
$url = $this->__getBaseUrl();
|
||||
if($this->friendlyUrl)
|
||||
{
|
||||
$url .= $this->pageIndex . ($this->currentPage - 1) . "/";
|
||||
}else
|
||||
{
|
||||
$url = $this->__appendQueryString($url, $this->pageIndex . "=" . ($this->currentPage -1));
|
||||
}
|
||||
$url = sprintf('<a href="%s" class="pagination_previous"><span>%s</span></a>',
|
||||
$url,
|
||||
$this->previousText);
|
||||
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
/**
|
||||
* get the next page url if anywhere
|
||||
*
|
||||
* @param array $excludedQueryStrings excluded the value from $_GET
|
||||
* @return string the next page url
|
||||
*/
|
||||
function getNextUrl()
|
||||
{
|
||||
$url = "";
|
||||
if($this->totalItems > ($this->currentPage * $this->itemsPerPage))
|
||||
{
|
||||
$url = $this->__getBaseUrl();
|
||||
if($this->friendlyUrl)
|
||||
{
|
||||
$url .= $this->pageIndex . ($this->currentPage + 1) . "/";
|
||||
}else
|
||||
{
|
||||
$url = $this->__appendQueryString($url, $this->pageIndex . "=" . ($this->currentPage + 1));
|
||||
}
|
||||
$url = sprintf('<a href="%s" class="pagination_next"><span>%s</span></a>',
|
||||
$url,
|
||||
$this->nextText);
|
||||
}
|
||||
return $url;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* get the group page links e.g. 1,2,3,4,5
|
||||
* return format
|
||||
* <a class="pagination_group" href='yoururl'>1</a>
|
||||
* <a class="pagination_group active" href='#'>2</a>
|
||||
* <a class="pagination_group" href='yoururl'>3</a>
|
||||
*/
|
||||
function getGroupUrls()
|
||||
{
|
||||
$output = "";
|
||||
if($this->totalItems > 0)
|
||||
{
|
||||
$displayedPages = 0;
|
||||
$url = $this->__getBaseUrl();
|
||||
$totalPages = $this->getTotalPages();
|
||||
// find halfway point
|
||||
$groupLimitHalf = floor($this->groupLimit / 2);
|
||||
// determine what item/page we start with
|
||||
$itemStart = $this->currentPage - $groupLimitHalf;
|
||||
$itemStart = ($itemStart > 0 && $itemStart <= $totalPages)?$itemStart:1;
|
||||
$itemEnd = $itemStart;
|
||||
|
||||
while($itemEnd < ($itemStart + $this->groupLimit - 1) && $itemEnd < $totalPages)
|
||||
{
|
||||
$itemEnd++;
|
||||
}
|
||||
|
||||
|
||||
if($totalPages > ($itemEnd - $itemStart))
|
||||
{
|
||||
for($i = $itemStart; $i > 1 && ($itemEnd - $itemStart + 1) < $this->groupLimit; $i--)
|
||||
{
|
||||
$itemStart--;
|
||||
}
|
||||
}
|
||||
|
||||
for($item = $itemStart; $item <= $itemEnd; $item++)
|
||||
{
|
||||
if($item != $this->currentPage)
|
||||
{//it is not the active link
|
||||
if($this->friendlyUrl)
|
||||
{
|
||||
$temUrl = $url . $this->pageIndex . $item . "/";
|
||||
}else
|
||||
{
|
||||
$temUrl = $this->__appendQueryString($url, $this->pageIndex . "=" . $item);
|
||||
}
|
||||
$output .= sprintf(' <a class="pagination_group" href="%s"><span>%d</span></a> ', $temUrl, $item);
|
||||
}else
|
||||
{//active link
|
||||
$output .= sprintf(' <a class="pagination_group pagination_active" href="#"><span>%d</span></a> ', $item);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
/**
|
||||
* set the text of previous page link
|
||||
*
|
||||
* @param string $value
|
||||
*/
|
||||
function setPreviousText($value)
|
||||
{
|
||||
$this->previousText = $value;
|
||||
}
|
||||
/**
|
||||
* set the text of first page link
|
||||
*
|
||||
* @param string $value
|
||||
*/
|
||||
function setFirstText($value)
|
||||
{
|
||||
$this->firstText = $value;
|
||||
}
|
||||
/**
|
||||
* set the text of next page link
|
||||
*
|
||||
* @param string $value
|
||||
*/
|
||||
|
||||
function setNextText($value)
|
||||
{
|
||||
$this->nextText = $value;
|
||||
}
|
||||
/**
|
||||
* set the text of last page link
|
||||
*
|
||||
* @param string $value
|
||||
*/
|
||||
function setLastText($value)
|
||||
{
|
||||
$this->lastText = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* set the excluded query string from $_GET;
|
||||
*
|
||||
* @param array the lists of the query string keys
|
||||
*/
|
||||
|
||||
function setExcludedQueryString($values = array())
|
||||
{
|
||||
$this->excludedQueryStrings = $values;
|
||||
}
|
||||
|
||||
function getExcludedQueryString()
|
||||
{
|
||||
return $this->excludedQueryStrings;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* add extra query stiring to a url
|
||||
* @param string $baseUrl
|
||||
* @param string $extra the query string added to the base url
|
||||
*/
|
||||
function __appendQueryString($baseUrl, $extra)
|
||||
{
|
||||
$output = trim($baseUrl);
|
||||
if(strpos($baseUrl, "?") !== false)
|
||||
{
|
||||
$output .= "&" . $extra;
|
||||
}else
|
||||
{
|
||||
$output .= "?" . $extra;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
/**
|
||||
* return the html
|
||||
*
|
||||
* @param integer $type
|
||||
*/
|
||||
function getPaginationHTML($type=1, $cssClass="pagination")
|
||||
{
|
||||
$output = '';
|
||||
$output .= "<div class=\"pagination_content\"><p class=\"$cssClass\">\n";
|
||||
switch($type)
|
||||
{
|
||||
case "2":
|
||||
$output .= "<span class=\"pagination_summany\">" . $this->getFirstItem() . " to " . $this->getLastItem() . " of " . $this->getTotal() . " results.</span> ";
|
||||
if($previousUrl = $this->getPreviousUrl())
|
||||
{
|
||||
$output .= " " . $previousUrl;
|
||||
}
|
||||
|
||||
if($nextUrl = $this->getNextUrl())
|
||||
{
|
||||
$output .= " " . $nextUrl;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
//get full summary pagination
|
||||
default:
|
||||
$output .= "<span class=\"pagination_summany\">" . $this->getFirstItem() . "/" . $this->getLastItem() . " (" . $this->getTotal() . ")</span> ";
|
||||
if($firstUrl = $this->getFirstUrl())
|
||||
{
|
||||
$output .= " " . $firstUrl;
|
||||
}
|
||||
if($previousUrl = $this->getPreviousUrl())
|
||||
{
|
||||
$output .= " " . $previousUrl;
|
||||
}
|
||||
|
||||
if($groupUrls = $this->getGroupUrls())
|
||||
{
|
||||
$output .= " " . $groupUrls;
|
||||
}
|
||||
if($nextUrl = $this->getNextUrl())
|
||||
{
|
||||
$output .= " " . $nextUrl;
|
||||
}
|
||||
if($lastUrl = $this->getLastUrl())
|
||||
{
|
||||
$output .= " " . $lastUrl;
|
||||
}
|
||||
$itemPerPage = '';
|
||||
$itemPerPage .= "<select name=\"" . $this->limitIndex . "\" id=\"limit\" class=\"input inputLimit\" onchange=\"changePaginationLimit();\">\n";
|
||||
foreach ($this->limits as $v)
|
||||
{
|
||||
$itemPerPage .= "<option value=\"" . $v . "\" " . ($v==$this->itemsPerPage?'selected="selected"':'') . ">" . $v . "</option>\n";
|
||||
}
|
||||
$itemPerPage .= "</select>\n";
|
||||
$output .= "<span class=\"pagination_items_per_page\">";
|
||||
$output .= sprintf(PAGINATION_ITEMS_PER_PAGE, $itemPerPage);
|
||||
$output .= "</span>";
|
||||
$output .= "<span class=\"pagination_parent\"><a href=\"#\" onclick=\"goParentFolder();\" id=\"pagination_parent_link\" title=\"" . PAGINATION_GO_PARENT . "\"> </a></span>";
|
||||
}
|
||||
|
||||
$output .= "</p></div>";
|
||||
return $output;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
184
BO/ajaxfilemanager/inc/class.search.php
Executable file
@ -0,0 +1,184 @@
|
||||
<?php
|
||||
include_once(CLASS_FILE);
|
||||
require_once(CLASS_SESSION_ACTION);
|
||||
require_once(CLASS_MANAGER);
|
||||
class Search
|
||||
{
|
||||
var $rootFolder = '';
|
||||
var $files = array();
|
||||
var $rootFolderInfo = array();
|
||||
var $searchkeywords = array(
|
||||
'mtime_from'=>'',
|
||||
'mtime_to'=>'',
|
||||
'name'=>'',
|
||||
'size_from'=>'',
|
||||
'size_to'=>'',
|
||||
'recursive'=>'0',
|
||||
|
||||
);
|
||||
var $sessionAction = null;
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
* @param string $rootFolder
|
||||
*/
|
||||
function __construct($rootFolder)
|
||||
{
|
||||
$this->rootFolder = $rootFolder;
|
||||
$this->sessionAction = new SessionAction();
|
||||
$objRootFolder = new file($this->rootFolder);
|
||||
$tem = $objRootFolder->getFileInfo();
|
||||
$obj = new manager($this->rootFolder, false);
|
||||
$obj->setSessionAction($this->sessionAction);
|
||||
$selectedDocuments = $this->sessionAction->get();
|
||||
$fileType = $obj->getFolderInfo($this->rootFolder);
|
||||
|
||||
foreach($fileType as $k=>$v)
|
||||
{
|
||||
$tem[$k] = $v;
|
||||
}
|
||||
|
||||
$tem['path'] = backslashToSlash($this->rootFolder);
|
||||
$tem['type'] = (is_dir($this->rootFolder)?'folder':'file');
|
||||
$tem['size'] = (is_dir($this->rootFolder)?'':transformFileSize(@filesize($this->rootFolder)));
|
||||
//$tem['ctime'] = date(DATE_TIME_FORMAT, $tem['ctime']);
|
||||
//$tem['mtime'] = date(DATE_TIME_FORMAT, $tem['mtime']);
|
||||
$tem['flag'] = (array_search($tem['path'], $selectedDocuments) !== false?($this->sessionAction->getAction() == "copy"?'copyFlag':'cutFlag'):'noFlag');
|
||||
$tem['url'] = getFileUrl($this->rootFolder);
|
||||
$tem['friendly_path'] = transformFilePath($this->rootFolder);
|
||||
$tem['file'] = 0;
|
||||
$tem['subdir'] = 0;
|
||||
$manager = null;
|
||||
$this->rootFolderInfo = $tem;
|
||||
$tem = null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
* @param string $rootFolder
|
||||
*/
|
||||
function Search($rootFolder)
|
||||
{
|
||||
$this->__construct($rootFolder);
|
||||
}
|
||||
|
||||
/**
|
||||
* change the search keyword individually
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $value
|
||||
*/
|
||||
function addSearchKeyword($key, $value)
|
||||
{
|
||||
$this->searchkeywords[$key] = $value;
|
||||
}
|
||||
/**
|
||||
* change the search keywords
|
||||
*
|
||||
* @param array $keywords
|
||||
*/
|
||||
function addSearchKeywords($keywords)
|
||||
{
|
||||
foreach($this->searchkeywords as $k=>$v)
|
||||
{
|
||||
if(array_key_exists($k, $keywords) !== false)
|
||||
{
|
||||
$this->searchkeywords[$k] = $keywords[$k];
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* get the file according to the search keywords
|
||||
*
|
||||
*/
|
||||
function doSearch($baseFolderPath = null)
|
||||
{
|
||||
|
||||
$baseFolderPath = addTrailingSlash(backslashToSlash((is_null($baseFolderPath)?$this->rootFolder:$baseFolderPath)));
|
||||
|
||||
$dirHandler = @opendir($baseFolderPath);
|
||||
if($dirHandler)
|
||||
{
|
||||
while(false !== ($file = readdir($dirHandler)))
|
||||
{
|
||||
if($file != '.' && $file != '..')
|
||||
{
|
||||
$path = $baseFolderPath . $file;
|
||||
if(is_file($path))
|
||||
{
|
||||
$isValid = true;
|
||||
|
||||
$fileTime = @filemtime($path);
|
||||
$fileSize = @filesize($path);
|
||||
if($this->searchkeywords['name'] !== '' && @eregi($this->searchkeywords['name'], $file) === false)
|
||||
{
|
||||
$isValid = false;
|
||||
}
|
||||
if($this->searchkeywords['mtime_from'] != '' && $fileTime < @strtotime($this->searchkeywords['mtime_from']))
|
||||
{
|
||||
$isValid = false;
|
||||
}
|
||||
if($this->searchkeywords['mtime_to'] != '' && $fileTime > @strtotime($this->searchkeywords['mtime_to']))
|
||||
{
|
||||
$isValid = false;
|
||||
}
|
||||
if($this->searchkeywords['size_from'] != '' && $fileSize < @strtotime($this->searchkeywords['size_from']))
|
||||
{
|
||||
$isValid = false;
|
||||
}
|
||||
if($this->searchkeywords['size_to'] != '' && $fileSize > @strtotime($this->searchkeywords['size_to']))
|
||||
{
|
||||
$isValid = false;
|
||||
}
|
||||
if($isValid && isListingDocument($path))
|
||||
{
|
||||
$finalPath = $path;
|
||||
$objFile = new file($finalPath);
|
||||
$tem = $objFile->getFileInfo();
|
||||
$obj = new manager($finalPath, false);
|
||||
$obj->setSessionAction($this->sessionAction);
|
||||
$selectedDocuments = $this->sessionAction->get();
|
||||
$fileType = $obj->getFileType($finalPath);
|
||||
|
||||
foreach($fileType as $k=>$v)
|
||||
{
|
||||
$tem[$k] = $v;
|
||||
}
|
||||
|
||||
$tem['path'] = backslashToSlash($finalPath);
|
||||
$tem['type'] = (is_dir($finalPath)?'folder':'file');
|
||||
$tem['size'] = transformFileSize($tem['size']);
|
||||
$tem['ctime'] = date(DATE_TIME_FORMAT, $tem['ctime']);
|
||||
$tem['mtime'] = date(DATE_TIME_FORMAT, $tem['mtime']);
|
||||
$tem['flag'] = (array_search($tem['path'], $selectedDocuments) !== false?($this->sessionAction->getAction() == "copy"?'copyFlag':'cutFlag'):'noFlag');
|
||||
$tem['url'] = getFileUrl($tem['path']);
|
||||
$this->rootFolderInfo['file']++;
|
||||
$manager = null;
|
||||
$this->files[] = $tem;
|
||||
$tem = null;
|
||||
}
|
||||
}elseif(is_dir($path) && $this->searchkeywords['recursive'])
|
||||
{
|
||||
$this->Search($baseFolderPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dirHandler);
|
||||
}
|
||||
|
||||
function getFoundFiles()
|
||||
{
|
||||
return $this->files;
|
||||
}
|
||||
|
||||
function getRootFolderInfo()
|
||||
{
|
||||
|
||||
return $this->rootFolderInfo;
|
||||
}
|
||||
}
|
||||
?>
|
228
BO/ajaxfilemanager/inc/class.session.php
Executable file
@ -0,0 +1,228 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* this class provide a function like session handling engine
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "class.file.php");
|
||||
class Session
|
||||
{
|
||||
var $lifeTime;
|
||||
var $fp = null;
|
||||
var $dir = null;
|
||||
var $mTime = null;
|
||||
var $sessionDir = null;
|
||||
var $sessionFile = null;
|
||||
var $ext = '.txt';
|
||||
var $gcCounter = 5; //call gc to delete expired session each ten request
|
||||
var $gcCounterFileName = 'gc_counter.ajax.php';
|
||||
var $gcCounterFile = null;
|
||||
var $gcLogFileName = 'gc_log.ajax.php';
|
||||
var $gcLogFile = null;
|
||||
var $debug = true; //turn it on when you want to see gc log
|
||||
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
//check if the session folder read and writable
|
||||
/*
|
||||
$dir = new file();
|
||||
if(!file_exists(CONFIG_SYS_DIR_SESSION_PATH))
|
||||
{
|
||||
if(!$dir->mkdir(CONFIG_SYS_DIR_SESSION_PATH))
|
||||
{
|
||||
die('Unable to create session folder.');
|
||||
}
|
||||
}
|
||||
if(!$dir->isReadable(CONFIG_SYS_DIR_SESSION_PATH))
|
||||
{
|
||||
die('Permission denied: ' . CONFIG_SYS_DIR_SESSION_PATH . " is not readable.");
|
||||
}
|
||||
if(!$dir->isWritable(CONFIG_SYS_DIR_SESSION_PATH))
|
||||
{
|
||||
die('Permission denied: ' . CONFIG_SYS_DIR_SESSION_PATH . " is not writable.");
|
||||
}
|
||||
$this->dir = backslashToSlash(addTrailingSlash(CONFIG_SYS_DIR_SESSION_PATH));
|
||||
$this->lifeTime = get_cfg_var("session.gc_maxlifetime");
|
||||
$this->gcCounterFile = $this->dir . $this->gcCounterFileName;
|
||||
$this->gcLogFile = $this->dir . $this->gcLogFileName;
|
||||
$this->sessionDir = backslashToSlash($this->dir.session_id().DIRECTORY_SEPARATOR);
|
||||
*/
|
||||
$this->init();
|
||||
}
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
*/
|
||||
function Session()
|
||||
{
|
||||
$this->__construct();
|
||||
}
|
||||
/**
|
||||
* session init
|
||||
* @return boolean
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function gc()
|
||||
{
|
||||
//init the counter file
|
||||
$fp = @fopen($this->gcCounterFile, 'a+');
|
||||
if($fp)
|
||||
{
|
||||
$count = (int)(fgets($fp, 999999)) + 1;
|
||||
if($count > $this->gcCounter || rand(0, 23) == date('h'))
|
||||
{
|
||||
$this->_gc();
|
||||
$count = 0;
|
||||
}
|
||||
@ftruncate($fp, 0);
|
||||
if(!@fputs($fp, $count))
|
||||
{
|
||||
die(SESSION_COUNTER_FILE_WRITE_FAILED);
|
||||
}
|
||||
@fclose($fp);
|
||||
}else
|
||||
{
|
||||
die(SESSION_COUNTER_FILE_CREATE_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function _gc()
|
||||
{
|
||||
//remove expired file from session folder
|
||||
$dirHandler = @opendir($this->dir);
|
||||
$output = '';
|
||||
$output .= "gc start at " . date('d/M/Y H:i:s') . "\n";
|
||||
$fo = new file();
|
||||
if($dirHandler)
|
||||
{
|
||||
while(false !== ($file = readdir($dirHandler)))
|
||||
{
|
||||
if($file != '.' && $file != '..' && $file != $this->gcCounterFileName && $file != $this->gcLogFileName && $file != session_id() )
|
||||
{
|
||||
$path=$this->dir.$file;
|
||||
$output .= $path ;
|
||||
//check if this is a expired session file
|
||||
if(filemtime($path) + $this->lifeTime < time())
|
||||
{
|
||||
if($fo->delete($path))
|
||||
{
|
||||
$output .= ' Deleted at ' . date('d/M/Y H:i:s');
|
||||
}else
|
||||
{
|
||||
$output .= " Failed at " . date('d/M/Y H:i:s');
|
||||
}
|
||||
}
|
||||
$output .= "\n";
|
||||
|
||||
}
|
||||
}
|
||||
if($this->debug)
|
||||
{
|
||||
$this->_log($output);
|
||||
}
|
||||
|
||||
@closedir($dirHandler);
|
||||
|
||||
}
|
||||
if(CONFIG_SYS_DEMO_ENABLE)
|
||||
{
|
||||
//remove expired files from uploaded folder
|
||||
$dirHandler = @opendir(CONFIG_SYS_ROOT_PATH);
|
||||
$output = '';
|
||||
$output .= "gc start at " . date('d/M/Y H:i:s') . "\n";
|
||||
$fo = new file();
|
||||
if($dirHandler)
|
||||
{
|
||||
while(false !== ($file = readdir($dirHandler)))
|
||||
{
|
||||
if($file != '.' && $file != '..')
|
||||
{
|
||||
$path=CONFIG_SYS_ROOT_PATH.$file;
|
||||
$output .= $path ;
|
||||
//check if this is a expired session file
|
||||
if(filemtime($path) + $this->lifeTime < time())
|
||||
{
|
||||
if($fo->delete($path))
|
||||
{
|
||||
$output .= ' Deleted at ' . date('d/M/Y H:i:s');
|
||||
}else
|
||||
{
|
||||
$output .= " Failed at " . date('d/M/Y H:i:s');
|
||||
}
|
||||
}
|
||||
$output .= "\n";
|
||||
|
||||
}
|
||||
}
|
||||
if($this->debug)
|
||||
{
|
||||
$this->_log($output);
|
||||
}
|
||||
|
||||
@closedir($dirHandler);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* log action taken by the gc
|
||||
*
|
||||
* @param unknown_type $msg
|
||||
*/
|
||||
function _log($msg)
|
||||
{
|
||||
$msg = "<?php die(); ?>\n" . $msg;
|
||||
$fp = @fopen($this->gcLogFile, 'w+');
|
||||
if($fp)
|
||||
{
|
||||
@ftruncate($fp, 0);
|
||||
!@fputs($fp, $msg);
|
||||
@fclose($fp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get the current session directory
|
||||
*
|
||||
* @return string return empty if failed
|
||||
*/
|
||||
function getSessionDir()
|
||||
{
|
||||
if(!file_exists($this->sessionDir) && !is_dir($this->sessionDir))
|
||||
{
|
||||
$dir = new file();
|
||||
if(!$dir->mkdir($this->sessionDir))
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}else
|
||||
{
|
||||
if(!@is_dir($this->sessionDir))
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
return $this->sessionDir;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
93
BO/ajaxfilemanager/inc/class.sessionaction.php
Executable file
@ -0,0 +1,93 @@
|
||||
<?php
|
||||
/**
|
||||
*Session Action Class
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
class SessionAction
|
||||
{
|
||||
var $actionIndex = 'ajax_file_action';
|
||||
var $selectedDocIndex = 'ajax_selected_doc';
|
||||
var $fromFolderIndex = 'ajax_from_folder';
|
||||
function __construct()
|
||||
{
|
||||
if(!isset($_SESSION[$this->actionIndex]))
|
||||
{
|
||||
$_SESSION[$this->actionIndex] = '';
|
||||
}
|
||||
if(!isset($_SESSION[$this->selectedDocIndex]) || !is_array($_SESSION[$this->selectedDocIndex]))
|
||||
{
|
||||
$_SESSION[$this->selectedDocIndex] = array();
|
||||
}
|
||||
if(!isset($_SESSION[$this->fromFolderIndex]))
|
||||
{
|
||||
$_SESSION[$this->fromFolderIndex] = '';
|
||||
}
|
||||
}
|
||||
|
||||
function SessionAction()
|
||||
{
|
||||
$this->__construct();
|
||||
}
|
||||
/**
|
||||
* count the number of selected documents
|
||||
*
|
||||
*/
|
||||
function count()
|
||||
{
|
||||
return (isset($_SESSION[$this->selectedDocIndex])?sizeof($_SESSION[$this->selectedDocIndex]):0);
|
||||
}
|
||||
/**
|
||||
* assign the selected documents
|
||||
*
|
||||
* @param array $selectedDocuments
|
||||
*/
|
||||
function set($selectedDocuments)
|
||||
{
|
||||
$_SESSION[$this->selectedDocIndex] = $selectedDocuments;
|
||||
|
||||
}
|
||||
/**
|
||||
* get the selected documents
|
||||
* @return array
|
||||
*/
|
||||
function get()
|
||||
{
|
||||
return (isset($_SESSION[$this->selectedDocIndex])?$_SESSION[$this->selectedDocIndex]:array());
|
||||
}
|
||||
|
||||
function setAction($action)
|
||||
{
|
||||
$_SESSION[$this->actionIndex] = $action;
|
||||
}
|
||||
/**
|
||||
* get the action
|
||||
*
|
||||
* @return unknown
|
||||
*/
|
||||
function getAction()
|
||||
{
|
||||
return (isset($_SESSION[$this->actionIndex])?$_SESSION[$this->actionIndex]:'');
|
||||
}
|
||||
/**
|
||||
* set the folder
|
||||
*
|
||||
* @param string $folder
|
||||
*/
|
||||
function setFolder($folder)
|
||||
{
|
||||
$_SESSION[$this->fromFolderIndex] = $folder;
|
||||
}
|
||||
/**
|
||||
* get the folder
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getFolder()
|
||||
{
|
||||
return (isset($_SESSION[$this->fromFolderIndex])?$_SESSION[$this->fromFolderIndex]:'');
|
||||
}
|
||||
}
|
||||
?>
|
589
BO/ajaxfilemanager/inc/class.upload.php
Executable file
@ -0,0 +1,589 @@
|
||||
<?php
|
||||
/**
|
||||
* This class provide all file upload functionalities
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/April/2007
|
||||
*
|
||||
*/
|
||||
class Upload
|
||||
{
|
||||
var $fileType = ""; //the file type
|
||||
var $originalFileName = "";
|
||||
var $fileName = ""; //the file final name
|
||||
var $fileExtension = "";
|
||||
var $img_x = 0;
|
||||
var $img_y = 0;
|
||||
var $img_new_x = 0;
|
||||
var $img_new_y = 0;
|
||||
var $imgHandler = null;
|
||||
var $fileBaseName = ""; //file name without the file extension and .
|
||||
var $filePath = ""; //the file path which the file uploaded to
|
||||
var $fileSize = 0;
|
||||
var $validImageExts = array("gif", "jpg", "png");
|
||||
var $errors = array();
|
||||
var $_value = null; //an array holding the uploaded file details
|
||||
var $dirPath = "";
|
||||
var $invalidFileExt = array(); //var $invalidFileExt = array('php,inc,asp,aspx');
|
||||
var $errCode = "";
|
||||
var $safeMode;
|
||||
var $uploadFileMode = 0755;
|
||||
var $errorCodes = array(
|
||||
0=>'the file uploaded with success',
|
||||
1=>'The uploaded file exceeds the upload_max_filesize directive in php.ini',
|
||||
2=>'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form',
|
||||
3=>'The uploaded file was only partially uploaded',
|
||||
4=>'No file was uploaded.',
|
||||
6=>'Missing a temporary folder',
|
||||
7=>'Failed to write file to disk',
|
||||
8=>'File upload stopped by extension',
|
||||
999=>'No error code avaiable',
|
||||
);
|
||||
|
||||
|
||||
function Upload()
|
||||
{
|
||||
//doing nothing
|
||||
}
|
||||
|
||||
function isFileUploaded($indexInPost="file")
|
||||
{
|
||||
|
||||
$this->errCode = isset($_FILES[$indexInPost]['error'])?$_FILES[$indexInPost]['error']:999;
|
||||
if((isset($_FILES[$indexInPost]['error']) && $_FILES[$indexInPost] == 0) ||
|
||||
(!empty($_FILES[$indexInPost]['tmp_name']) && $_FILES[$indexInPost]['tmp_name'] != 'none')
|
||||
)
|
||||
{
|
||||
$this->_value = $_FILES[$indexInPost];
|
||||
$this->fileSize = @filesize($this->_value['tmp_name']);
|
||||
$this->originalFileName = $this->_value['name'];
|
||||
$this->fileType = $this->_value['type'];
|
||||
|
||||
return true;
|
||||
}else
|
||||
{
|
||||
|
||||
array_push($this->errors, 'Unable to upload file');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function getErrorCodeMsg()
|
||||
{
|
||||
return (isset($this->errorCodes[$this->errCode])?$this->errorCodes[$this->errCode]:"");
|
||||
}
|
||||
/**
|
||||
* check if the uploaded file extension is allowed against the validFile Extension
|
||||
* or against the invalid extension list when the list of valid file extension is not set
|
||||
*
|
||||
* @param array $validFileExt
|
||||
* @return boolean
|
||||
*/
|
||||
function isPermittedFileExt($validFileExt = array())
|
||||
{
|
||||
$tem = array();
|
||||
|
||||
if(sizeof($validFileExt))
|
||||
{
|
||||
foreach($validFileExt as $k=>$v)
|
||||
{
|
||||
$tem[$k] = strtolower(trim($v));
|
||||
}
|
||||
}
|
||||
$validFileExt = $tem;
|
||||
|
||||
if(sizeof($validFileExt) && sizeof($this->invalidFileExt))
|
||||
{
|
||||
foreach($validFileExt as $k=>$ext)
|
||||
{
|
||||
if(array_search(strtolower($ext), $this->invalidFileExt) !== false)
|
||||
{
|
||||
unset($validFileExt[$k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if(sizeof($validFileExt))
|
||||
{
|
||||
if(array_search(strtolower($this->getFileExt()), $validFileExt) !== false)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}elseif(array_search(strtolower($this->getFileExt()), $this->invalidFileExt) === false)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
$this->deleteUploadedFile();
|
||||
return false;
|
||||
|
||||
}
|
||||
/**
|
||||
* check if the uploaded file size is too big
|
||||
*
|
||||
* @param integer $maxSize
|
||||
*/
|
||||
function isSizeTooBig($maxSize="")
|
||||
{
|
||||
if($this->fileSize > $maxSize)
|
||||
{
|
||||
$this->deleteUploadedFile();
|
||||
return true;
|
||||
}else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* set the invali file extensions
|
||||
*
|
||||
* @param array $invalidFileExt
|
||||
*/
|
||||
function setInvalidFileExt($invalidFileExt=array())
|
||||
{
|
||||
$tem = array();
|
||||
if(sizeof($invalidFileExt))
|
||||
{
|
||||
foreach($invalidFileExt as $k=>$v)
|
||||
{
|
||||
$tem[$k]= strtolower(trim($v));
|
||||
}
|
||||
}
|
||||
|
||||
$this->invalidFileExt = $tem;
|
||||
}
|
||||
/**
|
||||
* get file type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getFileType()
|
||||
{
|
||||
return $this->fileType;
|
||||
}
|
||||
/**
|
||||
* get a file extension
|
||||
*
|
||||
* @param string $fileName the path to a file or just the file name
|
||||
*/
|
||||
function getFileExt()
|
||||
{
|
||||
//return strtolower(substr(strrchr($this->fileName, "."), 1));
|
||||
return substr(strrchr($this->originalFileName, "."), 1);
|
||||
}
|
||||
/**
|
||||
* move the uploaded file to a specific location
|
||||
*
|
||||
* @param string $dest the path to the directory which the uploaded file will be moved to
|
||||
* @param string $fileBaseName the base name which the uploaded file will be renamed to
|
||||
* @param unknown_type $overwrite
|
||||
* @return unknown
|
||||
*/
|
||||
function moveUploadedFile($dest, $fileBaseName = '', $overwrite=false)
|
||||
{
|
||||
|
||||
//ensure the directory path ending with /
|
||||
if ($dest != '' && substr($dest, -1) != '/') {
|
||||
$dest .= '/';
|
||||
}
|
||||
$this->dirPath = $dest;
|
||||
$fileName = basename($this->_value['name']);
|
||||
|
||||
$dotIndex = strrpos($fileName, '.');
|
||||
$this->fileExtension = '';
|
||||
if(is_int($dotIndex))
|
||||
{
|
||||
$this->fileExtension = substr($fileName, $dotIndex);
|
||||
$this->fileBaseName = substr($fileName, 0, $dotIndex);
|
||||
}
|
||||
if(!empty($fileBaseName))
|
||||
{
|
||||
$this->fileBaseName = $fileBaseName;
|
||||
}
|
||||
$fileName = $this->fileBaseName . $this->fileExtension;
|
||||
$filePath = $dest . $fileName;
|
||||
|
||||
if(!$overwrite && file_exists($filePath) && is_file($filePath))
|
||||
{//rename
|
||||
|
||||
$counter = 0;
|
||||
while(file_exists($dest.$fileName) && is_file($dest .$fileName))
|
||||
{
|
||||
$counter++;
|
||||
$fileName = $this->fileBaseName.'_'.$counter.$this->fileExtension;
|
||||
}
|
||||
$this->fileBaseName .= "_" . $counter;
|
||||
|
||||
}
|
||||
if (@move_uploaded_file($this->_value['tmp_name'], $dest . $fileName)) {
|
||||
@chmod($dest . $fileName, $this->uploadFileMode);
|
||||
$this->fileName = $fileName;
|
||||
$this->filePath = $dest . $fileName;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* check if the uploaded is permitted to upload
|
||||
*
|
||||
* @param mixed $invalidImageExts invalid image extension
|
||||
* @param bool $delete force to delete the uploaded file
|
||||
*/
|
||||
function isImage($invalidImageExts = array(), $delete = true)
|
||||
{
|
||||
if(!is_array($invalidImageExts) && !empty($invalidImageExts))
|
||||
{
|
||||
$invalidImageExts = explode(",", $invalidImageExts);
|
||||
}
|
||||
foreach ($invalidImageExts as $k=>$v)
|
||||
{
|
||||
$invalidImageExts[$k] = strtolower(trim($v));
|
||||
}
|
||||
foreach ($this->validImageExts as $k=>$v)
|
||||
{
|
||||
$ValidImageExts[$k] = strtolower(trim($v));
|
||||
}
|
||||
if(sizeof($invalidImageExts))
|
||||
{
|
||||
foreach ($ValidImageExts as $k=>$v)
|
||||
{
|
||||
if(array_search(strtolower($v), $invalidImageExts) !== false)
|
||||
{
|
||||
unset($ValidImageExts[$k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(array_search(strtolower($this->getFileExt()), $ValidImageExts)!==false)
|
||||
{
|
||||
$this->_get_image_details($this->filePath);
|
||||
if(!empty($this->fileType))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}else
|
||||
{
|
||||
if($delete)
|
||||
{
|
||||
$this->deleteUploadedFile();
|
||||
}
|
||||
}
|
||||
|
||||
array($this->errors, "This file is not a image type file.");
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resize the Image in the X and/or Y direction
|
||||
* If either is 0 it will be scaled proportionally
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param mixed $new_x
|
||||
* @param mixed $new_y
|
||||
* @param string $thumb_suffix
|
||||
*
|
||||
* @return mixed none or PEAR_error
|
||||
*/
|
||||
function resize($filePath, $thumb_suffix="", $new_x = 0, $new_y = 0)
|
||||
{
|
||||
|
||||
if(empty($filePath))
|
||||
{
|
||||
$filePath = $this->dirPath . $this->fileBaseName . $thumb_suffix . $this->fileExtension;
|
||||
}
|
||||
// 0 means keep original size
|
||||
if ($this->img_x > $this->img_y)
|
||||
$new_y = (int)($new_y/$this->img_x*$this->img_y);
|
||||
else if ($this->img_y > $this->img_x)
|
||||
$new_x = (int)($new_x/$this->img_y*$this->img_x);
|
||||
// Now do the library specific resizing.
|
||||
return $this->_resize($filePath,$new_x, $new_y);
|
||||
} // End resize
|
||||
|
||||
/**
|
||||
* resize the image and return the thumbnail image details array("width"=>, "height"=>, "name")
|
||||
*
|
||||
* @param string $fileName
|
||||
* @param int $new_x the thumbnail width
|
||||
* @param int $new_y the thumbnail height
|
||||
* @return unknown
|
||||
*/
|
||||
function _resize($fileName, $new_x, $new_y) {
|
||||
$functionName = 'ImageCreateFrom' . $this->fileType;
|
||||
|
||||
|
||||
if(function_exists($functionName))
|
||||
{
|
||||
$this->imgHandler = $functionName($this->filePath);
|
||||
}else
|
||||
{
|
||||
array_push($this->errors, $functionName . " function is unavailable");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(function_exists('ImageCreateTrueColor')){
|
||||
$new_img =ImageCreateTrueColor($new_x,$new_y);
|
||||
} else {
|
||||
$new_img =ImageCreate($new_x,$new_y);
|
||||
}
|
||||
if(function_exists('ImageCopyResampled')){
|
||||
ImageCopyResampled($new_img, $this->imgHandler, 0, 0, 0, 0, $new_x, $new_y, $this->img_x, $this->img_y);
|
||||
} else {
|
||||
ImageCopyResized($new_img, $this->imgHandler, 0, 0, 0, 0, $new_x, $new_y, $this->img_x, $this->img_y);
|
||||
}
|
||||
if($this->_imageSave($new_img, $fileName, 80))
|
||||
{
|
||||
return array("width"=>$new_x, "height"=>$new_y, "name"=>basename($fileName));
|
||||
}else
|
||||
{
|
||||
|
||||
array_push($this->errors, "Unable to resize the image");
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* save the thumbnail file and destroy the opened image
|
||||
*
|
||||
* @param resource $newImageHandler
|
||||
* @param string $fileName
|
||||
* @param int $quality
|
||||
* @return boolean
|
||||
*/
|
||||
function _imageSave($newImageHandler, $fileName, $quality = 90)
|
||||
{
|
||||
$functionName = 'image' . $this->fileType;
|
||||
if($functionName($newImageHandler, $fileName, $quality))
|
||||
{
|
||||
imagedestroy($newImageHandler);
|
||||
return true;
|
||||
}else
|
||||
{
|
||||
imagedestroy($newImageHandler);
|
||||
array_push($this->errors, "Unable to save the thumbnail file.");
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function _get_image_details($image)
|
||||
{
|
||||
|
||||
//echo $image;
|
||||
$data = @GetImageSize($image);
|
||||
#1 = GIF, 2 = JPG, 3 = PNG, 4 = SWF, 5 = PSD, 6 = BMP, 7 = TIFF(intel byte order), 8 = TIFF(motorola byte order,
|
||||
# 9 = JPC, 10 = JP2, 11 = JPX, 12 = JB2, 13 = SWC
|
||||
if (is_array($data)){
|
||||
switch($data[2]){
|
||||
case 1:
|
||||
$type = 'gif';
|
||||
break;
|
||||
case 2:
|
||||
$type = 'jpeg';
|
||||
break;
|
||||
case 3:
|
||||
$type = 'png';
|
||||
break;
|
||||
case 4:
|
||||
$type = 'swf';
|
||||
break;
|
||||
case 5:
|
||||
$type = 'psd';
|
||||
case 6:
|
||||
$type = 'bmp';
|
||||
case 7:
|
||||
case 8:
|
||||
$type = 'tiff';
|
||||
default:
|
||||
array_push($this->errors, "We do not recognize this image format");
|
||||
|
||||
}
|
||||
$this->img_x = $data[0];
|
||||
$this->img_y = $data[1];
|
||||
$this->fileType = $type;
|
||||
|
||||
return true;
|
||||
} else {
|
||||
array_push($this->errors, "Cannot fetch image or images details.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* caculate the thumbnail details from the original image file
|
||||
*
|
||||
* @param string $originalImageName
|
||||
* @param int $originaleImageWidth
|
||||
* @param int $originalImageHeight
|
||||
* @param string $thumbnailSuffix
|
||||
* @param int $thumbnailWidth
|
||||
* @param int $thumbnailHeight
|
||||
* @return array array("name"=>"image name", "width"=>"image width", "height"=>"image height")
|
||||
*/
|
||||
function getThumbInfo($originalImageName, $originaleImageWidth, $originalImageHeight, $thumbnailSuffix, $thumbnailWidth, $thumbnailHeight)
|
||||
{
|
||||
$outputs = array("name"=>"", "width"=>0, "height"=>0);
|
||||
$thumbnailWidth = (int)($thumbnailWidth);
|
||||
$thumbnailHeight = (int)($thumbnailHeight);
|
||||
if(!empty($originalImageName) && !empty($originaleImageWidth) && !empty($originalImageHeight))
|
||||
{
|
||||
$dotIndex = strrpos($originalImageName, '.');
|
||||
//begin to get the thumbnail image name
|
||||
$fileExtension = '';
|
||||
$fileBaseName = '';
|
||||
if(is_int($dotIndex))
|
||||
{
|
||||
$fileExtension = substr($originalImageName, $dotIndex);
|
||||
$fileBaseName = substr($originalImageName, 0, $dotIndex);
|
||||
}
|
||||
$outputs['name'] = $fileBaseName . $thumbnailSuffix . $fileExtension;
|
||||
//start to get the thumbnail width & height
|
||||
if($thumbnailWidth < 1 && $thumbnailHeight < 1)
|
||||
{
|
||||
$thumbnailWidth =$originaleImageWidth;
|
||||
$thumbnailHeight = $originalImageHeight;
|
||||
}elseif($thumbnailWidth < 1)
|
||||
{
|
||||
$thumbnailWidth = floor($thumbnailHeight / $originalImageHeight * $originaleImageWidth);
|
||||
|
||||
}elseif($thumbnailHeight < 1)
|
||||
{
|
||||
$thumbnailHeight = floor($thumbnailWidth / $originaleImageWidth * $originalImageHeight);
|
||||
}else
|
||||
{
|
||||
$scale = min($thumbnailWidth/$originaleImageWidth, $thumbnailHeight/$originalImageHeight);
|
||||
$thumbnailWidth = floor($scale*$originaleImageWidth);
|
||||
$thumbnailHeight = floor($scale*$originalImageHeight);
|
||||
}
|
||||
$outputs['width'] = $thumbnailWidth;
|
||||
$outputs['height'] = $thumbnailHeight;
|
||||
}
|
||||
return $outputs;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get the uploaded file
|
||||
*/
|
||||
function deleteUploadedFile()
|
||||
{
|
||||
@unlink($this->filePath);
|
||||
}
|
||||
/**
|
||||
* destroy the tmp file
|
||||
*
|
||||
*/
|
||||
function finish()
|
||||
{
|
||||
@unlink($this->_value['tmp_name']);
|
||||
}
|
||||
|
||||
function displayError()
|
||||
{
|
||||
if(sizeof($this->errors))
|
||||
{
|
||||
echo "<pre>";
|
||||
print_r($this->errors);
|
||||
echo "</pre>";
|
||||
}
|
||||
}
|
||||
/**
|
||||
* get the path which the file uploaded to
|
||||
*
|
||||
*/
|
||||
function getFilePath()
|
||||
{
|
||||
return $this->filePath;
|
||||
}
|
||||
/**
|
||||
* return the directory path witch the file uploaded to
|
||||
*
|
||||
* @return unknown
|
||||
*/
|
||||
function getDirPath()
|
||||
{
|
||||
return $this->dirPath;
|
||||
}
|
||||
|
||||
function getFileBaseName()
|
||||
{
|
||||
return $this->fileBaseName;
|
||||
}
|
||||
|
||||
function getFileName()
|
||||
{
|
||||
return $this->fileName;
|
||||
}
|
||||
/**
|
||||
* get image width
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
function getImageWidth()
|
||||
{
|
||||
return $this->img_x;
|
||||
}
|
||||
/**
|
||||
* get image height
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
function getImageHeight()
|
||||
{
|
||||
return $this->img_y;
|
||||
}
|
||||
/**
|
||||
* get uploaded file size
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getFileSize()
|
||||
{
|
||||
return $this->fileSize;
|
||||
}
|
||||
/**
|
||||
* delete the uploaded image file & associated thumnails
|
||||
*
|
||||
* @param string $dirPath
|
||||
* @param string $originalImageName
|
||||
* @param string $arrayThumbnailSuffix
|
||||
*/
|
||||
function deleteFileAndThumbs($dirPath, $originalImageName, $arrayThumbnailSuffix)
|
||||
{
|
||||
//ensure the directory path ending with /
|
||||
if ($dirPath != '' && substr($dirPath, -1) != '/') {
|
||||
$dirPath .= '/';
|
||||
}
|
||||
if(!empty($originalImageName) && file_exists($dirPath . $originalImageName) && is_file($dirPath . $originalImageName))
|
||||
{
|
||||
@unlink($dirPath . $originalImageName);
|
||||
foreach($arrayThumbnailSuffix as $v)
|
||||
{
|
||||
$dotIndex = strrpos($originalImageName, '.');
|
||||
//begin to get the thumbnail image name
|
||||
$fileExtension = '';
|
||||
$fileBaseName = '';
|
||||
if(is_int($dotIndex))
|
||||
{
|
||||
$fileExtension = substr($originalImageName, $dotIndex);
|
||||
$fileBaseName = substr($originalImageName, 0, $dotIndex);
|
||||
}
|
||||
@unlink($dirPath . $fileBaseName . $v . $fileExtension);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
135
BO/ajaxfilemanager/inc/config.base.php
Executable file
@ -0,0 +1,135 @@
|
||||
<?php
|
||||
/**
|
||||
* sysem base config setting
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 1/August/2007
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
//error_reporting(E_ALL);
|
||||
//error_reporting(E_ALL ^ E_NOTICE);
|
||||
|
||||
|
||||
|
||||
//Access Control Setting
|
||||
/**
|
||||
* turn off => false
|
||||
* by session => true
|
||||
*/
|
||||
define('CONFIG_ACCESS_CONTROL_MODE', false);
|
||||
define("CONFIG_LOGIN_USERNAME", 'sdfgdfgdfgdgfdgsdfsdfg3454dsfb5e');
|
||||
define('CONFIG_LOGIN_PASSWORD', 'ASDF@#%JHGSDFGasdkjfh3812764ksdjfbhkjxcf');
|
||||
define('CONFIG_LOGIN_PAGE', 'ajax_login.php'); //the url to the login page
|
||||
|
||||
|
||||
//SYSTEM MODE CONFIG
|
||||
/**
|
||||
* turn it on when you have this system for demo purpose
|
||||
* that means changes made to each image is not physically applied to it
|
||||
* and all uploaded files/created folders will be removed automatically
|
||||
*/
|
||||
define('CONFIG_SYS_DEMO_ENABLE', false);
|
||||
define('CONFIG_SYS_VIEW_ONLY', false); //diabled the system, view only
|
||||
define('CONFIG_SYS_THUMBNAIL_VIEW_ENABLE', true);//REMOVE THE thumbnail view if false
|
||||
|
||||
//User Permissions
|
||||
define('CONFIG_OPTIONS_DELETE', true);
|
||||
define('CONFIG_OPTIONS_CUT', true);
|
||||
define('CONFIG_OPTIONS_COPY', true);
|
||||
define('CONFIG_OPTIONS_NEWFOLDER', true);
|
||||
define('CONFIG_OPTIONS_RENAME', true);
|
||||
define('CONFIG_OPTIONS_UPLOAD', true); //
|
||||
define('CONFIG_OPTIONS_EDITABLE', true); //disable image editor and text editor
|
||||
//FILESYSTEM CONFIG
|
||||
/*
|
||||
* CONFIG_SYS_DEFAULT_PATH is the default folder where the files would be uploaded to
|
||||
and it must be a folder under the CONFIG_SYS_ROOT_PATH or the same folder
|
||||
these two paths accept relative path only, don't use absolute path
|
||||
*/
|
||||
//check if folder exist
|
||||
if (!is_dir('../../img/cms'))
|
||||
mkdir('../../img/cms');
|
||||
|
||||
define('CONFIG_SYS_DEFAULT_PATH', '../../img/cms'); //accept relative path only
|
||||
define('CONFIG_SYS_ROOT_PATH', '../../img/cms'); //accept relative path only
|
||||
define('CONFIG_SYS_FOLDER_SHOWN_ON_TOP', true); //show your folders on the top of list if true or order by name
|
||||
define("CONFIG_SYS_DIR_SESSION_PATH", 'session/');
|
||||
define("CONFIG_SYS_PATTERN_FORMAT", 'list'); //three options: reg ,csv, list, this option define the parttern format for the following patterns
|
||||
/**
|
||||
* reg => regulare expression
|
||||
* csv => a list of comma separated file/folder name, (exactly match the specified file/folders)
|
||||
* list => a list of comma spearated vague file/folder name (partially match the specified file/folders)
|
||||
*
|
||||
*/
|
||||
//more details about regular expression please visit http://nz.php.net/manual/en/function.eregi.php
|
||||
define('CONFIG_SYS_INC_DIR_PATTERN', ''); //force listing of folders with such pattern(s). separated by , if multiple
|
||||
define('CONFIG_SYS_EXC_DIR_PATTERN', 'CVS'); //will prevent listing of folders with such pattern(s). separated by , if multiple
|
||||
define('CONFIG_SYS_INC_FILE_PATTERN', ''); //force listing of fiels with such pattern(s). separated by , if multiple
|
||||
define('CONFIG_SYS_EXC_FILE_PATTERN', ''); //will prevent listing of files with such pattern(s). separated by , if multiple
|
||||
define('CONFIG_SYS_DELETE_RECURSIVE', 1); //delete all contents within a specific folder if set to be 1
|
||||
|
||||
//UPLOAD OPTIONS CONFIG
|
||||
define('CONFIG_UPLOAD_MAXSIZE', 5000 * 1024 ); //by bytes
|
||||
//define('CONFIG_UPLOAD_MAXSIZE', 2048); //by bytes
|
||||
//define('CONFIG_UPLOAD_VALID_EXTS', 'txt');//
|
||||
|
||||
define('CONFIG_EDITABLE_VALID_EXTS', 'txt,htm,html,xml,js,css'); //make you include all these extension in CONFIG_UPLOAD_VALID_EXTS if you want all valid
|
||||
|
||||
define('CONFIG_OVERWRITTEN', false); //overwirte when processing paste
|
||||
define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png');// //
|
||||
//define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,bmp,tif,zip,sit,rar,gz,tar,htm,html,mov,mpg,avi,asf,mpeg,wmv,aif,aiff,wav,mp3,swf,ppt,rtf,doc,pdf,xls,txt,xml,xsl,dtd');//
|
||||
define("CONFIG_VIEWABLE_VALID_EXTS", 'gif,jpg,png');
|
||||
//define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,txt'); //
|
||||
define('CONFIG_UPLOAD_INVALID_EXTS', '');
|
||||
|
||||
//Preview
|
||||
define('CONFIG_IMG_THUMBNAIL_MAX_X', 100);
|
||||
define('CONFIG_IMG_THUMBNAIL_MAX_Y', 100);
|
||||
define('CONFIG_THICKBOX_MAX_WIDTH', 700);
|
||||
define('CONFIG_THICKBOX_MAX_HEIGHT', 430);
|
||||
|
||||
|
||||
/**
|
||||
* CONFIG_URL_PREVIEW_ROOT was replaced by CONFIG_WEBSITE_DOCUMENT_ROOT since v0.8
|
||||
* Normally, you don't need to bother with CONFIG_WEBSITE_DOCUMENT_ROOT
|
||||
* Howerver, some Web Hosts do not have standard php.ini setting
|
||||
* which you will find the file manager can not locate your files correctly
|
||||
* if you do have such issue, please change it to fit your system.
|
||||
* so what should you to do get it
|
||||
* 1. create a php script file (let's call it document_root.php)
|
||||
* 2. add the following codes in in
|
||||
* <?php
|
||||
* echo dirname(__FILE__);
|
||||
* ?>
|
||||
* 3. upload document_root.php to you website root folder which will only be reached when you visit http://www.domain-name.com or http://localhost/ at localhost computer
|
||||
* 4. run it via http://www.domain-name.com/document_root.php or http://localhost/docuent_root.php if localhost computer, the url has to be exactly like that
|
||||
* 5. the value shown on the screen is CONFIG_WEBSITE_DOCUMENT_ROOT should be
|
||||
* 6. enjoy it
|
||||
|
||||
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
define('CONFIG_WEBSITE_DOCUMENT_ROOT', '');
|
||||
//theme related setting
|
||||
/*
|
||||
* options avaialbe for CONFIG_EDITOR_NAME are:
|
||||
stand_alone
|
||||
tinymce
|
||||
fckeditor
|
||||
*/
|
||||
//CONFIG_EDITOR_NAME replaced CONFIG_THEME_MODE since @version 0.8
|
||||
define('CONFIG_EDITOR_NAME', (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['editor'])?secureFileName($_GET['editor']):'tinymce'));
|
||||
define('CONFIG_THEME_NAME', (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['theme'])?secureFileName($_GET['theme']):'default')); //change the theme to your custom theme rather than default
|
||||
define('CONFIG_DEFAULT_VIEW', (CONFIG_SYS_THUMBNAIL_VIEW_ENABLE?'detail':'detail')); //thumnail or detail
|
||||
define('CONFIG_DEFAULT_PAGINATION_LIMIT', 10);
|
||||
define('CONFIG_LOAD_DOC_LATTER', false); //all documents will be loaded up after the template has been loaded to the client
|
||||
|
||||
//General Option Declarations
|
||||
//LANGAUGAE DECLARATIONNS
|
||||
define('CONFIG_LANG_INDEX', 'language'); //the index in the session
|
||||
define('CONFIG_LANG_DEFAULT', (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['language']) && file_exists(DIR_LANG . secureFileName($_GET['language']) . '.php')?secureFileName($_GET['language']):'en')); //change it to be your language file base name, such en
|
||||
?>
|
107
BO/ajaxfilemanager/inc/config.php
Executable file
@ -0,0 +1,107 @@
|
||||
<?php
|
||||
/**
|
||||
* sysem config setting
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @version 1.0
|
||||
* @since 22/April/2007
|
||||
*
|
||||
*/
|
||||
|
||||
//FILESYSTEM CONFIG <br>
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "class.auth.php");
|
||||
define('CONFIG_QUERY_STRING_ENABLE', true); //Enable passed query string to setting the system configuration
|
||||
if(!isset($_SESSION))
|
||||
{
|
||||
session_start();
|
||||
}
|
||||
if(!headers_sent())
|
||||
{
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
}
|
||||
|
||||
/**
|
||||
* secure file name which retrieve from query string
|
||||
*
|
||||
* @param string $input
|
||||
* @return string
|
||||
*/
|
||||
function secureFileName($input)
|
||||
{
|
||||
return preg_replace('/[^a-zA-Z0-9\-_]/', '', $input);
|
||||
}
|
||||
//Directories Declarations
|
||||
|
||||
define('DIR_AJAX_ROOT', dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR) ; // the path to ajax file manager
|
||||
define('DIR_AJAX_INC', DIR_AJAX_ROOT . "inc" . DIRECTORY_SEPARATOR);
|
||||
define('DIR_AJAX_CLASSES', DIR_AJAX_ROOT . "classes" . DIRECTORY_SEPARATOR);
|
||||
define("DIR_AJAX_LANGS", DIR_AJAX_ROOT . "langs" . DIRECTORY_SEPARATOR);
|
||||
define('DIR_AJAX_JS', DIR_AJAX_ROOT . 'jscripts' . DIRECTORY_SEPARATOR);
|
||||
define('DIR_AJAX_EDIT_AREA', DIR_AJAX_JS . 'edit_area' . DIRECTORY_SEPARATOR);
|
||||
define('DIR_LANG', DIR_AJAX_ROOT . 'langs' . DIRECTORY_SEPARATOR);
|
||||
|
||||
|
||||
//Class Declarations
|
||||
define('CLASS_FILE', DIR_AJAX_INC .'class.file.php');
|
||||
define("CLASS_UPLOAD", DIR_AJAX_INC . 'class.upload.php');
|
||||
define('CLASS_MANAGER', DIR_AJAX_INC . 'class.manager.php');
|
||||
define('CLASS_IMAGE', DIR_AJAX_INC . "class.image.php");
|
||||
define('CLASS_HISTORY', DIR_AJAX_INC . "class.history.php");
|
||||
define('CLASS_SESSION_ACTION', DIR_AJAX_INC . "class.sessionaction.php");
|
||||
define('CLASS_PAGINATION', DIR_AJAX_INC . 'class.pagination.php');
|
||||
define('CLASS_SEARCH', DIR_AJAX_INC . "class.search.php");
|
||||
//SCRIPT FILES declarations
|
||||
define('SPT_FUNCTION_BASE', DIR_AJAX_INC . 'function.base.php');
|
||||
//include different config base file according to query string "config"
|
||||
$configBaseFileName = 'config.base.php';
|
||||
|
||||
if(CONFIG_QUERY_STRING_ENABLE && !empty($_GET['config']) && file_exists(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'config.' . secureFileName($_GET['config']) . ".php")
|
||||
{
|
||||
$configBaseFileName = 'config.' . secureFileName($_GET['config']) . ".php";
|
||||
}
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . $configBaseFileName);
|
||||
|
||||
|
||||
require_once(DIR_AJAX_LANGS . CONFIG_LANG_DEFAULT . ".php");
|
||||
require_once(DIR_AJAX_INC . "function.base.php");
|
||||
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "class.session.php");
|
||||
$session = new Session();
|
||||
$auth = new Auth();
|
||||
|
||||
if(CONFIG_ACCESS_CONTROL_MODE == 1)
|
||||
{//access control enabled
|
||||
if(!$auth->isLoggedIn() && strtolower(basename($_SERVER['PHP_SELF']) != strtolower(basename(CONFIG_LOGIN_PAGE))))
|
||||
{//
|
||||
header('Location: ' . appendQueryString(CONFIG_LOGIN_PAGE, makeQueryString()));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
addNoCacheHeaders();
|
||||
//URL Declartions
|
||||
define('CONFIG_URL_IMAGE_PREVIEW', 'ajax_image_preview.php');
|
||||
define('CONFIG_URL_CREATE_FOLDER', 'ajax_create_folder.php');
|
||||
define('CONFIG_URL_DELETE', 'ajax_delete_file.php');
|
||||
define('CONFIG_URL_HOME', 'ajaxfilemanager.php');
|
||||
define("CONFIG_URL_UPLOAD", 'ajax_file_upload.php');
|
||||
define('CONFIG_URL_PREVIEW', 'ajax_preview.php');
|
||||
define('CONFIG_URL_SAVE_NAME', 'ajax_save_name.php');
|
||||
define('CONFIG_URL_IMAGE_EDITOR', 'ajax_image_editor.php');
|
||||
define('CONFIG_URL_IMAGE_SAVE', 'ajax_image_save.php');
|
||||
define('CONFIG_URL_IMAGE_RESET', 'ajax_editor_reset.php');
|
||||
define('CONFIG_URL_IMAGE_UNDO', 'ajax_image_undo.php');
|
||||
define('CONFIG_URL_CUT', 'ajax_file_cut.php');
|
||||
define('CONFIG_URL_COPY', 'ajax_file_copy.php');
|
||||
define('CONFIG_URL_LOAD_FOLDERS', '_ajax_load_folders.php');
|
||||
|
||||
define('CONFIG_URL_DOWNLOAD', 'ajax_download.php');
|
||||
define('CONFIG_URL_TEXT_EDITOR', 'ajax_text_editor.php');
|
||||
define('CONFIG_URL_GET_FOLDER_LIST', 'ajax_get_folder_listing.php');
|
||||
define('CONFIG_URL_SAVE_TEXT', 'ajax_save_text.php');
|
||||
define('CONFIG_URL_LIST_LISTING', 'ajax_get_file_listing.php');
|
||||
define('CONFIG_URL_IMG_THUMBNAIL', 'ajax_image_thumbnail.php');
|
||||
define('CONFIG_URL_FILEnIMAGE_MANAGER', 'ajaxfilemanager.php');
|
||||
define('CONFIG_URL_FILE_PASTE', 'ajax_file_paste.php');
|
||||
|
||||
|
||||
?>
|
130
BO/ajaxfilemanager/inc/config.tinymce.php
Executable file
@ -0,0 +1,130 @@
|
||||
<?php
|
||||
/**
|
||||
* sysem base config setting
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 1/August/2007
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
//error_reporting(E_ALL ^ E_NOTICE);
|
||||
|
||||
|
||||
|
||||
//Access Control Setting
|
||||
/**
|
||||
* turn off => false
|
||||
* by session => true
|
||||
*/
|
||||
define('CONFIG_ACCESS_CONTROL_MODE', false);
|
||||
define("CONFIG_LOGIN_USERNAME", 'ajax');
|
||||
define('CONFIG_LOGIN_PASSWORD', '123456');
|
||||
define('CONFIG_LOGIN_PAGE', 'ajax_login.php'); //the url to the login page
|
||||
|
||||
//SYSTEM MODE CONFIG
|
||||
/**
|
||||
* turn it on when you have this system for demo purpose
|
||||
* that means changes made to each image is not physically applied to it
|
||||
* and all uploaded files/created folders will be removed automatically
|
||||
*/
|
||||
define('CONFIG_SYS_DEMO_ENABLE', false);
|
||||
define('CONFIG_SYS_VIEW_ONLY', false); //diabled the system, view only
|
||||
define('CONFIG_SYS_THUMBNAIL_VIEW_ENABLE', true);//REMOVE THE thumbnail view if false
|
||||
|
||||
//User Permissions
|
||||
define('CONFIG_OPTIONS_DELETE', true);
|
||||
define('CONFIG_OPTIONS_CUT', true);
|
||||
define('CONFIG_OPTIONS_COPY', true);
|
||||
define('CONFIG_OPTIONS_NEWFOLDER', true);
|
||||
define('CONFIG_OPTIONS_RENAME', true);
|
||||
define('CONFIG_OPTIONS_UPLOAD', true); //
|
||||
define('CONFIG_OPTIONS_EDITABLE', true); //disable image editor and text editor
|
||||
//FILESYSTEM CONFIG
|
||||
/*
|
||||
* CONFIG_SYS_DEFAULT_PATH is the default folder where the files would be uploaded to
|
||||
and it must be a folder under the CONFIG_SYS_ROOT_PATH or the same folder
|
||||
these two paths accept relative path only, don't use absolute path
|
||||
*/
|
||||
|
||||
define('CONFIG_SYS_DEFAULT_PATH', '../uploaded/'); //accept relative path only
|
||||
define('CONFIG_SYS_ROOT_PATH', '../uploaded/'); //accept relative path only
|
||||
define('CONFIG_SYS_FOLDER_SHOWN_ON_TOP', true); //show your folders on the top of list if true or order by name
|
||||
define("CONFIG_SYS_DIR_SESSION_PATH", 'session/');
|
||||
define("CONFIG_SYS_PATTERN_FORMAT", 'list'); //three options: reg ,csv, list, this option define the parttern format for the following patterns
|
||||
/**
|
||||
* reg => regulare expression
|
||||
* csv => a list of comma separated file/folder name, (exactly match the specified file/folders)
|
||||
* list => a list of comma spearated vague file/folder name (partially match the specified file/folders)
|
||||
*
|
||||
*/
|
||||
//more details about regular expression please visit http://nz.php.net/manual/en/function.eregi.php
|
||||
define('CONFIG_SYS_INC_DIR_PATTERN', ''); //force listing of folders with such pattern(s). separated by , if multiple
|
||||
define('CONFIG_SYS_EXC_DIR_PATTERN', ''); //will prevent listing of folders with such pattern(s). separated by , if multiple
|
||||
define('CONFIG_SYS_INC_FILE_PATTERN', ''); //force listing of fiels with such pattern(s). separated by , if multiple
|
||||
define('CONFIG_SYS_EXC_FILE_PATTERN', ''); //will prevent listing of files with such pattern(s). separated by , if multiple
|
||||
define('CONFIG_SYS_DELETE_RECURSIVE', 1); //delete all contents within a specific folder if set to be 1
|
||||
|
||||
//UPLOAD OPTIONS CONFIG
|
||||
define('CONFIG_UPLOAD_MAXSIZE', 5000 * 1024 ); //by bytes
|
||||
//define('CONFIG_UPLOAD_MAXSIZE', 2048); //by bytes
|
||||
//define('CONFIG_UPLOAD_VALID_EXTS', 'txt');//
|
||||
|
||||
define('CONFIG_EDITABLE_VALID_EXTS', 'txt,htm,html,xml,js,css'); //make you include all these extension in CONFIG_UPLOAD_VALID_EXTS if you want all valid
|
||||
|
||||
define('CONFIG_OVERWRITTEN', false); //overwirte when processing paste
|
||||
define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,txt'); //
|
||||
//define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,bmp,tif,zip,sit,rar,gz,tar,htm,html,mov,mpg,avi,asf,mpeg,wmv,aif,aiff,wav,mp3,swf,ppt,rtf,doc,pdf,xls,txt,xml,xsl,dtd');//
|
||||
define("CONFIG_VIEWABLE_VALID_EXTS", 'gif,bmp,txt,jpg,png,tif,html,htm,js,css,xml,xsl,dtd,mp3,wav,wmv,wma,rm,rmvb,mov,swf');
|
||||
//define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,txt'); //
|
||||
define('CONFIG_UPLOAD_INVALID_EXTS', '');
|
||||
|
||||
//Preview
|
||||
define('CONFIG_IMG_THUMBNAIL_MAX_X', 100);
|
||||
define('CONFIG_IMG_THUMBNAIL_MAX_Y', 100);
|
||||
define('CONFIG_THICKBOX_MAX_WIDTH', 700);
|
||||
define('CONFIG_THICKBOX_MAX_HEIGHT', 430);
|
||||
|
||||
|
||||
/**
|
||||
* CONFIG_URL_PREVIEW_ROOT was replaced by CONFIG_WEBSITE_DOCUMENT_ROOT since v0.8
|
||||
* Normally, you don't need to bother with CONFIG_WEBSITE_DOCUMENT_ROOT
|
||||
* Howerver, some Web Hosts do not have standard php.ini setting
|
||||
* which you will find the file manager can not locate your files correctly
|
||||
* if you do have such issue, please change it to fit your system.
|
||||
* so what should you to do get it
|
||||
* 1. create a php script file (let's call it document_root.php)
|
||||
* 2. add the following codes in in
|
||||
* <?php
|
||||
* echo dirname(__FILE__);
|
||||
* ?>
|
||||
* 3. upload document_root.php to you website root folder which will only be reached when you visit http://www.domain-name.com or http://localhost/ at localhost computer
|
||||
* 4. run it via http://www.domain-name.com/document_root.php or http://localhost/docuent_root.php if localhost computer, the url has to be exactly like that
|
||||
* 5. the value shown on the screen is CONFIG_WEBSITE_DOCUMENT_ROOT should be
|
||||
* 6. enjoy it
|
||||
|
||||
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
define('CONFIG_WEBSITE_DOCUMENT_ROOT', '');
|
||||
//theme related setting
|
||||
/*
|
||||
* options avaialbe for CONFIG_EDITOR_NAME are:
|
||||
stand_alone
|
||||
tinymce
|
||||
fckeditor
|
||||
*/
|
||||
//CONFIG_EDITOR_NAME replaced CONFIG_THEME_MODE since @version 0.8
|
||||
define('CONFIG_EDITOR_NAME', (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['editor'])?secureFileName($_GET['editor']):'stand_alone'));
|
||||
define('CONFIG_THEME_NAME', (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['theme'])?secureFileName($_GET['theme']):'default')); //change the theme to your custom theme rather than default
|
||||
define('CONFIG_DEFAULT_VIEW', (CONFIG_SYS_THUMBNAIL_VIEW_ENABLE?'detail':'detail')); //thumnail or detail
|
||||
define('CONFIG_DEFAULT_PAGINATION_LIMIT', 10);
|
||||
define('CONFIG_LOAD_DOC_LATTER', false); //all documents will be loaded up after the template has been loaded to the client
|
||||
|
||||
//General Option Declarations
|
||||
//LANGAUGAE DECLARATIONNS
|
||||
define('CONFIG_LANG_INDEX', 'language'); //the index in the session
|
||||
define('CONFIG_LANG_DEFAULT', (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['language']) && file_exists(DIR_LANG . secureFileName($_GET['language'] . '.php'))?secureFileName($_GET['language']):'en')); //change it to be your language file base name, such en
|
||||
?>
|
8
BO/ajaxfilemanager/inc/data.php
Executable file
@ -0,0 +1,8 @@
|
||||
<pre>Array
|
||||
(
|
||||
[currentFolderPath] => ../uploaded/
|
||||
[new_folder] => Test
|
||||
)
|
||||
</pre>
|
||||
|
||||
22/Sep/2008 13:17:12
|
1225
BO/ajaxfilemanager/inc/function.base.php
Executable file
35
BO/ajaxfilemanager/inc/index.php
Executable file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
35
BO/ajaxfilemanager/index.php
Executable file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
1845
BO/ajaxfilemanager/jscripts/ajaxfilemanager.js
Executable file
568
BO/ajaxfilemanager/jscripts/ajaxfilemanager_c.js
Executable file
225
BO/ajaxfilemanager/jscripts/ajaxfileupload.js
Executable file
@ -0,0 +1,225 @@
|
||||
jQuery.extend({
|
||||
|
||||
createUploadIframe: function(id, uri)
|
||||
{
|
||||
//create frame
|
||||
var frameId = 'jUploadFrame' + id;
|
||||
|
||||
if(window.ActiveXObject) {
|
||||
var io = document.createElement('<iframe id="' + frameId + '" name="' + frameId + '" />');
|
||||
if(typeof uri== 'boolean'){
|
||||
io.src = 'javascript:false';
|
||||
}
|
||||
else if(typeof uri== 'string'){
|
||||
io.src = uri;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var io = document.createElement('iframe');
|
||||
io.id = frameId;
|
||||
io.name = frameId;
|
||||
}
|
||||
io.style.position = 'absolute';
|
||||
io.style.top = '-1000px';
|
||||
io.style.left = '-1000px';
|
||||
|
||||
document.body.appendChild(io);
|
||||
|
||||
return io;
|
||||
},
|
||||
createUploadForm: function(id, fileElementId)
|
||||
{
|
||||
//create form
|
||||
var formId = 'jUploadForm' + id;
|
||||
var fileId = 'jUploadFile' + id;
|
||||
var form = jQuery('<form action="" method="POST" name="' + formId + '" id="' + formId + '" enctype="multipart/form-data"></form>');
|
||||
var oldElement = jQuery('#' + fileElementId);
|
||||
var newElement = jQuery(oldElement).clone();
|
||||
jQuery(oldElement).attr('id', fileId);
|
||||
jQuery(oldElement).before(newElement);
|
||||
jQuery(oldElement).appendTo(form);
|
||||
//set attributes
|
||||
jQuery(form).css('position', 'absolute');
|
||||
jQuery(form).css('top', '-1200px');
|
||||
jQuery(form).css('left', '-1200px');
|
||||
jQuery(form).appendTo('body');
|
||||
return form;
|
||||
},
|
||||
|
||||
ajaxFileUpload: function(s) {
|
||||
// TODO introduce global settings, allowing the client to modify them for all requests, not only timeout
|
||||
s = jQuery.extend({}, jQuery.ajaxSettings, s);
|
||||
var id = s.fileElementId;
|
||||
var form = jQuery.createUploadForm(id, s.fileElementId);
|
||||
var io = jQuery.createUploadIframe(id, s.secureuri);
|
||||
var frameId = 'jUploadFrame' + id;
|
||||
var formId = 'jUploadForm' + id;
|
||||
|
||||
if( s.global && ! jQuery.active++ )
|
||||
{
|
||||
// Watch for a new set of requests
|
||||
jQuery.event.trigger( "ajaxStart" );
|
||||
}
|
||||
var requestDone = false;
|
||||
// Create the request object
|
||||
var xml = {};
|
||||
if( s.global )
|
||||
{
|
||||
jQuery.event.trigger("ajaxSend", [xml, s]);
|
||||
}
|
||||
|
||||
var uploadCallback = function(isTimeout)
|
||||
{
|
||||
// Wait for a response to come back
|
||||
var io = document.getElementById(frameId);
|
||||
try
|
||||
{
|
||||
if(io.contentWindow)
|
||||
{
|
||||
xml.responseText = io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:null;
|
||||
xml.responseXML = io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document;
|
||||
|
||||
}else if(io.contentDocument)
|
||||
{
|
||||
xml.responseText = io.contentDocument.document.body?io.contentDocument.document.body.innerHTML:null;
|
||||
xml.responseXML = io.contentDocument.document.XMLDocument?io.contentDocument.document.XMLDocument:io.contentDocument.document;
|
||||
}
|
||||
}catch(e)
|
||||
{
|
||||
jQuery.handleError(s, xml, null, e);
|
||||
}
|
||||
if( xml || isTimeout == "timeout")
|
||||
{
|
||||
requestDone = true;
|
||||
var status;
|
||||
try {
|
||||
status = isTimeout != "timeout" ? "success" : "error";
|
||||
// Make sure that the request was successful or notmodified
|
||||
if( status != "error" )
|
||||
{
|
||||
// process the data (runs the xml through httpData regardless of callback)
|
||||
var data = jQuery.uploadHttpData( xml, s.dataType );
|
||||
if( s.success )
|
||||
{
|
||||
// ifa local callback was specified, fire it and pass it the data
|
||||
s.success( data, status );
|
||||
};
|
||||
if( s.global )
|
||||
{
|
||||
// Fire the global callback
|
||||
jQuery.event.trigger( "ajaxSuccess", [xml, s] );
|
||||
};
|
||||
} else
|
||||
{
|
||||
jQuery.handleError(s, xml, status);
|
||||
}
|
||||
|
||||
} catch(e)
|
||||
{
|
||||
status = "error";
|
||||
jQuery.handleError(s, xml, status, e);
|
||||
};
|
||||
if( s.global )
|
||||
{
|
||||
// The request was completed
|
||||
jQuery.event.trigger( "ajaxComplete", [xml, s] );
|
||||
};
|
||||
|
||||
|
||||
// Handle the global AJAX counter
|
||||
if(s.global && ! --jQuery.active)
|
||||
{
|
||||
jQuery.event.trigger("ajaxStop");
|
||||
};
|
||||
if(s.complete)
|
||||
{
|
||||
s.complete(xml, status);
|
||||
} ;
|
||||
|
||||
jQuery(io).unbind();
|
||||
|
||||
setTimeout(function()
|
||||
{ try
|
||||
{
|
||||
jQuery(io).remove();
|
||||
jQuery(form).remove();
|
||||
|
||||
} catch(e)
|
||||
{
|
||||
jQuery.handleError(s, xml, null, e);
|
||||
}
|
||||
|
||||
}, 100);
|
||||
|
||||
xml = null;
|
||||
|
||||
};
|
||||
}
|
||||
// Timeout checker
|
||||
if( s.timeout > 0 )
|
||||
{
|
||||
setTimeout(function(){
|
||||
|
||||
if( !requestDone )
|
||||
{
|
||||
// Check to see ifthe request is still happening
|
||||
uploadCallback( "timeout" );
|
||||
}
|
||||
|
||||
}, s.timeout);
|
||||
}
|
||||
try
|
||||
{
|
||||
var form = jQuery('#' + formId);
|
||||
jQuery(form).attr('action', s.url);
|
||||
jQuery(form).attr('method', 'POST');
|
||||
jQuery(form).attr('target', frameId);
|
||||
if(form.encoding)
|
||||
{
|
||||
form.encoding = 'multipart/form-data';
|
||||
}
|
||||
else
|
||||
{
|
||||
form.enctype = 'multipart/form-data';
|
||||
}
|
||||
jQuery(form).submit();
|
||||
|
||||
} catch(e)
|
||||
{
|
||||
jQuery.handleError(s, xml, null, e);
|
||||
}
|
||||
if(window.attachEvent){
|
||||
document.getElementById(frameId).attachEvent('onload', uploadCallback);
|
||||
}
|
||||
else{
|
||||
document.getElementById(frameId).addEventListener('load', uploadCallback, false);
|
||||
}
|
||||
return {abort: function () {}};
|
||||
|
||||
},
|
||||
|
||||
uploadHttpData: function( r, type ) {
|
||||
var data = !type;
|
||||
data = type == "xml" || data ? r.responseXML : r.responseText;
|
||||
// ifthe type is "script", eval it in global context
|
||||
if( type == "script" )
|
||||
{
|
||||
jQuery.globalEval( data );
|
||||
}
|
||||
|
||||
// Get the JavaScript object, ifJSON is used.
|
||||
if( type == "json" )
|
||||
{
|
||||
eval( "data = " + data );
|
||||
}
|
||||
|
||||
// evaluate scripts within html
|
||||
if( type == "html" )
|
||||
{
|
||||
jQuery("<div>").html(data).evalScripts();
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
});
|
||||
|
873
BO/ajaxfilemanager/jscripts/ajaximageeditor.js
Executable file
@ -0,0 +1,873 @@
|
||||
/*
|
||||
* author: Logan Cai
|
||||
* Email: cailongqun [at] yahoo [dot] com [dot] cn
|
||||
* Website: www.phpletter.com
|
||||
* Created At: 21/April/2007
|
||||
*/
|
||||
|
||||
/**
|
||||
* get current selected mode value
|
||||
*/
|
||||
function getModeValue()
|
||||
{
|
||||
//check if an mode has been selected or selected first one be default
|
||||
var CheckedElem = null;
|
||||
for(var i = 0; i < document.formAction.mode.length; i++)
|
||||
{
|
||||
if(document.formAction.mode[i].checked || i == 0)
|
||||
{
|
||||
CheckedElem = document.formAction.mode[i];
|
||||
}
|
||||
}
|
||||
CheckedElem.checked = true;
|
||||
return CheckedElem.value;
|
||||
};
|
||||
/**
|
||||
* get fired when mode changed
|
||||
* fire according function
|
||||
*/
|
||||
function changeMode(restore, force)
|
||||
{
|
||||
|
||||
var mode = getModeValue();
|
||||
var imageMode = $('#image_mode');
|
||||
if(mode != $(imageMode).val() || (typeof(restore) == "boolean"))
|
||||
{
|
||||
/**
|
||||
* confirm it when there has been some changes before go further
|
||||
*/
|
||||
if(isImageHistoryExist() || typeof(force) == 'boolean')
|
||||
{
|
||||
if(typeof(restore) == "boolean" || typeof(force) == 'boolean' )
|
||||
{
|
||||
if(!restoreToOriginal(restore))
|
||||
{
|
||||
return false;
|
||||
|
||||
}
|
||||
clearImageHistory();
|
||||
}
|
||||
else if(!window.confirm(warningLostChanges))
|
||||
{
|
||||
cancelChangeMode();
|
||||
return false;
|
||||
}else
|
||||
{
|
||||
restoreToOriginal(false);
|
||||
clearImageHistory();
|
||||
}
|
||||
}else if((typeof(restore) == "boolean" && restore))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
initPositionHandler();
|
||||
switch(mode)
|
||||
{
|
||||
case "resize":
|
||||
switch($('#image_mode').val())
|
||||
{
|
||||
case "crop":
|
||||
disableCrop();
|
||||
break;
|
||||
case "rotate":
|
||||
disableRotate();
|
||||
break;
|
||||
case "flip":
|
||||
disableFlip();
|
||||
break;
|
||||
default:
|
||||
disableRotate();
|
||||
}
|
||||
enableResize(document.formAction.constraint.checked);
|
||||
break;
|
||||
case "crop":
|
||||
switch($('#image_mode').val())
|
||||
{
|
||||
case "resize":
|
||||
disableResize();
|
||||
break;
|
||||
case "rotate":
|
||||
disableRotate();
|
||||
break;
|
||||
case "flip":
|
||||
disableFlip();
|
||||
break;
|
||||
default:
|
||||
disableRotate();
|
||||
}
|
||||
enableCrop();
|
||||
|
||||
break;
|
||||
case "rotate":
|
||||
switch($('#image_mode').val())
|
||||
{
|
||||
case "resize":
|
||||
disableResize();
|
||||
break;
|
||||
case "crop":
|
||||
disableCrop();
|
||||
break;
|
||||
case "flip":
|
||||
disableFlip();
|
||||
break;
|
||||
default:
|
||||
//do nothing
|
||||
}
|
||||
enableRotate();
|
||||
break;
|
||||
case "flip":
|
||||
switch($('#image_mode').val())
|
||||
{
|
||||
case "resize":
|
||||
disableResize();
|
||||
break;
|
||||
case "crop":
|
||||
disableCrop();
|
||||
break;
|
||||
case "rotate":
|
||||
disableRotate();
|
||||
break;
|
||||
default:
|
||||
//do nothing
|
||||
}
|
||||
enableFlip();
|
||||
break;
|
||||
default:
|
||||
alert('Unexpected Operation!');
|
||||
return false;
|
||||
}
|
||||
$('#image_mode').val(mode);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
function resetEditor()
|
||||
{
|
||||
if(isImageHistoryExist())
|
||||
{
|
||||
changeMode(true);
|
||||
}else
|
||||
{
|
||||
alert(warningResetEmpty);
|
||||
}
|
||||
return false;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* enable to crop function
|
||||
*/
|
||||
function enableCrop()
|
||||
{
|
||||
var widthField = $('#width');
|
||||
var heightField = $('#height');
|
||||
var topField = $('#y');
|
||||
var leftField = $('#x');
|
||||
var imageToResize = getImageElement();
|
||||
var imageWidth = $(imageToResize).attr('width');
|
||||
var imageHeight = $(imageToResize).attr('height');
|
||||
|
||||
var overlay = $('#resizeMe');
|
||||
var imageContainer = $('#imageContainer');
|
||||
var imageContainerTop = parseInt($(imageContainer).css('top').replace('px', ''));
|
||||
var imageContainerLeft = parseInt($(imageContainer).css('left').replace('px', ''));
|
||||
//Init Container
|
||||
$(imageContainer).css('width', imageWidth + 'px');
|
||||
$(imageContainer).css('height', imageHeight + 'px');
|
||||
$(imageToResize).css('opacity', '.5');
|
||||
|
||||
//Init Overlay
|
||||
overlay.css('background-image', 'url('+ $(imageToResize).attr('src')+')');
|
||||
overlay.css('width', imageWidth + 'px');
|
||||
overlay.css('height', imageHeight + 'px');
|
||||
|
||||
//Init Form
|
||||
widthField.val(imageWidth);
|
||||
heightField.val(imageHeight);
|
||||
topField.val(0);
|
||||
leftField.val(0);
|
||||
$(overlay).Resizable(
|
||||
{
|
||||
minWidth: 10,
|
||||
minHeight: 10,
|
||||
maxWidth: imageWidth,
|
||||
maxHeight: imageHeight,
|
||||
minTop: imageContainerTop,
|
||||
minLeft: imageContainerLeft,
|
||||
maxRight: (parseInt(imageWidth) + imageContainerLeft),
|
||||
maxBottom: (parseInt(imageHeight) + imageContainerTop),
|
||||
dragHandle: true,
|
||||
onDrag: function(x, y)
|
||||
{
|
||||
this.style.backgroundPosition = '-' + (x - imageContainerLeft) + 'px -' + (y - imageContainerTop) + 'px';
|
||||
$(topField).val(Math.round(y - imageContainerTop));
|
||||
$(leftField).val(Math.round(x - imageContainerLeft));
|
||||
addImageHistory();
|
||||
},
|
||||
handlers: {
|
||||
se: '#resizeSE',
|
||||
e: '#resizeE',
|
||||
ne: '#resizeNE',
|
||||
n: '#resizeN',
|
||||
nw: '#resizeNW',
|
||||
w: '#resizeW',
|
||||
sw: '#resizeSW',
|
||||
s: '#resizeS'
|
||||
},
|
||||
onResize : function(size, position) {
|
||||
this.style.backgroundPosition = '-' + (position.left - imageContainerLeft) + 'px -' + (position.top - imageContainerTop) + 'px';
|
||||
$(widthField).val(Math.round(size.width));
|
||||
$(heightField).val(Math.round(size.height));
|
||||
$(topField).val(Math.round(position.top - imageContainerTop));
|
||||
$(leftField).val(Math.round(position.left - imageContainerLeft));
|
||||
addImageHistory();
|
||||
$('#ratio').val($(overlay).ResizableRatio() );
|
||||
}
|
||||
}
|
||||
);
|
||||
enableConstraint();
|
||||
toggleConstraint();
|
||||
disableRotate();
|
||||
|
||||
};
|
||||
/*
|
||||
* disable crop function
|
||||
*/
|
||||
function disableCrop()
|
||||
{
|
||||
$('#resizeMe').ResizableDestroy();
|
||||
hideHandlers();
|
||||
};
|
||||
/**
|
||||
* disable resize function
|
||||
*/
|
||||
function disableResize()
|
||||
{
|
||||
$('#resizeMe').ResizableDestroy();
|
||||
|
||||
hideHandlers();
|
||||
};
|
||||
/**
|
||||
* hide all handlers
|
||||
*/
|
||||
function hideHandlers()
|
||||
{
|
||||
$('#resizeSE').hide();
|
||||
$('#resizeE').hide();
|
||||
$('#resizeNE').hide();
|
||||
$('#resizeN').hide();
|
||||
$('#resizeNW').hide();
|
||||
$('#resizeW').hide();
|
||||
$('#resizeSW').hide();
|
||||
$('#resizeS').hide();
|
||||
};
|
||||
/**
|
||||
*
|
||||
* enable to resize the image
|
||||
*/
|
||||
function enableResize(constraint)
|
||||
{
|
||||
hideHandlers();
|
||||
var imageToResize = getImageElement();
|
||||
var imageContainer = $('#imageContainer');
|
||||
var imageContainerTop = parseInt($(imageContainer).css('top').replace('px', ''));
|
||||
var imageContainerLeft = parseInt($(imageContainer).css('left').replace('px', ''));
|
||||
var resizeMe = $('#resizeMe');
|
||||
var width = $('#width');
|
||||
var height = $('#height');
|
||||
//ensure the container has same size with the image
|
||||
$(imageContainer).css('width', $(imageToResize).attr('width') + 'px');
|
||||
$(imageContainer).css('height', $(imageToResize).attr('height') + 'px');
|
||||
$(resizeMe).css('width', $(imageToResize).attr('width') + 'px');
|
||||
$(resizeMe).css('height', $(imageToResize).attr('height') + 'px');
|
||||
$('#width').val($(imageToResize).attr('width'));
|
||||
$('#height').val($(imageToResize).attr('height'));
|
||||
$('#x').val(0);
|
||||
$('#y').val(0);
|
||||
$(resizeMe).Resizable(
|
||||
{
|
||||
minWidth: 10,
|
||||
minHeight: 10,
|
||||
maxWidth: 2000,
|
||||
maxHeight: 2000,
|
||||
minTop: imageContainerTop,
|
||||
minLeft: imageContainerLeft,
|
||||
maxRight: 2000,
|
||||
maxBottom: 2000,
|
||||
handlers: {
|
||||
s: '#resizeS',
|
||||
se: '#resizeSE',
|
||||
e: '#resizeE'
|
||||
},
|
||||
onResize: function(size)
|
||||
{
|
||||
$(imageToResize).attr('height', Math.round(size.height).toString());
|
||||
$(imageToResize).attr('width', Math.round(size.width).toString());
|
||||
$(width).val(Math.round(size.width));
|
||||
$(height).val(Math.round(size.height));
|
||||
$(imageContainer).css('width', $(imageToResize).attr('width') + 'px');
|
||||
$(imageContainer).css('height', $(imageToResize).attr('height') + 'px');
|
||||
$('#ratio').val($(resizeMe).ResizableRatio() );
|
||||
addImageHistory();
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
$(resizeMe).ResizeConstraint(constraint);
|
||||
if(typeof(constraint) == 'boolean' && constraint)
|
||||
{
|
||||
$('#resizeS').hide();
|
||||
$('#resizeE').hide();
|
||||
}else
|
||||
{
|
||||
$('#resizeS').show();
|
||||
$('#resizeE').show();
|
||||
}
|
||||
$('#resizeSE').show();
|
||||
$('#ratio').val($(resizeMe).ResizableRatio() );
|
||||
|
||||
|
||||
};
|
||||
/**
|
||||
* initiate the position of handler
|
||||
*/
|
||||
function initPositionHandler()
|
||||
{
|
||||
var widthField = $('#width');
|
||||
var heightField = $('#height');
|
||||
var topField = $('#x');
|
||||
var leftField = $('#y');
|
||||
|
||||
var imageToResize = getImageElement();
|
||||
var imageWidth = $(imageToResize).attr('width');
|
||||
var imageHeight = $(imageToResize).attr('height');
|
||||
|
||||
var overlay = $('#resizeMe');
|
||||
var imageContainer = $('#imageContainer');
|
||||
var imageContainerTop = parseInt($(imageContainer).css('top').replace('px', ''));
|
||||
var imageContainerLeft = parseInt($(imageContainer).css('left').replace('px', ''));
|
||||
//Init Container
|
||||
$(imageContainer).css('width', imageWidth + 'px');
|
||||
$(imageContainer).css('height', imageHeight + 'px');
|
||||
|
||||
//Init Overlay
|
||||
$(imageToResize).css('opacity', '100');
|
||||
$(overlay).css('width', imageWidth + 'px');
|
||||
$(overlay).css('height', imageHeight + 'px');
|
||||
$(overlay).css('background-image', '');
|
||||
$(overlay).css('backgroundPosition', '0 0');
|
||||
$(overlay).css('left', imageContainerLeft);
|
||||
$(overlay).css('top', imageContainerTop);
|
||||
|
||||
//Init Form
|
||||
$(widthField).val(imageWidth);
|
||||
$(heightField).val(imageHeight);
|
||||
$(topField).val(0);
|
||||
$(leftField).val(0);
|
||||
$('#angle').val(0);
|
||||
$('#flip_angle').val('');
|
||||
};
|
||||
/**
|
||||
* enable rotate function
|
||||
*/
|
||||
function enableRotate()
|
||||
{
|
||||
hideHandlers();
|
||||
toggleDisabledButton('actionRotateLeft', false);
|
||||
toggleDisabledButton('actionRotateRight', false);
|
||||
|
||||
};
|
||||
/**
|
||||
* disable rotation function
|
||||
*/
|
||||
function disableRotate()
|
||||
{
|
||||
toggleDisabledButton('actionRotateLeft', true);
|
||||
toggleDisabledButton('actionRotateRight', true);
|
||||
};
|
||||
|
||||
function enableConstraint()
|
||||
{
|
||||
$('#constraint').removeAttr('disabled');
|
||||
};
|
||||
|
||||
function disableConstraint()
|
||||
{
|
||||
$('#constraint').attr('disabled', true);
|
||||
};
|
||||
function ShowHandlers()
|
||||
{
|
||||
$('#resizeSE').show();
|
||||
$('#resizeE').show();
|
||||
$('#resizeNE').show();
|
||||
$('#resizeN').show();
|
||||
$('#resizeNW').show();
|
||||
$('#resizeW').show();
|
||||
$('#resizeSW').show();
|
||||
$('#resizeS').show();
|
||||
} ;
|
||||
|
||||
/**
|
||||
* turn constraint on or off
|
||||
*/
|
||||
function toggleConstraint()
|
||||
{
|
||||
hideHandlers();
|
||||
if(document.formAction.constraint.checked)
|
||||
{
|
||||
$('#resizeMe').ResizeConstraint(true);
|
||||
switch(getModeValue())
|
||||
{
|
||||
case "resize":
|
||||
$('#resizeSE').show();
|
||||
break;
|
||||
case "crop":
|
||||
$('#resizeSE').show();
|
||||
$('#resizeNE').show();
|
||||
$('#resizeNW').show();
|
||||
$('#resizeSW').show();
|
||||
|
||||
break;
|
||||
case "rotate":
|
||||
break;
|
||||
}
|
||||
|
||||
}else
|
||||
{
|
||||
$('#resizeMe').ResizeConstraint(false);
|
||||
switch(getModeValue())
|
||||
{
|
||||
case "resize":
|
||||
$('#resizeSE').show();
|
||||
$('#resizeE').show();
|
||||
$('#resizeS').show();
|
||||
break;
|
||||
case "crop":
|
||||
ShowHandlers();
|
||||
break;
|
||||
case "rotate":
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* restore to the state the image was
|
||||
*/
|
||||
function restoreToOriginal(warning)
|
||||
{
|
||||
if(typeof(warning) == "boolean" && warning)
|
||||
{
|
||||
if(!window.confirm(warningReset))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$("#imageContainer").empty();
|
||||
$("#hiddenImage img").clone().appendTo("#imageContainer");
|
||||
return true;
|
||||
|
||||
|
||||
};
|
||||
/*
|
||||
* left rotate
|
||||
*/
|
||||
function leftRotate()
|
||||
{
|
||||
|
||||
var imageToResize = getImageElement();
|
||||
$(imageToResize).rotate(-90);
|
||||
swapWidthWithHeight();
|
||||
addImageHistory();
|
||||
var angle = $('#angle');
|
||||
|
||||
var angleDegree = (parseInt($(angle).val()) + 90);
|
||||
angleDegree = ((angleDegree == 360)?angleDegree:angleDegree%360);
|
||||
$(angle).val((angleDegree ));
|
||||
return false;
|
||||
|
||||
};
|
||||
/**
|
||||
* cancel mode change
|
||||
*/
|
||||
function cancelChangeMode()
|
||||
{
|
||||
$('#formAction input[@value=' + $('#image_mode').val() + ']').attr('checked', true);
|
||||
};
|
||||
/**
|
||||
* get the image element which is going to be modified
|
||||
*/
|
||||
function getImageElement()
|
||||
{
|
||||
var imageElement = null;
|
||||
var imageContainer = document.getElementById('imageContainer');
|
||||
for(var i = 0; i < imageContainer.childNodes.length; i++)
|
||||
{
|
||||
if((typeof(imageContainer.childNodes[i].name) != "undefined" && imageContainer.childNodes[i].name.toLowerCase() == 'image') || (typeof(imageContainer.childNodes[i].tagName) != "undefined" && (imageContainer.childNodes[i].tagName.toLowerCase() == 'canvas' || imageContainer.childNodes[i].tagName.toLowerCase() == 'img')) )
|
||||
{
|
||||
imageElement = imageContainer.childNodes[i];
|
||||
}
|
||||
}
|
||||
return imageElement;
|
||||
};
|
||||
/*
|
||||
right rotate
|
||||
*/
|
||||
function rightRotate()
|
||||
{
|
||||
|
||||
var imageToResize = getImageElement();
|
||||
$(imageToResize).rotate(90);
|
||||
swapWidthWithHeight();
|
||||
addImageHistory();
|
||||
var angle = $('#angle');
|
||||
|
||||
|
||||
var angleDegree = (parseInt($(angle).val()) - 90 );
|
||||
if(angleDegree < 0)
|
||||
{
|
||||
angleDegree += 360;
|
||||
}
|
||||
angleDegree = ((angleDegree == 360)?angleDegree:angleDegree%360);
|
||||
$(angle).val((angleDegree ));
|
||||
return false;
|
||||
} ;
|
||||
/**
|
||||
* swap image width with height when rotation fired
|
||||
*/
|
||||
function swapWidthWithHeight()
|
||||
{
|
||||
var imageContainer = $('#imageContainer');
|
||||
var resizeMe = $('#resizeMe');
|
||||
var width = $('#width');
|
||||
var height = $('#height');
|
||||
var imageToResize = getImageElement();
|
||||
var newWidth = 0;
|
||||
var newHeight = 0;
|
||||
newWidth = $(imageToResize).attr('width');
|
||||
newHeight = $(imageToResize).attr('height');
|
||||
$(imageContainer).css('width', newWidth + 'px');
|
||||
$(imageContainer).css('height', newHeight + 'px');
|
||||
$(width).val(newWidth);
|
||||
$(height).val(newHeight);
|
||||
$(resizeMe).css('width', newWidth + 'px');
|
||||
$(resizeMe).css('height', newHeight + 'px');
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* records all change mede to the image
|
||||
* this features will be implemented next release
|
||||
*/
|
||||
function addImageHistory()
|
||||
{
|
||||
imageHistory = true;
|
||||
initDisabledButtons(false);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* cleare all records
|
||||
* this features will be implemented next release
|
||||
*/
|
||||
function clearImageHistory()
|
||||
{
|
||||
imageHistory = false;
|
||||
initDisabledButtons(true);
|
||||
|
||||
|
||||
};
|
||||
|
||||
function initDisabledButtons(forceDisable)
|
||||
{
|
||||
if(numSessionHistory)
|
||||
{
|
||||
toggleDisabledButton('actionUndo', false);
|
||||
}else
|
||||
{
|
||||
toggleDisabledButton('actionUndo', true);
|
||||
}
|
||||
if(imageHistory)
|
||||
{
|
||||
toggleDisabledButton('actionSave', false);
|
||||
toggleDisabledButton('actionReset', false);
|
||||
}else
|
||||
{
|
||||
toggleDisabledButton('actionSave', true);
|
||||
toggleDisabledButton('actionReset', true);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* return record
|
||||
* this features will be implemented next release
|
||||
*/
|
||||
function getImageHistory()
|
||||
{
|
||||
return imageHistory;
|
||||
};
|
||||
/**
|
||||
* check if there exists any changes
|
||||
* this features will be implemented next release
|
||||
*/
|
||||
function isImageHistoryExist()
|
||||
{
|
||||
return imageHistory;
|
||||
};
|
||||
|
||||
function flipHorizontal()
|
||||
{
|
||||
if(window.confirm(warningFlipHorizotal))
|
||||
{
|
||||
addImageHistory();
|
||||
$('#flip_angle').val('horizontal');
|
||||
$('#mode').val('flip');
|
||||
saveImage();
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
function flipVertical()
|
||||
{
|
||||
if(window.confirm(warningFlipVertical))
|
||||
{
|
||||
addImageHistory();
|
||||
$('#flip_angle').val('vertical');
|
||||
$('#mode').val('flip');
|
||||
saveImage();
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
function enableFlip()
|
||||
{
|
||||
toggleDisabledButton('actionFlipH', false);
|
||||
toggleDisabledButton('actionFlipV', false);
|
||||
};
|
||||
|
||||
function toggleDisabledButton(buttonId, forceDisable)
|
||||
{
|
||||
var disabledButton = $('#' + buttonId);
|
||||
var newClass = '';
|
||||
var changeRequired = true;
|
||||
var toBeDisabled = false;
|
||||
var currentClass = $(disabledButton).attr('class') ;
|
||||
if(typeof(forceDisable) == 'boolean')
|
||||
{
|
||||
|
||||
if(forceDisable && currentClass == 'button')
|
||||
{
|
||||
newClass = 'disabledButton';
|
||||
$(disabledButton).attr('disabled', true);
|
||||
}else if(!forceDisable && currentClass == 'disabledButton')
|
||||
{
|
||||
newClass = 'button';
|
||||
$(disabledButton).removeAttr('disabled');
|
||||
}else
|
||||
{
|
||||
changeRequired = false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if(currentClass == 'button')
|
||||
{
|
||||
newClass = 'disabledButton';
|
||||
$(disabledButton).attr('disabled', true);
|
||||
}else
|
||||
{
|
||||
newClass = 'button';
|
||||
$(disabledButton).removeAttr('disabled');
|
||||
}
|
||||
if(changeRequired)
|
||||
{
|
||||
$(disabledButton).removeClass('button disabledButton');
|
||||
$(disabledButton).addClass(newClass);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
function disableFlip()
|
||||
{
|
||||
toggleDisabledButton('actionFlipH', true);
|
||||
toggleDisabledButton('actionFlipV', true);
|
||||
};
|
||||
|
||||
function undoImage()
|
||||
{
|
||||
if(numSessionHistory < 1)
|
||||
{
|
||||
alert(warningResetEmpty);
|
||||
|
||||
}else
|
||||
{
|
||||
if(window.confirm(warningUndoImage))
|
||||
{
|
||||
processImage('formAction');
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
|
||||
};
|
||||
|
||||
function processImage(formId)
|
||||
{
|
||||
$("#loading")
|
||||
.ajaxStart(function(){
|
||||
$(this).show();
|
||||
})
|
||||
.ajaxComplete(function(){
|
||||
$(this).hide();
|
||||
});
|
||||
var options =
|
||||
{
|
||||
dataType: 'json',
|
||||
error: function (data, status, e)
|
||||
{
|
||||
alert(e);
|
||||
},
|
||||
success: function(data)
|
||||
{
|
||||
if(typeof(data.error) == 'undefined')
|
||||
{
|
||||
alert('Unexpected information ');
|
||||
}
|
||||
else if(data.error != '')
|
||||
{
|
||||
|
||||
alert(data.error);
|
||||
}else
|
||||
{
|
||||
$("#loading").show();
|
||||
|
||||
currentFolder = data.folder_path;
|
||||
if(data.save_as == '1')
|
||||
{
|
||||
numSessionHistory = 0;
|
||||
}else
|
||||
{
|
||||
numSessionHistory = parseInt(data.history);
|
||||
}
|
||||
$('#file_path').val(data.path);
|
||||
$('#path').val(data.path);
|
||||
var preImage = new Image();
|
||||
preImage.width = data.width;
|
||||
preImage.height = data.height;
|
||||
preImage.onload = function()
|
||||
{
|
||||
|
||||
$('#hiddenImage').empty();
|
||||
$(preImage).appendTo('#hiddenImage');
|
||||
|
||||
changeMode(false, true);
|
||||
$('#loading').hide();
|
||||
$('#windowSaveAs').jqm({modal: true}).jqmHide();
|
||||
|
||||
};
|
||||
var now = new Date();
|
||||
preImage.src = data.path + "?" + now.getTime();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
$('#' + formId).ajaxSubmit(options);
|
||||
return false;
|
||||
};
|
||||
|
||||
function saveAsImagePre()
|
||||
{
|
||||
$('#windowSaveAs').jqm({modal: true}).jqmShow();
|
||||
var saveTo = $('#save_to');
|
||||
$(saveTo).removeOption(/./);
|
||||
$(saveTo).ajaxAddOption(urlGetFolderList, {}, false,
|
||||
function()
|
||||
{
|
||||
$(saveTo).selectOptions(currentFolder);
|
||||
});
|
||||
return false;
|
||||
};
|
||||
|
||||
function saveAsImage()
|
||||
{
|
||||
|
||||
var pattern=/^[A-Za-z0-9_ \-]+$/i;
|
||||
|
||||
var newName = $('#new_name');
|
||||
|
||||
var saveAs = $('#save_to').get(0);
|
||||
//alert($(saveAs).val());
|
||||
if(!pattern.test($(newName).val()))
|
||||
{
|
||||
alert(warningInvalidNewName);
|
||||
}else if(saveAs.selectedIndex < 0)
|
||||
{
|
||||
alert(warningNoFolderSelected);
|
||||
}else
|
||||
{
|
||||
|
||||
$('#hidden_new_name').val($(newName).val());
|
||||
$('#hidden_save_to').val(saveAs.options[saveAs.selectedIndex].value);
|
||||
if(saveImage(true))
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
function saveImage(saveAs)
|
||||
{
|
||||
if(typeof(saveAs) == 'boolean' && saveAs)
|
||||
{
|
||||
|
||||
}else
|
||||
{//remove new name if just normal save
|
||||
$('#hidden_new_name').val('');
|
||||
$('#hidden_save_to').val('');
|
||||
}
|
||||
if (!isImageHistoryExist() && (typeof(saveAs) == 'undefined' || !saveAs))
|
||||
{
|
||||
alert(noChangeMadeBeforeSave);
|
||||
}else
|
||||
{
|
||||
|
||||
if(processImage('formImageInfo'))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
function editorClose()
|
||||
{
|
||||
if(window.confirm(warningEditorClose))
|
||||
{
|
||||
window.close();
|
||||
}
|
||||
return false;
|
||||
};
|
26
BO/ajaxfilemanager/jscripts/ajaximageeditor_c.js
Executable file
91
BO/ajaxfilemanager/jscripts/ajaxtexteditor.js
Executable file
@ -0,0 +1,91 @@
|
||||
function save(id, text)
|
||||
{
|
||||
jQuery('#text').val(text);
|
||||
jQuery('#save_as_request').val('0');
|
||||
jQuery('#name').val(currentName);
|
||||
jQuery('#folder').val(currentFolder);
|
||||
do_save(false);
|
||||
};
|
||||
function do_save(saveAsRequest)
|
||||
{
|
||||
jQuery('#windowProcessing').jqmShow();
|
||||
|
||||
var options =
|
||||
{
|
||||
dataType: 'json',
|
||||
error: function (data, status, e)
|
||||
{
|
||||
alert(e);
|
||||
},
|
||||
success: function(data)
|
||||
{
|
||||
if(typeof(data.error) == 'undefined')
|
||||
{
|
||||
alert('Unexpected information ');
|
||||
|
||||
if(typeof(saveAsRequest) == 'boolean' && saveAsRequest)
|
||||
{
|
||||
jQuery('#windowSaveAs').jqmShow();
|
||||
}
|
||||
}
|
||||
else if(data.error != '')
|
||||
{
|
||||
alert(data.error);
|
||||
jQuery('#windowProcessing').jqmHide();
|
||||
if(typeof(saveAsRequest) == 'boolean' && saveAsRequest)
|
||||
{
|
||||
jQuery('#windowSaveAs').jqmShow();
|
||||
}
|
||||
}else
|
||||
{
|
||||
jQuery('#windowProcessing').jqmHide();
|
||||
jQuery('#windowSaveAs').jqmHide();
|
||||
currentFolder = data.folder;
|
||||
currentName = data.name;
|
||||
}
|
||||
}
|
||||
};
|
||||
jQuery('#frmProcessing').ajaxSubmit(options);
|
||||
};
|
||||
function save_as(id, text)
|
||||
{
|
||||
|
||||
jQuery('#text').val(text);
|
||||
jQuery('#windowSaveAs').jqmShow();
|
||||
var saveTo = jQuery('#save_to');
|
||||
jQuery(saveTo).removeOption(/./);
|
||||
jQuery(saveTo).ajaxAddOption(urlGetFolderList, {}, false,
|
||||
function()
|
||||
{
|
||||
jQuery(saveTo).selectOptions(currentFolder);
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
function do_save_as()
|
||||
{
|
||||
var pattern=/^[A-Za-z0-9_ \-]+$/i;
|
||||
var newName = jQuery('#new_name');
|
||||
var saveAs = jQuery('#save_to').get(0);
|
||||
var ext = jQuery('#ext').get(0);
|
||||
if(!pattern.test(jQuery(newName).val()))
|
||||
{
|
||||
alert(warningInvalidName);
|
||||
}else if(saveAs.selectedIndex < 0)
|
||||
{
|
||||
alert(waringFolderNotSelected);
|
||||
}else if(ext.selectedIndex < 0)
|
||||
{
|
||||
alert(warningExtNotSelected);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
jQuery('#name').val(jQuery(newName).val() + "." + ext.options[ext.selectedIndex].value);
|
||||
jQuery('#folder').val(saveAs.options[saveAs.selectedIndex].value);
|
||||
jQuery('#save_as_request').val('1');
|
||||
jQuery('#windowSaveAs').jqmHide();
|
||||
do_save(true);
|
||||
}
|
||||
return false;
|
||||
};
|
14
BO/ajaxfilemanager/jscripts/ajaxtexteditor_c.js
Executable file
6
BO/ajaxfilemanager/jscripts/calendar.js
Executable file
1
BO/ajaxfilemanager/jscripts/contextmenu.js
Executable file
@ -0,0 +1 @@
|
||||
(function($){var menu,shadow,trigger,content,hash,currentTarget;var defaults={menuStyle:{width:'100px'},itemStyle:{},itemHoverStyle:{},eventPosX:'pageX',eventPosY:'pageY',shadow:true,onContextMenu:null,onShowMenu:null};$.fn.contextMenu=function(id,options){if(!menu){menu=$('<div id="jqContextMenu"></div>').hide().css({position:'absolute',zIndex:'500'}).appendTo('body').bind('click',function(e){e.stopPropagation()})}if(!shadow){shadow=$('<div></div>').css({zIndex:499}).appendTo('body').hide()}hash=hash||[];hash.push({id:id,menuStyle:$.extend({},defaults.menuStyle,options.menuStyle||{}),itemStyle:$.extend({},defaults.itemStyle,options.itemStyle||{}),itemHoverStyle:$.extend({},defaults.itemHoverStyle,options.itemHoverStyle||{}),bindings:options.bindings||{},shadow:options.shadow||options.shadow===false?options.shadow:defaults.shadow,onContextMenu:options.onContextMenu||defaults.onContextMenu,onShowMenu:options.onShowMenu||defaults.onShowMenu,eventPosX:options.eventPosX||defaults.eventPosX,eventPosY:options.eventPosY||defaults.eventPosY});var index=hash.length-1;$(this).bind('contextmenu',function(e){var bShowContext=(!!hash[index].onContextMenu)?hash[index].onContextMenu(e):true;if(bShowContext)display(index,this,e,options);return false});return this};function display(index,trigger,e,options){var cur=hash[index];content=$('#'+cur.id).find('ul:first').clone(true);content.css(cur.menuStyle).find('li').css(cur.itemStyle).hover(function(){$(this).css(cur.itemHoverStyle)},function(){$(this).css(cur.itemStyle)}).find('img').css({verticalAlign:'middle',paddingRight:'2px'});menu.html(content);if(!!cur.onShowMenu)menu=cur.onShowMenu(e,menu);$.each(cur.bindings,function(id,func){$('#'+id,menu).bind('click',function(e){hide();func(trigger,currentTarget)})});menu.css({'left':e[cur.eventPosX],'top':e[cur.eventPosY]}).show();if(cur.shadow)shadow.css({width:menu.width(),height:menu.height(),left:e.pageX+2,top:e.pageY+2}).show();$(document).one('click',hide)}function hide(){menu.hide();shadow.hide()}$.contextMenu={defaults:function(userDefaults){$.each(userDefaults,function(i,val){if(typeof val=='object'&&defaults[i]){$.extend(defaults[i],val)}else defaults[i]=val})}}})(jQuery);$(function(){$('div.contextMenu').hide()});
|
352
BO/ajaxfilemanager/jscripts/edit_area/edit_area.css
Executable file
@ -0,0 +1,352 @@
|
||||
body, html{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
border: none;
|
||||
overflow: hidden;
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
|
||||
body, html, table, form, textarea{
|
||||
font: 12px monospace, sans-serif;
|
||||
}
|
||||
|
||||
#editor{
|
||||
border: solid #888888 1px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#result{
|
||||
z-index: 4;
|
||||
overflow: scroll;
|
||||
border-top: solid #888888 1px;
|
||||
border-bottom: solid #888888 1px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#container{
|
||||
overflow: hidden;
|
||||
/*height: 100px;*/
|
||||
border: solid blue 0px;
|
||||
position: relative;
|
||||
padding: 0 5px 0px 0;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
#textarea{
|
||||
position: relative;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
padding: 0px 0px 0px 45px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
/*position: absolute;*/
|
||||
overflow: hidden;
|
||||
z-index: 7;
|
||||
border: solid green 0px;
|
||||
/* background: none;
|
||||
background-color: transparent;*/
|
||||
}
|
||||
|
||||
#content_highlight{
|
||||
white-space: pre;
|
||||
/*background-color: #FFFFFF;*/
|
||||
padding: 1px 0 0 45px;
|
||||
position : absolute;
|
||||
z-index: 4;
|
||||
overflow: visible;
|
||||
border: solid yellow 0px;
|
||||
}
|
||||
|
||||
|
||||
#selection_field{
|
||||
padding: 0px 0px 0 45px;
|
||||
background-color: #FFFF99;
|
||||
height: 1px;
|
||||
position: absolute;
|
||||
z-index: 5;
|
||||
top: -100px;
|
||||
margin: 1px 0 0 0px;
|
||||
white-space: pre;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#line_number{
|
||||
position: absolute;
|
||||
overflow: hidden;
|
||||
border-right: solid black 1px;
|
||||
z-index:8;
|
||||
width: 38px;
|
||||
padding-right: 5px;
|
||||
text-align: right;
|
||||
color: #AAAAAA;
|
||||
}
|
||||
|
||||
#test_font_size{
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
visibility: hidden;
|
||||
position: absolute;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
pre{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.hidden{
|
||||
opacity: 0.2;
|
||||
-moz-opacity: 0.2;
|
||||
filter:alpha(opacity=20);
|
||||
}
|
||||
|
||||
#result .edit_area_cursor{
|
||||
position: absolute;
|
||||
z-index:6;
|
||||
background-color: #FF6633;
|
||||
top: -100px;
|
||||
margin: 1px 0 0 0px;
|
||||
}
|
||||
|
||||
#result .edit_area_selection_field .overline{
|
||||
background-color: #996600;
|
||||
}
|
||||
|
||||
|
||||
/* area popup */
|
||||
.editarea_popup{
|
||||
border: solid 1px #888888;
|
||||
background-color: #ECE9D8;
|
||||
width: 250px;
|
||||
padding: 4px;
|
||||
position: absolute;
|
||||
visibility: hidden;
|
||||
/*display: none;*/
|
||||
z-index: 15;
|
||||
top: -500px;
|
||||
|
||||
/*font-family: Aria, Verdana, sans-serif;
|
||||
font-size: 10pt;*/
|
||||
}
|
||||
|
||||
.editarea_popup, .editarea_popup table{
|
||||
font-family: sans-serif;
|
||||
font-size: 10pt;
|
||||
}
|
||||
|
||||
.editarea_popup img{
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.editarea_popup .close_popup{
|
||||
float: right;
|
||||
line-height: 16px;
|
||||
border: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.editarea_popup h1,.editarea_popup h2,.editarea_popup h3,.editarea_popup h4,.editarea_popup h5,.editarea_popup h6{
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.editarea_popup .copyright{
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* Area_search */
|
||||
div#area_search_replace{
|
||||
/*width: 250px;*/
|
||||
}
|
||||
|
||||
div#area_search_replace img{
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
div#area_search_replace div.button{
|
||||
text-align: center;
|
||||
line-height: 1.7em;
|
||||
}
|
||||
|
||||
div#area_search_replace .button a{
|
||||
cursor: pointer;
|
||||
border: solid 1px #888888;
|
||||
background-color: #DEDEDE;
|
||||
text-decoration: none;
|
||||
padding: 0 2px;
|
||||
color: #000000;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
div#area_search_replace a:hover{
|
||||
/*border: solid 1px #888888;*/
|
||||
background-color: #EDEDED;
|
||||
}
|
||||
|
||||
div#area_search_replace #move_area_search_replace{
|
||||
cursor: move;
|
||||
border: solid 1px #888888;
|
||||
}
|
||||
|
||||
div#area_search_replace #close_area_search_replace{
|
||||
text-align: right;
|
||||
vertical-align: top;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
div#area_search_replace #area_search_msg{
|
||||
height: 18px;
|
||||
overflow: hidden;
|
||||
border-top: solid 1px #888888;
|
||||
margin-top: 3px;
|
||||
}
|
||||
|
||||
/* area help */
|
||||
#edit_area_help{
|
||||
width: 350px;
|
||||
}
|
||||
|
||||
#edit_area_help div.close_popup{
|
||||
float: right;
|
||||
}
|
||||
|
||||
/* area_toolbar */
|
||||
.area_toolbar{
|
||||
/*font: 11px sans-serif;*/
|
||||
width: 100%;
|
||||
/*height: 21px; */
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
background-color: #ECE9D8;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.area_toolbar, .area_toolbar table{
|
||||
font: 11px sans-serif;
|
||||
}
|
||||
|
||||
.area_toolbar img{
|
||||
border: 0px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.area_toolbar input{
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.area_toolbar select{
|
||||
font-family: 'MS Sans Serif',sans-serif,Verdana,Arial;
|
||||
font-size: 7pt;
|
||||
font-weight: normal;
|
||||
margin: 2px 0 0 0 ;
|
||||
padding: 0;
|
||||
vertical-align: top;
|
||||
background-color: #F0F0EE;
|
||||
}
|
||||
|
||||
table.statusbar{
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.area_toolbar td.infos{
|
||||
text-align: center;
|
||||
width: 130px;
|
||||
border-right: solid 1px #888888;
|
||||
border-width: 0 1px 0 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.area_toolbar td.total{
|
||||
text-align: right;
|
||||
width: 50px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.area_toolbar td.resize{
|
||||
text-align: right;
|
||||
}
|
||||
/*
|
||||
.area_toolbar span{
|
||||
line-height: 1px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}*/
|
||||
|
||||
.area_toolbar span#resize_area{
|
||||
cursor: nw-resize;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
/* toolbar buttons */
|
||||
.editAreaButtonNormal, .editAreaButtonOver, .editAreaButtonDown, .editAreaSeparator, .editAreaSeparatorLine, .editAreaButtonDisabled, .editAreaButtonSelected {
|
||||
border: 0px; margin: 0px; padding: 0px; background: transparent;
|
||||
margin-top: 0px;
|
||||
margin-left: 1px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.editAreaButtonNormal {
|
||||
border: 1px solid #ECE9D8 !important;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.editAreaButtonOver {
|
||||
border: 1px solid #0A246A !important;
|
||||
cursor: pointer;
|
||||
background-color: #B6BDD2;
|
||||
}
|
||||
|
||||
.editAreaButtonDown {
|
||||
cursor: pointer;
|
||||
border: 1px solid #0A246A !important;
|
||||
background-color: #8592B5;
|
||||
}
|
||||
|
||||
.editAreaButtonSelected {
|
||||
border: 1px solid #C0C0BB !important;
|
||||
cursor: pointer;
|
||||
background-color: #F4F2E8;
|
||||
}
|
||||
|
||||
.editAreaButtonDisabled {
|
||||
filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30);
|
||||
-moz-opacity:0.3;
|
||||
opacity: 0.3;
|
||||
border: 1px solid #F0F0EE !important;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.editAreaSeparatorLine {
|
||||
margin: 1px 2px;
|
||||
background-color: #C0C0BB;
|
||||
width: 2px;
|
||||
height: 18px;
|
||||
}
|
||||
|
||||
/* waiting screen */
|
||||
#processing{
|
||||
display: none;
|
||||
background-color:#ECE9D8;
|
||||
border: solid #888888 1px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 100;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#processing_text{
|
||||
position:absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
width: 200px;
|
||||
height: 20px;
|
||||
margin-left: -100px;
|
||||
margin-top: -10px;
|
||||
text-align: center;
|
||||
}
|
||||
/* end */
|
35
BO/ajaxfilemanager/jscripts/edit_area/edit_area_full.js
Executable file
BIN
BO/ajaxfilemanager/jscripts/edit_area/images/close.gif
Executable file
After Width: | Height: | Size: 102 B |
BIN
BO/ajaxfilemanager/jscripts/edit_area/images/fullscreen.gif
Executable file
After Width: | Height: | Size: 198 B |
BIN
BO/ajaxfilemanager/jscripts/edit_area/images/go_to_line.gif
Executable file
After Width: | Height: | Size: 1.0 KiB |
BIN
BO/ajaxfilemanager/jscripts/edit_area/images/help.gif
Executable file
After Width: | Height: | Size: 295 B |
BIN
BO/ajaxfilemanager/jscripts/edit_area/images/highlight.gif
Executable file
After Width: | Height: | Size: 256 B |
35
BO/ajaxfilemanager/jscripts/edit_area/images/index.php
Executable file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
BIN
BO/ajaxfilemanager/jscripts/edit_area/images/load.gif
Executable file
After Width: | Height: | Size: 1.0 KiB |
BIN
BO/ajaxfilemanager/jscripts/edit_area/images/move.gif
Executable file
After Width: | Height: | Size: 257 B |
BIN
BO/ajaxfilemanager/jscripts/edit_area/images/newdocument.gif
Executable file
After Width: | Height: | Size: 170 B |
BIN
BO/ajaxfilemanager/jscripts/edit_area/images/opacity.png
Executable file
After Width: | Height: | Size: 147 B |
BIN
BO/ajaxfilemanager/jscripts/edit_area/images/processing.gif
Executable file
After Width: | Height: | Size: 825 B |
BIN
BO/ajaxfilemanager/jscripts/edit_area/images/redo.gif
Executable file
After Width: | Height: | Size: 169 B |
BIN
BO/ajaxfilemanager/jscripts/edit_area/images/reset_highlight.gif
Executable file
After Width: | Height: | Size: 168 B |
BIN
BO/ajaxfilemanager/jscripts/edit_area/images/save.gif
Executable file
After Width: | Height: | Size: 285 B |
BIN
BO/ajaxfilemanager/jscripts/edit_area/images/save_as.gif
Executable file
After Width: | Height: | Size: 203 B |
BIN
BO/ajaxfilemanager/jscripts/edit_area/images/search.gif
Executable file
After Width: | Height: | Size: 191 B |
BIN
BO/ajaxfilemanager/jscripts/edit_area/images/smooth_selection.gif
Executable file
After Width: | Height: | Size: 174 B |
BIN
BO/ajaxfilemanager/jscripts/edit_area/images/spacer.gif
Executable file
After Width: | Height: | Size: 43 B |
BIN
BO/ajaxfilemanager/jscripts/edit_area/images/statusbar_resize.gif
Executable file
After Width: | Height: | Size: 79 B |
BIN
BO/ajaxfilemanager/jscripts/edit_area/images/undo.gif
Executable file
After Width: | Height: | Size: 175 B |
35
BO/ajaxfilemanager/jscripts/edit_area/index.php
Executable file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
45
BO/ajaxfilemanager/jscripts/edit_area/langs/de.js
Executable file
@ -0,0 +1,45 @@
|
||||
editAreaLoader.lang["de"]={
|
||||
new_document: "neues leeres Dokument",
|
||||
search_button: "suchen und ersetzen",
|
||||
search_command: "suche nächsten / öffne Suchfeld",
|
||||
search: "suche",
|
||||
replace: "ersetze",
|
||||
replace_command: "ersetze / öffne Suchfeld",
|
||||
find_next: "finde nächsten",
|
||||
replace_all: "ersetze alle Treffer",
|
||||
reg_exp: "reguläre Ausdrücke",
|
||||
match_case: "passt auf den Begriff<br />",
|
||||
not_found: "Nicht gefunden.",
|
||||
occurrence_replaced: "Die Vorkommen wurden ersetzt.",
|
||||
search_field_empty: "leeres Suchfeld",
|
||||
restart_search_at_begin: "Ende des zu durchsuchenden Bereiches erreicht. Es wird die Suche von Anfang an fortgesetzt.", //find a shorter translation
|
||||
move_popup: "Suchfenster bewegen",
|
||||
font_size: "--Schriftgröße--",
|
||||
go_to_line: "gehe zu Zeile",
|
||||
go_to_line_prompt: "gehe zu Zeilennummmer:",
|
||||
undo: "rückgängig machen",
|
||||
redo: "wiederherstellen",
|
||||
change_smooth_selection: "aktiviere/deaktiviere einige Features (weniger Bildschirmnutzung aber mehr CPU-Belastung)",
|
||||
highlight: "Syntax Highlighting an- und ausschalten",
|
||||
reset_highlight: "Highlighting zurücksetzen (falls mit Text nicht konform)",
|
||||
help: "über",
|
||||
save: "sichern",
|
||||
load: "öffnen",
|
||||
line_abbr: "Ln",
|
||||
char_abbr: "Ch",
|
||||
position: "Position",
|
||||
total: "Gesamt",
|
||||
close_popup: "Popup schließen",
|
||||
shortcuts: "Shortcuts",
|
||||
add_tab: "Tab zum Text hinzufügen",
|
||||
remove_tab: "Tab aus Text entfernen",
|
||||
about_notice: "Bemerkung: Syntax Highlighting ist nur für kurze Texte",
|
||||
toggle: "Editor an- und ausschalten",
|
||||
accesskey: "Accesskey",
|
||||
tab: "Tab",
|
||||
shift: "Shift",
|
||||
ctrl: "Ctrl",
|
||||
esc: "Esc",
|
||||
processing: "In Bearbeitung...",
|
||||
fullscreen: "fullscreen"
|
||||
};
|
45
BO/ajaxfilemanager/jscripts/edit_area/langs/dk.js
Executable file
@ -0,0 +1,45 @@
|
||||
editAreaLoader.lang["dk"]={
|
||||
new_document: "nyt tomt dokument",
|
||||
search_button: "søg og erstat",
|
||||
search_command: "find næste / åben søgefelt",
|
||||
search: "søg",
|
||||
replace: "erstat",
|
||||
replace_command: "erstat / åben søgefelt",
|
||||
find_next: "find næste",
|
||||
replace_all: "erstat alle",
|
||||
reg_exp: "regular expressions",
|
||||
match_case: "forskel på store/små bogstaver<br />",
|
||||
not_found: "not found.",
|
||||
occurrence_replaced: "occurences replaced.",
|
||||
search_field_empty: "Search field empty",
|
||||
restart_search_at_begin: "End of area reached. Restart at begin.",
|
||||
move_popup: "flyt søgepopup",
|
||||
font_size: "--Skriftstørrelse--",
|
||||
go_to_line: "gå til linie",
|
||||
go_to_line_prompt: "gå til linienummer:",
|
||||
undo: "fortryd",
|
||||
redo: "gentag",
|
||||
change_smooth_selection: "slå display funktioner til/fra (smartere display men mere CPU krævende)",
|
||||
highlight: "slå syntax highlight til/fra",
|
||||
reset_highlight: "nulstil highlight (hvis den er desynkroniseret fra teksten)",
|
||||
help: "om",
|
||||
save: "gem",
|
||||
load: "hent",
|
||||
line_abbr: "Ln",
|
||||
char_abbr: "Ch",
|
||||
position: "Position",
|
||||
total: "Total",
|
||||
close_popup: "luk popup",
|
||||
shortcuts: "Genveje",
|
||||
add_tab: "tilføj tabulation til tekst",
|
||||
remove_tab: "fjern tabulation fra tekst",
|
||||
about_notice: "Husk: syntax highlight funktionen bør kun bruge til små tekster",
|
||||
toggle: "Slå editor til / fra",
|
||||
accesskey: "Accesskey",
|
||||
tab: "Tab",
|
||||
shift: "Skift",
|
||||
ctrl: "Ctrl",
|
||||
esc: "Esc",
|
||||
processing: "Processing...",
|
||||
fullscreen: "fullscreen"
|
||||
};
|
46
BO/ajaxfilemanager/jscripts/edit_area/langs/en.js
Executable file
@ -0,0 +1,46 @@
|
||||
editAreaLoader.lang["en"]={
|
||||
new_document: "new empty document",
|
||||
search_button: "search and replace",
|
||||
search_command: "search next / open search area",
|
||||
search: "search",
|
||||
replace: "replace",
|
||||
replace_command: "replace / open search area",
|
||||
find_next: "find next",
|
||||
replace_all: "replace all",
|
||||
reg_exp: "regular expressions",
|
||||
match_case: "match case",
|
||||
not_found: "not found.",
|
||||
occurrence_replaced: "occurences replaced.",
|
||||
search_field_empty: "Search field empty",
|
||||
restart_search_at_begin: "End of area reached. Restart at begin.",
|
||||
move_popup: "move search popup",
|
||||
font_size: "--Font size--",
|
||||
go_to_line: "go to line",
|
||||
go_to_line_prompt: "go to line number:",
|
||||
undo: "undo",
|
||||
redo: "redo",
|
||||
change_smooth_selection: "enable/disable some display features (smarter display but more CPU charge)",
|
||||
highlight: "toggle syntax highlight on/off",
|
||||
reset_highlight: "reset highlight (if desyncronized from text)",
|
||||
help: "about",
|
||||
save: "save",
|
||||
save_as: "save as",
|
||||
load: "load",
|
||||
line_abbr: "Ln",
|
||||
char_abbr: "Ch",
|
||||
position: "Position",
|
||||
total: "Total",
|
||||
close_popup: "close popup",
|
||||
shortcuts: "Shortcuts",
|
||||
add_tab: "add tabulation to text",
|
||||
remove_tab: "remove tabulation to text",
|
||||
about_notice: "Notice: syntax highlight function is only for small text",
|
||||
toggle: "Toggle editor",
|
||||
accesskey: "Accesskey",
|
||||
tab: "Tab",
|
||||
shift: "Shift",
|
||||
ctrl: "Ctrl",
|
||||
esc: "Esc",
|
||||
processing: "Processing...",
|
||||
fullscreen: "fullscreen"
|
||||
};
|
45
BO/ajaxfilemanager/jscripts/edit_area/langs/fr.js
Executable file
@ -0,0 +1,45 @@
|
||||
editAreaLoader.lang["fr"]={
|
||||
new_document: "nouveau document (efface le contenu)",
|
||||
search_button: "rechercher / remplacer",
|
||||
search_command: "rechercher suivant / ouvrir la fenêtre de recherche",
|
||||
search: "rechercher",
|
||||
replace: "remplacer",
|
||||
replace_command: "remplacer / ouvrir la fenêtre de recherche",
|
||||
find_next: "rechercher",
|
||||
replace_all: "tout remplacer",
|
||||
reg_exp: "expr. régulière",
|
||||
match_case: "respecter la casse",
|
||||
not_found: "pas trouvé.",
|
||||
occurrence_replaced: "remplacements éffectués.",
|
||||
search_field_empty: "Le champ de recherche est vide.",
|
||||
restart_search_at_begin: "Fin du texte atteint, poursuite au début.",
|
||||
move_popup: "déplacer la fenêtre de recherche",
|
||||
font_size: "--Taille police--",
|
||||
go_to_line: "aller à la ligne",
|
||||
go_to_line_prompt: "aller a la ligne numero:",
|
||||
undo: "annuler",
|
||||
redo: "refaire",
|
||||
change_smooth_selection: "activer/désactiver des fonctions d'affichage (meilleur affichage mais plus de charge processeur)",
|
||||
highlight: "activer/désactiver la coloration syntaxique",
|
||||
reset_highlight: "réinitialiser la coloration syntaxique (si désyncronisée du texte)",
|
||||
help: "à propos",
|
||||
save: "sauvegarder",
|
||||
load: "charger",
|
||||
line_abbr: "Ln",
|
||||
char_abbr: "Ch",
|
||||
position: "Position",
|
||||
total: "Total",
|
||||
close_popup: "fermer le popup",
|
||||
shortcuts: "Racourcis clavier",
|
||||
add_tab: "ajouter une tabulation dans le texte",
|
||||
remove_tab: "retirer une tabulation dans le texte",
|
||||
about_notice: "Note: la coloration syntaxique n'est prévue que pour de courts textes.",
|
||||
toggle: "basculer l'éditeur",
|
||||
accesskey: "Accesskey",
|
||||
tab: "Tab",
|
||||
shift: "Maj",
|
||||
ctrl: "Ctrl",
|
||||
esc: "Esc",
|
||||
processing: "chargement...",
|
||||
fullscreen: "plein écran"
|
||||
};
|
45
BO/ajaxfilemanager/jscripts/edit_area/langs/hr.js
Executable file
@ -0,0 +1,45 @@
|
||||
editAreaLoader.lang["hr"]={
|
||||
new_document: "Novi dokument",
|
||||
search_button: "Traži i izmijeni",
|
||||
search_command: "Traži dalje / Otvori prozor za traženje",
|
||||
search: "Traži",
|
||||
replace: "Izmijeni",
|
||||
replace_command: "Izmijeni / Otvori prozor za traženje",
|
||||
find_next: "Traži dalje",
|
||||
replace_all: "Izmjeni sve",
|
||||
reg_exp: "Regularni izrazi",
|
||||
match_case: "Bitna vel. slova",
|
||||
not_found: "nije naðeno.",
|
||||
occurrence_replaced: "izmjenjenih.",
|
||||
search_field_empty: "Prazno polje za traženje!",
|
||||
restart_search_at_begin: "Došao do kraja. Poèeo od poèetka.",
|
||||
move_popup: "Pomakni prozor",
|
||||
font_size: "--Velièina teksta--",
|
||||
go_to_line: "Odi na redak",
|
||||
go_to_line_prompt: "Odi na redak:",
|
||||
undo: "Vrati natrag",
|
||||
redo: "Napravi ponovo",
|
||||
change_smooth_selection: "Ukljuèi/iskljuèi neke moguænosti prikaza (pametniji prikaz, ali zagušeniji CPU)",
|
||||
highlight: "Ukljuèi/iskljuèi bojanje sintakse",
|
||||
reset_highlight: "Ponovi kolorizaciju (ako je nesinkronizirana s tekstom)",
|
||||
help: "O edit_area",
|
||||
save: "Spremi",
|
||||
load: "Uèitaj",
|
||||
line_abbr: "Ln",
|
||||
char_abbr: "Zn",
|
||||
position: "Pozicija",
|
||||
total: "Ukupno",
|
||||
close_popup: "Zatvori prozor",
|
||||
shortcuts: "Kratice",
|
||||
add_tab: "Dodaj tabulaciju",
|
||||
remove_tab: "Makni tabulaciju",
|
||||
about_notice: "Napomena: koloriziranje sintakse je samo za kratke kodove",
|
||||
toggle: "Prebaci naèin ureðivanja",
|
||||
accesskey: "Accesskey",
|
||||
tab: "Tab",
|
||||
shift: "Shift",
|
||||
ctrl: "Ctrl",
|
||||
esc: "Esc",
|
||||
processing: "Procesiram...",
|
||||
fullscreen: "Cijeli prozor"
|
||||
};
|
35
BO/ajaxfilemanager/jscripts/edit_area/langs/index.php
Executable file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
45
BO/ajaxfilemanager/jscripts/edit_area/langs/it.js
Executable file
@ -0,0 +1,45 @@
|
||||
editAreaLoader.lang["it"]={
|
||||
new_document: "nuovo documento vuoto",
|
||||
search_button: "cerca e sostituisci",
|
||||
search_command: "trova successivo / apri finestra di ricerca",
|
||||
search: "cerca",
|
||||
replace: "sostituisci",
|
||||
replace_command: "sostituisci / apri finestra di ricerca",
|
||||
find_next: "trova successivo",
|
||||
replace_all: "sostituisci tutti",
|
||||
reg_exp: "espressioni regolari",
|
||||
match_case: "confronta maiuscole/minuscole<br />",
|
||||
not_found: "non trovato.",
|
||||
occurrence_replaced: "occorrenze sostituite.",
|
||||
search_field_empty: "Campo ricerca vuoto",
|
||||
restart_search_at_begin: "Fine del testo raggiunta. Ricomincio dall'inizio.",
|
||||
move_popup: "sposta popup di ricerca",
|
||||
font_size: "-- Dimensione --",
|
||||
go_to_line: "vai alla linea",
|
||||
go_to_line_prompt: "vai alla linea numero:",
|
||||
undo: "annulla",
|
||||
redo: "ripeti",
|
||||
change_smooth_selection: "abilita/disabilita alcune caratteristiche della visualizzazione",
|
||||
highlight: "abilita/disabilita colorazione della sintassi",
|
||||
reset_highlight: "aggiorna colorazione (se non sincronizzata)",
|
||||
help: "informazioni su...",
|
||||
save: "salva",
|
||||
load: "carica",
|
||||
line_abbr: "Ln",
|
||||
char_abbr: "Ch",
|
||||
position: "Posizione",
|
||||
total: "Totale",
|
||||
close_popup: "chiudi popup",
|
||||
shortcuts: "Scorciatoie",
|
||||
add_tab: "aggiungi tabulazione",
|
||||
remove_tab: "rimuovi tabulazione",
|
||||
about_notice: "Avviso: la colorazione della sintassi vale solo con testo piccolo",
|
||||
toggle: "Abilita/disabilita editor",
|
||||
accesskey: "Accesskey",
|
||||
tab: "Tab",
|
||||
shift: "Shift",
|
||||
ctrl: "Ctrl",
|
||||
esc: "Esc",
|
||||
processing: "In corso...",
|
||||
fullscreen: "fullscreen"
|
||||
};
|
45
BO/ajaxfilemanager/jscripts/edit_area/langs/ja.js
Executable file
@ -0,0 +1,45 @@
|
||||
editAreaLoader.lang["ja"]={
|
||||
new_document: "新規作成",
|
||||
search_button: "検索・置換",
|
||||
search_command: "次を検索 / 検索窓を表示",
|
||||
search: "検索",
|
||||
replace: "置換",
|
||||
replace_command: "置換 / 置換窓を表示",
|
||||
find_next: "次を検索",
|
||||
replace_all: "全置換",
|
||||
reg_exp: "正規表現",
|
||||
match_case: "大文字小文字の区別",
|
||||
not_found: "見つかりません。",
|
||||
occurrence_replaced: "置換しました。",
|
||||
search_field_empty: "検索対象文字列が空です。",
|
||||
restart_search_at_begin: "終端に達しました、始めに戻ります",
|
||||
move_popup: "検索窓を移動",
|
||||
font_size: "--フォントサイズ--",
|
||||
go_to_line: "指定行へ移動",
|
||||
go_to_line_prompt: "指定行へ移動します:",
|
||||
undo: "元に戻す",
|
||||
redo: "やり直し",
|
||||
change_smooth_selection: "スムース表示の切り替え(CPUを使います)",
|
||||
highlight: "構文強調表示の切り替え",
|
||||
reset_highlight: "構文強調表示のリセット",
|
||||
help: "ヘルプを表示",
|
||||
save: "保存",
|
||||
load: "読み込み",
|
||||
line_abbr: "行",
|
||||
char_abbr: "文字",
|
||||
position: "位置",
|
||||
total: "合計",
|
||||
close_popup: "ポップアップを閉じる",
|
||||
shortcuts: "ショートカット",
|
||||
add_tab: "タブを挿入する",
|
||||
remove_tab: "タブを削除する",
|
||||
about_notice: "注意:構文強調表示は短いテキストでしか有効に機能しません。",
|
||||
toggle: "テキストエリアとeditAreaの切り替え",
|
||||
accesskey: "アクセスキー",
|
||||
tab: "Tab",
|
||||
shift: "Shift",
|
||||
ctrl: "Ctrl",
|
||||
esc: "Esc",
|
||||
processing: "処理中です...",
|
||||
fullscreen: "fullscreen"
|
||||
};
|
45
BO/ajaxfilemanager/jscripts/edit_area/langs/nl.js
Executable file
@ -0,0 +1,45 @@
|
||||
editAreaLoader.lang["nl"]={
|
||||
new_document: "nieuw leeg document",
|
||||
search_button: "zoek en vervang",
|
||||
search_command: "zoek volgende / zoekscherm openen",
|
||||
search: "zoek",
|
||||
replace: "vervang",
|
||||
replace_command: "vervang / zoekscherm openen",
|
||||
find_next: "volgende vinden",
|
||||
replace_all: "alles vervangen",
|
||||
reg_exp: "reguliere expressies",
|
||||
match_case: "hoofdletter gevoelig",
|
||||
not_found: "niet gevonden.",
|
||||
occurrence_replaced: "object vervangen.",
|
||||
search_field_empty: "Zoek veld leeg",
|
||||
restart_search_at_begin: "Niet meer instanties gevonden, begin opnieuw",
|
||||
move_popup: "versleep zoek scherm",
|
||||
font_size: "--Letter grootte--",
|
||||
go_to_line: "Ga naar regel",
|
||||
go_to_line_prompt: "Ga naar regel nummer:",
|
||||
undo: "Ongedaan maken",
|
||||
redo: "Opnieuw doen",
|
||||
change_smooth_selection: "zet wat schermopties aan/uit (kan langzamer zijn)",
|
||||
highlight: "zet syntax highlight aan/uit",
|
||||
reset_highlight: "reset highlight (indien gedesynchronizeerd)",
|
||||
help: "informatie",
|
||||
save: "opslaan",
|
||||
load: "laden",
|
||||
line_abbr: "Ln",
|
||||
char_abbr: "Ch",
|
||||
position: "Positie",
|
||||
total: "Totaal",
|
||||
close_popup: "Popup sluiten",
|
||||
shortcuts: "Snelkoppelingen",
|
||||
add_tab: "voeg tabs toe in tekst",
|
||||
remove_tab: "verwijder tabs uit tekst",
|
||||
about_notice: "Notitie: syntax highlight functie is alleen voor kleine tekst",
|
||||
toggle: "geavanceerde bewerkingsopties",
|
||||
accesskey: "Accessknop",
|
||||
tab: "Tab",
|
||||
shift: "Shift",
|
||||
ctrl: "Ctrl",
|
||||
esc: "Esc",
|
||||
processing: "Verwerken...",
|
||||
fullscreen: "fullscreen"
|
||||
};
|
45
BO/ajaxfilemanager/jscripts/edit_area/langs/pl.js
Executable file
@ -0,0 +1,45 @@
|
||||
editAreaLoader.lang["pl"]={
|
||||
new_document: "nowy dokument",
|
||||
search_button: "znajdź i zamień",
|
||||
search_command: "znajdź następny",
|
||||
search: "znajdź",
|
||||
replace: "zamień",
|
||||
replace_command: "zamień",
|
||||
find_next: "następny",
|
||||
replace_all: "zamień wszystko",
|
||||
reg_exp: "wyrażenie regularne",
|
||||
match_case: "uwzględnij wielkość liter<br />",
|
||||
not_found: "nie znaleziono.",
|
||||
occurrence_replaced: "wystąpień zamieniono.",
|
||||
search_field_empty: "Nie wprowadzono tekstu",
|
||||
restart_search_at_begin: "Koniec dokumentu. Wyszukiwanie od początku.",
|
||||
move_popup: "przesuń okienko wyszukiwania",
|
||||
font_size: "Rozmiar",
|
||||
go_to_line: "idź do linii",
|
||||
go_to_line_prompt: "numer linii:",
|
||||
undo: "cofnij",
|
||||
redo: "przywróć",
|
||||
change_smooth_selection: "włącz/wyłącz niektóre opcje wyglądu (zaawansowane opcje wyglądu obciążają procesor)",
|
||||
highlight: "włącz/wyłącz podświetlanie składni",
|
||||
reset_highlight: "odśwież podświetlanie składni (jeśli rozsynchronizowało się z tekstem)",
|
||||
help: "o programie",
|
||||
save: "zapisz",
|
||||
load: "otwórz",
|
||||
line_abbr: "Ln",
|
||||
char_abbr: "Zn",
|
||||
position: "Pozycja",
|
||||
total: "W sumie",
|
||||
close_popup: "zamknij okienko",
|
||||
shortcuts: "Skróty klawiaturowe",
|
||||
add_tab: "dodaj wcięcie do zaznaczonego tekstu",
|
||||
remove_tab: "usuń wcięcie",
|
||||
about_notice: "Uwaga: podświetlanie składni nie jest zalecane dla długich tekstów",
|
||||
toggle: "Włącz/wyłącz edytor",
|
||||
accesskey: "Alt+",
|
||||
tab: "Tab",
|
||||
shift: "Shift",
|
||||
ctrl: "Ctrl",
|
||||
esc: "Esc",
|
||||
processing: "Przetwarzanie...",
|
||||
fullscreen: "fullscreen"
|
||||
};
|
45
BO/ajaxfilemanager/jscripts/edit_area/langs/pt.js
Executable file
@ -0,0 +1,45 @@
|
||||
editAreaLoader.lang["pt"]={
|
||||
new_document: "Novo documento",
|
||||
search_button: "Localizar e substituir",
|
||||
search_command: "Localizar próximo",
|
||||
search: "Localizar",
|
||||
replace: "Substituir",
|
||||
replace_command: "Substituir",
|
||||
find_next: "Localizar",
|
||||
replace_all: "Subst. tudo",
|
||||
reg_exp: "Expressões regulares",
|
||||
match_case: "Diferenciar maiúsculas e minúsculas",
|
||||
not_found: "Não encontrado.",
|
||||
occurrence_replaced: "Ocorrências substituidas",
|
||||
search_field_empty: "Campo localizar vazio.",
|
||||
restart_search_at_begin: "Fim das ocorrências. Recomeçar do inicio.",
|
||||
move_popup: "Mover janela",
|
||||
font_size: "--Tamanho da fonte--",
|
||||
go_to_line: "Ir para linha",
|
||||
go_to_line_prompt: "Ir para a linha:",
|
||||
undo: "Desfazer",
|
||||
redo: "Refazer",
|
||||
change_smooth_selection: "Opções visuais",
|
||||
highlight: "Cores de sintaxe",
|
||||
reset_highlight: "Resetar cores (se não sincronizado)",
|
||||
help: "Sobre",
|
||||
save: "Salvar",
|
||||
load: "Carregar",
|
||||
line_abbr: "Ln",
|
||||
char_abbr: "Ch",
|
||||
position: "Posição",
|
||||
total: "Total",
|
||||
close_popup: "Fechar",
|
||||
shortcuts: "Shortcuts",
|
||||
add_tab: "Adicionar tabulação",
|
||||
remove_tab: "Remover tabulação",
|
||||
about_notice: "Atenção: Cores de sintaxe são indicados somente para textos pequenos",
|
||||
toggle: "Exibir editor",
|
||||
accesskey: "Accesskey",
|
||||
tab: "Tab",
|
||||
shift: "Shift",
|
||||
ctrl: "Ctrl",
|
||||
esc: "Esc",
|
||||
processing: "Processando...",
|
||||
fullscreen: "fullscreen"
|
||||
};
|
46
BO/ajaxfilemanager/jscripts/edit_area/langs/zh_cn.js
Executable file
@ -0,0 +1,46 @@
|
||||
editAreaLoader.lang["zh_cn"]={
|
||||
new_document: "新建文件",
|
||||
search_button: "查找与替换",
|
||||
search_command: "新查找/打开查找框",
|
||||
search: "查找",
|
||||
replace: "替换",
|
||||
replace_command: "替换/打开查找框",
|
||||
find_next: "查找下一个",
|
||||
replace_all: "替换全部",
|
||||
reg_exp: "正则表达式",
|
||||
match_case: "大小写区分",
|
||||
not_found: "无匹配.",
|
||||
occurrence_replaced: "被替换次数.",
|
||||
search_field_empty: "查找关键词为空",
|
||||
restart_search_at_begin: "已达文字框底,重新开始.",
|
||||
move_popup: "移动查找窗口",
|
||||
font_size: "--文字大小--",
|
||||
go_to_line: "指定行数",
|
||||
go_to_line_prompt: "移动到指定行数:",
|
||||
undo: "上一步",
|
||||
redo: "下一步",
|
||||
change_smooth_selection: "激活/禁止某些显示特效",
|
||||
highlight: "代码高亮开关",
|
||||
reset_highlight: "重设代码高亮",
|
||||
help: "关于",
|
||||
save: "保存",
|
||||
save_as: "别存为",
|
||||
load: "加载",
|
||||
line_abbr: "行数",
|
||||
char_abbr: "字节",
|
||||
position: "位置",
|
||||
total: "总共",
|
||||
close_popup: "关闭窗口",
|
||||
shortcuts: "快捷键",
|
||||
add_tab: "添加间隔号",
|
||||
remove_tab: "删除间隔号",
|
||||
about_notice: "提示:代码高度功能只适用于小文档",
|
||||
toggle: "转换编辑",
|
||||
accesskey: "可访问键",
|
||||
tab: "间隔号",
|
||||
shift: "Shift",
|
||||
ctrl: "Ctrl",
|
||||
esc: "Esc",
|
||||
processing: "处理中...",
|
||||
fullscreen: "全屏"
|
||||
};
|
69
BO/ajaxfilemanager/jscripts/edit_area/reg_syntax/basic.js
Executable file
@ -0,0 +1,69 @@
|
||||
editAreaLoader.load_syntax["basic"] = {
|
||||
'COMMENT_SINGLE' : {1 : "'", 2 : 'rem'}
|
||||
,'COMMENT_MULTI' : { }
|
||||
,'QUOTEMARKS' : {1: '"'}
|
||||
,'KEYWORD_CASE_SENSITIVE' : false
|
||||
,'KEYWORDS' : {
|
||||
'statements' : [
|
||||
'if','then','for','wend','while',
|
||||
'else','elseif','select','case','end select',
|
||||
'until','next','step','to','end if', 'call'
|
||||
]
|
||||
,'keywords' : [
|
||||
'sub', 'end sub', 'function', 'end function', 'exit',
|
||||
'exit function', 'dim', 'redim', 'shared', 'const',
|
||||
'is', 'absolute', 'access', 'any', 'append', 'as',
|
||||
'base', 'beep', 'binary', 'bload', 'bsave', 'chain',
|
||||
'chdir', 'circle', 'clear', 'close', 'cls', 'color',
|
||||
'com', 'common', 'data', 'date', 'declare', 'def',
|
||||
'defdbl', 'defint', 'deflng', 'defsng', 'defstr',
|
||||
'double', 'draw', 'environ', 'erase', 'error', 'field',
|
||||
'files', 'fn', 'get', 'gosub', 'goto', 'integer', 'key',
|
||||
'kill', 'let', 'line', 'list', 'locate', 'lock', 'long',
|
||||
'lprint', 'lset', 'mkdir', 'name', 'off', 'on', 'open',
|
||||
'option', 'out', 'output', 'paint', 'palette', 'pcopy',
|
||||
'poke', 'preset', 'print', 'pset', 'put', 'random',
|
||||
'randomize', 'read', 'reset', 'restore', 'resume',
|
||||
'return', 'rmdir', 'rset', 'run', 'screen', 'seg',
|
||||
'shell', 'single', 'sleep', 'sound', 'static', 'stop',
|
||||
'strig', 'string', 'swap', 'system', 'time', 'timer',
|
||||
'troff', 'tron', 'type', 'unlock', 'using', 'view',
|
||||
'wait', 'width', 'window', 'write'
|
||||
]
|
||||
,'functions' : [
|
||||
'abs', 'asc', 'atn', 'cdbl', 'chr', 'cint', 'clng',
|
||||
'cos', 'csng', 'csrlin', 'cvd', 'cvdmbf', 'cvi', 'cvl',
|
||||
'cvs', 'cvsmbf', 'eof', 'erdev', 'erl', 'err', 'exp',
|
||||
'fileattr', 'fix', 'fre', 'freefile', 'hex', 'inkey',
|
||||
'inp', 'input', 'instr', 'int', 'ioctl', 'lbound',
|
||||
'lcase', 'left', 'len', 'loc', 'lof', 'log', 'lpos',
|
||||
'ltrim', 'mid', 'mkd', 'mkdmbf', 'mki', 'mkl', 'mks',
|
||||
'mksmbf', 'oct', 'peek', 'pen', 'play', 'pmap', 'point',
|
||||
'pos', 'right', 'rnd', 'rtrim', 'seek', 'sgn', 'sin',
|
||||
'space', 'spc', 'sqr', 'stick', 'str', 'tab', 'tan',
|
||||
'ubound', 'ucase', 'val', 'varptr', 'varseg'
|
||||
]
|
||||
,'operators' : [
|
||||
'and', 'eqv', 'imp', 'mod', 'not', 'or', 'xor'
|
||||
]
|
||||
}
|
||||
,'OPERATORS' :[
|
||||
'+', '-', '/', '*', '=', '<', '>', '!', '&'
|
||||
]
|
||||
,'DELIMITERS' :[
|
||||
'(', ')', '[', ']', '{', '}'
|
||||
]
|
||||
,'STYLES' : {
|
||||
'COMMENTS': 'color: #99CC00;'
|
||||
,'QUOTESMARKS': 'color: #333399;'
|
||||
,'KEYWORDS' : {
|
||||
'keywords' : 'color: #3366FF;'
|
||||
,'functions' : 'color: #0000FF;'
|
||||
,'statements' : 'color: #3366FF;'
|
||||
,'operators' : 'color: #FF0000;'
|
||||
}
|
||||
,'OPERATORS' : 'color: #FF0000;'
|
||||
,'DELIMITERS' : 'color: #0000FF;'
|
||||
|
||||
}
|
||||
};
|
44
BO/ajaxfilemanager/jscripts/edit_area/reg_syntax/brainfuck.js
Executable file
@ -0,0 +1,44 @@
|
||||
editAreaLoader.load_syntax["brainfuck"] = {
|
||||
'COMMENT_SINGLE' : {}
|
||||
,'COMMENT_MULTI' : {}
|
||||
,'QUOTEMARKS' : {}
|
||||
,'KEYWORD_CASE_SENSITIVE' : true
|
||||
,'OPERATORS' :[
|
||||
'+', '-'
|
||||
]
|
||||
,'DELIMITERS' :[
|
||||
'[', ']'
|
||||
]
|
||||
,'REGEXPS' : {
|
||||
'bfispis' : {
|
||||
'search' : '()(\\.)()'
|
||||
,'class' : 'bfispis'
|
||||
,'modifiers' : 'g'
|
||||
,'execute' : 'before'
|
||||
}
|
||||
,'bfupis' : {
|
||||
'search' : '()(\\,)()'
|
||||
,'class' : 'bfupis'
|
||||
,'modifiers' : 'g'
|
||||
,'execute' : 'before'
|
||||
}
|
||||
,'bfmemory' : {
|
||||
'search' : '()([<>])()'
|
||||
,'class' : 'bfmemory'
|
||||
,'modifiers' : 'g'
|
||||
,'execute' : 'before'
|
||||
}
|
||||
}
|
||||
,'STYLES' : {
|
||||
'COMMENTS': 'color: #AAAAAA;'
|
||||
,'QUOTESMARKS': 'color: #6381F8;'
|
||||
,'OPERATORS' : 'color: #88AA00;'
|
||||
,'DELIMITERS' : 'color: #00C138;'
|
||||
,'REGEXPS' : {
|
||||
'bfispis' : 'color: #EE0000;'
|
||||
,'bfupis' : 'color: #4455ee;'
|
||||
,'bfmemory' : 'color: #DD00DD;'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
62
BO/ajaxfilemanager/jscripts/edit_area/reg_syntax/c.js
Executable file
@ -0,0 +1,62 @@
|
||||
editAreaLoader.load_syntax["c"] = {
|
||||
'COMMENT_SINGLE' : {1 : '//'}
|
||||
,'COMMENT_MULTI' : {'/*' : '*/'}
|
||||
,'QUOTEMARKS' : {1: "'", 2: '"'}
|
||||
,'KEYWORD_CASE_SENSITIVE' : true
|
||||
,'KEYWORDS' : {
|
||||
'constants' : [
|
||||
'NULL', 'false', 'stdin', 'stdout', 'stderr', 'true'
|
||||
]
|
||||
,'types' : [
|
||||
'FILE', 'auto', 'char', 'const', 'double',
|
||||
'extern', 'float', 'inline', 'int', 'long', 'register',
|
||||
'short', 'signed', 'size_t', 'static', 'struct',
|
||||
'time_t', 'typedef', 'union', 'unsigned', 'void',
|
||||
'volatile'
|
||||
]
|
||||
,'statements' : [
|
||||
'do', 'else', 'enum', 'for', 'goto', 'if', 'sizeof',
|
||||
'switch', 'while'
|
||||
]
|
||||
,'keywords' : [
|
||||
'break', 'case', 'continue', 'default', 'delete',
|
||||
'return'
|
||||
]
|
||||
}
|
||||
,'OPERATORS' :[
|
||||
'+', '-', '/', '*', '=', '<', '>', '%', '!', '?', ':', '&'
|
||||
]
|
||||
,'DELIMITERS' :[
|
||||
'(', ')', '[', ']', '{', '}'
|
||||
]
|
||||
,'REGEXPS' : {
|
||||
'precompiler' : {
|
||||
'search' : '()(#[^\r\n]*)()'
|
||||
,'class' : 'precompiler'
|
||||
,'modifiers' : 'g'
|
||||
,'execute' : 'before'
|
||||
}
|
||||
/* ,'precompilerstring' : {
|
||||
'search' : '(#[\t ]*include[\t ]*)([^\r\n]*)([^\r\n]*[\r\n])'
|
||||
,'class' : 'precompilerstring'
|
||||
,'modifiers' : 'g'
|
||||
,'execute' : 'before'
|
||||
}*/
|
||||
}
|
||||
,'STYLES' : {
|
||||
'COMMENTS': 'color: #AAAAAA;'
|
||||
,'QUOTESMARKS': 'color: #6381F8;'
|
||||
,'KEYWORDS' : {
|
||||
'constants' : 'color: #EE0000;'
|
||||
,'types' : 'color: #0000EE;'
|
||||
,'statements' : 'color: #60CA00;'
|
||||
,'keywords' : 'color: #48BDDF;'
|
||||
}
|
||||
,'OPERATORS' : 'color: #FF00FF;'
|
||||
,'DELIMITERS' : 'color: #0038E1;'
|
||||
,'REGEXPS' : {
|
||||
'precompiler' : 'color: #009900;'
|
||||
,'precompilerstring' : 'color: #994400;'
|
||||
}
|
||||
}
|
||||
};
|
65
BO/ajaxfilemanager/jscripts/edit_area/reg_syntax/cpp.js
Executable file
@ -0,0 +1,65 @@
|
||||
editAreaLoader.load_syntax["cpp"] = {
|
||||
'COMMENT_SINGLE' : {1 : '//'}
|
||||
,'COMMENT_MULTI' : {'/*' : '*/'}
|
||||
,'QUOTEMARKS' : {1: "'", 2: '"'}
|
||||
,'KEYWORD_CASE_SENSITIVE' : true
|
||||
,'KEYWORDS' : {
|
||||
'constants' : [
|
||||
'NULL', 'false', 'std', 'stdin', 'stdout', 'stderr',
|
||||
'true'
|
||||
]
|
||||
,'types' : [
|
||||
'FILE', 'auto', 'char', 'class', 'const', 'double',
|
||||
'extern', 'float', 'friend', 'inline', 'int',
|
||||
'iterator', 'long', 'map', 'operator', 'queue',
|
||||
'register', 'short', 'signed', 'size_t', 'stack',
|
||||
'static', 'string', 'struct', 'time_t', 'typedef',
|
||||
'union', 'unsigned', 'vector', 'void', 'volatile'
|
||||
]
|
||||
,'statements' : [
|
||||
'catch', 'do', 'else', 'enum', 'for', 'goto', 'if',
|
||||
'sizeof', 'switch', 'this', 'throw', 'try', 'while'
|
||||
]
|
||||
,'keywords' : [
|
||||
'break', 'case', 'continue', 'default', 'delete',
|
||||
'namespace', 'new', 'private', 'protected', 'public',
|
||||
'return', 'using'
|
||||
]
|
||||
}
|
||||
,'OPERATORS' :[
|
||||
'+', '-', '/', '*', '=', '<', '>', '%', '!', '?', ':', '&'
|
||||
]
|
||||
,'DELIMITERS' :[
|
||||
'(', ')', '[', ']', '{', '}'
|
||||
]
|
||||
,'REGEXPS' : {
|
||||
'precompiler' : {
|
||||
'search' : '()(#[^\r\n]*)()'
|
||||
,'class' : 'precompiler'
|
||||
,'modifiers' : 'g'
|
||||
,'execute' : 'before'
|
||||
}
|
||||
/* ,'precompilerstring' : {
|
||||
'search' : '(#[\t ]*include[\t ]*)([^\r\n]*)([^\r\n]*[\r\n])'
|
||||
,'class' : 'precompilerstring'
|
||||
,'modifiers' : 'g'
|
||||
,'execute' : 'before'
|
||||
}*/
|
||||
}
|
||||
,'STYLES' : {
|
||||
'COMMENTS': 'color: #AAAAAA;'
|
||||
,'QUOTESMARKS': 'color: #6381F8;'
|
||||
,'KEYWORDS' : {
|
||||
'constants' : 'color: #EE0000;'
|
||||
,'types' : 'color: #0000EE;'
|
||||
,'statements' : 'color: #60CA00;'
|
||||
,'keywords' : 'color: #48BDDF;'
|
||||
}
|
||||
,'OPERATORS' : 'color: #FF00FF;'
|
||||
,'DELIMITERS' : 'color: #0038E1;'
|
||||
,'REGEXPS' : {
|
||||
'precompiler' : 'color: #009900;'
|
||||
,'precompilerstring' : 'color: #994400;'
|
||||
}
|
||||
}
|
||||
};
|
84
BO/ajaxfilemanager/jscripts/edit_area/reg_syntax/css.js
Executable file
@ -0,0 +1,84 @@
|
||||
editAreaLoader.load_syntax["css"] = {
|
||||
'COMMENT_SINGLE' : {1 : '@'}
|
||||
,'COMMENT_MULTI' : {'/*' : '*/'}
|
||||
,'QUOTEMARKS' : ['"', "'"]
|
||||
,'KEYWORD_CASE_SENSITIVE' : false
|
||||
,'KEYWORDS' : {
|
||||
'attributes' : [
|
||||
'aqua', 'azimuth', 'background-attachment', 'background-color',
|
||||
'background-image', 'background-position', 'background-repeat',
|
||||
'background', 'border-bottom-color', 'border-bottom-style',
|
||||
'border-bottom-width', 'border-left-color', 'border-left-style',
|
||||
'border-left-width', 'border-right', 'border-right-color',
|
||||
'border-right-style', 'border-right-width', 'border-top-color',
|
||||
'border-top-style', 'border-top-width','border-bottom', 'border-collapse',
|
||||
'border-left', 'border-width', 'border-color', 'border-spacing',
|
||||
'border-style', 'border-top', 'border', 'caption-side',
|
||||
'clear', 'clip', 'color', 'content', 'counter-increment', 'counter-reset',
|
||||
'cue-after', 'cue-before', 'cue', 'cursor', 'direction', 'display',
|
||||
'elevation', 'empty-cells', 'float', 'font-family', 'font-size',
|
||||
'font-size-adjust', 'font-stretch', 'font-style', 'font-variant',
|
||||
'font-weight', 'font', 'height', 'letter-spacing', 'line-height',
|
||||
'list-style', 'list-style-image', 'list-style-position', 'list-style-type',
|
||||
'margin-bottom', 'margin-left', 'margin-right', 'margin-top', 'margin',
|
||||
'marker-offset', 'marks', 'max-height', 'max-width', 'min-height',
|
||||
'min-width', 'opacity', 'orphans', 'outline', 'outline-color', 'outline-style',
|
||||
'outline-width', 'overflow', 'padding-bottom', 'padding-left',
|
||||
'padding-right', 'padding-top', 'padding', 'page', 'page-break-after',
|
||||
'page-break-before', 'page-break-inside', 'pause-after', 'pause-before',
|
||||
'pause', 'pitch', 'pitch-range', 'play-during', 'position', 'quotes',
|
||||
'richness', 'right', 'size', 'speak-header', 'speak-numeral', 'speak-punctuation',
|
||||
'speak', 'speech-rate', 'stress', 'table-layout', 'text-align', 'text-decoration',
|
||||
'text-indent', 'text-shadow', 'text-transform', 'top', 'unicode-bidi',
|
||||
'vertical-align', 'visibility', 'voice-family', 'volume', 'white-space', 'widows',
|
||||
'width', 'word-spacing', 'z-index', 'bottom', 'left'
|
||||
]
|
||||
,'values' : [
|
||||
'above', 'absolute', 'always', 'armenian', 'aural', 'auto', 'avoid',
|
||||
'baseline', 'behind', 'below', 'bidi-override', 'black', 'blue', 'blink', 'block', 'bold', 'bolder', 'both',
|
||||
'capitalize', 'center-left', 'center-right', 'center', 'circle', 'cjk-ideographic',
|
||||
'close-quote', 'collapse', 'condensed', 'continuous', 'crop', 'crosshair', 'cross', 'cursive',
|
||||
'dashed', 'decimal-leading-zero', 'decimal', 'default', 'digits', 'disc', 'dotted', 'double',
|
||||
'e-resize', 'embed', 'extra-condensed', 'extra-expanded', 'expanded',
|
||||
'fantasy', 'far-left', 'far-right', 'faster', 'fast', 'fixed', 'fuchsia',
|
||||
'georgian', 'gray', 'green', 'groove', 'hebrew', 'help', 'hidden', 'hide', 'higher',
|
||||
'high', 'hiragana-iroha', 'hiragana', 'icon', 'inherit', 'inline-table', 'inline',
|
||||
'inset', 'inside', 'invert', 'italic', 'justify', 'katakana-iroha', 'katakana',
|
||||
'landscape', 'larger', 'large', 'left-side', 'leftwards', 'level', 'lighter', 'lime', 'line-through', 'list-item', 'loud', 'lower-alpha', 'lower-greek', 'lower-roman', 'lowercase', 'ltr', 'lower', 'low',
|
||||
'maroon', 'medium', 'message-box', 'middle', 'mix', 'monospace',
|
||||
'n-resize', 'narrower', 'navy', 'ne-resize', 'no-close-quote', 'no-open-quote', 'no-repeat', 'none', 'normal', 'nowrap', 'nw-resize',
|
||||
'oblique', 'olive', 'once', 'open-quote', 'outset', 'outside', 'overline',
|
||||
'pointer', 'portrait', 'purple', 'px',
|
||||
'red', 'relative', 'repeat-x', 'repeat-y', 'repeat', 'rgb', 'ridge', 'right-side', 'rightwards',
|
||||
's-resize', 'sans-serif', 'scroll', 'se-resize', 'semi-condensed', 'semi-expanded', 'separate', 'serif', 'show', 'silent', 'silver', 'slow', 'slower', 'small-caps', 'small-caption', 'smaller', 'soft', 'solid', 'spell-out', 'square',
|
||||
'static', 'status-bar', 'super', 'sw-resize',
|
||||
'table-caption', 'table-cell', 'table-column', 'table-column-group', 'table-footer-group', 'table-header-group', 'table-row', 'table-row-group', 'teal', 'text', 'text-bottom', 'text-top', 'thick', 'thin', 'transparent',
|
||||
'ultra-condensed', 'ultra-expanded', 'underline', 'upper-alpha', 'upper-latin', 'upper-roman', 'uppercase', 'url',
|
||||
'visible',
|
||||
'w-resize', 'wait', 'white', 'wider',
|
||||
'x-fast', 'x-high', 'x-large', 'x-loud', 'x-low', 'x-small', 'x-soft', 'xx-large', 'xx-small',
|
||||
'yellow', 'yes'
|
||||
]
|
||||
,'specials' : [
|
||||
'important'
|
||||
]
|
||||
}
|
||||
,'OPERATORS' :[
|
||||
':', ';', '!', '.', '#'
|
||||
]
|
||||
,'DELIMITERS' :[
|
||||
'{', '}'
|
||||
]
|
||||
,'STYLES' : {
|
||||
'COMMENTS': 'color: #AAAAAA;'
|
||||
,'QUOTESMARKS': 'color: #6381F8;'
|
||||
,'KEYWORDS' : {
|
||||
'attributes' : 'color: #48BDDF;'
|
||||
,'values' : 'color: #2B60FF;'
|
||||
,'specials' : 'color: #FF0000;'
|
||||
}
|
||||
,'OPERATORS' : 'color: #FF00FF;'
|
||||
,'DELIMITERS' : 'color: #60CA00;'
|
||||
|
||||
}
|
||||
};
|
50
BO/ajaxfilemanager/jscripts/edit_area/reg_syntax/html.js
Executable file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* last update: 2006-08-24
|
||||
*/
|
||||
|
||||
editAreaLoader.load_syntax["html"] = {
|
||||
'COMMENT_SINGLE' : {}
|
||||
,'COMMENT_MULTI' : {'<!--' : '-->'}
|
||||
,'QUOTEMARKS' : {1: "'", 2: '"'}
|
||||
,'KEYWORD_CASE_SENSITIVE' : false
|
||||
,'KEYWORDS' : {
|
||||
}
|
||||
,'OPERATORS' :[
|
||||
]
|
||||
,'DELIMITERS' :[
|
||||
]
|
||||
,'REGEXPS' : {
|
||||
'doctype' : {
|
||||
'search' : '()(<!DOCTYPE[^>]*>)()'
|
||||
,'class' : 'doctype'
|
||||
,'modifiers' : ''
|
||||
,'execute' : 'before' // before or after
|
||||
}
|
||||
,'tags' : {
|
||||
'search' : '(<)(/?[a-z][^ \r\n\t>]*)([^>]*>)'
|
||||
,'class' : 'tags'
|
||||
,'modifiers' : 'gi'
|
||||
,'execute' : 'before' // before or after
|
||||
}
|
||||
,'attributes' : {
|
||||
'search' : '( |\n|\r|\t)([^ \r\n\t=]+)(=)'
|
||||
,'class' : 'attributes'
|
||||
,'modifiers' : 'g'
|
||||
,'execute' : 'before' // before or after
|
||||
}
|
||||
}
|
||||
,'STYLES' : {
|
||||
'COMMENTS': 'color: #AAAAAA;'
|
||||
,'QUOTESMARKS': 'color: #6381F8;'
|
||||
,'KEYWORDS' : {
|
||||
}
|
||||
,'OPERATORS' : 'color: #E775F0;'
|
||||
,'DELIMITERS' : ''
|
||||
,'REGEXPS' : {
|
||||
'attributes': 'color: #B1AC41;'
|
||||
,'tags': 'color: #E62253;'
|
||||
,'doctype': 'color: #8DCFB5;'
|
||||
,'test': 'color: #00FF00;'
|
||||
}
|
||||
}
|
||||
};
|
35
BO/ajaxfilemanager/jscripts/edit_area/reg_syntax/index.php
Executable file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|