You can subscribe to this list here.
| 2011 |
Jan
|
Feb
|
Mar
(4) |
Apr
(57) |
May
(31) |
Jun
(21) |
Jul
(11) |
Aug
(23) |
Sep
(22) |
Oct
(36) |
Nov
(62) |
Dec
(85) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2012 |
Jan
(24) |
Feb
(24) |
Mar
(65) |
Apr
(232) |
May
(118) |
Jun
(22) |
Jul
(54) |
Aug
(57) |
Sep
(14) |
Oct
(27) |
Nov
(16) |
Dec
(19) |
| 2013 |
Jan
(16) |
Feb
(12) |
Mar
(3) |
Apr
(17) |
May
(2) |
Jun
(30) |
Jul
(33) |
Aug
(19) |
Sep
(35) |
Oct
(58) |
Nov
(27) |
Dec
(64) |
| 2014 |
Jan
(102) |
Feb
(80) |
Mar
(15) |
Apr
(4) |
May
(3) |
Jun
(3) |
Jul
(5) |
Aug
(11) |
Sep
(15) |
Oct
|
Nov
(3) |
Dec
(5) |
| 2015 |
Jan
(5) |
Feb
(4) |
Mar
(2) |
Apr
(11) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(9) |
Nov
(10) |
Dec
|
| 2016 |
Jan
(3) |
Feb
(2) |
Mar
(18) |
Apr
(13) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
(4) |
Oct
|
Nov
|
Dec
|
|
From: <os...@us...> - 2014-01-18 07:44:47
|
Revision: 5054
http://sourceforge.net/p/oscss/svn/5054
Author: oscim
Date: 2014-01-18 07:44:42 +0000 (Sat, 18 Jan 2014)
Log Message:
-----------
Fix minor reported by exe test
Fix Adjust extractto function in install
add test in backuptest
Modified Paths:
--------------
trunk/catalog/admin/includes/classes/fileUtility.php
trunk/catalog/admin/includes/modules/pages/backup.php
trunk/catalog/admin/includes/modules/pages/featureds.php
trunk/catalog/install/includes/classes/core.php
trunk/catalog/install/includes/content/core.template_sample.php
trunk/test/phpunit/Back/modules/pages/pagesbackupTest.php
Modified: trunk/catalog/admin/includes/classes/fileUtility.php
===================================================================
--- trunk/catalog/admin/includes/classes/fileUtility.php 2014-01-17 17:38:34 UTC (rev 5053)
+++ trunk/catalog/admin/includes/classes/fileUtility.php 2014-01-18 07:44:42 UTC (rev 5054)
@@ -428,20 +428,26 @@
if(substr($archive, 0, 1) == '/')
$archive = substr($archive, 1);
+
+ try {
+ $zip = new ZipArchive;
+ if(!$zip)
+ throw new Exception('Unknown ZipArchive :: '. $zip );
+
+ if(! $zip->open($archive, $optionnal ) )
+ throw new Exception('ZipArchive :: not open '. $archive );
- $zip = new ZipArchive;
-
- $res = $zip->open($archive, $optionnal ); //$optionnal);
- $res = $zip->extractTo($destination);
+ if(! $zip->extractTo($destination) )
+ throw new Exception('ZipArchive :: not extract '. $archive );
+
+ if( ! $zip->close() )
+ throw new Exception('ZipArchive :: not save ('. $archive.')' );
- if ($res === TRUE) {
- $messageStack->add(__('@system extract success') , 'success');
-
- $zip->close();
-
- } else {
- $messageStack->add(__('@system extract error'). ' '.$res, 'error' );
+ }
+ catch (Exception $e) {
+ print( 'Exception reçue : ' . $e. "\n" );
+ return false;
}
}
Modified: trunk/catalog/admin/includes/modules/pages/backup.php
===================================================================
--- trunk/catalog/admin/includes/modules/pages/backup.php 2014-01-17 17:38:34 UTC (rev 5053)
+++ trunk/catalog/admin/includes/modules/pages/backup.php 2014-01-18 07:44:42 UTC (rev 5054)
@@ -383,6 +383,7 @@
case 'listing':
default:
$li=$res=array();
+ if(is_array(self::$list))
foreach(self::$list as $item){
foreach(self::$InitInfo['modele']['listing'] as $k=>$row)
if($k == 'action') $li[$k]=self::ButtonRowsActions($item);
Modified: trunk/catalog/admin/includes/modules/pages/featureds.php
===================================================================
--- trunk/catalog/admin/includes/modules/pages/featureds.php 2014-01-17 17:38:34 UTC (rev 5053)
+++ trunk/catalog/admin/includes/modules/pages/featureds.php 2014-01-18 07:44:42 UTC (rev 5054)
@@ -61,6 +61,8 @@
'sWhere'=>'',
);
+ self::$modules=new AcaFactory(__CLASS__);
+
MGabCont::SetCurrentName(__CLASS__);
/**
Modified: trunk/catalog/install/includes/classes/core.php
===================================================================
--- trunk/catalog/install/includes/classes/core.php 2014-01-17 17:38:34 UTC (rev 5053)
+++ trunk/catalog/install/includes/classes/core.php 2014-01-18 07:44:42 UTC (rev 5054)
@@ -169,8 +169,9 @@
@brief ExtractTo , alias fileUtility::extractto
*/
function zip_extractto($archive, $destination) {
- require( $this->get_fs_document_root() . $this->ws_admin_rand . 'includes/classes/fileUtility.php' );
- return fileUtility::extractto($archive, $destination);
+ $base = substr(dirname(__FILE__), 0, -(strlen('install/includes/classes/') ) );
+ require( $base . '/'. $this->ws_admin_rand .'/'. 'includes/classes/fileUtility.php' );
+ return fileUtility::extractto($archive, $destination, 'zip', 'OVERWRITE');
}
/**
Modified: trunk/catalog/install/includes/content/core.template_sample.php
===================================================================
--- trunk/catalog/install/includes/content/core.template_sample.php 2014-01-17 17:38:34 UTC (rev 5053)
+++ trunk/catalog/install/includes/content/core.template_sample.php 2014-01-18 07:44:42 UTC (rev 5054)
@@ -86,7 +86,7 @@
// add img sample
- tep_zip_extractto( $this->fs_document_root . 'install/'.I_WS_DATA.'sample/'.$get[0].'/sample_images.zip', $_POST['FS_ROOT_DOCS'].'images/');
+ $this->zip_extractto( $this->fs_document_root . 'install/'.I_WS_DATA.'sample/'.$get[0].'/sample_images.zip', $_POST['FS_ROOT_DOCS'].'images/');
}
// add configuration shop tempale
Modified: trunk/test/phpunit/Back/modules/pages/pagesbackupTest.php
===================================================================
--- trunk/test/phpunit/Back/modules/pages/pagesbackupTest.php 2014-01-17 17:38:34 UTC (rev 5053)
+++ trunk/test/phpunit/Back/modules/pages/pagesbackupTest.php 2014-01-18 07:44:42 UTC (rev 5054)
@@ -54,6 +54,23 @@
}
+ /**
+ @brief test display form new customers
+ @depends testbackupConf
+ */
+ public function testadminsuerscreateBackup($objtmp){
+
+ $action = 'backupnow';
+ $get = array();
+ $get['compress'] = 'gzip';
+ $get['backup_structure'] = 'yes';
+
+ $res = $this->CheckAction($objtmp,$action, $get);
+
+ $this->assertTrue ( ( strlen($res) > 900) , 'Error retrun action::'.$action ) ;
+
+ }
+
/**
@brief test methode GetDBValue
@depends testbackupConf
@@ -130,6 +147,7 @@
$get['action'] = $action;
foreach($get as $k=>$v){
$_REQUEST[$k] = $v;
+ $_POST[$k] = $v;
$_GET[$k] = $v;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2014-01-17 17:38:37
|
Revision: 5053
http://sourceforge.net/p/oscss/svn/5053
Author: oscim
Date: 2014-01-17 17:38:34 +0000 (Fri, 17 Jan 2014)
Log Message:
-----------
Add unit test
Fix
Modified Paths:
--------------
trunk/catalog/admin/includes/gabarit/backup/display_view.backup.gab
trunk/catalog/admin/includes/gabarit/orders/display_view.delete.gab
trunk/catalog/admin/includes/modules/pages/backup.php
trunk/catalog/admin/includes/modules/pages/countries.php
trunk/catalog/admin/includes/modules/pages/currencies.php
trunk/catalog/admin/includes/modules/pages/orders.php
Added Paths:
-----------
trunk/test/phpunit/Back/modules/pages/pagecurrencieTest.php
trunk/test/phpunit/Back/modules/pages/pagesbackupTest.php
trunk/test/phpunit/Back/modules/pages/pagescountrieTest.php
trunk/test/phpunit/Back/modules/pages/pagesfeaturedTest.php
trunk/test/phpunit/Back/modules/pages/pagesorderTest.php
Modified: trunk/catalog/admin/includes/gabarit/backup/display_view.backup.gab
===================================================================
--- trunk/catalog/admin/includes/gabarit/backup/display_view.backup.gab 2014-01-17 15:25:51 UTC (rev 5052)
+++ trunk/catalog/admin/includes/gabarit/backup/display_view.backup.gab 2014-01-17 17:38:34 UTC (rev 5053)
@@ -1,12 +1,14 @@
<?php
/**
- @licence GPL 2005-2013 The osCSS developers - osCSS Open Source E-commerce
+ @licence GPL 2005-2014 The osCSS developers - osCSS Open Source E-commerce
@portion code Copyright (c) 2002 osCommerce
@package osCSS-2 <www http://www.oscss.org>
- @version 2.1.0
+ @version 2.2.0
@date 05/06/11, 18:10
@author oscim <mail aur...@os...> <www http://www.oscim.fr>
@encode UTF-8
+ @dir /admin/includes/gabarit/backup
+ @file display_view.backup.gab
*/
?>
@@ -46,9 +48,6 @@
</p>
- <p class="block_input">
- <?php echo tep_draw_checkbox_field('download','', 'yes', ((backup::$dir_ok == true) ? false : true )) . ' ' . __('text info download only') ?>
- </p>
Modified: trunk/catalog/admin/includes/gabarit/orders/display_view.delete.gab
===================================================================
--- trunk/catalog/admin/includes/gabarit/orders/display_view.delete.gab 2014-01-17 15:25:51 UTC (rev 5052)
+++ trunk/catalog/admin/includes/gabarit/orders/display_view.delete.gab 2014-01-17 17:38:34 UTC (rev 5053)
@@ -1,18 +1,20 @@
<?php
/**
- @licence GPL 2005-2013 The osCSS developers - osCSS Open Source E-commerce
+ @licence GPL 2005-2014 The osCSS developers - osCSS Open Source E-commerce
@portion code Copyright (c) 2002 osCommerce
@package osCSS-2 <www http://www.oscss.org>
- @version 2.1.1
- @date 12/03/2012, 19:33
+ @sub-package order
+ @version 2.2.0
+ @date 05/06/11, 18:10
@author oscim <mail aur...@os...> <www http://www.oscim.fr>
@encode UTF-8
+ @dir /admin/includes/gabarit/orders
+ @file display_view.delete.gab
*/
-
?>
<h3><?php echo __('text info heading delete order'); ?></h3>
-<?php echo tep_draw_form('orders', orders::FILENAME, 'oID=' . orders::$order->info['orders_id'] . '&action=deleteconfirm'); ?>
+<?php echo tep_draw_form('orders', orders::FILENAME, 'oID=' . orders::$order->orders_id . '&action=deleteconfirm'); ?>
<p><?php echo __('text info delete intro'); ?></p>
Modified: trunk/catalog/admin/includes/modules/pages/backup.php
===================================================================
--- trunk/catalog/admin/includes/modules/pages/backup.php 2014-01-17 15:25:51 UTC (rev 5052)
+++ trunk/catalog/admin/includes/modules/pages/backup.php 2014-01-17 17:38:34 UTC (rev 5053)
@@ -1,15 +1,19 @@
<?php if (!defined('HTTP_SERVER')) die('You can not access this file directly!');
/**
- @licence GPL 2005-2013 The osCSS developers - osCSS Open Source E-commerce
+ @licence GPL 2005-2014 The osCSS developers - osCSS Open Source E-commerce
@portion code Copyright (c) 2002 osCommerce
@package osCSS-2 <www http://www.oscss.org>
- @version 2.1.2
+ @version 2.2.0
@date 26/10/2013, 21:49
@author oscim <mail aur...@os...> <www http://www.oscim.fr>
@encode UTF-8
+ @file backup.php
+ @dir admin/includes/modules/pages/
+*/
+
+/**
@class backup
*/
-
class backup
extends ModTwo
implements InterfaceModule
Modified: trunk/catalog/admin/includes/modules/pages/countries.php
===================================================================
--- trunk/catalog/admin/includes/modules/pages/countries.php 2014-01-17 15:25:51 UTC (rev 5052)
+++ trunk/catalog/admin/includes/modules/pages/countries.php 2014-01-17 17:38:34 UTC (rev 5053)
@@ -7,9 +7,14 @@
@date 10/10/2013, 10:30
@author oscim <mail aur...@os...> <www http://www.oscim.fr>
@encode UTF-8
+ @file countries.php
+ @dir admin/includes/modules/pages/
+*/
+
+
+/**
@class countries
*/
-
class countries
extends ModTwo /// new abstract class for nextgen module
implements
@@ -310,10 +315,8 @@
break;
case 'setflag':
if ( ($_GET['flag'] == '0') || ($_GET['flag'] == '1') ) {
- $c_id =(int) tep_db_prepare_input($_GET['cID']);
-
if ($c_id > 0){
- $myarray = array('id'=>$c_id, 'post'=>array('visible'=>$_GET['flag']) );
+ $myarray = array('id'=>self::$Id, 'post'=>array('visible'=>$_GET['flag']) );
if( ! sqlcountries::update($myarray) )
$messageStack->add_session(__('@countries error in update process'), 'error');
else
@@ -547,7 +550,7 @@
case 'update_cell':
break;
case 'setflag':
- return self::RowStatus(array('country_visible'=>(int)$_GET['flag'], 'countries_id'=>(int)$_GET['cID']));
+ return self::RowStatus(array('visible'=>(int)$_GET['flag'], 'id'=>(int)self::$Id));
break;
Modified: trunk/catalog/admin/includes/modules/pages/currencies.php
===================================================================
--- trunk/catalog/admin/includes/modules/pages/currencies.php 2014-01-17 15:25:51 UTC (rev 5052)
+++ trunk/catalog/admin/includes/modules/pages/currencies.php 2014-01-17 17:38:34 UTC (rev 5053)
@@ -9,13 +9,13 @@
@encode UTF-8
@file currencies.php
@dir /admin/includes/modules/pages/
+
+ @note
+ @li 16/01/2014 modified by @oscim for fix constant already define
*/
-// Define how do we update currency exchange rates
-// Possible values are 'oanda' 'xe' or ''
- define('CURRENCY_SERVER_PRIMARY', 'oanda');
- define('CURRENCY_SERVER_BACKUP', 'xe');
+
/**
@class currencies
@@ -56,6 +56,13 @@
public static function GetConf(){
global $languages_id, $language;
+ // Define how do we update currency exchange rates
+ // Possible values are 'oanda' 'xe' or ''
+ if(!defined('CURRENCY_SERVER_PRIMARY') )
+ define('CURRENCY_SERVER_PRIMARY', 'oanda');
+ if(!defined('CURRENCY_SERVER_BACKUP') )
+ define('CURRENCY_SERVER_BACKUP', 'xe');
+
self::$code=__CLASS__;
self::$datatype='currencie';
Modified: trunk/catalog/admin/includes/modules/pages/orders.php
===================================================================
--- trunk/catalog/admin/includes/modules/pages/orders.php 2014-01-17 15:25:51 UTC (rev 5052)
+++ trunk/catalog/admin/includes/modules/pages/orders.php 2014-01-17 17:38:34 UTC (rev 5053)
@@ -1,17 +1,20 @@
<?php if (!defined('HTTP_SERVER')) die('You can not access this file directly!');
/**
- @licence GPL 2005-2013 The osCSS developers - osCSS Open Source E-commerce
+ @licence GPL 2005-2014 The osCSS developers - osCSS Open Source E-commerce
@portion code Copyright (c) 2002 osCommerce
@package osCSS-2 <www http://www.oscss.org>
- @version 2.1.2
+ @version 2.2.0
@date 04/07/2013, 10:36
@author oscim <mail aur...@os...> <www http://www.oscim.fr>
@encode UTF-8
+ @file orders.php
+ @dir /admin/includes/modules/pages/
+*/
+
+/**
@class orders
@brief manage orders, listing and edit status
*/
-
-
class orders
extends ModTwo /// new abstract class for nextgen module
implements
Added: trunk/test/phpunit/Back/modules/pages/pagecurrencieTest.php
===================================================================
--- trunk/test/phpunit/Back/modules/pages/pagecurrencieTest.php (rev 0)
+++ trunk/test/phpunit/Back/modules/pages/pagecurrencieTest.php 2014-01-17 17:38:34 UTC (rev 5053)
@@ -0,0 +1,158 @@
+<?php
+/**
+ * \file test/phpunit/Back/currencieTest.php
+ * \brief test unitaire class currencie Backoffice
+ * \remarks To run this script as CLI: phpunit filename.php
+ * \author oscim <mail aur...@os...> <www http://www.oscim.fr>
+ */
+
+// specific for test
+require_once(substr( dirname(__FILE__), 0, -14).'/_top.php');
+
+require_once(substr( dirname(__FILE__), 0, -14).'/_topDisplay.php');
+
+global $base_path;
+
+
+
+
+include_once($base_path.'includes/modules/pages/currencies.php');
+
+
+
+/**
+ * \class currencieTest
+ */
+class pagecurrencieTest
+ extends PHPUnit_Framework_TestCase
+{
+
+ /**
+ @var int
+ */
+ static public $Id;
+
+ function __construct()
+ {
+
+ }
+
+ /**
+ @brief test methode conf and static vars
+ */
+ public function testcurrencieConf(){
+
+ $objtmp = new currencies();
+
+ $this->assertTrue ( ( currencies::$code == 'currencies' ) , 'Error static var "code" is not correct' ) ;
+
+ $this->assertTrue ( ( is_array(currencies::$InitInfo) && count(currencies::$InitInfo)>0 ) , 'Error InitInfo is not array' ) ;
+
+ // count
+
+ return $objtmp;
+ }
+
+
+ /**
+ @brief test methode GetDBValue
+ @depends testcurrencieConf
+ */
+ public function testadminsuersGetDBValue($objtmp){
+
+ // action default : listing
+ $res = currencies::tep_get_list();
+
+ $this->assertTrue ( ( is_array($res) ) , 'Error GetDBValue listing' ) ;
+
+// $res = currencies::GetDBValue();
+
+
+ }
+
+
+ /**
+ @brief test display flag action
+ @depends testcurrencieConf
+ */
+ public function testadminsuersPrintFlag($objtmp){
+
+ $action = 'setflag';
+ $get = array();
+ $get['flag'] = 1;
+ $get['cID'] = 1;
+
+ $res = $this->CheckAction($objtmp,$action, $get);
+ $this->assertTrue ( ( strlen($res) ==160) , 'Error retrun action::'.$action) ;
+
+ }
+
+ /**
+ @brief test display form new customers
+ @depends testcurrencieConf
+ */
+ public function testadminsuersPrintNew($objtmp){
+
+ $action = 'new';
+ $get = array();
+
+ $res = $this->CheckAction($objtmp,$action, $get);
+ $this->assertTrue ( ( strlen($res) > 2000) , 'Error retrun action::'.$action ) ;
+
+ }
+
+ /**
+ @brief test display form edit
+ @depends testcurrencieConf
+ */
+ public function testadminsuersPrintEdit($objtmp){
+
+
+ $action = 'edit';
+ $get = array();
+ $get['cID'] = 1;
+
+ $res = $this->CheckAction($objtmp,$action, $get);
+ $this->assertTrue ( ( strlen($res) > 1600) , 'Error retrun action::'.$action ) ;
+ }
+
+ /**
+ @brief test display form edit
+ @depends testcurrencieConf
+ */
+ public function testadminsuersPrintDelete($objtmp){
+
+
+ $action = 'delete';
+ $get = array();
+ $get['cID'] = 1;
+ $get['forceajax'] = 1;
+
+ $res = $this->CheckAction($objtmp,$action, $get);
+ $this->assertTrue ( ( strlen($res) > 630) , 'Error retrun action::'.$action ) ;
+ }
+
+
+
+
+ /**
+ @brief test display action page, no process action
+ @depends testcurrencieConf
+ */
+ public function CheckAction($objtmp,$action, $get){
+
+ $get['action'] = $action;
+ foreach($get as $k=>$v){
+ $_REQUEST[$k] = $v;
+ $_GET[$k] = $v;
+ }
+
+ currencies::GetConf();
+ $res = $objtmp->display_view();
+
+ return $res;
+ }
+
+}
+
+?>
\ No newline at end of file
Added: trunk/test/phpunit/Back/modules/pages/pagesbackupTest.php
===================================================================
--- trunk/test/phpunit/Back/modules/pages/pagesbackupTest.php (rev 0)
+++ trunk/test/phpunit/Back/modules/pages/pagesbackupTest.php 2014-01-17 17:38:34 UTC (rev 5053)
@@ -0,0 +1,144 @@
+<?php
+/**
+ * \file test/phpunit/Back/backupTest.php
+ * \brief test unitaire class backup Backoffice
+ * \remarks To run this script as CLI: phpunit filename.php
+ * \author oscim <mail aur...@os...> <www http://www.oscim.fr>
+ */
+
+// specific for test
+require_once(substr( dirname(__FILE__), 0, -14).'/_top.php');
+
+require_once(substr( dirname(__FILE__), 0, -14).'/_topDisplay.php');
+
+global $base_path;
+
+
+
+
+include_once($base_path.'includes/modules/pages/backup.php');
+
+
+
+/**
+ * \class backupTest
+ */
+class pagesbackupTest
+ extends PHPUnit_Framework_TestCase
+{
+
+ /**
+ @var int
+ */
+ static public $Id;
+
+ function __construct()
+ {
+
+ }
+
+ /**
+ @brief test methode conf and static vars
+ */
+ public function testbackupConf(){
+
+ $objtmp = new backup();
+
+ $this->assertTrue ( ( backup::$code == 'backup' ) , 'Error static var "code" is not correct' ) ;
+
+ $this->assertTrue ( ( is_array(backup::$InitInfo) && count(backup::$InitInfo)>0 ) , 'Error InitInfo is not array' ) ;
+
+ // count
+
+ return $objtmp;
+ }
+
+
+ /**
+ @brief test methode GetDBValue
+ @depends testbackupConf
+ */
+ public function testadminsuersGetDBValue($objtmp){
+
+ // action default : listing
+ $res = backup::tep_get_list();
+
+ $this->assertTrue ( ( is_array($res) ) , 'Error GetDBValue listing' ) ;
+
+// $res = backup::GetDBValue();
+
+
+ }
+
+
+
+ /**
+ @brief test display form new customers
+ @depends testbackupConf
+ */
+ public function testadminsuersPrintBackup($objtmp){
+
+ $action = 'backup';
+ $get = array();
+
+ $res = $this->CheckAction($objtmp,$action, $get);
+ $this->assertTrue ( ( strlen($res) > 1300) , 'Error retrun action::'.$action ) ;
+
+ }
+
+ /**
+ @brief test display form edit
+ @depends testbackupConf
+ */
+// public function testadminsuersPrintRestore($objtmp){
+//
+//
+// $action = 'restore';
+// $get = array();
+// $get['cID'] = 1;
+//
+// $res = $this->CheckAction($objtmp,$action, $get);
+//
+// $this->assertTrue ( ( strlen($res) > 800) , 'Error retrun action::'.$action ) ;
+// }
+
+ /**
+ @brief test display form edit
+ @depends testbackupConf
+ */
+// public function testadminsuersPrintDelete($objtmp){
+//
+//
+// $action = 'delete';
+// $get = array();
+// $get['cID'] = 1;
+// $get['forceajax'] = 1;
+//
+// $res = $this->CheckAction($objtmp,$action, $get);
+// $this->assertTrue ( ( strlen($res) > 630) , 'Error retrun action::'.$action ) ;
+// }
+
+
+
+
+ /**
+ @brief test display action page, no process action
+ @depends testbackupConf
+ */
+ public function CheckAction($objtmp,$action, $get){
+
+ $get['action'] = $action;
+ foreach($get as $k=>$v){
+ $_REQUEST[$k] = $v;
+ $_GET[$k] = $v;
+ }
+
+ backup::GetConf();
+ $res = $objtmp->display_view();
+
+ return $res;
+ }
+
+}
+
+?>
\ No newline at end of file
Added: trunk/test/phpunit/Back/modules/pages/pagescountrieTest.php
===================================================================
--- trunk/test/phpunit/Back/modules/pages/pagescountrieTest.php (rev 0)
+++ trunk/test/phpunit/Back/modules/pages/pagescountrieTest.php 2014-01-17 17:38:34 UTC (rev 5053)
@@ -0,0 +1,159 @@
+<?php
+/**
+ * \file test/phpunit/Back/countrieTest.php
+ * \brief test unitaire class countrie Backoffice
+ * \remarks To run this script as CLI: phpunit filename.php
+ * \author oscim <mail aur...@os...> <www http://www.oscim.fr>
+ */
+
+// specific for test
+require_once(substr( dirname(__FILE__), 0, -14).'/_top.php');
+
+require_once(substr( dirname(__FILE__), 0, -14).'/_topDisplay.php');
+
+global $base_path;
+
+
+
+
+include_once($base_path.'includes/modules/pages/countries.php');
+
+
+
+/**
+ * \class countrieTest
+ */
+class pagescountrieTest
+ extends PHPUnit_Framework_TestCase
+{
+
+ /**
+ @var int
+ */
+ static public $Id;
+
+ function __construct()
+ {
+
+ }
+
+ /**
+ @brief test methode conf and static vars
+ */
+ public function testcountrieConf(){
+
+ $objtmp = new countries();
+
+ $this->assertTrue ( ( countries::$code == 'countries' ) , 'Error static var "code" is not correct' ) ;
+
+ $this->assertTrue ( ( is_array(countries::$InitInfo) && count(countries::$InitInfo)>0 ) , 'Error InitInfo is not array' ) ;
+
+ // count
+
+ return $objtmp;
+ }
+
+
+ /**
+ @brief test methode GetDBValue
+ @depends testcountrieConf
+ */
+ public function testadminsuersGetDBValue($objtmp){
+
+ // action default : listing
+ $res = countries::tep_get_list();
+
+ $this->assertTrue ( ( is_array($res) ) , 'Error GetDBValue listing' ) ;
+
+// $res = countries::GetDBValue();
+
+
+ }
+
+
+ /**
+ @brief test display flag action
+ @depends testcountrieConf
+ */
+ public function testadminsuersPrintFlag($objtmp){
+
+ $action = 'setflag';
+ $get = array();
+ $get['flag'] = 1;
+ $get['cID'] = 1;
+
+ $res = $this->CheckAction($objtmp,$action, $get);
+ $this->assertTrue ( ( strlen($res) ==352) , 'Error retrun action::'.$action) ;
+
+ }
+
+ /**
+ @brief test display form new customers
+ @depends testcountrieConf
+ */
+ public function testadminsuersPrintNew($objtmp){
+
+ $action = 'new';
+ $get = array();
+
+ $res = $this->CheckAction($objtmp,$action, $get);
+ $this->assertTrue ( ( strlen($res) > 2000) , 'Error retrun action::'.$action ) ;
+
+ }
+
+ /**
+ @brief test display form edit
+ @depends testcountrieConf
+ */
+ public function testadminsuersPrintEdit($objtmp){
+
+
+ $action = 'edit';
+ $get = array();
+ $get['cID'] = 1;
+
+ $res = $this->CheckAction($objtmp,$action, $get);
+
+ $this->assertTrue ( ( strlen($res) > 800) , 'Error retrun action::'.$action ) ;
+ }
+
+ /**
+ @brief test display form edit
+ @depends testcountrieConf
+ */
+ public function testadminsuersPrintDelete($objtmp){
+
+
+ $action = 'delete';
+ $get = array();
+ $get['cID'] = 1;
+ $get['forceajax'] = 1;
+
+ $res = $this->CheckAction($objtmp,$action, $get);
+ $this->assertTrue ( ( strlen($res) > 630) , 'Error retrun action::'.$action ) ;
+ }
+
+
+
+
+ /**
+ @brief test display action page, no process action
+ @depends testcountrieConf
+ */
+ public function CheckAction($objtmp,$action, $get){
+
+ $get['action'] = $action;
+ foreach($get as $k=>$v){
+ $_REQUEST[$k] = $v;
+ $_GET[$k] = $v;
+ }
+
+ countries::GetConf();
+ $res = $objtmp->display_view();
+
+ return $res;
+ }
+
+}
+
+?>
\ No newline at end of file
Added: trunk/test/phpunit/Back/modules/pages/pagesfeaturedTest.php
===================================================================
--- trunk/test/phpunit/Back/modules/pages/pagesfeaturedTest.php (rev 0)
+++ trunk/test/phpunit/Back/modules/pages/pagesfeaturedTest.php 2014-01-17 17:38:34 UTC (rev 5053)
@@ -0,0 +1,139 @@
+<?php
+/**
+ * \file test/phpunit/Back/featuredsTest.php
+ * \brief test unitaire class featureds Backoffice
+ * \remarks To run this script as CLI: phpunit filename.php
+ * \author oscim <mail aur...@os...> <www http://www.oscim.fr>
+ */
+
+// specific for test
+require_once(substr( dirname(__FILE__), 0, -14).'/_top.php');
+
+require_once(substr( dirname(__FILE__), 0, -14).'/_topDisplay.php');
+
+global $base_path;
+
+
+
+include_once($base_path.'includes/modules/pages/featureds.php');
+
+
+
+/**
+ * \class featuredTest
+ */
+class pagesfeaturedTest
+ extends PHPUnit_Framework_TestCase
+{
+
+ /**
+ @var int
+ */
+ static public $Id;
+
+ function __construct()
+ {
+
+ }
+
+ /**
+ @brief test class depends childs specific module newsletters
+ */
+ public function testallmodulesgenericDepends(){
+ global $base_path, $path;
+
+// include_once(DIR_FS_CATALOG . DIR_WS_COMMON_CLASSES.'DatasFiles.php');
+// include_once(DIR_FS_CATALOG . DIR_WS_COMMON_CLASSES.'shippingUtility.php');
+// include_once(DIR_FS_CATALOG . DIR_WS_COMMON_CLASSES.'featured.php');
+ }
+
+ /**
+ @brief test methode conf and static vars
+ */
+ public function testfeaturedsConf(){
+
+ $objtmp = new featureds();
+
+ $this->assertTrue ( ( featureds::$code == 'featureds' ) , 'Error static var "code" is not correct' ) ;
+
+ $this->assertTrue ( ( is_array(featureds::$InitInfo) && count(featureds::$InitInfo)>0 ) , 'Error InitInfo is not array' ) ;
+
+ // count
+
+ return $objtmp;
+ }
+
+
+ /**
+ @brief test methode GetDBValue
+ @depends testfeaturedsConf
+ */
+ public function testadminsuersGetDBValue($objtmp){
+
+ // action default : listing
+ $res = featureds::tep_get_list();
+
+ $this->assertTrue ( ( is_array($res) ) , 'Error GetDBValue listing' ) ;
+
+// $res = featureds::GetDBValue();
+
+
+ }
+
+
+
+
+ /**
+ @brief test display form edit
+ @depends testfeaturedsConf
+ */
+ public function testadminsuersPrintEdit($objtmp){
+
+
+ $action = 'edit';
+ $get = array();
+ $get['cID'] = 1;
+
+ $res = $this->CheckAction($objtmp,$action, $get);
+
+ $this->assertTrue ( ( strlen($res) > 2000) , 'Error retrun action::'.$action ) ;
+ }
+
+
+
+
+ /**
+ @brief test display form edit
+ @depends testfeaturedsConf
+ */
+ public function testadminsuersPrintDelete($objtmp){
+
+ $action = 'delete';
+ $get = array();
+ $get['cID'] = 1;
+ $get['forceajax'] = true;
+
+ $res = $this->CheckAction($objtmp,$action, $get);
+ $this->assertTrue ( ( strlen($res) > 400) , 'Error retrun action::'.$action ) ;
+ }
+ /**
+ @brief test display action page, no process action
+ @depends testfeaturedsConf
+ */
+ public function CheckAction($objtmp,$action, $get){
+
+ $get['action'] = $action;
+ foreach($get as $k=>$v){
+ $_REQUEST[$k] = $v;
+ $_GET[$k] = $v;
+ }
+
+ featureds::GetConf();
+ $res = $objtmp->display_view();
+
+ return $res;
+ }
+
+}
+
+?>
\ No newline at end of file
Added: trunk/test/phpunit/Back/modules/pages/pagesorderTest.php
===================================================================
--- trunk/test/phpunit/Back/modules/pages/pagesorderTest.php (rev 0)
+++ trunk/test/phpunit/Back/modules/pages/pagesorderTest.php 2014-01-17 17:38:34 UTC (rev 5053)
@@ -0,0 +1,153 @@
+<?php
+/**
+ * \file test/phpunit/Back/ordersTest.php
+ * \brief test unitaire class orders Backoffice
+ * \remarks To run this script as CLI: phpunit filename.php
+ * \author oscim <mail aur...@os...> <www http://www.oscim.fr>
+ */
+
+// specific for test
+require_once(substr( dirname(__FILE__), 0, -14).'/_top.php');
+
+require_once(substr( dirname(__FILE__), 0, -14).'/_topDisplay.php');
+
+global $base_path;
+
+
+
+include_once($base_path.'includes/functions/lib.orders.php');
+include_once($base_path.'includes/modules/pages/orders.php');
+
+
+
+/**
+ * \class orderTest
+ */
+class pagesorderTest
+ extends PHPUnit_Framework_TestCase
+{
+
+ /**
+ @var int
+ */
+ static public $Id;
+
+ function __construct()
+ {
+
+ }
+
+ /**
+ @brief test class depends childs specific module newsletters
+ */
+ public function testallmodulesgenericDepends(){
+ global $base_path, $path;
+
+ include_once(DIR_FS_CATALOG . DIR_WS_COMMON_CLASSES.'DatasFiles.php');
+ include_once(DIR_FS_CATALOG . DIR_WS_COMMON_CLASSES.'shippingUtility.php');
+ include_once(DIR_FS_CATALOG . DIR_WS_COMMON_CLASSES.'order.php');
+ }
+
+ /**
+ @brief test methode conf and static vars
+ */
+ public function testordersConf(){
+
+ $objtmp = new orders();
+
+ $this->assertTrue ( ( orders::$code == 'orders' ) , 'Error static var "code" is not correct' ) ;
+
+ $this->assertTrue ( ( is_array(orders::$InitInfo) && count(orders::$InitInfo)>0 ) , 'Error InitInfo is not array' ) ;
+
+ // count
+
+ return $objtmp;
+ }
+
+
+ /**
+ @brief test methode GetDBValue
+ @depends testordersConf
+ */
+ public function testadminsuersGetDBValue($objtmp){
+
+ // action default : listing
+ $res = orders::tep_get_list();
+
+ $this->assertTrue ( ( is_array($res) ) , 'Error GetDBValue listing' ) ;
+
+// $res = orders::GetDBValue();
+
+
+ }
+
+
+
+
+ /**
+ @brief test display form edit
+ @depends testordersConf
+ */
+ public function testadminsuersPrintEdit($objtmp){
+
+
+ $action = 'edit';
+ $get = array();
+ $get['oID'] = 11;
+
+ $res = $this->CheckAction($objtmp,$action, $get);
+
+ $this->assertTrue ( ( strlen($res) > 2000) , 'Error retrun action::'.$action ) ;
+ }
+
+
+ /**
+ @brief test display form edit
+ @depends testordersConf
+ */
+ public function testadminsuersPrintCopyTo($objtmp){
+
+ $action = 'copyto';
+ $get = array();
+ $get['oID'] = 11;
+
+ $res = $this->CheckAction($objtmp,$action, $get);
+ $this->assertTrue ( ( strlen($res) > 400) , 'Error retrun action::'.$action ) ;
+ }
+
+
+ /**
+ @brief test display form edit
+ @depends testordersConf
+ */
+ public function testadminsuersPrintDelete($objtmp){
+
+ $action = 'delete';
+ $get = array();
+ $get['oID'] = 11;
+ $get['forceajax'] = true;
+
+ $res = $this->CheckAction($objtmp,$action, $get);
+ $this->assertTrue ( ( strlen($res) > 400) , 'Error retrun action::'.$action ) ;
+ }
+ /**
+ @brief test display action page, no process action
+ @depends testordersConf
+ */
+ public function CheckAction($objtmp,$action, $get){
+
+ $get['action'] = $action;
+ foreach($get as $k=>$v){
+ $_REQUEST[$k] = $v;
+ $_GET[$k] = $v;
+ }
+
+ orders::GetConf();
+ $res = $objtmp->display_view();
+
+ return $res;
+ }
+
+}
+
+?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2014-01-17 15:25:56
|
Revision: 5052
http://sourceforge.net/p/oscss/svn/5052
Author: oscim
Date: 2014-01-17 15:25:51 +0000 (Fri, 17 Jan 2014)
Log Message:
-----------
Fix
Deletes old fil
Modified Paths:
--------------
trunk/extensions/ATTRIBUTEMANAGER_stable/attributeManager/attributeManager.php
trunk/extensions/ATTRIBUTEMANAGER_stable/attributeManager/javascript/attributeManager.js
trunk/extensions/ATTRIBUTEMANAGER_stable/catalog/admin/includes/languages/fr_FR/modules/products/attributeManager.txt
trunk/extensions/ATTRIBUTEMANAGER_stable/catalog/admin/includes/modules/products/attributeManager.php
Removed Paths:
-------------
trunk/catalog/admin/includes/classes/PclZip.php
Deleted: trunk/catalog/admin/includes/classes/PclZip.php
===================================================================
--- trunk/catalog/admin/includes/classes/PclZip.php 2014-01-17 14:40:38 UTC (rev 5051)
+++ trunk/catalog/admin/includes/classes/PclZip.php 2014-01-17 15:25:51 UTC (rev 5052)
@@ -1,5694 +0,0 @@
-<?php
-// --------------------------------------------------------------------------------
-// PhpConcept Library - Zip Module 2.8.2
-// --------------------------------------------------------------------------------
-// License GNU/LGPL - Vincent Blavet - August 2009
-// http://www.phpconcept.net
-// --------------------------------------------------------------------------------
-//
-// Presentation :
-// PclZip is a PHP library that manage ZIP archives.
-// So far tests show that archives generated by PclZip are readable by
-// WinZip application and other tools.
-//
-// Description :
-// See readme.txt and http://www.phpconcept.net
-//
-// Warning :
-// This library and the associated files are non commercial, non professional
-// work.
-// It should not have unexpected results. However if any damage is caused by
-// this software the author can not be responsible.
-// The use of this software is at the risk of the user.
-//
-// --------------------------------------------------------------------------------
-// $Id: pclzip.lib.php,v 1.60 2009/09/30 21:01:04 vblavet Exp $
-// --------------------------------------------------------------------------------
-
- // ----- Constants
- if (!defined('PCLZIP_READ_BLOCK_SIZE')) {
- define( 'PCLZIP_READ_BLOCK_SIZE', 2048 );
- }
-
- // ----- File list separator
- // In version 1.x of PclZip, the separator for file list is a space
- // (which is not a very smart choice, specifically for windows paths !).
- // A better separator should be a comma (,). This constant gives you the
- // abilty to change that.
- // However notice that changing this value, may have impact on existing
- // scripts, using space separated filenames.
- // Recommanded values for compatibility with older versions :
- //define( 'PCLZIP_SEPARATOR', ' ' );
- // Recommanded values for smart separation of filenames.
- if (!defined('PCLZIP_SEPARATOR')) {
- define( 'PCLZIP_SEPARATOR', ',' );
- }
-
- // ----- Error configuration
- // 0 : PclZip Class integrated error handling
- // 1 : PclError external library error handling. By enabling this
- // you must ensure that you have included PclError library.
- // [2,...] : reserved for futur use
- if (!defined('PCLZIP_ERROR_EXTERNAL')) {
- define( 'PCLZIP_ERROR_EXTERNAL', 0 );
- }
-
- // ----- Optional static temporary directory
- // By default temporary files are generated in the script current
- // path.
- // If defined :
- // - MUST BE terminated by a '/'.
- // - MUST be a valid, already created directory
- // Samples :
- // define( 'PCLZIP_TEMPORARY_DIR', '/temp/' );
- // define( 'PCLZIP_TEMPORARY_DIR', 'C:/Temp/' );
- if (!defined('PCLZIP_TEMPORARY_DIR')) {
- define( 'PCLZIP_TEMPORARY_DIR', '' );
- }
-
- // ----- Optional threshold ratio for use of temporary files
- // Pclzip sense the size of the file to add/extract and decide to
- // use or not temporary file. The algorythm is looking for
- // memory_limit of PHP and apply a ratio.
- // threshold = memory_limit * ratio.
- // Recommended values are under 0.5. Default 0.47.
- // Samples :
- // define( 'PCLZIP_TEMPORARY_FILE_RATIO', 0.5 );
- if (!defined('PCLZIP_TEMPORARY_FILE_RATIO')) {
- define( 'PCLZIP_TEMPORARY_FILE_RATIO', 0.47 );
- }
-
-// --------------------------------------------------------------------------------
-// ***** UNDER THIS LINE NOTHING NEEDS TO BE MODIFIED *****
-// --------------------------------------------------------------------------------
-
- // ----- Global variables
- $g_pclzip_version = "2.8.2";
-
- // ----- Error codes
- // -1 : Unable to open file in binary write mode
- // -2 : Unable to open file in binary read mode
- // -3 : Invalid parameters
- // -4 : File does not exist
- // -5 : Filename is too long (max. 255)
- // -6 : Not a valid zip file
- // -7 : Invalid extracted file size
- // -8 : Unable to create directory
- // -9 : Invalid archive extension
- // -10 : Invalid archive format
- // -11 : Unable to delete file (unlink)
- // -12 : Unable to rename file (rename)
- // -13 : Invalid header checksum
- // -14 : Invalid archive size
- define( 'PCLZIP_ERR_USER_ABORTED', 2 );
- define( 'PCLZIP_ERR_NO_ERROR', 0 );
- define( 'PCLZIP_ERR_WRITE_OPEN_FAIL', -1 );
- define( 'PCLZIP_ERR_READ_OPEN_FAIL', -2 );
- define( 'PCLZIP_ERR_INVALID_PARAMETER', -3 );
- define( 'PCLZIP_ERR_MISSING_FILE', -4 );
- define( 'PCLZIP_ERR_FILENAME_TOO_LONG', -5 );
- define( 'PCLZIP_ERR_INVALID_ZIP', -6 );
- define( 'PCLZIP_ERR_BAD_EXTRACTED_FILE', -7 );
- define( 'PCLZIP_ERR_DIR_CREATE_FAIL', -8 );
- define( 'PCLZIP_ERR_BAD_EXTENSION', -9 );
- define( 'PCLZIP_ERR_BAD_FORMAT', -10 );
- define( 'PCLZIP_ERR_DELETE_FILE_FAIL', -11 );
- define( 'PCLZIP_ERR_RENAME_FILE_FAIL', -12 );
- define( 'PCLZIP_ERR_BAD_CHECKSUM', -13 );
- define( 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP', -14 );
- define( 'PCLZIP_ERR_MISSING_OPTION_VALUE', -15 );
- define( 'PCLZIP_ERR_INVALID_OPTION_VALUE', -16 );
- define( 'PCLZIP_ERR_ALREADY_A_DIRECTORY', -17 );
- define( 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION', -18 );
- define( 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION', -19 );
- define( 'PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE', -20 );
- define( 'PCLZIP_ERR_DIRECTORY_RESTRICTION', -21 );
-
- // ----- Options values
- define( 'PCLZIP_OPT_PATH', 77001 );
- define( 'PCLZIP_OPT_ADD_PATH', 77002 );
- define( 'PCLZIP_OPT_REMOVE_PATH', 77003 );
- define( 'PCLZIP_OPT_REMOVE_ALL_PATH', 77004 );
- define( 'PCLZIP_OPT_SET_CHMOD', 77005 );
- define( 'PCLZIP_OPT_EXTRACT_AS_STRING', 77006 );
- define( 'PCLZIP_OPT_NO_COMPRESSION', 77007 );
- define( 'PCLZIP_OPT_BY_NAME', 77008 );
- define( 'PCLZIP_OPT_BY_INDEX', 77009 );
- define( 'PCLZIP_OPT_BY_EREG', 77010 );
- define( 'PCLZIP_OPT_BY_PREG', 77011 );
- define( 'PCLZIP_OPT_COMMENT', 77012 );
- define( 'PCLZIP_OPT_ADD_COMMENT', 77013 );
- define( 'PCLZIP_OPT_PREPEND_COMMENT', 77014 );
- define( 'PCLZIP_OPT_EXTRACT_IN_OUTPUT', 77015 );
- define( 'PCLZIP_OPT_REPLACE_NEWER', 77016 );
- define( 'PCLZIP_OPT_STOP_ON_ERROR', 77017 );
- // Having big trouble with crypt. Need to multiply 2 long int
- // which is not correctly supported by PHP ...
- //define( 'PCLZIP_OPT_CRYPT', 77018 );
- define( 'PCLZIP_OPT_EXTRACT_DIR_RESTRICTION', 77019 );
- define( 'PCLZIP_OPT_TEMP_FILE_THRESHOLD', 77020 );
- define( 'PCLZIP_OPT_ADD_TEMP_FILE_THRESHOLD', 77020 ); // alias
- define( 'PCLZIP_OPT_TEMP_FILE_ON', 77021 );
- define( 'PCLZIP_OPT_ADD_TEMP_FILE_ON', 77021 ); // alias
- define( 'PCLZIP_OPT_TEMP_FILE_OFF', 77022 );
- define( 'PCLZIP_OPT_ADD_TEMP_FILE_OFF', 77022 ); // alias
-
- // ----- File description attributes
- define( 'PCLZIP_ATT_FILE_NAME', 79001 );
- define( 'PCLZIP_ATT_FILE_NEW_SHORT_NAME', 79002 );
- define( 'PCLZIP_ATT_FILE_NEW_FULL_NAME', 79003 );
- define( 'PCLZIP_ATT_FILE_MTIME', 79004 );
- define( 'PCLZIP_ATT_FILE_CONTENT', 79005 );
- define( 'PCLZIP_ATT_FILE_COMMENT', 79006 );
-
- // ----- Call backs values
- define( 'PCLZIP_CB_PRE_EXTRACT', 78001 );
- define( 'PCLZIP_CB_POST_EXTRACT', 78002 );
- define( 'PCLZIP_CB_PRE_ADD', 78003 );
- define( 'PCLZIP_CB_POST_ADD', 78004 );
- /* For futur use
- define( 'PCLZIP_CB_PRE_LIST', 78005 );
- define( 'PCLZIP_CB_POST_LIST', 78006 );
- define( 'PCLZIP_CB_PRE_DELETE', 78007 );
- define( 'PCLZIP_CB_POST_DELETE', 78008 );
- */
-
- // --------------------------------------------------------------------------------
- // Class : PclZip
- // Description :
- // PclZip is the class that represent a Zip archive.
- // The public methods allow the manipulation of the archive.
- // Attributes :
- // Attributes must not be accessed directly.
- // Methods :
- // PclZip() : Object creator
- // create() : Creates the Zip archive
- // listContent() : List the content of the Zip archive
- // extract() : Extract the content of the archive
- // properties() : List the properties of the archive
- // --------------------------------------------------------------------------------
- class PclZip
- {
- // ----- Filename of the zip file
- var $zipname = '';
-
- // ----- File descriptor of the zip file
- var $zip_fd = 0;
-
- // ----- Internal error handling
- var $error_code = 1;
- var $error_string = '';
-
- // ----- Current status of the magic_quotes_runtime
- // This value store the php configuration for magic_quotes
- // The class can then disable the magic_quotes and reset it after
- var $magic_quotes_status;
-
- // --------------------------------------------------------------------------------
- // Function : PclZip()
- // Description :
- // Creates a PclZip object and set the name of the associated Zip archive
- // filename.
- // Note that no real action is taken, if the archive does not exist it is not
- // created. Use create() for that.
- // --------------------------------------------------------------------------------
- function PclZip($p_zipname)
- {
-
- // ----- Tests the zlib
- if (!function_exists('gzopen'))
- {
- die('Abort '.basename(__FILE__).' : Missing zlib extensions');
- }
-
- // ----- Set the attributes
- $this->zipname = $p_zipname;
- $this->zip_fd = 0;
- $this->magic_quotes_status = -1;
-
- // ----- Return
- return;
- }
- // --------------------------------------------------------------------------------
-
- // --------------------------------------------------------------------------------
- // Function :
- // create($p_filelist, $p_add_dir="", $p_remove_dir="")
- // create($p_filelist, $p_option, $p_option_value, ...)
- // Description :
- // This method supports two different synopsis. The first one is historical.
- // This method creates a Zip Archive. The Zip file is created in the
- // filesystem. The files and directories indicated in $p_filelist
- // are added in the archive. See the parameters description for the
- // supported format of $p_filelist.
- // When a directory is in the list, the directory and its content is added
- // in the archive.
- // In this synopsis, the function takes an optional variable list of
- // options. See bellow the supported options.
- // Parameters :
- // $p_filelist : An array containing file or directory names, or
- // a string containing one filename or one directory name, or
- // a string containing a list of filenames and/or directory
- // names separated by spaces.
- // $p_add_dir : A path to add before the real path of the archived file,
- // in order to have it memorized in the archive.
- // $p_remove_dir : A path to remove from the real path of the file to archive,
- // in order to have a shorter path memorized in the archive.
- // When $p_add_dir and $p_remove_dir are set, $p_remove_dir
- // is removed first, before $p_add_dir is added.
- // Options :
- // PCLZIP_OPT_ADD_PATH :
- // PCLZIP_OPT_REMOVE_PATH :
- // PCLZIP_OPT_REMOVE_ALL_PATH :
- // PCLZIP_OPT_COMMENT :
- // PCLZIP_CB_PRE_ADD :
- // PCLZIP_CB_POST_ADD :
- // Return Values :
- // 0 on failure,
- // The list of the added files, with a status of the add action.
- // (see PclZip::listContent() for list entry format)
- // --------------------------------------------------------------------------------
- function create($p_filelist)
- {
- $v_result=1;
-
- // ----- Reset the error handler
- $this->privErrorReset();
-
- // ----- Set default values
- $v_options = array();
- $v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE;
-
- // ----- Look for variable options arguments
- $v_size = func_num_args();
-
- // ----- Look for arguments
- if ($v_size > 1) {
- // ----- Get the arguments
- $v_arg_list = func_get_args();
-
- // ----- Remove from the options list the first argument
- array_shift($v_arg_list);
- $v_size--;
-
- // ----- Look for first arg
- if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
-
- // ----- Parse the options
- $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
- array (PCLZIP_OPT_REMOVE_PATH => 'optional',
- PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
- PCLZIP_OPT_ADD_PATH => 'optional',
- PCLZIP_CB_PRE_ADD => 'optional',
- PCLZIP_CB_POST_ADD => 'optional',
- PCLZIP_OPT_NO_COMPRESSION => 'optional',
- PCLZIP_OPT_COMMENT => 'optional',
- PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
- PCLZIP_OPT_TEMP_FILE_ON => 'optional',
- PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
- //, PCLZIP_OPT_CRYPT => 'optional'
- ));
- if ($v_result != 1) {
- return 0;
- }
- }
-
- // ----- Look for 2 args
- // Here we need to support the first historic synopsis of the
- // method.
- else {
-
- // ----- Get the first argument
- $v_options[PCLZIP_OPT_ADD_PATH] = $v_arg_list[0];
-
- // ----- Look for the optional second argument
- if ($v_size == 2) {
- $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1];
- }
- else if ($v_size > 2) {
- PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
- "Invalid number / type of arguments");
- return 0;
- }
- }
- }
-
- // ----- Look for default option values
- $this->privOptionDefaultThreshold($v_options);
-
- // ----- Init
- $v_string_list = array();
- $v_att_list = array();
- $v_filedescr_list = array();
- $p_result_list = array();
-
- // ----- Look if the $p_filelist is really an array
- if (is_array($p_filelist)) {
-
- // ----- Look if the first element is also an array
- // This will mean that this is a file description entry
- if (isset($p_filelist[0]) && is_array($p_filelist[0])) {
- $v_att_list = $p_filelist;
- }
-
- // ----- The list is a list of string names
- else {
- $v_string_list = $p_filelist;
- }
- }
-
- // ----- Look if the $p_filelist is a string
- else if (is_string($p_filelist)) {
- // ----- Create a list from the string
- $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist);
- }
-
- // ----- Invalid variable type for $p_filelist
- else {
- PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_filelist");
- return 0;
- }
-
- // ----- Reformat the string list
- if (sizeof($v_string_list) != 0) {
- foreach ($v_string_list as $v_string) {
- if ($v_string != '') {
- $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;
- }
- else {
- }
- }
- }
-
- // ----- For each file in the list check the attributes
- $v_supported_attributes
- = array ( PCLZIP_ATT_FILE_NAME => 'mandatory'
- ,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional'
- ,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional'
- ,PCLZIP_ATT_FILE_MTIME => 'optional'
- ,PCLZIP_ATT_FILE_CONTENT => 'optional'
- ,PCLZIP_ATT_FILE_COMMENT => 'optional'
- );
- foreach ($v_att_list as $v_entry) {
- $v_result = $this->privFileDescrParseAtt($v_entry,
- $v_filedescr_list[],
- $v_options,
- $v_supported_attributes);
- if ($v_result != 1) {
- return 0;
- }
- }
-
- // ----- Expand the filelist (expand directories)
- $v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options);
- if ($v_result != 1) {
- return 0;
- }
-
- // ----- Call the create fct
- $v_result = $this->privCreate($v_filedescr_list, $p_result_list, $v_options);
- if ($v_result != 1) {
- return 0;
- }
-
- // ----- Return
- return $p_result_list;
- }
- // --------------------------------------------------------------------------------
-
- // --------------------------------------------------------------------------------
- // Function :
- // add($p_filelist, $p_add_dir="", $p_remove_dir="")
- // add($p_filelist, $p_option, $p_option_value, ...)
- // Description :
- // This method supports two synopsis. The first one is historical.
- // This methods add the list of files in an existing archive.
- // If a file with the same name already exists, it is added at the end of the
- // archive, the first one is still present.
- // If the archive does not exist, it is created.
- // Parameters :
- // $p_filelist : An array containing file or directory names, or
- // a string containing one filename or one directory name, or
- // a string containing a list of filenames and/or directory
- // names separated by spaces.
- // $p_add_dir : A path to add before the real path of the archived file,
- // in order to have it memorized in the archive.
- // $p_remove_dir : A path to remove from the real path of the file to archive,
- // in order to have a shorter path memorized in the archive.
- // When $p_add_dir and $p_remove_dir are set, $p_remove_dir
- // is removed first, before $p_add_dir is added.
- // Options :
- // PCLZIP_OPT_ADD_PATH :
- // PCLZIP_OPT_REMOVE_PATH :
- // PCLZIP_OPT_REMOVE_ALL_PATH :
- // PCLZIP_OPT_COMMENT :
- // PCLZIP_OPT_ADD_COMMENT :
- // PCLZIP_OPT_PREPEND_COMMENT :
- // PCLZIP_CB_PRE_ADD :
- // PCLZIP_CB_POST_ADD :
- // Return Values :
- // 0 on failure,
- // The list of the added files, with a status of the add action.
- // (see PclZip::listContent() for list entry format)
- // --------------------------------------------------------------------------------
- function add($p_filelist)
- {
- $v_result=1;
-
- // ----- Reset the error handler
- $this->privErrorReset();
-
- // ----- Set default values
- $v_options = array();
- $v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE;
-
- // ----- Look for variable options arguments
- $v_size = func_num_args();
-
- // ----- Look for arguments
- if ($v_size > 1) {
- // ----- Get the arguments
- $v_arg_list = func_get_args();
-
- // ----- Remove form the options list the first argument
- array_shift($v_arg_list);
- $v_size--;
-
- // ----- Look for first arg
- if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
-
- // ----- Parse the options
- $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
- array (PCLZIP_OPT_REMOVE_PATH => 'optional',
- PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
- PCLZIP_OPT_ADD_PATH => 'optional',
- PCLZIP_CB_PRE_ADD => 'optional',
- PCLZIP_CB_POST_ADD => 'optional',
- PCLZIP_OPT_NO_COMPRESSION => 'optional',
- PCLZIP_OPT_COMMENT => 'optional',
- PCLZIP_OPT_ADD_COMMENT => 'optional',
- PCLZIP_OPT_PREPEND_COMMENT => 'optional',
- PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
- PCLZIP_OPT_TEMP_FILE_ON => 'optional',
- PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
- //, PCLZIP_OPT_CRYPT => 'optional'
- ));
- if ($v_result != 1) {
- return 0;
- }
- }
-
- // ----- Look for 2 args
- // Here we need to support the first historic synopsis of the
- // method.
- else {
-
- // ----- Get the first argument
- $v_options[PCLZIP_OPT_ADD_PATH] = $v_add_path = $v_arg_list[0];
-
- // ----- Look for the optional second argument
- if ($v_size == 2) {
- $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1];
- }
- else if ($v_size > 2) {
- // ----- Error log
- PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
-
- // ----- Return
- return 0;
- }
- }
- }
-
- // ----- Look for default option values
- $this->privOptionDefaultThreshold($v_options);
-
- // ----- Init
- $v_string_list = array();
- $v_att_list = array();
- $v_filedescr_list = array();
- $p_result_list = array();
-
- // ----- Look if the $p_filelist is really an array
- if (is_array($p_filelist)) {
-
- // ----- Look if the first element is also an array
- // This will mean that this is a file description entry
- if (isset($p_filelist[0]) && is_array($p_filelist[0])) {
- $v_att_list = $p_filelist;
- }
-
- // ----- The list is a list of string names
- else {
- $v_string_list = $p_filelist;
- }
- }
-
- // ----- Look if the $p_filelist is a string
- else if (is_string($p_filelist)) {
- // ----- Create a list from the string
- $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist);
- }
-
- // ----- Invalid variable type for $p_filelist
- else {
- PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type '".gettype($p_filelist)."' for p_filelist");
- return 0;
- }
-
- // ----- Reformat the string list
- if (sizeof($v_string_list) != 0) {
- foreach ($v_string_list as $v_string) {
- $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;
- }
- }
-
- // ----- For each file in the list check the attributes
- $v_supported_attributes
- = array ( PCLZIP_ATT_FILE_NAME => 'mandatory'
- ,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional'
- ,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional'
- ,PCLZIP_ATT_FILE_MTIME => 'optional'
- ,PCLZIP_ATT_FILE_CONTENT => 'optional'
- ,PCLZIP_ATT_FILE_COMMENT => 'optional'
- );
- foreach ($v_att_list as $v_entry) {
- $v_result = $this->privFileDescrParseAtt($v_entry,
- $v_filedescr_list[],
- $v_options,
- $v_supported_attributes);
- if ($v_result != 1) {
- return 0;
- }
- }
-
- // ----- Expand the filelist (expand directories)
- $v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options);
- if ($v_result != 1) {
- return 0;
- }
-
- // ----- Call the create fct
- $v_result = $this->privAdd($v_filedescr_list, $p_result_list, $v_options);
- if ($v_result != 1) {
- return 0;
- }
-
- // ----- Return
- return $p_result_list;
- }
- // --------------------------------------------------------------------------------
-
- // --------------------------------------------------------------------------------
- // Function : listContent()
- // Description :
- // This public method, gives the list of the files and directories, with their
- // properties.
- // The properties of each entries in the list are (used also in other functions) :
- // filename : Name of the file. For a create or add action it is the filename
- // given by the user. For an extract function it is the filename
- // of the extracted file.
- // stored_filename : Name of the file / directory stored in the archive.
- // size : Size of the stored file.
- // compressed_size : Size of the file's data compressed in the archive
- // (without the headers overhead)
- // mtime : Last known modification date of the file (UNIX timestamp)
- // comment : Comment associated with the file
- // folder : true | false
- // index : index of the file in the archive
- // status : status of the action (depending of the action) :
- // Values are :
- // ok : OK !
- // filtered : the file / dir is not extracted (filtered by user)
- // already_a_directory : the file can not be extracted because a
- // directory with the same name already exists
- // write_protected : the file can not be extracted because a file
- // with the same name already exists and is
- // write protected
- // newer_exist : the file was not extracted because a newer file exists
- // path_creation_fail : the file is not extracted because the folder
- // does not exist and can not be created
- // write_error : the file was not extracted because there was a
- // error while writing the file
- // read_error : the file was not extracted because there was a error
- // while reading the file
- // invalid_header : the file was not extracted because of an archive
- // format error (bad file header)
- // Note that each time a method can continue operating when there
- // is an action error on a file, the error is only logged in the file status.
- // Return Values :
- // 0 on an unrecoverable failure,
- // The list of the files in the archive.
- // --------------------------------------------------------------------------------
- function listContent()
- {
- $v_result=1;
-
- // ----- Reset the error handler
- $this->privErrorReset();
-
- // ----- Check archive
- if (!$this->privCheckFormat()) {
- return(0);
- }
-
- // ----- Call the extracting fct
- $p_list = array();
- if (($v_result = $this->privList($p_list)) != 1)
- {
- unset($p_list);
- return(0);
- }
-
- // ----- Return
- return $p_list;
- }
- // --------------------------------------------------------------------------------
-
- // --------------------------------------------------------------------------------
- // Function :
- // extract($p_path="./", $p_remove_path="")
- // extract([$p_option, $p_option_value, ...])
- // Description :
- // This method supports two synopsis. The first one is historical.
- // This method extract all the files / directories from the archive to the
- // folder indicated in $p_path.
- // If you want to ignore the 'root' part of path of the memorized files
- // you can indicate this in the optional $p_remove_path parameter.
- // By default, if a newer file with the same name already exists, the
- // file is not extracted.
- //
- // If both PCLZIP_OPT_PATH and PCLZIP_OPT_ADD_PATH aoptions
- // are used, the path indicated in PCLZIP_OPT_ADD_PATH is append
- // at the end of the path value of PCLZIP_OPT_PATH.
- // Parameters :
- // $p_path : Path where the files and directories are to be extracted
- // $p_remove_path : First part ('root' part) of the memorized path
- // (if any similar) to remove while extracting.
- // Options :
- // PCLZIP_OPT_PATH :
- // PCLZIP_OPT_ADD_PATH :
- // PCLZIP_OPT_REMOVE_PATH :
- // PCLZIP_OPT_REMOVE_ALL_PATH :
- // PCLZIP_CB_PRE_EXTRACT :
- // PCLZIP_CB_POST_EXTRACT :
- // Return Values :
- // 0 or a negative value on failure,
- // The list of the extracted files, with a status of the action.
- // (see PclZip::listContent() for list entry format)
- // --------------------------------------------------------------------------------
- function extract()
- {
- $v_result=1;
-
- // ----- Reset the error handler
- $this->privErrorReset();
-
- // ----- Check archive
- if (!$this->privCheckFormat()) {
- return(0);
- }
-
- // ----- Set default values
- $v_options = array();
-// $v_path = "./";
- $v_path = '';
- $v_remove_path = "";
- $v_remove_all_path = false;
-
- // ----- Look for variable options arguments
- $v_size = func_num_args();
-
- // ----- Default values for option
- $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
-
- // ----- Look for arguments
- if ($v_size > 0) {
- // ----- Get the arguments
- $v_arg_list = func_get_args();
-
- // ----- Look for first arg
- if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
-
- // ----- Parse the options
- $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
- array (PCLZIP_OPT_PATH => 'optional',
- PCLZIP_OPT_REMOVE_PATH => 'optional',
- PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
- PCLZIP_OPT_ADD_PATH => 'optional',
- PCLZIP_CB_PRE_EXTRACT => 'optional',
- PCLZIP_CB_POST_EXTRACT => 'optional',
- PCLZIP_OPT_SET_CHMOD => 'optional',
- PCLZIP_OPT_BY_NAME => 'optional',
- PCLZIP_OPT_BY_EREG => 'optional',
- PCLZIP_OPT_BY_PREG => 'optional',
- PCLZIP_OPT_BY_INDEX => 'optional',
- PCLZIP_OPT_EXTRACT_AS_STRING => 'optional',
- PCLZIP_OPT_EXTRACT_IN_OUTPUT => 'optional',
- PCLZIP_OPT_REPLACE_NEWER => 'optional'
- ,PCLZIP_OPT_STOP_ON_ERROR => 'optional'
- ,PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional',
- PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
- PCLZIP_OPT_TEMP_FILE_ON => 'optional',
- PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
- ));
- if ($v_result != 1) {
- return 0;
- }
-
- // ----- Set the arguments
- if (isset($v_options[PCLZIP_OPT_PATH])) {
- $v_path = $v_options[PCLZIP_OPT_PATH];
- }
- if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) {
- $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH];
- }
- if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
- $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH];
- }
- if (isset($v_options[PCLZIP_OPT_ADD_PATH])) {
- // ----- Check for '/' in last path char
- if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) {
- $v_path .= '/';
- }
- $v_path .= $v_options[PCLZIP_OPT_ADD_PATH];
- }
- }
-
- // ----- Look for 2 args
- // Here we need to support the first historic synopsis of the
- // method.
- else {
-
- // ----- Get the first argument
- $v_path = $v_arg_list[0];
-
- // ----- Look for the optional second argument
- if ($v_size == 2) {
- $v_remove_path = $v_arg_list[1];
- }
- else if ($v_size > 2) {
- // ----- Error log
- PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
-
- // ----- Return
- return 0;
- }
- }
- }
-
- // ----- Look for default option values
- $this->privOptionDefaultThreshold($v_options);
-
- // ----- Trace
-
- // ----- Call the extracting fct
- $p_list = array();
- $v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path,
- $v_remove_all_path, $v_options);
- if ($v_result < 1) {
- unset($p_list);
- return(0);
- }
-
- // ----- Return
- return $p_list;
- }
- // --------------------------------------------------------------------------------
-
-
- // --------------------------------------------------------------------------------
- // Function :
- // extractByIndex($p_index, $p_path="./", $p_remove_path="")
- // extractByIndex($p_index, [$p_option, $p_option_value, ...])
- // Description :
- // This method supports two synopsis. The first one is historical.
- // This method is doing a partial extract of the archive.
- // The extracted files or folders are identified by their index in the
- // archive (from 0 to n).
- // Note that if the index identify a folder, only the folder entry is
- // extracted, not all the files included in the archive.
- // Parameters :
- // $p_index : A single index (integer) or a string of indexes of files to
- // extract. The form of the string is "0,4-6,8-12" with only numbers
- // and '-' for range or ',' to separate ranges. No spaces or ';'
- // are allowed.
- // $p_path : Path where the files and directories are to be extracted
- // $p_remove_path : First part ('root' part) of the memorized path
- // (if any similar) to remove while extracting.
- // Options :
- // PCLZIP_OPT_PATH :
- // PCLZIP_OPT_ADD_PATH :
- // PCLZIP_OPT_REMOVE_PATH :
- // PCLZIP_OPT_REMOVE_ALL_PATH :
- // PCLZIP_OPT_EXTRACT_AS_STRING : The files are extracted as strings and
- // not as files.
- // The resulting content is in a new field 'content' in the file
- // structure.
- // This option must be used alone (any other options are ignored).
- // PCLZIP_CB_PRE_EXTRACT :
- // PCLZIP_CB_POST_EXTRACT :
- // Return Values :
- // 0 on failure,
- // The list of the extracted files, with a status of the action.
- // (see PclZip::listContent() for list entry format)
- // --------------------------------------------------------------------------------
- //function extractByIndex($p_index, options...)
- function extractByIndex($p_index)
- {
- $v_result=1;
-
- // ----- Reset the error handler
- $this->privErrorReset();
-
- // ----- Check archive
- if (!$this->privCheckFormat()) {
- return(0);
- }
-
- // ----- Set default values
- $v_options = array();
-// $v_path = "./";
- $v_path = '';
- $v_remove_path = "";
- $v_remove_all_path = false;
-
- // ----- Look for variable options arguments
- $v_size = func_num_args();
-
- // ----- Default values for option
- $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
-
- // ----- Look for arguments
- if ($v_size > 1) {
- // ----- Get the arguments
- $v_arg_list = func_get_args();
-
- // ----- Remove form the options list the first argument
- array_shift($v_arg_list);
- $v_size--;
-
- // ----- Look for first arg
- if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
-
- // ----- Parse the options
- $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
- array (PCLZIP_OPT_PATH => 'optional',
- PCLZIP_OPT_REMOVE_PATH => 'optional',
- PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
- PCLZIP_OPT_EXTRACT_AS_STRING => 'optional',
- PCLZIP_OPT_ADD_PATH => 'optional',
- PCLZIP_CB_PRE_EXTRACT => 'optional',
- PCLZIP_CB_POST_EXTRACT => 'optional',
- PCLZIP_OPT_SET_CHMOD => 'optional',
- PCLZIP_OPT_REPLACE_NEWER => 'optional'
- ,PCLZIP_OPT_STOP_ON_ERROR => 'optional'
- ,PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional',
- PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
- PCLZIP_OPT_TEMP_FILE_ON => 'optional',
- PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
- ));
- if ($v_result != 1) {
- return 0;
- }
-
- // ----- Set the arguments
- if (isset($v_options[PCLZIP_OPT_PATH])) {
- $v_path = $v_options[PCLZIP_OPT_PATH];
- }
- if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) {
- $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH];
- }
- if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
- $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH];
- }
- if (isset($v_options[PCLZIP_OPT_ADD_PATH])) {
- // ----- Check for '/' in last path char
- if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) {
- $v_path .= '/';
- }
- $v_path .= $v_options[PCLZIP_OPT_ADD_PATH];
- }
- if (!isset($v_options[PCLZIP_OPT_EXTRACT_AS_STRING])) {
- $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
- }
- else {
- }
- }
-
- // ----- Look for 2 args
- // Here we need to support the first historic synopsis of the
- // method.
- else {
-
- // ----- Get the first argument
- $v_path = $v_arg_list[0];
-
- // ----- Look for the optional second argument
- if ($v_size == 2) {
- $v_remove_path = $v_arg_list[1];
- }
- else if ($v_size > 2) {
- // ----- Error log
- PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
-
- // ----- Return
- return 0;
- }
- }
- }
-
- // ----- Trace
-
- // ----- Trick
- // Here I want to reuse extractByRule(), so I need to parse the $p_index
- // with privParseOptions()
- $v_arg_trick = array (PCLZIP_OPT_BY_INDEX, $p_index);
- $v_options_trick = array();
- $v_result = $this->privParseOptions($v_arg_trick, sizeof($v_arg_trick), $v_options_trick,
- array (PCLZIP_OPT_BY_INDEX => 'optional' ));
- if ($v_result != 1) {
- return 0;
- }
- $v_options[PCLZIP_OPT_BY_INDEX] = $v_options_trick[PCLZIP_OPT_BY_INDEX];
-
- // ----- Look for default option values
- $this->privOptionDefaultThreshold($v_options);
-
- // ----- Call the extracting fct
- if (($v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path, $v_remove_all_path, $v_options)) < 1) {
- return(0);
- }
-
- // ----- Return
- return $p_list;
- }
- // --------------------------------------------------------------------------------
-
- // --------------------------------------------------------------------------------
- // Function :
- // delete([$p_option, $p_option_value, ...])
- // Description :
- // This method removes files from the archive.
- // If no parameters are given, then all the archive is emptied.
- // Parameters :
- // None or optional arguments.
- // Options :
- // PCLZIP_OPT_BY_INDEX :
- // PCLZIP_OPT_BY_NAME :
- // PCLZIP_OPT_BY_EREG :
- // PCLZIP_OPT_BY_PREG :
- // Return Values :
- // 0 on failure,
- // The list of the files which are still present in the archive.
- // (see PclZip::listContent() for list entry format)
- // --------------------------------------------------------------------------------
- function delete()
- {
- $v_result=1;
-
- // ----- Reset the error handler
- $this->privErrorReset();
-
- // ----- Check archive
- if (!$this->privCheckFormat()) {
- return(0);
- }
-
- // ----- Set default values
- $v_options = array();
-
- // ----- Look for variable options arguments
- $v_size = func_num_args();
-
- // ----- Look for arguments
- if ($v_size > 0) {
- // ----- Get the arguments
- $v_arg_list = func_get_args();
-
- // ----- Parse the options
- $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
- array (PCLZIP_OPT_BY_NAME => 'optional',
- PCLZIP_OPT_BY_EREG => 'optional',
- PCLZIP_OPT_BY_PREG => 'optional',
- PCLZIP_OPT_BY_INDEX => 'optional' ));
- if ($v_result != 1) {
- return 0;
- }
- }
-
- // ----- Magic quotes trick
- $this->privDisableMagicQuotes();
-
- // ----- Call the delete fct
- $v_list = array();
- if (($v_result = $this->privDeleteByRule($v_list, $v_options)) != 1) {
- $this->privSwapBackMagicQuotes();
- unset($v_list);
- return(0);
- }
-
- // ----- Magic quotes trick
- $this->privSwapBackMagicQuotes();
-
- // ----- Return
- return $v_list;
- }
- // --------------------------------------------------------------------------------
-
- // --------------------------------------------------------------------------------
- // Function : deleteByIndex()
- // Description :
- // ***** Deprecated *****
- // delete(PCLZIP_OPT_BY_INDEX, $p_index) should be prefered.
- // --------------------------------------------------------------------------------
- function deleteByIndex($p_index)
- {
-
- $p_list = $this->delete(PCLZIP_OPT_BY_INDEX, $p_index);
-
- // ----- Return
- return $p_list;
- }
- // --------------------------------------------------------------------------------
-
- // --------------------------------------------------------------------------------
- // Function : properties()
- // Description :
- // This method gives the properties of the archive.
- // The properties are :
- // nb : Number of files in the archive
- // comment : Comment associated with the archive file
- // status : not_exist, ok
- // Parameters :
- // None
- // Return Values :
- // 0 on failure,
- // An array with the archive properties.
- // --------------------------------------------------------------------------------
- function properties()
- {
-
- // ----- Reset the error handler
- $this->privErrorReset();
-
- // ----- Magic quotes trick
- $this->privDisableMagicQuotes();
-
- // ----- Check archive
- if (!$this->privCheckFormat()) {
- $this->privSwapBackMagicQuotes();
- return(0);
- }
-
- // ----- Default properties
- $v_prop = array();
- $v_prop['comment'] = '';
- $v_prop['nb'] = 0;
- $v_prop['status'] = 'not_exist';
-
- // ----- Look if file exists
- if (@is_file($this->zipname))
- {
- // ----- Open the zip file
- if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
- {
- $this->privSwapBackMagicQuotes();
-
- // ----- Error log
- PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');
-
- // ----- Return
- return 0;
- }
-
- // ----- Read the central directory informations
- $v_central_dir = array();
- if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
- {
- $this->privSwapBackMagicQuotes();
- return 0;
- }
-
- // ----- Close the zip file
- $this->privCloseFd();
-
- // ----- Set the user attributes
- $v_prop['comment'] = $v_central_dir['comment'];
- $v_prop['nb'] = $v_central_dir['entries'];
- $v_prop['status'] = 'ok';
- }
-
- // ----- Magic quotes trick
- $this->privSwapBackMagicQuotes();
-
- // ----- Return
- return $v_prop;
- }
- // --------------------------------------------------------------------------------
-
- // --------------------------------------------------------------------------------
- // Function : duplicate()
- // Description :
- // This method creates an archive by copying the content of an other one. If
- // the archive already exist, it is replaced by the new one without any warning.
- // Parameters :
- // $p_archive : The filename of a valid archive, or
- // a valid PclZip object.
- // Return Values :
- // 1 on success.
- // 0 or a negative value on error (error code).
- // --------------------------------------------------------------------------------
- function duplicate($p_archive)
- {
- $v_result = 1;
-
- // ----- Reset the error handler
- $this->privErrorReset();
-
- // ----- Look if the $p_archive is a PclZip object
- if ((is_object($p_archive)) && (get_class($p_archive) == 'pclzip'))
- {
-
- // ----- Duplicate the archive
- $v_result = $this->privDuplicate($p_archive->zipname);
- }
-
- // ----- Look if the $p_archive is a string (so a filename)
- else if (is_string($p_archive))
- {
-
- // ----- Check that $p_archive is a valid zip file
- // TBC : Should also check the archive format
- if (!is_file($p_archive)) {
- // ----- Error log
- PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "No file with filename '".$p_archive."'");
- $v_result = PCLZIP_ERR_MISSING_FILE;
- }
- else {
- // ----- Duplicate the archive
- $v_result = $this->privDuplicate($p_archive);
- }
- }
-
- // ----- Invalid variable
- else
- {
- // ----- Error log
- PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add");
- $v_result = PCLZIP_ERR_INVALID_PARAMETER;
- }
-
- // ----- Return
- return $v_result;
- }
- // --------------------------------------------------------------------------------
-
- // --------------------------------------------------------------------------------
- // Function : merge()
- // Description :
- // This method merge the $p_archive_to_add archive at the end of the current
- // one ($this).
- // If the archive ($this) does not exist, the merge becomes a duplicate.
- // If the $p_archive_to_add archive does not exist, the merge is a success.
- // Parameters :
- // $p_archive_to_add : It can be directly the filename of a valid zip archive,
- // or a PclZip object archive.
- // Return Values :
- // 1 on success,
- // 0 or negative values on error (see below).
- // --------------------------------------------------------------------------------
- function merge($p_archive_to_add)
- {
- $v_result = 1;
-
- // ----- Reset the error handler
- $this->privErrorReset();
-
- // ----- Check archive
- if (!$this->privCheckFormat()) {
- return(0);
- }
-
- // ----- Look if the $p_archive_to_add is a PclZip object
- if ((is_object($p_archive_to_add)) && (get_class($p_archive_to_add) == 'pclzip'))
- {
-
- // ----- Merge the archive
- $v_result = $this->privMerge($p_archive_to_add);
- }
-
- // ----- Look if the $p_archive_to_add is a string (so a filename)
- else if (is_string($p_archive_to_add))
- {
-
- // ----- Create a temporary archive
- $v_object_archive = new PclZip($p_archive_to_add);
-
- // ----- Merge the archive
- $v_result = $this->privMerge($v_object_archive);
- }
-
- // ----- Invalid variable
- else
- {
- // ----- Error log
- PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add");
- $v_result = PCLZIP_ERR_INVALID_PARAMETER;
- }
-
- // ----- Return
- return $v_result;
- }
- // --------------------------------------------------------------------------------
-
-
-
- // --------------------------------------------------------------------------------
- // Function : errorCode()
- // Description :
- // Parameters :
- // --------------------------------------------------------------------------------
- function errorCode()
- {
- if (PCLZIP_ERROR_EXTERNAL == 1) {
- return(PclErrorCode());
- }
- else {
- return($this->error_code);
- }
- }
- // --------------------------------------------------------------------------------
-
- // --------------------------------------------------------------------------------
- // Function : errorName()
- // Description :
- // Parameters :
- // --------------------------------------------------------------------------------
- function errorName($p_with_code=false)
- {
- $v_name = array ( PCLZIP_ERR_NO_ERROR => 'PCLZIP_ERR_NO_ERROR',
- PCLZIP_ERR_WRITE_OPEN_FAIL => 'PCLZIP_ERR_WRITE_OPEN_FAIL',
- PCLZIP_ERR_READ_OPEN_FAIL => 'PCLZIP_ERR_READ_OPEN_FAIL',
- PCLZIP_ERR_INVALID_PARAMETER => 'PCLZIP_ERR_INVALID_PARAMETER',
- PCLZIP_ERR_MISSING_FILE => 'PCLZIP_ERR_MISSING_FILE',
- PCLZIP_ERR_FILENAME_TOO_LONG => 'PCLZIP_ERR_FILENAME_TOO_LONG',
- PCLZIP_ERR_INVALID_ZIP => 'PCLZIP_ERR_INVALID_ZIP',
- PCLZIP_ERR_BAD_EXTRACTED_FILE => 'PCLZIP_ERR_BAD_EXTRACTED_FILE',
- PCLZIP_ERR_DIR_CREATE_FAIL => 'PCLZIP_ERR_DIR_CREATE_FAIL',
- PCLZIP_ERR_BAD_EXTENSION => 'PCLZIP_ERR_BAD_EXTENSION',
- PCLZIP_ERR_BAD_FORMAT => 'PCLZIP_ERR_BAD_FORMAT',
- PCLZIP_ERR_DELETE_FILE_FAIL => 'PCLZIP_ERR_DELETE_FILE_FAIL',
- PCLZIP_ERR_RENAME_FILE_FAIL => 'PCLZIP_ERR_RENAME_FILE_FAIL',
- PCLZIP_ERR_BAD_CHECKSUM => 'PCLZIP_ERR_BAD_CHECKSUM',
- PCLZIP_ERR_INVALID_ARCHIVE_ZIP => 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP',
- PCLZIP_ERR_MISSING_OPTION_VALUE => 'PCLZIP_ERR_MISSING_OPTION_VALUE',
- PCLZIP_ERR_INVALID_OPTION_VALUE => 'PCLZIP_ERR_INVALID_OPTION_VALUE',
- PCLZIP_ERR_UNSUPPORTED_COMPRESSION => 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION',
- PCLZIP_ERR_UNSUPPORTED_ENCRYPTION => 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION'
- ,PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE => 'PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE'
- ,PCLZIP_ERR_DIRECTORY_RESTRICTION => 'PCLZIP_ERR_DIRECTORY_RESTRICTION'
- );
-
- if (isset($v_name[$this->error_code])) {
- $v_value = $v_name[$this->error_code];
- }
- else {
- $v_value = 'NoName';
- }
-
- if ($p_with_code) {
- return($v_value.' ('.$this->error_code.')');
- }
- else {
- return($v_value);
- }
- }
- // --------------------------------------------------------------------------------
-
- // --------------------------------------------------------------------------------
- // Function : errorInfo()
- // Description :
- // Parameters :
- // --------------------------------------------------------------------------------
- function errorInfo($p_full=false)
- {
- if (PCLZIP_ERROR_EXTERNAL == 1) {
- return(PclErrorString());
- }
- else {
- if ($p_full) {
- return($this->errorName(true)." : ".$this->error_string);
- }
- else {
- return($this->error_string." [code ".$this->error_code."]");
- }
- }
- }
- // --------------------------------------------------------------------------------
-
-
-// --------------------------------------------------------------------------------
-// ***** UNDER THIS LINE ARE DEFINED PRIVATE INTERNAL FUNCTIONS *****
-// ***** *****
-// ***** THESES FUNCTIONS MUST NOT BE USED DIRECTLY *****
-// --------------------------------------------------------------------------------
-
-
-
- // --------------------------------------------------------------------------------
- // Function : privCheckFormat()
- // Description :
- // This method check that the archive exists and is a valid zip archive.
- // Several level of check exists. (futur)
- // Parameters :
- // $p_level : Level of check. Default 0.
- // 0 : Check the first bytes (magic codes) (default value))
- // 1 : 0 + Check the central directory (futur)
- // 2 : 1 + Check each file header (futur)
- // Return Values :
- // true on success,
- // false on error, the error code is set.
- // --------------------------------------------------------------------------------
- function privCheckFormat($p_level=0)
- {
- $v_result = true;
-
- // ----- Reset the file system cache
- clearstatcache();
-
- // ----- Reset the error handler
- $this->privErrorReset();
-
- // ----- Look if the file exits
- if (!is_file($this->zipname)) {
- // ----- Error log
- PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "Missing archive file '".$this->zipname."'");
- return(false);
- }
-
- // ----- Check that the file is readeable
- if (!is_readable($this->zipname)) {
- // ----- Error log
- PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to read archive '".$this->zipname."'");
- return(false);
- }
-
- // ----- Check the magic code
- // TBC
-
- // ----- Check the central header
- // TBC
-
- // ----- Check each file header
- // TBC
-
- // ----- Return
- return $v_result;
- }
- // --------------------------------------------------------------------------------
-
- // --------------------------------------------------------------------------------
- // Function : privParseOptions()
- // Description :
- // This internal methods reads the variable list of arguments ($p_options_list,
- // $p_size) and generate an array with the options and values ($v_result_list).
- // $v_requested_options contains the options that can be present and those that
- // must be present.
- // $v_requested_options is an array, with the option value as key, and 'optional',
- // or 'mandatory' as value.
- // Parameters :
- // See above.
- // Return Values :
- // 1 on success.
- // 0 on failure.
- // --------------------------------------------------------------------------------
- function privParseOptions(&$p_options_list, $p_size, &$v_result_list, $v_requested_options=false)
- {
- $v_result=1;
-
- // ----- Read the options
- $i=0;
- while ($i<$p_size) {
-
- // ----- Check if the option is supported
- if (!isset($v_requested_options[$p_options_list[$i]])) {
- // ----- Error log
- PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid optional parameter '".$p_options_list[$i]."' for this method");
-
- // ----- Return
- return PclZip::errorCode();
- }
-
- // ----- Look for next option
- switch ($p_options_list[$i]) {
- // ----- Look for options that request a path value
- case PCLZIP_OPT_PATH :
- case PCLZIP_OPT_REMOVE_PATH :
- case PCLZIP_OPT_ADD_PATH :
- // ----- Check the number of parameters
- if (($i+1) >= $p_size) {
- // ----- Error log
- PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
-
- // ----- Return
- return PclZip::errorCode();
- }
-
- // ----- Get the value
- $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE);
- $i++;
- break;
-
- case PCLZIP_OPT_TEMP_FILE_THRESHOLD :
- // ----- Check the number of parameters
- if (($i+1) >= $p_size) {
- PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
- return PclZip::errorCode();
- }
-
- // ----- Check for incompatible options
- if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) {
- PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'");
- return PclZip::errorCode();
- }
-
- // ----- Check the value
- $v_value = $p_options_list[$i+1];
- if ((!is_integer($v_value)) || ($v_value<0)) {
- PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Integer expected for option '".PclZipUtilOptionText($p_options_list[$i])."'");
- return PclZip::errorCode();
- }
-
- // ----- Get the value (and convert it in bytes)
- $v_result_list[$p_options_list[$i]] = $v_value*1048576;
- $i++;
- break;
-
- case PCLZIP_OPT_TEMP_FILE_ON :
- // ----- Check for incompatible options
- if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) {
- PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'");
- return PclZip::errorCode();
- }
-
- $v_result_list[$p_options_list[$i]] = true;
- break;
-
- case PCLZIP_OPT_TEMP_FILE_OFF :
- // ----- Check for incompatible options
- if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_ON])) {
- PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_ON'");
- return PclZip::errorCode();
- }
- // ----- Check for incompatible options
- if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) {
- PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_THRESHOLD'");
- return PclZip::errorCode();
- }
-
- $v_result_list[$p_options_list[$i]] = true;
- break;
-
- case PCLZIP_OPT_EXTRACT_DIR_RESTRICTION :
- // ----- Check the number of parameters
- if (($i+1) >= $p_size) {
- // ----- Error log
- PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
-
- // ----- Return
- return PclZip::errorCode();
- }
-
- ...
[truncated message content] |
|
From: <os...@us...> - 2014-01-17 14:40:42
|
Revision: 5051
http://sourceforge.net/p/oscss/svn/5051
Author: oscim
Date: 2014-01-17 14:40:38 +0000 (Fri, 17 Jan 2014)
Log Message:
-----------
Fix link to image by attribute manager and last commit error reporting
Fix model in cli generator
Fix data xml in Backoffice template
Modified Paths:
--------------
trunk/catalog/admin/includes/template/defaut/data/icon_set.xml
trunk/catalog/admin/includes/template/oscss/data/icon_set.xml
trunk/dev/generator/datatype/Modele/catalog/admin/includes/modules/_DATATYPE_REPLACE_/_DATATYPE_REPLACE_SEOTAG__description.php
trunk/dev/generator/datatype/Modele/catalog/admin/includes/modules/_DATATYPE_REPLACE_/header_tags.php
trunk/dev/generator/datatype/Modele/catalog/admin/includes/modules/configuration/modextra_DATATYPE_REPLACE_.php
trunk/dev/generator/datatype/Modele/catalog/admin/includes/modules/pages/_DATATYPE_REPLACE_s.php
trunk/dev/generator/datatype/Modele/catalog/admin/includes/modules/rapport/rp__DATATYPE_REPLACE_.php
trunk/extensions/ATTRIBUTEMANAGER_stable/attributeManager/attributeManager.php
trunk/extensions/ATTRIBUTEMANAGER_stable/catalog/admin/includes/modules/products/attributeManager.php
Modified: trunk/catalog/admin/includes/template/defaut/data/icon_set.xml
===================================================================
--- trunk/catalog/admin/includes/template/defaut/data/icon_set.xml 2014-01-17 13:04:53 UTC (rev 5050)
+++ trunk/catalog/admin/includes/template/defaut/data/icon_set.xml 2014-01-17 14:40:38 UTC (rev 5051)
@@ -61,6 +61,22 @@
<package_config>icon_edit.png</package_config>
<package_is_zip>icon_edit.png</package_is_zip>
<package_is_folder>icon_edit.png</package_is_folder>
+
+ <at_icon_123>icon_123.png</at_icon_123>
+ <at_icon_abc>icon_abc.png</at_icon_abc>
+ <at_icon_rename>icon_rename.png</at_icon_rename>
+ <at_icon_plus>icon_plus.gif</at_icon_plus>
+ <at_icon_minus>icon_minus.gif</at_icon_minus>
+ <at_icon_add>icon_add.png</at_icon_add>
+ <at_icon_add_new>icon_add_new.png</at_icon_add_new>
+ <at_icon_disable>icon_disable.png</at_icon_disable>
+ <at_icon_up>icon_up.png</at_icon_up>
+ <at_icon_down>icon_down.png</at_icon_down>
+ <at_icon_down_edit>icon_down_edit.png</at_icon_down_edit>
+ <at_icon_down_delete>icon_down_delete.png</at_icon_down_delete>
+ <at_icon_arrow>icon_arrow.png</at_icon_arrow>
+ <at_icon_load>icon_load.png</at_icon_load>
+ <at_icon_save>icon_save.png</at_icon_save>
</icon>
</img>
Modified: trunk/catalog/admin/includes/template/oscss/data/icon_set.xml
===================================================================
--- trunk/catalog/admin/includes/template/oscss/data/icon_set.xml 2014-01-17 13:04:53 UTC (rev 5050)
+++ trunk/catalog/admin/includes/template/oscss/data/icon_set.xml 2014-01-17 14:40:38 UTC (rev 5051)
@@ -65,6 +65,22 @@
<package_config>icon_edit.png</package_config>
<package_is_zip>icon_edit.png</package_is_zip>
<package_is_folder>icon_edit.png</package_is_folder>
+
+ <at_icon_123>icon_123.png</at_icon_123>
+ <at_icon_abc>icon_abc.png</at_icon_abc>
+ <at_icon_rename>icon_rename.png</at_icon_rename>
+ <at_icon_plus>icon_plus.gif</at_icon_plus>
+ <at_icon_minus>icon_minus.gif</at_icon_minus>
+ <at_icon_add>icon_add.png</at_icon_add>
+ <at_icon_add_new>icon_add_new.png</at_icon_add_new>
+ <at_icon_disable>icon_disable.png</at_icon_disable>
+ <at_icon_up>icon_up.png</at_icon_up>
+ <at_icon_down>icon_down.png</at_icon_down>
+ <at_icon_down_edit>icon_down_edit.png</at_icon_down_edit>
+ <at_icon_down_delete>icon_down_delete.png</at_icon_down_delete>
+ <at_icon_arrow>icon_arrow.png</at_icon_arrow>
+ <at_icon_load>icon_load.png</at_icon_load>
+ <at_icon_save>icon_save.png</at_icon_save>
</icon>
</img>
Modified: trunk/dev/generator/datatype/Modele/catalog/admin/includes/modules/_DATATYPE_REPLACE_/_DATATYPE_REPLACE_SEOTAG__description.php
===================================================================
--- trunk/dev/generator/datatype/Modele/catalog/admin/includes/modules/_DATATYPE_REPLACE_/_DATATYPE_REPLACE_SEOTAG__description.php 2014-01-17 13:04:53 UTC (rev 5050)
+++ trunk/dev/generator/datatype/Modele/catalog/admin/includes/modules/_DATATYPE_REPLACE_/_DATATYPE_REPLACE_SEOTAG__description.php 2014-01-17 14:40:38 UTC (rev 5051)
@@ -145,6 +145,7 @@
/** Fonction complementaire utilisé dans la page produits */
+
/**
@remarks implements InterfaceModule depend
if module twin in backoffice, report all content install in the other module
@@ -159,16 +160,14 @@
@brief test if count all var , and keys is equal
@return boolean true/false
*/
- function check() { return false; }
+ function check() { return true; }
/**
@fn keys()
@return array all key configuration define by this module
*/
- function keys() {
- return array('MODULE__DATATYPE_REPLACE_MAJ_DESCRIPTION_SORT_ORDER');
- }
+ function keys() { return array('MODULE__DATATYPE_REPLACE_MAJ_DESCRIPTION_SORT_ORDER'); }
/**
@fn install()
@@ -182,7 +181,7 @@
var title MODULE_TOTO_ST_S (small description)
var description MODULE_TOTO_ST_L (long description)
*/
- function install() { return false; }
+ function install() { return true; }
/**
@fn remove()
@@ -191,6 +190,6 @@
- please, pefix all var configuration by 'MODULE_PAYMENT__MODTYPENAME_MAJ_'
- if module twin in backoffice, report all content remove in the other module
*/
- function remove() { return false; }
+ function remove() { return true; }
}
?>
\ No newline at end of file
Modified: trunk/dev/generator/datatype/Modele/catalog/admin/includes/modules/_DATATYPE_REPLACE_/header_tags.php
===================================================================
--- trunk/dev/generator/datatype/Modele/catalog/admin/includes/modules/_DATATYPE_REPLACE_/header_tags.php 2014-01-17 13:04:53 UTC (rev 5050)
+++ trunk/dev/generator/datatype/Modele/catalog/admin/includes/modules/_DATATYPE_REPLACE_/header_tags.php 2014-01-17 14:40:38 UTC (rev 5051)
@@ -112,13 +112,51 @@
$contents []=array('title'=> __('tab _DATATYPE_REPLACE_ meta'),'text'=>tep_get_include_contents(__CLASS__.'.form'));
}
-/** Force implements InterfaceModule class to define this method */
- public function check() { return true; }
- public function install() { return false; }
- public function remove() { return false; }
- public function keys() {
- return array( 'MODULE__DATATYPE_REPLACE_MAJ__HEADERTAGS_SORT_ORDER');
- }
+ /**
+ @remarks implements InterfaceModule depend
+ if module twin in backoffice, report all content install in the other module
+ public function check() {return true;}
+ public function install() {return true;}
+ public function remove() {return true;}
+ public function keys() {return array(); }
+ */
+
+ /**
+ @fn check()
+ @brief test if count all var , and keys is equal
+ @return boolean true/false
+ */
+ function check() { return true; }
+
+
+ /**
+ @fn keys()
+ @return array all key configuration define by this module
+ */
+ function keys() { return array('MODULE__DATATYPE_REPLACE_MAJ__HEADERTAGS_SORT_ORDER'); }
+
+ /**
+ @fn install()
+ @brief add all configuration
+ @note
+ - Modules can emarquer sql installation instructions, however, in the case of transverse information, or dependent of an extension, preferring the implementation of an extension, file with sql independent
+ - please, pefix all var configuration by 'MODULE_OT__MODTYPENAME_MAJ_'
+ - if module twin in backoffice, report all content install in the other module
+ - Not use language in DB , but function :__()
+ for MODULE_TOTO_ST
+ var title MODULE_TOTO_ST_S (small description)
+ var description MODULE_TOTO_ST_L (long description)
+ */
+ function install() { return true; }
+
+ /**
+ @fn remove()
+ @brief delete all configuration
+ @note
+ - please, pefix all var configuration by 'MODULE_PAYMENT__MODTYPENAME_MAJ_'
+ - if module twin in backoffice, report all content remove in the other module
+ */
+ function remove() { return true; }
}
?>
\ No newline at end of file
Modified: trunk/dev/generator/datatype/Modele/catalog/admin/includes/modules/configuration/modextra_DATATYPE_REPLACE_.php
===================================================================
--- trunk/dev/generator/datatype/Modele/catalog/admin/includes/modules/configuration/modextra_DATATYPE_REPLACE_.php 2014-01-17 13:04:53 UTC (rev 5050)
+++ trunk/dev/generator/datatype/Modele/catalog/admin/includes/modules/configuration/modextra_DATATYPE_REPLACE_.php 2014-01-17 14:40:38 UTC (rev 5051)
@@ -11,7 +11,6 @@
@brief Champs supplementaire
*/
-define('FILENAME_CFG',"gparentID=120&gID=".$_GET['gID']);
Class modextra_DATATYPE_REPLACE_{
const FILENAME = FILENAME_CONFIGURATION;
@@ -49,6 +48,9 @@
function __construct(){
$this->code=__CLASS__;
+ if(!defined('FILENAME_CFG'))
+ define('FILENAME_CFG',"gparentID=".$_GET['gparentID']."&gID=".$_GET['gID']);
+
global $messageStack, $language ,$oscss;
$oscss=oscss_cstr::getInstance();
@@ -82,11 +84,11 @@
self::$InitInfo['tfilter']['listing']=array(
array(
'title'=>__('@modprodextra filter tab clause'),
- '_DATATYPE_REPLACE_'=>tep_get_include__DATATYPE_REPLACE_s('MGabCont/filter.language'),
+ '_DATATYPE_REPLACE_'=>tep_get_include_contents('MGabCont/filter.language'),
),
// array(
// 'title'=>__('@products filter tab clause'),
-// '_DATATYPE_REPLACE_'=>tep_get_include__DATATYPE_REPLACE_s('configuration/'.__CLASS__.'/filter.clause'),
+// '_DATATYPE_REPLACE_'=>tep_get_include_contents('configuration/'.__CLASS__.'/filter.clause'),
// ),
);
}
Modified: trunk/dev/generator/datatype/Modele/catalog/admin/includes/modules/pages/_DATATYPE_REPLACE_s.php
===================================================================
--- trunk/dev/generator/datatype/Modele/catalog/admin/includes/modules/pages/_DATATYPE_REPLACE_s.php 2014-01-17 13:04:53 UTC (rev 5050)
+++ trunk/dev/generator/datatype/Modele/catalog/admin/includes/modules/pages/_DATATYPE_REPLACE_s.php 2014-01-17 14:40:38 UTC (rev 5051)
@@ -681,41 +681,8 @@
- /**
- @fn tep_get_list($page=1,$rowbyp=10,$sOrder='',$sWhere='',$options='')
- @brief Constructeur listing element cms _DATATYPE_REPLACE_
- @param $page integer default(1) split page
- @param $rowbyp integer default(10) nbr line in page
- @param $sOrder string | null
- @param $sWhere string | null
- @param $options array
- @return Array
- */
- public static function tep_get_list($page=1,$rowbyp=10,$sOrder='',$sWhere='',$options=''){
- global $query_numrows;
- /// @remarks force load conf
- self::GetConf();
- $res=array();
-
- /**
- @remarks adjust param for sql requete
- */
- self::$InitInfo['adjust']['page']=$page;
- self::$InitInfo['adjust']['rowbyp']=$rowbyp;
- self::$InitInfo['adjust']['sOrder']=$sOrder;
- self::$InitInfo['adjust']['sWhere']=$sWhere;
- self::$InitInfo['adjust']['options']=$options;
-
- $res = self::GetDBValue();
-
- self::$list= $query_numrows ; //= count($res);
-
- return $res;
- }
-
-
/** public static InterfacedTJsonS */
/**
@@ -894,14 +861,14 @@
@brief test if count all var , and keys is equal
@return boolean true/false
*/
- function check() { return false; }
+ function check() { return true; }
/**
@fn keys()
@return array all key configuration define by this module
*/
- function keys() { return false; }
+ function keys() { return array(); }
/**
@fn install()
@@ -915,7 +882,7 @@
var title MODULE_TOTO_ST_S (small description)
var description MODULE_TOTO_ST_L (long description)
*/
- function install() { return false; }
+ function install() { return true; }
/**
@fn remove()
@@ -924,7 +891,7 @@
- please, pefix all var configuration by 'MODULE_PAYMENT__MODTYPENAME_MAJ_'
- if module twin in backoffice, report all content remove in the other module
*/
- function remove() { return false; }
+ function remove() { return true; }
}
?>
\ No newline at end of file
Modified: trunk/dev/generator/datatype/Modele/catalog/admin/includes/modules/rapport/rp__DATATYPE_REPLACE_.php
===================================================================
--- trunk/dev/generator/datatype/Modele/catalog/admin/includes/modules/rapport/rp__DATATYPE_REPLACE_.php 2014-01-17 13:04:53 UTC (rev 5050)
+++ trunk/dev/generator/datatype/Modele/catalog/admin/includes/modules/rapport/rp__DATATYPE_REPLACE_.php 2014-01-17 14:40:38 UTC (rev 5051)
@@ -128,9 +128,10 @@
- /**
- @remarks implements InterfaceModule depend
- if module twin in backoffice, report all content install in the other module
+
+ /**
+ @remarks implements InterfaceModule depend
+ if module twin in backoffice, report all content install in the other module
public function check() {return true;}
public function install() {return true;}
public function remove() {return true;}
@@ -139,41 +140,39 @@
/**
@fn check()
- @brief test if count all var , and keys is equal
+ @brief test if count all var , and keys is equal
@return boolean true/false
*/
- function check() { return false; }
+ function check() { return true; }
/**
@fn keys()
- @return array all key configuration define by this module
+ @return array all key configuration define by this module
*/
- function keys() {
- return array('MODULE_PRODUCTS_VIEWEDDESCRIPTION_SORT_ORDER');
- }
+ function keys() { return array('MODULE_PRODUCTS_VIEWEDDESCRIPTION_SORT_ORDER'); }
/**
@fn install()
- @brief add all configuration
- @note
+ @brief add all configuration
+ @note
- Modules can emarquer sql installation instructions, however, in the case of transverse information, or dependent of an extension, preferring the implementation of an extension, file with sql independent
- please, pefix all var configuration by 'MODULE_OT__MODTYPENAME_MAJ_'
- if module twin in backoffice, report all content install in the other module
- - Not use language in DB , but function :__()
- for MODULE_TOTO_ST
+ - Not use language in DB , but function :__()
+ for MODULE_TOTO_ST
var title MODULE_TOTO_ST_S (small description)
var description MODULE_TOTO_ST_L (long description)
*/
- function install() { return false; }
+ function install() { return true; }
/**
@fn remove()
@brief delete all configuration
- @note
+ @note
- please, pefix all var configuration by 'MODULE_PAYMENT__MODTYPENAME_MAJ_'
- - if module twin in backoffice, report all content remove in the other module
+ - if module twin in backoffice, report all content remove in the other module
*/
- function remove() { return false; }
+ function remove() { return true; }
}
?>
\ No newline at end of file
Modified: trunk/extensions/ATTRIBUTEMANAGER_stable/attributeManager/attributeManager.php
===================================================================
--- trunk/extensions/ATTRIBUTEMANAGER_stable/attributeManager/attributeManager.php 2014-01-17 13:04:53 UTC (rev 5050)
+++ trunk/extensions/ATTRIBUTEMANAGER_stable/attributeManager/attributeManager.php 2014-01-17 14:40:38 UTC (rev 5051)
@@ -107,18 +107,18 @@
<td align="right">
<?php if(false !== AM_USE_TEMPLATES) { ?>
<div style="padding:5px 3px 5px 0px">
- <input type="image" <?php if($attributeManager->getTemplateOrder()=='123'){echo 'style="border:1px solid #DDDDDD;"';} ?> src="<?php echo DIR_WS_ICONS ?>icon_123.png" onclick="return amTemplateOrder('123');" border="0" title="" />
- <input type="image" <?php if($attributeManager->getTemplateOrder()=='abc'){echo 'style="border:1px solid #DDDDDD;"';} ?> src="<?php echo DIR_WS_ICONS ?>icon_abc.png" onclick="return amTemplateOrder('abc');" border="0" title="" />
+ <input type="image" <?php if($attributeManager->getTemplateOrder()=='123'){echo 'style="border:1px solid #DDDDDD;"';} ?> src="<?php echo DIR_WS_ADMIN . CsrtAction::getFullPathIcon('at_icon_123'); ?>" onclick="return amTemplateOrder('123');" border="0" title="123" />
+ <input type="image" <?php if($attributeManager->getTemplateOrder()=='abc'){echo 'style="border:1px solid #DDDDDD;"';} ?> src="<?php echo DIR_WS_ADMIN .CsrtAction::getFullPathIcon('at_icon_abc') ?>icon_abc.png" onclick="return amTemplateOrder('abc');" border="0" title="abc" />
<?php echo tep_draw_pull_down_menu('template_drop',$attributeManager->buildAllTemplatesDropDown($attributeManager->getTemplateOrder()),(0 == $selectedTemplate) ? '0' : $selectedTemplate,'id="template_drop" style="margin-bottom:3px"'); ?>
- <input type="image" src="<?php echo DIR_WS_ICONS ?>icon_load.png" onclick="return customTemplatePrompt('loadTemplate');" border="0" title="<?php echo AM_AJAX_LOADS_SELECTED_TEMPLATE; ?>" />
+ <input type="image" src="<?php echo DIR_WS_ADMIN .CsrtAction::getFullPathIcon('at_icon_load') ?>" onclick="return customTemplatePrompt('loadTemplate');" border="0" title="<?php echo AM_AJAX_LOADS_SELECTED_TEMPLATE; ?>" />
- <input type="image" src="<?php echo DIR_WS_ICONS ?>icon_save.png" onclick="return customPrompt('saveTemplate');" border="0" title="<?php echo AM_AJAX_SAVES_ATTRIBUTES_AS_A_NEW_TEMPLATE; ?>" />
+ <input type="image" src="<?php echo DIR_WS_ADMIN .CsrtAction::getFullPathIcon('at_icon_save') ?>" onclick="return customPrompt('saveTemplate');" border="0" title="<?php echo AM_AJAX_SAVES_ATTRIBUTES_AS_A_NEW_TEMPLATE; ?>" />
-<!-- <input type="image" src="<?php echo DIR_WS_ICONS ?>icon_rename.png" onclick="return customTemplatePrompt('renameTemplate');" border="0" title="<?php echo AM_AJAX_RENAMES_THE_SELECTED_TEMPLATE; ?>" />
+<!-- <input type="image" src="<?php echo DIR_WS_ADMIN .CsrtAction::getFullPathIcon('at_icon_rename') ?>" onclick="return customTemplatePrompt('renameTemplate');" border="0" title="<?php echo AM_AJAX_RENAMES_THE_SELECTED_TEMPLATE; ?>" />
-->
-<!-- <input type="image" src="<?php echo DIR_WS_ICONS ?>icon_disable.png" onclick="return customTemplatePrompt('deleteTemplate');" border="0" title="<?php echo AM_AJAX_DELETES_THE_SELECTED_TEMPLATE; ?>" />
+<!-- <input type="image" src="<?php echo DIR_WS_ADMIN .CsrtAction::getFullPathIcon('at_icon_disable') ?>" onclick="return customTemplatePrompt('deleteTemplate');" border="0" title="<?php echo AM_AJAX_DELETES_THE_SELECTED_TEMPLATE; ?>" />
-->
</div>
<?php } ?>
@@ -141,9 +141,9 @@
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr class="header">
<td width="50" align="center">
- <input type="image" src="<?php echo DIR_WS_ICONS ?>icon_plus.gif" onclick="return amShowHideAllOptionValues([<?php echo implode(',',array_keys($allProductOptionsAndValues));?>],true);" border="0" />
+ <input type="image" src="<?php echo DIR_WS_ADMIN .CsrtAction::getFullPathIcon('at_icon_plus') ?>" onclick="return amShowHideAllOptionValues([<?php echo implode(',',array_keys($allProductOptionsAndValues));?>],true);" border="0" />
- <input type="image" src="<?php echo DIR_WS_ICONS ?>icon_minus.gif" onclick="return amShowHideAllOptionValues([<?php echo implode(',',array_keys($allProductOptionsAndValues));?>],false);" border="0" />
+ <input type="image" src="<?php echo DIR_WS_ADMIN .CsrtAction::getFullPathIcon('at_icon_minus') ?>" onclick="return amShowHideAllOptionValues([<?php echo implode(',',array_keys($allProductOptionsAndValues));?>],false);" border="0" />
</td>
<td>
<?php echo AM_AJAX_NAME; ?>
@@ -163,26 +163,26 @@
$numValues = count($optionInfo['values']); ?>
<tr class="option">
<td align="center">
- <input type="image" border="0" id="show_hide_<?php echo $optionId; ?>" src="<?php echo DIR_WS_ICONS ?>icon_plus.gif" onclick="return amShowHideOptionsValues(<?php echo $optionId; ?>);" />
+ <input type="image" border="0" id="show_hide_<?php echo $optionId; ?>" src="<?php echo DIR_WS_ADMIN .CsrtAction::getFullPathIcon('at_icon_plus') ?>" onclick="return amShowHideOptionsValues(<?php echo $optionId; ?>);" />
</td>
<td>
<?php echo "{$optionInfo['name']} ($numValues) type:".translate_type_to_name($optionInfo['type']);?>
</td>
<td align="right">
- <?php echo tep_draw_pull_down_menu("new_option_value_$optionId",$attributeManager->buildOptionValueDropDown($optionId),$selectedOptionValue,'style="margin:0px;" id="new_option_value_'.$optionId.'"')?>
- <input type="image" src="<?php echo DIR_WS_ICONS ?>icon_add.png" value="Add" border="0" onclick="return amAddOptionValueToProduct('<?php echo $optionId?>');" title="<?php echo htmlspecialchars(sprintf(AM_AJAX_ADDS_ATTRIBUTE_TO_OPTION, $optionInfo['name'])); ?>" />
+ <?php echo tep_draw_pull_down_menu("new_option_value_$optionId",$attributeManager->buildOptionValueDropDown($optionId),$selectedOptionValue,'style="margin:3px 0px 3px 0px;" id="new_option_value_'.$optionId.'"')?>
+ <input type="image" src="<?php echo DIR_WS_ADMIN .CsrtAction::getFullPathIcon('at_icon_add') ?>" value="Add" border="0" onclick="return amAddOptionValueToProduct('<?php echo $optionId?>');" title="<?php echo htmlspecialchars(sprintf(AM_AJAX_ADDS_ATTRIBUTE_TO_OPTION, $optionInfo['name'])); ?>" />
- <input type="image" title="<?php echo htmlspecialchars(sprintf(AM_AJAX_ADDS_NEW_VALUE_TO_OPTION,$optionInfo['name'])) ?>" border="0" src="<?php echo DIR_WS_ICONS ?>icon_add_new.png" onclick="return customPrompt('amAddNewOptionValueToProduct','<?php echo addslashes("option_id:$optionId|option_name:".str_replace('"','"',$optionInfo['name']))?>');" />
+ <input type="image" title="<?php echo htmlspecialchars(sprintf(AM_AJAX_ADDS_NEW_VALUE_TO_OPTION,$optionInfo['name'])) ?>" border="0" src="<?php echo DIR_WS_ADMIN .CsrtAction::getFullPathIcon('at_icon_add_new') ?>" onclick="return customPrompt('amAddNewOptionValueToProduct','<?php echo addslashes("option_id:$optionId|option_name:".str_replace('"','"',$optionInfo['name']))?>');" />
<?php if(false){ ?>
-<!-- <input type="image" src="<?php echo DIR_WS_ICONS ?>icon_rename.png" onclick="return customTemplatePrompt('renameTemplate');" border="0" title="Renames the selected template" />-->
+<!-- <input type="image" src="<?php echo DIR_WS_ADMIN .CsrtAction::getFullPathIcon('at_icon_rename') ?>" onclick="return customTemplatePrompt('renameTemplate');" border="0" title="Renames the selected template" />-->
<?php } ?>
- <input type="image" border="0" onclick="return customPrompt('amRemoveOptionFromProduct','<?php echo addslashes("option_id:$optionId|option_name:".str_replace('"','"',$optionInfo['name']))?>');" src="<?php echo DIR_WS_ICONS ?>icon_disable.png" title="<?php echo htmlspecialchars(addslashes(sprintf(AM_AJAX_PRODUCT_REMOVES_OPTION_AND_ITS_VALUES,$optionInfo['name'],$numValues))) ?>" />
+ <input type="image" border="0" onclick="return customPrompt('amRemoveOptionFromProduct','<?php echo addslashes("option_id:$optionId|option_name:".str_replace('"','"',$optionInfo['name']))?>');" src="<?php echo DIR_WS_ADMIN .CsrtAction::getFullPathIcon('at_icon_disable') ?>" title="<?php echo htmlspecialchars(addslashes(sprintf(AM_AJAX_PRODUCT_REMOVES_OPTION_AND_ITS_VALUES,$optionInfo['name'],$numValues))) ?>" />
<?php if(AM_USE_SORT_ORDER) { ?>
- <input type="image" onclick="return amMoveOption('<?php echo 'option_id:'.$optionId ; ?>', 'up');" src="<?php echo DIR_WS_ICONS ?>icon_up.png" title="Moves option up" />
- <input type="image" onclick="return amMoveOption('<?php echo 'option_id:'.$optionId ; ?>', 'down');" src="<?php echo DIR_WS_ICONS ?>icon_down.png" title="Moves option down" />
+ <input type="image" onclick="return amMoveOption('<?php echo 'option_id:'.$optionId ; ?>', 'up');" src="<?php echo DIR_WS_ADMIN .CsrtAction::getFullPathIcon('at_icon_up') ?>" title="Moves option up" />
+ <input type="image" onclick="return amMoveOption('<?php echo 'option_id:'.$optionId ; ?>', 'down');" src="<?php echo DIR_WS_ADMIN .CsrtAction::getFullPathIcon('at_icon_down') ?>" title="Moves option down" />
<?php } ?>
</td>
</tr>
@@ -215,7 +215,7 @@
<span class="inlineblock" style="width:95px">
<?php echo ADJUST_PRICE ?>
</span>
-
+
<span class="inlineblock" style="width:25px"></span>
</td>
</tr>
@@ -227,10 +227,10 @@
<?php /** URL IMAGES Pour remplacement texte option */ ?>
<?php if(AM_USE_COLOR && $optionInfo['img_supp'] ) { ?>
<?php if($optionValueInfo['thumb'] !=''){ ?>
- <input type="image" border="0" onclick="return customPrompt('amEditthumbForProduct','<?php echo addslashes('option_id:' . $optionId . '|products_attributes_thumb:' . $optionValueInfo['thumb'] . '|option_value_name:'.str_replace('"','"',$optionValueInfo['name'] .'|option_value_id:'.$optionValueId))?>');" src="<?php echo DIR_WS_ICONS ?>icon_down_edit.png" title="<?php echo htmlspecialchars(sprintf(AM_AJAX_COLOR_EDIT,$optionValueInfo['name'],$optionInfo['name'])) ?>" />
- <input type="image" border="0" onclick="return customPrompt('amDeletethumbForProduct','<?php echo addslashes('option_id:' . $optionId . '|option_value_name:'.str_replace('"','"',$optionValueInfo['name']) .'|option_value_id:'.$optionValueId)?>');" src="<?php echo DIR_WS_ICONS ?>icon_down_delete.png" title="<?php echo htmlspecialchars(sprintf(AM_AJAX_COLOR_DELETE,$optionValueInfo['name'],$optionInfo['name'])) ?>" />
+ <input type="image" border="0" onclick="return customPrompt('amEditthumbForProduct','<?php echo addslashes('option_id:' . $optionId . '|products_attributes_thumb:' . $optionValueInfo['thumb'] . '|option_value_name:'.str_replace('"','"',$optionValueInfo['name'] .'|option_value_id:'.$optionValueId))?>');" src="<?php echo DIR_WS_ADMIN .CsrtAction::getFullPathIcon('at_icon_down_edit'); ?>" title="<?php echo htmlspecialchars(sprintf(AM_AJAX_COLOR_EDIT,$optionValueInfo['name'],$optionInfo['name'])) ?>" />
+ <input type="image" border="0" onclick="return customPrompt('amDeletethumbForProduct','<?php echo addslashes('option_id:' . $optionId . '|option_value_name:'.str_replace('"','"',$optionValueInfo['name']) .'|option_value_id:'.$optionValueId)?>');" src="<?php echo DIR_WS_ADMIN .CsrtAction::getFullPathIcon('at_icon_down_delete') ?>" title="<?php echo htmlspecialchars(sprintf(AM_AJAX_COLOR_DELETE,$optionValueInfo['name'],$optionInfo['name'])) ?>" />
<?php } else { ?>
- <input type="image" border="0" onclick="return customPrompt('amAddNewthumbForProduct','<?php echo addslashes('option_id:' . $optionId .'|option_value_id:'.$optionValueId . '|option_value_name:'.str_replace('"','"',$optionValueInfo['name']).'|option_value_id:'.$optionValueId)?>');" src="<?php echo DIR_WS_ICONS ?>icon_download.png" title="<?php echo htmlspecialchars(sprintf(AM_AJAX_COLOR_ADD_NEW,$optionValueInfo['name'],$optionInfo['name'])) ?>" />
+ <input type="image" border="0" onclick="return customPrompt('amAddNewthumbForProduct','<?php echo addslashes('option_id:' . $optionId .'|option_value_id:'.$optionValueId . '|option_value_name:'.str_replace('"','"',$optionValueInfo['name']).'|option_value_id:'.$optionValueId)?>');" src="<?php echo DIR_WS_ADMIN .CsrtAction::getFullPathIcon('at_icon_download'); ?>" title="<?php echo htmlspecialchars(sprintf(AM_AJAX_COLOR_ADD_NEW,$optionValueInfo['name'],$optionInfo['name'])) ?>" />
<?php } ?>
<?php } ?>
<?php echo $optionValueInfo['name']; ?>
@@ -241,10 +241,10 @@
<span class="inlineblock" style="top:0;">
<span class="button img col">
<?php if($optionValueInfo['urlimg'] !=''){ /** URL IMAGES */ ?>
- <input type="image" border="0" onclick="return customPrompt('amEditurlimgForProduct','<?php echo addslashes('option_id:' . $optionId . '|products_attributes_urlimg:' . $optionValueInfo['urlimg'] . '|option_value_name:'.str_replace('"','"',$optionValueInfo['name'] .'|products_attributes_id:'.$optionValueInfo['products_attributes_id']))?>');" src="<?php echo DIR_WS_ICONS ?>icon_down_edit.png" title="<?php echo htmlspecialchars(sprintf(AM_AJAX_URLIMG_EDIT,$optionValueInfo['name'],$optionInfo['name'])) ?>" />
- <input type="image" border="0" onclick="return customPrompt('amDeleteurlimgForProduct','<?php echo addslashes('option_id:' . $optionId . '|option_value_name:'.str_replace('"','"',$optionValueInfo['name']) .'|products_attributes_id:'.$optionValueInfo['products_attributes_id'])?>');" src="<?php echo DIR_WS_ICONS ?>icon_down_delete.png" title="<?php echo htmlspecialchars(sprintf(AM_AJAX_URLIMG_DELETE,$optionValueInfo['name'],$optionInfo['name'])) ?>" style="margin-right: 30px;" />
+ <input type="image" border="0" onclick="return customPrompt('amEditurlimgForProduct','<?php echo addslashes('option_id:' . $optionId . '|products_attributes_urlimg:' . $optionValueInfo['urlimg'] . '|option_value_name:'.str_replace('"','"',$optionValueInfo['name'] .'|products_attributes_id:'.$optionValueInfo['products_attributes_id']))?>');" src="<?php echo DIR_WS_ADMIN .CsrtAction::getFullPathIcon('at_icon_down_edit'); ?>" title="<?php echo htmlspecialchars(sprintf(AM_AJAX_URLIMG_EDIT,$optionValueInfo['name'],$optionInfo['name'])) ?>" />
+ <input type="image" border="0" onclick="return customPrompt('amDeleteurlimgForProduct','<?php echo addslashes('option_id:' . $optionId . '|option_value_name:'.str_replace('"','"',$optionValueInfo['name']) .'|products_attributes_id:'.$optionValueInfo['products_attributes_id'])?>');" src="<?php echo DIR_WS_ADMIN .CsrtAction::getFullPathIcon('at_icon_down_delete'); ?>" title="<?php echo htmlspecialchars(sprintf(AM_AJAX_URLIMG_DELETE,$optionValueInfo['name'],$optionInfo['name'])) ?>" style="margin-right: 30px;" />
<?php } else { ?>
- <input type="image" border="0" onclick="return customPrompt('amAddNewurlimgForProduct','<?php echo addslashes('option_id:' . $optionId .'|option_value_id:'.$optionValueId . '|option_value_name:'.str_replace('"','"',$optionValueInfo['name']).'|products_attributes_id:'.$optionValueInfo['products_attributes_id'])?>');" src="<?php echo DIR_WS_ICONS ?>icon_download.png" title="<?php echo htmlspecialchars(sprintf(AM_AJAX_URLIMG_ADD_NEW,$optionValueInfo['name'],$optionInfo['name'])) ?>" style="margin-right: 30px;" />
+ <input type="image" border="0" onclick="return customPrompt('amAddNewurlimgForProduct','<?php echo addslashes('option_id:' . $optionId .'|option_value_id:'.$optionValueId . '|option_value_name:'.str_replace('"','"',$optionValueInfo['name']).'|products_attributes_id:'.$optionValueInfo['products_attributes_id'])?>');" src="<?php echo DIR_WS_ADMIN .CsrtAction::getFullPathIcon('at_icon_download'); ?>" title="<?php echo htmlspecialchars(sprintf(AM_AJAX_URLIMG_ADD_NEW,$optionValueInfo['name'],$optionInfo['name'])) ?>" style="margin-right: 30px;" />
<?php } ?>
</span>
</span>
@@ -253,32 +253,32 @@
<?php if(AM_USE_DOWNLOAD): ?>
<span class="inlineblock">
<?php if($optionValueInfo['products_attributes_filename']){ /** DOWNLOAD*/ ?>
- <input type="image" border="0" onclick="return customPrompt('amEditDownloadForProduct','<?php echo addslashes('option_id:' . $optionId . '|products_attributes_filename:' . $optionValueInfo['products_attributes_filename'] . '|products_attributes_maxdays:'.$optionValueInfo['products_attributes_maxdays'] . '|products_attributes_maxcount:'.$optionValueInfo['products_attributes_maxcount'] .'|option_value_name:'.str_replace('"','"',$optionValueInfo['name'] .'|products_attributes_id:'.$optionValueInfo['products_attributes_id']))?>');" src="<?php echo DIR_WS_ICONS ?>icon_down_edit.png" title="<?php echo htmlspecialchars(sprintf(AM_AJAX_DOWLNOAD_EDIT,$optionValueInfo['name'],$optionInfo['name'])) ?>" />
- <input type="image" border="0" onclick="return customPrompt('amDeleteDownloadForProduct','<?php echo addslashes('option_id:' . $optionId . '|option_value_name:'.str_replace('"','"',$optionValueInfo['name']) .'|products_attributes_id:'.$optionValueInfo['products_attributes_id'])?>');" src="<?php echo DIR_WS_ICONS ?>icon_down_delete.png" title="<?php echo htmlspecialchars(sprintf(AM_AJAX_DOWLNOAD_DELETE,$optionValueInfo['name'],$optionInfo['name'])) ?>" style="margin-right: 30px;" />
+ <input type="image" border="0" onclick="return customPrompt('amEditDownloadForProduct','<?php echo addslashes('option_id:' . $optionId . '|products_attributes_filename:' . $optionValueInfo['products_attributes_filename'] . '|products_attributes_maxdays:'.$optionValueInfo['products_attributes_maxdays'] . '|products_attributes_maxcount:'.$optionValueInfo['products_attributes_maxcount'] .'|option_value_name:'.str_replace('"','"',$optionValueInfo['name'] .'|products_attributes_id:'.$optionValueInfo['products_attributes_id']))?>');" src="<?php echo DIR_WS_ADMIN .CsrtAction::getFullPathIcon('at_icon_down_edit'); ?>" title="<?php echo htmlspecialchars(sprintf(AM_AJAX_DOWLNOAD_EDIT,$optionValueInfo['name'],$optionInfo['name'])) ?>" />
+ <input type="image" border="0" onclick="return customPrompt('amDeleteDownloadForProduct','<?php echo addslashes('option_id:' . $optionId . '|option_value_name:'.str_replace('"','"',$optionValueInfo['name']) .'|products_attributes_id:'.$optionValueInfo['products_attributes_id'])?>');" src="<?php echo DIR_WS_ADMIN .CsrtAction::getFullPathIcon('at_icon_down_delete') ?>" title="<?php echo htmlspecialchars(sprintf(AM_AJAX_DOWLNOAD_DELETE,$optionValueInfo['name'],$optionInfo['name'])) ?>" style="margin-right: 30px;" />
<?php } else { ?>
- <input type="image" border="0" onclick="return customPrompt('amAddNewDownloadForProduct','<?php echo addslashes('option_id:' . $optionId .'|option_value_id:'.$optionValueId . '|option_value_name:'.str_replace('"','"',$optionValueInfo['name']).'|products_attributes_id:'.$optionValueInfo['products_attributes_id'])?>');" src="<?php echo DIR_WS_ICONS ?>icon_download.png" title="<?php echo htmlspecialchars(sprintf(AM_AJAX_DOWLNOAD_ADD_NEW,$optionValueInfo['name'],$optionInfo['name'])) ?>" style="margin-right: 30px;" />
+ <input type="image" border="0" onclick="return customPrompt('amAddNewDownloadForProduct','<?php echo addslashes('option_id:' . $optionId .'|option_value_id:'.$optionValueId . '|option_value_name:'.str_replace('"','"',$optionValueInfo['name']).'|products_attributes_id:'.$optionValueInfo['products_attributes_id'])?>');" src="<?php echo DIR_WS_ADMIN .CsrtAction::getFullPathIcon('at_icon_download') ?>" title="<?php echo htmlspecialchars(sprintf(AM_AJAX_DOWLNOAD_ADD_NEW,$optionValueInfo['name'],$optionInfo['name'])) ?>" style="margin-right: 30px;" />
<?php } ?>
</span>
<?php endif; ?>
<?php /** Weight */ ?>
<?php if(!in_array($TypeProduct, explode(',', TYPE_VIRTUAL_PRODUCTS))) { ?>
<span class="inlineblock" style="width:80px">
- <?php echo tep_draw_input_field("weight_$optionValueId",'',$optionValueInfo['weight'],' style="margin:0px;" size="7" onfocus="amF(this)" onblur="amB(this)" onchange="return amUpdateWeight(\''.$optionId.'\',\''.$optionValueId.'\',\'weight\');"'); ?>
+ <?php echo tep_draw_input_field("weight_$optionValueId",'',$optionValueInfo['weight'],' style="margin:3px 0px 3px 0px;" size="7" onfocus="amF(this)" onblur="amB(this)" onchange="return amUpdateWeight(\''.$optionId.'\',\''.$optionValueId.'\',\'weight\');"'); ?>
</span>
<?php } ?>
<?php /** Price */ ?>
<span class="inlineblock" style="width:95px">
- <?php echo drawDropDownPrefix('id="prefix_'.$optionValueId.'" style="margin:0px;" onchange="return amUpdate(\''.$optionId.'\',\''.$optionValueId.'\',\'prefix\');"',$optionValueInfo['prefix']);?><?php echo tep_draw_input_field("price_$optionValueId",'',$optionValueInfo['price'],' style="margin:0px;" size="7" onfocus="amF(this)" onblur="amB(this)" onchange="return amUpdate(\''.$optionId.'\',\''.$optionValueId.'\',\'price\');"'); ?>
+ <?php echo drawDropDownPrefix('id="prefix_'.$optionValueId.'" style="margin:3px 0px 3px 0px;" onchange="return amUpdate(\''.$optionId.'\',\''.$optionValueId.'\',\'prefix\');"',$optionValueInfo['prefix']);?><?php echo tep_draw_input_field("price_$optionValueId",'',$optionValueInfo['price'],' style="margin:3px 0px 3px 0px;" size="7" onfocus="amF(this)" onblur="amB(this)" onchange="return amUpdate(\''.$optionId.'\',\''.$optionValueId.'\',\'price\');"'); ?>
</span>
<?php /** Remove */ ?>
<span class="button img col">
- <input type="image" border="0" onclick="return customPrompt('amRemoveOptionValueFromProduct','<?php echo addslashes("option_id:$optionId|option_value_id:$optionValueId|option_value_name:".str_replace('"','"',$optionValueInfo['name']))?>');" src="<?php echo DIR_WS_ICONS ?>icon_disable.png" title="<?php echo htmlspecialchars(sprintf(AM_AJAX_PRODUCT_REMOVES_VALUE_FROM_OPTION,$optionValueInfo['name'],$optionInfo['name'])) ?>" />
+ <input type="image" border="0" onclick="return customPrompt('amRemoveOptionValueFromProduct','<?php echo addslashes("option_id:$optionId|option_value_id:$optionValueId|option_value_name:".str_replace('"','"',$optionValueInfo['name']))?>');" src="<?php echo DIR_WS_ADMIN .CsrtAction::getFullPathIcon('at_icon_disable'); ?>" title="<?php echo htmlspecialchars(sprintf(AM_AJAX_PRODUCT_REMOVES_VALUE_FROM_OPTION,$optionValueInfo['name'],$optionInfo['name'])) ?>" />
</span>
<?php /** Sort */ ?>
<?php if(AM_USE_SORT_ORDER) { ?>
<span class="button img col">
- <input type="image" onclick="return amMoveOptionValue('<?php echo 'option_id:'.$optionId.'|option_value_id:'.$optionValueId.'|products_attributes_id:'.$optionValueInfo['products_attributes_id']; ?>', 'up');" src="<?php echo DIR_WS_ICONS ?>icon_up.png" title="<?php echo AM_AJAX_MOVES_VALUE_UP; ?>" />
- <input type="image" onclick="return amMoveOptionValue('<?php echo 'option_id:'.$optionId.'|option_value_id:'.$optionValueId.'|products_attributes_id:'.$optionValueInfo['products_attributes_id']; ?>', 'down');" src="<?php echo DIR_WS_ICONS ?>icon_down.png" title="<?php echo AM_AJAX_MOVES_VALUE_DOWN; ?>" />
+ <input type="image" onclick="return amMoveOptionValue('<?php echo 'option_id:'.$optionId.'|option_value_id:'.$optionValueId.'|products_attributes_id:'.$optionValueInfo['products_attributes_id']; ?>', 'up');" src="<?php echo DIR_WS_ADMIN .CsrtAction::getFullPathIcon('at_icon_up'); ?>" title="<?php echo AM_AJAX_MOVES_VALUE_UP; ?>" />
+ <input type="image" onclick="return amMoveOptionValue('<?php echo 'option_id:'.$optionId.'|option_value_id:'.$optionValueId.'|products_attributes_id:'.$optionValueInfo['products_attributes_id']; ?>', 'down');" src="<?php echo DIR_WS_ADMIN .CsrtAction::getFullPathIcon('at_icon_down'); ?>" title="<?php echo AM_AJAX_MOVES_VALUE_DOWN; ?>" />
<?php } ?>
</span>
</td>
@@ -324,14 +324,14 @@
<td align="right" valign="middle" class="newOptionPanel-label">
<?php echo AM_AJAX_OPTION; ?> <?php echo tep_draw_pull_down_menu('optionDropDown',$optionDrop,$selectedOption,'id="optionDropDown" onchange="return amUpdateNewOptionValue(this.value);" class="optionDropDown"')?>
</td>
- <td align="right" valign="middle" class="newOptionPanel-button buttonimg">
- <input border="0" type="image" src="<?php echo DIR_WS_ICONS ?>icon_add_new.png" onclick="return customPrompt('amAddOption');" title="<?php echo AM_AJAX_ADDS_NEW_OPTION; ?>" />
+ <td align="right" valign="middle" class="newOptionPanel-button">
+ <input border="0" type="image" src="<?php echo DIR_WS_ADMIN .CsrtAction::getFullPathIcon('at_icon_add_new'); ?>" onclick="return customPrompt('amAddOption');" title="<?php echo AM_AJAX_ADDS_NEW_OPTION; ?>" />
</td>
<td align="right" valign="middle" class="newOptionPanel-label">
<?php echo AM_AJAX_VALUE; ?> <?php echo tep_draw_pull_down_menu('optionValueDropDown',$optionValueDrop,(is_numeric($selectedOptionValue) ? $selectedOptionValue : ''),'id="optionValueDropDown" class="optionValueDropDown"')?>
</td>
- <td align="right" valign="middle" class="newOptionPanel-button buttonimg">
- <input border="0" type="image" src="<?php echo DIR_WS_ICONS ?>icon_add_new.png" onclick="return customPrompt('amAddOptionValue');" title="<?php echo AM_AJAX_ADDS_NEW_OPTION_VALUE; ?>" />
+ <td align="right" valign="middle" class="newOptionPanel-button">
+ <input border="0" type="image" src="<?php echo DIR_WS_ADMIN .CsrtAction::getFullPathIcon('at_icon_add_new'); ?>" onclick="return customPrompt('amAddOptionValue');" title="<?php echo AM_AJAX_ADDS_NEW_OPTION_VALUE; ?>" />
</td>
<td valign="top" class="newOptionPanel-label">
<?php echo AM_AJAX_PREFIX; ?> <?php echo drawDropDownPrefix('id="prefix_0"')?>
@@ -349,8 +349,8 @@
</td>
<?php } ?>
- <td align="right" valign="middle" class="newOptionPanel-button buttonimg">
- <input type="image" src="<?php echo DIR_WS_ICONS ?>icon_add.png" value="Add" onclick="return amAddAttributeToProduct();" title="<?php echo AM_AJAX_ADDS_ATTRIBUTE_TO_PRODUCT; ?>" border="0" />
+ <td align="right" valign="middle" class="newOptionPanel-button">
+ <input type="image" src="<?php echo DIR_WS_ADMIN .CsrtAction::getFullPathIcon('at_icon_add'); ?>" value="Add" onclick="return amAddAttributeToProduct();" title="<?php echo AM_AJAX_ADDS_ATTRIBUTE_TO_PRODUCT; ?>" border="0" />
</td>
</tr>
</table>
@@ -391,9 +391,9 @@
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr class="header">
<td width="50" align="center">
- <input type="image" src="<?php echo DIR_WS_ICONS ?>icon_plus.gif" onclick="return amShowHideOptionsValues(9999,true);" border="0" />
+ <input type="image" src="<?php echo DIR_WS_ADMIN .CsrtAction::getFullPathIcon('at_icon_plus'); ?>" onclick="return amShowHideOptionsValues(9999,true);" border="0" />
- <input type="image" src="<?php echo DIR_WS_ICONS ?>icon_minus.gif" onclick="return amShowHideOptionsValues(9999,false);" border="0" />
+ <input type="image" src="<?php echo DIR_WS_ADMIN .CsrtAction::getFullPathIcon('at_icon_minus'); ?>" onclick="return amShowHideOptionsValues(9999,false);" border="0" />
</td>
<td>
<?php echo QTPRO_USE_FOR_STOCK ?>
@@ -405,7 +405,7 @@
</tr>
<tr class="option">
<td align="center">
- <input type="image" border="0" id="show_hide_9999" src="<?php echo DIR_WS_ICONS ?>icon_plus.gif" onclick="return amShowHideOptionsValues(9999);" />
+ <input type="image" border="0" id="show_hide_9999" src="<?php echo DIR_WS_ADMIN .CsrtAction::getFullPathIcon('at_icon_plus'); ?>" onclick="return amShowHideOptionsValues(9999);" />
</td>
<?php if (tep_db_num_rows($q)>0): ?>
@@ -417,18 +417,9 @@
<?php $title[$title_num]=$k; $title_num++; endwhile; ?>
<td align="right">
- <span style="margin-right:31px;">
- <?php echo AM_AJAX_REF; ?>
+ <span style="margin-right:41px;">
+ <?php echo AM_AJAX_QUANTITY; ?>
</span>
- <span style="margin-right:31px;">
- <?php echo AM_AJAX_BARCODE; ?>
- </span>
- <span style="margin-right:31px;">
- <?php echo AM_AJAX_QUANTITY_ALERT; ?>
- </span>
- <span style="margin-right:51px;">
- <?php echo AM_AJAX_QUANTITY; ?>
- </span>
</td>
</tr>
@@ -439,7 +430,7 @@
<tr class="optionValue" id="trOptionsValues_9999" style="display:none" >
<td align="center">
<?php echo $rec['products_stock_id']; ?>
- <img src="<?php echo DIR_WS_ICONS ?>icon_arrow.gif" />
+ <img src="<?php echo DIR_WS_ADMIN .CsrtAction::getFullPathIcon('at_icon_arrow'); ?>" />
</td>
<?php foreach($val_array as $val): ?>
@@ -461,19 +452,10 @@
<?php endfor; ?>
<td align="right">
- <span style="margin-right:31px;">
- <?php echo tep_draw_input_field("productStockRef_$rec[products_stock_id]",'', $rec['products_stock_ref'], ' style="margin:0" size="18" onchange="return amUpdateProductStockRef(\''.$rec['products_stock_id'].'\');"'); ?>
+ <span style="margin-right:41px;">
+ <?php echo tep_draw_input_field("productStockQuantity_$rec[products_stock_id]",'', $rec['products_stock_quantity'], ' style="margin:3px 0px 3px 0px;" size="4" onchange="return amUpdateProductStockQuantity(\''.$rec['products_stock_id'].'\');"'); ?>
</span>
- <span style="margin-right:31px;">
- <?php echo tep_draw_input_field("productStockBarCode_$rec[products_stock_id]",'', $rec['products_stock_barcode'], ' style="margin:0" size="18" onchange="return amUpdateProductStockBarCode(\''.$rec['products_stock_id'].'\');"'); ?>
- </span>
- <span style="margin-right:31px;">
- <?php echo tep_draw_input_field("productStockQuantityAlert_$rec[products_stock_id]",'', $rec['products_stock_quantity_alert'], ' style="margin:0" size="4" onchange="return amUpdateProductStockQuantityAlert(\''.$rec['products_stock_id'].'\');"'); ?>
- </span>
- <span style="margin-right:31px;">
- <?php echo tep_draw_input_field("productStockQuantity_$rec[products_stock_id]",'', $rec['products_stock_quantity'], ' style="margin:0" size="4" onchange="return amUpdateProductStockQuantity(\''.$rec['products_stock_id'].'\');"'); ?>
- </span>
- <input type="image" border="0" onclick="return customPrompt('amRemoveStockOptionValueFromProduct','<?php echo addslashes("option_id:$rec[products_stock_id]")?>');" src="<?php echo DIR_WS_ICONS ?>icon_disable.png" title="<?php echo AM_AJAX_ADDS_ATTRIBUTE_TO_PRODUCT; ?>" />
+ <input type="image" border="0" onclick="return customPrompt('amRemoveStockOptionValueFromProduct','<?php echo addslashes("option_id:$rec[products_stock_id]")?>');" src="<?php echo DIR_WS_ADMIN .CsrtAction::getFullPathIcon('at_icon_disable') ?>" title="<?php echo AM_AJAX_ADDS_ATTRIBUTE_TO_PRODUCT; ?>" />
</td>
</tr>
<?php } ?>
@@ -532,10 +514,10 @@
}
?>
<td>
- <?php echo tep_draw_input_field("stockQuantity", '', @$db_quantity, ' style="margin:0px;" size="4"'); ?>
+ <?php echo tep_draw_input_field("stockQuantity", '', @$db_quantity, ' style="margin:3px 0px 3px 0px;" size="4"'); ?>
</td>
<td valign="top">
- <input type="image" src="<?php echo DIR_WS_ICONS ?>icon_add.png" value="Add" onclick="return amAddStockToProduct('<?php echo implode(",", $dropDownOptions); ?>');" title="<?php echo AM_AJAX_UPDATE_OR_INSERT_ATTRIBUTE_COMBINATIONBY_QUANTITY; ?>" border="0" /><br/>
+ <input type="image" src="<?php echo DIR_WS_ADMIN .CsrtAction::getFullPathIcon('at_icon_add') ?>" value="Add" onclick="return amAddStockToProduct('<?php echo implode(",", $dropDownOptions); ?>');" title="<?php echo AM_AJAX_UPDATE_OR_INSERT_ATTRIBUTE_COMBINATIONBY_QUANTITY; ?>" border="0" /><br/>
</td>
</tr>
</table>
@@ -548,5 +530,4 @@
?>
<?php
} // End QT Pro Plugin
-?>
-
+?>
\ No newline at end of file
Modified: trunk/extensions/ATTRIBUTEMANAGER_stable/catalog/admin/includes/modules/products/attributeManager.php
===================================================================
--- trunk/extensions/ATTRIBUTEMANAGER_stable/catalog/admin/includes/modules/products/attributeManager.php 2014-01-17 13:04:53 UTC (rev 5050)
+++ trunk/extensions/ATTRIBUTEMANAGER_stable/catalog/admin/includes/modules/products/attributeManager.php 2014-01-17 14:40:38 UTC (rev 5051)
@@ -1,220 +1,171 @@
<?php
/**
- @licence GPL 2005-2010 The osCSS developers - osCSS Open Source E-commerce
- @package osCSS-2 <www http://www.oscss.org>
- @version 2.1.0
- @date 01/11/10, 16:46
- @author oscim <mail aur...@os...> <www http://www.oscim.fr>
- @encode UTF-8
- @Class attributeManager
+ @licence GPL 2005-2014 The osCSS developers - osCSS Open Source E-commerce
+ @package osCSS-2 <www http://www.oscss.org>
+ @sub-package attributeManager
+ @version 2.2.0
+ @date 04/06/10, 22:08
+ @author oscim <mail aur...@os...> <www http://www.oscim.fr>
+ @encode UTF-8
+ @file attributeManager.php
+ @dir /admin/includes/modules/products/
*/
-class attributeManager
- extends AbstractProduct
- implements InterfaceModule {
- /**
- */
- var $tag;
-
- function __construct() {
- $this->code = 'attributeManager';
- $this->title = __('attributemanager text title');
- $this->description = __('attributemanager text_description');
- $this->sort_order = (defined('MODULE_ACAPRO_ATTRIBUTEMANAGER_SORT_ORDER')) ? MODULE_ACAPRO_ATTRIBUTEMANAGER_SORT_ORDER : 0 ;
- $this->enabled = true; ;
-
- global $page;
- if(!is_object($page)) return '';
- $this->language = $page->the_var('language');
- $this->languages_id = $page->the_var('languages_id');
- }
-
-
-
- public function get_header($action=''){}
- public function display_view($pID,$class=''){ return array(); }
-
- function get_header_js($action=''){
- $this->pID=(int)$_GET['products_id'];
- require(DIR_WS_CLASSES . 'pad_base.php');
- $this->pad = new pad_base($this->pID, $this);
-
- echo $this->pad->draw_js();
- }
-
- /**
- */
- function load_db_values($pID){
- $this->product_id=$pID;
- $this->products_attributes= product_attribut_info($pID);
- }
-
-
-/*
- Function ACA option
+define('PATH_ATTRIBUT_MANAGER','attributeManager/');
+/**
+ @class attributeManager
+ @brief Prise en charge des attributes de produits
*/
+class attributeManager
+ implements InterfaceModule{
+ /**
+ @var code, name classe
+ */
+ public $code;
+ /**
+ @var title
+ */
+ public $title;
+ /**
+ @var string , description
+ */
+ public $description;
+ /**
+ @var position for user module
+ */
+ public $sort_order;
+ /**
+ */
+ public $enabled;
+ /*
+ @var string action name current by GET method
+ */
+ public static $action ='';
+ /**
+ @fn __construct()
+ @brief class constructor
+ */
+ function __construct() {
+ $this->code = 'attributeManager';
+ $this->title = __('Attribute manager');
+ $this->description = __("Gerer les options des produits, lors de l'edition des produits, avec attributeManager") ;
+ $this->sort_order = (defined('MODULE_ACAPRO_ATTRIBUTEMANAGER_SORT_ORDER')) ? MODULE_ACAPRO_ATTRIBUTEMANAGER_SORT_ORDER : 0 ;
+ $this->enabled = true;
+
+ self::$action = (isset($_GET['action']) ? (string)$_GET['action']: '');
+ }
+
+ /**
+ @fn get_header_js ($action)
+ */
+ function get_header_js ($action) {
+ if ($action="new_product") {
+ require_once(PATH_ATTRIBUT_MANAGER.'includes/attributeManagerHeader.inc.php' );
+ echo '<script type="text/javascript"><!--'."\n".
+ 'function get_ajax_attM(id,pID,paction){'."\n".
+ 'var ter = document.getElementById(id);'."\n".
+ 'ter.innerHTML = "'.__('En cours').'";'."\n".
+ '$.ajax({'."\n".
+ 'type: "GET",'."\n".
+ 'url: "'.PATH_ATTRIBUT_MANAGER.'/attributeManager.php",'."\n".
+ 'data: "'.tep_session_name().'='.tep_session_id().'&products_id=" +pID+"&pageAction="+paction,'."\n".
+ 'success: function(msg){'."\n".
+ 'ter.innerHTML = msg;'."\n".
+ '}'."\n".
+ '});'."\n".
+ '}'."\n".
+ '//--></script>'."\n".
+ '';
+ }
+ }
+
/**
- Affiche bock list client notifié coté public
- @param
- @a int pID l'Id du produits
+ @fn load_db_values($products_id)
+ @brief Edition/affichage produit
+ UP db
*/
- public function display_view_master($pID){
- global $page;
- if (!isset($this->products_attributes) ||( isset($this->product_id)&& $this->product_id!=$pID) ){
- if(!class_exists('pad_base')) require(DIR_WS_CLASSES . 'pad_base.php');
- $this->pad = new pad_base($pID, $this);
-
- echo $this->pad->draw_js();
-
- }
- $language = $page->the_var('language');
- $languages_id = $page->the_var('languages_id');
-
- $out ='<div id="productOptions">';
- $out .= $this->pad->draw();
-
- //Display a table with which attributecombinations is on stock to the customer?
- if(_cst_bool('PRODINFO_ATTRIBUTE_DISPLAY_STOCK_LIST')) $out .=$this->qtpro_stock_table($pID);
-
- $out .= '</div>';
- return $out;
+ function load_db_values($products_id) {
+ $languages = tep_get_languages();
+ $DB=Database::getInstance();
+
+ $arr = array();
+ $arr['products_id'] = $products_id;
+ return $arr;
}
+
+ /**
+ @fn display_edit(&$contents)
+ @brief Vue lors edition produits
+ */
+ function display_edit(&$contents) {
+ $languages = tep_get_languages();
+ $title= __('@attributemanager heading tabs');
+
+ $m='<div class="attributeManager">'."\n";
+
+ if (!isset($_GET['pID']))
+ $m .= __('@attributemanager please save product after view this tabs');
+ else {
+ $m.='<div id="attributeManager"></div>'."\n".
+ '<script type="text/javascript"><!--'."\n".
+ 'get_ajax_attM(\'attributeManager\','.$_GET['pID'].', \''.self::$action.'\');'."\n".
+ '// --></script>';
+ }
+ $m.='</div>'."\n";
+
+ $contents []=array(
+ 'title'=> $title,
+ 'text'=> $m
+ );
+ }
+
+
+ /**
+ @remarks implements InterfaceModule depend
+ if module twin in backoffice, report all content install in the other module
+ public function check() {return true;}
+ public function install() {return true;}
+ public function remove() {return true;}
+ public function keys() {return array(); }
+ */
+ /**
+ @fn check()
+ @brief test if count all var , and keys is equal
+ @return boolean true/false
+ */
+ function check() { return true; }
- /**
- Construction du selecteur d'attribut en fonction du type d'attribut
- Remplace le selecteur par defaut de pad_base
- @param
- @a array
- @a string
- */
- public function _draw_type_att($array,$js){
- $field ='';
- $selected=(tep_not_null($array['default']))? $array['default'] : '';
- switch ($array['otype']) {
- case '2': // Text
- $field .= '<label> '.$array['ovals'][0]['text'].'</label>'.tep_draw_hidden_field('Valueid[' .$array['oid'].']',$array['ovals'][0]['id'])
- .tep_draw_input_field('id[' .TEXT_PREFIX.$array['oid'].']', 'id_' .TEXT_PREFIX .$array['oid'].'','', ' maxlength="'.$array['olength'].'" onkeydown="textCounter(this,\'progressbar' . $array['oid'] . '\',' . $array['olength'] . ')" onkeyup="textCounter(this,\'progressbar' . $array['oid'] . '\',' . $array['olength'] . ')" onfocus="textCounter(this,\'progressbar' .$array['oid'] . '\',' . $array['olength'] . ')"')
- .'<div id="progressbar' . $array['oid'] . '" class="progress"></div>';
- break;
- case '5': //File
- break;
- case '3'://Radio
- $field .= tep_draw_pull_down_radio('id['.$array['oid'].']','id_'.$array['oid'],$array['ovals'],$selected,$js);
- break;
- case '4': //Checkbox
- $field .= tep_draw_pull_down_checkbox('id['.$array['oid'].']','id_'.$array['oid'],$array['ovals'],$selected,$js);
- break;
- case '1': // Select
- default:
- $field .= tep_draw_pull_down_menu('id['.$array['oid'].']','id_'.$array['oid'],$array['ovals'],$selected, $js);
- }
- return $field;
- }
+ /**
+ @fn keys()
+ @return array all key configuration define by this module
+ */
+ function keys() { return array(); }
+ /**
+ @fn install()
+ @brief add all configuration
+ @note
+ - Modules can emarquer sql installation instructions, however, in the case of transverse information, or dependent of an extension, preferring the implementation of an extension, file with sql independent
+ - please, pefix all var configuration by 'MODULE_OT__MODTYPENAME_MAJ_'
+ - if module twin in backoffice, report all content install in the other module
+ - Not use language in DB , but function :__()
+ for MODULE_TOTO_ST
+ var title MODULE_TOTO_ST_S (small description)
+ var description MODULE_TOTO_ST_L (long description)
+ */
+ function install() { return true; }
-
-
-
- private function qtpro_stock_table($pID){
-
- global $page;
- $languages_id = $page->the_var('languages_id');
- $currencies = $page->return_object('currencies');
-
- $products_facts_query = "select IF(s.status, s.specials_new_products_price, p.products_price) as products_price, p.products_tax_class_id from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_id = " . (int)$pID ;
- $products_facts = tep_db_fetch_array(tep_db_query($products_facts_query));
-
- // Get the stocklevels
- $products_stock_query=tep_db_query("SELECT products_stock_attributes, products_stock_quantity
- FROM " . TABLE_PRODUCTS_STOCK . "
- WHERE products_id=" . (int)$pID."
- ORDER BY products_stock_attributes");
-
- // get the option names
- $products_options_name_query = tep_db_query("SELECT distinct popt.products_options_id, popt.products_options_name
- FROM " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib
- WHERE patrib.products_id='" . (int)$pID . "'
- AND patrib.options_id = popt.products_options_id
- AND popt.products_options_track_stock = '1'
- AND popt.language_id = '" . (int)$languages_id . "'
- ORDER BY popt.products_options_id");
-
- // build array of attributes price delta
- $attributes_price = array();
- $products_attributes_query = tep_db_query("SELECT pa.options_id, pa.options_values_id, pa.options_values_price, pa.price_prefix
- FROM " . TABLE_PRODUCTS_ATTRIBUTES . " pa
- WHERE pa.products_id = '" . (int)$pID . "'");
-
- $total_price=$products_facts['products_price'];
- while ($products_attributes_values = tep_db_fetch_array($products_attributes_query)) {
- $tmp_price = $total_price;
- $option_price = $products_attributes_values['options_values_price'];
- switch ($products_attributes_values['price_prefix']) {
- case '-':
- $tmp_price += -1*$option_price;
- break;
- case '=':
- $tmp_price +=0;
- break;
- default:
- $tmp_price +=$option_price;
- }
-
- $attributes_price[$products_attributes_values['options_id']][$products_attributes_values['options_values_id']] = $tmp_price;
- }
-
- $rowscounter = 0;
- $html_ev_out = '<h4>' . __('stock list in pi text heading') . '</h4>
- <table border="0" cellspacing="0" cellpadding="0"><tr><thead>';
-
- // build heading line with option names
- while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
- $html_ev_out .= '<th class="infoBoxHeading" align="center">' . $products_options_name['products_options_name'] . '</th>';
- }
- $html_ev_out .= '<th class="infoBoxHeading" align="center">'. __('stock list in pi text price') .'</th>';
- $html_ev_out .= '<th class="infoBoxHeading" align="center">'. __('stock list in pi text stock') .'</th>';
- $html_ev_out .= '</tr></thead><tbody>';
-
-
- // now create the rows! Each row will display the quantity for one combination of attributes.
- while($products_stock_values=tep_db_fetch_array($products_stock_query)) {
- if($products_stock_values['products_stock_quantity'] > 0){
- //We only want to display rows for combinations we have on stock...
- //For example the quantity can be 0 or even negative if oversold.
- $rowscounter += 1;
- $attributes=explode(",",$products_stock_values['products_stock_attributes']);
- $html_ev_out .= '<tr >';
-
- $total_price=$products_facts['products_price'];
- foreach($attributes as $attribute) {
- // print_r($attributes_price);
- $attr=explode("-",$attribute);
- $html_ev_out .= '<td class="infoBoxContents" align="center">'.tep_values_name($attr[1]).'</td>';
- $total_price=$attributes_price[$attr[0]][$attr[1]];
- }
- $total_price=$currencies->display_price($total_price, tep_get_tax_rate($products_facts['products_tax_class_id']));
-
- $html_ev_out .= '<td class="infoBoxContents" align="center">'.$total_price.'</td>';
- $html_ev_out .= '<td class="infoBoxContents" align="center">'.$products_stock_values['products_stock_quantity'].'</td>';
- }
- }
-
-
- $html_ev_out .= '</tbody></tr></table>';
-
- if($rowscounter > 0){
- return $html_ev_out;
- }
- }
-
-/** implements InterfaceModule depend */
- public function check() {}
- public function install() {}
- public function remove() {}
- public function keys() {}
+ /**
+ @fn remove()
+ @brief delete all configuration
+ @note
+ - please, pefix all var c...
[truncated message content] |
|
From: <os...@us...> - 2014-01-17 13:04:57
|
Revision: 5050
http://sourceforge.net/p/oscss/svn/5050
Author: oscim
Date: 2014-01-17 13:04:53 +0000 (Fri, 17 Jan 2014)
Log Message:
-----------
Delete olds files
Removed Paths:
-------------
trunk/catalog/common/functions/pclzip.lib.php
trunk/catalog/common/functions/unzip.php
Deleted: trunk/catalog/common/functions/pclzip.lib.php
===================================================================
--- trunk/catalog/common/functions/pclzip.lib.php 2014-01-17 13:02:58 UTC (rev 5049)
+++ trunk/catalog/common/functions/pclzip.lib.php 2014-01-17 13:04:53 UTC (rev 5050)
@@ -1,5694 +0,0 @@
-<?php
-// --------------------------------------------------------------------------------
-// PhpConcept Library - Zip Module 2.8.2
-// --------------------------------------------------------------------------------
-// License GNU/LGPL - Vincent Blavet - August 2009
-// http://www.phpconcept.net
-// --------------------------------------------------------------------------------
-//
-// Presentation :
-// PclZip is a PHP library that manage ZIP archives.
-// So far tests show that archives generated by PclZip are readable by
-// WinZip application and other tools.
-//
-// Description :
-// See readme.txt and http://www.phpconcept.net
-//
-// Warning :
-// This library and the associated files are non commercial, non professional
-// work.
-// It should not have unexpected results. However if any damage is caused by
-// this software the author can not be responsible.
-// The use of this software is at the risk of the user.
-//
-// --------------------------------------------------------------------------------
-// $Id: pclzip.lib.php,v 1.60 2009/09/30 21:01:04 vblavet Exp $
-// --------------------------------------------------------------------------------
-
- // ----- Constants
- if (!defined('PCLZIP_READ_BLOCK_SIZE')) {
- define( 'PCLZIP_READ_BLOCK_SIZE', 2048 );
- }
-
- // ----- File list separator
- // In version 1.x of PclZip, the separator for file list is a space
- // (which is not a very smart choice, specifically for windows paths !).
- // A better separator should be a comma (,). This constant gives you the
- // abilty to change that.
- // However notice that changing this value, may have impact on existing
- // scripts, using space separated filenames.
- // Recommanded values for compatibility with older versions :
- //define( 'PCLZIP_SEPARATOR', ' ' );
- // Recommanded values for smart separation of filenames.
- if (!defined('PCLZIP_SEPARATOR')) {
- define( 'PCLZIP_SEPARATOR', ',' );
- }
-
- // ----- Error configuration
- // 0 : PclZip Class integrated error handling
- // 1 : PclError external library error handling. By enabling this
- // you must ensure that you have included PclError library.
- // [2,...] : reserved for futur use
- if (!defined('PCLZIP_ERROR_EXTERNAL')) {
- define( 'PCLZIP_ERROR_EXTERNAL', 0 );
- }
-
- // ----- Optional static temporary directory
- // By default temporary files are generated in the script current
- // path.
- // If defined :
- // - MUST BE terminated by a '/'.
- // - MUST be a valid, already created directory
- // Samples :
- // define( 'PCLZIP_TEMPORARY_DIR', '/temp/' );
- // define( 'PCLZIP_TEMPORARY_DIR', 'C:/Temp/' );
- if (!defined('PCLZIP_TEMPORARY_DIR')) {
- define( 'PCLZIP_TEMPORARY_DIR', '' );
- }
-
- // ----- Optional threshold ratio for use of temporary files
- // Pclzip sense the size of the file to add/extract and decide to
- // use or not temporary file. The algorythm is looking for
- // memory_limit of PHP and apply a ratio.
- // threshold = memory_limit * ratio.
- // Recommended values are under 0.5. Default 0.47.
- // Samples :
- // define( 'PCLZIP_TEMPORARY_FILE_RATIO', 0.5 );
- if (!defined('PCLZIP_TEMPORARY_FILE_RATIO')) {
- define( 'PCLZIP_TEMPORARY_FILE_RATIO', 0.47 );
- }
-
-// --------------------------------------------------------------------------------
-// ***** UNDER THIS LINE NOTHING NEEDS TO BE MODIFIED *****
-// --------------------------------------------------------------------------------
-
- // ----- Global variables
- $g_pclzip_version = "2.8.2";
-
- // ----- Error codes
- // -1 : Unable to open file in binary write mode
- // -2 : Unable to open file in binary read mode
- // -3 : Invalid parameters
- // -4 : File does not exist
- // -5 : Filename is too long (max. 255)
- // -6 : Not a valid zip file
- // -7 : Invalid extracted file size
- // -8 : Unable to create directory
- // -9 : Invalid archive extension
- // -10 : Invalid archive format
- // -11 : Unable to delete file (unlink)
- // -12 : Unable to rename file (rename)
- // -13 : Invalid header checksum
- // -14 : Invalid archive size
- define( 'PCLZIP_ERR_USER_ABORTED', 2 );
- define( 'PCLZIP_ERR_NO_ERROR', 0 );
- define( 'PCLZIP_ERR_WRITE_OPEN_FAIL', -1 );
- define( 'PCLZIP_ERR_READ_OPEN_FAIL', -2 );
- define( 'PCLZIP_ERR_INVALID_PARAMETER', -3 );
- define( 'PCLZIP_ERR_MISSING_FILE', -4 );
- define( 'PCLZIP_ERR_FILENAME_TOO_LONG', -5 );
- define( 'PCLZIP_ERR_INVALID_ZIP', -6 );
- define( 'PCLZIP_ERR_BAD_EXTRACTED_FILE', -7 );
- define( 'PCLZIP_ERR_DIR_CREATE_FAIL', -8 );
- define( 'PCLZIP_ERR_BAD_EXTENSION', -9 );
- define( 'PCLZIP_ERR_BAD_FORMAT', -10 );
- define( 'PCLZIP_ERR_DELETE_FILE_FAIL', -11 );
- define( 'PCLZIP_ERR_RENAME_FILE_FAIL', -12 );
- define( 'PCLZIP_ERR_BAD_CHECKSUM', -13 );
- define( 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP', -14 );
- define( 'PCLZIP_ERR_MISSING_OPTION_VALUE', -15 );
- define( 'PCLZIP_ERR_INVALID_OPTION_VALUE', -16 );
- define( 'PCLZIP_ERR_ALREADY_A_DIRECTORY', -17 );
- define( 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION', -18 );
- define( 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION', -19 );
- define( 'PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE', -20 );
- define( 'PCLZIP_ERR_DIRECTORY_RESTRICTION', -21 );
-
- // ----- Options values
- define( 'PCLZIP_OPT_PATH', 77001 );
- define( 'PCLZIP_OPT_ADD_PATH', 77002 );
- define( 'PCLZIP_OPT_REMOVE_PATH', 77003 );
- define( 'PCLZIP_OPT_REMOVE_ALL_PATH', 77004 );
- define( 'PCLZIP_OPT_SET_CHMOD', 77005 );
- define( 'PCLZIP_OPT_EXTRACT_AS_STRING', 77006 );
- define( 'PCLZIP_OPT_NO_COMPRESSION', 77007 );
- define( 'PCLZIP_OPT_BY_NAME', 77008 );
- define( 'PCLZIP_OPT_BY_INDEX', 77009 );
- define( 'PCLZIP_OPT_BY_EREG', 77010 );
- define( 'PCLZIP_OPT_BY_PREG', 77011 );
- define( 'PCLZIP_OPT_COMMENT', 77012 );
- define( 'PCLZIP_OPT_ADD_COMMENT', 77013 );
- define( 'PCLZIP_OPT_PREPEND_COMMENT', 77014 );
- define( 'PCLZIP_OPT_EXTRACT_IN_OUTPUT', 77015 );
- define( 'PCLZIP_OPT_REPLACE_NEWER', 77016 );
- define( 'PCLZIP_OPT_STOP_ON_ERROR', 77017 );
- // Having big trouble with crypt. Need to multiply 2 long int
- // which is not correctly supported by PHP ...
- //define( 'PCLZIP_OPT_CRYPT', 77018 );
- define( 'PCLZIP_OPT_EXTRACT_DIR_RESTRICTION', 77019 );
- define( 'PCLZIP_OPT_TEMP_FILE_THRESHOLD', 77020 );
- define( 'PCLZIP_OPT_ADD_TEMP_FILE_THRESHOLD', 77020 ); // alias
- define( 'PCLZIP_OPT_TEMP_FILE_ON', 77021 );
- define( 'PCLZIP_OPT_ADD_TEMP_FILE_ON', 77021 ); // alias
- define( 'PCLZIP_OPT_TEMP_FILE_OFF', 77022 );
- define( 'PCLZIP_OPT_ADD_TEMP_FILE_OFF', 77022 ); // alias
-
- // ----- File description attributes
- define( 'PCLZIP_ATT_FILE_NAME', 79001 );
- define( 'PCLZIP_ATT_FILE_NEW_SHORT_NAME', 79002 );
- define( 'PCLZIP_ATT_FILE_NEW_FULL_NAME', 79003 );
- define( 'PCLZIP_ATT_FILE_MTIME', 79004 );
- define( 'PCLZIP_ATT_FILE_CONTENT', 79005 );
- define( 'PCLZIP_ATT_FILE_COMMENT', 79006 );
-
- // ----- Call backs values
- define( 'PCLZIP_CB_PRE_EXTRACT', 78001 );
- define( 'PCLZIP_CB_POST_EXTRACT', 78002 );
- define( 'PCLZIP_CB_PRE_ADD', 78003 );
- define( 'PCLZIP_CB_POST_ADD', 78004 );
- /* For futur use
- define( 'PCLZIP_CB_PRE_LIST', 78005 );
- define( 'PCLZIP_CB_POST_LIST', 78006 );
- define( 'PCLZIP_CB_PRE_DELETE', 78007 );
- define( 'PCLZIP_CB_POST_DELETE', 78008 );
- */
-
- // --------------------------------------------------------------------------------
- // Class : PclZip
- // Description :
- // PclZip is the class that represent a Zip archive.
- // The public methods allow the manipulation of the archive.
- // Attributes :
- // Attributes must not be accessed directly.
- // Methods :
- // PclZip() : Object creator
- // create() : Creates the Zip archive
- // listContent() : List the content of the Zip archive
- // extract() : Extract the content of the archive
- // properties() : List the properties of the archive
- // --------------------------------------------------------------------------------
- class PclZip
- {
- // ----- Filename of the zip file
- var $zipname = '';
-
- // ----- File descriptor of the zip file
- var $zip_fd = 0;
-
- // ----- Internal error handling
- var $error_code = 1;
- var $error_string = '';
-
- // ----- Current status of the magic_quotes_runtime
- // This value store the php configuration for magic_quotes
- // The class can then disable the magic_quotes and reset it after
- var $magic_quotes_status;
-
- // --------------------------------------------------------------------------------
- // Function : PclZip()
- // Description :
- // Creates a PclZip object and set the name of the associated Zip archive
- // filename.
- // Note that no real action is taken, if the archive does not exist it is not
- // created. Use create() for that.
- // --------------------------------------------------------------------------------
- function PclZip($p_zipname)
- {
-
- // ----- Tests the zlib
- if (!function_exists('gzopen'))
- {
- die('Abort '.basename(__FILE__).' : Missing zlib extensions');
- }
-
- // ----- Set the attributes
- $this->zipname = $p_zipname;
- $this->zip_fd = 0;
- $this->magic_quotes_status = -1;
-
- // ----- Return
- return;
- }
- // --------------------------------------------------------------------------------
-
- // --------------------------------------------------------------------------------
- // Function :
- // create($p_filelist, $p_add_dir="", $p_remove_dir="")
- // create($p_filelist, $p_option, $p_option_value, ...)
- // Description :
- // This method supports two different synopsis. The first one is historical.
- // This method creates a Zip Archive. The Zip file is created in the
- // filesystem. The files and directories indicated in $p_filelist
- // are added in the archive. See the parameters description for the
- // supported format of $p_filelist.
- // When a directory is in the list, the directory and its content is added
- // in the archive.
- // In this synopsis, the function takes an optional variable list of
- // options. See bellow the supported options.
- // Parameters :
- // $p_filelist : An array containing file or directory names, or
- // a string containing one filename or one directory name, or
- // a string containing a list of filenames and/or directory
- // names separated by spaces.
- // $p_add_dir : A path to add before the real path of the archived file,
- // in order to have it memorized in the archive.
- // $p_remove_dir : A path to remove from the real path of the file to archive,
- // in order to have a shorter path memorized in the archive.
- // When $p_add_dir and $p_remove_dir are set, $p_remove_dir
- // is removed first, before $p_add_dir is added.
- // Options :
- // PCLZIP_OPT_ADD_PATH :
- // PCLZIP_OPT_REMOVE_PATH :
- // PCLZIP_OPT_REMOVE_ALL_PATH :
- // PCLZIP_OPT_COMMENT :
- // PCLZIP_CB_PRE_ADD :
- // PCLZIP_CB_POST_ADD :
- // Return Values :
- // 0 on failure,
- // The list of the added files, with a status of the add action.
- // (see PclZip::listContent() for list entry format)
- // --------------------------------------------------------------------------------
- function create($p_filelist)
- {
- $v_result=1;
-
- // ----- Reset the error handler
- $this->privErrorReset();
-
- // ----- Set default values
- $v_options = array();
- $v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE;
-
- // ----- Look for variable options arguments
- $v_size = func_num_args();
-
- // ----- Look for arguments
- if ($v_size > 1) {
- // ----- Get the arguments
- $v_arg_list = func_get_args();
-
- // ----- Remove from the options list the first argument
- array_shift($v_arg_list);
- $v_size--;
-
- // ----- Look for first arg
- if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
-
- // ----- Parse the options
- $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
- array (PCLZIP_OPT_REMOVE_PATH => 'optional',
- PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
- PCLZIP_OPT_ADD_PATH => 'optional',
- PCLZIP_CB_PRE_ADD => 'optional',
- PCLZIP_CB_POST_ADD => 'optional',
- PCLZIP_OPT_NO_COMPRESSION => 'optional',
- PCLZIP_OPT_COMMENT => 'optional',
- PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
- PCLZIP_OPT_TEMP_FILE_ON => 'optional',
- PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
- //, PCLZIP_OPT_CRYPT => 'optional'
- ));
- if ($v_result != 1) {
- return 0;
- }
- }
-
- // ----- Look for 2 args
- // Here we need to support the first historic synopsis of the
- // method.
- else {
-
- // ----- Get the first argument
- $v_options[PCLZIP_OPT_ADD_PATH] = $v_arg_list[0];
-
- // ----- Look for the optional second argument
- if ($v_size == 2) {
- $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1];
- }
- else if ($v_size > 2) {
- PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
- "Invalid number / type of arguments");
- return 0;
- }
- }
- }
-
- // ----- Look for default option values
- $this->privOptionDefaultThreshold($v_options);
-
- // ----- Init
- $v_string_list = array();
- $v_att_list = array();
- $v_filedescr_list = array();
- $p_result_list = array();
-
- // ----- Look if the $p_filelist is really an array
- if (is_array($p_filelist)) {
-
- // ----- Look if the first element is also an array
- // This will mean that this is a file description entry
- if (isset($p_filelist[0]) && is_array($p_filelist[0])) {
- $v_att_list = $p_filelist;
- }
-
- // ----- The list is a list of string names
- else {
- $v_string_list = $p_filelist;
- }
- }
-
- // ----- Look if the $p_filelist is a string
- else if (is_string($p_filelist)) {
- // ----- Create a list from the string
- $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist);
- }
-
- // ----- Invalid variable type for $p_filelist
- else {
- PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_filelist");
- return 0;
- }
-
- // ----- Reformat the string list
- if (sizeof($v_string_list) != 0) {
- foreach ($v_string_list as $v_string) {
- if ($v_string != '') {
- $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;
- }
- else {
- }
- }
- }
-
- // ----- For each file in the list check the attributes
- $v_supported_attributes
- = array ( PCLZIP_ATT_FILE_NAME => 'mandatory'
- ,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional'
- ,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional'
- ,PCLZIP_ATT_FILE_MTIME => 'optional'
- ,PCLZIP_ATT_FILE_CONTENT => 'optional'
- ,PCLZIP_ATT_FILE_COMMENT => 'optional'
- );
- foreach ($v_att_list as $v_entry) {
- $v_result = $this->privFileDescrParseAtt($v_entry,
- $v_filedescr_list[],
- $v_options,
- $v_supported_attributes);
- if ($v_result != 1) {
- return 0;
- }
- }
-
- // ----- Expand the filelist (expand directories)
- $v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options);
- if ($v_result != 1) {
- return 0;
- }
-
- // ----- Call the create fct
- $v_result = $this->privCreate($v_filedescr_list, $p_result_list, $v_options);
- if ($v_result != 1) {
- return 0;
- }
-
- // ----- Return
- return $p_result_list;
- }
- // --------------------------------------------------------------------------------
-
- // --------------------------------------------------------------------------------
- // Function :
- // add($p_filelist, $p_add_dir="", $p_remove_dir="")
- // add($p_filelist, $p_option, $p_option_value, ...)
- // Description :
- // This method supports two synopsis. The first one is historical.
- // This methods add the list of files in an existing archive.
- // If a file with the same name already exists, it is added at the end of the
- // archive, the first one is still present.
- // If the archive does not exist, it is created.
- // Parameters :
- // $p_filelist : An array containing file or directory names, or
- // a string containing one filename or one directory name, or
- // a string containing a list of filenames and/or directory
- // names separated by spaces.
- // $p_add_dir : A path to add before the real path of the archived file,
- // in order to have it memorized in the archive.
- // $p_remove_dir : A path to remove from the real path of the file to archive,
- // in order to have a shorter path memorized in the archive.
- // When $p_add_dir and $p_remove_dir are set, $p_remove_dir
- // is removed first, before $p_add_dir is added.
- // Options :
- // PCLZIP_OPT_ADD_PATH :
- // PCLZIP_OPT_REMOVE_PATH :
- // PCLZIP_OPT_REMOVE_ALL_PATH :
- // PCLZIP_OPT_COMMENT :
- // PCLZIP_OPT_ADD_COMMENT :
- // PCLZIP_OPT_PREPEND_COMMENT :
- // PCLZIP_CB_PRE_ADD :
- // PCLZIP_CB_POST_ADD :
- // Return Values :
- // 0 on failure,
- // The list of the added files, with a status of the add action.
- // (see PclZip::listContent() for list entry format)
- // --------------------------------------------------------------------------------
- function add($p_filelist)
- {
- $v_result=1;
-
- // ----- Reset the error handler
- $this->privErrorReset();
-
- // ----- Set default values
- $v_options = array();
- $v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE;
-
- // ----- Look for variable options arguments
- $v_size = func_num_args();
-
- // ----- Look for arguments
- if ($v_size > 1) {
- // ----- Get the arguments
- $v_arg_list = func_get_args();
-
- // ----- Remove form the options list the first argument
- array_shift($v_arg_list);
- $v_size--;
-
- // ----- Look for first arg
- if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
-
- // ----- Parse the options
- $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
- array (PCLZIP_OPT_REMOVE_PATH => 'optional',
- PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
- PCLZIP_OPT_ADD_PATH => 'optional',
- PCLZIP_CB_PRE_ADD => 'optional',
- PCLZIP_CB_POST_ADD => 'optional',
- PCLZIP_OPT_NO_COMPRESSION => 'optional',
- PCLZIP_OPT_COMMENT => 'optional',
- PCLZIP_OPT_ADD_COMMENT => 'optional',
- PCLZIP_OPT_PREPEND_COMMENT => 'optional',
- PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
- PCLZIP_OPT_TEMP_FILE_ON => 'optional',
- PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
- //, PCLZIP_OPT_CRYPT => 'optional'
- ));
- if ($v_result != 1) {
- return 0;
- }
- }
-
- // ----- Look for 2 args
- // Here we need to support the first historic synopsis of the
- // method.
- else {
-
- // ----- Get the first argument
- $v_options[PCLZIP_OPT_ADD_PATH] = $v_add_path = $v_arg_list[0];
-
- // ----- Look for the optional second argument
- if ($v_size == 2) {
- $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1];
- }
- else if ($v_size > 2) {
- // ----- Error log
- PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
-
- // ----- Return
- return 0;
- }
- }
- }
-
- // ----- Look for default option values
- $this->privOptionDefaultThreshold($v_options);
-
- // ----- Init
- $v_string_list = array();
- $v_att_list = array();
- $v_filedescr_list = array();
- $p_result_list = array();
-
- // ----- Look if the $p_filelist is really an array
- if (is_array($p_filelist)) {
-
- // ----- Look if the first element is also an array
- // This will mean that this is a file description entry
- if (isset($p_filelist[0]) && is_array($p_filelist[0])) {
- $v_att_list = $p_filelist;
- }
-
- // ----- The list is a list of string names
- else {
- $v_string_list = $p_filelist;
- }
- }
-
- // ----- Look if the $p_filelist is a string
- else if (is_string($p_filelist)) {
- // ----- Create a list from the string
- $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist);
- }
-
- // ----- Invalid variable type for $p_filelist
- else {
- PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type '".gettype($p_filelist)."' for p_filelist");
- return 0;
- }
-
- // ----- Reformat the string list
- if (sizeof($v_string_list) != 0) {
- foreach ($v_string_list as $v_string) {
- $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;
- }
- }
-
- // ----- For each file in the list check the attributes
- $v_supported_attributes
- = array ( PCLZIP_ATT_FILE_NAME => 'mandatory'
- ,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional'
- ,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional'
- ,PCLZIP_ATT_FILE_MTIME => 'optional'
- ,PCLZIP_ATT_FILE_CONTENT => 'optional'
- ,PCLZIP_ATT_FILE_COMMENT => 'optional'
- );
- foreach ($v_att_list as $v_entry) {
- $v_result = $this->privFileDescrParseAtt($v_entry,
- $v_filedescr_list[],
- $v_options,
- $v_supported_attributes);
- if ($v_result != 1) {
- return 0;
- }
- }
-
- // ----- Expand the filelist (expand directories)
- $v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options);
- if ($v_result != 1) {
- return 0;
- }
-
- // ----- Call the create fct
- $v_result = $this->privAdd($v_filedescr_list, $p_result_list, $v_options);
- if ($v_result != 1) {
- return 0;
- }
-
- // ----- Return
- return $p_result_list;
- }
- // --------------------------------------------------------------------------------
-
- // --------------------------------------------------------------------------------
- // Function : listContent()
- // Description :
- // This public method, gives the list of the files and directories, with their
- // properties.
- // The properties of each entries in the list are (used also in other functions) :
- // filename : Name of the file. For a create or add action it is the filename
- // given by the user. For an extract function it is the filename
- // of the extracted file.
- // stored_filename : Name of the file / directory stored in the archive.
- // size : Size of the stored file.
- // compressed_size : Size of the file's data compressed in the archive
- // (without the headers overhead)
- // mtime : Last known modification date of the file (UNIX timestamp)
- // comment : Comment associated with the file
- // folder : true | false
- // index : index of the file in the archive
- // status : status of the action (depending of the action) :
- // Values are :
- // ok : OK !
- // filtered : the file / dir is not extracted (filtered by user)
- // already_a_directory : the file can not be extracted because a
- // directory with the same name already exists
- // write_protected : the file can not be extracted because a file
- // with the same name already exists and is
- // write protected
- // newer_exist : the file was not extracted because a newer file exists
- // path_creation_fail : the file is not extracted because the folder
- // does not exist and can not be created
- // write_error : the file was not extracted because there was a
- // error while writing the file
- // read_error : the file was not extracted because there was a error
- // while reading the file
- // invalid_header : the file was not extracted because of an archive
- // format error (bad file header)
- // Note that each time a method can continue operating when there
- // is an action error on a file, the error is only logged in the file status.
- // Return Values :
- // 0 on an unrecoverable failure,
- // The list of the files in the archive.
- // --------------------------------------------------------------------------------
- function listContent()
- {
- $v_result=1;
-
- // ----- Reset the error handler
- $this->privErrorReset();
-
- // ----- Check archive
- if (!$this->privCheckFormat()) {
- return(0);
- }
-
- // ----- Call the extracting fct
- $p_list = array();
- if (($v_result = $this->privList($p_list)) != 1)
- {
- unset($p_list);
- return(0);
- }
-
- // ----- Return
- return $p_list;
- }
- // --------------------------------------------------------------------------------
-
- // --------------------------------------------------------------------------------
- // Function :
- // extract($p_path="./", $p_remove_path="")
- // extract([$p_option, $p_option_value, ...])
- // Description :
- // This method supports two synopsis. The first one is historical.
- // This method extract all the files / directories from the archive to the
- // folder indicated in $p_path.
- // If you want to ignore the 'root' part of path of the memorized files
- // you can indicate this in the optional $p_remove_path parameter.
- // By default, if a newer file with the same name already exists, the
- // file is not extracted.
- //
- // If both PCLZIP_OPT_PATH and PCLZIP_OPT_ADD_PATH aoptions
- // are used, the path indicated in PCLZIP_OPT_ADD_PATH is append
- // at the end of the path value of PCLZIP_OPT_PATH.
- // Parameters :
- // $p_path : Path where the files and directories are to be extracted
- // $p_remove_path : First part ('root' part) of the memorized path
- // (if any similar) to remove while extracting.
- // Options :
- // PCLZIP_OPT_PATH :
- // PCLZIP_OPT_ADD_PATH :
- // PCLZIP_OPT_REMOVE_PATH :
- // PCLZIP_OPT_REMOVE_ALL_PATH :
- // PCLZIP_CB_PRE_EXTRACT :
- // PCLZIP_CB_POST_EXTRACT :
- // Return Values :
- // 0 or a negative value on failure,
- // The list of the extracted files, with a status of the action.
- // (see PclZip::listContent() for list entry format)
- // --------------------------------------------------------------------------------
- function extract()
- {
- $v_result=1;
-
- // ----- Reset the error handler
- $this->privErrorReset();
-
- // ----- Check archive
- if (!$this->privCheckFormat()) {
- return(0);
- }
-
- // ----- Set default values
- $v_options = array();
-// $v_path = "./";
- $v_path = '';
- $v_remove_path = "";
- $v_remove_all_path = false;
-
- // ----- Look for variable options arguments
- $v_size = func_num_args();
-
- // ----- Default values for option
- $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
-
- // ----- Look for arguments
- if ($v_size > 0) {
- // ----- Get the arguments
- $v_arg_list = func_get_args();
-
- // ----- Look for first arg
- if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
-
- // ----- Parse the options
- $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
- array (PCLZIP_OPT_PATH => 'optional',
- PCLZIP_OPT_REMOVE_PATH => 'optional',
- PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
- PCLZIP_OPT_ADD_PATH => 'optional',
- PCLZIP_CB_PRE_EXTRACT => 'optional',
- PCLZIP_CB_POST_EXTRACT => 'optional',
- PCLZIP_OPT_SET_CHMOD => 'optional',
- PCLZIP_OPT_BY_NAME => 'optional',
- PCLZIP_OPT_BY_EREG => 'optional',
- PCLZIP_OPT_BY_PREG => 'optional',
- PCLZIP_OPT_BY_INDEX => 'optional',
- PCLZIP_OPT_EXTRACT_AS_STRING => 'optional',
- PCLZIP_OPT_EXTRACT_IN_OUTPUT => 'optional',
- PCLZIP_OPT_REPLACE_NEWER => 'optional'
- ,PCLZIP_OPT_STOP_ON_ERROR => 'optional'
- ,PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional',
- PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
- PCLZIP_OPT_TEMP_FILE_ON => 'optional',
- PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
- ));
- if ($v_result != 1) {
- return 0;
- }
-
- // ----- Set the arguments
- if (isset($v_options[PCLZIP_OPT_PATH])) {
- $v_path = $v_options[PCLZIP_OPT_PATH];
- }
- if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) {
- $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH];
- }
- if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
- $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH];
- }
- if (isset($v_options[PCLZIP_OPT_ADD_PATH])) {
- // ----- Check for '/' in last path char
- if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) {
- $v_path .= '/';
- }
- $v_path .= $v_options[PCLZIP_OPT_ADD_PATH];
- }
- }
-
- // ----- Look for 2 args
- // Here we need to support the first historic synopsis of the
- // method.
- else {
-
- // ----- Get the first argument
- $v_path = $v_arg_list[0];
-
- // ----- Look for the optional second argument
- if ($v_size == 2) {
- $v_remove_path = $v_arg_list[1];
- }
- else if ($v_size > 2) {
- // ----- Error log
- PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
-
- // ----- Return
- return 0;
- }
- }
- }
-
- // ----- Look for default option values
- $this->privOptionDefaultThreshold($v_options);
-
- // ----- Trace
-
- // ----- Call the extracting fct
- $p_list = array();
- $v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path,
- $v_remove_all_path, $v_options);
- if ($v_result < 1) {
- unset($p_list);
- return(0);
- }
-
- // ----- Return
- return $p_list;
- }
- // --------------------------------------------------------------------------------
-
-
- // --------------------------------------------------------------------------------
- // Function :
- // extractByIndex($p_index, $p_path="./", $p_remove_path="")
- // extractByIndex($p_index, [$p_option, $p_option_value, ...])
- // Description :
- // This method supports two synopsis. The first one is historical.
- // This method is doing a partial extract of the archive.
- // The extracted files or folders are identified by their index in the
- // archive (from 0 to n).
- // Note that if the index identify a folder, only the folder entry is
- // extracted, not all the files included in the archive.
- // Parameters :
- // $p_index : A single index (integer) or a string of indexes of files to
- // extract. The form of the string is "0,4-6,8-12" with only numbers
- // and '-' for range or ',' to separate ranges. No spaces or ';'
- // are allowed.
- // $p_path : Path where the files and directories are to be extracted
- // $p_remove_path : First part ('root' part) of the memorized path
- // (if any similar) to remove while extracting.
- // Options :
- // PCLZIP_OPT_PATH :
- // PCLZIP_OPT_ADD_PATH :
- // PCLZIP_OPT_REMOVE_PATH :
- // PCLZIP_OPT_REMOVE_ALL_PATH :
- // PCLZIP_OPT_EXTRACT_AS_STRING : The files are extracted as strings and
- // not as files.
- // The resulting content is in a new field 'content' in the file
- // structure.
- // This option must be used alone (any other options are ignored).
- // PCLZIP_CB_PRE_EXTRACT :
- // PCLZIP_CB_POST_EXTRACT :
- // Return Values :
- // 0 on failure,
- // The list of the extracted files, with a status of the action.
- // (see PclZip::listContent() for list entry format)
- // --------------------------------------------------------------------------------
- //function extractByIndex($p_index, options...)
- function extractByIndex($p_index)
- {
- $v_result=1;
-
- // ----- Reset the error handler
- $this->privErrorReset();
-
- // ----- Check archive
- if (!$this->privCheckFormat()) {
- return(0);
- }
-
- // ----- Set default values
- $v_options = array();
-// $v_path = "./";
- $v_path = '';
- $v_remove_path = "";
- $v_remove_all_path = false;
-
- // ----- Look for variable options arguments
- $v_size = func_num_args();
-
- // ----- Default values for option
- $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
-
- // ----- Look for arguments
- if ($v_size > 1) {
- // ----- Get the arguments
- $v_arg_list = func_get_args();
-
- // ----- Remove form the options list the first argument
- array_shift($v_arg_list);
- $v_size--;
-
- // ----- Look for first arg
- if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
-
- // ----- Parse the options
- $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
- array (PCLZIP_OPT_PATH => 'optional',
- PCLZIP_OPT_REMOVE_PATH => 'optional',
- PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
- PCLZIP_OPT_EXTRACT_AS_STRING => 'optional',
- PCLZIP_OPT_ADD_PATH => 'optional',
- PCLZIP_CB_PRE_EXTRACT => 'optional',
- PCLZIP_CB_POST_EXTRACT => 'optional',
- PCLZIP_OPT_SET_CHMOD => 'optional',
- PCLZIP_OPT_REPLACE_NEWER => 'optional'
- ,PCLZIP_OPT_STOP_ON_ERROR => 'optional'
- ,PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional',
- PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
- PCLZIP_OPT_TEMP_FILE_ON => 'optional',
- PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
- ));
- if ($v_result != 1) {
- return 0;
- }
-
- // ----- Set the arguments
- if (isset($v_options[PCLZIP_OPT_PATH])) {
- $v_path = $v_options[PCLZIP_OPT_PATH];
- }
- if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) {
- $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH];
- }
- if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
- $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH];
- }
- if (isset($v_options[PCLZIP_OPT_ADD_PATH])) {
- // ----- Check for '/' in last path char
- if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) {
- $v_path .= '/';
- }
- $v_path .= $v_options[PCLZIP_OPT_ADD_PATH];
- }
- if (!isset($v_options[PCLZIP_OPT_EXTRACT_AS_STRING])) {
- $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
- }
- else {
- }
- }
-
- // ----- Look for 2 args
- // Here we need to support the first historic synopsis of the
- // method.
- else {
-
- // ----- Get the first argument
- $v_path = $v_arg_list[0];
-
- // ----- Look for the optional second argument
- if ($v_size == 2) {
- $v_remove_path = $v_arg_list[1];
- }
- else if ($v_size > 2) {
- // ----- Error log
- PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
-
- // ----- Return
- return 0;
- }
- }
- }
-
- // ----- Trace
-
- // ----- Trick
- // Here I want to reuse extractByRule(), so I need to parse the $p_index
- // with privParseOptions()
- $v_arg_trick = array (PCLZIP_OPT_BY_INDEX, $p_index);
- $v_options_trick = array();
- $v_result = $this->privParseOptions($v_arg_trick, sizeof($v_arg_trick), $v_options_trick,
- array (PCLZIP_OPT_BY_INDEX => 'optional' ));
- if ($v_result != 1) {
- return 0;
- }
- $v_options[PCLZIP_OPT_BY_INDEX] = $v_options_trick[PCLZIP_OPT_BY_INDEX];
-
- // ----- Look for default option values
- $this->privOptionDefaultThreshold($v_options);
-
- // ----- Call the extracting fct
- if (($v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path, $v_remove_all_path, $v_options)) < 1) {
- return(0);
- }
-
- // ----- Return
- return $p_list;
- }
- // --------------------------------------------------------------------------------
-
- // --------------------------------------------------------------------------------
- // Function :
- // delete([$p_option, $p_option_value, ...])
- // Description :
- // This method removes files from the archive.
- // If no parameters are given, then all the archive is emptied.
- // Parameters :
- // None or optional arguments.
- // Options :
- // PCLZIP_OPT_BY_INDEX :
- // PCLZIP_OPT_BY_NAME :
- // PCLZIP_OPT_BY_EREG :
- // PCLZIP_OPT_BY_PREG :
- // Return Values :
- // 0 on failure,
- // The list of the files which are still present in the archive.
- // (see PclZip::listContent() for list entry format)
- // --------------------------------------------------------------------------------
- function delete()
- {
- $v_result=1;
-
- // ----- Reset the error handler
- $this->privErrorReset();
-
- // ----- Check archive
- if (!$this->privCheckFormat()) {
- return(0);
- }
-
- // ----- Set default values
- $v_options = array();
-
- // ----- Look for variable options arguments
- $v_size = func_num_args();
-
- // ----- Look for arguments
- if ($v_size > 0) {
- // ----- Get the arguments
- $v_arg_list = func_get_args();
-
- // ----- Parse the options
- $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
- array (PCLZIP_OPT_BY_NAME => 'optional',
- PCLZIP_OPT_BY_EREG => 'optional',
- PCLZIP_OPT_BY_PREG => 'optional',
- PCLZIP_OPT_BY_INDEX => 'optional' ));
- if ($v_result != 1) {
- return 0;
- }
- }
-
- // ----- Magic quotes trick
- $this->privDisableMagicQuotes();
-
- // ----- Call the delete fct
- $v_list = array();
- if (($v_result = $this->privDeleteByRule($v_list, $v_options)) != 1) {
- $this->privSwapBackMagicQuotes();
- unset($v_list);
- return(0);
- }
-
- // ----- Magic quotes trick
- $this->privSwapBackMagicQuotes();
-
- // ----- Return
- return $v_list;
- }
- // --------------------------------------------------------------------------------
-
- // --------------------------------------------------------------------------------
- // Function : deleteByIndex()
- // Description :
- // ***** Deprecated *****
- // delete(PCLZIP_OPT_BY_INDEX, $p_index) should be prefered.
- // --------------------------------------------------------------------------------
- function deleteByIndex($p_index)
- {
-
- $p_list = $this->delete(PCLZIP_OPT_BY_INDEX, $p_index);
-
- // ----- Return
- return $p_list;
- }
- // --------------------------------------------------------------------------------
-
- // --------------------------------------------------------------------------------
- // Function : properties()
- // Description :
- // This method gives the properties of the archive.
- // The properties are :
- // nb : Number of files in the archive
- // comment : Comment associated with the archive file
- // status : not_exist, ok
- // Parameters :
- // None
- // Return Values :
- // 0 on failure,
- // An array with the archive properties.
- // --------------------------------------------------------------------------------
- function properties()
- {
-
- // ----- Reset the error handler
- $this->privErrorReset();
-
- // ----- Magic quotes trick
- $this->privDisableMagicQuotes();
-
- // ----- Check archive
- if (!$this->privCheckFormat()) {
- $this->privSwapBackMagicQuotes();
- return(0);
- }
-
- // ----- Default properties
- $v_prop = array();
- $v_prop['comment'] = '';
- $v_prop['nb'] = 0;
- $v_prop['status'] = 'not_exist';
-
- // ----- Look if file exists
- if (@is_file($this->zipname))
- {
- // ----- Open the zip file
- if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
- {
- $this->privSwapBackMagicQuotes();
-
- // ----- Error log
- PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');
-
- // ----- Return
- return 0;
- }
-
- // ----- Read the central directory informations
- $v_central_dir = array();
- if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
- {
- $this->privSwapBackMagicQuotes();
- return 0;
- }
-
- // ----- Close the zip file
- $this->privCloseFd();
-
- // ----- Set the user attributes
- $v_prop['comment'] = $v_central_dir['comment'];
- $v_prop['nb'] = $v_central_dir['entries'];
- $v_prop['status'] = 'ok';
- }
-
- // ----- Magic quotes trick
- $this->privSwapBackMagicQuotes();
-
- // ----- Return
- return $v_prop;
- }
- // --------------------------------------------------------------------------------
-
- // --------------------------------------------------------------------------------
- // Function : duplicate()
- // Description :
- // This method creates an archive by copying the content of an other one. If
- // the archive already exist, it is replaced by the new one without any warning.
- // Parameters :
- // $p_archive : The filename of a valid archive, or
- // a valid PclZip object.
- // Return Values :
- // 1 on success.
- // 0 or a negative value on error (error code).
- // --------------------------------------------------------------------------------
- function duplicate($p_archive)
- {
- $v_result = 1;
-
- // ----- Reset the error handler
- $this->privErrorReset();
-
- // ----- Look if the $p_archive is a PclZip object
- if ((is_object($p_archive)) && (get_class($p_archive) == 'pclzip'))
- {
-
- // ----- Duplicate the archive
- $v_result = $this->privDuplicate($p_archive->zipname);
- }
-
- // ----- Look if the $p_archive is a string (so a filename)
- else if (is_string($p_archive))
- {
-
- // ----- Check that $p_archive is a valid zip file
- // TBC : Should also check the archive format
- if (!is_file($p_archive)) {
- // ----- Error log
- PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "No file with filename '".$p_archive."'");
- $v_result = PCLZIP_ERR_MISSING_FILE;
- }
- else {
- // ----- Duplicate the archive
- $v_result = $this->privDuplicate($p_archive);
- }
- }
-
- // ----- Invalid variable
- else
- {
- // ----- Error log
- PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add");
- $v_result = PCLZIP_ERR_INVALID_PARAMETER;
- }
-
- // ----- Return
- return $v_result;
- }
- // --------------------------------------------------------------------------------
-
- // --------------------------------------------------------------------------------
- // Function : merge()
- // Description :
- // This method merge the $p_archive_to_add archive at the end of the current
- // one ($this).
- // If the archive ($this) does not exist, the merge becomes a duplicate.
- // If the $p_archive_to_add archive does not exist, the merge is a success.
- // Parameters :
- // $p_archive_to_add : It can be directly the filename of a valid zip archive,
- // or a PclZip object archive.
- // Return Values :
- // 1 on success,
- // 0 or negative values on error (see below).
- // --------------------------------------------------------------------------------
- function merge($p_archive_to_add)
- {
- $v_result = 1;
-
- // ----- Reset the error handler
- $this->privErrorReset();
-
- // ----- Check archive
- if (!$this->privCheckFormat()) {
- return(0);
- }
-
- // ----- Look if the $p_archive_to_add is a PclZip object
- if ((is_object($p_archive_to_add)) && (get_class($p_archive_to_add) == 'pclzip'))
- {
-
- // ----- Merge the archive
- $v_result = $this->privMerge($p_archive_to_add);
- }
-
- // ----- Look if the $p_archive_to_add is a string (so a filename)
- else if (is_string($p_archive_to_add))
- {
-
- // ----- Create a temporary archive
- $v_object_archive = new PclZip($p_archive_to_add);
-
- // ----- Merge the archive
- $v_result = $this->privMerge($v_object_archive);
- }
-
- // ----- Invalid variable
- else
- {
- // ----- Error log
- PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add");
- $v_result = PCLZIP_ERR_INVALID_PARAMETER;
- }
-
- // ----- Return
- return $v_result;
- }
- // --------------------------------------------------------------------------------
-
-
-
- // --------------------------------------------------------------------------------
- // Function : errorCode()
- // Description :
- // Parameters :
- // --------------------------------------------------------------------------------
- function errorCode()
- {
- if (PCLZIP_ERROR_EXTERNAL == 1) {
- return(PclErrorCode());
- }
- else {
- return($this->error_code);
- }
- }
- // --------------------------------------------------------------------------------
-
- // --------------------------------------------------------------------------------
- // Function : errorName()
- // Description :
- // Parameters :
- // --------------------------------------------------------------------------------
- function errorName($p_with_code=false)
- {
- $v_name = array ( PCLZIP_ERR_NO_ERROR => 'PCLZIP_ERR_NO_ERROR',
- PCLZIP_ERR_WRITE_OPEN_FAIL => 'PCLZIP_ERR_WRITE_OPEN_FAIL',
- PCLZIP_ERR_READ_OPEN_FAIL => 'PCLZIP_ERR_READ_OPEN_FAIL',
- PCLZIP_ERR_INVALID_PARAMETER => 'PCLZIP_ERR_INVALID_PARAMETER',
- PCLZIP_ERR_MISSING_FILE => 'PCLZIP_ERR_MISSING_FILE',
- PCLZIP_ERR_FILENAME_TOO_LONG => 'PCLZIP_ERR_FILENAME_TOO_LONG',
- PCLZIP_ERR_INVALID_ZIP => 'PCLZIP_ERR_INVALID_ZIP',
- PCLZIP_ERR_BAD_EXTRACTED_FILE => 'PCLZIP_ERR_BAD_EXTRACTED_FILE',
- PCLZIP_ERR_DIR_CREATE_FAIL => 'PCLZIP_ERR_DIR_CREATE_FAIL',
- PCLZIP_ERR_BAD_EXTENSION => 'PCLZIP_ERR_BAD_EXTENSION',
- PCLZIP_ERR_BAD_FORMAT => 'PCLZIP_ERR_BAD_FORMAT',
- PCLZIP_ERR_DELETE_FILE_FAIL => 'PCLZIP_ERR_DELETE_FILE_FAIL',
- PCLZIP_ERR_RENAME_FILE_FAIL => 'PCLZIP_ERR_RENAME_FILE_FAIL',
- PCLZIP_ERR_BAD_CHECKSUM => 'PCLZIP_ERR_BAD_CHECKSUM',
- PCLZIP_ERR_INVALID_ARCHIVE_ZIP => 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP',
- PCLZIP_ERR_MISSING_OPTION_VALUE => 'PCLZIP_ERR_MISSING_OPTION_VALUE',
- PCLZIP_ERR_INVALID_OPTION_VALUE => 'PCLZIP_ERR_INVALID_OPTION_VALUE',
- PCLZIP_ERR_UNSUPPORTED_COMPRESSION => 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION',
- PCLZIP_ERR_UNSUPPORTED_ENCRYPTION => 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION'
- ,PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE => 'PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE'
- ,PCLZIP_ERR_DIRECTORY_RESTRICTION => 'PCLZIP_ERR_DIRECTORY_RESTRICTION'
- );
-
- if (isset($v_name[$this->error_code])) {
- $v_value = $v_name[$this->error_code];
- }
- else {
- $v_value = 'NoName';
- }
-
- if ($p_with_code) {
- return($v_value.' ('.$this->error_code.')');
- }
- else {
- return($v_value);
- }
- }
- // --------------------------------------------------------------------------------
-
- // --------------------------------------------------------------------------------
- // Function : errorInfo()
- // Description :
- // Parameters :
- // --------------------------------------------------------------------------------
- function errorInfo($p_full=false)
- {
- if (PCLZIP_ERROR_EXTERNAL == 1) {
- return(PclErrorString());
- }
- else {
- if ($p_full) {
- return($this->errorName(true)." : ".$this->error_string);
- }
- else {
- return($this->error_string." [code ".$this->error_code."]");
- }
- }
- }
- // --------------------------------------------------------------------------------
-
-
-// --------------------------------------------------------------------------------
-// ***** UNDER THIS LINE ARE DEFINED PRIVATE INTERNAL FUNCTIONS *****
-// ***** *****
-// ***** THESES FUNCTIONS MUST NOT BE USED DIRECTLY *****
-// --------------------------------------------------------------------------------
-
-
-
- // --------------------------------------------------------------------------------
- // Function : privCheckFormat()
- // Description :
- // This method check that the archive exists and is a valid zip archive.
- // Several level of check exists. (futur)
- // Parameters :
- // $p_level : Level of check. Default 0.
- // 0 : Check the first bytes (magic codes) (default value))
- // 1 : 0 + Check the central directory (futur)
- // 2 : 1 + Check each file header (futur)
- // Return Values :
- // true on success,
- // false on error, the error code is set.
- // --------------------------------------------------------------------------------
- function privCheckFormat($p_level=0)
- {
- $v_result = true;
-
- // ----- Reset the file system cache
- clearstatcache();
-
- // ----- Reset the error handler
- $this->privErrorReset();
-
- // ----- Look if the file exits
- if (!is_file($this->zipname)) {
- // ----- Error log
- PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "Missing archive file '".$this->zipname."'");
- return(false);
- }
-
- // ----- Check that the file is readeable
- if (!is_readable($this->zipname)) {
- // ----- Error log
- PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to read archive '".$this->zipname."'");
- return(false);
- }
-
- // ----- Check the magic code
- // TBC
-
- // ----- Check the central header
- // TBC
-
- // ----- Check each file header
- // TBC
-
- // ----- Return
- return $v_result;
- }
- // --------------------------------------------------------------------------------
-
- // --------------------------------------------------------------------------------
- // Function : privParseOptions()
- // Description :
- // This internal methods reads the variable list of arguments ($p_options_list,
- // $p_size) and generate an array with the options and values ($v_result_list).
- // $v_requested_options contains the options that can be present and those that
- // must be present.
- // $v_requested_options is an array, with the option value as key, and 'optional',
- // or 'mandatory' as value.
- // Parameters :
- // See above.
- // Return Values :
- // 1 on success.
- // 0 on failure.
- // --------------------------------------------------------------------------------
- function privParseOptions(&$p_options_list, $p_size, &$v_result_list, $v_requested_options=false)
- {
- $v_result=1;
-
- // ----- Read the options
- $i=0;
- while ($i<$p_size) {
-
- // ----- Check if the option is supported
- if (!isset($v_requested_options[$p_options_list[$i]])) {
- // ----- Error log
- PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid optional parameter '".$p_options_list[$i]."' for this method");
-
- // ----- Return
- return PclZip::errorCode();
- }
-
- // ----- Look for next option
- switch ($p_options_list[$i]) {
- // ----- Look for options that request a path value
- case PCLZIP_OPT_PATH :
- case PCLZIP_OPT_REMOVE_PATH :
- case PCLZIP_OPT_ADD_PATH :
- // ----- Check the number of parameters
- if (($i+1) >= $p_size) {
- // ----- Error log
- PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
-
- // ----- Return
- return PclZip::errorCode();
- }
-
- // ----- Get the value
- $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE);
- $i++;
- break;
-
- case PCLZIP_OPT_TEMP_FILE_THRESHOLD :
- // ----- Check the number of parameters
- if (($i+1) >= $p_size) {
- PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
- return PclZip::errorCode();
- }
-
- // ----- Check for incompatible options
- if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) {
- PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'");
- return PclZip::errorCode();
- }
-
- // ----- Check the value
- $v_value = $p_options_list[$i+1];
- if ((!is_integer($v_value)) || ($v_value<0)) {
- PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Integer expected for option '".PclZipUtilOptionText($p_options_list[$i])."'");
- return PclZip::errorCode();
- }
-
- // ----- Get the value (and convert it in bytes)
- $v_result_list[$p_options_list[$i]] = $v_value*1048576;
- $i++;
- break;
-
- case PCLZIP_OPT_TEMP_FILE_ON :
- // ----- Check for incompatible options
- if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) {
- PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'");
- return PclZip::errorCode();
- }
-
- $v_result_list[$p_options_list[$i]] = true;
- break;
-
- case PCLZIP_OPT_TEMP_FILE_OFF :
- // ----- Check for incompatible options
- if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_ON])) {
- PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_ON'");
- return PclZip::errorCode();
- }
- // ----- Check for incompatible options
- if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) {
- PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_THRESHOLD'");
- return PclZip::errorCode();
- }
-
- $v_result_list[$p_options_list[$i]] = true;
- break;
-
- case PCLZIP_OPT_EXTRACT_DIR_RESTRICTION :
- // ----- Check the number of parameters
- if (($i+1) >= $p_size) {
- // ----- Error log
- PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
-
- // ----- Return
- return PclZip::errorCode();
- }
-
- // ----- Get the value
- if ( is_string($p_options_list[$i+1])
- && ($p_options_list[$i+1] != '')) {
- $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE);
- $i++;
- }
- else {
- }
- break;
-
- // ----- Look for options that request an array of string for value
- ...
[truncated message content] |
|
From: <os...@us...> - 2014-01-17 13:03:01
|
Revision: 5049
http://sourceforge.net/p/oscss/svn/5049
Author: oscim
Date: 2014-01-17 13:02:58 +0000 (Fri, 17 Jan 2014)
Log Message:
-----------
fix and end implements Zip native function php > 5.2
Fix
Modified Paths:
--------------
trunk/catalog/admin/includes/classes/fileUtility.php
trunk/catalog/admin/includes/exts/package/CIP.php
trunk/catalog/admin/includes/exts/package/packageInstaller.php
trunk/catalog/admin/includes/exts/package/tags/extractzip.php
trunk/catalog/admin/includes/modules/configuration/modtemplate.php
Modified: trunk/catalog/admin/includes/classes/fileUtility.php
===================================================================
--- trunk/catalog/admin/includes/classes/fileUtility.php 2014-01-17 12:32:00 UTC (rev 5048)
+++ trunk/catalog/admin/includes/classes/fileUtility.php 2014-01-17 13:02:58 UTC (rev 5049)
@@ -424,8 +424,8 @@
default:
if($optionnal !=null)
- $optionnal = 'ZipArchive::'.$optionnal;
-
+ $optionnal = ' '.constant('ZipArchive::'.$optionnal);
+
if(substr($archive, 0, 1) == '/')
$archive = substr($archive, 1);
Modified: trunk/catalog/admin/includes/exts/package/CIP.php
===================================================================
--- trunk/catalog/admin/includes/exts/package/CIP.php 2014-01-17 12:32:00 UTC (rev 5048)
+++ trunk/catalog/admin/includes/exts/package/CIP.php 2014-01-17 13:02:58 UTC (rev 5049)
@@ -1,9 +1,9 @@
<?php if (!defined('HTTP_SERVER')) die('You can not access this file directly!');
/**
- @licence GPL 2005-2013 The osCSS developers - osCSS Open Source E-commerce
+ @licence GPL 2005-2014 The osCSS developers - osCSS Open Source E-commerce
@portion code Copyright (c) 2002 osCommerce
@package osCSS-2 <www http://www.oscss.org>
- @version 2.1.2
+ @version 2.2.0
@date 07/11/2013, 08:07
@author oscim <mail aur...@os...> <www http://www.oscim.fr>
@encode UTF-8
@@ -27,6 +27,10 @@
include_once(dirname(__FILE__).'/cip_modfiles.php');
+/**
+ @class CIP
+ @brief manage install / remove all extension
+*/
class CIP {
@@ -86,7 +90,7 @@
/**
* '1' if CIP was installed, '0' if not.
*/
- public $cip_installed;
+ public $cip_installed = 0;
/**
@var object
@@ -174,7 +178,7 @@
public function get_contrib_data() {return $this->contrib_data;}
// public function get_error() {return self::$error;}
public function get_cip_id() {return $this->cip_id;}
- public function get_description_id(){return @$this->description_id;}
+ public function get_description_id(){ return @$this->description_id;}
public function get_data($id){return $this->contrib_data[$id];}
//Post install notes:
public function post_install_notes() {
@@ -450,10 +454,14 @@
$clsname='Tc_'.strtolower($noeud->nodeName);
if (class_exists($clsname)){
+
+
$this->contrib_data[]=new $clsname($this, $tagcnt[$noeud->nodeName], $noeud);
if(!$this->check_bylevel(1)){
self::InProcess(__("Erreur lecture XML tag ").$noeud->nodeName, __CLASS__.'->'.__FUNCTION__.'::'.__LINE__,'block');
}
+
+
}
else {
self::InProcess('Tag'.$noeud->nodeName.__(' is not supported. Class ').$clsname.__(' does NOT exist.'), __CLASS__.'->'.__FUNCTION__.'::'.__LINE__,'info');
@@ -461,7 +469,7 @@
}
if(strtoupper($noeud->nodeName) == 'DESCRIPTION') {
- $this->description_id=$p;
+ $this->description_id= count($this->contrib_data) - 1 ;
}
}
@@ -493,7 +501,7 @@
function install($ForTest = true) {
self::$was_unpacked=false;
-
+
if ($this->is_cip_in_zip && $ForTest) {
//We unzip only if we get a zip-filename as a and do not have a unpacked version of CIP.
$this->unpack_cip();
@@ -530,19 +538,21 @@
}
// if no test process
else{
-
+
//! We passed by all checks. So if an error appears
- foreach ($this->contrib_data as $id=>$tag)
+ foreach ($this->contrib_data as $id=>$tag) {
if ( $tag->do_install() ===false){
self::InProcess(__("Erreur durant traitement de cette fonction "),'tag_xml-['.$id.']'. $tag->tag_name.'->do_install()','block');
break;
}
+ }
//! up db etat install cip name if not error
/// error and fatal block install
if (self::check_bylevel(1) !=false)
$this->set_installed();
}
+
}
/**
Modified: trunk/catalog/admin/includes/exts/package/packageInstaller.php
===================================================================
--- trunk/catalog/admin/includes/exts/package/packageInstaller.php 2014-01-17 12:32:00 UTC (rev 5048)
+++ trunk/catalog/admin/includes/exts/package/packageInstaller.php 2014-01-17 13:02:58 UTC (rev 5049)
@@ -161,15 +161,16 @@
$message=$messageStack;
$obj=parent::load_db_values($pkgID);
+
if(!$obj)
return false;
-
+error_reporting(E_ALL);
$obj=$obj[0];
$cip= new CIP( (string)$obj->item->ident.'_'.(string)$obj->item->level.'.zip');
-
- $cip->install(false);
-
+
+ $r=$cip->install(false);
+ var_dump($r);
// print_r(ErrorAndBlockProcess::$ArrayError);
if (ErrorAndBlockProcess::$error) {
$messageStack->add('error in process install', 'error');
@@ -307,7 +308,6 @@
if (isset($data['contrib_ref']) && $data['contrib_ref'] !=0)
$contents[]='<strong><a href="'.$data['contrib_ref'].'" title= "'. __('contribs page alt') . '">' . __('contribs page').'</a></strong>';
-//
if (isset($data['forum_ref']) && $data['forum_ref'] !=0)
$contents[]='<strong><a href="'. $data['forum_ref']. '" title="'. __('contribs forum alt'). '">'. __('contribs forum').'</a></strong>';
@@ -316,14 +316,14 @@
$contents[] = '<br /><h3>'.__('text info contrib').':</h3>';
+
foreach ($data as $key=>$value) {
- $value=htmlspecialchars($value);//convert to entries...
if (!in_array($key,array('post_install_notes','author_pkg','contrib_ref','forum_ref','oscss_forum_ref'))) {
if ($key =='last_update')
- $contents[]='<strong class="label text">'.__('contribs '.$key).'</strong>: '.tep_date_short($value);
+ $contents[]='<strong class="label text">'.__('contribs '.$key).'</strong>: '.tep_date_short( (string)$value);
else
- $contents[]='<strong class="label text">'.__('contribs '.$key).'</strong>: '.nl2br($value);
+ $contents[]='<strong class="label text">'.__('contribs '.$key).'</strong>: '.nl2br( (string)$value);
}
}
return $contents;
Modified: trunk/catalog/admin/includes/exts/package/tags/extractzip.php
===================================================================
--- trunk/catalog/admin/includes/exts/package/tags/extractzip.php 2014-01-17 12:32:00 UTC (rev 5048)
+++ trunk/catalog/admin/includes/exts/package/tags/extractzip.php 2014-01-17 13:02:58 UTC (rev 5049)
@@ -1,18 +1,17 @@
<?php
/**
- @licence GPL 2005-2013 The osCSS developers - osCSS Open Source E-commerce
+ @licence GPL 2005-2014 The osCSS developers - osCSS Open Source E-commerce
@portion code Copyright (c) 2002 osCommerce
@package osCSS-2 <www http://www.oscss.org>
- @version 2.1.1
+ @version 2.2.0
@date 11/04/2012, 18:17
@author oscim <mail aur...@os...> <www http://www.oscim.fr>
@encode UTF-8
-
- exemple:
- <extractzip>
- <zip name="productQuantity.zip" />
- <path name="templates/%TEMPLATE_NAME%/includes/plugins/" />
- </extractzip>
+ @example:
+ <extractzip> \
+ <zip name="productQuantity.zip" /> \
+ <path name="templates/%TEMPLATE_NAME%/includes/plugins/" /> \
+ </extractzip> \
*/
class Tc_extractzip
@@ -24,9 +23,9 @@
*/
protected $zipContent;
/**
- @var object result PclZip
+ @var object result $zip
*/
- protected static $PclZip;
+ protected static $zip;
function __construct($contrib='', $id='', $xml_data='', $dep='') {
$this->params=array(
@@ -55,26 +54,26 @@
$le_file=DIR_FS_CIP.$this->contrib.'/'.$this->data['zip'];
- self::$PclZip = new PclZip( $le_file );
- if($this->cip->is_Windows()) if(!defined('OS_WINDOWS'))define('OS_WINDOWS',1);
- else if(!defined('OS_WINDOWS'))define('OS_WINDOWS',0);
+
+ self::$zip = new ZipArchive;
+
+ $res = self::$zip->open($le_file );
+
+ for ($i=0; $i<self::$zip->numFiles;$i++) {
+ $row= self::$zip->statIndex($i);
+ $this->zipContent[] =array(
+ 'filename'=>$row['name']
+ );
+ }
- $this->zipContent = self::$PclZip->listContent( PCLZIP_OPT_PATH, DIR_FS_CATALOG.$this->data['path'] );
-
$i = 0;
- reset($this->zipContent );
- foreach($this->zipContent as $row){
- $this->data['filename'][$i] = replace_path_admin($this->data['path'].$row['filename']);;
- $this->data['srcdir'][$i] = 'catalog';
- $i++;
-// $rs_filename=replace_path_admin($row['filename']);
-//
-// $path=dirname($rs_filename); //['filename']);
-// $fs_filename = $rs_filename; //['filename'];
-//
+ foreach($this->zipContent as $row){
- }
+ $this->data['filename'][$i] = replace_path_admin($this->data['path'].$row['filename']);;
+ $this->data['srcdir'][$i] = 'catalog';
+ $i++;
+ }
}
@@ -195,7 +194,6 @@
if(file_exists(DIR_FS_CATALOG.$fs_filename) && is_writable(DIR_FS_CATALOG.$fs_filename) ){
if(! fileUtility::_unlink(DIR_FS_CATALOG. $fs_filename) ){
CIP::InProcess(__('write file permissins needed text').' '.$fs_filename, __CLASS__.'->'.__FUNCTION__.'::'.__LINE__,'noblock');
- // return false;
}
}
else{
@@ -222,11 +220,10 @@
reset($this->zipContent);
- $ret = self::$PclZip->extract( PCLZIP_OPT_PATH, DIR_FS_CATALOG.$dir );
-// exit;
+ $ret = self::$zip->extractTo(DIR_FS_CATALOG.$dir );
+
if($ret == 0) {
-// CIP::$error=true;
-// trigger_error(__CLASS__.sprintf(' error %s', __FUNCTION__).__('Unrecoverable error "').$zipfile->errorName(true).$le_file , E_USER_ERROR);
+
CIP::InProcess('check'.__('unpack with error').$file, __CLASS__.'->'.__FUNCTION__.'::'.__LINE__,'block');
return false;
}
Modified: trunk/catalog/admin/includes/modules/configuration/modtemplate.php
===================================================================
--- trunk/catalog/admin/includes/modules/configuration/modtemplate.php 2014-01-17 12:32:00 UTC (rev 5048)
+++ trunk/catalog/admin/includes/modules/configuration/modtemplate.php 2014-01-17 13:02:58 UTC (rev 5049)
@@ -66,7 +66,7 @@
break;
case 'insert':
if ($new_template = new upload('new_template', DIR_FS_TEMPLATES)) {
- tep_zip_extractto(DIR_FS_TEMPLATES.$new_template->filename,DIR_FS_TEMPLATES);
+ fileUtility::extractto(DIR_FS_TEMPLATES.$new_template->filename,DIR_FS_TEMPLATES);
tep_remove(DIR_FS_TEMPLATES.$new_template->filename);
}
tep_redirect(tep_href_link(FILENAME_CONFIGURATION, tep_get_all_get_params(array('action'), false) ));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2014-01-17 12:32:03
|
Revision: 5048
http://sourceforge.net/p/oscss/svn/5048
Author: oscim
Date: 2014-01-17 12:32:00 +0000 (Fri, 17 Jan 2014)
Log Message:
-----------
Fix
Deletes reference for PclZip
Modified Paths:
--------------
trunk/catalog/admin/includes/classes/fileUtility.php
trunk/catalog/install/includes/classes/core.php
trunk/catalog/install/includes/content/core.configuration.php
trunk/catalog/install/includes/content/core.modes.php
trunk/catalog/install/includes/functions/general.php
Modified: trunk/catalog/admin/includes/classes/fileUtility.php
===================================================================
--- trunk/catalog/admin/includes/classes/fileUtility.php 2014-01-17 11:06:13 UTC (rev 5047)
+++ trunk/catalog/admin/includes/classes/fileUtility.php 2014-01-17 12:32:00 UTC (rev 5048)
@@ -385,7 +385,7 @@
}
catch (Exception $e) {
-// print( 'Exception reçue : ' . $e. "\n" );
+ print( 'Exception reçue : ' . $e. "\n" );
return false;
}
}
@@ -404,6 +404,7 @@
empty : for extract zip
OVERWRITE : for extract and rewrite file
@return boolean true, else false
+ @note use language file Core.txt
*/
public static function extractto($archive, $destination, $ext='zip', $optionnal=null) {
global $messageStack;
@@ -434,10 +435,15 @@
$res = $zip->extractTo($destination);
- if ($res === TRUE)
+ if ($res === TRUE) {
+ $messageStack->add(__('@system extract success') , 'success');
+
$zip->close();
- else
- return false;
+
+ } else {
+ $messageStack->add(__('@system extract error'). ' '.$res, 'error' );
+ }
+
}
return true;
}
Modified: trunk/catalog/install/includes/classes/core.php
===================================================================
--- trunk/catalog/install/includes/classes/core.php 2014-01-17 11:06:13 UTC (rev 5047)
+++ trunk/catalog/install/includes/classes/core.php 2014-01-17 12:32:00 UTC (rev 5048)
@@ -31,6 +31,8 @@
@param array is sarray list key/value for option in install
*/
function __construct($option=array()){
+
+
/**
Languages
Reperoire portant le nom de cla clef dans /includes/language/
@@ -161,6 +163,15 @@
global $lang;
return isset($lang[$str]) ? $lang[$str] : $str;
}
+
+ /**
+ @fn tep_zip_extractto($archive, $destination)
+ @brief ExtractTo , alias fileUtility::extractto
+ */
+ function zip_extractto($archive, $destination) {
+ require( $this->get_fs_document_root() . $this->ws_admin_rand . 'includes/classes/fileUtility.php' );
+ return fileUtility::extractto($archive, $destination);
+ }
/**
*/
@@ -396,8 +407,7 @@
$class=(!isset($etape))? 'base' : (is_numeric($etape) ? substr($tab[$etape],5) :$etape ) ;
if(!class_exists($class)) require('includes/content/core.'.$class.'.php');
-
- $etape= new $class($this->config);
+ $etape= new $class();
if(!method_exists($etape,'exe_prev'))return;
if(call_user_func(array($etape,'exe_prev'))) return $etape->exe_prev();
@@ -451,7 +461,7 @@
if(!class_exists($class)) require('includes/content/core.'.$class.'.php');
self::$class=$class;
- $etape= new $class($this->config);
+ $etape= new $class();
$this->get_fs_document_root();
$this->get_server_conf();
Modified: trunk/catalog/install/includes/content/core.configuration.php
===================================================================
--- trunk/catalog/install/includes/content/core.configuration.php 2014-01-17 11:06:13 UTC (rev 5047)
+++ trunk/catalog/install/includes/content/core.configuration.php 2014-01-17 12:32:00 UTC (rev 5048)
@@ -249,7 +249,7 @@
private function install_rewrite(){
if(!isset($_POST['install']['rewrite']) || (isset($_POST['install']['rewrite']) && $_POST['install']['rewrite'] !='on' ) ) {
- tep_zip_extractto('no_rewrite.zip', '../');
+ $this->zip_extractto('no_rewrite.zip', '../');
if(file_exists($this->fs_document_root.'admin'))rename($this->fs_document_root.'admin',$this->fs_document_root.$this->ws_admin_rand);
}
elseif((isset($_POST['install']['rewrite']) && $_POST['install']['rewrite'] =='on' ) ) {
Modified: trunk/catalog/install/includes/content/core.modes.php
===================================================================
--- trunk/catalog/install/includes/content/core.modes.php 2014-01-17 11:06:13 UTC (rev 5047)
+++ trunk/catalog/install/includes/content/core.modes.php 2014-01-17 12:32:00 UTC (rev 5048)
@@ -498,7 +498,6 @@
$file=$this->fs_document_root.'install/old'.$core_rev.'new'.$curent_rev.'_patch.zip';
$oscss_zip = @fopen($file,'wb');
// recup zip
-// var_dump(__FILE__);
/**
Utiliser methode fetchRemote
*/
@@ -511,7 +510,7 @@
// add img sample
sleep(1);
- tep_zip_extractto( $file,'../');
+ $this->zip_extractto( $file,'../');
Modified: trunk/catalog/install/includes/functions/general.php
===================================================================
--- trunk/catalog/install/includes/functions/general.php 2014-01-17 11:06:13 UTC (rev 5047)
+++ trunk/catalog/install/includes/functions/general.php 2014-01-17 12:32:00 UTC (rev 5048)
@@ -47,27 +47,6 @@
/**
-* @package oscss-2
-* @author oscim - OscssTeam
-* @version 1.2
- Extraction des zip pour install
-*/
-function tep_zip_extractto($archive, $destination) {
- if(function_exists("zip_open")) {
- require_once('includes/functions/unzip.php');
- unzip($archive, $destination);
- } else {
- require_once('includes/functions/pclzip.lib.php');
- $archive = new PclZip($archive);
- if ($archive->extract(PCLZIP_OPT_PATH, $destination,
- PCLZIP_OPT_REMOVE_PATH, 'tmp') == 0) {
- die("Error : ".$archive->errorInfo(true));
- }
- return TRUE;
- }
-}
-
-/**
@package oscss-2 <www http://www.oscss.org>
@author oscim <mail os...@os...> <www http://www.oscim.fr>
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2014-01-17 11:06:17
|
Revision: 5047
http://sourceforge.net/p/oscss/svn/5047
Author: oscim
Date: 2014-01-17 11:06:13 +0000 (Fri, 17 Jan 2014)
Log Message:
-----------
Fix
Add pack_zip in fileUtility and implement in CIP suite
Fix title in login page
REmove usage PclZip class for internal Zip content in php > 5.2
Modified Paths:
--------------
trunk/catalog/admin/includes/classes/fileUtility.php
trunk/catalog/admin/includes/exts/package/CIP.php
trunk/catalog/admin/includes/exts/package/packageInstaller.php
trunk/catalog/admin/includes/languages/fr_FR/login.php
trunk/catalog/admin/includes/modules/pages/package.php
Modified: trunk/catalog/admin/includes/classes/fileUtility.php
===================================================================
--- trunk/catalog/admin/includes/classes/fileUtility.php 2014-01-16 15:49:49 UTC (rev 5046)
+++ trunk/catalog/admin/includes/classes/fileUtility.php 2014-01-17 11:06:13 UTC (rev 5047)
@@ -159,7 +159,7 @@
$testpath .= '/'.$row;
if (!file_exists($testpath) && !is_dir($testpath)) {
- if(!mkdir($testpath)) {
+ if(!mkdir($testpath, 0766, true)) {
self::ComportForError(__CLASS__.'->'.__FUNCTION__.'::'.__LINE__.__("cant create dir text"), 'error');
}
}
@@ -279,11 +279,11 @@
$arrReturn = array();
// Scan directory
-// if(file_exists($strFolder))
- foreach (scandir($strFolder) as $strFile) {
- if ($strFile == '.' || $strFile == '..') continue;
- $arrReturn[] = $strFile;
- }
+ if(file_exists($strFolder))
+ foreach (scandir($strFolder) as $strFile) {
+ if ($strFile == '.' || $strFile == '..') continue;
+ $arrReturn[] = $strFile;
+ }
$arrScanCache[$strFolder] = $arrReturn;
return $arrReturn;
@@ -301,7 +301,7 @@
/**
*/
- public static function compress_dir($directory, $file_in, $ext='zip', $delete_file = false, $level = 6) {
+ public static function compress_file($directory, $file_in, $ext='zip', $delete_file = false, $level = 6) {
switch ($ext) {
case 'zip':
case 'gz':
@@ -325,29 +325,91 @@
self::_unlink($in_file);
}
break;
+
}
return true;
}
+ /**
+ @fn compactto($directory, $archive, $ext='zip', $optionnal=null
+ @brief compress in $ext format for directory
+ @param $option String path source or array list file
+ @param $archive String path file for extract
+ @param $ext string type of extension
+ @param $optionnal string
+ List of possiblity value
+ - For Zip/empty type
+ empty : for extract zip
+ OVERWRITE : for extract and rewrite file
+ @return boolean true, else false
+ */
+ public static function compactto($option, $archive, $ext='zip', $optionnal=null) {
+ switch ($ext) {
+ case 'tbz':
+ case 'tbz2':
+ case 'bz2':
+ case 'bz':
+// if(CI_ARCHIVER_BZIP2) @ exec(CI_ARCHIVER_BZIP2.' '.$this->full_path_to_zip().' -d > '. DIR_FS_CIP.'/'.self::$cip_name, $output);
+ break;
+ case 'gz':
+// if(CI_ARCHIVER_GUNZIP) @ exec(CI_ARCHIVER_GUNZIP.' '.$this->full_path_to_zip() .' -c > '. DIR_FS_CIP.'/'.self::$cip_name, $output);
+ break;
+ case 'zip':
+ default:
+
+ if($optionnal !=null)
+ $optionnal = ' | '.constant('ZipArchive::'.$optionnal);
+ try {
+ $zip = new ZipArchive;
+ if(!$zip)
+
+ throw new Exception('Unknown ZipArchive :: '. $zip );
+
+ if(! $zip->open($archive, ZipArchive::CREATE . $optionnal ) ) //$optionnal);
+ throw new Exception('ZipArchive :: not open '. $archive );
+
+ if(is_string($option)) {
+ $Directory = new RecursiveDirectoryIterator ( $option );
+ $Iterator = new RecursiveIteratorIterator ( $Directory );
+ }
+ else
+ $Iterator = $option;
+
+ foreach($Iterator as $row=>$array) {
+ $res= $zip->addFile($row , substr($row, strlen(DIR_FS_CIP)) );
+ }
+
+ if( ! $zip->close() )
+ throw new Exception('ZipArchive :: not save ('. $archive.')' );
+
+ }
+ catch (Exception $e) {
+// print( 'Exception reçue : ' . $e. "\n" );
+ return false;
+ }
+ }
+ return true;
+ }
+
/**
- @package oscss
- @author oscim - OscssTeam
- @version 1.2
- Control la présence d'une constante de langue en remplacement de l'intitulé des menu de l'admin. Si cette constante n'est pas défini, une alerte est produite
- ne préciser que le contenu de la colonne key
+ @fn extractto($archive, $destination,$ext='zip', $optionnal='')
+ @brief Extract and move to
+ @param $archive String path file for extract
+ @param $destination String path destination extract to
+ @param $ext string type of extension
+ @param $optionnal string
+ List of possiblity value
+ - For Zip/empty type
+ empty : for extract zip
+ OVERWRITE : for extract and rewrite file
+ @return boolean true, else false
*/
- public static function extractto($archive, $destination,$ext='zip') {
+ public static function extractto($archive, $destination, $ext='zip', $optionnal=null) {
+ global $messageStack;
+
switch ($ext) {
- case 'zip':
- if(function_exists("zip_open")) {
- require_once(DIR_WS_FUNCTIONS.'unzip.php');
- return unzip($archive, $destination);
- } else {
- $archive = new PclZip($archive);
- if ($archive->extract(PCLZIP_OPT_PATH, $destination, PCLZIP_OPT_REMOVE_PATH, 'tmp') == 0)return false;
- }
- break;
+
case 'tbz':
case 'tbz2':
case 'bz2':
@@ -357,6 +419,25 @@
case 'gz':
// if(CI_ARCHIVER_GUNZIP) @ exec(CI_ARCHIVER_GUNZIP.' '.$this->full_path_to_zip() .' -c > '. DIR_FS_CIP.'/'.self::$cip_name, $output);
break;
+ case 'zip':
+ default:
+
+ if($optionnal !=null)
+ $optionnal = 'ZipArchive::'.$optionnal;
+
+ if(substr($archive, 0, 1) == '/')
+ $archive = substr($archive, 1);
+
+ $zip = new ZipArchive;
+
+ $res = $zip->open($archive, $optionnal ); //$optionnal);
+
+ $res = $zip->extractTo($destination);
+
+ if ($res === TRUE)
+ $zip->close();
+ else
+ return false;
}
return true;
}
Modified: trunk/catalog/admin/includes/exts/package/CIP.php
===================================================================
--- trunk/catalog/admin/includes/exts/package/CIP.php 2014-01-16 15:49:49 UTC (rev 5046)
+++ trunk/catalog/admin/includes/exts/package/CIP.php 2014-01-17 11:06:13 UTC (rev 5047)
@@ -211,24 +211,23 @@
si zip exists > delete
*/
function pack_cip($ext='zip') {
+ global $messageStack;
+
if (!$this->is_unpacked() || $this->is_zipped()) return false;
- if(file_exists(DIR_FS_CIP.escapeshellcmd(self::$cip_name)))
- unlink(DIR_FS_CIP.escapeshellcmd(self::$cip_name));
+
+ if(file_exists(DIR_FS_CIP.escapeshellcmd(self::$cip_name.'.'.$ext)))
+ fileUtility::_unlink(DIR_FS_CIP.escapeshellcmd(self::$cip_name.'.'.$ext));
+
switch ($ext) {
- case 'gzip':
- if(CI_ARCHIVER_GZIP) @exec(CI_ARCHIVER_GZIP.' '.DIR_FS_CIP.escapeshellcmd(self::$cip_name), $output);
- break;
- case 'zip':
- $zipfile = new PclZip($this->full_path_to_zip());
- if($this->is_Windows()) define('OS_WINDOWS',1);
- else define('OS_WINDOWS',0);
+// case 'gzip':
+// if(CI_ARCHIVER_GZIP) @exec(CI_ARCHIVER_GZIP.' '.DIR_FS_CIP.escapeshellcmd(self::$cip_name), $output);
+// break;
+ default:
+ $res = fileUtility::compactto( DIR_FS_CIP . self::$cip_name , $this->full_path_to_zip() , 'zip') ;
- $ret = $zipfile->add(DIR_FS_CIP.escapeshellcmd(self::$cip_name),"",DIR_FS_CIP);
- if($ret == 0) {
- $messageStack->add(__('Unrecoverable error'). ' "'.$zipfile->errorName(true).'"' );
- return false;
- }
- break;
+ if ( _test_bool( $res )) {
+ $messageStack->add_session(__('@package file is ok for install') , 'success');
+ }
}
return true;
}
@@ -240,34 +239,24 @@
global $messageStack;
switch ($ext) {
- case 'zip':
- $zipfile = new PclZip( $this->full_path_to_zip() );
+// case 'tbz':
+// case 'tbz2':
+// case 'bz2':
+// case 'bz':
+// if(CI_ARCHIVER_BZIP2) @ exec(CI_ARCHIVER_BZIP2.' '.$this->full_path_to_zip().' -d > '. DIR_FS_CIP.self::$cip_name, $output);
+// break;
+// case 'gz':
+// if(CI_ARCHIVER_GUNZIP) @ exec(CI_ARCHIVER_GUNZIP.' '.$this->full_path_to_zip() .' -c > '. DIR_FS_CIP.self::$cip_name, $output);
+// break;
+ default:
- $list = $zipfile->listContent();
- if($list[0]['filename'] =='catalog/')
- $dir = DIR_FS_CIP . self::$cip_name;
- else
- $dir = DIR_FS_CIP;
+ $res = fileUtility::extractto($this->full_path_to_zip() , DIR_FS_CIP . self::$cip_name , 'zip', 'OVERWRITE') ;
- if($this->is_Windows() ) { if(!defined('OS_WINDOWS'))define('OS_WINDOWS',1); }
- else { if(!defined('OS_WINDOWS'))define('OS_WINDOWS',0); }
-
- $ret = $zipfile->extract( PCLZIP_OPT_PATH, $dir );
- if($ret == 0) {
- $messageStack->add(__('Unrecoverable error'). ' "'.$zipfile->errorName(true).'"' );
- return false;
- }
- break;
- case 'tbz':
- case 'tbz2':
- case 'bz2':
- case 'bz':
- if(CI_ARCHIVER_BZIP2) @ exec(CI_ARCHIVER_BZIP2.' '.$this->full_path_to_zip().' -d > '. DIR_FS_CIP.self::$cip_name, $output);
- break;
- case 'gz':
- if(CI_ARCHIVER_GUNZIP) @ exec(CI_ARCHIVER_GUNZIP.' '.$this->full_path_to_zip() .' -c > '. DIR_FS_CIP.self::$cip_name, $output);
- break;
+ if ( _test_bool( $res )) {
+ $messageStack->add_session(__('@package file is ok for install') , 'success');
+ }
+
}
}
@@ -380,19 +369,15 @@
*/
public function read_xml() {
global $messageStack;
- if (is_array($this->contrib_data) && count($this->contrib_data)>0)
- self::InProcess(__("[data] contrib_data erreurs "), __CLASS__.'->'.__FUNCTION__.'::'.__LINE__,'error');
+
- if ($this->is_cip_in_zip && ! $this->is_unpacked()) {
- //We unzip only if we get a zip-filename as a and do not have a unpacked version of CIP.
- $this->unpack_cip();
- self::$was_unpacked=true;
- }
+ $this->contrib_data = array();
if ($this->is_unpacked()) {
if(!$this->read_from_xml())
self::InProcess(__("havn't contained well formed XML-file: ").(($this->is_cip_in_zip) ? $this->get_zip_name() : $this->get_cip_name()), __CLASS__.'->'.__FUNCTION__.'::'.__LINE__,'block');
+
//! Erreur fatal before process, delete and exit
if(!$this->check_bylevel(1)){
@@ -417,7 +402,10 @@
$tagcnt = array();
$this->does_have_install_xml();
+
if(!$xmlDoc=new DomDocument()) return false;
+
+
//$xmlDoc->prevservWhiteSpace = false;
if(! $xmlDoc->load(DIR_FS_CIP.self::$cip_name.'/'.self::CONFIG_FILENAME)) return false;
if(!$root = $xmlDoc->documentElement) return false;
@@ -462,7 +450,7 @@
$clsname='Tc_'.strtolower($noeud->nodeName);
if (class_exists($clsname)){
- $this->contrib_data[$p]=new $clsname($this, $tagcnt[$noeud->nodeName], $noeud);
+ $this->contrib_data[]=new $clsname($this, $tagcnt[$noeud->nodeName], $noeud);
if(!$this->check_bylevel(1)){
self::InProcess(__("Erreur lecture XML tag ").$noeud->nodeName, __CLASS__.'->'.__FUNCTION__.'::'.__LINE__,'block');
}
@@ -504,8 +492,14 @@
*/
function install($ForTest = true) {
-// fileUtility::_rmdir(DIR_FS_CIP.$this->get_cip_name());
-
+ self::$was_unpacked=false;
+
+ if ($this->is_cip_in_zip && $ForTest) {
+ //We unzip only if we get a zip-filename as a and do not have a unpacked version of CIP.
+ $this->unpack_cip();
+ self::$was_unpacked=true;
+ }
+
self::$was_unpacked=$this->read_xml();
//! Check min
@@ -551,8 +545,26 @@
}
}
+ /**
+ @brief Construct Zip File based on install.xml
+
+ */
+ function repack() {
+ $this->read_xml();
+
+ if ($this->is_cip_in_zip ) {
+ //We unzip only if we get a zip-filename as a and do not have a unpacked version of CIP.
+ fileUtility::_unlink($this->full_path_to_zip());
+
+ }
+ $this->pack_cip();
+
+ return true;
+ }
+
+
/**
@fn remove($cleaning=false)
@param $cleaning boolean if true, delete all files
Modified: trunk/catalog/admin/includes/exts/package/packageInstaller.php
===================================================================
--- trunk/catalog/admin/includes/exts/package/packageInstaller.php 2014-01-16 15:49:49 UTC (rev 5046)
+++ trunk/catalog/admin/includes/exts/package/packageInstaller.php 2014-01-17 11:06:13 UTC (rev 5047)
@@ -1,17 +1,19 @@
<?php if (!defined('HTTP_SERVER')) die('You can not access this file directly!');
/**
- @licence GPL 2005-2013 The osCSS developers - osCSS Open Source E-commerce
+ @licence GPL 2005-2014 The osCSS developers - osCSS Open Source E-commerce
@portion code Copyright (c) 2002 osCommerce
@package osCSS-2 <www http://www.oscss.org>
@version 2.1.1
@date 30/01/12, 08:07
@author oscim <mail aur...@os...> <www http://www.oscim.fr>
@encode UTF-8
- @class packageInstaller
+ @file packageInstaller.php
*/
if(!class_exists('package')) include_once(DIR_WS_MODULES .'pages/package.php');
-
+/**
+ @class packageInstaller
+*/
class packageInstaller
extends package {
@@ -53,8 +55,27 @@
return -1;
}
+
+ /**
+ @brief Recup du package distant
+ @param $pkgID int internal id
+ @return int OK > 0; KO < 0
+ */
+ public function repack_exts($pkgID){
+ global $messageStack;
+ $obj=parent::load_db_values($pkgID);
+ $obj=$obj[0];
+ $cip= new CIP( (string)$obj->item->ident.'_'.(string)$obj->item->level.'.zip');
+
+
+ if( $cip->repack() > 0)
+ return 5;
+
+ return -1;
+ }
+
/**
@brief View et check package
*/
Modified: trunk/catalog/admin/includes/languages/fr_FR/login.php
===================================================================
--- trunk/catalog/admin/includes/languages/fr_FR/login.php 2014-01-16 15:49:49 UTC (rev 5046)
+++ trunk/catalog/admin/includes/languages/fr_FR/login.php 2014-01-17 11:06:13 UTC (rev 5047)
@@ -1,13 +1,15 @@
<?php
/**
- @licence GPL 2005-2013 The osCSS developers - osCSS Open Source E-commerce
+ @licence GPL 2005-2014 The osCSS developers - osCSS Open Source E-commerce
@portion code Copyright (c) 2002 osCommerce
@package osCSS-2 <www http://www.oscss.org>
- @version 2.1.1
+ @version 2.2.0
@date 20/05/2012, 11:09
@author oscim <mail aur...@os...> <www http://www.oscim.fr>
@encode UTF-8
*/
+define('TITLE',"osCSS" );
+
define('HEADING_RETURNING_ADMIN',"Panneau d'ouverture :" );
define('HEADING_RETURNING_ADMIN_LG_CHOOSE',"Choix de la langue" );
define('HEADING_PASSWORD_FORGOTTEN',"Mot de passe oublié :" );
Modified: trunk/catalog/admin/includes/modules/pages/package.php
===================================================================
--- trunk/catalog/admin/includes/modules/pages/package.php 2014-01-16 15:49:49 UTC (rev 5046)
+++ trunk/catalog/admin/includes/modules/pages/package.php 2014-01-17 11:06:13 UTC (rev 5047)
@@ -1,16 +1,20 @@
<?php if (!defined('HTTP_SERVER')) die('You can not access this file directly!');
/**
- @licence GPL 2005-2013 The osCSS developers - osCSS Open Source E-commerce
+ @licence GPL 2005-2014 The osCSS developers - osCSS Open Source E-commerce
@portion code Copyright (c) 2002 osCommerce
@package osCSS-2 <www http://www.oscss.org>
- @version 2.1.1
+ @version 2.2.0
@date 02/01/2012, 18:17
@author oscim <mail aur...@os...> <www http://www.oscim.fr>
@encode UTF-8
+ @file package.php
+ @dir /admin/includes/modules/pages/
+*/
+
+/**
@class package
@brief manage , install, remove extension , plugin and module in core osCSS
*/
-
class package
implements ExtModPage, InterfacedTJsonS, InterfaceModule {
@@ -320,14 +324,27 @@
*/
case 'download':
$class=self::$code.'Installer';
+
if(!tep_class_exists('exts_'.self::$code.'_'.$class)) return false;
$obj=new $class;
- $obj->download_exts((string)$_GET['pkgID']);
+ $res = $obj->download_exts((string)$_GET['pkgID']);
// self::load_db_values(self::REPOSITORY_OFFICIAL,'action=view');
break;
+ /**
+ @remarks
+ */
+ case 'repack':
+ $class=self::$code.'Installer';
+ if(!tep_class_exists('exts_'.self::$code.'_'.$class)) return false;
+ $obj=new $class;
+
+ $res = $obj->repack_exts((string)$_GET['pkgID']);
+
+ break;
+
/**
@remarks
*/
@@ -599,6 +616,16 @@
/**
@remarks Normal display
*/
+ case 'download':
+ printf(CsrtAction::getLink('row_action_right', __('view'), 'continue'), '', tep_href_link(self::FILENAME, 'pkgID=' . (string)$_GET['pkgID'] . '&action=view') ,'' );
+ break;
+ case 'rebuild':
+ printf(CsrtAction::getLink('row_action_right', __('repack'), 'continue'), '', tep_href_link(self::FILENAME, 'pkgID=' . (string)$_GET['pkgID'] . '&action=repack') ,'' );
+ break;
+ case 'repack':
+
+ printf(CsrtAction::getLink('row_action_right', __('finish'), 'continue'), '', tep_href_link(self::FILENAME) ,'' );
+ break;
case 'upload':
break;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2014-01-16 15:49:52
|
Revision: 5046
http://sourceforge.net/p/oscss/svn/5046
Author: oscim
Date: 2014-01-16 15:49:49 +0000 (Thu, 16 Jan 2014)
Log Message:
-----------
Fix Datepicker in Backoffice Core
Clean
Fix css link
Modified Paths:
--------------
trunk/catalog/admin/includes/gabarit/orders/filter.clause.gab
trunk/catalog/admin/includes/gabarit/products/display_view.edit.gab
trunk/catalog/admin/includes/header.php
trunk/catalog/admin/includes/javascript/modules/pages/orders.js.php
trunk/catalog/admin/includes/javascript/modules/pages/products.js.php
trunk/catalog/admin/includes/modules/pages/orders.php
trunk/catalog/admin/includes/template/oscss/css/less/styles.less
Modified: trunk/catalog/admin/includes/gabarit/orders/filter.clause.gab
===================================================================
--- trunk/catalog/admin/includes/gabarit/orders/filter.clause.gab 2014-01-16 14:14:09 UTC (rev 5045)
+++ trunk/catalog/admin/includes/gabarit/orders/filter.clause.gab 2014-01-16 15:49:49 UTC (rev 5046)
@@ -1,12 +1,14 @@
<?php
/**
- @licence GPL 2005-2013 The osCSS developers - osCSS Open Source E-commerce
+ @licence GPL 2005-2014 The osCSS developers - osCSS Open Source E-commerce
@portion code Copyright (c) 2002 osCommerce
@package osCSS-2 <www http://www.oscss.org>
@version 2.1.1
@date 22/04/2012 ,22:50:08
@author oscim <mail aur...@os...> <www http://www.oscim.fr>
@encode UTF-8
+ @file filter.clause.gab
+ @dir /admin/includes/gabarit/orders/
*/
?>
<fieldset>
@@ -14,11 +16,11 @@
<ul class="inline">
<li class="inline">
<label for="filters[dates][start]"><?php echo __('@orders text date start'); ?></label>
- <?php echo tep_draw_input_field('filters[dates][start]', 'filters_start', tep_date_short( @$_SESSION['filters']['dates']['start'] ), ' maxlength="10" size="10"') . tep_draw_hidden_field('bt_filters_start'); ?>
+ <?php echo tep_draw_input_field('filters[dates][start]', 'filters_start', tep_date_short( @$_SESSION['filters']['dates']['start'] ), ' class="inputdate" maxlength="10" size="10"') ; ?>
</li>
<li class="inline">
<label for="filters[dates][end]"><?php echo __('@orders text date end'); ?></label>
- <?php echo tep_draw_input_field('filters[dates][end]', 'filters_end', tep_date_short( @$_SESSION['filters']['dates']['end'] ), ' maxlength="10" size="10"') . tep_draw_hidden_field('bt_filters_end'); ?>
+ <?php echo tep_draw_input_field('filters_end', 'filters_end', tep_date_short( @$_SESSION['filters']['dates']['end'] ), ' class="inputdate" maxlength="10" size="10"'); ?>
</li>
<li class="inline">
<?php echo ' ' . __('@orders text date format'); ?>
Modified: trunk/catalog/admin/includes/gabarit/products/display_view.edit.gab
===================================================================
--- trunk/catalog/admin/includes/gabarit/products/display_view.edit.gab 2014-01-16 14:14:09 UTC (rev 5045)
+++ trunk/catalog/admin/includes/gabarit/products/display_view.edit.gab 2014-01-16 15:49:49 UTC (rev 5046)
@@ -303,9 +303,9 @@
<?php if(products::CheckClassProduct('CLASS_DATE_AVAIBLE')): ?>
<p>
<label class="inline" for="products_date_available" title="<?php echo __('@products text date available help') ?>"><?php echo __('@products text date available'); ?></label>
- <?php echo tep_draw_input_field('products_date_available', '',( (tep_not_null(products::$Info->date_available) && !in_array(products::$Info->date_available, array('0000-00-00 00:00:00', '1000-01-01 00:00:00') ) ) ? tep_date_short(products::$Info->date_available) : ''), ' maxlength="10" size="10" style="min-width:30px;" ') . tep_draw_hidden_field('bt_products_date_available') . ' ' . __('@products display date format'); ?>
+ <?php echo tep_draw_input_field('products_date_available', '',( (tep_not_null(products::$Info->date_available) && !in_array(products::$Info->date_available, array('0000-00-00 00:00:00', '1000-01-01 00:00:00') ) ) ? tep_date_short(products::$Info->date_available) : ''), ' class="inputdate" maxlength="10" size="10" style="min-width:30px;" ') . ' ' . __('@products display date format'); ?>
</p>
- <?php endif; ?>
+ <?php endif; ?>
</dd>
<!-- All LinkTo -->
Modified: trunk/catalog/admin/includes/header.php
===================================================================
--- trunk/catalog/admin/includes/header.php 2014-01-16 14:14:09 UTC (rev 5045)
+++ trunk/catalog/admin/includes/header.php 2014-01-16 15:49:49 UTC (rev 5046)
@@ -32,6 +32,7 @@
// ui plugin jquery
tep_include_file ("includes/javascript/jquery-ui.min.js",true);
tep_include_file ("includes/javascript/jquery.cookie.js",true);
+ tep_include_file (DIR_WS_JS."timepicker.js",true);
if ( ($lng=language::LangueSelected()) && $lng != 'en') tep_include_file ("includes/javascript/jquery-ui-i18n.min.js",true);
tep_include_file (DIR_WS_JS."jquery.fancybox.pack.js",true);
@@ -43,21 +44,48 @@
tep_include_file (DIR_WS_JS."jquery.dataTables.editable.js",true);
+
+
+
if(defined('JSONSTATMENT')){
//! plugin add tools table
tep_include_file (DIR_WS_JS."dataTables.TableTools/ZeroClipboard/ZeroClipboard.js",true);
tep_include_file (DIR_WS_JS."dataTables.TableTools/js/TableTools.min.js",true);
}
+
+
+
?>
+<script type="text/javascript"><!--
-
+ // date picker
+ $(function() {
+ $.datepicker.setDefaults($.extend({
+ duration: '',
+ changeMonth: true,
+ changeYear: true,
+ showOn: 'button',
+ buttonImage: '<?php echo CsrtAction::getFullPathIcon('calendar'); ?>',
+ buttonImageOnly: true
+ }
+ <?php if (($lng=language::LangueSelected())&& $lng != 'en') echo ",\n"."$.datepicker.regional['".$lng."']"."\n"; ?>
+ ));
+
+ /*$('input[type=date]')*/
+ $('input.inputdate').each( function () {
+ var attid = $(this).attr('id');
+ $(this).after( '<input type="hidden" name="bt_'+ attid +'" value="..." title="..">');
+
+ $(this).next().datepicker({altField: '#' + attid });
+ });
+ });
<?php
/**
Section for use , and all manipluate listing by plugi jquery dataTable
*/
?>
-<script type="text/javascript"><!--
+
// init jquery
$(function() {
Modified: trunk/catalog/admin/includes/javascript/modules/pages/orders.js.php
===================================================================
--- trunk/catalog/admin/includes/javascript/modules/pages/orders.js.php 2014-01-16 14:14:09 UTC (rev 5045)
+++ trunk/catalog/admin/includes/javascript/modules/pages/orders.js.php 2014-01-16 15:49:49 UTC (rev 5046)
@@ -1,15 +1,18 @@
<?php if (!defined('HTTP_SERVER')) die('You can not access this file directly!');
/**
- @licence GPL 2005-2013 The osCSS developers - osCSS Open Source E-commerce
+ @licence GPL 2005-2014 The osCSS developers - osCSS Open Source E-commerce
@portion code Copyright (c) 2002 osCommerce
@package osCSS-2 <www http://www.oscss.org>
- @version 2.1.1
- @date 10/08/12, 17:30
+ @version 2.2.0
+ @date 28/03/2012, 17:30
@author oscim <mail aur...@os...> <www http://www.oscim.fr>
@encode UTF-8
+ @file orders.js.php
+ @dir /admin/includes/javascript/modules/page/
*/
?>
+
<?php if (orders::$action == 'edit'): ?>
<script type="text/javascript"><!--
@@ -59,9 +62,8 @@
var self = OSCSS_JSCORE.orders.utils;
})(); // fin de scope locale
+<?php endif; ?>
//--></script>
+
-<?php oscss_cstr::CallBack('OSCSS_JSCORE.orders.utils.Init();'); // Active check key ?>
-
-<?php endif; ?>
\ No newline at end of file
Modified: trunk/catalog/admin/includes/javascript/modules/pages/products.js.php
===================================================================
--- trunk/catalog/admin/includes/javascript/modules/pages/products.js.php 2014-01-16 14:14:09 UTC (rev 5045)
+++ trunk/catalog/admin/includes/javascript/modules/pages/products.js.php 2014-01-16 15:49:49 UTC (rev 5046)
@@ -19,7 +19,7 @@
OSCSS_JSCORE.products = OSCSS_JSCORE.products || {};
// déclaration de la classe de validation proprement dite
-OSCSS_JSCORE.products.utlis = {
+OSCSS_JSCORE.products.utils = {
// déclaration de nos variables statiques
loopfinal : {},
@@ -182,7 +182,7 @@
};
// trick JavaScript pour émuler le self:: en PHP : on utilise une variable locale
-var self = OSCSS_JSCORE.products.utlis;
+var self = OSCSS_JSCORE.products.utils;
})(); // fin de scope locale
@@ -242,33 +242,10 @@
// --></script>
-<?php if (products::$action == 'edit'): ?>
+<?php if (products::$action == 'noedit'): ?>
<script type="text/javascript"><!--
$(function() {
- $.datepicker.setDefaults($.extend({
- duration: '',
- changeMonth: true,
- changeYear: true,
- showOn: 'button',
- buttonImage: '<?php echo CsrtAction::getFullPathIcon('calendar'); ?>',
- buttonImageOnly: true
- }
- <?php if (($lng=language::LangueSelected())&& $lng != 'en') echo ",\n"."$.datepicker.regional['".$lng."']"."\n"; ?>
- ));
- $('#bt_products_date_available').datepicker({altField: '#products_date_available'});
-
-
- <?php oscss_cstr::CallBack('OSCSS_JSCORE.products.utlis.Init();'); // Active check key ?>
-
- });
-
- //--></script>
-
-<?php elseif (products::$action == 'noedit'): ?>
- <script type="text/javascript"><!--
-
- $(function() {
$('input[type=text],input[type=radio],input[type=checkbox], textarea, select').attr('disabled', 'disabled');
});
Modified: trunk/catalog/admin/includes/modules/pages/orders.php
===================================================================
--- trunk/catalog/admin/includes/modules/pages/orders.php 2014-01-16 14:14:09 UTC (rev 5045)
+++ trunk/catalog/admin/includes/modules/pages/orders.php 2014-01-16 15:49:49 UTC (rev 5046)
@@ -98,6 +98,8 @@
$status=(isset($_REQUEST['status'])? (string)$_REQUEST['status'] : '' );
+ self::$modules=new AcaFactory(__CLASS__);
+
MGabCont::SetCurrentName(__CLASS__);
self::$export= new export(__CLASS__);
@@ -477,7 +479,6 @@
*/
self::actionFilter();
-
// status orders restric list
foreach($_POST['filters']['viewstatus'] as $key=>$row){
if( $row =='on' )
@@ -933,9 +934,10 @@
@return no return
*/
public function get_header(){
+
tep_include_file(DIR_WS_JS . "modules/pages/".__CLASS__.".js.php",true);
- /** aca */ //self::$modules->get_header_js();
+ /** aca */ self::$modules->get_header_js();
}
Modified: trunk/catalog/admin/includes/template/oscss/css/less/styles.less
===================================================================
--- trunk/catalog/admin/includes/template/oscss/css/less/styles.less 2014-01-16 14:14:09 UTC (rev 5045)
+++ trunk/catalog/admin/includes/template/oscss/css/less/styles.less 2014-01-16 15:49:49 UTC (rev 5046)
@@ -147,7 +147,7 @@
}
}
.Ctrtirroir {
- background:transparent url("../defaut/img/1/icons/icon_down.gif") left top no-repeat;
+ background:transparent url("../defaut/img/1/icon_down.gif") left top no-repeat;
padding-left:20px;
height:@lineheight;
font-weight:bold;
@@ -159,7 +159,7 @@
background-color: @bg_hover;
}
}
-.Ctrtirroir.closed {background:transparent url("../defaut/img/1/icons/icon_arrow_right.gif") left top no-repeat; }
+.Ctrtirroir.closed {background:transparent url("../defaut/img/1/icon_arrow_right.gif") left top no-repeat; }
fieldset ul.tirroir li { float: left; position: relative; width: auto;}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2014-01-16 14:14:14
|
Revision: 5045
http://sourceforge.net/p/oscss/svn/5045
Author: oscim
Date: 2014-01-16 14:14:09 +0000 (Thu, 16 Jan 2014)
Log Message:
-----------
Fix display icon in listing by datatables.js
Fix version
Modified Paths:
--------------
trunk/catalog/Documents/oscss.version.xml
trunk/catalog/admin/includes/header.php
Modified: trunk/catalog/Documents/oscss.version.xml
===================================================================
--- trunk/catalog/Documents/oscss.version.xml 2014-01-16 10:26:09 UTC (rev 5044)
+++ trunk/catalog/Documents/oscss.version.xml 2014-01-16 14:14:09 UTC (rev 5045)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<core>
- <version>2.1.2</version>
- <svn>4478</svn>
+ <version>2.2.0</version>
+ <svn>4040</svn>
<level>unstable</level>
<template_admin>oscss</template_admin>
Modified: trunk/catalog/admin/includes/header.php
===================================================================
--- trunk/catalog/admin/includes/header.php 2014-01-16 10:26:09 UTC (rev 5044)
+++ trunk/catalog/admin/includes/header.php 2014-01-16 14:14:09 UTC (rev 5045)
@@ -1,13 +1,15 @@
<?php
/**
- @licence GPL 2005-2013 The osCSS developers - osCSS Open Source E-commerce
+ @licence GPL 2005-2014 The osCSS developers - osCSS Open Source E-commerce
@portion code Copyright (c) 2002 osCommerce
@package osCSS-2 <www http://www.oscss.org>
- @version 2.1.2
+ @version 2.2.0
@date 12/07/2013, 18:17
@author oscim <mail aur...@os...> <www http://www.oscim.fr>
@encode UTF-8
@brief block in balise html head.
+ @file header.php
+ @dir /admin/includes/
*/
global $languages_id;
/**
@@ -85,7 +87,7 @@
if ( this.src.match('details_close') )
{
/* This row is already open - close it */
- this.src = "<?php echo tep_get_http().DIR_WS_TEMPLATE . "/img/".$_SESSION['login_groups_id'].'/' ?>details_open.png";
+ this.src = "<?php echo CsrtAction::getFullPathIcon('details_open'); ?>";
/* fnClose doesn't do anything for server-side processing - do it ourselves :-) */
var nRemove = $(nTr).next()[0];
nRemove.parentNode.removeChild( nRemove );
@@ -93,7 +95,7 @@
else {
var aData = oTable.fnGetData( nTr );
/* Open this row */
- this.src = "<?php echo tep_get_http().DIR_WS_TEMPLATE . "/img/".$_SESSION['login_groups_id'].'/' ?>details_close.png";
+ this.src = "<?php echo CsrtAction::getFullPathIcon('details_close'); ?>";
var res = '<table id="detail_'+aData[0] +'" cellpadding="5" cellspacing="0" border="0" style="padding:0 1em; width:100%;">' + '</table>';
oTable.fnOpen( nTr, res , 'details' );
@@ -170,7 +172,7 @@
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
/* Append img in row */
- $('td:eq(0)', nRow).html( '<img class="imgDetail" src="<?php echo tep_get_http().DIR_WS_ADMIN.DIR_WS_ICONS ?>details_open.png">' );
+ $('td:eq(0)', nRow).html( '<img class="imgDetail" src="<?php echo CsrtAction::getFullPathIcon('details_open'); ?>">' );
return nRow;
},
<?php else: ?>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2014-01-16 10:26:14
|
Revision: 5044
http://sourceforge.net/p/oscss/svn/5044
Author: oscim
Date: 2014-01-16 10:26:09 +0000 (Thu, 16 Jan 2014)
Log Message:
-----------
Fix ajax call n activate module
Clean code
Fix display popupin address_book
Modified Paths:
--------------
trunk/catalog/admin/includes/modules/account/address_book.php
trunk/catalog/admin/includes/modules/configuration/modexpedition.php
trunk/catalog/admin/includes/modules/configuration/modpayment.php
trunk/catalog/includes/classes/shopping_cart_action.php
Modified: trunk/catalog/admin/includes/modules/account/address_book.php
===================================================================
--- trunk/catalog/admin/includes/modules/account/address_book.php 2014-01-16 10:04:45 UTC (rev 5043)
+++ trunk/catalog/admin/includes/modules/account/address_book.php 2014-01-16 10:26:09 UTC (rev 5044)
@@ -659,7 +659,8 @@
break;
}
-// return $contents;
+ // Fix for called by ajax and Popup
+ return $contents;
}
Modified: trunk/catalog/admin/includes/modules/configuration/modexpedition.php
===================================================================
--- trunk/catalog/admin/includes/modules/configuration/modexpedition.php 2014-01-16 10:04:45 UTC (rev 5043)
+++ trunk/catalog/admin/includes/modules/configuration/modexpedition.php 2014-01-16 10:26:09 UTC (rev 5044)
@@ -6,12 +6,16 @@
@date 06/01/2014, 11:28
@author oscim <mail aur...@os...> <www http://www.oscim.fr>
@encode UTF-8
- @class modexpedition
+ @dir /admin/includes/modules/configuration/
+ @file modexpedition.php
*/
define('FILENAME_CFG_127',"gparentID=".$_GET['gparentID']."&gID=".$_GET['gID']."&");
+/**
+ @class modexpedition
+*/
Class modexpedition
implements ext_configuration
{
@@ -364,7 +368,7 @@
$exclude=array('action','mod','forceajax','type','class','function','funct', 'mod');
$query_s=FILENAME_CFG_127.'action=modules&mod=' . $row->content->code.'&flag=';
- return '<a class="ajaxinline" href="' . tep_href_link(FILENAME_CONFIGURATION, tep_get_all_get_params($exclude).$query_s.(($row->status == '1')? '0' : '1') ) . '">'.
+ return '<a href="' . tep_href_link(FILENAME_CONFIGURATION, tep_get_all_get_params($exclude).$query_s.(($row->status == '1')? '0' : '1') ) . '">'.
sprintf(
CsrtAction::getFormat('row_flag'),
(int)$row->status,
Modified: trunk/catalog/admin/includes/modules/configuration/modpayment.php
===================================================================
--- trunk/catalog/admin/includes/modules/configuration/modpayment.php 2014-01-16 10:04:45 UTC (rev 5043)
+++ trunk/catalog/admin/includes/modules/configuration/modpayment.php 2014-01-16 10:26:09 UTC (rev 5044)
@@ -6,10 +6,13 @@
@date 06/01/2014, 11:28
@author oscim <mail aur...@os...> <www http://www.oscim.fr>
@encode UTF-8
+ @dir /admin/includes/modules/configuration/
+ @file modexpedition.php
+*/
+
+/**
@class modpayment
*/
-
-
Class modpayment
implements ext_configuration
{
@@ -352,9 +355,9 @@
*/
public static function GetStatusMod($row){
$exclude=array('action','mod','forceajax','type','class','function','funct', 'mod');
- $query_s=FILENAME_CFG.'action=modules&mod=' . $row->content->code.'&flag=';
+ $query_s=FILENAME_CFG.'&action=modules&mod=' . $row->content->code.'&flag=';
- return '<a class="ajaxinline" href="' . tep_href_link(FILENAME_CONFIGURATION, tep_get_all_get_params($exclude).$query_s.(($row->status == '1')? '0' : '1') ) . '">'.
+ return '<a href="' . tep_href_link(FILENAME_CONFIGURATION, tep_get_all_get_params($exclude).$query_s.(($row->status == '1')? '0' : '1') ) . '">'.
sprintf(
CsrtAction::getFormat('row_flag'),
(int)$row->status,
Modified: trunk/catalog/includes/classes/shopping_cart_action.php
===================================================================
--- trunk/catalog/includes/classes/shopping_cart_action.php 2014-01-16 10:04:45 UTC (rev 5043)
+++ trunk/catalog/includes/classes/shopping_cart_action.php 2014-01-16 10:26:09 UTC (rev 5044)
@@ -11,6 +11,7 @@
@dir /includes/classes/
*/
+
/**
@class shopping_cart_action
@brief Traitement des action sur le shopping cart par l'intermediaire d'une fonction
@@ -19,14 +20,11 @@
/**
- @var object shoppingCart
+ @var Panier d'achat client
*/
public $cart;
+
/**
- @var string
- */
- public $action;
- /**
@var array action autorised and exe by this class
*/
protected static $actionCart = array(
@@ -192,7 +190,10 @@
tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $_GET['products_id']));
else
- $this->cart->add_cart($_GET['products_id'], $this->cart->get_quantity($_GET['products_id'])+1);
+ $this->cart->add_cart(
+ $_GET['products_id'],
+ $this->cart->get_quantity($_GET['products_id'])+1
+ );
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2014-01-16 10:04:51
|
Revision: 5043
http://sourceforge.net/p/oscss/svn/5043
Author: oscim
Date: 2014-01-16 10:04:45 +0000 (Thu, 16 Jan 2014)
Log Message:
-----------
Fix class config and re-xrite content in config
Fix stock module and add code for correct view, edit, listing
Add in stock message for update
Fix
Modified Paths:
--------------
trunk/catalog/admin/includes/classes/drivers/sqlextrafieldsto.php
trunk/catalog/admin/includes/gabarit/products/stock.doctor.gab
trunk/catalog/admin/includes/gabarit/products/stock.edit.gab
trunk/catalog/admin/includes/gabarit/products/stock.listing.gab
trunk/catalog/admin/includes/modules/pages/customers.php
trunk/catalog/admin/includes/modules/pages/stock.php
trunk/catalog/common/classes/Config.php
trunk/catalog/includes/classes/drivers/data/product.php
Modified: trunk/catalog/admin/includes/classes/drivers/sqlextrafieldsto.php
===================================================================
--- trunk/catalog/admin/includes/classes/drivers/sqlextrafieldsto.php 2014-01-16 09:12:44 UTC (rev 5042)
+++ trunk/catalog/admin/includes/classes/drivers/sqlextrafieldsto.php 2014-01-16 10:04:45 UTC (rev 5043)
@@ -1,18 +1,20 @@
<?php if (!defined('HTTP_SERVER')) die('You can not access this file directly!');
/**
- @licence GPL 2005-2013 The osCSS developers - osCSS Open Source E-commerce
+ @licence GPL 2005-2014 The osCSS developers - osCSS Open Source E-commerce
@portion code Copyright (c) 2002 osCommerce
@package osCSS-2 <www http://www.oscss.org>
- @version 2.1.2
+ @version 2.2.0
@date 15/10/2013, 15:46
@author oscim <mail aur...@os...> <www http://www.oscim.fr>
@encode UTF-8
-
+ @file sqlextrafieldsto.php
+ @dir /admin/includes/classes/drivers/
*/
-
-
+/**
+ @class sqlextrafieldsto
+*/
class sqlextrafieldsto
{
@@ -127,14 +129,14 @@
$val='';
while($extra_fields = tep_db_fetch_array($extra_fields_query)) {
-
+ // clean current data
self::delete(array('id'=>$extra_fields['id'], 'data_id'=>(int)$id));
$val = array();
+
$obj = new stdClass();
-
- $obj->id = $extra_fields['id'];
- $obj->type = $extra_fields['type'];
+ $obj->id = (int)$extra_fields['id'];
+ $obj->input_type = (int)$extra_fields['type'];
$obj->input_name = (string)'fields_'.$extra_fields['id'];
$obj->active_value_language = 0;
Modified: trunk/catalog/admin/includes/gabarit/products/stock.doctor.gab
===================================================================
--- trunk/catalog/admin/includes/gabarit/products/stock.doctor.gab 2014-01-16 09:12:44 UTC (rev 5042)
+++ trunk/catalog/admin/includes/gabarit/products/stock.doctor.gab 2014-01-16 10:04:45 UTC (rev 5043)
@@ -1,11 +1,14 @@
<?php
/**
- @licence GPL 2005-2010 The osCSS developers - osCSS Open Source E-commerce
+ @licence GPL 2005-2014 The osCSS developers - osCSS Open Source E-commerce
+ @portion code Copyright (c) 2002 osCommerce
@package osCSS-2 <www http://www.oscss.org>
- @version 2.0.9
- @date 17/07/10, 16:35
+ @version 2.2.0
+ @date 11/09/11, 10:45
@author oscim <mail aur...@os...> <www http://www.oscim.fr>
@encode UTF-8
+ @file stock.doctor.gab
+ @dir /admin/includes/gabarit/products/
*/
?>
<h3><?php echo __('qtpro doctor') ?></h3>
Modified: trunk/catalog/admin/includes/gabarit/products/stock.edit.gab
===================================================================
--- trunk/catalog/admin/includes/gabarit/products/stock.edit.gab 2014-01-16 09:12:44 UTC (rev 5042)
+++ trunk/catalog/admin/includes/gabarit/products/stock.edit.gab 2014-01-16 10:04:45 UTC (rev 5043)
@@ -1,19 +1,22 @@
<?php
/**
- @licence GPL 2005-2010 The osCSS developers - osCSS Open Source E-commerce
+ @licence GPL 2005-2014 The osCSS developers - osCSS Open Source E-commerce
+ @portion code Copyright (c) 2002 osCommerce
@package osCSS-2 <www http://www.oscss.org>
- @version 2.0.9
- @date 17/07/10, 16:35
+ @version 2.2.0
+ @date 11/09/11, 10:45
@author oscim <mail aur...@os...> <www http://www.oscim.fr>
@encode UTF-8
+ @file stock.edit.gab
+ @dir /admin/includes/gabarit/products/
*/
?>
-<h3><?php echo __('products stock') . ': ' . stock::$product_name . ''; ?></h3>
+<h3><?php printf( __('@stock heading edit %s') , stock::$product_name ); ?></h3>
<div id="ret_ajax"></div>
<div class="box_left">
- <?php print tep_draw_form('productstock', stock::FILENAME, 'product_id='.stock::$pID.(isset($_GET['forceajax']) || isset($_GET['forceview'])? '&forceview=true':'') , 'post', (isset($_GET['forceajax']) && isset($_GET['forceview'])? 'class="fancy"' :'') ) ; ?>
+ <?php print tep_draw_form('productstock', stock::FILENAME, 'product_id='.stock::$pID , 'post', (isset($_GET['forceajax']) && isset($_GET['forceview'])? 'class="fancy"' :'') ) ; ?>
<table class="dataTableBase">
<tr>
@@ -52,21 +55,27 @@
</tr>
<tr>
- <?php if (stock::$by_attribute_stock) {
- reset(stock::$options);
- while(list($k,$v)=each(stock::$options)) {
- echo "<td><select name=option$k>";
- foreach($v as $v1) {
- echo "<option value=".$v1[1].">".$v1[0];
- }
- echo "</select></td>";
- }
- } ?>
- <td>
- <input type="text" name="quantity" size="4" value="<?php echo stock::$db_quantity ?>">
- <input type="hidden" name="product_id" value="<?php echo stock::$pID ?>">
- </td>
- <td class="row_action"><input class="button" type="submit" name="action" value="<?php echo (stock::$by_attribute_stock ?"Add":"Update") ?>"></td>
+ <?php if (stock::$by_attribute_stock) {
+ reset(stock::$options);
+ while(list($k,$v)=each(stock::$options)) {
+ echo "<td><select name=option$k>";
+ foreach($v as $v1) {
+ echo "<option value=".$v1[1].">".$v1[0];
+ }
+ echo "</select></td>";
+ }
+ } ?>
+ <td>
+ <input type="text" name="quantity" size="4" value="<?php echo stock::$db_quantity ?>">
+ <input type="hidden" name="product_id" value="<?php echo stock::$pID ?>">
+ <?php if(isset($_GET['origin'])): ?>
+ <input type="hidden" name="origin" value="<?php echo $_GET['origin'] ?>">
+ <?php endif; ?>
+ <?php if(isset($_GET['forceajax'])): ?>
+ <input type="hidden" name="forceajax" value="<?php echo $_GET['forceajax'] ?>">
+ <?php endif; ?>
+ </td>
+ <td class="row_action"><input class="button" type="submit" name="action" value="<?php echo (stock::$by_attribute_stock ?"Add":"Update") ?>"></td>
</tr>
</table>
Modified: trunk/catalog/admin/includes/gabarit/products/stock.listing.gab
===================================================================
--- trunk/catalog/admin/includes/gabarit/products/stock.listing.gab 2014-01-16 09:12:44 UTC (rev 5042)
+++ trunk/catalog/admin/includes/gabarit/products/stock.listing.gab 2014-01-16 10:04:45 UTC (rev 5043)
@@ -1,19 +1,21 @@
<?php
/**
- @licence GPL 2005-2013 The osCSS developers - osCSS Open Source E-commerce
+ @licence GPL 2005-2014 The osCSS developers - osCSS Open Source E-commerce
@portion code Copyright (c) 2002 osCommerce
@package osCSS-2 <www http://www.oscss.org>
- @version 2.1.1
- @date 30/03/2012, 09:32
+ @version 2.2.0
+ @date 11/09/11, 10:45
@author oscim <mail aur...@os...> <www http://www.oscim.fr>
@encode UTF-8
+ @file stock.listing.gab
+ @dir /admin/includes/gabarit/products/
*/
global $languages_id, $currencies;
require(DIR_WS_CLASSES . 'tracked_stock.php');
$tracked_stock = new tracked_stock();
?>
-<h3><?php echo __('products stock'); ?></h3>
+<h3><?php echo __('@stock heading listing'); ?></h3>
<div>
@@ -23,12 +25,12 @@
<table class="dataTable">
<thead>
<tr>
- <th style="width:3%" class="tcenter"><?php echo __('table heading id'); ?></th>
- <th style="width:10%" class="tcenter"><?php echo __('table heading name'); ?></th>
- <th style="width:10%" class="tcenter"><?php echo __('table heading model'); ?></th>
- <th style="width:25%" class="tleft"><?php echo __('table heading stock'); ?></th>
- <th style="width:12%" class="tleft"><?php echo __('table heading mode stock'); ?></th>
- <th style="width:12%" class="tleft"><?php echo __('table heading action'); ?></th>
+ <th style="width:3%" class="tcenter"><?php echo __('@stock table heading id'); ?></th>
+ <th style="width:10%" class="tcenter"><?php echo __('@stock table heading name'); ?></th>
+ <th style="width:10%" class="tcenter"><?php echo __('@stock table heading model'); ?></th>
+ <th style="width:25%" class="tleft"><?php echo __('@stock table heading stock'); ?></th>
+ <th style="width:12%" class="tleft"><?php echo __('@stock table heading mode stock'); ?></th>
+ <th style="width:12%" class="tleft"><?php echo __('@stock table heading action'); ?></th>
</tr>
</thead>
<tbody>
Modified: trunk/catalog/admin/includes/modules/pages/customers.php
===================================================================
--- trunk/catalog/admin/includes/modules/pages/customers.php 2014-01-16 09:12:44 UTC (rev 5042)
+++ trunk/catalog/admin/includes/modules/pages/customers.php 2014-01-16 10:04:45 UTC (rev 5043)
@@ -303,6 +303,14 @@
'text'=>__('@customers table heading date added'),
'width'=>'8%',
'class'=>'tcenter',
+// 'edit'=>array(
+// 'input_name'=>'customers_info_date_account_created',
+// 'input_size'=>'5',
+// 'reedit'=>false,
+// 'position_col'=>'right',
+// 'position_grp'=>5
+// ),
+
);
self::$allfields['ci.customers_info_date_account_last_modified'] = array(
'sort'=>true,
@@ -310,12 +318,27 @@
'text'=>__('@customers table heading last modified'),
'width'=>'8%',
'class'=>'tcenter',
+// 'edit'=>array(
+// 'input_name'=>'customers_info_date_account_last_modified',
+// 'input_size'=>'5',
+// 'reedit'=>false,
+// 'position_col'=>'right',
+// 'position_grp'=>5
+// ),
);
self::$allfields['ci.customers_info_date_of_last_logon'] = array(
'sort'=>true,
'alias'=>'last_logon',
'text'=>__('@customers table heading last logon'),
'class'=>'tright',
+ 'default'=>true,
+// 'edit'=>array(
+// 'input_name'=>'customers_info_date_of_last_logon',
+// 'input_size'=>'20',
+// 'reedit'=>false,
+// 'position_col'=>'right',
+// 'position_grp'=>5
+// ),
);
self::$allfields['ci.customers_info_number_of_logons'] = array(
'sort'=>true,
@@ -323,6 +346,13 @@
'text'=>__('@customers table heading number of logons'),
'default'=>true,
'class'=>'tcenter',
+ 'edit'=>array(
+ 'input_name'=>'customers_info_number_of_logons',
+ 'input_size'=>'5',
+ 'reedit'=>false,
+ 'position_col'=>'right',
+ 'position_grp'=>9
+ ),
);
Modified: trunk/catalog/admin/includes/modules/pages/stock.php
===================================================================
--- trunk/catalog/admin/includes/modules/pages/stock.php 2014-01-16 09:12:44 UTC (rev 5042)
+++ trunk/catalog/admin/includes/modules/pages/stock.php 2014-01-16 10:04:45 UTC (rev 5043)
@@ -1,15 +1,20 @@
<?php if (!defined('HTTP_SERVER')) die('You can not access this file directly!');
/**
- @licence GPL 2005-2013 The osCSS developers - osCSS Open Source E-commerce
+ @licence GPL 2005-2014 The osCSS developers - osCSS Open Source E-commerce
@portion code Copyright (c) 2002 osCommerce
@package osCSS-2 <www http://www.oscss.org>
- @version 2.1.1
- @date 11/04/2012, 10:32
+ @version 2.2.0
+ @date 11/09/11, 10:45
@author oscim <mail aur...@os...> <www http://www.oscim.fr>
@encode UTF-8
- @class currencies
+ @file stock.php
+ @dir /admin/includes/modules/pages/
*/
+/**
+ @class stock
+ @brief display and manage allstock by attribute or not
+*/
class stock
implements ExtModPage, InterfaceModule {
@@ -76,10 +81,16 @@
@fn check_action($actions)
@brief
*/
- public function check_action($actions){
- global $messageStack;
+ public function check_action($actions){
+ global $languages_id,$language , $messageStack;
$DB=Database::getInstance();
+ $Cfg = Config::getInstance();
+
+
+ $oscss = oscss_cstr::getInstance();
+ $oscss->pile_file_lang(DIR_FS_ADMIN.DIR_WS_LANGUAGES.$language.'/Stock.txt');
+
self::$action=$actions;
@@ -103,7 +114,7 @@
}
}
- if (!(is_numeric($_POST['quantity']) and ($_POST['quantity']==(int)$_POST['quantity']))) $inputok = false;
+ if (!(is_numeric($VARS['quantity']) and ($VARS['quantity']==(int)$VARS['quantity']))) $inputok = false;
if (($inputok)) {
sort($val_array, SORT_NUMERIC);
@@ -114,15 +125,15 @@
$stock_item=$q->fetchAssoc();
$stock_id=$stock_item['stock_id'];
- if ($_POST['quantity']=intval($_POST['quantity']))
- $DB->query($sql="update " . TABLE_PRODUCTS_STOCK . " set products_stock_quantity='" . (int)$_POST['quantity']. "' where products_stock_id='".$stock_id."'");
+ if ($VARS['quantity']=intval($VARS['quantity']))
+ $DB->query($sql="update " . TABLE_PRODUCTS_STOCK . " set products_stock_quantity='" . (int)$VARS['quantity']. "' where products_stock_id='".$stock_id."'");
else
- $DB->query($sql="delete from " . TABLE_PRODUCTS_STOCK . " where products_stock_id='".$stock_id."'");
+ $DB->query($sql="delete from " . TABLE_PRODUCTS_STOCK . " where products_stock_id='".$stock_id."'");
}
else
- $DB->query($sql="insert into " . TABLE_PRODUCTS_STOCK . " values (0," .self::$pID . ",'$val','" . (int)$_POST['quantity'] . "' )");
+ $DB->query($sql="insert into " . TABLE_PRODUCTS_STOCK . " values (0," .self::$pID . ",'$val','" . (int)$VARS['quantity'] . "' )");
$q=$DB->query("select sum(products_stock_quantity) as summa from " . TABLE_PRODUCTS_STOCK . " where products_id='" . self::$pID . "' and products_stock_quantity>0");
@@ -130,31 +141,38 @@
$summa= (empty($list['summa'])) ? 0 : $list['summa'];
$DB->query("update " . TABLE_PRODUCTS . " set products_quantity=$summa where products_id=" . self::$pID);
- if (($summa<1) && (STOCK_ALLOW_CHECKOUT == 'false')) {
+ if (($summa<1) && !$Cfg->GetConf('STOCK_ALLOW_CHECKOUT') ) {
$DB->query("update " . TABLE_PRODUCTS . " set products_status='0' where products_id=" . self::$pID);
}
}
-// if(!isset($_GET['origin']))
- tep_redirect(tep_href_link(self::FILENAME, 'product_id=' . self::$pID.(isset($_GET['forceajax']) || isset($_GET['forceview'])? '&forceview=true':'') ) );
-// else
-// tep_redirect(tep_href_link($_GET['origin']));
+ if(!isset($VARS['origin']))
+ tep_redirect(tep_href_link(self::FILENAME, 'product_id=' . self::$pID.(isset($VARS['forceajax']) || isset($VARS['forceview'])? '&forceview=true':'') ) );
+ else
+ tep_redirect(tep_href_link($VARS['origin']));
break;
-
+ /**
+ @brief Normal update master table stock
+ */
case "update":
- tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity=" . (int)$_POST['quantity'] . " where products_id=" . self::$pID);
- if (($_POST['quantity']<1) && (STOCK_ALLOW_CHECKOUT == 'false')) {
- tep_db_query("update " . TABLE_PRODUCTS . " set products_status='0' where products_id=" . self::$pID);
- }
- tep_redirect(tep_href_link(self::FILENAME, 'product_id=' . self::$pID.(isset($_GET['forceajax']) || isset($_GET['forceview'])? '&forceview=true':'') ));
- // if(!isset($_GET['origin'])) tep_redirect(tep_href_link(self::FILENAME, 'product_id=' . self::$pID.(isset($_GET['forceajax']) && isset($_GET['forceview']))? '&forceview=true':''));
- // else tep_redirect($_GET['origin']);
+ // adjust global row in master table product
+ if( ! tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity=" . (int)$VARS['quantity'] . " where products_id=" . self::$pID) )
+ $messageStack->add_session(__('@stock error in update stock'), 'error');
+ else
+ $messageStack->add_session(__('@stock success update stock'), 'success');
+
+
+ if(!isset($VARS['origin']))
+ tep_redirect(tep_href_link(self::FILENAME, 'product_id=' . self::$pID.(isset($VARS['forceajax']) && isset($VARS['forceview']))? '&forceview=true':''));
+ else
+ tep_redirect($VARS['origin']);
+
break;
case "Apply to all":
break;
Modified: trunk/catalog/common/classes/Config.php
===================================================================
--- trunk/catalog/common/classes/Config.php 2014-01-16 09:12:44 UTC (rev 5042)
+++ trunk/catalog/common/classes/Config.php 2014-01-16 10:04:45 UTC (rev 5043)
@@ -55,7 +55,8 @@
if($admin)
$this->admin = true;
- $this->conf = $conf;
+ if($conf != false)
+ $this->conf = $conf;
}
Modified: trunk/catalog/includes/classes/drivers/data/product.php
===================================================================
--- trunk/catalog/includes/classes/drivers/data/product.php 2014-01-16 09:12:44 UTC (rev 5042)
+++ trunk/catalog/includes/classes/drivers/data/product.php 2014-01-16 10:04:45 UTC (rev 5043)
@@ -1,9 +1,9 @@
<?php
/**
- @licence GPL 2005-2013 The osCSS developers - osCSS Open Source E-commerce
+ @licence GPL 2005-2014 The osCSS developers - osCSS Open Source E-commerce
@portion code Copyright (c) 2002 osCommerce
@package osCSS-2 <www http://www.oscss.org>
- @version 2.1.1
+ @version 2.2.0
@date 01/01/2012, 18:17
@author oscim <mail aur...@os...> <www http://www.oscim.fr>
@encode UTF-8
@@ -342,10 +342,12 @@
*/
public static function GetExtraFields($_id, $key=''){
$array= array();
-
+ $DB=Database::getInstance();
+
+
if(isset(self::$object_data[(int)$_id]) && isset(self::$object_data[(int)$_id]->extra) && empty($key) )$array= self::$object_data[(int)$_id]->extra;
else {
- $DB=Database::getInstance();
+
$array=array();
$sql = "SELECT
e.fields_id as id,
@@ -369,10 +371,15 @@
$epf_query = $DB->query($sql);
while( $e = $epf_query->fetchAssoc() ) {
+ $value = '';
+ $val = $DB->query( $sql ="SELECT p2epf.value as value FROM " . TABLE_EXTRA_FIELDS_TO . " p2epf WHERE p2epf.fields_id=".$e['id']." AND data_type='product' AND data_id = '" . (int)$_id . "' AND languages_id='". (($e['value_language']==1 && !in_array( (int)$e['input_type'] , array(4,2)) )? self::$lg_id : 0)."' " );
+
+ if($val !=false && $val->__get('numRows')){
+ $result = $val->fetchAssoc();
+ $value = $result['value'];
+ }
- $val = $DB->query( $sql ="SELECT p2epf.value as value FROM " . TABLE_EXTRA_FIELDS_TO . " p2epf WHERE p2epf.fields_id=".$e['id']." AND data_type='product' AND data_id = '" . (int)$_id . "' AND languages_id='". (($e['value_language']==1 && !in_array( (int)$e['input_type'] , array(4,2)) )? self::$lg_id : 0)."' ");
- $result = $val->fetchAssoc();
switch((int)$e['input_type'] ) {
case 2: // radio
@@ -380,20 +387,20 @@
case 6: // select mutli
case 7: // checkbox mutli
case 3: // checkbox
- $val = self::GetEFValue($e['id'] ,$result['value'] , (($e['value_language']==1)? self::$lg_id : 0) );
+ $value = self::GetEFValue($e['id'] ,$value , (($e['value_language']==1)? self::$lg_id : 0) );
break;
- case 0: // classic
- case 1: // textarea
- case 5: // hidden
- default:
- $val = $result['value'];
+// case 0: // classic
+// case 1: // textarea
+// case 5: // hidden
+// default:
+// $val = $value;
}
$array[ (!empty($e['epf_key'])?$e['fkey'] :$e['id']) ]=new objectInfo( array(
'label'=>(string)$e['label'],
'name'=>(string)$e['label'], // obsolete
- 'value' => $val, // obsolete
- 'input_value' => $val,
+ 'value' => $value, // obsolete
+ 'input_value' => $value,
'epf_key'=>(string)$e['fkey'],
'epf_id'=>(int)$e['id'], // obsolete
'id'=>(int)$e['id'],
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2014-01-16 09:12:47
|
Revision: 5042
http://sourceforge.net/p/oscss/svn/5042
Author: oscim
Date: 2014-01-16 09:12:44 +0000 (Thu, 16 Jan 2014)
Log Message:
-----------
Fix
Modified Paths:
--------------
trunk/catalog/admin/includes/classes/drivers/sqlproduct.php
Modified: trunk/catalog/admin/includes/classes/drivers/sqlproduct.php
===================================================================
--- trunk/catalog/admin/includes/classes/drivers/sqlproduct.php 2014-01-16 08:21:23 UTC (rev 5041)
+++ trunk/catalog/admin/includes/classes/drivers/sqlproduct.php 2014-01-16 09:12:44 UTC (rev 5042)
@@ -119,17 +119,9 @@
$post['products_id'] = $products_id;
}
- $tmp = (array)(isset($option['sqlarray'])? $option['sqlarray'] : array() );
-
- $sql_data_array = array();
- foreach($tmp as $key=>$row )
- if(!in_array($key, array('id', 'date_added', 'last_modified', 'weight_brut') ) && !is_array($row)){
- if(in_array($key, array('track_stock', 'manufacturers_id') ) )
- $sql_data_array[$key] = $row;
- else
- $sql_data_array['products_'.$key] = $row;
- }
+ $sql_data_array = (array)(isset($option['sqlarray'])? $option['sqlarray'] : array() );
+
if(( $origin = self::fetch($option, true) ) && !$origin )
$action = 'insert_product';
else
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2014-01-16 08:21:25
|
Revision: 5041
http://sourceforge.net/p/oscss/svn/5041
Author: oscim
Date: 2014-01-16 08:21:23 +0000 (Thu, 16 Jan 2014)
Log Message:
-----------
Fix UTf8 in cli mode
Fix Status delete
Modified Paths:
--------------
trunk/catalog/admin/includes/classes/drivers/sqlstatus.php
trunk/dev/_top.php
trunk/dev/cli_install.php
trunk/test/phpunit/Back/_top.php
trunk/test/phpunit/Front/_top.php
Modified: trunk/catalog/admin/includes/classes/drivers/sqlstatus.php
===================================================================
--- trunk/catalog/admin/includes/classes/drivers/sqlstatus.php 2014-01-16 08:06:11 UTC (rev 5040)
+++ trunk/catalog/admin/includes/classes/drivers/sqlstatus.php 2014-01-16 08:21:23 UTC (rev 5041)
@@ -6,13 +6,16 @@
@date 06/01/2014, 11:28
@author oscim <mail aur...@os...> <www http://www.oscim.fr>
@encode UTF-8
- @class sqlstatus
@file sqlstatus.php
+ @dir /admin/includes/classes/drivers/
*/
-
+/**
+ @class sqlstatus
+ @brief manage sql status table
+*/
class sqlstatus
implements ModSqlDataDriver{
@@ -169,16 +172,19 @@
self::getInstance();
$DB=Database::getInstance();
+ $where ='';
if(isset($option['id']))
- $where = " where status_id = '" .(int)tep_db_input($option['id']) . "'";
- elseif(isset($option['type']))
- $where = " where status_type = '" .(string)tep_db_input($option['type']) . "'";
- elseif(isset($option['language_id']))
- $where = " where language_id = '" .(int)tep_db_input($option['language_id']) . "'";
- else
+ $where .= " AND status_id = '" .(int)tep_db_input($option['id']) . "'";
+ if(isset($option['type']))
+ $where .= " AND status_type = '" .(string)tep_db_input($option['type']) . "'";
+ if(isset($option['language_id']))
+ $where .= " AND language_id = '" .(int)tep_db_input($option['language_id']) . "'";
+
+
+ if(strlen($where) == 0)
return false;
- $DB->query("delete from " . TABLE_STATUS . $where );
+ $DB->query($sql="delete from " . TABLE_STATUS . ' WHERE 1 '.$where );
return true;
Modified: trunk/dev/_top.php
===================================================================
--- trunk/dev/_top.php 2014-01-16 08:06:11 UTC (rev 5040)
+++ trunk/dev/_top.php 2014-01-16 08:21:23 UTC (rev 5041)
@@ -40,6 +40,10 @@
if ( substr( php_sapi_name() , 0, 3) != 'cli')
die('Use cli for execute this script'."\n");
+@ini_set('cli_server.color', 1 );
+@ini_set('default_charset', "utf-8" );
+@ini_set('mbstring.internal_encodin', "utf-8" );
+
// init file core oscss
if(!@include_once($path_base.'includes/appli_top_Test.php'))
die ('no found appli_top_Test.php '."\n");
Modified: trunk/dev/cli_install.php
===================================================================
--- trunk/dev/cli_install.php 2014-01-16 08:06:11 UTC (rev 5040)
+++ trunk/dev/cli_install.php 2014-01-16 08:21:23 UTC (rev 5041)
@@ -54,6 +54,10 @@
$_SERVER['SERVER_PORT']='80';
$_SERVER['REMOTE_ADDR']='1';
+@ini_set('cli_server.color', 1 );
+@ini_set('default_charset', "utf-8" );
+@ini_set('mbstring.internal_encodin', "utf-8" );
+
// block if not cli mode
if ( substr( php_sapi_name() , 0, 3) != 'cli')
die('Use cli for execute this script'."\n");
Modified: trunk/test/phpunit/Back/_top.php
===================================================================
--- trunk/test/phpunit/Back/_top.php 2014-01-16 08:06:11 UTC (rev 5040)
+++ trunk/test/phpunit/Back/_top.php 2014-01-16 08:21:23 UTC (rev 5041)
@@ -33,9 +33,10 @@
- @ini_set('cli_server.color', 1 );
+@ini_set('cli_server.color', 1 );
+@ini_set('default_charset', "utf-8" );
+@ini_set('mbstring.internal_encodin', "utf-8" );
-
// init file core oscss
if(!@include_once($base_path.'includes/appli_top_Test.php'))
die ('no found appli_top_Test.php '."\n");
Modified: trunk/test/phpunit/Front/_top.php
===================================================================
--- trunk/test/phpunit/Front/_top.php 2014-01-16 08:06:11 UTC (rev 5040)
+++ trunk/test/phpunit/Front/_top.php 2014-01-16 08:21:23 UTC (rev 5041)
@@ -18,7 +18,11 @@
$_SERVER['HTTP_HOST'] = 'localhost.tld';
$_SERVER['REQUEST_URI'] = '';
+@ini_set('cli_server.color', 1 );
+@ini_set('default_charset', "utf-8" );
+@ini_set('mbstring.internal_encodin', "utf-8" );
+
// init file core oscss
if(!@include('includes/appli_top_Test.php'))
die ('no found appli_top_Test.php');
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2014-01-16 08:06:14
|
Revision: 5040
http://sourceforge.net/p/oscss/svn/5040
Author: oscim
Date: 2014-01-16 08:06:11 +0000 (Thu, 16 Jan 2014)
Log Message:
-----------
Fix link icon
Add methode for call just icon fullpath declared in template BO
Fix call class ExtraUtility
Adjust comment in head file
Modified Paths:
--------------
trunk/catalog/admin/includes/classes/oscss_cstr.php
trunk/catalog/admin/includes/javascript/modules/pages/products.js.php
trunk/catalog/admin/includes/modules/account/account_extra.php
trunk/catalog/common/classes/ExtraUtility.php
Modified: trunk/catalog/admin/includes/classes/oscss_cstr.php
===================================================================
--- trunk/catalog/admin/includes/classes/oscss_cstr.php 2014-01-14 10:23:23 UTC (rev 5039)
+++ trunk/catalog/admin/includes/classes/oscss_cstr.php 2014-01-16 08:06:11 UTC (rev 5040)
@@ -368,6 +368,7 @@
}
/**
+ @fn getIcon($code)
@brief check and return file for icon code
@param $code unique id icon in data xml
@return string file name
@@ -376,8 +377,31 @@
$ref=self::$SimpleP->img->icon;
if(isset($ref->$code)) return (string)$ref->$code;
}
-
+
+ /**
+ @fn getFullPathIcon($code)
+ @brief return fullpath icon
+ @param $code unique id icon in data xml
+ @return string path file name
+ */
+ public static function getFullPathIcon($code){
+ $cdig = self::getIcon($code);
+ $file_img='';
+
+ // use template admin
+ if( file_exists( DIR_WS_TEMPLATE . 'img/' .$_SESSION['login_groups_id'] . '/' . $cdig ) )
+ $file_img = DIR_WS_TEMPLATE . 'img/' .$_SESSION['login_groups_id'] . '/' . $cdig ;
+ elseif( file_exists( DIR_WS_INCLUDES . 'template/defaut/img/' .$_SESSION['login_groups_id'] . '/' . $cdig ) )
+ $file_img = DIR_WS_INCLUDES . 'template/defaut/img/' .$_SESSION['login_groups_id'] . '/' . $cdig;
+ elseif( file_exists( DIR_WS_INCLUDES . 'template/defaut/img/1/' . $cdig ) )
+ $file_img = DIR_WS_INCLUDES . 'template/defaut/img/1/' . $cdig;
+
+ return $file_img;
+ }
+
+
/**
+ @fn getFormat($code)
@brief check and return file for icon code
@param $code unique id icon in data xml
@return string file name
@@ -409,16 +433,8 @@
$w=( ( (int)$obj->icon[0]['width']>0)? (int)$obj->icon[0]['width'] : '');
$h=( ( (int)$obj->icon[0]['height']>0)? (int)$obj->icon[0]['height'] : '');
- $cdig = self::getIcon($codeImg);
-
- // use template admin
- if( file_exists( DIR_WS_TEMPLATE . 'img/' .$_SESSION['login_groups_id'] . '/' . $cdig ) )
- $file_img = DIR_WS_TEMPLATE . 'img/' .$_SESSION['login_groups_id'] . '/' . $cdig ;
- elseif( file_exists( DIR_WS_INCLUDES . 'template/defaut/img/' .$_SESSION['login_groups_id'] . '/' . $cdig ) )
- $file_img = DIR_WS_INCLUDES . 'template/defaut/img/' .$_SESSION['login_groups_id'] . '/' . $cdig;
- elseif( file_exists( DIR_WS_INCLUDES . 'template/defaut/img/1/' . $cdig ) )
- $file_img = DIR_WS_INCLUDES . 'template/defaut/img/1/' . $cdig;
-
+ $file_img = self::getFullPathIcon($codeImg);
+
if(isset($obj->icon[0]['src']) && (bool)$obj->icon[0]['src']){
$i=image_ratio::get_image($file_img ,$txt , $w,$h);
$img=$i['src'];
Modified: trunk/catalog/admin/includes/javascript/modules/pages/products.js.php
===================================================================
--- trunk/catalog/admin/includes/javascript/modules/pages/products.js.php 2014-01-14 10:23:23 UTC (rev 5039)
+++ trunk/catalog/admin/includes/javascript/modules/pages/products.js.php 2014-01-16 08:06:11 UTC (rev 5040)
@@ -1,12 +1,14 @@
<?php if (!defined('HTTP_SERVER')) die('You can not access this file directly!');
/**
- @licence GPL 2005-2013 The osCSS developers - osCSS Open Source E-commerce
+ @licence GPL 2005-2014 The osCSS developers - osCSS Open Source E-commerce
@portion code Copyright (c) 2002 osCommerce
@package osCSS-2 <www http://www.oscss.org>
- @version 2.1.1
+ @version 2.2.0
@date 28/03/2012, 17:30
@author oscim <mail aur...@os...> <www http://www.oscim.fr>
@encode UTF-8
+ @file products.js.php
+ @dir /admin/includes/javascript/modules/page/
*/
?>
@@ -249,7 +251,7 @@
changeMonth: true,
changeYear: true,
showOn: 'button',
- buttonImage: '<?php echo DIR_WS_ICONS . 'calendar.gif';?>',
+ buttonImage: '<?php echo CsrtAction::getFullPathIcon('calendar'); ?>',
buttonImageOnly: true
}
<?php if (($lng=language::LangueSelected())&& $lng != 'en') echo ",\n"."$.datepicker.regional['".$lng."']"."\n"; ?>
Modified: trunk/catalog/admin/includes/modules/account/account_extra.php
===================================================================
--- trunk/catalog/admin/includes/modules/account/account_extra.php 2014-01-14 10:23:23 UTC (rev 5039)
+++ trunk/catalog/admin/includes/modules/account/account_extra.php 2014-01-16 08:06:11 UTC (rev 5040)
@@ -10,6 +10,10 @@
@brief This module is use generic fields, not use for fields content one owner (for fields_special_mod is null )
*/
+// var_dump( include_once( DIR_FS_CATALOG . DIR_WS_COMMON_CLASSES . 'ExtraUtility.php') );
+// exit;
+include_once( DIR_FS_CATALOG . DIR_WS_COMMON_CLASSES . 'ExtraUtility.php');
+
class account_extra
implements InterfaceModule{
/**
@@ -67,7 +71,7 @@
/// create cache for speed load page
$osCSS_Cache = new osCSS_Cache();
- if ($osCSS_Cache->read('product-'.MGabCont::CallSt('GetClassDatatype').'-'.__CLASS__.'-' . $languages_id.'-type', 720))
+ if ($osCSS_Cache->read('extra-'.MGabCont::CallSt('GetClassDatatype').'-'.__CLASS__.'-' . $languages_id.'-type', 720))
$epf = $osCSS_Cache->getCache();
else {
$languages = tep_get_languages();
@@ -89,17 +93,17 @@
// 'width'=>'8%',
'class'=>'tleft',
'position_tab'=>'extra',
-// 'edit'=>array(
-// 'input_type'=>ExtraUtility::GetInputType($e['fields_input_type']),
-// 'input_size'=>$e['fields_size'],
-// 'input_name'=> (string)'fields_'.$e['fields_id'],
-// // 'values_list'=>array(
-// // array('id'=>0, 'text'=>__('@customers text status off') ),
-// // array('id'=>1, 'text'=>__('@customers text status on') ),
-// // ),
-// 'position_col'=>'extra',
-// 'position_grp'=>3
-// ),
+ 'edit'=>array(
+ 'input_type'=>ExtraUtility::GetInputType($e['fields_input_type']),
+ 'input_size'=>$e['fields_size'],
+ 'input_name'=> (string)'fields_'.$e['fields_id'],
+// 'values_list'=>array(
+// array('id'=>0, 'text'=>__('@customers text status off') ),
+// array('id'=>1, 'text'=>__('@customers text status on') ),
+// ),
+ 'position_col'=>'extra',
+ 'position_grp'=>3
+ ),
);
}
Modified: trunk/catalog/common/classes/ExtraUtility.php
===================================================================
--- trunk/catalog/common/classes/ExtraUtility.php 2014-01-14 10:23:23 UTC (rev 5039)
+++ trunk/catalog/common/classes/ExtraUtility.php 2014-01-16 08:06:11 UTC (rev 5040)
@@ -1,11 +1,17 @@
<?php if (!defined('HTTP_SERVER')) die('You can not access this file directly!');
/**
- @licence GPL 2005-2013 The osCSS developers - osCSS Open Source E-commerce
+ @licence GPL 2005-2014 The osCSS developers - osCSS Open Source E-commerce
@package osCSS-2 <www http://www.oscss.org>
- @version 2.1.2
+ @version 2.2.0
@date 12/07/2013, 20:14
@author oscim <mail aur...@os...> <www http://www.oscim.fr>
@encode UTF-8
+ @file ExtraUtility.php
+ @dir /common/classes/
+*/
+
+
+/**
@class ExtraUtility
@brief This class manage and display unity for all fileds in data
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2014-01-14 10:23:26
|
Revision: 5039
http://sourceforge.net/p/oscss/svn/5039
Author: oscim
Date: 2014-01-14 10:23:23 +0000 (Tue, 14 Jan 2014)
Log Message:
-----------
Fix calculate thumb in Backoffice if ws_public === /
Modified Paths:
--------------
trunk/catalog/common/classes/image_ratio.php
Modified: trunk/catalog/common/classes/image_ratio.php
===================================================================
--- trunk/catalog/common/classes/image_ratio.php 2014-01-14 09:59:46 UTC (rev 5038)
+++ trunk/catalog/common/classes/image_ratio.php 2014-01-14 10:23:23 UTC (rev 5039)
@@ -1,14 +1,20 @@
<?php if (!defined('HTTP_SERVER')) die('You can not access this file directly!');
/**
- @licence GPL 2005-2013 The osCSS developers - osCSS Open Source E-commerce
+ @licence GPL 2005-2014 The osCSS developers - osCSS Open Source E-commerce
@portion code Copyright (c) 2002 osCommerce
@package osCSS-2 <www http://www.oscss.org>
- @version 2.1.2
+ @version 2.2.0
@date 06/11/13, 23:53
@author oscim <mail aur...@os...> <www http://www.oscim.fr>
@encode UTF-8
- @class image_ratio
+ @file image_ratio.php
+ @dir /common/classes
*/
+
+/**
+ @class image_ratio
+ @brief create, manage , delete all thumb image
+*/
class image_ratio {
/**
@var
@@ -361,9 +367,14 @@
if (self::$env->inadmin){
self::$CacheImage[self::$key]['conf']['mode']='BO';
- if(strpos($src, DIR_WS_ADMIN)===false && strpos($src, DIR_WS_CATALOG)===false && file_exists(DIR_FS_ADMIN.$src)) $src_dir = $src;
- elseif (strpos('_'.$src, DIR_WS_ADMIN) >0 || ( strpos('_'.$src, DIR_WS_IMAGES) >0 && file_exists(DIR_FS_ADMIN.$src) ) ) $src_dir = DIR_FS_ADMIN . $src;
- elseif(strpos($src, DIR_WS_CATALOG)===false ) $src_dir = DIR_FS_ROOT_DOCS . $src;
+
+ $isposadmin = strpos($src, DIR_WS_ADMIN);
+ $ispospub = ( (strlen(DIR_WS_CATALOG) > 1 && strpos($src, DIR_WS_CATALOG)===false) || strlen(DIR_WS_CATALOG) <=1 );
+ $fileexistadmin = file_exists(DIR_FS_ADMIN.$src);
+
+ if( $isposadmin===false && $ispospub && $fileexistadmin ) $src_dir = $src;
+ elseif (strpos('_'.$src, DIR_WS_ADMIN) >0 || ( strpos('_'.$src, DIR_WS_IMAGES) >0 && $fileexistadmin ) ) $src_dir = DIR_FS_ADMIN . $src;
+ elseif( $ispospub ) $src_dir = DIR_FS_ROOT_DOCS . $src;
else $src_dir = DIR_FS_ROOT_DOCS . substr ($src, (strrpos (DIR_WS_CATALOG , '/'))+1);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2014-01-14 09:59:51
|
Revision: 5038
http://sourceforge.net/p/oscss/svn/5038
Author: oscim
Date: 2014-01-14 09:59:46 +0000 (Tue, 14 Jan 2014)
Log Message:
-----------
Fix
Modified Paths:
--------------
trunk/catalog/admin/includes/classes/ModTwo.php
trunk/catalog/admin/includes/classes/drivers/sqlproduct.php
Modified: trunk/catalog/admin/includes/classes/ModTwo.php
===================================================================
--- trunk/catalog/admin/includes/classes/ModTwo.php 2014-01-14 09:41:37 UTC (rev 5037)
+++ trunk/catalog/admin/includes/classes/ModTwo.php 2014-01-14 09:59:46 UTC (rev 5038)
@@ -651,9 +651,9 @@
@remarks this define col in table, and if is possible sort
*/
self::$InitInfo['modele']['listing'][$alias]=((isset($row['sort']) && $row['sort'] == true) ? true : false );
-//
- self::$InitInfo['modele2']['listing'][$alias]=$row; //((isset($row['sort']) && $row['sort'] == true) ? true : false );
+ self::$InitInfo['modele2']['listing'][$alias]=$row;
+
if($clean !=$alias)
$listfield .=(!is_int($key)? $key : "''").' as '.$alias.',';
else
@@ -662,8 +662,7 @@
}
}
-// print_r(self::$InitInfo['edit'] );
-// exit;
+
self::$InitInfo['modele']['listing']['action']=false;
self::$InitInfo['theader']['listing']['action']= array( 'class'=>'row_action', 'txt'=>__('@'.self::$code.' table heading action') );
self::$InitInfo['tfooter']['listing']['action']= array( 'class'=>'row_action', 'txt'=>__('@'.self::$code.' table heading action') );
Modified: trunk/catalog/admin/includes/classes/drivers/sqlproduct.php
===================================================================
--- trunk/catalog/admin/includes/classes/drivers/sqlproduct.php 2014-01-14 09:41:37 UTC (rev 5037)
+++ trunk/catalog/admin/includes/classes/drivers/sqlproduct.php 2014-01-14 09:59:46 UTC (rev 5038)
@@ -328,7 +328,6 @@
$whlg = '';
if(isset($option['language_id'])){
- var_dump($option);
$languages_id = (int)$option['language_id'];
$whlg=" AND language_id='" . $option['language_id'] . "' ";
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2014-01-14 09:41:42
|
Revision: 5037
http://sourceforge.net/p/oscss/svn/5037
Author: oscim
Date: 2014-01-14 09:41:37 +0000 (Tue, 14 Jan 2014)
Log Message:
-----------
Re write currencie page for new ModTwo extends
Delete olds files
Add sqlcurrencie
Add unittest for sqlcurrencie
Modified Paths:
--------------
trunk/catalog/admin/includes/modules/pages/currencies.php
Added Paths:
-----------
trunk/catalog/admin/includes/classes/drivers/sqlcurrencie.php
trunk/catalog/admin/includes/languages/fr_FR/Currencie.txt
trunk/test/phpunit/Back/sqlxxx/sqlcurrencieTest.php
Removed Paths:
-------------
trunk/catalog/admin/includes/gabarit/currencies.listing.gab
trunk/catalog/admin/includes/languages/fr_FR/modules/pages/currencies.txt
Added: trunk/catalog/admin/includes/classes/drivers/sqlcurrencie.php
===================================================================
--- trunk/catalog/admin/includes/classes/drivers/sqlcurrencie.php (rev 0)
+++ trunk/catalog/admin/includes/classes/drivers/sqlcurrencie.php 2014-01-14 09:41:37 UTC (rev 5037)
@@ -0,0 +1,259 @@
+<?php if (!defined('HTTP_SERVER')) die('You can not access this file directly!');
+/**
+ @licence GPL 2005-2014 The osCSS developers - osCSS Open Source E-commerce
+ @portion code Copyright (c) 2002 osCommerce
+ @package osCSS-2 <www http://www.oscss.org>
+ @version 2.2.0
+ @date 12/01/2014, 08:07
+ @author oscim <mail aur...@os...> <www http://www.oscim.fr>
+ @encode UTF-8
+ @file sqlcip.php
+ @dir /admin/includes/classes/drivers/
+*/
+
+/**
+ @class sqlcip
+ @brief manage insert/update/delete in currencies tables
+*/
+class sqlcurrencie
+ implements ModSqlDataDriver{
+
+ public static $modules;
+
+ protected static $_instance;
+
+ protected function __construct(){
+ }
+
+
+ public static function getInstance() {
+ if(self::$_instance == null) self::$_instance = new self();
+ return self::$_instance;
+ }
+
+
+ /**
+ @brief create new ligne in table configuration
+ */
+ public static function create($option){
+ self::getInstance();
+
+ $DB=Database::getInstance();
+ $error = 0;
+ $DB->beginTransaction();
+
+ if( ! isset($option['sqlarray']) )
+ return false;
+ else
+ $sqlarray = (array)$option['sqlarray'];
+
+
+ if(!isset($sqlarray['code']))
+ return false;
+
+
+ $sql_data_array['title'] = tep_db_prepare_input($sqlarray['title']);
+ $sql_data_array['code'] = tep_db_prepare_input($sqlarray['code']);
+ $sql_data_array['symbol_left'] = (isset($option['symbol_left']) ? tep_db_prepare_input($sqlarray['symbol_left']) : '' );
+ $sql_data_array['symbol_right'] = (isset($option['symbol_right']) ? tep_db_prepare_input($sqlarray['symbol_right']) : '' );
+ $sql_data_array['decimal_point'] = tep_db_prepare_input($sqlarray['decimal_point']);
+ $sql_data_array['thousands_point'] = tep_db_prepare_input($sqlarray['thousands_point']);
+ $sql_data_array['decimal_places'] = tep_db_prepare_input($sqlarray['decimal_places']);
+ $sql_data_array['value'] = (isset($option['value']) ? tep_db_prepare_input($sqlarray['value']) : 1 );
+// $sql_data_array['last_update'] = tep_db_prepare_input($sqlarray['last_update']);
+
+
+ $res=tep_db_perform(TABLE_CURRENCIES, $sql_data_array);
+
+ if(!$res)
+ $error++;
+
+ $id = $res->__get('insertId');
+
+ if( $error > 0){
+ $DB->rollbackTransaction();
+ return false;
+ }
+ else{
+ $DB->commitTransaction();
+ return $id;
+ }
+ }
+
+ /**
+ @brief update ligne in table configuration
+ */
+ public static function update($option){
+ self::getInstance();
+ $DB=Database::getInstance();
+
+ $error = 0;
+ $sql_data_array = array();
+
+ if(!isset($option['id']))
+ return false;
+
+ if( ! isset($option['sqlarray']) )
+ return false;
+ else
+ $sqlarray = (array)$option['sqlarray'];
+
+
+ $DB->beginTransaction();
+
+
+ $where ='';
+ if(isset($option['id'])) $where .="AND currencies_id = '".(int)$option['id']."' ";
+
+ if(isset($sqlarray['title'])) $sql_data_array['title'] = tep_db_prepare_input($sqlarray['title']);
+ if(isset($sqlarray['code'])) $sql_data_array['code'] = tep_db_prepare_input($sqlarray['code']);
+ if(isset($sqlarray['symbol_left'])) $sql_data_array['symbol_left'] = tep_db_prepare_input($sqlarray['symbol_left']);
+ if(isset($sqlarray['symbol_right'])) $sql_data_array['symbol_right'] = tep_db_prepare_input($sqlarray['symbol_right']);
+ if(isset($sqlarray['decimal_point'])) $sql_data_array['decimal_point'] = tep_db_prepare_input($sqlarray['decimal_point']);
+ if(isset($sqlarray['thousands_point'])) $sql_data_array['thousands_point'] = tep_db_prepare_input($sqlarray['thousands_point']);
+ if(isset($sqlarray['decimal_places'])) $sql_data_array['decimal_places'] = tep_db_prepare_input($sqlarray['decimal_places']);
+ if(isset($sqlarray['value'])) $sql_data_array['value'] = tep_db_prepare_input($sqlarray['value']);
+
+
+ if(count($sql_data_array) > 0) {
+ $sql_data_array['last_updated'] = 'NOW()';
+ // $sql_data_array['user_update'] = @$_SESSION['login_id'];
+
+ if( ! tep_db_perform(TABLE_CURRENCIES, $sql_data_array, 'update' , substr($where,3) ) )
+ $error++;
+ }
+ else
+ $error++;
+
+ if( $error > 0){
+ $DB->rollbackTransaction();
+ return false;
+ }
+ else{
+ $DB->commitTransaction();
+ return 1;
+ }
+ }
+
+ /**
+ @brief load ligne in table configuration
+ @param option array
+ id => row id int (configuration_id)
+ key => string key (configuration_key)
+ group_id => group_id int (configuration_group_id)
+ @param $shortkey use cleankey for return short key
+ @return
+
+ object(stdClass)[13]
+ public 'id' => string '1' (length=1)
+
+ OR
+ array(
+ object(stdClass)[13]
+ ...
+ object(stdClass)[13]
+ ..
+ )
+
+ */
+ public static function fetch($option,$shortkey=false){
+ self::getInstance();
+ $DB=Database::getInstance();
+
+ $sql ="";
+ if(isset($option['id'])) $sql .="AND currencies_id = '".(int)$option['id']."' ";
+
+
+ if($sql=='')
+ return false;
+
+
+ $sql="SELECT * FROM " . TABLE_CURRENCIES . " a ".
+ " WHERE ".substr($sql,3);
+
+ $res=$DB->query($sql);
+
+ $num = $res->__get('numRows');
+
+ if($num == 1){
+ $result=$res->fetchAssoc();
+ return ((!$shortkey)? $result : self::CleanKey($result));
+ }
+ elseif($num > 1){
+ $array=array();
+
+ foreach($res->fetchAllAssoc() as $result)
+ $array[]= ((!$shortkey)? $result : self::CleanKey($result));
+
+ return $array;
+ }
+
+ return false;
+ }
+
+ /**
+ @brief delete row
+ */
+ public static function delete($option){
+ self::getInstance();
+ $DB=Database::getInstance();
+
+ $sql ="";
+
+ if(isset($option['id'])) $sql .="AND currencies_id = '".(int)$option['id']."' ";
+
+
+ if(strlen($sql) < 5)
+ return false;
+
+ $DB->query($s="DELETE FROM " . TABLE_CURRENCIES ." WHERE ". substr($sql,3) );
+
+ return true;
+ }
+
+
+ /**
+ @brief
+ @return array product empty
+ */
+ public static function Specimen($shortkey=false){
+ $par = array(
+ 'currencies_id' => '',
+ 'title' => '',
+ 'code' => '',
+ 'symbol_left' => '',
+ 'symbol_right' => '',
+ 'decimal_point' => '',
+ 'thousands_point' => '',
+ 'decimal_places' => '',
+ 'last_updated' => '',
+ 'value' => 1,
+ );
+
+ return ((!$shortkey)? $par : self::CleanKey($par));
+ }
+
+
+
+ /**
+ @fn CleanKey()
+ @brief Clean string name key
+ */
+ public static function CleanKey($array){
+ self::getInstance();
+ $object= new stdclass();
+
+ foreach($array as $key=>$value){
+ if( strpos($key,'currencies_') ===0)
+ $key=substr($key,11);
+
+ $object->$key = $value;
+ }
+
+ return $object;
+ }
+
+}
+
+
+?>
\ No newline at end of file
Deleted: trunk/catalog/admin/includes/gabarit/currencies.listing.gab
===================================================================
--- trunk/catalog/admin/includes/gabarit/currencies.listing.gab 2014-01-14 07:20:48 UTC (rev 5036)
+++ trunk/catalog/admin/includes/gabarit/currencies.listing.gab 2014-01-14 09:41:37 UTC (rev 5037)
@@ -1,39 +0,0 @@
-<?php
-/**
- @licence GPL 2005-2010 The osCSS developers - osCSS Open Source E-commerce
- @portion code Copyright (c) 2002 osCommerce
- @package osCSS-2 <www http://www.oscss.org>
- @version 2.0.9
- @date 22/06/10, 18:12
- @author oscim <mail aur...@os...> <www http://www.oscim.fr>
- @encode UTF-8
-*/
-?>
-<h3><?php echo __('heading title'); ?></h3>
-
-<div class="button_nav">
- <?php if (CURRENCY_SERVER_PRIMARY) { echo '<a class="button" href="' . tep_href_link(FILENAME_CURRENCIES, 'action=update') . '">' . IMAGE_UPDATE_CURRENCIES . '</a>'; } ?>
- <?php echo '<a class="button" href="' . tep_href_link(FILENAME_CURRENCIES, 'action=new') . '">' . tep_image(DIR_WS_ICONS . 'icon_add_new.png',__('bouton new currency')). __('bouton new currency') . '</a>'; ?>
-</div>
-
-<div class="box_uniq">
- <div class="box_left">
- <table class="dataTable">
- <thead>
- <tr>
- <th><?php echo __('table heading currency name'); ?></th>
- <th><?php echo __('table heading currency codes'); ?></th>
- <th><?php echo __('table heading currency value'); ?></th>
- <th><?php echo __('table heading action'); ?></th>
- </tr>
- </thead>
- <tbody>
- <!-- AJAX LOAD -->
- </tbody>
- </table>
- </div>
-
- <div class="box_right">
- <?php echo currencies::get_right_bar() ?>
- </div>
-</div>
\ No newline at end of file
Added: trunk/catalog/admin/includes/languages/fr_FR/Currencie.txt
===================================================================
--- trunk/catalog/admin/includes/languages/fr_FR/Currencie.txt (rev 0)
+++ trunk/catalog/admin/includes/languages/fr_FR/Currencie.txt 2014-01-14 09:41:37 UTC (rev 5037)
@@ -0,0 +1,57 @@
+<?php
+/**
+ @licence GPL 2005-2014 The osCSS developers - osCSS Open Source E-commerce
+ @portion code Copyright (c) 2002 osCommerce
+ @package osCSS-2 <www http://www.oscss.org>
+ @version 2.2.0
+ @date 14/01/2014, 22:00
+ @author oscim <mail aur...@os...> <www http://www.oscim.fr>
+ @encode UTF-8
+*/
+
+
+
+/* input */
+ $lang['@currencies table heading id']="Id" ;
+ $lang['@currencies table heading title']="Nom" ;
+ $lang['@currencies table heading code']="Code" ;
+ $lang['@currencies table heading symbol_left']="Symbole gauche" ;
+ $lang['@currencies table heading symbol_right']="Symbole droit" ;
+ $lang['@currencies table heading decimal_point']="Point décimal" ;
+ $lang['@currencies table heading decimal_places']="Nombre de décimales" ;
+ $lang['@currencies table heading thousands_point']="Séparateur de milliers" ;
+ $lang['@currencies table heading last_updated']="Mise à jour" ;
+ $lang['@currencies table heading value']="Valeur" ;
+ $lang['@currencies table heading action']="Action" ;
+
+/* listing */
+ $lang['heading title currencies']="Devises" ;
+ $lang['image add currencies']="Nouvelle devise" ;
+ $lang['image update all currencies']="Mise à jour des devises" ;
+
+/* Edit - New */
+ $lang['@currencies heading title edit']="Edition devise" ;
+
+ $lang['@currencies tab data']="Données" ;
+
+ /* message */
+ $lang['@currencie error in update process']="Erreur lors de la mise à jour" ;
+ $lang['@currencie success in update process']="Mise à jour ok" ;
+
+/* Delete */
+ $lang['heading title delete currencies']="Suppression d'une devise" ;
+ $lang['text info delete currencies']="Êtes-vous sûr de vouloir supprimer cette devise ?" ;
+
+ /* */
+
+/* update all */
+ $lang['@currencies text info currency updated']="Le taux de change pour %s (%s) a été mis à jour avec succès par l'intermédiaire de %s." ;
+ $lang['@currencies error currency invalid']="Erreur : Le taux de change pour %s (%s) n'a pas été mis à jour par l'intermédiaire de %s. S'agit-t'il d'un code devise valide ?" ;
+
+// $lang['@currencies heading title edit']="Devises" ;
+
+$lang['text info currency example']="Exemple de sortie :" ;
+$lang['text info set as default']=" Definir comme valeur par defaut. (Requiert que vous utilisez la valeur 1.00 et lancer une mise à jour des devises)" ;
+$lang['error remove default currency']="Erreur : La devise par défaut ne peut être supprimé. Merci de choisir une autre devise par défaut et de réessayer." ;
+$lang['warning primary server failed']="Attention : Le serveur de taux de change primaire (%s) a echoué %s (%s) - essayer avec le serveur de taux de change secondaire." ;
+?>
\ No newline at end of file
Deleted: trunk/catalog/admin/includes/languages/fr_FR/modules/pages/currencies.txt
===================================================================
--- trunk/catalog/admin/includes/languages/fr_FR/modules/pages/currencies.txt 2014-01-14 07:20:48 UTC (rev 5036)
+++ trunk/catalog/admin/includes/languages/fr_FR/modules/pages/currencies.txt 2014-01-14 09:41:37 UTC (rev 5037)
@@ -1,38 +0,0 @@
-<?php
-/**
- @licence GPL 2005-2013 The osCSS developers - osCSS Open Source E-commerce
- @portion code Copyright (c) 2002 osCommerce
- @package osCSS-2 <www http://www.oscss.org>
- @version 2.1.1
- @date 26/11/11, 22:00
- @author oscim <mail aur...@os...> <www http://www.oscim.fr>
- @encode UTF-8
-*/
-$lang['heading title']="Devises" ;
-$lang['table heading currency name']="Devise" ;
-$lang['table heading currency codes']="Code" ;
-$lang['table heading currency value']="Valeur" ;
-$lang['table heading action']="Action" ;
-$lang['bouton new currency']="Nouvelle devise" ;
-$lang['text info edit intro']="Merci de faire les changements nécessaires" ;
-$lang['text info currency title']="Titre :" ;
-$lang['text info currency code']="Code:" ;
-$lang['text info currency symbol left']="Symbole gauche :" ;
-$lang['text info currency symbol right']="Symbole droit :" ;
-$lang['text info currency decimal point']="Point décimal :" ;
-$lang['text info currency thousands point']="Séparateur de milliers :" ;
-$lang['text info currency decimal places']="Nombre de décimales :" ;
-$lang['text info currency last updated']="Dernière mise à jour :" ;
-$lang['text info currency value']="Valeur :" ;
-$lang['text info currency example']="Exemple de sortie :" ;
-$lang['text info insert intro']="Merci de rentrer la nouvelle devise avec ses données liées" ;
-$lang['text info delete intro']="Êtes-vous sûr de vouloir supprimer cette devise ?" ;
-$lang['text info heading new currency']="Nouvelle devise" ;
-$lang['text info heading edit currency']="Éditer la devise" ;
-$lang['text info heading delete currency']="Supprimer la devise" ;
-$lang['text info set as default']=" Definir comme valeur par defaut. (Requiert que vous utilisez la valeur 1.00 et lancer une mise à jour des devises)" ;
-$lang['text info currency updated']="Le taux de change pour %s (%s) a été mis à jour avec succès par l'intermédiaire de %s." ;
-$lang['error remove default currency']="Erreur : La devise par défaut ne peut être supprimé. Merci de choisir une autre devise par défaut et de réessayer." ;
-$lang['error currency invalid']="Erreur : Le taux de change pour %s (%s) n'a pas été mis à jour par l'intermédiaire de %s. S'agit-t'il d'un code devise valide ?" ;
-$lang['warning primary server failed']="Attention : Le serveur de taux de change primaire (%s) a echoué %s (%s) - essayer avec le serveur de taux de change secondaire." ;
-?>
\ No newline at end of file
Modified: trunk/catalog/admin/includes/modules/pages/currencies.php
===================================================================
--- trunk/catalog/admin/includes/modules/pages/currencies.php 2014-01-14 07:20:48 UTC (rev 5036)
+++ trunk/catalog/admin/includes/modules/pages/currencies.php 2014-01-14 09:41:37 UTC (rev 5037)
@@ -1,14 +1,14 @@
<?php if (!defined('HTTP_SERVER')) die('You can not access this file directly!');
/**
- @licence GPL 2005-2013 The osCSS developers - osCSS Open Source E-commerce
+ @licence GPL 2005-2014 The osCSS developers - osCSS Open Source E-commerce
@portion code Copyright (c) 2002 osCommerce
@package osCSS-2 <www http://www.oscss.org>
- @version 2.1.1
+ @version 2.2.0
@date 11/09/11, 10:45
@author oscim <mail aur...@os...> <www http://www.oscim.fr>
@encode UTF-8
- @class currencies
- @brief This class manipulate devise (add/up/delete)
+ @file currencies.php
+ @dir /admin/includes/modules/pages/
*/
// Define how do we update currency exchange rates
@@ -16,94 +16,464 @@
define('CURRENCY_SERVER_PRIMARY', 'oanda');
define('CURRENCY_SERVER_BACKUP', 'xe');
+
+/**
+ @class currencies
+ @brief This class manipulate devise (add/up/delete)
+*/
+class currencies
+ extends ModTwo /// new abstract class for nextgen module
+ implements
+ InterfaceModule,
+ /*IntModTwo, */ /// new interface module for nextgen module
+ ExtModConfig {
+ const FILENAME = FILENAME_CURRENCIES;
-class currencies
- implements ExtModPage, InterfacedTJsonS, InterfaceModule {
+ /**
+ @var string file
+ */
+ public static $Id;
+ /**
+ @var array list code action module
+ */
+ private static $Module_actions = array('delete', 'deleteconfirm', 'new', 'edit', 'insert', 'update', 'view', 'listing');
- const FILENAME =FILENAME_CURRENCIES;
- public static $code;
- public static $action;
+ /**
+ @brief class constructor
+ */
+ public function __construct() {
+ self::Clean();
+ self::GetConf();
+ }
- public static $list=array();
/**
- class constructor
+ @brief Load , adjust and define var environement exe for module
+ Is use in module and class abstract for init value config this module
*/
- public function __construct() {
+ public static function GetConf(){
+ global $languages_id, $language;
+
self::$code=__CLASS__;
+ self::$datatype='currencie';
+
+ self::$action=(isset($_REQUEST['action'])? (string)$_REQUEST['action'] : 'listing' );
+ self::$Id=(isset($_REQUEST['cID'])? (int)$_REQUEST['cID'] : 0 );
- //! active datatable in ajax, precise les GET necessaire
- define('JSONSTATMENT', 'mod=page&type='.self::$code.(isset($_GET['cID'])?'&cID='.$_GET['cID'] : '' ) );
+ $oscss = oscss_cstr::getInstance();
+ $oscss->pile_file_lang(DIR_FS_ADMIN.DIR_WS_LANGUAGES.$language.'/Currencie.txt');
+
+ self::$modules=new AcaFactory('currencies');
+
+ /**
+ @remarks not load if not first init
+ */
+ if(!defined('JSONSTATMENT')){
+ //! active datatable in ajax, precise les GET necessaire
+ define('JSONSTATMENT', 'ModTwo=true&mod=page&type='.self::$code.
+ (isset(parent::$action)?'&action='.parent::$action : '' ).
+ (isset(self::$Id)?'&file='.self::$Id : '' )
+ );
+ }
+
+
+ /**
+ @remarks define var execution sql in GetDBValue()
+ */
+ self::$InitInfo['adjust']=array(
+ 'languages_id'=>$languages_id,
+ 'page'=>1,
+ 'rowbyp'=>10,
+ 'sOrder'=>'',
+ 'sWhere'=>'',
+ );
+
+
+ MGabCont::SetCurrentName(__CLASS__);
+
+
+ /**
+ @remarks this define col theader title, and ajust html code
+ Just for Edit listing
+ */
+ self::$allfields = array(
+ 'c.currencies_id' => array(
+ 'sort'=>true,
+ 'alias'=>'id',
+ 'text'=>__('@currencies table heading id'),
+ 'width'=>'2%',
+ 'class'=>'tcenter',
+ 'default'=>true,
+ ),
+ );
+
+ self::$allfields['c.title'] = array(
+ 'sort'=>true,
+ 'alias'=>'title',
+ 'text'=>__('@currencies table heading title'),
+ 'default'=>true,
+ 'width'=>'18%',
+ 'edit'=>array(
+ 'input_name'=>'title',
+ 'input_size'=>'64',
+ 'required_status'=>true,
+ 'position_grp'=>4,
+ 'position_col'=>'left',
+ ),
+ );
+
+ self::$allfields['c.code'] = array(
+ 'sort'=>true,
+ 'alias'=>'code',
+ 'text'=>__('@currencies table heading code'),
+ 'default'=>true,
+ 'width'=>'18%',
+ 'edit'=>array(
+ 'input_name'=>'code',
+ 'input_size'=>'3',
+ 'required_status'=>true,
+ 'position_grp'=>4,
+ 'position_col'=>'left',
+ ),
+ );
+
+ self::$allfields['c.symbol_left'] = array(
+ 'sort'=>true,
+ 'alias'=>'symbol_left',
+ 'text'=>__('@currencies table heading symbol_left'),
+ 'default'=>false,
+ 'width'=>'18%',
+ 'edit'=>array(
+ 'input_name'=>'symbol_left',
+ 'input_size'=>'3',
+// 'required_status'=>true,
+ ),
+ );
+
+ self::$allfields['c.symbol_right'] = array(
+ 'sort'=>true,
+ 'alias'=>'symbol_right',
+ 'text'=>__('@currencies table heading symbol_right'),
+ 'default'=>false,
+ 'width'=>'18%',
+ 'edit'=>array(
+ 'input_name'=>'symbol_right',
+ 'input_size'=>'3',
+// 'required_status'=>true,
+ ),
+ );
+
+ self::$allfields['c.decimal_point'] = array(
+ 'sort'=>true,
+ 'alias'=>'decimal_point',
+ 'text'=>__('@currencies table heading decimal_point'),
+ 'default'=>true,
+ 'width'=>'18%',
+ 'edit'=>array(
+ 'input_name'=>'decimal_point',
+ 'input_size'=>'3',
+ 'position_col'=>'right',
+ ),
+ );
+
+ self::$allfields['c.thousands_point'] = array(
+ 'sort'=>true,
+ 'alias'=>'thousands_point',
+ 'text'=>__('@currencies table heading thousands_point'),
+ 'default'=>false,
+ 'width'=>'2%',
+// 'class'=>'tcenter',
+ 'edit'=>array(
+ 'input_name'=>'thousands_point',
+ 'input_size'=>'3',
+ 'position_col'=>'right',
+ ),
+ );
+
+ self::$allfields['c.decimal_places'] = array(
+ 'sort'=>true,
+ 'alias'=>'decimal_places',
+ 'text'=>__('@currencies table heading decimal_places'),
+ 'default'=>false,
+ 'width'=>'2%',
+// 'class'=>'tcenter',
+ 'edit'=>array(
+ 'input_name'=>'decimal_places',
+ 'input_size'=>'3',
+ 'position_col'=>'right',
+ ),
+ );
+
+ self::$allfields['c.value'] = array(
+ 'sort'=>true,
+ 'alias'=>'value',
+ 'text'=>__('@currencies table heading value'),
+ 'default'=>true,
+ 'width'=>'5%',
+ 'edit'=>array(
+ 'input_name'=>'value',
+ 'input_size'=>'8',
+ 'required_status'=>true,
+ ),
+ );
+
+
+ self::$allfields['c.last_updated'] = array(
+ 'sort'=>true,
+ 'alias'=>'last_updated',
+ 'text'=>__('@currencies table heading last_updated'),
+ 'default'=>true,
+ 'width'=>'10%',
+ 'class'=>'tcenter',
+ );
+ /// @remarks min fields and not view directly colonne fields
+ $listfield = ' c.currencies_id as id, ';
+
+ /// @remarks Active forms filter
+ $mutli=array();
+// $mutli[] = sprintf(CsrtAction::getButton('button_action', IMAGE_DELETE, 'delete'), '', ' name="multi_action" ' ) ;
+
+
+ /**
+ @remarks Active forms filter
+ @note
+ array[
+ // For normalised filter define on method ConvertInitVar
+ generic =>
+ array (
+ 'string'
+ // , ....
+ );
+ mod =>
+ array(
+ 'title'=>__('@products filter tab manufacturer'),
+ 'content'=>tep_get_include_contents('manufacturers/filter.manufacturer'),
+ )
+ ]
+ */
+ $tab = array();
+
+ /**
+ @remarks this define menu master module in page
+ @note use $boutons[action][] = array(params)
+
+ params :
+ 'type'=>'getLink',
+ 'format'=>'button_nav',
+ 'image'=>'',
+ 'cssclass'=>'button',
+ 'title'=>__('image create new content'),
+ 'url'=>tep_href_link(self::FILENAME, 'action=new'),
+ */
+ $boutons = array();
+ $boutons['listing'][]=array(
+ 'type'=>'getLink',
+ 'format'=>'button_nav',
+ 'image'=>'',
+ 'cssclass'=>'',
+ 'title'=>__('image add currencies'),
+ 'url'=>tep_href_link(self::FILENAME, 'action=new'),
+ );
+
+ $boutons['listing'][]=array(
+ 'type'=>'getLink',
+ 'format'=>'button_nav',
+ 'image'=>'',
+ 'cssclass'=>'',
+ 'title'=>__('image update all currencies'),
+ 'url'=>tep_href_link(self::FILENAME, 'action=updateallrate'),
+ );
+
+ /**
+ Call Base Init and construct $InitInfo for process Filter
+ $listfield string list row in db
+ $mutli array action multiple
+ $filter array put list off activate tab filter
+ $boutons array
+ */
+ self::ConvertInitVar( $listfield, $mutli, $tab, $boutons);
}
+
+
+ /**
+ @fn check_action($actions)
+ @brief Process action
+ @param $actions string
+ @return $actions string
+ */
public function check_action($actions){
- global $messageStack;
+ global $messageStack, $language;
-// $messageStack
+// self::$action=$actions;
- self::$action=$actions;
-
switch (self::$action) {
- case 'insert':
- case 'save':
- if (isset($_GET['cID'])) $currency_id = tep_db_prepare_input((int)$_GET['cID']);
- $title = tep_db_prepare_input($_POST['title']);
- $code = tep_db_prepare_input($_POST['code']);
+ /**
+ @remarks specific save in session value filters
+ */
+ case 'filters':
+ /*
+ Call Prev Process
+ */
+ self::actionFilter();
-/**
- TODO traiter charste avec config
-*/
- $symbol_right = htmlentities(tep_db_prepare_input($_POST['symbol_right']),ENT_NOQUOTES,'UTF-8');
- $symbol_left = htmlentities(tep_db_prepare_input($_POST['symbol_left']),ENT_NOQUOTES,'UTF-8');
- $decimal_point = tep_db_prepare_input($_POST['decimal_point']);
- $thousands_point = tep_db_prepare_input($_POST['thousands_point']);
- $decimal_places = tep_db_prepare_input($_POST['decimal_places']);
- $value = tep_db_prepare_input($_POST['value']);
+ tep_redirect(tep_href_link(self::FILENAME));
+ break;
- $sql_data_array = array('title' => $title,
- 'code' => $code,
- 'symbol_left' => $symbol_left,
- 'symbol_right' => $symbol_right,
- 'decimal_point' => $decimal_point,
- 'thousands_point' => $thousands_point,
- 'decimal_places' => $decimal_places,
- 'value' => $value);
+ /**
+ @remarks specific Ajax call
+ */
+ case 'update_cell':
+ try {
- if (self::$action == 'insert') {
- $res=tep_db_perform(TABLE_CURRENCIES, $sql_data_array);
- $currency_id = tep_db_insert_id($res);
- } elseif (self::$action == 'save') {
- tep_db_perform(TABLE_CURRENCIES, $sql_data_array, 'update', "currencies_id = '" . (int)$currency_id . "'");
- }
+ $modele = array_keys(sqlcurrencie::Specimen());
+ $params = array();
+ $params['id'] = $_REQUEST['id'];
- if (isset($_POST['default']) && ($_POST['default'] == 'on')) {
- tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . tep_db_input($code) . "' where configuration_key = 'DEFAULT_CURRENCY'");
- }
+ if( in_array($_REQUEST['columnName'], $modele) )
+ $params['sqlarray'] = array(
+ $_REQUEST['columnName'] => (isset($_REQUEST['value']) ? tep_db_prepare_input($_REQUEST['value']) : 0)
+ );
+ else{
+ $tab = explode('[', $_REQUEST['columnName']);
+ $final = $tabs2 = array();
+ foreach($tab as $row)
+ $tabs2[] = ( (substr($row,-1)==']')?substr($row,0,-1) : $row );
- tep_redirect(tep_href_link(self::FILENAME, 'cID=' . $currency_id));
- break;
- case 'deleteconfirm':
- $currencies_id = tep_db_prepare_input($_GET['cID']);
+ $tabs3 = array_reverse($tabs2);
+ $max = count($tabs2);
+ $i=0;
+ foreach($tabs3 as $row){
+ $i++;
+ if($i==1) $final[$row] = (isset($_REQUEST['value']) ? tep_db_prepare_input($_REQUEST['value']) : 0);
+ else
+ $final[$row] = $final;
+ }
- $currency_query = tep_db_query("select currencies_id from " . TABLE_CURRENCIES . " where code = '" . DEFAULT_CURRENCY . "'");
- $currency = tep_db_fetch_array($currency_query);
+ $params['sqlarray'] = $final;
+ }
- if ($currency['currencies_id'] == $currencies_id) {
- tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '' where configuration_key = 'DEFAULT_CURRENCY'");
+ $params['action']=self::$action;
+
+ $params['language_id']= $languages_id;
+
+ if( sqlcurrencie::update( $params ) != 1 )
+ throw new Exception(__('@currencie error in update process')) ;
+
+ $messageStack->add_session(__('@currencie success in update process'), 'success');
+
+ // display value for return
+ echo $_REQUEST['value'];
+ }
+ catch (Exception $e) {
+
+ $messageStack->add_session($e->getMessage() , 'error');
+ }
+ break;
+
+
+
+
+
+ /**
+ @remarks Classic page
+ */
+ case 'insert':
+ $myarray = array(
+ 'title' => tep_db_prepare_input($_POST['title']),
+ 'code' => tep_db_prepare_input($_POST['code']),
+ 'symbol_left' => htmlentities(tep_db_prepare_input($_POST['symbol_left']),ENT_NOQUOTES,'UTF-8'),
+ 'symbol_right' => htmlentities(tep_db_prepare_input($_POST['symbol_right']),ENT_NOQUOTES,'UTF-8'),
+ 'decimal_point' => tep_db_prepare_input($_POST['decimal_point']),
+ 'thousands_point' => tep_db_prepare_input($_POST['thousands_point']),
+ 'decimal_places' => tep_db_prepare_input($_POST['decimal_places']),
+ 'value' => tep_db_prepare_input($_POST['value'])
+ );
+
+ $_id = sqlcurrencie::create(array('sqlarray'=>$myarray) );
+
+
+ tep_redirect(tep_href_link(self::FILENAME ));
+ break;
+
+ case 'update':
+ $c_id =(int) tep_db_prepare_input($_GET['cID']);
+
+ if ($c_id > 0){
+ $myarray = array(
+ 'id'=>$c_id,
+ 'sqlarray' => array(
+ 'title' => tep_db_prepare_input($_POST['title']),
+ 'code' => tep_db_prepare_input($_POST['code']),
+ 'symbol_left' => htmlentities(tep_db_prepare_input($_POST['symbol_left']),ENT_NOQUOTES,'UTF-8'),
+ 'symbol_right' => htmlentities(tep_db_prepare_input($_POST['symbol_right']),ENT_NOQUOTES,'UTF-8'),
+ 'decimal_point' => tep_db_prepare_input($_POST['decimal_point']),
+ 'thousands_point' => tep_db_prepare_input($_POST['thousands_point']),
+ 'decimal_places' => tep_db_prepare_input($_POST['decimal_places']),
+ 'value' => tep_db_prepare_input($_POST['value'])
+ )
+ );
+
+ if(!sqlcurrencie::update($myarray) )
+ $messageStack->add_session(__('error in process for save user'), 'error');
+ else
+ $messageStack->add_session(sprintf(__('process for save user %s ok'), $c_id ), 'success');
+ }
+
+ if(isset($_POST['up_and_close']) )
+ tep_redirect(tep_href_link(self::FILENAME ));
+ else
+ tep_redirect(tep_href_link(self::FILENAME, 'action=edit&cID=' . $c_id ));
+ break;
+
+ case 'deleteconfirm':
+ $c_id =(int) tep_db_prepare_input($_REQUEST['cID']);
+
+ if ($c_id > 1){
+ $myarray = array(
+ 'id'=>$c_id,
+ );
+ $res=sqlcurrencie::delete($myarray);
+ }
+ elseif ($c_id == 1)
+ $messageStack->add_session(__('error this user not possible delete'), 'error');
+
+ if($res <= 0)
+ $messageStack->add_session(__('error in process for delete user'), 'error');
+ else {
+
+ $messageStack->add_session(sprintf(__('delete user %s ok'),$admin_id ), 'success');
+
+ $myarray = array(
+ 'email_use_html'=>_cst_bool('EMAIL_USE_HTML'),
+ 'links'=>HTTP_SERVER . DIR_WS_ADMIN,
+ 'message'=>sprintf(__("this post is inform you in action delete user %s in you'r shop"), $admin_id)
+ );
+
+ $message_final=tep_post_prepare_email('admin_internal_member_delete.tpl',$language,$myarray);
+
+
+
+ $myarray['from']=STORE_OWNER;
+ $myarray['email_use_html']=_cst_bool('EMAIL_USE_HTML');
+
+ if( ! notification::notif('admin_internal_member_delete',__('subject copy creat new compte for admin') ,$myarray, 'user_id='.$admin_id) )
+ $messageStack->add_session(sprintf(__('error in process notification for %s'), STORE_OWNER .' '. STORE_OWNER_EMAIL_ADDRESS ), 'error');
+
}
- tep_db_query("delete from " . TABLE_CURRENCIES . " where currencies_id = '" . (int)$currencies_id . "'");
-
- tep_redirect(tep_href_link(self::FILENAME));
- break;
- case 'update':
+ tep_redirect(tep_href_link(self::FILENAME));
+ break;
+
+ case 'updateallrate':
$server_used = CURRENCY_SERVER_PRIMARY;
$currency_query = tep_db_query("select currencies_id, code, title from " . TABLE_CURRENCIES);
while ($currency = tep_db_fetch_array($currency_query)) {
+
$quote_function = 'quote_' . CURRENCY_SERVER_PRIMARY . '_currency';
$rate = $quote_function($currency['code']);
@@ -116,178 +486,350 @@
$server_used = CURRENCY_SERVER_BACKUP;
}
- if (tep_not_null($rate)) {
- tep_db_query("update " . TABLE_CURRENCIES . " set value = '" . $rate . "', last_updated = now() where currencies_id = '" . (int)$currency['currencies_id'] . "'");
+
+ if( tep_not_null($rate) && sqlcurrencie::update(array('id'=>(int)$currency['currencies_id'] , 'sqlarray'=>array('value'=> $rate))) )
+ $messageStack->add_session(sprintf(__('@currencies text info currency updated'), $currency['title'], $currency['code'], $server_used), 'success');
+ else
+ $messageStack->add_session(sprintf(__('@currencies error currency invalid'), $currency['title'], $currency['code'], $server_used), 'error');
- $messageStack->add_session(sprintf(__('text info currency updated'), $currency['title'], $currency['code'], $server_used), 'success');
- } else {
- $messageStack->add_session(sprintf(__('error currency invalid'), $currency['title'], $currency['code'], $server_used), 'error');
- }
}
tep_redirect(tep_href_link(self::FILENAME, 'cID=' . $_GET['cID']));
- break;
- case 'delete':
- $currencies_id = tep_db_prepare_input($_GET['cID']);
-
- $currency_query = tep_db_query("select code from " . TABLE_CURRENCIES . " where currencies_id = '" . (int)$currencies_id . "'");
- $currency = tep_db_fetch_array($currency_query);
-
- $remove_currency = true;
- if ($currency['code'] == DEFAULT_CURRENCY) {
- $remove_currency = false;
- $messageStack->add(__('error remove default currency'), 'error');
- }
- break;
+ break;
+
}
return self::$action;
}
public function get_header(){
+ tep_include_file(DIR_WS_JS . "modules/pages/".__CLASS__.".js.php",true);
}
- public static function load_db_values($ID){
+ /**
+ @fn currencies::GetDBValue();
+ @brief return DB value adapted for current action
+ Use self::action for determine switch
+ @return
+ */
+ public static function GetDBValue(){
- $DB=Database::getInstance();
+ $DB= Database::getInstance();
- $currency_query_raw = "select currencies_id, title, code, symbol_left, symbol_right, decimal_point, thousands_point, decimal_places, last_updated, value from " . TABLE_CURRENCIES . " WHERE currencies_id='".$ID."' ";
- $currency_query = $DB->query($currency_query_raw);
+ switch (self::$action) {
- return new objectInfo($currency_query->fetchAssoc() );
+ case 'delete':
+ case 'edit':
+ case 'new':
+ if( (int)self::$Id > 0) {
+ $res = sqlcurrencie::fetch(array('id'=>self::$Id ), true);
+ }
+ else{
+ $res = sqlcurrencie::Specimen(true);
+ }
+
+ $res= self::FormatDBValue($res);
+
+ return $res;
+
+ break;
+
+
+ case 'listing':
+ default:
+
+ /**
+ @remarks retrun object load one inventaire
+ */
+ global $query_numrows, $languages_id;
+ $adjust=new objectInfo(self::$InitInfo['adjust']);
+
+ /**
+ @remarks replace id by name col
+ */
+ if(!empty($adjust->sWhere)) {
+
+ foreach(self::$allfields as $key=>$row){
+ if(is_array($row) && isset($row['alias']) ){
+ $k[] = '#[(]'.$row['alias'].'[)]#i';
+ $k[] = '# '.$row['alias'].' #i';
+ $k[] = '# \.'.$row['alias'].'#i';
+
+ $v[] = '('.$key.')';
+ $v[] = ' '.$key.' ';
+ $v[] = '.'.$key.' ';
+ }
+ }
+
+ if(isset($k))
+ $adjust->sWhere = preg_replace($k,$v, $adjust->sWhere);
+ }
+
+ $query_raw = "select ".$adjust->listfields." FROM " . TABLE_CURRENCIES . " c " .
+ ((!empty($adjust->sWhere)) ? " WHERE ".substr($adjust->sWhere, 3) : '').
+ " ORDER BY ".((!empty($adjust->sOrder)) ? $adjust->sOrder : ' currencies_id ASC ');
+
+ $_split = new splitPageResults($adjust->page, $adjust->rowbyp, $query_raw, $query_numrows);
+ $_query = $DB->query($query_raw);
+
+ if($_query !=false)
+ $res=self::FormatDBValue($_query);
+
+ return $res;
+ }
}
+
+ /**
+ @fn display_view()
+ @brief this methode is switch for call gabarit action
+ */
public function display_view(){
- self::tep_get_list();
- return tep_get_include_contents(self::$code.'.listing');
+ $action=self::$action;
+ $MG= false;
+ switch ($action) {
+
+ /**
+ @remarks Ajax View result
+ */
+ case 'setflag':
+ return self::RowStatus(array('status'=>(int)$_GET['flag'], 'id'=>(int)$_GET['cID']));
+ break;
+
+
+ /**
+ @remarks Normal View Page
+ */
+ case 'new':
+ $action='edit';
+ case 'delete':
+ case 'edit':
+ $MG= true;
+ self::$Info=self::GetDBValue();
+ break;
+
+ case 'listing':
+ default:
+ $MG= true;
+ $action='listing';
+ }
+
+ if($MG)
+ return MGabCont::CallGab($action,__FUNCTION__,self::MASTER);
+ else
+ return MGabCont::CallGab($action,__FUNCTION__,__CLASS__);
}
- public static function get_right_bar(){
- global $currencies;
- $heading = array();
- $contents = array();
- if(isset($_GET['cID']) && tep_not_null($_GET['cID']) ) $cInfo=self::load_db_values($_GET['cID']);
+ /** public static InterfacedTJsonS */
+ /**
+ @brief format db value for display page
+ @param $_query ressource db sql
+ @return array
+ */
+ private static function FormatDBValue($_query){
+ $DB=Database::getInstance();
+ $res=array();
+
+
switch (self::$action) {
- case 'new':
- $heading[] = array('text' => __('text info heading new currency') );
+ case 'listing':
+ global $query_numrows,$languages_id;
- $contents = array('form' => tep_draw_form('currencies', self::FILENAME, '&action=insert') );
- $contents[] = array('text' => __('text info insert intro') );
- $contents[] = array('class' => 'block_input','text' => __('text info currency title') . tep_draw_input_field('title'));
- $contents[] = array('class' => 'block_input','text' => __('text info currency code') . tep_draw_input_field('code'));
- $contents[] = array('class' => 'block_input','text' => __('text info currency symbol left') . tep_draw_input_field('symbol_left'));
- $contents[] = array('class' => 'block_input','text' => __('text info currency symbol right') . tep_draw_input_field('symbol_right'));
- $contents[] = array('class' => 'block_input','text' => __('text info currency decimal point') . tep_draw_input_field('decimal_point'));
- $contents[] = array('class' => 'block_input','text' => __('text info currency thousands point') . tep_draw_input_field('thousands_point'));
- $contents[] = array('class' => 'block_input','text' => __('text info currency decimal places') . tep_draw_input_field('decimal_places'));
- $contents[] = array('class' => 'block_input','text' => __('text info currency value') . tep_draw_input_field('value'));
- $contents[] = array('class' => 'block_input','text' => tep_draw_checkbox_field('default') . __('text info set as default'));
- $contents[] = array('class' => 'button_nav','text' => tep_image_submit('button_insert.gif', IMAGE_INSERT) . ' <a class="button" href="' . tep_href_link(self::FILENAME) . '">' . IMAGE_CANCEL. '</a>');
- break;
- case 'edit':
- $heading[] = array('text' => __('text info heading edit currency') );
- $contents = array('form' => tep_draw_form('currencies', self::FILENAME, 'cID=' . $cInfo->currencies_id . '&action=save'));
- $contents[] = array('class' => 'block_input','text' => __('text info edit intro'));
- $contents[] = array('class' => 'block_input','text' => __('text info currency title') . tep_draw_input_field('title','', $cInfo->title));
- $contents[] = array('class' => 'block_input','text' => __('text info currency code') . tep_draw_input_field('code','', $cInfo->code));
- $contents[] = array('class' => 'block_input','text' => __('text info currency symbol left') . tep_draw_input_field('symbol_left','', html_entity_decode($cInfo->symbol_left,ENT_NOQUOTES,'UTF-8')));
- $contents[] = array('class' => 'block_input','text' => __('text info currency symbol right') . tep_draw_input_field('symbol_right','', html_entity_decode($cInfo->symbol_right,ENT_NOQUOTES,'UTF-8') ));
- $contents[] = array('class' => 'block_input','text' => __('text info currency decimal point') . tep_draw_input_field('decimal_point','', $cInfo->decimal_point));
- $contents[] = array('class' => 'block_input','text' => __('text info currency thousands point') . tep_draw_input_field('thousands_point','', $cInfo->thousands_point));
- $contents[] = array('class' => 'block_input','text' => __('text info currency decimal places') . tep_draw_input_field('decimal_places','', $cInfo->decimal_places));
- $contents[] = array('class' => 'block_input','text' => __('text info currency value') . tep_draw_input_field('value', '', $cInfo->value));
- if (DEFAULT_CURRENCY != $cInfo->code) $contents[] = array('class' => 'block_input','text' => tep_draw_checkbox_field('default') . ' ' . __('text info set as default'));
- $contents[] = array('class' => 'button_nav','text' => tep_image_submit('button_update.gif', IMAGE_UPDATE) . ' <a class="button" href="' . tep_href_link(self::FILENAME, 'cID=' . $cInfo->currencies_id) . '">' . IMAGE_CANCEL . '</a>');
- break;
- case 'delete':
- $heading[] = array('text' => __('text info heading delete currency') );
+ foreach($_query->fetchAllAssoc() as $item){
- $contents[] = array('text' => __('text info delete intro') );
- $contents[] = array('text' => '<strong>' . $cInfo->title . '</strong>');
- $contents[] = array('class' => 'button_nav','text' => '<a class="button" href="' . tep_href_link(self::FILENAME, 'cID=' . $cInfo->currencies_id . '&action=deleteconfirm') . '">' . IMAGE_DELETE . '</a>' . ' <a class="button" href="' . tep_href_link(self::FILENAME, 'cID=' . $cInfo->currencies_id) . '">' . IMAGE_CANCEL . '</a>');
- break;
+ foreach(self::$InitInfo['modele']['listing'] as $k=>$row)
+ if($k == 'action') $ord[$k]=self::ButtonRowsActions($item);
+ elseif($k == 'status') $ord[$k]=self::RowStatus($item);
+ else $ord[$k]=$item[$k];
+
+ $res[]=$ord;
+ }
+ break;
+ case 'new':
+ case 'edit';
default:
- if (isset($cInfo) && is_object($cInfo)) {
- $heading[] = array('text' => $cInfo->title );
+ global $languages_id;
- $contents[] = array('text' => __('text info currency title') . $cInfo->title);
- $contents[] = array('text' => __('text info currency code') . $cInfo->code);
- $contents[] = array('text' => __('text info currency symbol left') . $cInfo->symbol_left);
- $contents[] = array('text' => __('text info currency symbol right') . $cInfo->symbol_right);
- $contents[] = array('text' => __('text info currency decimal point') . $cInfo->decimal_point);
- $contents[] = array('text' => __('text info currency thousands point') . $cInfo->thousands_point);
- $contents[] = array('text' => __('text info currency decimal places') . $cInfo->decimal_places);
- $contents[] = array('text' => __('text info currency value') . tep_date_short($cInfo->last_updated));
- $contents[] = array('text' => __('text info currency value') . number_format($cInfo->value, 8));
- $contents[] = array('text' => __('text info currency example') . $currencies->format('30', false, DEFAULT_CURRENCY) . ' = ' . $currencies->format('30', true, $cInfo->code, $cInfo->value, $cInfo->decimal_places));
- }
- break;
- }
+ $ord =array();
- if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {
- $box = new box;
- echo $box->infoBox($heading, $contents);
+ if(is_object($_query)){
+ $res = new stdClass;
+ foreach($_query as $key=>$row) {
+ switch($key){
+ case 'lg':
+ foreach($row as $ke=>$ro){
+ foreach($ro as $k=>$r){
+ if( ($new_r = self::GetEditFieldsDefine($k) ) && $new_r !=false ){
+ $new_r['input_value'][$ke] = $r;
+ $edit = 'edit_'.$k;
+ $res->$edit = new objectInfo($new_r);
+ }
+
+ $res->$k = $r;
+ }
+ }
+ break;
+
+// case 'barcode_type':
+
+ default:
+
+ if( ($new_r = self::GetEditFieldsDefine($key) ) && $new_r !=false ){
+ $new_r['input_value'] = $row;
+ $edit = 'edit_'.$key;
+ $res->$edit = new objectInfo($new_r);
+ }
+
+ $res->$key = $row;
+ }
+ }
+ }
}
+
+ return $res;
}
+ /**
+ @fn ButtonRowsActions($item)
+ @return string html
+ */
+ public static function ButtonRowsActions($item){
+ $left = '';
- /** public static InterfacedTJsonS */
+ if(tep_action_check('new', self::FILENAME) || $_SESSION['login_id'] == $item['admin_id'])
+ $left .=sprintf(CsrtAction::getLink('row_action_right', IMAGE_EDIT, 'edit'), '', tep_href_link(self::FILENAME, 'cID=' . $item['id'] . '&action=edit') ,'' );
- private static function get_item_action($currency){
- return '<span class="view fils fleft">'.
- '<a class="buttonimg" href="' . tep_href_link(self::FILENAME, 'cID=' . $currency['currencies_id']. '&action=edit') . '">' . tep_image(DIR_WS_ICONS . 'icon_edit.png',IMAGE_EDIT) . '</a> '.
- '<a class="buttonimg" href="' . tep_href_link(self::FILENAME, 'cID=' . $currency['currencies_id'] . '&action=delete') . '">' . tep_image(DIR_WS_ICONS . 'icon_delete.png',IMAGE_DELETE ). '</a>'.
- '</span>'.
- '<span class="fright">'.
- ( (isset($_GET['cID']) && $currency['currencies_id'] == $_GET['cID']) ? tep_image(DIR_WS_ICONS . 'icon_arrow_right.gif') : '<a href="' . tep_href_link(self::FILENAME, 'cID=' . $currency['currencies_id']) . '">' . tep_image(DIR_WS_ICONS . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>' ).
- '</span>'
- ;
+ if(tep_action_check('delete',self::FILENAME))
+ $left .=sprintf(CsrtAction::getLink('row_action_right', IMAGE_DELETE, 'delete'), 'fancy', tep_href_link(self::FILENAME, 'cID=' . $item['id'] . '&action=delete') ,'' );
+
+ return sprintf(
+ CsrtAction::getFormat('row_action'),
+ ''
+ ,
+ $left
+ );
}
- public static function tep_get_modele(){
- return array( 'title'=>true,
- 'code'=>true,
- 'value'=>true,
- 'action'=>false
- );
+ /**
+ @brief return format html for row status
+ @param $product array restuts row product
+ @return string html
+ */
+ private static function RowStatus($item){
+ $exclude=array('action','setflag','forceajax','cID','class','function','flag', 'mod');
+ $query_s='action=setflag&cID=' . $item['id'].'&flag=';
+
+ // force admin not desactive
+ if($item['id'] ==1 || !tep_action_check('edit', self::FILENAME))
+ return sprintf(
+ CsrtAction::getFormat('row_flag'),
+ (int)1,
+ ( IMAGE_ICON_STATUS_GREEN )
+ );
+
+ return '<a class="ajaxinline" href="' . tep_href_link(self::FILENAME, tep_get_all_get_params($exclude).$query_s.(($item['status'] == '1')? '0' : '1') ) . '">'.
+ sprintf(
+ CsrtAction::getFormat('row_flag'),
+ (int)$item['status'],
+ ( ($item['status'] == '1')? IMAGE_ICON_STATUS_GREEN : IMAGE_ICON_STATUS_RED)
+ ).
+ '</a>';
}
- public static function tep_get_list($page=1,$rowbyp=10,$sOrder='',$sWhere='',$options=''){
- global $query_numrows;
- $DB=Database::getInstance();
+ /**
+ @brief return Filename
+ */
+ public static function GetFILENAME(){
+ return self::FILENAME;
+ }
- $query_raw = "select currencies_id, title, code, symbol_left, symbol_right, decimal_point, thousands_point, decimal_places, last_updated, value from " . TABLE_CURRENCIES . " ".$sWhere." ORDER BY ".((!empty($sOrder)) ? $sOrder : " title ASC ");
- $currency_split = new splitPageResults($page, $rowbyp, $query_raw, $query_numrows);
- $currency_query = $DB->query($query_raw);
+ /**
+ @brief Check email if not exists
+ @param $email string email
+ @param $admin_id int admin id
+ @return boolean
+ */
+ private static function CheckEmail($email,$admin_id){
+ $stored_email=array();
+ $check_email_query = tep_db_query("select admin_email_address from " . TABLE_ADMIN . " where admin_id <> " . $admin_id . "");
+ while ($check_email = tep_db_fetch_array($check_email_query))
+ $stored_email[] = $check_email['admin_email_address'];
- while ($currency = $currency_query->fetchAssoc() ) {
- $currency['action']=self::get_item_action($currency);
- self::$list[]=$currency;
- }
+ return (in_array($email, $stored_email) );
+ }
- $li=$res=array();
- foreach(self::$list as $item){
- foreach(self::tep_get_modele() as $k=>$v) $li[$k]=$item[$k];
- $res[]=$li;
+ /**
+ @brief Create radom value
+ @return string
+ */
+ private static function randomize() {
+ $salt = "abchefghjkmnpqrstuvwxyz0123456789";
+ srand((double)microtime()*1000000);
+ $i = 0;
+ $pass='';
+ while ($i <= 7) {
+ $num = rand() % 33;
+ $tmp = substr($salt, $num, 1);
+ $pass = $pass . $tmp;
+ $i++;
}
-
- return $res;
+ return $pass;
}
-/** Interface module */
+ /**
+ @remarks implements InterfaceModule depend
+ if module twin in backoffice, report all content install in the other module
+ public function check() {return true;}
+ public function install() {return true;}
+ public function remove() {return true;}
+ public function keys() {return array(); }
+ */
+
+ /**
+ @fn check()
+ @brief test if count all var , and keys is equal
+ @return boolean true/false
+ */
function check() { return false; }
+
+
+ /**
+ @fn keys()
+ @return array all key configuration define by this module
+ */
+ function keys() { return false; }
+
+ /**
+ @fn install()
+ @brief add all configuration
+ @note
+ - Modules can emarquer sql installation instructions, however, in the case of transverse information, or dependent of an extension, preferring the implementation of an extension, file with sql independent
+ - please, pefix all var configuration by 'MODULE_OT__MODTYPENAME_MAJ_'
+ - if module twin in backoffice, report all content install in the other module
+ - Not use language in DB , but function :__()
+ for MODULE_TOTO_ST
+ var title MODULE_TOTO_ST_S (small description)
+ var description MODULE_TOTO_ST_L (long description)
+ */
function install() { return false; }
+
+ /**
+ @fn remove()
+ @brief delete all configuration
+ @note
+ - please, pefix all var configuration by 'MODULE_PAYMENT__MODTYPENAME_MAJ_'
+ - if module twin in backoffice, report all content remove in the other module
+ */
function remove() { return false; }
- function keys() { return false; }
}
?>
\ No newline at end of file
Added: trunk/test/phpunit/Back/sqlxxx/sqlcurrencieTest.php
===================================================================
--- trunk/test/phpunit/Back/sqlxxx/sqlcurrencieTest.php (rev 0)
+++ trunk/test/phpunit/Back/sqlxxx/sqlcurrencieTest.php 2014-01-14 09:41:37 UTC (rev 5037)
@@ -0,0 +1,129 @@
+<?php
+/**
+ * \file test/phpunit/Back/sqlcurrencieTest.php
+ * \brief test unitaire class currencie Backoffice
+ * \remarks To run this script as CLI: phpunit filename.php
+ * \author oscim <mail aur...@os...> <www http://www.oscim.fr>
+ */
+
+// specific for test
+require_once(substr( dirname(__FILE__), 0, -7).'/_top.php');
+
+global $base_path;
+
+
+/**
+ * \class sqlcurrencieTest
+ */
+class sqlcurrencieTest
+ extends PHPUnit_Framework_TestCase
+{
+
+ /**
+ @var int
+ */
+ static public $Id;
+
+ function __construct()
+ {
+
+ }
+
+ /**
+ @brief load Specimen and check result
+ @return array
+ */
+ public function testcurrencieSpecimen(){
+ $specimen = array();
+
+ $tmp = sqlcurrencie::Specimen(true);
+
+ $this->assertTrue ( ( is_object($tmp) ) , 'Error currencie Specimen return object' ) ;
+
+
+ foreach($tmp as $key=>$val)
+ $specimen[$key] = $val;
+
+
+ $this->assertTrue ( ( is_array($specimen) ) , 'Error currencie Specimen convert' ) ;
+
+
+ return array(
+// 'id'=>$id,
+ 'langue'=>1,
+ 'sqlarray'=>$specimen,
+ 'post'=>$specimen,
+ );
+ }
+
+ /**
+ * @brief test creat account user
+ * @depends testcurrencieSpecimen
+ */
+ public function testcurrencieCreat( $specimen ){
+
+
+ // not null
+ $specimen['sqlarray']['title'] = 'test';
+ $specimen['sqlarray']['code'] = 'E';
+
+ $id = sqlcurrencie::create($specimen);
+
+ $this -> assertTrue ( ((int)$id >0) , 'Error currencie not create' ) ;
+
+ $specimen['id'] = $id;
+ return $specimen;
+ }
+
+ /**
+ * \brief Load specific id passed in array
+ * @depends testcurrencieCreat
+ * @param $specimen array
+ * @return array(
+ id null
+ sqlarray = result specimen (array)
+ post = result specimen (array)
+ )
+ */
+ public function testcurrencieFetch($specimen){
+
+ $res = sqlcurrencie::fetch( $specimen , true);
+
+ $this -> assertTrue ( (is_object($res ) ) , 'Error currencie not fetch' ) ;
+
+ foreach($res as $key=>$val){
+ $tmp[$key] = $val;
+ }
+
+ return $tmp;
+ }
+
+
+ /**
+ * @depends testcurrencieCreat
+ */
+ public function testcurrencieUpdate( $specimen ){
+
+ $res = sqlcurrencie::update($specimen);
+
+ $this -> assertTrue ( ($res == 1) , 'Error currencie not update' ) ;
+
+ return $specimen;
+ }
+
+
+ /**
+ * @depends testcurrencieFetch
+ */
+ public function testcurrencieDelete( $specimen ){
+
+ $res = sqlcurrencie::delete( array('id'=>$specimen['id']) );
+
+ $this -> assertTrue ( ($res == true ) , 'Error currencie not delete' ) ;
+
+ }
+
+
+}
+
+?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2014-01-14 07:20:55
|
Revision: 5036
http://sourceforge.net/p/oscss/svn/5036
Author: oscim
Date: 2014-01-14 07:20:48 +0000 (Tue, 14 Jan 2014)
Log Message:
-----------
Delete old file not used
Removed Paths:
-------------
trunk/catalog/common/classes/FastJSON.php
Deleted: trunk/catalog/common/classes/FastJSON.php
===================================================================
--- trunk/catalog/common/classes/FastJSON.php 2014-01-13 14:36:07 UTC (rev 5035)
+++ trunk/catalog/common/classes/FastJSON.php 2014-01-14 07:20:48 UTC (rev 5036)
@@ -1,368 +0,0 @@
-<?php if (!defined('HTTP_SERVER')) die('You can not access this file directly!');
-/**_______________________________________
- *
- * FastJSON,
- * simple and fast Pear Service_JSON encoder/decoder alternative
- * [http://pear.php.net/pepr/pepr-proposal-show.php?id=198]
- * ---------------------------------------
- * This class is about two time faster than Pear Service_JSON class.
- * This class is probably not powerful as Service_JSON but it has
- * no dependencies and converts correctly ASCII range 0x00 - 0x1F too.
- * There's any string convertion, just regular RFC specific characters are converted
- * into \u00XX string.
- * To don't have problems with other chars try to use utf8_encode($json_encoded_string).
- * To recieve correctly JSON strings from JavaScript use encodeURIComponent then
- * use, if is necessary, utef8_decode before JS to PHP convertion.
- * decode method doesn't returns a standard object class but You can
- * create the corret class directly with FastJSON::convert method
- * and with them You can manage JS Date objects too.
- * ---------------------------------------
- * Summary of static public methods
- *
- * convert
- * extra, special method
- *
- * decode
- * converts a valid JSON string
- * into a native PHP variable
- *
- * encode
- * converts a native php variable
- * into a valid JSON string
- * ---------------------------------------
- *
- * Special FastJSON::convert method Informations
- * _______________________________________
- * ---------------------------------------
- * This method is used by FastJSON::encode method but should be used
- * to do these convertions too:
- *
- * - JSON string to time() integer:
- *
- * FastJSON::convert(decodedDate:String):time()
- *
- * If You recieve a date string rappresentation You
- * could convert into respective time() integer.
- * Example:
- * FastJSON::convert(FastJSON::decode($clienttime));
- * // i.e. $clienttime = 2006-11-09T14:42:30
- * // returned time will be an integer useful with gmdate or date
- * // to create, for example, this string
- * // Thu Nov 09 2006 14:42:30 GMT+0100 (Rome, Europe)
- *
- * - time() to JSON string:
- *
- * FastJSON::convert(time():Int32, true:Boolean):JSON Date String format
- *
- * You could send server time() informations and send them to clients.
- * Example:
- * FastJSON::convert(time(), true);
- * // i.e. 2006-11-09T14:42:30
- *
- * - associative array to generic class:
- *
- * FastJSON::convert(array(params=>values), new GenericClass):new Instance of GenericClass
- *
- * With a decoded JSON object You could convert them
- * into a new instance of your Generic Class.
- * Example:
- * class MyClass {
- * var $param = "somevalue";
- * function MyClass($somevar) {
- * $this->somevar = $somevar;
- * };
- * function getVar = function(){
- * return $this->somevar;
- * };
- * };
- *
- * $instance = new MyClass("example");
- * $encoded = FastJSON::encode($instance);
- * // {"param":"somevalue"}
- *
- * $decoded = FastJSON::decode($encoded);
- * // $decoded instanceof Object => true
- * // $decoded instanceof MyClass => false
- *
- * $decoded = FastJSON::convert($decoded, new MyClass("example"));
- * // $decoded instanceof Object => true
- * // $decoded instanceof MyClass => true
- *
- * $decoded->getVar(); // example
- *
- * ---------------------------------------
- *
- * @author Andrea Giammarchi
- * @site http://www.devpro.it/
- * @version 0.4 [fixed string convertion problems, add stdClass optional convertion instead of associative array (used by default)]
- * @requires anything
- * @compatibility PHP >= 4
- * @license
- * ---------------------------------------
- *
- * Copyright (c) 2006 - 2007 Andrea Giammarchi
- *
- * Permission is hereby granted, free of charge,
- * to any person obtaining a copy of this software and associated
- * documentation files (the "Software"),
- * to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
- * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- * _______________________________________
- */
-class FastJSON {
-
- // public methods
-
- /**
- * public static method
- *
- * FastJSON::convert(params:* [, result:Instance]):*
- *
- * @param * String or Object
- * @param Instance optional new generic class instance if first
- * parameter is an object.
- * @return * time() value or new Instance with object parameters.
- *
- * @note please read Special FastJSON::convert method Informations
- */
- public static function convert($params, $result = null){
- switch(gettype($params)){
- case 'array':
- $tmp = array();
- foreach($params as $key => $value) {
- if(($value = FastJSON::encode($value)) !== '')
- array_push($tmp, FastJSON::encode(strval($key)).':'.$value);
- };
- $result = '{'.implode(',', $tmp).'}';
- break;
- case 'boolean':
- $result = $params ? 'true' : 'false';
- break;
- case 'double':
- case 'float':
- case 'integer':
- $result = $result !== null ? strftime('%Y-%m-%dT%H:%M:%S', $params) : strval($params);
- break;
- case 'NULL':
- $result = 'null';
- break;
- case 'string':
- $i = create_function('&$e, $p, $l', 'return intval(substr($e, $p, $l));');
- if(preg_match('/^[0-9]{4}\-[0-9]{2}\-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/', $params))
- $result = mktime($i($params, 11, 2), $i($params, 14, 2), $i($params, 17, 2), $i($params, 5, 2), $i($params, 9, 2), $i($params, 0, 4));
- break;
- case 'object':
- $tmp = array();
- if(is_object($result)) {
- foreach($params as $key => $value)
- $result->$key = $value;
- } else {
- $result = get_object_vars($params);
- foreach($result as $key => $value) {
- if(($value = FastJSON::encode($value)) !== '')
- array_push($tmp, FastJSON::encode($key).':'.$value);
- };
- $result = '{'.implode(',', $tmp).'}';
- }
- break;
- }
- return $result;
- }
-
- /**
- * public method
- *
- * FastJSON::decode(params:String[, useStdClass:Boolean]):*
- *
- * @param String valid JSON encoded string
- * @param Bolean uses stdClass instead of associative array if params contains objects (default false)
- * @return * converted variable or null
- * is params is not a JSON compatible string.
- * @note This method works in an optimist way. If JSON string is not valid
- * the code execution will die using exit.
- * This is probably not so good but JSON is often used combined with
- * XMLHttpRequest then I suppose that's better more protection than
- * just some WARNING.
- * With every kind of valid JSON string the old error_reporting level
- * and the old error_handler will be restored.
- *
- * @example
- * FastJSON::decode('{"param":"value"}'); // associative array
- * FastJSON::decode('{"param":"value"}', true); // stdClass
- * FastJSON::decode('["one",two,true,false,null,{},[1,2]]'); // array
- */
- public static function decode($encode, $stdClass = false){
- $pos = 0;
- $slen = is_string($encode) ? strlen($encode) : null;
- if($slen !== null) {
- $error = error_reporting(0);
- set_error_handler(array('FastJSON', '__exit'));
- $result = FastJSON::__decode($encode, $pos, $slen, $stdClass);
- error_reporting($error);
- restore_error_handler();
- }
- else
- $result = null;
- return $result;
- }
-
- /**
- * public method
- *
- * FastJSON::encode(params:*):String
- *
- * @param $decode * Array, Boolean, Float, Int, Object, String or NULL variable.
- * @return String JSON genric object rappresentation
- * or empty string if param is not compatible.
- *
- * @example
- * FastJSON::encode(array(1,"two")); // '[1,"two"]'
- *
- * $obj = new MyClass();
- * obj->param = "value";
- * obj->param2 = "value2";
- * FastJSON::encode(obj); // '{"param":"value","param2":"value2"}'
- */
- public static function encode($decode){
- $result = '';
- switch(gettype($decode)){
- case 'array':
- if(!count($decode) || array_keys($decode) === range(0, count($decode) - 1)) {
- $keys = array();
- foreach($decode as $value) {
- if(($value = FastJSON::encode($value)) !== '')
- array_push($keys, $value);
- }
- $result = '['.implode(',', $keys).']';
- }
- else
- $result = FastJSON::convert($decode);
- break;
- case 'string':
- $replacement = FastJSON::__getStaticReplacement();
- $result = '"'.str_replace($replacement['find'], $replacement['replace'], $decode).'"';
- break;
- default:
- if(!is_callable($decode))
- $result = FastJSON::convert($decode);
- break;
- }
- return $result;
- }
-
- // private methods, uncommented, sorry
- public static function __getStaticReplacement(){
- static $replacement = array('find'=>array(), 'replace'=>array());
- if($replacement['find'] == array()) {
- foreach(array_merge(range(0, 7), array(11), range(14, 31)) as $v) {
- $replacement['find'][] = chr($v);
- $replacement['replace'][] = "\\u00".sprintf("%02x", $v);
- }
- $replacement['find'] = array_merge(array(chr(0x5c), chr(0x2F), chr(0x22), chr(0x0d), chr(0x0c), chr(0x0a), chr(0x09), chr(0x08)), $replacement['find']);
- $replacement['replace'] = array_merge(array('\\\\', '\\/', '\\"', '\r', '\f', '\n', '\t', '\b'), $replacement['replace']);
- }
- return $replacement;
- }
- public static function __decode(&$encode, &$pos, &$slen, &$stdClass){
- switch($encode{$pos}) {
- case 't':
- $result = true;
- $pos += 4;
- break;
- case 'f':
- $result = false;
- $pos += 5;
- break;
- case 'n':
- $result = null;
- $pos += 4;
- break;
- case '[':
- $result = array();
- ++$pos;
- while($encode{$pos} !== ']') {
- array_push($result, FastJSON::__decode($encode, $pos, $slen, $stdClass));
- if($encode{$pos} === ',')
- ++$pos;
- }
- ++$pos;
- break;
- case '{':
- $result = $stdClass ? new stdClass : array();
- ++$pos;
- while($encode{$pos} !== '}') {
- $tmp = FastJSON::__decodeString($encode, $pos);
- ++$pos;
- if($stdClass)
- $result->$tmp = FastJSON::__decode($encode, $pos, $slen, $stdClass);
- else
- $result[$tmp] = FastJSON::__decode($encode, $pos, $slen, $stdClass);
- if($encode{$pos} === ',')
- ++$pos;
- }
- ++$pos;
- break;
- case '"':
- switch($encode{++$pos}) {
- case '"':
- $result = "";
- break;
- default:
- $result = FastJSON::__decodeString($encode, $pos);
- break;
- }
- ++$pos;
- break;
- default:
- $tmp = '';
- preg_replace('/^(\-)?([0-9]+)(\.[0-9]+)?([eE]\+[0-9]+)?/e', '$tmp = "\\1\\2\\3\\4"', substr($encode, $pos));
- if($tmp !== '') {
- $pos += strlen($tmp);
- $nint = intval($tmp);
- $nfloat = floatval($tmp);
- $result = $nfloat == $nint ? $nint : $nfloat;
- }
- break;
- }
- return $result;
- }
- public static function __decodeString(&$encode, &$pos) {
- $replacement = FastJSON::__getStaticReplacement();
- $endString = FastJSON::__endString($encode, $pos, $pos);
- $result = str_replace($replacement['replace'], $replacement['find'], substr($encode, $pos, $endString));
- $pos += $endString;
- return $result;
- }
- public static function __endString(&$encode, $position, &$pos) {
- do {
- $position = strpos($encode, '"', $position + 1);
- }while($position !== false && FastJSON::__slashedChar($encode, $position - 1));
- if($position === false)
- trigger_error('', E_USER_WARNING);
- return $position - $pos;
- }
- public static function __exit($str, $a, $b) {
- exit($a.'FATAL: FastJSON decode method failure [malicious or incorrect JSON string]');
- }
- public static function __slashedChar(&$encode, $position) {
- $pos = 0;
- while($encode{$position--} === '\\')
- $pos++;
- return $pos % 2;
- }
-}
-?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2014-01-13 14:36:14
|
Revision: 5035
http://sourceforge.net/p/oscss/svn/5035
Author: oscim
Date: 2014-01-13 14:36:07 +0000 (Mon, 13 Jan 2014)
Log Message:
-----------
Fix
Add Unit Test
Modified Paths:
--------------
trunk/catalog/common/classes/DataTypes.php
trunk/catalog/common/classes/osCSS_Cache.php
trunk/catalog/common/classes/osCSS_CacheLib.php
trunk/catalog/common/classes/seo_url.php
trunk/test/phpunit/Back/classes/allClassSeoUrlTest.php
trunk/test/phpunit/Back/classes/allClassTrackStockTest.php
Added Paths:
-----------
trunk/test/phpunit/Back/classes/CacheLibTest.php
trunk/test/phpunit/Back/classes/allClassDataTypes.php
Modified: trunk/catalog/common/classes/DataTypes.php
===================================================================
--- trunk/catalog/common/classes/DataTypes.php 2014-01-13 07:48:04 UTC (rev 5034)
+++ trunk/catalog/common/classes/DataTypes.php 2014-01-13 14:36:07 UTC (rev 5035)
@@ -8,6 +8,7 @@
@author oscim <mail aur...@os...> <www http://www.oscim.fr>
@encode UTF-8
@dir /common/classes
+ @file DataTypes.php
@section AA Modifications made:
@li 2012 - Created by oscim
@@ -190,6 +191,7 @@
/**
+ @fn GetTypeForRootListing()
@brief Get regle anchors in childs module for seo class
@note backoffice use
@return array all type datatypeDynamic for manage and adjust in BO
@@ -213,6 +215,7 @@
}
/**
+ @fn GetRegHtaccess()
@brief Get all reg for htaccess based on datatype active
@note backoffice use
@return array for all contraint
Modified: trunk/catalog/common/classes/osCSS_Cache.php
===================================================================
--- trunk/catalog/common/classes/osCSS_Cache.php 2014-01-13 07:48:04 UTC (rev 5034)
+++ trunk/catalog/common/classes/osCSS_Cache.php 2014-01-13 14:36:07 UTC (rev 5035)
@@ -10,22 +10,22 @@
\class osCSS_Cache
\brief Class usage examples:
- \example Caching HTML:
- if ($osCSS_Cache->read('key', 60) === false) {
- $osCSS_Cache->startBuffer();
- ------ PHP/HTML LOGIC HERE ------
- $osCSS_Cache->stopBuffer();
- }
+ \example Caching
+ @li HTML:
+ if ($osCSS_Cache->read('key', 60) === false) { \
+ $osCSS_Cache->startBuffer(); \
+ ------ PHP/HTML LOGIC HERE ------ \
+ $osCSS_Cache->stopBuffer(); \
+ }
echo $osCSS_Cache->getCache();
- \example Caching data (in memory):
- if ($osCSS_Cache->read('key', 60)) {
- $variable = $osCSS_Cache->getCache();
- } else {
- $variable = array('some', 'data');
-
- $osCSS_Cache->writeBuffer($variable);
+ @li data (in memory):
+ if ($osCSS_Cache->read('key', 60)) { \
+ $variable = $osCSS_Cache->getCache(); \
+ } else { \
+ $variable = array('some', 'data'); \
+ $osCSS_Cache->writeBuffer($variable); \
}
*/
Modified: trunk/catalog/common/classes/osCSS_CacheLib.php
===================================================================
--- trunk/catalog/common/classes/osCSS_CacheLib.php 2014-01-13 07:48:04 UTC (rev 5034)
+++ trunk/catalog/common/classes/osCSS_CacheLib.php 2014-01-13 14:36:07 UTC (rev 5035)
@@ -1,30 +1,58 @@
<?php if (!defined('HTTP_SERVER')) die('You can not access this file directly!');
/**
- @licence GPL 2005-2013 The osCSS developers - osCSS Open Source E-commerce
+ @licence GPL 2005-2014 The osCSS developers - osCSS Open Source E-commerce
@portion code Copyright (c) 2002 osCommerce
@package osCSS-2 <www http://www.oscss.org>
- @version 2.1.1
- @date 04/03/2012, 21:31
+ @version 2.2.0
+ @date 12/01/2014, 21:31
@author oscim <mail aur...@os...> <www http://www.oscim.fr>
@encode UTF-8
+ @file CacheLib.php
+ @dir /common/classes/
+ @example
+ @li no limit
+ if (CacheLib::read('yourkey-'.md5(__FILE__)) === false) { \
+ CacheLib::addfiles($file); \
+ } \
+ include(CacheLib::getfilecache()); \
+ @li use limit filecached
+ CacheLib::read('yourkey-'.md5(__FILE__), $timestamp_max )
+*/
+
+/**
@class CacheLib
-
- Mise en cache de libraririe et class
+ @brief Write and manage file cache for lib and class
+ this cache is disable if OSCSS_DEBUG is <> false
+
*/
-
class CacheLib {
-
+ /**
+ @var object instance class
+ */
+ protected static $_instance;
+ /**
+ @var string current key used
+ */
protected static $cache_key;
-
- protected static $_instance;
-
+ /**
+ @var string current folder for stock
+ */
protected static $folder;
+ /**
+ @fn __construct()
+ */
protected function __construct(){
self::$cache_key = null;
self::$folder=(defined('DIR_WS_ADMIN')? DIR_FS_ROOT_DOCS .'admin/'. DIR_CACHE : DIR_FS_WORK);
}
-
+
+ /**
+ @fn read($key, $expire = 0)
+ @param $key string part of filename
+ @param $expire int 0/1 1 for delete old file cached
+ @return true OK /false KO
+ */
public static function read($key, $expire = 0) {
self::$_instance = new self();
@@ -38,11 +66,18 @@
if ( ($expire == '0') || ($difference < $expire) ) {
return true;
}
+ else
+ @unlink($filename);
}
return false;
}
+ /**
+ @fn addfiles($file=array())
+ @param array list of pathfilename for cache
+ @return none
+ */
public static function addfiles($file=array()){
$filename = self::$folder . self::$cache_key . '.cache';
@@ -54,7 +89,11 @@
flock($fp, 3); // LOCK_UN
fclose($fp);
}
-
+
+ /**
+ @fn getfilecache()
+ @return string file cached pathfilename
+ */
public static function getfilecache(){
return self::$folder . self::$cache_key . '.cache';
}
Modified: trunk/catalog/common/classes/seo_url.php
===================================================================
--- trunk/catalog/common/classes/seo_url.php 2014-01-13 07:48:04 UTC (rev 5034)
+++ trunk/catalog/common/classes/seo_url.php 2014-01-13 14:36:07 UTC (rev 5035)
@@ -354,14 +354,17 @@
}
/**
- * \brief Stock function, callback use
+ * @fn stock_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = false, $search_engine_safe = true)
+ * @brief Stock function, callback use
+ * is protected for use and tested by unit test
* @param $page
* @param $parameters
* @param $connection
* @param $add_session_id
* @param $search_engine_safe
+ * @return
*/
- private function stock_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = false, $search_engine_safe = true) {
+ protected function stock_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = false, $search_engine_safe = true) {
global $request_type, $session_started, $SID, $kill_sid;
if ($page == '/') $page = '';
@@ -421,6 +424,8 @@
return str_replace('&','&',$return);
break;
}
+
+ return false;
}
Added: trunk/test/phpunit/Back/classes/CacheLibTest.php
===================================================================
--- trunk/test/phpunit/Back/classes/CacheLibTest.php (rev 0)
+++ trunk/test/phpunit/Back/classes/CacheLibTest.php 2014-01-13 14:36:07 UTC (rev 5035)
@@ -0,0 +1,82 @@
+<?php
+/**
+ * \file test/phpunit/Back/CacheLibTest.php
+ * \brief test unitaire class allmodulesgeneric Backoffice
+ * \remarks To run this script as CLI: phpunit filename.php
+ * \author oscim <mail aur...@os...> <www http://www.oscim.fr>
+ */
+
+// specific for test
+require_once(substr( dirname(__FILE__), 0, -8).'/_top.php');
+
+global $base_path, $path;
+
+
+/**
+ * \class CacheLibTest
+ */
+class CacheLibTest
+ extends PHPUnit_Framework_TestCase
+{
+
+ /**
+ @var current instance object class
+ */
+ protected $obj;
+
+ function __construct()
+ {
+ }
+
+ /**
+ @brief test class depends childs specific module payment
+ */
+ public function testFilesRequired(){
+ global $base_path, $path;
+ include_once(DIR_FS_CATALOG . DIR_WS_COMMON_CLASSES.'osCSS_CacheLib.php');
+ }
+
+
+ /**
+ @fn testDbLowStock($obj)
+ @brief Get list for argument in alert stock
+ @param $obj object Class
+ @return none
+ */
+ public function testAddFiles(){
+
+ $array = array(
+ DIR_FS_CATALOG . DIR_WS_COMMON_CLASSES.'CacheLib.php',
+ );
+
+ if (CacheLib::read('yourkey-'.md5(__FILE__)) === false) {
+ CacheLib::addfiles($array);
+ }
+
+ if(OSCSS_DEBUG == false)
+ $this->assertTrue ( CacheLib::read('yourkey-'.md5(__FILE__)) == true , 'Error cached files') ;
+ else
+ $this->assertTrue ( true , 'No tested in DEBUG Mode ') ;
+
+ return true;
+ }
+
+ /**
+ @fn testDbLowStock($obj)
+ @brief Get list for argument in alert stock
+ @param $obj object Class
+ @return none
+ @depends testAddFiles()
+ */
+// public function testgetfilecache($arg){
+//
+// $link = CacheLib::getfilecache();
+//
+// if(OSCSS_DEBUG == false)
+// $this->assertTrue ( strlen($link) > 0 , 'Error cached files') ;
+// else
+// $this->assertTrue ( true , 'No tested in DEBUG Mode ') ;
+// }
+}
+
+?>
\ No newline at end of file
Added: trunk/test/phpunit/Back/classes/allClassDataTypes.php
===================================================================
--- trunk/test/phpunit/Back/classes/allClassDataTypes.php (rev 0)
+++ trunk/test/phpunit/Back/classes/allClassDataTypes.php 2014-01-13 14:36:07 UTC (rev 5035)
@@ -0,0 +1,103 @@
+<?php
+/**
+ * \file test/phpunit/Back/allClassDataTypes.php
+ * \brief test unitaire class allmodulesgeneric Backoffice
+ * \remarks To run this script as CLI: phpunit filename.php
+ * \author oscim <mail aur...@os...> <www http://www.oscim.fr>
+ */
+
+// specific for test
+require_once(substr( dirname(__FILE__), 0, -8).'/_top.php');
+
+global $base_path, $path;
+
+
+/**
+ * \class allClassDataTypes
+ */
+class allClassDataTypes
+ extends PHPUnit_Framework_TestCase
+{
+
+
+ function __construct()
+ {
+
+ }
+
+ /**
+ @brief test class depends childs specific module payment
+ */
+ public function testFilesRequired(){
+ global $base_path, $path;
+ include_once(DIR_FS_CATALOG . DIR_WS_COMMON_CLASSES.'DataTypes.php');
+ }
+
+
+ /**
+ @brief Instanccie class
+ @return $obj result class seo_url
+ */
+ public function testInstanceClass(){
+ global $language_id;
+
+ $obj = DataTypes::getinstance();
+
+ $this->assertTrue ( is_object($obj) , 'Error load DataTypes is not object ') ;
+
+ // check
+// $this->assertClassHasAttribute('type_actived', 'DataTypes');
+ $this->assertTrue ( count(DataTypes::$type_actived) > 1 , 'Error load DataTypes reg_anchors as init ') ;
+
+
+
+ return $obj;
+ }
+
+ /**
+ @fn testSubChildsloaded($obj)
+ @brief check all for others params content in subchild class
+ this methode test unique subclass loaded
+ @param $obj object Class seo_url
+ @return none
+ @depends testInstanceClass
+ @covers DataTypes->GetAllDataType
+ */
+ public function testSubChildsloaded($obj){
+ $list = $obj->GetAllDataType();
+ }
+
+ /**
+ @fn testGetTypeForRootListing($obj)
+ @brief check all for others params content in subchild class
+ this methode test unique subclass loaded
+ @param $obj object Class seo_url
+ @return none
+ @depends testInstanceClass
+ @covers DataTypes->GetTypeForRootListing
+ */
+ public function testGetTypeForRootListing($obj){
+ $list = $obj->GetTypeForRootListing();
+
+ $this->assertTrue ( is_array($list) , 'Error load DataTypes RootListing list is not array ') ;
+ $this->assertTrue ( count($list) > 1 , 'Error load DataTypes RootListing is empty ') ;
+ }
+
+ /**
+ @fn testGetRegHtaccess($obj)
+ @brief check all for others params content in subchild class
+ this methode test unique subclass loaded
+ @param $obj object Class seo_url
+ @return none
+ @depends testInstanceClass
+ @covers DataTypes->GetRegHtaccess
+ */
+ public function testGetRegHtaccess($obj){
+ $list = $obj->GetRegHtaccess();
+
+ $this->assertTrue ( is_array($list) , 'Error load DataTypes RegHtaccess list is not array ') ;
+ $this->assertTrue ( count($list) > 1 , 'Error load DataTypes RegHtaccess is empty ') ;
+ }
+}
+
+?>
\ No newline at end of file
Modified: trunk/test/phpunit/Back/classes/allClassSeoUrlTest.php
===================================================================
--- trunk/test/phpunit/Back/classes/allClassSeoUrlTest.php 2014-01-13 07:48:04 UTC (rev 5034)
+++ trunk/test/phpunit/Back/classes/allClassSeoUrlTest.php 2014-01-13 14:36:07 UTC (rev 5035)
@@ -11,7 +11,11 @@
global $base_path, $path;
+include_once(DIR_FS_CATALOG . DIR_WS_COMMON_CLASSES.'seo_url.php');
+include_once(DIR_FS_CATALOG . DIR_WS_COMMON_CLASSES.'DataTypes.php');
+
+
/**
* \class allClassSeoUrlTest
*/
@@ -20,22 +24,7 @@
{
- function __construct()
- {
-
- }
-
/**
- @brief test class depends childs specific module payment
- */
- public function testFilesRequired(){
- global $base_path, $path;
- include_once(DIR_FS_CATALOG . DIR_WS_COMMON_CLASSES.'seo_url.php');
- include_once(DIR_FS_CATALOG . DIR_WS_COMMON_CLASSES.'DataTypes.php');
- }
-
-
- /**
@brief Instanccie class
@return $obj result class seo_url
*/
@@ -89,9 +78,6 @@
$DT = DataTypes::getinstance();
$list = $DT->GetAllDataType();
-/*
- print_r($row->reg_check);
- exit;*/
foreach($list as $key=>$row){
$i = 0;
@@ -107,14 +93,32 @@
}
/**
- @fn
- @brief
- @return
+ @fn testMethodeHeaderTags($obj)
+ @brief test methode href_link
+ @param $obj object Class seo_url
+ @return none
@depends testInstanceClass
*/
-// public function testMethodeHrefLink(){
-//
-// }
+ public function testMethodeHeaderTags($obj){
+
+ $DT = DataTypes::getinstance();
+ $list = $DT->GetAllDataType();
+
+ foreach($list as $key=>$row){
+ $i = 0;
+
+ if(count($row->reg_anchors) > 0){
+ foreach($row->reg_anchors as $k=>$v){
+ $obj->header_tags($row->DataType.'.php', $k.'='. (preg_match('#0-9#', @$row->reg_check[$i])? 1 : 'toto') );
+ $i++;
+ }
+ }
+
+ }
+ }
+
+
+
}
?>
\ No newline at end of file
Modified: trunk/test/phpunit/Back/classes/allClassTrackStockTest.php
===================================================================
--- trunk/test/phpunit/Back/classes/allClassTrackStockTest.php 2014-01-13 07:48:04 UTC (rev 5034)
+++ trunk/test/phpunit/Back/classes/allClassTrackStockTest.php 2014-01-13 14:36:07 UTC (rev 5035)
@@ -55,7 +55,6 @@
@param $obj object Class seo_url
@return none
@depends testInstanceClass
- @covers tracked_stock->db_low_stock
*/
public function testDbLowStock($obj){
$list = $obj->db_low_stock();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2014-01-13 07:48:06
|
Revision: 5034
http://sourceforge.net/p/oscss/svn/5034
Author: oscim
Date: 2014-01-13 07:48:04 +0000 (Mon, 13 Jan 2014)
Log Message:
-----------
Add unittest
Delete old file
Fix
Modified Paths:
--------------
trunk/test/phpunit/Back/classes/allClassWorldUtilityTest.php
Added Paths:
-----------
trunk/test/phpunit/Back/classes/allClassCustomerUtilityTest.php
trunk/test/phpunit/Back/classes/allClassTrackStockTest.php
Removed Paths:
-------------
trunk/catalog/admin/includes/classes/held_order.php
Deleted: trunk/catalog/admin/includes/classes/held_order.php
===================================================================
--- trunk/catalog/admin/includes/classes/held_order.php 2014-01-11 15:01:13 UTC (rev 5033)
+++ trunk/catalog/admin/includes/classes/held_order.php 2014-01-13 07:48:04 UTC (rev 5034)
@@ -1,108 +0,0 @@
-<?php if (!defined('HTTP_SERVER')) die('You can not access this file directly!');
-/**
- @licence GPL 2005-2010 The osCSS developers - osCSS Open Source E-commerce
- @portion code Copyright (c) 2002 osCommerce
- @package osCSS-2 <www http://www.oscss.org>
- @version 2.0.9
- @date 10/06/10, 09:08
- @author oscim <mail aur...@os...> <www http://www.oscim.fr>
- @encode UTF-8
-*/
-class held_order {
- var $info;
- var $totals;
- var $products;
- var $customer;
- var $delivery;
-
- function held_order($order_id) {
- $this->info = array();
- $this->totals = array();
- $this->products = array();
- $this->customer = array();
- $this->delivery = array();
-
- $this->query($order_id);
- }
-
- function query($order_id) {
- $order_query = tep_db_query("select customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, date_purchased, orders_status, last_modified, ip_address from " . TABLE_HOLDING_ORDERS . " where orders_id = '" . tep_db_input($order_id) . "'");
- $order = tep_db_fetch_array($order_query);
-
- $totals_query = tep_db_query("select title, text from " . TABLE_HOLDING_ORDERS_TOTAL . " where orders_id = '" . tep_db_input($order_id) . "' order by sort_order");
- while ($totals = tep_db_fetch_array($totals_query)) {
- $this->totals[] = array('title' => $totals['title'],
- 'text' => $totals['text']);
- }
-
- $this->info = array('currency' => $order['currency'],
- 'currency_value' => $order['currency_value'],
- 'payment_method' => $order['payment_method'],
- 'cc_type' => $order['cc_type'],
- 'cc_owner' => $order['cc_owner'],
- 'cc_number' => $order['cc_number'],
- 'cc_expires' => $order['cc_expires'],
- 'date_purchased' => $order['date_purchased'],
- 'orders_status' => $order['orders_status'],
- 'last_modified' => $order['last_modified']);
-
- $this->customer = array('name' => $order['customers_name'],
- 'company' => $order['customers_company'],
- 'street_address' => $order['customers_street_address'],
- 'suburb' => $order['customers_suburb'],
- 'city' => $order['customers_city'],
- 'postcode' => $order['customers_postcode'],
- 'state' => $order['customers_state'],
- 'country' => $order['customers_country'],
- 'format_id' => $order['customers_address_format_id'],
- 'telephone' => $order['customers_telephone'],
- 'email_address' => $order['customers_email_address'],
- 'ip_address' => $order['ip_address'] );
-
- $this->delivery = array('name' => $order['delivery_name'],
- 'company' => $order['delivery_company'],
- 'street_address' => $order['delivery_street_address'],
- 'suburb' => $order['delivery_suburb'],
- 'city' => $order['delivery_city'],
- 'postcode' => $order['delivery_postcode'],
- 'state' => $order['delivery_state'],
- 'country' => $order['delivery_country'],
- 'format_id' => $order['delivery_address_format_id']);
-
- $this->billing = array('name' => $order['billing_name'],
- 'company' => $order['billing_company'],
- 'street_address' => $order['billing_street_address'],
- 'suburb' => $order['billing_suburb'],
- 'city' => $order['billing_city'],
- 'postcode' => $order['billing_postcode'],
- 'state' => $order['billing_state'],
- 'country' => $order['billing_country'],
- 'format_id' => $order['billing_address_format_id']);
-
- $index = 0;
- $orders_products_query = tep_db_query("select orders_products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price from " . TABLE_HOLDING_ORDERS_PRODUCTS . " where orders_id = '" . tep_db_input($order_id) . "'");
- while ($orders_products = tep_db_fetch_array($orders_products_query)) {
- $this->products[$index] = array('qty' => $orders_products['products_quantity'],
- 'name' => $orders_products['products_name'],
- 'model' => $orders_products['products_model'],
- 'tax' => $orders_products['products_tax'],
- 'price' => $orders_products['products_price'],
- 'final_price' => $orders_products['final_price']);
-
- $subindex = 0;
- $attributes_query = tep_db_query("select products_options, products_options_values, options_values_price, price_prefix from " . TABLE_HOLDING_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . tep_db_input($order_id) . "' and orders_products_id = '" . $orders_products['orders_products_id'] . "'");
- if (tep_db_num_rows($attributes_query)) {
- while ($attributes = tep_db_fetch_array($attributes_query)) {
- $this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'],
- 'value' => $attributes['products_options_values'],
- 'prefix' => $attributes['price_prefix'],
- 'price' => $attributes['options_values_price']);
-
- $subindex++;
- }
- }
- $index++;
- }
- }
- }
-?>
Added: trunk/test/phpunit/Back/classes/allClassCustomerUtilityTest.php
===================================================================
--- trunk/test/phpunit/Back/classes/allClassCustomerUtilityTest.php (rev 0)
+++ trunk/test/phpunit/Back/classes/allClassCustomerUtilityTest.php 2014-01-13 07:48:04 UTC (rev 5034)
@@ -0,0 +1,67 @@
+<?php
+/**
+ * \file test/phpunit/Back/allClassCustomerUtilityTest.php
+ * \brief test unitaire class allmodulesgeneric Backoffice
+ * \remarks To run this script as CLI: phpunit filename.php
+ * \author oscim <mail aur...@os...> <www http://www.oscim.fr>
+ */
+
+// specific for test
+require_once(substr( dirname(__FILE__), 0, -8).'/_top.php');
+
+global $base_path, $path;
+
+
+/**
+ * \class allClassCustomerUtilityTest
+ */
+class allClassCustomerUtilityTest
+ extends PHPUnit_Framework_TestCase
+{
+
+
+ function __construct()
+ {
+
+ }
+
+ /**
+ @brief test class depends childs specific module payment
+ */
+ public function testFilesRequired(){
+ global $base_path, $path;
+ include_once(DIR_FS_ADMIN . DIR_WS_CLASSES.'customerUtility.php');
+ }
+
+
+ /**
+ @brief test function
+ */
+ public function testGetAddressFormats(){
+
+ $list = customerUtility::get_address_formats();
+
+ $this->assertTrue ( is_array($list) , 'Error get_address_formats not load ' ) ;
+
+ foreach($list as $row){
+ $this->assertArrayHasKey('id', $row);
+ $this->assertArrayHasKey('text', $row);
+ }
+
+ }
+
+ /**
+ @brief test function
+ */
+ public function testCustomerName(){
+
+ $val = customerUtility::customers_name(1);
+
+ $this->assertTrue ( is_string($val) , 'Error customers_name not string ' ) ;
+
+ }
+
+
+}
+
+?>
\ No newline at end of file
Added: trunk/test/phpunit/Back/classes/allClassTrackStockTest.php
===================================================================
--- trunk/test/phpunit/Back/classes/allClassTrackStockTest.php (rev 0)
+++ trunk/test/phpunit/Back/classes/allClassTrackStockTest.php 2014-01-13 07:48:04 UTC (rev 5034)
@@ -0,0 +1,83 @@
+<?php
+/**
+ * \file test/phpunit/Back/allClassTrackStockTest.php
+ * \brief test unitaire class allmodulesgeneric Backoffice
+ * \remarks To run this script as CLI: phpunit filename.php
+ * \author oscim <mail aur...@os...> <www http://www.oscim.fr>
+ */
+
+// specific for test
+require_once(substr( dirname(__FILE__), 0, -8).'/_top.php');
+
+global $base_path, $path;
+
+
+/**
+ * \class allClassTrackStockTest
+ */
+class allClassTrackStockTest
+ extends PHPUnit_Framework_TestCase
+{
+
+
+ function __construct()
+ {
+
+ }
+
+ /**
+ @brief test class depends childs specific module payment
+ */
+ public function testFilesRequired(){
+ global $base_path, $path;
+ include_once(DIR_FS_ADMIN . DIR_WS_CLASSES.'tracked_stock.php');
+ }
+
+
+ /**
+ @brief Instanccie class
+ @return $obj result class seo_url
+ */
+ public function testInstanceClass(){
+ global $language_id;
+
+ $obj = new tracked_stock();
+
+ $this->assertTrue ( is_object($obj) , 'Error load tracked_stock is not object ') ;
+
+
+ return $obj;
+ }
+
+ /**
+ @fn testDbLowStock($obj)
+ @brief Get list for argument in alert stock
+ @param $obj object Class seo_url
+ @return none
+ @depends testInstanceClass
+ @covers tracked_stock->db_low_stock
+ */
+ public function testDbLowStock($obj){
+ $list = $obj->db_low_stock();
+
+ // check if subchild format rewrite is loaded
+ $this->assertTrue ( is_array($list) , 'Error load db_low_stock no list return ') ;
+
+
+ if( count($list) > 0)
+ foreach($list as $row){
+ $this->assertArrayHasKey('products_id', $row);
+ $this->assertArrayHasKey('ref', $row);
+ $this->assertArrayHasKey('products_name', $row);
+ $this->assertArrayHasKey('products_model', $row);
+ $this->assertArrayHasKey('stock', $row);
+ $this->assertArrayHasKey('option_stock', $row);
+ $this->assertArrayHasKey('products_stock_attributes', $row);
+ $this->assertArrayHasKey('products_price', $row);
+ $this->assertArrayHasKey('name', $row);
+ }
+ }
+
+}
+
+?>
\ No newline at end of file
Modified: trunk/test/phpunit/Back/classes/allClassWorldUtilityTest.php
===================================================================
--- trunk/test/phpunit/Back/classes/allClassWorldUtilityTest.php 2014-01-11 15:01:13 UTC (rev 5033)
+++ trunk/test/phpunit/Back/classes/allClassWorldUtilityTest.php 2014-01-13 07:48:04 UTC (rev 5034)
@@ -102,7 +102,7 @@
}
/**
- @fn testSelectZone()
+ @fn testZoneName()
@brief test function
@depends testGetCountryZones
@covers worldUtility::cfg_pull_down_zone_classes
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2014-01-11 15:01:17
|
Revision: 5033
http://sourceforge.net/p/oscss/svn/5033
Author: oscim
Date: 2014-01-11 15:01:13 +0000 (Sat, 11 Jan 2014)
Log Message:
-----------
Add Unit test
Added Paths:
-----------
trunk/test/phpunit/Back/classes/allClassWorldUtilityTest.php
Added: trunk/test/phpunit/Back/classes/allClassWorldUtilityTest.php
===================================================================
--- trunk/test/phpunit/Back/classes/allClassWorldUtilityTest.php (rev 0)
+++ trunk/test/phpunit/Back/classes/allClassWorldUtilityTest.php 2014-01-11 15:01:13 UTC (rev 5033)
@@ -0,0 +1,168 @@
+<?php
+/**
+ * \file test/phpunit/Back/allClassCategorieUtilityTest.php
+ * \brief test unitaire class allmodulesgeneric Backoffice
+ * \remarks To run this script as CLI: phpunit filename.php
+ * \author oscim <mail aur...@os...> <www http://www.oscim.fr>
+ */
+
+// specific for test
+require_once(substr( dirname(__FILE__), 0, -8).'/_top.php');
+
+global $base_path, $path;
+
+
+/**
+ * \class allClassCategorieUtilityTest
+ */
+class allClassWorldUtilityTest
+ extends PHPUnit_Framework_TestCase
+{
+
+
+ public function testDeps(){
+ // load class
+ include_once(DIR_FS_CATALOG . DIR_WS_COMMON_CLASSES .'formUtility.php');
+ }
+
+ /**
+ @fn testGetCountries()
+ @brief test function
+ @return $list array all coubtry
+ @covers worldUtility::get_countries
+ */
+ public function testGetCountries(){
+
+ $list = worldUtility::get_countries();
+
+ $this->assertTrue ( is_array($list) , 'Error testGetCountries not return list ' ) ;
+
+ foreach($list as $row){
+ $this->assertArrayHasKey('id', $row);
+ $this->assertArrayHasKey('text', $row);
+ }
+
+ return $list;
+ }
+
+
+ /**
+ @fn testGetCountryFormatAddress()
+ @brief test function
+ @depends testGetCountries
+ @covers worldUtility::GetCountryFormatAddress
+ */
+ public function testGetCountryFormatAddress($list){
+
+ foreach($list as $row){
+ $val = worldUtility::GetCountryFormatAddress($row['id']);
+
+ $this->assertTrue ( is_int($val) , 'Error GetCountryFormatAddress not return int for country as : '.$row['text'] ) ;
+ }
+ }
+
+
+ /**
+ @fn testGetCountryZones()
+ @brief test function
+ @depends testGetCountries
+ @covers worldUtility::get_country_zones
+ */
+ public function testGetCountryZones($list){
+
+ foreach($list as $row){
+ $val = worldUtility::get_country_zones($row['id']);
+
+ $this->assertTrue ( is_array($val) , 'Error get_country_zones not return array zone : '.$row['text'] ) ;
+
+ foreach($val as $r){
+ $this->assertArrayHasKey('id', $r);
+ $this->assertArrayHasKey('text', $r);
+
+ }
+ }
+
+ return $val;
+ }
+
+ /**
+ @fn testSelectZone()
+ @brief test function
+ @depends testGetCountryZones
+ @covers worldUtility::cfg_pull_down_zone_classes
+ */
+ public function testSelectZone($list){
+
+ foreach($list as $row){
+ $val = worldUtility::cfg_pull_down_zone_classes($row['id']);
+
+ $this->assertTrue ( is_string($val) , 'Error cfg_pull_down_zone_classes not return array zone : '.$row['text'] ) ;
+
+ }
+ }
+
+ /**
+ @fn testSelectZone()
+ @brief test function
+ @depends testGetCountryZones
+ @covers worldUtility::cfg_pull_down_zone_classes
+ */
+ public function testZoneName($list){
+
+ foreach($list as $row){
+ $val = worldUtility::get_zone_name($row['id']);
+
+ $this->assertTrue ( ( $val ===$row['text'] ) , 'Error get_zone_name not return array zone : '.$row['text'] ) ;
+
+ }
+ }
+
+ /**
+ @fn testSelectZone()
+ @brief test function
+ @depends testGetCountryZones
+ @covers worldUtility::geo_zones_pull_down
+ */
+ public function testSelectGeoZone($list){
+
+ foreach($list as $row){
+ $val = worldUtility::geo_zones_pull_down();
+
+ $this->assertTrue ( is_string($val) , 'Error geo_zones_pull_down not return array zone : '.$row['text'] ) ;
+
+ }
+ }
+
+ /**
+ @fn testGetCountryName()
+ @brief test function
+ @depends testGetCountries
+ @covers worldUtility::get_country_name
+ */
+ public function testGetCountryName($list){
+
+ foreach($list as $row){
+ $val = worldUtility::get_country_name($row['id']);
+
+ $this->assertTrue ( $val ===$row['text'] , 'Error get_country_name not return correct name : '.$row['text'] ) ;
+ }
+ }
+
+ /**
+ @fn testGetCountryName()
+ @brief test function
+ @depends testGetCountries
+ @covers worldUtility::GetCountryIdByName
+ */
+// public function testGetCountryByName($list){
+//
+// foreach($list as $row){
+// $val = worldUtility::GetCountryIdByName($row['text']);
+//
+// $this->assertTrue ( $val ===$row['id'] , 'Error get_country_name not return correct name : '.$row['text'] ) ;
+// }
+// }
+
+}
+
+?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2014-01-11 13:47:29
|
Revision: 5032
http://sourceforge.net/p/oscss/svn/5032
Author: oscim
Date: 2014-01-11 13:47:25 +0000 (Sat, 11 Jan 2014)
Log Message:
-----------
Fix path dir in test
Modified Paths:
--------------
trunk/test/phpunit/Back/modules/newsletters/allmodulesgenericNewslettersTest.php
Modified: trunk/test/phpunit/Back/modules/newsletters/allmodulesgenericNewslettersTest.php
===================================================================
--- trunk/test/phpunit/Back/modules/newsletters/allmodulesgenericNewslettersTest.php 2014-01-11 13:38:12 UTC (rev 5031)
+++ trunk/test/phpunit/Back/modules/newsletters/allmodulesgenericNewslettersTest.php 2014-01-11 13:47:25 UTC (rev 5032)
@@ -34,8 +34,8 @@
public function testallmodulesgenericDepends(){
global $base_path, $path;
- include_once($path.'../common/classes/NewslettersUtility.php');
- include_once($base_path.'includes/classes/NewslettersChargeur.php');
+ include_once(DIR_FS_CATALOG . DIR_WS_COMMON_CLASSES.'NewslettersUtility.php');
+ include_once(DIR_FS_ADMIN . DIR_WS_CLASSES.'NewslettersChargeur.php');
}
@@ -48,10 +48,10 @@
$arrtmp = array();
- foreach(scan($base_path.DIR_WS_MODULES . 'newsletters/') as $row) {
+ foreach(scan(DIR_FS_ADMIN .DIR_WS_MODULES . 'newsletters/') as $row) {
if( substr($row, -3) == 'php') {
$classes=substr($row,0, -4);
- $i = include($base_path. DIR_WS_MODULES . 'newsletters/'. $row);
+ $i = include(DIR_FS_ADMIN . DIR_WS_MODULES . 'newsletters/'. $row);
$this->assertTrue ( ( $i != false) , 'Error load subschilds mod' ) ;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2014-01-11 13:38:15
|
Revision: 5031
http://sourceforge.net/p/oscss/svn/5031
Author: oscim
Date: 2014-01-11 13:38:12 +0000 (Sat, 11 Jan 2014)
Log Message:
-----------
Fix
Modified Paths:
--------------
trunk/catalog/includes/classes/shopping_cart_action.php
trunk/test/phpunit/Front/paymentTest.php
trunk/test/phpunit/Front/shippingTest.php
Modified: trunk/catalog/includes/classes/shopping_cart_action.php
===================================================================
--- trunk/catalog/includes/classes/shopping_cart_action.php 2014-01-11 10:57:21 UTC (rev 5030)
+++ trunk/catalog/includes/classes/shopping_cart_action.php 2014-01-11 13:38:12 UTC (rev 5031)
@@ -11,8 +11,6 @@
@dir /includes/classes/
*/
-error_reporting(E_ALL);
-
/**
@class shopping_cart_action
@brief Traitement des action sur le shopping cart par l'intermediaire d'une fonction
@@ -21,11 +19,14 @@
/**
- @var Panier d'achat client
+ @var object shoppingCart
*/
public $cart;
-
/**
+ @var string
+ */
+ public $action;
+ /**
@var array action autorised and exe by this class
*/
protected static $actionCart = array(
Modified: trunk/test/phpunit/Front/paymentTest.php
===================================================================
--- trunk/test/phpunit/Front/paymentTest.php 2014-01-11 10:57:21 UTC (rev 5030)
+++ trunk/test/phpunit/Front/paymentTest.php 2014-01-11 13:38:12 UTC (rev 5031)
@@ -75,13 +75,13 @@
* @depends testpaymentshoppingcart_NotExist
*/
public function testpaymentshoppingcart($cart){
- global $cart;
+
self::InitUser();
$_GET['products_id'] = '9';
$_GET['noredirect'] = false;
- $shop_action=new shopping_cart_action();
+ $shop_action=new shopping_cart_action($cart);
$shop_action->init('buy_now');
@@ -107,7 +107,7 @@
// load all enabled payment modules
$payment = payment::resetInstance();
-// resetInstance($module='')
+
$this -> assertTrue ( (is_object($payment)) , 'error payment loadclass' ) ;
$this -> assertTrue ( (is_array($payment->modules) && count($payment->modules) >0 ) , 'error payment modules subchilds no active, please adjust config in backoffice pannel' ) ;
Modified: trunk/test/phpunit/Front/shippingTest.php
===================================================================
--- trunk/test/phpunit/Front/shippingTest.php 2014-01-11 10:57:21 UTC (rev 5030)
+++ trunk/test/phpunit/Front/shippingTest.php 2014-01-11 13:38:12 UTC (rev 5031)
@@ -76,13 +76,12 @@
* @depends testshippingshoppingcart_NotExist
*/
public function testshippingshoppingcart($cart){
- global $cart;
self::InitUser();
$_GET['products_id'] = '9';
$_GET['noredirect'] = false;
- $shop_action=new shopping_cart_action();
+ $shop_action=new shopping_cart_action($cart);
$shop_action->init('buy_now');
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2014-01-11 10:57:24
|
Revision: 5030
http://sourceforge.net/p/oscss/svn/5030
Author: oscim
Date: 2014-01-11 10:57:21 +0000 (Sat, 11 Jan 2014)
Log Message:
-----------
Fix
Added Paths:
-----------
trunk/catalog/common/classes/cart/CartSession.interface.php
Removed Paths:
-------------
trunk/catalog/common/classes/cart/CartSession.Interface.php
Deleted: trunk/catalog/common/classes/cart/CartSession.Interface.php
===================================================================
--- trunk/catalog/common/classes/cart/CartSession.Interface.php 2014-01-11 09:43:27 UTC (rev 5029)
+++ trunk/catalog/common/classes/cart/CartSession.Interface.php 2014-01-11 10:57:21 UTC (rev 5030)
@@ -1,75 +0,0 @@
-<?php
-/**
- @licence GPL 2005-2014 The osCSS developers - osCSS Open Source E-commerce
- @package osCSS-2 <www http://www.oscss.org>
- @version 2.2.0
- @date 06/01/2014, 11:12
- @author oscim <mail aur...@os...> <www http://www.oscim.fr>
- @encode UTF-8
- @file CartSession.Interface.php
- @dir common/classes/cart/
-*/
-
-
-/**
- @interface CartSession
- @brief structure for class stoackage session value cart
-*/
-Interface CartSession{
- /**
- @fn Get( (array)args)
- @brief call current content an return
-
- @return
- array all content
- or array one row if args (if key pid ou pid + option exist)
- */
- public function Get();
-
- /**
- @fn Set($products_id_string, $qty, $special_class)
- @brief stock in session new product / qty for member
- @param $products_id_string int
- @param $qty int
- @param $special_class string
- */
- public function Set(/*$products_id_string, $qty, $special_class*/);
-
- /**
- @fn SetAttribute($products_id_string, $option, $value, $attr_value)
- @param $products_id_string int
- @param $option int
- @param $value string or 0
- @param $attr_value string / text
- */
- public function SetAttribute(/*$products_id_string, $option, $value, $attr_value*/);
-
- /**
- @fn Update($products_id_string, $qty)
- @param $products_id_string int
- @param $qty int
- */
- public function Update(/*$products_id_string, $qty*/);
-
- /**
- @fn UpdateAttribute($products_id_string, $option, $value, $attr_value)
- @param $products_id_string int
- @param $option int
- @param $value string or 0
- @param $attr_value string / text
- */
- public function UpdateAttribute(/*$products_id_string, $option, $value, $attr_value*/);
-
- /**
- @fn delete($products_id_string)
- @param $products_id_string int
- */
- public function Delete(/*$products_id_string*/);
-
- /**
- @fn clean()
- */
- public function Clean();
-}
-
-?>
\ No newline at end of file
Copied: trunk/catalog/common/classes/cart/CartSession.interface.php (from rev 5029, trunk/catalog/common/classes/cart/CartSession.Interface.php)
===================================================================
--- trunk/catalog/common/classes/cart/CartSession.interface.php (rev 0)
+++ trunk/catalog/common/classes/cart/CartSession.interface.php 2014-01-11 10:57:21 UTC (rev 5030)
@@ -0,0 +1,75 @@
+<?php
+/**
+ @licence GPL 2005-2014 The osCSS developers - osCSS Open Source E-commerce
+ @package osCSS-2 <www http://www.oscss.org>
+ @version 2.2.0
+ @date 06/01/2014, 11:12
+ @author oscim <mail aur...@os...> <www http://www.oscim.fr>
+ @encode UTF-8
+ @file CartSession.Interface.php
+ @dir common/classes/cart/
+*/
+
+
+/**
+ @interface CartSession
+ @brief structure for class stoackage session value cart
+*/
+Interface CartSession{
+ /**
+ @fn Get( (array)args)
+ @brief call current content an return
+
+ @return
+ array all content
+ or array one row if args (if key pid ou pid + option exist)
+ */
+ public function Get();
+
+ /**
+ @fn Set($products_id_string, $qty, $special_class)
+ @brief stock in session new product / qty for member
+ @param $products_id_string int
+ @param $qty int
+ @param $special_class string
+ */
+ public function Set(/*$products_id_string, $qty, $special_class*/);
+
+ /**
+ @fn SetAttribute($products_id_string, $option, $value, $attr_value)
+ @param $products_id_string int
+ @param $option int
+ @param $value string or 0
+ @param $attr_value string / text
+ */
+ public function SetAttribute(/*$products_id_string, $option, $value, $attr_value*/);
+
+ /**
+ @fn Update($products_id_string, $qty)
+ @param $products_id_string int
+ @param $qty int
+ */
+ public function Update(/*$products_id_string, $qty*/);
+
+ /**
+ @fn UpdateAttribute($products_id_string, $option, $value, $attr_value)
+ @param $products_id_string int
+ @param $option int
+ @param $value string or 0
+ @param $attr_value string / text
+ */
+ public function UpdateAttribute(/*$products_id_string, $option, $value, $attr_value*/);
+
+ /**
+ @fn delete($products_id_string)
+ @param $products_id_string int
+ */
+ public function Delete(/*$products_id_string*/);
+
+ /**
+ @fn clean()
+ */
+ public function Clean();
+}
+
+?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|