diff --git a/admin.php b/admin.php index 40a50940..7f6de066 100644 --- a/admin.php +++ b/admin.php @@ -1,26 +1,32 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Core */ -if(!isset($_POST["default_admin"]) && !isset($_POST["default_admin"])) -{ - DEFINE('ADMIN_FORCE', true); -} +/** + * The main AgileBill Entry Page + */ + +if(! isset($_POST['default_admin']) && ! isset($_POST['default_admin'])) + DEFINE('ADMIN_FORCE',true); + include_once('index.php'); -?> \ No newline at end of file +?> diff --git a/ajax.php b/ajax.php index 0abcd892..43992d95 100644 --- a/ajax.php +++ b/ajax.php @@ -1,49 +1,61 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Core */ +/** + * The main AgileBill AJAX rendering + */ + +ob_start(); +define('AJAX',1); -ob_start(); -define('AJAX', 1); require_once('config.inc.php'); +require_once('modules/module.inc.php'); require_once('modules/core/vars.inc.php'); -$C_vars = new CORE_vars; -$VAR = $C_vars->f; -require_once('includes/adodb/adodb.inc.php'); -require_once('modules/core/auth.inc.php'); -require_once('modules/core/database.inc.php'); -require_once('modules/core/method_ajax.inc.php'); -require_once('modules/core/session.inc.php'); -require_once('modules/core/setup.inc.php'); -$C_debug = new CORE_debugger; -$C_setup = new CORE_setup; -$C_sess = new CORE_session; -$C_sess->session_constant(); -$C_method = new CORE_method; +$C_vars = new CORE_vars; +$VAR = $C_vars->f; + +require_once('includes/adodb/adodb.inc.php'); +require_once(PATH_CORE.'auth.inc.php'); +require_once(PATH_CORE.'database.inc.php'); +require_once(PATH_CORE.'method_ajax.inc.php'); +require_once(PATH_CORE.'session.inc.php'); +require_once(PATH_CORE.'setup.inc.php'); +require_once(PATH_CORE.'xml.inc.php'); + +$C_debug = new CORE_debugger; +$C_setup = new CORE_setup; +$C_sess = new CORE_session; +$C_sess->session_constant(); +$C_method = new CORE_method; + if ((isset($VAR['_login'])) && (isset($VAR['_username'])) && (isset($VAR['_password']))) { - require_once(PATH_CORE . 'login.inc.php'); + require_once(PATH_CORE.'login.inc.php'); $C_login = new CORE_login_handler(); $C_login->login($VAR); -} -$C_sess->session_constant_log(); -$C_auth = new CORE_auth (false); -$C_method->do_all(); -ob_end_flush(); +} -?> \ No newline at end of file +$C_sess->session_constant_log(); +$C_auth = new CORE_auth(false); +$C_method->do_all(); +ob_end_flush(); +?> diff --git a/config.inc.php b/config.inc.php index 8778f18e..63b667e4 100644 --- a/config.inc.php +++ b/config.inc.php @@ -1 +1,3 @@ -# this file must be writable by php to proceed with installation \ No newline at end of file + diff --git a/cookie.index.php b/cookie.index.php deleted file mode 100644 index 72e77915..00000000 --- a/cookie.index.php +++ /dev/null @@ -1,103 +0,0 @@ -f; - - # initialize the site setup - $C_setup = new CORE_setup; - - # initialize the session handler - $C_sess = new CORE_session; - - # define the other session variables as constants - $C_sess->session_constant(); - - # update the session constants - $C_sess->session_constant_log(); - - # initialze the authentication handler - $force = false; - $C_auth = new CORE_auth ($force); - - ############################################################################ - # Verify the User's Access - $authorized = false; - if(defined("SESS_LOGGED") && SESS_LOGGED == "1" && agile_check_auth ( _HTACCESS_ID ) ) - $authorized = true; - - ############################################################################ - ## forward to login page: - if ( !$authorized ) - { - header("Location: ".URL."?_page=account:login_cookie&_htaccess_id=" . _HTACCESS_ID. "&_next_page="._RETURN_URL); - exit(); - } - - - ### Reset the 's' var - if(isset($_POST_s)) - { - $_POST['s'] = $_POST_s; - } - else if (isset($_GET_s)) - { - $_GET['s'] = $_GET_s; - } - - - ############################## - ## Check Authentication ## - ############################## - function agile_check_auth($id) - { - ### Check if user is a member of one of the authorized groups: - $db = &DB(); - $sql = 'SELECT status,group_avail FROM ' . AGILE_DB_PREFIX . 'htaccess WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - status = ' . $db->qstr('1') . ' AND - id = ' . $db->qstr($id); - $result = $db->Execute($sql); - if($result->RecordCount() > 0) - { - global $C_auth; - @$arr = unserialize($result->fields['group_avail']); - for($i=0; $iauth_group_by_id($arr[$i])) - { - return true; - } - } - } - return false; - } - - ob_end_flush(); -?> \ No newline at end of file diff --git a/htaccess_index.php b/htaccess_index.php deleted file mode 100644 index dee70bae..00000000 --- a/htaccess_index.php +++ /dev/null @@ -1,266 +0,0 @@ - 'jpg', 'type' => 'image/jpeg', 'disposition' => 'inline'), - Array ('name' => 'jpeg', 'type' => 'image/jpeg', 'disposition' => 'inline'), - Array ('name' => 'jpe', 'type' => 'image/jpeg', 'disposition' => 'inline'), - Array ('name' => 'gif', 'type' => 'image/gif', 'disposition' => 'inline'), - Array ('name' => 'bmp', 'type' => 'image/bmp', 'disposition' => 'inline'), - Array ('name' => 'tif', 'type' => 'image/tif', 'disposition' => 'inline'), - Array ('name' => 'png', 'type' => 'image/png', 'disposition' => 'inline'), - Array ('name' => 'wbmp', 'type' => 'image/vnd.wap.wbmp', 'disposition' => 'inline'), - - Array ('name' => 'pdf', 'type' => 'application/pdf', 'disposition' => 'inline'), - Array ('name' => 'exe', 'type' => 'application/octet-stream', 'disposition'=> 'attatchment'), - Array ('name' => 'zip', 'type' => 'application/x-zip', 'disposition' => 'attatchment'), - Array ('name' => 'gzip', 'type' => 'application/gzip', 'disposition' => 'attatchment'), - Array ('name' => 'tgz', 'type' => 'application/tgz', 'disposition' => 'attatchment'), - Array ('name' => 'gz', 'type' => 'application/gz', 'disposition' => 'attatchment'), - Array ('name' => 'doc', 'type' => 'application/ms-word', 'disposition' => 'inline'), - Array ('name' => 'xls', 'type' => 'application/ms-excel', 'disposition' => 'inline'), - Array ('name' => 'csv', 'type' => 'application/ms-excel', 'disposition' => 'inline'), - Array ('name' => 'swf', 'type' => 'application/x-shockwave-flash', 'disposition' => 'inline'), - - Array ('name' => 'txt', 'type' => 'text/plain', 'disposition' => 'inline'), - Array ('name' => 'text', 'type' => 'text/plain', 'disposition' => 'inline'), - Array ('name' => 'rtf', 'type' => 'text/richtext', 'disposition' => 'inline'), - Array ('name' => 'xml', 'type' => 'text/xml', 'disposition' => 'inline'), - Array ('name' => 'css', 'type' => 'text/css', 'disposition' => 'inline'), - Array ('name' => 'js', 'type' => 'text/plain', 'disposition' => 'inline'), - Array ('name' => 'wml', 'type' => 'text/vnd.wap.wml', 'disposition' => 'inline'), - - Array ('name' => 'avi', 'type' => 'video/avi', 'disposition' => 'attatchment'), - Array ('name' => 'mpg', 'type' => 'video/mpeg', 'disposition' => 'attatchment'), - Array ('name' => 'mpeg', 'type' => 'video/mpeg', 'disposition' => 'attatchment'), - Array ('name' => 'mpe', 'type' => 'video/mpeg', 'disposition' => 'attatchment'), - Array ('name' => 'wmv', 'type' => 'video/x-ms-wmv', 'disposition' => 'attatchment'), - Array ('name' => 'asf', 'type' => 'video/x-ms-asf', 'disposition' => 'attatchment') - ); - - # Load the config file: - require_once('config.inc.php'); - - # Require the needed files... - require_once(PATH_ADODB . 'adodb.inc.php'); - require_once(PATH_CORE . 'auth.inc.php'); - require_once(PATH_CORE . 'database.inc.php'); - require_once(PATH_CORE . 'method.inc.php'); - require_once(PATH_CORE . 'session.inc.php'); - require_once(PATH_CORE . 'translate.inc.php'); - require_once(PATH_CORE . 'setup.inc.php'); - require_once(PATH_CORE . 'vars.inc.php'); - require_once(PATH_CORE . 'xml.inc.php'); - - ## Path to the error file - define ( 'ERROR_GIF', PATH_THEMES.DEF_THEME_N.'/images/htaccess_error.gif' ); - - # start the debugger - $C_debug = new CORE_debugger; - - # initialize the GET/POST vars - $C_vars = new CORE_vars; - $VAR = $C_vars->f; - - # initialize the site setup - $C_setup = new CORE_setup; - - # initialize the session handler - $C_sess = new CORE_session; - - # define the other session variables as constants - $C_sess->session_constant(); - - # initialize the translation handler - $C_translate = new CORE_translate; - - # update the session constants - $C_sess->session_constant_log(); - - # initialze the authentication handler - $force = false; - $C_auth = new CORE_auth ($force); - - ######################################################################## - # Verify the User's Access - $authorized = false; - if(defined("SESS_LOGGED")) - if(SESS_LOGGED == "1" && check_auth($VAR['_HTACCESS_ID'])) - $authorized = true; - - ############################################################################ - ## If this was a GET: - if ( isset($REQUEST_URI ) ) - { - $ARRAY = explode ( '?', $REQUEST_URI); - $REQUEST_URI = $ARRAY[0] ; - } - - ## Define global system vars... - if(!isset($DOCUMENT_ROOT)) $DOCUMENT_ROOT = $_SERVER["DOCUMENT_ROOT"]; - if(!isset($REQUEST_URI)) $REQUEST_URI = $_SERVER["REQUEST_URI"]; - if(!isset($SCRIPT_FILENAME)) $SCRIPT_FILENAME = $_SERVER["SCRIPT_FILENAME"]; - - - ############################################################################ - ### Check if File Exists: - if (file_exists($DOCUMENT_ROOT.$REQUEST_URI) && - ($SCRIPT_FILENAME != $DOCUMENT_ROOT.$REQUEST_URI) && - ($REQUEST_URI != "/") && - (!ereg( '[////]{2,}$', $REQUEST_URI ) ) ) - { - - $url = $REQUEST_URI; - - ######################################################################## - # Check Passthu File Types: - - for ($i=0; $i
PAGE NOT FOUND
"; - exit(); - } - } else { - ## forward to login page: - header("Location: ".URL."?_page=account:login_htaccess&_htaccess_id=" . $VAR['_HTACCESS_ID'] . '&_htaccess_dir_id=' . $VAR['_HTACCESS_DIR_ID']); - exit(); - } - - - ######################################################################## - # Filetype not defined, force download: - - header("Pragma: public"); - header("Expires: 0"); - header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); - header("Content-Type: application/force-download"); - header("Content-Type: application/octet-stream"); - header("Content-Type: application/download"); - header("Content-Disposition: attachment; filename=".@basename($DOCUMENT_ROOT.$url).";"); - header("Content-Transfer-Encoding: binary"); - header("Content-Length: ".@filesize($DOCUMENT_ROOT.$url)); - @readfile("$DOCUMENT_ROOT.$url"); - exit(); - - - ############################## - ## Check Authentication ## - ############################## - function check_auth($id) - { - ### Check if user is a member of one of the authorized groups: - $db = &DB(); - $sql = 'SELECT status,group_avail FROM ' . AGILE_DB_PREFIX . 'htaccess WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - status = ' . $db->qstr('1') . ' AND - id = ' . $db->qstr($id); - $result = $db->Execute($sql); - if($result->RecordCount() > 0) { - global $C_auth; - @$arr = unserialize($result->fields['group_avail']); - for($i=0; $iauth_group_by_id($arr[$i])) - return true; - } - return false; - } - - ob_end_flush(); -?> \ No newline at end of file diff --git a/includes/fpdf/font/courier.php b/includes/fpdf/font/courier.php new file mode 100755 index 00000000..913f9a45 --- /dev/null +++ b/includes/fpdf/font/courier.php @@ -0,0 +1,7 @@ + diff --git a/includes/fpdf/font/desktop.ini b/includes/fpdf/font/desktop.ini new file mode 100755 index 00000000..8a96fbb7 --- /dev/null +++ b/includes/fpdf/font/desktop.ini @@ -0,0 +1,4 @@ +[ViewState] +Mode= +Vid= +FolderType=NotSpecified diff --git a/includes/fpdf/font/helvetica.php b/includes/fpdf/font/helvetica.php new file mode 100755 index 00000000..ca94cdf2 --- /dev/null +++ b/includes/fpdf/font/helvetica.php @@ -0,0 +1,15 @@ +278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, + chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584, + ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667, + 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, + 'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833, + 'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556, + chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, + chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, + chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, + chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556, + chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); +?> diff --git a/includes/fpdf/font/helveticab.php b/includes/fpdf/font/helveticab.php new file mode 100755 index 00000000..276cfa8c --- /dev/null +++ b/includes/fpdf/font/helveticab.php @@ -0,0 +1,15 @@ +278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, + chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584, + ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722, + 'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, + 'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889, + 'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556, + chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, + chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, + chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, + chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611, + chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556); +?> diff --git a/includes/fpdf/font/helveticabi.php b/includes/fpdf/font/helveticabi.php new file mode 100755 index 00000000..8d217743 --- /dev/null +++ b/includes/fpdf/font/helveticabi.php @@ -0,0 +1,15 @@ +278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, + chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584, + ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722, + 'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, + 'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889, + 'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556, + chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, + chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, + chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, + chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611, + chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556); +?> diff --git a/includes/fpdf/font/helveticai.php b/includes/fpdf/font/helveticai.php new file mode 100755 index 00000000..88bf4371 --- /dev/null +++ b/includes/fpdf/font/helveticai.php @@ -0,0 +1,15 @@ +278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, + chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584, + ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667, + 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, + 'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833, + 'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556, + chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, + chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, + chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, + chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556, + chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); +?> diff --git a/includes/fpdf/font/makefont/cp1250.map b/includes/fpdf/font/makefont/cp1250.map new file mode 100755 index 00000000..ec110af0 --- /dev/null +++ b/includes/fpdf/font/makefont/cp1250.map @@ -0,0 +1,251 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+20AC Euro +!82 U+201A quotesinglbase +!84 U+201E quotedblbase +!85 U+2026 ellipsis +!86 U+2020 dagger +!87 U+2021 daggerdbl +!89 U+2030 perthousand +!8A U+0160 Scaron +!8B U+2039 guilsinglleft +!8C U+015A Sacute +!8D U+0164 Tcaron +!8E U+017D Zcaron +!8F U+0179 Zacute +!91 U+2018 quoteleft +!92 U+2019 quoteright +!93 U+201C quotedblleft +!94 U+201D quotedblright +!95 U+2022 bullet +!96 U+2013 endash +!97 U+2014 emdash +!99 U+2122 trademark +!9A U+0161 scaron +!9B U+203A guilsinglright +!9C U+015B sacute +!9D U+0165 tcaron +!9E U+017E zcaron +!9F U+017A zacute +!A0 U+00A0 space +!A1 U+02C7 caron +!A2 U+02D8 breve +!A3 U+0141 Lslash +!A4 U+00A4 currency +!A5 U+0104 Aogonek +!A6 U+00A6 brokenbar +!A7 U+00A7 section +!A8 U+00A8 dieresis +!A9 U+00A9 copyright +!AA U+015E Scedilla +!AB U+00AB guillemotleft +!AC U+00AC logicalnot +!AD U+00AD hyphen +!AE U+00AE registered +!AF U+017B Zdotaccent +!B0 U+00B0 degree +!B1 U+00B1 plusminus +!B2 U+02DB ogonek +!B3 U+0142 lslash +!B4 U+00B4 acute +!B5 U+00B5 mu +!B6 U+00B6 paragraph +!B7 U+00B7 periodcentered +!B8 U+00B8 cedilla +!B9 U+0105 aogonek +!BA U+015F scedilla +!BB U+00BB guillemotright +!BC U+013D Lcaron +!BD U+02DD hungarumlaut +!BE U+013E lcaron +!BF U+017C zdotaccent +!C0 U+0154 Racute +!C1 U+00C1 Aacute +!C2 U+00C2 Acircumflex +!C3 U+0102 Abreve +!C4 U+00C4 Adieresis +!C5 U+0139 Lacute +!C6 U+0106 Cacute +!C7 U+00C7 Ccedilla +!C8 U+010C Ccaron +!C9 U+00C9 Eacute +!CA U+0118 Eogonek +!CB U+00CB Edieresis +!CC U+011A Ecaron +!CD U+00CD Iacute +!CE U+00CE Icircumflex +!CF U+010E Dcaron +!D0 U+0110 Dcroat +!D1 U+0143 Nacute +!D2 U+0147 Ncaron +!D3 U+00D3 Oacute +!D4 U+00D4 Ocircumflex +!D5 U+0150 Ohungarumlaut +!D6 U+00D6 Odieresis +!D7 U+00D7 multiply +!D8 U+0158 Rcaron +!D9 U+016E Uring +!DA U+00DA Uacute +!DB U+0170 Uhungarumlaut +!DC U+00DC Udieresis +!DD U+00DD Yacute +!DE U+0162 Tcommaaccent +!DF U+00DF germandbls +!E0 U+0155 racute +!E1 U+00E1 aacute +!E2 U+00E2 acircumflex +!E3 U+0103 abreve +!E4 U+00E4 adieresis +!E5 U+013A lacute +!E6 U+0107 cacute +!E7 U+00E7 ccedilla +!E8 U+010D ccaron +!E9 U+00E9 eacute +!EA U+0119 eogonek +!EB U+00EB edieresis +!EC U+011B ecaron +!ED U+00ED iacute +!EE U+00EE icircumflex +!EF U+010F dcaron +!F0 U+0111 dcroat +!F1 U+0144 nacute +!F2 U+0148 ncaron +!F3 U+00F3 oacute +!F4 U+00F4 ocircumflex +!F5 U+0151 ohungarumlaut +!F6 U+00F6 odieresis +!F7 U+00F7 divide +!F8 U+0159 rcaron +!F9 U+016F uring +!FA U+00FA uacute +!FB U+0171 uhungarumlaut +!FC U+00FC udieresis +!FD U+00FD yacute +!FE U+0163 tcommaaccent +!FF U+02D9 dotaccent diff --git a/includes/fpdf/font/makefont/cp1251.map b/includes/fpdf/font/makefont/cp1251.map new file mode 100755 index 00000000..de6a198d --- /dev/null +++ b/includes/fpdf/font/makefont/cp1251.map @@ -0,0 +1,255 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+0402 afii10051 +!81 U+0403 afii10052 +!82 U+201A quotesinglbase +!83 U+0453 afii10100 +!84 U+201E quotedblbase +!85 U+2026 ellipsis +!86 U+2020 dagger +!87 U+2021 daggerdbl +!88 U+20AC Euro +!89 U+2030 perthousand +!8A U+0409 afii10058 +!8B U+2039 guilsinglleft +!8C U+040A afii10059 +!8D U+040C afii10061 +!8E U+040B afii10060 +!8F U+040F afii10145 +!90 U+0452 afii10099 +!91 U+2018 quoteleft +!92 U+2019 quoteright +!93 U+201C quotedblleft +!94 U+201D quotedblright +!95 U+2022 bullet +!96 U+2013 endash +!97 U+2014 emdash +!99 U+2122 trademark +!9A U+0459 afii10106 +!9B U+203A guilsinglright +!9C U+045A afii10107 +!9D U+045C afii10109 +!9E U+045B afii10108 +!9F U+045F afii10193 +!A0 U+00A0 space +!A1 U+040E afii10062 +!A2 U+045E afii10110 +!A3 U+0408 afii10057 +!A4 U+00A4 currency +!A5 U+0490 afii10050 +!A6 U+00A6 brokenbar +!A7 U+00A7 section +!A8 U+0401 afii10023 +!A9 U+00A9 copyright +!AA U+0404 afii10053 +!AB U+00AB guillemotleft +!AC U+00AC logicalnot +!AD U+00AD hyphen +!AE U+00AE registered +!AF U+0407 afii10056 +!B0 U+00B0 degree +!B1 U+00B1 plusminus +!B2 U+0406 afii10055 +!B3 U+0456 afii10103 +!B4 U+0491 afii10098 +!B5 U+00B5 mu +!B6 U+00B6 paragraph +!B7 U+00B7 periodcentered +!B8 U+0451 afii10071 +!B9 U+2116 afii61352 +!BA U+0454 afii10101 +!BB U+00BB guillemotright +!BC U+0458 afii10105 +!BD U+0405 afii10054 +!BE U+0455 afii10102 +!BF U+0457 afii10104 +!C0 U+0410 afii10017 +!C1 U+0411 afii10018 +!C2 U+0412 afii10019 +!C3 U+0413 afii10020 +!C4 U+0414 afii10021 +!C5 U+0415 afii10022 +!C6 U+0416 afii10024 +!C7 U+0417 afii10025 +!C8 U+0418 afii10026 +!C9 U+0419 afii10027 +!CA U+041A afii10028 +!CB U+041B afii10029 +!CC U+041C afii10030 +!CD U+041D afii10031 +!CE U+041E afii10032 +!CF U+041F afii10033 +!D0 U+0420 afii10034 +!D1 U+0421 afii10035 +!D2 U+0422 afii10036 +!D3 U+0423 afii10037 +!D4 U+0424 afii10038 +!D5 U+0425 afii10039 +!D6 U+0426 afii10040 +!D7 U+0427 afii10041 +!D8 U+0428 afii10042 +!D9 U+0429 afii10043 +!DA U+042A afii10044 +!DB U+042B afii10045 +!DC U+042C afii10046 +!DD U+042D afii10047 +!DE U+042E afii10048 +!DF U+042F afii10049 +!E0 U+0430 afii10065 +!E1 U+0431 afii10066 +!E2 U+0432 afii10067 +!E3 U+0433 afii10068 +!E4 U+0434 afii10069 +!E5 U+0435 afii10070 +!E6 U+0436 afii10072 +!E7 U+0437 afii10073 +!E8 U+0438 afii10074 +!E9 U+0439 afii10075 +!EA U+043A afii10076 +!EB U+043B afii10077 +!EC U+043C afii10078 +!ED U+043D afii10079 +!EE U+043E afii10080 +!EF U+043F afii10081 +!F0 U+0440 afii10082 +!F1 U+0441 afii10083 +!F2 U+0442 afii10084 +!F3 U+0443 afii10085 +!F4 U+0444 afii10086 +!F5 U+0445 afii10087 +!F6 U+0446 afii10088 +!F7 U+0447 afii10089 +!F8 U+0448 afii10090 +!F9 U+0449 afii10091 +!FA U+044A afii10092 +!FB U+044B afii10093 +!FC U+044C afii10094 +!FD U+044D afii10095 +!FE U+044E afii10096 +!FF U+044F afii10097 diff --git a/includes/fpdf/font/makefont/cp1252.map b/includes/fpdf/font/makefont/cp1252.map new file mode 100755 index 00000000..dd490e59 --- /dev/null +++ b/includes/fpdf/font/makefont/cp1252.map @@ -0,0 +1,251 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+20AC Euro +!82 U+201A quotesinglbase +!83 U+0192 florin +!84 U+201E quotedblbase +!85 U+2026 ellipsis +!86 U+2020 dagger +!87 U+2021 daggerdbl +!88 U+02C6 circumflex +!89 U+2030 perthousand +!8A U+0160 Scaron +!8B U+2039 guilsinglleft +!8C U+0152 OE +!8E U+017D Zcaron +!91 U+2018 quoteleft +!92 U+2019 quoteright +!93 U+201C quotedblleft +!94 U+201D quotedblright +!95 U+2022 bullet +!96 U+2013 endash +!97 U+2014 emdash +!98 U+02DC tilde +!99 U+2122 trademark +!9A U+0161 scaron +!9B U+203A guilsinglright +!9C U+0153 oe +!9E U+017E zcaron +!9F U+0178 Ydieresis +!A0 U+00A0 space +!A1 U+00A1 exclamdown +!A2 U+00A2 cent +!A3 U+00A3 sterling +!A4 U+00A4 currency +!A5 U+00A5 yen +!A6 U+00A6 brokenbar +!A7 U+00A7 section +!A8 U+00A8 dieresis +!A9 U+00A9 copyright +!AA U+00AA ordfeminine +!AB U+00AB guillemotleft +!AC U+00AC logicalnot +!AD U+00AD hyphen +!AE U+00AE registered +!AF U+00AF macron +!B0 U+00B0 degree +!B1 U+00B1 plusminus +!B2 U+00B2 twosuperior +!B3 U+00B3 threesuperior +!B4 U+00B4 acute +!B5 U+00B5 mu +!B6 U+00B6 paragraph +!B7 U+00B7 periodcentered +!B8 U+00B8 cedilla +!B9 U+00B9 onesuperior +!BA U+00BA ordmasculine +!BB U+00BB guillemotright +!BC U+00BC onequarter +!BD U+00BD onehalf +!BE U+00BE threequarters +!BF U+00BF questiondown +!C0 U+00C0 Agrave +!C1 U+00C1 Aacute +!C2 U+00C2 Acircumflex +!C3 U+00C3 Atilde +!C4 U+00C4 Adieresis +!C5 U+00C5 Aring +!C6 U+00C6 AE +!C7 U+00C7 Ccedilla +!C8 U+00C8 Egrave +!C9 U+00C9 Eacute +!CA U+00CA Ecircumflex +!CB U+00CB Edieresis +!CC U+00CC Igrave +!CD U+00CD Iacute +!CE U+00CE Icircumflex +!CF U+00CF Idieresis +!D0 U+00D0 Eth +!D1 U+00D1 Ntilde +!D2 U+00D2 Ograve +!D3 U+00D3 Oacute +!D4 U+00D4 Ocircumflex +!D5 U+00D5 Otilde +!D6 U+00D6 Odieresis +!D7 U+00D7 multiply +!D8 U+00D8 Oslash +!D9 U+00D9 Ugrave +!DA U+00DA Uacute +!DB U+00DB Ucircumflex +!DC U+00DC Udieresis +!DD U+00DD Yacute +!DE U+00DE Thorn +!DF U+00DF germandbls +!E0 U+00E0 agrave +!E1 U+00E1 aacute +!E2 U+00E2 acircumflex +!E3 U+00E3 atilde +!E4 U+00E4 adieresis +!E5 U+00E5 aring +!E6 U+00E6 ae +!E7 U+00E7 ccedilla +!E8 U+00E8 egrave +!E9 U+00E9 eacute +!EA U+00EA ecircumflex +!EB U+00EB edieresis +!EC U+00EC igrave +!ED U+00ED iacute +!EE U+00EE icircumflex +!EF U+00EF idieresis +!F0 U+00F0 eth +!F1 U+00F1 ntilde +!F2 U+00F2 ograve +!F3 U+00F3 oacute +!F4 U+00F4 ocircumflex +!F5 U+00F5 otilde +!F6 U+00F6 odieresis +!F7 U+00F7 divide +!F8 U+00F8 oslash +!F9 U+00F9 ugrave +!FA U+00FA uacute +!FB U+00FB ucircumflex +!FC U+00FC udieresis +!FD U+00FD yacute +!FE U+00FE thorn +!FF U+00FF ydieresis diff --git a/includes/fpdf/font/makefont/cp1253.map b/includes/fpdf/font/makefont/cp1253.map new file mode 100755 index 00000000..4bd826fb --- /dev/null +++ b/includes/fpdf/font/makefont/cp1253.map @@ -0,0 +1,239 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+20AC Euro +!82 U+201A quotesinglbase +!83 U+0192 florin +!84 U+201E quotedblbase +!85 U+2026 ellipsis +!86 U+2020 dagger +!87 U+2021 daggerdbl +!89 U+2030 perthousand +!8B U+2039 guilsinglleft +!91 U+2018 quoteleft +!92 U+2019 quoteright +!93 U+201C quotedblleft +!94 U+201D quotedblright +!95 U+2022 bullet +!96 U+2013 endash +!97 U+2014 emdash +!99 U+2122 trademark +!9B U+203A guilsinglright +!A0 U+00A0 space +!A1 U+0385 dieresistonos +!A2 U+0386 Alphatonos +!A3 U+00A3 sterling +!A4 U+00A4 currency +!A5 U+00A5 yen +!A6 U+00A6 brokenbar +!A7 U+00A7 section +!A8 U+00A8 dieresis +!A9 U+00A9 copyright +!AB U+00AB guillemotleft +!AC U+00AC logicalnot +!AD U+00AD hyphen +!AE U+00AE registered +!AF U+2015 afii00208 +!B0 U+00B0 degree +!B1 U+00B1 plusminus +!B2 U+00B2 twosuperior +!B3 U+00B3 threesuperior +!B4 U+0384 tonos +!B5 U+00B5 mu +!B6 U+00B6 paragraph +!B7 U+00B7 periodcentered +!B8 U+0388 Epsilontonos +!B9 U+0389 Etatonos +!BA U+038A Iotatonos +!BB U+00BB guillemotright +!BC U+038C Omicrontonos +!BD U+00BD onehalf +!BE U+038E Upsilontonos +!BF U+038F Omegatonos +!C0 U+0390 iotadieresistonos +!C1 U+0391 Alpha +!C2 U+0392 Beta +!C3 U+0393 Gamma +!C4 U+0394 Delta +!C5 U+0395 Epsilon +!C6 U+0396 Zeta +!C7 U+0397 Eta +!C8 U+0398 Theta +!C9 U+0399 Iota +!CA U+039A Kappa +!CB U+039B Lambda +!CC U+039C Mu +!CD U+039D Nu +!CE U+039E Xi +!CF U+039F Omicron +!D0 U+03A0 Pi +!D1 U+03A1 Rho +!D3 U+03A3 Sigma +!D4 U+03A4 Tau +!D5 U+03A5 Upsilon +!D6 U+03A6 Phi +!D7 U+03A7 Chi +!D8 U+03A8 Psi +!D9 U+03A9 Omega +!DA U+03AA Iotadieresis +!DB U+03AB Upsilondieresis +!DC U+03AC alphatonos +!DD U+03AD epsilontonos +!DE U+03AE etatonos +!DF U+03AF iotatonos +!E0 U+03B0 upsilondieresistonos +!E1 U+03B1 alpha +!E2 U+03B2 beta +!E3 U+03B3 gamma +!E4 U+03B4 delta +!E5 U+03B5 epsilon +!E6 U+03B6 zeta +!E7 U+03B7 eta +!E8 U+03B8 theta +!E9 U+03B9 iota +!EA U+03BA kappa +!EB U+03BB lambda +!EC U+03BC mu +!ED U+03BD nu +!EE U+03BE xi +!EF U+03BF omicron +!F0 U+03C0 pi +!F1 U+03C1 rho +!F2 U+03C2 sigma1 +!F3 U+03C3 sigma +!F4 U+03C4 tau +!F5 U+03C5 upsilon +!F6 U+03C6 phi +!F7 U+03C7 chi +!F8 U+03C8 psi +!F9 U+03C9 omega +!FA U+03CA iotadieresis +!FB U+03CB upsilondieresis +!FC U+03CC omicrontonos +!FD U+03CD upsilontonos +!FE U+03CE omegatonos diff --git a/includes/fpdf/font/makefont/cp1254.map b/includes/fpdf/font/makefont/cp1254.map new file mode 100755 index 00000000..829473b2 --- /dev/null +++ b/includes/fpdf/font/makefont/cp1254.map @@ -0,0 +1,249 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+20AC Euro +!82 U+201A quotesinglbase +!83 U+0192 florin +!84 U+201E quotedblbase +!85 U+2026 ellipsis +!86 U+2020 dagger +!87 U+2021 daggerdbl +!88 U+02C6 circumflex +!89 U+2030 perthousand +!8A U+0160 Scaron +!8B U+2039 guilsinglleft +!8C U+0152 OE +!91 U+2018 quoteleft +!92 U+2019 quoteright +!93 U+201C quotedblleft +!94 U+201D quotedblright +!95 U+2022 bullet +!96 U+2013 endash +!97 U+2014 emdash +!98 U+02DC tilde +!99 U+2122 trademark +!9A U+0161 scaron +!9B U+203A guilsinglright +!9C U+0153 oe +!9F U+0178 Ydieresis +!A0 U+00A0 space +!A1 U+00A1 exclamdown +!A2 U+00A2 cent +!A3 U+00A3 sterling +!A4 U+00A4 currency +!A5 U+00A5 yen +!A6 U+00A6 brokenbar +!A7 U+00A7 section +!A8 U+00A8 dieresis +!A9 U+00A9 copyright +!AA U+00AA ordfeminine +!AB U+00AB guillemotleft +!AC U+00AC logicalnot +!AD U+00AD hyphen +!AE U+00AE registered +!AF U+00AF macron +!B0 U+00B0 degree +!B1 U+00B1 plusminus +!B2 U+00B2 twosuperior +!B3 U+00B3 threesuperior +!B4 U+00B4 acute +!B5 U+00B5 mu +!B6 U+00B6 paragraph +!B7 U+00B7 periodcentered +!B8 U+00B8 cedilla +!B9 U+00B9 onesuperior +!BA U+00BA ordmasculine +!BB U+00BB guillemotright +!BC U+00BC onequarter +!BD U+00BD onehalf +!BE U+00BE threequarters +!BF U+00BF questiondown +!C0 U+00C0 Agrave +!C1 U+00C1 Aacute +!C2 U+00C2 Acircumflex +!C3 U+00C3 Atilde +!C4 U+00C4 Adieresis +!C5 U+00C5 Aring +!C6 U+00C6 AE +!C7 U+00C7 Ccedilla +!C8 U+00C8 Egrave +!C9 U+00C9 Eacute +!CA U+00CA Ecircumflex +!CB U+00CB Edieresis +!CC U+00CC Igrave +!CD U+00CD Iacute +!CE U+00CE Icircumflex +!CF U+00CF Idieresis +!D0 U+011E Gbreve +!D1 U+00D1 Ntilde +!D2 U+00D2 Ograve +!D3 U+00D3 Oacute +!D4 U+00D4 Ocircumflex +!D5 U+00D5 Otilde +!D6 U+00D6 Odieresis +!D7 U+00D7 multiply +!D8 U+00D8 Oslash +!D9 U+00D9 Ugrave +!DA U+00DA Uacute +!DB U+00DB Ucircumflex +!DC U+00DC Udieresis +!DD U+0130 Idotaccent +!DE U+015E Scedilla +!DF U+00DF germandbls +!E0 U+00E0 agrave +!E1 U+00E1 aacute +!E2 U+00E2 acircumflex +!E3 U+00E3 atilde +!E4 U+00E4 adieresis +!E5 U+00E5 aring +!E6 U+00E6 ae +!E7 U+00E7 ccedilla +!E8 U+00E8 egrave +!E9 U+00E9 eacute +!EA U+00EA ecircumflex +!EB U+00EB edieresis +!EC U+00EC igrave +!ED U+00ED iacute +!EE U+00EE icircumflex +!EF U+00EF idieresis +!F0 U+011F gbreve +!F1 U+00F1 ntilde +!F2 U+00F2 ograve +!F3 U+00F3 oacute +!F4 U+00F4 ocircumflex +!F5 U+00F5 otilde +!F6 U+00F6 odieresis +!F7 U+00F7 divide +!F8 U+00F8 oslash +!F9 U+00F9 ugrave +!FA U+00FA uacute +!FB U+00FB ucircumflex +!FC U+00FC udieresis +!FD U+0131 dotlessi +!FE U+015F scedilla +!FF U+00FF ydieresis diff --git a/includes/fpdf/font/makefont/cp1255.map b/includes/fpdf/font/makefont/cp1255.map new file mode 100755 index 00000000..079e10c6 --- /dev/null +++ b/includes/fpdf/font/makefont/cp1255.map @@ -0,0 +1,233 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+20AC Euro +!82 U+201A quotesinglbase +!83 U+0192 florin +!84 U+201E quotedblbase +!85 U+2026 ellipsis +!86 U+2020 dagger +!87 U+2021 daggerdbl +!88 U+02C6 circumflex +!89 U+2030 perthousand +!8B U+2039 guilsinglleft +!91 U+2018 quoteleft +!92 U+2019 quoteright +!93 U+201C quotedblleft +!94 U+201D quotedblright +!95 U+2022 bullet +!96 U+2013 endash +!97 U+2014 emdash +!98 U+02DC tilde +!99 U+2122 trademark +!9B U+203A guilsinglright +!A0 U+00A0 space +!A1 U+00A1 exclamdown +!A2 U+00A2 cent +!A3 U+00A3 sterling +!A4 U+20AA afii57636 +!A5 U+00A5 yen +!A6 U+00A6 brokenbar +!A7 U+00A7 section +!A8 U+00A8 dieresis +!A9 U+00A9 copyright +!AA U+00D7 multiply +!AB U+00AB guillemotleft +!AC U+00AC logicalnot +!AD U+00AD sfthyphen +!AE U+00AE registered +!AF U+00AF macron +!B0 U+00B0 degree +!B1 U+00B1 plusminus +!B2 U+00B2 twosuperior +!B3 U+00B3 threesuperior +!B4 U+00B4 acute +!B5 U+00B5 mu +!B6 U+00B6 paragraph +!B7 U+00B7 middot +!B8 U+00B8 cedilla +!B9 U+00B9 onesuperior +!BA U+00F7 divide +!BB U+00BB guillemotright +!BC U+00BC onequarter +!BD U+00BD onehalf +!BE U+00BE threequarters +!BF U+00BF questiondown +!C0 U+05B0 afii57799 +!C1 U+05B1 afii57801 +!C2 U+05B2 afii57800 +!C3 U+05B3 afii57802 +!C4 U+05B4 afii57793 +!C5 U+05B5 afii57794 +!C6 U+05B6 afii57795 +!C7 U+05B7 afii57798 +!C8 U+05B8 afii57797 +!C9 U+05B9 afii57806 +!CB U+05BB afii57796 +!CC U+05BC afii57807 +!CD U+05BD afii57839 +!CE U+05BE afii57645 +!CF U+05BF afii57841 +!D0 U+05C0 afii57842 +!D1 U+05C1 afii57804 +!D2 U+05C2 afii57803 +!D3 U+05C3 afii57658 +!D4 U+05F0 afii57716 +!D5 U+05F1 afii57717 +!D6 U+05F2 afii57718 +!D7 U+05F3 gereshhebrew +!D8 U+05F4 gershayimhebrew +!E0 U+05D0 afii57664 +!E1 U+05D1 afii57665 +!E2 U+05D2 afii57666 +!E3 U+05D3 afii57667 +!E4 U+05D4 afii57668 +!E5 U+05D5 afii57669 +!E6 U+05D6 afii57670 +!E7 U+05D7 afii57671 +!E8 U+05D8 afii57672 +!E9 U+05D9 afii57673 +!EA U+05DA afii57674 +!EB U+05DB afii57675 +!EC U+05DC afii57676 +!ED U+05DD afii57677 +!EE U+05DE afii57678 +!EF U+05DF afii57679 +!F0 U+05E0 afii57680 +!F1 U+05E1 afii57681 +!F2 U+05E2 afii57682 +!F3 U+05E3 afii57683 +!F4 U+05E4 afii57684 +!F5 U+05E5 afii57685 +!F6 U+05E6 afii57686 +!F7 U+05E7 afii57687 +!F8 U+05E8 afii57688 +!F9 U+05E9 afii57689 +!FA U+05EA afii57690 +!FD U+200E afii299 +!FE U+200F afii300 diff --git a/includes/fpdf/font/makefont/cp1257.map b/includes/fpdf/font/makefont/cp1257.map new file mode 100755 index 00000000..2f2ecfa2 --- /dev/null +++ b/includes/fpdf/font/makefont/cp1257.map @@ -0,0 +1,244 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+20AC Euro +!82 U+201A quotesinglbase +!84 U+201E quotedblbase +!85 U+2026 ellipsis +!86 U+2020 dagger +!87 U+2021 daggerdbl +!89 U+2030 perthousand +!8B U+2039 guilsinglleft +!8D U+00A8 dieresis +!8E U+02C7 caron +!8F U+00B8 cedilla +!91 U+2018 quoteleft +!92 U+2019 quoteright +!93 U+201C quotedblleft +!94 U+201D quotedblright +!95 U+2022 bullet +!96 U+2013 endash +!97 U+2014 emdash +!99 U+2122 trademark +!9B U+203A guilsinglright +!9D U+00AF macron +!9E U+02DB ogonek +!A0 U+00A0 space +!A2 U+00A2 cent +!A3 U+00A3 sterling +!A4 U+00A4 currency +!A6 U+00A6 brokenbar +!A7 U+00A7 section +!A8 U+00D8 Oslash +!A9 U+00A9 copyright +!AA U+0156 Rcommaaccent +!AB U+00AB guillemotleft +!AC U+00AC logicalnot +!AD U+00AD hyphen +!AE U+00AE registered +!AF U+00C6 AE +!B0 U+00B0 degree +!B1 U+00B1 plusminus +!B2 U+00B2 twosuperior +!B3 U+00B3 threesuperior +!B4 U+00B4 acute +!B5 U+00B5 mu +!B6 U+00B6 paragraph +!B7 U+00B7 periodcentered +!B8 U+00F8 oslash +!B9 U+00B9 onesuperior +!BA U+0157 rcommaaccent +!BB U+00BB guillemotright +!BC U+00BC onequarter +!BD U+00BD onehalf +!BE U+00BE threequarters +!BF U+00E6 ae +!C0 U+0104 Aogonek +!C1 U+012E Iogonek +!C2 U+0100 Amacron +!C3 U+0106 Cacute +!C4 U+00C4 Adieresis +!C5 U+00C5 Aring +!C6 U+0118 Eogonek +!C7 U+0112 Emacron +!C8 U+010C Ccaron +!C9 U+00C9 Eacute +!CA U+0179 Zacute +!CB U+0116 Edotaccent +!CC U+0122 Gcommaaccent +!CD U+0136 Kcommaaccent +!CE U+012A Imacron +!CF U+013B Lcommaaccent +!D0 U+0160 Scaron +!D1 U+0143 Nacute +!D2 U+0145 Ncommaaccent +!D3 U+00D3 Oacute +!D4 U+014C Omacron +!D5 U+00D5 Otilde +!D6 U+00D6 Odieresis +!D7 U+00D7 multiply +!D8 U+0172 Uogonek +!D9 U+0141 Lslash +!DA U+015A Sacute +!DB U+016A Umacron +!DC U+00DC Udieresis +!DD U+017B Zdotaccent +!DE U+017D Zcaron +!DF U+00DF germandbls +!E0 U+0105 aogonek +!E1 U+012F iogonek +!E2 U+0101 amacron +!E3 U+0107 cacute +!E4 U+00E4 adieresis +!E5 U+00E5 aring +!E6 U+0119 eogonek +!E7 U+0113 emacron +!E8 U+010D ccaron +!E9 U+00E9 eacute +!EA U+017A zacute +!EB U+0117 edotaccent +!EC U+0123 gcommaaccent +!ED U+0137 kcommaaccent +!EE U+012B imacron +!EF U+013C lcommaaccent +!F0 U+0161 scaron +!F1 U+0144 nacute +!F2 U+0146 ncommaaccent +!F3 U+00F3 oacute +!F4 U+014D omacron +!F5 U+00F5 otilde +!F6 U+00F6 odieresis +!F7 U+00F7 divide +!F8 U+0173 uogonek +!F9 U+0142 lslash +!FA U+015B sacute +!FB U+016B umacron +!FC U+00FC udieresis +!FD U+017C zdotaccent +!FE U+017E zcaron +!FF U+02D9 dotaccent diff --git a/includes/fpdf/font/makefont/cp1258.map b/includes/fpdf/font/makefont/cp1258.map new file mode 100755 index 00000000..fed915f7 --- /dev/null +++ b/includes/fpdf/font/makefont/cp1258.map @@ -0,0 +1,247 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+20AC Euro +!82 U+201A quotesinglbase +!83 U+0192 florin +!84 U+201E quotedblbase +!85 U+2026 ellipsis +!86 U+2020 dagger +!87 U+2021 daggerdbl +!88 U+02C6 circumflex +!89 U+2030 perthousand +!8B U+2039 guilsinglleft +!8C U+0152 OE +!91 U+2018 quoteleft +!92 U+2019 quoteright +!93 U+201C quotedblleft +!94 U+201D quotedblright +!95 U+2022 bullet +!96 U+2013 endash +!97 U+2014 emdash +!98 U+02DC tilde +!99 U+2122 trademark +!9B U+203A guilsinglright +!9C U+0153 oe +!9F U+0178 Ydieresis +!A0 U+00A0 space +!A1 U+00A1 exclamdown +!A2 U+00A2 cent +!A3 U+00A3 sterling +!A4 U+00A4 currency +!A5 U+00A5 yen +!A6 U+00A6 brokenbar +!A7 U+00A7 section +!A8 U+00A8 dieresis +!A9 U+00A9 copyright +!AA U+00AA ordfeminine +!AB U+00AB guillemotleft +!AC U+00AC logicalnot +!AD U+00AD hyphen +!AE U+00AE registered +!AF U+00AF macron +!B0 U+00B0 degree +!B1 U+00B1 plusminus +!B2 U+00B2 twosuperior +!B3 U+00B3 threesuperior +!B4 U+00B4 acute +!B5 U+00B5 mu +!B6 U+00B6 paragraph +!B7 U+00B7 periodcentered +!B8 U+00B8 cedilla +!B9 U+00B9 onesuperior +!BA U+00BA ordmasculine +!BB U+00BB guillemotright +!BC U+00BC onequarter +!BD U+00BD onehalf +!BE U+00BE threequarters +!BF U+00BF questiondown +!C0 U+00C0 Agrave +!C1 U+00C1 Aacute +!C2 U+00C2 Acircumflex +!C3 U+0102 Abreve +!C4 U+00C4 Adieresis +!C5 U+00C5 Aring +!C6 U+00C6 AE +!C7 U+00C7 Ccedilla +!C8 U+00C8 Egrave +!C9 U+00C9 Eacute +!CA U+00CA Ecircumflex +!CB U+00CB Edieresis +!CC U+0300 gravecomb +!CD U+00CD Iacute +!CE U+00CE Icircumflex +!CF U+00CF Idieresis +!D0 U+0110 Dcroat +!D1 U+00D1 Ntilde +!D2 U+0309 hookabovecomb +!D3 U+00D3 Oacute +!D4 U+00D4 Ocircumflex +!D5 U+01A0 Ohorn +!D6 U+00D6 Odieresis +!D7 U+00D7 multiply +!D8 U+00D8 Oslash +!D9 U+00D9 Ugrave +!DA U+00DA Uacute +!DB U+00DB Ucircumflex +!DC U+00DC Udieresis +!DD U+01AF Uhorn +!DE U+0303 tildecomb +!DF U+00DF germandbls +!E0 U+00E0 agrave +!E1 U+00E1 aacute +!E2 U+00E2 acircumflex +!E3 U+0103 abreve +!E4 U+00E4 adieresis +!E5 U+00E5 aring +!E6 U+00E6 ae +!E7 U+00E7 ccedilla +!E8 U+00E8 egrave +!E9 U+00E9 eacute +!EA U+00EA ecircumflex +!EB U+00EB edieresis +!EC U+0301 acutecomb +!ED U+00ED iacute +!EE U+00EE icircumflex +!EF U+00EF idieresis +!F0 U+0111 dcroat +!F1 U+00F1 ntilde +!F2 U+0323 dotbelowcomb +!F3 U+00F3 oacute +!F4 U+00F4 ocircumflex +!F5 U+01A1 ohorn +!F6 U+00F6 odieresis +!F7 U+00F7 divide +!F8 U+00F8 oslash +!F9 U+00F9 ugrave +!FA U+00FA uacute +!FB U+00FB ucircumflex +!FC U+00FC udieresis +!FD U+01B0 uhorn +!FE U+20AB dong +!FF U+00FF ydieresis diff --git a/includes/fpdf/font/makefont/cp874.map b/includes/fpdf/font/makefont/cp874.map new file mode 100755 index 00000000..1006e6b1 --- /dev/null +++ b/includes/fpdf/font/makefont/cp874.map @@ -0,0 +1,225 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+20AC Euro +!85 U+2026 ellipsis +!91 U+2018 quoteleft +!92 U+2019 quoteright +!93 U+201C quotedblleft +!94 U+201D quotedblright +!95 U+2022 bullet +!96 U+2013 endash +!97 U+2014 emdash +!A0 U+00A0 space +!A1 U+0E01 kokaithai +!A2 U+0E02 khokhaithai +!A3 U+0E03 khokhuatthai +!A4 U+0E04 khokhwaithai +!A5 U+0E05 khokhonthai +!A6 U+0E06 khorakhangthai +!A7 U+0E07 ngonguthai +!A8 U+0E08 chochanthai +!A9 U+0E09 chochingthai +!AA U+0E0A chochangthai +!AB U+0E0B sosothai +!AC U+0E0C chochoethai +!AD U+0E0D yoyingthai +!AE U+0E0E dochadathai +!AF U+0E0F topatakthai +!B0 U+0E10 thothanthai +!B1 U+0E11 thonangmonthothai +!B2 U+0E12 thophuthaothai +!B3 U+0E13 nonenthai +!B4 U+0E14 dodekthai +!B5 U+0E15 totaothai +!B6 U+0E16 thothungthai +!B7 U+0E17 thothahanthai +!B8 U+0E18 thothongthai +!B9 U+0E19 nonuthai +!BA U+0E1A bobaimaithai +!BB U+0E1B poplathai +!BC U+0E1C phophungthai +!BD U+0E1D fofathai +!BE U+0E1E phophanthai +!BF U+0E1F fofanthai +!C0 U+0E20 phosamphaothai +!C1 U+0E21 momathai +!C2 U+0E22 yoyakthai +!C3 U+0E23 roruathai +!C4 U+0E24 ruthai +!C5 U+0E25 lolingthai +!C6 U+0E26 luthai +!C7 U+0E27 wowaenthai +!C8 U+0E28 sosalathai +!C9 U+0E29 sorusithai +!CA U+0E2A sosuathai +!CB U+0E2B hohipthai +!CC U+0E2C lochulathai +!CD U+0E2D oangthai +!CE U+0E2E honokhukthai +!CF U+0E2F paiyannoithai +!D0 U+0E30 saraathai +!D1 U+0E31 maihanakatthai +!D2 U+0E32 saraaathai +!D3 U+0E33 saraamthai +!D4 U+0E34 saraithai +!D5 U+0E35 saraiithai +!D6 U+0E36 sarauethai +!D7 U+0E37 saraueethai +!D8 U+0E38 sarauthai +!D9 U+0E39 sarauuthai +!DA U+0E3A phinthuthai +!DF U+0E3F bahtthai +!E0 U+0E40 saraethai +!E1 U+0E41 saraaethai +!E2 U+0E42 saraothai +!E3 U+0E43 saraaimaimuanthai +!E4 U+0E44 saraaimaimalaithai +!E5 U+0E45 lakkhangyaothai +!E6 U+0E46 maiyamokthai +!E7 U+0E47 maitaikhuthai +!E8 U+0E48 maiekthai +!E9 U+0E49 maithothai +!EA U+0E4A maitrithai +!EB U+0E4B maichattawathai +!EC U+0E4C thanthakhatthai +!ED U+0E4D nikhahitthai +!EE U+0E4E yamakkanthai +!EF U+0E4F fongmanthai +!F0 U+0E50 zerothai +!F1 U+0E51 onethai +!F2 U+0E52 twothai +!F3 U+0E53 threethai +!F4 U+0E54 fourthai +!F5 U+0E55 fivethai +!F6 U+0E56 sixthai +!F7 U+0E57 seventhai +!F8 U+0E58 eightthai +!F9 U+0E59 ninethai +!FA U+0E5A angkhankhuthai +!FB U+0E5B khomutthai diff --git a/includes/fpdf/font/makefont/iso-8859-1.map b/includes/fpdf/font/makefont/iso-8859-1.map new file mode 100755 index 00000000..61740a38 --- /dev/null +++ b/includes/fpdf/font/makefont/iso-8859-1.map @@ -0,0 +1,256 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+0080 .notdef +!81 U+0081 .notdef +!82 U+0082 .notdef +!83 U+0083 .notdef +!84 U+0084 .notdef +!85 U+0085 .notdef +!86 U+0086 .notdef +!87 U+0087 .notdef +!88 U+0088 .notdef +!89 U+0089 .notdef +!8A U+008A .notdef +!8B U+008B .notdef +!8C U+008C .notdef +!8D U+008D .notdef +!8E U+008E .notdef +!8F U+008F .notdef +!90 U+0090 .notdef +!91 U+0091 .notdef +!92 U+0092 .notdef +!93 U+0093 .notdef +!94 U+0094 .notdef +!95 U+0095 .notdef +!96 U+0096 .notdef +!97 U+0097 .notdef +!98 U+0098 .notdef +!99 U+0099 .notdef +!9A U+009A .notdef +!9B U+009B .notdef +!9C U+009C .notdef +!9D U+009D .notdef +!9E U+009E .notdef +!9F U+009F .notdef +!A0 U+00A0 space +!A1 U+00A1 exclamdown +!A2 U+00A2 cent +!A3 U+00A3 sterling +!A4 U+00A4 currency +!A5 U+00A5 yen +!A6 U+00A6 brokenbar +!A7 U+00A7 section +!A8 U+00A8 dieresis +!A9 U+00A9 copyright +!AA U+00AA ordfeminine +!AB U+00AB guillemotleft +!AC U+00AC logicalnot +!AD U+00AD hyphen +!AE U+00AE registered +!AF U+00AF macron +!B0 U+00B0 degree +!B1 U+00B1 plusminus +!B2 U+00B2 twosuperior +!B3 U+00B3 threesuperior +!B4 U+00B4 acute +!B5 U+00B5 mu +!B6 U+00B6 paragraph +!B7 U+00B7 periodcentered +!B8 U+00B8 cedilla +!B9 U+00B9 onesuperior +!BA U+00BA ordmasculine +!BB U+00BB guillemotright +!BC U+00BC onequarter +!BD U+00BD onehalf +!BE U+00BE threequarters +!BF U+00BF questiondown +!C0 U+00C0 Agrave +!C1 U+00C1 Aacute +!C2 U+00C2 Acircumflex +!C3 U+00C3 Atilde +!C4 U+00C4 Adieresis +!C5 U+00C5 Aring +!C6 U+00C6 AE +!C7 U+00C7 Ccedilla +!C8 U+00C8 Egrave +!C9 U+00C9 Eacute +!CA U+00CA Ecircumflex +!CB U+00CB Edieresis +!CC U+00CC Igrave +!CD U+00CD Iacute +!CE U+00CE Icircumflex +!CF U+00CF Idieresis +!D0 U+00D0 Eth +!D1 U+00D1 Ntilde +!D2 U+00D2 Ograve +!D3 U+00D3 Oacute +!D4 U+00D4 Ocircumflex +!D5 U+00D5 Otilde +!D6 U+00D6 Odieresis +!D7 U+00D7 multiply +!D8 U+00D8 Oslash +!D9 U+00D9 Ugrave +!DA U+00DA Uacute +!DB U+00DB Ucircumflex +!DC U+00DC Udieresis +!DD U+00DD Yacute +!DE U+00DE Thorn +!DF U+00DF germandbls +!E0 U+00E0 agrave +!E1 U+00E1 aacute +!E2 U+00E2 acircumflex +!E3 U+00E3 atilde +!E4 U+00E4 adieresis +!E5 U+00E5 aring +!E6 U+00E6 ae +!E7 U+00E7 ccedilla +!E8 U+00E8 egrave +!E9 U+00E9 eacute +!EA U+00EA ecircumflex +!EB U+00EB edieresis +!EC U+00EC igrave +!ED U+00ED iacute +!EE U+00EE icircumflex +!EF U+00EF idieresis +!F0 U+00F0 eth +!F1 U+00F1 ntilde +!F2 U+00F2 ograve +!F3 U+00F3 oacute +!F4 U+00F4 ocircumflex +!F5 U+00F5 otilde +!F6 U+00F6 odieresis +!F7 U+00F7 divide +!F8 U+00F8 oslash +!F9 U+00F9 ugrave +!FA U+00FA uacute +!FB U+00FB ucircumflex +!FC U+00FC udieresis +!FD U+00FD yacute +!FE U+00FE thorn +!FF U+00FF ydieresis diff --git a/includes/fpdf/font/makefont/iso-8859-11.map b/includes/fpdf/font/makefont/iso-8859-11.map new file mode 100755 index 00000000..91688120 --- /dev/null +++ b/includes/fpdf/font/makefont/iso-8859-11.map @@ -0,0 +1,248 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+0080 .notdef +!81 U+0081 .notdef +!82 U+0082 .notdef +!83 U+0083 .notdef +!84 U+0084 .notdef +!85 U+0085 .notdef +!86 U+0086 .notdef +!87 U+0087 .notdef +!88 U+0088 .notdef +!89 U+0089 .notdef +!8A U+008A .notdef +!8B U+008B .notdef +!8C U+008C .notdef +!8D U+008D .notdef +!8E U+008E .notdef +!8F U+008F .notdef +!90 U+0090 .notdef +!91 U+0091 .notdef +!92 U+0092 .notdef +!93 U+0093 .notdef +!94 U+0094 .notdef +!95 U+0095 .notdef +!96 U+0096 .notdef +!97 U+0097 .notdef +!98 U+0098 .notdef +!99 U+0099 .notdef +!9A U+009A .notdef +!9B U+009B .notdef +!9C U+009C .notdef +!9D U+009D .notdef +!9E U+009E .notdef +!9F U+009F .notdef +!A0 U+00A0 space +!A1 U+0E01 kokaithai +!A2 U+0E02 khokhaithai +!A3 U+0E03 khokhuatthai +!A4 U+0E04 khokhwaithai +!A5 U+0E05 khokhonthai +!A6 U+0E06 khorakhangthai +!A7 U+0E07 ngonguthai +!A8 U+0E08 chochanthai +!A9 U+0E09 chochingthai +!AA U+0E0A chochangthai +!AB U+0E0B sosothai +!AC U+0E0C chochoethai +!AD U+0E0D yoyingthai +!AE U+0E0E dochadathai +!AF U+0E0F topatakthai +!B0 U+0E10 thothanthai +!B1 U+0E11 thonangmonthothai +!B2 U+0E12 thophuthaothai +!B3 U+0E13 nonenthai +!B4 U+0E14 dodekthai +!B5 U+0E15 totaothai +!B6 U+0E16 thothungthai +!B7 U+0E17 thothahanthai +!B8 U+0E18 thothongthai +!B9 U+0E19 nonuthai +!BA U+0E1A bobaimaithai +!BB U+0E1B poplathai +!BC U+0E1C phophungthai +!BD U+0E1D fofathai +!BE U+0E1E phophanthai +!BF U+0E1F fofanthai +!C0 U+0E20 phosamphaothai +!C1 U+0E21 momathai +!C2 U+0E22 yoyakthai +!C3 U+0E23 roruathai +!C4 U+0E24 ruthai +!C5 U+0E25 lolingthai +!C6 U+0E26 luthai +!C7 U+0E27 wowaenthai +!C8 U+0E28 sosalathai +!C9 U+0E29 sorusithai +!CA U+0E2A sosuathai +!CB U+0E2B hohipthai +!CC U+0E2C lochulathai +!CD U+0E2D oangthai +!CE U+0E2E honokhukthai +!CF U+0E2F paiyannoithai +!D0 U+0E30 saraathai +!D1 U+0E31 maihanakatthai +!D2 U+0E32 saraaathai +!D3 U+0E33 saraamthai +!D4 U+0E34 saraithai +!D5 U+0E35 saraiithai +!D6 U+0E36 sarauethai +!D7 U+0E37 saraueethai +!D8 U+0E38 sarauthai +!D9 U+0E39 sarauuthai +!DA U+0E3A phinthuthai +!DF U+0E3F bahtthai +!E0 U+0E40 saraethai +!E1 U+0E41 saraaethai +!E2 U+0E42 saraothai +!E3 U+0E43 saraaimaimuanthai +!E4 U+0E44 saraaimaimalaithai +!E5 U+0E45 lakkhangyaothai +!E6 U+0E46 maiyamokthai +!E7 U+0E47 maitaikhuthai +!E8 U+0E48 maiekthai +!E9 U+0E49 maithothai +!EA U+0E4A maitrithai +!EB U+0E4B maichattawathai +!EC U+0E4C thanthakhatthai +!ED U+0E4D nikhahitthai +!EE U+0E4E yamakkanthai +!EF U+0E4F fongmanthai +!F0 U+0E50 zerothai +!F1 U+0E51 onethai +!F2 U+0E52 twothai +!F3 U+0E53 threethai +!F4 U+0E54 fourthai +!F5 U+0E55 fivethai +!F6 U+0E56 sixthai +!F7 U+0E57 seventhai +!F8 U+0E58 eightthai +!F9 U+0E59 ninethai +!FA U+0E5A angkhankhuthai +!FB U+0E5B khomutthai diff --git a/includes/fpdf/font/makefont/iso-8859-15.map b/includes/fpdf/font/makefont/iso-8859-15.map new file mode 100755 index 00000000..6c2b5712 --- /dev/null +++ b/includes/fpdf/font/makefont/iso-8859-15.map @@ -0,0 +1,256 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+0080 .notdef +!81 U+0081 .notdef +!82 U+0082 .notdef +!83 U+0083 .notdef +!84 U+0084 .notdef +!85 U+0085 .notdef +!86 U+0086 .notdef +!87 U+0087 .notdef +!88 U+0088 .notdef +!89 U+0089 .notdef +!8A U+008A .notdef +!8B U+008B .notdef +!8C U+008C .notdef +!8D U+008D .notdef +!8E U+008E .notdef +!8F U+008F .notdef +!90 U+0090 .notdef +!91 U+0091 .notdef +!92 U+0092 .notdef +!93 U+0093 .notdef +!94 U+0094 .notdef +!95 U+0095 .notdef +!96 U+0096 .notdef +!97 U+0097 .notdef +!98 U+0098 .notdef +!99 U+0099 .notdef +!9A U+009A .notdef +!9B U+009B .notdef +!9C U+009C .notdef +!9D U+009D .notdef +!9E U+009E .notdef +!9F U+009F .notdef +!A0 U+00A0 space +!A1 U+00A1 exclamdown +!A2 U+00A2 cent +!A3 U+00A3 sterling +!A4 U+20AC Euro +!A5 U+00A5 yen +!A6 U+0160 Scaron +!A7 U+00A7 section +!A8 U+0161 scaron +!A9 U+00A9 copyright +!AA U+00AA ordfeminine +!AB U+00AB guillemotleft +!AC U+00AC logicalnot +!AD U+00AD hyphen +!AE U+00AE registered +!AF U+00AF macron +!B0 U+00B0 degree +!B1 U+00B1 plusminus +!B2 U+00B2 twosuperior +!B3 U+00B3 threesuperior +!B4 U+017D Zcaron +!B5 U+00B5 mu +!B6 U+00B6 paragraph +!B7 U+00B7 periodcentered +!B8 U+017E zcaron +!B9 U+00B9 onesuperior +!BA U+00BA ordmasculine +!BB U+00BB guillemotright +!BC U+0152 OE +!BD U+0153 oe +!BE U+0178 Ydieresis +!BF U+00BF questiondown +!C0 U+00C0 Agrave +!C1 U+00C1 Aacute +!C2 U+00C2 Acircumflex +!C3 U+00C3 Atilde +!C4 U+00C4 Adieresis +!C5 U+00C5 Aring +!C6 U+00C6 AE +!C7 U+00C7 Ccedilla +!C8 U+00C8 Egrave +!C9 U+00C9 Eacute +!CA U+00CA Ecircumflex +!CB U+00CB Edieresis +!CC U+00CC Igrave +!CD U+00CD Iacute +!CE U+00CE Icircumflex +!CF U+00CF Idieresis +!D0 U+00D0 Eth +!D1 U+00D1 Ntilde +!D2 U+00D2 Ograve +!D3 U+00D3 Oacute +!D4 U+00D4 Ocircumflex +!D5 U+00D5 Otilde +!D6 U+00D6 Odieresis +!D7 U+00D7 multiply +!D8 U+00D8 Oslash +!D9 U+00D9 Ugrave +!DA U+00DA Uacute +!DB U+00DB Ucircumflex +!DC U+00DC Udieresis +!DD U+00DD Yacute +!DE U+00DE Thorn +!DF U+00DF germandbls +!E0 U+00E0 agrave +!E1 U+00E1 aacute +!E2 U+00E2 acircumflex +!E3 U+00E3 atilde +!E4 U+00E4 adieresis +!E5 U+00E5 aring +!E6 U+00E6 ae +!E7 U+00E7 ccedilla +!E8 U+00E8 egrave +!E9 U+00E9 eacute +!EA U+00EA ecircumflex +!EB U+00EB edieresis +!EC U+00EC igrave +!ED U+00ED iacute +!EE U+00EE icircumflex +!EF U+00EF idieresis +!F0 U+00F0 eth +!F1 U+00F1 ntilde +!F2 U+00F2 ograve +!F3 U+00F3 oacute +!F4 U+00F4 ocircumflex +!F5 U+00F5 otilde +!F6 U+00F6 odieresis +!F7 U+00F7 divide +!F8 U+00F8 oslash +!F9 U+00F9 ugrave +!FA U+00FA uacute +!FB U+00FB ucircumflex +!FC U+00FC udieresis +!FD U+00FD yacute +!FE U+00FE thorn +!FF U+00FF ydieresis diff --git a/includes/fpdf/font/makefont/iso-8859-16.map b/includes/fpdf/font/makefont/iso-8859-16.map new file mode 100755 index 00000000..202c8fe5 --- /dev/null +++ b/includes/fpdf/font/makefont/iso-8859-16.map @@ -0,0 +1,256 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+0080 .notdef +!81 U+0081 .notdef +!82 U+0082 .notdef +!83 U+0083 .notdef +!84 U+0084 .notdef +!85 U+0085 .notdef +!86 U+0086 .notdef +!87 U+0087 .notdef +!88 U+0088 .notdef +!89 U+0089 .notdef +!8A U+008A .notdef +!8B U+008B .notdef +!8C U+008C .notdef +!8D U+008D .notdef +!8E U+008E .notdef +!8F U+008F .notdef +!90 U+0090 .notdef +!91 U+0091 .notdef +!92 U+0092 .notdef +!93 U+0093 .notdef +!94 U+0094 .notdef +!95 U+0095 .notdef +!96 U+0096 .notdef +!97 U+0097 .notdef +!98 U+0098 .notdef +!99 U+0099 .notdef +!9A U+009A .notdef +!9B U+009B .notdef +!9C U+009C .notdef +!9D U+009D .notdef +!9E U+009E .notdef +!9F U+009F .notdef +!A0 U+00A0 space +!A1 U+0104 Aogonek +!A2 U+0105 aogonek +!A3 U+0141 Lslash +!A4 U+20AC Euro +!A5 U+201E quotedblbase +!A6 U+0160 Scaron +!A7 U+00A7 section +!A8 U+0161 scaron +!A9 U+00A9 copyright +!AA U+0218 Scommaaccent +!AB U+00AB guillemotleft +!AC U+0179 Zacute +!AD U+00AD hyphen +!AE U+017A zacute +!AF U+017B Zdotaccent +!B0 U+00B0 degree +!B1 U+00B1 plusminus +!B2 U+010C Ccaron +!B3 U+0142 lslash +!B4 U+017D Zcaron +!B5 U+201D quotedblright +!B6 U+00B6 paragraph +!B7 U+00B7 periodcentered +!B8 U+017E zcaron +!B9 U+010D ccaron +!BA U+0219 scommaaccent +!BB U+00BB guillemotright +!BC U+0152 OE +!BD U+0153 oe +!BE U+0178 Ydieresis +!BF U+017C zdotaccent +!C0 U+00C0 Agrave +!C1 U+00C1 Aacute +!C2 U+00C2 Acircumflex +!C3 U+0102 Abreve +!C4 U+00C4 Adieresis +!C5 U+0106 Cacute +!C6 U+00C6 AE +!C7 U+00C7 Ccedilla +!C8 U+00C8 Egrave +!C9 U+00C9 Eacute +!CA U+00CA Ecircumflex +!CB U+00CB Edieresis +!CC U+00CC Igrave +!CD U+00CD Iacute +!CE U+00CE Icircumflex +!CF U+00CF Idieresis +!D0 U+0110 Dcroat +!D1 U+0143 Nacute +!D2 U+00D2 Ograve +!D3 U+00D3 Oacute +!D4 U+00D4 Ocircumflex +!D5 U+0150 Ohungarumlaut +!D6 U+00D6 Odieresis +!D7 U+015A Sacute +!D8 U+0170 Uhungarumlaut +!D9 U+00D9 Ugrave +!DA U+00DA Uacute +!DB U+00DB Ucircumflex +!DC U+00DC Udieresis +!DD U+0118 Eogonek +!DE U+021A Tcommaaccent +!DF U+00DF germandbls +!E0 U+00E0 agrave +!E1 U+00E1 aacute +!E2 U+00E2 acircumflex +!E3 U+0103 abreve +!E4 U+00E4 adieresis +!E5 U+0107 cacute +!E6 U+00E6 ae +!E7 U+00E7 ccedilla +!E8 U+00E8 egrave +!E9 U+00E9 eacute +!EA U+00EA ecircumflex +!EB U+00EB edieresis +!EC U+00EC igrave +!ED U+00ED iacute +!EE U+00EE icircumflex +!EF U+00EF idieresis +!F0 U+0111 dcroat +!F1 U+0144 nacute +!F2 U+00F2 ograve +!F3 U+00F3 oacute +!F4 U+00F4 ocircumflex +!F5 U+0151 ohungarumlaut +!F6 U+00F6 odieresis +!F7 U+015B sacute +!F8 U+0171 uhungarumlaut +!F9 U+00F9 ugrave +!FA U+00FA uacute +!FB U+00FB ucircumflex +!FC U+00FC udieresis +!FD U+0119 eogonek +!FE U+021B tcommaaccent +!FF U+00FF ydieresis diff --git a/includes/fpdf/font/makefont/iso-8859-2.map b/includes/fpdf/font/makefont/iso-8859-2.map new file mode 100755 index 00000000..65ae09f9 --- /dev/null +++ b/includes/fpdf/font/makefont/iso-8859-2.map @@ -0,0 +1,256 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+0080 .notdef +!81 U+0081 .notdef +!82 U+0082 .notdef +!83 U+0083 .notdef +!84 U+0084 .notdef +!85 U+0085 .notdef +!86 U+0086 .notdef +!87 U+0087 .notdef +!88 U+0088 .notdef +!89 U+0089 .notdef +!8A U+008A .notdef +!8B U+008B .notdef +!8C U+008C .notdef +!8D U+008D .notdef +!8E U+008E .notdef +!8F U+008F .notdef +!90 U+0090 .notdef +!91 U+0091 .notdef +!92 U+0092 .notdef +!93 U+0093 .notdef +!94 U+0094 .notdef +!95 U+0095 .notdef +!96 U+0096 .notdef +!97 U+0097 .notdef +!98 U+0098 .notdef +!99 U+0099 .notdef +!9A U+009A .notdef +!9B U+009B .notdef +!9C U+009C .notdef +!9D U+009D .notdef +!9E U+009E .notdef +!9F U+009F .notdef +!A0 U+00A0 space +!A1 U+0104 Aogonek +!A2 U+02D8 breve +!A3 U+0141 Lslash +!A4 U+00A4 currency +!A5 U+013D Lcaron +!A6 U+015A Sacute +!A7 U+00A7 section +!A8 U+00A8 dieresis +!A9 U+0160 Scaron +!AA U+015E Scedilla +!AB U+0164 Tcaron +!AC U+0179 Zacute +!AD U+00AD hyphen +!AE U+017D Zcaron +!AF U+017B Zdotaccent +!B0 U+00B0 degree +!B1 U+0105 aogonek +!B2 U+02DB ogonek +!B3 U+0142 lslash +!B4 U+00B4 acute +!B5 U+013E lcaron +!B6 U+015B sacute +!B7 U+02C7 caron +!B8 U+00B8 cedilla +!B9 U+0161 scaron +!BA U+015F scedilla +!BB U+0165 tcaron +!BC U+017A zacute +!BD U+02DD hungarumlaut +!BE U+017E zcaron +!BF U+017C zdotaccent +!C0 U+0154 Racute +!C1 U+00C1 Aacute +!C2 U+00C2 Acircumflex +!C3 U+0102 Abreve +!C4 U+00C4 Adieresis +!C5 U+0139 Lacute +!C6 U+0106 Cacute +!C7 U+00C7 Ccedilla +!C8 U+010C Ccaron +!C9 U+00C9 Eacute +!CA U+0118 Eogonek +!CB U+00CB Edieresis +!CC U+011A Ecaron +!CD U+00CD Iacute +!CE U+00CE Icircumflex +!CF U+010E Dcaron +!D0 U+0110 Dcroat +!D1 U+0143 Nacute +!D2 U+0147 Ncaron +!D3 U+00D3 Oacute +!D4 U+00D4 Ocircumflex +!D5 U+0150 Ohungarumlaut +!D6 U+00D6 Odieresis +!D7 U+00D7 multiply +!D8 U+0158 Rcaron +!D9 U+016E Uring +!DA U+00DA Uacute +!DB U+0170 Uhungarumlaut +!DC U+00DC Udieresis +!DD U+00DD Yacute +!DE U+0162 Tcommaaccent +!DF U+00DF germandbls +!E0 U+0155 racute +!E1 U+00E1 aacute +!E2 U+00E2 acircumflex +!E3 U+0103 abreve +!E4 U+00E4 adieresis +!E5 U+013A lacute +!E6 U+0107 cacute +!E7 U+00E7 ccedilla +!E8 U+010D ccaron +!E9 U+00E9 eacute +!EA U+0119 eogonek +!EB U+00EB edieresis +!EC U+011B ecaron +!ED U+00ED iacute +!EE U+00EE icircumflex +!EF U+010F dcaron +!F0 U+0111 dcroat +!F1 U+0144 nacute +!F2 U+0148 ncaron +!F3 U+00F3 oacute +!F4 U+00F4 ocircumflex +!F5 U+0151 ohungarumlaut +!F6 U+00F6 odieresis +!F7 U+00F7 divide +!F8 U+0159 rcaron +!F9 U+016F uring +!FA U+00FA uacute +!FB U+0171 uhungarumlaut +!FC U+00FC udieresis +!FD U+00FD yacute +!FE U+0163 tcommaaccent +!FF U+02D9 dotaccent diff --git a/includes/fpdf/font/makefont/iso-8859-4.map b/includes/fpdf/font/makefont/iso-8859-4.map new file mode 100755 index 00000000..a7d87bf3 --- /dev/null +++ b/includes/fpdf/font/makefont/iso-8859-4.map @@ -0,0 +1,256 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+0080 .notdef +!81 U+0081 .notdef +!82 U+0082 .notdef +!83 U+0083 .notdef +!84 U+0084 .notdef +!85 U+0085 .notdef +!86 U+0086 .notdef +!87 U+0087 .notdef +!88 U+0088 .notdef +!89 U+0089 .notdef +!8A U+008A .notdef +!8B U+008B .notdef +!8C U+008C .notdef +!8D U+008D .notdef +!8E U+008E .notdef +!8F U+008F .notdef +!90 U+0090 .notdef +!91 U+0091 .notdef +!92 U+0092 .notdef +!93 U+0093 .notdef +!94 U+0094 .notdef +!95 U+0095 .notdef +!96 U+0096 .notdef +!97 U+0097 .notdef +!98 U+0098 .notdef +!99 U+0099 .notdef +!9A U+009A .notdef +!9B U+009B .notdef +!9C U+009C .notdef +!9D U+009D .notdef +!9E U+009E .notdef +!9F U+009F .notdef +!A0 U+00A0 space +!A1 U+0104 Aogonek +!A2 U+0138 kgreenlandic +!A3 U+0156 Rcommaaccent +!A4 U+00A4 currency +!A5 U+0128 Itilde +!A6 U+013B Lcommaaccent +!A7 U+00A7 section +!A8 U+00A8 dieresis +!A9 U+0160 Scaron +!AA U+0112 Emacron +!AB U+0122 Gcommaaccent +!AC U+0166 Tbar +!AD U+00AD hyphen +!AE U+017D Zcaron +!AF U+00AF macron +!B0 U+00B0 degree +!B1 U+0105 aogonek +!B2 U+02DB ogonek +!B3 U+0157 rcommaaccent +!B4 U+00B4 acute +!B5 U+0129 itilde +!B6 U+013C lcommaaccent +!B7 U+02C7 caron +!B8 U+00B8 cedilla +!B9 U+0161 scaron +!BA U+0113 emacron +!BB U+0123 gcommaaccent +!BC U+0167 tbar +!BD U+014A Eng +!BE U+017E zcaron +!BF U+014B eng +!C0 U+0100 Amacron +!C1 U+00C1 Aacute +!C2 U+00C2 Acircumflex +!C3 U+00C3 Atilde +!C4 U+00C4 Adieresis +!C5 U+00C5 Aring +!C6 U+00C6 AE +!C7 U+012E Iogonek +!C8 U+010C Ccaron +!C9 U+00C9 Eacute +!CA U+0118 Eogonek +!CB U+00CB Edieresis +!CC U+0116 Edotaccent +!CD U+00CD Iacute +!CE U+00CE Icircumflex +!CF U+012A Imacron +!D0 U+0110 Dcroat +!D1 U+0145 Ncommaaccent +!D2 U+014C Omacron +!D3 U+0136 Kcommaaccent +!D4 U+00D4 Ocircumflex +!D5 U+00D5 Otilde +!D6 U+00D6 Odieresis +!D7 U+00D7 multiply +!D8 U+00D8 Oslash +!D9 U+0172 Uogonek +!DA U+00DA Uacute +!DB U+00DB Ucircumflex +!DC U+00DC Udieresis +!DD U+0168 Utilde +!DE U+016A Umacron +!DF U+00DF germandbls +!E0 U+0101 amacron +!E1 U+00E1 aacute +!E2 U+00E2 acircumflex +!E3 U+00E3 atilde +!E4 U+00E4 adieresis +!E5 U+00E5 aring +!E6 U+00E6 ae +!E7 U+012F iogonek +!E8 U+010D ccaron +!E9 U+00E9 eacute +!EA U+0119 eogonek +!EB U+00EB edieresis +!EC U+0117 edotaccent +!ED U+00ED iacute +!EE U+00EE icircumflex +!EF U+012B imacron +!F0 U+0111 dcroat +!F1 U+0146 ncommaaccent +!F2 U+014D omacron +!F3 U+0137 kcommaaccent +!F4 U+00F4 ocircumflex +!F5 U+00F5 otilde +!F6 U+00F6 odieresis +!F7 U+00F7 divide +!F8 U+00F8 oslash +!F9 U+0173 uogonek +!FA U+00FA uacute +!FB U+00FB ucircumflex +!FC U+00FC udieresis +!FD U+0169 utilde +!FE U+016B umacron +!FF U+02D9 dotaccent diff --git a/includes/fpdf/font/makefont/iso-8859-5.map b/includes/fpdf/font/makefont/iso-8859-5.map new file mode 100755 index 00000000..f9cd4edc --- /dev/null +++ b/includes/fpdf/font/makefont/iso-8859-5.map @@ -0,0 +1,256 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+0080 .notdef +!81 U+0081 .notdef +!82 U+0082 .notdef +!83 U+0083 .notdef +!84 U+0084 .notdef +!85 U+0085 .notdef +!86 U+0086 .notdef +!87 U+0087 .notdef +!88 U+0088 .notdef +!89 U+0089 .notdef +!8A U+008A .notdef +!8B U+008B .notdef +!8C U+008C .notdef +!8D U+008D .notdef +!8E U+008E .notdef +!8F U+008F .notdef +!90 U+0090 .notdef +!91 U+0091 .notdef +!92 U+0092 .notdef +!93 U+0093 .notdef +!94 U+0094 .notdef +!95 U+0095 .notdef +!96 U+0096 .notdef +!97 U+0097 .notdef +!98 U+0098 .notdef +!99 U+0099 .notdef +!9A U+009A .notdef +!9B U+009B .notdef +!9C U+009C .notdef +!9D U+009D .notdef +!9E U+009E .notdef +!9F U+009F .notdef +!A0 U+00A0 space +!A1 U+0401 afii10023 +!A2 U+0402 afii10051 +!A3 U+0403 afii10052 +!A4 U+0404 afii10053 +!A5 U+0405 afii10054 +!A6 U+0406 afii10055 +!A7 U+0407 afii10056 +!A8 U+0408 afii10057 +!A9 U+0409 afii10058 +!AA U+040A afii10059 +!AB U+040B afii10060 +!AC U+040C afii10061 +!AD U+00AD hyphen +!AE U+040E afii10062 +!AF U+040F afii10145 +!B0 U+0410 afii10017 +!B1 U+0411 afii10018 +!B2 U+0412 afii10019 +!B3 U+0413 afii10020 +!B4 U+0414 afii10021 +!B5 U+0415 afii10022 +!B6 U+0416 afii10024 +!B7 U+0417 afii10025 +!B8 U+0418 afii10026 +!B9 U+0419 afii10027 +!BA U+041A afii10028 +!BB U+041B afii10029 +!BC U+041C afii10030 +!BD U+041D afii10031 +!BE U+041E afii10032 +!BF U+041F afii10033 +!C0 U+0420 afii10034 +!C1 U+0421 afii10035 +!C2 U+0422 afii10036 +!C3 U+0423 afii10037 +!C4 U+0424 afii10038 +!C5 U+0425 afii10039 +!C6 U+0426 afii10040 +!C7 U+0427 afii10041 +!C8 U+0428 afii10042 +!C9 U+0429 afii10043 +!CA U+042A afii10044 +!CB U+042B afii10045 +!CC U+042C afii10046 +!CD U+042D afii10047 +!CE U+042E afii10048 +!CF U+042F afii10049 +!D0 U+0430 afii10065 +!D1 U+0431 afii10066 +!D2 U+0432 afii10067 +!D3 U+0433 afii10068 +!D4 U+0434 afii10069 +!D5 U+0435 afii10070 +!D6 U+0436 afii10072 +!D7 U+0437 afii10073 +!D8 U+0438 afii10074 +!D9 U+0439 afii10075 +!DA U+043A afii10076 +!DB U+043B afii10077 +!DC U+043C afii10078 +!DD U+043D afii10079 +!DE U+043E afii10080 +!DF U+043F afii10081 +!E0 U+0440 afii10082 +!E1 U+0441 afii10083 +!E2 U+0442 afii10084 +!E3 U+0443 afii10085 +!E4 U+0444 afii10086 +!E5 U+0445 afii10087 +!E6 U+0446 afii10088 +!E7 U+0447 afii10089 +!E8 U+0448 afii10090 +!E9 U+0449 afii10091 +!EA U+044A afii10092 +!EB U+044B afii10093 +!EC U+044C afii10094 +!ED U+044D afii10095 +!EE U+044E afii10096 +!EF U+044F afii10097 +!F0 U+2116 afii61352 +!F1 U+0451 afii10071 +!F2 U+0452 afii10099 +!F3 U+0453 afii10100 +!F4 U+0454 afii10101 +!F5 U+0455 afii10102 +!F6 U+0456 afii10103 +!F7 U+0457 afii10104 +!F8 U+0458 afii10105 +!F9 U+0459 afii10106 +!FA U+045A afii10107 +!FB U+045B afii10108 +!FC U+045C afii10109 +!FD U+00A7 section +!FE U+045E afii10110 +!FF U+045F afii10193 diff --git a/includes/fpdf/font/makefont/iso-8859-7.map b/includes/fpdf/font/makefont/iso-8859-7.map new file mode 100755 index 00000000..e163796b --- /dev/null +++ b/includes/fpdf/font/makefont/iso-8859-7.map @@ -0,0 +1,250 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+0080 .notdef +!81 U+0081 .notdef +!82 U+0082 .notdef +!83 U+0083 .notdef +!84 U+0084 .notdef +!85 U+0085 .notdef +!86 U+0086 .notdef +!87 U+0087 .notdef +!88 U+0088 .notdef +!89 U+0089 .notdef +!8A U+008A .notdef +!8B U+008B .notdef +!8C U+008C .notdef +!8D U+008D .notdef +!8E U+008E .notdef +!8F U+008F .notdef +!90 U+0090 .notdef +!91 U+0091 .notdef +!92 U+0092 .notdef +!93 U+0093 .notdef +!94 U+0094 .notdef +!95 U+0095 .notdef +!96 U+0096 .notdef +!97 U+0097 .notdef +!98 U+0098 .notdef +!99 U+0099 .notdef +!9A U+009A .notdef +!9B U+009B .notdef +!9C U+009C .notdef +!9D U+009D .notdef +!9E U+009E .notdef +!9F U+009F .notdef +!A0 U+00A0 space +!A1 U+2018 quoteleft +!A2 U+2019 quoteright +!A3 U+00A3 sterling +!A6 U+00A6 brokenbar +!A7 U+00A7 section +!A8 U+00A8 dieresis +!A9 U+00A9 copyright +!AB U+00AB guillemotleft +!AC U+00AC logicalnot +!AD U+00AD hyphen +!AF U+2015 afii00208 +!B0 U+00B0 degree +!B1 U+00B1 plusminus +!B2 U+00B2 twosuperior +!B3 U+00B3 threesuperior +!B4 U+0384 tonos +!B5 U+0385 dieresistonos +!B6 U+0386 Alphatonos +!B7 U+00B7 periodcentered +!B8 U+0388 Epsilontonos +!B9 U+0389 Etatonos +!BA U+038A Iotatonos +!BB U+00BB guillemotright +!BC U+038C Omicrontonos +!BD U+00BD onehalf +!BE U+038E Upsilontonos +!BF U+038F Omegatonos +!C0 U+0390 iotadieresistonos +!C1 U+0391 Alpha +!C2 U+0392 Beta +!C3 U+0393 Gamma +!C4 U+0394 Delta +!C5 U+0395 Epsilon +!C6 U+0396 Zeta +!C7 U+0397 Eta +!C8 U+0398 Theta +!C9 U+0399 Iota +!CA U+039A Kappa +!CB U+039B Lambda +!CC U+039C Mu +!CD U+039D Nu +!CE U+039E Xi +!CF U+039F Omicron +!D0 U+03A0 Pi +!D1 U+03A1 Rho +!D3 U+03A3 Sigma +!D4 U+03A4 Tau +!D5 U+03A5 Upsilon +!D6 U+03A6 Phi +!D7 U+03A7 Chi +!D8 U+03A8 Psi +!D9 U+03A9 Omega +!DA U+03AA Iotadieresis +!DB U+03AB Upsilondieresis +!DC U+03AC alphatonos +!DD U+03AD epsilontonos +!DE U+03AE etatonos +!DF U+03AF iotatonos +!E0 U+03B0 upsilondieresistonos +!E1 U+03B1 alpha +!E2 U+03B2 beta +!E3 U+03B3 gamma +!E4 U+03B4 delta +!E5 U+03B5 epsilon +!E6 U+03B6 zeta +!E7 U+03B7 eta +!E8 U+03B8 theta +!E9 U+03B9 iota +!EA U+03BA kappa +!EB U+03BB lambda +!EC U+03BC mu +!ED U+03BD nu +!EE U+03BE xi +!EF U+03BF omicron +!F0 U+03C0 pi +!F1 U+03C1 rho +!F2 U+03C2 sigma1 +!F3 U+03C3 sigma +!F4 U+03C4 tau +!F5 U+03C5 upsilon +!F6 U+03C6 phi +!F7 U+03C7 chi +!F8 U+03C8 psi +!F9 U+03C9 omega +!FA U+03CA iotadieresis +!FB U+03CB upsilondieresis +!FC U+03CC omicrontonos +!FD U+03CD upsilontonos +!FE U+03CE omegatonos diff --git a/includes/fpdf/font/makefont/iso-8859-9.map b/includes/fpdf/font/makefont/iso-8859-9.map new file mode 100755 index 00000000..48c123ae --- /dev/null +++ b/includes/fpdf/font/makefont/iso-8859-9.map @@ -0,0 +1,256 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+0080 .notdef +!81 U+0081 .notdef +!82 U+0082 .notdef +!83 U+0083 .notdef +!84 U+0084 .notdef +!85 U+0085 .notdef +!86 U+0086 .notdef +!87 U+0087 .notdef +!88 U+0088 .notdef +!89 U+0089 .notdef +!8A U+008A .notdef +!8B U+008B .notdef +!8C U+008C .notdef +!8D U+008D .notdef +!8E U+008E .notdef +!8F U+008F .notdef +!90 U+0090 .notdef +!91 U+0091 .notdef +!92 U+0092 .notdef +!93 U+0093 .notdef +!94 U+0094 .notdef +!95 U+0095 .notdef +!96 U+0096 .notdef +!97 U+0097 .notdef +!98 U+0098 .notdef +!99 U+0099 .notdef +!9A U+009A .notdef +!9B U+009B .notdef +!9C U+009C .notdef +!9D U+009D .notdef +!9E U+009E .notdef +!9F U+009F .notdef +!A0 U+00A0 space +!A1 U+00A1 exclamdown +!A2 U+00A2 cent +!A3 U+00A3 sterling +!A4 U+00A4 currency +!A5 U+00A5 yen +!A6 U+00A6 brokenbar +!A7 U+00A7 section +!A8 U+00A8 dieresis +!A9 U+00A9 copyright +!AA U+00AA ordfeminine +!AB U+00AB guillemotleft +!AC U+00AC logicalnot +!AD U+00AD hyphen +!AE U+00AE registered +!AF U+00AF macron +!B0 U+00B0 degree +!B1 U+00B1 plusminus +!B2 U+00B2 twosuperior +!B3 U+00B3 threesuperior +!B4 U+00B4 acute +!B5 U+00B5 mu +!B6 U+00B6 paragraph +!B7 U+00B7 periodcentered +!B8 U+00B8 cedilla +!B9 U+00B9 onesuperior +!BA U+00BA ordmasculine +!BB U+00BB guillemotright +!BC U+00BC onequarter +!BD U+00BD onehalf +!BE U+00BE threequarters +!BF U+00BF questiondown +!C0 U+00C0 Agrave +!C1 U+00C1 Aacute +!C2 U+00C2 Acircumflex +!C3 U+00C3 Atilde +!C4 U+00C4 Adieresis +!C5 U+00C5 Aring +!C6 U+00C6 AE +!C7 U+00C7 Ccedilla +!C8 U+00C8 Egrave +!C9 U+00C9 Eacute +!CA U+00CA Ecircumflex +!CB U+00CB Edieresis +!CC U+00CC Igrave +!CD U+00CD Iacute +!CE U+00CE Icircumflex +!CF U+00CF Idieresis +!D0 U+011E Gbreve +!D1 U+00D1 Ntilde +!D2 U+00D2 Ograve +!D3 U+00D3 Oacute +!D4 U+00D4 Ocircumflex +!D5 U+00D5 Otilde +!D6 U+00D6 Odieresis +!D7 U+00D7 multiply +!D8 U+00D8 Oslash +!D9 U+00D9 Ugrave +!DA U+00DA Uacute +!DB U+00DB Ucircumflex +!DC U+00DC Udieresis +!DD U+0130 Idotaccent +!DE U+015E Scedilla +!DF U+00DF germandbls +!E0 U+00E0 agrave +!E1 U+00E1 aacute +!E2 U+00E2 acircumflex +!E3 U+00E3 atilde +!E4 U+00E4 adieresis +!E5 U+00E5 aring +!E6 U+00E6 ae +!E7 U+00E7 ccedilla +!E8 U+00E8 egrave +!E9 U+00E9 eacute +!EA U+00EA ecircumflex +!EB U+00EB edieresis +!EC U+00EC igrave +!ED U+00ED iacute +!EE U+00EE icircumflex +!EF U+00EF idieresis +!F0 U+011F gbreve +!F1 U+00F1 ntilde +!F2 U+00F2 ograve +!F3 U+00F3 oacute +!F4 U+00F4 ocircumflex +!F5 U+00F5 otilde +!F6 U+00F6 odieresis +!F7 U+00F7 divide +!F8 U+00F8 oslash +!F9 U+00F9 ugrave +!FA U+00FA uacute +!FB U+00FB ucircumflex +!FC U+00FC udieresis +!FD U+0131 dotlessi +!FE U+015F scedilla +!FF U+00FF ydieresis diff --git a/includes/fpdf/font/makefont/koi8-r.map b/includes/fpdf/font/makefont/koi8-r.map new file mode 100755 index 00000000..6ad5d05d --- /dev/null +++ b/includes/fpdf/font/makefont/koi8-r.map @@ -0,0 +1,256 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+2500 SF100000 +!81 U+2502 SF110000 +!82 U+250C SF010000 +!83 U+2510 SF030000 +!84 U+2514 SF020000 +!85 U+2518 SF040000 +!86 U+251C SF080000 +!87 U+2524 SF090000 +!88 U+252C SF060000 +!89 U+2534 SF070000 +!8A U+253C SF050000 +!8B U+2580 upblock +!8C U+2584 dnblock +!8D U+2588 block +!8E U+258C lfblock +!8F U+2590 rtblock +!90 U+2591 ltshade +!91 U+2592 shade +!92 U+2593 dkshade +!93 U+2320 integraltp +!94 U+25A0 filledbox +!95 U+2219 periodcentered +!96 U+221A radical +!97 U+2248 approxequal +!98 U+2264 lessequal +!99 U+2265 greaterequal +!9A U+00A0 space +!9B U+2321 integralbt +!9C U+00B0 degree +!9D U+00B2 twosuperior +!9E U+00B7 periodcentered +!9F U+00F7 divide +!A0 U+2550 SF430000 +!A1 U+2551 SF240000 +!A2 U+2552 SF510000 +!A3 U+0451 afii10071 +!A4 U+2553 SF520000 +!A5 U+2554 SF390000 +!A6 U+2555 SF220000 +!A7 U+2556 SF210000 +!A8 U+2557 SF250000 +!A9 U+2558 SF500000 +!AA U+2559 SF490000 +!AB U+255A SF380000 +!AC U+255B SF280000 +!AD U+255C SF270000 +!AE U+255D SF260000 +!AF U+255E SF360000 +!B0 U+255F SF370000 +!B1 U+2560 SF420000 +!B2 U+2561 SF190000 +!B3 U+0401 afii10023 +!B4 U+2562 SF200000 +!B5 U+2563 SF230000 +!B6 U+2564 SF470000 +!B7 U+2565 SF480000 +!B8 U+2566 SF410000 +!B9 U+2567 SF450000 +!BA U+2568 SF460000 +!BB U+2569 SF400000 +!BC U+256A SF540000 +!BD U+256B SF530000 +!BE U+256C SF440000 +!BF U+00A9 copyright +!C0 U+044E afii10096 +!C1 U+0430 afii10065 +!C2 U+0431 afii10066 +!C3 U+0446 afii10088 +!C4 U+0434 afii10069 +!C5 U+0435 afii10070 +!C6 U+0444 afii10086 +!C7 U+0433 afii10068 +!C8 U+0445 afii10087 +!C9 U+0438 afii10074 +!CA U+0439 afii10075 +!CB U+043A afii10076 +!CC U+043B afii10077 +!CD U+043C afii10078 +!CE U+043D afii10079 +!CF U+043E afii10080 +!D0 U+043F afii10081 +!D1 U+044F afii10097 +!D2 U+0440 afii10082 +!D3 U+0441 afii10083 +!D4 U+0442 afii10084 +!D5 U+0443 afii10085 +!D6 U+0436 afii10072 +!D7 U+0432 afii10067 +!D8 U+044C afii10094 +!D9 U+044B afii10093 +!DA U+0437 afii10073 +!DB U+0448 afii10090 +!DC U+044D afii10095 +!DD U+0449 afii10091 +!DE U+0447 afii10089 +!DF U+044A afii10092 +!E0 U+042E afii10048 +!E1 U+0410 afii10017 +!E2 U+0411 afii10018 +!E3 U+0426 afii10040 +!E4 U+0414 afii10021 +!E5 U+0415 afii10022 +!E6 U+0424 afii10038 +!E7 U+0413 afii10020 +!E8 U+0425 afii10039 +!E9 U+0418 afii10026 +!EA U+0419 afii10027 +!EB U+041A afii10028 +!EC U+041B afii10029 +!ED U+041C afii10030 +!EE U+041D afii10031 +!EF U+041E afii10032 +!F0 U+041F afii10033 +!F1 U+042F afii10049 +!F2 U+0420 afii10034 +!F3 U+0421 afii10035 +!F4 U+0422 afii10036 +!F5 U+0423 afii10037 +!F6 U+0416 afii10024 +!F7 U+0412 afii10019 +!F8 U+042C afii10046 +!F9 U+042B afii10045 +!FA U+0417 afii10025 +!FB U+0428 afii10042 +!FC U+042D afii10047 +!FD U+0429 afii10043 +!FE U+0427 afii10041 +!FF U+042A afii10044 diff --git a/includes/fpdf/font/makefont/koi8-u.map b/includes/fpdf/font/makefont/koi8-u.map new file mode 100755 index 00000000..40a7e4fd --- /dev/null +++ b/includes/fpdf/font/makefont/koi8-u.map @@ -0,0 +1,256 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+2500 SF100000 +!81 U+2502 SF110000 +!82 U+250C SF010000 +!83 U+2510 SF030000 +!84 U+2514 SF020000 +!85 U+2518 SF040000 +!86 U+251C SF080000 +!87 U+2524 SF090000 +!88 U+252C SF060000 +!89 U+2534 SF070000 +!8A U+253C SF050000 +!8B U+2580 upblock +!8C U+2584 dnblock +!8D U+2588 block +!8E U+258C lfblock +!8F U+2590 rtblock +!90 U+2591 ltshade +!91 U+2592 shade +!92 U+2593 dkshade +!93 U+2320 integraltp +!94 U+25A0 filledbox +!95 U+2022 bullet +!96 U+221A radical +!97 U+2248 approxequal +!98 U+2264 lessequal +!99 U+2265 greaterequal +!9A U+00A0 space +!9B U+2321 integralbt +!9C U+00B0 degree +!9D U+00B2 twosuperior +!9E U+00B7 periodcentered +!9F U+00F7 divide +!A0 U+2550 SF430000 +!A1 U+2551 SF240000 +!A2 U+2552 SF510000 +!A3 U+0451 afii10071 +!A4 U+0454 afii10101 +!A5 U+2554 SF390000 +!A6 U+0456 afii10103 +!A7 U+0457 afii10104 +!A8 U+2557 SF250000 +!A9 U+2558 SF500000 +!AA U+2559 SF490000 +!AB U+255A SF380000 +!AC U+255B SF280000 +!AD U+0491 afii10098 +!AE U+255D SF260000 +!AF U+255E SF360000 +!B0 U+255F SF370000 +!B1 U+2560 SF420000 +!B2 U+2561 SF190000 +!B3 U+0401 afii10023 +!B4 U+0404 afii10053 +!B5 U+2563 SF230000 +!B6 U+0406 afii10055 +!B7 U+0407 afii10056 +!B8 U+2566 SF410000 +!B9 U+2567 SF450000 +!BA U+2568 SF460000 +!BB U+2569 SF400000 +!BC U+256A SF540000 +!BD U+0490 afii10050 +!BE U+256C SF440000 +!BF U+00A9 copyright +!C0 U+044E afii10096 +!C1 U+0430 afii10065 +!C2 U+0431 afii10066 +!C3 U+0446 afii10088 +!C4 U+0434 afii10069 +!C5 U+0435 afii10070 +!C6 U+0444 afii10086 +!C7 U+0433 afii10068 +!C8 U+0445 afii10087 +!C9 U+0438 afii10074 +!CA U+0439 afii10075 +!CB U+043A afii10076 +!CC U+043B afii10077 +!CD U+043C afii10078 +!CE U+043D afii10079 +!CF U+043E afii10080 +!D0 U+043F afii10081 +!D1 U+044F afii10097 +!D2 U+0440 afii10082 +!D3 U+0441 afii10083 +!D4 U+0442 afii10084 +!D5 U+0443 afii10085 +!D6 U+0436 afii10072 +!D7 U+0432 afii10067 +!D8 U+044C afii10094 +!D9 U+044B afii10093 +!DA U+0437 afii10073 +!DB U+0448 afii10090 +!DC U+044D afii10095 +!DD U+0449 afii10091 +!DE U+0447 afii10089 +!DF U+044A afii10092 +!E0 U+042E afii10048 +!E1 U+0410 afii10017 +!E2 U+0411 afii10018 +!E3 U+0426 afii10040 +!E4 U+0414 afii10021 +!E5 U+0415 afii10022 +!E6 U+0424 afii10038 +!E7 U+0413 afii10020 +!E8 U+0425 afii10039 +!E9 U+0418 afii10026 +!EA U+0419 afii10027 +!EB U+041A afii10028 +!EC U+041B afii10029 +!ED U+041C afii10030 +!EE U+041D afii10031 +!EF U+041E afii10032 +!F0 U+041F afii10033 +!F1 U+042F afii10049 +!F2 U+0420 afii10034 +!F3 U+0421 afii10035 +!F4 U+0422 afii10036 +!F5 U+0423 afii10037 +!F6 U+0416 afii10024 +!F7 U+0412 afii10019 +!F8 U+042C afii10046 +!F9 U+042B afii10045 +!FA U+0417 afii10025 +!FB U+0428 afii10042 +!FC U+042D afii10047 +!FD U+0429 afii10043 +!FE U+0427 afii10041 +!FF U+042A afii10044 diff --git a/includes/fpdf/font/makefont/makefont.php b/includes/fpdf/font/makefont/makefont.php new file mode 100755 index 00000000..7e7ed564 --- /dev/null +++ b/includes/fpdf/font/makefont/makefont.php @@ -0,0 +1,419 @@ +Error: encoding not found: '.$enc); + $cc2gn=array(); + foreach($a as $l) + { + if($l[0]=='!') + { + $e=preg_split('/[ \\t]+/',rtrim($l)); + $cc=hexdec(substr($e[0],1)); + $gn=$e[2]; + $cc2gn[$cc]=$gn; + } + } + for($i=0;$i<=255;$i++) + { + if(!isset($cc2gn[$i])) + $cc2gn[$i]='.notdef'; + } + return $cc2gn; +} + +function ReadAFM($file, &$map) +{ + //Read a font metric file + $a=file($file); + if(empty($a)) + die('File not found'); + $widths=array(); + $fm=array(); + $fix=array('Edot'=>'Edotaccent','edot'=>'edotaccent','Idot'=>'Idotaccent','Zdot'=>'Zdotaccent','zdot'=>'zdotaccent', + 'Odblacute'=>'Ohungarumlaut','odblacute'=>'ohungarumlaut','Udblacute'=>'Uhungarumlaut','udblacute'=>'uhungarumlaut', + 'Gcedilla'=>'Gcommaaccent','gcedilla'=>'gcommaaccent','Kcedilla'=>'Kcommaaccent','kcedilla'=>'kcommaaccent', + 'Lcedilla'=>'Lcommaaccent','lcedilla'=>'lcommaaccent','Ncedilla'=>'Ncommaaccent','ncedilla'=>'ncommaaccent', + 'Rcedilla'=>'Rcommaaccent','rcedilla'=>'rcommaaccent','Scedilla'=>'Scommaaccent','scedilla'=>'scommaaccent', + 'Tcedilla'=>'Tcommaaccent','tcedilla'=>'tcommaaccent','Dslash'=>'Dcroat','dslash'=>'dcroat','Dmacron'=>'Dcroat','dmacron'=>'dcroat', + 'combininggraveaccent'=>'gravecomb','combininghookabove'=>'hookabovecomb','combiningtildeaccent'=>'tildecomb', + 'combiningacuteaccent'=>'acutecomb','combiningdotbelow'=>'dotbelowcomb','dongsign'=>'dong'); + foreach($a as $l) + { + $e=explode(' ',rtrim($l)); + if(count($e)<2) + continue; + $code=$e[0]; + $param=$e[1]; + if($code=='C') + { + //Character metrics + $cc=(int)$e[1]; + $w=$e[4]; + $gn=$e[7]; + if(substr($gn,-4)=='20AC') + $gn='Euro'; + if(isset($fix[$gn])) + { + //Fix incorrect glyph name + foreach($map as $c=>$n) + { + if($n==$fix[$gn]) + $map[$c]=$gn; + } + } + if(empty($map)) + { + //Symbolic font: use built-in encoding + $widths[$cc]=$w; + } + else + { + $widths[$gn]=$w; + if($gn=='X') + $fm['CapXHeight']=$e[13]; + } + if($gn=='.notdef') + $fm['MissingWidth']=$w; + } + elseif($code=='FontName') + $fm['FontName']=$param; + elseif($code=='Weight') + $fm['Weight']=$param; + elseif($code=='ItalicAngle') + $fm['ItalicAngle']=(double)$param; + elseif($code=='Ascender') + $fm['Ascender']=(int)$param; + elseif($code=='Descender') + $fm['Descender']=(int)$param; + elseif($code=='UnderlineThickness') + $fm['UnderlineThickness']=(int)$param; + elseif($code=='UnderlinePosition') + $fm['UnderlinePosition']=(int)$param; + elseif($code=='IsFixedPitch') + $fm['IsFixedPitch']=($param=='true'); + elseif($code=='FontBBox') + $fm['FontBBox']=array($e[1],$e[2],$e[3],$e[4]); + elseif($code=='CapHeight') + $fm['CapHeight']=(int)$param; + elseif($code=='StdVW') + $fm['StdVW']=(int)$param; + } + if(!isset($fm['FontName'])) + die('FontName not found'); + if(!empty($map)) + { + if(!isset($widths['.notdef'])) + $widths['.notdef']=600; + if(!isset($widths['Delta']) && isset($widths['increment'])) + $widths['Delta']=$widths['increment']; + //Order widths according to map + for($i=0;$i<=255;$i++) + { + if(!isset($widths[$map[$i]])) + { + echo 'Warning: character '.$map[$i].' is missing
'; + $widths[$i]=$widths['.notdef']; + } + else + $widths[$i]=$widths[$map[$i]]; + } + } + $fm['Widths']=$widths; + return $fm; +} + +function MakeFontDescriptor($fm, $symbolic) +{ + //Ascent + $asc=(isset($fm['Ascender']) ? $fm['Ascender'] : 1000); + $fd="array('Ascent'=>".$asc; + //Descent + $desc=(isset($fm['Descender']) ? $fm['Descender'] : -200); + $fd.=",'Descent'=>".$desc; + //CapHeight + if(isset($fm['CapHeight'])) + $ch=$fm['CapHeight']; + elseif(isset($fm['CapXHeight'])) + $ch=$fm['CapXHeight']; + else + $ch=$asc; + $fd.=",'CapHeight'=>".$ch; + //Flags + $flags=0; + if(isset($fm['IsFixedPitch']) && $fm['IsFixedPitch']) + $flags+=1<<0; + if($symbolic) + $flags+=1<<2; + if(!$symbolic) + $flags+=1<<5; + if(isset($fm['ItalicAngle']) && $fm['ItalicAngle']!=0) + $flags+=1<<6; + $fd.=",'Flags'=>".$flags; + //FontBBox + if(isset($fm['FontBBox'])) + $fbb=$fm['FontBBox']; + else + $fbb=array(0,$desc-100,1000,$asc+100); + $fd.=",'FontBBox'=>'[".$fbb[0].' '.$fbb[1].' '.$fbb[2].' '.$fbb[3]."]'"; + //ItalicAngle + $ia=(isset($fm['ItalicAngle']) ? $fm['ItalicAngle'] : 0); + $fd.=",'ItalicAngle'=>".$ia; + //StemV + if(isset($fm['StdVW'])) + $stemv=$fm['StdVW']; + elseif(isset($fm['Weight']) && preg_match('/bold|black/i',$fm['Weight'])) + $stemv=120; + else + $stemv=70; + $fd.=",'StemV'=>".$stemv; + //MissingWidth + if(isset($fm['MissingWidth'])) + $fd.=",'MissingWidth'=>".$fm['MissingWidth']; + $fd.=')'; + return $fd; +} + +function MakeWidthArray($fm) +{ + //Make character width array + $s="array(\n\t"; + $cw=$fm['Widths']; + for($i=0;$i<=255;$i++) + { + if(chr($i)=="'") + $s.="'\\''"; + elseif(chr($i)=="\\") + $s.="'\\\\'"; + elseif($i>=32 && $i<=126) + $s.="'".chr($i)."'"; + else + $s.="chr($i)"; + $s.='=>'.$fm['Widths'][$i]; + if($i<255) + $s.=','; + if(($i+1)%22==0) + $s.="\n\t"; + } + $s.=')'; + return $s; +} + +function MakeFontEncoding($map) +{ + //Build differences from reference encoding + $ref=ReadMap('cp1252'); + $s=''; + $last=0; + for($i=32;$i<=255;$i++) + { + if($map[$i]!=$ref[$i]) + { + if($i!=$last+1) + $s.=$i.' '; + $last=$i; + $s.='/'.$map[$i].' '; + } + } + return rtrim($s); +} + +function SaveToFile($file, $s, $mode) +{ + $f=fopen($file,'w'.$mode); + if(!$f) + die('Can\'t write to file '.$file); + fwrite($f,$s,strlen($s)); + fclose($f); +} + +function ReadShort($f) +{ + $a=unpack('n1n',fread($f,2)); + return $a['n']; +} + +function ReadLong($f) +{ + $a=unpack('N1N',fread($f,4)); + return $a['N']; +} + +function CheckTTF($file) +{ + //Check if font license allows embedding + $f=fopen($file,'rb'); + if(!$f) + die('Error: Can\'t open '.$file); + //Extract number of tables + fseek($f,4,SEEK_CUR); + $nb=ReadShort($f); + fseek($f,6,SEEK_CUR); + //Seek OS/2 table + $found=false; + for($i=0;$i<$nb;$i++) + { + if(fread($f,4)=='OS/2') + { + $found=true; + break; + } + fseek($f,12,SEEK_CUR); + } + if(!$found) + { + fclose($f); + return; + } + fseek($f,4,SEEK_CUR); + $offset=ReadLong($f); + fseek($f,$offset,SEEK_SET); + //Extract fsType flags + fseek($f,8,SEEK_CUR); + $fsType=ReadShort($f); + $rl=($fsType & 0x02)!=0; + $pp=($fsType & 0x04)!=0; + $e=($fsType & 0x08)!=0; + fclose($f); + if($rl && !$pp && !$e) + echo 'Warning: font license does not allow embedding'; +} + +/******************************************************************************* +* fontfile: path to TTF file (or empty string if not to be embedded) * +* afmfile: path to AFM file * +* enc: font encoding (or empty string for symbolic fonts) * +* patch: optional patch for encoding * +* type: font type if fontfile is empty * +*******************************************************************************/ +function MakeFont($fontfile, $afmfile, $enc='cp1252', $patch=array(), $type='TrueType') +{ + //Generate a font definition file + if(get_magic_quotes_runtime()) + @set_magic_quotes_runtime(0); + ini_set('auto_detect_line_endings','1'); + if($enc) + { + $map=ReadMap($enc); + foreach($patch as $cc=>$gn) + $map[$cc]=$gn; + } + else + $map=array(); + if(!file_exists($afmfile)) + die('Error: AFM file not found: '.$afmfile); + $fm=ReadAFM($afmfile,$map); + if($enc) + $diff=MakeFontEncoding($map); + else + $diff=''; + $fd=MakeFontDescriptor($fm,empty($map)); + //Find font type + if($fontfile) + { + $ext=strtolower(substr($fontfile,-3)); + if($ext=='ttf') + $type='TrueType'; + elseif($ext=='pfb') + $type='Type1'; + else + die('Error: unrecognized font file extension: '.$ext); + } + else + { + if($type!='TrueType' && $type!='Type1') + die('Error: incorrect font type: '.$type); + } + //Start generation + $s='Error: font file not found: '.$fontfile); + if($type=='TrueType') + CheckTTF($fontfile); + $f=fopen($fontfile,'rb'); + if(!$f) + die('Error: Can\'t open '.$fontfile); + $file=fread($f,filesize($fontfile)); + fclose($f); + if($type=='Type1') + { + //Find first two sections and discard third one + $header=(ord($file[0])==128); + if($header) + { + //Strip first binary header + $file=substr($file,6); + } + $pos=strpos($file,'eexec'); + if(!$pos) + die('Error: font file does not seem to be valid Type1'); + $size1=$pos+6; + if($header && ord($file[$size1])==128) + { + //Strip second binary header + $file=substr($file,0,$size1).substr($file,$size1+6); + } + $pos=strpos($file,'00000000'); + if(!$pos) + die('Error: font file does not seem to be valid Type1'); + $size2=$pos-$size1; + $file=substr($file,0,$size1+$size2); + } + if(function_exists('gzcompress')) + { + $cmp=$basename.'.z'; + SaveToFile($cmp,gzcompress($file),'b'); + $s.='$file=\''.$cmp."';\n"; + echo 'Font file compressed ('.$cmp.')
'; + } + else + { + $s.='$file=\''.basename($fontfile)."';\n"; + echo 'Notice: font file could not be compressed (zlib extension not available)
'; + } + if($type=='Type1') + { + $s.='$size1='.$size1.";\n"; + $s.='$size2='.$size2.";\n"; + } + else + $s.='$originalsize='.filesize($fontfile).";\n"; + } + else + { + //Not embedded font + $s.='$file='."'';\n"; + } + $s.="?>\n"; + SaveToFile($basename.'.php',$s,'t'); + echo 'Font definition file generated ('.$basename.'.php'.')
'; +} +?> diff --git a/includes/fpdf/font/symbol.php b/includes/fpdf/font/symbol.php new file mode 100755 index 00000000..43b50e45 --- /dev/null +++ b/includes/fpdf/font/symbol.php @@ -0,0 +1,15 @@ +250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, + chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>713,'#'=>500,'$'=>549,'%'=>833,'&'=>778,'\''=>439,'('=>333,')'=>333,'*'=>500,'+'=>549, + ','=>250,'-'=>549,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>278,';'=>278,'<'=>549,'='=>549,'>'=>549,'?'=>444,'@'=>549,'A'=>722, + 'B'=>667,'C'=>722,'D'=>612,'E'=>611,'F'=>763,'G'=>603,'H'=>722,'I'=>333,'J'=>631,'K'=>722,'L'=>686,'M'=>889,'N'=>722,'O'=>722,'P'=>768,'Q'=>741,'R'=>556,'S'=>592,'T'=>611,'U'=>690,'V'=>439,'W'=>768, + 'X'=>645,'Y'=>795,'Z'=>611,'['=>333,'\\'=>863,']'=>333,'^'=>658,'_'=>500,'`'=>500,'a'=>631,'b'=>549,'c'=>549,'d'=>494,'e'=>439,'f'=>521,'g'=>411,'h'=>603,'i'=>329,'j'=>603,'k'=>549,'l'=>549,'m'=>576, + 'n'=>521,'o'=>549,'p'=>549,'q'=>521,'r'=>549,'s'=>603,'t'=>439,'u'=>576,'v'=>713,'w'=>686,'x'=>493,'y'=>686,'z'=>494,'{'=>480,'|'=>200,'}'=>480,'~'=>549,chr(127)=>0,chr(128)=>0,chr(129)=>0,chr(130)=>0,chr(131)=>0, + chr(132)=>0,chr(133)=>0,chr(134)=>0,chr(135)=>0,chr(136)=>0,chr(137)=>0,chr(138)=>0,chr(139)=>0,chr(140)=>0,chr(141)=>0,chr(142)=>0,chr(143)=>0,chr(144)=>0,chr(145)=>0,chr(146)=>0,chr(147)=>0,chr(148)=>0,chr(149)=>0,chr(150)=>0,chr(151)=>0,chr(152)=>0,chr(153)=>0, + chr(154)=>0,chr(155)=>0,chr(156)=>0,chr(157)=>0,chr(158)=>0,chr(159)=>0,chr(160)=>750,chr(161)=>620,chr(162)=>247,chr(163)=>549,chr(164)=>167,chr(165)=>713,chr(166)=>500,chr(167)=>753,chr(168)=>753,chr(169)=>753,chr(170)=>753,chr(171)=>1042,chr(172)=>987,chr(173)=>603,chr(174)=>987,chr(175)=>603, + chr(176)=>400,chr(177)=>549,chr(178)=>411,chr(179)=>549,chr(180)=>549,chr(181)=>713,chr(182)=>494,chr(183)=>460,chr(184)=>549,chr(185)=>549,chr(186)=>549,chr(187)=>549,chr(188)=>1000,chr(189)=>603,chr(190)=>1000,chr(191)=>658,chr(192)=>823,chr(193)=>686,chr(194)=>795,chr(195)=>987,chr(196)=>768,chr(197)=>768, + chr(198)=>823,chr(199)=>768,chr(200)=>768,chr(201)=>713,chr(202)=>713,chr(203)=>713,chr(204)=>713,chr(205)=>713,chr(206)=>713,chr(207)=>713,chr(208)=>768,chr(209)=>713,chr(210)=>790,chr(211)=>790,chr(212)=>890,chr(213)=>823,chr(214)=>549,chr(215)=>250,chr(216)=>713,chr(217)=>603,chr(218)=>603,chr(219)=>1042, + chr(220)=>987,chr(221)=>603,chr(222)=>987,chr(223)=>603,chr(224)=>494,chr(225)=>329,chr(226)=>790,chr(227)=>790,chr(228)=>786,chr(229)=>713,chr(230)=>384,chr(231)=>384,chr(232)=>384,chr(233)=>384,chr(234)=>384,chr(235)=>384,chr(236)=>494,chr(237)=>494,chr(238)=>494,chr(239)=>494,chr(240)=>0,chr(241)=>329, + chr(242)=>274,chr(243)=>686,chr(244)=>686,chr(245)=>686,chr(246)=>384,chr(247)=>384,chr(248)=>384,chr(249)=>384,chr(250)=>384,chr(251)=>384,chr(252)=>494,chr(253)=>494,chr(254)=>494,chr(255)=>0); +?> diff --git a/includes/fpdf/font/times.php b/includes/fpdf/font/times.php new file mode 100755 index 00000000..837c706e --- /dev/null +++ b/includes/fpdf/font/times.php @@ -0,0 +1,15 @@ +250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, + chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>408,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>180,'('=>333,')'=>333,'*'=>500,'+'=>564, + ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>278,';'=>278,'<'=>564,'='=>564,'>'=>564,'?'=>444,'@'=>921,'A'=>722, + 'B'=>667,'C'=>667,'D'=>722,'E'=>611,'F'=>556,'G'=>722,'H'=>722,'I'=>333,'J'=>389,'K'=>722,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>556,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>722,'W'=>944, + 'X'=>722,'Y'=>722,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>469,'_'=>500,'`'=>333,'a'=>444,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778, + 'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>333,'s'=>389,'t'=>278,'u'=>500,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>480,'|'=>200,'}'=>480,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, + chr(132)=>444,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>889,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>444,chr(148)=>444,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>980, + chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>200,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>564,chr(173)=>333,chr(174)=>760,chr(175)=>333, + chr(176)=>400,chr(177)=>564,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>453,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>444,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, + chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>564,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>722,chr(222)=>556,chr(223)=>500,chr(224)=>444,chr(225)=>444,chr(226)=>444,chr(227)=>444,chr(228)=>444,chr(229)=>444,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500, + chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>564,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>500,chr(254)=>500,chr(255)=>500); +?> diff --git a/includes/fpdf/font/timesb.php b/includes/fpdf/font/timesb.php new file mode 100755 index 00000000..09cff86a --- /dev/null +++ b/includes/fpdf/font/timesb.php @@ -0,0 +1,15 @@ +250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, + chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>555,'#'=>500,'$'=>500,'%'=>1000,'&'=>833,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570, + ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>930,'A'=>722, + 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>778,'I'=>389,'J'=>500,'K'=>778,'L'=>667,'M'=>944,'N'=>722,'O'=>778,'P'=>611,'Q'=>778,'R'=>722,'S'=>556,'T'=>667,'U'=>722,'V'=>722,'W'=>1000, + 'X'=>722,'Y'=>722,'Z'=>667,'['=>333,'\\'=>278,']'=>333,'^'=>581,'_'=>500,'`'=>333,'a'=>500,'b'=>556,'c'=>444,'d'=>556,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>333,'k'=>556,'l'=>278,'m'=>833, + 'n'=>556,'o'=>500,'p'=>556,'q'=>556,'r'=>444,'s'=>389,'t'=>333,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>394,'|'=>220,'}'=>394,'~'=>520,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, + chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>667,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, + chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>300,chr(171)=>500,chr(172)=>570,chr(173)=>333,chr(174)=>747,chr(175)=>333, + chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>556,chr(182)=>540,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>330,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, + chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>570,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>722,chr(222)=>611,chr(223)=>556,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556, + chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); +?> diff --git a/includes/fpdf/font/timesbi.php b/includes/fpdf/font/timesbi.php new file mode 100755 index 00000000..b4e38d76 --- /dev/null +++ b/includes/fpdf/font/timesbi.php @@ -0,0 +1,15 @@ +250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, + chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>389,'"'=>555,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570, + ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>832,'A'=>667, + 'B'=>667,'C'=>667,'D'=>722,'E'=>667,'F'=>667,'G'=>722,'H'=>778,'I'=>389,'J'=>500,'K'=>667,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>611,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>667,'W'=>889, + 'X'=>667,'Y'=>611,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>570,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778, + 'n'=>556,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>556,'v'=>444,'w'=>667,'x'=>500,'y'=>444,'z'=>389,'{'=>348,'|'=>220,'}'=>348,'~'=>570,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, + chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, + chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>389,chr(159)=>611,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>266,chr(171)=>500,chr(172)=>606,chr(173)=>333,chr(174)=>747,chr(175)=>333, + chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>576,chr(182)=>500,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>300,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, + chr(198)=>944,chr(199)=>667,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>570,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>611,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556, + chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>444,chr(254)=>500,chr(255)=>444); +?> diff --git a/includes/fpdf/font/timesi.php b/includes/fpdf/font/timesi.php new file mode 100755 index 00000000..0ba2b777 --- /dev/null +++ b/includes/fpdf/font/timesi.php @@ -0,0 +1,15 @@ +250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, + chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>420,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>214,'('=>333,')'=>333,'*'=>500,'+'=>675, + ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>675,'='=>675,'>'=>675,'?'=>500,'@'=>920,'A'=>611, + 'B'=>611,'C'=>667,'D'=>722,'E'=>611,'F'=>611,'G'=>722,'H'=>722,'I'=>333,'J'=>444,'K'=>667,'L'=>556,'M'=>833,'N'=>667,'O'=>722,'P'=>611,'Q'=>722,'R'=>611,'S'=>500,'T'=>556,'U'=>722,'V'=>611,'W'=>833, + 'X'=>611,'Y'=>556,'Z'=>556,'['=>389,'\\'=>278,']'=>389,'^'=>422,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>278,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>444,'l'=>278,'m'=>722, + 'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>500,'v'=>444,'w'=>667,'x'=>444,'y'=>444,'z'=>389,'{'=>400,'|'=>275,'}'=>400,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, + chr(132)=>556,chr(133)=>889,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>500,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>556,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>556,chr(148)=>556,chr(149)=>350,chr(150)=>500,chr(151)=>889,chr(152)=>333,chr(153)=>980, + chr(154)=>389,chr(155)=>333,chr(156)=>667,chr(157)=>350,chr(158)=>389,chr(159)=>556,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>275,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>675,chr(173)=>333,chr(174)=>760,chr(175)=>333, + chr(176)=>400,chr(177)=>675,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>523,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>611,chr(193)=>611,chr(194)=>611,chr(195)=>611,chr(196)=>611,chr(197)=>611, + chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>667,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>675,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>556,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500, + chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>675,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>444,chr(254)=>500,chr(255)=>444); +?> diff --git a/includes/fpdf/font/zapfdingbats.php b/includes/fpdf/font/zapfdingbats.php new file mode 100755 index 00000000..1f926a8c --- /dev/null +++ b/includes/fpdf/font/zapfdingbats.php @@ -0,0 +1,15 @@ +0,chr(1)=>0,chr(2)=>0,chr(3)=>0,chr(4)=>0,chr(5)=>0,chr(6)=>0,chr(7)=>0,chr(8)=>0,chr(9)=>0,chr(10)=>0,chr(11)=>0,chr(12)=>0,chr(13)=>0,chr(14)=>0,chr(15)=>0,chr(16)=>0,chr(17)=>0,chr(18)=>0,chr(19)=>0,chr(20)=>0,chr(21)=>0, + chr(22)=>0,chr(23)=>0,chr(24)=>0,chr(25)=>0,chr(26)=>0,chr(27)=>0,chr(28)=>0,chr(29)=>0,chr(30)=>0,chr(31)=>0,' '=>278,'!'=>974,'"'=>961,'#'=>974,'$'=>980,'%'=>719,'&'=>789,'\''=>790,'('=>791,')'=>690,'*'=>960,'+'=>939, + ','=>549,'-'=>855,'.'=>911,'/'=>933,'0'=>911,'1'=>945,'2'=>974,'3'=>755,'4'=>846,'5'=>762,'6'=>761,'7'=>571,'8'=>677,'9'=>763,':'=>760,';'=>759,'<'=>754,'='=>494,'>'=>552,'?'=>537,'@'=>577,'A'=>692, + 'B'=>786,'C'=>788,'D'=>788,'E'=>790,'F'=>793,'G'=>794,'H'=>816,'I'=>823,'J'=>789,'K'=>841,'L'=>823,'M'=>833,'N'=>816,'O'=>831,'P'=>923,'Q'=>744,'R'=>723,'S'=>749,'T'=>790,'U'=>792,'V'=>695,'W'=>776, + 'X'=>768,'Y'=>792,'Z'=>759,'['=>707,'\\'=>708,']'=>682,'^'=>701,'_'=>826,'`'=>815,'a'=>789,'b'=>789,'c'=>707,'d'=>687,'e'=>696,'f'=>689,'g'=>786,'h'=>787,'i'=>713,'j'=>791,'k'=>785,'l'=>791,'m'=>873, + 'n'=>761,'o'=>762,'p'=>762,'q'=>759,'r'=>759,'s'=>892,'t'=>892,'u'=>788,'v'=>784,'w'=>438,'x'=>138,'y'=>277,'z'=>415,'{'=>392,'|'=>392,'}'=>668,'~'=>668,chr(127)=>0,chr(128)=>390,chr(129)=>390,chr(130)=>317,chr(131)=>317, + chr(132)=>276,chr(133)=>276,chr(134)=>509,chr(135)=>509,chr(136)=>410,chr(137)=>410,chr(138)=>234,chr(139)=>234,chr(140)=>334,chr(141)=>334,chr(142)=>0,chr(143)=>0,chr(144)=>0,chr(145)=>0,chr(146)=>0,chr(147)=>0,chr(148)=>0,chr(149)=>0,chr(150)=>0,chr(151)=>0,chr(152)=>0,chr(153)=>0, + chr(154)=>0,chr(155)=>0,chr(156)=>0,chr(157)=>0,chr(158)=>0,chr(159)=>0,chr(160)=>0,chr(161)=>732,chr(162)=>544,chr(163)=>544,chr(164)=>910,chr(165)=>667,chr(166)=>760,chr(167)=>760,chr(168)=>776,chr(169)=>595,chr(170)=>694,chr(171)=>626,chr(172)=>788,chr(173)=>788,chr(174)=>788,chr(175)=>788, + chr(176)=>788,chr(177)=>788,chr(178)=>788,chr(179)=>788,chr(180)=>788,chr(181)=>788,chr(182)=>788,chr(183)=>788,chr(184)=>788,chr(185)=>788,chr(186)=>788,chr(187)=>788,chr(188)=>788,chr(189)=>788,chr(190)=>788,chr(191)=>788,chr(192)=>788,chr(193)=>788,chr(194)=>788,chr(195)=>788,chr(196)=>788,chr(197)=>788, + chr(198)=>788,chr(199)=>788,chr(200)=>788,chr(201)=>788,chr(202)=>788,chr(203)=>788,chr(204)=>788,chr(205)=>788,chr(206)=>788,chr(207)=>788,chr(208)=>788,chr(209)=>788,chr(210)=>788,chr(211)=>788,chr(212)=>894,chr(213)=>838,chr(214)=>1016,chr(215)=>458,chr(216)=>748,chr(217)=>924,chr(218)=>748,chr(219)=>918, + chr(220)=>927,chr(221)=>928,chr(222)=>928,chr(223)=>834,chr(224)=>873,chr(225)=>828,chr(226)=>924,chr(227)=>924,chr(228)=>917,chr(229)=>930,chr(230)=>931,chr(231)=>463,chr(232)=>883,chr(233)=>836,chr(234)=>836,chr(235)=>867,chr(236)=>867,chr(237)=>696,chr(238)=>696,chr(239)=>874,chr(240)=>0,chr(241)=>874, + chr(242)=>760,chr(243)=>946,chr(244)=>771,chr(245)=>865,chr(246)=>771,chr(247)=>888,chr(248)=>967,chr(249)=>888,chr(250)=>831,chr(251)=>873,chr(252)=>927,chr(253)=>970,chr(254)=>918,chr(255)=>0); +?> diff --git a/includes/fpdf/fpdf.php b/includes/fpdf/fpdf.php new file mode 100755 index 00000000..b27ca6df --- /dev/null +++ b/includes/fpdf/fpdf.php @@ -0,0 +1,1732 @@ +_dochecks(); + //Initialization of properties + $this->page=0; + $this->n=2; + $this->buffer=''; + $this->pages=array(); + $this->PageSizes=array(); + $this->state=0; + $this->fonts=array(); + $this->FontFiles=array(); + $this->diffs=array(); + $this->images=array(); + $this->links=array(); + $this->InHeader=false; + $this->InFooter=false; + $this->lasth=0; + $this->FontFamily=''; + $this->FontStyle=''; + $this->FontSizePt=12; + $this->underline=false; + $this->DrawColor='0 G'; + $this->FillColor='0 g'; + $this->TextColor='0 g'; + $this->ColorFlag=false; + $this->ws=0; + //Standard fonts + $this->CoreFonts=array('courier'=>'Courier', 'courierB'=>'Courier-Bold', 'courierI'=>'Courier-Oblique', 'courierBI'=>'Courier-BoldOblique', + 'helvetica'=>'Helvetica', 'helveticaB'=>'Helvetica-Bold', 'helveticaI'=>'Helvetica-Oblique', 'helveticaBI'=>'Helvetica-BoldOblique', + 'times'=>'Times-Roman', 'timesB'=>'Times-Bold', 'timesI'=>'Times-Italic', 'timesBI'=>'Times-BoldItalic', + 'symbol'=>'Symbol', 'zapfdingbats'=>'ZapfDingbats'); + //Scale factor + if($unit=='pt') + $this->k=1; + elseif($unit=='mm') + $this->k=72/25.4; + elseif($unit=='cm') + $this->k=72/2.54; + elseif($unit=='in') + $this->k=72; + else + $this->Error('Incorrect unit: '.$unit); + //Page format + $this->PageFormats=array('a3'=>array(841.89,1190.55), 'a4'=>array(595.28,841.89), 'a5'=>array(420.94,595.28), + 'letter'=>array(612,792), 'legal'=>array(612,1008)); + if(is_string($format)) + $format=$this->_getpageformat($format); + $this->DefPageFormat=$format; + $this->CurPageFormat=$format; + //Page orientation + $orientation=strtolower($orientation); + if($orientation=='p' || $orientation=='portrait') + { + $this->DefOrientation='P'; + $this->w=$this->DefPageFormat[0]; + $this->h=$this->DefPageFormat[1]; + } + elseif($orientation=='l' || $orientation=='landscape') + { + $this->DefOrientation='L'; + $this->w=$this->DefPageFormat[1]; + $this->h=$this->DefPageFormat[0]; + } + else + $this->Error('Incorrect orientation: '.$orientation); + $this->CurOrientation=$this->DefOrientation; + $this->wPt=$this->w*$this->k; + $this->hPt=$this->h*$this->k; + //Page margins (1 cm) + $margin=28.35/$this->k; + $this->SetMargins($margin,$margin); + //Interior cell margin (1 mm) + $this->cMargin=$margin/10; + //Line width (0.2 mm) + $this->LineWidth=.567/$this->k; + //Automatic page break + $this->SetAutoPageBreak(true,2*$margin); + //Full width display mode + $this->SetDisplayMode('fullwidth'); + //Enable compression + $this->SetCompression(true); + //Set default PDF version number + $this->PDFVersion='1.3'; +} + +function SetMargins($left, $top, $right=null) +{ + //Set left, top and right margins + $this->lMargin=$left; + $this->tMargin=$top; + if($right===null) + $right=$left; + $this->rMargin=$right; +} + +function SetLeftMargin($margin) +{ + //Set left margin + $this->lMargin=$margin; + if($this->page>0 && $this->x<$margin) + $this->x=$margin; +} + +function SetTopMargin($margin) +{ + //Set top margin + $this->tMargin=$margin; +} + +function SetRightMargin($margin) +{ + //Set right margin + $this->rMargin=$margin; +} + +function SetAutoPageBreak($auto, $margin=0) +{ + //Set auto page break mode and triggering margin + $this->AutoPageBreak=$auto; + $this->bMargin=$margin; + $this->PageBreakTrigger=$this->h-$margin; +} + +function SetDisplayMode($zoom, $layout='continuous') +{ + //Set display mode in viewer + if($zoom=='fullpage' || $zoom=='fullwidth' || $zoom=='real' || $zoom=='default' || !is_string($zoom)) + $this->ZoomMode=$zoom; + else + $this->Error('Incorrect zoom display mode: '.$zoom); + if($layout=='single' || $layout=='continuous' || $layout=='two' || $layout=='default') + $this->LayoutMode=$layout; + else + $this->Error('Incorrect layout display mode: '.$layout); +} + +function SetCompression($compress) +{ + //Set page compression + if(function_exists('gzcompress')) + $this->compress=$compress; + else + $this->compress=false; +} + +function SetTitle($title, $isUTF8=false) +{ + //Title of document + if($isUTF8) + $title=$this->_UTF8toUTF16($title); + $this->title=$title; +} + +function SetSubject($subject, $isUTF8=false) +{ + //Subject of document + if($isUTF8) + $subject=$this->_UTF8toUTF16($subject); + $this->subject=$subject; +} + +function SetAuthor($author, $isUTF8=false) +{ + //Author of document + if($isUTF8) + $author=$this->_UTF8toUTF16($author); + $this->author=$author; +} + +function SetKeywords($keywords, $isUTF8=false) +{ + //Keywords of document + if($isUTF8) + $keywords=$this->_UTF8toUTF16($keywords); + $this->keywords=$keywords; +} + +function SetCreator($creator, $isUTF8=false) +{ + //Creator of document + if($isUTF8) + $creator=$this->_UTF8toUTF16($creator); + $this->creator=$creator; +} + +function AliasNbPages($alias='{nb}') +{ + //Define an alias for total number of pages + $this->AliasNbPages=$alias; +} + +function Error($msg) +{ + //Fatal error + die('FPDF error: '.$msg); +} + +function Open() +{ + //Begin document + $this->state=1; +} + +function Close() +{ + //Terminate document + if($this->state==3) + return; + if($this->page==0) + $this->AddPage(); + //Page footer + $this->InFooter=true; + $this->Footer(); + $this->InFooter=false; + //Close page + $this->_endpage(); + //Close document + $this->_enddoc(); +} + +function AddPage($orientation='', $format='') +{ + //Start a new page + if($this->state==0) + $this->Open(); + $family=$this->FontFamily; + $style=$this->FontStyle.($this->underline ? 'U' : ''); + $size=$this->FontSizePt; + $lw=$this->LineWidth; + $dc=$this->DrawColor; + $fc=$this->FillColor; + $tc=$this->TextColor; + $cf=$this->ColorFlag; + if($this->page>0) + { + //Page footer + $this->InFooter=true; + $this->Footer(); + $this->InFooter=false; + //Close page + $this->_endpage(); + } + //Start new page + $this->_beginpage($orientation,$format); + //Set line cap style to square + $this->_out('2 J'); + //Set line width + $this->LineWidth=$lw; + $this->_out(sprintf('%.2F w',$lw*$this->k)); + //Set font + if($family) + $this->SetFont($family,$style,$size); + //Set colors + $this->DrawColor=$dc; + if($dc!='0 G') + $this->_out($dc); + $this->FillColor=$fc; + if($fc!='0 g') + $this->_out($fc); + $this->TextColor=$tc; + $this->ColorFlag=$cf; + //Page header + $this->InHeader=true; + $this->Header(); + $this->InHeader=false; + //Restore line width + if($this->LineWidth!=$lw) + { + $this->LineWidth=$lw; + $this->_out(sprintf('%.2F w',$lw*$this->k)); + } + //Restore font + if($family) + $this->SetFont($family,$style,$size); + //Restore colors + if($this->DrawColor!=$dc) + { + $this->DrawColor=$dc; + $this->_out($dc); + } + if($this->FillColor!=$fc) + { + $this->FillColor=$fc; + $this->_out($fc); + } + $this->TextColor=$tc; + $this->ColorFlag=$cf; +} + +function Header() +{ + //To be implemented in your own inherited class +} + +function Footer() +{ + //To be implemented in your own inherited class +} + +function PageNo() +{ + //Get current page number + return $this->page; +} + +function SetDrawColor($r, $g=null, $b=null) +{ + //Set color for all stroking operations + if(($r==0 && $g==0 && $b==0) || $g===null) + $this->DrawColor=sprintf('%.3F G',$r/255); + else + $this->DrawColor=sprintf('%.3F %.3F %.3F RG',$r/255,$g/255,$b/255); + if($this->page>0) + $this->_out($this->DrawColor); +} + +function SetFillColor($r, $g=null, $b=null) +{ + //Set color for all filling operations + if(($r==0 && $g==0 && $b==0) || $g===null) + $this->FillColor=sprintf('%.3F g',$r/255); + else + $this->FillColor=sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255); + $this->ColorFlag=($this->FillColor!=$this->TextColor); + if($this->page>0) + $this->_out($this->FillColor); +} + +function SetTextColor($r, $g=null, $b=null) +{ + //Set color for text + if(($r==0 && $g==0 && $b==0) || $g===null) + $this->TextColor=sprintf('%.3F g',$r/255); + else + $this->TextColor=sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255); + $this->ColorFlag=($this->FillColor!=$this->TextColor); +} + +function GetStringWidth($s) +{ + //Get width of a string in the current font + $s=(string)$s; + $cw=&$this->CurrentFont['cw']; + $w=0; + $l=strlen($s); + for($i=0;$i<$l;$i++) + $w+=$cw[$s[$i]]; + return $w*$this->FontSize/1000; +} + +function SetLineWidth($width) +{ + //Set line width + $this->LineWidth=$width; + if($this->page>0) + $this->_out(sprintf('%.2F w',$width*$this->k)); +} + +function Line($x1, $y1, $x2, $y2) +{ + //Draw a line + $this->_out(sprintf('%.2F %.2F m %.2F %.2F l S',$x1*$this->k,($this->h-$y1)*$this->k,$x2*$this->k,($this->h-$y2)*$this->k)); +} + +function Rect($x, $y, $w, $h, $style='') +{ + //Draw a rectangle + if($style=='F') + $op='f'; + elseif($style=='FD' || $style=='DF') + $op='B'; + else + $op='S'; + $this->_out(sprintf('%.2F %.2F %.2F %.2F re %s',$x*$this->k,($this->h-$y)*$this->k,$w*$this->k,-$h*$this->k,$op)); +} + +function AddFont($family, $style='', $file='') +{ + //Add a TrueType or Type1 font + $family=strtolower($family); + if($file=='') + $file=str_replace(' ','',$family).strtolower($style).'.php'; + if($family=='arial') + $family='helvetica'; + $style=strtoupper($style); + if($style=='IB') + $style='BI'; + $fontkey=$family.$style; + if(isset($this->fonts[$fontkey])) + return; + include($this->_getfontpath().$file); + if(!isset($name)) + $this->Error('Could not include font definition file'); + $i=count($this->fonts)+1; + $this->fonts[$fontkey]=array('i'=>$i, 'type'=>$type, 'name'=>$name, 'desc'=>$desc, 'up'=>$up, 'ut'=>$ut, 'cw'=>$cw, 'enc'=>$enc, 'file'=>$file); + if($diff) + { + //Search existing encodings + $d=0; + $nb=count($this->diffs); + for($i=1;$i<=$nb;$i++) + { + if($this->diffs[$i]==$diff) + { + $d=$i; + break; + } + } + if($d==0) + { + $d=$nb+1; + $this->diffs[$d]=$diff; + } + $this->fonts[$fontkey]['diff']=$d; + } + if($file) + { + if($type=='TrueType') + $this->FontFiles[$file]=array('length1'=>$originalsize); + else + $this->FontFiles[$file]=array('length1'=>$size1, 'length2'=>$size2); + } +} + +function SetFont($family, $style='', $size=0) +{ + //Select a font; size given in points + global $fpdf_charwidths; + + $family=strtolower($family); + if($family=='') + $family=$this->FontFamily; + if($family=='arial') + $family='helvetica'; + elseif($family=='symbol' || $family=='zapfdingbats') + $style=''; + $style=strtoupper($style); + if(strpos($style,'U')!==false) + { + $this->underline=true; + $style=str_replace('U','',$style); + } + else + $this->underline=false; + if($style=='IB') + $style='BI'; + if($size==0) + $size=$this->FontSizePt; + //Test if font is already selected + if($this->FontFamily==$family && $this->FontStyle==$style && $this->FontSizePt==$size) + return; + //Test if used for the first time + $fontkey=$family.$style; + if(!isset($this->fonts[$fontkey])) + { + //Check if one of the standard fonts + if(isset($this->CoreFonts[$fontkey])) + { + if(!isset($fpdf_charwidths[$fontkey])) + { + //Load metric file + $file=$family; + if($family=='times' || $family=='helvetica') + $file.=strtolower($style); + include($this->_getfontpath().$file.'.php'); + if(!isset($fpdf_charwidths[$fontkey])) + $this->Error('Could not include font metric file'); + } + $i=count($this->fonts)+1; + $name=$this->CoreFonts[$fontkey]; + $cw=$fpdf_charwidths[$fontkey]; + $this->fonts[$fontkey]=array('i'=>$i, 'type'=>'core', 'name'=>$name, 'up'=>-100, 'ut'=>50, 'cw'=>$cw); + } + else + $this->Error('Undefined font: '.$family.' '.$style); + } + //Select it + $this->FontFamily=$family; + $this->FontStyle=$style; + $this->FontSizePt=$size; + $this->FontSize=$size/$this->k; + $this->CurrentFont=&$this->fonts[$fontkey]; + if($this->page>0) + $this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt)); +} + +function SetFontSize($size) +{ + //Set font size in points + if($this->FontSizePt==$size) + return; + $this->FontSizePt=$size; + $this->FontSize=$size/$this->k; + if($this->page>0) + $this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt)); +} + +function AddLink() +{ + //Create a new internal link + $n=count($this->links)+1; + $this->links[$n]=array(0, 0); + return $n; +} + +function SetLink($link, $y=0, $page=-1) +{ + //Set destination of internal link + if($y==-1) + $y=$this->y; + if($page==-1) + $page=$this->page; + $this->links[$link]=array($page, $y); +} + +function Link($x, $y, $w, $h, $link) +{ + //Put a link on the page + $this->PageLinks[$this->page][]=array($x*$this->k, $this->hPt-$y*$this->k, $w*$this->k, $h*$this->k, $link); +} + +function Text($x, $y, $txt) +{ + //Output a string + $s=sprintf('BT %.2F %.2F Td (%s) Tj ET',$x*$this->k,($this->h-$y)*$this->k,$this->_escape($txt)); + if($this->underline && $txt!='') + $s.=' '.$this->_dounderline($x,$y,$txt); + if($this->ColorFlag) + $s='q '.$this->TextColor.' '.$s.' Q'; + $this->_out($s); +} + +function AcceptPageBreak() +{ + //Accept automatic page break or not + return $this->AutoPageBreak; +} + +function Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='') +{ + //Output a cell + $k=$this->k; + if($this->y+$h>$this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak()) + { + //Automatic page break + $x=$this->x; + $ws=$this->ws; + if($ws>0) + { + $this->ws=0; + $this->_out('0 Tw'); + } + $this->AddPage($this->CurOrientation,$this->CurPageFormat); + $this->x=$x; + if($ws>0) + { + $this->ws=$ws; + $this->_out(sprintf('%.3F Tw',$ws*$k)); + } + } + if($w==0) + $w=$this->w-$this->rMargin-$this->x; + $s=''; + if($fill || $border==1) + { + if($fill) + $op=($border==1) ? 'B' : 'f'; + else + $op='S'; + $s=sprintf('%.2F %.2F %.2F %.2F re %s ',$this->x*$k,($this->h-$this->y)*$k,$w*$k,-$h*$k,$op); + } + if(is_string($border)) + { + $x=$this->x; + $y=$this->y; + if(strpos($border,'L')!==false) + $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,$x*$k,($this->h-($y+$h))*$k); + if(strpos($border,'T')!==false) + $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-$y)*$k); + if(strpos($border,'R')!==false) + $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',($x+$w)*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-($y+$h))*$k); + if(strpos($border,'B')!==false) + $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-($y+$h))*$k,($x+$w)*$k,($this->h-($y+$h))*$k); + } + if($txt!=='') + { + if($align=='R') + $dx=$w-$this->cMargin-$this->GetStringWidth($txt); + elseif($align=='C') + $dx=($w-$this->GetStringWidth($txt))/2; + else + $dx=$this->cMargin; + if($this->ColorFlag) + $s.='q '.$this->TextColor.' '; + $txt2=str_replace(')','\\)',str_replace('(','\\(',str_replace('\\','\\\\',$txt))); + $s.=sprintf('BT %.2F %.2F Td (%s) Tj ET',($this->x+$dx)*$k,($this->h-($this->y+.5*$h+.3*$this->FontSize))*$k,$txt2); + if($this->underline) + $s.=' '.$this->_dounderline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt); + if($this->ColorFlag) + $s.=' Q'; + if($link) + $this->Link($this->x+$dx,$this->y+.5*$h-.5*$this->FontSize,$this->GetStringWidth($txt),$this->FontSize,$link); + } + if($s) + $this->_out($s); + $this->lasth=$h; + if($ln>0) + { + //Go to next line + $this->y+=$h; + if($ln==1) + $this->x=$this->lMargin; + } + else + $this->x+=$w; +} + +function MultiCell($w, $h, $txt, $border=0, $align='J', $fill=false) +{ + //Output text with automatic or explicit line breaks + $cw=&$this->CurrentFont['cw']; + if($w==0) + $w=$this->w-$this->rMargin-$this->x; + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; + $s=str_replace("\r",'',$txt); + $nb=strlen($s); + if($nb>0 && $s[$nb-1]=="\n") + $nb--; + $b=0; + if($border) + { + if($border==1) + { + $border='LTRB'; + $b='LRT'; + $b2='LR'; + } + else + { + $b2=''; + if(strpos($border,'L')!==false) + $b2.='L'; + if(strpos($border,'R')!==false) + $b2.='R'; + $b=(strpos($border,'T')!==false) ? $b2.'T' : $b2; + } + } + $sep=-1; + $i=0; + $j=0; + $l=0; + $ns=0; + $nl=1; + while($i<$nb) + { + //Get next character + $c=$s[$i]; + if($c=="\n") + { + //Explicit line break + if($this->ws>0) + { + $this->ws=0; + $this->_out('0 Tw'); + } + $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); + $i++; + $sep=-1; + $j=$i; + $l=0; + $ns=0; + $nl++; + if($border && $nl==2) + $b=$b2; + continue; + } + if($c==' ') + { + $sep=$i; + $ls=$l; + $ns++; + } + $l+=$cw[$c]; + if($l>$wmax) + { + //Automatic line break + if($sep==-1) + { + if($i==$j) + $i++; + if($this->ws>0) + { + $this->ws=0; + $this->_out('0 Tw'); + } + $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); + } + else + { + if($align=='J') + { + $this->ws=($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0; + $this->_out(sprintf('%.3F Tw',$this->ws*$this->k)); + } + $this->Cell($w,$h,substr($s,$j,$sep-$j),$b,2,$align,$fill); + $i=$sep+1; + } + $sep=-1; + $j=$i; + $l=0; + $ns=0; + $nl++; + if($border && $nl==2) + $b=$b2; + } + else + $i++; + } + //Last chunk + if($this->ws>0) + { + $this->ws=0; + $this->_out('0 Tw'); + } + if($border && strpos($border,'B')!==false) + $b.='B'; + $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); + $this->x=$this->lMargin; +} + +function Write($h, $txt, $link='') +{ + //Output text in flowing mode + $cw=&$this->CurrentFont['cw']; + $w=$this->w-$this->rMargin-$this->x; + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; + $s=str_replace("\r",'',$txt); + $nb=strlen($s); + $sep=-1; + $i=0; + $j=0; + $l=0; + $nl=1; + while($i<$nb) + { + //Get next character + $c=$s[$i]; + if($c=="\n") + { + //Explicit line break + $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link); + $i++; + $sep=-1; + $j=$i; + $l=0; + if($nl==1) + { + $this->x=$this->lMargin; + $w=$this->w-$this->rMargin-$this->x; + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; + } + $nl++; + continue; + } + if($c==' ') + $sep=$i; + $l+=$cw[$c]; + if($l>$wmax) + { + //Automatic line break + if($sep==-1) + { + if($this->x>$this->lMargin) + { + //Move to next line + $this->x=$this->lMargin; + $this->y+=$h; + $w=$this->w-$this->rMargin-$this->x; + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; + $i++; + $nl++; + continue; + } + if($i==$j) + $i++; + $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link); + } + else + { + $this->Cell($w,$h,substr($s,$j,$sep-$j),0,2,'',0,$link); + $i=$sep+1; + } + $sep=-1; + $j=$i; + $l=0; + if($nl==1) + { + $this->x=$this->lMargin; + $w=$this->w-$this->rMargin-$this->x; + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; + } + $nl++; + } + else + $i++; + } + //Last chunk + if($i!=$j) + $this->Cell($l/1000*$this->FontSize,$h,substr($s,$j),0,0,'',0,$link); +} + +function Ln($h=null) +{ + //Line feed; default value is last cell height + $this->x=$this->lMargin; + if($h===null) + $this->y+=$this->lasth; + else + $this->y+=$h; +} + +function Image($file, $x=null, $y=null, $w=0, $h=0, $type='', $link='') +{ + //Put an image on the page + if(!isset($this->images[$file])) + { + //First use of this image, get info + if($type=='') + { + $pos=strrpos($file,'.'); + if(!$pos) + $this->Error('Image file has no extension and no type was specified: '.$file); + $type=substr($file,$pos+1); + } + $type=strtolower($type); + if($type=='jpeg') + $type='jpg'; + $mtd='_parse'.$type; + if(!method_exists($this,$mtd)) + $this->Error('Unsupported image type: '.$type); + $info=$this->$mtd($file); + $info['i']=count($this->images)+1; + $this->images[$file]=$info; + } + else + $info=$this->images[$file]; + //Automatic width and height calculation if needed + if($w==0 && $h==0) + { + //Put image at 72 dpi + $w=$info['w']/$this->k; + $h=$info['h']/$this->k; + } + elseif($w==0) + $w=$h*$info['w']/$info['h']; + elseif($h==0) + $h=$w*$info['h']/$info['w']; + //Flowing mode + if($y===null) + { + if($this->y+$h>$this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak()) + { + //Automatic page break + $x2=$this->x; + $this->AddPage($this->CurOrientation,$this->CurPageFormat); + $this->x=$x2; + } + $y=$this->y; + $this->y+=$h; + } + if($x===null) + $x=$this->x; + $this->_out(sprintf('q %.2F 0 0 %.2F %.2F %.2F cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i'])); + if($link) + $this->Link($x,$y,$w,$h,$link); +} + +function GetX() +{ + //Get x position + return $this->x; +} + +function SetX($x) +{ + //Set x position + if($x>=0) + $this->x=$x; + else + $this->x=$this->w+$x; +} + +function GetY() +{ + //Get y position + return $this->y; +} + +function SetY($y) +{ + //Set y position and reset x + $this->x=$this->lMargin; + if($y>=0) + $this->y=$y; + else + $this->y=$this->h+$y; +} + +function SetXY($x, $y) +{ + //Set x and y positions + $this->SetY($y); + $this->SetX($x); +} + +function Output($name='', $dest='') +{ + //Output PDF to some destination + if($this->state<3) + $this->Close(); + $dest=strtoupper($dest); + if($dest=='') + { + if($name=='') + { + $name='doc.pdf'; + $dest='I'; + } + else + $dest='F'; + } + switch($dest) + { + case 'I': + //Send to standard output + if(ob_get_length()) + $this->Error('Some data has already been output, can\'t send PDF file'); + if(php_sapi_name()!='cli') + { + //We send to a browser + header('Content-Type: application/pdf'); + if(headers_sent()) + $this->Error('Some data has already been output, can\'t send PDF file'); + header('Content-Length: '.strlen($this->buffer)); + header('Content-Disposition: inline; filename="'.$name.'"'); + header('Cache-Control: private, max-age=0, must-revalidate'); + header('Pragma: public'); + ini_set('zlib.output_compression','0'); + } + echo $this->buffer; + break; + case 'D': + //Download file + if(ob_get_length()) + $this->Error('Some data has already been output, can\'t send PDF file'); + header('Content-Type: application/x-download'); + if(headers_sent()) + $this->Error('Some data has already been output, can\'t send PDF file'); + header('Content-Length: '.strlen($this->buffer)); + header('Content-Disposition: attachment; filename="'.$name.'"'); + header('Cache-Control: private, max-age=0, must-revalidate'); + header('Pragma: public'); + ini_set('zlib.output_compression','0'); + echo $this->buffer; + break; + case 'F': + //Save to local file + $f=fopen($name,'wb'); + if(!$f) + $this->Error('Unable to create output file: '.$name); + fwrite($f,$this->buffer,strlen($this->buffer)); + fclose($f); + break; + case 'S': + //Return as a string + return $this->buffer; + default: + $this->Error('Incorrect output destination: '.$dest); + } + return ''; +} + +/******************************************************************************* +* * +* Protected methods * +* * +*******************************************************************************/ +function _dochecks() +{ + //Check availability of %F + if(sprintf('%.1F',1.0)!='1.0') + $this->Error('This version of PHP is not supported'); + //Check mbstring overloading + if(ini_get('mbstring.func_overload') & 2) + $this->Error('mbstring overloading must be disabled'); + //Disable runtime magic quotes + if(get_magic_quotes_runtime()) + @set_magic_quotes_runtime(0); +} + +function _getpageformat($format) +{ + $format=strtolower($format); + if(!isset($this->PageFormats[$format])) + $this->Error('Unknown page format: '.$format); + $a=$this->PageFormats[$format]; + return array($a[0]/$this->k, $a[1]/$this->k); +} + +function _getfontpath() +{ + if(!defined('FPDF_FONTPATH') && is_dir(dirname(__FILE__).'/font')) + define('FPDF_FONTPATH',dirname(__FILE__).'/font/'); + return defined('FPDF_FONTPATH') ? FPDF_FONTPATH : ''; +} + +function _beginpage($orientation, $format) +{ + $this->page++; + $this->pages[$this->page]=''; + $this->state=2; + $this->x=$this->lMargin; + $this->y=$this->tMargin; + $this->FontFamily=''; + //Check page size + if($orientation=='') + $orientation=$this->DefOrientation; + else + $orientation=strtoupper($orientation[0]); + if($format=='') + $format=$this->DefPageFormat; + else + { + if(is_string($format)) + $format=$this->_getpageformat($format); + } + if($orientation!=$this->CurOrientation || $format[0]!=$this->CurPageFormat[0] || $format[1]!=$this->CurPageFormat[1]) + { + //New size + if($orientation=='P') + { + $this->w=$format[0]; + $this->h=$format[1]; + } + else + { + $this->w=$format[1]; + $this->h=$format[0]; + } + $this->wPt=$this->w*$this->k; + $this->hPt=$this->h*$this->k; + $this->PageBreakTrigger=$this->h-$this->bMargin; + $this->CurOrientation=$orientation; + $this->CurPageFormat=$format; + } + if($orientation!=$this->DefOrientation || $format[0]!=$this->DefPageFormat[0] || $format[1]!=$this->DefPageFormat[1]) + $this->PageSizes[$this->page]=array($this->wPt, $this->hPt); +} + +function _endpage() +{ + $this->state=1; +} + +function _escape($s) +{ + //Escape special characters in strings + $s=str_replace('\\','\\\\',$s); + $s=str_replace('(','\\(',$s); + $s=str_replace(')','\\)',$s); + $s=str_replace("\r",'\\r',$s); + return $s; +} + +function _textstring($s) +{ + //Format a text string + return '('.$this->_escape($s).')'; +} + +function _UTF8toUTF16($s) +{ + //Convert UTF-8 to UTF-16BE with BOM + $res="\xFE\xFF"; + $nb=strlen($s); + $i=0; + while($i<$nb) + { + $c1=ord($s[$i++]); + if($c1>=224) + { + //3-byte character + $c2=ord($s[$i++]); + $c3=ord($s[$i++]); + $res.=chr((($c1 & 0x0F)<<4) + (($c2 & 0x3C)>>2)); + $res.=chr((($c2 & 0x03)<<6) + ($c3 & 0x3F)); + } + elseif($c1>=192) + { + //2-byte character + $c2=ord($s[$i++]); + $res.=chr(($c1 & 0x1C)>>2); + $res.=chr((($c1 & 0x03)<<6) + ($c2 & 0x3F)); + } + else + { + //Single-byte character + $res.="\0".chr($c1); + } + } + return $res; +} + +function _dounderline($x, $y, $txt) +{ + //Underline text + $up=$this->CurrentFont['up']; + $ut=$this->CurrentFont['ut']; + $w=$this->GetStringWidth($txt)+$this->ws*substr_count($txt,' '); + return sprintf('%.2F %.2F %.2F %.2F re f',$x*$this->k,($this->h-($y-$up/1000*$this->FontSize))*$this->k,$w*$this->k,-$ut/1000*$this->FontSizePt); +} + +function _parsejpg($file) +{ + //Extract info from a JPEG file + $a=GetImageSize($file); + if(!$a) + $this->Error('Missing or incorrect image file: '.$file); + if($a[2]!=2) + $this->Error('Not a JPEG file: '.$file); + if(!isset($a['channels']) || $a['channels']==3) + $colspace='DeviceRGB'; + elseif($a['channels']==4) + $colspace='DeviceCMYK'; + else + $colspace='DeviceGray'; + $bpc=isset($a['bits']) ? $a['bits'] : 8; + //Read whole file + $f=fopen($file,'rb'); + $data=''; + while(!feof($f)) + $data.=fread($f,8192); + fclose($f); + return array('w'=>$a[0], 'h'=>$a[1], 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'DCTDecode', 'data'=>$data); +} + +function _parsepng($file) +{ + //Extract info from a PNG file + $f=fopen($file,'rb'); + if(!$f) + $this->Error('Can\'t open image file: '.$file); + //Check signature + if($this->_readstream($f,8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10)) + $this->Error('Not a PNG file: '.$file); + //Read header chunk + $this->_readstream($f,4); + if($this->_readstream($f,4)!='IHDR') + $this->Error('Incorrect PNG file: '.$file); + $w=$this->_readint($f); + $h=$this->_readint($f); + $bpc=ord($this->_readstream($f,1)); + if($bpc>8) + $this->Error('16-bit depth not supported: '.$file); + $ct=ord($this->_readstream($f,1)); + if($ct==0) + $colspace='DeviceGray'; + elseif($ct==2) + $colspace='DeviceRGB'; + elseif($ct==3) + $colspace='Indexed'; + else + $this->Error('Alpha channel not supported: '.$file); + if(ord($this->_readstream($f,1))!=0) + $this->Error('Unknown compression method: '.$file); + if(ord($this->_readstream($f,1))!=0) + $this->Error('Unknown filter method: '.$file); + if(ord($this->_readstream($f,1))!=0) + $this->Error('Interlacing not supported: '.$file); + $this->_readstream($f,4); + $parms='/DecodeParms <>'; + //Scan chunks looking for palette, transparency and image data + $pal=''; + $trns=''; + $data=''; + do + { + $n=$this->_readint($f); + $type=$this->_readstream($f,4); + if($type=='PLTE') + { + //Read palette + $pal=$this->_readstream($f,$n); + $this->_readstream($f,4); + } + elseif($type=='tRNS') + { + //Read transparency info + $t=$this->_readstream($f,$n); + if($ct==0) + $trns=array(ord(substr($t,1,1))); + elseif($ct==2) + $trns=array(ord(substr($t,1,1)), ord(substr($t,3,1)), ord(substr($t,5,1))); + else + { + $pos=strpos($t,chr(0)); + if($pos!==false) + $trns=array($pos); + } + $this->_readstream($f,4); + } + elseif($type=='IDAT') + { + //Read image data block + $data.=$this->_readstream($f,$n); + $this->_readstream($f,4); + } + elseif($type=='IEND') + break; + else + $this->_readstream($f,$n+4); + } + while($n); + if($colspace=='Indexed' && empty($pal)) + $this->Error('Missing palette in '.$file); + fclose($f); + return array('w'=>$w, 'h'=>$h, 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'FlateDecode', 'parms'=>$parms, 'pal'=>$pal, 'trns'=>$trns, 'data'=>$data); +} + +function _readstream($f, $n) +{ + //Read n bytes from stream + $res=''; + while($n>0 && !feof($f)) + { + $s=fread($f,$n); + if($s===false) + $this->Error('Error while reading stream'); + $n-=strlen($s); + $res.=$s; + } + if($n>0) + $this->Error('Unexpected end of stream'); + return $res; +} + +function _readint($f) +{ + //Read a 4-byte integer from stream + $a=unpack('Ni',$this->_readstream($f,4)); + return $a['i']; +} + +function _parsegif($file) +{ + //Extract info from a GIF file (via PNG conversion) + if(!function_exists('imagepng')) + $this->Error('GD extension is required for GIF support'); + if(!function_exists('imagecreatefromgif')) + $this->Error('GD has no GIF read support'); + $im=imagecreatefromgif($file); + if(!$im) + $this->Error('Missing or incorrect image file: '.$file); + imageinterlace($im,0); + $tmp=tempnam('.','gif'); + if(!$tmp) + $this->Error('Unable to create a temporary file'); + if(!imagepng($im,$tmp)) + $this->Error('Error while saving to temporary file'); + imagedestroy($im); + $info=$this->_parsepng($tmp); + unlink($tmp); + return $info; +} + +function _newobj() +{ + //Begin a new object + $this->n++; + $this->offsets[$this->n]=strlen($this->buffer); + $this->_out($this->n.' 0 obj'); +} + +function _putstream($s) +{ + $this->_out('stream'); + $this->_out($s); + $this->_out('endstream'); +} + +function _out($s) +{ + //Add a line to the document + if($this->state==2) + $this->pages[$this->page].=$s."\n"; + else + $this->buffer.=$s."\n"; +} + +function _putpages() +{ + $nb=$this->page; + if(!empty($this->AliasNbPages)) + { + //Replace number of pages + for($n=1;$n<=$nb;$n++) + $this->pages[$n]=str_replace($this->AliasNbPages,$nb,$this->pages[$n]); + } + if($this->DefOrientation=='P') + { + $wPt=$this->DefPageFormat[0]*$this->k; + $hPt=$this->DefPageFormat[1]*$this->k; + } + else + { + $wPt=$this->DefPageFormat[1]*$this->k; + $hPt=$this->DefPageFormat[0]*$this->k; + } + $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; + for($n=1;$n<=$nb;$n++) + { + //Page + $this->_newobj(); + $this->_out('<_out('/Parent 1 0 R'); + if(isset($this->PageSizes[$n])) + $this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]',$this->PageSizes[$n][0],$this->PageSizes[$n][1])); + $this->_out('/Resources 2 0 R'); + if(isset($this->PageLinks[$n])) + { + //Links + $annots='/Annots ['; + foreach($this->PageLinks[$n] as $pl) + { + $rect=sprintf('%.2F %.2F %.2F %.2F',$pl[0],$pl[1],$pl[0]+$pl[2],$pl[1]-$pl[3]); + $annots.='<_textstring($pl[4]).'>>>>'; + else + { + $l=$this->links[$pl[4]]; + $h=isset($this->PageSizes[$l[0]]) ? $this->PageSizes[$l[0]][1] : $hPt; + $annots.=sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>',1+2*$l[0],$h-$l[1]*$this->k); + } + } + $this->_out($annots.']'); + } + $this->_out('/Contents '.($this->n+1).' 0 R>>'); + $this->_out('endobj'); + //Page content + $p=($this->compress) ? gzcompress($this->pages[$n]) : $this->pages[$n]; + $this->_newobj(); + $this->_out('<<'.$filter.'/Length '.strlen($p).'>>'); + $this->_putstream($p); + $this->_out('endobj'); + } + //Pages root + $this->offsets[1]=strlen($this->buffer); + $this->_out('1 0 obj'); + $this->_out('<_out($kids.']'); + $this->_out('/Count '.$nb); + $this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]',$wPt,$hPt)); + $this->_out('>>'); + $this->_out('endobj'); +} + +function _putfonts() +{ + $nf=$this->n; + foreach($this->diffs as $diff) + { + //Encodings + $this->_newobj(); + $this->_out('<>'); + $this->_out('endobj'); + } + foreach($this->FontFiles as $file=>$info) + { + //Font file embedding + $this->_newobj(); + $this->FontFiles[$file]['n']=$this->n; + $font=''; + $f=fopen($this->_getfontpath().$file,'rb',1); + if(!$f) + $this->Error('Font file not found'); + while(!feof($f)) + $font.=fread($f,8192); + fclose($f); + $compressed=(substr($file,-2)=='.z'); + if(!$compressed && isset($info['length2'])) + { + $header=(ord($font[0])==128); + if($header) + { + //Strip first binary header + $font=substr($font,6); + } + if($header && ord($font[$info['length1']])==128) + { + //Strip second binary header + $font=substr($font,0,$info['length1']).substr($font,$info['length1']+6); + } + } + $this->_out('<_out('/Filter /FlateDecode'); + $this->_out('/Length1 '.$info['length1']); + if(isset($info['length2'])) + $this->_out('/Length2 '.$info['length2'].' /Length3 0'); + $this->_out('>>'); + $this->_putstream($font); + $this->_out('endobj'); + } + foreach($this->fonts as $k=>$font) + { + //Font objects + $this->fonts[$k]['n']=$this->n+1; + $type=$font['type']; + $name=$font['name']; + if($type=='core') + { + //Standard font + $this->_newobj(); + $this->_out('<_out('/BaseFont /'.$name); + $this->_out('/Subtype /Type1'); + if($name!='Symbol' && $name!='ZapfDingbats') + $this->_out('/Encoding /WinAnsiEncoding'); + $this->_out('>>'); + $this->_out('endobj'); + } + elseif($type=='Type1' || $type=='TrueType') + { + //Additional Type1 or TrueType font + $this->_newobj(); + $this->_out('<_out('/BaseFont /'.$name); + $this->_out('/Subtype /'.$type); + $this->_out('/FirstChar 32 /LastChar 255'); + $this->_out('/Widths '.($this->n+1).' 0 R'); + $this->_out('/FontDescriptor '.($this->n+2).' 0 R'); + if($font['enc']) + { + if(isset($font['diff'])) + $this->_out('/Encoding '.($nf+$font['diff']).' 0 R'); + else + $this->_out('/Encoding /WinAnsiEncoding'); + } + $this->_out('>>'); + $this->_out('endobj'); + //Widths + $this->_newobj(); + $cw=&$font['cw']; + $s='['; + for($i=32;$i<=255;$i++) + $s.=$cw[chr($i)].' '; + $this->_out($s.']'); + $this->_out('endobj'); + //Descriptor + $this->_newobj(); + $s='<$v) + $s.=' /'.$k.' '.$v; + $file=$font['file']; + if($file) + $s.=' /FontFile'.($type=='Type1' ? '' : '2').' '.$this->FontFiles[$file]['n'].' 0 R'; + $this->_out($s.'>>'); + $this->_out('endobj'); + } + else + { + //Allow for additional types + $mtd='_put'.strtolower($type); + if(!method_exists($this,$mtd)) + $this->Error('Unsupported font type: '.$type); + $this->$mtd($font); + } + } +} + +function _putimages() +{ + $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; + reset($this->images); + while(list($file,$info)=each($this->images)) + { + $this->_newobj(); + $this->images[$file]['n']=$this->n; + $this->_out('<_out('/Subtype /Image'); + $this->_out('/Width '.$info['w']); + $this->_out('/Height '.$info['h']); + if($info['cs']=='Indexed') + $this->_out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]'); + else + { + $this->_out('/ColorSpace /'.$info['cs']); + if($info['cs']=='DeviceCMYK') + $this->_out('/Decode [1 0 1 0 1 0 1 0]'); + } + $this->_out('/BitsPerComponent '.$info['bpc']); + if(isset($info['f'])) + $this->_out('/Filter /'.$info['f']); + if(isset($info['parms'])) + $this->_out($info['parms']); + if(isset($info['trns']) && is_array($info['trns'])) + { + $trns=''; + for($i=0;$i_out('/Mask ['.$trns.']'); + } + $this->_out('/Length '.strlen($info['data']).'>>'); + $this->_putstream($info['data']); + unset($this->images[$file]['data']); + $this->_out('endobj'); + //Palette + if($info['cs']=='Indexed') + { + $this->_newobj(); + $pal=($this->compress) ? gzcompress($info['pal']) : $info['pal']; + $this->_out('<<'.$filter.'/Length '.strlen($pal).'>>'); + $this->_putstream($pal); + $this->_out('endobj'); + } + } +} + +function _putxobjectdict() +{ + foreach($this->images as $image) + $this->_out('/I'.$image['i'].' '.$image['n'].' 0 R'); +} + +function _putresourcedict() +{ + $this->_out('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); + $this->_out('/Font <<'); + foreach($this->fonts as $font) + $this->_out('/F'.$font['i'].' '.$font['n'].' 0 R'); + $this->_out('>>'); + $this->_out('/XObject <<'); + $this->_putxobjectdict(); + $this->_out('>>'); +} + +function _putresources() +{ + $this->_putfonts(); + $this->_putimages(); + //Resource dictionary + $this->offsets[2]=strlen($this->buffer); + $this->_out('2 0 obj'); + $this->_out('<<'); + $this->_putresourcedict(); + $this->_out('>>'); + $this->_out('endobj'); +} + +function _putinfo() +{ + $this->_out('/Producer '.$this->_textstring('FPDF '.FPDF_VERSION)); + if(!empty($this->title)) + $this->_out('/Title '.$this->_textstring($this->title)); + if(!empty($this->subject)) + $this->_out('/Subject '.$this->_textstring($this->subject)); + if(!empty($this->author)) + $this->_out('/Author '.$this->_textstring($this->author)); + if(!empty($this->keywords)) + $this->_out('/Keywords '.$this->_textstring($this->keywords)); + if(!empty($this->creator)) + $this->_out('/Creator '.$this->_textstring($this->creator)); + $this->_out('/CreationDate '.$this->_textstring('D:'.@date('YmdHis'))); +} + +function _putcatalog() +{ + $this->_out('/Type /Catalog'); + $this->_out('/Pages 1 0 R'); + if($this->ZoomMode=='fullpage') + $this->_out('/OpenAction [3 0 R /Fit]'); + elseif($this->ZoomMode=='fullwidth') + $this->_out('/OpenAction [3 0 R /FitH null]'); + elseif($this->ZoomMode=='real') + $this->_out('/OpenAction [3 0 R /XYZ null null 1]'); + elseif(!is_string($this->ZoomMode)) + $this->_out('/OpenAction [3 0 R /XYZ null null '.($this->ZoomMode/100).']'); + if($this->LayoutMode=='single') + $this->_out('/PageLayout /SinglePage'); + elseif($this->LayoutMode=='continuous') + $this->_out('/PageLayout /OneColumn'); + elseif($this->LayoutMode=='two') + $this->_out('/PageLayout /TwoColumnLeft'); +} + +function _putheader() +{ + $this->_out('%PDF-'.$this->PDFVersion); +} + +function _puttrailer() +{ + $this->_out('/Size '.($this->n+1)); + $this->_out('/Root '.$this->n.' 0 R'); + $this->_out('/Info '.($this->n-1).' 0 R'); +} + +function _enddoc() +{ + $this->_putheader(); + $this->_putpages(); + $this->_putresources(); + //Info + $this->_newobj(); + $this->_out('<<'); + $this->_putinfo(); + $this->_out('>>'); + $this->_out('endobj'); + //Catalog + $this->_newobj(); + $this->_out('<<'); + $this->_putcatalog(); + $this->_out('>>'); + $this->_out('endobj'); + //Cross-ref + $o=strlen($this->buffer); + $this->_out('xref'); + $this->_out('0 '.($this->n+1)); + $this->_out('0000000000 65535 f '); + for($i=1;$i<=$this->n;$i++) + $this->_out(sprintf('%010d 00000 n ',$this->offsets[$i])); + //Trailer + $this->_out('trailer'); + $this->_out('<<'); + $this->_puttrailer(); + $this->_out('>>'); + $this->_out('startxref'); + $this->_out($o); + $this->_out('%%EOF'); + $this->state=3; +} +//End of class +} + +//Handle special IE contype request +if(isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT']=='contype') +{ + header('Content-Type: application/pdf'); + exit; +} + +?> diff --git a/includes/fpdf/license.txt b/includes/fpdf/license.txt new file mode 100755 index 00000000..fd811c6f --- /dev/null +++ b/includes/fpdf/license.txt @@ -0,0 +1,6 @@ +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software to use, copy, modify, distribute, sublicense, and/or sell +copies of the software, and to permit persons to whom the software is furnished +to do so. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. \ No newline at end of file diff --git a/includes/javascript/controls.js b/includes/javascript/controls.js index 664b62a0..bf24ddc3 100644 --- a/includes/javascript/controls.js +++ b/includes/javascript/controls.js @@ -42,7 +42,7 @@ Ajax.Autocompleter = Class.create(); Ajax.Autocompleter.prototype = (new Ajax.Base()).extend({ initialize: function(element, update, url, options) { this.element = $(element); - this.hidden = element+'_hidden'; //agileco add + this.hidden = element+'_hidden'; //agileco add this.update = $(update); this.has_focus = false; this.changed = false; @@ -262,4 +262,4 @@ Ajax.Autocompleter.prototype = (new Ajax.Base()).extend({ id = Element.collectTextNodesIgnoreClass(this.get_current_entry(), 'name', 'informal' ).unescapeHTML(); // agileco add document.getElementById(this.hidden).value = id; // agileco add } -}); \ No newline at end of file +}); diff --git a/includes/pdf/invoice_base.inc.php b/includes/pdf/invoice_base.inc.php deleted file mode 100644 index 88b9720e..00000000 --- a/includes/pdf/invoice_base.inc.php +++ /dev/null @@ -1,254 +0,0 @@ -Execute(sqlSelect($db,"setup_invoice","*","")); - } - $this->billToCompany = $rs->fields['bill_to_company']; - $this->invoiceCurrency = $rs->fields['invoice_currency']; - $this->invoiceDecimals = $rs->fields['invoice_decimals']; - $this->itemsSummaryMax = $rs->fields['items_summary_max']; - $this->news = $rs->fields['news']; - $this->pageType = $rs->fields['page_type']; - $this->show_itemized = $rs->fields['invoice_show_itemized']; - $this->show_service_range = $rs->fields['invoice_show_service_dates']; - $this->contact_us_url = $rs->fields['contact_us_url']; - $this->contact_us_phone = $rs->fields['contact_us_phone']; - #$this->currency; - $this->currency = $rs->fields['invoice_currency']; - } - - function drawCustom() { - } - - function getTemplate() { - return PATH_INCLUDES."pdf/invoice.pdf"; - } - - function drawCompanyLogo() { - } - - function drawCompanyAddress() { - } - - function drawAccountMailing() { - } - - function drawAccountId() { - } - - function drawAccountName() { - } - - function drawAccountUsername() { - } - - function drawAccountAddress() { - } - - function drawInvoiceNo() { - } - - function drawInvoiceCreatedDate() { - } - - function drawInvoiceRange() { - } - - function drawInvoiceDueDate() { - } - - function drawInvoiceTotalAmt() { - } - - function drawInvoicePaidAmt() { - } - - function drawInvoiceDueAmt() { - } - - function drawInvoiceDiscountAmt() { - } - - function drawInvoiceDueNotice() { - } - - function drawInvoicePaidNotice() { - } - - function drawInvoiceTaxAmt() { - } - - function drawInvoiceShippingAmt() { - } - - /** - * Actual second plus pages of details. This is the constructor. - */ - function drawLineItems_pre($iteration) { - } - - /** - * This is called for each line item on the second plus pages of details. - */ - function drawLineItems(&$db, &$line) { - } - - /** - * Draws the summary on the first page - */ - function drawSummaryLineItems($items) { - } - - /** - * Assigns the invoice fields to this object. - */ - function setInvoiceFields($flds) { - $this->invoice = $flds; - } - - /** - * Assigns the account fields to this object. - */ - function setAccountFields($flds) { - $this->account = $flds; - } - - /** - * Assigns the item summary fields to this object. - */ - function setItemsSummary($items) { - $this->itemsSummary = $items; - } - - function setItemsFull($items) { - $this->itemsFull = $items; - } - - function setDateRange($periodStart, $periodEnd) { - $this->dateRange = date(UNIX_DATE_FORMAT, $periodStart) . ' - ' . date(UNIX_DATE_FORMAT, $periodEnd); - } - - function setCurrency($currency) { - $this->invoiceCurrency = $currency; - } - - function setDecimals($decimals) { - $this->invoiceDecimals = $decimals; - } - - function setLateFeeNotice() { - } - - function setDueAmt($amt) { - $this->invoiceDueAmt=$amt; - } - - function setNetTerms($terms) { - $this->netTerms=$terms; - } - - function _currency($num) { - global $C_list; - if($this->invoiceDecimals>3) - return $this->invoiceCurrency . number_format($num, $this->invoiceDecimals); - else - return $C_list->format_currency_num($num, $this->invoice['actual_billed_currency_id']); - } - - - function _putpages() { - $nb=$this->page; - if(!empty($this->AliasNbPages)) - { - //Replace number of pages - for($n=1;$n<=$nb;$n++) - $this->pages[$n]=($this->compress) ? gzcompress(str_replace($this->AliasNbPages,$nb,gzuncompress($this->pages[$n]))) : str_replace($this->AliasNbPages,$nb,$this->pages[$n]) ; - } - if($this->DefOrientation=='P') - { - $wPt=$this->fwPt; - $hPt=$this->fhPt; - } - else - { - $wPt=$this->fhPt; - $hPt=$this->fwPt; - } - $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; - for($n=1;$n<=$nb;$n++) - { - //Page - $this->_newobj(); - $this->_out('<_out('/Parent 1 0 R'); - if(isset($this->OrientationChanges[$n])) - $this->_out(sprintf('/MediaBox [0 0 %.2f %.2f]',$hPt,$wPt)); - $this->_out('/Resources 2 0 R'); - if(isset($this->PageLinks[$n])) - { - //Links - $annots='/Annots ['; - foreach($this->PageLinks[$n] as $pl) - { - $rect=sprintf('%.2f %.2f %.2f %.2f',$pl[0],$pl[1],$pl[0]+$pl[2],$pl[1]-$pl[3]); - $annots.='<_textstring($pl[4]).'>>>>'; - else - { - $l=$this->links[$pl[4]]; - $h=isset($this->OrientationChanges[$l[0]]) ? $wPt : $hPt; - $annots.=sprintf('/Dest [%d 0 R /XYZ 0 %.2f null]>>',1+2*$l[0],$h-$l[1]*$this->k); - } - } - $this->_out($annots.']'); - } - $this->_out('/Contents '.($this->n+1).' 0 R>>'); - $this->_out('endobj'); - //Page content - $this->_newobj(); - $this->_out('<<'.$filter.'/Length '.strlen($this->pages[$n]).'>>'); - $this->_putstream($this->pages[$n]); - $this->_out('endobj'); - } - //Pages root - $this->offsets[1]=strlen($this->buffer); - $this->_out('1 0 obj'); - $this->_out('<_out($kids.']'); - $this->_out('/Count '.$nb); - $this->_out(sprintf('/MediaBox [0 0 %.2f %.2f]',$wPt,$hPt)); - $this->_out('>>'); - $this->_out('endobj'); - } - - function _endpage() { - //End of page contents - $this->pages[$this->page] = ($this->compress) ? gzcompress($this->pages[$this->page]) : $this->pages[$this->page]; - $this->state=1; - } - -} - -?> \ No newline at end of file diff --git a/includes/pdf/pdf_invoice_overview.inc.php b/includes/pdf/pdf_invoice_overview.inc.php deleted file mode 100644 index 9982d801..00000000 --- a/includes/pdf/pdf_invoice_overview.inc.php +++ /dev/null @@ -1,278 +0,0 @@ -Image(PATH_THEMES.'default/images/invoice_logo.jpg',$x,$y,$width); - } - - // draw the company address - function drawCompanyAddress() { - // add the company address on the payment stub (1) - $this->SetFont('times','B', 10); - $this->SetXY(18,202); $this->Cell(50,10, $this->companyName); - $this->SetXY(18,206); $this->Cell(50,10, $this->companyAddress); - $this->SetXY(18,210); $this->Cell(50,10, $this->companyCity. ", ". $this->companyState . " " . $this->companyZip); - } - - function drawAccountMailing() { - // add the company address on the payment stub (2) - $this->SetFont('times','B', 10); - - if($this->billToCompany && !empty($this->account['company'])) - $name = $this->account['company']; - else - $name = $this->account['first_name'].' '.$this->account['last_name']; - - $this->SetXY(120,240); $this->Cell(10,10, html_entity_decode($name,ENT_NOQUOTES)); - $this->SetXY(120,244); $this->Cell(50,10, $this->account['address1'] .' '. $this->account['address2']); - $this->SetXY(120,248); $this->Cell(50,10, $this->account['city'] . ", ". $this->account['state'] . " " . $this->account['zip']); - } - - function drawAccountId() { - $this->SetFont('times','B',11); - $this->SetXY(28, 39.5); - $this->Cell(10,10, $this->account['id']); // add to top of invoice - - } - - function drawAccountName() { - $this->SetFont('times','B',11); - $this->SetXY(36, 44); - if($this->billToCompany && !empty($this->account['company'])) - $this->Cell(10,10, html_entity_decode($this->account['company'],ENT_NOQUOTES)); - else - $this->Cell(10,10, html_entity_decode($this->account['first_name'].' '.$this->account['last_name'],ENT_NOQUOTES)); - } - - function drawAccountUsername() { - $this->SetFont('times','B',11); - $this->SetXY(161, 44); - $this->Cell(10,10, $this->account['username']); - } - - function drawAccountAddress() { - $this->SetFont('times','B',11); - } - - function drawInvoiceNo() { - $this->SetFont('times','',11); - $this->SetXY(180, 222); - $this->Cell(10,10, $this->invoice["id"]); // draw at the bottom of invoice - } - - function drawInvoiceRange() { - if($this->show_service_range) { - global $C_translate; - $this->SetFont('times','B',11); - $this->SetXY(8,85.5); - $this->Cell(50,10, $C_translate->translate('pdf_service_range_month','setup_invoice') . " {$this->dateRange}"); - } - } - - function drawInvoiceDueDate() { - $this->SetFont('times','B',11); - $this->SetXY(161, 39.5); - $this->Cell(10,10, date(UNIX_DATE_FORMAT, $this->invoice['due_date'])); // draw at top of invoice - - $this->SetFont('times','',11); - $this->SetXY(151, 222); - $this->Cell(10,10, date(UNIX_DATE_FORMAT, $this->invoice['due_date']),0,0,'C'); // draw at the bottom of invoice - } - - function drawInvoiceTotalAmt() { - $this->SetXY(147.5,72); - $this->Cell(10,10, $this->_currency($this->invoice['total_amt']),0,0,'C'); // draw at the top - } - - function drawInvoicePaidAmt() { - $this->SetFont('times','',11); - $this->SetXY(47,72); - $this->Cell(10,10, $this->_currency($this->invoice['billed_amt']), 0,0,'C'); - } - - function drawInvoiceDueAmt() { - $this->SetFont('times','',11); - - $this->SetXY(114,72); - $this->Cell(10,10, $this->_currency($this->invoiceDueAmt),0,0,'C'); // draw at the top - - $this->SetXY(181,72); - $this->Cell(10,10, $this->_currency($this->invoiceDueAmt),0,0,'C'); // draw at the top - - $this->SetXY(123, 222); - $this->Cell(10,10, $this->_currency($this->invoiceDueAmt),0,0,'C'); // draw at the bottom - } - - function drawInvoiceDiscountAmt() { - $this->SetXY(80.5, 72); - $this->Cell(10,10, $this->_currency($this->invoice['discount_amt']), 0,0,'C'); - } - - function drawInvoiceTaxAmt() { - $this->SetFont('times','',11); - $this->SetXY(16,72); - $this->Cell(10,10, $this->_currency($this->invoice['tax_amt']),0,0,'C'); // draw at the top - } - - /** - * Called before begining to loop the invoice_item table. Used to set initial values. - */ - function drawLineItems_pre($iteration) { - $this->iteration = $iteration; - if($iteration>0) - return false; - $this->i = 0; - $this->y = 0; - return true; - } - - /** - * Called once per line item to add to the PDF invoice. - */ - function drawSubLineItems(&$db, $line) { - global $C_translate; - if ($this->i == 0 || $this->i%51 == 0) { - $this->AddPage(); - - $this->SetFont('times','B',12); - $this->SetXY(3,10); $this->Cell(0,0,$C_translate->translate('pdf_itemized_charges','setup_invoice')); - $this->Cell(0,0,$C_translate->translate('pdf_page','setup_invoice').$this->PageNo(),0,0,'R'); - $this->SetXY(3,10); $this->Cell(0,0,$C_translate->translate('pdf_invoice_number_small','setup_invoice').$this->invoice['id'],0,0,'C'); - - # Draw table headers - $this->SetFont('times','B',8); - $this->SetXY(9,20); - $this->Cell(0,0,$C_translate->translate('pdf_item_description','setup_invoice')); - $this->SetX(145); - $this->Cell(0,0,$C_translate->translate('pdf_item_quantity','setup_invoice')); - $this->SetX(170); - $this->Cell(10,0,$C_translate->translate('pdf_item_cost','setup_invoice'),0,0,'R'); - $this->SetX(145); - $this->Cell(0,0,$C_translate->translate('pdf_item_amount','setup_invoice'),0,0,'R'); - $this->Line(9,21,200,21); - $this->y = 24; - $this->SetY($this->y); - } - - $this->SetFont('times','',8); - $this->SetX(18); - $this->Cell(0,0, $line); - - $this->y += 5; - $this->SetY($this->y); - $this->i++; - } - - /** - * Called once per line item to add to the PDF invoice. - */ - function drawLineItems(&$db, &$line) { - global $C_translate; - if ($this->i == 0 || $this->i%51 == 0) { - $this->AddPage(); - - $this->SetFont('times','B',12); - $this->SetXY(3,10); $this->Cell(0,0,$C_translate->translate('pdf_itemized_charges','setup_invoice')); - $this->Cell(0,0,$C_translate->translate('pdf_page','setup_invoice').$this->PageNo(),0,0,'R'); - $this->SetXY(3,10); $this->Cell(0,0,$C_translate->translate('pdf_invoice_number_small','setup_invoice').$this->invoice['id'],0,0,'C'); - - # Draw table headers - $this->SetFont('times','B',8); - $this->SetXY(9,20); - $this->Cell(0,0,$C_translate->translate('pdf_item_description','setup_invoice')); - $this->SetX(145); - $this->Cell(0,0,$C_translate->translate('pdf_item_quantity','setup_invoice')); - $this->SetX(170); - $this->Cell(10,0,$C_translate->translate('pdf_item_cost','setup_invoice'),0,0,'R'); - $this->SetX(145); - $this->Cell(0,0,$C_translate->translate('pdf_item_amount','setup_invoice'),0,0,'R'); - $this->Line(9,21,200,21); - $this->y = 24; - $this->SetY($this->y); - } - - $this->SetFont('times','',8); - $this->SetX(9); - $this->Cell(0,0, $line['name']); - $this->SetX(170); - $this->Cell(10,0, $this->_currency($line['amount']/$line['qty']),0,0,'R'); - $this->SetX(145); - $this->Cell(10,0, $line['qty'],0,0,'R'); - $this->SetX(145); - $this->Cell(0,0, $this->_currency($line['amount']), 0,0,'R'); - $this->y += 5; - $this->SetY($this->y); - $this->i++; - - # Draw attributes if they are present - if (strlen($line['attr'])) { - $atrs = preg_split("/\r\n/", str_replace('\r\n',"\r\n",$line['attr'])); - foreach ($atrs as $a) { - $parts = preg_split("/==/", $a); - switch ($parts[0]) { - default: - if(strlen($parts[0])) - $this->drawSubLineItems($db, $parts[0].": ".$parts[1]); - break; - } - } - } - } - - function drawSummaryLineItems($items) { - global $C_translate; - if (!$this->show_itemized) return; - - $y = 105; - $this->SetY($y); - $this->SetFont('times','',11); - - $i=0; - if(is_array($items)) { - foreach($items as $line) { - $val = $line['name']; - $this->SetX(9); - $this->Cell(0,0, $val); - $this->SetX(145); - $this->Cell(0,0, $this->_currency($line['amount']), 0,0,'R'); - $y += 5; - $this->SetY($y); - $i++; - if($i > $this->itemsSummaryMax) { - $this->SetFont('times','B',11); - $this->SetX(9); - $this->Cell(0,0,$C_translate->translate('pdf_summary','setup_invoice')); - break; - } - } - } - } -} -?> \ No newline at end of file diff --git a/includes/pdf/pdf_invoice_voip-detailed.inc.php b/includes/pdf/pdf_invoice_voip-detailed.inc.php deleted file mode 100644 index ce3c7ac4..00000000 --- a/includes/pdf/pdf_invoice_voip-detailed.inc.php +++ /dev/null @@ -1,406 +0,0 @@ -pageType == 2) - return PATH_INCLUDES."pdf/invoice2.pdf"; - return PATH_INCLUDES."pdf/invoice1.pdf"; - } - - // draw the logo - function drawCompanyLogo() { - $x = 9; - $y = 7; - $width = 50; - if(is_file(PATH_THEMES.DEFAULT_THEME.'/images/invoice_logo.png')) - $this->Image(PATH_THEMES.DEFAULT_THEME.'/images/invoice_logo.png',$x,$y,$width); - } - - // draw the company address - function drawCompanyAddress() { - global $C_translate; - - // add the company address on the payment stub (1) - $this->SetFont('arial','B', 13); - $this->SetXY(18,202); $this->Cell(0,0,$C_translate->translate('pdf_payment_coupon','setup_invoice')); - $this->SetFont('arial','', 8); - $this->SetXY(18,206); $this->Cell(0,0,$C_translate->translate('pdf_return1','setup_invoice')); - $this->SetXY(18,209); $this->Cell(0,0,$C_translate->translate('pdf_return2','setup_invoice').$this->companyName); - - $this->SetFont('arial','', 10); - $x = 18; $y = 216; - if ($this->pageType == 2) { - $y = 230; - } - $this->SetXY(18,$y); $this->Cell(0,0, $this->companyName); $y += 4; - $this->SetXY(18,$y); $this->Cell(0,0, $this->companyAddress); $y += 4; - $this->SetXY(18,$y); $this->Cell(0,0, $this->companyCity. ", ". $this->companyState . " " . $this->companyZip); $y += 4; - } - - function drawAccountMailing() { - // add the company address on the payment stub (2) - $this->SetFont('arial','B', 10); - - if($this->billToCompany && !empty($this->account['company'])) - $name = $this->account['company']; - else - $name = $this->account['first_name'].' '.$this->account['last_name']; - - $x = 110; $y = 248; - if ($this->pageType == 2) { - $x = 18; $y = 268; - } - $this->SetXY($x,$y); $this->Cell(0,0, html_entity_decode($name,ENT_NOQUOTES)); $y += 4; - $this->SetXY($x,$y); $this->Cell(0,0, $this->account['address1'] .' '. $this->account['address2']); $y += 4; - $this->SetXY($x,$y); $this->Cell(0,0, $this->account['city'] . ", ". $this->account['state'] . " " . $this->account['zip']); $y += 4; - } - - function drawAccountId() { - global $C_translate; - $this->SetFont('arial','',11); - $this->SetXY(110, 205); $this->Cell(0,0,$C_translate->translate('pdf_account_number','setup_invoice')); - $this->SetXY(150, 205); - $this->Cell(0,0, $this->account['id']); // add to bottom of invoice - - } - - function drawAccountUsername() { - global $C_translate; - $this->SetFont('arial','B',11); - $this->SetXY(95, 18); $this->Cell(0,0,$C_translate->translate('pdf_account_username','setup_invoice')); - $this->SetXY(201,18); $this->Cell(0,0,$this->account['username'],0,0,'R'); - - $this->SetFont('arial','',11); - $this->SetXY(95,30); - $contact = $C_translate->translate('pdf_contact','setup_invoice')."\n"; - $contact .= $C_translate->translate('pdf_contact_online','setup_invoice').$this->contact_us_url."\n"; - $contact .= $C_translate->translate('pdf_contact_phone','setup_invoice').$this->contact_us_phone; - $this->MultiCell(0,4,$contact); - - $this->SetXY(9,170); - $this->MultiCell(0, 4, str_replace('\n',"\n",$this->news)); - } - - function drawAccountAddress() { - $this->SetFont('times','B',11); - } - - function drawInvoiceNo() { - global $C_translate; - $this->SetFont('arial','B',11); - $this->SetXY(95, 14); $this->Cell(0,0,$C_translate->translate('pdf_invoice_number','setup_invoice')); - $this->SetXY(201, 14); $this->Cell(0,0, $this->invoice['id'],0,0,'R'); // add to bottom of invoice - - $this->SetFont('arial','',11); - $this->SetXY(110, 210); $this->Cell(0,0,$C_translate->translate('pdf_invoice_number','setup_invoice')); - $this->SetXY(150, 210); $this->Cell(0,0, $this->invoice['id']); // add to bottom of invoice - } - - function drawInvoiceDueDate() { - global $C_translate; - $this->SetFont('arial','B',11); - $this->SetXY(95,10); $this->Cell(0,0,$C_translate->translate('pdf_billing_date','setup_invoice')); - $this->SetXY(201,10); $this->Cell(0,0, date(UNIX_DATE_FORMAT, $this->invoice['due_date']),0,0,'R'); // draw at top of invoice - - $this->SetFont('arial','',11); - $this->SetXY(110, 200); $this->Cell(0,0,$C_translate->translate('pdf_bill_date','setup_invoice')); - $this->SetXY(150, 200); - $this->Cell(0,0, date(UNIX_DATE_FORMAT, $this->invoice['due_date'])); // draw at the bottom of invoice - } - - function drawInvoiceTotalAmt() { - global $C_translate; - $this->SetFont('arial','B',11); - $this->SetXY(95, 22); $this->Cell(0,0,$C_translate->translate('pdf_current_charges','setup_invoice')); - $this->SetXY(201, 22); $this->Cell(0,0, $this->_currency($this->invoice['total_amt']),0,0,'R'); // draw at the top - - $this->SetFont('arial','',9); - $this->SetXY(110, 222); $this->Cell(0,0,$C_translate->translate('pdf_current_charges','setup_invoice')); - $this->SetXY(201, 222); $this->Cell(0,0, $this->_currency($this->invoice['total_amt']),0,0,'R'); // draw at the top - } - - function drawInvoiceDueAmt() { - global $C_translate; - $this->SetFont('times','',11); - - $this->SetFont('arial','',9); - $this->SetXY(110, 226); $this->Cell(0,0,$C_translate->translate('pdf_amount_due_by','setup_invoice').date(UNIX_DATE_FORMAT, $this->invoice['due_date'])); - $this->SetXY(201, 226); $this->Cell(0,0, $this->_currency($this->invoiceDueAmt),0,0,'R'); - - $this->SetXY(110, 230); $this->Cell(0,0,$C_translate->translate('pdf_make_check','setup_invoice')); - $this->SetXY(110, 234); $this->Cell(0,0,$this->companyName); - } - - /** - * Called before begining to loop the invoice_item table. Used to set initial values. - */ - function drawLineItems_pre($iteration) { - $this->iteration = $iteration; - if($iteration>1) - return false; - - # Include the voip class - include_once(PATH_MODULES.'voip/voip.inc.php'); - $this->v = new voip; - $this->i = 0; - $this->y = 0; - return true; - } - - /** - * Called once per line item to add to the PDF invoice. This function serves to - * direct each iteration to a different function which handles a specific piece - * of the PDF building puzzle. - */ - function drawLineItems(&$db, &$line) { - switch($this->iteration) { - case 0: - $this->drawLineItems_0($db, $line); - break; - case 1: - $this->drawLineItems_1($db, $line); - break; - default: - echo 'Unknown PDF iteration encountered. Halting.'; - exit; - } - } - - /** - * Draws the non-VoIP related items for iteration 0. - */ - function drawLineItems_0(&$db, &$line) { - global $C_translate; - if ($line['price_type'] == 0 && $line['item_type']==5) - return; - - if ($this->i == 0 || $this->i%51 == 0) { - $this->AddPage(); - - $this->SetFont('arial','B',12); - $this->SetXY(3,10); $this->Cell(0,0,$C_translate->translate('pdf_itemized_charges','setup_invoice')); - $this->Cell(0,0,$C_translate->translate('pdf_page','setup_invoice').$this->PageNo(),0,0,'R'); - $this->SetXY(3,10); $this->Cell(0,0,$C_translate->translate('pdf_invoice_number_small','setup_invoice').$this->invoice['id'],0,0,'C'); - - # Draw table headers - $this->SetFont('arial','B',8); - $this->SetXY(9,20); - $this->Cell(0,0,$C_translate->translate('pdf_item_description','setup_invoice')); - $this->SetX(145); - $this->Cell(0,0,$C_translate->translate('pdf_item_quantity','setup_invoice')); - $this->SetX(170); - $this->Cell(10,0,$C_translate->translate('pdf_item_cost','setup_invoice'),0,0,'R'); - $this->SetX(145); - $this->Cell(0,0,$C_translate->translate('pdf_item_amount','setup_invoice'),0,0,'R'); - $this->Line(9,21,200,21); - $this->y = 24; - $this->SetY($this->y); - } - - $this->SetFont('arial','',8); - $this->SetX(9); - $this->Cell(0,0, $line['name']); - $this->SetX(170); - $this->Cell(10,0, $this->_currency($line['price_base']),0,0,'R'); - $this->SetX(145); - $this->Cell(10,0, $line['qty'],0,0,'R'); - $this->SetX(145); - $this->Cell(0,0, $this->_currency($line['total_amt']), 0,0,'R'); - $this->y += 5; - $this->SetY($this->y); - $this->i++; - } - - /** - * Draws the VoIP Calling Detail for Iteration 1. - */ - function drawLineItems_1(&$db, &$line) { - global $C_translate; - if($this->show_itemized != 1) return; - if($line['price_type'] != 0 || $line['item_type'] != 5) - return; - - if ($this->i == 0 || $this->i%51 == 0) { - $this->AddPage(); - - $this->SetFont('arial','B',12); - $this->SetXY(3,10); $this->Cell(0,0,$C_translate->translate('pdf_itemized_calls','setup_invoice')); - $this->Cell(0,0,$C_translate->translate('pdf_page','setup_invoice').$this->PageNo(),0,0,'R'); - $this->SetXY(3,10); $this->Cell(0,0,$C_translate->translate('pdf_invoice_number_small','setup_invoice').$this->invoice['id'],0,0,'C'); - - # Draw table headers - $this->SetFont('arial','B',8); - $this->SetXY(9,20); - $this->Cell(0,0,$C_translate->translate('pdf_item_from','setup_invoice')); - $this->SetX(69); - $this->Cell(0,0,$C_translate->translate('pdf_item_to','setup_invoice')); - $this->SetX(119); - $this->Cell(0,0,'Date & Time'); - $this->SetX(160); - $this->Cell(10,0,'Seconds' /*$C_translate->translate('pdf_item_min','setup_invoice')*/,0,0,'R'); - $this->SetX(145); - $this->Cell(0,0,$C_translate->translate('pdf_item_amount','setup_invoice'),0,0,'R'); - $this->Line(9,21,200,21); - $this->y = 24; - $this->SetY($this->y); - } - - if ($line['price_type'] != 0) { - $this->SetFont('arial','I',6); - } else { - $this->SetFont('arial','',6); - } - - $val = $line['name']; - if (strlen($line['attr'])) { - $val = ""; - $atrs = preg_split("/\r\n/", str_replace('\r\n',"\r\n",$line['attr'])); - foreach ($atrs as $a) { - $parts = preg_split("/==/", $a); - switch ($parts[0]) { - case "Destination": - $this->SetX(69); - $this->Cell(0,0,$parts[1]); - $cc = ""; $npa = ""; $nxx = ""; $e164 = ""; - if ($this->v->e164($parts[1], $e164, $cc, $npa, $nxx)) { - $this->SetX(89); - $this->Cell(0,0,substr($this->v->where_is($db, $cc, $npa, $nxx), 0, 20)); - } - break; - case "Source": - $this->SetX(9); - $this->Cell(0,0,$parts[1]); - $cc = ""; $npa = ""; $nxx = ""; $e164 = ""; - if ($this->v->e164($parts[1], $e164, $cc, $npa, $nxx)) { - $this->SetX(29); - $this->Cell(0,0,substr($this->v->where_is($db, $cc, $npa, $nxx), 0, 20)); - } - break; - case "parent_service_id": - $sql = sqlSelect($db,"service","prod_attr","id=::".$parts[1]."::"); - $rstmp = $db->Execute($sql); - $atrs2 = split("\r\n", $rstmp->fields['prod_attr']); - foreach ($atrs2 as $a2) { - $parts2 = split("==", $a2); - switch ($parts2[0]) { - case "station": - case "ported": - $val = $line['name']." for ".$parts2[1]; - break; - default: - break; - } - } - break; - case "station": - case "ported": - $val = $line['name']." for ".$parts[1]; - break; - case "date_orig": - $this->SetX(119); - $this->Cell(0,0,date(UNIX_DATE_FORMAT." H:i:s",$parts[1])); - break; - case "voip_cdr_id": - $sql = "SELECT billsec, amount FROM ".AGILE_DB_PREFIX."voip_cdr WHERE site_id=".DEFAULT_SITE." AND id=".$parts[1]; - $row = $db->GetRow($sql); - $this->SetX(160); - $this->Cell(10,0,$row[0],0,0,'R'); - $this->SetX(160); - $this->Cell(0,0,$this->_currency($row[1]),0,0,'R'); - $val = ""; - default: - break; - } - } - } - - $this->SetX(9); - $this->Cell(0,0, $val); - if ($line['price_type'] == 0) { - $this->SetX(160); - //$this->Cell(10,0, $line['qty']." M",0,0,'R'); - } else { - $q = $line['qty']; - if(empty($q)) $q = 1; - $this->SetX(160); - $this->Cell(10,0, $line['qty'],0,0,'R'); - // } - $this->SetX(145); - $this->Cell(0,0, $this->_currency($line['amount']), 0,0,'R'); - } - $this->y += 5; - $this->SetY($this->y); - $this->i++; - } - - function drawSummaryLineItems($items) { - global $C_translate; - #if (!$this->show_itemized) return; - - # Include the voip class - include_once(PATH_MODULES.'voip/voip.inc.php'); - $v = new voip; - $db = &DB(); - - $this->SetFont('arial','B',11); - $y = 70; - $this->SetY($y); - - $this->SetX(9); $this->Cell(0,0,$C_translate->translate('pdf_cur_charge_summary','setup_invoice').$this->dateRange); - $y += 5; - $this->SetY($y); - - $this->SetFont('arial','',9); - - $i=0; - if(is_array($items)) { - foreach($items as $line) { - $val = $line['name']; - $this->SetX(9); - if (@$line['item_type'] == 5) { - $val = $line['quantity'].$C_translate->translate('pdf_combine_minutes','setup_invoice'); - } - $q = $line['quantity']; - if(empty($q)) $q = 1; - $this->Cell(0,0, $q); - $this->SetX(18); - $this->Cell(0,0, $val); - $this->SetX(145); - $this->Cell(0,0, $this->_currency($line['amount']), 0,0,'R'); - $y += 5; - $this->SetY($y); - $i++; - if($i > $this->itemsSummaryMax) { - $this->SetFont('arial','B',11); - $this->SetX(9); - $this->Cell(0,0,$C_translate->translate('pdf_summary','setup_invoice')); - break; - } - } - } - } -} - -?> \ No newline at end of file diff --git a/includes/pdf/pdf_invoice_voip.inc.php b/includes/pdf/pdf_invoice_voip.inc.php deleted file mode 100644 index be1b90a7..00000000 --- a/includes/pdf/pdf_invoice_voip.inc.php +++ /dev/null @@ -1,321 +0,0 @@ -pageType == 2) - return PATH_INCLUDES."pdf/invoice2.pdf"; - return PATH_INCLUDES."pdf/invoice1.pdf"; - } - - // draw the logo - function drawCompanyLogo() { - $x = 9; - $y = 7; - $width = 50; - if(is_file(PATH_THEMES.DEFAULT_THEME.'/images/invoice_logo.png')) - $this->Image(PATH_THEMES.DEFAULT_THEME.'/images/invoice_logo.png',$x,$y,$width); - } - - // draw the company address - function drawCompanyAddress() { - global $C_translate; - // add the company address on the payment stub (1) - $this->SetFont('arial','B', 13); - $this->SetXY(18,202); $this->Cell(0,0,$C_translate->translate('pdf_payment_coupon','setup_invoice')); - $this->SetFont('arial','', 8); - $this->SetXY(18,206); $this->Cell(0,0,$C_translate->translate('pdf_return1','setup_invoice')); - $this->SetXY(18,209); $this->Cell(0,0,$C_translate->translate('pdf_return2','setup_invoice').$this->companyName); - - $this->SetFont('arial','', 10); - $x = 18; $y = 216; - if ($this->pageType == 2) { - $y = 230; - } - $this->SetXY(18,$y); $this->Cell(0,0, $this->companyName); $y += 4; - $this->SetXY(18,$y); $this->Cell(0,0, $this->companyAddress); $y += 4; - $this->SetXY(18,$y); $this->Cell(0,0, $this->companyCity. ", ". $this->companyState . " " . $this->companyZip); $y += 4; - } - - function drawAccountMailing() { - // add the company address on the payment stub (2) - $this->SetFont('arial','B', 10); - - if($this->billToCompany && !empty($this->account['company'])) - $name = $this->account['company']; - else - $name = $this->account['first_name'].' '.$this->account['last_name']; - - $x = 110; $y = 248; - if ($this->pageType == 2) { - $x = 18; $y = 268; - } - $this->SetXY($x,$y); $this->Cell(0,0, html_entity_decode($name,ENT_NOQUOTES)); $y += 4; - $this->SetXY($x,$y); $this->Cell(0,0, $this->account['address1'] .' '. $this->account['address2']); $y += 4; - $this->SetXY($x,$y); $this->Cell(0,0, $this->account['city'] . ", ". $this->account['state'] . " " . $this->account['zip']); $y += 4; - } - - function drawAccountId() { - global $C_translate; - $this->SetFont('arial','',11); - $this->SetXY(110, 205); $this->Cell(0,0,$C_translate->translate('pdf_account_number','setup_invoice')); - $this->SetXY(150, 205); - $this->Cell(0,0, $this->account['id']); // add to bottom of invoice - - } - - function drawAccountUsername() { - global $C_translate; - $this->SetFont('arial','B',11); - $this->SetXY(95, 18); $this->Cell(0,0,$C_translate->translate('pdf_account_username','setup_invoice')); - $this->SetXY(201,18); $this->Cell(0,0,$this->account['username'],0,0,'R'); - - $this->SetFont('arial','',11); - $this->SetXY(95,30); - $contact = $C_translate->translate('pdf_contact','setup_invoice')."\n"; - $contact .= $C_translate->translate('pdf_contact_online','setup_invoice').$this->contact_us_url."\n"; - $contact .= $C_translate->translate('pdf_contact_phone','setup_invoice').$this->contact_us_phone; - $this->MultiCell(0,4,$contact); - - $this->SetXY(9,170); - $this->MultiCell(0, 4, str_replace('\n',"\n",$this->news)); - } - - function drawAccountAddress() { - $this->SetFont('times','B',11); - } - - function drawInvoiceNo() { - global $C_translate; - $this->SetFont('arial','B',11); - $this->SetXY(95, 14); $this->Cell(0,0,$C_translate->translate('pdf_invoice_number','setup_invoice')); - $this->SetXY(201, 14); $this->Cell(0,0, $this->invoice['id'],0,0,'R'); // add to bottom of invoice - - $this->SetFont('arial','',11); - $this->SetXY(110, 210); $this->Cell(0,0,$C_translate->translate('pdf_invoice_number','setup_invoice')); - $this->SetXY(150, 210); $this->Cell(0,0, $this->invoice['id']); // add to bottom of invoice - } - - function drawInvoiceDueDate() { - global $C_translate; - $this->SetFont('arial','B',11); - $this->SetXY(95,10); $this->Cell(0,0,$C_translate->translate('pdf_billing_date','setup_invoice')); - $this->SetXY(201,10); $this->Cell(0,0, date(UNIX_DATE_FORMAT, $this->invoice['due_date']),0,0,'R'); // draw at top of invoice - - $this->SetFont('arial','',11); - $this->SetXY(110, 200); $this->Cell(0,0,$C_translate->translate('pdf_bill_date','setup_invoice')); - $this->SetXY(150, 200); - $this->Cell(0,0, date(UNIX_DATE_FORMAT, $this->invoice['due_date'])); // draw at the bottom of invoice - } - - function drawInvoiceTotalAmt() { - global $C_translate; - $this->SetFont('arial','B',11); - $this->SetXY(95, 22); $this->Cell(0,0,$C_translate->translate('pdf_current_charges','setup_invoice')); - $this->SetXY(201, 22); $this->Cell(0,0, $this->_currency($this->invoice['total_amt']),0,0,'R'); // draw at the top - - $this->SetFont('arial','',9); - $this->SetXY(110, 222); $this->Cell(0,0,$C_translate->translate('pdf_current_charges','setup_invoice')); - $this->SetXY(201, 222); $this->Cell(0,0, $this->_currency($this->invoice['total_amt']),0,0,'R'); // draw at the top - } - - function drawInvoiceDueAmt() { - global $C_translate; - $this->SetFont('times','',11); - - $this->SetFont('arial','',9); - $this->SetXY(110, 226); $this->Cell(0,0,$C_translate->translate('pdf_amount_due_by','setup_invoice').date(UNIX_DATE_FORMAT, $this->invoice['due_date'])); - $this->SetXY(201, 226); $this->Cell(0,0, $this->_currency($this->invoiceDueAmt),0,0,'R'); - - $this->SetXY(110, 230); $this->Cell(0,0,$C_translate->translate('pdf_make_check','setup_invoice')); - $this->SetXY(110, 234); $this->Cell(0,0,$this->companyName); - } - - /** - * Called before begining to loop the invoice_item table. Used to set initial values. - */ - function drawLineItems_pre($iteration) { - $this->iteration = $iteration; - if($iteration>0) - return false; - # Include the voip class - include_once(PATH_MODULES.'voip/voip.inc.php'); - $this->v = new voip; - $this->i = 0; - $this->y = 0; - return true; - } - - /** - * Called once per line item to add to the PDF invoice. - */ - function drawLineItems(&$db, &$line) { - global $C_translate; - if ($this->i == 0 || $this->i%51 == 0) { - $this->AddPage(); - - $this->SetFont('arial','B',12); - $this->SetXY(3,10); $this->Cell(0,0,$C_translate->translate('pdf_itemized_calls','setup_invoice')); - $this->Cell(0,0,$C_translate->translate('pdf_page','setup_invoice').$this->PageNo(),0,0,'R'); - $this->SetXY(3,10); $this->Cell(0,0,$C_translate->translate('pdf_invoice_number_small','setup_invoice').$this->invoice['id'],0,0,'C'); - - # Draw table headers - $this->SetFont('arial','B',8); - $this->SetXY(9,20); - $this->Cell(0,0,$C_translate->translate('pdf_item_from','setup_invoice')); - $this->SetX(75); - $this->Cell(0,0,$C_translate->translate('pdf_item_to','setup_invoice')); - $this->SetX(160); - $this->Cell(10,0,$C_translate->translate('pdf_item_min','setup_invoice'),0,0,'R'); - $this->SetX(145); - $this->Cell(0,0,$C_translate->translate('pdf_item_amount','setup_invoice'),0,0,'R'); - $this->Line(9,21,200,21); - $this->y = 24; - $this->SetY($this->y); - } - - if ($line['price_type'] != 0) { - $this->SetFont('arial','I',8); - } else { - $this->SetFont('arial','',8); - } - - $val = $line['name']; - if (strlen($line['attr'])) { - $val = ""; - $atrs = preg_split("/\r\n/", str_replace('\r\n',"\r\n",$line['attr'])); - foreach ($atrs as $a) { - $parts = preg_split("/==/", $a); - switch ($parts[0]) { - case "Destination": - $this->SetX(75); - $this->Cell(0,0,$parts[1]); - $cc = ""; $npa = ""; $nxx = ""; $e164 = ""; - if ($this->v->e164($parts[1], $e164, $cc, $npa, $nxx)) { - $this->SetX(115); - $this->Cell(0,0,substr($this->v->where_is($db, $cc, $npa, $nxx), 0, 20)); - } - break; - case "Source": - $this->SetX(9); - $this->Cell(0,0,$parts[1]); - $cc = ""; $npa = ""; $nxx = ""; $e164 = ""; - if ($this->v->e164($parts[1], $e164, $cc, $npa, $nxx)) { - $this->SetX(39); - $this->Cell(0,0,substr($this->v->where_is($db, $cc, $npa, $nxx), 0, 20)); - } - break; - case "parent_service_id": - $sql = sqlSelect($db,"service","prod_attr","id=::".$parts[1]."::"); - $rstmp = $db->Execute($sql); - $atrs2 = preg_split("/\r\n/", $rstmp->fields['prod_attr']); - foreach ($atrs2 as $a2) { - $parts2 = preg_split("/==/", $a2); - switch ($parts2[0]) { - case "station": - case "ported": - $val = $line['name']." for ".$parts2[1]; - break; - default: - break; - } - } - break; - case "station": - case "ported": - $val = $line['name']." for ".$parts[1]; - break; - default: - break; - } - } - } - - $this->SetX(9); - $this->Cell(0,0, $val); - if ($line['price_type'] == 0) { - $this->SetX(160); - $this->Cell(10,0, $line['qty']." M",0,0,'R'); - } else { - $q = $line['qty']; - if(empty($q)) $q = 1; - $this->SetX(160); - $this->Cell(10,0, $line['qty'],0,0,'R'); - } - $this->SetX(145); - $this->Cell(0,0, $this->_currency($line['total_amt']), 0,0,'R'); - $this->y += 5; - $this->SetY($this->y); - $this->i++; - } - - function drawSummaryLineItems($items) { - global $C_translate; - if (!$this->show_itemized) return; - - # Include the voip class - include_once(PATH_MODULES.'voip/voip.inc.php'); - $v = new voip; - $db = &DB(); - - $this->SetFont('arial','B',11); - $y = 70; - $this->SetY($y); - - $this->SetX(9); $this->Cell(0,0,$C_translate->translate('pdf_cur_charge_summary','setup_invoice').$this->dateRange); - $y += 5; - $this->SetY($y); - - $this->SetFont('arial','',9); - - $i=0; - if(is_array($items)) { - foreach($items as $line) { - $val = $line['name']; - $this->SetX(9); - if (@$line['item_type'] == 5) { - $val = $line['quantity'].$C_translate->translate('pdf_combine_minutes','setup_invoice'); - } - $q = $line['quantity']; - if(empty($q)) $q = 1; - $this->Cell(0,0, $q); - $this->SetX(18); - $this->Cell(0,0, $val); - $this->SetX(145); - $this->Cell(0,0, $this->_currency($line['amount']), 0,0,'R'); - $y += 5; - $this->SetY($y); - $i++; - if($i > $this->itemsSummaryMax) { - $this->SetFont('arial','B',11); - $this->SetX(9); - $this->Cell(0,0,$C_translate->translate('pdf_summary','setup_invoice')); - break; - } - } - } - } -} - -?> \ No newline at end of file diff --git a/includes/smarty/plugins/block.account.php b/includes/smarty/plugins/block.account.php deleted file mode 100644 index 6d98de30..00000000 --- a/includes/smarty/plugins/block.account.php +++ /dev/null @@ -1,20 +0,0 @@ -account($resource); - } -} -?> \ No newline at end of file diff --git a/includes/smarty/plugins/block.group.php b/includes/smarty/plugins/block.group.php deleted file mode 100644 index dd91e05f..00000000 --- a/includes/smarty/plugins/block.group.php +++ /dev/null @@ -1,38 +0,0 @@ -qstr(DEFAULT_SITE) . ' AND - status = ' . $db->qstr('1') . ' AND - id = ' . $db->qstr($id); - @$result = $db->Execute($sql); - $do = false; - if(@$result->RecordCount() > 0) { - global $C_auth; - @$arr = unserialize($result->fields['group_avail']); - for($i=0; $iauth_group_by_id($arr[$i])) - $do = true; - } - - if($do) { - echo $resource; - } else { - echo @$params["msg"]; - } -} -?> \ No newline at end of file diff --git a/includes/smarty/plugins/block.htmlarea.php b/includes/smarty/plugins/block.htmlarea.php deleted file mode 100644 index 4375931e..00000000 --- a/includes/smarty/plugins/block.htmlarea.php +++ /dev/null @@ -1,55 +0,0 @@ -'.$resource.' - '; - } -} -?> \ No newline at end of file diff --git a/includes/smarty/plugins/block.is_auth.php b/includes/smarty/plugins/block.is_auth.php deleted file mode 100644 index 6a315d89..00000000 --- a/includes/smarty/plugins/block.is_auth.php +++ /dev/null @@ -1,23 +0,0 @@ -auth_method_by_name($params["module"], $params["method"])) - echo $resource; - else - echo $params["alt"]; -} -?> \ No newline at end of file diff --git a/includes/smarty/plugins/block.is_auth_method.php b/includes/smarty/plugins/block.is_auth_method.php deleted file mode 100644 index 3d975959..00000000 --- a/includes/smarty/plugins/block.is_auth_method.php +++ /dev/null @@ -1,25 +0,0 @@ -auth_method_by_name($params["module"], $params["method"])) - echo $resource; - else if(!empty($params["alt"])) - echo $params["alt"]; -} -?> \ No newline at end of file diff --git a/includes/smarty/plugins/block.panel.php b/includes/smarty/plugins/block.panel.php deleted file mode 100644 index 2c8d7f6a..00000000 --- a/includes/smarty/plugins/block.panel.php +++ /dev/null @@ -1,39 +0,0 @@ - $_val) - if(empty($_ignore["$_key"])) - $vals .= " $_key=\"$_val\""; - else - $$_key = $_val; - - $pre = "<{$type}"; - if(!$show) - $pre .= " style=\"display:none\""; - $pre .= $vals; - $pre .= ">\r\n"; - - $pre .= $resource; - - $pre .= "\r\n"; - - return $pre; -} -?> \ No newline at end of file diff --git a/includes/smarty/plugins/block.translate.php b/includes/smarty/plugins/block.translate.php deleted file mode 100644 index 15a100b9..00000000 --- a/includes/smarty/plugins/block.translate.php +++ /dev/null @@ -1,38 +0,0 @@ -value["$module"]["$key"] = $val; - } - - - - $resource = trim($resource); - if ($resource != '') { - # strip whitespaces from the resouce identifier - echo $C_translate->translate($resource,$module,''); - } -} -?> \ No newline at end of file diff --git a/includes/smarty/plugins/function.ab_version.php b/includes/smarty/plugins/function.ab_version.php deleted file mode 100644 index 4bee78f2..00000000 --- a/includes/smarty/plugins/function.ab_version.php +++ /dev/null @@ -1,19 +0,0 @@ -smarty(); - -} - -?> diff --git a/includes/smarty/plugins/function.assign.php b/includes/smarty/plugins/function.assign.php deleted file mode 100644 index 0eb29602..00000000 --- a/includes/smarty/plugins/function.assign.php +++ /dev/null @@ -1,30 +0,0 @@ -trigger_error("assign: missing 'var' parameter"); - return; - } - - if (!in_array('value', array_keys($params))) { - $smarty->trigger_error("assign: missing 'value' parameter"); - return; - } - - $smarty->assign($var, $value); -} - -/* vim: set expandtab: */ - -?> diff --git a/includes/smarty/plugins/function.block.php b/includes/smarty/plugins/function.block.php deleted file mode 100644 index 54aadcc8..00000000 --- a/includes/smarty/plugins/function.block.php +++ /dev/null @@ -1,29 +0,0 @@ -display('file:' . PATH_THEMES . '' . THEME_NAME . '/' . $smarty->template_dir . '' . $block . '.tpl'); - } else { - if(is_file(PATH_THEMES . '' . THEME_NAME . '/blocks/' . $module . '/' . $block . '.tpl')) - $this->display('file:'. PATH_THEMES . '' . THEME_NAME . '/blocks/' . $module . '/' . $block . '.tpl' ); - elseif (is_file(PATH_THEMES . '' . DEF_THEME_N . '/blocks/' . $module . '/' . $block . '.tpl')) - $this->display('file:' . PATH_THEMES . '' . DEF_THEME_N . '/blocks/' . $module . '/' . $block . '.tpl'); - elseif (is_file(PATH_THEMES . 'default/blocks/' . $module . '/' . $block . '.tpl')) - $this->display('file:' . PATH_THEMES . 'default/blocks/' . $module . '/' . $block . '.tpl'); - else - $this->display('file:'. PATH_THEMES . '' . DEF_THEME_N . '/blocks/core/invalid_page.tpl'); - } -} -?> \ No newline at end of file diff --git a/includes/smarty/plugins/function.date.php b/includes/smarty/plugins/function.date.php deleted file mode 100644 index 8279b1da..00000000 --- a/includes/smarty/plugins/function.date.php +++ /dev/null @@ -1,16 +0,0 @@ - \ No newline at end of file diff --git a/includes/smarty/plugins/function.date_time.php b/includes/smarty/plugins/function.date_time.php deleted file mode 100644 index 3332f754..00000000 --- a/includes/smarty/plugins/function.date_time.php +++ /dev/null @@ -1,18 +0,0 @@ - \ No newline at end of file diff --git a/includes/smarty/plugins/function.db_lookup.php b/includes/smarty/plugins/function.db_lookup.php deleted file mode 100644 index c5803b54..00000000 --- a/includes/smarty/plugins/function.db_lookup.php +++ /dev/null @@ -1,33 +0,0 @@ -trigger_error("db_lookup: attribute 'id' required"); - return false; - } - if (empty($table)) { - $smarty->trigger_error("db_lookup: attribute 'table' required"); - return false; - } - if (empty($field)) { - $smarty->trigger_error("db_lookup: attribute 'field' required"); - return false; - } - - $db =& DB(); - $rs = $db->Execute(sqlSelect($db, $table, $field, "id=::".$id."::")); - return $rs->fields[0]; -} - -?> diff --git a/includes/smarty/plugins/function.exe.php b/includes/smarty/plugins/function.exe.php deleted file mode 100644 index 94111fd2..00000000 --- a/includes/smarty/plugins/function.exe.php +++ /dev/null @@ -1,22 +0,0 @@ -exe_noauth($module,$method); - else - echo $m->exe($module,$method); -} -?> \ No newline at end of file diff --git a/includes/smarty/plugins/function.graph.php b/includes/smarty/plugins/function.graph.php deleted file mode 100644 index f9e0e8eb..00000000 --- a/includes/smarty/plugins/function.graph.php +++ /dev/null @@ -1,41 +0,0 @@ -translate($title,$module); - if(!empty($trans)) $title = $trans; - } - - if($show === false) $display = 'style="display:none"'; - - global $VAR; - $vars = ''; - foreach($VAR as $a => $b) $vars .= "&{$a}={$b}"; - - - echo "
"; - echo "

$title

"; - echo InsertChart ( "includes/charts/charts.swf", "includes/charts/charts_library", URL."ajax.php?do[]={$module}:{$method}{$vars}", $width, $height, $color, $transparency); - echo "
"; -} -?> \ No newline at end of file diff --git a/includes/smarty/plugins/function.grid_bool.php b/includes/smarty/plugins/function.grid_bool.php deleted file mode 100644 index c60d880f..00000000 --- a/includes/smarty/plugins/function.grid_bool.php +++ /dev/null @@ -1,20 +0,0 @@ - \ No newline at end of file diff --git a/includes/smarty/plugins/function.grid_column_heading.php b/includes/smarty/plugins/function.grid_column_heading.php deleted file mode 100644 index 84c4b047..00000000 --- a/includes/smarty/plugins/function.grid_column_heading.php +++ /dev/null @@ -1,31 +0,0 @@ -'; - return; - } - - echo ''; - echo ''; - - global $C_translate; - - if($column == 'id') - echo ''.$C_translate->translate("id").''; - else - echo ''.$C_translate->translate("field_".$column,$module).''; -} - -?> diff --git a/includes/smarty/plugins/function.grid_column_refine.php b/includes/smarty/plugins/function.grid_column_refine.php deleted file mode 100644 index 37913e7f..00000000 --- a/includes/smarty/plugins/function.grid_column_refine.php +++ /dev/null @@ -1,26 +0,0 @@ -'; - echo ''; - - if($column == 'id') - echo ''; - else - echo ''; -} - -?> \ No newline at end of file diff --git a/includes/smarty/plugins/function.html_bool.php b/includes/smarty/plugins/function.html_bool.php deleted file mode 100644 index c8ce124d..00000000 --- a/includes/smarty/plugins/function.html_bool.php +++ /dev/null @@ -1,28 +0,0 @@ -'; - - return $ret; - -} -?> \ No newline at end of file diff --git a/includes/smarty/plugins/function.html_button.php b/includes/smarty/plugins/function.html_button.php deleted file mode 100644 index 083b3a98..00000000 --- a/includes/smarty/plugins/function.html_button.php +++ /dev/null @@ -1,58 +0,0 @@ - $_val) $$_key = $_val; - - # translate name - global $C_translate; - $trans = $C_translate->translate($name, $module); - if(!empty($trans)) $name = $trans; - - # allow multiple clicks? - if(!$allowdclick) $action = "this.disabled=true; this.value='". $C_translate->translate('processing') ."';" . $action; - - # change state(s) - $t = 0; - if($hide) { - $e = 'Fade'; - if(ereg(',', $hide)) $hides = explode(',', $hide); else $hides = Array($hide); - foreach($hides as $element) { - if(ereg('\|', $element)) { - $el = explode('|', $element); - $action .= " new Effect.{$el[2]}('{$el[0]}', {duration: {$el[1]}}); "; - } else { - $action .= " $('{$element}').style.display='none'; "; - } - } - } - if($show) { - $e = 'Appear'; - if(ereg(',', $show)) $shows = explode(',', $show); else $shows = Array($show); - foreach($shows as $element) { - if(ereg('\|', $element)) { - $el = explode('|', $element); - $action .= " new Effect.{$el[2]}('{$el[0]}', {duration: {$el[1]}}); "; - } else { - $action .= " $('{$element}').style.display='block'; "; - } - } - } - - $html = ""; - - return $html; -} -?> \ No newline at end of file diff --git a/includes/smarty/plugins/function.html_date.php b/includes/smarty/plugins/function.html_date.php deleted file mode 100644 index 0b1475a1..00000000 --- a/includes/smarty/plugins/function.html_date.php +++ /dev/null @@ -1,28 +0,0 @@ -'; - - # set the date to current date if 'now' is set as default - if($default == 'now') $default = date(UNIX_DATE_FORMAT); - - if(empty($id)) $id = $field; - if(empty($trigger)) $trigger = $id; - - $ret = ''; - $ret .= ' '; - return $ret; - -} -?> \ No newline at end of file diff --git a/includes/smarty/plugins/function.html_link.php b/includes/smarty/plugins/function.html_link.php deleted file mode 100644 index d3bb2065..00000000 --- a/includes/smarty/plugins/function.html_link.php +++ /dev/null @@ -1,77 +0,0 @@ - $_val) - if(empty($_ignore["$_key"])) - $vals .= " $_key=\"$_val\""; - else - $$_key = $_val; - - foreach($params as $_key => $_val) $$_key = $_val; - - - # change state(s) (hide) - $t = 0; - if($hide) { - $e = 'Fade'; - if(ereg(',', $hide)) $hides = explode(',', $hide); else $hides = Array($hide); - foreach($hides as $element) { - if(ereg('\|', $element)) { - $el = explode('|', $element); - $action .= " new Effect.{$el[2]}('{$el[0]}', {duration: {$el[1]}}); "; - } else { - $action .= " $('{$element}').style.display='none'; "; - } - } - } - - # change state(s) (show) - if($show) { - $e = 'Appear'; - if(ereg(',', $show)) $shows = explode(',', $show); else $shows = Array($show); - foreach($shows as $element) { - if(ereg('\|', $element)) { - $el = explode('|', $element); - $action .= " new Effect.{$el[2]}('{$el[0]}', {duration: {$el[1]}}); "; - } else { - $action .= " $('{$element}').style.display='block'; "; - } - } - } - - # translate name - global $C_translate; - $trans = $C_translate->translate($name, $module); - if(!empty($trans)) $name = $trans; - - if(empty($link)) $link = "#"; - - $html = ""; - $html .= $name; - $html .= ""; - - return $html; -} -?> \ No newline at end of file diff --git a/includes/smarty/plugins/function.html_menu.php b/includes/smarty/plugins/function.html_menu.php deleted file mode 100644 index 2dc5bc1f..00000000 --- a/includes/smarty/plugins/function.html_menu.php +++ /dev/null @@ -1,41 +0,0 @@ -Execute( $sql = sqlSelect($db, $assoc_table, "id,".$assoc_field, $conditions, $assoc_field)); - - #echo $sql; - - $return = ''; - echo $return; -} -?> \ No newline at end of file diff --git a/includes/smarty/plugins/function.html_menu_files.php b/includes/smarty/plugins/function.html_menu_files.php deleted file mode 100644 index eaf4ffc8..00000000 --- a/includes/smarty/plugins/function.html_menu_files.php +++ /dev/null @@ -1,80 +0,0 @@ -'; - if($default == "all") - $return .= ''; - $i = 0; - for($i=0; $i<$count; $i++) - { - $return .= ''; - $return .= ''; - - echo $return; -} -?> \ No newline at end of file diff --git a/includes/smarty/plugins/function.html_menu_multi.php b/includes/smarty/plugins/function.html_menu_multi.php deleted file mode 100644 index 50842f13..00000000 --- a/includes/smarty/plugins/function.html_menu_multi.php +++ /dev/null @@ -1,51 +0,0 @@ -Execute( $sql = sqlSelect($db, $assoc_table, "id,".$assoc_field, $conditions, $assoc_field)); - - if(empty($default)) $default = Array(''); - elseif (is_array($default)) $default = $default; - elseif (is_numeric($default)) $default[] = $default; - elseif (is_string($default)) $default = unserialize($default); - else $default = Array(''); - - - if($default == "all") $return .= ''; - $i=0; - if($rs && $rs->RecordCount() > 0) { - while(!$rs->EOF) { - $return .= ''; - $i++; - $rs->MoveNext(); - } - } else { - if( $default != "all") $return .= ''; - } - - $return .= ''; - - if($i < $size) $size = $i++; - echo '"; - while(!$result->EOF) { - $sel=''; - foreach($default as $cur) if ($cur == $result->fields['id']) $sel = "selected"; - echo ""; - $result->MoveNext(); - } - echo ""; - } -} -?> \ No newline at end of file diff --git a/includes/smarty/plugins/function.html_menu_product_subscription.php b/includes/smarty/plugins/function.html_menu_product_subscription.php deleted file mode 100644 index 35c04245..00000000 --- a/includes/smarty/plugins/function.html_menu_product_subscription.php +++ /dev/null @@ -1,42 +0,0 @@ -Execute($q); - if($result && $result->RecordCount() > 0) - { - echo ""; - } -} -?> \ No newline at end of file diff --git a/includes/smarty/plugins/function.html_menu_search_expr.php b/includes/smarty/plugins/function.html_menu_search_expr.php deleted file mode 100644 index a0989013..00000000 --- a/includes/smarty/plugins/function.html_menu_search_expr.php +++ /dev/null @@ -1,63 +0,0 @@ -'; - foreach($options as $opt) echo ''; - echo ''; - - echo ''; - } -?> \ No newline at end of file diff --git a/includes/smarty/plugins/function.html_menu_sub.php b/includes/smarty/plugins/function.html_menu_sub.php deleted file mode 100644 index 63862642..00000000 --- a/includes/smarty/plugins/function.html_menu_sub.php +++ /dev/null @@ -1,96 +0,0 @@ -Execute( sqlSelect($db,$assoc_table,"id,$parent_id,".$assoc_field, $conditions, "$parent_id,$assoc_field")); - - # Get current id - if(!empty($VAR['id'])) $cid = ereg_replace(",","", $VAR['id']); else $current = ''; - - # Loop and put in array - while(!$result->EOF) { - if($result->fields["$parent_id"] == "" || $result->fields["$parent_id"] == 0 || $result->fields["$parent_id"] == $result->fields['id']) { - $arr[0][] = $result->fields; - } else { - $arr["{$result->fields["$parent_id"]}"][] = $result->fields; - } - - # get current parent_id - if($cid > 0 && $result->fields['id'] == $cid) - $current = $result->fields["$parent_id"]; - $result->MoveNext(); - } - - $option = ''; - $dirpre = ' \\ '; - - for($i=0; $i'.$dir.''; - - # get the sub-records # (LEVEL 2) - if(isset($arr[$id])) { - for($ii=0; $ii'.$dir.''; - } - - # get the sub-records # (LEVEL 3) - if(isset($arr[$idx])) { - for($iii=0; $iii'.$dir.''; - } - - # get the sub-records # (LEVEL 4) - if(isset($arr[$idx2])) { - for($iiii=0; $iiii'.$dir.''; - } - - # get the sub-records # (LEVEL 5) - if(isset($arr[$idx3])) { - for($iiiii=0; $iiiii'.$dir.''; - } - } - } - } - } - } - - echo "'; -} -?> \ No newline at end of file diff --git a/includes/smarty/plugins/function.html_select_account.php b/includes/smarty/plugins/function.html_select_account.php deleted file mode 100644 index d5ca3fe4..00000000 --- a/includes/smarty/plugins/function.html_select_account.php +++ /dev/null @@ -1,49 +0,0 @@ -Execute($q); - if($result->RecordCount() > 0) - $val = $result->fields['first_name'].' '.$result->fields['last_name']; - - if(!empty($val)) { - # Get - - } - } else { - $val = ''; - } - - if(empty($val)) { - echo ' - - -
- - '; - } else { - echo "{$val}"; - echo ""; - } -} -?> \ No newline at end of file diff --git a/includes/smarty/plugins/function.html_select_affiliate.php b/includes/smarty/plugins/function.html_select_affiliate.php deleted file mode 100644 index 451a40bb..00000000 --- a/includes/smarty/plugins/function.html_select_affiliate.php +++ /dev/null @@ -1,56 +0,0 @@ -Execute($q); - if($result != false && $result->RecordCount() > 0) $val = $result->fields['first_name'].' '.$result->fields['last_name']; - } else { - $val = ''; - } - - echo ' - - -
- - '; - - if(!empty($val)) { - // display unselect option - echo ' - '; - } -} -?> \ No newline at end of file diff --git a/includes/smarty/plugins/function.input_text.php b/includes/smarty/plugins/function.input_text.php deleted file mode 100644 index 3c79c7c6..00000000 --- a/includes/smarty/plugins/function.input_text.php +++ /dev/null @@ -1,21 +0,0 @@ -"; -} -?> diff --git a/includes/smarty/plugins/function.osb.php b/includes/smarty/plugins/function.osb.php new file mode 100644 index 00000000..7789a30d --- /dev/null +++ b/includes/smarty/plugins/function.osb.php @@ -0,0 +1,445 @@ +',$id,$default); + printf('',$name,'account',$val); + printf('
',$id); + printf('',$name,$id,$module); + + } else { + printf('',$module,$default,$val); + printf('',$id,$name,$default); + } +} + +/** + * HTML Account Selector + * + * If passed a default ID (and it exists), that will be rendered, otherwise a javascript selection box is rendered. + */ +function osb_html_select_account($params,&$smarty) { + if (! $params['name']) { + printf('MISSING name:%s',__METHOD__); + return; + } + + $module = isset($params['module']) ? $params['module'] : 'account'; + $default = isset($params['default']) ? $params['default'] : ''; + $id = isset($params['id']) ? $params['id'] : sprintf('%s_id',$params['name']); + $val = ''; + + if ($default) { + $db = &DB(); + $result = $db->Execute(sqlSelect($db,'account','first_name,last_name',array('id'=>$default))); + + if ($result->RecordCount() > 0) + $val = sprintf('%s %s',$result->fields['first_name'],$result->fields['last_name']); + } + + return osb_html_select($val,$id,$params['name'],$default,$module); +} + +/** + * HTML Affiliate Selector + * + * If passed a default ID (and it exists), that will be rendered, otherwise a javascript selection box is rendered. + * @todo need to create autoselect(); + */ +function osb_html_select_affiliate($params,&$smarty) { + if (! $params['name']) { + printf('MISSING name:%s',__METHOD__); + return; + } + + $module = isset($params['module']) ? $params['module'] : 'affiliate'; + $default = isset($params['default']) ? $params['default'] : ''; + $id = isset($params['id']) ? $params['id'] : sprintf('%s_id',$params['name']); + $val = ''; + + if ($default) { + $db = &DB(); + $sql = sprintf('SELECT DISTINCT {p}affiliate.id,{p}account.first_name,{p}account.last_name,{p}account.username + FROM {p}account LEFT JOIN {p}affiliate ON {p}account.id={p}affiliate.account_id + WHERE {p}affiliate.id=%s AND {p}affiliate.site_id=%s AND {p}account.site_id=%s',$db->qstr($default),DEFAULT_SITE,DEFAULT_SITE); + + $result = $db->Execute(str_replace('{p}',AGILE_DB_PREFIX,$sql)); + + if ($result->RecordCount() > 0) + $val = sprintf('%s %s',$result->fields['first_name'],$result->fields['last_name']); + } + + return osb_html_select($val,$id,$params['name'],$default,$module); +} + +function osb_html_select_name($params,&$smarty) { + if (! $params['name']) { + printf('MISSING name:%s',__METHOD__); + return; + } + + $module = isset($params['module']) ? $params['module'] : ''; + $table = isset($params['table']) ? $params['table'] : ''; + $default = isset($params['default']) ? $params['default'] : ''; + $id = isset($params['id']) ? $params['id'] : sprintf('%s_id',$params['name']); + $val = ''; + + if ($default) { + $db = &DB(); + $result = $db->Execute($q=sqlSelect($db,$table,'name',array('id'=>$default))); + + if ($result && $result->RecordCount() > 0) + $val = $result->fields['name']; + } + + return osb_html_select($val,$id,$params['name'],$default,$module); +} + +function osb_autoselect($params,&$smarty) { + $module = isset($params['module']) ? $params['module'] : (isset($smarty->_tpl_vars['meth'][0]) ? $smarty->_tpl_vars['meth'][0] : ''); + $field = isset($params['field']) ? $params['field'] : ''; + $return = isset($params['return']) ? $params['return'] : ''; + $default = isset($params['default']) ? $params['default'] : ''; + $val = ''; + + if (! $module || ! $field || ! $return) { + printf('MISSING module (%s),field (%s) OR return (%s):%s',$module,$field,$return,__METHOD__); + return; + } + + if ($default) { + $db = &DB(); + $result = $db->Execute($q=sqlSelect($db,$module,$return.',first_name,last_name',array($return=>$default))); + + if ($result && $result->RecordCount() == 1) + $val = sprintf('%s %s',$result->fields['first_name'],$result->fields['last_name']); + } + + printf('',$field,$field,$default); + printf('',$field,$field,$val); + printf('
',$field); + echo ''."\n"; +} + +/** + * Get list of files from the filesystem, and present in a select list + */ +function osb_html_menu_files($params,&$smarty) { + if (! $params['name'] || ! $params['path']) { + printf('MISSING name OR path:%s',__METHOD__); + return; + } + + $id = isset($params['id']) ? $params['id'] : $params['name']; + $ext = ''; + + switch ($params['path']) { + case 'affiliate_plugin': $path = sprintf('%s/affiliate/',PATH_PLUGINS); break; + case 'checkout_plugin': $path = sprintf('%s/checkout/',PATH_PLUGINS); break; + case 'invoice_pdf': $path = sprintf('%s/invoice/PDF/',PATH_MODULES); $ext = '.inc.php'; $pre = 'pdf_invoice_'; break; + case 'invoice_pagetype': $path = sprintf('%s%s/invoice/',PATH_THEMES,DEF_THEME_N); $ext = '.pdf'; $pre = 'invoice-'; break; + case 'language': $path = sprintf('%s/core/',PATH_LANGUAGE); $ext = '_core.xml'; $cap=1; break; + case 'product' : $path = sprintf('%s/product',PATH_PLUGINS); break; + case 'product_cat' : $path = sprintf('%s%s/blocks/product_cat',PATH_THEMES,DEF_THEME_N); break; + case 'provision_plugin': $path = sprintf('%s/provision/',PATH_PLUGINS); break; + case 'static_template': $path = sprintf('%s/default/blocks/static_page/',PATH_THEMES); $ext = '_template.tpl'; $cap=1; break; + case 'theme' : $path = PATH_THEMES; break; + case 'whois_plugin': $path = sprintf('%s/whois/',PATH_PLUGINS); break; + + default: + printf('Unkonwn path: %s',$params['path']); + return; + } + + $count = 0; + $arr = array(); + $dir = opendir($path); + while ($file_name = readdir($dir)) { + $display = true; + + if (! in_array($file_name,array('.','..'))) { + if ($ext) { + $cute = preg_replace("/{$ext}$/",'',$file_name); + + if (! preg_match("/{$ext}$/",$file_name)) + $display = false; + } + + if ($pre) { + $cute = preg_replace("/^{$pre}/",'',$cute); + + if (! preg_match("/^{$pre}/",$file_name)) + $display = false; + + } + + if ($display) { + $value = str_replace('_',' ',str_replace('-',' ',$cute)); + + if ($cap==1) + $value = ucfirst(strtolower($value)); + elseif ($cap==2) + $value = ucwords(strtolower($value)); + elseif($cap) + $value = strtoupper($value); + + $arr[$cute] = $value; + } + } + } + + $return = sprintf(''; + + echo $return; +} + +function osb_html_link($params,&$smarty) { + $name = 'submit'; + $module = 'CORE'; + + $_ignore['show'] = true; + $_ignore['hide'] = true; + $_ignore['name'] = true; + + # Get the values passed... + $vals = ''; + foreach ($params as $_key => $_val) + if (empty($_ignore[$_key])) + $vals .= sprintf(' %s="%s"',$_key,$_val); + else + $$_key = $_val; + + foreach ($params as $_key => $_val) + $$_key = $_val; + + # Change state(s) (hide) + $t = 0; + if ($hide) { + if (preg_match('/,/',$hide)) + $hides = explode(',',$hide); + else + $hides = array($hide); + + foreach ($hides as $element) + if (preg_match('/\|/',$element)) { + $el = explode('|',$element); + $action .= sprintf("new Effect.%s('%s',{duration: %s});",$el[2],$el[0],$el[1]); + } else { + $action .= sprintf("$('%s').style.display='none';",$element); + } + } + + # Change state(s) (show) + if ($show) { + if (preg_match('/,/',$show)) + $shows = explode(',',$show); + else + $shows = array($show); + + foreach ($shows as $element) { + if (preg_match('/\|/',$element)) { + $el = explode('|',$element); + $action .= sprintf("new Effect.%s('%s',{duration: %s});",$el[2],$el[0],$el[1]); + } else { + $action .= sprintf("$('%s').style.display='block';",$element); + } + } + } + + # translate name + global $C_translate; + $trans = $C_translate->translate($name,$module); + if (! empty($trans)) + $name = $trans; + + if (empty($link)) + $link = '#'; + + return sprintf('%s',$link,$vals,$action ? sprintf(' onclick="%s"',$action) : '',$name); +} + +/** + * Hides a div/span element without disabling the view + */ +function osb_style_hide($params,&$smarty) { + echo 'style="display:none;"'; +} + +/** + * Displays & Populates an Plug In template + * @todo change this to be dynmaic, ie: defined by the instalation of a module and calling a method. + */ +function osb_plugin($params,&$smarty) { + # Some Validation + if ((! isset($params['type']) || ! trim($params['type'])) || (! isset($params['name']) || ! trim($params['name']))) + return; + + if (! isset($params['name_prefix'])) + $params['name_prefix'] = ''; + + if (! isset($params['data']) && $params['data']) + $smarty->assign('plugin',unserialize($params['data'])); + + # Pass any other vars to smarty + foreach ($params as $var=>$val) + $smarty->assign($var,$val); + + # Get full template file-path: + switch ($params['type']) { + case 'affiliate': + $meth = 'affiliate:plugin'; + break; + + case 'checkout': + $meth = 'checkout_plugin:plugin'; + break; + + case 'import': + $meth = ''; // @todo + break; + + case 'product': + $meth = 'product_plugin:plugin'; + break; + + case 'provision': + $meth = 'host_provision_plugin:plugin'; + break; + + case 'registrar': + $meth = 'host_registrar_plugin:plugin'; + break; + + case 'whois': + $meth = 'host_whois_plugin:plugin'; + break; + + case 'voip_did': + $meth = 'voip_did_plugin:config'; + break; + } + + $_tpl = sprintf('%s_%s%s',$meth,$params['name_prefix'],$params['name']); + + # Check if file exists: + $_template_full = sprintf('%s%s/blocks/%s.tpl',PATH_THEMES,DEF_THEME_N,str_replace(':','/',$_tpl)); + + if (! is_file($_template_full)) { + $_template_full = sprintf('%s%s/blocks/%s.tpl',PATH_THEMES,'default',str_replace(':','/',$_tpl)); + + if (! is_file($_template_full)) { + if ($debug) + printf('Error loading plugin template: %s',$_template_full); + + return; + } + } + + // Load file + $smarty->display(sprintf('file:%s',$_template_full)); +} + +/** + * Translate a table title + */ +function osb_tt($params,&$smarty) { + require_once(PATH_CORE.'translate.inc.php'); + $C_translate = new CORE_translate; + + echo $C_translate->tt($params,$smarty); +} + +/** + * Translate a table field + */ +function osb_tf($params,&$smarty) { + require_once(PATH_CORE.'translate.inc.php'); + $C_translate = new CORE_translate; + + echo $C_translate->tf($params,$smarty); +} + +function osb_html_menu_product_host($params,&$smarty) { + $id = $params['id']; + $default = unserialize($params['default']); + if (empty($id)) + $id = $params['name']; + + $db = &DB(); + $result = $db->Execute(sqlSelect($db,'product','id,sku',sprintf('host=1 AND active=1 AND price_type=1 AND id!%s',$params['exclude']))); + if ($result && $result->RecordCount()) { + printf(''; + } +} + +function osb_html_menu_product_subscription($params,&$smarty) { + $id = $params['id']; + $default = unserialize($params['default']); + if (empty($id)) + $id = $params['name']; + + $db = &DB(); + $result = $db->Execute(sqlSelect($db,'product','id,sku',sprintf('(host=0 OR host IS NULL) AND active=1 AND price_type=1 AND id!=%s',$params['exclude']),'sku')); + if ($result && $result->RecordCount()) { + printf(''; + } +} +?> diff --git a/includes/smarty/plugins/function.plugin.php b/includes/smarty/plugins/function.plugin.php deleted file mode 100644 index 95eda5f4..00000000 --- a/includes/smarty/plugins/function.plugin.php +++ /dev/null @@ -1,70 +0,0 @@ -assign('plugin', unserialize($data)); - - // pass any other vars to smarty - foreach($params as $var=>$val) $smarty->assign($var,$val); - - // get full template file-path: - switch($type) { - case 'affiliate': - $_tpl = "affiliate:plugin_{$name_prefix}{$name}"; - break; - case 'checkout': - $_tpl = "checkout_plugin:plugin_{$name_prefix}{$name}"; - break; - case 'db_mapping': - $_tpl = "db_mapping:group_map_{$name_prefix}{$name}"; - break; - case 'import': - $_tpl = ""; // todo - break; - case 'product': - $_tpl = "product_plugin:plugin_{$name_prefix}{$name}"; - break; - case 'provision': - $_tpl = "host_provision_plugin:plugin_{$name_prefix}{$name}"; - break; - case 'registrar': - $_tpl = "host_registrar_plugin:plugin_{$name_prefix}{$name}"; - break; - case 'whois': - $_tpl = "host_whois_plugin:plugin_{$name_prefix}{$name}"; - break; - case 'voip_did': - $_tpl = "voip_did_plugin:config_{$name_prefix}{$name}"; - break; - } - - // check if file exists: - $_template_full = PATH_THEMES.DEF_THEME_N."/blocks/". ereg_replace(":", "/", $_tpl).".tpl"; - - if(!is_file($_template_full)) { - $_template_full = PATH_THEMES."default/blocks/". ereg_replace(":", "/", $_tpl).".tpl"; - if(!is_file($_template_full)) { - if($debug) echo "Error loading plugin template: $_template_full"; - return; - } - } - - // load file - $smarty->display("file:$_template_full"); - -} -?> \ No newline at end of file diff --git a/includes/smarty/plugins/function.style_hide.php b/includes/smarty/plugins/function.style_hide.php deleted file mode 100644 index 66558633..00000000 --- a/includes/smarty/plugins/function.style_hide.php +++ /dev/null @@ -1,17 +0,0 @@ - \ No newline at end of file diff --git a/includes/smarty/plugins/modifier.date.php b/includes/smarty/plugins/modifier.date.php deleted file mode 100644 index dbcd80cb..00000000 --- a/includes/smarty/plugins/modifier.date.php +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/includes/smarty/plugins/modifier.linkalize.php b/includes/smarty/plugins/modifier.linkalize.php deleted file mode 100644 index 9487c7f0..00000000 --- a/includes/smarty/plugins/modifier.linkalize.php +++ /dev/null @@ -1,28 +0,0 @@ -$1", $text); //make all URLs links - $text = preg_replace("/[\w-\.]+@(\w+[\w-]+\.){0,3}\w+[\w-]+\.[a-zA-Z]{2,4}\b/i","$0",$text); - return $text; -} -?> \ No newline at end of file diff --git a/includes/smarty/plugins/modifier.markdown.php b/includes/smarty/plugins/modifier.markdown.php deleted file mode 100644 index 8ba21183..00000000 --- a/includes/smarty/plugins/modifier.markdown.php +++ /dev/null @@ -1,1989 +0,0 @@ - -# -# Based on Markdown -# Copyright (c) 2004-2005 John Gruber -# -# - - -global $MarkdownPHPVersion, $MarkdownSyntaxVersion, - $md_empty_element_suffix, $md_tab_width, - $md_nested_brackets_depth, $md_nested_brackets, - $md_escape_table, $md_backslash_escape_table, - $md_list_level; - -$MarkdownPHPVersion = 'Extra 1.0'; # Mon 5 Sep 2005 -$MarkdownSyntaxVersion = '1.0.1'; # Sun 12 Dec 2004 - - -# -# Global default settings: -# -$md_empty_element_suffix = " />"; # Change to ">" for HTML output -$md_tab_width = 4; - -# -# WordPress settings: -# -$md_wp_posts = true; # Set to false to remove Markdown from posts. -$md_wp_comments = true; # Set to false to remove Markdown from comments. - - -# -- WordPress Plugin Interface ----------------------------------------------- -/* -Plugin Name: PHP Markdown Extra -Plugin URI: http://www.michelf.com/projects/php-markdown/ -Description: Markdown syntax allows you to write using an easy-to-read, easy-to-write plain text format. Based on the original Perl version by John Gruber. More... -Version: Extra 1.0 -Author: Michel Fortin -Author URI: http://www.michelf.com/ -*/ -if (isset($wp_version)) { - # More details about how it works here: - # - - # Post content and excerpts - if ($md_wp_posts) { - remove_filter('the_content', 'wpautop'); - remove_filter('the_excerpt', 'wpautop'); - add_filter('the_content', 'Markdown', 6); - add_filter('get_the_excerpt', 'Markdown', 6); - add_filter('get_the_excerpt', 'trim', 7); - add_filter('the_excerpt', 'md_add_p'); - add_filter('the_excerpt_rss', 'md_strip_p'); - - remove_filter('content_save_pre', 'balanceTags', 50); - remove_filter('excerpt_save_pre', 'balanceTags', 50); - add_filter('the_content', 'balanceTags', 50); - add_filter('get_the_excerpt', 'balanceTags', 9); - - function md_add_p($text) { - if (strlen($text) == 0) return; - if (strcasecmp(substr($text, -3), '

') == 0) return $text; - return '

'.$text.'

'; - } - function md_strip_p($t) { return preg_replace('{}', '', $t); } - } - - # Comments - if ($md_wp_comments) { - remove_filter('comment_text', 'wpautop'); - remove_filter('comment_text', 'make_clickable'); - add_filter('pre_comment_content', 'Markdown', 6); - add_filter('pre_comment_content', 'md_hide_tags', 8); - add_filter('pre_comment_content', 'md_show_tags', 12); - add_filter('get_comment_text', 'Markdown', 6); - add_filter('get_comment_excerpt', 'Markdown', 6); - add_filter('get_comment_excerpt', 'md_strip_p', 7); - - global $md_hidden_tags; - $md_hidden_tags = array( - '

' => md5('

'), '

' => md5('

'), - '
'	=> md5('
'),	'
'=> md5('
'), - '
    ' => md5('
      '), '
    ' => md5('
'), - '
    ' => md5('
      '), '
    ' => md5('
'), - '
  • ' => md5('
  • '), '
  • ' => md5(''), - ); - - function md_hide_tags($text) { - global $md_hidden_tags; - return str_replace(array_keys($md_hidden_tags), - array_values($md_hidden_tags), $text); - } - function md_show_tags($text) { - global $md_hidden_tags; - return str_replace(array_values($md_hidden_tags), - array_keys($md_hidden_tags), $text); - } - } -} - - -# -- bBlog Plugin Info -------------------------------------------------------- -function identify_modifier_markdown() { - global $MarkdownPHPVersion; - return array( - 'name' => 'markdown', - 'type' => 'modifier', - 'nicename' => 'PHP Markdown Extra', - 'description' => 'A text-to-HTML conversion tool for web writers', - 'authors' => 'Michel Fortin and John Gruber', - 'licence' => 'GPL', - 'version' => $MarkdownPHPVersion, - 'help' => 'Markdown syntax allows you to write using an easy-to-read, easy-to-write plain text format. Based on the original Perl version by John Gruber. More...' - ); -} - -# -- Smarty Modifier Interface ------------------------------------------------ -function smarty_modifier_markdown($text) { - return Markdown($text); -} - -# -- Textile Compatibility Mode ----------------------------------------------- -# Rename this file to "classTextile.php" and it can replace Textile anywhere. -if (strcasecmp(substr(__FILE__, -16), "classTextile.php") == 0) { - # Try to include PHP SmartyPants. Should be in the same directory. - @include_once 'smartypants.php'; - # Fake Textile class. It calls Markdown instead. - class Textile { - function TextileThis($text, $lite='', $encode='', $noimage='', $strict='') { - if ($lite == '' && $encode == '') $text = Markdown($text); - if (function_exists('SmartyPants')) $text = SmartyPants($text); - return $text; - } - } -} - - - -# -# Globals: -# - -# Regex to match balanced [brackets]. -# Needed to insert a maximum bracked depth while converting to PHP. -$md_nested_brackets_depth = 6; -$md_nested_brackets = - str_repeat('(?>[^\[\]]+|\[', $md_nested_brackets_depth). - str_repeat('\])*', $md_nested_brackets_depth); - -# Table of hash values for escaped characters: -$md_escape_table = array( - "\\" => md5("\\"), - "`" => md5("`"), - "*" => md5("*"), - "_" => md5("_"), - "{" => md5("{"), - "}" => md5("}"), - "[" => md5("["), - "]" => md5("]"), - "(" => md5("("), - ")" => md5(")"), - ">" => md5(">"), - "#" => md5("#"), - "+" => md5("+"), - "-" => md5("-"), - "." => md5("."), - "!" => md5("!"), - ":" => md5(":"), - "|" => md5("|"), -); -# Create an identical table but for escaped characters. -$md_backslash_escape_table; -foreach ($md_escape_table as $key => $char) - $md_backslash_escape_table["\\$key"] = $char; - - - -function Markdown($text) { -# -# Main function. The order in which other subs are called here is -# essential. Link and image substitutions need to happen before -# _EscapeSpecialCharsWithinTagAttributes(), so that any *'s or _'s in the -# and tags get encoded. -# - # Clear the global hashes. If we don't clear these, you get conflicts - # from other articles when generating a page which contains more than - # one article (e.g. an index page that shows the N most recent - # articles): - global $md_urls, $md_titles, $md_html_blocks, $md_html_hashes; - $md_urls = array(); - $md_titles = array(); - $md_html_blocks = array(); - $md_html_hashes = array(); - - # Standardize line endings: - # DOS to Unix and Mac to Unix - $text = str_replace(array("\r\n", "\r"), "\n", $text); - - # Make sure $text ends with a couple of newlines: - $text .= "\n\n"; - - # Convert all tabs to spaces. - $text = _Detab($text); - - # Turn block-level HTML blocks into hash entries - $text = _HashHTMLBlocks($text); - - # Strip any lines consisting only of spaces and tabs. - # This makes subsequent regexen easier to write, because we can - # match consecutive blank lines with /\n+/ instead of something - # contorted like /[ \t]*\n+/ . - $text = preg_replace('/^[ \t]+$/m', '', $text); - - # Strip link definitions, store in hashes. - $text = _StripLinkDefinitions($text); - - $text = _RunBlockGamut($text, FALSE); - - $text = _UnescapeSpecialChars($text); - - return $text . "\n"; -} - - -function _StripLinkDefinitions($text) { -# -# Strips link definitions from text, stores the URLs and titles in -# hash references. -# - global $md_tab_width; - $less_than_tab = $md_tab_width - 1; - - # Link defs are in the form: ^[id]: url "optional title" - $text = preg_replace_callback('{ - ^[ ]{0,'.$less_than_tab.'}\[(.+)\]: # id = $1 - [ \t]* - \n? # maybe *one* newline - [ \t]* - ? # url = $2 - [ \t]* - \n? # maybe one newline - [ \t]* - (?: - (?<=\s) # lookbehind for whitespace - ["(] - (.+?) # title = $3 - [")] - [ \t]* - )? # title is optional - (?:\n+|\Z) - }xm', - '_StripLinkDefinitions_callback', - $text); - return $text; -} -function _StripLinkDefinitions_callback($matches) { - global $md_urls, $md_titles; - $link_id = strtolower($matches[1]); - $md_urls[$link_id] = _EncodeAmpsAndAngles($matches[2]); - if (isset($matches[3])) - $md_titles[$link_id] = str_replace('"', '"', $matches[3]); - return ''; # String that will replace the block -} - - -function _HashHTMLBlocks($text) { -# -# Hashify HTML Blocks and "clean tags". -# -# We only want to do this for block-level HTML tags, such as headers, -# lists, and tables. That's because we still want to wrap

    s around -# "paragraphs" that are wrapped in non-block-level tags, such as anchors, -# phrase emphasis, and spans. The list of tags we're looking for is -# hard-coded. -# -# This works by calling _HashHTMLBlocks_InMarkdown, which then calls -# _HashHTMLBlocks_InHTML when it encounter block tags. When the markdown="1" -# attribute is found whitin a tag, _HashHTMLBlocks_InHTML calls back -# _HashHTMLBlocks_InMarkdown to handle the Markdown syntax within the tag. -# These two functions are calling each other. It's recursive! -# - global $block_tags, $context_block_tags, $contain_span_tags, - $clean_tags, $auto_close_tags; - - # Tags that are always treated as block tags: - $block_tags = 'p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|'. - 'form|fieldset|iframe|hr|legend'; - - # Tags treated as block tags only if the opening tag is alone on it's line: - $context_block_tags = 'script|noscript|math|ins|del'; - - # Tags where markdown="1" default to span mode: - $contain_span_tags = 'p|h[1-6]|li|dd|dt|td|th|legend'; - - # Tags which must not have their contents modified, no matter where - # they appear: - $clean_tags = 'script|math'; - - # Tags that do not need to be closed. - $auto_close_tags = 'hr|img'; - - # Regex to match any tag. - global $tag_match; - $tag_match = - '{ - ( # $2: Capture hole tag. - `) - \'.*?\' | # Single quotes (can contain `>`) - .+? # Anything but quotes and `>`. - )*? - > # End of tag. - | - # HTML Comment - | - <\? .*? \?> # Processing instruction - | - # CData Block - ) - }xs'; - - # - # Call the HTML-in-Markdown hasher. - # - list($text, ) = _HashHTMLBlocks_InMarkdown($text); - - return $text; -} -function _HashHTMLBlocks_InMarkdown($text, $indent = 0, - $enclosing_tag = '', $md_span = false) -{ -# -# Parse markdown text, calling _HashHTMLBlocks_InHTML for block tags. -# -# * $indent is the number of space to be ignored when checking for code -# blocks. This is important because if we don't take the indent into -# account, something like this (which looks right) won't work as expected: -# -#

    -#
    -# Hello World. <-- Is this a Markdown code block or text? -#
    <-- Is this a Markdown code block or a real tag? -#
    -# -# If you don't like this, just don't indent the tag on which -# you apply the markdown="1" attribute. -# -# * If $enclosing_tag is not empty, stops at the first unmatched closing -# tag with that name. Nested tags supported. -# -# * If $md_span is true, text inside must treated as span. So any double -# newline will be replaced by a single newline so that it does not create -# paragraphs. -# -# Returns an array of that form: ( processed text , remaining text ) -# - global $block_tags, $context_block_tags, $clean_tags, $auto_close_tags, - $tag_match; - - if ($text === '') return array('', ''); - - # Regex to check for the presense of newlines around a block tag. - $newline_match_before = "/(?:^\n?|\n\n) *$/"; - $newline_match_after = - '{ - ^ # Start of text following the tag. - (?:[ ]*)? # Optional comment. - [ ]*\n # Must be followed by newline. - }xs'; - - # Regex to match any tag. - $block_tag_match = - '{ - ( # $2: Capture hole tag. - `) - \'.*?\' | # Single quotes (can contain `>`) - .+? # Anything but quotes and `>`. - )*? - > # End of tag. - | - # HTML Comment - | - <\? .*? \?> # Processing instruction - | - # CData Block - ) - }xs'; - - - $depth = 0; # Current depth inside the tag tree. - $parsed = ""; # Parsed text that will be returned. - - # - # Loop through every tag until we find the closing tag of the parent - # or loop until reaching the end of text if no parent tag specified. - # - do { - # - # Split the text using the first $tag_match pattern found. - # Text before pattern will be first in the array, text after - # pattern will be at the end, and between will be any catches made - # by the pattern. - # - $parts = preg_split($block_tag_match, $text, 2, - PREG_SPLIT_DELIM_CAPTURE); - - # If in Markdown span mode, replace any multiple newlines that would - # trigger a new paragraph. - if ($md_span) { - $parts[0] = preg_replace('/\n\n/', "\n", $parts[0]); - } - - $parsed .= $parts[0]; # Text before current tag. - - # If end of $text has been reached. Stop loop. - if (count($parts) < 3) { - $text = ""; - break; - } - - $tag = $parts[1]; # Tag to handle. - $text = $parts[2]; # Remaining text after current tag. - - # - # Check for: Tag inside code block or span - # - if (# Find current paragraph - preg_match('/(?>^\n?|\n\n)((?>.\n?)+?)$/', $parsed, $matches) && - ( - # Then match in it either a code block... - preg_match('/^ {'.($indent+4).'}.*(?>\n {'.($indent+4).'}.*)*'. - '(?!\n)$/', $matches[1], $x) || - # ...or unbalenced code span markers. (the regex matches balenced) - !preg_match('/^(?>[^`]+|(`+)(?>[^`]+|(?!\1[^`])`)*?\1(?!`))*$/s', - $matches[1]) - )) - { - # Tag is in code block or span and may not be a tag at all. So we - # simply skip the first char (should be a `<`). - $parsed .= $tag{0}; - $text = substr($tag, 1) . $text; # Put back $tag minus first char. - } - # - # Check for: Opening Block level tag or - # Opening Content Block tag (like ins and del) - # used as a block tag (tag is alone on it's line). - # - else if (preg_match("{^<(?:$block_tags)\b}", $tag) || - ( preg_match("{^<(?:$context_block_tags)\b}", $tag) && - preg_match($newline_match_before, $parsed) && - preg_match($newline_match_after, $text) ) - ) - { - # Need to parse tag and following text using the HTML parser. - list($block_text, $text) = - _HashHTMLBlocks_InHTML($tag . $text, - "_HashHTMLBlocks_HashBlock", TRUE); - - # Make sure it stays outside of any paragraph by adding newlines. - $parsed .= "\n\n$block_text\n\n"; - } - # - # Check for: Clean tag (like script, math) - # HTML Comments, processing instructions. - # - else if (preg_match("{^<(?:$clean_tags)\b}", $tag) || - $tag{1} == '!' || $tag{1} == '?') - { - # Need to parse tag and following text using the HTML parser. - # (don't check for markdown attribute) - list($block_text, $text) = - _HashHTMLBlocks_InHTML($tag . $text, - "_HashHTMLBlocks_HashClean", FALSE); - - $parsed .= $block_text; - } - # - # Check for: Tag with same name as enclosing tag. - # - else if ($enclosing_tag !== '' && - # Same name as enclosing tag. - preg_match("{^= 0); - - return array($parsed, $text); -} -function _HashHTMLBlocks_InHTML($text, $hash_function, $md_attr) { -# -# Parse HTML, calling _HashHTMLBlocks_InMarkdown for block tags. -# -# * Calls $hash_function to convert any blocks. -# * Stops when the first opening tag closes. -# * $md_attr indicate if the use of the `markdown="1"` attribute is allowed. -# (it is not inside clean tags) -# -# Returns an array of that form: ( processed text , remaining text ) -# - global $auto_close_tags, $contain_span_tags, $tag_match; - - if ($text === '') return array('', ''); - - # Regex to match `markdown` attribute inside of a tag. - $markdown_attr_match = ' - { - \s* # Eat whitespace before the `markdown` attribute - markdown - \s*=\s* - (["\']) # $1: quote delimiter - (.*?) # $2: attribute value - \1 # matching delimiter - }xs'; - - $original_text = $text; # Save original text in case of faliure. - - $depth = 0; # Current depth inside the tag tree. - $block_text = ""; # Temporary text holder for current text. - $parsed = ""; # Parsed text that will be returned. - - # - # Get the name of the starting tag. - # - if (preg_match("/^<([\w:$]*)\b/", $text, $matches)) - $base_tag_name = $matches[1]; - - # - # Loop through every tag until we find the corresponding closing tag. - # - do { - # - # Split the text using the first $tag_match pattern found. - # Text before pattern will be first in the array, text after - # pattern will be at the end, and between will be any catches made - # by the pattern. - # - $parts = preg_split($tag_match, $text, 2, PREG_SPLIT_DELIM_CAPTURE); - - if (count($parts) < 3) { - # - # End of $text reached with unbalenced tag(s). - # In that case, we return original text unchanged and pass the - # first character as filtered to prevent an infinite loop in the - # parent function. - # - return array($original_text{0}, substr($original_text, 1)); - } - - $block_text .= $parts[0]; # Text before current tag. - $tag = $parts[1]; # Tag to handle. - $text = $parts[2]; # Remaining text after current tag. - - # - # Check for: Auto-close tag (like
    ) - # Comments and Processing Instructions. - # - if (preg_match("{^ 0) { - $block_text = preg_replace("/^[ ]{1,$indent}/m", "", - $block_text); - } - - # Append tag content to parsed text. - if (!$span_mode) $parsed .= "\n\n$block_text\n\n"; - else $parsed .= "$block_text"; - - # Start over a new block. - $block_text = ""; - } - else $block_text .= $tag; - } - - } while ($depth > 0); - - # - # Hash last block text that wasn't processed inside the loop. - # - $parsed .= $hash_function($block_text); - - return array($parsed, $text); -} -function _HashHTMLBlocks_HashBlock($text) { - global $md_html_hashes, $md_html_blocks; - $key = md5($text); - $md_html_hashes[$key] = $text; - $md_html_blocks[$key] = $text; - return $key; # String that will replace the tag. -} -function _HashHTMLBlocks_HashClean($text) { - global $md_html_hashes; - $key = md5($text); - $md_html_hashes[$key] = $text; - return $key; # String that will replace the clean tag. -} - - -function _HashBlock($text) { -# -# Called whenever a tag must be hashed. When a function insert a block-level -# tag in $text, it pass through this function and is automaticaly escaped, -# which remove the need to call _HashHTMLBlocks at every step. -# - # Swap back any tag hash found in $text so we do not have to _UnhashTags - # multiple times at the end. Must do this because of - $text = _UnhashTags($text); - - # Then hash the block as normal. - return _HashHTMLBlocks_HashBlock($text); -} - - -function _RunBlockGamut($text, $hash_html_blocks = TRUE) { -# -# These are all the transformations that form block-level -# tags like paragraphs, headers, and list items. -# - if ($hash_html_blocks) { - # We need to escape raw HTML in Markdown source before doing anything - # else. This need to be done for each block, and not only at the - # begining in the Markdown function since hashed blocks can be part of - # a list item and could have been indented. Indented blocks would have - # been seen as a code block in previous pass of _HashHTMLBlocks. - $text = _HashHTMLBlocks($text); - } - - $text = _DoHeaders($text); - $text = _DoTables($text); - - # Do Horizontal Rules: - global $md_empty_element_suffix; - $text = preg_replace( - array('{^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$}emx', - '{^[ ]{0,2}([ ]? -[ ]?){3,}[ \t]*$}emx', - '{^[ ]{0,2}([ ]? _[ ]?){3,}[ \t]*$}emx'), - "_HashBlock('\n` - # Must come after _DoAnchors(), because you can use < and > - # delimiters in inline links like [this](). - $text = _DoAutoLinks($text); - $text = _EncodeAmpsAndAngles($text); - $text = _DoItalicsAndBold($text); - - # Do hard breaks: - $text = preg_replace('/ {2,}\n/', " or tags. -# $tags_to_skip = "!<(/?)(?:pre|code|kbd|script|math)[\s>]!"; - - foreach ($tokens as $cur_token) { - if ($cur_token[0] == 'tag') { - # Within tags, encode * and _ so they don't conflict - # with their use in Markdown for italics and strong. - # We're replacing each such character with its - # corresponding MD5 checksum value; this is likely - # overkill, but it should prevent us from colliding - # with the escape values by accident. - $cur_token[1] = str_replace(array('*', '_'), - array($md_escape_table['*'], $md_escape_table['_']), - $cur_token[1]); - $text .= $cur_token[1]; - } else { - $t = $cur_token[1]; - $t = _EncodeBackslashEscapes($t); - $text .= $t; - } - } - return $text; -} - - -function _DoAnchors($text) { -# -# Turn Markdown link shortcuts into XHTML
    tags. -# - global $md_nested_brackets; - # - # First, handle reference-style links: [link text] [id] - # - $text = preg_replace_callback("{ - ( # wrap whole match in $1 - \\[ - ($md_nested_brackets) # link text = $2 - \\] - - [ ]? # one optional space - (?:\\n[ ]*)? # one optional newline followed by spaces - - \\[ - (.*?) # id = $3 - \\] - ) - }xs", - '_DoAnchors_reference_callback', $text); - - # - # Next, inline-style links: [link text](url "optional title") - # - $text = preg_replace_callback("{ - ( # wrap whole match in $1 - \\[ - ($md_nested_brackets) # link text = $2 - \\] - \\( # literal paren - [ \\t]* - ? # href = $3 - [ \\t]* - ( # $4 - (['\"]) # quote char = $5 - (.*?) # Title = $6 - \\5 # matching quote - )? # title is optional - \\) - ) - }xs", - '_DoAnchors_inline_callback', $text); - - return $text; -} -function _DoAnchors_reference_callback($matches) { - global $md_urls, $md_titles, $md_escape_table; - $whole_match = $matches[1]; - $link_text = $matches[2]; - $link_id = strtolower($matches[3]); - - if ($link_id == "") { - $link_id = strtolower($link_text); # for shortcut links like [this][]. - } - - if (isset($md_urls[$link_id])) { - $url = $md_urls[$link_id]; - # We've got to encode these to avoid conflicting with italics/bold. - $url = str_replace(array('*', '_'), - array($md_escape_table['*'], $md_escape_table['_']), - $url); - $result = " tags. -# - global $md_nested_brackets; - - # - # First, handle reference-style labeled images: ![alt text][id] - # - $text = preg_replace_callback('{ - ( # wrap whole match in $1 - !\[ - ('.$md_nested_brackets.') # alt text = $2 - \] - - [ ]? # one optional space - (?:\n[ ]*)? # one optional newline followed by spaces - - \[ - (.*?) # id = $3 - \] - - ) - }xs', - '_DoImages_reference_callback', $text); - - # - # Next, handle inline images: ![alt text](url "optional title") - # Don't forget: encode * and _ - - $text = preg_replace_callback('{ - ( # wrap whole match in $1 - !\[ - ('.$md_nested_brackets.') # alt text = $2 - \] - \( # literal paren - [ \t]* - ? # src url = $3 - [ \t]* - ( # $4 - ([\'"]) # quote char = $5 - (.*?) # title = $6 - \5 # matching quote - [ \t]* - )? # title is optional - \) - ) - }xs', - '_DoImages_inline_callback', $text); - - return $text; -} -function _DoImages_reference_callback($matches) { - global $md_urls, $md_titles, $md_empty_element_suffix, $md_escape_table; - $whole_match = $matches[1]; - $alt_text = $matches[2]; - $link_id = strtolower($matches[3]); - - if ($link_id == "") { - $link_id = strtolower($alt_text); # for shortcut links like ![this][]. - } - - $alt_text = str_replace('"', '"', $alt_text); - if (isset($md_urls[$link_id])) { - $url = $md_urls[$link_id]; - # We've got to encode these to avoid conflicting with italics/bold. - $url = str_replace(array('*', '_'), - array($md_escape_table['*'], $md_escape_table['_']), - $url); - $result = "\"$alt_text\"";'._RunSpanGamut(_UnslashQuotes('\\1')).'' - ) . '\n\n'", - "_HashBlock(''._RunSpanGamut(_UnslashQuotes('\\1')).'' - ) . '\n\n'"), - $text); - - # atx-style headers: - # # Header 1 - # ## Header 2 - # ## Header 2 with closing hashes ## - # ... - # ###### Header 6 - # - $text = preg_replace('{ - ^(\#{1,6}) # $1 = string of #\'s - [ \t]* - (.+?) # $2 = Header text - [ \t]* - \#* # optional closing #\'s (not counted) - (?:[ ]+\{\#([-_:a-zA-Z0-9]+)\}[ ]*)? # id attribute - \n+ - }xme', - "_HashBlock( - ''. - _RunSpanGamut(_UnslashQuotes('\\2')). - '' - ) . '\n\n'", - $text); - - return $text; -} - - -function _DoTables($text) { -# -# Form HTML tables. -# - global $md_tab_width; - $less_than_tab = $md_tab_width - 1; - # - # Find tables with leading pipe. - # - # | Header 1 | Header 2 - # | -------- | -------- - # | Cell 1 | Cell 2 - # | Cell 3 | Cell 4 - # - $text = preg_replace_callback(' - { - ^ # Start of a line - [ ]{0,'.$less_than_tab.'} # Allowed whitespace. - [|] # Optional leading pipe (present) - (.+) \n # $1: Header row (at least one pipe) - - [ ]{0,'.$less_than_tab.'} # Allowed whitespace. - [|] ([ ]*[-:]+[-| :]*) \n # $2: Header underline - - ( # $3: Cells - (?: - [ ]* # Allowed whitespace. - [|] .* \n # Row content. - )* - ) - (?=\n|\Z) # Stop at final double newline. - }xm', - '_DoTable_LeadingPipe_callback', $text); - - # - # Find tables without leading pipe. - # - # Header 1 | Header 2 - # -------- | -------- - # Cell 1 | Cell 2 - # Cell 3 | Cell 4 - # - $text = preg_replace_callback(' - { - ^ # Start of a line - [ ]{0,'.$less_than_tab.'} # Allowed whitespace. - (\S.*[|].*) \n # $1: Header row (at least one pipe) - - [ ]{0,'.$less_than_tab.'} # Allowed whitespace. - ([-:]+[ ]*[|][-| :]*) \n # $2: Header underline - - ( # $3: Cells - (?: - .* [|] .* \n # Row content - )* - ) - (?=\n|\Z) # Stop at final double newline. - }xm', - '_DoTable_callback', $text); - - return $text; -} -function _DoTable_LeadingPipe_callback($matches) { - $head = $matches[1]; - $underline = $matches[2]; - $content = $matches[3]; - - # Remove leading pipe for each row. - $content = preg_replace('/^ *[|]/m', '', $content); - - return _DoTable_callback(array($matches[0], $head, $underline, $content)); -} -function _DoTable_callback($matches) { - $head = $matches[1]; - $underline = $matches[2]; - $content = $matches[3]; - - # Remove any tailing pipes for each line. - $head = preg_replace('/[|] *$/m', '', $head); - $underline = preg_replace('/[|] *$/m', '', $underline); - $content = preg_replace('/[|] *$/m', '', $content); - - # Reading alignement from header underline. - $separators = preg_split('/ *[|] */', $underline); - foreach ($separators as $n => $s) { - if (preg_match('/^ *-+: *$/', $s)) $attr[$n] = ' align="right"'; - else if (preg_match('/^ *:-+: *$/', $s))$attr[$n] = ' align="center"'; - else if (preg_match('/^ *:-+ *$/', $s)) $attr[$n] = ' align="left"'; - else $attr[$n] = ''; - } - - # Creating code spans before splitting the row is an easy way to - # handle a code span containg pipes. - $head = _DoCodeSpans($head); - $headers = preg_split('/ *[|] */', $head); - $col_count = count($headers); - - # Write column headers. - $text = "\n"; - $text .= "\n"; - $text .= "\n"; - foreach ($headers as $n => $header) - $text .= " "._RunSpanGamut(trim($header))."\n"; - $text .= "\n"; - $text .= "\n"; - - # Split content by row. - $rows = explode("\n", trim($content, "\n")); - - $text .= "\n"; - foreach ($rows as $row) { - # Creating code spans before splitting the row is an easy way to - # handle a code span containg pipes. - $row = _DoCodeSpans($row); - - # Split row by cell. - $row_cells = preg_split('/ *[|] */', $row, $col_count); - $row_cells = array_pad($row_cells, $col_count, ''); - - $text .= "\n"; - foreach ($row_cells as $n => $cell) - $text .= " "._RunSpanGamut(trim($cell))."\n"; - $text .= "\n"; - } - $text .= "\n"; - $text .= "
    "; - - return _HashBlock($text) . "\n"; -} - - -function _DoLists($text) { -# -# Form HTML ordered (numbered) and unordered (bulleted) lists. -# - global $md_tab_width, $md_list_level; - $less_than_tab = $md_tab_width - 1; - - # Re-usable patterns to match list item bullets and number markers: - $marker_ul = '[*+-]'; - $marker_ol = '\d+[.]'; - $marker_any = "(?:$marker_ul|$marker_ol)"; - - $markers = array($marker_ul, $marker_ol); - - foreach ($markers as $marker) { - # Re-usable pattern to match any entirel ul or ol list: - $whole_list = ' - ( # $1 = whole list - ( # $2 - [ ]{0,'.$less_than_tab.'} - ('.$marker.') # $3 = first list item marker - [ \t]+ - ) - (?s:.+?) - ( # $4 - \z - | - \n{2,} - (?=\S) - (?! # Negative lookahead for another list item marker - [ \t]* - '.$marker.'[ \t]+ - ) - ) - ) - '; // mx - - # We use a different prefix before nested lists than top-level lists. - # See extended comment in _ProcessListItems(). - - if ($md_list_level) { - $text = preg_replace_callback('{ - ^ - '.$whole_list.' - }mx', - '_DoLists_callback', $text); - } - else { - $text = preg_replace_callback('{ - (?:(?<=\n\n)|\A\n?) - '.$whole_list.' - }mx', - '_DoLists_callback', $text); - } - } - - return $text; -} -function _DoLists_callback($matches) { - # Re-usable patterns to match list item bullets and number markers: - $marker_ul = '[*+-]'; - $marker_ol = '\d+[.]'; - $marker_any = "(?:$marker_ul|$marker_ol)"; - - $list = $matches[1]; - $list_type = preg_match("/$marker_ul/", $matches[3]) ? "ul" : "ol"; - - $marker_any = ( $list_type == "ul" ? $marker_ul : $marker_ol ); - - # Turn double returns into triple returns, so that we can make a - # paragraph for the last item in a list, if necessary: - $list = preg_replace("/\n{2,}/", "\n\n\n", $list); - $result = _ProcessListItems($list, $marker_any); - $result = "<$list_type>\n" . $result . ""; - return "\n" . _HashBlock($result) . "\n\n"; -} - - -function _ProcessListItems($list_str, $marker_any) { -# -# Process the contents of a single ordered or unordered list, splitting it -# into individual list items. -# - global $md_list_level; - - # The $md_list_level global keeps track of when we're inside a list. - # Each time we enter a list, we increment it; when we leave a list, - # we decrement. If it's zero, we're not in a list anymore. - # - # We do this because when we're not inside a list, we want to treat - # something like this: - # - # I recommend upgrading to version - # 8. Oops, now this line is treated - # as a sub-list. - # - # As a single paragraph, despite the fact that the second line starts - # with a digit-period-space sequence. - # - # Whereas when we're inside a list (or sub-list), that line will be - # treated as the start of a sub-list. What a kludge, huh? This is - # an aspect of Markdown's syntax that's hard to parse perfectly - # without resorting to mind-reading. Perhaps the solution is to - # change the syntax rules such that sub-lists must start with a - # starting cardinal number; e.g. "1." or "a.". - - $md_list_level++; - - # trim trailing blank lines: - $list_str = preg_replace("/\n{2,}\\z/", "\n", $list_str); - - $list_str = preg_replace_callback('{ - (\n)? # leading line = $1 - (^[ \t]*) # leading whitespace = $2 - ('.$marker_any.') [ \t]+ # list marker = $3 - ((?s:.+?) # list item text = $4 - (\n{1,2})) - (?= \n* (\z | \2 ('.$marker_any.') [ \t]+)) - }xm', - '_ProcessListItems_callback', $list_str); - - $md_list_level--; - return $list_str; -} -function _ProcessListItems_callback($matches) { - $item = $matches[4]; - $leading_line =& $matches[1]; - $leading_space =& $matches[2]; - - if ($leading_line || preg_match('/\n{2,}/', $item)) { - $item = _RunBlockGamut(_Outdent($item)); - } - else { - # Recursion for sub-lists: - $item = _DoLists(_Outdent($item)); - $item = preg_replace('/\n+$/', '', $item); - $item = _RunSpanGamut($item); - } - - return "
  • " . $item . "
  • \n"; -} - - -function _DoDefLists($text) { -# -# Form HTML definition lists. -# - global $md_tab_width; - $less_than_tab = $md_tab_width - 1; - - # Re-usable patterns to match list item bullets and number markers: - - # Re-usable pattern to match any entire dl list: - $whole_list = ' - ( # $1 = whole list - ( # $2 - [ ]{0,'.$less_than_tab.'} - ((?>.*\S.*\n)+) # $3 = defined term - \n? - [ ]{0,'.$less_than_tab.'}:[ ]+ # colon starting definition - ) - (?s:.+?) - ( # $4 - \z - | - \n{2,} - (?=\S) - (?! # Negative lookahead for another term - [ ]{0,'.$less_than_tab.'} - (?: \S.*\n )+? # defined term - \n? - [ ]{0,'.$less_than_tab.'}:[ ]+ # colon starting definition - ) - (?! # Negative lookahead for another definition - [ ]{0,'.$less_than_tab.'}:[ ]+ # colon starting definition - ) - ) - ) - '; // mx - - $text = preg_replace_callback('{ - (?:(?<=\n\n)|\A\n?) - '.$whole_list.' - }mx', - '_DoDefLists_callback', $text); - - return $text; -} -function _DoDefLists_callback($matches) { - # Re-usable patterns to match list item bullets and number markers: - $list = $matches[1]; - - # Turn double returns into triple returns, so that we can make a - # paragraph for the last item in a list, if necessary: - $result = trim(_ProcessDefListItems($list)); - $result = "
    \n" . $result . "\n
    "; - return _HashBlock($result) . "\n\n"; -} - - -function _ProcessDefListItems($list_str) { -# -# Process the contents of a single ordered or unordered list, splitting it -# into individual list items. -# - global $md_tab_width; - $less_than_tab = $md_tab_width - 1; - - # trim trailing blank lines: - $list_str = preg_replace("/\n{2,}\\z/", "\n", $list_str); - - # Process definition terms. - $list_str = preg_replace_callback('{ - (?:\n\n+|\A\n?) # leading line - ( # definition terms = $1 - [ ]{0,'.$less_than_tab.'} # leading whitespace - (?![:][ ]|[ ]) # negative lookahead for a definition - # mark (colon) or more whitespace. - (?: \S.* \n)+? # actual term (not whitespace). - ) - (?=\n?[ ]{0,3}:[ ]) # lookahead for following line feed - # with a definition mark. - }xm', - '_ProcessDefListItems_callback_dt', $list_str); - - # Process actual definitions. - $list_str = preg_replace_callback('{ - \n(\n+)? # leading line = $1 - [ ]{0,'.$less_than_tab.'} # whitespace before colon - [:][ ]+ # definition mark (colon) - ((?s:.+?)) # definition text = $2 - (?= \n+ # stop at next definition mark, - (?: # next term or end of text - [ ]{0,'.$less_than_tab.'} [:][ ] | -
    | \z - ) - ) - }xm', - '_ProcessDefListItems_callback_dd', $list_str); - - return $list_str; -} -function _ProcessDefListItems_callback_dt($matches) { - $terms = explode("\n", trim($matches[1])); - $text = ''; - foreach ($terms as $term) { - $term = _RunSpanGamut(trim($term)); - $text .= "\n
    " . $term . "
    "; - } - return $text . "\n"; -} -function _ProcessDefListItems_callback_dd($matches) { - $leading_line = $matches[1]; - $def = $matches[2]; - - if ($leading_line || preg_match('/\n{2,}/', $def)) { - $def = _RunBlockGamut(_Outdent($def . "\n\n")); - $def = "\n". $def ."\n"; - } - else { - $def = rtrim($def); - $def = _RunSpanGamut(_Outdent($def)); - } - - return "\n
    " . $def . "
    \n"; -} - - -function _DoCodeBlocks($text) { -# -# Process Markdown `
    ` blocks.
    -#
    -	global $md_tab_width;
    -	$text = preg_replace_callback("{
    -			(?:\\n\\n|\\A)
    -			(	            # $1 = the code block -- one or more lines, starting with a space/tab
    -			  (?:
    -				(?:[ ]\{$md_tab_width} | \\t)  # Lines must start with a tab or a tab-width of spaces
    -				.*\\n+
    -			  )+
    -			)
    -			((?=^[ ]{0,$md_tab_width}\\S)|\\Z)	# Lookahead for non-space at line-start, or end of doc
    -		}xm",
    -		'_DoCodeBlocks_callback', $text);
    -
    -	return $text;
    -}
    -function _DoCodeBlocks_callback($matches) {
    -	$codeblock = $matches[1];
    -
    -	$codeblock = _EncodeCode(_Outdent($codeblock));
    -//	$codeblock = _Detab($codeblock);
    -	# trim leading newlines and trailing whitespace
    -	$codeblock = preg_replace(array('/\A\n+/', '/\s+\z/'), '', $codeblock);
    -
    -	$result = "
    " . $codeblock . "\n
    "; - - return "\n\n" . _HashBlock($result) . "\n\n"; -} - - -function _DoCodeSpans($text) { -# -# * Backtick quotes are used for spans. -# -# * You can use multiple backticks as the delimiters if you want to -# include literal backticks in the code span. So, this input: -# -# Just type ``foo `bar` baz`` at the prompt. -# -# Will translate to: -# -#

    Just type foo `bar` baz at the prompt.

    -# -# There's no arbitrary limit to the number of backticks you -# can use as delimters. If you need three consecutive backticks -# in your code, use four for delimiters, etc. -# -# * You can use spaces to get literal backticks at the edges: -# -# ... type `` `bar` `` ... -# -# Turns to: -# -# ... type `bar` ... -# - $text = preg_replace_callback('@ - (?$c
    "; -} - - -function _EncodeCode($_) { -# -# Encode/escape certain characters inside Markdown code runs. -# The point is that in code, these characters are literals, -# and lose their special Markdown meanings. -# - global $md_escape_table; - - # Encode all ampersands; HTML entities are not - # entities within a Markdown code span. - $_ = str_replace('&', '&', $_); - - # Do the angle bracket song and dance: - $_ = str_replace(array('<', '>'), - array('<', '>'), $_); - - # Now, escape characters that are magic in Markdown: - $_ = str_replace(array_keys($md_escape_table), - array_values($md_escape_table), $_); - - return $_; -} - - -function _DoItalicsAndBold($text) { - # must go first: - $text = preg_replace(array( - '{ - ( (? - [^_]+? # Anthing not em markers. - | - # Balence any regular _ emphasis inside. - (? - [^*]+? # Anthing not em markers. - | - # Balence any regular * emphasis inside. - \* (?=\S) (?! \*) (.+?) (?<=\S) \* - )+? - ) - (?<=\S) \*\* # End mark not preceded by whitespace. - }sx', - ), - '\2', $text); - # Then : - $text = preg_replace(array( - '{ ( (?\2', $text); - - return $text; -} - - -function _DoBlockQuotes($text) { - $text = preg_replace_callback('/ - ( # Wrap whole match in $1 - ( - ^[ \t]*>[ \t]? # ">" at the start of a line - .+\n # rest of the first line - (.+\n)* # subsequent consecutive lines - \n* # blanks - )+ - ) - /xm', - '_DoBlockQuotes_callback', $text); - - return $text; -} -function _DoBlockQuotes_callback($matches) { - $bq = $matches[1]; - # trim one level of quoting - trim whitespace-only lines - $bq = preg_replace(array('/^[ \t]*>[ \t]?/m', '/^[ \t]+$/m'), '', $bq); - $bq = _RunBlockGamut($bq); # recurse - - $bq = preg_replace('/^/m', " ", $bq); - # These leading spaces screw with
     content, so we need to fix that:
    -	$bq = preg_replace_callback('{(\s*
    .+?
    )}sx', - '_DoBlockQuotes_callback2', $bq); - - return _HashBlock("
    \n$bq\n
    ") . "\n\n"; -} -function _DoBlockQuotes_callback2($matches) { - $pre = $matches[1]; - $pre = preg_replace('/^ /m', '', $pre); - return $pre; -} - - -function _FormParagraphs($text) { -# -# Params: -# $text - string to process with html

    tags -# - global $md_html_blocks, $md_html_hashes; - - # Strip leading and trailing lines: - $text = preg_replace(array('/\A\n+/', '/\n+\z/'), '', $text); - - $grafs = preg_split('/\n{2,}/', $text, -1, PREG_SPLIT_NO_EMPTY); - - # - # Wrap

    tags and unhashify HTML blocks - # - foreach ($grafs as $key => $value) { - $value = trim(_RunSpanGamut($value)); - - # Check if this should be enclosed in a paragraph. - # Text equaling to a clean tag hash are not enclosed. - # Text starting with a block tag hash are not either. - $clean_key = $value; - $block_key = substr($value, 0, 32); - - $is_p = (!isset($md_html_blocks[$block_key]) && - !isset($md_html_hashes[$clean_key])); - - if ($is_p) { - $value = "

    $value

    "; - } - $grafs[$key] = $value; - } - - # Join grafs in one text, then unhash HTML tags. - $text = implode("\n\n", $grafs); - - # Finish by removing any tag hashes still present in $text. - $text = _UnhashTags($text); - - return $text; -} - - -function _EncodeAmpsAndAngles($text) { -# Smart processing for ampersands and angle brackets that need to be encoded. - - # Ampersand-encoding based entirely on Nat Irons's Amputator MT plugin: - # http://bumppo.net/projects/amputator/ - $text = preg_replace('/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/', - '&', $text);; - - # Encode naked <'s - $text = preg_replace('{<(?![a-z/?\$!])}i', '<', $text); - - return $text; -} - - -function _EncodeBackslashEscapes($text) { -# -# Parameter: String. -# Returns: The string, with after processing the following backslash -# escape sequences. -# - global $md_escape_table, $md_backslash_escape_table; - # Must process escaped backslashes first. - return str_replace(array_keys($md_backslash_escape_table), - array_values($md_backslash_escape_table), $text); -} - - -function _DoAutoLinks($text) { - $text = preg_replace("!<((https?|ftp):[^'\">\\s]+)>!", - '
    \1', $text); - - # Email addresses: - $text = preg_replace('{ - < - (?:mailto:)? - ( - [-.\w]+ - \@ - [-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+ - ) - > - }exi', - "_EncodeEmailAddress(_UnescapeSpecialChars(_UnslashQuotes('\\1')))", - $text); - - return $text; -} - - -function _EncodeEmailAddress($addr) { -# -# Input: an email address, e.g. "foo@example.com" -# -# Output: the email address as a mailto link, with each character -# of the address encoded as either a decimal or hex entity, in -# the hopes of foiling most address harvesting spam bots. E.g.: -# -# foo -# @example.com -# -# Based by a filter by Matthew Wickline, posted to the BBEdit-Talk -# mailing list: -# - $addr = "mailto:" . $addr; - $length = strlen($addr); - - # leave ':' alone (to spot mailto: later) - $addr = preg_replace_callback('/([^\:])/', - '_EncodeEmailAddress_callback', $addr); - - $addr = "$addr"; - # strip the mailto: from the visible part - $addr = preg_replace('/">.+?:/', '">', $addr); - - return $addr; -} -function _EncodeEmailAddress_callback($matches) { - $char = $matches[1]; - $r = rand(0, 100); - # roughly 10% raw, 45% hex, 45% dec - # '@' *must* be encoded. I insist. - if ($r > 90 && $char != '@') return $char; - if ($r < 45) return '&#x'.dechex(ord($char)).';'; - return '&#'.ord($char).';'; -} - - -function _UnescapeSpecialChars($text) { -# -# Swap back in all the special characters we've hidden. -# - global $md_escape_table; - return str_replace(array_values($md_escape_table), - array_keys($md_escape_table), $text); -} - - -function _UnhashTags($text) { -# -# Swap back in all the tags hashed by _HashHTMLBlocks. -# - global $md_html_hashes; - return str_replace(array_keys($md_html_hashes), - array_values($md_html_hashes), $text); -} - - -# _TokenizeHTML is shared between PHP Markdown and PHP SmartyPants. -# We only define it if it is not already defined. -if (!function_exists('_TokenizeHTML')) : -function _TokenizeHTML($str) { -# -# Parameter: String containing HTML markup. -# Returns: An array of the tokens comprising the input -# string. Each token is either a tag (possibly with nested, -# tags contained therein, such as , or a -# run of text between tags. Each element of the array is a -# two-element array; the first is either 'tag' or 'text'; -# the second is the actual value. -# -# -# Regular expression derived from the _tokenize() subroutine in -# Brad Choate's MTRegex plugin. -# -# - $index = 0; - $tokens = array(); - - $match = '(?s:)|'. # comment - '(?s:<\?.*?\?>)|'. # processing instruction - # regular tags - '(?:<[/!$]?[-a-zA-Z0-9:]+\b(?>[^"\'>]+|"[^"]*"|\'[^\']*\')*>)'; - - $parts = preg_split("{($match)}", $str, -1, PREG_SPLIT_DELIM_CAPTURE); - - foreach ($parts as $part) { - if (++$index % 2 && $part != '') - $tokens[] = array('text', $part); - else - $tokens[] = array('tag', $part); - } - - return $tokens; -} -endif; - - -function _Outdent($text) { -# -# Remove one level of line-leading tabs or spaces -# - global $md_tab_width; - return preg_replace("/^(\\t|[ ]{1,$md_tab_width})/m", "", $text); -} - - -function _Detab($text) { -# -# Replace tabs with the appropriate amount of space. -# - global $md_tab_width; - - # For each line we separate the line in blocks delemited by - # tab characters. Then we reconstruct every line by adding the - # appropriate number of space between each blocks. - - $lines = explode("\n", $text); - $text = ""; - - foreach ($lines as $line) { - # Split in blocks. - $blocks = explode("\t", $line); - # Add each blocks to the line. - $line = $blocks[0]; - unset($blocks[0]); # Do not add first block twice. - foreach ($blocks as $block) { - # Calculate amount of space, insert spaces, insert block. - $amount = $md_tab_width - strlen($line) % $md_tab_width; - $line .= str_repeat(" ", $amount) . $block; - } - $text .= "$line\n"; - } - return $text; -} - - -function _UnslashQuotes($text) { -# -# This function is useful to remove automaticaly slashed double quotes -# when using preg_replace and evaluating an expression. -# Parameter: String. -# Returns: The string with any slash-double-quote (\") sequence replaced -# by a single double quote. -# - return str_replace('\"', '"', $text); -} - - -/* - -PHP Markdown Extra -================== - -Description ------------ - -This is a PHP translation of the original Markdown formatter written in -Perl by John Gruber. This special version of PHP Markdown also include -syntax additions by myself. - -Markdown is a text-to-HTML filter; it translates an easy-to-read / -easy-to-write structured text format into HTML. Markdown's text format -is most similar to that of plain text email, and supports features such -as headers, *emphasis*, code blocks, blockquotes, and links. - -Markdown's syntax is designed not as a generic markup language, but -specifically to serve as a front-end to (X)HTML. You can use span-level -HTML tags anywhere in a Markdown document, and you can use block level -HTML tags (like
    and as well). - -For more information about Markdown's syntax, see: - - - - -Bugs ----- - -To file bug reports please send email to: - - - -Please include with your report: (1) the example input; (2) the output you -expected; (3) the output Markdown actually produced. - - -Version History ---------------- - -See Readme file for details. - -Extra 1.0 - 5 September 2005 - -Extra 1.0b4 - 1 August 2005 - -Extra 1.0b3 - 29 July 2005 - -Extra 1.0b2 - 26 July 2005 - -Extra 1.0b1 - 25 July 2005 - - -Author & Contributors ---------------------- - -Original Markdown in Perl by John Gruber - - -PHP port and extras by Michel Fortin - - - -Copyright and License ---------------------- - -Copyright (c) 2004-2005 Michel Fortin - -All rights reserved. - -Based on Markdown -Copyright (c) 2003-2004 John Gruber - -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -* Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -* Neither the name "Markdown" nor the names of its contributors may - be used to endorse or promote products derived from this software - without specific prior written permission. - -This software is provided by the copyright holders and contributors "as -is" and any express or implied warranties, including, but not limited -to, the implied warranties of merchantability and fitness for a -particular purpose are disclaimed. In no event shall the copyright owner -or contributors be liable for any direct, indirect, incidental, special, -exemplary, or consequential damages (including, but not limited to, -procurement of substitute goods or services; loss of use, data, or -profits; or business interruption) however caused and on any theory of -liability, whether in contract, strict liability, or tort (including -negligence or otherwise) arising in any way out of the use of this -software, even if advised of the possibility of such damage. - -*/ -?> \ No newline at end of file diff --git a/includes/smarty/plugins/modifier.smartypants.php b/includes/smarty/plugins/modifier.smartypants.php deleted file mode 100644 index 38c29f5f..00000000 --- a/includes/smarty/plugins/modifier.smartypants.php +++ /dev/null @@ -1,854 +0,0 @@ - -# -# PHP port by Michel Fortin -# -# -# Copyright (c) 2003-2004 John Gruber -# Copyright (c) 2004-2005 Michel Fortin -# - - -global $SmartyPantsPHPVersion, $SmartyPantsSyntaxVersion, - $smartypants_attr, $sp_tags_to_skip; - -$SmartyPantsPHPVersion = '1.5.1d'; # Mon 6 Jun 2005 -$SmartyPantsSyntaxVersion = '1.5.1'; # Fri 12 Mar 2004 - - -# Configurable variables: -$smartypants_attr = "1"; # Change this to configure. - # 1 => "--" for em-dashes; no en-dash support - # 2 => "---" for em-dashes; "--" for en-dashes - # 3 => "--" for em-dashes; "---" for en-dashes - # See docs for more configuration options. - -# Globals: -$sp_tags_to_skip = '<(/?)(?:pre|code|kbd|script|math)[\s>]'; - - -# -- WordPress plugin interface ----------------------------------------------- -/* -Plugin Name: SmartyPants -Plugin URI: http://www.michelf.com/projects/php-smartypants/ -Description: SmartyPants is a web publishing utility that translates plain ASCII punctuation characters into “smart” typographic punctuation HTML entities. This plugin replace the default WordPress Texturize algorithm for the content and the title of your posts, the comments body and author name, and everywhere else Texturize normally apply. Based on the original Perl version by John Gruber. -Version: 1.5.1c -Author: Michel Fortin -Author URI: http://www.michelf.com/ -*/ -if (isset($wp_version)) { - # Remove default Texturize filter that would conflict with SmartyPants. - remove_filter('category_description', 'wptexturize'); - remove_filter('list_cats', 'wptexturize'); - remove_filter('comment_author', 'wptexturize'); - remove_filter('comment_text', 'wptexturize'); - remove_filter('single_post_title', 'wptexturize'); - remove_filter('the_title', 'wptexturize'); - remove_filter('the_content', 'wptexturize'); - remove_filter('the_excerpt', 'wptexturize'); - # Add SmartyPants filter with priority 10 (same as Texturize). - add_filter('category_description', 'SmartyPants', 10); - add_filter('list_cats', 'SmartyPants', 10); - add_filter('comment_author', 'SmartyPants', 10); - add_filter('comment_text', 'SmartyPants', 10); - add_filter('single_post_title', 'SmartyPants', 10); - add_filter('the_title', 'SmartyPants', 10); - add_filter('the_content', 'SmartyPants', 10); - add_filter('the_excerpt', 'SmartyPants', 10); -} - -# -- Smarty Modifier Interface ------------------------------------------------ -function smarty_modifier_smartypants($text, $attr = NULL) { - return SmartyPants($text, $attr); -} - - - -function SmartyPants($text, $attr = NULL, $ctx = NULL) { - global $smartypants_attr, $sp_tags_to_skip; - # Paramaters: - $text; # text to be parsed - $attr; # value of the smart_quotes="" attribute - $ctx; # MT context object (unused) - if ($attr == NULL) $attr = $smartypants_attr; - - # Options to specify which transformations to make: - $do_stupefy = FALSE; - $convert_quot = 0; # should we translate " entities into normal quotes? - - # Parse attributes: - # 0 : do nothing - # 1 : set all - # 2 : set all, using old school en- and em- dash shortcuts - # 3 : set all, using inverted old school en and em- dash shortcuts - # - # q : quotes - # b : backtick quotes (``double'' only) - # B : backtick quotes (``double'' and `single') - # d : dashes - # D : old school dashes - # i : inverted old school dashes - # e : ellipses - # w : convert " entities to " for Dreamweaver users - - if ($attr == "0") { - # Do nothing. - return $text; - } - else if ($attr == "1") { - # Do everything, turn all options on. - $do_quotes = 1; - $do_backticks = 1; - $do_dashes = 1; - $do_ellipses = 1; - } - else if ($attr == "2") { - # Do everything, turn all options on, use old school dash shorthand. - $do_quotes = 1; - $do_backticks = 1; - $do_dashes = 2; - $do_ellipses = 1; - } - else if ($attr == "3") { - # Do everything, turn all options on, use inverted old school dash shorthand. - $do_quotes = 1; - $do_backticks = 1; - $do_dashes = 3; - $do_ellipses = 1; - } - else if ($attr == "-1") { - # Special "stupefy" mode. - $do_stupefy = 1; - } - else { - $chars = preg_split('//', $attr); - foreach ($chars as $c){ - if ($c == "q") { $do_quotes = 1; } - else if ($c == "b") { $do_backticks = 1; } - else if ($c == "B") { $do_backticks = 2; } - else if ($c == "d") { $do_dashes = 1; } - else if ($c == "D") { $do_dashes = 2; } - else if ($c == "i") { $do_dashes = 3; } - else if ($c == "e") { $do_ellipses = 1; } - else if ($c == "w") { $convert_quot = 1; } - else { - # Unknown attribute option, ignore. - } - } - } - - $tokens = _TokenizeHTML($text); - $result = ''; - $in_pre = 0; # Keep track of when we're inside
     or  tags.
    -
    -	$prev_token_last_char = "";     # This is a cheat, used to get some context
    -									# for one-character tokens that consist of 
    -									# just a quote char. What we do is remember
    -									# the last character of the previous text
    -									# token, to use as context to curl single-
    -									# character quote tokens correctly.
    -
    -	foreach ($tokens as $cur_token) {
    -		if ($cur_token[0] == "tag") {
    -			# Don't mess with quotes inside tags.
    -			$result .= $cur_token[1];
    -			if (preg_match("@$sp_tags_to_skip@", $cur_token[1], $matches)) {
    -				$in_pre = isset($matches[1]) && $matches[1] == '/' ? 0 : 1;
    -			}
    -		} else {
    -			$t = $cur_token[1];
    -			$last_char = substr($t, -1); # Remember last char of this token before processing.
    -			if (! $in_pre) {
    -				$t = ProcessEscapes($t);
    -
    -				if ($convert_quot) {
    -					$t = preg_replace('/"/', '"', $t);
    -				}
    -
    -				if ($do_dashes) {
    -					if ($do_dashes == 1) $t = EducateDashes($t);
    -					if ($do_dashes == 2) $t = EducateDashesOldSchool($t);
    -					if ($do_dashes == 3) $t = EducateDashesOldSchoolInverted($t);
    -				}
    -
    -				if ($do_ellipses) $t = EducateEllipses($t);
    -
    -				# Note: backticks need to be processed before quotes.
    -				if ($do_backticks) {
    -					$t = EducateBackticks($t);
    -					if ($do_backticks == 2) $t = EducateSingleBackticks($t);
    -				}
    -
    -				if ($do_quotes) {
    -					if ($t == "'") {
    -						# Special case: single-character ' token
    -						if (preg_match('/\S/', $prev_token_last_char)) {
    -							$t = "’";
    -						}
    -						else {
    -							$t = "‘";
    -						}
    -					}
    -					else if ($t == '"') {
    -						# Special case: single-character " token
    -						if (preg_match('/\S/', $prev_token_last_char)) {
    -							$t = "”";
    -						}
    -						else {
    -							$t = "“";
    -						}
    -					}
    -					else {
    -						# Normal case:
    -						$t = EducateQuotes($t);
    -					}
    -				}
    -
    -				if ($do_stupefy) $t = StupefyEntities($t);
    -			}
    -			$prev_token_last_char = $last_char;
    -			$result .= $t;
    -		}
    -	}
    -
    -	return $result;
    -}
    -
    -
    -function SmartQuotes($text, $attr = NULL, $ctx = NULL) {
    -	global $smartypants_attr, $sp_tags_to_skip;
    -	# Paramaters:
    -	$text;   # text to be parsed
    -	$attr;   # value of the smart_quotes="" attribute
    -	$ctx;    # MT context object (unused)
    -	if ($attr == NULL) $attr = $smartypants_attr;
    -
    -	$do_backticks;   # should we educate ``backticks'' -style quotes?
    -
    -	if ($attr == 0) {
    -		# do nothing;
    -		return $text;
    -	}
    -	else if ($attr == 2) {
    -		# smarten ``backticks'' -style quotes
    -		$do_backticks = 1;
    -	}
    -	else {
    -		$do_backticks = 0;
    -	}
    -
    -	# Special case to handle quotes at the very end of $text when preceded by
    -	# an HTML tag. Add a space to give the quote education algorithm a bit of
    -	# context, so that it can guess correctly that it's a closing quote:
    -	$add_extra_space = 0;
    -	if (preg_match("/>['\"]\\z/", $text)) {
    -		$add_extra_space = 1; # Remember, so we can trim the extra space later.
    -		$text .= " ";
    -	}
    -
    -	$tokens = _TokenizeHTML($text);
    -	$result = '';
    -	$in_pre = 0;  # Keep track of when we're inside 
     or  tags
    -
    -	$prev_token_last_char = "";     # This is a cheat, used to get some context
    -									# for one-character tokens that consist of 
    -									# just a quote char. What we do is remember
    -									# the last character of the previous text
    -									# token, to use as context to curl single-
    -									# character quote tokens correctly.
    -
    -	foreach ($tokens as $cur_token) {
    -		if ($cur_token[0] == "tag") {
    -			# Don't mess with quotes inside tags
    -			$result .= $cur_token[1];
    -			if (preg_match("@$sp_tags_to_skip@", $cur_token[1], $matches)) {
    -				$in_pre = isset($matches[1]) && $matches[1] == '/' ? 0 : 1;
    -			}
    -		} else {
    -			$t = $cur_token[1];
    -			$last_char = substr($t, -1); # Remember last char of this token before processing.
    -			if (! $in_pre) {
    -				$t = ProcessEscapes($t);
    -				if ($do_backticks) {
    -					$t = EducateBackticks($t);
    -				}
    -
    -				if ($t == "'") {
    -					# Special case: single-character ' token
    -					if (preg_match('/\S/', $prev_token_last_char)) {
    -						$t = "’";
    -					}
    -					else {
    -						$t = "‘";
    -					}
    -				}
    -				else if ($t == '"') {
    -					# Special case: single-character " token
    -					if (preg_match('/\S/', $prev_token_last_char)) {
    -						$t = "”";
    -					}
    -					else {
    -						$t = "“";
    -					}
    -				}
    -				else {
    -					# Normal case:
    -					$t = EducateQuotes($t);
    -				}
    -
    -			}
    -			$prev_token_last_char = $last_char;
    -			$result .= $t;
    -		}
    -	}
    -
    -	if ($add_extra_space) {
    -		preg_replace('/ \z/', '', $result);  # Trim trailing space if we added one earlier.
    -	}
    -	return $result;
    -}
    -
    -
    -function SmartDashes($text, $attr = NULL, $ctx = NULL) {
    -	global $smartypants_attr, $sp_tags_to_skip;
    -	# Paramaters:
    -	$text;   # text to be parsed
    -	$attr;   # value of the smart_dashes="" attribute
    -	$ctx;    # MT context object (unused)
    -	if ($attr == NULL) $attr = $smartypants_attr;
    -
    -	# reference to the subroutine to use for dash education, default to EducateDashes:
    -	$dash_sub_ref = 'EducateDashes';
    -
    -	if ($attr == 0) {
    -		# do nothing;
    -		return $text;
    -	}
    -	else if ($attr == 2) {
    -		# use old smart dash shortcuts, "--" for en, "---" for em
    -		$dash_sub_ref = 'EducateDashesOldSchool'; 
    -	}
    -	else if ($attr == 3) {
    -		# inverse of 2, "--" for em, "---" for en
    -		$dash_sub_ref = 'EducateDashesOldSchoolInverted'; 
    -	}
    -
    -	$tokens;
    -	$tokens = _TokenizeHTML($text);
    -
    -	$result = '';
    -	$in_pre = 0;  # Keep track of when we're inside 
     or  tags
    -	foreach ($tokens as $cur_token) {
    -		if ($cur_token[0] == "tag") {
    -			# Don't mess with quotes inside tags
    -			$result .= $cur_token[1];
    -			if (preg_match("@$sp_tags_to_skip@", $cur_token[1], $matches)) {
    -				$in_pre = isset($matches[1]) && $matches[1] == '/' ? 0 : 1;
    -			}
    -		} else {
    -			$t = $cur_token[1];
    -			if (! $in_pre) {
    -				$t = ProcessEscapes($t);
    -				$t = $dash_sub_ref($t);
    -			}
    -			$result .= $t;
    -		}
    -	}
    -	return $result;
    -}
    -
    -
    -function SmartEllipses($text, $attr = NULL, $ctx = NULL) {
    -	# Paramaters:
    -	$text;   # text to be parsed
    -	$attr;   # value of the smart_ellipses="" attribute
    -	$ctx;    # MT context object (unused)
    -	if ($attr == NULL) $attr = $smartypants_attr;
    -
    -	if ($attr == 0) {
    -		# do nothing;
    -		return $text;
    -	}
    -
    -	$tokens;
    -	$tokens = _TokenizeHTML($text);
    -
    -	$result = '';
    -	$in_pre = 0;  # Keep track of when we're inside 
     or  tags
    -	foreach ($tokens as $cur_token) {
    -		if ($cur_token[0] == "tag") {
    -			# Don't mess with quotes inside tags
    -			$result .= $cur_token[1];
    -			if (preg_match("@$sp_tags_to_skip@", $cur_token[1], $matches)) {
    -				$in_pre = isset($matches[1]) && $matches[1] == '/' ? 0 : 1;
    -			}
    -		} else {
    -			$t = $cur_token[1];
    -			if (! $in_pre) {
    -				$t = ProcessEscapes($t);
    -				$t = EducateEllipses($t);
    -			}
    -			$result .= $t;
    -		}
    -	}
    -	return $result;
    -}
    -
    -
    -function EducateQuotes($_) {
    -#
    -#   Parameter:  String.
    -#
    -#   Returns:    The string, with "educated" curly quote HTML entities.
    -#
    -#   Example input:  "Isn't this fun?"
    -#   Example output: “Isn’t this fun?”
    -#
    -	# Make our own "punctuation" character class, because the POSIX-style
    -	# [:PUNCT:] is only available in Perl 5.6 or later:
    -	$punct_class = "[!\"#\\$\\%'()*+,-.\\/:;<=>?\\@\\[\\\\\]\\^_`{|}~]";
    -
    -	# Special case if the very first character is a quote
    -	# followed by punctuation at a non-word-break. Close the quotes by brute force:
    -	$_ = preg_replace(
    -		array("/^'(?=$punct_class\\B)/", "/^\"(?=$punct_class\\B)/"),
    -		array('’',                 '”'), $_);
    -
    -
    -	# Special case for double sets of quotes, e.g.:
    -	#   

    He said, "'Quoted' words in a larger quote."

    - $_ = preg_replace( - array("/\"'(?=\w)/", "/'\"(?=\w)/"), - array('“‘', '‘“'), $_); - - # Special case for decade abbreviations (the '80s): - $_ = preg_replace("/'(?=\\d{2}s)/", '’', $_); - - $close_class = '[^\ \t\r\n\[\{\(\-]'; - $dec_dashes = '&\#8211;|&\#8212;'; - - # Get most opening single quotes: - $_ = preg_replace("{ - ( - \\s | # a whitespace char, or -   | # a non-breaking space entity, or - -- | # dashes, or - &[mn]dash; | # named dash entities - $dec_dashes | # or decimal entities - &\\#x201[34]; # or hex - ) - ' # the quote - (?=\\w) # followed by a word character - }x", '\1‘', $_); - # Single closing quotes: - $_ = preg_replace("{ - ($close_class)? - ' - (?(1)| # If $1 captured, then do nothing; - (?=\\s | s\\b) # otherwise, positive lookahead for a whitespace - ) # char or an 's' at a word ending position. This - # is a special case to handle something like: - # \"Custer's Last Stand.\" - }xi", '\1’', $_); - - # Any remaining single quotes should be opening ones: - $_ = str_replace("'", '‘', $_); - - - # Get most opening double quotes: - $_ = preg_replace("{ - ( - \\s | # a whitespace char, or -   | # a non-breaking space entity, or - -- | # dashes, or - &[mn]dash; | # named dash entities - $dec_dashes | # or decimal entities - &\\#x201[34]; # or hex - ) - \" # the quote - (?=\\w) # followed by a word character - }x", '\1“', $_); - - # Double closing quotes: - $_ = preg_replace("{ - ($close_class)? - \" - (?(1)|(?=\\s)) # If $1 captured, then do nothing; - # if not, then make sure the next char is whitespace. - }x", '\1”', $_); - - # Any remaining quotes should be opening ones. - $_ = str_replace('"', '“', $_); - - return $_; -} - - -function EducateBackticks($_) { -# -# Parameter: String. -# Returns: The string, with ``backticks'' -style double quotes -# translated into HTML curly quote entities. -# -# Example input: ``Isn't this fun?'' -# Example output: “Isn't this fun?” -# - - $_ = str_replace(array("``", "''",), - array('“', '”'), $_); - return $_; -} - - -function EducateSingleBackticks($_) { -# -# Parameter: String. -# Returns: The string, with `backticks' -style single quotes -# translated into HTML curly quote entities. -# -# Example input: `Isn't this fun?' -# Example output: ‘Isn’t this fun?’ -# - - $_ = str_replace(array("`", "'",), - array('‘', '’'), $_); - return $_; -} - - -function EducateDashes($_) { -# -# Parameter: String. -# -# Returns: The string, with each instance of "--" translated to -# an em-dash HTML entity. -# - - $_ = str_replace('--', '—', $_); - return $_; -} - - -function EducateDashesOldSchool($_) { -# -# Parameter: String. -# -# Returns: The string, with each instance of "--" translated to -# an en-dash HTML entity, and each "---" translated to -# an em-dash HTML entity. -# - - # em en - $_ = str_replace(array("---", "--",), - array('—', '–'), $_); - return $_; -} - - -function EducateDashesOldSchoolInverted($_) { -# -# Parameter: String. -# -# Returns: The string, with each instance of "--" translated to -# an em-dash HTML entity, and each "---" translated to -# an en-dash HTML entity. Two reasons why: First, unlike the -# en- and em-dash syntax supported by -# EducateDashesOldSchool(), it's compatible with existing -# entries written before SmartyPants 1.1, back when "--" was -# only used for em-dashes. Second, em-dashes are more -# common than en-dashes, and so it sort of makes sense that -# the shortcut should be shorter to type. (Thanks to Aaron -# Swartz for the idea.) -# - - # en em - $_ = str_replace(array("---", "--",), - array('–', '—'), $_); - return $_; -} - - -function EducateEllipses($_) { -# -# Parameter: String. -# Returns: The string, with each instance of "..." translated to -# an ellipsis HTML entity. Also converts the case where -# there are spaces between the dots. -# -# Example input: Huh...? -# Example output: Huh…? -# - - $_ = str_replace(array("...", ". . .",), '…', $_); - return $_; -} - - -function StupefyEntities($_) { -# -# Parameter: String. -# Returns: The string, with each SmartyPants HTML entity translated to -# its ASCII counterpart. -# -# Example input: “Hello — world.” -# Example output: "Hello -- world." -# - - # en-dash em-dash - $_ = str_replace(array('–', '—'), - array('-', '--'), $_); - - # single quote open close - $_ = str_replace(array('‘', '’'), "'", $_); - - # double quote open close - $_ = str_replace(array('“', '”'), '"', $_); - - $_ = str_replace('…', '...', $_); # ellipsis - - return $_; -} - - -function ProcessEscapes($_) { -# -# Parameter: String. -# Returns: The string, with after processing the following backslash -# escape sequences. This is useful if you want to force a "dumb" -# quote or other character to appear. -# -# Escape Value -# ------ ----- -# \\ \ -# \" " -# \' ' -# \. . -# \- - -# \` ` -# - $_ = str_replace( - array('\\', '\"', "\'", '\.', '\-', '\`'), - array('\', '"', ''', '.', '-', '`'), $_); - - return $_; -} - - -# _TokenizeHTML is shared between PHP SmartyPants and PHP Markdown. -# We only define it if it is not already defined. -if (!function_exists('_TokenizeHTML')) : -function _TokenizeHTML($str) { -# -# Parameter: String containing HTML markup. -# Returns: An array of the tokens comprising the input -# string. Each token is either a tag (possibly with nested, -# tags contained therein, such as , or a -# run of text between tags. Each element of the array is a -# two-element array; the first is either 'tag' or 'text'; -# the second is the actual value. -# -# -# Regular expression derived from the _tokenize() subroutine in -# Brad Choate's MTRegex plugin. -# -# - $index = 0; - $tokens = array(); - - $match = '(?s:)|'. # comment - '(?s:<\?.*?\?>)|'. # processing instruction - # regular tags - '(?:<[/!$]?[-a-zA-Z0-9:]+\b(?>[^"\'>]+|"[^"]*"|\'[^\']*\')*>)'; - - $parts = preg_split("{($match)}", $str, -1, PREG_SPLIT_DELIM_CAPTURE); - - foreach ($parts as $part) { - if (++$index % 2 && $part != '') - $tokens[] = array('text', $part); - else - $tokens[] = array('tag', $part); - } - return $tokens; -} -endif; - - -/* - -PHP SmartyPants -=============== - -Description ------------ - -This is a PHP translation of the original SmartyPants quote educator written in -Perl by John Gruber. - -SmartyPants is a web publishing utility that translates plain ASCII -punctuation characters into "smart" typographic punctuation HTML -entities. SmartyPants can perform the following transformations: - -* Straight quotes (`"` and `'`) into "curly" quote HTML entities -* Backticks-style quotes (` ``like this'' `) into "curly" quote HTML - entities -* Dashes (`--` and `---`) into en- and em-dash entities -* Three consecutive dots (`...`) into an ellipsis entity - -SmartyPants does not modify characters within `
    `, ``, ``, 
    -` ';
    +			echo $res;
    +		}
    +		else if ($results == 1)
    +		{
    +			$id     = $result->fields['id'];
    +			$name   = $result->fields['first_name'].' '.$result->fields['last_name'];
    +			$val = $id.'|'.$name;
    +			$res = '
    +				 ';
    +			echo $res;
    +		}
    +		else
    +		{
    +			# create the search record
    +			include_once(PATH_CORE   . 'search.inc.php');
    +			$search = new CORE_search;
    +			$arr['module']     = $this->module;
    +			$arr['sql']        = $q_save;
    +			$arr['limit']      = '30';
    +			$arr['order_by']   = 'last_name';
    +			$arr['results']    = $results;
    +			$search->add($arr);
    +
    +			global $smarty;
    +			$smarty->assign('search_id', $search->id);
    +			$smarty->assign('page', '1');
    +			$smarty->assign('limit', $limit);
    +			$smarty->assign('order_by', $order_by);
    +			$smarty->assign('results', $results);
    +
    +			$res = '
    +				 ';
    +
    +			echo $res;
    +
    +		}
    +	}
    +
    +	###########################################
    +	### Top Accounts Graph
    +	###########################################
    +	#@todo appears to be redundant ?page=core:graphview
    +	private function top($VAR)
    +	{
    +		global $smarty, $C_translate, $C_auth;
    +
    +		# Get the period type, default to month
    +		if (empty($VAR['period']))
    +			$p = 'm';
    +		else
    +			$p = $VAR['period'];
    +
    +		# Load the jpgraph class
    +		include(PATH_GRAPH."jpgraph.php");
    +		include(PATH_GRAPH."jpgraph_bar.php");
    +
    +		# check the validation for this function
    +		if(!$C_auth->auth_method_by_name($this->module,'search'))  {
    +			$error = $C_translate->translate('module_non_auth','','');
    +			include(PATH_GRAPH."jpgraph_canvas.php");
    +			$graph = new CanvasGraph(460,55,"auto");
    +			$t1 = new Text($error);
    +			$t1->Pos(0.2,0.5);
    +			$t1->SetOrientation("h");
    +			$t1->SetBox("white","black",'gray');
    +			$t1->SetFont(FF_FONT1,FS_NORMAL);
    +			$t1->SetColor("black");
    +			$graph->AddText($t1);
    +			$graph->Stroke();
    +			exit;
    +		}
    +
    +		# Get the period start & end
    +		switch ($p)
    +		{
    +			# By Weeks
    +			case 'w':
    +				$interval       = "1";
    +				$width          = ".9";
    +				$title          = 'Top Accounts for Last Last Week';
    +				$dow            = date('w');
    +				$start_str      = mktime(0,0,0,date('m'),      date('d')-$dow,             date('y'));
    +				$end_str        = mktime(23,59,59,date('m'),   date('d'),                  date('y'));
    +			break;
    +
    +			# By Months
    +			case 'm':
    +				$interval       = "3";
    +				$width          = ".6";
    +				$title          = 'Top Accounts for Last Last Month';
    +				$start_str      = mktime(0,0,0,date('m'), 1,                                date('y'));
    +				$end_str        = mktime(23,59,59,date('m'),   date('d'),                   date('y'));
    +			break;
    +
    +			# By Years
    +			case 'y':
    +				$interval       = "1";
    +				$width          = ".8";
    +				$title          = 'Top Accounts for Last Last Year';
    +				$start_str      = mktime(0,0,0,1,1,                            date('y'));
    +				$end_str        = mktime(23,59,59,     date('m'),  date('d'),  date('y'));
    +			break;
    +		}
    +
    +
    +		##############################@@@@@@@@
    +		# Get accounts & sales for this period
    +		##############################@@@@@@@@
    +		$db         = &DB();
    +		$sql   = 'SELECT account_id,total_amt FROM ' . AGILE_DB_PREFIX . 'invoice WHERE
    +				   date_orig    >=  ' . $db->qstr( $start_str ) . ' AND  date_orig    <=  ' . $db->qstr( $end_str ) . ' AND
    +				   site_id      =  ' . $db->qstr(DEFAULT_SITE);
    +		$result = $db->Execute($sql);
    +		if(@$result->RecordCount() == 0) {
    +			$file = fopen( PATH_THEMES.'default_admin/images/invisible.gif', 'r');
    +			fpassthru($file);
    +			exit;
    +		}
    +
    +		while(!$result->EOF)
    +		{
    +			$amt  = $result->fields['total_amt'];
    +			$acct = $result->fields['account_id'];
    +			if(!isset( $arr[$acct] )) $arr[$acct] = 0;
    +			$arr[$acct] += $amt;
    +			$result->MoveNext();
    +		}
    +
    +		$i = 0;
    +		while(list($key, $var) = each(@$arr)) {
    +			# Get the user name
    +			$sql    = 'SELECT first_name,last_name FROM ' . AGILE_DB_PREFIX . 'account WHERE
    +						   id           =  ' . $db->qstr( $key ) . ' AND
    +						   site_id      =  ' . $db->qstr(DEFAULT_SITE);
    +			$rs     = $db->Execute($sql);
    +
    +			$_lbl[]   = strtoupper(substr($rs->fields['first_name'],0,1)) . ". " . $rs->fields['last_name'];
    +			$_datay[] = $var;
    +			$i++;
    +		}
    +
    +
    +		### Sort the arrays
    +		array_multisort($_datay,SORT_DESC, SORT_NUMERIC, $_lbl);
    +
    +		### Limit the results to 10 or less
    +		for($i=0; $i=9) $i = count($_lbl);
    +		}
    +
    +		$i = count($lbl);
    +
    +
    +		# Get the Currency
    +		$sql    = 'SELECT symbol FROM ' . AGILE_DB_PREFIX . 'currency WHERE
    +					id           =  ' . $db->qstr( DEFAULT_CURRENCY ) . ' AND
    +					site_id      =  ' . $db->qstr(DEFAULT_SITE);
    +		$rs     = $db->Execute($sql);
    +		$currency_iso = $rs->fields['symbol'];
    +
    +		// Size of graph
    +		$width=265;
    +		$height=75 + ($i*15);
    +
    +		// Set the basic parameters of the graph
    +		$graph = new Graph($width,$height,'auto');
    +		$graph->SetScale("textlin");
    +		$graph->yaxis->scale->SetGrace(50);
    +		$graph->SetMarginColor('#F9F9F9');
    +		$graph->SetFrame(true,'#CCCCCC',1);
    +		$graph->SetColor('#FFFFFF');
    +
    +		$top    = 45;
    +		$bottom = 10;
    +		$left   = 95;
    +		$right  = 15;
    +		$graph->Set90AndMargin($left,$right,$top,$bottom);
    +
    +		// Label align for X-axis
    +		$graph->xaxis->SetLabelAlign('right','center','right');
    +
    +		// Label align for Y-axis
    +		$graph->yaxis->SetLabelAlign('center','bottom');
    +		$graph->xaxis->SetTickLabels($lbl);
    +
    +		// Titles
    +		$graph->title->SetFont(FF_FONT1,FS_BOLD,9.5);
    +		$title = $C_translate->translate('graph_top','account_admin','');
    +		$graph->title->Set($title);
    +
    +		// Create a bar pot
    +		$bplot = new BarPlot($datay);
    +		$bplot->SetFillColor("#506DC7");
    +		$bplot->SetWidth(0.2);
    +
    +		// Show the values
    +		$bplot->value->Show();
    +		$bplot->value->SetFont(FF_FONT1,FS_NORMAL,8);
    +		$bplot->value->SetAlign('center','center');
    +		$bplot->value->SetColor("black","darkred");
    +		$bplot->value->SetFormat($currency_iso.'%.2f');
    +
    +		$graph->Add($bplot);
    +		$graph->Stroke();
    +
    +		return;
    +	}
    +
    +	/**
    +	 * Send an email to an account
    +	 *
    +	 * @uses CORE_email
    +	 */
    +	public function mail_one($VAR) {
    +		global $C_translate,$C_debug;
    +
    +		# Validate the required vars (account_id, message, subject)
    +		if (@$VAR['mail_account_id'] != '' && @$VAR['mail_subject'] != '' && @$VAR['mail_message'] != '') {
    +			# Verify the specified account
    +			$db = &DB();
    +			$account = $db->Execute(sqlSelect($db,'account','email,first_name,last_name',sprintf('id=%s',$VAR['mail_account_id'])));
    +
    +			if ($account->RecordCount() == 0) {
    +				# Error message
    +				$C_debug->alert($C_translate->translate('account_non_exist',$this->module,''));
    +
    +				return;
    +			}
    +
    +			# OK to send the email
    +			$db = &DB();
    +			$setup_email = $db->Execute(sqlSelect($db,'setup_email','*',sprintf('id=%s',$VAR['mail_email_id'])));
    +
    +			$E['priority'] = $VAR['mail_priority'];
    +			$E['html'] = '0';
    +			$E['subject'] = $VAR['mail_subject'];
    +			$E['body_text'] = $VAR['mail_message'];
    +			$E['to_email'] = $account->fields['email'];
    +			$E['to_name'] = sprintf('%s %s',$account->fields['first_name'],$account->fields['last_name']);
    +
    +			if ($setup_email->fields['type'] == 0) {
    +				$type = 0;
    +
    +			} else {
    +				$type = 1;
    +				$E['server'] = $setup_email->fields['server'];
    +				$E['account'] = $setup_email->fields['username'];
    +				$E['password'] = $setup_email->fields['password'];
    +			}
    +
    +			$E['from_name'] = $setup_email->fields['from_name'];
    +			$E['from_email'] = $setup_email->fields['from_email'];
    +
    +			if ($setup_email->fields['cc_list'] != '')
    +				$E['cc_list'] = explode(',',$setup_email->fields['cc_list']);
    +
    +			if ($setup_email->fields['bcc_list'] != '')
    +				$E['bcc_list'] = explode(',',$setup_email->fields['bcc_list']);
    +
    +			# Call the mail class
    +			require_once(PATH_CORE.'email.inc.php');
    +			$email = new CORE_email;
    +
    +			if ($type == 0)
    +				$email->PHP_Mail($E);
    +			else
    +				$email->SMTP_Mail($E);
    +
    +		} else {
     			global $C_vars;
    +
    +			# Error message
    +			$C_debug->alert($C_translate->translate('validate_any','',''));
     			$C_vars->strip_slashes_all();
     
     			return;
     		}
     
    -		# Get default invoice options
    -		$db=&DB();
    -		$invopt=$db->Execute(sqlSelect($db,"setup_invoice","*","")); 
    -		if($invopt && $invopt->RecordCount()) { 
    -			$invoice_delivery=$invopt->fields['invoice_delivery'];
    -			$invoice_format=$invopt->fields['invoice_show_itemized'];
    -		}			
    +		global $C_vars;
     
    -		/* hash the password */
    -		if(defined('PASSWORD_ENCODING_SHA'))  
    -			$password_encoded = sha1($password);
    -		else  
    -			$password_encoded = md5($password);
    +		# Success message
    +		$C_debug->alert($C_translate->translate('mail_sent',$this->module,''));
    +		$C_vars->strip_slashes_all();
    +	}
     
    -		####################################################################
    -		### Insert the account record
    -		#################################################################### 
    -		$this->account_id = $db->GenID(AGILE_DB_PREFIX . 'account_id');
    -		$validation_str = time();
    +	/**
    +	 * Send a mail to multiple recipients
    +	 * Send email to the receipients found from a search
    +	 *
    +	 * @uses CORE_email
    +	 * @uses CORE_search
    +	 */
    +	public function mail_multi($VAR) {
    +		global $C_translate, $C_debug;
     
    -		/** get parent id */ 
    -		$this->account_id;
    -		if(empty($this->parent_id)) $this->parent_id = $this->account_id;
    +		# Validate the required vars (account_id, message, subject)
    +		if (@$VAR['search_id'] != '' && @$VAR['mail_subject'] != '' && @$VAR['mail_message'] != '') {
     
    -		$sql = '
    -			INSERT INTO ' . AGILE_DB_PREFIX . 'account SET
    -			id              = ' . $db->qstr ( $this->account_id ) . ',
    -			site_id         = ' . $db->qstr ( DEFAULT_SITE ) . ',
    -			date_orig       = ' . $db->qstr ( $validation_str ) . ',
    -			date_last       = ' . $db->qstr ( time()) . ',
    -			language_id     = ' . $db->qstr ( $VAR["account_language_id"] ) . ',
    -			country_id      = ' . $db->qstr ( $VAR["account_country_id"] ) . ',
    -			parent_id    	= ' . $db->qstr ( $this->parent_id ) . ',
    -			affiliate_id    = ' . $db->qstr ( @$VAR["account_affiliate_id"] ) . ',
    -			campaign_id    	= ' . $db->qstr ( @$VAR["account_campaign_id"] ) . ',
    -			reseller_id     = ' . $db->qstr ( @$VAR["account_reseller_id"] ) . ',
    -			currency_id     = ' . $db->qstr ( $VAR["account_currency_id"] ) . ',
    -			theme_id        = ' . $db->qstr ( $VAR["account_theme_id"] ) . ',
    -			username        = ' . $db->qstr ( $VAR["account_username"] , get_magic_quotes_gpc()) . ',
    -			password        = ' . $db->qstr ( $password_encoded ) . ',
    -			status          = ' . $db->qstr ( $status ) . ',
    -			first_name      = ' . $db->qstr ( $VAR["account_first_name"] , get_magic_quotes_gpc()) . ',
    -			middle_name     = ' . $db->qstr ( $VAR["account_middle_name"], get_magic_quotes_gpc()) . ',
    -			last_name       = ' . $db->qstr ( $VAR["account_last_name"] , get_magic_quotes_gpc()) . ',
    -			company         = ' . $db->qstr ( $VAR["account_company"] , get_magic_quotes_gpc()) . ',
    -			title           = ' . $db->qstr ( $VAR["account_title"] , get_magic_quotes_gpc()) . ',
    -			email           = ' . $db->qstr ( $VAR["account_email"] , get_magic_quotes_gpc()) . ',
    -			address1		= ' . $db->qstr ( $VAR["account_address1"] , get_magic_quotes_gpc()) . ',
    -			address2		= ' . $db->qstr ( $VAR["account_address2"] , get_magic_quotes_gpc()) . ',
    -			city			= ' . $db->qstr ( $VAR["account_city"] , get_magic_quotes_gpc()) . ',
    -			state			= ' . $db->qstr ( $VAR["account_state"] , get_magic_quotes_gpc()) . ',
    -			zip				= ' . $db->qstr ( $VAR["account_zip"] , get_magic_quotes_gpc()) . ',
    -			email_type      = ' . $db->qstr ( $VAR["account_email_type"] , get_magic_quotes_gpc()). ',
    -			invoice_delivery= ' . $db->qstr ( @$invoice_delivery ) . ',
    -			invoice_show_itemized=' . $db->qstr ( @$invoice_format) . ',
    -			invoice_advance_gen	= ' . $db->qstr ( MAX_INV_GEN_PERIOD ) . ',
    -			invoice_grace	= ' . $db->qstr ( GRACE_PERIOD ) . ',
    -			tax_id			= ' . $db->qstr ( @$VAR['account_tax_id'] );
    -		$result = $db->Execute($sql);          
    +			# Get the search details
    +			if (isset($VAR['search_id'])) {
    +				include_once(PATH_CORE.'search.inc.php');
    +				$search = new CORE_search;
     
    -		####################################################################
    -		### error reporting:
    -		####################################################################
    +				$search->get($VAR['search_id']);
    +			} else {
    +				# Invalid search!
    +				# @todo Translate
    +				echo '
    The search terms submitted were invalid!'; - if ($result === false) - { - global $C_debug; - $C_debug->error('account.inc.php','add', $db->ErrorMsg()); - - if(isset($this->trigger["$type"])) { - include_once(PATH_CORE . 'trigger.inc.php'); - $trigger = new CORE_trigger; - $trigger->trigger($this->trigger["$type"], 0, $VAR); - } - return; - } - - /* password logging class */ - if($C_list->is_installed('account_password_history')) { - include_once(PATH_MODULES.'account_password_history/account_password_history.inc.php'); - $accountHistory = new account_password_history(); - $accountHistory->setNewPassword($this->account_id, $password_encoded); - } - - #################################################################### - ### Add the account to the default group: - #################################################################### - - $group_id = $db->GenID(AGILE_DB_PREFIX . 'account_group_id'); - $sql = ' - INSERT INTO ' . AGILE_DB_PREFIX . 'account_group SET - id = ' . $db->qstr ( $group_id ) . ', - site_id = ' . $db->qstr ( DEFAULT_SITE ) . ', - date_orig = ' . $db->qstr ( time() ) . ', - group_id = ' . $db->qstr ( DEFAULT_GROUP ) . ', - account_id = ' . $db->qstr ( $this->account_id ) . ', - active = ' . $db->qstr ('1'); - $db->Execute($sql); - - - #################################################################### - ### Insert the static vars: - #################################################################### - - $static_var->add($VAR, $this->module, $this->account_id); - - - #################################################################### - ### Mail the user the new_account email template - #################################################################### - - require_once(PATH_MODULES . 'email_template/email_template.inc.php'); - $my = new email_template; - if($status == "1") - { - $my->send('account_registration_active', $this->account_id, $this->account_id, '', ''); - } else { - $validation_str = strtoupper($validation_str. ':' .$this->account_id); - $my->send('account_registration_inactive', $this->account_id, '', '', $validation_str); - } - - - #################################################################### - ### Add the newsletters - #################################################################### - - if(NEWSLETTER_REGISTRATION == "1") - { - @$VAR['newsletter_html'] = $VAR['account_email_type']; - $VAR['newsletter_email'] = $VAR['account_email']; - $VAR['newsletter_first_name'] = $VAR['account_first_name']; - $VAR['newsletter_last_name'] = $VAR['account_last_name']; - require_once(PATH_MODULES . '/newsletter/newsletter.inc.php'); - $newsletter = new newsletter; - $newsletter->subscribe($VAR, $this); - } - - - #################################################################### - ### Log in the user & display the welcome message - #################################################################### - - if($status == "1") - { - if($this->parent_id == $this->account_id || empty($this->parent_id)) - { - $C_debug->alert($C_translate->translate("user_add_active_welcome","account","")); - if(SESSION_EXPIRE == 0) $exp = 99999; - else $exp = SESSION_EXPIRE; - $date_expire = (time() + (SESSION_EXPIRE * 60)); - - # update the session - $db = &DB(); - $q = "UPDATE " . AGILE_DB_PREFIX . "session - SET - ip= " . $db->qstr(USER_IP) .", - date_expire = " . $db->qstr($date_expire) . ", - logged = " . $db->qstr('1').", - account_id = " . $db->qstr($this->account_id) . " - WHERE - id = " . $db->qstr(SESS) . " - AND - site_id = " . $db->qstr(DEFAULT_SITE); - $result = $db->Execute($q); - - ### constants - define('FORCE_SESS_ACCOUNT', $this->account_id); - define('FORCE_SESS_LOGGED', 1); - - ### Reload the session auth cache - if(CACHE_SESSIONS == '1') { - $force = true; - $C_auth = new CORE_auth($force); - global $C_auth2; - $C_auth2 = $C_auth; - } - - if(isset($VAR['_page_next'])) - define('REDIRECT_PAGE', '?_page='.$VAR['_page_next']); - elseif(isset($VAR['_page'])) - define('REDIRECT_PAGE', '?_page='.$VAR['_page']); + return; } - #################################################################### - ### Do any db_mapping - #################################################################### - if($C_list->is_installed('db_mapping')) - { - include_once ( PATH_MODULES . 'db_mapping/db_mapping.inc.php' ); - $db_map = new db_mapping; - if(!empty($password)) - $db_map->plaintext_password = $password; + # Generate the full query + $field_list = sprintf('%saccount.email,%saccount.first_name,%saccount.last_name',AGILE_DB_PREFIX,AGILE_DB_PREFIX,AGILE_DB_PREFIX); + + $q = str_replace('%%fieldList%%',$field_list,$search->sql); + $q = str_replace('%%tableList%%',AGILE_DB_PREFIX.'account',$q); + $q = str_replace('%%whereList%%','',$q); + + $q .= sprintf('%saccount.site_id=%s',AGILE_DB_PREFIX,DEFAULT_SITE); + $db = &DB(); + $account = $db->Execute($q); + + # Check results + if ($account->RecordCount() == 0) { + $C_debug->alert($C_translate->translate('account_non_exist',$this->module,'')); + + return; + } + + # Get the selected email setup details + $db = &DB(); + $setup_email = $db->Execute(sqlSelect($db,'setup_email','*',sprintf('id=%s',$VAR['mail_email_id']))); + if ($setup_email->fields['type'] == 0) { + $type = 0; + + } else { + $type = 1; + + $E['server'] = $setup_email->fields['server']; + $E['account'] = $setup_email->fields['username']; + $E['password'] = $setup_email->fields['password']; + } + + $E['priority'] = $VAR['mail_priority']; + $E['html'] = '0'; + $E['subject'] = $VAR['mail_subject']; + $E['body_text'] = $VAR['mail_message']; + $E['from_name'] = $setup_email->fields['from_name']; + $E['from_email'] = $setup_email->fields['from_email']; + + # Loop to send each e-mail + while (! $account->EOF) { + $E['to_email'] = $account->fields['email']; + $E['to_name'] = sprintf('%s %s',$account->fields['first_name'],$account->fields['last_name']); + + # Call the mail class + require_once(PATH_CORE.'email.inc.php'); + $email = new CORE_email; + + if ($type == 0) + $email->PHP_Mail($E); else - $db_map->plaintext_password = false; - $db_map->account_add ( $this->account_id ); + $email->SMTP_Mail($E); - $db_map = new db_mapping; - $db_map->login ( $this->account_id ); - } - - #################################################################### - ### Affiliate Auto Creation - #################################################################### - if(AUTO_AFFILIATE == 1 && $C_list->is_installed("affiliate")) - { - $VAR['affiliate_account_id'] = $this->account_id; - $VAR['affiliate_template_id'] = DEFAULT_AFFILIATE_TEMPLATE; - - include_once(PATH_MODULES . 'affiliate/affiliate.inc.php'); - $affiliate = new affiliate; - $affiliate->add($VAR, $affiliate); - } - } else { - $C_debug->alert($C_translate->translate("user_add_inactive_welcome","account","")); - define('FORCE_PAGE', 'core:blank'); - } - } - - - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - - ### Check that user is logged in: - if(SESS_LOGGED != '1') { - echo "Sorry, you must be logged in!"; - return false; - } - - $this->account_construct(); - - /* check for sub account */ - if(!empty($VAR['id']) && $VAR['id'] != SESS_ACCOUNT) { - if($this->isParentAccount($VAR['id'])) { - $VAR['account_id'] = $VAR['id']; - global $smarty; - $smarty->assign('issubaccount', true); - } else { - return false; - } - } else { - $VAR['id'] = SESS_ACCOUNT; - $VAR['account_id'] = SESS_ACCOUNT; - } - - ### Retrieve the record: - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - - - ### Get the static vars: - global $smarty; - require_once(PATH_CORE . 'static_var.inc.php'); - $static_var = new CORE_static_var; - $arr = $static_var->update_form('account', 'update', SESS_ACCOUNT); - if(gettype($arr) == 'array') { - $smarty->assign('static_var', $arr); - } else { - $smarty->assign('static_var', false); - } - - /* get child accounts */ - if(empty($smarty->_tpl_vars['account'][0]['parent_id']) || $smarty->_tpl_vars['account'][0]['parent_id']==$smarty->_tpl_vars['account'][0]['id']) { - $db=&DB(); - $rs = $db->Execute(sqlSelect($db,"account","id,first_name,last_name,email,username","parent_id=". $db->qstr(SESS_ACCOUNT))); - if($rs && $rs->RecordCount()) { - while(!$rs->EOF) { - $smart[] = $rs->fields; - $rs->MoveNext(); - } - $smarty->assign('subaccount', $smart); + # Next record + $account->MoveNext(); } - } - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - global $VAR; - - ### Check that user is logged in: - if(SESS_LOGGED != '1') - echo "Sorry, you must be logged in!"; - - - /* check for sub account */ - $issubaccount=false; - if(!empty($VAR['account_id']) && $VAR['account_id'] != SESS_ACCOUNT) { - if($this->isParentAccount($VAR['account_id'])) { - $VAR['id'] = $VAR['account_id']; - global $smarty; - $issubaccount=true; - } else { - return false; - } } else { - $VAR['id'] = SESS_ACCOUNT; - $VAR['account_id'] = SESS_ACCOUNT; - } + global $C_vars; - $VAR['account_date_last']=time(); - - - // validate the tax_id - require_once(PATH_MODULES.'tax/tax.inc.php'); - $taxObj=new tax; - $tax_arr = @$VAR['account_tax_id']; - if(is_array($tax_arr)) { - foreach($tax_arr as $country_id => $tax_id) { - if ($country_id == $VAR['cid']) { - $exempt = @$VAR["account_tax_id_exempt"][$country_id]; - if(!$txRs=$taxObj->TaxIdsValidate($country_id, $tax_id, $exempt)) { - $this->validated = false; - global $C_translate; - $this->val_error[] = array( - 'field' => 'account_tax_id', - 'field_trans' => $taxObj->errField, - 'error' => $C_translate->translate('validate_general', "", "")); - } - if($exempt) - $VAR['account_tax_id']=false; - else - $VAR['account_tax_id']=$tax_id; - } - } - } - - #################################################################### - ### Get required static_Vars and validate them... return an array - ### w/ ALL errors... - #################################################################### - - require_once(PATH_CORE . 'static_var.inc.php'); - $static_var = new CORE_static_var; - if(!isset($this->val_error)) $this->val_error = false; - $all_error = $static_var->validate_form('account', $this->val_error); - - if($all_error != false && gettype($all_error) == 'array') - $this->validated = false; - else - $this->validated = true; - - - - #################################################################### - # If validation was failed, skip the db insert & - # set the errors & origonal fields as Smarty objects, - # and change the page to be loaded. - #################################################################### - - if(!$this->validated) - { - global $smarty; - - # set the errors as a Smarty Object - $smarty->assign('form_validation', $all_error); - - # set the page to be loaded - if(!defined("FORCE_PAGE")) - { - define('FORCE_PAGE', $VAR['_page_current']); - } + # Error message + $C_debug->alert($C_translate->translate('validate_any','','')); + $C_vars->strip_slashes_all(); return; } + global $C_vars; - ### Change password - $password_changed = false; - if(isset($VAR['account_password']) && $VAR['account_password'] != "") - { - if(isset($VAR['confirm_password']) && $VAR['account_password'] == $VAR['confirm_password']) - { - $password = $VAR['account_password']; - unset($VAR['account_password']); - @$VAR["account_password"] = $password; - ### Alert: the password has been changed! - global $C_debug, $C_translate; - $C_debug->alert($C_translate->translate('password_changed','account','')); - $password_changed=true; + # Success message + $C_debug->alert($C_translate->translate('mail_sent',$this->module,'')); + $C_vars->strip_slashes_all(); + } - /* check if new password is ok */ - global $C_list; - if($C_list->is_installed('account_password_history')) { - include_once(PATH_MODULES.'account_password_history/account_password_history.inc.php'); - $accountHistory = new account_password_history(); - if(!$accountHistory->getIsPasswordOk(SESS_ACCOUNT, $VAR['account_password'], false)) { - $C_debug->alert("The password you have selected has been used recently and cannot be used again at this time for security purposes."); - unset($VAR["account_password"]); - $password_changed=false; - } - } + /** + * Send Password Reminder + * + * @uses email_template + */ + public function send_password_email($VAR) { + global $C_translate,$C_debug; + + require_once(PATH_MODULES.'email_template/email_template.inc.php'); + $my = new email_template; + + $my->send('password_change_instructions',@$VAR['id'],'','',''); + echo $C_translate->translate('password_change_instructions',$this->module,''); + } + + /** + * Send users verification email + * + * @uses email_template + */ + public function send_verify_email($VAR) { + global $C_translate,$C_debug; + + require_once(PATH_MODULES.'email_template/email_template.inc.php'); + $my = new email_template; + + $db = &DB(); + $result = $db->Execute(sqlSelect($db,'account','date_orig',sprintf('id=%s',$VAR['id']))); + + $my->send('account_registration_inactive',$VAR['id'],$VAR['id'],'',$this->validation_str($VAR['id'])); + echo $C_translate->translate('account_verify_instructions',$this->module,''); + } + + /** + * Add new accounts + * + * @uses CORE_validate + * @uses email_template + * @uses affiliate + */ + public function add($VAR) { + global $C_list,$C_translate,$C_debug,$smarty; + + if (! empty($VAR['account_date_expire'])) { + include_once(PATH_CORE.'validate.inc.php'); + $val = new CORE_validate($VAR); + + $VAR['account_date_expire'] = $val->convert_date($VAR['account_date_expire']); + } else { + $VAR['account_date_expire'] = 0; + } + + # If the username is blank, auto generate one + if (empty($VAR['account_username'])) { + $VAR['account_username'] = ''; + $length = 4; + srand((double)microtime()*1000000); + $vowels = array('a','e','i','o','u'); + $cons = array('b','c','d','g','h','j','k','l','m','n','p','r','s','t','u','v','w','tr','cr','br','fr','th','dr','ch','ph','wr','st','sp','sw','pr','sl','cl'); + + $num_vowels = count($vowels); + $num_cons = count($cons); + for ($i=0; $i<$length; $i++) + $VAR['account_username'] .= $cons[rand(0,$num_cons-1)].$vowels[rand(0,$num_vowels-1)]; + } + + # If the password is blank, auto generate one + if (empty($VAR['account_password'])) { + $passwd = '********'; + + srand((double)microtime() * 1000000); + $UniqID = md5(uniqid(rand())); + $VAR['account_password'] = substr(md5(uniqid(rand())),0,10); + + } else { + $passwd = $VAR['account_password']; + } + + # Add the record + if (! $this->account_id = parent::add($VAR)) + return; + + # Add the account to the groups + $this->add_account_groups($VAR['groups'],$this->account_id,$VAR['account_date_expire']); + + # Mail the new user + if (! empty($VAR['welcome_email'])) { + require_once(PATH_MODULES.'email_template/email_template.inc.php'); + $my = new email_template; + + if ($VAR['account_status'] == '1') + $my->send('account_add_staff_active',$this->account_id,'','',$passwd); - } else - { - ### ERROR: The passwords provided do not match! - global $C_debug, $C_translate; - $C_debug->alert($C_translate->translate('password_change_match','account','')); - unset($VAR["account_password"]); - } + $my->send('account_add_staff_inactive',$this->account_id,$this->account_id,'',$this->validation_str($this->account_id)); } + + # Display the welcome message + if ($VAR['account_status'] == '1') + $C_debug->alert($C_translate->translate('staff_add_active',$this->module,'')); else - { - unset($VAR["account_password"]); + $C_debug->alert($C_translate->translate('staff_add_inactive',$this->module,'')); + + # Affiliate Auto Creation + if (AUTO_AFFILIATE == 1 && $C_list->is_installed('affiliate')) { + $VAR['affiliate_account_id'] = $this->account_id; + $VAR['affiliate_template_id'] = DEFAULT_AFFILIATE_TEMPLATE; + $VAR['affiliate_parent_affiliate_id'] = $VAR['account_affiliate_id']; + + include_once(PATH_MODULES.'affiliate/affiliate.inc.php'); + $affiliate = new affiliate; + + $affiliate->add($VAR,$affiliate); } - - ### Change theme - if(isset($VAR['tid']) && $VAR['tid'] != "") - @$VAR["account_theme_id"] = $VAR['tid']; - - - ### Change Language - if(isset($VAR['lid']) && $VAR['lid'] != "") - @$VAR["account_language_id"] = $VAR['lid']; - - - ### Change country - if(isset($VAR['cid']) && $VAR['cid'] != "") - @$VAR["account_country_id"] = $VAR['cid']; - - - ### Change currency - if(isset($VAR['cyid']) && $VAR['cyid'] != "") - @$VAR["account_currency_id"] = $VAR['cyid']; - - ### Get the old username ( for db mapping ) - $db = &DB(); - $sql = 'SELECT username FROM ' . AGILE_DB_PREFIX . 'account WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - id = ' . $db->qstr(SESS_ACCOUNT); - $result = $db->Execute($sql); - if($result->RecordCount() > 0) - { - $old_username = $result->fields['username']; - } - - ### Update the record - $this->account_construct(); - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - - - /* password logging class */ - if($password_changed && is_object($accountHistory)) $accountHistory->setNewPassword(SESS_ACCOUNT, $VAR['account_password'], false); - - - - ### Update the static vars: - $static_var->update($VAR, 'account', SESS_ACCOUNT); - - ### Do any db_mapping - global $C_list; - if($C_list->is_installed('db_mapping')) - { - include_once ( PATH_MODULES . 'db_mapping/db_mapping.inc.php' ); - $db_map = new db_mapping; - if(!empty($password)) - $db_map->plaintext_password = $password; - else - $db_map->plaintext_password = false; - $db_map->account_edit ( SESS_ACCOUNT, $old_username ); - } - - /* update groups for subaccount */ - if($issubaccount) { - $db=&DB(); - $db->Execute(sqlDelete($db,"account_group","group_id>2 and - (service_id is null or service_id=0 or service_id='') - and account_id=".$db->qstr($VAR['account_id']))); - if(!empty($VAR['groups'])) - { - global $C_auth; - foreach($VAR['groups'] as $gid=>$val) { - if($gid==$val && $C_auth->auth_group_by_id($gid)) { - $fields=Array('account_id'=>$VAR['account_id'], 'group_id'=>$gid, 'active'=>1, 'date_orig'=>time() ); - $db->Execute(sqlInsert($db,"account_group",$fields)); - } - } - } - } + return; } - - - ############################## - ## PASSWORD ## - ############################## - - function password($VAR) - { - ### Set the max time between password requests: - $LIMIT_SECONDS = 120; - - global $C_translate, $C_debug; - - ### Is the username & email both set? - if(!isset($VAR["account_email"]) && !isset($VAR["account_username"]) ) - { - #### ERROR: You must enter either your username or e-mail address! - $C_debug->alert($C_translate->translate('password_reset_req','account','')); - return; - } - else if($VAR["account_email"] == "" && $VAR["account_username"] == "") - { - #### ERROR: You must enter either your username or e-mail address! - $C_debug->alert($C_translate->translate('password_reset_req','account','')); - return; - } + /** + * View an Account + */ + public function view($VAR) { + global $C_auth; $db = &DB(); - if(isset($VAR["account_email"]) && $VAR["account_email"] != "") - { - $sql = ' email = '. $db->qstr($VAR["account_email"], get_magic_quotes_gpc()); - } - else if(isset($VAR["account_username"]) && $VAR["account_username"] != "") - { - $sql = ' username = '. $db->qstr($VAR["account_username"], get_magic_quotes_gpc()); - } + # Get our results + $smart = parent::view($VAR); + if ($smart) { + # Get any authorized groups + $view = $db->Execute(sqlSelect($db,'account_group','service_id,group_id',array('account_id'=>$VAR['id'],'active'=>1),'group_id')); - $q = 'SELECT id,email,first_name,last_name FROM ' . AGILE_DB_PREFIX . 'account - WHERE '. $sql . ' AND - site_id = ' . $db->qstr(DEFAULT_SITE); - $result = $db->Execute($q); + while (! $view->EOF) { + $smart['groups'] = array(); + + if ($view->fields['service_id'] == '') + array_push($smart['groups'],$view->fields['group_id']); + + $view->MoveNext(); + } + + # Verify the user has access to view this account + if (SESS_ACCOUNT != $VAR['id']) { + $smart['own_account'] = false; + + $display_this = true; + for ($ix=0; $ixauth_group_by_id($group[$ix])) + $display_this = false; + + } else { + $display_this = true; + $smart['own_account'] = true; + } + + # define the results + if (! $display_this) { + unset($smart); + echo 'You have selected an account for which you are not authorized, your permission settings are to low!

    '; + + continue; + } + + # Get the last activity date/IP + $view = $db->SelectLimit(sqlSelect($db,'login_log','*',array('account_id'=>$VAR['id']),'date_orig DESC'),1); + + if ($view && $view->RecordCount() == 1) { + $smart['last_activity'] = $view->fields['date_orig']; + $smart['last_ip'] = $view->fields['ip']; + } else { + $smart['last_activity'] = ''; + $smart['last_ip'] = ''; + } + + # Get invoice details for this account + $view = $db->SelectLimit(sqlSelect($db,'invoice','id,date_orig,total_amt,billed_amt,process_status',array('account_id'=>$VAR['id']),'id DESC'),10); + if ($view && $view->RecordCount() > 0) { + $smart['invoice'] = array(); + + while (! $view->EOF) { + if ($view->fields['total_amt'] > $view->fields['billed_amt'] && $view->fields['suspend_billing'] != 1) + $view->fields['due'] = $view->fields['total_amt']-$view->fields['billed_amt']; + + array_push($smart['invoice'],$view->fields); + $view->MoveNext(); + } + } + + # Get service details for this account + $view = $db->SelectLimit(sqlSelect($db,'service','id,sku,price,active,type,domain_name,domain_tld',array('account_id'=>$VAR['id']),'id DESC'),10); + if ($view && $view->RecordCount() > 0) { + $smart['service'] = array(); + + while (! $view->EOF) { + array_push($smart['service'],$view->fields); + $view->MoveNext(); + } + } + + # Get invoices to be generated for this account + include_once(PATH_MODULES.'invoice/invoice.inc.php'); + $invoice = new invoice; + + $view = $db->Execute($invoice->sql_invoice_soon(null,null,$VAR['id'])); + if ($view && $view->RecordCount() > 0) { + $smart['duesoon'] = array(); + + while (! $view->EOF) { + array_push($smart['duesoon'],$view->fields); + $view->MoveNext(); + } + } + + # No results + } else { + global $C_debug; + $C_debug->error(__FILE__,__METHOD__,'The selected record does not exist any longer, or your account is not authorized to view it'); - if($result->RecordCount() == 0) - { - ### ERROR: No matches found! - $C_debug->alert($C_translate->translate('password_reset_no_match','account','')); return; } - $account = $result->fields["id"]; - - ################################################################### - ### Check that this email has not been requested already - ### In the last 60 seconds - - $db = &DB(); - $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'temporary_data WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - field1 = ' . $db->qstr($account); - $result = $db->Execute($sql); - if($result->RecordCount() > 0) - { - $limit = $result->fields['date_orig'] + $LIMIT_SECONDS; - - if($limit > time()) - { - $error1 = $C_translate->translate("password_reset_spam_limit","account",""); - $error = ereg_replace('%limit%', "$LIMIT_SECONDS", $error1); - $C_debug->alert( $error ); - return; - } - else - { - ### Delete the old request - $sql = 'DELETE FROM ' . AGILE_DB_PREFIX . 'temporary_data WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - field1 = ' . $db->qstr($account); - $db->Execute($sql); - } - - } - - - ################################################################### - ### Ok to continue: - - $now = md5(microtime()); - $expire = time() + (15*60); // expires in 15 minutes - - - ##################################################### - ### Create the temporary DB Record: - - $db = &DB(); - $id = $db->GenID(AGILE_DB_PREFIX . "" . 'temporary_data_id'); - $sql = 'INSERT INTO ' . AGILE_DB_PREFIX . 'temporary_data SET - site_id = ' . $db->qstr(DEFAULT_SITE) . ', - id = ' . $db->qstr($id) . ', - date_orig = ' . $db->qstr(time()) . ', - date_expire = ' . $db->qstr($expire) . ', - field1 = ' . $db->qstr($account) . ', - field2 = ' . $db->qstr($now); - $result = $db->Execute($sql); - - - ##################################################### - ### Send the password reset email template: - - require_once(PATH_MODULES . 'email_template/email_template.inc.php'); - $my = new email_template; - $my->send('account_reset_password', $account, '', '', $now); - - ### ALERT: we have sent an email to you.... - $C_debug->alert($C_translate->translate('password_reset_sent','account','')); + global $smarty; + $smarty->assign('record',$smart); } + /** + * Update an account + */ + public function update($VAR) { + if (isset($VAR['process_account_password']) && $VAR['process_account_password']) + $VAR['account_password'] = $VAR['process_account_password']; + $ok = parent::update($VAR); - - ############################## - ## PASSWORD RESET ## - ############################## - - function password_reset($VAR) - { - global $C_translate, $C_debug, $smarty; - - ### Validate that the password is set... && confirm password is set... - if(!isset($VAR['account_password']) || !isset($VAR['confirm_password'])) - { - ### ERROR: - $message = $C_translate->translate('password_reset_reqq','account',''); - $C_debug->alert($message); - return; - } - else if ($VAR['account_password'] == "") - { - ### ERROR: - $message = $C_translate->translate('password_reset_reqq','account',''); - $C_debug->alert($message); - return; - } - else if ($VAR['account_password'] != $VAR['confirm_password']) - { - ### ERROR: - $message = $C_translate->translate('password_change_match','account',''); - $C_debug->alert($message); - return; - } - else - { - $plaintext_password = $VAR['account_password']; - - /* hash the password */ - if(defined('PASSWORD_ENCODING_SHA')) - $password = sha1($VAR['account_password']); - else - $password = md5($VAR['account_password']); - } - - - if(!isset($VAR['validate']) || $VAR['validate'] == "") - { - ### ERROR: bad link.... - $url = '
    ' . $C_translate->translate('submit','CORE','') . ''; - $message = $C_translate->translate('password_reset_bad_url','account',''); - $C_debug->alert($message . '' . $url); - return; - } - - - ### Get the temporary record from the database - $validate = @$VAR['validate']; - $db = &DB(); - $sql = 'SELECT field1,field2 FROM ' . AGILE_DB_PREFIX . 'temporary_data WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - date_expire >= '. $db->qstr(time()) . ' AND - field2 = ' . $db->qstr($validate); - $result = $db->Execute($sql); - - if($result->RecordCount() == 0) - { - ### ERROR: no match for submitted link, invalid or expired. - $url = '
    ' . $C_translate->translate('submit','CORE','') . ''; - $message = $C_translate->translate('password_reset_bad_url','account',''); - $C_debug->alert($message . '' . $url); - return; - } - - $account_id = $result->fields['field1']; - - /* check if new password is ok */ - global $C_list; - if($C_list->is_installed('account_password_history')) { - include_once(PATH_MODULES.'account_password_history/account_password_history.inc.php'); - $accountHistory = new account_password_history(); - if(!$accountHistory->getIsPasswordOk($account_id, $password)) { - $C_debug->alert("The password you have selected has been used recently and cannot be used again at this time for security purposes."); - return; + if ($ok) { + # Remove login lock + if ($VAR['account_status']) { + $db = &DB(); + $delrs = $db->Execute(sqlDelete($db,'login_lock',sprintf('account_id=%s',$VAR['account_id']))); + $delrs = $db->Execute(sqlDelete($db,'login_log',sprintf('account_id=%s AND status=0',$VAR['account_id']))); } + + return true; } - - - ############################################################### - ### Delete the temporary record - $sql = 'DELETE FROM ' . AGILE_DB_PREFIX . 'temporary_data WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - field2 = ' . $db->qstr($validate); - $db->Execute($sql); - - - ############################################################### - ### Update the password record: - $db = &DB(); - $sql = 'UPDATE ' . AGILE_DB_PREFIX . 'account - SET - date_last = ' . $db->qstr(time()) . ', - password = ' . $db->qstr($password) . ' - WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - id = ' . $db->qstr($account_id); - $db->Execute($sql); - - /* password logging class */ - if(!empty($accountHistory) && is_object($accountHistory)) $accountHistory->setNewPassword($account_id, $password); - - - #################################################################### - ### Get the old username ( for db mapping ) - - $db = &DB(); - $sql = 'SELECT username FROM ' . AGILE_DB_PREFIX . 'account WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - id = ' . $db->qstr($account_id); - $result = $db->Execute($sql); - if($result->RecordCount() > 0) - { - $old_username = $result->fields['username']; - } - - #################################################################### - ### Do any db_mapping - #################################################################### - global $C_list; - if($C_list->is_installed('db_mapping')) - { - include_once ( PATH_MODULES . 'db_mapping/db_mapping.inc.php' ); - $db_map = new db_mapping; - $db_map->plaintext_password = $plaintext_password; - $db_map->account_edit ( $account_id, $old_username ); - } - - - ### Return the success message: - $C_debug->alert($C_translate->translate('password_update_success','account','')); - $smarty->assign('pw_changed', true); - } - - - - ############################## - ## VERIFY ACCOUNT ## - ############################## - - function verify($VAR) - { - global $C_debug, $C_translate, $smarty; - - ### Validate $verify is set... - if(!isset($VAR['verify']) || $VAR['verify'] == "") - { - ### Error: please use the form below ... - $smarty->assign('verify_results', false); - return; - } - - @$verify = explode(':', $VAR['verify']); - - ### Validate the $verify string.... - $db = &DB(); - $sql = 'SELECT id,username,status FROM ' . AGILE_DB_PREFIX . 'account WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - id = ' . $db->qstr(@$verify[1]) . ' AND - date_orig = ' . $db->qstr(@$verify[0]); - $result = $db->Execute($sql); - if($result->RecordCount() == 0) - { - ### Error: please use the form below ... - $smarty->assign('verify_results', false); - return; - } - - - ### Check the status: - $status = $result->fields['status']; - $username = $result->fields['username']; - if($status == "1") - { - ### Account already active! - $smarty->assign('verify_results', true); - return; - } - - ### Update the account status - $sql = 'UPDATE ' . AGILE_DB_PREFIX . 'account SET - status = ' . $db->qstr("1") . ' - WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - id = ' . $db->qstr(@$verify[1]); - $result = $db->Execute($sql); - - - ### Account now active! - $smarty->assign('verify_results', true); - - - ### Return the success message: - $C_debug->alert($C_translate->translate('password_update_success','account','')); - - - #################################################################### - ### Do any db_mapping - #################################################################### - global $C_list; - /* - if($C_list->is_installed('db_mapping')) - { - include_once ( PATH_MODULES . 'db_mapping/db_mapping.inc.php' ); - $db_map = new db_mapping; - $db_map->account_edit ( $VAR['verify'], $username ); - } - */ - if($C_list->is_installed('db_mapping') ) - { - include_once ( PATH_MODULES . 'db_mapping/db_mapping.inc.php' ); - $db_map = new db_mapping; - $db_map->plaintext_password = false; - $db_map->account_add ( $verify[1] ); - } } - - - - ############################## - ## VERIFY ACCOUNT ## - ############################## - - function verify_resend($VAR) - { - global $C_translate, $C_debug; - - ### Is the username & email both set? - if(!isset($VAR["account_email"]) && !isset($VAR["account_username"]) ) - { - #### ERROR: You must enter either your username or e-mail address! - $C_debug->alert($C_translate->translate('verify_resend_req','account','')); - return; - } - else if($VAR["account_email"] == "" && $VAR["account_username"] == "") - { - #### ERROR: You must enter either your username or e-mail address! - $C_debug->alert($C_translate->translate('verify_resend_req','account','')); - return; - } + /** + * Merge two accounts together + * + * @uses CORE_auth + */ + public function merge($VAR) { + global $C_auth,$C_list,$C_translate,$C_debug; $db = &DB(); - if(isset($VAR["account_email"]) && $VAR["account_email"] != "") - { - $sql = ' email = '. $db->qstr($VAR["account_email"], get_magic_quotes_gpc()); - } - else if(isset($VAR["account_username"]) && $VAR["account_username"] != "") - { - $sql = ' username = '. $db->qstr($VAR["account_username"], get_magic_quotes_gpc()); + if (empty($VAR['id']) || empty($VAR['merge_acct_id'])) { + $C_debug->alert($C_translate->translate('merge_err',$this->module,'')); + + return false; } + $acct_id = $VAR['id']; + $merge_acct_id = $VAR['merge_acct_id']; - $q = 'SELECT id,date_orig,status,email,first_name,last_name FROM ' . AGILE_DB_PREFIX . 'account - WHERE '. $sql . ' AND - site_id = ' . $db->qstr(DEFAULT_SITE); - $result = $db->Execute($q); + # Get merged account_group + $rs = $db->Execute(sqlSelect($db,'account_group','*',sprintf("(service_id = '' OR service_id = 0 OR service_id IS NULL) AND account_id=%s",$acct_id))); + if ($rs === false) { + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); - if($result->RecordCount() == 0) - { - ### ERROR: No matches found! - $C_debug->alert($C_translate->translate('password_reset_no_match','account','')); - return; - } - $account = $result->fields["id"]; - $status = $result->fields["status"]; - $validation_str = strtoupper($result->fields['date_orig']. ':' . $result->fields['id']); + } else { + while (! $rs->EOF) { + $Cauth = new CORE_auth(true); - if($status == "1") - { - ### ERROR: This account is already active! - $C_debug->alert($C_translate->translate('verify_resend_active','account','')); - return; + if ($Cauth->auth_group_by_account_id($merge_acct_id,$rs->fields['group_id'])) + # Duplicate group, delete + $db->Execute(sqlDelete($db,'account_group',sprintf('id=%s',$rs->fields['id']))); + + $rs->MoveNext(); + } } - ### Resend the pending email: - require_once(PATH_MODULES . 'email_template/email_template.inc.php'); - $my = new email_template; - $my->send('account_registration_inactive', $account, $account, '', $validation_str); + # Default table + $merge = array( + 'account_group'=>'account_id', + 'account_billing'=>'account_id', + 'cart'=>'account_id', + 'charge'=>'account_id', + 'discount'=>'avail_account_id', + 'invoice'=>'account_id', + 'log_error'=>'account_id', + 'login_lock'=>'account_id', + 'login_log'=>'account_id', + 'search'=>'account_id', + 'service'=>'account_id', + 'session'=>'account_id', + 'staff'=>'account_id' + ); - ### Notice that the email is sent: - $C_debug->alert($C_translate->translate("user_add_inactive_welcome","account","")); + # Affiliate + if ($C_list->is_installed('affiliate')) + $merge['affiliate'] = 'account_id'; + foreach ($merge as $table => $field) { + $rs = $db->Execute(sqlUpdate($db,$table,array($field=>$acct_id),sprintf('%s=%s',$field,$merge_acct_id))); + + if ($rs === false) + $C_debug->error(__FILE__,sprintf('%s::%s',__METHOD__,$table),$db->ErrorMsg()); + } + + # Delete account + $rs = $db->Execute(sqlDelete($db,'account',sprintf('id=%s',$merge_acct_id))); + if ($rs === false) + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); + + $C_debug->alert($C_translate->translate('merge_ok',$this->module,'')); + + return; } + /** + * Delete an account + * + * @uses invoice + */ + public function delete($VAR) { + global $C_list; - ############################## - ## STATIC VARS ## - ############################## + $db = &DB(); - function static_var($VAR) - { - global $smarty; - require_once(PATH_CORE . 'static_var.inc.php'); - $static_var = new CORE_static_var; + # Generate the list of ID's + $id_list = ''; + $account_id_list = ''; + $discount_id_list = ''; + if (isset($VAR['delete_id'])) + $ids = explode(',',preg_replace('/,$/','',$VAR['delete_id'])); + elseif (isset($VAR['id'])) + $ids = explode(',',preg_replace('/,$/','',$VAR['id'])); - if(ereg('search', $VAR['_page'])) - $arr = $static_var->generate_form('account', 'add', 'search'); - else - $arr = $static_var->generate_form('account', 'add', 'update'); + # Verify this is not the admin account or the current user's account + if (($i = array_search(SESS_ACCOUNT,$ids)) || ($i = array_search(1,$ids))) + unset($ids[$i]); - if(gettype($arr) == 'array') - { - ### Set everything as a smarty array, and return: - $smarty->assign('show_static_var', true); - $smarty->assign('static_var', $arr); - return true; + $this->associated_DELETE = array(); + array_push($this->associated_DELETE,array('table'=>'session','field'=>'account_id')); + array_push($this->associated_DELETE,array('table'=>'account_billing','field'=>'account_id')); + array_push($this->associated_DELETE,array('table'=>'account_group','field'=>'account_id')); + array_push($this->associated_DELETE,array('table'=>'cart','field'=>'account_id')); + array_push($this->associated_DELETE,array('table'=>'search','field'=>'account_id')); + array_push($this->associated_DELETE,array('table'=>'staff','field'=>'account_id')); + array_push($this->associated_DELETE,array('table'=>'discount','field'=>'account_id')); + if ($C_list->is_installed('affiliate')) + array_push($this->associated_DELETE,array('table'=>'affiliate','field'=>'account_id')); + + $result = parent::delete($VAR); + + if ($result) { + # Generate the full query (invoice) + $invoice = $db->Execute(sqlSelect($db,'invoice','id',array('account_id'=>$ids))); + if ($invoice && $invoice->RecordCount() > 0 ) { + while (! $invoice->EOF) { + include_once(PATH_MODULES.'invoice/invoice.inc.php'); + $inv = new invoice; + + $arr['id'] = $invoice->fields['id']; + $inv->delete($arr,$inv); + + $invoice->MoveNext(); + } + } + + # Error reporting + if ($result === false) { + global $C_debug; + $C_debug->error('account_admin.inc.php','delete', $db->ErrorMsg()); + + } else { + # Alert delete message + global $C_debug, $C_translate; + $C_translate->value['CORE']['module_name'] = $C_translate->translate('name',$this->table,''); + $message = $C_translate->translate('alert_delete_ids','CORE',''); + $C_debug->alert($message); + } } - else - { - ### Or if no results: - $smarty->assign('show_static_var', false); + } + + /** + * Update account groups + * + * This method is a trigger, called when an account is added from account() + * + * @uses CORE_validate + */ + public function update_account_groups($VAR) { + global $C_auth; + + $db = &DB(); + @$account = $VAR['account_id']; + + # If there are no groups to modify, just return + if (! is_array($VAR['groups']) || ! count($VAR['groups'])) return false; + + $groups = $VAR['groups']; + + # Admin accounts groups cannot be altered user cannot modify their own groups + if ($account == '1' || SESS_ACCOUNT == $account) + return false; + + # Drop the current groups for this account + $result = $db->Execute(sqlDelete($db,'account_group',sprintf('service_id IS NULL AND account_id=%s',$account))); + + # Verify the admin adding this account is authorized for this group themselves, otherwise skip + foreach ($groups as $i => $group) + if (! $C_auth->auth_group_by_id($groups[$i])) + unset($groups[$i]); + + if (! count($group)) + return false; + + # Determine the expiration + if (! empty($VAR['account_date_expire'])) { + include_once(PATH_CORE.'validate.inc.php'); + $validate = new CORE_validate; + + $expire = $validate->convert_date($VAR['account_date_expire'],DEFAULT_DATE_FORMAT); + } else { + $expire = 0; + } + + $this->add_account_groups($groups,$account,$expire); + + # Remove the user's session_auth_cache so it is regenerated on user's next pageview + $rss = $db->Execute(sqlSelect($db,'session','id',array('account_id'=>$account))); + + while (! $rss->EOF) { + $db->Execute(sqlDelete($db,'session_auth_cache',sprintf('session_id=::%s::',$rss->fields['id']))); + $rss->MoveNext(); } } } -?> \ No newline at end of file +?> diff --git a/modules/account/account_construct.xml b/modules/account/account_construct.xml index bd59606a..8898a760 100644 --- a/modules/account/account_construct.xml +++ b/modules/account/account_construct.xml @@ -1,193 +1,309 @@ - - account - -
    account
    - - - - 0 - - last_name - - 30 - - - - I8 - 1 - - - I4 - - - I8 - - - I8 - date-now - - - I8 - date - - - I4 - - - C(32) - - - I4 - - - C(32) - - - I4 - - - I4 - - - I4 - - - C(32) - - - C(128) - 4 - 12 - any - 1 - 1 - - - C(128) - 6 - 12 - password - md5 - - - L - - - C2(128) - - - I4 - - - C(128) - 1 - 128 - any - 1 - - - C(128) - - - C(128) - 1 - 128 - any - 1 - - - <type>C(128)</type> - - - C(255) - 4 - 128 - email - 1 - 1 - - - C(255) - - - C(128) - 3 - 128 - any - - - C(128) - 128 - - - C(32) - 2 - 32 - any - - - C(32) - 2 - 32 - any - - - C(16) - 4 - 16 - any - - - L - - - I4 - - - L - 1 - - - I4 - - - I4 - - - C(64) - - - I4 - - - - - username,password - first_name,middle_name,last_name - company - email - affiliate_id - campaign_id - country_id - city,state - city - state - zip - id,site_id - first_name,last_name,email,company - - - - id,date_orig,date_last,language_id,country_id,affiliate_id,reseller_id,currency_id,theme_id,username,password,status,first_name,middle_name,last_name,title,email,company,address1,address2,city,state,zip,tax_id - id,date_orig,date_last,language_id,country_id,affiliate_id,reseller_id,currency_id,theme_id,username,password,status,first_name,middle_name,last_name,title,email,company,address1,address2,city,state,zip,email_type,tax_id - id,parent_id,date_last,language_id,country_id,affiliate_id,reseller_id,currency_id,theme_id,username,password,status,first_name,middle_name,last_name,title,email,company,address1,address2,city,state,zip,email_type,tax_id,max_child - - - - - account_admin:add_account_groups - - + + account + + account
    + + + + 0 + + last_name + + 25 + + 1 + + + + username,password + first_name,middle_name,last_name + company + email + affiliate_id + campaign_id + country_id + city,state + city + state + zip + id,site_id + first_name,last_name,email,company + + + + + + + 1 + I8 + 1 + + + + 1 + I4 + + + + date-now + Date Created + I8 + + + + date-now + Date Updated + I8 + + + I8 + date + Date Expire + + + I4 + Parent Account + + + C(32) + Language + + + I4 + Country + + + I4 + + + I4 + + + I4 + + + I4 + Currency + + + C(32) + Theme + + + C(128) + 4 + 128 + any + 1 + 1 + User Name + + + C(128) + 6 + 128 + password + md5 + Password + + + L + + + + C2(128) + + + + Active + I4 + + + C(128) + 1 + 128 + any + 1 + First Name + + + C(128) + Middle Name + + + C(128) + 1 + 128 + any + 1 + Last Name + + + <type>C(128)</type> + <display>Title</display> + + + C(255) + 4 + 128 + email + 1 + 1 + Email + + + C(255) + Company + + + C(128) + 3 + 128 + any + Address + + + C(128) + 128 + Address + + + C(32) + 2 + 32 + any + City + + + C(32) + 2 + 32 + any + State + + + C(16) + 4 + 16 + any + Postal Code + + + L + HTML Email + + + I4 + Invoice Delivery + + + L + 1 + Show Itemised Invoice + + + I4 + Invoice Grace Period + + + I4 + Invoice Advance Generation + + + C(64) + Tax ID + + + I4 + Max Children + + + + I4 + Net Terms + + + + + + date_orig,date_last,language_id,country_id,affiliate_id,reseller_id,campaign_id,currency_id,theme_id,username,password,status,first_name,middle_name,last_name,title,email,company,address1,address2,city,state,zip,email_type,tax_id,invoice_delivery,invoice_show_itemized,invoice_grace + id,date_orig,date_last,language_id,country_id,affiliate_id,reseller_id,currency_id,theme_id,username,password,status,first_name,middle_name,last_name,title,email,company,address1,address2,city,state,zip,email_type,tax_id + id,parent_id,date_last,language_id,country_id,affiliate_id,reseller_id,currency_id,theme_id,username,password,status,first_name,middle_name,last_name,title,email,company,address1,address2,city,state,zip,email_type,tax_id,max_child + id + search,date_expire,language_id,country_id,currency_id,theme_id,username,password,misc,status,first_name,middle_name,last_name,title,email,email_type,company,address1,address2,city,state,zip + id,date_orig,date_last,date_expire,parent_id,language_id,country_id,affiliate_id,campaign_id,reseller_id,currency_id,theme_id,username,password,inherit_group,misc,status,first_name,middle_name,last_name,title,email,email_type,company,address1,address2,city,state,zip,invoice_delivery,invoice_show_itemized,invoice_grace,invoice_advance_gen,tax_id,max_child + id,date_orig,date_last,date_expire,parent_id,language_id,country_id,affiliate_id,campaign_id,reseller_id,currency_id,theme_id,username,password,inherit_group,misc,status,first_name,middle_name,last_name,title,email,email_type,company,address1,address2,city,state,zip,invoice_delivery,invoice_show_itemized,invoice_grace,invoice_advance_gen,tax_id,max_child + id,date_orig,date_last,date_expire,parent_id,language_id,country_id,affiliate_id,campaign_id,reseller_id,currency_id,theme_id,username,password,misc,status,first_name,middle_name,last_name,title,email,email_type,company,address1,address2,city,state,zip,invoice_delivery,invoice_show_itemized,invoice_grace,invoice_advance_gen,tax_id,max_child + id,date_orig,date_last,date_expire,parent_id,language_id,country_id,affiliate_id,campaign_id,reseller_id,currency_id,theme_id,username,password,inherit_group,misc,status,first_name,middle_name,last_name,title,email,email_type,company,address1,address2,city,state,zip,tax_id,max_child + language_id,country_id,affiliate_id,campaign_id,currency_id,username,password,misc,status,first_name,middle_name,last_name,title,email,company,address1,address2,city,state,zip,tax_id + language_id,country_id,affiliate_id,campaign_id,currency_id,username,password,misc,status,first_name,middle_name,last_name,title,email,company,address1,address2,city,state,zip,tax_id + language_id,country_id,affiliate_id,campaign_id,currency_id,username,password,misc,status,first_name,middle_name,last_name,title,email,company,address1,address2,city,state,zip,tax_id + language_id,country_id,affiliate_id,campaign_id,currency_id,username,password,misc,status,first_name,middle_name,last_name,title,email,company,address1,address2,city,state,zip,tax_id + + + + + + account:add_account_groups + + + account:update_account_groups + + + + + + <add>Register User Account</add> + <mail_one>Send Email to User</mail_one> + <merge>Merge User Accounts</merge> + <search_form>Search</search_form> + <user_add>Register User Account</user_add> + <user_view>Update User Account</user_view> + <user_password>Reset Password</user_password> + <user_password_reset>Reset Password</user_password_reset> + <user_verify>Enter Verification Code</user_verify> + <user_verify_resend>Resend Verification Email</user_verify_resend> + <view>Account</view> + + + + + + + id + checkbox + 25px + + + status + bool_icon + 20px + + + last_name + + + first_name + + + username + 25 + + + email + 25 + + + literal + 120px + +Email +Service +Invoice +
    ]]> + + + diff --git a/modules/account/account_install.xml b/modules/account/account_install.xml index c664002c..712518bb 100644 --- a/modules/account/account_install.xml +++ b/modules/account/account_install.xml @@ -1,14 +1,101 @@ + + + + + + Account + + 1 + account - account - + + + + + + + + base - - - - install - - - - \ No newline at end of file + + + + + Add + 1 + add + + + + delete + + + + List + 1 + search + + + + + Search + 1 + search_form + + + + search_show + + + + update + + + + view + + + + search_export + + + install + + + update_account_groups + + + + send_verify_email + + + + send_password_email + + + + mail_multi + + + mail_one + + + autoselect + + + login + + + + merge + + + group_search + + + product_search + + + diff --git a/modules/account/account_install_data.xml b/modules/account/account_install_data.xml index 26e597a8..751480ae 100644 --- a/modules/account/account_install_data.xml +++ b/modules/account/account_install_data.xml @@ -1,33 +1,33 @@ - - 1 - 1 - 1075175744 - 1112335769 - 0 - 0 - english - 840 - 0 - 1 - default - admin - 21232f297a57a5a743894a0e4a801fc3 - Notes - 1 - Admin - Admin - Mrs - email@company.com - - City - State - 12345 - 0 - 0 - - - 33 - - \ No newline at end of file + + 1 + 1 + 1075175744 + 1112335769 + 0 + 0 + english + 840 + 0 + 1 + default + admin + 21232f297a57a5a743894a0e4a801fc3 + Notes + 1 + Admin + Admin + Mrs + email@company.com + + City + State + 12345 + 0 + 0 + + + 33 + + diff --git a/modules/account/auth.inc.php b/modules/account/auth.inc.php index c637b6b8..098fc3a9 100644 --- a/modules/account/auth.inc.php +++ b/modules/account/auth.inc.php @@ -1,38 +1,37 @@ - + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Modules:Account */ -$auth_methods = Array -( - Array ('module' => 'account', 'method' => 'add'), - Array ('module' => 'account', 'method' => 'user_add'), - Array ('module' => 'account', 'method' => 'user_view'), - Array ('module' => 'account', 'method' => 'add'), - Array ('module' => 'account', 'method' => 'view'), - Array ('module' => 'account', 'method' => 'update'), - Array ('module' => 'account', 'method' => 'password'), - Array ('module' => 'account', 'method' => 'password_reset'), - Array ('module' => 'account', 'method' => 'static_var'), - Array ('module' => 'account', 'method' => 'verify'), - Array ('module' => 'account', 'method' => 'verify_resend'), - Array ('module' => 'account', 'method' => 'sub_account_add'), - Array ('module' => 'account', 'method' => 'sub_delete') -); +/** + * Public Account methods + */ -?> \ No newline at end of file +$auth_methods = array( + array('module'=>'account','method'=>'user_add'), + array('module'=>'account','method'=>'user_view'), + array('module'=>'account','method'=>'user_password'), + array('module'=>'account','method'=>'user_password_reset'), + array('module'=>'account','method'=>'user_verify'), + array('module'=>'account','method'=>'user_verify_resend') +); +?> diff --git a/modules/account_admin/account_admin.inc.php b/modules/account_admin/account_admin.inc.php deleted file mode 100644 index 13ecc29c..00000000 --- a/modules/account_admin/account_admin.inc.php +++ /dev/null @@ -1,2651 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -class account_admin -{ - - # Open the constructor for this mod - function account_admin() - { - # name of this module: - $this->module = "account_admin"; - - if(!defined('AJAX')) - { - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - } - - /** - * Check account limitations - */ - function checkLimits() { - if(!defined('AGILE_RST_ACCOUNT') || AGILE_RST_ACCOUNT <= 0) return true; - $sql="SELECT count(*) as totalacct from ".AGILE_DB_PREFIX."account WHERE site_id=".DEFAULT_SITE; - $db=&DB(); - $rs=$db->Execute($sql); - if($rs && $rs->RecordCount() && $rs->fields['totalacct'] <= AGILE_RST_ACCOUNT) { - return true; - } else { - echo "Licensed user limit of ".AGILE_RST_ACCOUNT." exceeded, operation failed."; - return false; - } - return true; - } - - /* BEGIN: custom product/group searching method */ - - function group_search($VAR) { - $sql = ''; - echo "
    "; 
    -
    -		// get date ranges:
    -		foreach($VAR['dates']['val'] as $cond => $val) 
    -		{
    -			if($val > 0) {
    -				$exp = $VAR['dates']['expr'][$cond]; 
    -				$val = $this->convert_date($val,false);
    -
    -				if(!empty($sql)) $sql .= " AND "; else $sql = " ";
    -				$sql .= " A.date_orig $exp $val ";
    -			} 
    -		}        
    -		if(!empty($sql)) $sql = " ( $sql ) ";	
    -
    -		// get group(s)
    -		if(!empty($VAR['groups'])) {
    -			foreach($VAR['groups'] as $group ) 
    -			{  
    -				if($group != 0) {
    -					if(!empty($sql2)) $sql2 .= " OR "; else $sql2 = " ";
    -					$sql2 .= " B.group_id = $group ";  
    -				}
    -			}
    -		}
    -		if(!empty($sql2)) {
    -			if(!empty($sql)) $sql .= " AND \r\n";
    -			$sql .= " ( $sql2 ) AND ( A.id = B.account_id AND B.active = 1 ) ";
    -		}
    -
    -		// Assemble SQL:
    -		$q = "SELECT DISTINCT A.* FROM 
    -			". AGILE_DB_PREFIX ."account as A,
    -			". AGILE_DB_PREFIX ."account_group as B
    -			WHERE (
    -			A.site_id = ". DEFAULT_SITE ." AND
    -			B.site_id = ". DEFAULT_SITE ." ) ";        	
    -		if(!empty($sql)) $q .= " AND " . $sql;
    -		$db = &DB();
    -		$rs = $db->Execute($q);	 
    -
    -		// print results in text format      	
    -		if($rs && $rs->RecordCount() > 0) {
    -			while(!$rs->EOF) {        			
    -				echo $rs->fields['first_name'] .', '.$rs->fields['last_name'] .', '.$rs->fields['email'] .', '.$rs->fields['company'] .",\r\n";        		
    -				$rs->MoveNext();
    -			}
    -		} else {
    -			echo "No matches!";
    -		}
    -		echo "
    "; - } - - - - function product_search($VAR) { - $sql = ''; - echo "
    "; 
    -
    -		// get date ranges:
    -		if(!empty($VAR["dates"]))
    -		{
    -			foreach($VAR['dates']['val'] as $cond => $val) 
    -			{
    -				if($val > 0) {
    -					$exp = $VAR['dates']['expr'][$cond]; 
    -					$val = $this->convert_date($val,false);
    -
    -					if(!empty($sql)) $sql .= " AND "; else $sql = " ";
    -					$sql .= " B.date_orig $exp $val ";
    -				} 
    -			}
    -		}        
    -		if(!empty($sql)) $sql = " ( $sql ) ";	
    -
    -		// get group(s)
    -		if(!empty($VAR['products'])) {
    -			foreach($VAR['products'] as $prod ) 
    -			{  
    -				if($prod != 0) {
    -					if(!empty($sql2)) $sql2 .= " OR "; else $sql2 = " ";
    -					$sql2 .= " B.product_id = $prod ";  
    -				}
    -			}
    -		}
    -		if(!empty($sql2)) {
    -			if(!empty($sql)) $sql .= " AND \r\n";
    -			$sql .= " ( $sql2 ) AND ( A.id = C.account_id AND C.id =  B.invoice_id ) ";
    -		}
    -
    -		// Assemble SQL:
    -		$q = "SELECT DISTINCT A.* FROM 
    -			". AGILE_DB_PREFIX ."account as A,
    -			". AGILE_DB_PREFIX ."invoice_item as B,
    -			". AGILE_DB_PREFIX ."invoice as C
    -			WHERE (
    -			A.site_id = ". DEFAULT_SITE ." AND
    -			C.site_id = ". DEFAULT_SITE ." AND
    -			B.site_id = ". DEFAULT_SITE ." ) ";        	
    -		if(!empty($sql)) $q .= " AND " . $sql;
    -		$db = &DB();
    -		$rs = $db->Execute($q);	 
    -
    -
    -		// print results in text format      	
    -		if($rs && $rs->RecordCount() > 0) {
    -			while(!$rs->EOF) {        			
    -				echo $rs->fields['first_name'] .', '.$rs->fields['last_name'] .', '.$rs->fields['email'] .', '.$rs->fields['company'] .",\r\n";        		
    -				$rs->MoveNext();
    -			}
    -		} else {
    -			echo "No matches!";
    -		}
    -		echo "
    "; - } - - function convert_date ($date,$field) - { - if($date == '0' || $date == '') - return ''; - - $Arr_format = explode(DEFAULT_DATE_DIVIDER, UNIX_DATE_FORMAT); - $Arr_date = explode(DEFAULT_DATE_DIVIDER, $date); - - for($i=0; $i<3; $i++) - { - if($Arr_format[$i] == 'd') - $day = $Arr_date[$i]; - - if($Arr_format[$i] == 'm') - $month = $Arr_date[$i]; - - if($Arr_format[$i] == 'Y') - $year = $Arr_date[$i]; - } - - $timestamp = mktime(0, 0, 0, $month, $day, $year); - return $timestamp; - } - - /* END: custom product/group searching method */ - - - - - - - - - ########################################### - ### AJAX Auto-selector - ########################################### - - function autoselect($VAR) - { - if(!$this->checkLimits()) return false; // check account limits - - $db = &DB(); - $p = AGILE_DB_PREFIX; - - if (empty($VAR['account_search'])) { - $where = "id > 0"; - $type = 1; - } elseif (is_numeric($VAR['account_search'])) { - $where = "id LIKE ".$db->qstr($VAR['account_search']."%"); - $type = 1; - } elseif (eregi(" ", $VAR['account_search'])) { - $arr = explode(" ", $VAR['account_search']); - $where = "first_name = ".$db->qstr($arr[0])." AND ". - "last_name LIKE ".$db->qstr($arr[1].'%') ; - $type = 2; - } elseif (eregi("@", $VAR['account_search'])) { - $where = "email LIKE ".$db->qstr('%'.$VAR['account_search'].'%') ; - $type = 3; - - } else { - $where = "username LIKE ".$db->qstr($VAR['account_search'].'%')." OR ". - "first_name LIKE ".$db->qstr($VAR['account_search'].'%')." OR ". - "last_name LIKE ".$db->qstr($VAR['account_search'].'%') ; - $type = 4; - } - - $q = "SELECT id,email,first_name,last_name,username FROM {$p}account WHERE - ( $where ) - AND - site_id = " . DEFAULT_SITE." - ORDER BY first_name,last_name"; - $result = $db->SelectLimit($q,10); - - # Create the alert for no records found - echo '
      '; - # Create the alert for no records found - if ($result->RecordCount() > 0) { - $i=0; - while(!$result->EOF) - { - echo '
    • ' . $result->fields['first_name'].' '.$result->fields['last_name'] . '
      '. - ''. - '
    • ' . "\r\n"; - $result->MoveNext(); - $i++; - } - } - echo "
    "; - - } - - - ########################################### - ### Login as user - ########################################### - - function login($VAR) - { - global $C_auth; - - # Check for target user - $display_this=false; - if(!empty($VAR['account_id'])) - { - ### Get any authorized groups of the target account - $dba = &DB(); - $sql = 'SELECT group_id FROM ' . AGILE_DB_PREFIX . 'account_group WHERE - site_id = ' . $dba->qstr(DEFAULT_SITE) . ' AND - account_id = ' . $dba->qstr($VAR['account_id']) . ' AND - active = ' . $dba->qstr("1") . ' - ORDER BY group_id'; - $groups = $dba->Execute($sql); - while (!$groups->EOF) { - $group[] = $groups->fields['group_id']; - $groups->MoveNext(); - } - - ### Verify the user has access to view this account: - if(SESS_ACCOUNT != $VAR['account_id']) { - $display_this = true; - for($ix=0; $ixauth_group_by_id($group[$ix])) - $display_this = false; - } - } else { - return false; - } - - } else { - return false; - } - - # Logout current user and login as the target user - if($display_this) - { - $db = &DB(); - $sql = 'SELECT username,password FROM ' . AGILE_DB_PREFIX . 'account WHERE - site_id = ' . $dba->qstr(DEFAULT_SITE) . ' AND - id = ' . $dba->qstr($VAR['account_id']); - $acct = $db->Execute($sql); - $arr['_username'] = $acct->fields['username']; - $arr['_password'] = $acct->fields['password']; - include_once(PATH_CORE.'login.inc.php'); - $login = new CORE_login_handler; - $login->logout($VAR); - $login->login($arr, $md5=false); - define('REDIRECT_PAGE', '?_page=account:account&tid='.DEFAULT_THEME); - } - - - #################################################################### - ### Do any db_mapping - #################################################################### - $db = &DB(); - $sql = 'SELECT id FROM ' . AGILE_DB_PREFIX . 'module WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - name = ' . $db->qstr('db_mapping') . ' AND - status = ' . $db->qstr("1"); - $result = $db->Execute($sql); - if($result->RecordCount() > 0) - { - include_once ( PATH_MODULES . 'db_mapping/db_mapping.inc.php' ); - $db_map = new db_mapping; - $db_map->login ( $VAR['account_id'] ); - } - } - - - ########################################### - ### Account selector list search - ########################################### - - function popup_search($VAR) - { - $db = &DB(); - if (empty($VAR['search'])) { - $where = ''; - } elseif (eregi(" ", $VAR['search'])) { - $arr = explode(" ", $VAR['search']); - $where = "first_name = ".$db->qstr($arr[0])." AND ". - "last_name LIKE ".$db->qstr('%'.$arr[1].'%')." AND "; - } else { - $where = "username LIKE ".$db->qstr('%'.$VAR['search'].'%')." OR ". - "first_name LIKE ".$db->qstr('%'.$VAR['search'].'%')." OR ". - "first_name LIKE ".$db->qstr('%'.$VAR['search'].'%')." OR ". - "company LIKE ". $db->qstr('%'.$VAR['search'].'%')." AND "; - } - - $q = "SELECT id,first_name,last_name - FROM ".AGILE_DB_PREFIX."account - WHERE $where - site_id = '" . DEFAULT_SITE . "'"; - - $q_save = "SELECT * FROM ".AGILE_DB_PREFIX."account WHERE $where %%whereList%% "; - $result = $db->Execute($q); - - /// DEBUG //// - // echo "
    $q
    "; - - # get the result count: - $results = $result->RecordCount(); - - # Create the alert for no records found - if ($results == 0) - { - $id = $result->fields['id']; - $name = $result->fields['first_name'].' '.$result->fields['last_name']; - $val = $id.'|'.$name; - $res = ' - '; - echo $res; - } - else if ($results == 1) - { - $id = $result->fields['id']; - $name = $result->fields['first_name'].' '.$result->fields['last_name']; - $val = $id.'|'.$name; - $res = ' - '; - echo $res; - } - else - { - # create the search record - include_once(PATH_CORE . 'search.inc.php'); - $search = new CORE_search; - $arr['module'] = $this->module; - $arr['sql'] = $q_save; - $arr['limit'] = '30'; - $arr['order_by'] = 'last_name'; - $arr['results'] = $results; - $search->add($arr); - - global $smarty; - $smarty->assign('search_id', $search->id); - $smarty->assign('page', '1'); - $smarty->assign('limit', $limit); - $smarty->assign('order_by', $order_by); - $smarty->assign('results', $results); - - $res = ' - '; - - echo $res; - - } - } - - - ########################################### - ### Top Accounts Graph: - ########################################### - function top($VAR) - { - global $smarty, $C_translate, $C_auth; - - # Get the period type, default to month - if (empty($VAR['period'])) - $p = 'm'; - else - $p = $VAR['period']; - - # Load the jpgraph class - include (PATH_GRAPH."jpgraph.php"); - include (PATH_GRAPH."jpgraph_bar.php"); - - # check the validation for this function - if(!$C_auth->auth_method_by_name($this->module,'search')) { - $error = $C_translate->translate('module_non_auth','',''); - include (PATH_GRAPH."jpgraph_canvas.php"); - $graph = new CanvasGraph(460,55,"auto"); - $t1 = new Text($error); - $t1->Pos(0.2,0.5); - $t1->SetOrientation("h"); - $t1->SetBox("white","black",'gray'); - $t1->SetFont(FF_FONT1,FS_NORMAL); - $t1->SetColor("black"); - $graph->AddText($t1); - $graph->Stroke(); - exit; - } - - # Get the period start & end - switch ($p) - { - # By Weeks: - case 'w': - $interval = "1"; - $width = ".9"; - $title = 'Top Accounts for Last Last Week'; - $dow = date('w'); - $start_str = mktime(0,0,0,date('m'), date('d')-$dow, date('y')); - $end_str = mktime(23,59,59,date('m'), date('d'), date('y')); - break; - - # By Months: - case 'm': - $interval = "3"; - $width = ".6"; - $title = 'Top Accounts for Last Last Month'; - $start_str = mktime(0,0,0,date('m'), 1, date('y')); - $end_str = mktime(23,59,59,date('m'), date('d'), date('y')); - break; - - # By Years: - case 'y': - $interval = "1"; - $width = ".8"; - $title = 'Top Accounts for Last Last Year'; - $start_str = mktime(0,0,0,1,1, date('y')); - $end_str = mktime(23,59,59, date('m'), date('d'), date('y')); - break; - } - - - ##############################@@@@@@@@ - # Get accounts & sales for this period - ##############################@@@@@@@@ - $db = &DB(); - $sql = 'SELECT account_id,total_amt FROM ' . AGILE_DB_PREFIX . 'invoice WHERE - date_orig >= ' . $db->qstr( $start_str ) . ' AND date_orig <= ' . $db->qstr( $end_str ) . ' AND - site_id = ' . $db->qstr(DEFAULT_SITE); - $result = $db->Execute($sql); - if(@$result->RecordCount() == 0) { - $file = fopen( PATH_THEMES.'default_admin/images/invisible.gif', 'r'); - fpassthru($file); - exit; - } - - while(!$result->EOF) - { - $amt = $result->fields['total_amt']; - $acct = $result->fields['account_id']; - if(!isset( $arr[$acct] )) $arr[$acct] = 0; - $arr[$acct] += $amt; - $result->MoveNext(); - } - - $i = 0; - while(list($key, $var) = each(@$arr)) { - # Get the user name - $sql = 'SELECT first_name,last_name FROM ' . AGILE_DB_PREFIX . 'account WHERE - id = ' . $db->qstr( $key ) . ' AND - site_id = ' . $db->qstr(DEFAULT_SITE); - $rs = $db->Execute($sql); - - $_lbl[] = strtoupper(substr($rs->fields['first_name'],0,1)) . ". " . $rs->fields['last_name']; - $_datay[] = $var; - $i++; - } - - - ### Sort the arrays - array_multisort($_datay,SORT_DESC, SORT_NUMERIC, $_lbl); - - ### Limit the results to 10 or less - for($i=0; $i=9) $i = count($_lbl); - } - - $i = count($lbl); - - - # Get the Currency - $sql = 'SELECT symbol FROM ' . AGILE_DB_PREFIX . 'currency WHERE - id = ' . $db->qstr( DEFAULT_CURRENCY ) . ' AND - site_id = ' . $db->qstr(DEFAULT_SITE); - $rs = $db->Execute($sql); - $currency_iso = $rs->fields['symbol']; - - // Size of graph - $width=265; - $height=75 + ($i*15); - - // Set the basic parameters of the graph - $graph = new Graph($width,$height,'auto'); - $graph->SetScale("textlin"); - $graph->yaxis->scale->SetGrace(50); - $graph->SetMarginColor('#F9F9F9'); - $graph->SetFrame(true,'#CCCCCC',1); - $graph->SetColor('#FFFFFF'); - - $top = 45; - $bottom = 10; - $left = 95; - $right = 15; - $graph->Set90AndMargin($left,$right,$top,$bottom); - - // Label align for X-axis - $graph->xaxis->SetLabelAlign('right','center','right'); - - // Label align for Y-axis - $graph->yaxis->SetLabelAlign('center','bottom'); - $graph->xaxis->SetTickLabels($lbl); - - // Titles - $graph->title->SetFont(FF_FONT1,FS_BOLD,9.5); - $title = $C_translate->translate('graph_top','account_admin',''); - $graph->title->Set($title); - - // Create a bar pot - $bplot = new BarPlot($datay); - $bplot->SetFillColor("#506DC7"); - $bplot->SetWidth(0.2); - - // Show the values - $bplot->value->Show(); - $bplot->value->SetFont(FF_FONT1,FS_NORMAL,8); - $bplot->value->SetAlign('center','center'); - $bplot->value->SetColor("black","darkred"); - $bplot->value->SetFormat($currency_iso.'%.2f'); - - $graph->Add($bplot); - $graph->Stroke(); - - return; - } - - - - ############################## - ## MAIL ONE ACCOUNT ## - ############################## - function mail_one($VAR) - { - global $C_translate, $C_debug; - - ## Validate the required vars (account_id, message, subject) - if(@$VAR['mail_account_id'] != "" && @$VAR['mail_subject'] != "" && @$VAR['mail_message'] != "") - { - ## Verify the specified account: - $db = &DB(); - $sql = 'SELECT email,first_name,last_name FROM ' . AGILE_DB_PREFIX . 'account WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - id = ' . $db->qstr($VAR['mail_account_id']); - $account = $db->Execute($sql); - - if($account->RecordCount() == 0) - { - ## Error message: - $C_debug->alert($C_translate->translate('account_non_exist','account_admin','')); - return; - } - - ################################################################ - ## OK to send the email: - - $db = &DB(); - $q = "SELECT * FROM ".AGILE_DB_PREFIX."setup_email WHERE - site_id = ".$db->qstr(DEFAULT_SITE)." AND - id = ".$db->qstr($VAR['mail_email_id']); - $setup_email = $db->Execute($q); - - $E['priority'] = $VAR['mail_priority']; - $E['html'] = '0'; - $E['subject'] = $VAR['mail_subject']; - $E['body_text'] = $VAR['mail_message']; - $E['to_email'] = $account->fields['email']; - $E['to_name'] = $account->fields['first_name'] . ' ' . $account->fields['last_name']; - - - if($setup_email->fields['type'] == 0) - { - $type = 0; - } - else - { - $type = 1; - $E['server'] = $setup_email->fields['server']; - $E['account'] = $setup_email->fields['username']; - $E['password'] = $setup_email->fields['password']; - } - - $E['from_name'] = $setup_email->fields['from_name']; - $E['from_email'] = $setup_email->fields['from_email']; - - if($setup_email->fields['cc_list'] != '') - $E['cc_list'] = explode(',', $setup_email->fields['cc_list']); - - if($setup_email->fields['bcc_list'] != '') - $E['bcc_list'] = explode(',', $setup_email->fields['bcc_list']); - - - ### Call the mail class - require_once(PATH_CORE . 'email.inc.php'); - $email = new CORE_email; - if($type == 0) - $email->PHP_Mail($E); - else - $email->SMTP_Mail($E); - - - } - else - { - ## Error message: - $C_debug->alert($C_translate->translate('validate_any','','')); - - ## Stripslashes - global $C_vars; - $C_vars->strip_slashes_all(); - return; - } - - ## Success message: - $C_debug->alert($C_translate->translate('mail_sent','account_admin','')); - - ## Stripslashes - global $C_vars; - $C_vars->strip_slashes_all(); - } - - - ############################## - ## MAIL MULTI ACCOUNTS ## - ############################## - function mail_multi($VAR) - { - if(!$this->checkLimits()) return false; // check account limits - - global $C_translate, $C_debug; - - ## Validate the required vars (account_id, message, subject) - if(@$VAR['search_id'] != "" && @$VAR['mail_subject'] != "" && @$VAR['mail_message'] != "") - { - - ## Get the specified accounts: - # get the search details: - if(isset($VAR['search_id'])) { - include_once(PATH_CORE . 'search.inc.php'); - $search = new CORE_search; - $search->get($VAR['search_id']); - } else { - # invalid search! - echo '
    The search terms submitted were invalid!'; # translate... # alert - return; - } - - # generate the full query - $field_list = AGILE_DB_PREFIX."account.email, ". - AGILE_DB_PREFIX."account.first_name, ". - AGILE_DB_PREFIX."account.last_name "; - - $q = eregi_replace("%%fieldList%%", $field_list, $search->sql); - $q = eregi_replace("%%tableList%%", AGILE_DB_PREFIX."account", $q); - $q = eregi_replace("%%whereList%%", "", $q); - $q .= " ".AGILE_DB_PREFIX."account.site_id = '" . DEFAULT_SITE . "'"; - $db = &DB(); - $account = $db->Execute($q); - - // check results - if($account->RecordCount() == 0) { - $C_debug->alert($C_translate->translate('account_non_exist','account_admin','')); - return; - } - - // get the selected email setup details - $db = &DB(); - $q = "SELECT * FROM ".AGILE_DB_PREFIX."setup_email WHERE - site_id = ".$db->qstr(DEFAULT_SITE)." AND - id = ".$db->qstr($VAR['mail_email_id']); - $setup_email = $db->Execute($q); - if($setup_email->fields['type'] == 0) { - $type = 0; - } else { - $type = 1; - $E['server'] = $setup_email->fields['server']; - $E['account'] = $setup_email->fields['username']; - $E['password'] = $setup_email->fields['password']; - } - - // loop to send each e-mail - while ( !$account->EOF ) - { - $E['priority'] = $VAR['mail_priority']; - $E['html'] = '0'; - $E['subject'] = $VAR['mail_subject']; - $E['body_text'] = $VAR['mail_message']; - $E['to_email'] = $account->fields['email']; - $E['to_name'] = $account->fields['first_name'] . ' ' . $account->fields['last_name']; - $E['from_name'] = $setup_email->fields['from_name']; - $E['from_email'] = $setup_email->fields['from_email']; - - ### Call the mail class - require_once(PATH_CORE . 'email.inc.php'); - $email = new CORE_email; - $email = new CORE_email; - if($type == 0) - $email->PHP_Mail($E); - else - $email->SMTP_Mail($E); - - ### Next record - $account->MoveNext(); - } - - - } else { - ## Error message: - $C_debug->alert($C_translate->translate('validate_any','','')); - - ## Stripslashes - global $C_vars; - $C_vars->strip_slashes_all(); - return; - } - - ## Success message: - $C_debug->alert($C_translate->translate('mail_sent','account_admin','')); - - ## Stripslashes - global $C_vars; - $C_vars->strip_slashes_all(); - } - - - ############################## - ## SEND PASSWORD CHANGE ## - ############################## - function send_password_email($VAR) - { - global $C_translate, $C_debug; - require_once(PATH_MODULES . 'email_template/email_template.inc.php'); - $my = new email_template; - $my->send('password_change_instructions', @$VAR['id'], '', '', ''); - echo $C_translate->translate("password_change_instructions","account_admin",""); - } - - - ############################## - ## SEND VERIFY E-MAIL ## - ############################## - function send_verify_email($VAR) - { - global $C_translate, $C_debug; - - require_once(PATH_MODULES . 'email_template/email_template.inc.php'); - $my = new email_template; - $db = &DB(); - $dbm = new CORE_database; - echo $sql = $dbm->sql_select('account','date_orig',"id = {$VAR['id']}",'', $db); - $result = $db->Execute($sql); - $validation_str = strtoupper($result->fields['date_orig']. ':' . $VAR['id']); - $my->send('account_registration_inactive', @$VAR['id'], @$VAR['id'], '', $validation_str); - echo $C_translate->translate("account_verify_instructions","account_admin",""); - } - - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - if(!$this->checkLimits()) return false; // check account limits - - global $C_translate, $C_debug, $smarty; - - ### Set the hidden values: - $VAR['account_admin_date_orig'] = time(); - $VAR['account_admin_date_last'] = time(); - if(!empty($VAR["account_admin_date_expire"])) { - include_once(PATH_CORE.'validate.inc.php'); - $val = new CORE_validate; - $date_expire = $val->DateToEpoch(false, $VAR["account_admin_date_expire"]); - } else { - $date_expire = 0; - } - - - ### Determine the proper account status: - if(!isset($VAR['account_admin_status']) || $VAR['account_admin_status'] != "1") - $status = 0; - else - $status = 1; - - - ### DEFINE A USERNAME: - if(empty($VAR['account_admin_username'])) { - $length = 4; - srand((double)microtime()*1000000); - $vowels = array("a", "e", "i", "o", "u"); - $cons = array("b", "c", "d", "g", "h", "j", "k", "l", "m", "n", "p", - "r", "s", "t", "u", "v", "w", "tr", "cr", "br", "fr", "th", - "dr", "ch", "ph", "wr", "st", "sp", "sw", "pr", "sl", "cl"); - $num_vowels = count($vowels); - $num_cons = count($cons); - for($i = 0; $i < $length; $i++){ - @$VAR['account_admin_username'] .= $cons[rand(0, $num_cons - 1)] . $vowels[rand(0, $num_vowels - 1)]; - } - } - - ## Single field login: - if(defined('SINGLE_FIELD_LOGIN') && SINGLE_FIELD_LOGIN==true && empty($VAR['account_admin_password'])) { - $VAR['account_admin_password']='none'; - $passwd = 'none'; - } - - ### DEFINE A PASSWORD: - if(empty($VAR['account_admin_password'])) - { - srand((double)microtime() * 1000000); - $UniqID = md5(uniqid(rand())); - @$VAR['account_admin_password'] = substr(md5(uniqid(rand())), 0, 10); - $passwd = '********'; - } else { - $passwd = $VAR['account_admin_password']; - - /* hash the password */ - if(defined('PASSWORD_ENCODING_SHA')) - $VAR['account_admin_password'] = sha1($VAR['account_admin_password']); - else - $VAR['account_admin_password'] = md5($VAR['account_admin_password']); - } - - - #################################################################### - ### loop through the field list to validate the required fields - #################################################################### - - $type = 'add'; - $this->method["$type"] = explode(",", $this->method["$type"]); - $arr = $this->method["$type"]; - include_once(PATH_CORE . 'validate.inc.php'); - $validate = new CORE_validate; - $this->validated = true; - - while (list ($key, $value) = each ($arr)) - { - # get the field value - $field_var = $this->module . '_' . $value; - $field_name = $value; - - #################################################################### - ### perform any field validation... - #################################################################### - - # check if this value is unique - if(isset($this->field["$value"]["unique"]) && isset($VAR["$field_var"])) - { - if(!$validate->validate_unique($this->table, $field_name, "record_id", $VAR["$field_var"])) - { - $this->validated = false; - $this->val_error[] = array('field' => $this->table . '_' . $field_name, - 'field_trans' => $C_translate->translate('field_' . $field_name, $this->module, ""), # translate - 'error' => $C_translate->translate('validate_unique',"", "")); - } - } - - # check if the submitted value meets the specifed requirements - if(isset($this->field["$value"]["validate"])) - { - if(isset($VAR["$field_var"])) - { - if($VAR["$field_var"] != '') - { - if(!$validate->validate($field_name, $this->field["$value"], $VAR["$field_var"], $this->field["$value"]["validate"])) - { - $this->validated = false; - $this->val_error[] = array('field' => $this->module . '_' . $field_name, - 'field_trans' => $C_translate->translate('field_' . $field_name, $this->module, ""), - 'error' => $validate->error["$field_name"] ); - } - } - else - { - $this->validated = false; - $this->val_error[] = array('field' => $this->module . '_' . $field_name, - 'field_trans' => $C_translate->translate('field_' . $field_name, $this->module, ""), - 'error' => $C_translate->translate('validate_any',"", "")); - } - } - else - { - $this->validated = false; - $this->val_error[] = array('field' => $this->module . '_' . $field_name, - 'field_trans' => $C_translate->translate('field_' . $field_name, $this->module, ""), - 'error' => $C_translate->translate('validate_any',"", "")); - } - } - } - - - // validate the tax_id - require_once(PATH_MODULES.'tax/tax.inc.php'); - $taxObj=new tax; - $tax_arr = @$VAR['account_admin_tax_id']; - if(is_array($tax_arr)) { - foreach($tax_arr as $country_id => $tax_id) { - if ($country_id == $VAR['account_admin_country_id']) { - $exempt = @$VAR["account_tax_id_exempt"][$country_id]; - if(!$taxObj->TaxIdsValidate($country_id, $tax_id, $exempt)) { - $this->validated = false; - $this->val_error[] = array( - 'field' => 'account_admin_tax_id', - 'field_trans' => $taxObj->errField, - 'error' => $C_translate->translate('validate_general', "", "")); - } - if($exempt) - $account_admin_tax_id=false; - else - $account_admin_tax_id=$tax_id; - } - } - } - - #################################################################### - ### Get required static_Vars and validate them... return an array - ### w/ ALL errors... - #################################################################### - - require_once(PATH_CORE . 'static_var.inc.php'); - $static_var = new CORE_static_var; - - if(!isset($this->val_error)) $this->val_error = false; - $all_error = $static_var->validate_form('account', $this->val_error); - - if($all_error != false && gettype($all_error) == 'array') - $this->validated = false; - else - $this->validated = true; - - - #################################################################### - ### If validation was failed, skip the db insert & - ### set the errors & origonal fields as Smarty objects, - ### and change the page to be loaded. - #################################################################### - - if(!$this->validated) - { - global $smarty; - - # set the errors as a Smarty Object - $smarty->assign('form_validation', $all_error); - - # set the page to be loaded - if(!defined("FORCE_PAGE")) - { - define('FORCE_PAGE', $VAR['_page_current']); - } - - # Stripslashes - global $C_vars; - $C_vars->strip_slashes_all(); - - - return; - } - - # Get default invoice options - $db=&DB(); - $invopt=$db->Execute(sqlSelect($db,"setup_invoice","*","")); - if($invopt && $invopt->RecordCount()) { - $invoice_delivery=$invopt->fields['invoice_delivery']; - $invoice_format=$invopt->fields['invoice_show_itemized']; - } - - #################################################################### - ### Insert the account record - #################################################################### - $this->account_id = $db->GenID(AGILE_DB_PREFIX . 'account_id'); - $validation_str = time(); - - /** get parent id */ - @$parent_id = @$VAR["account_admin_parent_id"]; - if(empty($parent_id)) $parent_id = $this->account_id; - - $sql = ' - INSERT INTO ' . AGILE_DB_PREFIX . 'account SET - id = ' . $db->qstr ( $this->account_id ) . ', - site_id = ' . $db->qstr ( DEFAULT_SITE ) . ', - date_orig = ' . $db->qstr ( $validation_str ) . ', - date_last = ' . $db->qstr ( time()) . ', - date_expire = ' . $db->qstr ( $date_expire ) . ', - language_id = ' . $db->qstr ( $VAR["account_admin_language_id"] ) . ', - country_id = ' . $db->qstr ( $VAR["account_admin_country_id"] ) . ', - parent_id = ' . $db->qstr ( $parent_id ) . ', - affiliate_id = ' . $db->qstr ( @$VAR["account_admin_affiliate_id"] ) . ', - reseller_id = ' . $db->qstr ( @$VAR["account_admin_reseller_id"] ) . ', - currency_id = ' . $db->qstr ( $VAR["account_admin_currency_id"] ) . ', - theme_id = ' . $db->qstr ( $VAR["account_admin_theme_id"] ) . ', - username = ' . $db->qstr ( $VAR["account_admin_username"] ) . ', - password = ' . $db->qstr ( $VAR["account_admin_password"] ) . ', - status = ' . $db->qstr ( $status ) . ', - first_name = ' . $db->qstr ( $VAR["account_admin_first_name"] ) . ', - middle_name = ' . $db->qstr ( $VAR["account_admin_middle_name"] ) . ', - last_name = ' . $db->qstr ( $VAR["account_admin_last_name"] ) . ', - company = ' . $db->qstr ( $VAR["account_admin_company"] ) . ', - title = ' . $db->qstr ( $VAR["account_admin_title"] ) . ', - email = ' . $db->qstr ( $VAR["account_admin_email"] ) . ', - address1 = ' . $db->qstr ( $VAR["account_admin_address1"] ) . ', - address2 = ' . $db->qstr ( $VAR["account_admin_address2"] ) . ', - city = ' . $db->qstr ( $VAR["account_admin_city"] ) . ', - state = ' . $db->qstr ( $VAR["account_admin_state"] ) . ', - zip = ' . $db->qstr ( $VAR["account_admin_zip"] ) . ', - misc = ' . $db->qstr ( $VAR["account_admin_misc"] ) . ', - email_type = ' . $db->qstr ( $VAR["account_admin_email_html"] ) . ', - invoice_delivery= ' . $db->qstr ( @$invoice_delivery ) . ', - invoice_show_itemized=' . $db->qstr ( @$invoice_format ) . ', - invoice_advance_gen = ' . $db->qstr ( MAX_INV_GEN_PERIOD ) . ', - invoice_grace = ' . $db->qstr ( GRACE_PERIOD ) . ', - tax_id = ' . $db->qstr ( @$account_tax_id ); - $result = $db->Execute($sql); - - ### error reporting: - if ($result === false) - { - global $C_debug; - $C_debug->error('account_admin.inc.php','add', $db->ErrorMsg()); - - if(isset($this->trigger["$type"])) - { - include_once(PATH_CORE . 'trigger.inc.php'); - $trigger = new CORE_trigger; - $trigger->trigger($this->trigger["$type"], 0, $VAR); - } - return; - } - - /* password logging class */ - global $C_list; - if($C_list->is_installed('account_password_history')) { - include_once(PATH_MODULES.'account_password_history/account_password_history.inc.php'); - $accountHistory = new account_password_history(); - $accountHistory->setNewPassword($this->account_id, $VAR["account_admin_password"]); - } - - ### Add the account to the default group: - $this->add_account_groups($VAR['groups'], $this->account_id, $VAR['account_admin_date_expire']); - - ### Insert the static vars: - $static_var->add($VAR, 'account', $this->account_id); - - - ### Mail the new user - if(!empty($VAR['welcome_email'])) { - require_once(PATH_MODULES . 'email_template/email_template.inc.php'); - $my = new email_template; - if($status == "1") { - $my->send('account_add_staff_active', $this->account_id, '', '', $passwd); - } else { - $validation_str = strtoupper($validation_str. ':' .$this->account_id); - $my->send('account_add_staff_inactive', $this->account_id, $this->account_id, '', $validation_str); - } - } - - ### Do any db_mapping - if($C_list->is_installed('db_mapping')) - { - include_once ( PATH_MODULES . 'db_mapping/db_mapping.inc.php' ); - $db_map = new db_mapping; - if(!empty($passwd)) - $db_map->plaintext_password = $passwd; - else - $db_map->plaintext_password = false; - $db_map->account_add ( $this->account_id ); - } - - ### Display the welcome message - if($status == "1") - { - $C_debug->alert($C_translate->translate("staff_add_active","account_admin","")); - - } else { - $C_debug->alert($C_translate->translate("staff_add_inactive","account_admin","")); - } - - #$VAR["id"] = $this->account_id; - $url = '?_page=' . $VAR['_page'] . '&id=' . $this->account_id; - if(!empty($VAR['id'])) $url.= '&_escape=1'; - if(!empty($VAR['field'])) - { - $url .= '&field='.$VAR['field']; - $url .= '&name='.$VAR['account_admin_first_name'].' '.$VAR['account_admin_last_name']; - } - - define('REDIRECT_PAGE', $url); - - ### Affiliate Auto Creation - if(AUTO_AFFILIATE == 1 && $C_list->is_installed("affiliate")) - { - $VAR['affiliate_account_id'] = $this->account_id; - $VAR['affiliate_template_id'] = DEFAULT_AFFILIATE_TEMPLATE; - @$VAR['affiliate_parent_affiliate_id'] = $VAR['account_admin_affiliate_id']; - - include_once(PATH_MODULES . 'affiliate/affiliate.inc.php'); - $affiliate = new affiliate; - $affiliate->add($VAR, $affiliate); - } - - return; - } - - - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - if(!$this->checkLimits()) return false; // check account limits - - global $C_auth; - - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - - # set the field list for this method: - $db = &DB(); - $arr = $this->method[$type]; - if(isset($VAR["id"])) - { - $id = explode(',',$VAR["id"]); - for($i=0; $iqstr($id[$i])." "; - $ii++; - } - else - { - $id_list .= " OR id = " .$db->qstr($id[$i]). " "; - $ii++; - } - } - } - } - - if($ii>0) - { - # generate the full query - $q = "SELECT * FROM - ".AGILE_DB_PREFIX."account - WHERE - $id_list - AND site_id = '" . DEFAULT_SITE . "'"; - - $result = $db->Execute($q); - - # error reporting - if ($result === false) - { - global $C_debug; - $C_debug->error('account_admin.inc.php','view', $db->ErrorMsg() . ' ' . $q); - return; - } - - # put the results into a smarty accessable array - $i=0; - $class_name = TRUE; - while (!$result->EOF) - { - $smart[$i] = $result->fields; - - if($class_name) - { - $smart[$i]["i"] = $i; - } else { - $smart[$i]["i"] = $i; - } - - ### Get any authorized groups: - $dba = &DB(); - $sql = 'SELECT service_id,group_id FROM ' . AGILE_DB_PREFIX . 'account_group WHERE - site_id = ' . $dba->qstr(DEFAULT_SITE) . ' AND - account_id = ' . $dba->qstr($result->fields['id']) . ' AND - active = ' . $dba->qstr("1") . ' - ORDER BY group_id'; - - $groups = $dba->Execute($sql); - - while (!$groups->EOF) - { - if($groups->fields['service_id'] == '') $group[] = $groups->fields['group_id']; - $groups->MoveNext(); - } - $smart[$i]["groups"] = $group; - - ### Verify the user has access to view this account: - if(SESS_ACCOUNT != $result->fields['id']) - { - $smart[$i]['own_account'] = false; - $display_this = true; - for($ix=0; $ixauth_group_by_id($group[$ix])) - $display_this = false; - } - } - else - { - $display_this = true; - $smart[$i]['own_account'] = true; - } - - - - - ### Get the static vars: - require_once(PATH_CORE . 'static_var.inc.php'); - $static_var = new CORE_static_var; - $arr = $static_var->update_form('account', 'update', $result->fields['id']); - if(gettype($arr) == 'array') - { - $smart[$i]["static_var"] = $arr; - } - - - ### Get the last activity date/IP - $sql = "SELECT * FROM ".AGILE_DB_PREFIX."login_log - WHERE account_id = {$result->fields['id']} - AND site_id = ".DEFAULT_SITE." - ORDER BY date_orig DESC "; - $rslast = $db->SelectLimit($sql, 1); - if($rslast != false && $rslast->RecordCount() == 1) { - $smart[$i]["last_activity"] = $rslast->fields['date_orig']; - $smart[$i]["last_ip"] = $rslast->fields['ip']; - } else { - $smart[$i]["last_activity"] = $result->fields['date_orig']; - $smart[$i]["last_ip"] = ''; - } - - - ### Get invoice details for this account: - $sql = "SELECT id,date_orig,total_amt,billed_amt,process_status FROM ".AGILE_DB_PREFIX."invoice - WHERE account_id = {$result->fields['id']} - AND site_id = ".DEFAULT_SITE." - ORDER BY id DESC "; - $inv = $db->SelectLimit($sql, 10); - if($inv != false && $inv->RecordCount() > 0) { - while(!$inv->EOF) { - if($inv->fields['total_amt'] > $inv->fields['billed_amt'] && $inv->fields['suspend_billing'] != 1) { - $inv->fields['due'] = $inv->fields['total_amt'] - $inv->fields['billed_amt']; - } - $smart[$i]["invoice"][] = $inv->fields; - $inv->MoveNext(); - } - } - - - ### Get service details for this account: - $sql = "SELECT id,sku,active,type,domain_name,domain_tld FROM ".AGILE_DB_PREFIX."service - WHERE account_id = {$result->fields['id']} - AND site_id = ".DEFAULT_SITE." - ORDER BY id DESC "; - $svc = $db->SelectLimit($sql, 10); - if($svc != false && $svc->RecordCount() > 0) { - while(!$svc->EOF) { - $smart[$i]["service"][] = $svc->fields; - $svc->MoveNext(); - } - } - - - # define the results - if(!$display_this) - { - unset($smart["$i"]); - echo "You have selected an account for which you are not authorized, - your permission settings are to low!

    "; - } - else - { - $i++; - } - unset($group); - $result->MoveNext(); - } - - # get the result count: - $results = $i; - - ### No results: - if($i == 0) - { - global $C_debug; - $C_debug->error("CORE:account_admin.inc.php", "view()", " - The selected record does not exist any longer, or your account is not authorized to view it"); - return; - } - - - global $smarty; - $smarty->assign($this->table, $smart); - $smarty->assign('results', $search->results); - } - } - - - - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - global $C_list, $C_debug; - - if(!$this->checkLimits()) return false; // check account limits - - // validate the tax_id - global $VAR; - require_once(PATH_MODULES.'tax/tax.inc.php'); - $taxObj=new tax; - $tax_arr = @$VAR['account_admin_tax_id']; - if(is_array($tax_arr)) { - foreach($tax_arr as $country_id => $tax_id) { - if ($country_id == $VAR['account_admin_country_id']) { - $exempt = @$VAR["account_tax_id_exempt"][$country_id]; - if(!$txRs=$taxObj->TaxIdsValidate($country_id, $tax_id, $exempt)) { - $this->validated = false; - global $C_translate; - $this->val_error[] = array( - 'field' => 'account_admin_tax_id', - 'field_trans' => $taxObj->errField, - 'error' => $C_translate->translate('validate_general', "", "")); - } - if($exempt) - $VAR['account_admin_tax_id']=false; - else - $VAR['account_admin_tax_id']=$tax_id; - } - } - } - - #################################################################### - ### Get required static_Vars and validate them... return an array - ### w/ ALL errors... - #################################################################### - - require_once(PATH_CORE . 'static_var.inc.php'); - $static_var = new CORE_static_var; - if(!isset($this->val_error)) $this->val_error = false; - $all_error = $static_var->validate_form('account', $this->val_error); - - if($all_error != false && gettype($all_error) == 'array') - $this->validated = false; - else - $this->validated = true; - - #################################################################### - # If validation was failed, skip the db insert & - # set the errors & origonal fields as Smarty objects, - # and change the page to be loaded. - #################################################################### - - if(!$this->validated) - { - global $smarty; - - # set the errors as a Smarty Object - $smarty->assign('form_validation', $all_error); - - # set the page to be loaded - if(!defined("FORCE_PAGE")) - { - define('FORCE_PAGE', $VAR['_page_current']); - } - return; - } - - ### Get the old username ( for db mapping ) - $db = &DB(); - $sql = 'SELECT username FROM ' . AGILE_DB_PREFIX . 'account WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - id = ' . $db->qstr($VAR['account_admin_id']); - $result = $db->Execute($sql); - if($result->RecordCount() > 0) - { - $old_username = $result->fields['username']; - } - - ### Update the password: - $update_password=false; - if(!empty($VAR['_password'])) { - $VAR['account_admin_password'] = $VAR['_password']; - - /* check if new password is ok */ - if($C_list->is_installed('account_password_history')) { - include_once(PATH_MODULES.'account_password_history/account_password_history.inc.php'); - $accountHistory = new account_password_history(); - if(!$accountHistory->getIsPasswordOk($VAR['account_admin_id'], $VAR['account_admin_password'], false)) { - $C_debug->alert("The password you have selected has been used recently and cannot be used again at this time for security purposes."); - unset($VAR['account_admin_password']); - } else { - $update_password=true; - } - } - } - - ### Update the record - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $ok = $db->update($VAR, $this, $type); - - if($ok) - { - /* password logging class */ - if($update_password && is_object($accountHistory)) $accountHistory->setNewPassword($VAR['account_admin_id'], $VAR["account_admin_password"], false); - - ### Update the static vars: - $static_var->update($VAR, 'account', $VAR['account_admin_id']); - - ### Do any db_mapping - if($C_list->is_installed('db_mapping')) - { - include_once ( PATH_MODULES . 'db_mapping/db_mapping.inc.php' ); - $db_map = new db_mapping; - - if(!empty($VAR['account_admin_password'])) - $db_map->plaintext_password = $VAR['account_admin_password']; - else - $db_map->plaintext_password = false; - - $db_map->account_edit ( $VAR['account_admin_id'], $old_username ); - } - - // remove login lock - if($VAR['account_admin_status']) { - $db=&DB(); - $delrs = $db->Execute($sql=sqlDelete($db,"login_lock","account_id={$VAR['account_admin_id']}")); - $delrs = $db->Execute($sql=sqlDelete($db,"login_log","account_id={$VAR['account_admin_id']} AND status=0")); - } - return true; - } - } - - - - ############################## - ## MERGE ## - ############################## - function merge($VAR) - { - $db = &DB(); - global $C_auth, $C_list, $C_translate, $C_debug; - - if(empty($VAR['id']) || empty($VAR['merge_acct_id'])) { - $C_debug->alert($C_translate->translate('merge_err','account_admin','')); - return false; - } - - $acct_id = $VAR['id']; - $merge_acct_id = $VAR['merge_acct_id']; - - # Get merged account_group - $q = "SELECT * FROM ".AGILE_DB_PREFIX."account_group WHERE ( - service_id = '' OR - service_id = 0 OR - service_id IS NULL - ) AND account_id = $acct_id AND site_id = ".DEFAULT_SITE; - $rs = $db->Execute($q); - if ($rs === false) { - $C_debug->error('account_admin.inc.php','merge :: account_group', $db->ErrorMsg()); - } else { - while(!$rs->EOF) { - $Cauth = new CORE_auth(true); - if($Cauth->auth_group_by_account_id($merge_acct_id, $rs->fields['group_id'])) { - # duplicate group, delete - $q = "DELETE FROM ".AGILE_DB_PREFIX."account_group WHERE id = {$rs->fields['id']} AND site_id = ".DEFAULT_SITE; - $db->Execute($q); - } - $rs->MoveNext(); - } - } - - # account_group - $q = "UPDATE ".AGILE_DB_PREFIX."account_group SET account_id = $acct_id WHERE account_id = $merge_acct_id AND site_id = ".DEFAULT_SITE; - $rs = $db->Execute($q); - if ($rs === false) $C_debug->error('account_admin.inc.php','merge :: account_group', $db->ErrorMsg()); - - # account_billing - $q = "UPDATE ".AGILE_DB_PREFIX."account_billing SET account_id = $acct_id WHERE account_id = $merge_acct_id AND site_id = ".DEFAULT_SITE; - $rs = $db->Execute($q); - if ($rs === false) $C_debug->error('account_admin.inc.php','merge :: account_billing', $db->ErrorMsg()); - - # cart - $q = "UPDATE ".AGILE_DB_PREFIX."cart SET account_id = $acct_id WHERE account_id = $merge_acct_id AND site_id = ".DEFAULT_SITE; - $rs = $db->Execute($q); - if ($rs === false) $C_debug->error('account_admin.inc.php','merge :: cart', $db->ErrorMsg()); - - # charge - $q = "UPDATE ".AGILE_DB_PREFIX."charge SET account_id = $acct_id WHERE account_id = $merge_acct_id AND site_id = ".DEFAULT_SITE; - $rs = $db->Execute($q); - if ($rs === false) $C_debug->error('account_admin.inc.php','merge :: charge', $db->ErrorMsg()); - - # discount - $q = "UPDATE ".AGILE_DB_PREFIX."discount SET avail_account_id = $acct_id WHERE avail_account_id = $merge_acct_id AND site_id = ".DEFAULT_SITE; - $rs = $db->Execute($q); - if ($rs === false) $C_debug->error('account_admin.inc.php','merge :: charge', $db->ErrorMsg()); - - # invoice - $q = "UPDATE ".AGILE_DB_PREFIX."invoice SET account_id = $acct_id WHERE account_id = $merge_acct_id AND site_id = ".DEFAULT_SITE; - $rs = $db->Execute($q); - if ($rs === false) $C_debug->error('account_admin.inc.php','merge :: invoice', $db->ErrorMsg()); - - # log_error - $q = "UPDATE ".AGILE_DB_PREFIX."log_error SET account_id = $acct_id WHERE account_id = $merge_acct_id AND site_id = ".DEFAULT_SITE; - $rs = $db->Execute($q); - if ($rs === false) $C_debug->error('account_admin.inc.php','merge :: log_error', $db->ErrorMsg()); - - # login_lock - $q = "DELETE FROM ".AGILE_DB_PREFIX."login_lock WHERE account_id = $merge_acct_id AND site_id = ".DEFAULT_SITE; - $rs = $db->Execute($q); - if ($rs === false) $C_debug->error('account_admin.inc.php','merge :: login_lock', $db->ErrorMsg()); - - # login_log - $q = "UPDATE ".AGILE_DB_PREFIX."login_log SET account_id = $acct_id WHERE account_id = $merge_acct_id AND site_id = ".DEFAULT_SITE; - $rs = $db->Execute($q); - if ($rs === false) $C_debug->error('account_admin.inc.php','merge :: login_log', $db->ErrorMsg()); - - # search - $q = "UPDATE ".AGILE_DB_PREFIX."search SET account_id = $acct_id WHERE account_id = $merge_acct_id AND site_id = ".DEFAULT_SITE; - $rs = $db->Execute($q); - if ($rs === false) $C_debug->error('account_admin.inc.php','merge :: search', $db->ErrorMsg()); - - # service - $q = "UPDATE ".AGILE_DB_PREFIX."service SET account_id = $acct_id WHERE account_id = $merge_acct_id AND site_id = ".DEFAULT_SITE; - $rs = $db->Execute($q); - if ($rs === false) $C_debug->error('account_admin.inc.php','merge :: service', $db->ErrorMsg()); - - # session - $q = "DELETE FROM ".AGILE_DB_PREFIX."session WHERE account_id = $merge_acct_id AND site_id = ".DEFAULT_SITE; - $rs = $db->Execute($q); - if ($rs === false) $C_debug->error('account_admin.inc.php','merge :: session', $db->ErrorMsg()); - - # staff - $q = "UPDATE ".AGILE_DB_PREFIX."staff SET account_id = $acct_id WHERE account_id = $merge_acct_id AND site_id = ".DEFAULT_SITE; - $rs = $db->Execute($q); - if ($rs === false) $C_debug->error('account_admin.inc.php','merge :: staff', $db->ErrorMsg()); - - # affiliate - if($C_list->is_installed('affiliate')) - { - $q = "UPDATE ".AGILE_DB_PREFIX."affiliate SET account_id = $acct_id WHERE account_id = $merge_acct_id AND site_id = ".DEFAULT_SITE; - $rs = $db->Execute($q); - if ($rs === false) $C_debug->error('account_admin.inc.php','merge :: affiliate', $db->ErrorMsg()); - } - - # ticket - if($C_list->is_installed('ticket')) - { - $q = "UPDATE ".AGILE_DB_PREFIX."ticket SET account_id = $acct_id WHERE account_id = $merge_acct_id AND site_id = ".DEFAULT_SITE; - $rs = $db->Execute($q); - if ($rs === false) $C_debug->error('account_admin.inc.php','merge :: ticket', $db->ErrorMsg()); - } - - # DB Mapping - if($C_list->is_installed('db_mapping')) - { - $dbsql = "SELECT username FROM ".AGILE_DB_PREFIX."account WHERE - site_id = ".$db->qstr(DEFAULT_SITE)." AND - id = ".$db->qstr($merge_acct_id); - $resultdb = $db->Execute($dbsql); - $old_username = $resultdb->fields['username']; - include_once ( PATH_MODULES . 'db_mapping/db_mapping.inc.php' ); - $db_map = new db_mapping; - $db_map->account_delete ( $merge_acct_id, $old_username ); - } - - # Delete account - $q = "DELETE FROM ".AGILE_DB_PREFIX."account WHERE id = $merge_acct_id AND site_id = ".DEFAULT_SITE; - $rs = $db->Execute($q); - if ($rs === false) $C_debug->error('account_admin.inc.php','merge :: account', $db->ErrorMsg()); - - $C_debug->alert($C_translate->translate('merge_ok','account_admin','')); - return; - - } - - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $db = &DB(); - global $C_auth, $C_list; - - # set the id - $id = $this->table . '_id'; - - # generate the list of ID's - $id_list = ''; - $account_id_list = ''; - $discount_id_list = ''; - $ii=0; - - if(isset($VAR["delete_id"])) - { - $id = explode(',',$VAR["delete_id"]); - } - elseif (isset($VAR["id"])) - { - $id = explode(',',$VAR["id"]); - } - - for($i=0; $iExecute($sql); - while (!$groups->EOF) - { - $group[] = $groups->fields['group_id']; - $groups->MoveNext(); - } - - ### Verify the user has access to view this account: - $delete_this = true; - if(!empty($group) && is_array($group)) { - for($ix=0; $ixauth_group_by_id($group[$ix])) - { - $delete_this = false; - $ix = count($group); - } - } - } - unset($group); - - ### Verify this is not the admin account or the current user's account: - if(SESS_ACCOUNT == $id[$i] || $id[$i] == '1') - $delete_this = false; - - ### Generate the SQL - if($delete_this) - { - if($i == 0) { - $id_list .= " id = " . $db->qstr($id[$i], get_magic_quotes_gpc()) . " "; - $account_id_list .= " account_id = " . $db->qstr($id[$i], get_magic_quotes_gpc()) . " "; - $discount_id_list .= " account_id = " . $db->qstr($id[$i], get_magic_quotes_gpc()) . " "; - $ii++; - } else { - $id_list .= " OR id = " . $db->qstr($id[$i], get_magic_quotes_gpc()) . " "; - $account_id_list .= " OR account_id = " . $db->qstr($id[$i], get_magic_quotes_gpc()) . " "; - $discount_id_list .= " OR account_id = " . $db->qstr($id[$i], get_magic_quotes_gpc()) . " "; - $ii++; - } - - #################################################################### - ### Do any db_mapping - #################################################################### - - $dbsql = "SELECT username FROM ".AGILE_DB_PREFIX."account WHERE - site_id = ".$db->qstr(DEFAULT_SITE)." AND - id = ".$db->qstr($id[$i]); - $resultdb = $db->Execute($dbsql); - $old_username = $resultdb->fields['username']; - - if($C_list->is_installed('db_mapping')) - { - include_once ( PATH_MODULES . 'db_mapping/db_mapping.inc.php' ); - $db_map = new db_mapping; - $db_map->account_delete ( $id[$i], $old_username ); - } - } - } - } - - $db = &DB(); - if($ii>0) - { - # generate the full query (account) - $q = "DELETE FROM ".AGILE_DB_PREFIX."account - WHERE $id_list AND site_id = ".$db->qstr(DEFAULT_SITE); - $result = $db->Execute($q); - - # generate the full query (sessions) - $q = "DELETE FROM ".AGILE_DB_PREFIX."session - WHERE $account_id_list AND site_id = ".$db->qstr(DEFAULT_SITE); - $db->Execute($q); - - # generate the full query (account_billing) - $q = "DELETE FROM ".AGILE_DB_PREFIX."account_billing - WHERE $account_id_list AND site_id = ".$db->qstr(DEFAULT_SITE); - $db->Execute($q); - - # generate the full query (account_group) - $q = "DELETE FROM ".AGILE_DB_PREFIX."account_group - WHERE $account_id_list AND site_id = ".$db->qstr(DEFAULT_SITE); - $db->Execute($q); - - # generate the full query (cart) - $q = "DELETE FROM ".AGILE_DB_PREFIX."cart - WHERE $account_id_list AND site_id = ".$db->qstr(DEFAULT_SITE); - $db->Execute($q); - - # generate the full query (search) - $q = "DELETE FROM ".AGILE_DB_PREFIX."search - WHERE $account_id_list AND site_id = ".$db->qstr(DEFAULT_SITE); - $db->Execute($q); - - # generate the full query (staff) - $q = "DELETE FROM ".AGILE_DB_PREFIX."staff - WHERE $account_id_list AND site_id = ".$db->qstr(DEFAULT_SITE); - $db->Execute($q); - - # generate the full query (ticket) - if($C_list->is_installed('ticket')) - { - $q = "SELECT id FROM ".AGILE_DB_PREFIX."ticket - WHERE $account_id_list AND site_id = ".$db->qstr(DEFAULT_SITE); - $ticket = $db->Execute($q); - if($ticket != false && $ticket->RecordCount() > 0) { - while( !$ticket->EOF ) { - include_once(PATH_MODULES.'ticket/ticket.inc.php'); - $tk = new ticket; - $arr['id'] = $ticket->fields['id']; - $tk->delete($arr, $tk); - $ticket->MoveNext(); - } - } - } - - # generate the full query (affiliate) - if($C_list->is_installed('affiliate')) - { - $q = "DELETE FROM ".AGILE_DB_PREFIX."affiliate - WHERE $account_id_list AND site_id = ".$db->qstr(DEFAULT_SITE); - $db->Execute($q); - } - - # generate the full query (discount) - $q = "DELETE FROM ".AGILE_DB_PREFIX."discount - WHERE $discount_id_list AND site_id = ".$db->qstr(DEFAULT_SITE); - $db->Execute($q); - - # generate the full query (invoice) - $q = "SELECT id FROM ".AGILE_DB_PREFIX."invoice - WHERE $account_id_list AND site_id = ".$db->qstr(DEFAULT_SITE); - $invoice = $db->Execute($q); - if($invoice != false && $invoice->RecordCount() > 0 ) { - while( !$invoice->EOF ) { - include_once(PATH_MODULES.'invoice/invoice.inc.php'); - $inv = new invoice; - $arr['id'] = $invoice->fields['id']; - $inv->delete($arr, $inv); - $invoice->MoveNext(); - } - } - - # error reporting - if ($result === false) - { - global $C_debug; - $C_debug->error('account_admin.inc.php','delete', $db->ErrorMsg()); - - } - else - { - # Alert delete message - global $C_debug, $C_translate; - $C_translate->value["CORE"]["module_name"] = $C_translate->translate('name','account_admin',""); - $message = $C_translate->translate('alert_delete_ids',"CORE",""); - $C_debug->alert($message); - } - } - } - - - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - - - - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - - $db = &DB(); - - include_once(PATH_CORE . 'validate.inc.php'); - $validate = new CORE_validate; - - # set the search criteria array - $arr = $VAR; - - # loop through the submitted field_names to get the WHERE statement - $where_list = ''; - $i=0; - while (list ($key, $value) = each ($arr)) - { - if($i == 0) - { - if($value != '') - { - $pat = "^" . $this->module . "_"; - if(eregi($pat, $key)) - { - $field = eregi_replace($pat,"",$key); - if(eregi('%',$value)) - { - # do any data conversion for this field (date, encrypt, etc...) - if(isset($this->field["$field"]["convert"])) - { - $value = $validate->convert($field, $value, $this->field["$field"]["convert"]); - } - - $where_list .= " WHERE ".AGILE_DB_PREFIX."account.".$field . " LIKE " . $db->qstr($value, get_magic_quotes_gpc()); - $i++; - } - else - { - # check if array - if(is_array($value)) - { - for($i_arr=0; $i_arr < count($value); $i_arr++) - { - if($value["$i_arr"] != '') - { - # determine any field options (=, >, <, etc...) - $f_opt = '='; - $pat_field = $this->module.'_'.$field; - $VAR['field_option']["$pat_field"]["$i_arr"]; - if(isset($VAR['field_option']["$pat_field"]["$i_arr"])) - { - $f_opt = $VAR['field_option']["$pat_field"]["$i_arr"]; - # error checking, safety precaution - if($f_opt != '=' && $f_opt != '>' && $f_opt != '<' && $f_opt != '>=' && $f_opt != '<=' && $f_opt != '!=') - $f_opt = '='; - } - - # do any data conversion for this field (date, encrypt, etc...) - if(isset($this->field["$field"]["convert"])) - { - $value["$i_arr"] = $validate->convert($field, $value["$i_arr"], $this->field["$field"]["convert"]); - } - - - if($i_arr == 0) - { - $where_list .= " WHERE ".AGILE_DB_PREFIX."account.".$field . " $f_opt " . $db->qstr($value["$i_arr"], get_magic_quotes_gpc()); - $i++; - } - else - { - $where_list .= " AND ".AGILE_DB_PREFIX."account.".$field . " $f_opt " . $db->qstr($value["$i_arr"], get_magic_quotes_gpc()); - $i++; - } - } - } - } - else - { - $where_list .= " WHERE ".AGILE_DB_PREFIX."account.".$field . " = " . $db->qstr($value, get_magic_quotes_gpc()); - $i++; - } - } - } - } - } - else - { - if($value != '') - { - $pat = "^" . $this->module . "_"; - if(eregi($pat, $key)) - { - $field = eregi_replace($pat,"",$key); - if(eregi('%',$value)) - { - # do any data conversion for this field (date, encrypt, etc...) - if(isset($this->field["$field"]["convert"])) - { - $value = $validate->convert($field, $value, $this->field["$field"]["convert"]); - } - - $where_list .= " AND ".AGILE_DB_PREFIX."account.".$field . " LIKE " . $db->qstr($value, get_magic_quotes_gpc()); - $i++; - } - else - { - # check if array - if(is_array($value)) - { - for($i_arr=0; $i_arr < count($value); $i_arr++) - { - if($value["$i_arr"] != '') - { - # determine any field options (=, >, <, etc...) - $f_opt = '='; - $pat_field = $this->module.'_'.$field; - if(isset($VAR['field_option']["$pat_field"]["$i_arr"])) - { - $f_opt = $VAR['field_option']["$pat_field"]["$i_arr"]; - - # error checking, safety precaution - if($f_opt != '=' && $f_opt != '>' && $f_opt != '<' && $f_opt != '>=' && $f_opt != '<=' && $f_opt != '!=') - $f_opt = '='; - } - - # do any data conversion for this field (date, encrypt, etc...) - if(isset($this->field["$field"]["convert"])) - { - $value["$i_arr"] = $validate->convert($field, $value["$i_arr"], $this->field["$field"]["convert"]); - } - - $where_list .= " AND ".AGILE_DB_PREFIX."account.". $field . " $f_opt " . $db->qstr($value["$i_arr"], get_magic_quotes_gpc()); - $i++; - } - } - } - else - { - $where_list .= " AND ".AGILE_DB_PREFIX."account.". $field . " = ". $db->qstr($value, get_magic_quotes_gpc()); - $i++; - } - } - } - } - } - } - - #### finalize the WHERE statement - if($where_list == '') - { - $where_list .= ' WHERE '; - } - else - { - $where_list .= ' AND '; - } - - - # get limit type - if(isset($VAR['limit'])) - { - $limit = $VAR['limit']; - } - else - { - $limit = $this->limit; - } - - # get order by - if(isset($VAR['order_by'])) - { - $order_by = $VAR['order_by']; - } - else - { - $order_by = $this->order_by; - } - - $pre = AGILE_DB_PREFIX; - - $q = "SELECT DISTINCT ".AGILE_DB_PREFIX."account.id,".AGILE_DB_PREFIX."account.last_name,".AGILE_DB_PREFIX."account.first_name,".AGILE_DB_PREFIX."account.username FROM ".AGILE_DB_PREFIX."account "; - $q_save = "SELECT DISTINCT %%fieldList%% FROM ".AGILE_DB_PREFIX."account "; - - # Code for group searches: - if(!empty($VAR['account_group'])) - $q .= " LEFT JOIN ".AGILE_DB_PREFIX."account_group ON ".AGILE_DB_PREFIX."account_group.account_id = ".AGILE_DB_PREFIX."account.id"; - - - ######## GET ANY STATIC VARS TO SEARCH ########## - $join_list = ''; - if(!empty($VAR["static_relation"]) && count( $VAR["static_relation"] > 0 )) { - while(list($idx, $value) = each ($VAR["static_relation"])) { - if($value != "") { - - $join_list .= " INNER JOIN {$pre}static_var_record AS s{$idx} ON - ( - s{$idx}.record_id = {$pre}{$this->table}.id - AND - s{$idx}.static_var_relation_id = '{$idx}' - AND - s{$idx}.site_id = ".$db->qstr(DEFAULT_SITE)." - AND"; - if(ereg("%", $value)) - $join_list .= " s{$idx}.value LIKE ".$db->qstr($VAR["static_relation"]["$idx"]); - else - $join_list .= " s{$idx}.value = ".$db->qstr($VAR["static_relation"]["$idx"]); - $join_list .= " ) "; - } - } - } - ######## END STATIC VAR SEARCH ################## - - - # standard where list - $q .= $join_list . $where_list ." ".AGILE_DB_PREFIX."account.site_id = " . $db->qstr(DEFAULT_SITE); - - # Code for member group: - if(!empty($VAR['account_group'])) { - $q .= " AND ".AGILE_DB_PREFIX."account_group.group_id = " . $db->qstr($VAR['account_group'])." - AND ".AGILE_DB_PREFIX."account_group.site_id = " . $db->qstr(DEFAULT_SITE); - } - if(!empty($VAR['account_group'])) - { - $q_save .= " LEFT JOIN ".AGILE_DB_PREFIX."account_group ON ".AGILE_DB_PREFIX."account_group.account_id = ".AGILE_DB_PREFIX."account.id "; - - if(!empty($join_list)) - $q_save .= $join_list; - - $q_save .= $where_list ." %%whereList%% "; - $q_save .= AGILE_DB_PREFIX."account_group.group_id = " . $db->qstr($VAR['account_group'])." AND "; - } - else - { - if(!empty($join_list)) - $q_save .= $join_list; - - $q_save .= $where_list ." %%whereList%% "; - } - - ################## DEBUG ################## - #echo "
    " . $q;
    -		#echo "

    " . $q_save; - #exit; - - # run the database query - $result = $db->Execute($q); - - # error reporting - if ($result === false) - { - global $C_debug; - $C_debug->error('database.inc.php','search', $db->ErrorMsg()); - return false; - } - - # get the result count: - $results = $result->RecordCount(); - - # get the first record id: - if($results == 1) $record_id = $result->fields['id']; - - # define the DB vars as a Smarty accessible block - global $smarty; - - # Create the definition for fast-forwarding to a single record: - if ($results == 1 && !isset($this->fast_forward)) - { - $smarty->assign('record_id', $record_id); - } - - # create the search record: - if($results > 0) - { - # create the search record - include_once(PATH_CORE . 'search.inc.php'); - $search = new CORE_search; - $arr['module'] = $this->module; - $arr['sql'] = $q_save; - $arr['limit'] = $limit; - $arr['order_by']= $order_by; - $arr['results'] = $results; - $search->add($arr); - - # define the search id and other parameters for Smarty - $smarty->assign('search_id', $search->id); - - # page: - $smarty->assign('page', '1'); - - # limit: - $smarty->assign('limit', $limit); - - # order_by: - $smarty->assign('order_by', $order_by); - } - - # define the result count - $smarty->assign('results', $results); - } - - - - - - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - - # set the field list for this method: - $arr = $this->method[$type]; - - $field_list = ''; - $i=0; - while (list ($key, $value) = each ($arr)) - { - if($i == 0) - { - $field_var = $this->table . '_' . $value; - $field_list .= AGILE_DB_PREFIX . "account" . "." . $value; - - // determine if this record is linked to another table/field - if($this->field[$value]["asso_table"] != "") - { - $this->linked[] = array('field' => $value, 'link_table' => $this->field[$value]["asso_table"], 'link_field' => $this->field[$value]["asso_field"]); - } - } - else - { - $field_var = $this->table . '_' . $value; - $field_list .= "," . AGILE_DB_PREFIX . "account" . "." . $value; - - // determine if this record is linked to another table/field - if($this->field[$value]["asso_table"] != "") - { - $this->linked[] = array('field' => $value, 'link_table' => $this->field[$value]["asso_table"], 'link_field' => $this->field[$value]["asso_field"]); - } - } - $i++; - } - - - # get the search details: - if(isset($VAR['search_id'])) { - include_once(PATH_CORE . 'search.inc.php'); - $search = new CORE_search; - $search->get($VAR['search_id']); - } else { - # invalid search! - echo '
    The search terms submitted were invalid!'; # translate... # alert - - if(isset($this->trigger["$type"])) { - include_once(PATH_CORE . 'trigger.inc.php'); - $trigger = new CORE_trigger; - $trigger->trigger($this->trigger["$type"], 0, $VAR); - } - } - - # get the sort order details: - if(isset($VAR['order_by']) && $VAR['order_by'] != "") { - $order_by = ' ORDER BY ' . AGILE_DB_PREFIX . 'account.'.$VAR['order_by']; - $smarty_order = $VAR['order_by']; - } else { - $order_by = ' ORDER BY ' . AGILE_DB_PREFIX . 'account.'.$this->order_by; - $smarty_order = $search->order_by; - } - - - # determine the sort order - if(isset($VAR['desc'])) { - $order_by .= ' DESC'; - $smarty_sort = 'desc='; - } else if(isset($VAR['asc'])) { - $order_by .= ' ASC'; - $smarty_sort = 'asc='; - } else { - if (!eregi('date',$smarty_order)) { - $order_by .= ' ASC'; - $smarty_sort = 'asc='; - } else { - $order_by .= ' DESC'; - $smarty_sort = 'desc='; - } - } - - # generate the full query - - $db = &DB(); - $q = eregi_replace("%%fieldList%%", $field_list, $search->sql); - $q = eregi_replace("%%tableList%%", AGILE_DB_PREFIX.$construct->table, $q); - $q = eregi_replace("%%whereList%%", "", $q); - $q .= " ".AGILE_DB_PREFIX . "account."."site_id = " . $db->qstr(DEFAULT_SITE); - $q .= $order_by; - - ////////////////// - #echo "
     $q 

    "; - $current_page=1; - $offset=-1; - if (!empty($VAR['page'])) $current_page = $VAR['page']; - if (empty($search->limit)) $search->limit=25; - if($current_page>1) $offset = (($current_page * $search->limit) - $search->limit); - $result = $db->SelectLimit($q, $search->limit, $offset); - - - # error reporting - if ($result === false) - { - global $C_debug; - $C_debug->error('database.inc.php','search', $db->ErrorMsg()); - - if(isset($this->trigger["$type"])) - { - include_once(PATH_CORE . 'trigger.inc.php'); - $trigger = new CORE_trigger; - $trigger->trigger($this->trigger["$type"], 0, $VAR); - } - return; - } - - - # put the results into a smarty accessable array - $i=0; - $class_name = TRUE; - while (!$result->EOF) { - $smart[$i] = $result->fields; - - if($class_name) - { - $smart[$i]['_C'] = 'row1'; - $class_name = FALSE; - } else { - $smart[$i]['_C'] = 'row2'; - $class_name = TRUE; - } - $result->MoveNext(); - $i++; - } - - - # get any linked fields - if($i > 0) - { - $db_join = new CORE_database; - $this->result = $db_join->join_fields($smart, $this->linked); - } - else - { - $this->result = $smart; - } - - # get the result count: - $results = $result->RecordCount(); - - # define the DB vars as a Smarty accessible block - global $smarty; - - # define the results - $smarty->assign($this->table, $this->result); - $smarty->assign('page', $VAR['page']); - $smarty->assign('order', $smarty_order); - $smarty->assign('sort', $smarty_sort); - $smarty->assign('limit', $search->limit); - $smarty->assign('search_id',$search->id); - $smarty->assign('results', $search->results); - - # get the total pages for this search: - if(empty($search->limit)) - $this->pages = 1; - else - $this->pages = intval($search->results / $search->limit); - if ($search->results % $search->limit) $this->pages++; - - # total pages - $smarty->assign('pages', $this->pages); - - # current page - $smarty->assign('page', $current_page); - $page_arr = ''; - for($i=0; $i <= $this->pages; $i++) - { - if ($this->page != $i) $page_arr[] = $i; - } - - # page array for menu - $smarty->assign('page_arr', $page_arr); - } - - - - ############################## - ## SEARCH EXPORT ## - ############################## - function search_export($VAR) - { - if(!$this->checkLimits()) return false; // check account limits - - # require the export class - require_once (PATH_CORE . "export.inc.php"); - - # Call the correct export function for inline browser display, download, email, or web save. - if($VAR["format"] == "excel") - { - $type = "export_excel"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $export = new CORE_export; - $export->search_excel($VAR, $this, $type); - } - - else if ($VAR["format"] == "pdf") - { - $type = "export_pdf"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $export = new CORE_export; - $export->search_pdf($VAR, $this, $type); - } - - else if ($VAR["format"] == "xml") - { - $type = "export_xml"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $export = new CORE_export; - $export->search_xml($VAR, $this, $type); - } - - else if ($VAR["format"] == "csv") - { - $type = "export_csv"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $export = new CORE_export; - $export->search_csv($VAR, $this, $type); - } - - else if ($VAR["format"] == "tab") - { - $type = "export_tab"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $export = new CORE_export; - $export->search_tab($VAR, $this, $type); - } - } - - - - - ############################## - ## ADD GROUPS ## - ############################## - - function add_account_groups($groups, $account, $expire) - { - global $C_auth; - $ii = 0; - - #loop through the array to add each account_group record - for($i=0; $iauth_group_by_id($groups[$i])) - { - - # add the account to the selected groups... - $dba = &DB(); - - # determine the record id: - $this->new_id = $dba->GenID(AGILE_DB_PREFIX . "" . 'account_group_id'); - - # generate the full query - $q = "INSERT INTO ".AGILE_DB_PREFIX."account_group - SET - id = ". $dba->qstr($this->new_id).", - date_orig = ". $dba->qstr(time()).", - date_expire = ". $dba->qstr($expire).", - group_id = ". $dba->qstr($groups[$i]).", - account_id = ". $dba->qstr($account).", - active = ". $dba->qstr('1').", - site_id = ". $dba->qstr(DEFAULT_SITE); - - # execute the query - $result = $dba->Execute($q); - $ii++; - - # error reporting: - if ($result === false) { - global $C_debug; - $C_debug->error('account_admin.inc.php','add_account_groups', $dba->ErrorMsg()); - } - } - } - - ### Add default group - if($ii == 0) - { - # add the account to the selected groups... - $dba = &DB(); - - # determine the record id: - $this->new_id = $dba->GenID(AGILE_DB_PREFIX . "" . 'account_group_id'); - - # generate the full query - $q = "INSERT INTO ".AGILE_DB_PREFIX."account_group - SET - id = ". $dba->qstr($this->new_id).", - date_orig = ". $dba->qstr(time()).", - date_expire = ". $dba->qstr($expire).", - group_id = ". $dba->qstr(DEFAULT_GROUP).", - account_id = ". $dba->qstr($account).", - active = ". $dba->qstr('1').", - site_id = ". $dba->qstr(DEFAULT_SITE); - - # execute the query - $result = $dba->Execute($q); - if ($result === false) { - global $C_debug; - $C_debug->error('account_admin.inc.php','add_account_groups', $dba->ErrorMsg()); - } - } - } - - - - - ############################## - ## UDPATE GROUPS ## - ############################## - - function update_account_groups($VAR) - { - global $C_auth; - $ii = 0; - @$groups = $VAR['groups']; - @$account = $VAR['account_admin_id']; - - # admin accounts groups cannot be altered - # user cannot modify their own groups - if($account == "1" || SESS_ACCOUNT == $account) - return false; - - ### Drop the current groups for this account: - # generate the full query - $dba = &DB(); - $q = "DELETE FROM ".AGILE_DB_PREFIX."account_group - WHERE - service_id IS NULL AND - account_id = ". $dba->qstr($account)." AND - site_id = ". $dba->qstr(DEFAULT_SITE); - # execute the query - $result = $dba->Execute($q); - - #loop through the array to add each account_group record - for($i=0; $iauth_group_by_id($groups[$i])) - { - # add the account to the selected groups... - $dba = &DB(); - - # determine the record id: - $this->new_id = $dba->GenID(AGILE_DB_PREFIX . "" . 'account_group_id'); - - # determine the expiration - if(!empty($VAR['account_admin_date_expire'])) - { - include_once(PATH_CORE.'validate.inc.php'); - $validate = new CORE_validate; - $expire = $validate->DateToEpoch(DEFAULT_DATE_FORMAT,$VAR['account_admin_date_expire']); - } else { - $expire = 0; - } - - # generate the full query - $q = "INSERT INTO ".AGILE_DB_PREFIX."account_group - SET - id = ". $dba->qstr($this->new_id).", - date_orig = ". $dba->qstr(time()).", - date_expire = ". $dba->qstr($expire).", - group_id = ". $dba->qstr($groups[$i]).", - account_id = ". $dba->qstr($account).", - active = ". $dba->qstr('1').", - site_id = ". $dba->qstr(DEFAULT_SITE); - - # execute the query - $result = $dba->Execute($q); - $ii++; - - # error reporting: - if ($result === false) { - global $C_debug; - $C_debug->error('account_admin.inc.php','update_account_groups', $dba->ErrorMsg()); - } - } - } - - ### Add default group - if($ii == 0) - { - # add the account to the selected groups... - $dba = &DB(); - - # determine the record id: - $this->new_id = $dba->GenID(AGILE_DB_PREFIX . "" . 'account_group_id'); - - # generate the full query - $q = "INSERT INTO ".AGILE_DB_PREFIX."account_group - SET - id = ". $dba->qstr($this->new_id).", - date_orig = ". $dba->qstr(time()).", - date_expire = ". $dba->qstr(@$expire).", - group_id = ". $dba->qstr(DEFAULT_GROUP).", - account_id = ". $dba->qstr($account).", - active = ". $dba->qstr('1').", - site_id = ". $dba->qstr(DEFAULT_SITE); - $result = $dba->Execute($q); - if ($result === false) { - global $C_debug; - $C_debug->error('account_admin.inc.php','update_account_groups', $dba->ErrorMsg()); - } - } - - ### Remove the user's session_auth_cache so it is regenerated on user's next pageview - $db = &DB(); - $q = "SELECT id FROM ".AGILE_DB_PREFIX."session WHERE - account_id = ".$db->qstr($account)." AND - site_id = ".$db->qstr(DEFAULT_SITE); - $rss = $db->Execute($q); - while(!$rss->EOF) - { - $q = "DELETE FROM ".AGILE_DB_PREFIX."session_auth_cache WHERE - session_id = ".$db->qstr($rss->fields['id'])." AND - site_id = ".$db->qstr(DEFAULT_SITE); - $db->Execute($q); - $rss->MoveNext(); - } - - ### Do any db_mapping - global $C_list; - if($C_list->is_installed('db_mapping')) - { - include_once ( PATH_MODULES . 'db_mapping/db_mapping.inc.php' ); - $db_map = new db_mapping; - $db_map->account_group_sync ( $account ); - } - } -} -?> \ No newline at end of file diff --git a/modules/account_admin/account_admin_construct.xml b/modules/account_admin/account_admin_construct.xml deleted file mode 100644 index 5f24d706..00000000 --- a/modules/account_admin/account_admin_construct.xml +++ /dev/null @@ -1,180 +0,0 @@ - - - - account_admin - - account
    - - account - - 0 - - last_name - - 30 - - - - I8 - 1 - - - I4 - - - I8 - date-time - - - I8 - date-now - - - I8 - date - - - I4 - - - C(32) - - - I4 - - - I4 - - - I4 - - - I4 - - - I4 - - - C(32) - - - C(128) - 4 - 128 - any - 1 - - - C(128) - 4 - 128 - password - md5 - - - L - - - C2(128) - - - I4 - 0 - - - C(128) - 1 - 128 - any - - - C(128) - - - C(128) - 1 - 128 - any - - - <type>C(128)</type> - - - C(255) - 4 - 128 - email - 1 - - - C(255) - - - C(128) - 3 - 128 - any - - - C(128) - 128 - - - C(32) - 2 - 32 - any - - - C(32) - 2 - 32 - any - - - C(16) - 4 - 16 - any - - - L - - - I4 - - - L - 1 - - - I4 - - - I4 - - - C(64) - - - I4 - - - - id - id,date_orig,date_last,date_expire,parent_id,language_id,country_id,affiliate_id,campaign_id,reseller_id,currency_id,theme_id,username,password,inherit_group,misc,status,first_name,middle_name,last_name,title,email,email_type,company,address1,address2,city,state,zip,invoice_delivery,invoice_show_itemized,invoice_grace,invoice_advance_gen,tax_id,max_child - id,date_orig,date_last,date_expire,parent_id,language_id,country_id,affiliate_id,campaign_id,reseller_id,currency_id,theme_id,username,password,inherit_group,misc,status,first_name,middle_name,last_name,title,email,email_type,company,address1,address2,city,state,zip,invoice_delivery,invoice_show_itemized,invoice_grace,invoice_advance_gen,tax_id,max_child - id,date_orig,date_last,date_expire,parent_id,language_id,country_id,affiliate_id,campaign_id,reseller_id,currency_id,theme_id,username,password,inherit_group,misc,status,first_name,middle_name,last_name,title,email,email_type,company,address1,address2,city,state,zip,invoice_delivery,invoice_show_itemized,invoice_grace,invoice_advance_gen,tax_id,max_child - id,date_orig,date_last,date_expire,parent_id,language_id,country_id,affiliate_id,campaign_id,reseller_id,currency_id,theme_id,username,password,misc,status,first_name,middle_name,last_name,title,email,email_type,company,address1,address2,city,state,zip,invoice_delivery,invoice_show_itemized,invoice_grace,invoice_advance_gen,tax_id,max_child - id,date_orig,date_last,date_expire,parent_id,language_id,country_id,affiliate_id,campaign_id,reseller_id,currency_id,theme_id,username,password,inherit_group,misc,status,first_name,middle_name,last_name,title,email,email_type,company,address1,address2,city,state,zip,tax_id,max_child - language_id,country_id,affiliate_id,campaign_id,currency_id,username,password,misc,status,first_name,middle_name,last_name,title,email,company,address1,address2,city,state,zip,tax_id - language_id,country_id,affiliate_id,campaign_id,currency_id,username,password,misc,status,first_name,middle_name,last_name,title,email,company,address1,address2,city,state,zip,tax_id - language_id,country_id,affiliate_id,campaign_id,currency_id,username,password,misc,status,first_name,middle_name,last_name,title,email,company,address1,address2,city,state,zip,tax_id - language_id,country_id,affiliate_id,campaign_id,currency_id,username,password,misc,status,first_name,middle_name,last_name,title,email,company,address1,address2,city,state,zip,tax_id - - - - account_admin:update_account_groups - - -
    diff --git a/modules/account_admin/account_admin_install.xml b/modules/account_admin/account_admin_install.xml deleted file mode 100644 index 1db56c72..00000000 --- a/modules/account_admin/account_admin_install.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - account_admin - account_admin - - 1 - - - - - add - 1 - - - update - - - delete - - - view - - 1 - - - search - - 1 - - - search_form - - - search_show - - - search_export - - - update_account_groups - - - - send_verify_email - - - - send_password_email - - - - mail_multi - - - mail_one - - - autoselect - - - login - - - - merge - - - - group_search - - - product_search - - - - - \ No newline at end of file diff --git a/modules/account_group/account_group_construct.xml b/modules/account_group/account_group_construct.xml index e01fc7e9..40732652 100644 --- a/modules/account_group/account_group_construct.xml +++ b/modules/account_group/account_group_construct.xml @@ -1,55 +1,59 @@ - - - account_group - account_group
    - account - 0 - - 25 - - date_start,date_expire - active,account_id,group_id - service_id - - - - I8 - - - I4 - 1 - - - I8 - - - I8 - - - I8 - - - I4 - 1 - - - I8 - 1 - - - I8 - - - L - - - - id,site_id,module_id,name,notes,page,menu_display - id,site_id,module_id,name,notes,page,menu_display - id,site_id,module_id,name,notes,page,menu_display - id,site_id,module_id,name,notes,page,menu_display - id,site_id,module_id,name,notes,page,menu_display - id,site_id,module_id,name,notes,page,menu_display - - 0 + + + account_group + account_group
    + account + 0 + + 25 + + + date_start,date_expire + active,account_id,group_id + service_id + + + + + I8 + + + I4 + 1 + + + I8 + + + I8 + + + I8 + + + I4 + 1 + + + I8 + 1 + + + I8 + + + L + + + + + id,site_id,module_id,name,notes,page,menu_display + id,site_id,module_id,name,notes,page,menu_display + id,site_id,module_id,name,notes,page,menu_display + id,site_id,module_id,name,notes,page,menu_display + id,site_id,module_id,name,notes,page,menu_display + id,site_id,module_id,name,notes,page,menu_display + + + 0
    diff --git a/modules/account_group/account_group_install.xml b/modules/account_group/account_group_install.xml index e73f15d3..e2a19825 100644 --- a/modules/account_group/account_group_install.xml +++ b/modules/account_group/account_group_install.xml @@ -1,11 +1,13 @@ account_group - account_admin + account + base + - \ No newline at end of file + diff --git a/modules/account_group/account_group_install_data.xml b/modules/account_group/account_group_install_data.xml index 05798359..1406e20a 100644 --- a/modules/account_group/account_group_install_data.xml +++ b/modules/account_group/account_group_install_data.xml @@ -1,44 +1,45 @@ - - 0 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 1 - - - 210 - 1 - 1099624291 - 0 - 2 - 1 - 1 - - - 211 - 1 - 1099624291 - 0 - 1001 - 1 - 1 - - - 212 - 1 - 1099624291 - 0 - 4 - 1 - 1 - - - 502 - - \ No newline at end of file + + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + + + 210 + 1 + 1099624291 + 0 + 2 + 1 + 1 + + + 211 + 1 + 1099624291 + 0 + 1001 + 1 + 1 + + + 212 + 1 + 1099624291 + 0 + 4 + 1 + 1 + + + + 502 + + diff --git a/modules/account_memo/account_memo.inc.php b/modules/account_memo/account_memo.inc.php index 6e3a69e0..00005476 100644 --- a/modules/account_memo/account_memo.inc.php +++ b/modules/account_memo/account_memo.inc.php @@ -1,125 +1,33 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Module:Account */ -class account_memo -{ - - # Open the constructor for this mod - function account_memo() - { - # name of this module: - $this->module = "account_memo"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } +/** + * The main AgileBill Account Memo Class + * + * @package AgileBill + * @subpackage Module:Account + */ +class account_memo extends OSB_module { } ?> diff --git a/modules/account_memo/account_memo_construct.xml b/modules/account_memo/account_memo_construct.xml index eebd7367..9819bd6f 100644 --- a/modules/account_memo/account_memo_construct.xml +++ b/modules/account_memo/account_memo_construct.xml @@ -1,63 +1,100 @@ - - account_memo - - account_memo
    - - account - - 0 - - date_orig - - 25 - - - account_id - memo - - - - - I8 - - - I4 - - - I8 - date-time - date-now - - - I8 - account - username - - - I8 - - - C(32) - any - - - C(255) - any - - - C(32) - - - - - id,site_id,date_orig,staff_id,account_id,type,memo - id,site_id,date_orig,staff_id,account_id,type,memo - id,site_id,date_orig,staff_id,account_id,type,memo - id,site_id,date_orig,staff_id,account_id,type,memo - id,site_id,date_orig,staff_id,account_id,type,memo - - - 0 + + account_memo + + account_memo
    + + account + + 0 + + date_orig + + 25 + + + + account_id + memo + + + + + <add>Add Account Memo</add> + <view>Account Memo</view> + + + + + + I8 + + + I4 + + + Date + I8 + date-time + date-now + + + Staff + I8 + account + username + + + Account + I8 + + + Type + C(32) + any + + + Memo + C(255) + any + + + C(32) + + + + + + date_orig,staff_id,account_id,type,memo + id,site_id,date_orig,staff_id,account_id,type,memo + id,site_id,date_orig,staff_id,account_id,type,memo + id,site_id,date_orig,staff_id,account_id,type,memo + id,site_id,date_orig,staff_id,account_id,type,memo + + + + 0 + + + + + + id + 25px + + + date_orig + + + staff_id + + + type + + + memo + + +
    diff --git a/modules/account_memo/account_memo_install.xml b/modules/account_memo/account_memo_install.xml index c8469597..3cc0ab1e 100644 --- a/modules/account_memo/account_memo_install.xml +++ b/modules/account_memo/account_memo_install.xml @@ -1,10 +1,11 @@ account_memo - account_admin - - invoice + account + + account + @@ -23,10 +24,10 @@ search - search_form + search_form - search_show + search_show diff --git a/modules/affiliate/affiliate.inc.php b/modules/affiliate/affiliate.inc.php index efda6f52..bcb17b4b 100644 --- a/modules/affiliate/affiliate.inc.php +++ b/modules/affiliate/affiliate.inc.php @@ -18,37 +18,8 @@ * @version 1.4.93 */ -class affiliate -{ - # Open the constructor for this mod - function affiliate() - { - # name of affiliate id prefix - $this->id_prefix = 'AB-'; - - # name of this module: - $this->module = "affiliate"; - - if(!defined('AJAX')) - { - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - } - +class affiliate extends OSB_module { + private $id_prefix = 'AB-'; ########################################### ### AJAX Auto-selector @@ -858,8 +829,7 @@ class affiliate ############################## ## VIEW ## ############################## - function view($VAR) - { + function view($VAR) { $type = "view"; $this->method["$type"] = explode(",", $this->method["$type"]); @@ -1007,11 +977,8 @@ class affiliate return; } - - - global $smarty; - $smarty->assign($this->table, $smart); + $smarty->assign('record', array_pop($smart)); $smarty->assign('plugin_data', $plugin_data); $smarty->assign('results', $search->results); } @@ -1239,23 +1206,10 @@ class affiliate } } - - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - ############################## ## SEARCH ## ############################## - function search($VAR) + function xsearch($VAR) { $type = "search"; $this->method["$type"] = explode(",", $this->method["$type"]); @@ -1549,7 +1503,7 @@ class affiliate ## SEARCH SHOW ## ############################## - function search_show($VAR) + function xsearch_show($VAR) { $type = "search"; $this->method["$type"] = explode(",", $this->method["$type"]); @@ -1803,4 +1757,4 @@ class affiliate } } } -?> \ No newline at end of file +?> diff --git a/modules/affiliate/affiliate_construct.xml b/modules/affiliate/affiliate_construct.xml index fb34ce00..34a60242 100644 --- a/modules/affiliate/affiliate_construct.xml +++ b/modules/affiliate/affiliate_construct.xml @@ -1,104 +1,155 @@ - - affiliate - - affiliate
    - - - - 0 - - id - - 25 - - - account_id - parent_affiliate_id - - - - - C(32) - 1 - 1 - - - I4 - 1 - - - I8 - date-time - - - I8 - any - date-now - - - L - - - I8 - any - - - X2 - array - - - C(32) - - - C(16) - affiliate - id - - - I4 - - - F - - - L - - - X2 - array - - - L - - - X2 - array - - - I4 - - - X2 - array - - - - - id,site_id,date_orig,date_last,status,account_id,avail_campaign_id,affiliate_plugin,parent_affiliate_id,max_tiers,commission_minimum,new_commission_type,new_commission_rate,recurr_commission_type,recurr_commission_rate,recurr_max_commission_periods,plugin_data - id,site_id,date_orig,date_last,status,account_id,avail_campaign_id,affiliate_plugin,parent_affiliate_id,max_tiers,commission_minimum,new_commission_type,new_commission_rate,recurr_commission_type,recurr_commission_rate,recurr_max_commission_periods,plugin_data - id,site_id,date_orig,date_last,status,account_id,avail_campaign_id,affiliate_plugin,parent_affiliate_id,max_tiers,commission_minimum,new_commission_type,new_commission_rate,recurr_commission_type,recurr_commission_rate,recurr_max_commission_periods,plugin_data - id,site_id,date_orig,date_last,status,account_id,avail_campaign_id,affiliate_plugin,parent_affiliate_id,max_tiers,commission_minimum,new_commission_type,new_commission_rate,recurr_commission_type,recurr_commission_rate,recurr_max_commission_periods,plugin_data - id,site_id,date_orig,date_last,status,account_id,avail_campaign_id,affiliate_plugin,parent_affiliate_id,max_tiers,commission_minimum,new_commission_type,new_commission_rate,recurr_commission_type,recurr_commission_rate,recurr_max_commission_periods,plugin_data - date_last,affiliate_plugin,plugin_data - id,site_id,date_orig,date_last,status,account_id,avail_campaign_id,affiliate_plugin,parent_affiliate_id,max_tiers,commission_minimum,new_commission_type,new_commission_rate,recurr_commission_type,recurr_commission_rate,recurr_max_commission_periods - id,date_orig,date_last,status,account_id,avail_campaign_id,affiliate_plugin,parent_affiliate_id,max_tiers,commission_minimum,new_commission_type,new_commission_rate,recurr_commission_type,recurr_commission_rate,recurr_max_commission_periods - id,date_orig,date_last,status,account_id,affiliate_plugin,parent_affiliate_id,max_tiers,commission_minimum,new_commission_type,recurr_commission_type,recurr_max_commission_periods - id,date_orig,date_last,status,account_id,affiliate_plugin,parent_affiliate_id,max_tiers,commission_minimum,new_commission_type,recurr_commission_type,recurr_max_commission_periods - id,date_orig,date_last,status,account_id,affiliate_plugin,parent_affiliate_id,max_tiers,commission_minimum,new_commission_type,recurr_commission_type,recurr_max_commission_periods - id,date_orig,date_last,status,account_id,affiliate_plugin,parent_affiliate_id,max_tiers,commission_minimum,new_commission_type,recurr_commission_type,recurr_max_commission_periods - - - 0 + + affiliate + + affiliate
    + + + + 0 + + id + + 25 + + 0 + + + + account_id + parent_affiliate_id + + + + + + + 1 + C(32) + 1 + + + + 1 + I4 + + + + date-now + Date Created + I8 + + + + date-now + Date Updated + I8 + + + + Active + L + + + I8 + any + + + X2 + array + + + C(32) + + + C(16) + affiliate + id + + + I4 + + + F + + + L + + + X2 + array + + + L + + + X2 + array + + + I4 + + + X2 + array + + + + + + id,site_id,date_orig,date_last,status,account_id,avail_campaign_id,affiliate_plugin,parent_affiliate_id,max_tiers,commission_minimum,new_commission_type,new_commission_rate,recurr_commission_type,recurr_commission_rate,recurr_max_commission_periods,plugin_data + id,site_id,date_orig,date_last,status,account_id,avail_campaign_id,affiliate_plugin,parent_affiliate_id,max_tiers,commission_minimum,new_commission_type,new_commission_rate,recurr_commission_type,recurr_commission_rate,recurr_max_commission_periods,plugin_data + id,site_id,date_orig,date_last,status,account_id,avail_campaign_id,affiliate_plugin,parent_affiliate_id,max_tiers,commission_minimum,new_commission_type,new_commission_rate,recurr_commission_type,recurr_commission_rate,recurr_max_commission_periods,plugin_data + id,site_id,date_orig,date_last,status,account_id,avail_campaign_id,affiliate_plugin,parent_affiliate_id,max_tiers,commission_minimum,new_commission_type,new_commission_rate,recurr_commission_type,recurr_commission_rate,recurr_max_commission_periods,plugin_data + id,site_id,date_orig,date_last,status,account_id,avail_campaign_id,affiliate_plugin,parent_affiliate_id,max_tiers,commission_minimum,new_commission_type,new_commission_rate,recurr_commission_type,recurr_commission_rate,recurr_max_commission_periods,plugin_data + date_last,affiliate_plugin,plugin_data + id,site_id,date_orig,date_last,status,account_id,avail_campaign_id,affiliate_plugin,parent_affiliate_id,max_tiers,commission_minimum,new_commission_type,new_commission_rate,recurr_commission_type,recurr_commission_rate,recurr_max_commission_periods + id,date_orig,date_last,status,account_id,avail_campaign_id,affiliate_plugin,parent_affiliate_id,max_tiers,commission_minimum,new_commission_type,new_commission_rate,recurr_commission_type,recurr_commission_rate,recurr_max_commission_periods + id,date_orig,date_last,status,account_id,affiliate_plugin,parent_affiliate_id,max_tiers,commission_minimum,new_commission_type,recurr_commission_type,recurr_max_commission_periods + id,date_orig,date_last,status,account_id,affiliate_plugin,parent_affiliate_id,max_tiers,commission_minimum,new_commission_type,recurr_commission_type,recurr_max_commission_periods + id,date_orig,date_last,status,account_id,affiliate_plugin,parent_affiliate_id,max_tiers,commission_minimum,new_commission_type,recurr_commission_type,recurr_max_commission_periods + id,date_orig,date_last,status,account_id,affiliate_plugin,parent_affiliate_id,max_tiers,commission_minimum,new_commission_type,recurr_commission_type,recurr_max_commission_periods + + + + + + + + <new_tier_iframe>Commissions New Charges</new_tier_iframe> + <recurr_tier_iframe>Commissions Recurring Charges</recurr_tier_iframe> + + + + + + + id + checkbox + 25px + + + id + + + sessions + + + accounts + + + invoices + + + commissions + + + status + 20px + + + + +
    diff --git a/modules/affiliate/affiliate_install.xml b/modules/affiliate/affiliate_install.xml index d14e80b6..8908dc41 100644 --- a/modules/affiliate/affiliate_install.xml +++ b/modules/affiliate/affiliate_install.xml @@ -1,49 +1,68 @@ + + - affiliate - affiliate - + + + + Affiliates + 1 + + affiliate + + + + account + affiliate_commission,affiliate_template,campaign + + - - - - search_form - - - search_show - - - search - - 1 - - - view - - 1 - - - delete - - - update - - - add - - 1 - - - search_export - - - mail_multi - - - autoselect - - - - \ No newline at end of file + + + + + Add + 1 + add + + + + delete + + + + List + 1 + search + + + + + search_form + + + + search_show + + + + update + + + + view + + + + search_export + + + mail_multi + + + autoselect + + +
    diff --git a/modules/affiliate_commission/affiliate_commission.inc.php b/modules/affiliate_commission/affiliate_commission.inc.php index c81bf458..b3f2ed5c 100644 --- a/modules/affiliate_commission/affiliate_commission.inc.php +++ b/modules/affiliate_commission/affiliate_commission.inc.php @@ -1,50 +1,34 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Module:AffiliateCommission */ -class affiliate_commission -{ - # Open the constructor for this mod - function affiliate_commission() - { - # name of this module: - $this->module = "affiliate_commission"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - - +/** + * The main AgileBill Affilicate Commissions Class + * + * @package AgileBill + * @subpackage Module:AffiliateCommission + */ +class affiliate_commission extends OSB_module { ############################## ## ADD ## ############################## @@ -446,17 +430,6 @@ class affiliate_commission } - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - ############################## ## DELETE ## ############################## @@ -494,38 +467,5 @@ class affiliate_commission $result = $db->Execute($sql); } } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } } -?> \ No newline at end of file +?> diff --git a/modules/affiliate_commission/affiliate_commission_construct.xml b/modules/affiliate_commission/affiliate_commission_construct.xml index d4ce2b57..13064f7f 100644 --- a/modules/affiliate_commission/affiliate_commission_construct.xml +++ b/modules/affiliate_commission/affiliate_commission_construct.xml @@ -1,66 +1,113 @@ - - affiliate_commission - - affiliate_commission
    - - affiliate - - 0 - - date_orig - - 25 - - - date_begin - date_end - - - - - I4 - 1 - 1 - - - I4 - 1 - - - I8 - date-now - - - I8 - date - - - I8 - date - - - F - - - X2 - - - X2 - - - L - - - - - id,site_id,date_orig,date_begin,date_end,commissions,notes_admin,notes_affiliate,status - id,site_id,date_orig,date_begin,date_end,commissions,notes_admin,notes_affiliate,status - id,site_id - id,site_id,date_orig,date_begin,date_end,commissions,notes_admin,notes_affiliate,status - id,site_id,date_orig,date_begin,date_end,commissions,notes_admin,notes_affiliate,status - - - 0 + + affiliate_commission + + affiliate_commission
    + + affiliate + + 0 + + date_orig + + 25 + + 0 + + + + date_begin + date_end + + + + + + + 1 + I4 + 1 + + + + 1 + I4 + + + + date-now + Date Created + I8 + + + + Active + L + + + date + I8 + + + I8 + date + + + F + + + X2 + + + X2 + + + + + + id,site_id,date_orig,date_begin,date_end,commissions,notes_admin,notes_affiliate,status + id,site_id,date_orig,date_begin,date_end,commissions,notes_admin,notes_affiliate,status + id,site_id + id,site_id,date_orig,date_begin,date_end,commissions,notes_admin,notes_affiliate,status + id,site_id,date_orig,date_begin,date_end,commissions,notes_admin,notes_affiliate,status + + + + + + + + + + + + + + id + checkbox + 25px + + + date_orig + date + + + date_begin + date + + + date_end + date + + + commissions + + + status + bool_icon + 20px + + +
    diff --git a/modules/affiliate_commission/affiliate_commission_install.xml b/modules/affiliate_commission/affiliate_commission_install.xml index 6cd1e34a..ca36588d 100644 --- a/modules/affiliate_commission/affiliate_commission_install.xml +++ b/modules/affiliate_commission/affiliate_commission_install.xml @@ -1,41 +1,62 @@ + + - affiliate_commission - affiliate - - 1 + affiliate + + Affiliate Commissions + + 1 + + affiliate_commission + + + + affiliate + + + + - - - - add - - 1 - - - update - - - delete - - - view - - - search - - 1 - - - search_form - - - search_show - - - export - - - - \ No newline at end of file + + + + + Add + 1 + add + + + + delete + + + + List + 1 + search + + + + + search_form + + + + search_show + + + + update + + + + view + + + + export + + + diff --git a/modules/affiliate_template/affiliate_template.inc.php b/modules/affiliate_template/affiliate_template.inc.php index 5b25baef..a5369346 100644 --- a/modules/affiliate_template/affiliate_template.inc.php +++ b/modules/affiliate_template/affiliate_template.inc.php @@ -1,125 +1,33 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Module:AffiliateTemplate */ -class affiliate_template -{ - - # Open the constructor for this mod - function affiliate_template() - { - # name of this module: - $this->module = "affiliate_template"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } +/** + * The main AgileBill Module:Affiliate Template Class + * + * @package AgileBill + * @subpackage Module:AffiliateTemplate + */ +class affiliate_template extends OSB_module { } ?> diff --git a/modules/affiliate_template/affiliate_template_construct.xml b/modules/affiliate_template/affiliate_template_construct.xml index 34a90956..bb6198e3 100644 --- a/modules/affiliate_template/affiliate_template_construct.xml +++ b/modules/affiliate_template/affiliate_template_construct.xml @@ -1,85 +1,127 @@ - - affiliate_template - - affiliate_template
    - - affiliate - - 0 - - name - - 25 - - - - I4 - 1 - 1 - - - I4 - 1 - - - C(32) - - - X2 - array - - - L - - - C(32) - 2 - 32 - any - - - X2 - - - I4 - 1 - 2 - numeric - - - F - 1 - 12 - float - - - L - - - X2 - array - - - L - - - X2 - array - - - I4 - - - - - id,site_id,affiliate_plugin,avail_campaign_id,status,name,notes,max_tiers,commission_minimum,new_commission_type,new_commission_rate,recurr_commission_type,recurr_commission_rate,recurr_max_commission_periods - id,site_id,affiliate_plugin,avail_campaign_id,status,name,notes,max_tiers,commission_minimum,new_commission_type,new_commission_rate,recurr_commission_type,recurr_commission_rate,recurr_max_commission_periods - id,site_id,affiliate_plugin,avail_campaign_id,status,name,notes,max_tiers,commission_minimum,new_commission_type,new_commission_rate,recurr_commission_type,recurr_commission_rate,recurr_max_commission_periods - id,site_id,affiliate_plugin,avail_campaign_id,status,name,notes,max_tiers,commission_minimum,new_commission_type,new_commission_rate,recurr_commission_type,recurr_commission_rate,recurr_max_commission_periods - id,site_id,affiliate_plugin,avail_campaign_id,status,name,notes,max_tiers,commission_minimum,new_commission_type,new_commission_rate,recurr_commission_type,recurr_commission_rate,recurr_max_commission_periods - - - 0 + + affiliate_template + + affiliate_template
    + + affiliate + + 0 + + name + + 25 + + 0 + + + + + + + + + + 1 + I4 + 1 + + + + 1 + I4 + + + + Active + L + + + C(32) + + + X2 + array + + + C(32) + 2 + 32 + any + + + X2 + + + I4 + 1 + 2 + numeric + + + F + 1 + 12 + float + + + L + + + X2 + array + + + L + + + X2 + array + + + I4 + + + + + + affiliate_plugin,avail_campaign_id,status,name,notes,max_tiers,commission_minimum,new_commission_type,new_commission_rate,recurr_commission_type,recurr_commission_rate,recurr_max_commission_periods + id,site_id,affiliate_plugin,avail_campaign_id,status,name,notes,max_tiers,commission_minimum,new_commission_type,new_commission_rate,recurr_commission_type,recurr_commission_rate,recurr_max_commission_periods + id,site_id,affiliate_plugin,avail_campaign_id,status,name,notes,max_tiers,commission_minimum,new_commission_type,new_commission_rate,recurr_commission_type,recurr_commission_rate,recurr_max_commission_periods + id,site_id,affiliate_plugin,avail_campaign_id,status,name,notes,max_tiers,commission_minimum,new_commission_type,new_commission_rate,recurr_commission_type,recurr_commission_rate,recurr_max_commission_periods + id,site_id,affiliate_plugin,avail_campaign_id,status,name,notes,max_tiers,commission_minimum,new_commission_type,new_commission_rate,recurr_commission_type,recurr_commission_rate,recurr_max_commission_periods + + + + + + + + + + + + + + id + checkbox + 25px + + + name + + + max_tiers + + + commission_minimum + + + status + bool_icon + 20px + + +
    diff --git a/modules/affiliate_template/affiliate_template_install.xml b/modules/affiliate_template/affiliate_template_install.xml index edd2e2f6..1bf4de8b 100644 --- a/modules/affiliate_template/affiliate_template_install.xml +++ b/modules/affiliate_template/affiliate_template_install.xml @@ -1,35 +1,55 @@ + + - affiliate_template - affiliate - - 1 + affiliate + + Affiliate Templates + + 1 + + affiliate_template + + + + affiliate + + + + - - - - delete - - - view - - 1 - - - update - - - add - - 1 - - - search - - - search_show - - - - \ No newline at end of file + + + + + Add + 1 + add + + + + delete + + + + List + 1 + search + + + + + search_show + + + + update + + + + view + + + + diff --git a/modules/affiliate_template/affiliate_template_install_data.xml b/modules/affiliate_template/affiliate_template_install_data.xml index f8be3d1d..feae42d7 100644 --- a/modules/affiliate_template/affiliate_template_install_data.xml +++ b/modules/affiliate_template/affiliate_template_install_data.xml @@ -1,21 +1,21 @@ - - 1 - 1 - ACCOUNT_DISCOUNT - - 1 - Default - 1 - 10 - 1 - - 1 - - 5 - - - 1 - - \ No newline at end of file + + 1 + 1 + ACCOUNT_DISCOUNT + + 1 + Default + 1 + 10 + 1 + + 1 + + 5 + + + 1 + + diff --git a/modules/blocked_email/blocked_email.inc.php b/modules/blocked_email/blocked_email.inc.php index ceec3970..518b0c74 100644 --- a/modules/blocked_email/blocked_email.inc.php +++ b/modules/blocked_email/blocked_email.inc.php @@ -1,146 +1,48 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Module:BlockedEmail */ -class blocked_email -{ +/** + * The main AgileBill Blocked Email Class + * + * @package AgileBill + * @subpackage Module:BlockedEmail + */ +class blocked_email extends OSB_module { + /** + * Is Email Blocked? + */ + public function is_blocked($email) { + if ($email && ! preg_match('/@/',$email)) + return true; - # Open the constructor for this mod - function blocked_email() - { - # name of this module: - $this->module = "blocked_email"; + $dom = explode('@',$email); + $db = &DB(); + $result = $db->Execute(sqlSelect($db,'blocked_email','id',sprintf('email=::%s:: OR email=::%s::',$email,$dom[1]))); + if ($result && $result->RecordCount() > 0) + return true; - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; + return false; } - - - ############################## - ## IS EMAIL BLOCKED? ## - ############################## - function is_blocked($email) - { - @$dom = explode('@', $email); - $db = &DB(); - $sql = 'SELECT id FROM ' . AGILE_DB_PREFIX . 'blocked_email WHERE - email = ' . $db->qstr($email) .' OR - email = ' . $db->qstr($dom[1]) .' AND - site_id = ' . $db->qstr(DEFAULT_SITE); - $result = $db->Execute($sql); - if($result->RecordCount() > 0) - { - return false; - } - return true; - } - - - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } - } -?> \ No newline at end of file +?> diff --git a/modules/blocked_email/blocked_email_construct.xml b/modules/blocked_email/blocked_email_construct.xml index c3ae6841..f4580df9 100644 --- a/modules/blocked_email/blocked_email_construct.xml +++ b/modules/blocked_email/blocked_email_construct.xml @@ -1,59 +1,95 @@ - - blocked_email - - blocked_email
    - - - - 0 - - email - - 25 - - - email - - - - - I4 - 1 - 1 - - - I4 - 1 - - - I8 - date-now - - - I8 - date-now - - - C(128) - 1 - 128 - any - - - X2 - - - - - id,site_id,date_orig,date_last,email,notes - id,site_id,date_orig,date_last,email,notes - id,site_id,date_orig,date_last,email,notes - id,site_id,date_orig,date_last,email,notes - id,site_id,date_orig,date_last,email,notes - - - - + + blocked_email + + blocked_email
    + + + + 0 + + email + + 25 + + 1 + + + + email + + + + + + + 1 + I4 + 1 + + + + 1 + I4 + + + + date-now + Date Created + I8 + + + + date-now + Date Updated + I8 + + + Email + C(128) + 1 + 128 + any + 1 + + + X2 + + + + + + date_orig,date_last,email,notes + id,site_id,date_orig,date_last,email,notes + id,site_id,date_orig,date_last,email,notes + id,site_id,date_orig,date_last,email,notes + id,site_id,date_orig,date_last,email,notes + + + + + + + + + + + + + + id + checkbox + 25px + + + date_orig + date + 150px + + + email + + +
    diff --git a/modules/blocked_email/blocked_email_install.xml b/modules/blocked_email/blocked_email_install.xml index 2cd5a4c7..23d66f4c 100644 --- a/modules/blocked_email/blocked_email_install.xml +++ b/modules/blocked_email/blocked_email_install.xml @@ -1,42 +1,59 @@ + + - blocked_email - setup - + + + + Blocked Email + 1 + + blocked_email + + + + setup + + + + base - - - - search - - - 1 - - - view - - - 1 - - - add - - 1 - - - delete - - - update - - - search_form - - - search_show - - - - - \ No newline at end of file + + + + + Add + 1 + add + + + + delete + + + + List + 1 + search + + + + + search_form + + + + search_show + + + + update + + + + view + + + + diff --git a/modules/blocked_ip/blocked_ip.inc.php b/modules/blocked_ip/blocked_ip.inc.php index 782c9c18..d1519d2b 100644 --- a/modules/blocked_ip/blocked_ip.inc.php +++ b/modules/blocked_ip/blocked_ip.inc.php @@ -1,146 +1,50 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Module:BlockedIP */ -class blocked_ip -{ +/** + * The main AgileBill Blocked IP Class + * + * @package AgileBill + * @subpackage Module:BlockedIP + */ +class blocked_ip extends OSB_module { + /** + * Is IP Blocked? + */ + public function is_blocked($ip) { + if ($ip && ! preg_match('/\./',$ip)) + return true; - # Open the constructor for this mod - function blocked_ip() - { - # name of this module: - $this->module = "blocked_ip"; + $ip_oct = explode('.',$ip); + $db = &DB(); + $result = $db->Execute($q=sqlSelect($db,'blocked_ip','id',sprintf('ip IN (::%s::,::%s.%s::,::%s.%s.%s::,::%s::)', + $ip_oct[0],$ip_oct[0],@$ip_oct[1],$ip_oct[0],@$ip_oct[1],@$ip_oct[2],$ip))); - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; + if ($result->RecordCount() > 0) + return true; - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; + return false; } - - ############################## - ## IS IP BLOCKED? ## - ############################## - function is_blocked($ip) - { - $ip_full = $ip; - @$ip = explode('\.', $ip_full); - $db = &DB(); - $sql = 'SELECT id FROM ' . AGILE_DB_PREFIX . 'blocked_ip WHERE - ip = ' . $db->qstr(@$ip[0]) . ' OR - ip = ' . $db->qstr(@$ip[0].'.'.@$ip[1]) . ' OR - ip = ' . $db->qstr(@$ip[0].'.'.@$ip[1].'.'.@$ip[2]) . ' OR - ip = ' . $db->qstr($ip_full) . ' AND - site_id = ' . $db->qstr(DEFAULT_SITE); - $result = $db->Execute($sql); - if($result->RecordCount() > 0) - { - return false; - } - return true; - } - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } - } -?> \ No newline at end of file +?> diff --git a/modules/blocked_ip/blocked_ip_construct.xml b/modules/blocked_ip/blocked_ip_construct.xml index 8eea0590..908d871e 100644 --- a/modules/blocked_ip/blocked_ip_construct.xml +++ b/modules/blocked_ip/blocked_ip_construct.xml @@ -1,57 +1,95 @@ - - blocked_ip - - blocked_ip
    - - - - 0 - - ip - - 25 - - - ip - - - - - I4 - 1 - - - I4 - 1 - - - I8 - date-time - - - I8 - - - C(128) - 1 - 128 - any - - - X2 - - - - - id,site_id,date_orig,date_last,ip,notes - id,site_id,date_orig,date_last,ip,notes - id,site_id,date_orig,date_last,ip,notes - id,site_id,date_orig,date_last,ip,notes - id,site_id,date_orig,date_last,ip,notes - - - - + + blocked_ip + + blocked_ip
    + + + + 0 + + ip + + 25 + + 1 + + + + ip + + + + + + + 1 + I4 + 1 + + + + 1 + I4 + + + + date-now + Date Created + I8 + + + + date-now + Date Updated + I8 + + + IP Address + C(128) + 1 + 128 + any + 1 + + + X2 + + + + + + date_orig,date_last,ip,notes + id,site_id,date_orig,date_last,ip,notes + id,site_id,date_orig,date_last,ip,notes + id,site_id,date_orig,date_last,ip,notes + id,site_id,date_orig,date_last,ip,notes + + + + + + + + + + + + + + id + checkbox + 25px + + + date_orig + date + 150px + + + ip + + +
    diff --git a/modules/blocked_ip/blocked_ip_install.xml b/modules/blocked_ip/blocked_ip_install.xml index ce97c4a4..512860aa 100644 --- a/modules/blocked_ip/blocked_ip_install.xml +++ b/modules/blocked_ip/blocked_ip_install.xml @@ -1,42 +1,59 @@ + + - blocked_ip - setup - + + + + Blocked IP + 1 + + blocked_ip + + + + setup + + + + base - - - - search - - - 1 - - - view - - - 1 - - - add - - 1 - - - delete - - - update - - - search_form - - - search_show - - - - - \ No newline at end of file + + + + + Add + 1 + add + + + + delete + + + + List + 1 + search + + + + + search_form + + + + search_show + + + + update + + + + view + + + + diff --git a/modules/campaign/campaign.inc.php b/modules/campaign/campaign.inc.php index 67a1b7a8..02ce8e23 100644 --- a/modules/campaign/campaign.inc.php +++ b/modules/campaign/campaign.inc.php @@ -6,49 +6,24 @@ * This body of work is free software; you can redistribute it and/or * modify it under the terms of the Open AgileBill License * License as published at http://www.agileco.com/agilebill/license1-4.txt - * + * * For questions, help, comments, discussion, etc., please join the - * Agileco community forums at http://forum.agileco.com/ + * Agileco community forums at http://forum.agileco.com/ * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill * @version 1.4.93 */ - -class campaign -{ - # Open the constructor for this mod - function campaign() - { - # name of this module: - $this->module = "campaign"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - +class campaign extends OSB_module { ############################## ## CLICK ## ############################## function click($VAR) - { + { ### Set the forward URL if(!empty($VAR['caid'])) { @@ -56,9 +31,9 @@ class campaign $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'campaign WHERE site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND id = ' . $db->qstr(@$VAR['caid']); - $result = $db->Execute($sql); + $result = $db->Execute($sql); if (strlen($result->fields['url']) >= 1) $url = $result->fields['url']; - } + } if(empty($url)) $url = URL; echo ''; + + # Validate user is logged in: + if (! SESS_LOGGED) { + printf('', + _('You must be logged in to complete this purchase! Please refresh this page in your browser to login now.')); + return false; } - - // check for admin - if(!$this->admin_checkout && !empty($VAR['account_id'])) { + + # Check for admin + if (! $this->admin_checkout && ! empty($VAR['account_id'])) { global $C_auth; - if(!empty($VAR['account_id']) && $C_auth->auth_method_by_name('checkout','admin_checkoutnow')) { - $this->account_id=$VAR['account_id']; - $this->admin_checkout=true; + + if (! empty($VAR['account_id']) && $C_auth->auth_method_by_name('checkout','admin_checkoutnow')) { + $this->account_id = $VAR['account_id']; + $this->admin_checkout = true; + } else { - $this->account_id=SESS_ACCOUNT; - } + $this->account_id = SESS_ACCOUNT; + } } - - if(empty($this->session_id)) $this->session_id = SESS; - if(empty($this->account_id)) $this->account_id = SESS_ACCOUNT; - - include_once ( PATH_MODULES . '/cart/cart.inc.php' ); + + if (empty($this->session_id)) + $this->session_id = SESS; + if (empty($this->account_id)) + $this->account_id = SESS_ACCOUNT; + + include_once(PATH_MODULES.'/cart/cart.inc.php'); $cartObj = new cart; - $cartObj->account_id=$this->account_id; - $cartObj->session_id=$this->session_id; - $result = $cartObj->get_contents($db); - if($result->RecordCount() == 0) return false; - - // load invoice object + + $cartObj->account_id = $this->account_id; + $cartObj->session_id = $this->session_id; + $result = $cartObj->get_contents(); + if (! $result || $result->RecordCount() == 0) + return false; + + # Load invoice object include_once(PATH_MODULES.'invoice/invoice.inc.php'); $invoice = new invoice; + + $invoice->initNew(0); $invoice->account_id = $this->account_id; - $invoice->initNew(0); - - // Get the account details: - $account = $db->Execute(sqlSelect($db,"account","*","id=::$this->account_id::")); + + # Get the account details: + $account = $db->Execute(sqlSelect($db,'account','*',array('id'=>$this->account_id))); $invoice->country_id = $account->fields['country_id']; $invoice->state = $account->fields['state']; - // load tax object for tax calculation - include_once(PATH_MODULES.'tax/tax.inc.php'); - $taxObj=new tax; - - // load discount object for discount calculation - include_once(PATH_MODULES.'discount/discount.inc.php'); - $discountObj=new discount; - $discountObj->available_discounts($invoice->account_id); - - // put cart contents into invoice format - $cartObj->put_contents_invoice($db, $result, $invoice, $smart, $taxObj, $discountObj); - + # Put cart contents into invoice format + $cartObj->put_contents_invoice($result,$invoice); + // Validate and init a checkout plugin - $checkout=false; - if($this->admin_checkout_option) { - // admin checkout option specified - include_once ( PATH_MODULES . 'checkout/checkout_admin.inc.php' ); - $PLG = new checkout_admin; - $checkout=true; - $invoice->checkout_plugin_id=false; - } else { - // get available checkout options and check against the one provided - $invoice->checkout_plugin_id=$VAR['option']; - foreach($invoice->invoice_item as $item) if(!empty($item['product_id'])) $product_arr[]=$item['product_id']; - $checkout_options = $this->get_checkout_options($this->account_id,$invoice->total_amt,@$product_arr,$invoice->country_id,$invoice->any_new, $invoice->any_trial, $invoice->any_recurring); - if($checkout_options) { - foreach($checkout_options as $a) { - if($a['fields']['id']==$invoice->checkout_plugin_id) { - // load the selected checkout plugin and run pre-validation - $checkout_plugin=$a['fields']['checkout_plugin']; - $plugin_file = PATH_PLUGINS . 'checkout/'.$checkout_plugin.'.php'; - include_once ( $plugin_file ); - eval ( '$PLG = new plg_chout_'.$checkout_plugin.'("'.$invoice->checkout_plugin_id.'");'); - $plugin_validate = $PLG->validate($VAR, $this); - if ( $plugin_validate != true ) { + $checkout = false; + if ($this->admin_checkout_option) { + # Admin checkout option specified + include_once(PATH_MODULES.'checkout/checkout_admin.inc.php'); + $PLG = new checkout_admin; + + $checkout = true; + $invoice->checkout_plugin_id = false; + + } else { + // Get available checkout options and check against the one provided + $invoice->checkout_plugin_id = $VAR['option']; + $product_arr = array(); + foreach ($invoice->invoice_item as $item) + if (! empty($item['product_id'])) + array_push($product_arr,$item['product_id']); + + $checkout_options = $this->get_checkout_options($this->account_id,$invoice->total_amt,$product_arr,$invoice->country_id,$invoice->any_new,$invoice->any_trial,$invoice->any_recurring); + if ($checkout_options) { + foreach ($checkout_options as $a) { + if ($a['fields']['id'] == $invoice->checkout_plugin_id) { + # Load the selected checkout plugin and run pre-validation + $checkout_plugin = $a['fields']['checkout_plugin']; + include_once(sprintf('%scheckout/%s.php',PATH_PLUGINS,$checkout_plugin)); + eval ('$PLG = new plg_chout_'.$checkout_plugin.'("'.$invoice->checkout_plugin_id.'");'); + + $plugin_validate = $PLG->validate($VAR,$this); + if ($plugin_validate != true) { echo $plugin_validate; return false; - } + } + $checkout=true; break; } } - } + } } - if(!$checkout) { + + if (! $checkout) { echo ' '; return false; } - + // validate credit card on file details - global $VAR; - if(!empty($VAR['account_billing_id']) && @$VAR['new_card']==2) { - $invoice->account_billing_id=$VAR['account_billing_id']; - /* validate credit card on file details */ - if(!$PLG->setBillingFromDB($this->account_id, $invoice->account_billing_id, $invoice->checkout_plugin_id)) { + global $VAR; + if (! empty($VAR['account_billing_id']) && @$VAR['new_card']==2) { + $invoice->account_billing_id=$VAR['account_billing_id']; + /* validate credit card on file details */ + if(!$PLG->setBillingFromDB($this->account_id, $invoice->account_billing_id, $invoice->checkout_plugin_id)) { global $C_debug; $C_debug->alert("Sorry, we cannot use that billing record for this purchase."); return false; } + } else { /* use passed in vars */ $PLG->setBillingFromParams($VAR); - } - + } + // validate recurring processing options if ($PLG->recurr_only) { if ($invoice->recur_amt<=0) { echo ' '; return false; } + if(is_array($invoice->recur_arr) && count($invoice->recur_arr)>1) { $recurring = true; // validate recur day and recurring schedule are the same for both products - foreach($invoice->recur_arr as $a) { - foreach($invoice->recur_arr as $b) { - foreach($b as $key=>$val) { + foreach($invoice->recur_arr as $a) { + foreach($invoice->recur_arr as $b) { + foreach($b as $key=>$val) { if($key != 'price' && $key != 'recurr_week' && $a[$key] != $val) { $recurring=false; break; } } } - } + } if (!$recurring) { echo ' '; return false; } } } - + # Affiliate if(empty($this->affiliate_id)) { if(!empty($account->fields['affiliate_id'])) @@ -439,15 +457,15 @@ class checkout else $invoice->campaign_id = SESS_CAMPAIGN; } - - $invoice->record_id = sqlGenID($db,"invoice"); + + $invoice->record_id = sqlGenID($db,"invoice"); $invoice->actual_billed_currency_id = SESS_CURRENCY; $invoice->billed_currency_id = DEFAULT_CURRENCY; $invoice->checkout_type = $PLG->type; - + // initial invoice status if( $invoice->total_amt == 0 || $PLG->type == 'gateway') { - $invoice->billing_status = 1; + $invoice->billing_status = 1; $invoice->actual_billed_amt = $C_list->format_currency_decimal($invoice->total_amt, SESS_CURRENCY); $invoice->billed_amt = $invoice->total_amt; } @@ -460,7 +478,7 @@ class checkout $bill_amt = round($invoice->total_amt,2); $recur_amt = round($invoice->recur_amt,2); } - + // Get currency ISO (three_digit) for checkout plugin $currrs = $db->Execute(sqlSelect($db,"currency","three_digit","id=".SESS_CURRENCY)); if($currrs && $currrs->RecordCount()) $currency_iso = $currrs->fields['three_digit']; @@ -470,12 +488,12 @@ class checkout $invoice->checkout_plugin_data = $PLG->bill_checkout($bill_amt, $invoice->record_id, $currency_iso, $account->fields, $recur_amt, $invoice->recur_arr); if($invoice->checkout_plugin_data === false || $invoice->checkout_plugin_data == '' ) { if(!empty($PLG->redirect)) echo $PLG->redirect; - return false; + return false; } elseif ($PLG->type == "gateway" || empty($PLG->redirect)) { - $VAR['id'] = $invoice->record_id; - if(!$this->admin_checkout) $VAR['_page'] = "invoice:thankyou"; - $invoice->checkout_plugin_data=false; - } elseif(!$this->admin_checkout) { + $VAR['id'] = $invoice->record_id; + if(!$this->admin_checkout) $VAR['_page'] = "invoice:thankyou"; + $invoice->checkout_plugin_data=false; + } elseif(!$this->admin_checkout) { echo "
    Please wait while we redirect you to the secure payment site.... {$PLG->redirect}
    "; @@ -483,36 +501,36 @@ class checkout // Call the Plugin method for storing the checkout data: $invoice->account_billing_id = $PLG->store_billing($VAR, $invoice->account_id); - - // clear user discounts + + // clear user discounts $fields=Array('discounts'=>""); $db->Execute(sqlUpdate($db,"session",$fields,"id = ::".SESS."::")); - + // admin options $email=true; - if($this->admin_checkout) { + if($this->admin_checkout) { if(empty($VAR['send_email']) || $VAR['send_email']=='false') $email=false; else $email=true; if(!empty($VAR['due_date'])) $invoice->due_date=$this->getInputDate($VAR['due_date']); if(!empty($VAR['grace_period'])) $invoice->grace_period=$VAR['grace_period']; - if(!empty($VAR['notice_max'])) $invoice->notice_max=$VAR['notice_max']; + if(!empty($VAR['notice_max'])) $invoice->notice_max=$VAR['notice_max']; } - - if($invoice->commitNew($taxObj, $discountObj, $email)) { - // delete all cart items - $db->Execute(sqlDelete($db,"cart", "(session_id=::".SESS.":: OR account_id=$invoice->account_id)")); - // admin redirect - if($this->admin_checkout) { - $url = URL.'admin.php?_page=invoice:view&id='.$invoice->record_id; - echo ''; - } - } - return false; + + if ($invoice->commitNew($taxObj,$discountObj,$email)) { + # Delete all cart items + $db->Execute(sqlDelete($db,'cart',sprintf('(session_id=::%s:: OR account_id=%s)',SESS,$invoice->account_id))); + + # Admin redirect + if ($this->admin_checkout) + printf('',URL,$invoice->record_id); + } + + return false; } - /** Convert a localized d,m,y string to epoch timestamp + /** Convert a localized d,m,y string to epoch timestamp */ - function getInputDate($date) { - + function getInputDate($date) { + $Arr_format = explode(DEFAULT_DATE_DIVIDER, UNIX_DATE_FORMAT); $Arr_date = explode(DEFAULT_DATE_DIVIDER, $date); for($i=0; $i<3; $i++) @@ -522,26 +540,26 @@ class checkout if($Arr_format[$i] == 'Y') $year = $Arr_date[$i]; } $timestamp = mktime(0, 0, 0, $month, $day, $year); - return $timestamp; - + return $timestamp; + return time(); } - + /** - * Manage postback for multiple invoices + * Manage postback for multiple invoices */ function postback_multiple($arr) { $db=&DB(); include_once(PATH_MODULES.'invoice/invoice.inc.php'); - $invoice=new invoice; - + $invoice=new invoice; + // get multi-invoice details $total = $invoice->multiple_invoice_total($arr['invoice_id']); - if(!$total) return false; - + if(!$total) return false; + $amt = $arr['amount']; - - foreach($invoice->invoice_id as $id) + + foreach($invoice->invoice_id as $id) { if($amt > 0) { @@ -549,56 +567,56 @@ class checkout $rs=sqlSelect($db, "invoice","SUM(total_amt-billed_amt) as total","id=$id"); if($rs && $rs->RecordCount()) { $thisamt = $rs->fields["total"]; - + if($thisamt > $amt) $arr['amount'] = $amt; else $arr['amount'] = $thisamt; $arr["invoice_id"] = $id; - + $this->postback($arr); $amt -= $thisamt; } - } - } + } + } } - + /** - * Postback for Redirect Pay + * Postback for Redirect Pay */ function postback($arr) { global $C_debug; - - if(empty($arr['invoice_id'])) return false; - if(empty($arr['transaction_id'])) return false; + + if(empty($arr['invoice_id'])) return false; + if(empty($arr['transaction_id'])) return false; if(empty($arr['amount'])) return false; - + if(eregi("MULTI-", $arr['invoice_id'])) { $this->postback_multiple($arr); return; } # Get the latest invoice info: - $db = &DB(); + $db = &DB(); $sql1 =""; if(!empty($arr['subscription_id'])) $sql1 = "checkout_plugin_data = ".$db->qstr( trim($arr['subscription_id']) )." OR "; $q = "SELECT * FROM ".AGILE_DB_PREFIX."invoice WHERE - ( + ( $sql1 parent_id = ".$db->qstr(@$arr['invoice_id'])." OR - id = ".$db->qstr(@$arr['invoice_id'])." - ) + id = ".$db->qstr(@$arr['invoice_id'])." + ) AND billing_status != 1 - AND + AND site_id = ".$db->qstr(DEFAULT_SITE)." ORDER BY date_orig - LIMIT 0,1"; + LIMIT 0,1"; $invoice = $db->Execute($q); if ($invoice === false || $invoice->RecordCount()==0) @@ -706,7 +724,7 @@ class checkout invoice_id = ".$db->qstr($invoice_id)." AND type = ".$db->qstr('postback')." AND memo = ".$db->qstr($arr['transaction_id'])." AND - site_id = ".$db->qstr(DEFAULT_SITE); + site_id = ".$db->qstr(DEFAULT_SITE); $memo = $db->Execute($q); if ($memo === false) @@ -719,14 +737,14 @@ class checkout # Create the invoice memo: $memo_id = $db->GenID(AGILE_DB_PREFIX . 'invoice_memo_id'); $q = "INSERT INTO - ".AGILE_DB_PREFIX."invoice_memo + ".AGILE_DB_PREFIX."invoice_memo SET id = ".$db->qstr($memo_id).", site_id = ".$db->qstr(DEFAULT_SITE).", - date_orig = ".$db->qstr(time()).", - invoice_id = ".$db->qstr($invoice_id).", - account_id = ".$db->qstr(0).", - type = ".$db->qstr('postback').", + date_orig = ".$db->qstr(time()).", + invoice_id = ".$db->qstr($invoice_id).", + account_id = ".$db->qstr(0).", + type = ".$db->qstr('postback').", memo = ".$db->qstr($arr['transaction_id']) ; $memosql = $db->Execute($q); @@ -735,14 +753,14 @@ class checkout # Update the invoice billing info: $q = "UPDATE - ".AGILE_DB_PREFIX."invoice + ".AGILE_DB_PREFIX."invoice SET - date_last = ".$db->qstr(time()).", - billing_status = ".$db->qstr($this->billing_status).", - checkout_plugin_id = ".$db->qstr($this->checkout_id).", - checkout_plugin_data = ".$db->qstr($this->subscription_id).", - billed_amt = ".$db->qstr($this->billed_amt).", - actual_billed_amt = ".$db->qstr($this->actual_billed_amt).", + date_last = ".$db->qstr(time()).", + billing_status = ".$db->qstr($this->billing_status).", + checkout_plugin_id = ".$db->qstr($this->checkout_id).", + checkout_plugin_data = ".$db->qstr($this->subscription_id).", + billed_amt = ".$db->qstr($this->billed_amt).", + actual_billed_amt = ".$db->qstr($this->actual_billed_amt).", actual_billed_currency_id = ".$db->qstr($this->actual_billed_currency_id)." WHERE id = ".$db->qstr($invoice_id)." AND @@ -764,14 +782,14 @@ class checkout # create a record of the viod in an invoice memo: $memo_id = $db->GenID(AGILE_DB_PREFIX . 'invoice_memo_id'); $q = "INSERT INTO - ".AGILE_DB_PREFIX."invoice_memo + ".AGILE_DB_PREFIX."invoice_memo SET id = ".$db->qstr($memo_id).", site_id = ".$db->qstr(DEFAULT_SITE).", - date_orig = ".$db->qstr(time()).", - invoice_id = ".$db->qstr($invoice_id).", - account_id = ".$db->qstr(0).", - type = ".$db->qstr('void').", + date_orig = ".$db->qstr(time()).", + invoice_id = ".$db->qstr($invoice_id).", + account_id = ".$db->qstr(0).", + type = ".$db->qstr('void').", memo = ".$db->qstr("Voided due to postback: ".$arr['transaction_id']) ; $rsql = $db->Execute($q); @@ -797,109 +815,55 @@ class checkout } /** - * Display Checkout Data Form + * Display Checkout Data Form */ function checkoutoption($VAR) { - global $VAR, $C_translate, $smarty; + global $VAR,$C_translate,$C_auth,$C_vars,$smarty; - if(SESS_LOGGED != '1') { - $smarty->assign('plugin_template', false); + if (SESS_LOGGED != '1') { + $smarty->assign('plugin_template',false); return false; } - // Normal checkout + # Normal checkout $db = &DB(); - $q = "SELECT * FROM ".AGILE_DB_PREFIX."checkout WHERE site_id=".DEFAULT_SITE." AND id=".$db->qstr(@$VAR["option"]); - $rs = $db->Execute($q); - if($rs == false || $rs->RecordCount() == 0) { - $smarty->assign('plugin_template', false); + $rs = $db->Execute(sqlSelect($db,'checkout','*',array('id'=>$VAR['option']))); + if (! $rs || $rs->RecordCount() == 0) { + $smarty->assign('plugin_template',false); return false; } - - // determine account id - global $C_auth; - if(!empty($VAR['account_id']) && $C_auth->auth_method_by_name('checkout','admin_checkoutnow')) { - $this->account_id=$VAR['account_id']; - $this->admin_view = true; - } else { - $this->account_id=SESS_ACCOUNT; - } - - // Set account options && seed VAR with defaults - if(empty($VAR['detailsnocopy'])) { - $acct = $db->Execute($sql=sqlSelect($db,"account","first_name,last_name,address1,address2,city,state,zip,country_id,email,company","id=".$this->account_id)); - if($acct && $acct->RecordCount()) - foreach($acct->fields as $key=>$val) - if(!is_numeric($key) && empty($VAR["$key"])) - $VAR["$key"]=stripslashes($acct->fields["$key"]); - } - - global $C_vars; - $C_vars->strip_slashes_all(); - $smarty->assign('VAR', $VAR); - - $smarty->assign('plugin_template', 'checkout_plugin:plugin_ord_' . $rs->fields["checkout_plugin"]); + + # Determine account id + if (! empty($VAR['account_id']) && $C_auth->auth_method_by_name('checkout','admin_checkoutnow')) { + $this->account_id = $VAR['account_id']; + $this->admin_view = true; + } else { + $this->account_id=SESS_ACCOUNT; + } + + # Set account options && seed VAR with defaults + if (empty($VAR['detailsnocopy'])) { + $acct = $db->Execute(sqlSelect($db,'account','first_name,last_name,address1,address2,city,state,zip,country_id,email,company',array('id'=>$this->account_id))); + + if ($acct && $acct->RecordCount()) + foreach ($acct->fields as $key=>$val) + if(!is_numeric($key) && empty($VAR[$key])) + $VAR[$key]=stripslashes($acct->fields[$key]); + } + + $C_vars->strip_slashes_all(); + $smarty->assign('VAR',$VAR); + $smarty->assign('plugin_template','checkout_plugin:plugin_ord_'.$rs->fields['checkout_plugin']); } - function add($VAR) { - $this->checkout_construct(); - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } + public function tpl_get_plugindata($VAR) { + global $smarty; - function view($VAR) { - $this->checkout_construct(); - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - function update($VAR) { - $this->checkout_construct(); - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - function delete($VAR) { - $this->checkout_construct(); - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - function search($VAR) { - $this->checkout_construct(); - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - function search_show($VAR) { - $this->checkout_construct(); - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } - - function checkout_construct() { - $this->module = "checkout"; - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; + # Normal checkout + $db = &DB(); + $rs = $db->Execute(sqlSelect($db,'checkout','plugin_data',array('id'=>$VAR['checkout_id']))); + if ($rs || $rs->RecordCount() == 1) + $smarty->assign('plugin_data',$rs->fields['plugin_data']); } } -?> \ No newline at end of file +?> diff --git a/modules/checkout/checkout_construct.xml b/modules/checkout/checkout_construct.xml index c43401b6..d7604e11 100644 --- a/modules/checkout/checkout_construct.xml +++ b/modules/checkout/checkout_construct.xml @@ -1,140 +1,178 @@ - - checkout - - checkout
    - - - - 0 - - name - - 25 - - - - I4 - 1 - 1 - - - I4 - 1 - - - C(32) - 1 - 32 - any - - - C(255) - - - L - - - C(32) - any - - - X2 - array - 1 - - - L - - - L - - - L - - - F - - - F - - - I4 - - - L - - - L - - - X2 - array - 1 - - - X2 - array - 1 - - - F - - - X2 - array - 1 - - - X2 - array - 1 - - - X2 - array - 1 - - - X2 - array - 1 - - - F - - - X2 - array - 1 - any - - - X2 - - - X2 - array - 1 - - - X2 - array - 1 - - - C(128) - - - - - id,site_id,name,description,active,checkout_plugin,plugin_data,allow_recurring,allow_new,allow_trial,total_minimum,total_maximum,max_decline_attempts,manual_approval_all,manual_approval_recur,manual_approval_country,manual_approval_group,manual_approval_amount,manual_approval_currency,default_when_currency,default_when_country,default_when_group,default_when_amount,allowed_currencies,email_template,excluded_products,required_groups,graphic_url - id,site_id,name,description,active,checkout_plugin,plugin_data,allow_recurring,allow_new,allow_trial,total_minimum,total_maximum,max_decline_attempts,manual_approval_all,manual_approval_recur,manual_approval_country,manual_approval_group,manual_approval_amount,manual_approval_currency,default_when_currency,default_when_country,default_when_group,default_when_amount,allowed_currencies,email_template,excluded_products,required_groups,graphic_url - id,site_id,name,description,active,checkout_plugin,plugin_data,allow_recurring,allow_new,allow_trial,total_minimum,total_maximum,max_decline_attempts,manual_approval_all,manual_approval_recur,manual_approval_country,manual_approval_group,manual_approval_amount,manual_approval_currency,default_when_currency,default_when_country,default_when_group,default_when_amount,allowed_currencies,excluded_products,required_groups - id,site_id,name,description,active,checkout_plugin,plugin_data,allow_recurring,allow_new,allow_trial,total_minimum,total_maximum,max_decline_attempts,manual_approval_all,manual_approval_recur,manual_approval_country,manual_approval_group,manual_approval_amount,manual_approval_currency,default_when_currency,default_when_country,default_when_group,default_when_amount,allowed_currencies,email_template,excluded_products,required_groups,graphic_url - id,site_id,name,description,active,checkout_plugin,plugin_data,allow_recurring,allow_new,allow_trial,total_minimum,total_maximum,max_decline_attempts,manual_approval_all,manual_approval_recur,manual_approval_country,manual_approval_group,manual_approval_amount,manual_approval_currency,default_when_currency,default_when_country,default_when_group,default_when_amount,allowed_currencies,email_template,excluded_products,required_groups - - - 0 + + checkout + + checkout
    + + + + 15 + + name + + 25 + + 1 + + + + + + + + + + 1 + I4 + 1 + + + + 1 + I4 + + + + Active + L + + + C(32) + 1 + 32 + any + + + C(255) + + + C(32) + any + + + X2 + array + 1 + + + L + + + L + + + L + + + F + + + F + + + I4 + + + L + + + L + + + X2 + array + 1 + + + X2 + array + 1 + + + F + + + X2 + array + 1 + + + X2 + array + 1 + + + X2 + array + 1 + + + X2 + array + 1 + + + F + + + X2 + array + 1 + any + + + X2 + + + X2 + array + 1 + + + X2 + array + 1 + + + C(128) + + + + + + id,site_id,name,description,active,checkout_plugin,plugin_data,allow_recurring,allow_new,allow_trial,total_minimum,total_maximum,max_decline_attempts,manual_approval_all,manual_approval_recur,manual_approval_country,manual_approval_group,manual_approval_amount,manual_approval_currency,default_when_currency,default_when_country,default_when_group,default_when_amount,allowed_currencies,email_template,excluded_products,required_groups,graphic_url + id,site_id,name,description,active,checkout_plugin,plugin_data,allow_recurring,allow_new,allow_trial,total_minimum,total_maximum,max_decline_attempts,manual_approval_all,manual_approval_recur,manual_approval_country,manual_approval_group,manual_approval_amount,manual_approval_currency,default_when_currency,default_when_country,default_when_group,default_when_amount,allowed_currencies,email_template,excluded_products,required_groups,graphic_url + id,site_id,name,description,active,checkout_plugin,plugin_data,allow_recurring,allow_new,allow_trial,total_minimum,total_maximum,max_decline_attempts,manual_approval_all,manual_approval_recur,manual_approval_country,manual_approval_group,manual_approval_amount,manual_approval_currency,default_when_currency,default_when_country,default_when_group,default_when_amount,allowed_currencies,excluded_products,required_groups + id,site_id,name,description,active,checkout_plugin,plugin_data,allow_recurring,allow_new,allow_trial,total_minimum,total_maximum,max_decline_attempts,manual_approval_all,manual_approval_recur,manual_approval_country,manual_approval_group,manual_approval_amount,manual_approval_currency,default_when_currency,default_when_country,default_when_group,default_when_amount,allowed_currencies,email_template,excluded_products,required_groups,graphic_url + id,site_id,name,description,active,checkout_plugin,plugin_data,allow_recurring,allow_new,allow_trial,total_minimum,total_maximum,max_decline_attempts,manual_approval_all,manual_approval_recur,manual_approval_country,manual_approval_group,manual_approval_amount,manual_approval_currency,default_when_currency,default_when_country,default_when_group,default_when_amount,allowed_currencies,email_template,excluded_products,required_groups + + + + + + + + + + + + + id + checkbox + 25px + + + name + + + checkout_plugin + + + active + bool_icon + 20px + + +
    diff --git a/modules/checkout/checkout_install.xml b/modules/checkout/checkout_install.xml index 124b080e..3daa48bb 100644 --- a/modules/checkout/checkout_install.xml +++ b/modules/checkout/checkout_install.xml @@ -1,45 +1,68 @@ + + - checkout - setup - + + + + Checkout + 1 + + checkout + + + + setup + + + + - - - - search_form - - - search - - - view - - 1 - - - delete - - - add - 1 - - - update - - - search_show - - - admin_checkoutnow - - - admin_adddiscount - - - admin_preview - - - - \ No newline at end of file + + + + + Add + 1 + add + + + + delete + + + + List + 1 + search + + + + + search_form + + + + search_show + + + + update + + + + view + + + + admin_checkoutnow + + + admin_adddiscount + + + admin_preview + + + diff --git a/modules/core/auth.inc.php b/modules/core/auth.inc.php index 8c3bab49..68bd2002 100644 --- a/modules/core/auth.inc.php +++ b/modules/core/auth.inc.php @@ -1,283 +1,304 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Core */ - -class CORE_auth -{ - var $auth_modules; - var $auth_methods; - var $account=false; - var $logged=false; - function CORE_auth($force) - { +/** + * The main AgileBill CORE Auth Class + * + * @package AgileBill + * @subpackage Core + */ +class CORE_auth { + private $account = 0; + private $logged = false; + private $group = array(); + + public function __construct($force) { global $VAR; - if(!isset( $this->auth_methods ) ) { - #include (PATH_CORE . 'auth_methods.inc'); - #$this->auth_methods = $auth_methods; - } - - if(defined("SESS_LOGGED")) { - if(SESS_LOGGED == "1") { - $this->logged = TRUE; - $this->account = SESS_ACCOUNT; + if (defined('SESS_LOGGED')) { + if (SESS_LOGGED == '1') { + $this->logged = true; + $this->account = SESS_ACCOUNT; } - else { - $this->logged = FALSE; - $this->account = 0; - } - } else { - $this->logged = FALSE; - $this->account = 0; - if(!defined('SESS_LOGGED')) define('SESS_LOGGED', false); - if(!defined('SESS')) define('SESS', false); + } else { + if (! defined('SESS_LOGGED')) + define('SESS_LOGGED',false); + if (! defined('SESS')) + define('SESS',false); } - if($force && defined("FORCE_SESS_ACCOUNT")) { + if ($force && defined('FORCE_SESS_ACCOUNT')) { $this->account = FORCE_SESS_ACCOUNT; - $this->logged = TRUE; - } - $this->auth_update(); - if ( isset($VAR['_logout']) || - isset($VAR['_login']) || - isset($VAR['lid']) || - $force == true || - CACHE_SESSIONS != "1") { - return; - } else { - if($this->session_auth_cache_retrieve()) - { - $this->module_count = count($this->module); - return; - } + $this->logged = true; + } + + $this->auth_update(); + + if (isset($VAR['_logout']) || isset($VAR['_login']) || isset($VAR['lid']) || $force == true || CACHE_SESSIONS != '1') { + return; + + } else { + if ($this->session_auth_cache_retrieve()) { + $this->module_count = count($this->module); + + return; + } } } - - function auth_update() { - $this->group = array('0'); + public function auth_update() { + $this->group = array('0'); $this->module = array('0'); - - if($this->account) { + + if ($this->account) { $this->group_list($this->account); - if (!$this->group) { + + if (! $this->group) return; - } - $db = &DB(); - $p = AGILE_DB_PREFIX; - $sql="SELECT DISTINCT MM.module_id, GM.method_id, GM.group_id, - M.name AS module_name, M.parent_id AS module_parent_id, M.menu_display AS module_display, - MM.name AS method_name, MM.page AS method_page, MM.menu_display AS method_display - FROM {$p}group_method as GM - LEFT JOIN {$p}module as M on (GM.module_id=M.id and M.site_id=".DEFAULT_SITE.") - LEFT JOIN {$p}module_method as MM on (GM.method_id=MM.id and MM.site_id=".DEFAULT_SITE.") "; - for($i=0; $igroup); $i++) - if($i==0) $sql .= "WHERE (GM.group_id={$this->group[$i]} "; - else $sql .= "OR GM.group_id={$this->group[$i]} "; - $sql .= ") AND GM.site_id=".DEFAULT_SITE." ORDER BY M.name,MM.name"; - $result=$db->Execute($sql); - if($result === false) - { + + $db = &DB(); + $p = AGILE_DB_PREFIX; + $sql = " +SELECT DISTINCT MM.module_id, GM.method_id, GM.group_id, M.name AS module_name, M.parent_id AS module_parent_id, M.menu_display AS module_display, MM.name AS method_name, MM.page AS method_page, MM.menu_display AS method_display +FROM {$p}group_method as GM +LEFT JOIN {$p}module as M on (GM.module_id=M.id and M.site_id=".DEFAULT_SITE.") +LEFT JOIN {$p}module_method as MM on (GM.method_id=MM.id and MM.site_id=".DEFAULT_SITE.") "; + + for ($i=0; $igroup); $i++) + if ($i==0) + $sql .= sprintf('WHERE (GM.group_id=%s ',$this->group[$i]); + else + $sql .= sprintf('OR GM.group_id=%s ',$this->group[$i]); + + $sql .= sprintf(') AND GM.site_id=%s ORDER BY M.name,MM.name',DEFAULT_SITE); + $result=$db->Execute($sql); + + if ($result === false) { global $C_debug; - $C_debug->error('core:auth.inc.php','auth_update', $db->ErrorMsg() . '

    ' .$q); + + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg().'
    '.$q); return; } + while (!$result->EOF) { - $module_name = $result->fields["module_name"]; - $method_name = $result->fields["method_name"]; + $module_name = $result->fields['module_name']; + $method_name = $result->fields['method_name']; - if(empty($this->module[$module_name])) { - $this->module[$module_name] = array($result->fields["module_id"], - $result->fields["module_parent_id"], - $result->fields["module_display"]); - } + if (empty($this->module[$module_name])) + $this->module[$module_name] = array($result->fields['module_id'],$result->fields['module_parent_id'],$result->fields['module_display']); + + if (empty($this->module[$module_name][$method_name])) + $this->module[$module_name][$method_name] = array($result->fields['method_id'],$result->fields['method_display'],$result->fields['method_page']); - if(empty($this->module[$module_name][$method_name])) { - $this->module[$module_name][$method_name] = array($result->fields["method_id"], - $result->fields["method_display"], - $result->fields["method_page"]); - } $result->MoveNext(); } } + $this->session_auth_cache_update(); } - - function session_auth_cache_update() { + private function session_auth_cache_update() { $db = &DB(); - $expire = time() + 7200; // 1 hour - if(isset($this->group) && gettype($this->group) == 'array') - $group = serialize($this->group); + $expire = time()+7200; // 1 hour + + if (isset($this->group) && is_array($this->group)) + $group = serialize($this->group); else - $group = 0; + $group = 0; - if(isset($this->module) && gettype($this->module) == 'array') - $module = serialize($this->module); + if (isset($this->module) && is_array($this->module)) + $module = serialize($this->module); else - $module = 0; + $module = 0; - $q = 'DELETE FROM '.AGILE_DB_PREFIX.'session_auth_cache WHERE - session_id = '. $db->qstr(SESS) .' AND - site_id = '. $db->qstr(DEFAULT_SITE); - $db->Execute($q); - - $id = $db->GenID(AGILE_DB_PREFIX . "" . 'session_auth_cache_id'); - $q = 'INSERT INTO '.AGILE_DB_PREFIX.'session_auth_cache SET - id = '. $db->qstr($id) .', - site_id = '. $db->qstr(DEFAULT_SITE) .', - session_id = '. $db->qstr(SESS) .', - date_expire = '. $db->qstr($expire) .', - group_arr = '. $db->qstr($group) .', - module_arr = '. $db->qstr($module); - $db->Execute($q); + $db->Execute(sqlDelete($db,'session_auth_cache',array('session_id'=>SESS))); + $db->Execute(sqlInsert($db,'session_auth_cache',array('session_id'=>SESS,'date_expire'=>$expire,'group_arr'=>$group,'module_arr'=>$module))); } - - function session_auth_cache_retrieve() { + private function session_auth_cache_retrieve() { global $C_sess; - if(!empty($C_sess->auth_cache)) { - if ( $C_sess->auth_cache["date_expire"] > time() ) { - $group = $C_sess->auth_cache['group_arr']; - $module = $C_sess->auth_cache['module_arr']; - if($group != '0' && $group != '') $this->group = unserialize($group); - if($module != '0' && $module != '') $this->module = unserialize($module); + + if (! empty($C_sess->auth_cache)) { + if ($C_sess->auth_cache['date_expire'] > time()) { + $group = $C_sess->auth_cache['group_arr']; + $module = $C_sess->auth_cache['module_arr']; + + if ($group != '0' && $group != '') + $this->group = unserialize($group); + if ($module != '0' && $module != '') + $this->module = unserialize($module); + return true; } - } + } $db = &DB(); - $q = 'SELECT * FROM '.AGILE_DB_PREFIX.'session_auth_cache WHERE - site_id = '. $db->qstr(DEFAULT_SITE) .' AND - session_id = '. $db->qstr(SESS) .' AND - date_expire >= '. $db->qstr(time()); - $result = $db->Execute($q); - if($result->RecordCount() > 0) { - $group = $result->fields['group_arr']; - $module = $result->fields['module_arr']; - if($group != '0' && $group != '') $this->group = unserialize($group); - if($module != '0' && $module != '') $this->module = unserialize($module); + $result = $db->Execute(sqlSelect($db,'session_auth_cache','*',sprintf('session_id=::%s:: AND date_expire >= %s',SESS,time()))); + if ($result->RecordCount() > 0) { + $group = $result->fields['group_arr']; + $module = $result->fields['module_arr']; + + if ($group != '0' && $group != '') + $this->group = unserialize($group); + if ($module != '0' && $module != '') + $this->module = unserialize($module); + return true; } + return false; } - - function group_list($account) { - $this->group[0] = "0"; + private function group_list($account) { + $this->group[0] = '0'; $time = time(); $db = &DB(); $p = AGILE_DB_PREFIX; - $q="SELECT DISTINCT ag.group_id AS group_id,g.parent_id AS parent_id - FROM {$p}account_group as ag - INNER JOIN {$p}group as g ON (ag.group_id=g.id AND g.status=1 AND g.site_id=".DEFAULT_SITE.") - WHERE ag.account_id = '$account' - AND ( ag.date_start IS NULL OR ag.date_start < $time ) - AND ( ag.date_expire IS NULL OR ag.date_expire = 0 OR ag.date_expire > $time ) - AND ( g.date_start IS NULL OR g.date_start <= $time ) - AND ( g.date_expire IS NULL OR g.date_expire = 0 OR g.date_expire > $time ) - AND ag.active=1 AND g.status=1 - AND ag.site_id=".DEFAULT_SITE; - $result = $db->Execute($q); + $q = " +SELECT DISTINCT ag.group_id AS group_id,g.parent_id AS parent_id +FROM {$p}account_group as ag +INNER JOIN {$p}group as g ON (ag.group_id=g.id AND g.status=1 AND g.site_id=".DEFAULT_SITE.") +WHERE ag.account_id = '$account' + AND (ag.date_start IS NULL OR ag.date_start < $time) + AND (ag.date_expire IS NULL OR ag.date_expire = 0 OR ag.date_expire > $time) + AND (g.date_start IS NULL OR g.date_start <= $time) + AND (g.date_expire IS NULL OR g.date_expire = 0 OR g.date_expire > $time) + AND ag.active=1 AND g.status=1 + AND ag.site_id=".DEFAULT_SITE; + + $result = $db->Execute($q); + if ($result === false) { global $C_debug; + echo $db->ErrorMsg(); - $C_debug->error('auth.inc.php','group_list', $db->ErrorMsg()); + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); + exit; - } elseif($result->RecordCount() == 0) { + + } elseif ($result->RecordCount() == 0) { return; - } else { + + } else { + $arr = array(); while (!$result->EOF) { - $arr[] = $result->fields; + array_push($arr,$result->fields); $result->MoveNext(); } } - for($i=0; $igroup); $ii++) - if($this->group[$ii] == $arr[$i]["group_id"]) $do = false; - if($do) { - $this->group[] = $arr[$i]["group_id"]; + for ($ii=0; $iigroup); $ii++) + if ($this->group[$ii] == $arr[$i]['group_id']) + $do = false; - if(!empty($arr[$i]["parent_id"]) && $arr[$i]["parent_id"] != $arr[$i]["group_id"]) { + if ($do) { + array_push($this->group,$arr[$i]['group_id']); + + if (! empty($arr[$i]['parent_id']) && $arr[$i]['parent_id'] != $arr[$i]['group_id']) { $do = true; - for($ii=0; $iigroup); $ii++) - if($this->group[$ii] == $arr[$i]["parent_id"]) $do = false; - if($do) $this->group[] = $arr[$i]["parent_id"]; - } + + for ($ii=0; $iigroup); $ii++) + if ($this->group[$ii] == $arr[$i]['parent_id']) + $do = false; + + if ($do) + array_push($this->group,$arr[$i]['parent_id']); + } } } - if($account != SESS_ACCOUNT) return $this->group; - } - function auth_method_by_name($module,$method) { + if ($account != SESS_ACCOUNT) + return $this->group; + } - if(isset($this->module[$module][$method])) return TRUE; + public function auth_method_by_name($module,$method) { + if (isset($this->module[$module][$method])) + return true; - if($module == 'core') - if($method == 'cleanup') + if ($module == 'core') + if ($method == 'cleanup') return true; else return false; - if( is_file(PATH_MODULES.$module.'/auth.inc.php')) { - include (PATH_MODULES.$module.'/auth.inc.php'); - $this->auth_methods = $auth_methods; - for($i=0; $iauth_methods); $i++) - if ($module == @$this->auth_methods[$i]['module']) - if($method == false || $method == @$this->auth_methods[$i]['method']) - return true; - } - return FALSE; - } + if (is_file(PATH_MODULES.$module.'/auth.inc.php')) { + include(PATH_MODULES.$module.'/auth.inc.php'); + + $this->auth_methods = $auth_methods; + + for ($i=0; $iauth_methods); $i++) + if ($module == @$this->auth_methods[$i]['module']) + if ($method == false || $method == @$this->auth_methods[$i]['method']) + return true; + } - function auth_group_by_id($id) { - if(!is_array($id)) - $ids[] = $id; - else - $ids = $id; - foreach ( $ids as $group_id ) - if(isset($this->group)) - foreach ($this->group as $this_group_id) - if($this_group_id == $group_id) - return true; return false; } - function auth_group_by_account_id($account, $id) { - if(SESS_LOGGED == true && $account == SESS_ACCOUNT) - return $this->auth_group_by_id($id); - unset($this->group); - $this->group_list($account); - for($i=0; $i < count($this->group); $i++) - if($this->group[$i] == $id) return true; - return FALSE; + public function auth_group_by_id($id) { + $ids = array(); + + if (! is_array($id)) + array_push($ids,$id); + else + $ids = $id; + + foreach ($ids as $group_id) + if (isset($this->group)) + foreach ($this->group as $this_group_id) + if ($this_group_id == $group_id) + return true; + + return false; } - function generate_admin_menu() { + public function auth_group_by_account_id($account, $id) { + if (SESS_LOGGED == true && $account == SESS_ACCOUNT) + return $this->auth_group_by_id($id); + + unset($this->group); + $this->group_list($account); + + for ($i=0; $igroup); $i++) + if ($this->group[$i] == $id) + return true; + + return false; + } + + /** + * Generate the admin menu + */ + public function generate_admin_menu() { include_once(PATH_CORE.'auth_generate_admin_menu.inc.php'); + return auth_generate_admin_menu($this); } } -?> \ No newline at end of file +?> diff --git a/modules/core/auth_generate_admin_menu.inc.php b/modules/core/auth_generate_admin_menu.inc.php index fcd26686..c620254e 100644 --- a/modules/core/auth_generate_admin_menu.inc.php +++ b/modules/core/auth_generate_admin_menu.inc.php @@ -1,149 +1,150 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Menu */ - -// generate the admin menu -function auth_generate_admin_menu($menu_obj) -{ - $menu_obj->auth_update(); - global $C_translate, $smarty, $C_list; - $i=1; - $js=''; - $arr = $menu_obj->module; +/** + * The main AgileBill Admin Menu Method + * + * @package AgileBill + * @subpackage Menu + */ + +function auth_generate_admin_menu($menu_obj) { + global $C_translate,$smarty,$C_list; + + $menu_obj->auth_update(); + + $i = 1; + $js = ''; + $arr = $menu_obj->module; $arr2 = $menu_obj->module; - // loop through the modules - while (list($module, $val) = each ($arr)) { - if(!empty($val[2])) { - if($val[1] == $val[0] || empty($val[0]) || empty($val[1])) - { - $module_name = $C_translate->translate('menu',$module,''); + # Loop through the modules + while (list($module,$val) = each($arr)) { + if (! empty($val[2])) { + if ($val[1] == $val[0] || empty($val[0]) || empty($val[1])) { + $module_name = $C_translate->translate('menu',$module,'','menutitle'); $parent = $val[0]; $module_id = $val[0]; - $module_arr[$i]["name"] = $module_name; - $module_arr[$i]["module"] = $module; + $module_arr[$i]['name'] = $module_name; + $module_arr[$i]['module'] = $module; + + # Loop through the methods + while (list($method,$meth_arr) = each($arr[$module])) { + if (gettype($meth_arr) == 'array' && ! empty($meth_arr[1])) { + $method_name = $C_translate->translate($method,$module,'','methodtitle'); - // loop through the methods - while (list($method, $meth_arr) = each ($arr[$module])) { - if(gettype($meth_arr) == 'array' && !empty($meth_arr[1])) { - $method_name = $C_translate->translate('menu_'.$method,$module,''); if(empty($meth_arr[2])) $page = $module.':'.$method; else - $page = preg_replace('/%%/', $module, $meth_arr[2]); - - $module_arr[$i]["methods"][] = Array('name' => $method_name, 'page' => $page); + $page = htmlspecialchars(str_replace('%%',$module,$meth_arr[2])); + $module_arr[$i]['methods'][] = array('name'=>$method_name,'page'=>$page); } } - // Loop through the sub-modules: + # Loop through the sub-modules: reset($arr2); - $ii=0; - while (list($module, $val) = each ($arr2)) { - if(!empty($val[2])) { - if($val[1] == $parent && $module_id != $val[0]) - { - $module_name = $C_translate->translate('menu',$module,''); - $module_arr[$i]["sub_name"][$ii] = $module_name; + $ii = 0; + while (list($module,$val) = each ($arr2)) { + if (! empty($val[2])) { + if ($val[1] == $parent && $module_id != $val[0]) { + $module_name = $C_translate->translate('menu',$module,'','menutitle'); + $module_arr[$i]["sub_name"][$ii] = $module_name; - // loop through the methods - while (list($method, $meth_arr) = each ($arr2[$module])) { - if(gettype($meth_arr) == 'array' && !empty($meth_arr[1])) { - $method_name = $C_translate->translate('menu_'.$method,$module,''); - if(empty($meth_arr[2])) - $page = $module.':'.$method; - else - $page = preg_replace('/%%/', $module, $meth_arr[2]); - $module_arr[$i]["sub_methods"][$ii][] = Array('name' => $method_name, 'page' => $page); - } + # Loop through the methods + while (list($method,$meth_arr) = each($arr2[$module])) { + if (gettype($meth_arr) == 'array' && ! empty($meth_arr[1])) { + $method_name = $C_translate->translate($method,$module,'','methodtitle'); + + if(empty($meth_arr[2])) + $page = $module.':'.$method; + else + $page = htmlspecialchars(str_replace('%%',$module,$meth_arr[2])); + + $module_arr[$i]['sub_methods'][$ii][] = array('name'=>$method_name,'page'=>$page); } - $ii++; } + + $ii++; } } - $i++; + } - } - } + $i++; + } + } } - - - - // Generate the main modules: + # Generate the main modules: $js = ''; $js .= ".|Overview|javascript:openUrl('?_page=core:admin');\n"; $js .= ".|Exit Administration|javascript:exitAdmin();\n"; - $js .= ".|Misc\n"; - $js .= "..|Documentation|http://agilebill.com/documentation|||mainFrame\n"; - $js .= "..|Agileco News|http://forum.agileco.com/forumdisplay.php?f=26|||mainFrame\n"; - $js .= "..|Version Check|?_page=module:upgrade|||mainFrame\n"; - for($i=1; $i<=count($module_arr); $i++) - { + for ($i=1; $i<=count($module_arr); $i++) { $name = $module_arr[$i]['name']; $js .= ".|{$name}\n"; - // Generate the main methods: - for($ii=0; $iiassign('today_start', $C_list->date(mktime(0,0,0,date("m"),date("d"), date("Y")))); - $smarty->assign('week_start', $C_list->date(mktime(0,0,0,date("m"),date("d")-7, date("Y")))); - $smarty->assign('month_start', $C_list->date(mktime(0,0,0,date("m"),1, date("Y")))); + # Set the dates for the quicksearch + $smarty->assign('today_start',$C_list->date(mktime(0,0,0,date('m'),date('d'),date('Y')))); + $smarty->assign('week_start',$C_list->date(mktime(0,0,0,date('m'),date('d')-7,date('Y')))); + $smarty->assign('month_start',$C_list->date(mktime(0,0,0,date('m'),1,date('Y')))); # Generate the menu - require_once(PATH_INCLUDES."phplayers/PHPLIB.php"); - require_once(PATH_INCLUDES."phplayers/layersmenu-common.inc.php"); - require_once(PATH_INCLUDES."phplayers/treemenu.inc.php"); + require_once(PATH_INCLUDES.'phplayers/PHPLIB.php'); + require_once(PATH_INCLUDES.'phplayers/layersmenu-common.inc.php'); + require_once(PATH_INCLUDES.'phplayers/treemenu.inc.php'); - // unstoppable agileco logo ;) - echo ''; + # Unstoppable agileco logo ;) + echo 'Logo'; $mnu = new TreeMenu(); $mnu->setMenuStructureString($js); - $mnu->setIconsize(16, 16); + $mnu->setIconsize(16,16); $mnu->parseStructureForMenu('treemenu1'); - $mnu->setTreemenuTheme("kde_"); - return $mnu->newTreeMenu('treemenu1'); - return $js; - + $mnu->setTreemenuTheme('kde_'); + return $mnu->newTreeMenu('treemenu1'); } ?> diff --git a/modules/core/crypt.inc.php b/modules/core/crypt.inc.php index 95cef43f..a16826a9 100644 --- a/modules/core/crypt.inc.php +++ b/modules/core/crypt.inc.php @@ -1,77 +1,119 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net + * + * @link http://www.agileco.com/ + * @copyright 2004-2008 Agileco, LLC. + * @license http://www.agileco.com/agilebill/license1-4.txt + * @author Tony Landis + * @package AgileBill + * @subpackage Core + */ - var $primes; - var $maxprimes; +if (! defined('LICENSE_KEY')) + define('LICENSE_KEY','47012093-4943-32127707'); - function SecurityRSA($show_debug=0) { - mt_srand((double)microtime()*1000000); - $this->primes = array (4507, 4513, 4517, 4519, 4523, 4547, 4549, 4561, 4567, 4583, 4591, 4597, - 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657, 4663, 4673, 4679, 4691, 4703, 4721, 4723, 4729, 4733, 4751, - 4759, 4783, 4787, 4789, 4793, 4799, 4801, 4813, 4817, 4831, 4861, 4871, 4877, 4889, 4903, 4909, 4919, 4931, - 4933, 4937, 4943, 4951, 4957, 4967, 4969, 4973, 4987, 4993, 4999, 5003, 5009, 5011, 5021, 5023, 5039, 5051, - 5059, 5077, 5081, 5087, 5099, 5101, 5107, 5113, 5119, 5147, 5153, 5167, 5171, 5179, 5189, 5197, 5209, 5227, - 5231, 5233, 5237, 5261, 5273, 5279, 5281, 5297, 5303, 5309, 5323, 5333, 5347, 5351, 5381, 5387, 5393, 5399, - 5407, 5413, 5417, 5419, 5431, 5437, 5441, 5443, 5449, 5471, 5477, 5479, 5483, 5501, 5503, 5507, 5519, 5521, - 5527, 5531, 5557, 5563, 5569, 5573, 5581, 5591, 5623, 5639, 5641, 5647, 5651, 5653, 5657, 5659, 5669, 5683, - 5689, 5693, 5701, 5711, 5717, 5737, 5741, 5743, 5749, 5779, 5783, 5791, 5801, 5807, 5813, 5821, 5827, 5839, - 5843, 5849, 5851, 5857, 5861, 5867, 5869, 5879, 5881, 5897, 5903, 5923, 5927, 5939, 5953, 5981, 5987, 6007, - 6011, 6029, 6037, 6043, 6047, 6053, 6067, 6073, 6079, 6089, 6091, 6101, 6113, 6121, 6131, 6133, 6143, 6151, - 6163, 6173, 6197, 6199, 6203, 6211, 6217, 6221, 6229, 6247, 6257, 6263, 6269, 6271, 6277, 6287, 6299, 6301, - 6311, 6317, 6323, 6329, 6337, 6343, 6353, 6359, 6361, 6367, 6373, 6379, 6389, 6397, 6421, 6427, 6449, 6451, - 6469, 6473, 6481, 6491, 6521, 6529, 6547, 6551, 6553, 6563, 6569, 6571, 6577, 6581, 6599, 6607, 6619, 6637, - 6653, 6659, 6661, 6673, 6679, 6689, 6691, 6701, 6703, 6709, 6719, 6733, 6737, 6761, 6763, 6779, 6781, 6791, - 6793, 6803, 6823, 6827, 6829, 6833, 6841, 6857, 6863, 6869, 6871, 6883, 6899, 6907, 6911, 6917, 6947, 6949, - 6959, 6961, 6967, 6971, 6977, 6983, 6991, 6997, 7001, 7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 7103, - 7109, 7121, 7127, 7129, 7151, 7159, 7177, 7187, 7193, 7207, 7211, 7213, 7219, 7229, 7237, 7243, 7247, 7253, - 7283, 7297, 7307, 7309, 7321, 7331, 7333, 7349, 7351, 7369, 7393, 7411, 7417, 7433, 7451, 7457, 7459, 7477, - 7481, 7487, 7489, 7499, 7507, 7517, 7523, 7529, 7537, 7541, 7547, 7549, 7559, 7561, 7573, 7577, 7583, 7589, - 7591, 7603, 7607, 7621, 7639, 7643, 7649, 7669, 7673, 7681, 7687, 7691, 7699, 7703, 7717, 7723, 7727, 7741, - 7753, 7757, 7759, 7789, 7793, 7817, 7823, 7829, 7841, 7853, 7867, 7873, 7877, 7879, 7883, 7901, 7907, 7919, - 7927, 7933, 7937, 7949, 7951, 7963, 7993, 8009, 8011, 8017, 8039, 8053, 8059, 8069, 8081, 8087, 8089, 8093, - 8101, 8111, 8117, 8123, 8147, 8161, 8167, 8171, 8179, 8191, 8209, 8219, 8221, 8231, 8233, 8237, 8243, 8263, - 8269, 8273, 8287, 8291, 8293, 8297, 8311, 8317, 8329, 8353, 8363, 8369, 8377, 8387, 8389, 8419, 8423, 8429, - 8431, 8443, 8447, 8461, 8467, 8501, 8513, 8521, 8527, 8537, 8539, 8543, 8563, 8573, 8581, 8597, 8599, 8609, - 8623, 8627, 8629, 8641, 8647, 8663, 8669, 8677, 8681, 8689, 8693, 8699, 8707, 8713, 8719, 8731, 8737, 8741, - 8747, 8753, 8761, 8779, 8783, 8803, 8807, 8819, 8821, 8831, 8837, 8839, 8849, 8861, 8863, 8867, 8887, 8893, - 8923, 8929, 8933, 8941, 8951, 8963, 8969, 8971, 8999, 9001, 9007, 9011, 9013, 9029, 9041, 9043, 9049, 9059, - 9067, 9091, 9103, 9109, 9127, 9133, 9137, 9151, 9157, 9161, 9173, 9181, 9187, 9199, 9203, 9209, 9221, 9227, - 9239, 9241, 9257, 9277, 9281, 9283, 9293, 9311, 9319, 9323, 9337, 9341, 9343, 9349, 9371, 9377, 9391, 9397, - 9403, 9413, 9419, 9421, 9431, 9433, 9437, 9439, 9461, 9463, 9467, 9473, 9479, 9491, 9497, 9511, 9521, 9533); - $this->maxprimes = count($this->primes) - 1; +/** + * The main AgileBill CORE RSA Class + * + * @package AgileBill + * @subpackage Core + * @todo This Class appears unused. + */ +class CORE_RSA { + private $primes = array(); + private $maxprimes = 0; + + public function __construct() { + mt_srand((double)microtime()*1000000); + + $this->primes = array( + 4507,4513,4517,4519,4523,4547,4549,4561,4567,4583,4591,4597, + 4603,4621,4637,4639,4643,4649,4651,4657,4663,4673,4679,4691,4703,4721,4723,4729,4733,4751, + 4759,4783,4787,4789,4793,4799,4801,4813,4817,4831,4861,4871,4877,4889,4903,4909,4919,4931, + 4933,4937,4943,4951,4957,4967,4969,4973,4987,4993,4999,5003,5009,5011,5021,5023,5039,5051, + 5059,5077,5081,5087,5099,5101,5107,5113,5119,5147,5153,5167,5171,5179,5189,5197,5209,5227, + 5231,5233,5237,5261,5273,5279,5281,5297,5303,5309,5323,5333,5347,5351,5381,5387,5393,5399, + 5407,5413,5417,5419,5431,5437,5441,5443,5449,5471,5477,5479,5483,5501,5503,5507,5519,5521, + 5527,5531,5557,5563,5569,5573,5581,5591,5623,5639,5641,5647,5651,5653,5657,5659,5669,5683, + 5689,5693,5701,5711,5717,5737,5741,5743,5749,5779,5783,5791,5801,5807,5813,5821,5827,5839, + 5843,5849,5851,5857,5861,5867,5869,5879,5881,5897,5903,5923,5927,5939,5953,5981,5987,6007, + 6011,6029,6037,6043,6047,6053,6067,6073,6079,6089,6091,6101,6113,6121,6131,6133,6143,6151, + 6163,6173,6197,6199,6203,6211,6217,6221,6229,6247,6257,6263,6269,6271,6277,6287,6299,6301, + 6311,6317,6323,6329,6337,6343,6353,6359,6361,6367,6373,6379,6389,6397,6421,6427,6449,6451, + 6469,6473,6481,6491,6521,6529,6547,6551,6553,6563,6569,6571,6577,6581,6599,6607,6619,6637, + 6653,6659,6661,6673,6679,6689,6691,6701,6703,6709,6719,6733,6737,6761,6763,6779,6781,6791, + 6793,6803,6823,6827,6829,6833,6841,6857,6863,6869,6871,6883,6899,6907,6911,6917,6947,6949, + 6959,6961,6967,6971,6977,6983,6991,6997,7001,7013,7019,7027,7039,7043,7057,7069,7079,7103, + 7109,7121,7127,7129,7151,7159,7177,7187,7193,7207,7211,7213,7219,7229,7237,7243,7247,7253, + 7283,7297,7307,7309,7321,7331,7333,7349,7351,7369,7393,7411,7417,7433,7451,7457,7459,7477, + 7481,7487,7489,7499,7507,7517,7523,7529,7537,7541,7547,7549,7559,7561,7573,7577,7583,7589, + 7591,7603,7607,7621,7639,7643,7649,7669,7673,7681,7687,7691,7699,7703,7717,7723,7727,7741, + 7753,7757,7759,7789,7793,7817,7823,7829,7841,7853,7867,7873,7877,7879,7883,7901,7907,7919, + 7927,7933,7937,7949,7951,7963,7993,8009,8011,8017,8039,8053,8059,8069,8081,8087,8089,8093, + 8101,8111,8117,8123,8147,8161,8167,8171,8179,8191,8209,8219,8221,8231,8233,8237,8243,8263, + 8269,8273,8287,8291,8293,8297,8311,8317,8329,8353,8363,8369,8377,8387,8389,8419,8423,8429, + 8431,8443,8447,8461,8467,8501,8513,8521,8527,8537,8539,8543,8563,8573,8581,8597,8599,8609, + 8623,8627,8629,8641,8647,8663,8669,8677,8681,8689,8693,8699,8707,8713,8719,8731,8737,8741, + 8747,8753,8761,8779,8783,8803,8807,8819,8821,8831,8837,8839,8849,8861,8863,8867,8887,8893, + 8923,8929,8933,8941,8951,8963,8969,8971,8999,9001,9007,9011,9013,9029,9041,9043,9049,9059, + 9067,9091,9103,9109,9127,9133,9137,9151,9157,9161,9173,9181,9187,9199,9203,9209,9221,9227, + 9239,9241,9257,9277,9281,9283,9293,9311,9319,9323,9337,9341,9343,9349,9371,9377,9391,9397, + 9403,9413,9419,9421,9431,9433,9437,9439,9461,9463,9467,9473,9479,9491,9497,9511,9521,9533); + + $this->maxprimes = count($this->primes)-1; } - function generate_keys($show_debug=0){ - while (empty($e) || empty($d)) { - $p = $this->primes[mt_rand(0, $this->maxprimes)]; - while (empty($q) || ($p==$q)) { - $q = $this->primes[mt_rand(0, $this->maxprimes)]; - } - $n = $p*$q; - $pi = ($p - 1) * ($q - 1); - $e = $this->tofindE($pi, $p, $q); - $d = $this->extend($e,$pi); - $keys = array ($n, $e, $d); + public function generate_keys(){ + $e = false; + $d = false; + $q = false; + + while (! $e || ! $d) { + $p = $this->primes[mt_rand(0,$this->maxprimes)]; + + while (! $q || ($p==$q)) + $q = $this->primes[mt_rand(0,$this->maxprimes)]; + + $n = $p*$q; + $pi = ($p-1)*($q-1); + $e = $this->tofindE($pi,$p,$q); + $d = $this->extend($e,$pi); + $keys = array($n,$e,$d); } + return $keys; - } - function mo($g, $l) { - return $g - ($l * floor ($g/$l)); } - function extend($Ee,$Epi) { + private function mo($g,$l) { + return $g-($l*floor($g/$l)); + } + + private function extend($Ee,$Epi) { $u1 = 1; $u2 = 0; $u3 = $Epi; $v1 = 0; $v2 = 1; $v3 = $Ee; + while ($v3 != 0) { $qq = floor($u3/$v3); - $t1 = $u1 - $qq * $v1; - $t2 = $u2 - $qq * $v2; - $t3 = $u3 - $qq * $v3; + $t1 = $u1-$qq*$v1; + $t2 = $u2-$qq*$v2; + $t3 = $u3-$qq*$v3; $u1 = $v1; $u2 = $v2; $u3 = $v3; @@ -80,172 +122,212 @@ class CORE_RSA $v3 = $t3; $z = 1; } + $uu = $u1; $vv = $u2; - if ($vv < 0) { - $inverse = $vv + $Epi; - } else { + + if ($vv < 0) + $inverse = $vv+$Epi; + else $inverse = $vv; - } + return $inverse; } - function GCD($e,$pi) { + private function GCD($e,$pi) { $y = $e; $x = $pi; + while ($y != 0) { - $w = $this->mo($x , $y); + $w = $this->mo($x,$y); $x = $y; $y = $w; } + return $x; } - function tofindE($pi) { + private function tofindE($pi) { $great = 0; - $cc = mt_rand (0,$this->maxprimes); + $cc = mt_rand(0,$this->maxprimes); $startcc = $cc; + while ($cc >= 0) { $se = $this->primes[$cc]; $great = $this->GCD($se,$pi); $cc--; - if ($great == 1) break; + + if ($great == 1) + break; } + if ($great == 0) { $cc = $startcc + 1; + while ($cc <= $this->maxprimes) { $se = $this->primes[$cc]; $great = $this->GCD($se,$pi); $cc++; - if ($great == 1) break; + + if ($great == 1) + break; } } + return $se; } - function rsa_encrypt($m, $e, $n) { - $asci = array (); + public function rsa_encrypt($m,$e,$n) { + $asci = array(); + $coded = ''; + for ($i=0; $ipowmod($asci[$k], $e, $n); - @$coded .= $resultmod." "; + for ($k=0; $k< count($asci); $k++) { + $resultmod = $this->powmod($asci[$k],$e,$n); + $coded .= $resultmod.' '; } - return trim(@$coded); + + return trim($coded); } - function powmod($base, $exp, $modulus) { + private function powmod($base,$exp,$modulus) { $accum = 1; $i = 0; $basepow2 = $base; + while (($exp >> $i)>0) { - if ((($exp >> $i) & 1) == 1) { - $accum = $this->mo(($accum * $basepow2) , $modulus); - } - $basepow2 = $this->mo(($basepow2 * $basepow2) , $modulus); + if ((($exp >> $i) & 1) == 1) + $accum = $this->mo(($accum*$basepow2),$modulus); + + $basepow2 = $this->mo(($basepow2*$basepow2),$modulus); + $i++; } + return $accum; } - function rsa_decrypt($c, $d, $n) { - $decryptarray = explode(" ", $c); - for ($u=0; $upowmod($decryptarray[$u], $d, $n); - @$deencrypt.= substr ($resultmod,1,strlen($resultmod)-2); - } - for ($u=0; $upowmod($decryptarray[$u],$d,$n); + $deencrypt .= substr($resultmod,1,strlen($resultmod)-2); } - return @$resultd; + + for ($u=0; $ursa_encrypt($data,$keys[1],$keys[0]); + $rc4_data = do_rc4($rsa_data,'en',$rc4_key); -function CORE_encrypt($data) { - if(LICENSE_KEY == '') return $data; // provide a license key in the setup area to enable encryption - $rsa = new CORE_RSA; - $keys = explode('-', LICENSE_KEY); - $rsa_data = $rsa->rsa_encrypt($data, $keys[1], $keys[0]); - $rc4_key = do_rc4(LICENSE_KEY, 'en', false); - $rc4_data = do_rc4($rsa_data, 'en', $rc4_key); return $rc4_data; } +/** + * Decrypt the data + */ +function CORE_decrypt($data) { + $rsa = new CORE_RSA; + + $keys = explode('-',LICENSE_KEY); + $rc4_key = do_rc4(LICENSE_KEY,'en',false); + + $rc4_data = do_rc4($data,'de',$rc4_key); + $rsa_data = $rsa->rsa_decrypt($rc4_data,$keys[2],$keys[0]); -function CORE_decrypt($data) { - if(LICENSE_KEY == '') return $data; // provide a license key in the setup area to enable encryption - $rc4_key = do_rc4(LICENSE_KEY, 'en', false); - $rc4_data = do_rc4($data, 'de', $rc4_key); - $rsa = new CORE_RSA; - $keys = explode('-', LICENSE_KEY); - $rsa_data = $rsa->rsa_decrypt($rc4_data, $keys[2], $keys[0]); return $rsa_data; } +/** + * Do the encryption/decryption + */ +function do_rc4($data,$case,$pwd) { + if (! $pwd) + $pwd = '21e0*kO-(uV9B0@jFk-er'; -function do_rc4($data, $case, $pwd) { - if(!$pwd) $pwd = '21e0*kO-(uV9B0@jFk-er'; - if ($case == 'de') { + if ($case == 'de') $data = urldecode($data); - } - $key[] = ""; - $box[] = ""; - $temp_swap = ""; - $pwd_length = 0; - $pwd_length = strlen($pwd); + + $key = array(); + $box = array(); + $temp_swap = ''; + $pwd_length = strlen($pwd); + for ($i = 0; $i <= 255; $i++) { - $key[$i] = ord(substr($pwd, ($i % $pwd_length), 1)); + $key[$i] = ord(substr($pwd,($i%$pwd_length),1)); $box[$i] = $i; } - $x = 0; - for ($i = 0; $i <= 255; $i++) { - $x = ($x + $box[$i] + $key[$i]) % 256; + + $x = 0; + for ($i=0; $i<=255; $i++) { + $x = ($x+$box[$i]+$key[$i])%256; $temp_swap = $box[$i]; $box[$i] = $box[$x]; $box[$x] = $temp_swap; } - $temp = ""; - $k = ""; - $cipherby = ""; - $cipher = ""; + + $temp = ''; + $k = ''; + $cipherby = ''; + $cipher = ''; $a = 0; $j = 0; - for ($i = 0; $i < strlen($data); $i++) { - $a = ($a + 1) % 256; - $j = ($j + $box[$a]) % 256; + + for ($i=0; $i \ No newline at end of file +} +?> diff --git a/modules/core/database.inc.php b/modules/core/database.inc.php index 502665ff..fd7eec23 100644 --- a/modules/core/database.inc.php +++ b/modules/core/database.inc.php @@ -1,262 +1,363 @@ - + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Core */ - -class CORE_database -{ - function add($VAR, &$construct, $type) - { - include_once(PATH_CORE . 'database_add.inc.php'); - return CORE_database_add($VAR, $construct, $type); + +/** + * The main AgileBill CORE Database Class + * + * @package AgileBill + * @subpackage Core + */ +class CORE_database { + public function add($VAR,$construct,$type) { + include_once(PATH_CORE.'database_add.inc.php'); + return CORE_database_add($VAR,$construct,$type); } - function update($VAR, &$construct, $type) - { - include_once(PATH_CORE . 'database_update.inc.php'); - return CORE_database_update($VAR, $construct, $type); + public function update($VAR,$construct,$type) { + include_once(PATH_CORE.'database_update.inc.php'); + return CORE_database_update($VAR,$construct,$type); } - function search_form($VAR, &$construct, $type) - { - include_once(PATH_CORE . 'database_search_form.inc.php'); - return CORE_database_search_form($VAR, $construct, $type); + public function search_form($VAR,$construct,$type) { + include_once(PATH_CORE.'database_search_form.inc.php'); + return CORE_database_search_form($VAR,$construct,$type); } - function search($VAR, &$construct, $type) - { - include_once(PATH_CORE . 'database_search.inc.php'); - return CORE_database_search($VAR, $construct, $type); + public function search($VAR,$construct,$type) { + include_once(PATH_CORE.'database_search.inc.php'); + return CORE_database_search($VAR,$construct,$type); } - function search_show($VAR, &$construct, $type) - { - include_once(PATH_CORE . 'database_search_show.inc.php'); - return CORE_database_search_show($VAR, $construct, $type); - } - - function view($VAR, &$construct, $type) - { - include_once(PATH_CORE . 'database_view.inc.php'); - return CORE_database_view($VAR, $construct, $type); - } - - function mass_delete($VAR, &$construct, $type) - { - include_once(PATH_CORE . 'database_mass_delete.inc.php'); - return CORE_database_mass_delete($VAR, $construct, $type); - } - - function delete($VAR, &$construct, $type) - { - include_once(PATH_CORE . 'database_delete.inc.php'); - return CORE_database_delete($VAR, $construct, $type); + public function search_show($VAR,$construct,$type) { + include_once(PATH_CORE.'database_search_show.inc.php'); + return CORE_database_search_show($VAR,$construct,$type); } - function join_fields($result, $linked) - { - include_once(PATH_CORE . 'database_join_fields.inc.php'); - return CORE_database_join_fields($result, $linked); - } + public function view($VAR,$construct,$type) { + include_once(PATH_CORE.'database_view.inc.php'); + return CORE_database_view($VAR,$construct,$type); + } + + public function mass_delete($VAR,$construct,$type) { + include_once(PATH_CORE.'database_mass_delete.inc.php'); + return CORE_database_mass_delete($VAR,$construct,$type); + } + + public function delete($VAR,$construct,$type) { + include_once(PATH_CORE.'database_delete.inc.php'); + return CORE_database_delete($VAR,$construct,$type); + } + + public function join_fields($result,$linked) { + include_once(PATH_CORE.'database_join_fields.inc.php'); + return CORE_database_join_fields($result,$linked); + } // replaced in v1.4.91 (use sqlSelect) - function sql_select($TableList, $FieldList, $Conditions, $Order, &$db) { - return sqlSelect( $db, $TableList, $FieldList, $Conditions, $Order); + # @todo To deprecate + public function sql_select($TableList,$FieldList,$Conditions,$Order,&$db) { + return sqlSelect($db,$TableList,$FieldList,$Conditions,$Order); } /** - * Remove fields from the standard construct type to ingore insert/select/validation rules set in construct + * Remove fields from the standard construct type to ignore insert/select/validation rules set in construct * * @param array $ignore_fields * @param string $construct_fields * @return array */ - function ignore_fields($ignore_fields,$construct_fields) { - if(!is_array($construct_fields)) $fields = explode(",", $construct_fields); else $fields = $construct_fields; - foreach($fields as $id=>$fld) { - if(in_array($fld,$ignore_fields)) { + public function ignore_fields($ignore_fields,$construct_fields) { + if (! is_array($construct_fields)) + $fields = explode(',',$construct_fields); + else + $fields = $construct_fields; + + foreach ($fields as $id=>$fld) + if (in_array($fld,$ignore_fields)) unset($fields[$id]); - } - } - return $fields; + + return $fields; } } - -class CORE_debugger -{ - var $sql_count; - - function sql_count() { - if(!isset($this->sql_count)) $this->sql_count = 0; - $this->sql_count++; +/** + * The main AgileBill CORE Debugger Class + * + * @package AgileBill + * @subpackage Core + */ +class CORE_debugger { + public function alert($message) { + $this->alert = array($message); } - function alert($message) { - $this->alert = Array ($message); - } + public function error($module,$method,$message) { + $this->error = sprintf('%s:%s => %s
    ',$module,$method,$message); + + if (defined('ERROR_REPORTING') && ERROR_REPORTING > 0) + $this->alert($this->error); - function error($module, $method, $message) { - $this->error = $module . ':'. $method . ' =>    ' . $message . '
    '; - if(defined("ERROR_REPORTING") && ERROR_REPORTING > 0) $this->alert($this->error); $db = &DB(); - $this->record_id = $db->GenID(AGILE_DB_PREFIX . "" . 'log_error_id'); - $q = "INSERT INTO ".AGILE_DB_PREFIX."log_error - SET - id = ". $db->qstr($this->record_id).", - date_orig = ". $db->qstr(time()).", - account_id = ". @$db->qstr(SESS_ACCOUNT).", - module = ". $db->qstr($module).", - method = ". $db->qstr($method).", - message = ". $db->qstr($message).", - site_id = ". @$db->qstr(DEFAULT_SITE); - $result = $db->Execute($q); + $result = $db->Execute(sqlInsert($db,'log_error',array('date_orig'=>time(),'account_id'=>SESS_ACCOUNT,'module'=>$module,'method'=>$method,'message'=>$message))); } -} +} - -function &DB($debug=false) { +/** + * The main AgileBill CORE Database Function + */ +function DB($debug=false) { static $saved_db_conn; - if (isset($saved_db_conn) && defined("AGILE_DB_CACHE")) { - #echo 'Cached:
    '.print_r($saved_db_conn,true).'

    '; - if($debug) $saved_db_conn->debug=true; else $saved_db_conn->debug=false; + if (isset($saved_db_conn) && defined('AGILE_DB_CACHE')) { + if ($debug) + $saved_db_conn->debug = true; + else + $saved_db_conn->debug = false; + return $saved_db_conn; } $saved_db_conn = NewADOConnection(AGILE_DB_TYPE); - if(defined("AGILE_DB_PCONNECT") && AGILE_DB_PCONNECT == true) + if (defined('AGILE_DB_PCONNECT') && AGILE_DB_PCONNECT == true) $saved_db_conn->PConnect(AGILE_DB_HOST,AGILE_DB_USERNAME,AGILE_DB_PASSWORD,AGILE_DB_DATABASE); else $saved_db_conn->Connect(AGILE_DB_HOST,AGILE_DB_USERNAME,AGILE_DB_PASSWORD,AGILE_DB_DATABASE); - #echo 'Original:
    '.print_r($saved_db_conn,true).'

    '; - if($debug) $saved_db_conn->debug=true; else $saved_db_conn->debug=false; - return $saved_db_conn; -} + if ($debug) + $saved_db_conn->debug = true; + else + $saved_db_conn->debug = false; -function sqlGenID(&$db, $table) { - return $db->GenID( AGILE_DB_PREFIX . $table . '_id' ); + $saved_db_conn->SetFetchMode(ADODB_FETCH_ASSOC); + + return $saved_db_conn; } -function sqlConditions( &$db, $Conditions=false, $Tables=false ) -{ - $where = " WHERE "; +/** + * Get the next SQL index ID for a table + * + * @param $db + * @param $table + * @return int + */ +function sqlGenID($db,$table) { + $id = 0; - if($Conditions) { - if(preg_match('/::/', $Conditions) ) { - $s = explode('::', $Conditions); - $ii=1; - $Conditions = ''; - for($i=0; $iqstr($s[$i]); - $ii=1; - } - } + # Check if our ID table exists, and if not + static $CACHE = array(); + $dbname = md5($db->databaseType.$db->host.$db->database.$db->user); + + if (! isset($CACHE[$dbname][$table])) { + $CACHE[$dbname][$table] = true; + $rs = $db->Execute(sprintf('SELECT id FROM %s%s_id WHERE 1=0',AGILE_DB_PREFIX,$table)); + + if ($rs) { + $rs = $db->Execute(sprintf('SELECT MAX(id) AS max FROM %s%s',AGILE_DB_PREFIX,$table)); + if ($rs) + $id = $rs->fields['max']+1; } - $where .= $Conditions . " AND "; } - if(!is_array($Tables)) { - $where .= " site_id = ". DEFAULT_SITE; - } else { - $tbarr = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S', 'T','U','V'); - for($i=0; $i 0 ) $where .= " AND "; - $where .= " {$tbarr[$i]}.site_id = ". DEFAULT_SITE; - } - } - - if( $where ) return $where; + return $db->GenID(sprintf('%s%s_id',AGILE_DB_PREFIX,$table),$id); } -function sqlDelete(&$db, $table, $conditions) { - $conditions = sqlConditions( $db, $conditions); - return "DELETE FROM ".AGILE_DB_PREFIX."$table $conditions"; -} +/** + * Generate SQL Conditions for a Query + */ +function sqlConditions($db,$Conditions=false,$Tables=false) { + $db = &DB(); + $where = 'WHERE '; -function sqlInsert(&$db, $table, $fields, $id=false) { - if(!$id) $id = sqlGenID( $db,$table); - $fields['id'] = $id; - if(empty($fields['site_id'])) $fields['site_id'] = DEFAULT_SITE; - $tab = AGILE_DB_PREFIX.''.$table; - return $db->GetInsertSQL($tab, $fields, get_magic_quotes_gpc()); -} + if ($Conditions) { + if (is_array($Conditions)) { + foreach ($Conditions as $a => $b) + if (is_array($b)) + $where .= sprintf("%s IN ('%s') AND ",$a,implode("','",$b)); + elseif ($db->qstr($b) == 'NULL') + $where .= sprintf('%s IS NULL AND ',$a); + else + $where .= sprintf('%s=%s AND ',$a,$db->qstr($b)); -function sqlUpdate(&$db, $table, $fields, $conditions, $force=false) { - $rs = $db->Execute( sqlSelect( $db, $table, '*', $conditions) ); - if(empty($fields['site_id'])) $fields['site_id'] = DEFAULT_SITE; - return $db->GetUpdateSQL( $rs, $fields, false, get_magic_quotes_gpc()); -} + } else { + if (preg_match('/::/',$Conditions)) { + $s = explode('::',$Conditions); + $ii = 1; + $Conditions = ''; -function sqlSelect(&$db, $TableList, $FieldList, $Conditions, $Order=false, $Limit=false, $DISTINCT='', $GroupBy=false ) -{ - ### Table(s) - if(is_array($TableList)) { - $tbarr = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S', 'T','U','V'); - $table = ''; - $site_id_where = ''; - for($i=0;$i0) { - $table .= ",".AGILE_DB_PREFIX.$TableList[$i] . " AS $as"; - } else { - $table .= AGILE_DB_PREFIX.$TableList[$i] . " AS $as"; + for ($i=0; $iqstr($s[$i]); + $ii = 1; + } + } } + + $where .= sprintf('%s AND ',$Conditions); + } + } + + # Add the SITE ID + if (! is_array($Tables) || count($Tables) == 1) { + $where .= sprintf('site_id=%s',DEFAULT_SITE); + + } else { + $tbarr = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V'); + for ($i=0; $i0) + $where .= ' AND '; + + $where .= sprintf(' %s.site_id = %s',$tbarr[$i],DEFAULT_SITE); + } + } + + $where = str_replace('{p}',AGILE_DB_PREFIX,$where); + + return $where; +} + +/** + * Generate SQL to delete from the database + */ +function sqlDelete($db,$table,$where) { + $db = &DB(); + $where = sqlConditions($db,$where); + + return sprintf('DELETE FROM %s%s %s',AGILE_DB_PREFIX,$table,$where); +} + +/** + * Generate SQL to insert into the database + */ +function sqlInsert($db,$table,$FieldList,$id=false) { + $db = &DB(); + + if (! $id) + $id = sqlGenID($db,$table); + + $FieldList['id'] = $id; + if (empty($FieldList['site_id'])) + $FieldList['site_id'] = DEFAULT_SITE; + + $table = AGILE_DB_PREFIX.$table; + return $db->GetInsertSQL($table,$FieldList,get_magic_quotes_gpc()); +} + +/** + * Generate SQL to update records in the database + */ +function sqlUpdate($table,$FieldList,$options=array()) { + $sql = array(); + $force = false; + $db = &DB(); + + # Transition until all calls to sqlUpdate() are changed + # @todo To deprecate + if (func_num_args() >= 4) { + $args = func_get_args(); + $db = array_shift($args); + $table = array_shift($args); + $FieldList = array_shift($args); if (! is_array($FieldList)) $FieldList=array($FieldList); + $options['where'] = array_shift($args); + $options['force'] = count($args) ? array_shift($args) : false; + } + + if (isset($options['force'])) + $force = $options['force']; + if (isset($options['where'])) + $sql['where'] = $options['where']; + + $rs = $db->Execute(sqlSelect($table,'*',$sql)); + return $db->GetUpdateSQL($rs,$FieldList,$force,get_magic_quotes_gpc()); +} + +/** + * Generate SQL to select records from the database + */ +function sqlSelect($TableList,$FieldList,$sql=array()) { + # Transition until all calls to sqlSelect() are changed + # @todo To deprecate + if (func_num_args() >= 4) { + $sql = array(); + + $args = func_get_args(); + $db = array_shift($args); + $TableList = array_shift($args); + $FieldList = array_shift($args); + $sql['where'] = array_shift($args); + $sql['orderby'] = count($args) ? array_shift($args) : ''; + $sql['limit'] = count($args) ? array_shift($args) : 0; + $sql['distinct'] = count($args) ? array_shift($args) : false; + $sql['groupby'] = count($args) ? array_shift($args) : ''; + } + + # Table(s) + if (is_array($TableList)) { + $tbarr = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V'); + $table = ''; + + $i = 0; + foreach ($TableList as $index => $value) { + if ($i++>0) + $table .= ','; + + $table .= sprintf('%s%s AS %s',AGILE_DB_PREFIX,$value,$tbarr[$index]); } } else { $table = AGILE_DB_PREFIX.$TableList; } - ### Field(s) - if(is_array($FieldList)) { - $fields = ''; - for($i=0;$i0) - $fields .= ",".$FieldList[$i]; - else - $fields .= $FieldList[$i]; - } - } else { + # Field(s) + if (isset($sql['distinct']) && $sql['distinct']) + $fields = 'DISTINCT '.$FieldList; + else $fields = $FieldList; - } - ### Condition(s) - $where = sqlConditions( $db, $Conditions, $TableList); + # Condition(s) + $where = sqlConditions($db,$sql['where'],$TableList); - ### Order By - if(!empty($Order)) { - $where .= " ORDER BY $Order "; - } + $line = ''; + # Group By + if (isset($sql['groupby']) && $sql['groupby']) + $line .= sprintf(' GROUP BY %s',$sql['groupby']); - ### Group By - if(!empty($GroupBy)) { - $where .= " GROUP BY $GroupBy "; - } + # Order By + if (isset($sql['orderby']) && $sql['orderby']) + $line .= sprintf(' ORDER BY %s',$sql['orderby']); - $where = str_replace('{p}', AGILE_DB_PREFIX, $where ); + # Limit + if (isset($sql['limit']) && $sql['limit']) + $line .= 'LIMIT '.$sql['limit']; - if(!empty($DISTINCT)) $DISTINCT = 'DISTINCT'; + $SQL = sprintf('SELECT %s FROM %s %s %s',$fields,$table,$where,$line); - return "SELECT $DISTINCT $fields FROM $table $where"; + if (isset($sql['debug'])) + printf('
    %s
    ',$SQL); + + return $SQL; } -?> \ No newline at end of file +?> diff --git a/modules/core/database_add.inc.php b/modules/core/database_add.inc.php index 16f8a5ab..17d00d53 100644 --- a/modules/core/database_add.inc.php +++ b/modules/core/database_add.inc.php @@ -1,216 +1,239 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.94 + * @subpackage Core */ - -function CORE_database_add($VAR, $construct, $type) -{ + +/** + * The main AgileBill CORE Database ADD Method + * + * @uses CORE_validate + * @uses CORE_static_var + * @uses CORE_trigger + */ + +function CORE_database_add($VAR,$construct,$type) { global $C_translate; - # set the field list for this method: - $arr = $construct->method["$type"]; + # Temp during code rework + if (! is_array($construct->val_error)) + $construct->val_error = array(); - # define the validation class - include_once(PATH_CORE . 'validate.inc.php'); - $validate = new CORE_validate; + # Set the field list for this method + $arr = $construct->method[$type]; + + # Define the validation class + include_once(PATH_CORE.'validate.inc.php'); + $validate = new CORE_validate($VAR,$construct->module); $construct->validated = true; + # Quick Validation to see if we have too many variables. + foreach ($VAR as $field_name => $value) + if (preg_match("/^{$construct->module}_/",$field_name)) + if (! in_array(preg_replace("/^{$construct->module}_/",'',$field_name),$arr)) + array_push($construct->val_error,array( + 'field'=>sprintf('%s_%s',$construct->table,$field_name), + 'field_trans'=>$field_name, + 'error'=>sprintf('WARNING: Variable passed to %s but it will be ignored.',__METHOD__), + 'method'=>sprintf('%s:%s(%s)',__FILE__,__METHOD__,__LINE__) + )); - #################################################################### - # loop through the field list to validate the required fields - #################################################################### + # Quick Validation to see if we are missing variables. + foreach ($construct->method[$type] as $field_name) { + $field_var = sprintf('%s_%s',$construct->module,$field_name); - while (list ($key, $value) = each ($arr)) - { - # get the field value - $field_var = $construct->module . '_' . $value; - $field_name = $value; - $construct->validate = true; + if (! array_key_exists($field_var,$VAR)) + array_push($construct->val_error,array( + 'field'=>$field_var, + 'field_trans'=>$field_name, + 'error'=>sprintf('WARNING: Variable NOT passed to %s.',__METHOD__), + 'method'=>sprintf('%s:%s(%s)',__FILE__,__METHOD__,__LINE__) + )); + } - #################################################################### - # perform any field validation... - #################################################################### + # Perform each field validation + while (list($key,$field_name) = each($arr)) { + # Get the field value + $field_var = sprintf('%s_%s',$construct->module,$field_name); - # check if this value is unique - if(isset($construct->field["$value"]["unique"]) && isset($VAR["$field_var"])) - { - if(!$validate->validate_unique($construct->table, $field_name, "record_id", $VAR["$field_var"])) - { + # Check if this value is unique + if (isset($construct->field[$field_name]['unique']) && isset($VAR[$field_var])) { + if (! $validate->validate_unique($construct->table,$field_name,'record_id',$VAR[$field_var])) { $construct->validated = false; - $construct->val_error[] = array('field' => $construct->table . '_' . $field_name, - 'field_trans' => $C_translate->translate('field_' . $field_name, $construct->module, ""), # translate - 'error' => $C_translate->translate('validate_unique',"", "")); + + array_push($construct->val_error,array( + 'field'=>sprintf('%s_%s',$construct->module,$field_name), + 'field_trans'=>$C_translate->translate('field_'.$field_name,$construct->module,''), + 'error'=>$C_translate->translate('validate_unique','',''), + 'method'=>sprintf('%s:%s(%s)',__FILE__,__METHOD__,__LINE__) + )); } } - # check if the submitted value meets the specifed requirements - if(isset($construct->field["$value"]["validate"])) - { - if(isset($VAR["$field_var"])) - { - if($VAR["$field_var"] != '') - { - if(!$validate->validate($field_name, $construct->field["$value"], $VAR["$field_var"], $construct->field["$value"]["validate"])) - { - $construct->validated = false; - $construct->val_error[] = array('field' => $construct->module . '_' . $field_name, - 'field_trans' => $C_translate->translate('field_' . $field_name, $construct->module, ""), - 'error' => $validate->error["$field_name"] ); - } - } - else - { + # Check if the submitted value meets the specifed requirements + if (isset($construct->field[$field_name]['validate'])) { + if (isset($VAR[$field_var]) && ($VAR[$field_var] != '')) { + if (! $validate->validate($field_name,$construct->field[$field_name],$VAR[$field_var],$construct->field[$field_name]['validate'])) { $construct->validated = false; - $construct->val_error[] = array('field' => $construct->module . '_' . $field_name, - 'field_trans' => $C_translate->translate('field_' . $field_name, $construct->module, ""), - 'error' => $C_translate->translate('validate_any',"", "")); + + array_push($construct->val_error,array( + 'field'=>sprintf('%s_%s',$construct->module,$field_name), + 'field_trans'=>$C_translate->translate('field_'.$field_name,$construct->module,''), + 'error'=>$validate->error[$field_name], + 'method'=>sprintf('%s:%s(%s)',__FILE__,__METHOD__,__LINE__) + )); } - } - else - { + + } else { $construct->validated = false; - $construct->val_error[] = array('field' => $construct->module . '_' . $field_name, - 'field_trans' => $C_translate->translate('field_' . $field_name, $construct->module, ""), - 'error' => $C_translate->translate('validate_any',"", "")); + + array_push($construct->val_error,array( + 'field'=>sprintf('%s_%s',$construct->module,$field_name), + 'field_trans'=>$C_translate->translate('field_'.$field_name,$construct->module,''), + 'error'=>$C_translate->translate('validate_any','',''), + 'method'=>sprintf('%s:%s(%s)',__FILE__,__METHOD__,__LINE__) + )); } } } + # Get required static_vars and validate them + require_once(PATH_CORE.'static_var.inc.php'); + $static_var = new CORE_static_var; - #################################################################### - # If validation was failed, skip the db insert & - # set the errors & origonal fields as Smarty objects, - # and change the page to be loaded. - #################################################################### + $all_error = $static_var->validate_form($construct->module,$construct->val_error); - if(!$construct->validated) - { - global $smarty; + if ($all_error != false && gettype($all_error) == 'array') + $construct->validated = false; + else + $construct->validated = true; - # set the errors as a Smarty Object - $smarty->assign('form_validation', $construct->val_error); + /* If validation has failed, skip the db insert & set the errors & original fields as Smarty objects, + and change the page to be loaded.*/ + if (! $construct->validated) { + global $smarty; - # set the page to be loaded - if(!defined("FORCE_PAGE")) - { - define('FORCE_PAGE', $VAR['_page_current']); + # Set the errors as a Smarty Object + $smarty->assign('form_validation',$construct->val_error); + + # Set the page to be loaded + if (! defined('FORCE_PAGE')) + define('FORCE_PAGE',$VAR['_page_current']); + + # Define any triggers + if (isset($construct->trigger[$type])) { + include_once(PATH_CORE.'trigger.inc.php'); + $trigger = new CORE_trigger; + + $trigger->trigger($construct->trigger[$type],0,$VAR); } - # define any triggers - if(isset($construct->trigger["$type"])) - { - include_once(PATH_CORE . 'trigger.inc.php'); - $trigger = new CORE_trigger; - $trigger->trigger($construct->trigger["$type"], 0, $VAR); - } - - # strip slashes + # Strip slashes global $C_vars; $C_vars->strip_slashes_all(); + return false; - } - else - { - # begin the new database class: + + } else { + # Begin the new database class $db = &DB(); - # loop through the field list to create the sql queries - $field_list = ''; - $i = 0; + # Loop through the field list to create the sql queries + $field_list = array(); reset($arr); - while (list ($key, $value) = each ($arr)) - { - # get the field value - $field_var = $construct->module . '_' . $value; - $field_name = $value; - if(isset($VAR["$field_var"])) - { - # check if html allowed: - if(@$construct->field["$value"]["html"] != 1 && !is_array($VAR["$field_var"])) - { - $insert_value = htmlspecialchars($VAR["$field_var"]); - } else { - $insert_value = $VAR["$field_var"]; - } + while (list($key,$field_name) = each($arr)) { + # Get the field value + $field_var = sprintf('%s_%s',$construct->module,$field_name); - # perform data conversions - if(isset( $construct->field["$value"]["convert"] )) - $insert_value = $validate->convert($field_name, $insert_value, $construct->field["$value"]["convert"]); + if (isset($VAR[$field_var])) { + # Check if HTML allowed + if (@$construct->field[$field_name]['html'] != 1 && ! is_array($VAR[$field_var])) + $insert_value = htmlspecialchars($VAR[$field_var]); + else + $insert_value = $VAR[$field_var]; - # create the sql statement - if(!is_null($insert_value)) - $field_list .= ", " . $value . "=" . $db->qstr($insert_value, get_magic_quotes_gpc()); - } - } + # Perform data conversions + if (isset($construct->field[$field_name]['convert'])) + $insert_value = $validate->convert($field_name,$insert_value,$construct->field[$field_name]['convert']); - # add a comma before the site_id if needed - if($field_list != '') - { - $field_list .= ','; - } - - # determine the record id: - $construct->record_id = $db->GenID(AGILE_DB_PREFIX . "" . $construct->table.'_id'); - - # define the new ID as a constant - define(strtoupper('NEW_RECORD_'.$construct->table.'_ID'), $construct->record_id); - - # generate the full query - $q = "INSERT INTO ".AGILE_DB_PREFIX."$construct->table - SET - id = ". $db->qstr($construct->record_id)." - $field_list - site_id = " . $db->qstr(DEFAULT_SITE); - - # execute the query - $result = $db->Execute($q); - - ## echo $q; - - # error reporting: - if ($result === false) - { - global $C_debug; - $C_debug->error('database.inc.php','add', $db->ErrorMsg()); - - if(isset($construct->trigger["$type"])) - { - include_once(PATH_CORE . 'trigger.inc.php'); - $trigger = new CORE_trigger; - $trigger->trigger($construct->trigger["$type"], 0, $VAR); - return false; + # Create the sql statement + if (! is_null($insert_value)) + $field_list[$field_name] = $insert_value; } } - # define any triggers: - if(isset($construct->trigger["$type"])) - { - include_once(PATH_CORE . 'trigger.inc.php'); - $trigger = new CORE_trigger; - $trigger->trigger($construct->trigger["$type"], 1, $VAR); + # Check and see if we have some default fields + foreach (array('date_orig','date_last') as $field_name) { + $field_var = sprintf('%s_%s',$construct->module,$field_name); + + if (isset($construct->field[$field_name]) && ! isset($VAR[$field_var])) + if (isset($construct->field[$field_name]['convert'])) + $field_list[$field_name] = $validate->convert($field_name,time(),$construct->field[$field_name]['convert']); + else + $field_list[$field_name] = time(); } - global $VAR; - $VAR["id"] = $construct->record_id; - @$redirect_page = $VAR['_page']; - if(isset($VAR["_escape"]) || isset($VAR["_escape_next"])) $_escape = '&_escape=1&_escape_next=1'; - define('REDIRECT_PAGE', '?_page=' . $redirect_page . '&id=' . $construct->record_id . '' . @$_escape); + # Determine the record id + $construct->record_id = $db->GenID(AGILE_DB_PREFIX.$construct->table.'_id'); + + # Define the new ID as a constant + define(strtoupper(sprintf('NEW_RECORD_%s_ID',$construct->table)),$construct->record_id); + + # Execute the query + $result = $db->Execute(sqlInsert($db,$construct->table,$field_list,$construct->record_id)); + + # Error reporting + if ($result === false) { + global $C_debug; + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); + + if (isset($construct->trigger[$type])) { + include_once(PATH_CORE.'trigger.inc.php'); + $trigger = new CORE_trigger; + + $trigger->trigger($construct->trigger[$type],0,$VAR); + } + + return false; + } + + # Define any triggers + if (isset($construct->trigger[$type])) { + include_once(PATH_CORE.'trigger.inc.php'); + $trigger = new CORE_trigger; + + $trigger->trigger($construct->trigger[$type],1,$VAR); + } + + # Insert the static vars + $static_var->add($VAR,$construct->module,$construct->record_id); + + $_escape = ''; + if (isset($VAR['_escape']) || isset($VAR['_escape_next'])) + $_escape = '&_escape=1&_escape_next=1'; + + if (! isset($VAR['_noredirect'])) + define('REDIRECT_PAGE',sprintf('?_page=%s&id=%s%s',$VAR['_page'],$construct->record_id,$_escape)); + return $construct->record_id; } } -?> \ No newline at end of file +?> diff --git a/modules/core/database_delete.inc.php b/modules/core/database_delete.inc.php index d7dec3ca..53e907ee 100644 --- a/modules/core/database_delete.inc.php +++ b/modules/core/database_delete.inc.php @@ -1,69 +1,58 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 */ - -function CORE_database_delete($VAR, &$construct, $type) -{ - global $C_debug, $C_translate; - # set the id - $id = $construct->table . '_id'; +/** + * The main AgileBill CORE Database DELETE Method + * + * @package AgileBill + * @subpackage Core:Database + * @uses CORE_Trigger + */ - # generate the full query - $q = "DELETE FROM - ".AGILE_DB_PREFIX."$construct->table - WHERE - id = '".$db->qstr($VAR["id"], get_magic_quotes_gpc())."' - AND - site_id = '" . DEFAULT_SITE . "'"; +function CORE_database_delete($VAR,$construct,$type) { + global $C_debug,$C_translate; - # execute the query $db = &DB(); - $result = $db->Execute($q); + + # Execute the SQL + $result = $db->Execute(sqlDelete($db,$construct->table,array('id'=>$VAR['id']))); # Alert - $C_debug->value["id"] = $VAR[$id]; - $C_debug->value["module_name"] = $C_translate->translate('menu',$construct->module,""); - $alert = $C_translate->translate('alert_delete_id',"",""); - $C_debug->alert($alert); + $C_debug->value['id'] = $VAR[$construct->table.'_id']; + $C_debug->value['module_name'] = $C_translate->translate('menu',$construct->module,''); + $C_debug->alert($C_translate->translate('alert_delete_id','','')); # error reporting - if ($result === false) - { + if ($result === false) { global $C_debug; - $C_debug->error('database.inc.php','delete', $db->ErrorMsg()); + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); + } - if(isset($construct->trigger["$type"])) - { - include_once(PATH_CORE . 'trigger.inc.php'); - $trigger = new CORE_trigger; - $trigger->trigger($construct->trigger["$type"], 0, $VAR); - } - } else { + if (isset($construct->trigger[$type])) { + include_once(PATH_CORE.'trigger.inc.php'); + $trigger = new CORE_trigger; - if(isset($construct->trigger["$type"])) - { - include_once(PATH_CORE . 'trigger.inc.php'); - $trigger = new CORE_trigger; - $trigger->trigger($construct->trigger["$type"], 0, $VAR); - } + $trigger->trigger($construct->trigger[$type],0,$VAR); } } -?> \ No newline at end of file +?> diff --git a/modules/core/database_mass_delete.inc.php b/modules/core/database_mass_delete.inc.php index 05b4f793..8e2fd804 100644 --- a/modules/core/database_mass_delete.inc.php +++ b/modules/core/database_mass_delete.inc.php @@ -1,141 +1,105 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Core */ - -function CORE_database_mass_delete($VAR, &$construct, $type) -{ + +/** + * The main AgileBill CORE Database MASS DELETE Method + * + * @uses CORE_trigger + */ + +function CORE_database_mass_delete($VAR,$construct,$type) { + global $C_auth,$C_debug; + $db = &DB(); - # set the id - $id = $construct->table . '_id'; - # generate the list of ID's - $id_list = ''; - $ii=0; + if (isset($VAR['delete_id'])) + $ids = explode(',',preg_replace('/,$/','',$VAR['delete_id'])); + elseif (isset($VAR['id'])) + $ids = explode(',',preg_replace('/,$/','',$VAR['id'])); - if(isset($VAR["delete_id"])) - { - $id = explode(',',$VAR["delete_id"]); - } - elseif (isset($VAR["id"])) - { - $id = explode(',',$VAR["id"]); - } - - for($i=0; $iqstr($id[$i], get_magic_quotes_gpc()) . " "; - $ii++; - } - else - { - $id_list .= " OR id = " . $db->qstr($id[$i], get_magic_quotes_gpc()) . " "; - $ii++; - } - } - } - - - if($ii>0) - { - # generate the full query - $q = "DELETE FROM - ".AGILE_DB_PREFIX."$construct->table - WHERE - $id_list - AND - site_id = '" . DEFAULT_SITE . "'"; - # execute the query - $result = $db->Execute($q); - - - # error reporting - if ($result === false) - { - global $C_debug; - $C_debug->error('database.inc.php','mass_delete', $db->ErrorMsg()); - - if(isset($construct->trigger["$type"])) - { - include_once(PATH_CORE . 'trigger.inc.php'); - $trigger = new CORE_trigger; - $trigger->trigger($construct->trigger["$type"], 0, $VAR); - } + # Check and see if the user is authorised to delete this records + foreach ($ids as $i => $id) { + $groups = $db->Execute(sqlSelect($db,'account_group','group_id',array('account_id'=>$id),'group_id')); + $group = array(); + while (! $groups->EOF) { + array_push($group,$groups->fields['group_id']); + $groups->MoveNext(); } - else - { + # Verify the user has access to view this account + foreach ($group as $gid) { + if (! $C_auth->auth_group_by_id($gid)) { + unset($ids[$i]); + break; + } + } + } + # Nothing to delete + if (! count($ids)) + return false; - ### Delete any associated records: - if(isset($construct->associated_DELETE)) - { + # Execute the query + $result = $db->Execute(sqlDelete($db,$construct->table,array('id'=>$ids))); - for($ii=0; $iiassociated_DELETE); $ii++) - { - $id_list = ''; - for($i=0; $iassociated_DELETE[$ii]["field"] ." = " . $db->qstr($id[$i], get_magic_quotes_gpc()) . " "; - } - else - { - $id_list .= " OR " . $construct->associated_DELETE[$ii]["field"] . " = " . $db->qstr($id[$i], get_magic_quotes_gpc()) . " "; - } - } - } + # Error reporting + if ($result === false) { + $C_debug->error(__FILE__,__METHOD__, $db->ErrorMsg()); - # generate the full query - $q = "DELETE FROM - ".AGILE_DB_PREFIX."". $construct->associated_DELETE[$ii]["table"] . " - WHERE - $id_list - AND - site_id = '" . DEFAULT_SITE . "'"; - # execute the query - $result = $db->Execute($q); + if (isset($construct->trigger[$type])) { + include_once(PATH_CORE.'trigger.inc.php'); + $trigger = new CORE_trigger; + + $trigger->trigger($construct->trigger[$type],0,$VAR); + } + + } else { + # Delete any associated records + if (isset($construct->associated_DELETE) && is_array($construct->associated_DELETE) && count($construct->associated_DELETE)) { + foreach ($construct->associated_DELETE as $assoc) { + $db->Execute(sqlDelete($db,$assoc['table'],array($assoc['field']=>$ids))); + + # Alert delete message + if (! defined('AJAX')) { + global $C_translate; + + $C_translate->value['CORE']['module_name'] = $C_translate->translate('name',$construct->module,''); + $message = $C_translate->translate('alert_delete_ids','CORE',''); + $message = str_replace('%%module_name%%','', $message); + $C_debug->alert($message); + } + + if (isset($construct->trigger[$type])) { + include_once(PATH_CORE.'trigger.inc.php'); + $trigger = new CORE_trigger; + + $trigger->trigger($construct->trigger[$type],1,$VAR); } } - - # Alert delete message - if(!defined('AJAX')) { - global $C_debug, $C_translate; - $C_translate->value["CORE"]["module_name"] = $C_translate->translate('name',$construct->module,""); - $message = $C_translate->translate('alert_delete_ids',"CORE",""); - $message = ereg_replace('%%module_name%%','', $message); - $C_debug->alert($message); - } - - if(isset($construct->trigger["$type"])) - { - include_once(PATH_CORE . 'trigger.inc.php'); - $trigger = new CORE_trigger; - $trigger->trigger($construct->trigger["$type"], 1, $VAR); - } } } -} -?> \ No newline at end of file + + return $result; +} +?> diff --git a/modules/core/database_search.inc.php b/modules/core/database_search.inc.php index aab78040..3cf9a6b6 100644 --- a/modules/core/database_search.inc.php +++ b/modules/core/database_search.inc.php @@ -1,316 +1,282 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Core */ - -function CORE_database_search($VAR, &$construct, $type) -{ - $db = &DB(); - include_once(PATH_CORE . 'validate.inc.php'); + +/** + * The main AgileBill CORE Database SEARCH Method + * + * @uses CORE_validate + * @uses CORE_trigger + * @uses CORE_search + */ + +function CORE_database_search($VAR,$construct,$type) { + global $C_list; + + include_once(PATH_CORE.'validate.inc.php'); $validate = new CORE_validate; - # set the search criteria array + $db = &DB(); + + # Set the search criteria array $arr = $VAR; - # loop through the submitted field_names to get the WHERE statement + # Loop through the submitted field_names to get the WHERE statement $where_list = ''; $i=0; - while (list ($key, $value) = each ($arr)) - { - if($i == 0) - { - if($value != '') - { - $pat = "^" . $construct->module . "_"; - if(eregi($pat, $key)) - { - $field = eregi_replace($pat,"",$key); - if(eregi('%',$value)) - { - # do any data conversion for this field (date, encrypt, etc...) - if(isset($construct->field["$field"]["convert"])) - { - $value = $validate->convert($field, $value, $construct->field["$field"]["convert"]); - } + $pat = sprintf('/^%s_/',$construct->module); + while (list($key,$value) = each($arr)) { + if ($value != '') { + if (preg_match($pat,$key)) { + $field = preg_replace($pat,'',$key); - $where_list .= " WHERE " . $field . " LIKE " . $db->qstr($value, get_magic_quotes_gpc()); - $i++; - } + if (! is_array($value) && preg_match('/%/',$value)) { + # Do any data conversion for this field (date, encrypt, etc...) + if (isset($construct->field[$field]['convert'])) + $value = $validate->convert($field,$value,$construct->field[$field]['convert']); + + if ($i) + $where_list .= sprintf(' AND %s LIKE %s ',$field,$db->qstr($value,get_magic_quotes_gpc())); else - { - # check if array - if(is_array($value)) - { - for($i_arr=0; $i_arr < count($value); $i_arr++) - { - if($value["$i_arr"] != '') - { - # determine any field options (=, >, <, etc...) - $f_opt = '='; - $pat_field = $construct->module.'_'.$field; - $VAR['field_option']["$pat_field"]["$i_arr"]; - if(isset($VAR['field_option']["$pat_field"]["$i_arr"])) - { - $f_opt = $VAR['field_option']["$pat_field"]["$i_arr"]; - # error checking, safety precaution - if($f_opt != '=' && $f_opt != '>' && $f_opt != '<' && $f_opt != '>=' && $f_opt != '<=' && $f_opt != '!=') - $f_opt = '='; - } + $where_list .= sprintf(' WHERE %s LIKE %s',$field,$db->qstr($value,get_magic_quotes_gpc())); - # do any data conversion for this field (date, encrypt, etc...) - if(isset($construct->field["$field"]["convert"])) - { - $value["$i_arr"] = $validate->convert($field, $value["$i_arr"], $construct->field["$field"]["convert"]); - } + $i++; + } else { + # Check if array + if (is_array($value)) { + for ($i_arr=0; $i_arr, <, etc...) + $f_opt = '='; + $pat_field = sprintf('%s_%s',$construct->module,$field); - if($i_arr == 0) - { - $where_list .= " WHERE " . $field . " $f_opt " . $db->qstr($value["$i_arr"], get_magic_quotes_gpc()); - $i++; - } - else - { - $where_list .= " AND " . $field . " $f_opt " . $db->qstr($value["$i_arr"], get_magic_quotes_gpc()); - $i++; - } - } + if (isset($VAR['field_option'][$pat_field][$i_arr])) { + $f_opt = $VAR['field_option'][$pat_field][$i_arr]; + # Error checking, safety precaution + if (! in_array($f_opt,array('=','>','<','>=','<=','!='))) + $f_opt = '='; + } + + # Do any data conversion for this field (date, encrypt, etc...) + if (isset($construct->field[$field]['convert'])) + $value[$i_arr] = $validate->convert($field,$value[$i_arr],$construct->field[$field]['convert']); + + if (($i_arr == 0) && ($i==0)) + $where_list .= sprintf(' WHERE %s %s %s',$field,$f_opt,$db->qstr($value[$i_arr],get_magic_quotes_gpc())); + else + $where_list .= sprintf(' AND %s %s %s',$field,$f_opt,$db->qstr($value[$i_arr],get_magic_quotes_gpc())); + + $i++; } } + + } else { + if ($i) + $where_list .= sprintf(' AND %s=%s ',$field,$db->qstr($value,get_magic_quotes_gpc())); else - { - $where_list .= " WHERE " . $field . " = " . $db->qstr($value, get_magic_quotes_gpc()); - $i++; - } - } - } - } - } - else - { - if($value != '') - { - $pat = "^" . $construct->module . "_"; - if(eregi($pat, $key)) - { - $field = eregi_replace($pat,"",$key); - if(eregi('%',$value)) - { - # do any data conversion for this field (date, encrypt, etc...) - if(isset($construct->field["$field"]["convert"])) - { - $value = $validate->convert($field, $value, $construct->field["$field"]["convert"]); - } + $where_list .= sprintf(' WHERE %s=%s',$field,$db->qstr($value,get_magic_quotes_gpc())); - $where_list .= " AND " . $field . " LIKE " . $db->qstr($value, get_magic_quotes_gpc()); - $i++; - } - else - { - # check if array - if(is_array($value)) - { - for($i_arr=0; $i_arr < count($value); $i_arr++) - { - if($value["$i_arr"] != '') - { - # determine any field options (=, >, <, etc...) - $f_opt = '='; - $pat_field = $construct->module.'_'.$field; - if(isset($VAR['field_option']["$pat_field"]["$i_arr"])) - { - $f_opt = $VAR['field_option']["$pat_field"]["$i_arr"]; - - # error checking, safety precaution - if($f_opt != '=' && $f_opt != '>' && $f_opt != '<' && $f_opt != '>=' && $f_opt != '<=' && $f_opt != '!=') - $f_opt = '='; - } - - # do any data conversion for this field (date, encrypt, etc...) - if(isset($construct->field["$field"]["convert"])) - { - $value["$i_arr"] = $validate->convert($field, $value["$i_arr"], $construct->field["$field"]["convert"]); - } - - $where_list .= " AND " . $field . " $f_opt " . $db->qstr($value["$i_arr"], get_magic_quotes_gpc()); - $i++; - } - } - } - else - { - $where_list .= " AND " . $field . " = ". $db->qstr($value, get_magic_quotes_gpc()); - $i++; - } + $i++; } } } } } + # Some table joins + $join_table = ''; + if (isset($VAR['join']) && is_array($VAR['join'])) + foreach ($VAR['join'] as $table => $joins) + if ($C_list->is_installed($table)) { - #### finalize the WHERE statement - if($where_list == '') - { + include_once(PATH_MODULES.sprintf('%s/%s.inc.php',$table,$table)); + $join = new $table; + + if (method_exists($join,'sql_join')) { + foreach ($joins as $jointable => $id) + $q_join .= $join->sql_join($jointable,$id); + + $join_table .= sprintf(',%s%s',AGILE_DB_PREFIX,$jointable); + } + + if ($where_list) + $where_list .= sprintf(' AND %s',$q_join); + else + $where_list .= sprintf(' WHERE %s',$q_join); + } + + # Finalize the WHERE statement + if ($where_list == '') $where_list .= ' WHERE '; - } else - { $where_list .= ' AND '; - } - - # get limit type - if(isset($VAR['limit'])) - { + # Get limit type + if (isset($VAR['limit'])) $limit = $VAR['limit']; - } else - { $limit = $construct->limit; - } - # get order by - if(isset($VAR['order_by'])) - { + # Get order by + if (isset($VAR['order_by'])) $order_by = $VAR['order_by']; - } else - { $order_by = $construct->order_by; - } - ### Get any addition fields to select: - if(isset($construct->custom_EXP)) - { - for($ei=0; $eicustom_EXP); $ei++) - { - if($ei == 0) - $field_list = "," . $construct->custom_EXP[$ei]['field']; + # Get any addition fields to select: + if (isset($construct->custom_EXP)) + for ($ei=1; $eicustom_EXP); $ei++) + $field_list = sprintf(',%s',$construct->custom_EXP[$ei]['field']); + + # Get any static vars to search + $join_list = ''; + $pre = AGILE_DB_PREFIX; + if (! empty($VAR['static_relation']) && count($VAR['static_relation']>0)) { + while (list($idx,$value) = each($VAR['static_relation'])) { + if ($value != '') { + $join_list .= sprintf(" INNER JOIN %sstatic_var_record AS s%s ON (s%s.record_id=%s%s.id AND s%s.static_var_relation_id='%s' AND s%s.site_id=%s AND", + $pre,$idx,$idx,$pre,$this->table,$idx,$idx,$idx,$db->qstr(DEFAULT_SITE)); + + if(preg_match('/%/',$value)) + $join_list .= sprintf(' s%s.value LIKE %s',$idx,$db->qstr($VAR['static_relation'][$idx])); + else + $join_list .= sprintf(' s%s.value = %s',$idx,$db->qstr($VAR['static_relation'][$idx])); + + $join_list .= ') '; + } } } +/* + # standard where list + $q .= $join_list . $where_list ." ".AGILE_DB_PREFIX."account.site_id = " . $db->qstr(DEFAULT_SITE); + + # Code for member group + if(!empty($VAR['account_group'])) { + $q .= " AND ".AGILE_DB_PREFIX."account_group.group_id = " . $db->qstr($VAR['account_group'])." + AND ".AGILE_DB_PREFIX."account_group.site_id = " . $db->qstr(DEFAULT_SITE); + } + if(!empty($VAR['account_group'])) { + $q_save .= " LEFT JOIN ".AGILE_DB_PREFIX."account_group ON ".AGILE_DB_PREFIX."account_group.account_id = ".AGILE_DB_PREFIX."account.id "; + + if(!empty($join_list)) + $q_save .= $join_list; + + $q_save .= $where_list ." %%whereList%% "; + $q_save .= AGILE_DB_PREFIX."account_group.group_id = " . $db->qstr($VAR['account_group'])." AND "; + } else { + if(!empty($join_list)) + $q_save .= $join_list; + + $q_save .= $where_list ." %%whereList%% "; + } +*/ + # generate the full query - $q = "SELECT id".$field_list." FROM - ".AGILE_DB_PREFIX."$construct->table - $where_list - site_id = '" . DEFAULT_SITE . "'"; + $q = sprintf('SELECT %s%s.id AS id%s FROM %s%s %s %s %s%s.site_id=%s', + AGILE_DB_PREFIX,$construct->table,$field_list, + AGILE_DB_PREFIX,$construct->table,$join_table, + $where_list,AGILE_DB_PREFIX,$construct->table,DEFAULT_SITE); + $q_save = "SELECT %%fieldList%% FROM %%tableList%% $join_table".$where_list." %%whereList%% "; + $result = $db->Execute($q); - $q_save = "SELECT %%fieldList%% FROM %%tableList%% ".$where_list." %%whereList%% "; - - - - $result = $db->Execute($q); - - - //////////////// DEBUG //// - #echo "
    $q
    "; - #exit; - - # error reporting - if ($result === false) - { + # Error reporting + if ($result === false) { global $C_debug; - $C_debug->error('database.inc.php','search', $db->ErrorMsg()); + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); - if(isset($construct->trigger["$type"])) - { - include_once(PATH_CORE . 'trigger.inc.php'); - $trigger = new CORE_trigger; - $trigger->trigger($construct->trigger["$type"], 0, $VAR); + if (isset($construct->trigger[$type])) { + include_once(PATH_CORE.'trigger.inc.php'); + $trigger = new CORE_trigger; + $trigger->trigger($construct->trigger[$type],0,$VAR); } - return; + return; } - # get the result count: + # Get the result count: $results = $result->RecordCount(); - # get the first record id: - if($results == 1) $record_id = $result->fields['id']; + # Get the first record id: + if ($results == 1) + $record_id = $result->fields['id']; - ### Run any custom validation on this result for - ### this module - if(isset($construct->custom_EXP)) - { + # Run any custom validation on this result for this module + if (isset($construct->custom_EXP)) { $results = 0; - while(!$result->EOF) - { - for($ei=0; $eicustom_EXP); $ei++) - { - $field = $construct->custom_EXP[$ei]["field"]; - $value = $construct->custom_EXP[$ei]["value"]; - if($result->fields["$field"] == $value) - { - //$result->MoveNext(); + + while (! $result->EOF) { + for ($ei=0; $eicustom_EXP); $ei++) { + $field = $construct->custom_EXP[$ei]['field']; + $value = $construct->custom_EXP[$ei]['value']; + + if ($result->fields[$field] == $value) { $ei = count($construct->custom_EXP); - $results++; - } + $results++; + } } + $result->MoveNext(); } } - - # define the DB vars as a Smarty accessible block + # Define the DB vars as a Smarty accessible block global $smarty; # Create the definition for fast-forwarding to a single record: if ($results == 1 && !isset($construct->fast_forward)) - { - $smarty->assign('record_id', $record_id); - } + $smarty->assign('record_id',$record_id); # create the search record: - if($results > 0) - { + if ($results > 0) { # create the search record - include_once(PATH_CORE . 'search.inc.php'); + include_once(PATH_CORE.'search.inc.php'); $search = new CORE_search; - $arr['module'] = $construct->module; + $arr['module'] = $construct->module; $arr['sql'] = $q_save; - $arr['limit'] = $limit; + $arr['limit'] = $limit; $arr['order_by']= $order_by; $arr['results'] = $results; $search->add($arr); # define the search id and other parameters for Smarty - $smarty->assign('search_id', $search->id); - + $smarty->assign('search_id',$search->id); # page: - $smarty->assign('page', '1'); - + $smarty->assign('page','1'); # limit: - $smarty->assign('limit', $limit); - + $smarty->assign('limit',$limit); # order_by: - $smarty->assign('order_by', $order_by); + $smarty->assign('order_by',$order_by); } - # define the result count - $smarty->assign('results', $results); + $smarty->assign('results',$results); - if(isset($construct->trigger["$type"])) - { - include_once(PATH_CORE . 'trigger.inc.php'); - $trigger = new CORE_trigger; - $trigger->trigger($construct->trigger["$type"], 1, $VAR); + if (isset($construct->trigger[$type])) { + include_once(PATH_CORE.'trigger.inc.php'); + $trigger = new CORE_trigger; + $trigger->trigger($construct->trigger[$type],1,$VAR); } } -?> \ No newline at end of file +?> diff --git a/modules/core/database_search_form.inc.php b/modules/core/database_search_form.inc.php index 7da75866..1fa5cc4e 100644 --- a/modules/core/database_search_form.inc.php +++ b/modules/core/database_search_form.inc.php @@ -31,18 +31,20 @@ function CORE_database_search_form($VAR, $construct, $type) while (list ($key, $value) = each ($arr)) { $field_list["$i"]['translate'] = $C_translate->translate('field_' . $value, $construct->module, ""); + if (! $field_list["$i"]['translate']) + $field_list["$i"]['translate'] = sprintf('field_%s',$value); $field_list["$i"]['field'] = $value; $i++; } # define the field list as a Smarty accessible array - $smarty->assign($construct->module, $field_list); + $smarty->assign('field_list',$field_list); # define the default ORDER BY field - $smarty->assign($construct->module . '_order_by', $construct->order_by); + $smarty->assign('field_order_by',$construct->order_by); # define the default LIMIT count - $smarty->assign($construct->module . '_limit', $construct->limit); + $smarty->assign('field_limit',$construct->limit); # define the recent search menu & javascript include_once(PATH_CORE . 'search.inc.php'); @@ -66,4 +68,4 @@ function CORE_database_search_form($VAR, $construct, $type) # send the finished SAVED SEARCH JavaScript to Smarty $smarty->assign($construct->module . "_saved_js", $search->saved_js); } -?> \ No newline at end of file +?> diff --git a/modules/core/database_search_show.inc.php b/modules/core/database_search_show.inc.php index c6190376..13719354 100644 --- a/modules/core/database_search_show.inc.php +++ b/modules/core/database_search_show.inc.php @@ -1,75 +1,72 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Core */ - -function CORE_database_search_show($VAR, &$construct, $type) -{ - # set the field list for this method: +/** + * The main AgileBill CORE Database SEARCH_SHOW Method + * + * @uses CORE_search + * @uses CORE_trigger + */ + +function CORE_database_search_show($VAR, &$construct, $type) { + # Set the field list for this method: $arr = $construct->method[$type]; $field_list = ''; + $construct->linked = array(); + $i=0; - while (list ($key, $value) = each ($arr)) - { - if($i == 0) - { - $field_var = $construct->table . '_' . $value; - $field_list .= AGILE_DB_PREFIX . $construct->table . "." . $value; + while (list($key,$value) = each($arr)) { + $field_var = sprintf('%s_%s',$construct->table,$value); - // determine if this record is linked to another table/field - if($construct->field[$value]["asso_table"] != "") - { - $construct->linked[] = array('field' => $value, 'link_table' => $construct->field[$value]["asso_table"], 'link_field' => $construct->field[$value]["asso_field"]); - } - } + if ($i == 0) + $field_list .= sprintf('%s%s.%s',AGILE_DB_PREFIX,$construct->table,$value); else - { - $field_var = $construct->table . '_' . $value; - $field_list .= "," . AGILE_DB_PREFIX . $construct->table . "." . $value; + $field_list .= sprintf(',%s%s.%s',AGILE_DB_PREFIX,$construct->table,$value); + + # Determine if this record is linked to another table/field + if ($construct->field[$value]['asso_table'] != '') + array_push($construct->linked,array('field'=>$value,'link_table'=>$construct->field[$value]['asso_table'],'link_field'=>$construct->field[$value]['asso_field'])); - // determine if this record is linked to another table/field - if($construct->field[$value]["asso_table"] != "") - { - $construct->linked[] = array('field' => $value, 'link_table' => $construct->field[$value]["asso_table"], 'link_field' => $construct->field[$value]["asso_field"]); - } - } $i++; } - - # get the search details: - if(isset($VAR['search_id'])) - { - include_once(PATH_CORE . 'search.inc.php'); + # Get the search details: + if (isset($VAR['search_id'])) { + include_once(PATH_CORE.'search.inc.php'); $search = new CORE_search; - $search->get($VAR['search_id']); - } - else - { - # invalid search! - echo '
    The search terms submitted were invalid!
    '; # translate... # alert - if(isset($construct->trigger["$type"])) - { - include_once(PATH_CORE . 'trigger.inc.php'); - $trigger = new CORE_trigger; - $trigger->trigger($construct->trigger["$type"], 0, $VAR); + $search->get($VAR['search_id']); + + } else { + # Invalid search! + echo '
    The search terms submitted were invalid!
    '; + + if (isset($construct->trigger[$type])) { + include_once(PATH_CORE.'trigger.inc.php'); + $trigger = new CORE_trigger; + + $trigger->trigger($construct->trigger[$type],0,$VAR); } } @@ -77,176 +74,179 @@ function CORE_database_search_show($VAR, &$construct, $type) if ($search->session != SESS && $search->account != SESS_ACCOUNT) { global $C_debug; $C_debug->alert('You are not authorized to view this search!'); + return false; } - # get the sort order details: - if(isset($VAR['order_by']) && $VAR['order_by'] != "") - { - $order_by = ' ORDER BY ' . $VAR['order_by']; - $smarty_order = $VAR['order_by']; - } - else - { - $order_by = ' ORDER BY ' . $construct->order_by; - $smarty_order = $search->order_by; + # Get the sort order details: + if (isset($VAR['order_by']) && $VAR['order_by'] != '') { + $order_by = sprintf(' ORDER BY %s',$VAR['order_by']); + + $smarty_order = $VAR['order_by']; + + } else { + $order_by = sprintf(' ORDER BY %s',$construct->order_by); + $smarty_order = $search->order_by; } - - # determine the sort order - if(isset($VAR['desc'])) { + # Determine the sort order + if (isset($VAR['desc'])) { $order_by .= ' DESC'; $smarty_sort = 'desc='; - } else if(isset($VAR['asc'])) { + + } elseif (isset($VAR['asc'])) { $order_by .= ' ASC'; $smarty_sort = 'asc='; + } else { - if (!eregi('date',$smarty_order)) { + if (! preg_match('/date/',$smarty_order)) { $order_by .= ' ASC'; $smarty_sort = 'asc='; - } else { + + } else { $order_by .= ' DESC'; $smarty_sort = 'desc='; } - } + } + # Generate the full query + $db = &DB(); - # generate the full query - $db = &DB(); - $q = eregi_replace("%%fieldList%%", $field_list, $search->sql); - $q = eregi_replace("%%tableList%%", AGILE_DB_PREFIX.$construct->table, $q); - $q = eregi_replace("%%whereList%%", "", $q); - $q .= " site_id = '" . DEFAULT_SITE . "'"; + $q = str_replace('%%fieldList%%',$field_list,$search->sql); + $q = str_replace('%%tableList%%',AGILE_DB_PREFIX.$construct->table,$q); + $q = str_replace('%%whereList%%','',$q); + + $q .= sprintf(' %s.site_id = %s',AGILE_DB_PREFIX.$construct->table,DEFAULT_SITE); $q .= $order_by; - /////////////////////// + # Determine the offset & limit + $current_page = 1; + $offset = -1; - # determine the offset & limit - $current_page=1; - $offset=-1; - if (!empty($VAR['page'])) $current_page = $VAR['page']; - if (empty($search->limit)) $search->limit=25; - if($current_page>1) $offset = (($current_page * $search->limit) - $search->limit); - $result = $db->SelectLimit($q, $search->limit, $offset); + if (! empty($VAR['page'])) + $current_page = $VAR['page']; + if (empty($search->limit)) + $search->limit=25; - # error reporting - if ($result === false) - { + if ($current_page>1) + $offset = (($current_page*$search->limit)-$search->limit); + + $result = $db->SelectLimit($q,$search->limit,$offset); + + # Error reporting + if ($result === false) { global $C_debug; - $C_debug->error('database.inc.php','search', $db->ErrorMsg()); + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); - if(isset($construct->trigger["$type"])) - { - include_once(PATH_CORE . 'trigger.inc.php'); - $trigger = new CORE_trigger; - $trigger->trigger($construct->trigger["$type"], 0, $VAR); + if (isset($construct->trigger[$type])) { + include_once(PATH_CORE.'trigger.inc.php'); + $trigger = new CORE_trigger; + + $trigger->trigger($construct->trigger[$type],0,$VAR); } - return; + + return; } + # Run any custom validation on this result for this module + $i = 0; + $class_name = true; + if (isset($construct->custom_EXP)) { + while (! $result->EOF) { + for ($ei=0; $eicustom_EXP); $ei++) { + $field = $construct->custom_EXP[$ei]['field']; + $value = $construct->custom_EXP[$ei]['value']; - ### Put the results into a smarty accessable array - ### Run any custom validation on this result for - ### this module - if(isset($construct->custom_EXP)) - { - $i=0; - $class_name = TRUE; - $results = 0; - while(!$result->EOF) - { - for($ei=0; $eicustom_EXP); $ei++) - { - $field = $construct->custom_EXP[$ei]["field"]; - $value = $construct->custom_EXP[$ei]["value"]; - if($result->fields["$field"] == $value) - { + if ($result->fields[$field] == $value) { $smart[$i] = $result->fields; - if($class_name) - { + if ($class_name) { $smart[$i]['_C'] = 'row1'; - $class_name = FALSE; + $class_name = false; } else { $smart[$i]['_C'] = 'row2'; - $class_name = TRUE; - } - $i++; + $class_name = true; + } + + $i++; $ei = count($construct->custom_EXP); - $results++; - } - } + } + } + $result->MoveNext(); } - } - else - { - $i=0; - $class_name = TRUE; - while (!$result->EOF) { + + } else { + while (! $result->EOF) { $smart[$i] = $result->fields; - if($class_name) - { + if ($class_name) { $smart[$i]['_C'] = 'row1'; - $class_name = FALSE; + $class_name = false; } else { $smart[$i]['_C'] = 'row2'; - $class_name = TRUE; + $class_name = true; } + $result->MoveNext(); $i++; } } - # get any linked fields - if($i > 0) { + # Get any linked fields + if ($i > 0) { $db_join = new CORE_database; $construct->result = $db_join->join_fields($smart, $construct->linked); + } else { $construct->result = $smart; - } + } - # get the result count: + # Get the result count: $results = $result->RecordCount(); # define the DB vars as a Smarty accessible block global $smarty; # define the results - $smarty->assign($construct->table, $construct->result); - $smarty->assign('page', $VAR['page']); - $smarty->assign('order', $smarty_order); - $smarty->assign('sort', $smarty_sort); - $smarty->assign('limit', $search->limit); + $smarty->assign('search_show',$construct->result); + $smarty->assign('page',$VAR['page']); + $smarty->assign('order',$smarty_order); + $smarty->assign('sort',$smarty_sort); + $smarty->assign('limit',$search->limit); $smarty->assign('search_id',$search->id); - $smarty->assign('results', $search->results); + $smarty->assign('results',$search->results); # get the total pages for this search: if (empty($search->limit)) $construct->pages = 1; else $construct->pages = intval($search->results / $search->limit); - if ($search->results % $search->limit) $construct->pages++; - # total pages - $smarty->assign('pages', $construct->pages); + if ($search->results % $search->limit) + $construct->pages++; - # current page - $smarty->assign('page', $current_page); - $page_arr = ''; - for($i=0; $i <= $construct->pages; $i++) - if ($construct->page != $i) $page_arr[] = $i; + # Total pages + $smarty->assign('pages',$construct->pages); - # page array for menu - $smarty->assign('page_arr', $page_arr); + # Current page + $smarty->assign('page',$current_page); - if(isset($construct->trigger["$type"])) - { - include_once(PATH_CORE . 'trigger.inc.php'); - $trigger = new CORE_trigger; - $trigger->trigger($construct->trigger["$type"], 1, $VAR); - } - return $construct->result; + $page_arr = array(); + for ($i=0; $i<=$construct->pages; $i++) + if ($construct->page != $i) + array_push($page_arr,$i); + + # Page array for menu + $smarty->assign('page_arr',$page_arr); + + if(isset($construct->trigger[$type])) { + include_once(PATH_CORE.'trigger.inc.php'); + $trigger = new CORE_trigger; + + $trigger->trigger($construct->trigger[$type],1,$VAR); + } + + return $construct->result; } -?> \ No newline at end of file +?> diff --git a/modules/core/database_update.inc.php b/modules/core/database_update.inc.php index 779e0f62..5af4090d 100644 --- a/modules/core/database_update.inc.php +++ b/modules/core/database_update.inc.php @@ -1,226 +1,200 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Core */ - -function CORE_database_update($VAR, &$construct, $type) -{ + +/** + * The main AgileBill CORE Database UPDATE Method + * + * @uses CORE_validate + * @uses CORE_trigger + */ + +function CORE_database_update($VAR,$construct,$type) { global $C_translate; - # set the field list for this method: - $arr = $construct->method["$type"]; + # Temp during code rework + if (! is_array($construct->val_error)) + $construct->val_error = array(); - # define the validation class - include_once(PATH_CORE . 'validate.inc.php'); - $validate = new CORE_validate; + # Set the field list for this method + $arr = $construct->method[$type]; - $construct->validated = true; + # Define the validation class + include_once(PATH_CORE.'validate.inc.php'); + $validate = new CORE_validate($VAR,$construct->module); + $construct->validated = true; - # define this record id - $id = $VAR[$construct->module . '_id']; + # Quick Validation to see if we have too many variables. + foreach ($VAR as $field_name => $value) + if (preg_match("/^{$construct->module}_/",$field_name)) + if (! in_array(preg_replace("/^{$construct->module}_/",'',$field_name),$arr)) + array_push($construct->val_error,array( + 'field'=>sprintf('%s_%s',$construct->table,$field_name), + 'field_trans'=>$field_name, + 'error'=>sprintf('WARNING: Variable passed to %s but it will be ignored.',__METHOD__), + 'method'=>sprintf('%s:%s(%s)',__FILE__,__METHOD__,__LINE__) + )); - #################################################################### - # loop through the field list to validate the required fields - #################################################################### + # Define this record id + $id = $VAR[$construct->module.'_id']; - while (list ($key, $value) = each ($arr)) - { - # get the field value - $field_var = $construct->module . '_' . $value; - $field_name = $value; - $construct->validate = true; + # Perform each field validation + while (list($key,$field_name) = each($arr)) { + # Get the field value + $field_var = sprintf('%s_%s',$construct->module,$field_name); - - #################################################################### - # perform any field validation... - #################################################################### - - # check if the conversion type required is not one ignored on updates: + # Check if the conversion type required is not one ignored on updates $ignore_con = false; - $ignore_convert = Array('sha', 'md5','rc5','crypt'); - for ($ic=0; $ic < count($ignore_convert); $ic++) - { - if (isset($construct->field["$value"]["convert"])) - if ($construct->field["$value"]["convert"] == $ignore_convert[$ic]) $ignore_con = true; - } + $ignore_convert = array('sha','md5','rc5','crypt'); + for ($ic=0; $icfield[$field_name]['convert'])) + if ($construct->field[$field_name]['convert'] == $ignore_convert[$ic]) + $ignore_con = true; - if(!$ignore_con) - { + if (! $ignore_con) { # check if this value is unique - if(isset($construct->field["$value"]["unique"])) - { - if(isset($VAR["$field_var"])) - { - if(!$validate->validate_unique($construct->table, $field_name, $id, $VAR["$field_var"])) - { - $construct->validated = false; - $construct->val_error[] = array('field' => $construct->module . '_' . $field_name, - 'field_trans' => $C_translate->translate('field_' . $field_name, $construct->module, ""), # translate - 'error' => $C_translate->translate('validate_unique',"", "")); - } - } + if (isset($construct->field[$field_name]['unique']) && isset($VAR[$field_var])) { + if (! $validate->validate_unique($construct->table,$field_name,$id,$VAR[$field_var])) { + $construct->validated = false; + + array_push($construct->val_error,array( + 'field'=>sprintf('%s_%s',$construct->module,$field_name), + 'field_trans'=>$C_translate->translate('field_'.$field_name,$construct->module,''), + 'error'=>$C_translate->translate('validate_unique','',''), + 'method'=>sprintf('%s:%s(%s)',__FILE__,__METHOD__,__LINE__) + )); + } } - # check if the submitted value meets the specifed requirements - if(isset($construct->field["$value"]["validate"])) - { - if(isset($VAR["$field_var"])) - { - if($VAR["$field_var"] != '') - { - if(!$validate->validate($field_name, $construct->field["$value"], $VAR["$field_var"], $construct->field["$value"]["validate"])) - { - $construct->validated = false; - $construct->val_error[] = array('field' => $construct->module . '_' . $field_name, - 'field_trans' => $C_translate->translate('field_' . $field_name, $construct->module, ""), - 'error' => $validate->error["$field_name"] ); - } - } - else - { + # Check if the submitted value meets the specifed requirements + if (isset($construct->field[$field_name]['validate'])) { + if (isset($VAR[$field_var]) && ($VAR[$field_var] != '')) { + if (! $validate->validate($field_name,$construct->field[$field_name],$VAR[$field_var],$construct->field[$field_name]['validate'])) { $construct->validated = false; - $construct->val_error[] = array('field' => $construct->module . '_' . $field_name, - 'field_trans' => $C_translate->translate('field_' . $field_name, $construct->module, ""), - 'error' => $C_translate->translate('validate_any',"", "")); + + array_push($construct->val_error,array( + 'field'=>sprintf('%s_%s',$construct->module,$field_name), + 'field_trans'=>$C_translate->translate('field_'.$field_name,$construct->module,''), + 'error'=>$validate->error[$field_name], + 'method'=>sprintf('%s:%s(%s)',__FILE__,__METHOD__,__LINE__) + )); } - } - else - { + + } else { $construct->validated = false; - $construct->val_error[] = array('field' => $construct->module. '_' . $field_name, - 'field_trans' => $C_translate->translate('field_' . $field_name, $construct->module, ""), - 'error' => $C_translate->translate('validate_any',"", "")); + + array_push($construct->val_error,array( + 'field'=>sprintf('%s_%s',$construct->module,$field_name), + 'field_trans'=>$C_translate->translate('field_'.$field_name,$construct->module,''), + 'error'=>$C_translate->translate('validate_any','',''), + 'method'=>sprintf('%s:%s(%s)',__FILE__,__METHOD__,__LINE__) + )); } } } } + /* If validation has failed, skip the db insert & set the errors & original fields as Smarty objects, + and change the page to be loaded.*/ + if (! $construct->validated) { + global $smarty; + # Set the errors as a Smarty Object + $smarty->assign('form_validation',$construct->val_error); + # Change the page to be loaded + $VAR['_page'] = $construct->module.':view'; - #################################################################### - # If validation was failed, skip the db insert & - # set the errors & origonal fields as Smarty objects, - # and change the page to be loaded. - #################################################################### + # Define any triggers + if (isset($construct->trigger[$type])) { + include_once(PATH_CORE.'trigger.inc.php'); + $trigger = new CORE_trigger; - if(!$construct->validated) - { - global $smarty; - - # set the errors as a Smarty Object - $smarty->assign('form_validation', $construct->val_error); - - # change the page to be loaded - global $VAR; - $VAR['_page'] = $construct->module . ':view'; - - if(isset($construct->trigger["$type"])) - { - include_once(PATH_CORE . 'trigger.inc.php'); - $trigger = new CORE_trigger; - $trigger->trigger($construct->trigger["$type"], 0, $VAR); + $trigger->trigger($construct->trigger[$type],0,$VAR); } - # strip slashes + # Strip slashes global $C_vars; $C_vars->strip_slashes_all(); - return false; - } - else - { + + return false; + + } else { + # Begin the new database class $db = &DB(); - $field_list = ''; - $i = 0; + + # Loop through the field list to create the sql queries + $field_list = array(); reset($arr); - while (list ($key, $value) = each ($arr)) - { - # get the field value - $field_var = $construct->module . '_' . $value; - $field_name = $value; + while (list($key,$field_name) = each($arr)) { + # Get the field value + $field_var = sprintf('%s_%s',$construct->module,$field_name); - if(isset($VAR["$field_var"]) && $VAR["$field_var"] != 'IGNORE-ARRAY-VALUE') - { - # check if html allowed: - if(@$construct->field["$value"]["html"] != 1 && !is_array($VAR["$field_var"])) - $insert_value = htmlspecialchars($VAR["$field_var"]); + if (isset($VAR[$field_var]) && $VAR[$field_var] != 'IGNORE-ARRAY-VALUE') { + # Check if HTML allowed + if (@$construct->field[$field_name]['html'] != 1 && ! is_array($VAR[$field_var])) + $insert_value = htmlspecialchars($VAR[$field_var]); else - $insert_value = $VAR["$field_var"]; + $insert_value = $VAR[$field_var]; - # perform data conversions - if(isset($construct->field["$value"]["convert"] )) - $insert_value = $validate->convert($field_name, $insert_value, $construct->field["$value"]["convert"]); + # Perform data conversions + if (isset($construct->field[$field_name]['convert']) && trim($construct->field[$field_name]['convert'])) + $insert_value = $validate->convert($field_name,$insert_value,$construct->field[$field_name]['convert']); - if($i == 0) - $field_list .= $value . "=" . $db->qstr($insert_value, get_magic_quotes_gpc()); - else - $field_list .= ", " . $value . "=" . $db->qstr($insert_value, get_magic_quotes_gpc()); - $i++; - } - elseif ( @$construct->field["$value"]["convert"] == "array" && @$VAR["$field_var"] != 'IGNORE-ARRAY-VALUE') - { - # Handle blank array string... - $insert_value = serialize(Array("")); - if($i == 0) - $field_list .= $value . "=" . $db->qstr($insert_value, get_magic_quotes_gpc()); - else - $field_list .= ", " . $value . "=" . $db->qstr($insert_value, get_magic_quotes_gpc()); - $i++; - } + $field_list[$field_name] = $insert_value; + + } elseif (@$construct->field[$field_name]['convert'] == 'array' && @$VAR[$field_var] != 'IGNORE-ARRAY-VALUE') + # Handle blank array string + $field_list[$field_name] = serialize(array()); } - # generate the full query - $q = "UPDATE " . AGILE_DB_PREFIX . "$construct->table SET - $field_list - WHERE - id = ". $db->qstr($id) ." - AND - site_id = " . $db->qstr(DEFAULT_SITE); - # execute the query - $db = &DB(); - $result = $db->Execute($q); + # Execute the query + $result = $db->Execute(sqlUpdate($db,$construct->table,$field_list,array('id'=>$id))); - # echo "
    $q
    "; - - # error reporting - if ($result === false) - { + # Error reporting + if ($result === false) { global $C_debug; - $C_debug->error('database.inc.php','update', $db->ErrorMsg()); + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); - if(isset($construct->trigger["$type"])) - { - include_once(PATH_CORE . 'trigger.inc.php'); - $trigger = new CORE_trigger; - $trigger->trigger($construct->trigger["$type"], 0, $VAR); + if (isset($construct->trigger[$type])) { + include_once(PATH_CORE.'trigger.inc.php'); + $trigger = new CORE_trigger; + + $trigger->trigger($construct->trigger[$type],0,$VAR); } - return false; + + return false; + } - else - { - if(isset($construct->trigger["$type"])) - { - include_once(PATH_CORE . 'trigger.inc.php'); - $trigger = new CORE_trigger; - $trigger->trigger($construct->trigger["$type"], 1, $VAR); - } - return true; + # Define any triggers + if (isset($construct->trigger[$type])) { + include_once(PATH_CORE.'trigger.inc.php'); + $trigger = new CORE_trigger; + + $trigger->trigger($construct->trigger[$type],1,$VAR); } - } + + return true; + } } -?> \ No newline at end of file +?> diff --git a/modules/core/database_view.inc.php b/modules/core/database_view.inc.php index 3927deeb..55810c6e 100644 --- a/modules/core/database_view.inc.php +++ b/modules/core/database_view.inc.php @@ -1,170 +1,111 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Core */ - -function CORE_database_view($VAR, &$construct, $type) -{ + +/** + * The main AgileBill CORE Database VIEW Method + * + * This function should only return 1 record. + * + * @uses CORE_trigger + * @uses CORE_static_var + */ + +function CORE_database_view($VAR,$construct,$type) { + require_once(PATH_CORE.'static_var.inc.php'); + + # Some Validaiton + if (! isset($VAR['id'])) + return; + + # If we have more than 1 entry, then return. Javascript should bring us back with 1 entry to view. + if (count(explode(',',preg_replace('/,$/','',$VAR['id']))) > 1) + return; + + # Set our db. $db = &DB(); - # set the field list for this method: - $arr = $construct->method[$type]; + $result = $db->Execute(sqlSelect($db,$construct->table,implode(',',$construct->method[$type]),array('id'=>$VAR['id']),$construct->order_by)); - # loop through the field list to create the sql queries - $field_list = ''; - $i=0; - while (list ($key, $value) = each ($arr)) - { - if($i == 0) - { - $field_var = $construct->table . '_' . $value; - $field_list .= $value; + # Error reporting + if ($result === false) { + global $C_debug; + + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); + + if (isset($construct->trigger[$type])) { + include_once(PATH_CORE.'trigger.inc.php'); + $trigger = new CORE_trigger; + + $trigger->trigger($construct->trigger[$type],0,$VAR); } - else - { - $field_var = $construct->table . '_' . $value; - $field_list .= "," . $value; - } - $i++; + + return; + + # No results: + } elseif (! $result->RecordCount()) { + global $C_debug; + $C_debug->error(__FILE__,__METHOD__,'The selected record does not exist any longer, or your account is not authorized to view it'); + + return; } - if(isset($VAR["id"])) - { - $id = explode(',',$VAR["id"]); - for($i=0; $iqstr($id[$i])." "; - $ii++; - } - else - { - $id_list .= " OR id = " .$db->qstr($id[$i]). " "; - $ii++; - } - } - } - } + # Get the static vars + $static_var = new CORE_static_var; + $arr = $static_var->update_form($construct->module,'update',$result->fields['id']); + if (is_array($arr)) + $smart['static_var'] = $arr; - if($ii>0) - { - # generate the full query - $q = "SELECT - $field_list - FROM - ".AGILE_DB_PREFIX."$construct->table - WHERE - $id_list - AND site_id = '" . DEFAULT_SITE . "' - ORDER BY $construct->order_by "; + # Run any custom validation on this result for this module + if (isset($construct->custom_EXP)) { + for ($ei=0; $eicustom_EXP); $ei++) { + $field = $construct->custom_EXP[$ei]['field']; + $value = $construct->custom_EXP[$ei]['value']; - $result = $db->Execute($q); + if ($result->fields[$field] == $value) { + $smart = $result->fields; - /////////////////////// - # echo $q; - # echo "
    " . $db->ErrorMsg(); - - # error reporting - if ($result === false) - { - global $C_debug; - $C_debug->error('database.inc.php','view', $db->ErrorMsg()); - - if(isset($construct->trigger["$type"])) - { - include_once(PATH_CORE . 'trigger.inc.php'); - $trigger = new CORE_trigger; - $trigger->trigger($construct->trigger["$type"], 0, $VAR); - } - return; - } - - # put the results into a smarty accessable array - $i=0; - $class_name = TRUE; - while (!$result->EOF) - { - ### Run any custom validation on this result for - ### this module - if(isset($construct->custom_EXP)) - { - for($ei=0; $eicustom_EXP); $ei++) - { - $field = $construct->custom_EXP[$ei]["field"]; - $value = $construct->custom_EXP[$ei]["value"]; - if($result->fields["$field"] == $value) - { - $smart[$i] = $result->fields; - if($class_name) - { - $smart[$i]["i"] = $i; - } else { - $smart[$i]["i"] = $i; - } - $result->MoveNext(); - $ei = count($construct->custom_EXP); - $i++; - } - } $result->MoveNext(); - } - else - { - $smart[$i] = $result->fields; - if($class_name) - { - $smart[$i]["i"] = $i; - } else { - $smart[$i]["i"] = $i; - } - $result->MoveNext(); - $i++; + $ei = count($construct->custom_EXP); } } - # get the result count: - $results = $i; - - ### No results: - if($i == 0) - { - global $C_debug; - $C_debug->error("CORE:database.inc.php", "view()", "The selected record does not - exist any longer, or your account is not authorized to view it"); - return; - } - - # define the results - global $smarty; - $smarty->assign($construct->table, $smart); - $smarty->assign('results', $search->results); - - if(isset($construct->trigger["$type"])) - { - include_once(PATH_CORE . 'trigger.inc.php'); - $trigger = new CORE_trigger; - $trigger->trigger($construct->trigger["$type"], 1, $VAR); - } - - return $smart; + } else { + $smart = $result->fields; } + + # Define the results + global $smarty; + $smarty->assign('record',$smart); + + if (isset($construct->trigger[$type])) { + include_once(PATH_CORE.'trigger.inc.php'); + $trigger = new CORE_trigger; + + $trigger->trigger($construct->trigger[$type],1,$VAR); + } + + # Return the retrieved records + return $smart; } -?> \ No newline at end of file +?> diff --git a/modules/core/email.inc.php b/modules/core/email.inc.php index fa78f701..780280af 100644 --- a/modules/core/email.inc.php +++ b/modules/core/email.inc.php @@ -1,249 +1,217 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Core */ - - -/* - Email Handler Class - This class handles the interface to SMPT and Mail() functions. - - $arr = Array( - 'from_html' => 'true/false' (so we know whether to stripslashes or not) - 'html' => '0/1', - 'from_name' => '', - 'from_email' => '', - 'priority' => '0/1', - 'to_email' => 'email@email.com', - 'to_name' => '', - 'bcc_list' => Array('email@email.com'), - 'cc_list' => Array('email@email.com'), - 'subject' => '', - 'body_text' => '', - 'body_html' => '', - 'attachments' => Array(Array('file' => 'file.exe', - 'data' => 'file data here...')) - 'server' => 'mail.domain.com', - 'account' => '', - 'password' => ''); +/** + * The main AgileBill CORE Mail Class + * + * This class handles the interface to SMTP and Mail() functions. + * + * + * $arr = array( + * 'from_html' => 'true/false' (so we know whether to stripslashes or not) + * 'html' => '0/1', + * 'from_name' => '', + * 'from_email' => '', + * 'priority' => '0/1', + * 'to_email' => 'email@email.com', + * 'to_name' => '', + * 'bcc_list' => array('email@email.com'), + * 'cc_list' => array('email@email.com'), + * 'subject' => '', + * 'body_text' => '', + * 'body_html' => '', + * 'attachments' => array(array('file' => 'file.exe', + * 'data' => 'file data here...')) + * 'server' => 'mail.domain.com', + * 'account' => '', + * 'password' => ''); + * + * + * @package AgileBill + * @subpackage Core */ -class CORE_email -{ +class CORE_email { var $debug=false; - function PHP_Mail($arr) - { - ### SET THE SMTP SETTINGS - #ini_set('sendmail_from', @$arr['from_email']); - #ini_set('SMTP', @$arr['server']); + public function PHP_Mail($arr) { + # SET THE SMTP SETTINGS + #ini_set('sendmail_from',@$arr['from_email']); + #ini_set('SMTP',@$arr['server']); - ### CC LIST - if(isset($arr['cc_list']) == 'array') - { - if(count($arr['cc_list'] > 0)) - { - $cc = ''; - for($i=0; $i',$arr['from_name'],$arr['from_email'])."\r\n"; + $headers .= sprintf('Reply-To: "%s" <%s>',$arr['from_name'],$arr['from_email'])."\r\n"; + + # HTML/non-HTML version of body & headers + $headers .= "MIME-Version: 1.0\r\n"; + if (isset($arr['html']) && $arr['html'] == '1' && isset($arr['body_html'])) { + # Specify MIME version 1.0 + $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; + $body = $arr['body_html']; + + } else { + # Specify MIME version 1.0 + $headers .= "Content-type: text/plain; charset=iso-8859-1\r\n"; + $body = $arr['body_text']; } - ### BCC LIST - if(isset($arr['bcc_list']) == 'array') - { - if(count($arr['bcc_list'] > 0)) - { - $bcc = ''; - for($i=0; $i\r \n"; - $headers .= "Reply-To: \"".$arr['from_name']."\" <".$arr['from_email'].">\r \n"; - - # html/non-html version of body & headers - if(isset($arr['html']) && $arr['html'] == '1' && isset($arr['body_html'])) - { - ### specify MIME version 1.0 - $headers .= "MIME-Version: 1.0\r \n"; - $headers .= "Content-type: text/html; charset=iso-8859-1\r \n"; - $body = $arr['body_html']; - } - else - { - ### specify MIME version 1.0 - $headers .= "MIME-Version: 1.0\r \n"; - $headers .= "Content-type: text/plain; charset=iso-8859-1\r \n"; - $body = $arr['body_text']; - } - - - ### CC: - if(isset($cc)) - $headers .= "Cc: ".$cc."\r \n"; - - ### BCC: - if(isset($bcc)) - $headers .= "Bcc: ".$bcc."\r \n"; + # BCC: + if (trim($bcc)) + $headers .= sprintf('Bcc: %s',$bcc)."\r\n"; ### PRIORITY if(isset($arr['priority']) && $arr['priority'] == '1') - $headers .= "X-Priority: 1"; + $headers .= "X-Priority: 1\r\n"; else - $headers .= "X-Priority: 3"; + $headers .= "X-Priority: 3\r\n"; - - /* - echo "
    ";
    -		echo print_r($arr);
    -		echo $headers;
    -		echo $body;
    -		*/
    -
    -		### Strip Slashes
    -		if (!isset($arr['from_html']) || @$arr['html_form'] == false) {
    -			# from database, we must strip slashes
    +		# Strip Slashes
    +		if (! isset($arr['from_html']) || @$arr['html_form'] == false) {
    +			# From database, we must strip slashes
     			$arr['subject'] = stripslashes($arr['subject']);
    -			$body           = stripslashes($body);
    +			$body = stripslashes($body);
    +
     		} elseif (@$arr['from_html'] == true && get_magic_quotes_gpc()) {
    -			# straight from html, we must strip slashes
    +			# Straight from html, we must strip slashes
     			$arr['subject'] = stripslashes($arr['subject']);
    -			$body           = stripslashes($body);
    +			$body = stripslashes($body);
     		}
     
    -		if($this->debug)
    -		{
    -			if(mail($arr['to_email'], $arr['subject'], $body, $headers)) {
    +		if ($this->debug) {
    +			if (mail($arr['to_email'],$arr['subject'],$body,$headers)) {
     				global $C_debug;
    -				$message = 'PHP mail() failed to send message "'.$arr['subject'].'" to "'.$arr['to_email'].'"';
    -				$C_debug->alert('CORE:email.inc.php','SMTP_Mail', $message);
    -				return false;
    -			}
    -		}
    -		else
    -		{
    -			if(@mail($arr['to_email'], $arr['subject'], $body, $headers)) {
    -				global $C_debug;
    -				$message = 'PHP mail() failed to send message "'.$arr['subject'].'" to "'.$arr['to_email'].'"';
    +				$C_debug->alert(__FILE__,__METHOD__,sprintf('PHP mail() failed to send message "%s" to "%s"',$arr['subject'],$arr['to_email']));
    +
    +				return false;
    +			}
    +
    +		} else {
    +			if (@mail($arr['to_email'],$arr['subject'],$body,$headers)) {
    +				global $C_debug;
    +				$C_debug->alert(__FILE__,__METHOD__,sprintf('PHP mail() failed to send message "%s" to "%s"',$arr['subject'],$arr['to_email']));
    +
     				return false;
     			}
     		}
    +
     		return true;
     	}
     
    -
    -
    -	function SMTP_Mail($arr)
    -	{
    -		### include the phpmailer class
    -		require_once(PATH_INCLUDES."phpmailer/class.phpmailer.php");
    +	public function SMTP_Mail($arr) {
    +		# Include the phpmailer class
    +		require_once(PATH_INCLUDES.'phpmailer/class.phpmailer.php');
     		$mail = new PHPMailer();
    +
     		$mail->IsSMTP();
    -		$mail->SMTPAuth     = true;
    -		$mail->Host         = @$arr['server'];
    -		$mail->Username     = @$arr['account'];
    -		$mail->Password     = @$arr['password'];
    -		$mail->From         = $arr['from_email'];
    -		$mail->FromName     = $arr['from_name'];
    -		$mail->AddAddress($arr['to_email'], @$arr['to_name']);
    +		$mail->SMTPAuth = true;
    +		$mail->Host = @$arr['server'];
    +		$mail->Username = @$arr['account'];
    +		$mail->Password = @$arr['password'];
    +		$mail->From = $arr['from_email'];
    +		$mail->FromName = $arr['from_name'];
    +		$mail->AddAddress($arr['to_email'],@$arr['to_name']);
     		#$mail->AddReplyTo($arr['from_name'], $arr['from_email']);
     
    +		# CC LIST
    +		if (isset($arr['cc_list']) && is_array($arr['cc_list']))
    +			foreach ($arr['cc_list'] as $email)
    +				$mail->AddCC($email,'');
     
    -		### CC LIST
    -		if(is_array(@$arr['cc_list']))
    -			for($i=0; $iAddCC($arr['cc_list'][$i], "");
    +		# BCC LIST
    +		if (isset($arr['bcc_list']) && is_array($arr['bcc_list']))
    +			foreach ($arr['bcc_list'] as $email)
    +				$mail->AddBCC($email,'');
     
    -		### BCC LIST
    -		if(is_array(@$arr['bcc_list']))
    -			for($i=0; $iAddBCC($arr['bcc_list'][$i], "");
    -
    -		### Strip Slashes
    -		if (empty($arr['from_html']) || @$arr['html_form'] == false) {
    -			# from database, we must strip slashes
    -			$arr['subject']   = stripslashes($arr['subject']);
    +		# Strip Slashes
    +		if (! isset($arr['from_html']) || @$arr['html_form'] == false) {
    +			# From database, we must strip slashes
    +			$arr['subject'] = stripslashes($arr['subject']);
     			@$arr['body_html'] = stripslashes($arr['body_html']);
     			@$arr['body_text'] = stripslashes($arr['body_text']);
    +
     		} elseif (@$arr['from_html'] == true && get_magic_quotes_gpc()) {
    -			# straight from html, we must strip slashes
    +			# Straight from html, we must strip slashes
     			$arr['subject'] = stripslashes($arr['subject']);
     			@$arr['body_html'] = stripslashes($arr['body_html']);
     			@$arr['body_text'] = stripslashes($arr['body_text']);
     		}
     
    -		# html/non-html version of body & headers
    -		if(isset($arr['html']) && $arr['html'] == '1' && isset($arr['body_html'])) {
    +		# HTML/non-HTML version of body & headers
    +		if (isset($arr['html']) && $arr['html'] == '1' && isset($arr['body_html'])) {
     			$mail->IsHTML(true);
    -			$mail->Body     =  @$arr['body_html'];
    -			$mail->AltBody  =  @$arr['body_text'];
    -		}  else  {
    +			$mail->Body = @$arr['body_html'];
    +			$mail->AltBody = @$arr['body_text'];
    +
    +		} else {
     			$mail->IsHTML(false);
    -			$mail->Body     =  @$arr['body_text'];
    +			$mail->Body = @$arr['body_text'];
     			$mail->WordWrap = 50;
     		}
     
    -		# subject
    -		$mail->Subject  =  $arr['subject'];
    +		# Subject
    +		$mail->Subject = $arr['subject'];
     
     		# PRIORITY
     		if(isset($arr['priority']) && $arr['priority'] == '1')
    -		$mail->Priority = 1;
    +			$mail->Priority = 1;
     		else
    -		$mail->Priority = 3;
    +			$mail->Priority = 3;
     
    -
    -		/* attachments
    +		/* Attachments
     		$mail->AddAttachment("/var/tmp/file.tar.gz");
     		$mail->AddAttachment("/tmp/image.jpg", "new.jpg");
     		*/
     
    -		if(!$mail->Send())
    -		{
    -			if($this->debug) {
    -				global $C_debug;
    -				$message = 'SMTP mail() failed to send message "'.$arr['subject'].'" to "'.$arr['to_email'].'" on server "'.$arr['server'].'"';
    -				$C_debug->error('CORE:email.inc.php','SMTP_Mail', $message . ' ---- '.$mail->ErrorInfo);
    -				echo "Message was not sent 

    "; - echo "Mailer Error: " . $mail->ErrorInfo; - } else { - global $C_debug; - $message = 'SMTP mail() failed to send message "'.$arr['subject'].'" to "'.$arr['to_email'].'" on server "'.$arr['server'].'"'; - $C_debug->error('CORE:email.inc.php','SMTP_Mail', $message. ' ---- '.$mail->ErrorInfo); + if (! $mail->Send()) { + global $C_debug; + $C_debug->error(__FILE__,__METHOD__,sprintf('SMTP mail() failed to send message "%s" to "%s" on server "%s" (%s)', + $arr['subject'],$arr['to_email'],$arr['server'],$mail->ErrorInfo)); + + if ($this->debug) { + echo 'Message was not sent

    '; + printf('Mailer Error: %s',$mail->ErrorInfo); } - return false; + + return false; } + return true; } } -?> \ No newline at end of file +?> diff --git a/modules/core/list.inc.php b/modules/core/list.inc.php index db0db994..8a9c104c 100644 --- a/modules/core/list.inc.php +++ b/modules/core/list.inc.php @@ -1,58 +1,102 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Core */ - -class CORE_list -{ - var $id; - function menu($input_id, $name, $table, $field, $id, $class, $all=false) { +/** + * The main AgileBill CORE List Class + * + * @package AgileBill + * @subpackage Core + */ +class CORE_list { + private $id = 100; + + /** + * @todo deprecite this function - replace with mmenu() + */ + public function menu($input_id,$name,$table,$field,$default,$class,$all=false) { + $this->mmenu($input_id,$name,$table,$field,$default,'',$class,$all); + } + + /** + * Generate a select list, using the values in a table + * + * @param string $input_id HTML id="" value. + * + If 'no', then a hot click img wont be included + * + If 'all', then a blank item will be included + * @param string $name HTML name="" value. + * @param string $table Table to query for a list of items. + * @param string $field Column to query for a list of items. + * @param string $default Default Value to pre-select (if it exists) + * + If 'all', then a blank item will be included + * @param string|array $where SQL where conditions + * @param string $class CSS class for the select list + * @param bool $all If true, then a blank item will be included. + * + * @todo Remove the many ways of selecting all + */ + public function mmenu($input_id,$name,$table,$field,$default,$where,$class,$all=false) { global $C_translate; - if($all == true || $id == 'all') $all = true; - if(!isset($this->id)) $this->id = 100; - if($input_id <= 0 && $input_id != 'no') $input_id = $this->id++; + + $noicon = false; + + if ($input_id == 'no') { + $input_id = ''; + $noicon = true; + } + + if (! $input_id) + $input_id = sprintf('%s_%s_%s',$table,$field,$this->id++); + $db = &DB(); - $sql= "SELECT id, $field FROM ".AGILE_DB_PREFIX."$table WHERE site_id = '" . DEFAULT_SITE . "' ORDER BY $field"; - $result = $db->Execute($sql); - if ($result === false) - { + $result = $db->Execute(sqlSelect($db,$table,sprintf('id,%s',$field),$where,$field)); + if ($result === false) { global $C_debug; - $C_debug->error('list.inc.php','menu', $db->ErrorMsg()); + + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); + } else { - $return = '',$input_id,$name,$class); + + if ($all) + $return .= ''; + $i = 0; - while (!$result->EOF) { - $return .= ' - '; - $i++; + while (! $result->EOF) { + $return .= sprintf('',$result->fields['id'],($default == $result->fields['id']) ? ' selected="selected"' : '',$result->fields[$field]); $result->MoveNext(); + + $i++; } - if($i==0) - $return .= ''; + $return .= ''; - if($i > 0 && $input_id != 'no') - $return .= ' '; + + if ($i==0) + $return = $C_translate->translate('lists_none_defined'); + + if ($i > 0 && ! $noicon) + $return .= sprintf(' Zoom',THEME_NAME,$table,$input_id); + echo $return; } } @@ -66,25 +110,190 @@ class CORE_list include_once(PATH_MODULES . 'account_billing/account_billing.inc.php'); $acct_bill = new account_billing; echo $acct_bill->menu_admin($field, $account, $default, $class, $user); - } + } function menu_multi($default, $name, $table, $field, $id, $max, $class) { - include_once(PATH_CORE . 'list_menu_multi.inc.php'); - echo list_menu_multi($default, $name, $table, $field, $id, $max, $class); + include_once(PATH_CORE.'list_menu_multi.inc.php'); + echo list_menu_multi($default, $name, $table, $field, $id, $max, $class); } function menu_files($id, $name, $default, $path, $pre, $ext, $class) { - include_once(PATH_CORE . 'list_menu_files.inc.php'); + include_once(PATH_CORE.'list_menu_files.inc.php'); echo list_menu_files($id, $name, $default, $path, $pre, $ext, $class); } + /** + * Generate a list of frequently used selections in OSB + * + * @param string $type List type + * @param string $input_id HTML id="" value. + * @param string $name HTML name="" value. + * @param string $default Default Value to pre-select (if it exists) + * @param string $class CSS class for the select list + * @param bool $all If true, then a blank item will be included. + */ + public function menu_staticlist($type,$input_id,$name,$default,$class,$all=false) { + global $C_list; + + # Whether the values are also keys. + $nokeys = false; + $list = array(); + + switch ($type) { + case 'assoc_grant_type': + $list = array(0=>_('Grant access for specified amount of days'),1=>_('Grant access while associated subscription is active'),2=>_('Grant access forerver')); + break; + + case 'assoc_prod_type': + $list = array(0=>_('Require All Selected Products'),1=>_('Require Any One Selected Product')); + break; + + case 'charge_sweep': + $list = array(0=>_('Daily'),1=>_('Weekly'),2=>_('Monthly'),3=>_('Quarterly'),4=>_('Semi-Annually'),5=>_('Annually'),6=>_('Service Rebill')); + break; + + case 'commissiontype': + $list = array(0=>_('None'),1=>_('Percentage Based'),2=>('Flat Rate')); + break; + + # @todo To deprecate this and standardise with commissiontype + case 'discounttype': + $list = array(0=>_('Percentage Based'),1=>('Flat Rate')); + break; + + case 'copluginmode': + $list = array(0=>_('Test'),1=>_('Live')); + break; + + case 'domaintype': + $list = array( + 'register'=>_('Register'), + 'transfer'=>_('Transfer'), + 'park'=>_('Park') + ); + + break; + + case 'email_piping': + $list = array(0=>' ',1=>'POP',2=>'IMAP'); + break; + + case 'email_piping_action': + $list = array(0=>_('Leave message in mailbox'),1=>_('Delete message from mailbox')); + break; + + case 'invoice_delivery': + $list = array(0=>_('None'),1=>_('E-Mail'),2=>_('Print')); + break; + + case 'invoice_show_itemized': + $list = array(0=>_('Overview Only'),1=>_('Full Detail')); + break; + + case 'nametitle': + $list = array(_('Mr'),_('Ms'),_('Mrs'),_('Miss'),_('Dr'),_('Prof')); + $nokeys = true; + break; + + case 'os': + $list = array(0=>'Linux',1=>'Windows'); + break; + + case 'recur_schedule': + $list = array(0=>_('Weekly'),1=>_('Monthly'),2=>_('Quarterly'),3=>_('Semi-Annually'),4=>_('Annually'),5=>_('Two years'),6=>_('Three Years')); + break; + + case 'recur_type': + $list = array(0=>_('Bill on Aniversary Date of Subscription'),1=>_('Bill on Fixed Schedule')); + break; + + case 'pricetype': + $list = array(0=>_('One-time Charge'),1=>_('Recurring Membership/Subscription'),2=>_('Trial for Membership/Subscription')); + break; + + case 'servicetype': + if ($C_list->is_installed('host_server')) { + $list['host'] = _('Hosting'); + $list['host_group'] = _('Hosting & Group Access'); + $list['domain'] = _('Domain Name'); + } + $list['none'] = _('Recurring Only'); + + break; + + case 'servicequeue': + $list = array( + 'new'=>_('Add New'), + 'active'=>_('Activate'), + 'inactive'=>_('Deactivate'), + 'delete'=>_('Delete'), + 'edit'=>_('Edit/Update'), + 'queue_none'=>_('None') + ); + + break; + + case 'statictype': + $list = array( + 'small_text'=>_('Small Text'), + 'medium_text'=>_('Medium Text'), + 'large_text'=>_('Large Text'), + 'dropdown_list'=>_('Dropdown List'), + 'calendar'=>_('Calendar'), + 'file_upload'=>_('File Upload'), + 'status'=>_('Status'), + 'checkbox'=>_('Checkbox'), + 'hidden'=>_('Hidden') + ); + break; + + case 'tasktype': + $list = array(0=>_('Internal Method'),1=>_('System Call')); + break; + + case 'trial_length': + $list = array(0=>_('Days'),1=>_('Weeks'),2=>_('Months')); + break; + + default: return sprintf('Unknown staticlist: %s',$type); + } + + # If id is blank, we'll just return the value + if (! $input_id) + return $list[$default]; + + $return = sprintf(''; + + return $return; + } + function format_currency ($number, $currency_id) { - if(empty($number)) $number = 0; + if(empty($number)) $number = 0; if(empty($currency_id)) $currency_id = DEFAULT_CURRENCY; if(!isset($this->format_currency[$currency_id])) $this->currency($currency_id); if($currency_id != DEFAULT_CURRENCY) - if(!isset($this->format_currency[DEFAULT_CURRENCY])) - $this->currency(DEFAULT_CURRENCY); + if(!isset($this->format_currency[DEFAULT_CURRENCY])) + $this->currency(DEFAULT_CURRENCY); $number *= $this->format_currency[DEFAULT_CURRENCY]["convert"][$currency_id]["rate"]; if($number > .05 || $number == 0 || $number < -1) return $this->format_currency[$currency_id]["symbol"] @@ -93,33 +302,33 @@ class CORE_list else return $this->format_currency[$currency_id]["symbol"] . "" . number_format($number, 3) . " " - . $this->format_currency[$currency_id]["iso"]; + . $this->format_currency[$currency_id]["iso"]; } function format_currency_num ($number, $currency_id) { - if(empty($number)) $number = 0; + if(empty($number)) $number = 0; if(empty($currency_id)) $currency_id = DEFAULT_CURRENCY; if(!isset($this->format_currency[$currency_id])) $this->currency($currency_id); - if(!isset($this->format_currency[DEFAULT_CURRENCY])) $this->currency(DEFAULT_CURRENCY); + if(!isset($this->format_currency[DEFAULT_CURRENCY])) $this->currency(DEFAULT_CURRENCY); $number *= $this->format_currency[DEFAULT_CURRENCY]["convert"][$currency_id]["rate"]; if($number > .05 || $number == 0 || $number < -1) return $this->format_currency[$currency_id]["symbol"] . number_format($number, DEFAULT_DECIMAL_PLACE); else - return $this->format_currency[$currency_id]["symbol"] . number_format($number, 3); - } + return $this->format_currency[$currency_id]["symbol"] . number_format($number, 2); + } function format_currency_decimal ($number, $currency_id) { if(empty($number)) return 0; if(empty($currency_id)) $currency_id = DEFAULT_CURRENCY; if(!isset($this->format_currency[$currency_id])) $this->currency($currency_id); - if(!isset($this->format_currency[DEFAULT_CURRENCY])) $this->currency(DEFAULT_CURRENCY); + if(!isset($this->format_currency[DEFAULT_CURRENCY])) $this->currency(DEFAULT_CURRENCY); return round($number *= $this->format_currency[DEFAULT_CURRENCY]["convert"][$currency_id]["rate"], 2); - } + } function currency_list($ret) { if(!isset($this->format_currency[$currency_id])) $this->currency(DEFAULT_CURRENCY); global $smarty; - $smarty->assign("$ret", $this->format_currency[DEFAULT_CURRENCY]["convert"]); + $smarty->assign("$ret", $this->format_currency[DEFAULT_CURRENCY]["convert"]); } function currency_iso ($currency_id) { @@ -147,13 +356,13 @@ class CORE_list function radio($input_id, $name, $table, $field, $id, $class) { include_once(PATH_CORE . 'list_radio.inc.php'); - echo list_radio($input_id, $name, $table, $field, $id, $class); - } + echo list_radio($input_id, $name, $table, $field, $id, $class); + } function check($input_id, $name, $table, $field, $default, $class) { include_once(PATH_CORE . 'list_check.inc.php'); echo list_check($input_id, $name, $table, $field, $default, $class); - } + } function select_groups($default, $field_name, $class, $size, $own_account) { include_once(PATH_CORE . 'list_select_groups.inc.php'); @@ -161,46 +370,52 @@ class CORE_list } function calender_view($field, $default, $css, $id) { - if(isset($default) && $default != '' && $default != '0') + if(isset($default) && $default != '' && $default != '0') $default = date(UNIX_DATE_FORMAT, $default); else $default = ''; include_once(PATH_CORE.'list_calendar.inc.php'); - echo list_calender_add($field, $default, $css); - } - - function calender_add($field, $default, $css) { - if($default == 'now') $default = date(UNIX_DATE_FORMAT, time()); - include_once(PATH_CORE.'list_calendar.inc.php'); - echo list_calender_add($field, $default, $css); + echo list_calender_add($field, $default, $css,$id); } + public function calender_add($field,$default,$css,$id='') { + if ($default == 'now') + $default = date(UNIX_DATE_FORMAT,time()); + + include_once(PATH_CORE.'list_calendar.inc.php'); + echo list_calender_add($field,$default,$css,$id); + } + + # @todo Remove? function calender_add_static_var($field, $default, $css) { if($default == 'now') $default = date(UNIX_DATE_FORMAT, time()); include_once(PATH_CORE.'list_calendar.inc.php'); echo list_calender_add_static($field, $default, $css); } - function calender_search($field, $default, $css) { - if($default == 'now') $default = date(UNIX_DATE_FORMAT, time()); + function calender_search($field, $default, $css) { + if ($default == 'now') + $default = date(UNIX_DATE_FORMAT, time()); + echo '   '; - $this->calender_view($field.'[0]', $default, $css, 1); - echo '
    -   '; - $this->calender_view($field.'[1]', $default, $css, 1); + + $this->calender_view($field,$default,$css,0); + echo '
    +   '; + $this->calender_view($field,$default,$css,1); } function setup_default_date($default, $css) { @@ -208,19 +423,20 @@ class CORE_list echo list_setup_default_date($default, $css); } - function card_type_menu($default_selected, $checkout_id, $field='checkout_plugin_data[card_type]', $class) { + function card_type_menu($default_selected, $checkout_id, $field='checkout_plugin_data[card_type]', $class,$all=false) { include_once(PATH_CORE . 'list_card_type_menu.inc.php'); - echo list_card_type_menu($default_selected, $checkout_id, $field, $class); - } + echo list_card_type_menu($default_selected, $checkout_id, $field, $class,$all); + } - function date($date) { + function date($date) { if($date == '') $date = time(); - return date(UNIX_DATE_FORMAT, $date); - } + return date(UNIX_DATE_FORMAT, $date); + } - function date_time($date) { - if($date == '') $date = time(); - $ret = date(UNIX_DATE_FORMAT, $date); + function date_time($date) { + if ($date == '') + return 'UNKNOWN'; + $ret = date(UNIX_DATE_FORMAT, $date); $ret .= " ".date(DEFAULT_TIME_FORMAT, $date); return $ret; } @@ -228,7 +444,7 @@ class CORE_list function unserial ($data, $var) { global $smarty; if(is_string($data)) $array = unserialize($data); - if(is_array($array)) $smarty->assign($var, $array); + if(is_array($array)) $smarty->assign($var, $array); return; } @@ -237,18 +453,18 @@ class CORE_list $sql= "SELECT id, $field FROM ".AGILE_DB_PREFIX."$table WHERE site_id = '" . DEFAULT_SITE . "'" . $sql . " ORDER BY $field"; - $result = $db->Execute($sql); + $result = $db->Execute($sql); if ($result === false) { global $C_debug; - $C_debug->error('list.inc.php','smarty_array', $db->ErrorMsg()); + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); return false; - } + } while (!$result->EOF) - { + { $smart[] = $result->fields; $result->MoveNext(); - } + } global $smarty; $smarty->assign("$return", $smart); return true; @@ -261,11 +477,11 @@ class CORE_list WHERE site_id = " . $db->qstr(DEFAULT_SITE) . " AND language_id = " . $db->qstr(SESS_LANGUAGE). " AND " . $field2 . " = " . $db->qstr($id); - $result = $db->Execute($sql); + $result = $db->Execute($sql); if ($result === false) { global $C_debug; - $C_debug->error('list.inc.php','translate', $db->ErrorMsg()); + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); return false; } else if($result->RecordCount() > 0) { $smarty->assign("$var", $result->fields); @@ -278,10 +494,10 @@ class CORE_list WHERE site_id = " . $db->qstr(DEFAULT_SITE) . " AND language_id = " . $db->qstr(DEFAULT_LANGUAGE). " AND " . $field2 . " = " . $db->qstr($id); - $result = $db->Execute($sql); + $result = $db->Execute($sql); if ($result === false) { global $C_debug; - $C_debug->error('list.inc.php','translate', $db->ErrorMsg()); + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); return false; } else if($result->RecordCount() > 0) { $smarty->assign("$var", $result->fields); @@ -293,29 +509,39 @@ class CORE_list } } - function bool($field, $curr_value, $extra) { + public function bool($field,$curr_value,$class='form_menu',$extra='') { global $C_translate; - if($curr_value == 'all') { + + # If the field is blank, we'll just return true/false + if (! $field) + return $curr_value ? $C_translate->translate('true') : $C_translate->translate('false'); + + if ($curr_value == 'all') { $true = ''; $false= ''; - } else if($curr_value == "1") { - $true = ' selected'; + + } elseif($curr_value == '1') { + $true = ' selected="selected"'; $false= ''; + } else { $true = ''; - $false= ' selected'; + $false= ' selected="selected"'; } - $return = ''; + $return = sprintf(''; + echo $return; } + // @todo this looks the same as bool() function bool_static_var($field, $curr_value, $class) { global $C_translate; if ($curr_value == 'all') { @@ -328,12 +554,12 @@ class CORE_list $true = ' selected'; $false= ''; } - $return = ''; if($curr_value == 'all') - $return .= ''; + $return .= ''; $return .= ''; $return .= ''; - $return .= ''; + $return .= ''; return $return; } @@ -372,7 +598,9 @@ class CORE_list $graph->PIE_graph($module, $method, $range, $start, $extra); } - function is_installed($module) { + # @todo consider changing this so that it returns the .inc file if the module is installed + # so that $a = x->is_installed('y'); require_once $a can be used + function is_installed($module) { if(@$this->is_installed[$module] == true) return true; if($this->auth_method_by_name($module, 'search')) { $this->is_installed[$module] = true; @@ -393,15 +621,22 @@ class CORE_list } function auth_method_by_name($module, $method) { - global $C_auth; - if(!is_object($C_auth)) return false; - return $C_auth->auth_method_by_name($module, $method); + global $C_auth; + + if (!is_object($C_auth)) + return false; + + return $C_auth->auth_method_by_name($module,$method); } - function generate_admin_menu() { + /** + * Generate the admin menu + */ + public function generate_admin_menu() { global $C_auth; + echo $C_auth->generate_admin_menu(); - } + } function account($field) { if (empty($this->account) && SESS_LOGGED) { @@ -413,11 +648,11 @@ class CORE_list $this->account = $result->fields; } echo $this->account[$field]; - } + } # Get the AgileBill version info function version() { require_once(PATH_CORE.'version.inc.php'); } } -?> \ No newline at end of file +?> diff --git a/modules/core/list_calendar.inc.php b/modules/core/list_calendar.inc.php index 9eb60bd9..d835516e 100644 --- a/modules/core/list_calendar.inc.php +++ b/modules/core/list_calendar.inc.php @@ -1,60 +1,66 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Template:Calendar */ - -function list_calender_add($field, $default, $css) -{ - # set the date to current date if 'now' is set as $default - if($default == 'now') - { - $default = date(UNIX_DATE_FORMAT, time()); - } + +/** + * The main AgileBill Template Calendar Method + * + * @package AgileBill + * @subpackage Template:Calendar + */ + +function list_calender_add($field,$default,$css,$fid) { + # Set the date to current date if 'now' is set as $default + if ($default == 'now') + $default = date(UNIX_DATE_FORMAT,time()); $id = rand(9,999); - $ret = ' -   - - - '; + $ret = ''; + if ($fid) + $ret .= sprintf(' ',$field,$fid,$id,$field,$fid,$css,$default); + else + $ret .= sprintf(' ',$field,$fid,$id,$field,$css,$default); + $ret .= sprintf('',$field,$fid,$id); + $ret .= ''; + return $ret; -} +} +# @todo Remove? +function list_calender_add_static($field,$default,$css) { + return list_calender_add($field,$default,$css,''); -function list_calender_add_static($field, $default, $css) -{ - # set the date to current date if 'now' is set as $default - if($default == 'now') - { - $default = date(UNIX_DATE_FORMAT); - } + # Set the date to current date if 'now' is set as $default + if ($default == 'now') + $default = date(UNIX_DATE_FORMAT); $id = rand(9,999); $ret = ' -   +   "; @@ -410,28 +379,23 @@ class CORE_search { $this->recent_js = FALSE; } - } # end of functino - - - + } # End of functino /** - * Build the saved search menu and JavaScript - * - * @return void - * @since Version 1.0 - * @param string Contains the name of the Module to find saved searches for - */ - - function build_saved($module) - { - # disable for now + * Build the saved search menu and JavaScript + * + * @param string Contains the name of the Module to find saved searches for + * @return void + * @since Version 1.0 + */ + function build_saved($module) { + # Disable for now return 0; if(isset($this->arr)) unset ($this->arr); - # get the saved searches - # get the recent searches + # Get the saved searches + # Get the recent searches $db1 = &DB(); $q = "SELECT id, search_id, name FROM " . AGILE_DB_PREFIX . "search_saved @@ -446,17 +410,17 @@ class CORE_search ORDER BY name ASC"; $result1 = $db1->Execute($q); - # error reporting + # Error reporting if ($result1 === false) { global $C_debug; $C_debug->sql_error($db1->ErrorMsg()); } - $i=0; - while (!$result1->EOF) - { - # get the information for this search + $i=0; + while (!$result1->EOF) + { + # Get the information for this search $db = &DB(); $q = "SELECT id, full_sql, order_by, limit_no FROM " . AGILE_DB_PREFIX . "search @@ -466,28 +430,28 @@ class CORE_search site_id = '" . DEFAULT_SITE . "'"; $result = $db->Execute($q); - # error reporting + # Error reporting if ($result === false) { global $C_debug; - $C_debug->error('search.inc.php','build_saved', $db->ErrorMsg()); + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); } - # get the fields for this loop + # Get the fields for this loop $sql = $result->fields['full_sql']; - # remove the WHERE + # Remove the WHERE $sql = trim($sql); $sql = eregi_replace("WHERE","",$sql); $sql = eregi_replace("AND$","",$sql); $sql = trim($sql); - # replace any sql statements before we split the string + # Replace any sql statements before we split the string $sql = ereg_replace(" = ","===",$sql); $sql = ereg_replace(" LIKE ","===",$sql); - # determine the number of fields + # Determine the number of fields $ii=0; if(ereg(" AND ", $sql)) @@ -495,16 +459,16 @@ class CORE_search $sql = explode(" AND ",$sql); $this_fields = count($sql); - # loop + # Loop for($count=0; $count < $this_fields; $count++) { - # do each field + # Do each field $sqls = explode("==",$sql[$count]); $field[$count][name] = $sqls[0]; $field[$count][value] = ereg_replace("'","",$sqls[1]); $field[$count][value] = ereg_replace("=","",$field[$count][value]); - # check that the name & value are both set... + # Check that the name & value are both set... if($field[$count][value] != '' && $field[$count][name] != '') { if(!isset($this->arr[$i][$ii][limit])) @@ -526,16 +490,16 @@ class CORE_search } else { - # field count + # Field count $this_fields = 1; - # do this one field + # Do this one field $sqls = explode("==",$sql); $field[name] = $sqls[0]; $field[value] = ereg_replace("'","",$sqls[1]); $field[value] = ereg_replace("=","",$field[value]); - # check that the name & value are both set... + # Check that the name & value are both set... if($field[value] != '' && $field[name] != '') { if(!isset($this->arr[$i][$ii][limit])) @@ -551,25 +515,25 @@ class CORE_search # echo "

    Field/Name: " . $field[name] . " -> " . $field[value]; $ii++; - # set the menu up for Smarty + # Set the menu up for Smarty $this->saved_menu[$i] = $result->fields; $this->saved_menu[$i]["name"] = $result1->fields["name"]; } } - $result1->MoveNext(); - if ($ii > 0) $i++; + $result1->MoveNext(); + if ($ii > 0) $i++; } - # finish the JS: + # Finish the JS: if($i > 0 && $ii > 0) { - # build the JavaScript + # Build the JavaScript $this->saved_js = ' - "; @@ -650,4 +614,4 @@ class CORE_search } } } -?> \ No newline at end of file +?> diff --git a/modules/core/service_group.inc.php b/modules/core/service_group.inc.php index 5e78700d..b6a46e39 100644 --- a/modules/core/service_group.inc.php +++ b/modules/core/service_group.inc.php @@ -255,14 +255,6 @@ class service_group include_once(PATH_CORE . 'list.inc.php'); $C_list = new CORE_list; } - - if($C_list->is_installed('db_mapping')) - { - # Update the db_mapping accounts - include_once ( PATH_MODULES . 'db_mapping/db_mapping.inc.php' ); - $db_map = new db_mapping; - $db_map->account_group_sync ( $this->rs['account_id'] ); - } } } -?> \ No newline at end of file +?> diff --git a/modules/core/session.inc.php b/modules/core/session.inc.php index fe6011a9..2272d65f 100644 --- a/modules/core/session.inc.php +++ b/modules/core/session.inc.php @@ -325,7 +325,6 @@ class CORE_session theme_id = ".$db->qstr($this->sess_theme_id).", campaign_id = ".$db->qstr($this->sess_campaign_id); $result = $db->Execute($q); - $C_debug->sql_count(); if ($result === false) { $C_debug->error('session.inc.php','validate', $db->ErrorMsg()); echo 'Unable to start session: Db error
    ' . $q . '

    ' . $db->ErrorMsg(); @@ -370,7 +369,6 @@ class CORE_session $db = &DB(); $q = "DELETE FROM " . AGILE_DB_PREFIX . "session WHERE id = '$sess' AND site_id = '" . DEFAULT_SITE . "'"; $result = $db->Execute($q); - $C_debug->sql_count(); if ($result === false) $C_debug->error('session.inc.php','delete', $db->ErrorMsg()); } @@ -397,7 +395,6 @@ class CORE_session AND site_id = " . $db->qstr(DEFAULT_SITE); $result = $db->Execute($q); global $C_debug; - $C_debug->sql_count(); if ($result === false) $C_debug->error('session.inc.php','session_constant', $db->ErrorMsg()); if(!defined("SESS_LOGGED")) define ('SESS_LOGGED', $result->fields['logged']); @@ -416,4 +413,4 @@ class CORE_session define ('SESS_EXPIRES', 0); } } -?> \ No newline at end of file +?> diff --git a/modules/core/setup.inc.php b/modules/core/setup.inc.php index 85614dab..b7c482e1 100644 --- a/modules/core/setup.inc.php +++ b/modules/core/setup.inc.php @@ -1,169 +1,169 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Core:Setup */ - -class CORE_setup -{ - function CORE_setup() - { - if(defined('MEMCACHE_ENABLED') && MEMCACHE_ENABLED == true) { - require_once (PATH_INCLUDES. 'cache/cache.php'); + +/** + * The main AgileBill Core Setup Class + * + * @package AgileBill + * @subpackage Core:Setup + */ +class CORE_setup { + public function __construct() { + if (defined('MEMCACHE_ENABLED') && MEMCACHE_ENABLED == true) { + require_once(PATH_INCLUDES.'cache/cache.php'); + $key = md5('keyname1'.__FILE__.DEFAULT_SITE); - $sec = 60*30; + $sec = 60*30; $timeout = get_value($key.'_exp'); - if($timeout == "" || $timeout < time() || !$fields = get_value($key) ) - { + if ($timeout == '' || $timeout < time() || ! $fields = get_value($key)) { $fields = $this->get_setup(); - store_value($key, $fields); - store_value($key.'_exp', time()+$sec); - } + store_value($key,$fields); + store_value($key.'_exp',time()+$sec); + } + } else { $fields = $this->get_setup(); } - define ('DEFAULT_COUNTRY', $fields['country_id']); - define ('DEFAULT_LANGUAGE', $fields['language_id']); - define ('DEFAULT_CURRENCY', $fields['currency_id']); - define ('DEFAULT_WEIGHT', $fields['weight_id']); - define ('DEFAULT_THEME', $fields['theme_id']); - define ('DEFAULT_ADMIN_THEME', $fields['admin_theme_id']); - define ('DEFAULT_GROUP', $fields['group_id']); - define ('DEFAULT_AFFILIATE_TEMPLATE', $fields['affiliate_template_id']); - define ('DEFAULT_AFFILIATE', $fields['affiliate_id']); - define ('DEFAULT_RESELLER', $fields['reseller_id']); - define ('DEFAULT_SETUP_EMAIL', $fields['setup_email_id']); - define ('DEFAULT_TIME_FORMAT', $fields['time_format']); - define ('DEFAULT_ACCOUNT_STATUS',$fields['default_account_status']); + define('DEFAULT_COUNTRY', $fields['country_id']); + define('DEFAULT_LANGUAGE', $fields['language_id']); + define('DEFAULT_CURRENCY', $fields['currency_id']); + define('DEFAULT_WEIGHT', $fields['weight_id']); + define('DEFAULT_THEME', $fields['theme_id']); + define('DEFAULT_ADMIN_THEME', $fields['admin_theme_id']); + define('DEFAULT_GROUP', $fields['group_id']); + define('DEFAULT_AFFILIATE_TEMPLATE', $fields['affiliate_template_id']); + define('DEFAULT_AFFILIATE', $fields['affiliate_id']); + define('DEFAULT_RESELLER', $fields['reseller_id']); + define('DEFAULT_SETUP_EMAIL', $fields['setup_email_id']); + define('DEFAULT_TIME_FORMAT', $fields['time_format']); + define('DEFAULT_ACCOUNT_STATUS',$fields['default_account_status']); $this->default_date_format($fields['date_format']); - if(!defined("DEFAULT_TIME_FORMAT")) - define ('DEFAULT_TIME_FORMAT', $fields['time_format']); - define ('DEFAULT_DATE_TIME_FORMAT', $fields['date_time_format']); - define ('DEFAULT_DECIMAL_PLACE',$fields['decimal_place']); - define ('COOKIE_NAME', $fields['cookie_name']); - define ('COOKIE_EXPIRE', $fields['cookie_expire']); - define ('SESSION_IP_MATCH', $fields['session_ip_match']); - define ('SESSION_EXPIRE', $fields['login_expire']); - define ('NEWSLETTER_REGISTRATION',$fields['newsletter_registration']); - define ('SEARCH_EXPIRE', $fields['search_expire']); - define ('ERROR_REPORTING', $fields['error_reporting']); - define ('DEBUG', $fields['debug']); + if (! defined('DEFAULT_TIME_FORMAT')) + define('DEFAULT_TIME_FORMAT',$fields['time_format']); + define('DEFAULT_DATE_TIME_FORMAT',$fields['date_time_format']); + define('DEFAULT_DECIMAL_PLACE',$fields['decimal_place']); + define('COOKIE_NAME', $fields['cookie_name']); + define('COOKIE_EXPIRE', $fields['cookie_expire']); + define('SESSION_IP_MATCH', $fields['session_ip_match']); + define('SESSION_EXPIRE', $fields['login_expire']); + define('NEWSLETTER_REGISTRATION',$fields['newsletter_registration']); + define('SEARCH_EXPIRE', $fields['search_expire']); + define('ERROR_REPORTING', $fields['error_reporting']); + define('DEBUG', $fields['debug']); - define ('LOGIN_ATTEMPT_TRY', $fields['login_attempt_try']); - define ('LOGIN_ATTEMPT_TIME', $fields['login_attempt_time']); - define ('LOGIN_ATTEMPT_LOCK', $fields['login_attempt_lock']); - define ('DB_CACHE', $fields['db_cache']); - define ('CACHE_SESSIONS', $fields['cache_sessions']); - define ('WEBLOG', $fields['weblog']); - define ('LICENSE_KEY', $fields['license_key']); - define ('LICENSE_CODE', $fields['license_code']); + define('LOGIN_ATTEMPT_TRY', $fields['login_attempt_try']); + define('LOGIN_ATTEMPT_TIME', $fields['login_attempt_time']); + define('LOGIN_ATTEMPT_LOCK', $fields['login_attempt_lock']); + define('DB_CACHE', $fields['db_cache']); + define('CACHE_SESSIONS', $fields['cache_sessions']); + define('WEBLOG', $fields['weblog']); - if(!defined('SSL_URL')) define ('SSL_URL', $fields['ssl_url']); - if(!defined('URL')) define ('URL', $fields['nonssl_url']); - if(!defined('SITE_NAME')) define ('SITE_NAME', $fields['site_name']); - if(!defined('SITE_EMAIL')) define ('SITE_EMAIL', $fields['site_email']); - if(!defined('SITE_ADDRESS'))define ('SITE_ADDRESS',$fields['site_address']); - if(!defined('SITE_CITY')) define ('SITE_CITY', $fields['site_city']); - if(!defined('SITE_STATE')) define ('SITE_STATE', $fields['site_state']); - if(!defined('SITE_ZIP')) define ('SITE_ZIP', $fields['site_zip']); - if(!defined('SITE_PHONE')) define ('SITE_PHONE', $fields['site_phone']); - if(!defined('SITE_FAX')) define ('SITE_FAX', $fields['site_fax']); + if (! defined('SSL_URL')) define('SSL_URL', $fields['ssl_url']); + if (! defined('URL')) define('URL', $fields['nonssl_url']); + if (! defined('SITE_NAME')) define('SITE_NAME', $fields['site_name']); + if (! defined('SITE_EMAIL')) define('SITE_EMAIL', $fields['site_email']); + if (! defined('SITE_ADDRESS')) define('SITE_ADDRESS', $fields['site_address']); + if (! defined('SITE_CITY')) define('SITE_CITY', $fields['site_city']); + if (! defined('SITE_STATE')) define('SITE_STATE', $fields['site_state']); + if (! defined('SITE_ZIP')) define('SITE_ZIP', $fields['site_zip']); + if (! defined('SITE_PHONE')) define('SITE_PHONE', $fields['site_phone']); + if (! defined('SITE_FAX')) define('SITE_FAX', $fields['site_fax']); - if($fields['os'] == 1) - define ('AGILE_OS', 'WINDOWS'); + if ($fields['os'] == 1) + define('AGILE_OS', 'WINDOWS'); else - define ('AGILE_OS', 'LINUX'); + define('AGILE_OS', 'LINUX'); - define ('PATH_CURL', $fields['path_curl']); - define ('SHOW_AFFILIATE_LINK', $fields['show_affiliate_link']); - define ('AUTO_AFFILIATE', @$fields['auto_affiliate']); - define ('SHOW_TICKET_LINK', $fields['show_ticket_link']); - define ('SHOW_NEWSLETTER_LINK', $fields['show_newsletter_link']); - define ('SHOW_CONTACT_LINK', $fields['show_contact_link']); - define ('SHOW_DOMAIN_LINK', $fields['show_domain_link']); - define ('SHOW_CART_LINK', $fields['show_cart_link']); - define ('SHOW_CHECKOUT_LINK', $fields['show_checkout_link']); - define ('SHOW_PRODUCT_LINK', $fields['show_product_link']); - define ('SHOW_CAT_BLOCK', $fields['show_cat_block']); - define ('SHOW_FILE_BLOCK', $fields['show_file_block']); - define ('SHOW_STATIC_BLOCK', $fields['show_static_block']); - define ('SHOW_AFFILIATE_CODE', $fields['show_affiliate_code']); - define ('SHOW_DISCOUNT_CODE', $fields['show_discount_code']); - define ('BILLING_WEEKDAY', $fields['billing_weekday']); - define ('GRACE_PERIOD', $fields['grace_period']); - define ('MAX_BILLING_NOTICE', $fields['max_billing_notice']); - define ('MAX_INV_GEN_PERIOD', $fields['max_inv_gen_period']); + define('PATH_CURL', $fields['path_curl']); + define('SHOW_AFFILIATE_LINK', $fields['show_affiliate_link']); + define('AUTO_AFFILIATE', @$fields['auto_affiliate']); + define('SHOW_NEWSLETTER_LINK', $fields['show_newsletter_link']); + define('SHOW_CONTACT_LINK', $fields['show_contact_link']); + define('SHOW_DOMAIN_LINK', $fields['show_domain_link']); + define('SHOW_CART_LINK', $fields['show_cart_link']); + define('SHOW_CHECKOUT_LINK', $fields['show_checkout_link']); + define('SHOW_PRODUCT_LINK', $fields['show_product_link']); + define('SHOW_CAT_BLOCK', $fields['show_cat_block']); + define('SHOW_STATIC_BLOCK', $fields['show_static_block']); + define('SHOW_AFFILIATE_CODE', $fields['show_affiliate_code']); + define('SHOW_DISCOUNT_CODE', $fields['show_discount_code']); + define('BILLING_WEEKDAY', $fields['billing_weekday']); + define('GRACE_PERIOD', $fields['grace_period']); + define('MAX_BILLING_NOTICE', $fields['max_billing_notice']); - $error_reporting_eval = 'error_reporting('.ERROR_REPORTING.');'; - eval($error_reporting_eval); + error_reporting(ERROR_REPORTING); } - function get_setup() - { + private function get_setup() { $db = &DB(); - $q = "SELECT * FROM " . AGILE_DB_PREFIX . "setup WHERE site_id = ". DEFAULT_SITE; - $result = $db->Execute($q); - if ($result === false || @$result->RecordCount() == 0) { - if(is_file('install/install.inc')) + $result = $db->Execute(sqlSelect($db,'setup','*','')); + if (! $result || $result->RecordCount() == 0) { + if (is_file('install/install.inc')) require_once('install/install.inc'); else $this->handle_failure($db); exit; + } else { return $result->fields; } - } + } - function default_date_format($default) - { + private function default_date_format($default) { $default = unserialize($default); $format = ''; $divider = $default[3]; - for($i=0; $i<3; $i++) - { + + for ($i=0; $i<3; $i++) { $format .= $default[$i]; - if($i != 2) - $format .= $divider; + if ($i != 2) + $format .= $divider; } + $arr = Array('a','A','b','B','d','j','m','u','y','Y'); - for($i=0; $i_errorMsg)); - // log the error - if($f=fopen(PATH_FILES.'sql_error.txt', 'a')) { - $data = date("m-d-Y H:i:s a") . " " . $db->_errorMsg . "\r\n"; - fputs($f,$data); - } - - exit; + exit; } } -?> \ No newline at end of file +?> diff --git a/modules/core/sort_array.inc.php b/modules/core/sort_array.inc.php index 35d0048c..eebc543a 100644 --- a/modules/core/sort_array.inc.php +++ b/modules/core/sort_array.inc.php @@ -1,4 +1,4 @@ - \ No newline at end of file +?> diff --git a/modules/core/static_var.inc.php b/modules/core/static_var.inc.php index 32f1c4d7..cbb91f58 100644 --- a/modules/core/static_var.inc.php +++ b/modules/core/static_var.inc.php @@ -166,12 +166,12 @@ class CORE_static_var { ### SMALL TEXT FIELD $this_html = ''; + '" value="'.$static_value.'"/>'; } elseif($display == 'search') { $this_html = '' . + '" value="'.$static_value.'"/>' . $C_translate->translate('search_partial', 'CORE', SESS_LANGUAGE); } else @@ -187,12 +187,12 @@ class CORE_static_var { ### MEDIUM TEXT FIELD $this_html = ''; + '" value="'.$static_value.'"/>'; } elseif($display == 'search') { $this_html = '' . + '" value="'.$static_value.'"/>' . $C_translate->translate('search_partial', 'CORE', SESS_LANGUAGE); } else @@ -213,7 +213,7 @@ class CORE_static_var elseif($display == 'search') { $this_html = '' . + '" value="'.$static_value.'"/>' . $C_translate->translate('search_partial', 'CORE', SESS_LANGUAGE); } else @@ -289,7 +289,7 @@ class CORE_static_var $id = rand(9,999); $this_html = '   - + "; - } - - $C_debug->alert($message); -} - - - - - ############################################################################ - #>>>>> default Account Add module - ############################################################################ - - function MAP_account_add( $account_id, $MAP_this ) - { - ### Get the local account details - $db = &DB(); - $sql= 'SELECT * FROM '.AGILE_DB_PREFIX.'account WHERE - site_id = '.$db->qstr(DEFAULT_SITE).' AND - id = '.$db->qstr($account_id); - $result = $db->Execute($sql); - - ### error reporting: - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','MAP_account_add', $db->ErrorMsg()); - return; - } - - ### Create the insert statement - $dbm = new db_mapping; - $db = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = "INSERT INTO " . - $db_prefix . "" . $MAP_this->map['account_map_field'] . ' SET '; - - ### Define the main fields - $comma=false; - reset ( $MAP_this->map['account_fields'] ); - while ( list ($key, $val) = each ( $MAP_this->map['account_fields'] )) - { - if ( $val['map_field'] && $key != 'id') - { - if($comma) $sql .= " , "; - $sql .= $val['map_field'] . " = ". $db->qstr($result->fields[$key]); - $comma = true; - } - elseif ( $val['map_field'] && $key == 'id') - { - if(isset($val['unique']) && $val['unique'] == '1') - { - $remote_account_id = $db->GenID($db_prefix . "" . $MAP_this->map['account_map_field'] . '_id'); - if($comma) $sql .= " , "; - $sql .= $val['map_field'] . " = ". $db->qstr($remote_account_id); - $comma = true; - } - } - } - - ### Define any custom fields - for($i=0; $imap['extra_field']); $i++) - { - if ( $MAP_this->map['extra_field'][$i]['add'] ) - { - if($comma) $sql .= " , "; - $value = $MAP_this->map['extra_field'][$i]['value']; - - # conversion - if ($value == 'random|64') - $value = rand(999,99999) .''. md5(microtime() . '-' . rand(999,9999)); - if ($value == 'random|32') - $value = md5(microtime() . rand(999,99999)); - - $sql .= $MAP_this->map['extra_field'][$i]['name'] . " = ".$db->qstr($value); - $comma = true; - } - } - $result = $db->Execute($sql); - - ### error reporting: - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','MAP_account_add', $db->ErrorMsg()); - return; - } - return true; - } - - - - - - - - - - - - ############################################################################ - #>>>>> default Account Edit method - ############################################################################ - - function MAP_account_edit($account_id, $old_username, $MAP_this) - { - $db = &DB(); - if( $old_username == '') - { - ### Get the username: - $sql = 'SELECT username FROM ' . AGILE_DB_PREFIX . 'account WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - id = ' . $db->qstr($account_id); - $result = $db->Execute($sql); - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','MAP_account_edit(1)', $db->ErrorMsg()); - return; - } - - if($result->RecordCount() > 0) - { - $old_username = $result->fields['username']; - } - } - - - if (@$old_username == strtolower('admin') || - @$old_username == strtolower('administrator')) - return false; - - ### Get the current account details from the local db - $sql= "SELECT * FROM " . AGILE_DB_PREFIX . "account WHERE - id = " . $db->qstr($account_id) . " AND - site_id = " . $db->qstr(DEFAULT_SITE); - $result=$db->Execute($sql); - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','MAP_account_edit(2)', $db->ErrorMsg()); - return; - } - - ### Create the sql update statement - unset($db); - $dbm = new db_mapping; - $db = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = "UPDATE " . - $db_prefix . "" . $MAP_this->map['account_map_field'] . ' SET '; - - - ### Define the main fields - $comma=false; - reset ( $MAP_this->map['account_fields'] ); - while ( list ($key, $val) = each ( $MAP_this->map['account_fields'] )) - { - if ( $val['map_field'] && $key != 'id') - { - if($comma) $sql .= " , "; - $sql .= $val['map_field'] . " = ". $db->qstr($result->fields[$key]); - $comma = true; - } - } - - ### Define any custom fields - for($i=0; $imap['extra_field']); $i++) - { - if ( $MAP_this->map['extra_field'][$i]['edit'] ) - { - if($comma) $sql .= " , "; - $sql .= $MAP_this->map['extra_field'][$i]['name'] . " = ". - $db->qstr($MAP_this->map['extra_field'][$i]['value']); - $comma = true; - } - } - - ### Update the account in the remote db - $sql .= " WHERE " . $MAP_this->map['account_fields']['username']['map_field'] . - ' = ' . $db->qstr($old_username); - $result = $db->Execute($sql); - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','MAP_account_edit(3)', $db->ErrorMsg()); - return; - } - } - - - - - ############################################################################ - #>>>>> default Account Deletion method - ############################################################################ - - function MAP_account_delete($account_id, $username, $MAP_this) - { - ### Check if delete is allowed for this db map: - if ( !isset($MAP_this->map['account_sync_field']['delete']) || - !$MAP_this->map['account_sync_field']['delete'] ) - return false; - - ### Check if username is defined - if ( $username == '') - { - ### Get the username: - $db = &DB(); - $sql = 'SELECT username FROM ' . AGILE_DB_PREFIX . 'account WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - id = ' . $db->qstr($account_id); - $result = $db->Execute($sql); - - ### error reporting: - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','MAP_account_delete', $db->ErrorMsg()); - return; - } - - if($result->RecordCount > 0) - { - $username = $result->fields['username']; - } - } - - ################################################################### - ### Get the remote account ID: - $dbm = new db_mapping; - $db2 = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = "SELECT " . $MAP_this->map['account_fields']['id']['map_field'] . " FROM " . - $db_prefix . "" . $MAP_this->map['account_map_field'] . ' WHERE ' . - $MAP_this->map['account_fields']['username']['map_field'] . " = " . - $db2->qstr($username); - $result = $db2->Execute($sql); - - ### error reporting: - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_delete', $db2->ErrorMsg()); - return; - } - - $fld = $MAP_this->map['account_fields']['id']['map_field']; - $remote_account_id = $result->fields[$fld]; - - #################################################################### - ### Delete the remote account: - $sql = "DELETE FROM " . - $db_prefix . "" . $MAP_this->map['account_map_field'] . ' WHERE ' . - $MAP_this->map['account_fields']['id']['map_field'] . " = " . - $db2->qstr($remote_account_id); - $result = $db2->Execute($sql); - - ### error reporting: - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','MAP_account_delete', $db->ErrorMsg()); - return; - } - - #################################################################### - ### Delete the remote groups: - if ( $MAP_this->map['group_type'] == 'db' || $MAP_this->map['group_type'] == 'hardcode' ) - { - $sql = "DELETE FROM " . - $db_prefix . "" . $MAP_this->map['group_account_map']['table'] . ' WHERE ' . - $MAP_this->map['group_account_map']['account_id'] . " = " . - $db2->qstr($remote_account_id); - $result = $db2->Execute($sql); - - ### error reporting: - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','MAP_account_delete', $db->ErrorMsg()); - return; - } - - return $remote_account_id; - } - } - - - - - - - ######################################################################## - #>>>>> default Account Import method - ######################################################################## - - function MAP_account_import($remote_account_id, $MAP_this) - { - #################################################################### - ### Get the remote account details: - $dbm = new db_mapping; - $db2 = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = "SELECT * FROM " . - $db_prefix . "" . $MAP_this->map['account_map_field'] . ' WHERE ' . - $MAP_this->map['account_fields']['id']['map_field'] . " = " . - $db2->qstr($remote_account_id); - $result = $db2->Execute($sql); - - ### error reporting: - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','MAP_account_import', $db2->ErrorMsg()); - return; - } - - if ($result->RecordCount() == 0) return false; - - #################################################################### - ### get a unique account id: - - $db = &DB(); - $account_id = $db->GenID(AGILE_DB_PREFIX . 'account_id'); - - $fld = $MAP_this->map['account_fields']['username']['map_field']; - @$username = $result->fields[$fld]; - - $fld = $MAP_this->map['account_fields']['password']['map_field']; - @$password = $result->fields[$fld]; - - if ( !$MAP_this->map['account_fields']['company']['map_field'] ) - { - $company = ''; - } - else - { - $fld = $MAP_this->map['account_fields']['company']['map_field']; - @$company = $result->fields[$fld]; - } - - $fld = $MAP_this->map['account_fields']['email']['map_field']; - @$email = $result->fields[$fld]; - - $fld = $MAP_this->map['account_fields']['email_type']['map_field']; - @$email_type = $result->fields[$fld]; - - $fld = $MAP_this->map['account_fields']['date_last']['map_field']; - @$date_last = $result->fields[$fld]; - if ($date_last <= 0) $date_last = time(); - - $fld = $MAP_this->map['account_fields']['date_orig']['map_field']; - @$date_orig = $result->fields[$fld]; - if ($date_orig <= 0) $date_orig = time(); - - - if ( !$MAP_this->map['account_fields']['last_name']['map_field'] ) - { - $status = '1'; - } - else - { - $fld = $MAP_this->map['account_fields']['status']['map_field']; - @$status = $result->fields[$fld]; - if ($status != '0' && $status != '1') $status = '1'; - } - - - $fld = $MAP_this->map['account_fields']['first_name']['map_field']; - @$first_name = $result->fields[$fld]; - @$name_arr = explode(' ', $first_name); - - if ( !$MAP_this->map['account_fields']['last_name']['map_field'] ) - { - if (count($name_arr) >= 3) - { - @$first_name = $name_arr["0"]; - @$middle_name = $name_arr["1"]; - @$last_name = $name_arr["2"]; - } - elseif (count($name_arr) == 2) - { - @$first_name = $name_arr["0"]; - $middle_name = ''; - @$last_name = $name_arr["1"]; - } - else - { - $middle_name = ''; - $last_name = ''; - } - } - else - { - $fld = $MAP_this->map['account_fields']['middle_name']['map_field']; - @$middle_name = $result->fields[$fld]; - - $fld = $MAP_this->map['account_fields']['last_name']['map_field']; - @$last_name = $result->fields[$fld]; - } - - - - #################################################################### - ### Create the sql update statement - - $sql = "INSERT INTO ". AGILE_DB_PREFIX ."account SET - id = ".$db->qstr($account_id).", - site_id = ".$db->qstr(DEFAULT_SITE).", - language_id = ".$db->qstr(DEFAULT_LANGUAGE).", - affiliate_id= ".$db->qstr(DEFAULT_AFFILIATE).", - reseller_id = ".$db->qstr(DEFAULT_RESELLER).", - currency_id = ".$db->qstr(DEFAULT_CURRENCY).", - theme_id = ".$db->qstr(DEFAULT_THEME).", - status = ".$db->qstr($status).", - date_orig = ".$db->qstr($date_orig).", - date_last = ".$db->qstr($date_last).", - username = ".$db->qstr($username).", - password = ".$db->qstr($password).", - first_name = ".$db->qstr($first_name).", - middle_name = ".$db->qstr($middle_name).", - last_name = ".$db->qstr($last_name).", - company = ".$db->qstr($company).", - email = ".$db->qstr($email).", - email_type = ".$db->qstr($email_type); - $result = $db->Execute($sql); - - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','MAP_account_import', $db->ErrorMsg() . " --- ". $sql); - return; - } - - - #################################################################### - ### add the user to the default group: - - $group_id = $db->GenID(AGILE_DB_PREFIX . "" . 'account_id'); - $sql = ' - INSERT INTO ' . AGILE_DB_PREFIX . 'account_group SET - id = ' . $db->qstr ( $group_id ) . ', - site_id = ' . $db->qstr ( DEFAULT_SITE ) . ', - date_orig = ' . $db->qstr ( time() ) . ', - group_id = ' . $db->qstr ( DEFAULT_GROUP ) . ', - account_id = ' . $db->qstr ( $account_id ) . ', - active = ' . $db->qstr ('1'); - $db->Execute($sql); - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','MAP_account_import', $db->ErrorMsg()); - return; - } - } - - - - - - - - - - - - - - - - - - - ######################################################################## - #>>>>> default Account Import method ( FOR 'DB' based groups... ) - ######################################################################## - - function MAP_account_group_sync_db($account_id, $MAP_this) - { - ### Get the local account details - - $db = &DB(); - $sql= 'SELECT username,email FROM '.AGILE_DB_PREFIX.'account WHERE - site_id = '.$db->qstr(DEFAULT_SITE).' AND - id = '.$db->qstr($account_id); - $result = $db->Execute($sql); - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','MAP_account_group_sync_db1', $db->ErrorMsg(). ' ---> ' . $sql); - return; - } - - $user = $result->fields['username']; - $email = $result->fields['email']; - - ### Get the remote account id: - $dbm = new db_mapping; - $db2 = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = "SELECT " . - $MAP_this->map['account_fields']['id']['map_field'] - . " FROM " . - $db_prefix . "" . $MAP_this->map['account_map_field'] . ' WHERE ' . - $MAP_this->map['account_fields']['username']['map_field'] . " = " . - $db2->qstr($user); - $result = $db2->Execute($sql); - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','MAP_account_group_sync_db2', $db2->ErrorMsg(). ' ---> ' . $sql); - return; - } - - $fld_remote_id = $MAP_this->map['account_fields']['id']['map_field']; - $remote_account_id = $result->fields[$fld_remote_id]; - - ### Delete all current groups for this account id: - if(!empty($MAP_this->map['group_account_map']['account_id'])) { - $sql = "DELETE FROM " . - $db_prefix . "" . $MAP_this->map['group_account_map']['table'] - . ' WHERE ' . - $MAP_this->map['group_account_map']['account_id'] . " = " . - $db2->qstr($remote_account_id); - $result = $db2->Execute($sql); - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','MAP_account_group_sync_db3', $db2->ErrorMsg(). ' ---> ' . $sql); - return; - } - } - - ### Get the group_map array for this database map: - if(!isset($this->group_arr)) - { - $db = &DB(); - $sql = "SELECT group_map FROM ".AGILE_DB_PREFIX."db_mapping WHERE - map_file = ".$db->qstr($MAP_this->map['map'])." AND - site_id = ".$db->qstr(DEFAULT_SITE); - $result = $db->Execute($sql); - - ### error reporting: - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','MAP_account_group_sync_db4', $db->ErrorMsg(). ' ---> ' . $sql); - return; - } - @$MAP_this->group_arr = unserialize( $result->fields['group_map'] ); - } - - - #################################################################### - ### Determine the groups the selected account is authorize for: - - $db = &DB(); - $sql = "SELECT group_id,date_start,date_expire FROM ". - AGILE_DB_PREFIX."account_group WHERE - account_id = ".$db->qstr($account_id)." AND - active = ".$db->qstr(1)." AND - site_id = ".$db->qstr(DEFAULT_SITE); - $result = $db->Execute($sql); - - ### error reporting: - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','MAP_account_group_sync_db4', $db->ErrorMsg(). ' ---> ' . $sql); - return; - } - - if($result->RecordCount() == 0) return; - while( !$result->EOF ) - { - $start = $result->fields['date_start']; - $expire = $result->fields['date_expire']; - $group = $result->fields['group_id']; - - ### Group access started and not expired: - if - (($expire >= time() || $expire == '' || $expire == '0') - && - ($start <= time() || $start == '' || $start == '0')) - { - ### Group is authorized: - ### Get the associated remote group(s) this account needs - ### to be added to: - - reset ($MAP_this->group_arr); - while ( list ($key, $val) = each ($MAP_this->group_arr)) - { - if ($key == $group) - { - ### what remote group(s) is this group mapped to? - while ( list ($remote_group, $add) = each ($val)) - { - if ($add) - { - ### create this group in the remote DB: - $dbm = new db_mapping; - $db2 = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = "INSERT INTO " . - $db_prefix . "" . - $MAP_this->map['group_account_map']['table'] . ' SET ' . - $MAP_this->map['group_account_map']['group_id'] . " = " . - $db2->qstr($remote_group) . ", " . - $MAP_this->map['group_account_map']['account_id'] . " = " . - $db2->qstr($remote_account_id); - $group_result = $db2->Execute($sql); - if ($group_result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','MAP_account_group_sync_db5', $db2->ErrorMsg(). ' ---> ' . $sql); - return; - } - } - } - } - } - } - $result->MoveNext(); - } - return $remote_account_id; - } - - - - - - - - - - - - - - - - - - ######################################################################## - #>>>>> default Account Import method ( FOR 'DB' based groups... ) - ######################################################################## - - function MAP_account_group_sync_status($account_id, $MAP_this) - { - #################################################################### - ### Get the local account details - - $db = &DB(); - $sql= 'SELECT username,email FROM '.AGILE_DB_PREFIX.'account WHERE - site_id = '.$db->qstr(DEFAULT_SITE).' AND - id = '.$db->qstr($account_id); - $result = $db->Execute($sql); - - ### error reporting: - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','MAP_account_group_sync_status', $db->ErrorMsg()); - return; - } - - $user = $result->fields['username']; - $email = $result->fields['email']; - - - - #################################################################### - ### Get the remote account id: - - $dbm = new db_mapping; - $db2 = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = "SELECT " . - $MAP_this->map['account_fields']['id']['map_field'] - . " FROM " . - $db_prefix . "" . $MAP_this->map['account_map_field'] . ' WHERE ' . - $MAP_this->map['account_fields']['username']['map_field'] . " = " . - $db2->qstr($user); - $result = $db2->Execute($sql); - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','MAP_account_group_sync_status', $db2->ErrorMsg()); - return; - } - - $fld_remote_id = $MAP_this->map['account_fields']['id']['map_field']; - $remote_account_id = $result->fields[$fld_remote_id]; - - - #################################################################### - ### Get the group_map array for this database map: - - if(!isset($this->group_arr)) - { - $db = &DB(); - $sql = "SELECT group_map FROM ".AGILE_DB_PREFIX."db_mapping WHERE - map_file = ".$db->qstr($MAP_this->map['map'])." AND - site_id = ".$db->qstr(DEFAULT_SITE); - $result = $db->Execute($sql); - - ### error reporting: - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','MAP_account_group_sync_status', $db->ErrorMsg()); - return; - } - - @$MAP_this->group_arr = unserialize( $result->fields['group_map'] ); - } - - - #################################################################### - ### Determine the groups the selected account is authorize for: - - $db = &DB(); - $sql = "SELECT group_id,date_start,date_expire FROM ". - AGILE_DB_PREFIX."account_group WHERE - account_id = ".$db->qstr($account_id)." AND - active = ".$db->qstr(1)." AND - site_id = ".$db->qstr(DEFAULT_SITE); - $result = $db->Execute($sql); - - ### error reporting: - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','MAP_account_group_sync_status', $db->ErrorMsg()); - return; - } - - if($result->RecordCount() == 0) return; - - $MAP_this->status = 0; - - while( !$result->EOF ) - { - $start = $result->fields['date_start']; - $expire = $result->fields['date_expire']; - $group = $result->fields['group_id']; - - ### Group access started and not expired: - if - (($expire >= time() || $expire == '' || $expire == '0') - && - ($start <= time() || $start == '' || $start == '0')) - { - ### Group is authorized: - ### Get the associated remote group(s) this account needs - ### to be added to: - - - if(is_array($MAP_this->group_arr)) - { - reset ($MAP_this->group_arr); - while ( list ($key, $add) = each ($MAP_this->group_arr)) - { - if ($key == $group) - { - if ($add != '' && gettype($add) != 'string') - { - if ( $MAP_this->status < $add ) - $MAP_this->status = $add; - } - else - { - $MAP_this->status = $add; - } - } - } - } - } - $result->MoveNext(); - } - - ### Update the remote account: - $dbm = new db_mapping; - $db2 = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = "UPDATE " . - $db_prefix . "" . - $MAP_this->map['account_map_field'] . ' SET ' . - $MAP_this->map['account_status_field'] . " = " . - $db2->qstr($MAP_this->status) . " WHERE " . - $MAP_this->map['account_fields']['id']['map_field'] . " = " . - $db2->qstr($remote_account_id); - $group_result = $db2->Execute($sql); - - ### error reporting: - if ($group_result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','MAP_account_group_sync_status', $db->ErrorMsg()); - return; - } - return $remote_account_id; - } - - - - - - - - - - ######################################################################## - #>>>>> default Account Import method ( FOR 'DB' based groups... ) - ######################################################################## - - function MAP_account_group_sync_db_status($account_id, $MAP_this) - { - ### Get the local account details - $db = &DB(); - $sql= 'SELECT username,email FROM '.AGILE_DB_PREFIX.'account WHERE - site_id = '.$db->qstr(DEFAULT_SITE).' AND - id = '.$db->qstr($account_id); - $result = $db->Execute($sql); - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','MAP_account_group_sync_status', $db->ErrorMsg()); - return; - } - - $user = $result->fields['username']; - $email = $result->fields['email']; - - - ### Get the remote account id: - $dbm = new db_mapping; - $db2 = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = "SELECT " . - $MAP_this->map['account_fields']['id']['map_field'] - . " FROM " . - $db_prefix . "" . $MAP_this->map['account_map_field'] . ' WHERE ' . - $MAP_this->map['account_fields']['username']['map_field'] . " = " . - $db2->qstr($user); - $result = $db2->Execute($sql); - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','MAP_account_group_sync_status', $db2->ErrorMsg()); - return; - } - - $fld_remote_id = $MAP_this->map['account_fields']['id']['map_field']; - $remote_account_id = $result->fields[$fld_remote_id]; - - ### Get the group_map array for this database map: - if(!isset($this->group_arr)) - { - $db = &DB(); - $sql = "SELECT group_map,group_rank FROM ".AGILE_DB_PREFIX."db_mapping WHERE - map_file = ".$db->qstr($MAP_this->map['map'])." AND - site_id = ".$db->qstr(DEFAULT_SITE); - $result = $db->Execute($sql); - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','MAP_account_group_sync_status', $db->ErrorMsg()); - return; - } - - @$MAP_this->group_arr = unserialize( $result->fields['group_map'] ); - @$MAP_this->group_rank = unserialize( $result->fields['group_rank']); - } - - ### Determine the groups the selected account is authorize for: - $db = &DB(); - $sql = "SELECT group_id,date_start,date_expire FROM ". - AGILE_DB_PREFIX."account_group WHERE - account_id = ".$db->qstr($account_id)." AND - active = ".$db->qstr(1)." AND - site_id = ".$db->qstr(DEFAULT_SITE); - $result = $db->Execute($sql); - - ### error reporting: - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','MAP_account_group_sync_status', $db->ErrorMsg()); - return; - } - - if($result->RecordCount() == 0) return; - - $MAP_this->status = 0; - if($result->RecordCount() == 0) return; - $rank = 0; - while( !$result->EOF ) - { - $start = $result->fields['date_start']; - $expire = $result->fields['date_expire']; - $group = $result->fields['group_id']; - - ### Group access started and not expired: - if - (($expire >= time() || $expire == '' || $expire == '0') - && - ($start <= time() || $start == '' || $start == '0')) - { - ### Group is authorized: - ### Get the associated remote group(s) this account needs - ### to be added to: - - if(!empty($MAP_this->group_arr) && is_array($MAP_this->group_arr)) - { - reset ($MAP_this->group_arr); - foreach($MAP_this->group_arr as $key => $val) - { - if ($key == $group) - { - ### what remote group(s) is this group mapped to? - foreach($val as $remote_group => $add) { - if (!empty($add) && $MAP_this->group_rank[$key]['rank'] > $rank) - { - $MAP_this->status = $add; - $rank = $MAP_this->group_rank[$key]['rank']; - } - } - } - } - } - } - $result->MoveNext(); - } - - ### Update the remote account: - $dbm = new db_mapping; - $db2 = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = "UPDATE " . - $db_prefix . "" . - $MAP_this->map['account_map_field'] . ' SET ' . - $MAP_this->map['account_status_field'] . " = " . - $db2->qstr($MAP_this->status) . " WHERE " . - $MAP_this->map['account_fields']['id']['map_field'] . " = " . - $db2->qstr($remote_account_id); - $group_result = $db2->Execute($sql); - if ($group_result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','MAP_account_group_sync_status', $db->ErrorMsg()); - return; - } - return $remote_account_id; - } -} -?> \ No newline at end of file diff --git a/modules/db_mapping/db_mapping_construct.xml b/modules/db_mapping/db_mapping_construct.xml deleted file mode 100644 index 1e5d3764..00000000 --- a/modules/db_mapping/db_mapping_construct.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - - db_mapping - - db_mapping
    - - - - 0 - - name - - 25 - - name - status,type - - - - I8 - 1 - - - I4 - - - C(128) - 3 - 128 - any - - - X2 - - - L - - - C(16) - - - C(128) - 1 - 128 - any - - - C(128) - 2 - 128 - any - - - C(128) - - - C(128) - - - C(128) - - - C(128) - - - X - array - - - X - array - - - C(128) - 4 - 128 - - - - - id,site_id,name,notes,status,type,db_name,db_host,db_user,db_pass,db_prefix,cookie_name,group_map,map_file,group_rank - id,site_id,name,notes,status,type,db_name,db_host,db_user,db_pass,db_prefix,cookie_name,group_map,map_file,group_rank - id,site_id,name,notes,status,type,db_name,db_host,db_user,db_pass,db_prefix,cookie_name,group_map,map_file,group_rank - id,site_id,name,notes,status,type,db_name,db_host,db_user,db_pass,db_prefix,cookie_name,group_map,map_file,group_rank - id,site_id,name,notes,status,type,db_name,db_host,db_user,db_pass,db_prefix,cookie_name,group_map,map_file,group_rank - - - 0 -
    diff --git a/modules/db_mapping/db_mapping_install.xml b/modules/db_mapping/db_mapping_install.xml deleted file mode 100644 index 8bf1e345..00000000 --- a/modules/db_mapping/db_mapping_install.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - db_mapping - setup - - 1 - - - - - view - - 1 - - - add - - - update - - - search - - - delete - - - search_show - - - sync - - - - \ No newline at end of file diff --git a/modules/discount/discount.inc.php b/modules/discount/discount.inc.php index 0c055038..7850d3d6 100644 --- a/modules/discount/discount.inc.php +++ b/modules/discount/discount.inc.php @@ -1,25 +1,34 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Module:Discount */ - -class discount -{ + +/** + * The main AgileBill Discount Class + * + * @package AgileBill + * @subpackage Module:Discount + */ +class discount extends OSB_module { /** * array of available discounts * @@ -48,13 +57,6 @@ class discount */ var $plugins=false; - /** - * Setup the discount plugin array if needed - */ - function discount() { - // $this->plugins = array('test'); - } - /** * Load a specific discount plugin and validate the results * @@ -358,22 +360,6 @@ class discount return true; } - - function discount_construct() { - $this->module = "discount"; - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - function user_search($VAR) { # Lock the user only for his billing_records: if(!SESS_LOGGED) { @@ -381,7 +367,6 @@ class discount } # Lock the account_id $VAR['discount_avail_account_id'] = SESS_ACCOUNT; - $this->discount_construct(); $type = "search"; $this->method["$type"] = explode(",", $this->method["$type"]); $db = new CORE_database; @@ -393,61 +378,13 @@ class discount if(!SESS_LOGGED) { return false; } - $this->discount_construct(); $type = "search"; $this->method["$type"] = explode(",", $this->method["$type"]); $db = new CORE_database; $db->search_show($VAR, $this, $type); } - function add($VAR) { - $this->discount_construct(); - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - function view($VAR) { - $this->discount_construct(); - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - function update($VAR) { - $this->discount_construct(); - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - function delete($VAR) { - $this->discount_construct(); - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - function search_form($VAR) { - $this->discount_construct(); - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - function search($VAR) { - $this->discount_construct(); - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - function search_show($VAR) { - $this->discount_construct(); $type = "search"; $this->method["$type"] = explode(",", $this->method["$type"]); $dbc = new CORE_database; @@ -477,4 +414,4 @@ class discount $smarty->assign('discount', $smart); } } -?> \ No newline at end of file +?> diff --git a/modules/discount/discount_construct.xml b/modules/discount/discount_construct.xml index ed463398..995dd409 100644 --- a/modules/discount/discount_construct.xml +++ b/modules/discount/discount_construct.xml @@ -1,120 +1,176 @@ - - discount - - discount
    - - - - 0 - - name - - 25 - - - date_start - date_expire - status - - - - - I8 - 1 - 1 - - - I4 - 1 - - - I8 - date-now - - - I8 - date - - - I8 - date - - - L - - - C(64) - 2 - 32 - any - - - X2 - - - I4 - - - I4 - - - I8 - - - X2 - country - name - array - - - X2 - array - - - X2 - array - - - L - - - L - - - F - - - F - - - F - - - L - - - L - - - F - - - F - - - F - - - - - id,site_id,date_orig,date_start,date_expire,status,name,notes,max_usage_account,max_usage_global,avail_account_id,avail_product_id,avail_group_id,avail_tld_id,new_status,new_type,new_rate,new_max_discount,new_min_cost,recurr_status,recurr_type,recurr_rate,recurr_max_discount,recurr_min_cost - id,site_id,date_orig,date_start,date_expire,status,name,notes,max_usage_account,max_usage_global,avail_account_id,avail_product_id,avail_group_id,avail_tld_id,new_status,new_type,new_rate,new_max_discount,new_min_cost,recurr_status,recurr_type,recurr_rate,recurr_max_discount,recurr_min_cost - id,site_id,date_orig,date_start,date_expire,status,name,notes,max_usage_account,max_usage_global,avail_account_id,avail_product_id,avail_group_id,avail_tld_id,new_status,new_type,new_rate,new_max_discount,new_min_cost,recurr_status,recurr_type,recurr_rate,recurr_max_discount,recurr_min_cost - id,site_id,date_orig,date_start,date_expire,status,name,notes,max_usage_account,max_usage_global,avail_account_id,avail_product_id,avail_group_id,avail_tld_id,new_status,new_type,new_rate,new_max_discount,new_min_cost,recurr_status,recurr_type,recurr_rate,recurr_max_discount,recurr_min_cost - id,site_id,date_orig,date_start,date_expire,status,name,notes,max_usage_account,max_usage_global,avail_account_id,new_status,new_type,new_rate,new_max_discount,new_min_cost,recurr_status,recurr_type,recurr_rate,recurr_max_discount,recurr_min_cost - - - 0 + + discount + + discount
    + + + + 0 + + name + + 25 + + 0 + + + + date_start + date_expire + status + + + + + + + 1 + I8 + 1 + + + + 1 + I4 + + + + date-now + Date Created + I8 + + + + Active + L + + + date + Date Start + I8 + + + date + Date End + I8 + + + Name + 2 + 32 + C(64) + any + + + Notes + X2 + + + I4 + + + I4 + + + Account + I8 + + + Product + X2 + country + name + array + + + array + Group + X2 + + + array + Domain + X2 + + + L + + + L + + + F + + + F + + + F + + + L + + + L + + + F + + + F + + + F + + + + + + date_start,date_expire,status,name,notes,max_usage_account,max_usage_global,avail_account_id,avail_product_id,avail_group_id,avail_tld_id,new_status,new_type,new_rate,new_max_discount,new_min_cost,recurr_status,recurr_type,recurr_rate,recurr_max_discount,recurr_min_cost + id,site_id,date_orig,date_start,date_expire,status,name,notes,max_usage_account,max_usage_global,avail_account_id,avail_product_id,avail_group_id,avail_tld_id,new_status,new_type,new_rate,new_max_discount,new_min_cost,recurr_status,recurr_type,recurr_rate,recurr_max_discount,recurr_min_cost + id,site_id,date_orig,date_start,date_expire,status,name,notes,max_usage_account,max_usage_global,avail_account_id,avail_product_id,avail_group_id,avail_tld_id,new_status,new_type,new_rate,new_max_discount,new_min_cost,recurr_status,recurr_type,recurr_rate,recurr_max_discount,recurr_min_cost + id,site_id,date_orig,date_start,date_expire,status,name,notes,max_usage_account,max_usage_global,avail_account_id,avail_product_id,avail_group_id,avail_tld_id,new_status,new_type,new_rate,new_max_discount,new_min_cost,recurr_status,recurr_type,recurr_rate,recurr_max_discount,recurr_min_cost + id,site_id,date_orig,date_start,date_expire,status,name,notes,max_usage_account,max_usage_global,avail_account_id,new_status,new_type,new_rate,new_max_discount,new_min_cost,recurr_status,recurr_type,recurr_rate,recurr_max_discount,recurr_min_cost + + + + + + + + + + + + + + id + checkbox + 25px + + + name + + + status + + + orders + invoice_count + + + revenue + revenue + + + savings + savings + + + new_type + + +
    diff --git a/modules/discount/discount_install.xml b/modules/discount/discount_install.xml index cfb721d2..a3127bbb 100644 --- a/modules/discount/discount_install.xml +++ b/modules/discount/discount_install.xml @@ -1,39 +1,59 @@ + + - discount - account_admin - + + + + Discounts + 1 + + discount + + + + account + + + + base - - - - search - - 1 - - - view - - 1 - - - delete - - - update - - - add - - 1 - - - search_form - - - search_show - - - - \ No newline at end of file + + + + + Add + 1 + add + + + + delete + + + + List + 1 + search + + + + + search_form + + + + search_show + + + + update + + + + view + + + + diff --git a/modules/email_log/email_log.inc.php b/modules/email_log/email_log.inc.php index cf3db10d..1d6b765c 100644 --- a/modules/email_log/email_log.inc.php +++ b/modules/email_log/email_log.inc.php @@ -1,118 +1,79 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Modules:EmailLog */ - -class email_log -{ + +/** + * The main AgileBill Email Log Class + * + * @package AgileBill + * @subpackage Modules:EmailLog + */ +class email_log extends OSB_module { var $user_view_count = 25; /* show last X email logs for user */ - - function user_list($VAR) { - if(!SESS_LOGGED) return false; - $db=&DB(); - $email = $db->GetOne("select email from ".AGILE_DB_PREFIX."account where id = ".SESS_ACCOUNT); - $rs=$db->Execute(sqlSelect($db,"email_log","id,email,date_orig,subject,urgent,userread", - "email=::$email:: and account_id=".SESS_ACCOUNT,'date_orig',$this->user_view_count)); - if($rs && $rs->RecordCount()) { - $smart=array(); - while(!$rs->EOF) { - array_push($smart, $rs->fields); - $rs->MoveNext(); + + public function user_list($VAR) { + if (! SESS_LOGGED) + return false; + + $db = &DB(); + + $email = $db->GetOne(sqlSelect($db,'account','email',array('id'=>SESS_ACCOUNT))); + $rs = $db->Execute( + sqlSelect($db,'email_log','id,email,date_orig,subject,urgent,userread',array('email'=>$email,'account_id'=>SESS_ACCOUNT),'date_orig',$this->user_view_count)); + + if ($rs && $rs->RecordCount()) { + $smart = array(); + while (! $rs->EOF) { + array_push($smart,$rs->fields); + $rs->MoveNext(); } + global $smarty; - $smarty->assign('email_log', $smart); - } - } - - function user_view($VAR) { - /* validate, update to read, and view() */ - if(!SESS_LOGGED || empty($VAR['id'])) return false; - /* select id for this user */ - $db=&DB(); - $rs = $db->Execute(sqlSelect($db,"email_log","*","id=::{$VAR['id']}:: and account_id=".SESS_ACCOUNT)); - if($rs && $rs->RecordCount()) { - global $smarty; - $smarty->assign('email_log', $rs->fields); - if($rs->fields['userread'] != 1) { - /* update to read */ - $fields=Array('userread'=>1); - $db->Execute(sqlUpdate($db,"email_log",$fields,"id = {$rs->fields['id']}")); - } + $smarty->assign('email_log',$smart); } } - + + public function user_view($VAR) { + if (! SESS_LOGGED || empty($VAR['id'])) + return false; + + $db = &DB(); + + $rs = $db->Execute(sqlSelect($db,'email_log','*',array('id'=>$VAR['id'],'account_id'=>SESS_ACCOUNT))); + if ($rs && $rs->RecordCount()) { + global $smarty; + + $smarty->assign('email_log',$rs->fields); + # Update to read + if ($rs->fields['userread'] != 1) + $db->Execute(sqlUpdate($db,'email_log',array('userread'=>1),array('id'=>$rs->fields['id']))); + } + } + function add($account_id, $subject, $message, $email, $html=0, $urgent=0) { $db=&DB(); $fields=Array('date_orig'=>time(), 'account_id'=>$account_id, 'subject'=>$subject, 'message'=>$message, 'email'=>$email, 'html'=>$html, 'urgent'=>$urgent, 'userread'=>0); $id = & $db->Execute(sqlInsert($db,"email_log",$fields)); } - - function view($VAR) { - $this->construct(); - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - function delete($VAR) { - $this->construct(); - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - function search_form($VAR) { - $this->construct(); - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - function search($VAR) { - $this->construct(); - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - function search_show($VAR) { - $this->construct(); - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } - - function construct() { - $this->module = "email_log"; - $this->xml_construct = PATH_MODULES . $this->module . "/" . $this->module . "_construct.xml"; - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } } -?> \ No newline at end of file +?> diff --git a/modules/email_log/email_log_construct.xml b/modules/email_log/email_log_construct.xml index 1a5745ff..34a8ffac 100644 --- a/modules/email_log/email_log_construct.xml +++ b/modules/email_log/email_log_construct.xml @@ -1,55 +1,107 @@ - - email_log - email_log
    - setup - 0 - date_orig - 35 + + + email_log + + email_log
    + + setup + + 0 + + date_orig + + 25 + + 1 + + id,site_id,account_id email html,urgent,userread - - - I8 - 1 - - - I4 - - - I8 - date-now - - - I4 - any - - - C(128) - - - C(128) - - - X2 - - - L - - - L - - - L - - - - id,site_id,date_orig,account_id,email,subject,message,html,urgent,userread - id,site_id,date_orig,account_id,email,subject,message,html,urgent,userread - id,site_id,date_orig,account_id,email,subject,message,html,urgent,userread - - -
    \ No newline at end of file + + + + + + 1 + I8 + 1 + + + + 1 + I4 + + + + date-now + Date Created + I8 + + + I4 + any + + + Email Address + C(128) + + + Subject + C(128) + + + Message + X2 + + + L + + + L + + + L + + + + + + id,site_id,date_orig,account_id,email,subject,message,html,urgent,userread + id,site_id,date_orig,account_id,email,subject,message,html,urgent,userread + id,site_id,date_orig,account_id,email,subject,message,html,urgent,userread + + + + + + + + <user_list>Emails</user_list> + <user_view>Email</user_view> + + + + + + + id + checkbox + 25px + + + date_orig + date + + + email + + + subject + + + +
    diff --git a/modules/email_log/email_log_install.xml b/modules/email_log/email_log_install.xml index c500c944..acee29f1 100644 --- a/modules/email_log/email_log_install.xml +++ b/modules/email_log/email_log_install.xml @@ -1,34 +1,51 @@ - + + - email_log - setup - Stores log of all e-mails sent out to accounts - 1 - setup - - - - - - delete - - - view - core:search&module=%%&_escape=1 - 1 - - - search - %%:search_form - 1 - - - search_form - - - search_show - - - - \ No newline at end of file + + setup + + Email Log + + 1 + + email_log + + + + setup + + + + + + + + + + delete + + + + List + 1 + search + + + + + Search + 1 + search_form + + + + search_show + + + + view + + + + diff --git a/modules/email_queue/email_queue.inc.php b/modules/email_queue/email_queue.inc.php index f36f0bcc..f2fc2d1a 100644 --- a/modules/email_queue/email_queue.inc.php +++ b/modules/email_queue/email_queue.inc.php @@ -1,189 +1,67 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Module:EmailQueue */ - -class email_queue -{ - # Open the constructor for this mod - function email_queue() - { - # name of this module: - $this->module = "email_queue"; +/** + * The main AgileBill Email Queue Class + * + * @package AgileBill + * @subpackage Module:EmailQueue + */ +class email_queue extends OSB_module { + /** + * Send mails in the queue + */ + public function send($VAR) { + $db = &DB(); + $rs = $db->Execute(sqlSelect($db,'email_queue','*',array('status'=>0))); - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; + if ($rs && $rs->RecordCount()) { + require_once(PATH_MODULES.'email_template/email_template.inc.php'); - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); + while (! $rs->EOF) { + # Get values + $sql = array(); + $sql[1] = $rs->fields['sql1']; + $sql[2] = $rs->fields['sql2']; + $sql[3] = $rs->fields['sql3']; - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - ############################## - ## SEND E-MAILS IN QUEUE ## - ############################## - function send($VAR) - { - $VAR_ORIG = $VAR; - - $db = &DB(); - $dbm = new CORE_database; - $sql = $dbm->sql_select("email_queue", "*", "status = 0", "", $db); - $rs = $db->Execute($sql); - - if($rs != false && $rs->RecordCount() > 0) - { - require_once ( PATH_MODULES . 'email_template/email_template.inc.php' ); - while(!$rs->EOF) - { - # Get values - global $VAR; - $VAR = unserialize($rs->fields['var']); - - $sql1 = $rs->fields['sql1']; - $sql2 = $rs->fields['sql2']; - $sql3 = $rs->fields['sql3']; - - if(!empty($sql1)) { - if(ereg("^a:", $sql1) && is_array(unserialize($sql1))) $sql1 = unserialize($sql1); - } else { - $sql1 = false; - } - - if(!empty($sql2)) { - if(ereg("^a:", $sql2) && is_array(unserialize($sql2))) $sql2 = unserialize($sql2); - } else { - $sql2 = false; - } - - if(!empty($sql3)) { - if(ereg("^a:", $sql3) && is_array(unserialize($sql3))) $sql3 = unserialize($sql3); - } else { - $sql3 = false; - } + # Unserialize the SQL data if required. + foreach ($sql as $i) + if (preg_match('/^a:/',$sql[$i]) && is_array($a = unserialize($sql[$a]))) + $sql[$i] = $a; # Send email $mail = new email_template; - $result = $mail->send($rs->fields['email_template'], $rs->fields['account_id'], $sql1, $sql2, $sql3, false); + $result = $mail->send($rs->fields['email_template'],$rs->fields['account_id'],$sql[1],$sql[2],$sql[3],false); # Update to sent status - if($result) - { - $sql = "UPDATE ".AGILE_DB_PREFIX."email_queue SET - status = 1 - WHERE - id = {$rs->fields['id']} - AND - site_id = ".DEFAULT_SITE; - $db->Execute($sql); - } + if ($result) + $db->Execute(sqlUpdate($db,'email_queue',array('status'=>1),array('id'=>$rs->fields['id']))); + $rs->MoveNext(); } } - - $VAR = $VAR_ORIG; } - - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } } -?> \ No newline at end of file +?> diff --git a/modules/email_queue/email_queue_construct.xml b/modules/email_queue/email_queue_construct.xml index 6bca2ae4..77f7ff44 100644 --- a/modules/email_queue/email_queue_construct.xml +++ b/modules/email_queue/email_queue_construct.xml @@ -1,78 +1,126 @@ + + email_queue + + email_queue
    + + + + 0 + + id + + 25 + + 0 - - email_queue + + + - - email_queue
    + + + + + 1 + I8 + 1 + + + + 1 + I4 + + + + date-now + Date Created + I8 + + + + date-now + Date Updated + I8 + + + + Processed + L + + + Account + C(128) + + + Email Template + C(128) + + + Data Field 1 + C(128) + + + Data Field 2 + C(128) + + + Data Field 3 + C(128) + + + Data Field 4 + C(128) + + + Data Field 5 + C(128) + + + Data Variables + X2 + + - - + + + id,site_id,date_orig,date_last,status,account_id,email_template,sql1,sql2,sql3,sql4,sql5,var + id,site_id,date_orig,date_last,status,account_id,email_template,sql1,sql2,sql3,sql4,sql5,var + id,site_id,date_orig,date_last,status,account_id,email_template,sql1,sql2,sql3,sql4,sql5,var + id,site_id,date_orig,date_last,status,account_id,email_template,sql1,sql2,sql3,sql4,sql5,var + id,site_id,date_orig,date_last,status,account_id,email_template,sql1,sql2,sql3,sql4,sql5,var + - - 0 + + - - id + + + - - 35 - - - - - I8 - - - I4 - - - I8 - time - - - I8 - date-now - - - L - - - C(128) - - - C(128) - - - C(128) - - - C(128) - - - C(128) - - - C(128) - - - C(128) - - - X2 - - - - - - id,site_id,date_orig,date_last,status,account_id,email_template,sql1,sql2,sql3,sql4,sql5,var - id,site_id,date_orig,date_last,status,account_id,email_template,sql1,sql2,sql3,sql4,sql5,var - id,site_id,date_orig,date_last,status,account_id,email_template,sql1,sql2,sql3,sql4,sql5,var - id,site_id,date_orig,date_last,status,account_id,email_template,sql1,sql2,sql3,sql4,sql5,var - id,site_id,date_orig,date_last,status,account_id,email_template,sql1,sql2,sql3,sql4,sql5,var - - - - 0 -
    \ No newline at end of file + + + + + id + checkbox + 25px + + + date_orig + date + + + account_id + + + email_template + + + status + bool + + + + diff --git a/modules/email_queue/email_queue_install.xml b/modules/email_queue/email_queue_install.xml index 8cdd8825..0f3b53ae 100644 --- a/modules/email_queue/email_queue_install.xml +++ b/modules/email_queue/email_queue_install.xml @@ -1,22 +1,29 @@ + + + + + + + + 0 + + email_queue + + + + email_queue + + + + base + - - - email_queue - account_admin - Stores the email queue for future mailing - - - - - - - - - - add - - - - \ No newline at end of file + + + + add + + + diff --git a/modules/email_template/email_template.inc.php b/modules/email_template/email_template.inc.php index 5cbefd6b..aac54b07 100644 --- a/modules/email_template/email_template.inc.php +++ b/modules/email_template/email_template.inc.php @@ -1,527 +1,329 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Module:Mail */ /** + * The main AgileBill Mail Template Class + * * include_once(PATH_MODULES.'email_template/email_template.inc.php'); * $my = new email_template; - * $my->send('newsletter_subscribe', '4d1800b401f5d340f022688de0ac2687', 'f1714072da3c05a220ac3b60a3a57d88', '2', '3'); + * $my->send('newsletter_subscribe','4d1800b401f5d340f022688de0ac2687','f1714072da3c05a220ac3b60a3a57d88','2','3'); + * + * @package AgileBill + * @subpackage Module:Mail */ -class email_template -{ - var $debug=false; - - # Open the constructor for this mod - function construct() - { - # name of this module: - $this->module = "email_template"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $this->construct(); - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $this->construct(); - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $this->construct(); - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $this->construct(); - $this->associated_DELETE[] = Array( 'table' => 'email_template_translate', - 'field' => 'email_template_id'); - - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $this->construct(); - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $this->construct(); - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $this->construct(); - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } - - - - - ############################## - ## SEND EMAIL TEMPLATE ## - ############################## - - function send($template, $acct, $sql1, $sql2, $sql3, $queue=true) - { - global $VAR, $C_debug; +class email_template extends OSB_module { + /** + * Send or Queue template based email + * + * Prefixing the template with "admin->" will result in the mail being + * sent to the admin only. + * + * @param string $template_name Name of template to use + * @param int $acct Account ID or email address + */ + public function send($template_name,$acct,$sql1,$sql2,$sql3,$queue=true) { + global $VAR,$C_debug,$C_list; $db = &DB(); - # Send to admin only? + # Send to admin only? $admin_only = false; - if(eregi('admin->', $template)) { + if (preg_match('/^admin->/',$template_name)) { $admin_only = true; - $template = eregi_replace('admin->', '', $template); - } + $template_name = preg_replace('/^admin->/','',$template_name); + } + $template = $db->Execute(sqlselect($db,'email_template','*',array('name'=>$template_name))); - ############################################################ - ### Get the template settings + # If the template is not active, return. + if (! $template || $template->fields['status'] != '1') + return; - $q = "SELECT * FROM ".AGILE_DB_PREFIX."email_template WHERE - site_id = ".$db->qstr(DEFAULT_SITE)." AND - name = ".$db->qstr($template); - $template = $db->Execute($q); - if($template->fields['status'] != '1') - return; + # Setup our Email + $E = array(); - $E['priority'] = $template->fields["priority"]; + # Email Priority + $E['priority'] = $template->fields['priority']; - ############################################################ - ### Get the setup_email settings - - if(empty($template->fields["setup_email_id"])) + # Get the setup_email settings + if (empty($template->fields['setup_email_id'])) $setup_email_id = DEFAULT_SETUP_EMAIL; else - $setup_email_id = $template->fields["setup_email_id"]; + $setup_email_id = $template->fields['setup_email_id']; - $q = "SELECT * FROM ".AGILE_DB_PREFIX."setup_email WHERE - site_id = ".$db->qstr(DEFAULT_SITE)." AND - id = ".$db->qstr($setup_email_id); - $setup_email = $db->Execute($q); + $setup_email = $db->Execute(sqlSelect($db,'setup_email','*',array('id'=>$setup_email_id))); - ### E-mail queue? - if($setup_email->fields['queue'] == 1 && $queue) - { + # Queue the email + if ($queue && $C_list->is_installed('email_queue') && $setup_email->fields['queue']) { # Set sql vars - if(is_array($sql1)) $sql1 = serialize($sql1); - if(is_array($sql2)) $sql2 = serialize($sql2); - if(is_array($sql3)) $sql3 = serialize($sql3); - if(is_array($VAR)) $var = serialize($VAR); - if(@$admin_only) - $sql_template = "admin->".$template->fields['name']; + if (is_array($sql1)) + $sql1 = serialize($sql1); + if (is_array($sql2)) + $sql2 = serialize($sql2); + if (is_array($sql3)) + $sql3 = serialize($sql3); + if (is_array($VAR)) + $var = serialize($VAR); + + # If this was an admin only email, we need to rewrite the template name again. + if ($admin_only) + $sql_template = sprintf('admin->%s',$template->fields['name']); else $sql_template = $template->fields['name']; - # Check that this email is not already in the queue: - $q = "SELECT id FROM ".AGILE_DB_PREFIX."email_queue WHERE - site_id = ".$db->qstr(DEFAULT_SITE)." AND - status = 0 AND - account_id = '$acct' AND - email_template= ".$db->qstr($sql_template)." AND - sql1 = ".$db->qstr(@$sql1)." AND - sql2 = ".$db->qstr(@$sql2)." AND - sql3 = ".$db->qstr(@$sql3); - $duplicates = $db->Execute($q); - if($duplicates != false && $duplicates->RecordCount() > 0) - return; + # Check that this email is not already in the queue + $duplicates = $db->Execute(sqlSelect($db,'email_queue','id', + array('status'=>0,'account_id'=>$acct,'email_template'=>$sql_template,'sql1'=>$sql1,'sql2'=>$sql2,'sql3'=>$sql3) + )); + if ($duplicates != false && $duplicates->RecordCount() > 0) + return; - # queue this e-mail: - $id = $db->GenID(AGILE_DB_PREFIX.'email_queue_id'); - $sql = "INSERT INTO ".AGILE_DB_PREFIX."email_queue SET - id = $id, - site_id = ".DEFAULT_SITE.", - date_orig = ".time().", - date_last = ".time().", - status = 0, - account_id = '$acct', - email_template= ".$db->qstr($sql_template).", - sql1 = ".$db->qstr(@$sql1).", - sql2 = ".$db->qstr(@$sql2).", - sql3 = ".$db->qstr(@$sql3).", - var = ".$db->qstr(@$var); - $db->Execute($sql); - return; - } - - if($setup_email->fields['type'] == 0) { - $type = 0; - } else { - $type = 1; - $E['server'] = $setup_email->fields['server']; - $E['account'] = $setup_email->fields['username']; - $E['password'] = $setup_email->fields['password']; - } - - $E['from_name'] = $setup_email->fields['from_name']; - $E['from_email'] = $setup_email->fields['from_email']; - - if($setup_email->fields['cc_list'] != '') - $E['cc_list'] = explode(',', $setup_email->fields['cc_list']); - - if($setup_email->fields['bcc_list'] != '') - $E['bcc_list'] = explode(',', $setup_email->fields['bcc_list']); - - - - ############################################################ - ### Get the account settings - - $q = "SELECT * FROM ".AGILE_DB_PREFIX."account WHERE - site_id = ".$db->qstr(DEFAULT_SITE)." AND - ( - email = ".$db->qstr($acct)." OR - id = ".$db->qstr($acct). " - )"; - $account = $db->Execute($q); - if($account == false) - { - $C_debug->error('email_template.inc.php','send1', $db->ErrorMsg() . " " . $sql); - return false; - } - else - { - if($admin_only == false) - { - if($account->RecordCount() > 0) { - $E['to_email'] = $account->fields['email']; - $E['to_name'] = $account->fields['first_name'] . ' ' . $account->fields['last_name']; - $this->ab_account = true; - } else { - $E['to_email'] = $acct; - $E['to_name'] = $acct; - $this->ab_account = false; - } - } else { - $E['to_email'] = $setup_email->fields['from_email']; - $E['to_name'] = $setup_email->fields['from_name']; - $this->ab_account = true; - } - } - - - ############################################################ - ### Get the template translation for the specified account for text/htm - - if(@$this->ab_account && @$account->fields["language_id"] != "") - $language_id = $account->fields["language_id"]; - else - $language_id = DEFAULT_LANGUAGE; - - $q = "SELECT * FROM ".AGILE_DB_PREFIX."email_template_translate WHERE - site_id = ".$db->qstr(DEFAULT_SITE)." AND - language_id = ".$db->qstr($language_id)." AND - email_template_id = ".$db->qstr($template->fields["id"]); - $setup_email = $db->Execute($q); - - if(!$setup_email || !$setup_email->RecordCount()) { - # get the default translation for this email: - $q = "SELECT * FROM ".AGILE_DB_PREFIX."email_template_translate WHERE - site_id = ".$db->qstr(DEFAULT_SITE)." AND - language_id = ".$db->qstr(DEFAULT_LANGUAGE)." AND - email_template_id = ".$db->qstr($template->fields["id"]); - $setup_email = $db->Execute($q); - } - - if(!$setup_email || !$setup_email->RecordCount()) { - # unable to locate translation! - global $C_debug; - $message = 'Unable to locate translation for Email Template "'.$template->fields['name'].'" and Language "'. $language_id .'" OR "' . DEFAULT_LANGUAGE . '"'; - $C_debug->error('email_template.inc.php','send', $message); + # Queue this Email + $db->Execute(sqlInsert($db,'email_queue',array( + 'date_orig'=>time(), + 'date_last'=>time(), + 'status'=>0, + 'account_id'=>$acct, + 'email_template'=>$sql_template, + 'sql1'=>$sql1, + 'sql2'=>$sql2, + 'sql3'=>$sql3, + 'var'=>$var) + )); return; } - - # set the subject: - $E['subject'] = $setup_email->fields['subject']; - - # determine whether to send HTML or not... - if(@$this->ab_account && $account->fields['email_type'] == 1) { - if(!empty($setup_email->fields['message_html'])) { - $E['body_html'] = $setup_email->fields['message_html']; - $E['html'] = '1'; - } else { - $E['body_html'] = false; - $E['html'] = '0'; - } - } else { - $E['html'] = '0'; + # Is this an SMTP connection + if ($setup_email->fields['type'] == 1) { + $E['server'] = $setup_email->fields['server']; + $E['account'] = $setup_email->fields['username']; + $E['password'] = $setup_email->fields['password']; } - $E['body_text'] = $setup_email->fields['message_text']; + $E['from_name'] = $setup_email->fields['from_name']; + $E['from_email'] = $setup_email->fields['from_email']; - ### Get the date-time + if ($setup_email->fields['cc_list']) + $E['cc_list'] = explode(',',$setup_email->fields['cc_list']); + + if ($setup_email->fields['bcc_list']) + $E['bcc_list'] = explode(',',$setup_email->fields['bcc_list']); + + # Get the account settings + $account = $db->Execute($q=sqlSelect($db,'account','*',sprintf('(email=::%s:: OR id=::%s::)',$acct,$acct))); + if (! $account) { + $C_debug->error(__FILE__,__METHOD__,sprintf('%s %s',$db->ErrorMsg(),$q)); + + return false; + } + + if ($admin_only) { + $E['to_email'] = $setup_email->fields['from_email']; + $E['to_name'] = $setup_email->fields['from_name']; + $ab_account = true; + + } else { + if ($account->RecordCount() > 0) { + $E['to_email'] = $account->fields['email']; + $E['to_name'] = sprintf('%s %s',$account->fields['first_name'],$account->fields['last_name']); + $ab_account = true; + + } else { + $E['to_email'] = $acct; + $E['to_name'] = $acct; + $ab_account = false; + } + } + + # Get the template translation for the specified account for text/htm + if ($ab_account && $account->fields['language_id']) + $language_id = $account->fields['language_id']; + else + $language_id = DEFAULT_LANGUAGE; + + $email_template_translate = $db->Execute(sqlSelect($db,'email_template_translate','*',array('language_id'=>$language_id,'email_template_id'=>$template->fields['id']))); + + # If there is no translation, get the default translation for this email + if (! $email_template_translate || ! $email_template_translate->RecordCount()) + $email_template_translate = $db->Execute(sqlSelect($db,'email_template_translate','*',array('language_id'=>DEFAULT_LANGUAGE,'email_template_id'=>$template->fields['id']))); + + # Unable to locate translation? + if (! $email_template_translate || ! $email_template_translate->RecordCount()) { + global $C_debug; + + $C_debug->error(__FILE__,__METHOD__, + sprintf('Unable to locate translation for Email Template %s and Language %s OR %s',$template->fields['name'],$language_id,DEFAULT_LANGUAGE)); + + return; + } + + # Set the subject: + $E['subject'] = $email_template_translate->fields['subject']; + + # Determine whether to send HTML or not... + if ($ab_account && $account->fields['email_type'] == 1) { + if (! empty($email_template_translate->fields['message_html'])) { + $E['body_html'] = $email_template_translate->fields['message_html']; + $E['html'] = '1'; + + } else { + $E['body_html'] = false; + $E['html'] = '0'; + } + + } else { + $E['html'] = '0'; + } + + $E['body_text'] = $email_template_translate->fields['message_text']; + + # Get the date-time include_once(PATH_CORE.'list.inc.php'); - $C_list = new CORE_list; - $date = $C_list->date_time(time()); + $cl = new CORE_list; - ### Url formatting... - if($admin_only) { + $date = $cl->date_time(time()); + + # Url formatting. + if ($admin_only) { $site_url = URL.'admin.php'; $site_ssl_url = SSL_URL.'admin.php'; + } else { $site_url = URL; - $site_ssl_url = SSL_URL; + $site_ssl_url = SSL_URL; } - ### Get the replace vars from the email template: - $replace = Array('%site_name%' => $E['from_name'], - '%site_email%' => $E['from_email'], - '%url%' => $site_url, - '%date%' => $date, - '%ssl_url%' => $site_ssl_url); + # Get the replace vars from the email template: + $replace = array( + '%site_name%' => $E['from_name'], + '%site_email%' => $E['from_email'], + '%url%' => $site_url, + '%date%' => $date, + '%ssl_url%' => $site_ssl_url); - ### Get the replace vars from the $VAR variable: - reset($VAR); - while(list($key, $value) = each($VAR)) - { - $re_this = "%var_".$key."%"; + # Include the replace vars from the $VAR variable: + foreach ($VAR as $key => $value) { + $re_this = sprintf('%%var_%s%%',$key); $replace[$re_this] = $value; } - ### Get the replace vars from the account: + # Get the replace vars from the account $replace['%acct_id%'] = $acct; - if(@$this->ab_account) { - while(list($key, $value) = each($account->fields)) { - $re_this = "%acct_".$key."%"; + if ($ab_account) + foreach ($account->fields as $key => $value) { + $re_this = sprintf('%%acct_%s%%',$key); $replace[$re_this] = $value; - } - } - - ############################################################ - ### Get the SQL1 Query/Arrays - if(!empty($template->fields["sql_1"]) && !empty($sql1) &&!is_array($sql1)) - { - $sql = eregi_replace('%DB_PREFIX%', AGILE_DB_PREFIX, $template->fields["sql_1"]); - $sql = eregi_replace('%SQL1%', $db->qstr($sql1), $sql); - if(!is_array($sql2)) - $sql = eregi_replace('%SQL2%', $db->qstr($sql2), $sql); - if(!is_array($sql3)) - $sql = eregi_replace('%SQL3%', $db->qstr($sql3), $sql); - $sql .= " AND site_id = ". $db->qstr(DEFAULT_SITE); - $SQL_1 = $db->Execute($sql); - - if($SQL_1 == false) - { - ### return the error message - global $C_debug; - $C_debug->error('email_template.inc.php','send', $db->ErrorMsg() . " " . $sql); } - else if($SQL_1->RecordCount() > 0) - { - ### Get the replace vars from the sql results: - while(list($key, $value) = each($SQL_1->fields)) - { - $re_this = "%sql1_".$key."%"; - $replace[$re_this] = $value; + + # Get the SQL1/2/3 Query/Arrays + foreach (array(1,2,3) as $i) + if ($template->fields['sql_'.$i] && $sql1 && ! is_array($sql1)) { + # Set our DB prefix + $sql = str_replace('%DB_PREFIX%',AGILE_DB_PREFIX,$template->fields['sql_'.$i]); + + # Set the SQL + $sql = str_replace('%SQL1%',$db->qstr($sql1),$sql); + if ($sql2 && ! is_array($sql2)) + $sql = str_replace('%SQL2%',$db->qstr($sql2),$sql); + if ($sql3 && ! is_array($sql3)) + $sql = str_replace('%SQL3%',$db->qstr($sql3),$sql); + + $sql .= sprintf(' AND site_id=%s',DEFAULT_SITE); + + $SQL = $db->Execute($sql); + + if (! $SQL) { + # Return the error message + global $C_debug; + + $C_debug->error(__FILE__,__METHOD__,sprintf('%s %s',$db->ErrorMsg(),$sql)); + + } elseif ($SQL->RecordCount() > 0) { + # Get the replace vars from the sql results: + foreach ($SQL->fields as $key => $value) { + $re_this = sprintf('%%sql%s_%s%%',$i,$key); + $replace[$re_this] = $value; + } } } - } - elseif (is_array($sql1)) - { - while(list($key, $value) = each($sql1[$i])) - $replace[$key] = $value; - } - elseif (!empty($sql1)) - { - $replace['%sql1%'] = $sql3; + + if (is_array($sql1)) { + echo '

    1a.HOW DID I GET HERE??? (WHAT SHOULD THIS DO??)';debug_print_backtrace();die();
    +			while(list($key,$value) = each($sql1))
    +				$replace[$key] = $value;
    +
    +		} elseif ($sql1 && ! $template->fields['sql_1']) {
    +			$replace['%sql1%'] = $sql1;
     		}
     
    +		if (is_array($sql2)) {
    +			echo '
    2a.HOW DID I GET HERE??? (WHAT SHOULD THIS DO??)';debug_print_backtrace();die();
    +			while(list($key,$value) = each($sql2))
    +				$replace[$key] = $value;
     
    -		############################################################
    -		### Get the SQL2 Query/Arrays 
    -		if(!empty($template->fields["sql_2"]) && !empty($sql2) &&!is_array($sql2))
    -		{
    -			$sql = eregi_replace('%DB_PREFIX%', AGILE_DB_PREFIX, $template->fields["sql_2"]);
    -			$sql = eregi_replace('%SQL1%', $db->qstr($sql1), $sql);
    -			if(!is_array($sql2)) 
    -			$sql = eregi_replace('%SQL2%', $db->qstr($sql2), $sql);
    -			if(!is_array($sql3)) 
    -			$sql = eregi_replace('%SQL3%', $db->qstr($sql3), $sql);
    -			$sql .= " AND site_id     = ".$db->qstr(DEFAULT_SITE);
    -			$SQL_2     = $db->Execute($sql);
    -			if($SQL_2 == false)
    -			{
    -				### return the error message
    -				global $C_debug;
    -				$C_debug->error('email_template.inc.php','send', $db->ErrorMsg() . " " . $sql);
    +		} elseif ($sql2 && ! $template->fields['sql_2']) {
    +			$replace['%sql2%'] = $sql2;
    +		}
    +
    +		if (is_array($sql3)) {
    +			echo '
    3a.HOW DID I GET HERE??? (WHAT SHOULD THIS DO??)';debug_print_backtrace();die();
    +			while(list($key,$value) = each($sql3))
    +				$replace[$key] = $value;
    +
    +		} elseif ($sql3 && ! $template->fields['sql_3']) {
    +			$replace['%sql3%'] = $sql3;
    +		}
    +
    +		foreach (array('subject','body_text','body_html') as $i)
    +			if (! empty($E[$i])) {
    +				# Replace the $replace vars in the body and subject
    +				foreach ($replace as $key => $value)
    +					$E[$i] = str_replace($key,$value,$E[$i]);
    +
    +				# Remove any unparsed vars from the body text and html:
    +				if (preg_match('/%/',$E[$i]))
    +					$E[$i] = preg_replace('/%[a-zA-Z0-9_]{1,}%/','',$E[$i]);
     			}
    -			else if($SQL_2->RecordCount() > 0)
    -			{
    -				### Get the replace vars from the sql results:
    -				while(list($key, $value) = each($SQL_2->fields))
    -				{
    -					$re_this  = "%sql2_".$key."%";
    -					$replace[$re_this] = $value;
    -				}
    -			} 
    -		} 
    -		elseif (is_array($sql2)) 
    -		{  
    -			 while(list($key, $value) = each($sql2[$i]))   
    -					$replace[$key] = $value;  
    -		}
    -		elseif (!empty($sql2))
    -		{
    -			$replace['%sql2%'] = $sql2; 
    -		}
     
    +		# Set any attachments (not currently supported)
    +		$E['attatchments'] = '';
     
    -		############################################################
    -		### Get the SQL3 Query/Arrays 
    -		if(!empty($template->fields["sql_3"]) && !empty($sql3) &&!is_array($sql3))
    -		{
    -			$sql = eregi_replace('%DB_PREFIX%', AGILE_DB_PREFIX, $template->fields["sql_3"]);
    -			$sql = eregi_replace('%SQL1%', $db->qstr($sql1), $sql);
    -			if(!is_array($sql2)) 
    -			$sql = eregi_replace('%SQL2%', $db->qstr($sql2), $sql);
    -			if(!is_array($sql3)) 
    -			$sql = eregi_replace('%SQL3%', $db->qstr($sql3), $sql);
    -			$sql .= " AND site_id     = ".$db->qstr(DEFAULT_SITE);
    -			$SQL_3          = $db->Execute($sql);
    -			if($SQL_3 == false)
    -			{
    -				### return the error message
    -				global $C_debug;
    -				$C_debug->error('email_template.inc.php','send', $db->ErrorMsg() . " " . $sql);
    -			}
    -			else if($SQL_3->RecordCount() > 0)
    -			{
    -				### Get the replace vars from the sql results:
    -				while(list($key, $value) = each($SQL_3->fields))
    -				{
    -					$re_this  = "%sql3_".$key."%";
    -					$replace[$re_this] = $value;
    -				}
    -			}
    -		} 
    -		elseif (is_array($sql3)) 
    -		{
    -			 while(list($key, $value) = each($sql3))   
    -					$replace[$key] = $value;  
    -		}
    -		elseif (!empty($sql3))
    -		{
    -			$replace['%sql3%'] = $sql3; 
    -		} 
    -
    -		### Replace the $replace vars in the body and subject
    -		while(list($key, $value) = each($replace))
    -		{
    -			$E['subject']   = eregi_replace($key, $value, $E['subject']);
    -			$E['body_text'] = eregi_replace($key, $value, $E['body_text']);
    -			if(!empty($E['body_html']))
    -			$E['body_html'] = eregi_replace($key, $value, $E['body_html']);
    -		}
    -
    -		### Remove any unparsed vars from the body text and html:  
    -		if(!empty($E['body_html']) && ereg('%',$E['body_html']))
    -		@$E['body_html'] = ereg_replace("%[a-zA-Z0-9_]{1,}%", '', $E['body_html']); 
    -		if(!empty($E['body_text']) && ereg("%",$E['body_text']))
    -		@$E['body_text'] = ereg_replace("%[a-zA-Z0-9_]{1,}%", '', $E['body_text']);            
    -
    -		### Set any attachments (not currently supported)
    -		$E['attatchments']  = '';
    -
    -		/* email log? */
    -		global $C_list;
    -		if(is_object($C_list) && $C_list->is_installed('email_log')) {
    +		# Email log?
    +		if ($C_list->is_installed('email_log')) {
     			include_once(PATH_MODULES.'email_log/email_log.inc.php');
    -			$log = new email_log;            	
    -			$log->add($acct, $E['subject'], $E['body_text'], $E['to_email'], false, $E['priority']);
    +			$log = new email_log;
    +
    +			$log->add($acct,$E['subject'],$E['body_text'],$E['to_email'],false,$E['priority']);
     		}
     
    -		### Call the mail class
    -		require_once(PATH_CORE   . 'email.inc.php');
    +		# Call the mail class
    +		require_once(PATH_CORE.'email.inc.php');
     		$email = new CORE_email;
    -		$email->debug=$this->debug;
    -		if($type == 0)
    -		return $email->PHP_Mail($E);
    +
    +		if ($setup_email->fields['type'] == 1)
    +			return $email->SMTP_Mail($E);
     		else
    -		return $email->SMTP_Mail($E);
    +			return $email->PHP_Mail($E);
     	}
     }
    -?>
    \ No newline at end of file
    +?>
    diff --git a/modules/email_template/email_template_construct.xml b/modules/email_template/email_template_construct.xml
    index dd5f4db6..4234cafb 100644
    --- a/modules/email_template/email_template_construct.xml
    +++ b/modules/email_template/email_template_construct.xml
    @@ -1,74 +1,118 @@
     
     
    -    
    -    email_template
    -    
    -    email_template
    - - - - 0 - - name - - 25 - - - name - - - - - I8 - 1 - 1 - - - I4 - 1 - - - I4 - setup_email - name - 1 - - - C(128) - 4 - 128 - any - - - L - - - X2 - - - X2 - - - X2 - - - X2 - - - X2 - - - L - - - - - id,site_id,setup_email_id,name,priority,shortcuts,notes,sql_1,sql_2,sql_3,status - id,site_id,setup_email_id,priority,shortcuts,notes,sql_1,sql_2,sql_3,status - id,site_id,setup_email_id,name,priority,shortcuts,notes,sql_1,sql_2,sql_3,status - id,site_id,setup_email_id,name,priority,shortcuts,notes,sql_1,sql_2,sql_3,status - id,site_id,setup_email_id,name,priority,shortcuts,notes,sql_1,sql_2,sql_3,status - - - 0 + + email_template + + email_template
    + + + + 0 + + name + + 25 + + 0 + + + + name + + + + + + + 1 + I8 + 1 + + + + 1 + I4 + + + + Active + L + + + setup_email + name + Setup Email + 1 + I4 + + + Name + C(128) + 4 + 128 + any + + + Priority + L + + + X2 + + + Notes + X2 + + + SQL 1 + X2 + + + SQL 2 + X2 + + + SQL 3 + X2 + + + + + + id,site_id,setup_email_id,name,priority,shortcuts,notes,sql_1,sql_2,sql_3,status + id,site_id,setup_email_id,priority,shortcuts,notes,sql_1,sql_2,sql_3,status + id,site_id,setup_email_id,name,priority,shortcuts,notes,sql_1,sql_2,sql_3,status + id,site_id,setup_email_id,name,priority,shortcuts,notes,sql_1,sql_2,sql_3,status + id,site_id,setup_email_id,name,priority,shortcuts,notes,sql_1,sql_2,sql_3,status + + + + + + + + + + + + + + id + checkbox + 25px + + + name + + + priority + bool + + + status + bool_icon + 20px + + +
    diff --git a/modules/email_template/email_template_install.xml b/modules/email_template/email_template_install.xml index 31562720..3151fd6b 100644 --- a/modules/email_template/email_template_install.xml +++ b/modules/email_template/email_template_install.xml @@ -1,35 +1,55 @@ + + - email_template - setup - + + + + + 1 + + email_template + + + + setup + + + + base - - - - search - - - view - - - 1 - - - search_show - - - add - - 1 - - - delete - - - update - - - - \ No newline at end of file + + + + + Add + 1 + add + + + + delete + + + + List + 1 + search + + + + + search_show + + + + update + + + + view + + + + diff --git a/modules/email_template/email_template_install_data.xml b/modules/email_template/email_template_install_data.xml index a07bde69..c33bcf5d 100644 --- a/modules/email_template/email_template_install_data.xml +++ b/modules/email_template/email_template_install_data.xml @@ -481,116 +481,6 @@ SELECT * FROM %DB_PREFIX%voip_vm WHERE mailbox=%SQL3% 1 - - 658 - 1 - 3 - ticket_piping_add_user - 0 - This e-mail is set to the user when a e-mail message is successfully piped to a new ticket. - SELECT * FROM %DB_PREFIX%ticket WHERE id = %SQL1% - 1 - - - 659 - 1 - 3 - ticket_piping_add_user_pending - 0 - This e-mail is set to the user when a e-mail message is piped to a new ticket and requires further authorization... - SELECT * FROM %DB_PREFIX%ticket WHERE id = %SQL1% - 1 - - - 660 - 1 - 3 - ticket_piping_add_user_unauth - 0 - This e-mail is set to the user when a e-mail message is piped to a new ticket and requires further authorization... - SELECT * FROM %DB_PREFIX%ticket WHERE id = %SQL1% - 1 - - - 661 - 1 - 1 - ticket_staff_add - 0 - all - This template is sent to all applicable staff members (except the staff member who added the ticket) when a staff member adds a new ticket - SELECT * FROM %DB_PREFIX%ticket WHERE id = %SQL1% - SELECT * FROM %DB_PREFIX%ticket_department WHERE id = %SQL2% - 1 - - - 662 - 1 - 1 - ticket_staff_add_user - 0 - all - This template is sent to the user when a staff member adds a new ticket to their account - SELECT * FROM %DB_PREFIX%ticket WHERE id = %SQL1% - 1 - - - 663 - 1 - 1 - ticket_staff_update_user - 0 - all - This template is sent out to the user when a staff member updates one of their tickets... - SELECT * FROM %DB_PREFIX%ticket WHERE id = %SQL1% - 1 - - - 664 - 1 - 1 - ticket_user_add - 0 - all - This template is sent out when a new ticket is added - SELECT * FROM %DB_PREFIX%ticket WHERE id = %SQL1% - 1 - - - 665 - 1 - 1 - ticket_user_add_staff - 0 - all - This email is sent to all ticket staff members who are set to recieve new ticket notices - SELECT * FROM %DB_PREFIX%ticket WHERE id = %SQL1% - SELECT * FROM %DB_PREFIX%ticket_department WHERE id = %SQL2% - 1 - - - 666 - 1 - 1 - ticket_user_update - 0 - All - This is sent to the user when they respond to a ticket - SELECT * FROM %DB_PREFIX%ticket WHERE id = %SQL1% - 1 - - - 667 - 1 - 1 - ticket_user_update_staff - 0 - all - This email is sent to all ticket staff members who are set to recieve updated ticket notices - SELECT * FROM %DB_PREFIX%ticket WHERE id = %SQL1% - SELECT * FROM %DB_PREFIX%ticket_department WHERE id = %SQL2% - 1 - 668 1 @@ -608,4 +498,4 @@ 668 - \ No newline at end of file + diff --git a/modules/email_template_translate/email_template_translate.inc.php b/modules/email_template_translate/email_template_translate.inc.php index 47375511..f2935734 100644 --- a/modules/email_template_translate/email_template_translate.inc.php +++ b/modules/email_template_translate/email_template_translate.inc.php @@ -1,125 +1,33 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Module:EmailTemplateTranslation */ - -class email_template_translate -{ - # Open the constructor for this mod - function email_template_translate() - { - # name of this module: - $this->module = "email_template_translate"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } +/** + * The main AgileBill Email Template Translation Class + * + * @package AgileBill + * @subpackage Module:EmailTemplateTranslation + */ +class email_template_translate extends OSB_module { } -?> \ No newline at end of file +?> diff --git a/modules/email_template_translate/email_template_translate_construct.xml b/modules/email_template_translate/email_template_translate_construct.xml index 6a81363a..7bdaaf66 100644 --- a/modules/email_template_translate/email_template_translate_construct.xml +++ b/modules/email_template_translate/email_template_translate_construct.xml @@ -1,64 +1,99 @@ + - - email_template_translate - - email_template_translate
    - - email_template - - 0 - - email_template_id - - 25 - - - email_template_id - language_id - - - - - I8 - 1 - 1 - - - I4 - 1 - - - I8 - email_template - name - - - C(16) - - - C(255) - 1 - 255 - any - - - X2 - any - 1 - - - X2 - 1 - - - - - id,site_id,email_template_id,language_id,subject,message_text,message_html - id,site_id,email_template_id,language_id,subject,message_text,message_html - id,site_id,email_template_id,language_id,subject,message_text,message_html - id,site_id,email_template_id,language_id,subject,message_text,message_html - id,site_id,email_template_id,language_id,subject,message_text,message_html - - - 1 + + email_template_translate + + email_template_translate
    + + email_template + + 0 + + email_template_id + + 25 + + 1 + + + + email_template_id + language_id + + + + + + + 1 + I8 + 1 + + + + 1 + I4 + + + I8 + email_template + name + + + C(16) + + + C(255) + 1 + 255 + any + + + X2 + any + 1 + + + X2 + 1 + + + + + + email_template_id,language_id,subject,message_text,message_html + id,site_id,email_template_id,language_id,subject,message_text,message_html + id,site_id,email_template_id,language_id,subject,message_text,message_html + id,site_id,email_template_id,language_id,subject,message_text,message_html + id,site_id,email_template_id,language_id,subject,message_text,message_html + + + + 1 + + + + + + + + + + id + checkbox + 25px + + + email_template_id + + + language_id + + + subject + + + + +
    diff --git a/modules/email_template_translate/email_template_translate_install.xml b/modules/email_template_translate/email_template_translate_install.xml index eefc8aca..8c2ad50f 100644 --- a/modules/email_template_translate/email_template_translate_install.xml +++ b/modules/email_template_translate/email_template_translate_install.xml @@ -1,34 +1,55 @@ + + + + + + + + 0 + email_template_translate - email_template + + + email_template + + + + base - - - - search - - - view - - - add - - - - delete - - - update - - - search_form - - - search_show - - - - - \ No newline at end of file + + + + + add + + + + delete + + + + search + + + + + search_form + + + + search_show + + + + update + + + + view + + + + diff --git a/modules/email_template_translate/email_template_translate_install_data.xml b/modules/email_template_translate/email_template_translate_install_data.xml index 15dd5a92..8a63f30a 100644 --- a/modules/email_template_translate/email_template_translate_install_data.xml +++ b/modules/email_template_translate/email_template_translate_install_data.xml @@ -1,229 +1,5 @@ - - 2 - 1 - 4 - english - New Ticket ( %var_ticket_subject% ) - - We have received your new ticket, dated %date%.
    -
    -You can view your ticket here:
    -%url%?_page=ticket:user_view&id=%sql1_id%&email=%var_email%&key=%var_key%
    -
    -If prompted, please provide the following information:
    -E-mail: %var_email%
    -Key: %var_key%
    -
    -Please do not reply to this email, this message was generated automatically and your response will not be seen by our staff.
    -
    -Thank you,
    -%site_name%
    -
    -]]>
    -
    - - 3 - 1 - 5 - english - New Ticket ( %sql2_name% ) %var_ticket_subject% - - We have recieved a new ticket on %date%, with a priority of %var_ticket_priority%.
    -
    -==================================================
    -%var_ticket_subject%
    -==================================================
    -%var_ticket_body%
    -==================================================
    -
    -%url%admin.php?_page=ticket:view&id=%sql1_id%
    -]]>
    -
    - - 4 - 1 - 6 - english - Updated Ticket ( %sql1_subject% ) - - This e-mail is to let you know we have recieved your response to your ticket, dated %date%.
    -
    -You can view your ticket here:
    -%url%?_page=ticket:user_view&id=%sql1_id%&email=%var_email%&key=%var_key%
    -
    -If prompted, please provide the following details:
    -E-mail: %var_email%
    -Key: %var_key%
    -
    -Please do not reply to this email, this message was generated automatically and your response will not be seen by our staff.
    -
    -Thank you,
    -%site_name%
    -
    -]]>
    -
    - - 5 - 1 - 7 - english - Updated Ticket ( %sql2_name% ) %sql1_subject% - - We have received a reply to a ticket at %date%, with a priority of %sql1_priority%.
    -
    -==================================================
    -%sql1_subject%
    -==================================================
    -%var_ticket_reply%
    -==================================================
    -
    %url%admin.php?_page=ticket:view&id=%sql1_id%
    ]]>
    -
    - - 6 - 1 - 9 - english - New Ticket (%var_ticket_subject% ) - - -
    -You can view your ticket here:
    -%url%?_page=ticket:user_view&id=%sql1_id%&email=%var_email%&key=%var_key%
    -
    -If promted, please provide the following details:
    -E-mail: %var_email%
    -Key: %var_key%
    -
    -Please do not reply to this email, this message was generated automatically and your response will not be seen by our staff.
    -
    -
    Subject: %var_ticket_subject%
    -
    %var_ticket_body%
    -

    -Thank you,
    -%site_name%]]>
    -
    - - 7 - 1 - 8 - english - New Ticket ( %sql2_name% ) %var_ticket_subject% - - We have recieved a new staff issued ticket at %date%, with a priority of  %var_ticket_priority%.
    -
    -==================================================
    -%var_ticket_subject%
    -==================================================
    -%var_ticket_body%
    -==================================================
    -
    -%url%admin.php?_page=ticket:view&id=%sql1_id%]]>
    -
    - - 8 - 1 - 10 - english - Ticket Response [ %sql1_subject% ] - - This e-mail is to let you know we have responded to a ticket of yours on %date%.

    -

    You can view your ticket here: %url%?_page=ticket:user_view&id=%sql1_id%

    -

    Please do not reply to this email, this message was generated automatically and your response will not be seen by our staff.
    -

    -

    Subject: %sql1_subject%

    -
    %var_message%
    - -

    Thank you,
    -%site_name%

    ]]>
    -
    9 1 @@ -236,7 +12,7 @@ You (or someone who knows your email or username) has recently submitted a passw If this was you, you can click the link below to change your password. The link expires in 15 minutes so be sure to do this right away: -%ssl_url%?_page=account:password_reset&validate=%sql3% +%ssl_url%?_page=account:user_password_reset&validate=%sql3% If the link above does not display as a link in your browser, you will need to paste it into the address bar of your browser instead. @@ -245,7 +21,7 @@ If you did not request a password retrieval at our site, then you can safetly ig Thank you, %site_name% ]]> - Dear %acct_first_name%,

    You (or someone who knows your email or username) has recently submitted a password retrieval request at our site.

    If this was you, you can click the link below to change your password.
    The link expires in 15 minutes so be sure to do this right away:

    %ssl_url%?_page=account:password_reset&validate=%sql3%

    If the link above does not display as a link in your browser, you will need to paste it into the address bar of your browser instead.

    If you did not request a password retrieval at our site, then you can safetly ignore and delete this email.

    Thank you,
    %site_name%

    ]]>
    + Dear %acct_first_name%,

    You (or someone who knows your email or username) has recently submitted a password retrieval request at our site.

    If this was you, you can click the link below to change your password.
    The link expires in 15 minutes so be sure to do this right away:

    %ssl_url%?_page=account:user_password_reset&validate=%sql3%

    If the link above does not display as a link in your browser, you will need to paste it into the address bar of your browser instead.

    If you did not request a password retrieval at our site, then you can safetly ignore and delete this email.

    Thank you,
    %site_name%

    ]]>
    10 @@ -272,10 +48,10 @@ Thanks! %site_name%: Verification Required - Dear %acct_first_name%,

    We have received your registration, but futher action on your part is requested in order to activate your account.

    Please click the link below in order to activate your account:
    %ssl_url%?_page=account:verify&verify=%sql3%

    If the text above does not show up as a clickable link, you can paste it to the address bar of your web browser. If you are not sure how to do this, or it does not work, then do the following:

    Go to %ssl_url%

    Click 'Verify Account'

    Enter the following code into the verification form:

    %sql3%

    Thank you!
    %site_name%

    ]]>
    + Dear %acct_first_name%,

    We have received your registration, but further action on your part is requested in order to activate your account.

    Please click the link below in order to activate your account:
    %ssl_url%?_page=account:user_verify&verify=%sql3%

    If the text above does not show up as a clickable link, you can paste it to the address bar of your web browser. If you are not sure how to do this, or it does not work, then do the following:

    Go to %ssl_url%

    Click 'Verify Account'

    Enter the following code into the verification form:

    %sql3%

    Thank you!
    %site_name%

    ]]>
    12 @@ -304,7 +80,7 @@ One of our staff members has just added your account to our system. The username assigned to your account is: %acct_username% For security reasons, you must choose your own password here: -%ssl_url%?_page=account:password +%ssl_url%?_page=account:user_password Once you set your password, you will be able to login to your account. @@ -314,7 +90,7 @@ Thank you,

    Dear %acct_first_name%,

    One of our staff members has just added your account to our system.

    The username assigned to your account is: %acct_username%

    -

    For security reasons, you must choose your own password here:
    %ssl_url%?_page=account:password

    +

    For security reasons, you must choose your own password here:
    %ssl_url%?_page=account:user_password

    Once you set your password, you will be able to login to your account.

    Thank you,
    %site_name%

    ]]>
    @@ -329,18 +105,18 @@ Thank you, One of our staff members has just added your account to our system. Futher action on your part is required to validate your account. To validate your account, please click the link below: -%ssl_url%?_page=account:verify&verify=%sql3% +%ssl_url%?_page=account:user_verify&verify=%sql3% The username assigned to your account is: %acct_username% For security reasons, you must choose your own password here: -%ssl_url%?_page=account:password +%ssl_url%?_page=account:user_password Once you set your password and verify your account, you will be able to login to your account. Thank you, %site_name%]]> - Dear %acct_first_name%,

    One of our staff members has just added your account to our system. Futher action on your part is required to validate your account.

    To validate your account, please click the link below:
    %ssl_url%?_page=account:verify&verify=%sql3%

    The username assigned to your account is: %acct_username%

    For security reasons, you must choose your own password here:
    %ssl_url%?_page=account:password

    Once you set your password and verify your account, you will be able to login to your account.

    Thank you,
    %site_name%

    ]]>
    + Dear %acct_first_name%,

    One of our staff members has just added your account to our system. Futher action on your part is required to validate your account.

    To validate your account, please click the link below:
    %ssl_url%?_page=account:user_verify&verify=%sql3%

    The username assigned to your account is: %acct_username%

    For security reasons, you must choose your own password here:
    %ssl_url%?_page=account:user_password

    Once you set your password and verify your account, you will be able to login to your account.

    Thank you,
    %site_name%

    ]]>
    14 @@ -353,13 +129,13 @@ Thank you, We are sending you this e-mail because you indicated to our staff that you would like to change your account password. If you would like to change your password, just click this link: -%ssl_url%?_page=account:password +%ssl_url%?_page=account:user_password You can then enter either your username or e-mail address, and we will send you a link where you can change your password. Thank you, %site_name% - Dear %acct_first_name%,

    We are sending you this e-mail because you indicated to our staff that you would like to change your account password.

    If you would like to change your password, just click this link:
    %ssl_url%?_page=account:password

    You can then enter either your username or e-mail address, and we will send you a link where you can change your password.

    Thank you,
    %site_name%

    ]]>
    + Dear %acct_first_name%,

    We are sending you this e-mail because you indicated to our staff that you would like to change your account password.

    If you would like to change your password, just click this link:
    %ssl_url%?_page=account:user_password

    You can then enter either your username or e-mail address, and we will send you a link where you can change your password.

    Thank you,
    %site_name%

    ]]>
    15 @@ -880,977 +656,6 @@ View invoice details: ]]> This e-mail is to notify you that %acct_first_name% %acct_last_name% has requested a change of billing schedule for service id %sql1_id%.

    Current Billing Schedule: %sql2%
    Requested Billing Schedule: %sql3%

    View service details | View account details | View invoice details

    ]]>
    - - 104 - 1 - 104 - english - New Ticket ( %var_ticket_subject% ) - - We have recently received your email dated %date% with the following subject:
    -
    -%var_ticket_subject%
    -
    -You can view your ticket here: %url%?_page=ticket:user_view&id=%sql1_id%&email=%var_email%&key=%var_key%
    -
    -If prompted, please enter the following details:
    -E-mail: %var_email%
    -Key: %var_key%
    -
    -Please do not reply to this email, this message was generated automatically and your response will not be seen by our staff.
    -
    -Thank you,
    -%site_name%]]>
    -
    - - 105 - 1 - 105 - english - New Ticket Received - Authorization Required - - We have recently received your e-mail dated %date% with the following subject:
    -
    -%var_ticket_subject%
    -
    -Further action on your part is required before we can process your request, for one of two possible reasons:
    -
    - -1) The department you sent your request to requires that you have an account with us and maintain a particular subscription.
    -
    - -2) The e-mail address you sent your request from is not the same as the e-mail address on file in your your account with us.
    - - - - -

    To -rectify this situation, please visit the link below and provide your -login details so we can associate your request with an authorized -account:

    You can view your ticket here: %url%?_page=ticket:user_view&id=%sql1_id%&email=%var_email%&key=%var_key%
    -
    -If prompted, please enter the following details:
    -E-mail: %var_email%
    -Key: %var_key%
    -
    -
    Please do not reply to this e-mail, this message was generated automatically and your response will not be seen by our staff.
    -
    - -Thank you,
    - -%site_name%
    -

    ]]>
    -
    - - 106 - 1 - 106 - english - Unable to Process your e-mail request - We have recently received your e-mail dated %date% with the following subject: - -%var_ticket_subject% - -We regret to inform you that we are unable to process your request for the following reason: - -The department you sent your request to requires that you have an account with us and maintain a particular subscription. - -Please check the link below to see if there are any other departments which your account is authorized to access: - -%url%?_page=ticket:ticket - -If no available departments are listed at the link above, please contact customer service with your account details and request details for any additional requirements needed to access our ticket system. - -Please do not reply to this e-mail, this message was generated automatically and your response will not be seen by our staff. - -Thank you, -%site_name% - - We have recently received your e-mail dated %date% with the following subject:
    -
    -%var_ticket_subject%
    -
    -We regret to inform you that we are unable to process your request for the following reason:
    -
    -The department you sent your request to requires that you have an account with us and maintain a particular subscription.
    -
    - -Please check the link below to see if there are any other departments which your account is authorized to access:
    - - - -

    -

    %url%?_page=ticket:ticket
    -
    -

    -

    If no available departments are listed at the link above, please -contact customer service with your account details and request details -for any additional requirements needed to access our ticket system.
    -
    - -Please do not reply to this e-mail, this message was generated automatically and your response will not be seen by our staff.
    -
    - -Thank you,
    - -%site_name%
    - -

    ]]>
    -
    - - 616 - 1 - 616 - english - New Ticket ( %var_ticket_subject% ) - - We have recently received your email dated %date% with the following subject:
    -
    -%var_ticket_subject%
    -
    -You can view your ticket here: %url%?_page=ticket:user_view&id=%sql1_id%&email=%var_email%&key=%var_key%
    -
    -If prompted, please enter the following details:
    -E-mail: %var_email%
    -Key: %var_key%
    -
    -Please do not reply to this email, this message was generated automatically and your response will not be seen by our staff.
    -
    -Thank you,
    -%site_name%]]>
    -
    - - 617 - 1 - 617 - english - New Ticket ( %var_ticket_subject% ) - - We have recently received your email dated %date% with the following subject:
    -
    -%var_ticket_subject%
    -
    -You can view your ticket here: %url%?_page=ticket:user_view&id=%sql1_id%&email=%var_email%&key=%var_key%
    -
    -If prompted, please enter the following details:
    -E-mail: %var_email%
    -Key: %var_key%
    -
    -Please do not reply to this email, this message was generated automatically and your response will not be seen by our staff.
    -
    -Thank you,
    -%site_name%]]>
    -
    - - 618 - 1 - 618 - english - New Ticket ( %var_ticket_subject% ) - - We have recently received your email dated %date% with the following subject:
    -
    -%var_ticket_subject%
    -
    -You can view your ticket here: %url%?_page=ticket:user_view&id=%sql1_id%&email=%var_email%&key=%var_key%
    -
    -If prompted, please enter the following details:
    -E-mail: %var_email%
    -Key: %var_key%
    -
    -Please do not reply to this email, this message was generated automatically and your response will not be seen by our staff.
    -
    -Thank you,
    -%site_name%]]>
    -
    - - 619 - 1 - 619 - english - New Ticket Received - Authorization Required - - We have recently received your e-mail dated %date% with the following subject:
    -
    -%var_ticket_subject%
    -
    -Further action on your part is required before we can process your request, for one of two possible reasons:
    -
    - -1) The department you sent your request to requires that you have an account with us and maintain a particular subscription.
    -
    - -2) The e-mail address you sent your request from is not the same as the e-mail address on file in your your account with us.
    - - - - -

    To -rectify this situation, please visit the link below and provide your -login details so we can associate your request with an authorized -account:

    You can view your ticket here: %url%?_page=ticket:user_view&id=%sql1_id%&email=%var_email%&key=%var_key%
    -
    -If prompted, please enter the following details:
    -E-mail: %var_email%
    -Key: %var_key%
    -
    -
    Please do not reply to this e-mail, this message was generated automatically and your response will not be seen by our staff.
    -
    - -Thank you,
    - -%site_name%
    -

    ]]>
    -
    - - 621 - 1 - 621 - english - New Ticket ( %sql2_name% ) %var_ticket_subject% - - We have recieved a new staff issued ticket at %date%, with a priority of  %var_ticket_priority%.
    -
    -==================================================
    -%var_ticket_subject%
    -==================================================
    -%var_ticket_body%
    -==================================================
    -
    -%url%admin.php?_page=ticket:view&id=%sql1_id%]]>
    -
    - - 622 - 1 - 622 - english - New Ticket (%var_ticket_subject% ) - - -
    -You can view your ticket here:
    -%url%?_page=ticket:user_view&id=%sql1_id%&email=%var_email%&key=%var_key%
    -
    -If promted, please provide the following details:
    -E-mail: %var_email%
    -Key: %var_key%
    -
    -Please do not reply to this email, this message was generated automatically and your response will not be seen by our staff.
    -
    -
    Subject: %var_ticket_subject%
    -
    %var_ticket_body%
    -

    -Thank you,
    -%site_name%]]>
    -
    - - 623 - 1 - 623 - english - Ticket Response ( %sql1_subject% ) - - This e-mail is to let you know we have responded to a ticket of yours on %date%.

    -

    You can view your ticket here: %url%?_page=ticket:user_view&id=%sql1_id%

    -

    Please do not reply to this email, this message was generated automatically and your response will not be seen by our staff.
    -

    -

    Subject: %sql1_subject%

    -
    %var_message%
    - -

    Thank you,
    -%site_name%

    ]]>
    -
    - - 624 - 1 - 624 - english - New Ticket ( %var_ticket_subject% ) - - We have received your new ticket, dated %date%.
    -
    -You can view your ticket here:
    -%url%?_page=ticket:user_view&id=%sql1_id%&email=%var_email%&key=%var_key%
    -
    -If prompted, please provide the following information:
    -E-mail: %var_email%
    -Key: %var_key%
    -
    -Please do not reply to this email, this message was generated automatically and your response will not be seen by our staff.
    -
    -Thank you,
    -%site_name%
    -
    -]]>
    -
    - - 625 - 1 - 625 - english - New Ticket ( %sql2_name% ) %var_ticket_subject% - - We have recieved a new ticket on %date%, with a priority of %var_ticket_priority%.
    -
    -==================================================
    -%var_ticket_subject%
    -==================================================
    -%var_ticket_body%
    -==================================================
    -
    -%url%admin.php?_page=ticket:view&id=%sql1_id%
    -]]>
    -
    - - 626 - 1 - 626 - english - Updated Ticket ( %sql1_subject% ) - - This e-mail is to let you know we have recieved your response to your ticket, dated %date%.
    -
    -You can view your ticket here:
    -%url%?_page=ticket:user_view&id=%sql1_id%&email=%var_email%&key=%var_key%
    -
    -If prompted, please provide the following details:
    -E-mail: %var_email%
    -Key: %var_key%
    -
    -Please do not reply to this email, this message was generated automatically and your response will not be seen by our staff.
    -
    -Thank you,
    -%site_name%
    -
    -]]>
    -
    - - 627 - 1 - 627 - english - Updated Ticket ( %sql2_name% ) %sql1_subject% - - We have received a reply to a ticket at %date%, with a priority of %sql1_priority%.
    -
    -==================================================
    -%sql1_subject%
    -==================================================
    -%var_ticket_reply%
    -==================================================
    -
    %url%admin.php?_page=ticket:view&id=%sql1_id%
    ]]>
    -
    - - 1620 - 1 - 620 - english - Unable to Process your e-mail request - We have recently received your e-mail dated %date% with the following subject: - -%var_ticket_subject% - -We regret to inform you that we are unable to process your request for the following reason: - -The department you sent your request to requires that you have an account with us and maintain a particular subscription. - -Please check the link below to see if there are any other departments which your account is authorized to access: - -%url%?_page=ticket:ticket - -If no available departments are listed at the link above, please contact customer service with your account details and request details for any additional requirements needed to access our ticket system. - -Please do not reply to this e-mail, this message was generated automatically and your response will not be seen by our staff. - -Thank you, -%site_name% - - We have recently received your e-mail dated %date% with the following subject:
    -
    -%var_ticket_subject%
    -
    -We regret to inform you that we are unable to process your request for the following reason:
    -
    -The department you sent your request to requires that you have an account with us and maintain a particular subscription.
    -
    - -Please check the link below to see if there are any other departments which your account is authorized to access:
    - - - -

    -

    %url%?_page=ticket:ticket
    -
    -

    -

    If no available departments are listed at the link above, please -contact customer service with your account details and request details -for any additional requirements needed to access our ticket system.
    -
    - -Please do not reply to this e-mail, this message was generated automatically and your response will not be seen by our staff.
    -
    - -Thank you,
    - -%site_name%
    - -

    ]]>
    -
    - - 1622 - 1 - 628 - english - New Ticket ( %var_ticket_subject% ) - - We have recently received your email dated %date% with the following subject:
    -
    -%var_ticket_subject%
    -
    -You can view your ticket here: %url%?_page=ticket:user_view&id=%sql1_id%&email=%var_email%&key=%var_key%
    -
    -If prompted, please enter the following details:
    -E-mail: %var_email%
    -Key: %var_key%
    -
    -Please do not reply to this email, this message was generated automatically and your response will not be seen by our staff.
    -
    -Thank you,
    -%site_name%]]>
    -
    - - 1623 - 1 - 629 - english - New Ticket Received - Authorization Required - - We have recently received your e-mail dated %date% with the following subject:
    -
    -%var_ticket_subject%
    -
    -Further action on your part is required before we can process your request, for one of two possible reasons:
    -
    - -1) The department you sent your request to requires that you have an account with us and maintain a particular subscription.
    -
    - -2) The e-mail address you sent your request from is not the same as the e-mail address on file in your your account with us.
    - - - - -

    To -rectify this situation, please visit the link below and provide your -login details so we can associate your request with an authorized -account:

    You can view your ticket here: %url%?_page=ticket:user_view&id=%sql1_id%&email=%var_email%&key=%var_key%
    -
    -If prompted, please enter the following details:
    -E-mail: %var_email%
    -Key: %var_key%
    -
    -
    Please do not reply to this e-mail, this message was generated automatically and your response will not be seen by our staff.
    -
    - -Thank you,
    - -%site_name%
    -

    ]]>
    -
    - - 1625 - 1 - 631 - english - New Ticket ( %sql2_name% ) %var_ticket_subject% - - We have recieved a new staff issued ticket at %date%, with a priority of  %var_ticket_priority%.
    -
    -==================================================
    -%var_ticket_subject%
    -==================================================
    -%var_ticket_body%
    -==================================================
    -
    -%url%admin.php?_page=ticket:view&id=%sql1_id%]]>
    -
    - - 1626 - 1 - 632 - english - New Ticket (%var_ticket_subject% ) - - -
    -You can view your ticket here:
    -%url%?_page=ticket:user_view&id=%sql1_id%&email=%var_email%&key=%var_key%
    -
    -If promted, please provide the following details:
    -E-mail: %var_email%
    -Key: %var_key%
    -
    -Please do not reply to this email, this message was generated automatically and your response will not be seen by our staff.
    -
    -
    Subject: %var_ticket_subject%
    -
    %var_ticket_body%
    -

    -Thank you,
    -%site_name%]]>
    -
    - - 1627 - 1 - 633 - english - Ticket Response ( %sql1_subject% ) - - This e-mail is to let you know we have responded to a ticket of yours on %date%.

    -

    You can view your ticket here: %url%?_page=ticket:user_view&id=%sql1_id%

    -

    Please do not reply to this email, this message was generated automatically and your response will not be seen by our staff.
    -

    -

    Subject: %sql1_subject%

    -
    %var_message%
    - -

    Thank you,
    -%site_name%

    ]]>
    -
    - - 1628 - 1 - 634 - english - New Ticket ( %var_ticket_subject% ) - - We have received your new ticket, dated %date%.
    -
    -You can view your ticket here:
    -%url%?_page=ticket:user_view&id=%sql1_id%&email=%var_email%&key=%var_key%
    -
    -If prompted, please provide the following information:
    -E-mail: %var_email%
    -Key: %var_key%
    -
    -Please do not reply to this email, this message was generated automatically and your response will not be seen by our staff.
    -
    -Thank you,
    -%site_name%
    -
    -]]>
    -
    - - 1629 - 1 - 635 - english - New Ticket ( %sql2_name% ) %var_ticket_subject% - - We have recieved a new ticket on %date%, with a priority of %var_ticket_priority%.
    -
    -==================================================
    -%var_ticket_subject%
    -==================================================
    -%var_ticket_body%
    -==================================================
    -
    -%url%admin.php?_page=ticket:view&id=%sql1_id%
    -]]>
    -
    - - 1630 - 1 - 636 - english - Updated Ticket ( %sql1_subject% ) - - This e-mail is to let you know we have recieved your response to your ticket, dated %date%.
    -
    -You can view your ticket here:
    -%url%?_page=ticket:user_view&id=%sql1_id%&email=%var_email%&key=%var_key%
    -
    -If prompted, please provide the following details:
    -E-mail: %var_email%
    -Key: %var_key%
    -
    -Please do not reply to this email, this message was generated automatically and your response will not be seen by our staff.
    -
    -Thank you,
    -%site_name%
    -
    -]]>
    -
    - - 1631 - 1 - 637 - english - Updated Ticket ( %sql2_name% ) %sql1_subject% - - We have received a reply to a ticket at %date%, with a priority of %sql1_priority%.
    -
    -==================================================
    -%sql1_subject%
    -==================================================
    -%var_ticket_reply%
    -==================================================
    -
    %url%admin.php?_page=ticket:view&id=%sql1_id%
    ]]>
    -
    - - 11624 - 1 - 630 - english - Unable to Process your e-mail request - We have recently received your e-mail dated %date% with the following subject: - -%var_ticket_subject% - -We regret to inform you that we are unable to process your request for the following reason: - -The department you sent your request to requires that you have an account with us and maintain a particular subscription. - -Please check the link below to see if there are any other departments which your account is authorized to access: - -%url%?_page=ticket:ticket - -If no available departments are listed at the link above, please contact customer service with your account details and request details for any additional requirements needed to access our ticket system. - -Please do not reply to this e-mail, this message was generated automatically and your response will not be seen by our staff. - -Thank you, -%site_name% - - We have recently received your e-mail dated %date% with the following subject:
    -
    -%var_ticket_subject%
    -
    -We regret to inform you that we are unable to process your request for the following reason:
    -
    -The department you sent your request to requires that you have an account with us and maintain a particular subscription.
    -
    - -Please check the link below to see if there are any other departments which your account is authorized to access:
    - - - -

    -

    %url%?_page=ticket:ticket
    -
    -

    -

    If no available departments are listed at the link above, please -contact customer service with your account details and request details -for any additional requirements needed to access our ticket system.
    -
    - -Please do not reply to this e-mail, this message was generated automatically and your response will not be seen by our staff.
    -
    - -Thank you,
    - -%site_name%
    - -

    ]]>
    -
    11626 1 @@ -1928,379 +733,6 @@ Please login at the link below to update it so your service is not suspended.
    Thank you,
    %site_name%]]> -
    - - 11629 - 1 - 641 - english - New Ticket ( %var_ticket_subject% ) - - We have recently received your email dated %date% with the following subject:
    -
    -%var_ticket_subject%
    -
    -You can view your ticket here: %url%?_page=ticket:user_view&id=%sql1_id%&email=%var_email%&key=%var_key%
    -
    -If prompted, please enter the following details:
    -E-mail: %var_email%
    -Key: %var_key%
    -
    -Please do not reply to this email, this message was generated automatically and your response will not be seen by our staff.
    -
    -Thank you,
    -%site_name%]]>
    -
    - - 11630 - 1 - 642 - english - New Ticket Received - Authorization Required - - We have recently received your e-mail dated %date% with the following subject:
    -
    -%var_ticket_subject%
    -
    -Further action on your part is required before we can process your request, for one of two possible reasons:
    -
    - -1) The department you sent your request to requires that you have an account with us and maintain a particular subscription.
    -
    - -2) The e-mail address you sent your request from is not the same as the e-mail address on file in your your account with us.
    - - - - -

    To -rectify this situation, please visit the link below and provide your -login details so we can associate your request with an authorized -account:

    You can view your ticket here: %url%?_page=ticket:user_view&id=%sql1_id%&email=%var_email%&key=%var_key%
    -
    -If prompted, please enter the following details:
    -E-mail: %var_email%
    -Key: %var_key%
    -
    -
    Please do not reply to this e-mail, this message was generated automatically and your response will not be seen by our staff.
    -
    - -Thank you,
    - -%site_name%
    -

    ]]>
    -
    - - 11632 - 1 - 644 - english - New Ticket ( %sql2_name% ) %var_ticket_subject% - - We have recieved a new staff issued ticket at %date%, with a priority of %var_ticket_priority%.
    -
    -==================================================
    %sql1_email% - %var_ticket_subject%
    -==================================================
    -%var_ticket_body%
    -==================================================
    -
    -%url%admin.php?_page=ticket:view&id=%sql1_id%]]>
    -
    - - 11633 - 1 - 645 - english - New Ticket (%var_ticket_subject% ) - - -
    -You can view your ticket here:
    -%url%?_page=ticket:user_view&id=%sql1_id%&email=%var_email%&key=%var_key%
    -
    -If promted, please provide the following details:
    -E-mail: %var_email%
    -Key: %var_key%
    -
    -Please do not reply to this email, this message was generated automatically and your response will not be seen by our staff.
    -
    -
    Subject: %var_ticket_subject%
    -
    %var_ticket_body%
    -

    -Thank you,
    -%site_name%]]>
    -
    - - 11634 - 1 - 646 - english - Ticket Response ( %sql1_subject% ) - - This e-mail is to let you know we have responded to a ticket of yours on %date%.

    -

    You can view your ticket here: %url%?_page=ticket:user_view&id=%sql1_id%

    -

    Please do not reply to this email, this message was generated automatically and your response will not be seen by our staff.
    -

    -

    Subject: %sql1_subject%

    -
    %var_message%
    - -

    Thank you,
    -%site_name%

    ]]>
    -
    - - 11635 - 1 - 647 - english - New Ticket ( %var_ticket_subject% ) - - We have received your new ticket, dated %date%.
    -
    -You can view your ticket here:
    -%url%?_page=ticket:user_view&id=%sql1_id%&email=%var_email%&key=%var_key%
    -
    -If prompted, please provide the following information:
    -E-mail: %var_email%
    -Key: %var_key%
    -
    -Please do not reply to this email, this message was generated automatically and your response will not be seen by our staff.
    -
    -Thank you,
    -%site_name%
    -
    -]]>
    -
    - - 11636 - 1 - 648 - english - New Ticket ( %sql2_name% ) %var_ticket_subject% - - We have recieved a new ticket on %date%, with a priority of %var_ticket_priority%.
    -
    -==================================================
    -%sql1_email% - %var_ticket_subject%
    -==================================================
    -%var_ticket_body%
    -==================================================
    -
    -%url%admin.php?_page=ticket:view&id=%sql1_id%
    -]]>
    -
    - - 11637 - 1 - 649 - english - Updated Ticket ( %sql1_subject% ) - - This e-mail is to let you know we have recieved your response to your ticket, dated %date%.
    -
    -You can view your ticket here:
    -%url%?_page=ticket:user_view&id=%sql1_id%&email=%var_email%&key=%var_key%
    -
    -If prompted, please provide the following details:
    -E-mail: %var_email%
    -Key: %var_key%
    -
    -Please do not reply to this email, this message was generated automatically and your response will not be seen by our staff.
    -
    -Thank you,
    -%site_name%
    -
    -]]>
    -
    - - 11638 - 1 - 650 - english - Updated Ticket ( %sql2_name% ) %sql1_subject% - - We have received a reply to a ticket at %date%, with a priority of %sql1_priority%.
    -
    -==================================================
    %sql1_email% - %sql1_subject%
    -==================================================
    -%var_ticket_reply%
    -==================================================
    -
    %url%admin.php?_page=ticket:view&id=%sql1_id%
    ]]>
    -
    - - 111631 - 1 - 643 - english - Unable to Process your e-mail request - We have recently received your e-mail dated %date% with the following subject: - -%var_ticket_subject% - -We regret to inform you that we are unable to process your request for the following reason: - -The department you sent your request to requires that you have an account with us and maintain a particular subscription. - -Please check the link below to see if there are any other departments which your account is authorized to access: - -%url%?_page=ticket:ticket - -If no available departments are listed at the link above, please contact customer service with your account details and request details for any additional requirements needed to access our ticket system. - -Please do not reply to this e-mail, this message was generated automatically and your response will not be seen by our staff. - -Thank you, -%site_name% - - We have recently received your e-mail dated %date% with the following subject:
    -
    -%var_ticket_subject%
    -
    -We regret to inform you that we are unable to process your request for the following reason:
    -
    -The department you sent your request to requires that you have an account with us and maintain a particular subscription.
    -
    - -Please check the link below to see if there are any other departments which your account is authorized to access:
    - - - -

    -

    %url%?_page=ticket:ticket
    -
    -

    -

    If no available departments are listed at the link above, please -contact customer service with your account details and request details -for any additional requirements needed to access our ticket system.
    -
    - -Please do not reply to this e-mail, this message was generated automatically and your response will not be seen by our staff.
    -
    - -Thank you,
    - -%site_name%
    - -

    ]]>
    111633 @@ -2556,381 +988,6 @@ Thank you, %site_name%

    ]]> -
    - - 111640 - 1 - 658 - english - New Ticket ( %var_ticket_subject% ) - - We have recently received your email dated %date% with the following subject:
    -
    -%var_ticket_subject%
    -
    -You can view your ticket here: %url%?_page=ticket:user_view&id=%sql1_id%&email=%var_email%&key=%var_key%
    -
    -If prompted, please enter the following details:
    -E-mail: %var_email%
    -Key: %var_key%
    -
    -Please do not reply to this email, this message was generated automatically and your response will not be seen by our staff.
    -
    -Thank you,
    -%site_name%]]>
    -
    - - 111641 - 1 - 659 - english - New Ticket Received - Authorization Required - - We have recently received your e-mail dated %date% with the following subject:
    -
    -%var_ticket_subject%
    -
    -Further action on your part is required before we can process your request, for one of two possible reasons:
    -
    - -1) The department you sent your request to requires that you have an account with us and maintain a particular subscription.
    -
    - -2) The e-mail address you sent your request from is not the same as the e-mail address on file in your your account with us.
    - - - - -

    To -rectify this situation, please visit the link below and provide your -login details so we can associate your request with an authorized -account:

    You can view your ticket here: %url%?_page=ticket:user_view&id=%sql1_id%&email=%var_email%&key=%var_key%
    -
    -If prompted, please enter the following details:
    -E-mail: %var_email%
    -Key: %var_key%
    -
    -
    Please do not reply to this e-mail, this message was generated automatically and your response will not be seen by our staff.
    -
    - -Thank you,
    - -%site_name%
    -

    ]]>
    -
    - - 111643 - 1 - 661 - english - New Ticket ( %sql2_name% ) %var_ticket_subject% - - We have recieved a new staff issued ticket at %date%, with a priority of  %var_ticket_priority%.
    -
    -==================================================
    -%var_ticket_subject%
    -==================================================
    -%var_ticket_body%
    -==================================================
    -
    -%url%admin.php?_page=ticket:view&id=%sql1_id%]]>
    -
    - - 111644 - 1 - 662 - english - New Ticket (%var_ticket_subject% ) - - -
    -You can view your ticket here:
    -%url%?_page=ticket:user_view&id=%sql1_id%&email=%var_email%&key=%var_key%
    -
    -If promted, please provide the following details:
    -E-mail: %var_email%
    -Key: %var_key%
    -
    -Please do not reply to this email, this message was generated automatically and your response will not be seen by our staff.
    -
    -
    Subject: %var_ticket_subject%
    -
    %var_ticket_body%
    -

    -Thank you,
    -%site_name%]]>
    -
    - - 111645 - 1 - 663 - english - Ticket Response ( %sql1_subject% ) - - This e-mail is to let you know we have responded to a ticket of yours on %date%.

    -

    You can view your ticket here: %url%?_page=ticket:user_view&id=%sql1_id%

    -

    Please do not reply to this email, this message was generated automatically and your response will not be seen by our staff.
    -

    -

    Subject: %sql1_subject%

    -
    %var_message%
    - -

    Thank you,
    -%site_name%

    ]]>
    -
    - - 111646 - 1 - 664 - english - New Ticket ( %var_ticket_subject% ) - - We have received your new ticket, dated %date%.
    -
    -You can view your ticket here:
    -%url%?_page=ticket:user_view&id=%sql1_id%&email=%var_email%&key=%var_key%
    -
    -If prompted, please provide the following information:
    -E-mail: %var_email%
    -Key: %var_key%
    -
    -Please do not reply to this email, this message was generated automatically and your response will not be seen by our staff.
    -
    -Thank you,
    -%site_name%
    -
    -]]>
    -
    - - 111647 - 1 - 665 - english - New Ticket ( %sql2_name% ) %var_ticket_subject% - - We have recieved a new ticket on %date%, with a priority of %var_ticket_priority%.
    -
    -==================================================
    -%var_ticket_subject%
    -==================================================
    -%var_ticket_body%
    -==================================================
    -
    -%url%admin.php?_page=ticket:view&id=%sql1_id%
    -]]>
    -
    - - 111648 - 1 - 666 - english - Updated Ticket ( %sql1_subject% ) - - This e-mail is to let you know we have recieved your response to your ticket, dated %date%.
    -
    -You can view your ticket here:
    -%url%?_page=ticket:user_view&id=%sql1_id%&email=%var_email%&key=%var_key%
    -
    -If prompted, please provide the following details:
    -E-mail: %var_email%
    -Key: %var_key%
    -
    -Please do not reply to this email, this message was generated automatically and your response will not be seen by our staff.
    -
    -Thank you,
    -%site_name%
    -
    -]]>
    -
    - - 111649 - 1 - 667 - english - Updated Ticket ( %sql2_name% ) %sql1_subject% - - We have received a reply to a ticket at %date%, with a priority of %sql1_priority%.
    -
    -==================================================
    -%sql1_subject%
    -==================================================
    -%var_ticket_reply%
    -==================================================
    -
    %url%admin.php?_page=ticket:view&id=%sql1_id%
    ]]>
    -
    - - 1111642 - 1 - 660 - english - Unable to Process your e-mail request - We have recently received your e-mail dated %date% with the following subject: - -%var_ticket_subject% - -We regret to inform you that we are unable to process your request for the following reason: - -The department you sent your request to requires that you have an account with us and maintain a particular subscription. - -Please check the link below to see if there are any other departments which your account is authorized to access: - -%url%?_page=ticket:ticket - -If no available departments are listed at the link above, please contact customer service with your account details and request details for any additional requirements needed to access our ticket system. - -Please do not reply to this e-mail, this message was generated automatically and your response will not be seen by our staff. - -Thank you, -%site_name% - - We have recently received your e-mail dated %date% with the following subject:
    -
    -%var_ticket_subject%
    -
    -We regret to inform you that we are unable to process your request for the following reason:
    -
    -The department you sent your request to requires that you have an account with us and maintain a particular subscription.
    -
    - -Please check the link below to see if there are any other departments which your account is authorized to access:
    - - - -

    -

    %url%?_page=ticket:ticket
    -
    -

    -

    If no available departments are listed at the link above, please -contact customer service with your account details and request details -for any additional requirements needed to access our ticket system.
    -
    - -Please do not reply to this e-mail, this message was generated automatically and your response will not be seen by our staff.
    -
    - -Thank you,
    - -%site_name%
    - -

    ]]>
    1111644 @@ -2966,4 +1023,4 @@ Thank you,
    1111644 -
    \ No newline at end of file + diff --git a/modules/faq/auth.inc.php b/modules/faq/auth.inc.php index c3151b11..07053e2b 100644 --- a/modules/faq/auth.inc.php +++ b/modules/faq/auth.inc.php @@ -1,12 +1,35 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net + * + * @link http://www.agileco.com/ + * @copyright 2004-2008 Agileco, LLC. + * @license http://www.agileco.com/agilebill/license1-4.txt + * @author Tony Landis + * @package AgileBill + * @subpackage Modules:Account + */ - ### public methods for this module: - - $auth_methods = Array - ( - Array ('module' => 'faq', 'method' => 'faq_categories'), - Array ('module' => 'faq', 'method' => 'faq_show'), - Array ('module' => 'faq', 'method' => 'autofill'), - Array ('module' => 'faq', 'method' => 'faq_search') - ); +/** + * Public FAQ methods + */ + +$auth_methods = array( + array('module'=>'faq','method'=>'faq_categories'), + array('module'=>'faq','method'=>'faq_show'), + array('module'=>'faq','method'=>'autofill'), + array('module'=>'faq','method'=>'faq_search') +); ?> diff --git a/modules/faq/faq.inc.php b/modules/faq/faq.inc.php index 843a2e4d..7271acc6 100644 --- a/modules/faq/faq.inc.php +++ b/modules/faq/faq.inc.php @@ -1,55 +1,34 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Module:FAQ */ - -class faq -{ - - # Open the constructor for this mod - function faq() - { - # name of this module: - $this->module = "faq"; - $this->version = "1.0.0a"; - - if(!defined('AJAX')) - { - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - } - - +/** + * The main AgileBill FAQ Class + * + * @package AgileBill + * @subpackage Module:FAQ + */ +class faq extends OSB_module { ### autofill for admin 'canned messages' in ticket reply function autofill($VAR) { @@ -198,61 +177,33 @@ class faq $smarty->assign('faq_category_list', @$smart); } + /** + * Add a entry to the database + */ + public function add($VAR) { + global $VAR; + if (empty($VAR['faq_translate_question'])) + return false; + $q = $VAR['faq_translate_question']; + unset($VAR['faq_translate_question']); + $a = ''; + if (isset($VAR['faq_translate_answer'])) { + $a = $VAR['faq_translate_answer']; + unset($VAR['faq_translate_answer']); + } - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $id = $db->add($VAR, $this, $type); + $id = parent::add($VAR); - if($id && !empty($VAR['faq_question'])) - { - # Insert translation + # Insert translation + if ($id) { $db = &DB(); - $idx = $db->GenID(AGILE_DB_PREFIX. 'faq_translate_id'); - $sql = "INSERT INTO ".AGILE_DB_PREFIX."faq_translate - SET - site_id = ".DEFAULT_SITE.", - id = $idx, - faq_id = $id, - date_orig = ".time().", - date_last = ".time().", - language_id = '".DEFAULT_LANGUAGE."', - answer = ".$db->qstr( @$VAR['faq_answer'] ).", - question = ".$db->qstr( @$VAR['faq_question']); - $db->Execute($sql); + $db->Execute(sqlInsert($db,'faq_translate',array('faq_id'=>$id,'date_orig'=>time(),'date_last'=>time(),'language_id'=>DEFAULT_LANGUAGE,'question'=>$q,'answer'=>$a))); } } - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - ############################## ## DELETE ## ############################## @@ -268,40 +219,6 @@ class faq $db->mass_delete($VAR, $this, ""); } - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } - function linkalize($text) { $text = preg_replace("/([^\w\/])(www\.[a-z0-9\-]+\.[a-z0-9\-]+)/i", "$1http://$2", $text); diff --git a/modules/faq/faq_construct.xml b/modules/faq/faq_construct.xml index 23b466e0..a5107c1f 100644 --- a/modules/faq/faq_construct.xml +++ b/modules/faq/faq_construct.xml @@ -1,78 +1,116 @@ + + faq + + faq
    + + + + 0 + + sort_order,date_orig,name + + 25 + + 0 - - faq + + + - - faq
    + + + + + 1 + I4 + 1 + + + + 1 + I4 + + + + date-now + Date Created + I8 + + + + date-now + Date Updated + I8 + + + Category + I4 + faq_category + name + + + Date Start + I8 + date + + + Date Expire + I8 + date + + + Sort Order + I4 + + + Active + L + + + Name + C(255) + 1 + 255 + any + 1 + + - - + + + faq_category_id,date_orig,sort_order,status,name + id,site_id,faq_category_id,date_orig,date_last,date_start,date_expire,sort_order,status,name + id,site_id,faq_category_id,date_orig,date_last,date_start,date_expire,sort_order,status,name + id,site_id,faq_category_id,date_orig,date_last,date_start,date_expire,sort_order,status,name + id,site_id,faq_category_id,date_orig,date_last,date_start,date_expire,sort_order,status,name + - - 0 + + - - sort_order,date_orig,name + + + <add>Add FAQ</add> + <search_form>Search FAQ</search_form> + <view>FAQ</view> + - - 35 - - - - - I4 - 1 - - - I4 - - - I4 - faq_category - name - - - I8 - date-now - - - I8 - date-now - - - I8 - date - - - I8 - date - - - I4 - - - L - - - C(255) - 1 - 255 - any - 1 - - - - - - id,site_id,faq_category_id,date_orig,date_last,date_start,date_expire,sort_order,status,name - id,site_id,faq_category_id,date_orig,date_last,date_start,date_expire,sort_order,status,name - id,site_id,faq_category_id,date_orig,date_last,date_start,date_expire,sort_order,status,name - id,site_id,faq_category_id,date_orig,date_last,date_start,date_expire,sort_order,status,name - id,site_id,faq_category_id,date_orig,date_last,date_start,date_expire,sort_order,status,name - - - - 0 + + + + + id + checkbox + 25px + + + name + + + faq_category_id + + +
    diff --git a/modules/faq/faq_install.xml b/modules/faq/faq_install.xml index 2c1ee562..4876acf2 100644 --- a/modules/faq/faq_install.xml +++ b/modules/faq/faq_install.xml @@ -1,49 +1,61 @@ + + + + + + FAQ + + 1 + + faq + + + + faq + + faq_category,faq_translate + + base + - - - faq - faq - This module controls the FAQs - 1 - faq_category,faq_translate - - - - - - - - search - Allow users to view the search form - %%:search_form - 1 - - - view - Allow users to view records - - 1 - - - add - Allow users to add records - 1 - - - delete - - - update - - - search_form - - - search_show - Allow users to view the search results - - - + + + + Add + 1 + add + + + + delete + + + + List + 1 + search + + + + + Search + 1 + search_form + + + + search_show + + + + update + + + + view + + + diff --git a/modules/faq_category/auth.inc.php b/modules/faq_category/auth.inc.php index e44fc43d..aeffe7e3 100644 --- a/modules/faq_category/auth.inc.php +++ b/modules/faq_category/auth.inc.php @@ -1,9 +1,32 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net + * + * @link http://www.agileco.com/ + * @copyright 2004-2008 Agileco, LLC. + * @license http://www.agileco.com/agilebill/license1-4.txt + * @author Tony Landis + * @package AgileBill + * @subpackage Modules:Account + */ - ### public methods for this module: - - $auth_methods = Array - ( - Array ('module' => 'faq_category', 'method' => 'category_list'), - ); +/** + * Public FAQ Category methods + */ + +$auth_methods = array( + array('module'=>'faq_category','method'=>'category_list') +); ?> diff --git a/modules/faq_category/faq_category.inc.php b/modules/faq_category/faq_category.inc.php index 6dac9ccb..0c4b5044 100644 --- a/modules/faq_category/faq_category.inc.php +++ b/modules/faq_category/faq_category.inc.php @@ -1,55 +1,37 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Modules:FAQ */ - -class faq_category -{ - - # Open the constructor for this mod - function faq_category_construct() - { - # name of this module: - $this->module = "faq_category"; - $this->version = "1.0.0a"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - +/** + * The main AgileBill FAQ Category Class + * + * @package AgileBill + * @subpackage Modules:FAQ + */ +class faq_category extends OSB_module { ############################## ## GET AUTH CATEGORIES ## ############################## - function category_list($VAR) { @@ -112,97 +94,5 @@ class faq_category return true; } } - - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $this->faq_category_construct(); - - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $this->faq_category_construct(); - - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $this->faq_category_construct(); - - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $this->faq_category_construct(); - - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $this->faq_category_construct(); - - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $this->faq_category_construct(); - - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $this->faq_category_construct(); - - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } - } -?> \ No newline at end of file +?> diff --git a/modules/faq_category/faq_category_construct.xml b/modules/faq_category/faq_category_construct.xml index ba59adc8..4b3b4921 100644 --- a/modules/faq_category/faq_category_construct.xml +++ b/modules/faq_category/faq_category_construct.xml @@ -1,69 +1,108 @@ + + faq_category + + faq_category
    + + faq + + 0 + + sort_order,name + + 25 + + 1 - - faq_category + + + - - faq_category
    + + + + + 1 + I4 + 1 + + + + 1 + I4 + + + + date-now + Date Created + I8 + + + Groups that can access this category + C(255) + any + array + + + Name + C(128) + 1 + 128 + any + 1 + + + Description + X2 + + + Active + L + + + Sort Order + I4 + + - - faq + + + date_orig,group_avail,name,description,status,sort_order + id,site_id,date_orig,group_avail,name,description,status,sort_order + id,site_id,date_orig,group_avail,name,description,status,sort_order + id,site_id,date_orig,group_avail,name,description,status,sort_order + id,site_id,date_orig,group_avail,name,description,status,sort_order + - - 0 + + - - sort_order,name + + + <add>Add FAQ Category</add> + <view>FAQ Category</view> + - - 35 - - - - - I4 - 1 - - - I4 - - - I8 - date-now - - - C(255) - any - array - - - C(128) - 1 - 128 - any - 1 - - - X2 - - - L - - - I4 - - - - - - id,site_id,date_orig,group_avail,name,description,status,sort_order - id,site_id,date_orig,group_avail,name,description,status,sort_order - id,site_id,date_orig,group_avail,name,description,status,sort_order - id,site_id,date_orig,group_avail,name,description,status,sort_order - id,site_id,date_orig,group_avail,name,description,status,sort_order - - - - 0 + + + + + id + checkbox + 25px + + + status + bool_icon + 20px + + + name + + + sort_order + + +
    diff --git a/modules/faq_category/faq_category_install.xml b/modules/faq_category/faq_category_install.xml index cfe5d506..8b115b6e 100644 --- a/modules/faq_category/faq_category_install.xml +++ b/modules/faq_category/faq_category_install.xml @@ -1,41 +1,55 @@ + + + + + + FAQ Categories + + 1 + + faq_category + + + + faq + + + + base + - - - faq_category - faq - This module controls the FAQs categories - 1 - - - - - - - - - - search - - - view - - 1 - - - add - 1 - - - delete - - - update - - - search_show - - - + + + + Add + 1 + add + + + + delete + + + + List + 1 + search + + + + + search_show + + + + update + + + + view + + + diff --git a/modules/faq_translate/faq_translate.inc.php b/modules/faq_translate/faq_translate.inc.php index 16c14a1b..610ebe13 100644 --- a/modules/faq_translate/faq_translate.inc.php +++ b/modules/faq_translate/faq_translate.inc.php @@ -1,127 +1,33 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Modules:FAQ */ - -class faq_translate -{ - - # Open the constructor for this mod - function faq_translate() - { - # name of this module: - $this->module = "faq_translate"; - $this->version = "1.0.0a"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } +/** + * The main AgileBill FAQ Class + * + * @package AgileBill + * @subpackage Modules:FAQ + */ +class faq_translate extends OSB_module { } -?> \ No newline at end of file +?> diff --git a/modules/faq_translate/faq_translate_construct.xml b/modules/faq_translate/faq_translate_construct.xml index 759c4a37..7acf3890 100644 --- a/modules/faq_translate/faq_translate_construct.xml +++ b/modules/faq_translate/faq_translate_construct.xml @@ -1,77 +1,105 @@ + + faq_translate + + faq_translate
    + + faq + + 0 + + faq_id + + 25 + + 0 - - faq_translate + + + answer,question + - - faq_translate
    - - - faq - - - 0 - - - faq_id - - - 35 - - - - - I4 - 1 - 1 - - - I4 - - - I8 - date-now - - - I8 - date-now - - - I4 - faq - name - - - C(16) - - - X2 - 1 + + + + + 1 + I4 + 1 + + + + 1 + I4 + + + + date-now + Date Created + I8 + + + + date-now + Date Updated + I8 + + + I4 + faq + name + + + C(16) + + + X2 + 1 1 - - - X2 - 1 - 255 - any - - + + + X2 + 1 + 255 + any + + - - - answer,question - - - - - id,site_id,date_orig,date_last,faq_id,language_id,answer,question - id,site_id,date_orig,date_last,faq_id,language_id,answer,question - id,site_id,date_orig,date_last,faq_id,language_id,answer,question - id,site_id,date_orig,date_last,faq_id,language_id,answer,question - id,site_id,date_orig,date_last,faq_id,language_id,answer,question - + + + date_orig,faq_id,language_id,answer,question + id,site_id,date_orig,date_last,faq_id,language_id,answer,question + id,site_id,date_orig,date_last,faq_id,language_id,answer,question + id,site_id,date_orig,date_last,faq_id,language_id,answer,question + id,site_id,date_orig,date_last,faq_id,language_id,answer,question + - - 0 + + + + + + <add>Add XXX</add> + + + + + + + id + checkbox + 25px + + + faq_id + + + language_id + + + question + + +
    diff --git a/modules/faq_translate/faq_translate_install.xml b/modules/faq_translate/faq_translate_install.xml index 979c19e9..1607ecf9 100644 --- a/modules/faq_translate/faq_translate_install.xml +++ b/modules/faq_translate/faq_translate_install.xml @@ -1,34 +1,51 @@ + + + + + + + + 0 + + faq_translate + + + + faq + + + + base + - - - faq_translate - faq_translate - This module controls the FAQs translations - - - - - - - search - - - view - - - add - - - delete - - - update - - - search_show - - - + + + + add + + + + delete + + + + search + + + + + search_show + + + + update + + + + view + + + diff --git a/modules/file/auth.inc.php b/modules/file/auth.inc.php deleted file mode 100644 index 4b629485..00000000 --- a/modules/file/auth.inc.php +++ /dev/null @@ -1,11 +0,0 @@ - 'file', 'method' => 'download'), - Array ('module' => 'file', 'method' => 'category_list'), - Array ('module' => 'file', 'method' => 'file_list') - ); -?> \ No newline at end of file diff --git a/modules/file/file.inc.php b/modules/file/file.inc.php deleted file mode 100644 index 9db7cc76..00000000 --- a/modules/file/file.inc.php +++ /dev/null @@ -1,492 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -class file -{ - - # Open the constructor for this mod - function file() - { - # name of this module: - $this->module = "file"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - - - ############################## - ## LIST AUTH FILES ## - ############################## - - function file_list($VAR) - { - global $smarty; - if(!isset($VAR['id'])) - { - global $C_debug; - $smarty->assign('file_display', false); - return false; - } - - ### Check if user is auth for the selected category: - $db = &DB(); - $sql = 'SELECT * - FROM ' . AGILE_DB_PREFIX . 'file WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - file_category_id = ' . $db->qstr($VAR['id']) . ' AND - status = ' . $db->qstr('1') .' - ORDER BY sort_order,date_orig,name'; - $result = $db->Execute($sql); - - if($result->RecordCount() == 0) - { - $smarty->assign('file_display', false); - return false; - } - - global $C_auth; - $ii = 0; - - while(!$result->EOF) - { - @$arr = unserialize($result->fields['group_avail']); - $this_show = false; - - for($i=0; $iauth_group_by_id($arr[$i])) - { - $this_show = true; - $i=count($arr); - } - } - - if($this_show) - { - - $start = $result->fields['date_start']; - $expire= $result->fields['date_expire']; - - ### Check that it is not expired - if (( $start == "0" || $start <= time()+2 ) && - ( $expire == "0" || $expire >= time() ) ) - { - $arr_smarty[] = Array ( - 'id' => $result->fields['id'], - 'name' => $result->fields['name'], - 'description' => $result->fields['description'], - 'size' => $result->fields['type'], - 'size' => $result->fields['size'] - ); - $ii++; - } - } - $result->MoveNext(); - } - - - if($ii == "0") - { - $smarty->assign('file_display', false); - return false; - } - else - { - $smarty->assign('file_display', true); - $smarty->assign('file_results', $arr_smarty); - return true; - } - } - - - - ############################## - ## GET AUTH CATEGORIES ## - ############################## - - function category_list($VAR) - { - /* check if current session is authorized for any ticket departments.. - and return true/false... - */ - - global $smarty; - $db = &DB(); - $sql = 'SELECT id,name,group_avail FROM ' . AGILE_DB_PREFIX . 'file_category WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - status = ' . $db->qstr('1') .' - ORDER BY sort_order,name'; - $result = $db->Execute($sql); - - if($result->RecordCount() == 0) - { - $smarty->assign('file_category_display', false); - return false; - } - - global $C_auth; - $ii = 0; - - while(!$result->EOF) - { - @$arr = unserialize($result->fields['group_avail']); - - for($i=0; $iauth_group_by_id($arr[$i])) - { - ### Add to the array - $ii++; - $arr_smarty[] = Array( 'name' => $result->fields['name'], - 'id' => $result->fields['id']); - $i=count($arr); - } - } - $result->MoveNext(); - } - - if($ii == "0") - { - $smarty->assign('file_category_display', false); - return false; - } - else - { - $smarty->assign('file_category_display', true); - $smarty->assign('file_category_results', $arr_smarty); - return true; - } - } - - - - - ############################## - ## DOWNLOAD ## - ############################## - function download($VAR) - { - $db = &DB(); - $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'file WHERE - site_id = ' . DEFAULT_SITE . ' AND - id = ' . $db->qstr(@$VAR['id']) . ' AND - status = 1'; - $result = $db->Execute($sql); - - if($result->RecordCount() == 1) - { - $show = true; - - ### Validate start date - $s = $result->fields['date_start']; - if($s != '' && $s != 0) - if($s > time()) - $show = false; - - ### Validate expire date - $e = $result->fields['date_expire']; - if($e != '' && $e != 0) - if($e < time()) - $show = false; - - ### Validate user group: - if($show) { - global $C_auth; - @$arr = unserialize($result->fields['group_avail']); - $show = false; - for($i=0; $iauth_group_by_id($arr[$i])) { - $show = true; - break; - } - } - } - - ### Get the filetype - if($show) - { - $ft = $result->fields['location_type']; - if($ft == 0) - $file = PATH_FILES . 'file_'.$VAR['id'].'.dat'; - elseif ($ft == 1) - $file = $result->fields['location']; - elseif ($ft == 2) - $file = $result->fields['location']; - - ### Open the file - if (@$file=fopen($file, 'r')) - { - ### Display the correct headers: - header ("Content-Type: " . $result->fields['type']); - header ("Content-Size: " . $result->fields['size']); - header ("Content-Disposition: inline; filename=" . $result->fields['name']); - fpassthru($file); - exit; - } - } - } - echo 'Sorry, the file does not exist or you are not authorized or your access has expired!'; - } - - - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - global $_FILES, $smarty, $C_debug, $C_translate; - - if($VAR['file_location_type'] == '') return false; - - $lt = $VAR['file_location_type']; - - // UPLOADED FILE FROM LOCAL PC - if($lt == 0) { - ### Validate the file upoad: - if(!isset($_FILES['upload_file']) || $_FILES['upload_file']['size'] <= 0) - { - global $C_debug; - $C_debug->alert('You must go back and enter a file for upload!'); - return; - } - $VAR['file_size'] = $_FILES['upload_file']['size']; - $VAR['file_type'] = $_FILES['upload_file']['type']; - $VAR['file_name'] = $_FILES['upload_file']['name']; - } - - // ENTERED URL TO FILE - elseif ($lt == 1) { - ### Validate the remote file can be opened and is greater than 0K - $file = $VAR['url_file']; - if(empty($file) || !$fp = fopen ($file, "r")) { - # error - $C_debug->alert( $C_translate->translate('remote_file_err','file','') ); - return; - } else { - $VAR['file_location'] = $file; - $fn = explode("/", $file); - $count = count($fn)-1; - $VAR['file_name'] = $fn[$count]; - $headers = stream_get_meta_data($fp); - $headers = $headers['wrapper_data']; - for($i=0;$icontent_type($file); - } - else - { - $C_debug->alert( $C_translate->translate('local_file_err','file','') ); - return; - } - } - else { return false; } - - ### Create the record - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $id = $db->add($VAR, $this, $type); - - ### Copy the uploaded file, or exit if fail: - if($lt == 0) { - if(isset($id) && $id > 0) { - if(!copy($_FILES['upload_file']['tmp_name'], PATH_FILES . 'file_'.$id.'.dat')) { - $C_debug->alert( $C_translate->translate('copy_file_err','file','') ); - } - } - unlink($_FILES['upload_file']['tmp_name']); - } - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $db = &DB(); - $id = $this->table . '_id'; - - # generate the list of ID's - $id_list = ''; - $ii=0; - - if(isset($VAR["delete_id"])) - { - $id = explode(',',$VAR["delete_id"]); - } - elseif (isset($VAR["id"])) - { - $id = explode(',',$VAR["id"]); - } - - for($i=0; $iqstr($id[$i]) . " "; - $ii++; - } - else - { - $id_list .= " OR id = " . $db->qstr($id[$i]) . " "; - $ii++; - } - } - } - - if($ii>0) - { - # generate the full query - $q = "DELETE FROM - ".AGILE_DB_PREFIX."$this->table - WHERE - $id_list - AND - site_id = " . DEFAULT_SITE; - $result = $db->Execute($q); - - # error reporting - if ($result === false) { - global $C_debug; - $C_debug->error('file.inc.php','delete', $db->ErrorMsg()); - } else { - for($i=0; $ivalue["CORE"]["module_name"] = $C_translate->translate('name',$this->module,""); - $message = $C_translate->translate('alert_delete_ids',"CORE",""); - $C_debug->alert($message); - - } - } - } - - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } -} -?> \ No newline at end of file diff --git a/modules/file/file_construct.xml b/modules/file/file_construct.xml deleted file mode 100644 index 2ae86c14..00000000 --- a/modules/file/file_construct.xml +++ /dev/null @@ -1,100 +0,0 @@ - - - - - file - - - file
    - - - - - - 0 - - - sort_order - - - 35 - - - - - I4 - 1 - 1 - - - I4 - 1 - - - I8 - date-now - - - I8 - date-now - - - I8 - date - - - I8 - date - - - I4 - file_category - name - 1 - - - C(32) - - - I8 - - - C(255) - 1 - 255 - any - - - X2 - - - L - - - C(255) - - - L - - - I4 - - - C(255) - array - any - - - - - - id,site_id,group_avail,date_orig,date_last,date_start,date_expire,file_category_id,type,size,name,description,status,location,location_type,sort_order - id,site_id,group_avail,date_orig,date_last,date_start,date_expire,file_category_id,type,size,name,description,status,location,location_type,sort_order - id,site_id,group_avail,date_orig,date_last,date_start,date_expire,file_category_id,type,size,name,description,status,location,location_type,sort_order - id,site_id,group_avail,date_orig,date_last,date_start,date_expire,file_category_id,type,size,name,description,status,location,location_type,sort_order - id,site_id,group_avail,date_orig,date_last,date_start,date_expire,file_category_id,type,size,name,description,status,location,location_type,sort_order - - - - 0 -
    diff --git a/modules/file/file_install.xml b/modules/file/file_install.xml deleted file mode 100644 index cc54a7f5..00000000 --- a/modules/file/file_install.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - file - file - This module allows you to manage your downloadable files and permissions. - 1 - - file_category - - - - - - - - search - Allow users to view the search form - %%:search_form - 1 - - - view - Allow users to view records - core:search&module=%%&_escape=1&_next_page_one=view - 1 - - - add - Allow users to add records - 1 - - - delete - - - update - - - search_form - - - search_show - Allow users to view the search results - - - - \ No newline at end of file diff --git a/modules/file/file_install_data.xml b/modules/file/file_install_data.xml deleted file mode 100644 index 5d28dce2..00000000 --- a/modules/file/file_install_data.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/modules/file_category/file_category.inc.php b/modules/file_category/file_category.inc.php deleted file mode 100644 index 994572ab..00000000 --- a/modules/file_category/file_category.inc.php +++ /dev/null @@ -1,123 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -class file_category -{ - - # Open the constructor for this mod - function file_category() - { - # name of this module: - $this->module = "file_category"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } -} -?> \ No newline at end of file diff --git a/modules/file_category/file_category_construct.xml b/modules/file_category/file_category_construct.xml deleted file mode 100644 index c4846e10..00000000 --- a/modules/file_category/file_category_construct.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - file_category - - - file_category
    - - - file - - - 0 - - - sort_order - - - 35 - - - - - I4 - 1 - 1 - - - I4 - 1 - - - I8 - date-now - - - C(128) - 1 - 128 - any - - - X2 - - - L - - - C(255) - any - array - - - I4 - - - - - - id,site_id,date_orig,name,description,status,group_avail,sort_order - id,site_id,date_orig,name,description,status,group_avail,sort_order - id,site_id,date_orig,name,description,status,group_avail,sort_order - id,site_id,date_orig,name,description,status,group_avail,sort_order - id,site_id,date_orig,name,description,status,group_avail,sort_order - - - - - -
    diff --git a/modules/file_category/file_category_install.xml b/modules/file_category/file_category_install.xml deleted file mode 100644 index 921ef90b..00000000 --- a/modules/file_category/file_category_install.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - file_category - file - This module allows you to manage the categories for your downloadable files. - 1 - file - - - - - - - - - search - - - view - Allow users to view records - core:search&module=%%&_escape=1&_next_page_one=view - 1 - - - add - Allow users to add records - 1 - - - delete - - - update - - - search_show - Allow users to view the search results - - - - \ No newline at end of file diff --git a/modules/file_category/file_category_install_data.xml b/modules/file_category/file_category_install_data.xml deleted file mode 100644 index 49188bce..00000000 --- a/modules/file_category/file_category_install_data.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - 1 - 1 - 1069748554 - Registered Users - Only registered users can access this category - 1 - a:4:{i:0;s:1:"2";i:1;s:1:"3";i:2;s:4:"1001";i:3;s:1:"4";} - 2 - - - 2 - 1 - 1069748586 - All Users - All users can access these downloads - 1 - a:4:{i:0;s:1:"2";i:1;s:1:"3";i:2;s:4:"1001";i:3;s:1:"4";} - 1 - - - 2 - - \ No newline at end of file diff --git a/modules/group/group.inc.php b/modules/group/group.inc.php index 662f8463..be954af5 100644 --- a/modules/group/group.inc.php +++ b/modules/group/group.inc.php @@ -1,80 +1,55 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Module:Group */ - -class group -{ - # Open the constructor for this mod - function group() - { - # name of this module: - $this->module = "group"; - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; +/** + * The main AgileBill Group Class + * + * @package AgileBill + * @subpackage Module:Group + */ +class group extends OSB_module { + /** + * Add a record + */ + public function add($VAR) { + $group_id = parent::add($VAR); - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); + if ($group_id) { + # Add the new group to the account_group table: + $db = &DB(); + $result = $db->Execute(sqlInsert($db,'account_group',array('date_orig'=>time(),'group_id'=>$group_id,'account_id'=>SESS_ACCOUNT,'acive'=>1))); + if ($result === false) { + global $C_debug; - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); + return; + } + } else + return false; - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $group_id = $db->add($VAR, $this, $type); - - # add the new group to the account_group table: - $db = &DB(); - $record_id = $db->GenID(AGILE_DB_PREFIX . 'account_group_id'); - $sql= "INSERT INTO ". AGILE_DB_PREFIX ."account_group SET - id = ".$db->qstr($record_id).", - site_id = ".$db->qstr(DEFAULT_SITE).", - date_orig = ".$db->qstr(time()).", - date_expire = ".$db->qstr('0').", - group_id = ".$db->qstr($group_id).", - account_id = ".$db->qstr(SESS_ACCOUNT).", - active = ".$db->qstr(1); - $result = $db->Execute($sql); - if ($result === false) - { - global $C_debug; - $C_debug->error('list.inc.php','select_groups', $db->ErrorMsg()); - return; - } - - # update the current user's authentication so the newly added group appears + # Update the current user's authentication so the newly added group appears # as available to them global $C_auth; $C_auth->auth_update(); @@ -82,248 +57,105 @@ class group return; } - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } + private function isAuthorised($VAR) { + # Remove any group ids <= 1001 from the VAR array: + global $C_debug,$C_auth; - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - #remove any group ids <= 1001 from the VAR array: - global $C_debug, $C_auth; - $id_list = ''; - if(isset($VAR["delete_id"])) - $id = explode(',',$VAR["delete_id"]); - elseif (isset($VAR["id"])) - $id = explode(',',$VAR["id"]); + $id = array(); - for($i=0; $i 1001 ) - { - if($i == 0) - $id_list .= $id[$i]; - else - $id_list .= ','.$id[$i]; + if (isset($VAR['id'])) + $id = explode(',',$VAR['id']); + + for ($i=0; $i 1001) { # Check if group allowed: - if(!$C_auth->auth_group_by_id($id[$i])) { + if (! $C_auth->auth_group_by_id($id[$i])) { $C_debug->alert('The selected group cannot be modified as your account is not authorized for it.'); - return; - } - } else { - $C_debug->alert('The selected group is part of the CORE and cannot be edited.'); - return; - } - } - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - global $C_auth; - - $this->associated_DELETE[] = Array ('table' => 'account_group', 'field' => 'group_id'); - $this->associated_DELETE[] = Array ('table' => 'group_method', 'field' => 'group_id'); - - #remove any group ids <= 1001 from the mass delete array: - global $C_debug; - $id_list = ''; - if(isset($VAR["delete_id"])) - $id = explode(',',$VAR["delete_id"]); - elseif (isset($VAR["id"])) - $id = explode(',',$VAR["id"]); - - for($i=0; $i 1001 ) - { - if($i == 0) - $id_list .= $id[$i]; - else - $id_list .= ','.$id[$i]; - - # Check if group allowed: - if(!$C_auth->auth_group_by_id(1001) && !$C_auth->auth_group_by_id($id[$i])) { - $C_debug->alert('The selected group cannot be modified as your account is not authorized for it.'); - return; + return true; } } else { - $C_debug->alert('One or more of the groups selected to be deleted are part of the core and cannot be removed.'); + $C_debug->alert('The selected group is part of the CORE and cannot be edited or deleted.'); + + return true; } } - - $VAR['id'] = $id_list; - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); } - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); + /** + * Update an entry + */ + public function update($VAR) { + if (! $this->isAuthorised($VAR)) + return parent::update($VAR); } - ############################## - ## SEARCH SHOW ## - ############################## + /** + * Delete a record + */ + public function delete($VAR) { + $this->associated_DELETE = array(); - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } + array_push($this->associated_DELETE,array('table'=>'account_group','field'=>'group_id')); + array_push($this->associated_DELETE,array('table'=>'group_method','field'=>'group_id')); + if (! $this->isAuthorised($VAR)) + return parent::delete($VAR); + } - ############################## - ## VISUAL LAYOUT ## - ############################## - function visual_layout() - { - + /** + * Draw the group layout + */ + public function tpl_visual_layout() { $class = 'form_field'; - # get the default group - if(!isset($default)) $default = unserialize(DEFAULT_GROUP); - for($i=0; $iExecute($sql); + $result = $db->Execute(sqlSelect($db,'group','id,name,parent_id','id!=0','parent_id,name')); - # error handling - if ($result === false) - { + # Error handling + if (! $result) { global $C_debug; - $C_debug->error('list.inc.php','select_groups', $db->ErrorMsg()); - } - # number of results - if($result->RecordCount() > 0) - { - # set the results to an array: - $arr = $result->GetArray(); - - # start the list - $ret = ''; - - #---------------------- - # start the parent loop - #---------------------- - $group = 0; - $arr_count = count($arr); - for($i=0; $i < $arr_count; $i++) - { - $level = 0; - if($arr[$i]['parent_id'] == $group) - { - - $ret .= '  '. $arr[$i]['name']; - $ret .= '    edit
    '; - - #---------------------- - # start the child loop - #---------------------- - $level++; - $ii_group = $arr[$i]['id']; - $ii_print = 1; - - # count the available childs for this group - $count_child[$ii_group]=0; - for($c_child=0; $c_child < $arr_count; $c_child++) - if($arr[$c_child]['parent_id'] == $ii_group) $count_child[$ii_group]++; - - for($ii=0; $ii < $arr_count; $ii++) - { - if($arr[$ii]['parent_id'] == $ii_group) - { - $ret .= '  |__'; - $ret .= '  '. $arr[$ii]['name']; - $ret .= '    edit
    '; - - $ii_print++; - - #-------------------------- - # start the sub-child loop - #-------------------------- - $level++; - $iii_group = $arr[$ii]['id']; - $iii_print = 0; - for($iii=0; $iii < $arr_count; $iii++) - { - if($arr[$iii]['parent_id'] == $iii_group) - { - - if($count_child[$ii_group] < $ii_print) - { - $ret .= '         |__ '; - } - else - { - $ret .= '  |      |__ '; - } - $ret .= '  '. $arr[$iii]['name']; - $ret .= '    edit
    '; - $iii_print++; - } - } - $level--; - #----------------------- - # end of sub-child loop - #----------------------- - - } - } - $level--; - #------------------- - # end of child loop - #------------------- - } - } - } - else - { - return 'No groups available!'; // translate! + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); } - echo $ret; + + # Number of results + if ($result->RecordCount() > 0) + echo $this->build_nested_list($result->GetArray(),0,0); + else + echo _('No groups available!'); } + /** + * This function will build a nested option list + * showing the heirachy of the groups + * + * @see tpl_visual_layout + */ + private function build_nested_list($arr,$level,$current) { + $ret = ''; + for ($i=0; $i < count($arr); $i++) { + if ($arr[$i]['parent_id'] == $current) { + if ($level) + $ret .= sprintf('%s|__ ',str_repeat('   ',$level)); + + $ret .= sprintf('  %s   %s
    ',$arr[$i]['name'],$arr[$i]['id'],_('Edit')); + $ret .= $this->build_nested_list($arr,$level+1,$arr[$i]['id']); + } + } + + return $ret; + } } -?> \ No newline at end of file +?> diff --git a/modules/group/group_construct.xml b/modules/group/group_construct.xml index 51dbfd0d..2e0e6455 100644 --- a/modules/group/group_construct.xml +++ b/modules/group/group_construct.xml @@ -1,72 +1,103 @@ - - group - - group
    - - - - 0 - - parent_id,name - - 25 - - - date_expire - status,parent_id,date_start,date_expire - - - - - I4 - 1 - - - I4 - - - I8 - date-now - - - I8 - date-time - - - I8 - date-time - - - I4 - - - L - - - L - - - C(128) - any - 3 - 64 - 1 - - - X2 - - - - - id,site_id,date_orig,date_start,date_expire,name,notes,status,pricing,parent_id - id,site_id,date_orig,date_start,date_expire,name,notes,status,pricing,parent_id - id,site_id,date_orig,date_start,date_expire,name,notes,status,pricing,parent_id - id,site_id,date_orig,date_start,date_expire,name,notes,status,pricing,parent_id - id,site_id,date_orig,date_start,date_expire,name,notes,status,pricing,parent_id - id,site_id,date_orig,date_start,date_expire,name,notes,status,pricing,parent_id - - - 0 + + group + + group
    + + + + 0 + + parent_id,name + + 25 + + 0 + + + + date_expire + status,parent_id,date_start,date_expire + + + + + + + 1 + I4 + 1 + + + + 1 + I4 + + + + date-now + Date Created + I8 + + + I8 + date-time + Date Start + + + I8 + date-time + Date End + + + I4 + Parent + + + + Active + L + + + L + Group Pricing + + + C(128) + any + 3 + 64 + 1 + Name + + + X2 + Notes + + + + + + date_start,date_expire,name,notes,status,pricing,parent_id + date_start,date_expire,name,notes,status,pricing,parent_id + id + id,date_orig,date_start,date_expire,name,notes,status,pricing,parent_id + name + + + + + + + + <add>Add Group</add> + <search_show>Groups</search_show> + <tpl_title_visual>Group Layout Visualisation</tpl_title_visual> + <view>Modify Group</view> + + + + +
    diff --git a/modules/group/group_install.xml b/modules/group/group_install.xml index 23a1babd..722b1535 100644 --- a/modules/group/group_install.xml +++ b/modules/group/group_install.xml @@ -1,40 +1,59 @@ + + - group - account_admin - + + + + Groups + 1 + + group + + + + setup + + + + core - - - - visual_layout - - - - search - - - view - - - 1 - - - add - - 1 - - - delete - - - update - - - search_show - - - - - \ No newline at end of file + + + + + Add + 1 + add + + + + delete + + + + 1 + List + search + + + + + search_show + + + + update + + + + view + + + + tpl_visual_layout + + + + diff --git a/modules/group/group_install_data.xml b/modules/group/group_install_data.xml index a42c61e4..4d899f38 100644 --- a/modules/group/group_install_data.xml +++ b/modules/group/group_install_data.xml @@ -1,51 +1,51 @@ - - 0 - 1 - 0 - 0 - 0 - 0 - 1 - 1 - All Users - All unregistered users will have access to this. - - - 2 - 1 - 0 - 0 - 0 - 0 - 1 - 1 - Registered Users - - - 4 - 1 - 0 - 0 - 0 - 2 - 1 - 0 - Staff - - - 1001 - 1 - 0 - 0 - 0 - 2 - 1 - 0 - Root - - - 1016 - - \ No newline at end of file + + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 1 + All Users + All unregistered users will have access to this. + + + 2 + 1 + 0 + 0 + 0 + 0 + 1 + 1 + Registered Users + + + 4 + 1 + 0 + 0 + 0 + 2 + 1 + 0 + Staff + + + 1001 + 1 + 0 + 0 + 0 + 2 + 1 + 0 + Root + + + 1016 + + diff --git a/modules/group_method/group_method_install.xml b/modules/group_method/group_method_install.xml index 169c5910..0b1f24f4 100644 --- a/modules/group_method/group_method_install.xml +++ b/modules/group_method/group_method_install.xml @@ -2,7 +2,9 @@ group_method group + module_method + core @@ -26,4 +28,4 @@ - \ No newline at end of file + diff --git a/modules/host_registrar_plugin/host_registrar_plugin.inc.php b/modules/host_registrar_plugin/host_registrar_plugin.inc.php index 825755d6..07528e4f 100644 --- a/modules/host_registrar_plugin/host_registrar_plugin.inc.php +++ b/modules/host_registrar_plugin/host_registrar_plugin.inc.php @@ -1,102 +1,34 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Module:HostRegistrarPlugin */ - -class host_registrar_plugin -{ - - # Open the constructor for this mod - function host_registrar_plugin() - { - # name of this module: - $this->module = "host_registrar_plugin"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } +/** + * The main AgileBill Host Registrar Plugin Class + * + * @package AgileBill + * @subpackage Module:HostRegistrarPlugin + */ +class host_registrar_plugin extends OSB_module { ############################## ## SEARCH ## ############################## @@ -148,11 +80,9 @@ class host_registrar_plugin } } - ############################## ## SEARCH SHOW ## ############################## - function search_show($VAR) { @@ -236,4 +166,4 @@ class host_registrar_plugin $smarty->assign('page_arr', $page_arr); } } -?> \ No newline at end of file +?> diff --git a/modules/host_registrar_plugin/host_registrar_plugin_construct.xml b/modules/host_registrar_plugin/host_registrar_plugin_construct.xml index 0440d43d..6366dfb2 100644 --- a/modules/host_registrar_plugin/host_registrar_plugin_construct.xml +++ b/modules/host_registrar_plugin/host_registrar_plugin_construct.xml @@ -1,59 +1,79 @@ - - host_registrar_plugin - - host_registrar_plugin
    - - - - 0 - - name - - 25 - - - - I4 - 1 - 1 - - - I4 - 1 - 1 - - - L - - - C(32) - 1 - 2 - 32 - any - - - C(32) - 1 - 2 - 32 - any - - - X2 - array - - - - - id,site_id,status,name,file,plugin_data - id,site_id,status,name,file,plugin_data - id,site_id,status,name,file,plugin_data - id,site_id,status,name,file,plugin_data - id,site_id,status,name,file,plugin_data - - - 0> -
    \ No newline at end of file + + host_registrar_plugin + + host_registrar_plugin
    + + + + 0 + + name + + 25 + + 1 + + + + + + + + + + 1 + I4 + 1 + + + + 1 + I4 + + + + Active + L + + + C(32) + 1 + 2 + 32 + any + + + C(32) + 1 + 2 + 32 + any + + + X2 + array + + + + + + status,name,file,plugin_data + id,site_id,status,name,file,plugin_data + id,site_id,status,name,file,plugin_data + id,site_id,status,name,file,plugin_data + id,site_id,status,name,file,plugin_data + + + + + + + + + + + + + diff --git a/modules/host_registrar_plugin/host_registrar_plugin_install.xml b/modules/host_registrar_plugin/host_registrar_plugin_install.xml index 8b547bd7..bc49746e 100644 --- a/modules/host_registrar_plugin/host_registrar_plugin_install.xml +++ b/modules/host_registrar_plugin/host_registrar_plugin_install.xml @@ -1,35 +1,57 @@ + + - host_registrar_plugin - host_server - + + + + Host Registrar Plugins + 1 + + host_registrar_plugin + + + + host_server + + + + - - - - add - - - update - - - delete - - - view - - 1 - - - search - - - search_form - - - search_show - - - - \ No newline at end of file + + + + + add + + + + delete + + + + List + 1 + search + + + + + search_form + + + + search_show + + + + update + + + + view + + + + diff --git a/modules/host_registrar_plugin/host_registrar_plugin_install_data.xml b/modules/host_registrar_plugin/host_registrar_plugin_install_data.xml index 5c8a3687..91da153e 100644 --- a/modules/host_registrar_plugin/host_registrar_plugin_install_data.xml +++ b/modules/host_registrar_plugin/host_registrar_plugin_install_data.xml @@ -1,14 +1,14 @@ - - 1 - 1 - 1 - manual - MANUAL - - - - 2 - - \ No newline at end of file + + 1 + 1 + 1 + manual + MANUAL + + + + 2 + + diff --git a/modules/host_server/host_server.inc.php b/modules/host_server/host_server.inc.php index 9c9f6a29..3bd75d44 100644 --- a/modules/host_server/host_server.inc.php +++ b/modules/host_server/host_server.inc.php @@ -1,86 +1,57 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Module:HostServer */ - -class host_server -{ - # Open the constructor for this mod - function host_server() - { - # name of this module: - $this->module = "host_server"; +/** + * The main AgileBill Hosting Server Class + * + * @package AgileBill + * @subpackage Module:HostServer + */ +class host_server extends OSB_module { + # Manual add + function host_manual_new($service, $server, $account) { } - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; + # Manual edit + function host_manual_edit($service, $server, $account) { } - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); + # Manual activate + function host_manual_active($service, $server, $account) { } - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } + # Manual deactivate + function host_manual_inactive($service, $server, $account) { } - # manual add - function host_manual_new($service, $server, $account) - { - } - - # manual edit - function host_manual_edit($service, $server, $account) - { - } - - # manual activate - function host_manual_active($service, $server, $account) - { - } - - # manual deactivate - function host_manual_inactive($service, $server, $account) - { - } - - # manual delete - function host_manual_delete($service, $server, $account) - { - } + # Manual delete + function host_manual_delete($service, $server, $account) { } # Generate a new login - function generate_login($service,$account,$max_un_len, $max_pw_len, $shared) - { + function generate_login($service,$account,$max_un_len, $max_pw_len, $shared) { # define username - if($service['host_username'] != '') - { + if($service['host_username'] != '') { $ret['username'] = $service['host_username']; - } else - { - if ($shared == false) - { + } else { + if ($shared == false) { # is username already in use on this server? $db = &DB(); $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'service WHERE @@ -89,8 +60,7 @@ class host_server host_username = ' . $db->qstr( $account['username'] ) . ' AND site_id = ' . $db->qstr(DEFAULT_SITE); $rs = $db->Execute($sql); - if ($rs->RecordCount() == 0) - { + if ($rs->RecordCount() == 0) { $ret['username'] = $account['username']; } else { $ret['username'] = $this->generate_login1($max_un_len); @@ -204,18 +174,13 @@ class host_server return true; } + /** + * Add a record + */ + public function add($VAR) { + $VAR['host_server_keycode'] = md5(rand(99,999).microtime()); - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $VAR['host_server_keycode'] = md5(rand(99,999) . microtime()); - - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); + return parent::add($VAR); } ############################## @@ -252,60 +217,5 @@ class host_server $smarty->assign('next_server', false); } } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } - } -?> \ No newline at end of file +?> diff --git a/modules/host_server/host_server_construct.xml b/modules/host_server/host_server_construct.xml index a2ad8bd6..80abd5ee 100644 --- a/modules/host_server/host_server_construct.xml +++ b/modules/host_server/host_server_construct.xml @@ -1,96 +1,141 @@ - - host_server - - host_server
    - - - - 0 - - name - - 25 - - - - I4 - 1 - 1 - - - I4 - 1 - - - L - - - L - - - C(128) - 1 - 128 - any - - - C(255) - - - C(128) - 1 - 128 - - - X2 - array - - - I4 - - - I4 - host_server - name - - - L - - - C(32) - - - L - - - X2 - - - C(128) - - - C(128) - - - C(128) - - - C(128) - - - C(64) - - - - - id,site_id,status,debug,name,notes,provision_plugin,provision_plugin_data,max_accounts,next_host_server_id,name_based,name_based_ip,ip_based,ip_based_ip,ns_ip_secondary,ns_ip_primary,ns_primary,ns_secondary,keycode - id,site_id,status,debug,name,notes,provision_plugin,provision_plugin_data,max_accounts,next_host_server_id,name_based,name_based_ip,ip_based,ip_based_ip,ns_ip_secondary,ns_ip_primary,ns_primary,ns_secondary,keycode - id,site_id,status,debug,name,notes,provision_plugin,provision_plugin_data,max_accounts,next_host_server_id,name_based,name_based_ip,ip_based,ip_based_ip,ns_ip_secondary,ns_ip_primary,ns_primary,ns_secondary,keycode - id,site_id,status,debug,name,notes,provision_plugin,provision_plugin_data,max_accounts,next_host_server_id,name_based,name_based_ip,ip_based,ip_based_ip,ns_ip_secondary,ns_ip_primary,ns_primary,ns_secondary,keycode - id,site_id,status,debug,name,notes,provision_plugin,provision_plugin_data,max_accounts,next_host_server_id,name_based,name_based_ip,ip_based,ip_based_ip,ns_ip_secondary,ns_ip_primary,ns_primary,ns_secondary,keycode - - - 0 + + host_server + + host_server
    + + + + 0 + + name + + 25 + + 0 + + + + + + + + + + 1 + I4 + 1 + + + + 1 + I4 + + + + Active + L + + + L + + + C(128) + 1 + 128 + any + + + C(255) + + + C(128) + 1 + 128 + + + X2 + array + + + I4 + + + I4 + host_server + name + + + L + + + C(32) + + + L + + + X2 + + + C(128) + + + C(128) + + + C(128) + + + C(128) + + + C(64) + + + + + + status,debug,name,notes,provision_plugin,name_based,name_based_ip,ip_based,ip_based_ip,ns_ip_secondary,ns_ip_primary,ns_primary,ns_secondary,keycode + id,site_id,status,debug,name,notes,provision_plugin,provision_plugin_data,max_accounts,next_host_server_id,name_based,name_based_ip,ip_based,ip_based_ip,ns_ip_secondary,ns_ip_primary,ns_primary,ns_secondary,keycode + id,site_id,status,debug,name,notes,provision_plugin,provision_plugin_data,max_accounts,next_host_server_id,name_based,name_based_ip,ip_based,ip_based_ip,ns_ip_secondary,ns_ip_primary,ns_primary,ns_secondary,keycode + id,site_id,status,debug,name,notes,provision_plugin,provision_plugin_data,max_accounts,next_host_server_id,name_based,name_based_ip,ip_based,ip_based_ip,ns_ip_secondary,ns_ip_primary,ns_primary,ns_secondary,keycode + id,site_id,status,debug,name,notes,provision_plugin,provision_plugin_data,max_accounts,next_host_server_id,name_based,name_based_ip,ip_based,ip_based_ip,ns_ip_secondary,ns_ip_primary,ns_primary,ns_secondary,keycode + + + + + + + + + + + + + + id + checkbox + 25px + + + name + + + provision_plugin + + + name_based_ip + + + max_accounts + + + status + bool_icon + 20px + + +
    diff --git a/modules/host_server/host_server_install.xml b/modules/host_server/host_server_install.xml index d44e4a6c..479581c7 100644 --- a/modules/host_server/host_server_install.xml +++ b/modules/host_server/host_server_install.xml @@ -1,40 +1,59 @@ + + - host_server - host_server - + + + + Hosting Servers + 1 + + host_server + + + + + host_tld,host_registrar_plugin + + - - - - add - - 1 - - - update - - - search - - - search_form - - - - view - - 1 - - - delete - - - search_show - - - - - \ No newline at end of file + + + + + Add + 1 + add + + + + delete + + + + List + 1 + search + + + + + search_form + + + + search_show + + + + update + + + + view + + + + diff --git a/modules/host_tld/host_tld.inc.php b/modules/host_tld/host_tld.inc.php index 774d3b4c..ef0dde04 100644 --- a/modules/host_tld/host_tld.inc.php +++ b/modules/host_tld/host_tld.inc.php @@ -1,25 +1,34 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Module:Domains */ - -class host_tld -{ + +/** + * The main AgileBill Module Domains Class + * + * @package AgileBill + * @subpackage Module:Domains + */ +class host_tld extends OSB_module { /** * Get the TLD pricing array @@ -335,82 +344,5 @@ class host_tld return; } } - - function constructor() - { - $this->module = "host_tld"; - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - function add($VAR) - { - $this->constructor(); - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - function view($VAR) - { - $this->constructor(); - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - function update($VAR) - { - $this->constructor(); - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - function delete($VAR) - { - $this->constructor(); - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - function search_form($VAR) - { - $this->constructor(); - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - function search($VAR) - { - $this->constructor(); - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - function search_show($VAR) - { - $this->constructor(); - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } } -?> \ No newline at end of file +?> diff --git a/modules/host_tld/host_tld_construct.xml b/modules/host_tld/host_tld_construct.xml index 43afd8a4..6d150626 100644 --- a/modules/host_tld/host_tld_construct.xml +++ b/modules/host_tld/host_tld_construct.xml @@ -1,84 +1,141 @@ - - host_tld - - host_tld
    - - - - 0 - - name - - 25 - - - status - name - auto_search - - - - - I4 - 1 - 1 - - - I4 - 1 - - - L - - - C(128) - any - - - L - - - C(32) - 1 - 32 - - - X2 - array - - - I4 - host_registrar_plugin - name - - - X2 - array - - - L - - - I4 - 1 - 2 - numeric - - - X2 - array - - - - - id,site_id,status,name,whois_plugin,whois_plugin_data,registrar_plugin_id,registrar_plugin_data,auto_search,default_term_new,price_group,taxable - id,site_id,status,name,whois_plugin,whois_plugin_data,registrar_plugin_id,registrar_plugin_data,auto_search,default_term_new,price_group,taxable - id,site_id,status,name,whois_plugin,whois_plugin_data,registrar_plugin_id,registrar_plugin_data,auto_search,default_term_new,price_group,taxable - id,site_id,status,name,whois_plugin,whois_plugin_data,registrar_plugin_id,registrar_plugin_data,auto_search,default_term_new,price_group,taxable - id,site_id,status,name,whois_plugin,whois_plugin_data,registrar_plugin_id,registrar_plugin_data,auto_search,default_term_new,price_group,taxable - - - 0 + + host_tld + + host_tld
    + + + + 15 + + name + + 25 + + 0 + + + + status + name + auto_search + + + + + + + 1 + I4 + 1 + + + + 1 + I4 + + + + Date Created + I8 + + + + date-now + Date Updated + I8 + + + + Active + L + + + Extension Name + C(128) + any + + + Taxable + L + + + Whois Plugin + C(32) + 1 + 32 + + + X2 + array + + + Registrar Plugin + I4 + host_registrar_plugin + name + + + X2 + array + + + Auto Search + L + + + Default Term + I4 + 1 + 2 + numeric + + + X2 + array + + + + + + date_orig,status,name,whois_plugin,registrar_plugin_id,auto_search,default_term_new,taxable + id,site_id,status,name,whois_plugin,whois_plugin_data,registrar_plugin_id,registrar_plugin_data,auto_search,default_term_new,price_group,taxable + id,site_id,status,name,whois_plugin,whois_plugin_data,registrar_plugin_id,registrar_plugin_data,auto_search,default_term_new,price_group,taxable + id,site_id,status,name,whois_plugin,whois_plugin_data,registrar_plugin_id,registrar_plugin_data,auto_search,default_term_new,price_group,taxable + id,site_id,status,name,whois_plugin,whois_plugin_data,registrar_plugin_id,registrar_plugin_data,auto_search,default_term_new,price_group,taxable + + + + + + + + <add>Add TLD</add> + + + + + + + id + checkbox + 25px + + + name + + + status + bool_icon + 20px + + + whois_plugin + + + registrar_plugin_id + + +
    diff --git a/modules/host_tld/host_tld_install.xml b/modules/host_tld/host_tld_install.xml index f8438d95..7ced8540 100644 --- a/modules/host_tld/host_tld_install.xml +++ b/modules/host_tld/host_tld_install.xml @@ -1,37 +1,57 @@ + + - host_tld - host_server - + + + + Domain TLD + 1 + + host_tld + + + + host_server + + - - - - add - - 1 - - - update - - - delete - - - view - - 1 - - - search - - - search_form - - - search_show - - - - \ No newline at end of file + + + + + Add + 1 + add + + + + delete + + + + List + 1 + search + + + + + search_form + + + + search_show + + + + update + + + + view + + + + diff --git a/modules/host_tld/host_tld_install_data.xml b/modules/host_tld/host_tld_install_data.xml index 0ced9544..cce3e428 100644 --- a/modules/host_tld/host_tld_install_data.xml +++ b/modules/host_tld/host_tld_install_data.xml @@ -42,7 +42,49 @@ 2 + + 4 + 1 + 1 + com.au + 1 + DEFAULT + + 1 + + 1 + 2 + + + + 5 + 1 + 1 + net.au + 1 + DEFAULT + + 1 + + 1 + 2 + + + + 6 + 1 + 1 + org.au + 1 + DEFAULT + + 1 + + 1 + 2 + + - 3 + 6 - \ No newline at end of file + diff --git a/modules/htaccess/auth.inc.php b/modules/htaccess/auth.inc.php deleted file mode 100644 index bdbf26a0..00000000 --- a/modules/htaccess/auth.inc.php +++ /dev/null @@ -1,10 +0,0 @@ - 'htaccess', 'method' => 'list_dirs'), - Array ('module' => 'htaccess', 'method' => 'check_smarty') - ); -?> \ No newline at end of file diff --git a/modules/htaccess/htaccess.inc.php b/modules/htaccess/htaccess.inc.php deleted file mode 100644 index bcc8106e..00000000 --- a/modules/htaccess/htaccess.inc.php +++ /dev/null @@ -1,362 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -class htaccess -{ - - # Open the constructor for this mod - function htaccess() - { - # name of this module: - $this->module = "htaccess"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - - - ############################## - ## LIST AUTH HTACCESS URLS ## - ############################## - - function list_dirs($VAR) - { - global $smarty, $C_auth; - $ii = 0; - - ### Get a list of htaccess groups: - $db = &DB(); - $sql = 'SELECT id,group_avail - FROM ' . AGILE_DB_PREFIX . 'htaccess WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - status = ' . $db->qstr('1'); - $result = $db->Execute($sql); - - if($result->RecordCount() == 0) - { - - $smarty->assign('htaccess_display', false); - return false; - } - - while(!$result->EOF) - { - @$arr = unserialize($result->fields['group_avail']); - $id = $result->fields['id']; - $this_show = false; - - for($i=0; $iauth_group_by_id($arr[$i])) - { - $this_show = true; - $i=count($arr); - } - } - - if($this_show) - { - ### Get each directory and add it to the array: - $db = &DB(); - $sql = 'SELECT * - FROM ' . AGILE_DB_PREFIX . 'htaccess_dir WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - htaccess_id = ' . $db->qstr($id) . ' AND - status = ' . $db->qstr('1'); - $result_dir = $db->Execute($sql); - - while(!$result_dir->EOF) - { - - $arr_smarty[] = Array ( - 'id' => $result_dir->fields['id'], - 'name' => $result_dir->fields['name'], - 'description' => $result_dir->fields['description'], - 'url' => $result_dir->fields['url'] - ); - $ii++; - $result_dir->MoveNext(); - } - } - $result->MoveNext(); - } - - - - if($ii == "0") - { - $smarty->assign('htaccess_display', false); - return false; - } - else - { - $smarty->assign('htaccess_display', true); - $smarty->assign('htaccess_results', $arr_smarty); - return true; - } - } - - - - - - ############################## - ## Smarty Authentication ## - ############################## - function check_smarty($VAR) - { - global $smarty, $C_translate; - if($this->check_auth($VAR['_htaccess_id']) ) - { - if(isset($VAR['_htaccess_dir_id'])) - { - ## Get the URL for this htaccess area: - $db = &DB(); - $sql = 'SELECT url FROM ' . AGILE_DB_PREFIX . 'htaccess_dir WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - id = ' . $db->qstr($VAR['_htaccess_dir_id']); - $result = $db->Execute($sql); - if($result->RecordCount() > 0) - $smarty->assign('htaccess_url', $result->fields['url']); - $smarty->assign('htaccess_auth', "1"); - return true; - } - } - - $smarty->assign('htaccess_auth', "0"); - return false; - } - - - ############################## - ## Check Authentication ## - ############################## - function check_auth($id) - { - ### Check if user is a member of one of the authorized groups: - $db = &DB(); - $sql = 'SELECT status,group_avail FROM ' . AGILE_DB_PREFIX . 'htaccess WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - id = ' . $db->qstr($id); - $result = $db->Execute($sql); - - if($result->RecordCount() > 0) - { - if ($result->fields['status'] != '1') return false; - @$arr = unserialize($result->fields['group_avail']); - global $C_auth; - for($i=0; $iauth_group_by_id($arr[$i])) return true; - - } - - return false; - } - - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $id = $db->add($VAR, $this, $type); - - if(isset($id) && $id > 0) - { - # Create the php index file for the Apache mod_auth_remote module: - /* - $GroupArray = ''; - for($i=0; $i 0) $GroupArray .= ','; - $GroupArray .= $VAR['htaccess_group_avail'][$i]; - } - - $data = ''; - - # add dir: - $dir = PATH_FILES . 'htaccess_'. $id .'/'; - if(is_dir($dir)) - mkdir($dir, '755'); - - $file = $dir . 'index.php'; - $fp = fopen($file, "w+"); - fputs($fp, $data); - fclose($fp); - */ - } - } - - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $result = $db->update($VAR, $this, $type); - - if($result) - { - $id = $VAR['htaccess_id']; - - # Update the php index file for the Apache mod_auth_remote module: - $GroupArray = ''; - for($i=0; $i 0) $GroupArray .= ','; - $GroupArray .= $VAR['htaccess_group_avail'][$i]; - } - - - $data = ''; - - # add dir: - $dir = PATH_FILES . 'htaccess_'. $id; - if(!is_dir($dir)) - mkdir($dir, '755'); - - $file = PATH_FILES . 'htaccess_'. $id . '/index.php'; - $fp = fopen($file, "w+"); - fputs($fp, $data); - fclose($fp); - } - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - global $C_debug, $C_translate; - - ### Get the array - if(isset($VAR["delete_id"])) - $id = explode(',', $VAR["delete_id"]); - elseif (isset($VAR["id"])) - $id = explode(',', $VAR["id"]); - - ### Load class for deleting sub-dirs. - include_once ( PATH_MODULES .'htaccess_dir/htaccess_dir.inc.php' ); - $htdir = new htaccess_dir; - - ### Loop: - $db = &DB(); - for($i=0; $i 0 ) - { - ### Delete the htpasswd record: - $sql = "DELETE FROM ".AGILE_DB_PREFIX."htaccess WHERE - site_id = ".$db->qstr(DEFAULT_SITE)." AND - id = ".$db->qstr($id[$i]); - $result = $db->Execute($sql); - - if ( $result ) - { - ### Delete .htaccess file(s) from the sub-directories - $sql = "SELECT id FROM ".AGILE_DB_PREFIX."htaccess_dir WHERE - site_id = ".$db->qstr(DEFAULT_SITE)." AND - htaccess_id = ".$db->qstr($id[$i]); - $result = $db->Execute($sql); - if ($result->RecordCount() > 0 ) - $htdir->delete_one($result->fields['id']); - } - } - - ### Delete the mod_auth_remote files: - /* - unlink(PATH_FILES.'htaccess_'. $id[$i] . '/index.php'); - rmdir(PATH_FILES.'htaccess_'. $id[$i] ); - */ - } - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } - -} -?> \ No newline at end of file diff --git a/modules/htaccess/htaccess_construct.xml b/modules/htaccess/htaccess_construct.xml deleted file mode 100644 index 3749b7dc..00000000 --- a/modules/htaccess/htaccess_construct.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - htaccess - - htaccess
    - - - - 0 - - name - - 25 - - - date_start - date_expire - status - - - - - I4 - 1 - 1 - - - I4 - 1 - 1 - - - I8 - date - - - I8 - date - - - C(128) - 3 - 128 - alphanumeric - 1 - - - X2 - - - L - - - X2 - any - array - - - - - id,site_id,date_start,date_expire,name,description,status,group_avail - id,site_id,date_start,date_expire,name,description,status,group_avail - id,site_id,date_start,date_expire,name,description,status,group_avail - id,site_id,date_start,date_expire,name,description,status,group_avail - id,site_id,date_start,date_expire,name,description,status,group_avail - - - 0 -
    diff --git a/modules/htaccess/htaccess_install.xml b/modules/htaccess/htaccess_install.xml deleted file mode 100644 index c6d37810..00000000 --- a/modules/htaccess/htaccess_install.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - htaccess - htaccess - - 1 - htaccess_dir,htaccess_exclude - - - - - search - - - view - - - 1 - - - add - - 1 - - - delete - - - update - - - search_show - - - - - \ No newline at end of file diff --git a/modules/htaccess/mod_auth_remote.inc.php b/modules/htaccess/mod_auth_remote.inc.php deleted file mode 100644 index 1b11c42d..00000000 --- a/modules/htaccess/mod_auth_remote.inc.php +++ /dev/null @@ -1,103 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -# check that the username/password are both set -if(empty($_SERVER['PHP_AUTH_USER']) || empty($_SERVER['PHP_AUTH_PW'])) -{ - mail('sales@agileco.com', 'htaccess empty', ''); - header_unauth(); -} - - -#check the database for a match -$pre = AGILE_DB_PREFIX; -$time = time(); -$db = &DB(); -$q = " SELECT DISTINCT - {$pre}account.id AS account_id, - {$pre}account_group.group_id AS group_id - FROM - {$pre}account - INNER JOIN - {$pre}account_group - ON - {$pre}account_group.account_id = {$pre}account.id - WHERE - ( - {$pre}account.date_expire IS NULL OR - {$pre}account.date_expire = 0 OR - {$pre}account.date_expire > ".$db->qstr($time)." - ) - AND - {$pre}account.status = ". $db->qstr(1) . " - AND - ( - {$pre}account.password = ". $db->qstr(md5(@$_SERVER['PHP_AUTH_PW'])) . " - OR - {$pre}account.password = ". $db->qstr(@$_SERVER['PHP_AUTH_PW']) . " - ) - AND - {$pre}account.username = ". $db->qstr(@$_SERVER['PHP_AUTH_USER'] )." - AND - {$pre}account.site_id = ". $db->qstr(DEFAULT_SITE ) . " - AND - ( - {$pre}account_group.date_start IS NULL OR - {$pre}account_group.date_start = 0 OR - {$pre}account_group.date_start < ".$db->qstr($time)." - ) - AND - ( - {$pre}account_group.date_expire IS NULL OR - {$pre}account_group.date_expire = 0 OR - {$pre}account_group.date_expire > ".$db->qstr($time)." - ) - AND - {$pre}account_group.active = ".$db->qstr(1)." - AND - {$pre}account_group.site_id = ". $db->qstr( DEFAULT_SITE ); - -# Check for group permissions: -$result = $db->Execute($q); -if($result->RecordCount() > 0) { - while( !$result->EOF ) { - for($i=0; $ifields["group_id"]) - header_auth(); - } - $result->MoveNext(); - } -} - -# Not authorized: -header_unauth(); - - -function header_auth() { - header('HTTP/1.0 201 Authorized'); - exit; -} - -function header_unauth() -{ - header('WWW-Authenticate: Basic realm="{$realm}"'); - header('HTTP/1.0 401 Unauthorized'); -} -?> \ No newline at end of file diff --git a/modules/htaccess_dir/htaccess_dir.inc.php b/modules/htaccess_dir/htaccess_dir.inc.php deleted file mode 100644 index c2b059ed..00000000 --- a/modules/htaccess_dir/htaccess_dir.inc.php +++ /dev/null @@ -1,472 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -class htaccess_dir -{ - - # Open the constructor for this mod - function htaccess_dir() - { - # name of this module: - $this->module = "htaccess_dir"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - - # add extra lines needed in the .htaccess files when added/updated: - # Example: - #$this->htaccess_extra = "Options +FollowSymlinks\n"; - $this->htaccess_extra = ''; - } - - - - - ############################## - ## ADD ## - ############################## - - function add($VAR) - { - global $C_translate, $C_debug; - $VAR['htaccess_dir_htaccess'] = '# Error!'; - $this->validated = true; - - ### Change the path... - if ( isset ( $VAR['htaccess_dir_path'] ) && $VAR['htaccess_dir_path'] != '' ) - { - # trim whitspaces - $VAR['htaccess_dir_path'] = trim ( $VAR['htaccess_dir_path'] ); - - # replace all forward slashes with back slashes - $VAR['htaccess_dir_path'] = ereg_replace('\\\\', '/', $VAR['htaccess_dir_path']); - - # add the final trailing slash if missing - if ( !ereg ('[/]$', $VAR['htaccess_dir_path'] ) ) - $VAR['htaccess_dir_path'] = $VAR['htaccess_dir_path'] . '/'; - } - - - if( isset ( $VAR['htaccess_dir_path'] ) && $VAR['htaccess_dir_path'] != '' ) - { - ################################################################ - ### VERIFY LOCAL PATH & WRITABILITY! - - @$filename = $VAR['htaccess_dir_path'] . '.htaccess'; - @$id = $VAR['htaccess_dir_htaccess_id']; - $db = &DB(); - $sql = 'SELECT name FROM ' . AGILE_DB_PREFIX . 'htaccess WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - id = ' . $db->qstr($id); - $result = $db->Execute($sql); - @$name = $result->fields['name']; - - ### Check path - $path = $VAR['htaccess_dir_path']; - if ( is_dir ( $path ) ) - { - ### Check if is writable! - if ( !is_writable ( $path ) ) - { - ## Path not writable! - $this->validated = false; - $this->val_error[] = array( - 'field' => 'none', - 'field_trans' => $C_translate->translate('error', 'core', ""), - 'error' => $C_translate->translate('path_auth', 'htaccess_dir', "")); - } - } - else - { - ### Path broken! - $this->validated = false; - $this->val_error[] = array( - 'field' => 'none', - 'field_trans' => $C_translate->translate('error', 'core', ""), - 'error' => $C_translate->translate('path_broke', 'htaccess_dir', "")); - } - } - - - - #################################################################### - ### If validation was failed, skip the db insert & - ### set the errors & origonal fields as Smarty objects, - ### and change the page to be loaded. - #################################################################### - - if(!$this->validated) - { - global $smarty; - - # set the errors as a Smarty Object - $smarty->assign('form_validation', $this->val_error); - - # set the page to be loaded - if(!defined("FORCE_PAGE")) - { - define('FORCE_PAGE', $VAR['_page_current']); - } - return; - } - - - #################################################################### - ### Create the record/verify fields - - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $dir_id = $db->add($VAR, $this, $type); - - #################################################################### - ### Create the .htaccess file - - if( isset ( $dir_id ) && $dir_id > 0 ) - { - ### GENERATE THE EXCLUDE LIST - $exclude_list = $this->exclude_list(); - - ### GENERATE THE .HTACCESS FILE - $nl = "\n"; - $data = $this->htaccess_extra . 'RewriteEngine on' . $nl; - if(empty($VAR['htaccess_dir_recursive'])) - $data .= 'RewriteRule ^(.*)/.*$ - [L]' . $nl; - $data .= 'RewriteRule ' . $exclude_list . '$ htaccess_index.php?_HTACCESS_ID='.$id.'&_HTACCESS_DIR_ID='.$dir_id; - - ### Update the db record - $db = &DB(); - $sql = "UPDATE ".AGILE_DB_PREFIX."htaccess_dir SET - htaccess = " . $db->qstr( $data ) . " WHERE - id = " . $db->qstr( $dir_id ) . " AND - site_id = " . $db->qstr( DEFAULT_SITE ); - $result = $db->Execute($sql); - - ### WRITE THE LOCAL .HTACCESS FILE - $fp = fopen($filename, "w+"); - fwrite($fp,$data); - fclose($fp); - - ### WRITE THE htaccess_index.php FILE - $php_filename = $VAR['htaccess_dir_path'] . 'htaccess_index.php'; - $data = $this->create_php(); - $fp = fopen($php_filename, "w+"); - fwrite($fp,$data); - fclose($fp); - } - } - - - - - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - global $C_translate, $C_debug; - $this->validated = true; - - ### Change the path... - if ( isset ( $VAR['htaccess_dir_path'] ) && $VAR['htaccess_dir_path'] != '' ) - { - # trim whitspaces - $VAR['htaccess_dir_path'] = trim ( $VAR['htaccess_dir_path'] ); - - # replace all forward slashes with back slashes - $VAR['htaccess_dir_path'] = ereg_replace('\\\\', '/', $VAR['htaccess_dir_path']); - - # add the final trailing slash if missing - if ( !ereg ('[/]$', $VAR['htaccess_dir_path'] ) ) - $VAR['htaccess_dir_path'] = $VAR['htaccess_dir_path'] . '/'; - } - - ### Change the .htaccess data - if( isset ( $VAR['htaccess_dir_path'] ) && $VAR['htaccess_dir_path'] != '' ) - { - - ################################################################ - ### VERIFY LOCAL PATH & WRITABILITY! - - @$filename = $VAR['htaccess_dir_path'] . '.htaccess'; - @$php_filename = $VAR['htaccess_dir_path'] . 'htaccess_index.php'; - @$id = $VAR['htaccess_dir_htaccess_id']; - $db = &DB(); - $sql = 'SELECT name FROM ' . AGILE_DB_PREFIX . 'htaccess WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - id = ' . $db->qstr($id); - $result = $db->Execute($sql); - @$name = $result->fields['name']; - - - ### Check path - $path = $VAR['htaccess_dir_path']; - if ( is_dir ( $path ) ) - { - ### Check if is writable! - if ( is_writable ( $path ) ) - { - ### GENERATE THE EXCLUDE LIST - $exclude_list = $this->exclude_list(); - $nl = "\n"; - - /* - $data = $this->htaccess_extra . - 'RewriteEngine on' . $nl . - 'RewriteRule ^(.*)/.*$ - [L]' . $nl . - 'RewriteRule ' . - '' . $exclude_list . '$ ' . - 'htaccess_index.php' . - '?_HTACCESS_ID='.$id.'&_HTACCESS_DIR_ID='.$VAR["htaccess_dir_id"]; - */ - - $data = $this->htaccess_extra . 'RewriteEngine on' . $nl; - if(empty($VAR['htaccess_dir_recursive'])) - $data .= 'RewriteRule ^(.*)/.*$ - [L]' . $nl; - $data .= 'RewriteRule ' . $exclude_list . '$ htaccess_index.php?_HTACCESS_ID='.$id.'&_HTACCESS_DIR_ID='.$VAR["htaccess_dir_id"]; - - - ### Set the .htaccess var for the db - $VAR['htaccess_dir_htaccess'] = $data; - } - else - { - ## Path not writable! - $this->validated = false; - $this->val_error[] = array( - 'field' => 'none', - 'field_trans' => $C_translate->translate('error', 'core', ""), - 'error' => $C_translate->translate('path_auth', 'htaccess_dir', "")); - } - } - else - { - ### Path broken! - $this->validated = false; - $this->val_error[] = array( - 'field' => 'none', - 'field_trans' => $C_translate->translate('error', 'core', ""), - 'error' => $C_translate->translate('path_broke', 'htaccess_dir', "")); - } - } - - #################################################################### - ### If validation was failed, skip the db insert & - ### set the errors & origonal fields as Smarty objects, - ### and change the page to be loaded. - #################################################################### - - if(!$this->validated) - { - global $smarty; - - # set the errors as a Smarty Object - $smarty->assign('form_validation', $this->val_error); - - # set the page to be loaded - if(!defined("FORCE_PAGE")) - { - define('FORCE_PAGE', $VAR['_page']); - } - return; - } - - ### Update the db record - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $dir = $db->update($VAR, $this, $type); - - if($dir != false) - { - ### UPDATE THE LOCAL .HTACCESS FILE - $fp = fopen($filename, "w+"); - fwrite($fp,$data); - fclose($fp); - - ### UPDATE THE LOCAL htaccess_index.php - $data = $this->create_php(); - $fp = fopen($php_filename, "w+"); - fwrite($fp,$data); - fclose($fp); - } - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - ### Get the array - if(isset($VAR["delete_id"])) - $id = explode(',', $VAR["delete_id"]); - elseif (isset($VAR["id"])) - $id = explode(',', $VAR["id"]); - - ### Loop: - for($i=0; $idelete_one($id[$i]); - } - } - - ############################## - ## DELETE ONE ## - ############################## - function delete_one($id) - { - global $C_debug, $C_translate; - - if ($id == '') return false; - - ### Get the details of this directory record - $db = &DB(); - $sql = "SELECT * FROM ".AGILE_DB_PREFIX."htaccess_dir WHERE - site_id = ".$db->qstr(DEFAULT_SITE)." AND - id = ".$db->qstr($id); - $result = $db->Execute($sql); - $type = $result->fields['type']; - $path = $result->fields['path']; - - if( $result != false ) - { - ### DELETE THE LOCAL .HTACCESS FILE - $filename = $result->fields['path'] . '.htaccess'; - if ( @unlink ($filename) === false) - { - $C_translate->value['htaccess_dir']['dir'] = $result->fields['path'] . '.htaccess'; - $C_debug->alert($C_translate->translate('remove_fail','htaccess_dir','')); - } - - ### DELETE THE LOCAL HTACCESS_ATILE.PHP FILE - $filename = $result->fields['path'] . 'htaccess_index.php'; - @unlink ($filename); - } - - ### Delete the Record: - $db = &DB(); - $sql = "DELETE FROM ".AGILE_DB_PREFIX."htaccess_dir WHERE - site_id = ".$db->qstr(DEFAULT_SITE)." AND - id = ".$db->qstr($id); - $resulta = $db->Execute($sql); - - ### Success message - $C_translate->value['htaccess_dir']['dira'] = $path; - $C_debug->alert($C_translate->translate('remove_success','htaccess_dir','')); - - return true; - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } - - function exclude_list() - { - global $VAR; - - $list = ''; - @$Arr = $VAR['htaccess_dir_exclude']; - if ( count($Arr) == 0) return ''; - - $db = &DB(); - $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'htaccess_exclude WHERE - site_id = ' . $db->qstr(DEFAULT_SITE); - $result = $db->Execute($sql); - if($result->RecordCount() == 0) return ''; - while(!$result->EOF) - { - $id = $result->fields['id']; - $ext= $result->fields['extension']; - - ### GENERATE THE EXCLUDE LIST - for ($i=0; $iMoveNext(); - } - - if ($list != '') $list = '!(\.+' . $list . ')'; - return $list; - } - - - - function create_php() - { - $data = ''; - return $data; - } -} -?> \ No newline at end of file diff --git a/modules/htaccess_dir/htaccess_dir_construct.xml b/modules/htaccess_dir/htaccess_dir_construct.xml deleted file mode 100644 index 1cdf9011..00000000 --- a/modules/htaccess_dir/htaccess_dir_construct.xml +++ /dev/null @@ -1,114 +0,0 @@ - - - - htaccess_dir - - htaccess_dir
    - - htaccess - - 0 - - id - - 25 - - - htaccess_id - status - - - - - I4 - 1 - 1 - - - I4 - 1 - - - I4 - htaccess - name - any - 1 - - - C(128) - 3 - 128 - any - - - X - - - L - - - L - - - L - - - X - any - - - C(128) - 1 - 128 - any - - - C(128) - 1 - 128 - any - 1 - - - C(128) - 1 - 128 - - - C(128) - 1 - 128 - - - C(128) - 1 - 128 - - - C(128) - 1 - 128 - - - C(16) - 21 - 1 - 4 - - - X - array - - - - - id,site_id,name,description,htaccess,status,type,url,path,ftp_host,ftp_user,ftp_pass,ftp_path,ftp_port,htaccess_id,exclude,recursive - id,site_id,name,description,htaccess,status,type,url,path,ftp_host,ftp_user,ftp_pass,ftp_path,ftp_port,htaccess_id,exclude,recursive - id,site_id,name,description,htaccess,status,type,url,path,ftp_host,ftp_user,ftp_pass,ftp_path,ftp_port,htaccess_id,exclude,recursive - id,site_id,name,description,htaccess,status,type,url,path,ftp_host,ftp_user,ftp_pass,ftp_path,ftp_port,htaccess_id,exclude,recursive - id,site_id,name,description,htaccess,status,type,url,path,ftp_host,ftp_user,ftp_pass,ftp_path,ftp_port,htaccess_id,exclude,recursive - - - 0 -
    diff --git a/modules/htaccess_dir/htaccess_dir_install.xml b/modules/htaccess_dir/htaccess_dir_install.xml deleted file mode 100644 index 4b4c9d26..00000000 --- a/modules/htaccess_dir/htaccess_dir_install.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - htaccess_dir - htaccess - - 1 - - - - - search - - - view - - 1 - - - add - 1 - - - delete - - - update - - - search_show - - - - \ No newline at end of file diff --git a/modules/htaccess_exclude/htaccess_exclude.inc.php b/modules/htaccess_exclude/htaccess_exclude.inc.php deleted file mode 100644 index a0f9621a..00000000 --- a/modules/htaccess_exclude/htaccess_exclude.inc.php +++ /dev/null @@ -1,126 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -class htaccess_exclude -{ - - # Open the constructor for this mod - function htaccess_exclude() - { - # name of this module: - $this->module = "htaccess_exclude"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } - -} -?> \ No newline at end of file diff --git a/modules/htaccess_exclude/htaccess_exclude_construct.xml b/modules/htaccess_exclude/htaccess_exclude_construct.xml deleted file mode 100644 index 2b722a9d..00000000 --- a/modules/htaccess_exclude/htaccess_exclude_construct.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - htaccess_exclude - - htaccess_exclude
    - - htaccess - - 0 - - name - - 25 - - - - I4 - 1 - 1 - - - I4 - 1 - - - C(32) - 3 - 24 - any - - - C(16) - 2 - 4 - alphanumeric - - - - - id,site_id,name,extension - id,site_id,name,extension - id,site_id,name,extension - id,site_id,name,extension - id,site_id,name,extension - - - 0 -
    diff --git a/modules/htaccess_exclude/htaccess_exclude_install.xml b/modules/htaccess_exclude/htaccess_exclude_install.xml deleted file mode 100644 index 44007e06..00000000 --- a/modules/htaccess_exclude/htaccess_exclude_install.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - htaccess_exclude - htaccess - - 1 - - - - - search - - - view - - - 1 - - - add - - 1 - - - delete - - - update - - - search_show - - - - - \ No newline at end of file diff --git a/modules/htaccess_exclude/htaccess_exclude_install_data.xml b/modules/htaccess_exclude/htaccess_exclude_install_data.xml deleted file mode 100644 index d1432102..00000000 --- a/modules/htaccess_exclude/htaccess_exclude_install_data.xml +++ /dev/null @@ -1,153 +0,0 @@ - - - - 1 - 1 - PHP - php - - - 2 - 1 - PHP3 - php3 - - - 3 - 1 - PHP4 - php4 - - - 4 - 1 - PHPS - phps - - - 5 - 1 - INC - inc - - - 6 - 1 - HTML - html - - - 7 - 1 - HTM - htm - - - 8 - 1 - JPG - jpg - - - 9 - 1 - JPEG - jpeg - - - 10 - 1 - GIF - gif - - - 11 - 1 - BMP - bmp - - - 12 - 1 - TIF - tif - - - 13 - 1 - JAVASCRIPT - js - - - 14 - 1 - CSS - css - - - 15 - 1 - PDF - pdf - - - 16 - 1 - MS WORD - doc - - - 17 - 1 - MS EXCEL - xls - - - 18 - 1 - CSV - csv - - - 19 - 1 - TEXT - txt - - - 20 - 1 - RICH TEXT - rtf - - - 21 - 1 - XML - xml - - - 22 - 1 - ZIP - zip - - - 23 - 1 - GZIP - gzip - - - 24 - 1 - TAR.GZ - gz - - - 30 - - - 1 - - \ No newline at end of file diff --git a/modules/import/import.inc.php b/modules/import/import.inc.php index f0098a62..56566476 100644 --- a/modules/import/import.inc.php +++ b/modules/import/import.inc.php @@ -1,301 +1,319 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Modules:Import */ - -class import -{ - # Open the constructor for this mod - function import() - { - # name of this module: - $this->module = "import"; +/** + * The main AgileBill Import Class + * + * @package AgileBill + * @subpackage Modules:Import + */ +class import extends OSB_module { + protected $actions = array(); + /** + * Test remote database connectivity + */ + protected function test() { + global $C_debug,$VAR; - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; + # Connect to the remote DB + $dbr = &NewADOConnection($this->type); + $dbr->Connect($this->host,$this->user,$this->pass,$this->db); - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); + if (! empty($dbr->_errorMsg)) + $C_debug->alert(sprintf('Failed: %s',$dbr->_errorMsg)); + else + $this->pre_test(); - - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; + # Return to main import page + printf("",$VAR['plugin']); } - ### Store import id - function import_transaction($plugin, $action, $ab_table, $ab_id, $remote_table, $remote_id, &$db) - { - # Check that this record has not already been imported: - $sql = "SELECT id FROM ".AGILE_DB_PREFIX."import WHERE - plugin = ".$db->qstr($plugin)." AND - action = ".$db->qstr($action)." AND - ab_table = ".$db->qstr($ab_table)." AND - ab_id = ".$db->qstr($ab_id)." AND - remote_table= ".$db->qstr($remote_table). " AND - remote_id = ".$db->qstr($remote_id)." AND - site_id = ".DEFAULT_SITE; - $rs = $db->Execute($sql); + /** + * Record pre-setup tests + */ + protected function pre_test() { + global $C_debug,$VAR; - # check results - if($rs === false || $rs->RecordCount() > 0) { + $C_debug->alert('Marked Done!'); + + $db = &DB(); + + # Insert the import record + $this->import_transaction($this->plugin,$VAR['action'],null,null,null,null,$db); + + # Return to main import page + printf("",$VAR['plugin']); + } + + # Store import id + protected function import_transaction($plugin,$action,$ab_table,$ab_id,$remote_table,$remote_id,&$db) { + # Check that this record has not already been imported: + $sql = sqlSelect($db,'import','id', + sprintf('plugin = %s AND action = %s AND ab_table = %s AND ab_id = %s AND remote_table = %s AND remote_id = %s', + $db->qstr($plugin), + $db->qstr($action), + $db->qstr($ab_table), + $db->qstr($ab_id), + $db->qstr($remote_table), + $db->qstr($remote_id) + )); + $rs = $db->Execute($sql); + + # Check results + if ($rs === false || $rs->RecordCount() > 0) { $db->FailTrans(); return false; } # Insert the record - $id = $db->GenID(AGILE_DB_PREFIX.'import_id'); - $sql = "INSERT INTO ".AGILE_DB_PREFIX."import SET - id = $id, - date_orig = ".time().", - plugin = ".$db->qstr($plugin).", - action = ".$db->qstr($action).", - ab_table = ".$db->qstr($ab_table).", - ab_id = ".$db->qstr($ab_id).", - remote_table= ".$db->qstr($remote_table). ", - remote_id = ".$db->qstr($remote_id).", - site_id = ".DEFAULT_SITE; - $rs = $db->Execute($sql); + $update = array( + 'date_orig'=>time(), + 'plugin'=>$plugin, + 'action'=>$action, + 'ab_table'=>$ab_table, + 'ab_id'=>$ab_id, + 'remote_table'=>$remote_table, + 'remote_id'=>$remote_id); + + $db->Execute(sqlInsert($db,'import',$update)); + return true; - } + } - - ### Do an action for a specific plugin: - function do_action ($VAR) - { + # Do an action for a specific plugin: + public function do_action($VAR) { # Load the plugin - if(!is_file($file = PATH_PLUGINS . 'import/'.@$VAR['plugin'].'.php')) - return false; - + if (! is_file($file = sprintf('%simport/%s.php',PATH_PLUGINS,$VAR['plugin']))) + return false; # New instance include_once($file); - $import_plugin = new import_plugin; + $import_plugin = new import_plugin; - - # Call the required method - call_user_func (array($import_plugin, @$VAR['action']), $VAR, $import_plugin); + # Call the required method + call_user_func(array($import_plugin,$VAR['action']),$VAR,$import_plugin); } - - ### Do an action for a specific plugin: - function undo_action ($VAR) - { + # Do an action for a specific plugin: + public function undo_action($VAR) { $db = &DB(); # Make sure this action is done... - $sql = "SELECT * FROM ".AGILE_DB_PREFIX."import WHERE - plugin = ".$db->qstr($VAR['plugin'])." AND - action = ".$db->qstr($VAR['action'])." AND - site_id = ".DEFAULT_SITE; - $rs = $db->Execute($sql); - if($rs->RecordCount() == 0) { + $rs = $db->Execute(sqlSelect($db,'import','ab_table,ab_id',sprintf('plugin=::%s:: AND action=::%s::',$VAR['plugin'],$VAR['action']))); + + if ($rs->RecordCount() == 0) { echo 'There is nothing to undo!'; + return; - } - - while(!$rs->EOF) - { - $table = $rs->fields['ab_table']; - $id = $rs->fields['ab_id']; - - $q = "DELETE FROM ".AGILE_DB_PREFIX."$table WHERE - id = $id AND - site_id = ".DEFAULT_SITE; - $db->Execute($q); - - $rs->MoveNext(); } - # delete the selected action: - $sql = "DELETE FROM ".AGILE_DB_PREFIX."import WHERE - plugin = ".$db->qstr($VAR['plugin'])." AND - action = ".$db->qstr($VAR['action'])." AND - site_id = ".DEFAULT_SITE; - $rs = $db->Execute($sql); + while (! $rs->EOF) { + if (trim($rs->fields['ab_table']) && trim($rs->fields['ab_id'])) + $db->Execute(sqlDelete($db,$rs->fields['ab_table'],sprintf('id=%s',$rs->fields['ab_id']))); + $rs->MoveNext(); + } + + # Delete the selected action + $db->Execute(sqlDelete($db,'import',sprintf('plugin=::%s:: AND action=::%s::',$VAR['plugin'],$VAR['action']))); } + /** + * View import plugins + */ + public function view($VAR) { + # Load the plugin + if (! is_file($file = sprintf('%simport/%s.php',PATH_PLUGINS,$VAR['plugin']))) + return false; - ############################## - ## VIEW ## - ############################## - function view($VAR) - { $db = &DB(); - if(!is_file($file = PATH_PLUGINS . 'import/'.@$VAR['plugin'].'.php')) - return false; - include_once($file); $import_plugin = new import_plugin; - # Loop through each action to determine its availibility status + # Loop through each action to determine its availibility status $actions = $import_plugin->actions; - $done = false; - for($i=0; $iassign('name', $import_plugin->name); - $smarty->assign('instructions', $import_plugin->instructions); - $smarty->assign('import', $actions); - } - - - - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - ### Read the contents of the /plugins/affiliate directory: - $count = 0; - chdir(PATH_PLUGINS . 'import'); - $dir = opendir(PATH_PLUGINS . 'import'); - while ($file_name = readdir($dir)) { - if($file_name != '..' && $file_name != '.' && !eregi("^_", $file_name) && eregi(".php$", $file_name)) { - $count++; + $actions[$i]['records'] = $rs->RecordCount(); + $done[$actions[$i]['name']] = true; + } } } - # define the DB vars as a Smarty accessible block + global $smarty; + $smarty->assign('name',$import_plugin->name); + $smarty->assign('instructions',$import_plugin->instructions); + $smarty->assign('import',$actions); + } + + /** + * Search for available plugs + * + * @uses CORE_search + */ + public function search($VAR) { + # Read the contents of the directory + $count = 0; + $dir = opendir(PATH_PLUGINS.'import'); + while ($file_name = readdir($dir)) + if (! in_array($file_name,array('.','..')) && ! preg_match('/^_/',$file_name) && preg_match('/.php$/',$file_name)) + $count++; + + # Define the DB vars as a Smarty accessible block global $smarty; # create the search record: - if($count > 0) - { + if ($count > 0) { # create the search record - include_once(PATH_CORE . 'search.inc.php'); + include_once(PATH_CORE.'search.inc.php'); $search = new CORE_search; - $arr['module'] = $this->module; - $arr['sql'] = ''; - $arr['limit'] = '999'; - $arr['order_by']= 'name'; + + $arr['module'] = $this->module; + $arr['sql'] = ''; + $arr['limit'] = '999'; + $arr['order_by'] = 'name'; $arr['results'] = $count; $search->add($arr); # define the search id and other parameters for Smarty - $smarty->assign('search_id', $search->id); + $smarty->assign('search_id',$search->id); - # page: - $smarty->assign('page', '1'); + # page + $smarty->assign('page','1'); - # limit: - $smarty->assign('limit', '999'); + # limit + $smarty->assign('limit','999'); - # order_by: - $smarty->assign('order_by', 'name'); + # order_by + $smarty->assign('order_by','name'); # define the result count - $smarty->assign('results', $count); + $smarty->assign('results',$count); } } - - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - ### Read the contents of the /plugins/db_mapping directory: + /** + * Show search results + */ + public function search_show($VAR) { + # Read the contents of the directory $count = 0; - chdir(PATH_PLUGINS . 'import'); - $dir = opendir(PATH_PLUGINS . 'import'); + $dir = opendir(PATH_PLUGINS.'import'); while ($file_name = readdir($dir)) { - if($file_name != '..' && $file_name != '.' && !eregi("^_", $file_name) && eregi(".php$", $file_name) ) { - $result[$count]['name'] = eregi_replace('.php', '', $file_name); - $result[$count]['id'] = $count; + if (! in_array($file_name,array('.','..')) && ! preg_match('/^_/',$file_name) && preg_match('/.php$/',$file_name)) { + $result[$count]['name'] = preg_replace('/.php$/','',$file_name); + $result[$count]['id'] = $count; $count++; } - } + } - $class_name = TRUE; - for ($i=0; $iassign($this->table, $smart); - $smarty->assign('page', $VAR['page']); - $smarty->assign('order', $smarty_order); - $smarty->assign('sort', $smarty_sort); - $smarty->assign('limit', $search->limit); + $smarty->assign('search_show',$smart); + $smarty->assign('page',$VAR['page']); + $smarty->assign('order',$smarty_order); + $smarty->assign('sort',$smarty_sort); + $smarty->assign('limit',$search->limit); $smarty->assign('search_id',$search->id); - $smarty->assign('results', $count); + $smarty->assign('results',$count); # total pages - $smarty->assign('pages', 1); + $smarty->assign('pages',1); # current page - $smarty->assign('page', 1); - $page_arr = ''; + $smarty->assign('page',1); # page array for menu - $smarty->assign('page_arr', $page_arr); - } + $smarty->assign('page_arr',''); + } + + /** + * Read a plugin map file, for some default values + * + * @uses CORE_xml; + */ + protected function read_map() { + # If there is a map file, open it + $pmap = array(); + + if (file_exists($mapfile = sprintf('%simport/%s_map.xml',PATH_PLUGINS,$this->plugin))) { + $C_xml = new CORE_xml; + $map = $C_xml->xml_to_array($mapfile); + + if (isset($map['map'])) + foreach ($map['map'] as $index => $details) + foreach ($map['map'][$index] as $values) { + $a = $values['id']; + unset($values['id']); + $pmap[$index][$a] = $values; + } + } + + return $pmap; + } } -?> \ No newline at end of file +?> diff --git a/modules/import/import_construct.xml b/modules/import/import_construct.xml index 2717b772..6a688ad8 100644 --- a/modules/import/import_construct.xml +++ b/modules/import/import_construct.xml @@ -1,65 +1,90 @@ + + import + + import
    + + + + 0 + + plugin + + 25 + + 1 - - import + + + - - import
    + + + + + 1 + I8 + 1 + + + + 1 + I4 + + + + date-now + I8 + + + C(32) + + + C(32) + + + C(32) + + + C(32) + + + I8 + + + I8 + + - - + + + id,site_id,date_orig,plugin,local_table,ab_table,remote_id,ab_id + id,site_id,date_orig,plugin,local_table,ab_table,remote_id,ab_id + id,site_id,date_orig,plugin,local_table,ab_table,remote_id,ab_id + id,site_id,date_orig,plugin,local_table,ab_table,remote_id,ab_id + id,site_id,date_orig,plugin,local_table,ab_table,remote_id,ab_id + - - 0 + + - - plugin + + + <view>Import</view> + - - 35 - - - - - I8 - 1 - - - I4 - - - I8 - - - C(32) - - - C(32) - - - C(32) - - - C(32) - - - I8 - - - I8 - - - - - - id,site_id,date_orig,plugin,local_table,ab_table,remote_id,ab_id - id,site_id,date_orig,plugin,local_table,ab_table,remote_id,ab_id - id,site_id,date_orig,plugin,local_table,ab_table,remote_id,ab_id - id,site_id,date_orig,plugin,local_table,ab_table,remote_id,ab_id - id,site_id,date_orig,plugin,local_table,ab_table,remote_id,ab_id - - - - 0 -
    \ No newline at end of file + + + + + none + plugin + 90px + + + 10px + + + + diff --git a/modules/import/import_install.xml b/modules/import/import_install.xml index f794caf4..a5ba072a 100644 --- a/modules/import/import_install.xml +++ b/modules/import/import_install.xml @@ -1,43 +1,47 @@ + + + + + + Import + + 1 + + import + + ]]> + + setup + + + + base + - - - import - setup - - 1 - - - - - - - - - - do_action - - - - undo_action - - - - - view - core:search&module=%%&_escape=1 - - - - search - core:search&module=%%&_escape=1 - 1 - - - search_show - - - - - \ No newline at end of file + + + + List + 1 + search + + + + + search_show + + + + view + + + + do_action + + + undo_action + + + diff --git a/modules/invoice/PDF/pdf_invoice_itemised-fpdf.inc.php b/modules/invoice/PDF/pdf_invoice_itemised-fpdf.inc.php new file mode 100644 index 00000000..738b4f58 --- /dev/null +++ b/modules/invoice/PDF/pdf_invoice_itemised-fpdf.inc.php @@ -0,0 +1,621 @@ +Image($logo,$x,$y,$size); + } + + /** + * Draw the Company Address + */ + public function drawCompanyAddress($inv) { + global $C_translate; + + # Add the company address next to the logo + $x = 40; $y = 9; + + $this->SetFont('arial','B',10); + $this->SetXY($x,$y); $this->Cell(0,0,$inv->print['site']['NAME']); $y += 4; + + $this->SetFont('arial','',10); + $this->SetXY($x,$y); $this->Cell(0,0,$inv->print['site']['TAXID']); $y += 6; + + $this->SetXY($x,$y); $this->Cell(0,0,$inv->print['site']['ADDRESS']); $y += 4; + $this->SetXY($x,$y); $this->Cell(0,0,sprintf('%s, %s %s',$inv->print['site']['CITY'],$inv->print['site']['STATE'],$inv->print['site']['ZIP'])); $y += 4; + + $y += 2; + $this->SetXY($x,$y); $this->Cell(0,0,'Phone:'); $this->SetXY($x+16,$y); $this->Cell(0,0,$inv->print['site']['PHONE']); $y += 4; + $this->SetXY($x,$y); $this->Cell(0,0,'Fax:'); $this->SetXY($x+16,$y); $this->Cell(0,0,$inv->print['site']['FAX']); $y += 4; + $this->SetXY($x,$y); $this->Cell(0,0,'Web:'); $this->SetXY($x+16,$y); $this->Cell(0,0,$inv->print['site']['URL']); $y += 4; + } + + public function drawRemittenceStub($inv) { + global $C_translate; + + # Draw the remittance line + $this->Line(9,195,200,195); + + $x = 18; $y = 200; + + $this->SetFont('arial','B',13); + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_payment_remit','setup_invoice')); $y +=5; + + $this->SetFont('arial','',8); + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_return1','setup_invoice')); $y +=3; + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_return2','setup_invoice').' '.$inv->print['site']['NAME']); + + # Due Date + $x = 110; $y = 200; + $this->SetFont('arial','',10); + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_bill_date','setup_invoice')); + $this->SetFont('arial','B',11); + $this->SetXY($x,$y); $this->Cell(0,0,date(UNIX_DATE_FORMAT,$inv->print['invoice']['date_orig']),0,0,'R'); + + # Account ID + $y = 205; + $this->SetFont('arial','',10); + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_account_number','setup_invoice')); + $this->SetFont('arial','B',11); + $this->SetXY($x,$y); $this->Cell(0,0,sprintf('%06s',$inv->print['account']['id']),0,0,'R'); + + # Invoice number + $y = 210; + $this->SetFont('arial','',10); + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_invoice_number','setup_invoice')); + $this->SetFont('arial','B',11); + $this->SetXY($x,$y); $this->Cell(0,0,sprintf('%06s',$inv->getInvoiceNum()),0,0,'R'); + + # Company Address + $y = 216; + $this->SetFont('arial','',10); + $this->SetXY(18,$y); $this->Cell(0,0,$inv->print['site']['NAME']); $y += 4; + $this->SetXY(18,$y); $this->Cell(0,0,$inv->print['site']['ADDRESS']); $y += 4; + $this->SetXY(18,$y); $this->Cell(0,0,sprintf('%s, %s %s',$inv->print['site']['CITY'],$inv->print['site']['STATE'],$inv->print['site']['ZIP'])); $y += 4; + + # Previous Due + $y = 215; + $this->SetFont('arial','',9); + $this->SetXY($x,$y); $this->Cell(0,0,'Previous Due'); + $this->SetXY($x,$y); $this->Cell(0,0,$this->_currency($inv->getPreviousBalance()),0,0,'R'); + + $y = 219; + $this->SetFont('arial','',9); + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_amount_due_by','setup_invoice').' '.date(UNIX_DATE_FORMAT,$inv->print['invoice']['due_date'])); + $this->SetXY($x,$y); $this->Cell(0,0,$this->_currency($inv->print['invoice']['total_amt']-$inv->print['invoice']['billed_amt']),0,0,'R'); + + # Total Due + $y = 224; + $this->SetFont('arial','B',10); + $this->SetXY($x,$y); $this->Cell(0,0,'Total Due'); + $this->SetXY($x,$y); $this->Cell(0,0,$this->_currency($inv->getPreviousBalance()+$inv->print['invoice']['total_amt']-$inv->print['invoice']['billed_amt']),0,0,'R'); + + # Draw the Customers Address + $x = 25; $y = 248; + + $this->SetFont('arial','B',12); + + if ($this->billToCompany && ! empty($inv->print['account']['company'])) + $name = $inv->print['account']['company']; + else + $name = sprintf('%s %s',$inv->print['account']['first_name'],$inv->print['account']['last_name']); + + $this->SetXY($x,$y); $this->Cell(0,0,html_entity_decode($name,ENT_NOQUOTES)); $y += 5; + $this->SetXY($x,$y); $this->Cell(0,0,sprintf('%s %s ',$inv->print['account']['address1'],$inv->print['account']['address2'])); $y += 5; + $this->SetXY($x,$y); $this->Cell(0,0,sprintf('%s, %s %s',$inv->print['account']['city'],$inv->print['account']['state'],$inv->print['account']['zip'])); $y += 5; + } + + public function drawInvoiceHeader($inv) { + global $C_translate; + + $x = 125; $y = 10; + + # Draw a box. + $this->SetFillColor(245); + $this->SetXY($x-1,$y-3); $this->Cell(0,35+($inv->print['invoice']['billed_amt'] ? 5 : 0),'',1,0,'',1); + + # Draw a box around the invoice due date and amount due. + $this->SetFont('arial','B',11); + $this->SetXY($x,$y); $this->Cell(0,0,'TAX INVOICE'); + $this->SetFont('arial','B',11); + $this->SetXY($x,$y); $this->Cell(0,0,sprintf('%06s',$inv->getInvoiceNum()),0,0,'R'); + + # Invoice number at top of page. + $y += 7; + $this->SetFont('arial','',10); + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_bill_date','setup_invoice')); $y += 5; + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_amount_due_by','setup_invoice')); + $this->SetFont('arial','B',11); + + $y -= 5; + $this->SetXY($x,$y); $this->Cell(0,0,date(UNIX_DATE_FORMAT,$inv->print['invoice']['date_orig']),0,0,'R'); $y += 5; + $this->SetXY($x,$y); $this->Cell(0,0,date(UNIX_DATE_FORMAT,$inv->print['invoice']['due_date']),0,0,'R'); + + $y += 5; + $this->SetFont('arial','',10); + $this->SetXY($x,$y); $this->Cell(0,0,'Previous Due'); + $this->SetFont('arial','B',11); + $this->SetXY($x+55,$y); $this->Cell(0,0,$this->_currency($inv->getPreviousBalance()),0,0,'R'); + + $y += 5; + $this->SetFont('arial','',10); + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_current_charges','setup_invoice')); + $this->SetFont('arial','B',11); + $this->SetXY($x+55,$y); $this->Cell(0,0,$this->_currency($inv->print['invoice']['total_amt']),0,0,'R'); + + if ($inv->print['invoice']['billed_amt']) { + $y += 5; + $this->SetFont('arial','',10); + $this->SetXY($x,$y); $this->Cell(0,0,'Payments Received'); + $this->SetFont('arial','B',11); + $this->SetXY($x+55,$y); $this->Cell(0,0,$this->_currency($inv->print['invoice']['billed_amt']),0,0,'R'); + } + + $y += 5; + $this->SetFont('arial','',10); + $this->SetXY($x,$y); $this->Cell(0,0,'Total Payable'); + $this->SetFont('arial','B',11); + $this->SetXY($x+55,$y); $this->Cell(0,0,$this->_currency($inv->getPreviousBalance()+$inv->print['invoice']['total_amt']-$inv->print['invoice']['billed_amt']),0,0,'R'); + } + + #@todo Limit the size of the news to 6 lines + public function drawNews($news) { + global $C_translate; + + if (! $news) + return; + + $x = 9; $y = 170; + + # Draw a box. + $this->SetFillColor(243); + $this->SetXY($x-1,$y-3); $this->Cell(0,20,'',1,0,'',1); + + $this->SetFont('arial','',8); + $this->SetXY($x,$y); $this->MultiCell(0,3,str_replace('\n',"\n",$news),0,'L',0); + } + + #@todo make this list dynamic + public function drawPaymentMethods($inv) { + $x = 110; $y = 242; + + # Draw a box. + $this->SetFillColor(235); + $this->SetXY($x-1,$y-3); $this->Cell(0,32,'',1,0,'',1); + + $this->SetFont('arial','B',8); + $this->SetXY($x,$y); $this->Cell(0,0,'This invoice can also be paid by:'); $y += 4; + + # Direct Debit + $logo = sprintf('%s/%s',PATH_THEMES.DEFAULT_THEME,'invoice/invoice-payment-dd.png'); + $this->Image($logo,$x+1,$y,8); + $this->SetFont('arial','B',8); + $this->SetXY($x+10,$y); $this->Cell(0,0,'Direct Credit to our Bank Account'); $y += 3; + $this->SetFont('arial','',8); + $this->SetXY($x+10,$y); $this->Cell(0,0,'BSB:'); $y += 3; + $this->SetXY($x+10,$y); $this->Cell(0,0,'ACCOUNT:'); $y += 3; + $this->SetXY($x+10,$y); $this->Cell(0,0,'REF:'); $y += 3; + + $y -= 9; + $this->SetFont('arial','B',8); + $this->SetXY($x+30,$y); $this->Cell(0,0,'633-000'); $y += 3; + $this->SetXY($x+30,$y); $this->Cell(0,0,'120 440 821'); $y += 3; + $this->SetXY($x+30,$y); $this->Cell(0,0,$inv->getInvoiceID()); $y += 3; + + # Direct Debit + $y += 3; + $logo = sprintf('%s/%s',PATH_THEMES.DEFAULT_THEME,'invoice/invoice-payment-dd.png'); + $this->Image($logo,$x+1,$y,8); + $this->SetFont('arial','B',8); + $this->SetXY($x+10,$y); $this->Cell(0,0,'Direct Debit'); $y += 3; + $this->SetFont('arial','',8); + $this->SetXY($x+10,$y); $this->Cell(0,0,'Please visit '.$inv->print['site']['URL']); $y += 3; + } + + /** + * Draw previous invoices due + */ + public function drawSummaryInvoicesDue($items) { + $x = 125; $y = $this->sum_y ? $this->sum_y : 50; + + # Calculate the box size + $box = count($items) < $this->itemsPreviousMax ? count($items) : $this->itemsPreviousMax; + + # Draw a box. + $this->SetFillColor(245); + $this->SetXY($x-1,$y-3); $this->Cell(0,5*(1+$box)+1,'',1,0,'',1); + + $this->SetFont('arial','B',11); + $this->SetXY($x,$y); $this->Cell(0,0,'Previous Invoices due'); $y += 5; + + $this->SetFont('arial','',11); + $i = 0; + $sum_total = 0; + foreach ($items as $line) { + if (++$i < $this->itemsPreviousMax) { + $this->SetXY($x,$y); + $this->Cell(0,0,sprintf('%s #%06s',date(UNIX_DATE_FORMAT,$line['date_orig']),$line['id'])); + $this->Cell(0,0,$this->_currency($line['total_amt']-$line['billed_amt']),0,0,'R'); $y += 5; + + } else { + $sum_total += $line['total_amt']-$line['billed_amt']; + } + } + + if ($sum_total) { + $this->SetXY($x,$y); + $this->SetFont('arial','I',11); + $this->Cell(0,0,'Other invoices'); + $this->SetFont('arial','',11); + $this->Cell(0,0,$this->_currency($sum_total),0,0,'R'); $y += 5; + } + + $this->sum_y = $y+5; + } + + /** + * Called before begining to loop the invoice_item table. Used to set initial values. + */ + public function drawLineItems_pre($iteration) { + $this->iteration = $iteration; + if ($iteration>1) + return false; + + return true; + } + + /** + * Called once per line item to add to the PDF invoice. This function serves to + * direct each iteration to a different function which handles a specific piece + * of the PDF building puzzle. + */ + public function drawLineItems($db,$line,$invnum) { + switch($this->iteration) { + case 0: + $this->drawLineItems_0($db,$line,$invnum); + break; + + case 1: + $this->drawLineItems_1($db,$line,$invnum); + break; + + default: + echo 'Unknown PDF iteration encountered. Halting.'; + exit; + } + } + + /** + * Draws the non-VoIP related items for iteration 0. + */ + private function drawLineItems_0($db,$line,$invnum) { + global $C_translate; + + if ($line['price_type'] == 0 && $line['item_type']==5) + return; + + $x = 10; $y = 5; + if ($this->i == 0 || $this->i%51 == 0) { + $this->AddPage(); + + $this->SetFont('arial','B',12); + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_itemized_charges','setup_invoice')); + $this->Cell(0,0,$C_translate->translate('pdf_page','setup_invoice').$this->PageNo(),0,0,'R'); + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_invoice_number_small','setup_invoice').$invnum,0,0,'C'); + + # Draw table headers + $y += 10; + $this->SetFont('arial','B',8); + $this->SetXY($x,$y); + $this->Cell(0,0,$C_translate->translate('pdf_item_description','setup_invoice')); + $this->SetX($x+135); + $this->Cell(0,0,$C_translate->translate('pdf_item_quantity','setup_invoice')); + $this->SetX($x+160); + $this->Cell(10,0,$C_translate->translate('pdf_item_cost','setup_invoice'),0,0,'R'); + $this->SetX($x+135); + $this->Cell(0,0,$C_translate->translate('pdf_item_amount','setup_invoice'),0,0,'R'); + $this->Line($x,$y+2,200,$y+2); + $y += 5; + $this->SetY($y); + } + + $this->SetFont('arial','',8); + $this->SetX($x); + $this->Cell(0,0,$line['name']); + + if (isset($line['price_base'])) { + $this->SetX($x+160); + $this->Cell(10,0,$this->_currency($line['price_base']),0,0,'R'); + } + + if (isset($line['qty'])) { + $this->SetX($x+130); + $this->Cell(10,0,$line['qty'],0,0,'R'); + } + + $this->SetX($x+130); + $this->Cell(0,0,$this->_currency($line['total_amt']),0,0,'R'); + + if ($this->show_service_range && $line['daterange']) { + $this->SetFont('arial','I',7); + $y += 3; + $this->SetXY($x+10,$y); $this->Cell(0,0,'Service Period'); + $this->SetFont('arial','',7); + $this->SetXY($x+40,$y); $this->Cell(0,0,$line['daterange']); + } + + if ($line['domain']) { + $this->SetFont('arial','I',7); + $y += 3; + $this->SetXY($x+10,$y); $this->Cell(0,0,'Domain'); + $this->SetFont('arial','',7); + $this->SetXY($x+40,$y); $this->Cell(0,0,$line['domain']); + } + + if ($line['attr']) { + $showchars = 20; + foreach (explode("\n",$line['attr']) as $attr) { + list($field,$value) = explode('==',$attr); + + $this->SetFont('arial','I',7); + $this->y += 3; + $this->SetXY(20,$this->y); $this->Cell(0,0,strlen($field) > $showchars ? substr($field,0,$showchars-2).'...' : $field); + $this->SetFont('arial','',7); + $this->SetXY(50,$this->y); $this->Cell(0,0,$value); + } + } + + $this->y += 5; + $this->SetY($this->y); + $this->i++; + } + + /** + * Draws the Item Detail for Iteration 1. + */ + private function drawLineItems_1($db,$line,$invnum) { + global $C_translate; + + if ($this->show_itemized != 1) return; + if ($line['price_type'] != 0 || $line['item_type'] != 5) + return; + + $x = 10; $y = 5; + if ($this->i == 0 || $this->i%51 == 0) { + $this->AddPage(); + + $this->SetFont('arial','B',12); + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_itemized_calls','setup_invoice')); + $this->Cell(0,0,$C_translate->translate('pdf_page','setup_invoice').$this->PageNo(),0,0,'R'); + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_invoice_number_small','setup_invoice').$invnum,0,0,'C'); + + # Draw table headers + $this->SetFont('arial','B',8); + $this->SetXY($x,$y); + $this->Cell(0,0,$C_translate->translate('pdf_item_from','setup_invoice')); + $this->SetX(69); + $this->Cell(0,0,$C_translate->translate('pdf_item_to','setup_invoice')); + $this->SetX(119); + $this->Cell(0,0,'Date & Time'); + $this->SetX(160); + $this->Cell(10,0,'Seconds' /*$C_translate->translate('pdf_item_min','setup_invoice')*/,0,0,'R'); + $this->SetX($x+135); + $this->Cell(0,0,$C_translate->translate('pdf_item_amount','setup_invoice'),0,0,'R'); + $this->Line($x,$y+4,200,$y+4); + $y += 5; + $this->SetY($y); + } + + if ($line['price_type'] != 0) { + $this->SetFont('arial','I',6); + } else { + $this->SetFont('arial','',6); + } + + $val = $line['name']; + if (strlen($line['attr'])) { + $val = ""; + $atrs = preg_split("/\r\n/", str_replace('\r\n',"\r\n",$line['attr'])); + foreach ($atrs as $a) { + $parts = preg_split("/==/", $a); + switch ($parts[0]) { + case "Destination": + $this->SetX(69); + $this->Cell(0,0,$parts[1]); + $cc = ""; $npa = ""; $nxx = ""; $e164 = ""; + if ($this->v->e164($parts[1], $e164, $cc, $npa, $nxx)) { + $this->SetX(89); + $this->Cell(0,0,substr($this->v->where_is($db, $cc, $npa, $nxx), 0, 20)); + } + break; + case "Source": + $this->SetX(9); + $this->Cell(0,0,$parts[1]); + $cc = ""; $npa = ""; $nxx = ""; $e164 = ""; + if ($this->v->e164($parts[1], $e164, $cc, $npa, $nxx)) { + $this->SetX(29); + $this->Cell(0,0,substr($this->v->where_is($db, $cc, $npa, $nxx), 0, 20)); + } + break; + case "parent_service_id": + $sql = sqlSelect($db,"service","prod_attr","id=::".$parts[1]."::"); + $rstmp = $db->Execute($sql); + $atrs2 = split("\r\n", $rstmp->fields['prod_attr']); + foreach ($atrs2 as $a2) { + $parts2 = split("==", $a2); + switch ($parts2[0]) { + case "station": + case "ported": + $val = $line['name']." for ".$parts2[1]; + break; + default: + break; + } + } + break; + case "station": + case "ported": + $val = $line['name']." for ".$parts[1]; + break; + case "date_orig": + $this->SetX(119); + $this->Cell(0,0,date(UNIX_DATE_FORMAT." H:i:s",$parts[1])); + break; + case "voip_cdr_id": + $sql = "SELECT billsec, amount FROM ".AGILE_DB_PREFIX."voip_cdr WHERE site_id=".DEFAULT_SITE." AND id=".$parts[1]; + $row = $db->GetRow($sql); + $this->SetX(160); + $this->Cell(10,0,$row[0],0,0,'R'); + $this->SetX(160); + $this->Cell(0,0,$this->_currency($row[1]),0,0,'R'); + $val = ""; + default: + break; + } + } + } + + $this->SetX(9); + $this->Cell(0,0, $val); + if ($line['price_type'] == 0) { + $this->SetX(160); + //$this->Cell(10,0, $line['qty']." M",0,0,'R'); + } else { + $q = $line['qty']; + if(empty($q)) $q = 1; + $this->SetX(160); + $this->Cell(10,0, $line['qty'],0,0,'R'); + $this->SetX($x+135); + $this->Cell(0,0, $this->_currency($line['amount']), 0,0,'R'); + } + $this->y += 5; + $this->SetY($this->y); + $this->i++; + } + + /** + * This will draw the Summary Box, with the summary of the items + * on the invoice. + */ + public function drawSummaryLineItems($inv) { + global $C_translate; + + if (! $this->show_itemized) + return; + + $items = $inv->summarizeLineItems($inv->print['invoiceitems']); + + # Calculate the box size + $box = count($items) < $this->itemsSummaryMax ? count($items) : $this->itemsSummaryMax; + + $x = 10; $y = $this->sum_y ? $this->sum_y : 55; + + # Draw a box. + $this->SetFillColor(245); + $this->SetXY($x-1,$y-3); $this->Cell(0,5*(1+1+1+5+$box)+1,'',1,0,'',1); + + $this->SetFont('arial','B',11); + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_cur_charge_summary','setup_invoice')); $y += 5; + + $this->SetY($y); + $this->SetFont('arial','',9); + + $i=0; + if (is_array($items)) { + foreach($items as $line) { + $this->SetX($x); + + $q = $line['quantity']; + if (empty($q)) + $q = 1; + + $this->Cell(0,0,$q); + $this->SetX($x+8); + $this->Cell(0,0,sprintf('%s (%s)',$line['summaryname'],$this->_currency($line['price_base']))); + $this->SetX($x+135); + $this->Cell(0,0,$this->_currency($line['price_base']*$line['quantity']),0,0,'R'); + $y += 5; + $this->SetY($y); + $i++; + if ($i > $this->itemsSummaryMax) { + $this->SetFont('arial','B',11); + $this->SetX($x); + $this->Cell(0,0,$C_translate->translate('pdf_summary','setup_invoice')); + break; + } + } + + # Calculate our rounding error + $subtotal = 0; + foreach($items as $line) + $subtotal += $line['price_base']*$line['quantity']; + + $subtotal = round($subtotal,2); + + if (round($inv->print['invoice']['total_amt']-$inv->print['invoice']['tax_amt'],2) != $subtotal) { + $this->SetFont('arial','',9); + $this->SetX($x); + $this->Cell(0,0,'Rounding'); + $this->SetX($x+135); + $this->Cell(0,0,$this->_currency($inv->print['invoice']['total_amt']-$inv->print['invoice']['tax_amt']-$subtotal),0,0,'R'); + $y += 5; + $this->SetY($y); + } + + # @todo Draw discounts + # Sub total and tax. + $y += 5; + $this->SetY($y); + $this->SetFont('arial','B',9); + $this->SetX($x+8); + $this->Cell(0,0,'Sub Total'); + $this->SetX($x+135); + $this->Cell(0,0,$this->_currency($inv->print['invoice']['total_amt']-$inv->print['invoice']['tax_amt']),0,0,'R'); + + $y += 5; + $this->SetY($y); + $this->SetX($x+8); + $this->Cell(0,0,'Taxes'); + $this->SetX($x+135); + $this->Cell(0,0,$this->_currency($inv->print['invoice']['tax_amt']),0,0,'R'); + + $y += 5; + $this->SetY($y); + $this->SetX($x+8); + $this->Cell(0,0,'Total Charges'); + $this->SetX($x+135); + $this->Cell(0,0,$this->_currency($inv->print['invoice']['total_amt']),0,0,'R'); + + $y += 5; + $this->SetY($y); + $this->SetX($x+8); + $this->Cell(0,0,'Payments Received'); + $this->SetX($x+135); + $this->Cell(0,0,$this->_currency($inv->print['invoice']['billed_amt']),0,0,'R'); + + $y += 5; + $this->SetY($y); + $this->SetX($x+8); + $this->Cell(0,0,'Balance Due'); + $this->SetX($x+135); + $this->Cell(0,0,$this->_currency($inv->print['invoice']['total_amt']-$inv->print['invoice']['billed_amt']),0,0,'R'); + } + } +} +?> diff --git a/modules/invoice/PDF/pdf_invoice_itemised-fpdi.inc.php b/modules/invoice/PDF/pdf_invoice_itemised-fpdi.inc.php new file mode 100644 index 00000000..dde3d8c8 --- /dev/null +++ b/modules/invoice/PDF/pdf_invoice_itemised-fpdi.inc.php @@ -0,0 +1,638 @@ +Image($logo,$x,$y,$size); + } + + /** + * Draw the Company Address + */ + public function drawCompanyAddress($inv) { + global $C_translate; + + # Add the company address next to the logo + $x = 40; $y = 9; + + $this->SetFont('arial','B',10); + $this->SetXY($x,$y); $this->Cell(0,0,$inv->print['site']['NAME']); $y += 4; + + $this->SetFont('arial','',10); + $this->SetXY($x,$y); $this->Cell(0,0,$inv->print['site']['TAXID']); $y += 6; + + $this->SetXY($x,$y); $this->Cell(0,0,$inv->print['site']['ADDRESS']); $y += 4; + $this->SetXY($x,$y); $this->Cell(0,0,sprintf('%s, %s %s',$inv->print['site']['CITY'],$inv->print['site']['STATE'],$inv->print['site']['ZIP'])); $y += 4; + + $y += 2; + $this->SetXY($x,$y); $this->Cell(0,0,'Phone:'); $this->SetXY($x+16,$y); $this->Cell(0,0,$inv->print['site']['PHONE']); $y += 4; + $this->SetXY($x,$y); $this->Cell(0,0,'Fax:'); $this->SetXY($x+16,$y); $this->Cell(0,0,$inv->print['site']['FAX']); $y += 4; + $this->SetXY($x,$y); $this->Cell(0,0,'Web:'); $this->SetXY($x+16,$y); $this->Cell(0,0,$inv->print['site']['URL']); $y += 4; + } + + public function drawRemittenceStub($inv) { + global $C_translate; + + # Draw the remittance line + $this->Line(9,195,200,195); + + $x = 18; $y = 200; + + $this->SetFont('arial','B',13); + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_payment_remit','setup_invoice')); $y +=5; + + $this->SetFont('arial','',8); + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_return1','setup_invoice')); $y +=3; + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_return2','setup_invoice').' '.$inv->print['site']['NAME']); + + # Due Date + $x = 110; $y = 200; + $this->SetFont('arial','',10); + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_bill_date','setup_invoice')); + $this->SetFont('arial','B',11); + $this->SetXY($x,$y); $this->Cell(0,0,date(UNIX_DATE_FORMAT,$inv->print['invoice']['date_orig']),0,0,'R'); + + # Account ID + $y = 205; + $this->SetFont('arial','',10); + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_account_number','setup_invoice')); + $this->SetFont('arial','B',11); + $this->SetXY($x,$y); $this->Cell(0,0,sprintf('%06s',$inv->print['account']['id']),0,0,'R'); + + # Invoice number + $y = 210; + $this->SetFont('arial','',10); + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_invoice_number','setup_invoice')); + $this->SetFont('arial','B',11); + $this->SetXY($x,$y); $this->Cell(0,0,sprintf('%06s',$inv->getInvoiceNum()),0,0,'R'); + + # Company Address + $y = 216; + $this->SetFont('arial','',10); + $this->SetXY(18,$y); $this->Cell(0,0,$inv->print['site']['NAME']); $y += 4; + $this->SetXY(18,$y); $this->Cell(0,0,$inv->print['site']['ADDRESS']); $y += 4; + $this->SetXY(18,$y); $this->Cell(0,0,sprintf('%s, %s %s',$inv->print['site']['CITY'],$inv->print['site']['STATE'],$inv->print['site']['ZIP'])); $y += 4; + + # Previous Due + $y = 215; + $this->SetFont('arial','',9); + $this->SetXY($x,$y); $this->Cell(0,0,'Previous Due'); + $this->SetXY($x,$y); $this->Cell(0,0,$this->_currency($inv->getPreviousBalance()),0,0,'R'); + + $y = 219; + $this->SetFont('arial','',9); + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_amount_due_by','setup_invoice').' '.date(UNIX_DATE_FORMAT,$inv->print['invoice']['due_date'])); + $this->SetXY($x,$y); $this->Cell(0,0,$this->_currency($inv->print['invoice']['total_amt']-$inv->print['invoice']['billed_amt']),0,0,'R'); + + # Total Due + $y = 224; + $this->SetFont('arial','B',10); + $this->SetXY($x,$y); $this->Cell(0,0,'Total Due'); + $this->SetXY($x,$y); $this->Cell(0,0,$this->_currency($inv->getPreviousBalance()+$inv->print['invoice']['total_amt']-$inv->print['invoice']['billed_amt']),0,0,'R'); + + # Draw the Customers Address + $x = 25; $y = 248; + + $this->SetFont('arial','B',12); + + if ($this->billToCompany && ! empty($inv->print['account']['company'])) + $name = $inv->print['account']['company']; + else + $name = sprintf('%s %s',$inv->print['account']['first_name'],$inv->print['account']['last_name']); + + $this->SetXY($x,$y); $this->Cell(0,0,html_entity_decode($name,ENT_NOQUOTES)); $y += 5; + $this->SetXY($x,$y); $this->Cell(0,0,sprintf('%s %s ',$inv->print['account']['address1'],$inv->print['account']['address2'])); $y += 5; + $this->SetXY($x,$y); $this->Cell(0,0,sprintf('%s, %s %s',$inv->print['account']['city'],$inv->print['account']['state'],$inv->print['account']['zip'])); $y += 5; + } + + public function drawInvoiceHeader($inv) { + global $C_translate; + + $x = 125; $y = 10; + + # Draw a box. + $this->SetFillColor(245); + $this->SetXY($x-1,$y-3); $this->Cell(0,35+($inv->print['invoice']['billed_amt'] ? 5 : 0),'',1,0,'',1); + + # Draw a box around the invoice due date and amount due. + $this->SetFont('arial','B',11); + $this->SetXY($x,$y); $this->Cell(0,0,'TAX INVOICE'); + $this->SetFont('arial','B',11); + $this->SetXY($x,$y); $this->Cell(0,0,sprintf('%06s',$inv->getInvoiceNum()),0,0,'R'); + + # Invoice number at top of page. + $y += 7; + $this->SetFont('arial','',10); + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_bill_date','setup_invoice')); $y += 5; + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_amount_due_by','setup_invoice')); + $this->SetFont('arial','B',11); + + $y -= 5; + $this->SetXY($x,$y); $this->Cell(0,0,date(UNIX_DATE_FORMAT,$inv->print['invoice']['date_orig']),0,0,'R'); $y += 5; + $this->SetXY($x,$y); $this->Cell(0,0,date(UNIX_DATE_FORMAT,$inv->print['invoice']['due_date']),0,0,'R'); + + $y += 5; + $this->SetFont('arial','',10); + $this->SetXY($x,$y); $this->Cell(0,0,'Previous Due'); + $this->SetFont('arial','B',11); + $this->SetXY($x+55,$y); $this->Cell(0,0,$this->_currency($inv->getPreviousBalance()),0,0,'R'); + + $y += 5; + $this->SetFont('arial','',10); + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_current_charges','setup_invoice')); + $this->SetFont('arial','B',11); + $this->SetXY($x+55,$y); $this->Cell(0,0,$this->_currency($inv->print['invoice']['total_amt']),0,0,'R'); + + if ($inv->print['invoice']['billed_amt']) { + $y += 5; + $this->SetFont('arial','',10); + $this->SetXY($x,$y); $this->Cell(0,0,'Payments Received'); + $this->SetFont('arial','B',11); + $this->SetXY($x+55,$y); $this->Cell(0,0,$this->_currency($inv->print['invoice']['billed_amt']),0,0,'R'); + } + + $y += 5; + $this->SetFont('arial','',10); + $this->SetXY($x,$y); $this->Cell(0,0,'Total Payable'); + $this->SetFont('arial','B',11); + $this->SetXY($x+55,$y); $this->Cell(0,0,$this->_currency($inv->getPreviousBalance()+$inv->print['invoice']['total_amt']-$inv->print['invoice']['billed_amt']),0,0,'R'); + } + + #@todo Limit the size of the news to 6 lines + public function drawNews($news) { + global $C_translate; + + if (! $news) + return; + + $x = 9; $y = 170; + + # Draw a box. + $this->SetFillColor(243); + $this->SetXY($x-1,$y-3); $this->Cell(0,20,'',1,0,'',1); + + $this->SetFont('arial','',8); + $this->SetXY($x,$y); $this->MultiCell(0,3,str_replace('\n',"\n",$news),0,'L',0); + } + + #@todo make this list dynamic + public function drawPaymentMethods($inv) { + $x = 110; $y = 242; + + # Draw a box. + $this->SetFillColor(235); + $this->SetXY($x-1,$y-3); $this->Cell(0,32,'',1,0,'',1); + + $this->SetFont('arial','B',8); + $this->SetXY($x,$y); $this->Cell(0,0,'This invoice can also be paid by:'); $y += 4; + + # Direct Debit + $logo = sprintf('%s/%s',PATH_THEMES.DEFAULT_THEME,'invoice/invoice-payment-dd.png'); + $this->Image($logo,$x+1,$y,8); + $this->SetFont('arial','B',8); + $this->SetXY($x+10,$y); $this->Cell(0,0,'Direct Credit to our Bank Account'); $y += 3; + $this->SetFont('arial','',8); + $this->SetXY($x+10,$y); $this->Cell(0,0,'BSB:'); $y += 3; + $this->SetXY($x+10,$y); $this->Cell(0,0,'ACCOUNT:'); $y += 3; + $this->SetXY($x+10,$y); $this->Cell(0,0,'REF:'); $y += 3; + + $y -= 9; + $this->SetFont('arial','B',8); + $this->SetXY($x+30,$y); $this->Cell(0,0,'633-000'); $y += 3; + $this->SetXY($x+30,$y); $this->Cell(0,0,'120 440 821'); $y += 3; + $this->SetXY($x+30,$y); $this->Cell(0,0,$inv->getInvoiceID()); $y += 3; + + # Direct Debit + $y += 3; + $logo = sprintf('%s/%s',PATH_THEMES.DEFAULT_THEME,'invoice/invoice-payment-dd.png'); + $this->Image($logo,$x+1,$y,8); + $this->SetFont('arial','B',8); + $this->SetXY($x+10,$y); $this->Cell(0,0,'Direct Debit'); $y += 3; + $this->SetFont('arial','',8); + $this->SetXY($x+10,$y); $this->Cell(0,0,'Please visit '.$inv->print['site']['URL']); $y += 3; + +# $r1 = $this->w - 40; +# $r2 = $r1 + 30; +# $y1 = 8; +# $y2 = $y1 ; +# $mid = $y1 + ($y2 / 2); +# $this->RoundedRect($r1, $y1, ($r2 - $r1), $y2, 2.5, 'F'); + +# $this->addWaterMark('hello'); +# # Pay Pal +# $y += 3; +# $logo = sprintf('%s/%s',PATH_THEMES.DEFAULT_THEME,'invoice/invoice-payment-pp.png'); +# $this->Image($logo,$x+1,$y,8); +# $this->SetFont('arial','B',8); +# $this->SetXY($x+10,$y); $this->Cell(0,0,'Pay Pal'); $y += 3; +# $this->SetFont('arial','',8); +# $this->SetXY($x+10,$y); $this->Cell(0,0,'Please visit '.$inv->print['site']['URL']); $y += 3; + } + + /** + * Draw previous invoices due + */ + public function drawSummaryInvoicesDue($items) { + $x = 125; $y = $this->sum_y ? $this->sum_y : 50; + + # Calculate the box size + $box = count($items) < $this->itemsPreviousMax ? count($items) : $this->itemsPreviousMax; + + # Draw a box. + $this->SetFillColor(245); + $this->SetXY($x-1,$y-3); $this->Cell(0,5*(1+$box)+1,'',1,0,'',1); + + $this->SetFont('arial','B',11); + $this->SetXY($x,$y); $this->Cell(0,0,'Previous Invoices due'); $y += 5; + + $this->SetFont('arial','',11); + $i = 0; + $sum_total = 0; + foreach ($items as $line) { + if (++$i < $this->itemsPreviousMax) { + $this->SetXY($x,$y); + $this->Cell(0,0,sprintf('%s #%06s',date(UNIX_DATE_FORMAT,$line['date_orig']),$line['id'])); + $this->Cell(0,0,$this->_currency($line['total_amt']-$line['billed_amt']),0,0,'R'); $y += 5; + + } else { + $sum_total += $line['total_amt']-$line['billed_amt']; + } + } + + if ($sum_total) { + $this->SetXY($x,$y); + $this->SetFont('arial','I',11); + $this->Cell(0,0,'Other invoices'); + $this->SetFont('arial','',11); + $this->Cell(0,0,$this->_currency($sum_total),0,0,'R'); $y += 5; + } + + $this->sum_y = $y+5; + } + + /** + * Called before begining to loop the invoice_item table. Used to set initial values. + */ + public function drawLineItems_pre($iteration) { + $this->iteration = $iteration; + if ($iteration>1) + return false; + + return true; + } + + /** + * Called once per line item to add to the PDF invoice. This function serves to + * direct each iteration to a different function which handles a specific piece + * of the PDF building puzzle. + */ + public function drawLineItems($db,$line,$invnum) { + switch($this->iteration) { + case 0: + $this->drawLineItems_0($db,$line,$invnum); + break; + + case 1: + $this->drawLineItems_1($db,$line,$invnum); + break; + + default: + echo 'Unknown PDF iteration encountered. Halting.'; + exit; + } + } + + /** + * Draws the non-VoIP related items for iteration 0. + */ + private function drawLineItems_0($db,$line,$invnum) { + global $C_translate; + + if ($line['price_type'] == 0 && $line['item_type']==5) + return; + + $x = 10; $y = 5; + if ($this->i == 0 || $this->i%51 == 0) { + $this->AddPage(); + + $this->SetFont('arial','B',12); + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_itemized_charges','setup_invoice')); + $this->Cell(0,0,$C_translate->translate('pdf_page','setup_invoice').$this->PageNo(),0,0,'R'); + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_invoice_number_small','setup_invoice').$invnum,0,0,'C'); + + # Draw table headers + $y += 10; + $this->SetFont('arial','B',8); + $this->SetXY($x,$y); + $this->Cell(0,0,$C_translate->translate('pdf_item_description','setup_invoice')); + $this->SetX($x+135); + $this->Cell(0,0,$C_translate->translate('pdf_item_quantity','setup_invoice')); + $this->SetX($x+160); + $this->Cell(10,0,$C_translate->translate('pdf_item_cost','setup_invoice'),0,0,'R'); + $this->SetX($x+135); + $this->Cell(0,0,$C_translate->translate('pdf_item_amount','setup_invoice'),0,0,'R'); + $this->Line($x,$y+2,200,$y+2); + $y += 5; + $this->SetY($y); + } + + $this->SetFont('arial','',8); + $this->SetX($x); + $this->Cell(0,0,$line['name']); + + if (isset($line['price_base'])) { + $this->SetX($x+160); + $this->Cell(10,0,$this->_currency($line['price_base']),0,0,'R'); + } + + if (isset($line['qty'])) { + $this->SetX($x+130); + $this->Cell(10,0,$line['qty'],0,0,'R'); + } + + $this->SetX($x+130); + $this->Cell(0,0,$this->_currency($line['total_amt']),0,0,'R'); + + if ($this->show_service_range && $line['daterange']) { + $this->SetFont('arial','I',7); + $y += 3; + $this->SetXY($x+10,$y); $this->Cell(0,0,'Service Period'); + $this->SetFont('arial','',7); + $this->SetXY($x+40,$y); $this->Cell(0,0,$line['daterange']); + } + + if ($line['domain']) { + $this->SetFont('arial','I',7); + $y += 3; + $this->SetXY($x+10,$y); $this->Cell(0,0,'Domain'); + $this->SetFont('arial','',7); + $this->SetXY($x+40,$y); $this->Cell(0,0,$line['domain']); + } + + if ($line['attr']) { + $showchars = 20; + foreach (explode("\n",$line['attr']) as $attr) { + list($field,$value) = explode('==',$attr); + + $this->SetFont('arial','I',7); + $this->y += 3; + $this->SetXY(20,$this->y); $this->Cell(0,0,strlen($field) > $showchars ? substr($field,0,$showchars-2).'...' : $field); + $this->SetFont('arial','',7); + $this->SetXY(50,$this->y); $this->Cell(0,0,$value); + } + } + + $this->y += 5; + $this->SetY($this->y); + $this->i++; + } + + /** + * Draws the Item Detail for Iteration 1. + */ + private function drawLineItems_1($db,$line,$invnum) { + global $C_translate; + + if ($this->show_itemized != 1) return; + if ($line['price_type'] != 0 || $line['item_type'] != 5) + return; + + $x = 10; $y = 5; + if ($this->i == 0 || $this->i%51 == 0) { + $this->AddPage(); + + $this->SetFont('arial','B',12); + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_itemized_calls','setup_invoice')); + $this->Cell(0,0,$C_translate->translate('pdf_page','setup_invoice').$this->PageNo(),0,0,'R'); + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_invoice_number_small','setup_invoice').$invnum,0,0,'C'); + + # Draw table headers + $this->SetFont('arial','B',8); + $this->SetXY($x,$y); + $this->Cell(0,0,$C_translate->translate('pdf_item_from','setup_invoice')); + $this->SetX(69); + $this->Cell(0,0,$C_translate->translate('pdf_item_to','setup_invoice')); + $this->SetX(119); + $this->Cell(0,0,'Date & Time'); + $this->SetX(160); + $this->Cell(10,0,'Seconds' /*$C_translate->translate('pdf_item_min','setup_invoice')*/,0,0,'R'); + $this->SetX($x+135); + $this->Cell(0,0,$C_translate->translate('pdf_item_amount','setup_invoice'),0,0,'R'); + $this->Line($x,$y+4,200,$y+4); + $y += 5; + $this->SetY($y); + } + + if ($line['price_type'] != 0) { + $this->SetFont('arial','I',6); + } else { + $this->SetFont('arial','',6); + } + + $val = $line['name']; + if (strlen($line['attr'])) { + $val = ""; + $atrs = preg_split("/\r\n/", str_replace('\r\n',"\r\n",$line['attr'])); + foreach ($atrs as $a) { + $parts = preg_split("/==/", $a); + switch ($parts[0]) { + case "Destination": + $this->SetX(69); + $this->Cell(0,0,$parts[1]); + $cc = ""; $npa = ""; $nxx = ""; $e164 = ""; + if ($this->v->e164($parts[1], $e164, $cc, $npa, $nxx)) { + $this->SetX(89); + $this->Cell(0,0,substr($this->v->where_is($db, $cc, $npa, $nxx), 0, 20)); + } + break; + case "Source": + $this->SetX(9); + $this->Cell(0,0,$parts[1]); + $cc = ""; $npa = ""; $nxx = ""; $e164 = ""; + if ($this->v->e164($parts[1], $e164, $cc, $npa, $nxx)) { + $this->SetX(29); + $this->Cell(0,0,substr($this->v->where_is($db, $cc, $npa, $nxx), 0, 20)); + } + break; + case "parent_service_id": + $sql = sqlSelect($db,"service","prod_attr","id=::".$parts[1]."::"); + $rstmp = $db->Execute($sql); + $atrs2 = split("\r\n", $rstmp->fields['prod_attr']); + foreach ($atrs2 as $a2) { + $parts2 = split("==", $a2); + switch ($parts2[0]) { + case "station": + case "ported": + $val = $line['name']." for ".$parts2[1]; + break; + default: + break; + } + } + break; + case "station": + case "ported": + $val = $line['name']." for ".$parts[1]; + break; + case "date_orig": + $this->SetX(119); + $this->Cell(0,0,date(UNIX_DATE_FORMAT." H:i:s",$parts[1])); + break; + case "voip_cdr_id": + $sql = "SELECT billsec, amount FROM ".AGILE_DB_PREFIX."voip_cdr WHERE site_id=".DEFAULT_SITE." AND id=".$parts[1]; + $row = $db->GetRow($sql); + $this->SetX(160); + $this->Cell(10,0,$row[0],0,0,'R'); + $this->SetX(160); + $this->Cell(0,0,$this->_currency($row[1]),0,0,'R'); + $val = ""; + default: + break; + } + } + } + + $this->SetX(9); + $this->Cell(0,0, $val); + if ($line['price_type'] == 0) { + $this->SetX(160); + //$this->Cell(10,0, $line['qty']." M",0,0,'R'); + } else { + $q = $line['qty']; + if(empty($q)) $q = 1; + $this->SetX(160); + $this->Cell(10,0, $line['qty'],0,0,'R'); + $this->SetX($x+135); + $this->Cell(0,0, $this->_currency($line['amount']), 0,0,'R'); + } + $this->y += 5; + $this->SetY($this->y); + $this->i++; + } + + /** + * This will draw the Summary Box, with the summary of the items + * on the invoice. + */ + public function drawSummaryLineItems($inv) { + global $C_translate; + + if (! $this->show_itemized) + return; + + $items = $inv->summarizeLineItems($inv->print['invoiceitems']); + + # Calculate the box size + $box = count($items) < $this->itemsSummaryMax ? count($items) : $this->itemsSummaryMax; + + $x = 10; $y = $this->sum_y ? $this->sum_y : 55; + + # Draw a box. + $this->SetFillColor(245); + $this->SetXY($x-1,$y-3); $this->Cell(0,5*(1+1+1+5+$box)+1,'',1,0,'',1); + + $this->SetFont('arial','B',11); + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_cur_charge_summary','setup_invoice')); $y += 5; + + $this->SetY($y); + $this->SetFont('arial','',9); + + $i=0; + if (is_array($items)) { + foreach($items as $line) { + $this->SetX($x); + + $q = $line['quantity']; + if (empty($q)) + $q = 1; + + $this->Cell(0,0,$q); + $this->SetX($x+8); + $this->Cell(0,0,sprintf('%s (%s)',$line['summaryname'],$this->_currency($line['price_base']))); + $this->SetX($x+135); + $this->Cell(0,0,$this->_currency($line['price_base']*$line['quantity']),0,0,'R'); + $y += 5; + $this->SetY($y); + $i++; + if ($i > $this->itemsSummaryMax) { + $this->SetFont('arial','B',11); + $this->SetX($x); + $this->Cell(0,0,$C_translate->translate('pdf_summary','setup_invoice')); + break; + } + } + + # Calculate our rounding error + $subtotal = 0; + foreach($items as $line) + $subtotal += $line['price_base']*$line['quantity']; + + $subtotal = round($subtotal,2); + + if (round($inv->print['invoice']['total_amt']-$inv->print['invoice']['tax_amt'],2) != $subtotal) { + $this->SetFont('arial','',9); + $this->SetX($x); + $this->Cell(0,0,'Rounding'); + $this->SetX($x+135); + $this->Cell(0,0,$this->_currency($inv->print['invoice']['total_amt']-$inv->print['invoice']['tax_amt']-$subtotal),0,0,'R'); + $y += 5; + $this->SetY($y); + } + + # @todo Draw discounts + # Sub total and tax. + $y += 5; + $this->SetY($y); + $this->SetFont('arial','B',9); + $this->SetX($x+8); + $this->Cell(0,0,'Sub Total'); + $this->SetX($x+135); + $this->Cell(0,0,$this->_currency($inv->print['invoice']['total_amt']-$inv->print['invoice']['tax_amt']),0,0,'R'); + + $y += 5; + $this->SetY($y); + $this->SetX($x+8); + $this->Cell(0,0,'Taxes'); + $this->SetX($x+135); + $this->Cell(0,0,$this->_currency($inv->print['invoice']['tax_amt']),0,0,'R'); + + $y += 5; + $this->SetY($y); + $this->SetX($x+8); + $this->Cell(0,0,'Total Charges'); + $this->SetX($x+135); + $this->Cell(0,0,$this->_currency($inv->print['invoice']['total_amt']),0,0,'R'); + + $y += 5; + $this->SetY($y); + $this->SetX($x+8); + $this->Cell(0,0,'Payments Received'); + $this->SetX($x+135); + $this->Cell(0,0,$this->_currency($inv->print['invoice']['billed_amt']),0,0,'R'); + + $y += 5; + $this->SetY($y); + $this->SetX($x+8); + $this->Cell(0,0,'Balance Due'); + $this->SetX($x+135); + $this->Cell(0,0,$this->_currency($inv->print['invoice']['total_amt']-$inv->print['invoice']['billed_amt']),0,0,'R'); + } + } +} +?> diff --git a/modules/invoice/PDF/pdf_invoice_itemised-tcpdf.inc.php b/modules/invoice/PDF/pdf_invoice_itemised-tcpdf.inc.php new file mode 100644 index 00000000..3dd90684 --- /dev/null +++ b/modules/invoice/PDF/pdf_invoice_itemised-tcpdf.inc.php @@ -0,0 +1,624 @@ +Image($logo,$x,$y,$size); + } + + /** + * Draw the Company Address + */ + public function drawCompanyAddress($inv) { + global $C_translate; + + # Add the company address next to the logo + $x = 40; $y = 7; + + $this->SetFont('helvetica','B',10); + $this->SetXY($x,$y); $this->Cell(0,0,$inv->print['site']['NAME']); $y += 4; + + $this->SetFont('helvetica','',10); + $this->SetXY($x,$y); $this->Cell(0,0,$inv->print['site']['TAXID']); $y += 6; + + $this->SetXY($x,$y); $this->Cell(0,0,$inv->print['site']['ADDRESS']); $y += 4; + $this->SetXY($x,$y); $this->Cell(0,0,sprintf('%s, %s %s',$inv->print['site']['CITY'],$inv->print['site']['STATE'],$inv->print['site']['ZIP'])); $y += 4; + + $y += 2; + $this->SetXY($x,$y); $this->Cell(0,0,'Phone:'); $this->SetXY($x+16,$y); $this->Cell(0,0,$inv->print['site']['PHONE']); $y += 4; + $this->SetXY($x,$y); $this->Cell(0,0,'Fax:'); $this->SetXY($x+16,$y); $this->Cell(0,0,$inv->print['site']['FAX']); $y += 4; + $this->SetXY($x,$y); $this->Cell(0,0,'Web:'); $this->SetXY($x+16,$y); $this->addHtmlLink($inv->print['site']['URL'],$inv->print['site']['URL']); $y += 4; + } + + public function drawRemittenceStub($inv) { + global $C_translate; + + # Draw the remittance line + $this->Line(9,195,200,195); + + $x = 18; $y = 200; + + $this->SetFont('helvetica','B',13); + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_payment_remit','setup_invoice')); $y +=5; + + $this->SetFont('helvetica','',8); + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_return1','setup_invoice')); $y +=3; + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_return2','setup_invoice').' '.$inv->print['site']['NAME']); + + # Due Date + $x = 110; $y = 200; + $this->SetFont('helvetica','',10); + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_bill_date','setup_invoice')); + $this->SetFont('helvetica','B',11); + $this->SetXY($x,$y); $this->Cell(0,0,date(UNIX_DATE_FORMAT,$inv->print['invoice']['date_orig']),0,0,'R'); + + # Account ID + $y = 205; + $this->SetFont('helvetica','',10); + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_account_number','setup_invoice')); + $this->SetFont('helvetica','B',11); + $this->SetXY($x,$y); $this->Cell(0,0,sprintf('%06s',$inv->print['account']['id']),0,0,'R'); + + # Invoice number + $y = 210; + $this->SetFont('helvetica','',10); + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_invoice_number','setup_invoice')); + $this->SetFont('helvetica','B',11); + $this->SetXY($x,$y); $this->Cell(0,0,sprintf('%06s',$inv->getInvoiceNum()),0,0,'R'); + + # Company Address + $y = 216; + $this->SetFont('helvetica','',10); + $this->SetXY(18,$y); $this->Cell(0,0,$inv->print['site']['NAME']); $y += 4; + $this->SetXY(18,$y); $this->Cell(0,0,$inv->print['site']['ADDRESS']); $y += 4; + $this->SetXY(18,$y); $this->Cell(0,0,sprintf('%s, %s %s',$inv->print['site']['CITY'],$inv->print['site']['STATE'],$inv->print['site']['ZIP'])); $y += 4; + + # Previous Due + $y = 215; + $this->SetFont('helvetica','',9); + $this->SetXY($x,$y); $this->Cell(0,0,'Previous Due'); + $this->SetXY($x,$y); $this->Cell(0,0,$this->_currency($inv->getPreviousBalance()),0,0,'R'); + + $y = 219; + $this->SetFont('helvetica','',9); + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_amount_due_by','setup_invoice').' '.date(UNIX_DATE_FORMAT,$inv->print['invoice']['due_date'])); + $this->SetXY($x,$y); $this->Cell(0,0,$this->_currency($inv->print['invoice']['total_amt']-$inv->print['invoice']['billed_amt']),0,0,'R'); + + # Total Due + $y = 224; + $this->SetFont('helvetica','B',10); + $this->SetXY($x,$y); $this->Cell(0,0,'Total Due'); + $this->SetXY($x,$y); $this->Cell(0,0,$this->_currency($inv->getPreviousBalance()+$inv->print['invoice']['total_amt']-$inv->print['invoice']['billed_amt']),0,0,'R'); + + # Draw the Customers Address + $x = 25; $y = 248; + + $this->SetFont('helvetica','B',12); + + if ($this->billToCompany && ! empty($inv->print['account']['company'])) + $name = $inv->print['account']['company']; + else + $name = sprintf('%s %s',$inv->print['account']['first_name'],$inv->print['account']['last_name']); + + $this->SetXY($x,$y); $this->Cell(0,0,html_entity_decode($name,ENT_NOQUOTES)); $y += 5; + $this->SetXY($x,$y); $this->Cell(0,0,sprintf('%s %s ',$inv->print['account']['address1'],$inv->print['account']['address2'])); $y += 5; + $this->SetXY($x,$y); $this->Cell(0,0,sprintf('%s, %s %s',$inv->print['account']['city'],$inv->print['account']['state'],$inv->print['account']['zip'])); $y += 5; + } + + public function drawInvoiceHeader($inv) { + global $C_translate; + + $x = 125; $y = 10; + + # Draw a box. + $this->SetFillColor(245); + $this->SetXY($x-1,$y-1); $this->Cell(0,35+($inv->print['invoice']['billed_amt'] ? 5 : 0),'',1,0,'',1); + + # Draw a box around the invoice due date and amount due. + $this->SetFont('helvetica','B',11); + $this->SetXY($x,$y); $this->Cell(0,0,'TAX INVOICE'); + $this->SetFont('helvetica','B',11); + $this->SetXY($x,$y); $this->Cell(0,0,sprintf('%06s',$inv->getInvoiceNum()),0,0,'R'); + + # Invoice number at top of page. + $y += 7; + $this->SetFont('helvetica','',10); + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_bill_date','setup_invoice')); $y += 5; + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_amount_due_by','setup_invoice')); + + $y -= 5; + $this->SetFont('helvetica','B',11); + $this->SetXY($x,$y); $this->Cell(0,0,date(UNIX_DATE_FORMAT,$inv->print['invoice']['date_orig']),0,0,'R'); $y += 5; + $this->SetXY($x,$y); $this->Cell(0,0,date(UNIX_DATE_FORMAT,$inv->print['invoice']['due_date']),0,0,'R'); + + $y += 5; + $this->SetFont('helvetica','',10); + $this->SetXY($x,$y); $this->Cell(0,0,'Previous Due'); + $this->SetFont('helvetica','B',11); + $this->SetXY($x+55,$y); $this->Cell(0,0,$this->_currency($inv->getPreviousBalance()),0,0,'R'); + + $y += 5; + $this->SetFont('helvetica','',10); + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_current_charges','setup_invoice')); + $this->SetFont('helvetica','B',11); + $this->SetXY($x+55,$y); $this->Cell(0,0,$this->_currency($inv->print['invoice']['total_amt']),0,0,'R'); + + if ($inv->print['invoice']['billed_amt']) { + $y += 5; + $this->SetFont('helvetica','',10); + $this->SetXY($x,$y); $this->Cell(0,0,'Payments Received'); + $this->SetFont('helvetica','B',11); + $this->SetXY($x+55,$y); $this->Cell(0,0,$this->_currency($inv->print['invoice']['billed_amt']),0,0,'R'); + } + + $y += 5; + $this->SetFont('helvetica','',10); + $this->SetXY($x,$y); $this->Cell(0,0,'Total Payable'); + $this->SetFont('helvetica','B',11); + $this->SetXY($x+55,$y); $this->Cell(0,0,$this->_currency($inv->getPreviousBalance()+$inv->print['invoice']['total_amt']-$inv->print['invoice']['billed_amt']),0,0,'R'); + } + + #@todo Limit the size of the news to 6 lines + public function drawNews($news) { + global $C_translate; + + if (! $news) + return; + + $x = 9; $y = 170; + + # Draw a box. + $this->SetFillColor(243); + $this->SetXY($x-1,$y-1); $this->Cell(0,20,'',1,0,'',1); + + $this->SetFont('helvetica','',8); + $this->SetXY($x,$y); $this->MultiCell(0,3,str_replace('\n',"\n",$news),0,'L',0); + } + + #@todo make this list dynamic + public function drawPaymentMethods($inv) { + $x = 110; $y = 242; + + # Draw a box. + $this->SetFillColor(235); + $this->SetXY($x-1,$y-2); $this->Cell(0,32,'',1,0,'',1); + + $this->SetFont('helvetica','B',8); + $this->SetXY($x,$y); $this->Cell(0,0,'This invoice can also be paid by:'); $y += 4; + + # Direct Debit + $logo = sprintf('%s/%s',PATH_THEMES.DEFAULT_THEME,'invoice/invoice-payment-dd.png'); + $this->Image($logo,$x+1,$y,8); + $this->SetFont('helvetica','B',8); + $this->SetXY($x+10,$y); $this->Cell(0,0,'Direct Credit to our Bank Account'); $y += 3; + $this->SetFont('helvetica','',8); + $this->SetXY($x+10,$y); $this->Cell(0,0,'BSB:'); $y += 3; + $this->SetXY($x+10,$y); $this->Cell(0,0,'ACCOUNT:'); $y += 3; + $this->SetXY($x+10,$y); $this->Cell(0,0,'REF:'); $y += 3; + + $y -= 9; + $this->SetFont('helvetica','B',8); + $this->SetXY($x+30,$y); $this->Cell(0,0,'633-000'); $y += 3; + $this->SetXY($x+30,$y); $this->Cell(0,0,'120 440 821'); $y += 3; + $this->SetXY($x+30,$y); $this->Cell(0,0,$inv->getInvoiceID()); $y += 3; + + # Direct Debit + $y += 3; + $logo = sprintf('%s/%s',PATH_THEMES.DEFAULT_THEME,'invoice/invoice-payment-dd.png'); + $this->Image($logo,$x+1,$y,8); + $this->SetFont('helvetica','B',8); + $this->SetXY($x+10,$y); $this->Cell(0,0,'Direct Debit'); $y += 3; + $this->SetFont('helvetica','',8); + $this->SetXY($x+10,$y); $this->Cell(0,0,'Please visit '); $this->SetXY($x+30,$y); $this->addHtmlLink($inv->print['site']['URL'].'?_page=invoice:user_view&id='.$inv->getInvoiceNum(),$inv->print['site']['URL']); $y += 3; + } + + /** + * Draw previous invoices due + */ + public function drawSummaryInvoicesDue($items) { + $x = 125; $y = $this->sum_y ? $this->sum_y : 50; + + # Calculate the box size + $box = count($items) < $this->itemsPreviousMax ? count($items) : $this->itemsPreviousMax; + + # Draw a box. + $this->SetFillColor(245); + $this->SetXY($x-1,$y-1); $this->Cell(0,5*(1+$box)+1,'',1,0,'',1); + + $this->SetFont('helvetica','B',11); + $this->SetXY($x,$y); $this->Cell(0,0,'Previous Invoices due'); $y += 5; + + $this->SetFont('helvetica','',11); + $i = 0; + $sum_total = 0; + foreach ($items as $line) { + if (++$i < $this->itemsPreviousMax) { + $this->SetXY($x,$y); + $this->Cell(0,0,sprintf('%s #%06s',date(UNIX_DATE_FORMAT,$line['date_orig']),$line['id'])); + $this->Cell(0,0,$this->_currency($line['total_amt']-$line['billed_amt']),0,0,'R'); $y += 5; + + } else { + $sum_total += $line['total_amt']-$line['billed_amt']; + } + } + + if ($sum_total) { + $this->SetXY($x,$y); + $this->SetFont('helvetica','I',11); + $this->Cell(0,0,'Other invoices'); + $this->SetFont('helvetica','',11); + $this->Cell(0,0,$this->_currency($sum_total),0,0,'R'); $y += 5; + } + + $this->sum_y = $y+5; + } + + /** + * Called before begining to loop the invoice_item table. Used to set initial values. + */ + public function drawLineItems_pre($iteration) { + $this->iteration = $iteration; + if ($iteration>1) + return false; + + return true; + } + + /** + * Called once per line item to add to the PDF invoice. This function serves to + * direct each iteration to a different function which handles a specific piece + * of the PDF building puzzle. + */ + public function drawLineItems($db,$line,$invnum) { + switch($this->iteration) { + case 0: + $this->drawLineItems_0($db,$line,$invnum); + break; + + case 1: + $this->drawLineItems_1($db,$line,$invnum); + break; + + default: + echo 'Unknown PDF iteration encountered. Halting.'; + exit; + } + } + + /** + * Draws the non-VoIP related items for iteration 0. + * @todo need to make sure that this pages well, when there are many items (with many sub details). + * @tood Need to replicate this to the other fpdf files + */ + private function drawLineItems_0($db,$line,$invnum) { + global $C_translate; + + if ($line['price_type'] == 0 && $line['item_type']==5) + return; + + $x = 10; + if ($this->i == 0 || $this->i%51 == 0) { + $this->y = 5; + $this->AddPage(); + + $this->SetFont('helvetica','B',12); + $this->SetXY($x,$this->y); $this->Cell(0,0,$C_translate->translate('pdf_itemized_charges','setup_invoice')); + $this->Cell(0,0,$C_translate->translate('pdf_page','setup_invoice').$this->PageNo(),0,0,'R'); + $this->SetXY($x,$this->y); $this->Cell(0,0,$C_translate->translate('pdf_invoice_number_small','setup_invoice').$invnum,0,0,'C'); + + # Draw table headers + $this->y += 10; + $this->SetFont('helvetica','B',8); + $this->SetXY($x,$this->y); + $this->Cell(0,0,$C_translate->translate('pdf_item_description','setup_invoice')); + $this->SetX($x+135); + $this->Cell(0,0,$C_translate->translate('pdf_item_quantity','setup_invoice')); + $this->SetX($x+160); + $this->Cell(10,0,$C_translate->translate('pdf_item_cost','setup_invoice'),0,0,'R'); + $this->SetX($x+135); + $this->Cell(0,0,$C_translate->translate('pdf_item_amount','setup_invoice'),0,0,'R'); + $this->Line($x,$this->y+4,200,$this->y+4); + $this->y += 5; + $this->SetY($this->y); + } + + $this->SetFont('helvetica','',8); + $this->SetX($x); + $this->Cell(0,0,$line['name']); + + if (isset($line['price_base'])) { + $this->SetX($x+160); + $this->Cell(10,0,$this->_currency($line['price_base']),0,0,'R'); + } + + if (isset($line['qty'])) { + $this->SetX($x+130); + $this->Cell(10,0,$line['qty'],0,0,'R'); + } + + $this->SetX($x+130); + $this->Cell(0,0,$this->_currency($line['total_amt']),0,0,'R'); + + if ($this->show_service_range && $line['daterange']) { + $this->SetFont('helvetica','I',7); + $this->y += 3; + $this->SetXY($x+10,$this->y); $this->Cell(0,0,'Service Period'); + $this->SetFont('helvetica','',7); + $this->SetXY($x+40,$this->y); $this->Cell(0,0,$line['daterange']); + } + + if ($line['domain']) { + $this->SetFont('helvetica','I',7); + $this->y += 3; + $this->SetXY($x+10,$this->y); $this->Cell(0,0,'Domain'); + $this->SetFont('helvetica','',7); + $this->SetXY($x+40,$this->y); $this->Cell(0,0,$line['domain']); + } + + if ($line['attr']) { + $showchars = 20; + foreach (explode("\n",$line['attr']) as $attr) { + list($field,$value) = explode('==',$attr); + + $this->SetFont('helvetica','I',7); + $this->y += 3; + $this->SetXY(20,$this->y); $this->Cell(0,0,strlen($field) > $showchars ? substr($field,0,$showchars-2).'...' : $field); + $this->SetFont('helvetica','',7); + $this->SetXY(50,$this->y); $this->Cell(0,0,$value); + } + } + + $this->y += 5; + $this->SetY($this->y); + $this->i++; + } + + /** + * Draws the Item Detail for Iteration 1. + */ + private function drawLineItems_1($db,$line,$invnum) { + global $C_translate; + + if ($this->show_itemized != 1) return; + if ($line['price_type'] != 0 || $line['item_type'] != 5) + return; + + $x = 10; $this->y = 5; + if ($this->i == 0 || $this->i%51 == 0) { + $this->AddPage(); + + $this->SetFont('helvetica','B',12); + $this->SetXY($x,$this->y); $this->Cell(0,0,$C_translate->translate('pdf_itemized_calls','setup_invoice')); + $this->Cell(0,0,$C_translate->translate('pdf_page','setup_invoice').$this->PageNo(),0,0,'R'); + $this->SetXY($x,$this->y); $this->Cell(0,0,$C_translate->translate('pdf_invoice_number_small','setup_invoice').$invnum,0,0,'C'); + + # Draw table headers + $this->SetFont('helvetica','B',8); + $this->SetXY($x,$this->y); + $this->Cell(0,0,$C_translate->translate('pdf_item_from','setup_invoice')); + $this->SetX(69); + $this->Cell(0,0,$C_translate->translate('pdf_item_to','setup_invoice')); + $this->SetX(119); + $this->Cell(0,0,'Date & Time'); + $this->SetX(160); + $this->Cell(10,0,'Seconds' /*$C_translate->translate('pdf_item_min','setup_invoice')*/,0,0,'R'); + $this->SetX($x+135); + $this->Cell(0,0,$C_translate->translate('pdf_item_amount','setup_invoice'),0,0,'R'); + $this->Line($x,$this->y+4,200,$this->y+4); + $this->y += 5; + $this->SetY($this->y); + } + + if ($line['price_type'] != 0) { + $this->SetFont('helvetica','I',6); + } else { + $this->SetFont('helvetica','',6); + } + + $val = $line['name']; + if (strlen($line['attr'])) { + $val = ""; + $atrs = preg_split("/\r\n/", str_replace('\r\n',"\r\n",$line['attr'])); + foreach ($atrs as $a) { + $parts = preg_split("/==/", $a); + switch ($parts[0]) { + case "Destination": + $this->SetX(69); + $this->Cell(0,0,$parts[1]); + $cc = ""; $npa = ""; $nxx = ""; $e164 = ""; + if ($this->v->e164($parts[1], $e164, $cc, $npa, $nxx)) { + $this->SetX(89); + $this->Cell(0,0,substr($this->v->where_is($db, $cc, $npa, $nxx), 0, 20)); + } + break; + case "Source": + $this->SetX(9); + $this->Cell(0,0,$parts[1]); + $cc = ""; $npa = ""; $nxx = ""; $e164 = ""; + if ($this->v->e164($parts[1], $e164, $cc, $npa, $nxx)) { + $this->SetX(29); + $this->Cell(0,0,substr($this->v->where_is($db, $cc, $npa, $nxx), 0, 20)); + } + break; + case "parent_service_id": + $sql = sqlSelect($db,"service","prod_attr","id=::".$parts[1]."::"); + $rstmp = $db->Execute($sql); + $atrs2 = split("\r\n", $rstmp->fields['prod_attr']); + foreach ($atrs2 as $a2) { + $parts2 = split("==", $a2); + switch ($parts2[0]) { + case "station": + case "ported": + $val = $line['name']." for ".$parts2[1]; + break; + default: + break; + } + } + break; + case "station": + case "ported": + $val = $line['name']." for ".$parts[1]; + break; + case "date_orig": + $this->SetX(119); + $this->Cell(0,0,date(UNIX_DATE_FORMAT." H:i:s",$parts[1])); + break; + case "voip_cdr_id": + $sql = "SELECT billsec, amount FROM ".AGILE_DB_PREFIX."voip_cdr WHERE site_id=".DEFAULT_SITE." AND id=".$parts[1]; + $row = $db->GetRow($sql); + $this->SetX(160); + $this->Cell(10,0,$row[0],0,0,'R'); + $this->SetX(160); + $this->Cell(0,0,$this->_currency($row[1]),0,0,'R'); + $val = ""; + default: + break; + } + } + } + + $this->SetX(9); + $this->Cell(0,0, $val); + if ($line['price_type'] == 0) { + $this->SetX(160); + //$this->Cell(10,0, $line['qty']." M",0,0,'R'); + } else { + $q = $line['qty']; + if(empty($q)) $q = 1; + $this->SetX(160); + $this->Cell(10,0, $line['qty'],0,0,'R'); + $this->SetX($x+135); + $this->Cell(0,0, $this->_currency($line['amount']), 0,0,'R'); + } + $this->y += 5; + $this->SetY($this->y); + $this->i++; + } + + /** + * This will draw the Summary Box, with the summary of the items + * on the invoice. + */ + public function drawSummaryLineItems($inv) { + global $C_translate; + + if (! $this->show_itemized) + return; + + $items = $inv->summarizeLineItems($inv->print['invoiceitems']); + + # Calculate the box size + $box = count($items) < $this->itemsSummaryMax ? count($items) : $this->itemsSummaryMax; + + $x = 10; $y = $this->sum_y ? $this->sum_y : 55; + + # Draw a box. + $this->SetFillColor(245); + $this->SetXY($x-1,$y-1); $this->Cell(0,5*(1+1+1+5+$box)+1,'',1,0,'',1); + + $this->SetFont('helvetica','B',11); + $this->SetXY($x,$y); $this->Cell(0,0,$C_translate->translate('pdf_cur_charge_summary','setup_invoice')); $y += 5; + + $this->SetY($y); + $this->SetFont('helvetica','',9); + + $i=0; + if (is_array($items)) { + foreach($items as $line) { + $this->SetX($x); + + $q = $line['quantity']; + if (empty($q)) + $q = 1; + + $this->Cell(0,0,$q); + $this->SetX($x+8); + $this->Cell(0,0,sprintf('%s (%s)',$line['summaryname'],$this->_currency($line['price_base']))); + $this->SetX($x+135); + $this->Cell(0,0,$this->_currency($line['price_base']*$line['quantity']),0,0,'R'); + $y += 5; + $this->SetY($y); + $i++; + if ($i > $this->itemsSummaryMax) { + $this->SetFont('helvetica','B',11); + $this->SetX($x); + $this->Cell(0,0,$C_translate->translate('pdf_summary','setup_invoice')); + break; + } + } + + # Calculate our rounding error + $subtotal = 0; + foreach($items as $line) + $subtotal += $line['price_base']*$line['quantity']; + + $subtotal = round($subtotal,2); + + if (round($inv->print['invoice']['total_amt']-$inv->print['invoice']['tax_amt'],2) != $subtotal) { + $this->SetFont('helvetica','',9); + $this->SetX($x); + $this->Cell(0,0,'Rounding'); + $this->SetX($x+135); + $this->Cell(0,0,$this->_currency($inv->print['invoice']['total_amt']-$inv->print['invoice']['tax_amt']-$subtotal),0,0,'R'); + $y += 5; + $this->SetY($y); + } + + # @todo Draw discounts + # Sub total and tax. + $y += 5; + $this->SetY($y); + $this->SetFont('helvetica','B',9); + $this->SetX($x+8); + $this->Cell(0,0,'Sub Total'); + $this->SetX($x+135); + $this->Cell(0,0,$this->_currency($inv->print['invoice']['total_amt']-$inv->print['invoice']['tax_amt']),0,0,'R'); + + $y += 5; + $this->SetY($y); + $this->SetX($x+8); + $this->Cell(0,0,'Taxes'); + $this->SetX($x+135); + $this->Cell(0,0,$this->_currency($inv->print['invoice']['tax_amt']),0,0,'R'); + + $y += 5; + $this->SetY($y); + $this->SetX($x+8); + $this->Cell(0,0,'Total Charges'); + $this->SetX($x+135); + $this->Cell(0,0,$this->_currency($inv->print['invoice']['total_amt']),0,0,'R'); + + $y += 5; + $this->SetY($y); + $this->SetX($x+8); + $this->Cell(0,0,'Payments Received'); + $this->SetX($x+135); + $this->Cell(0,0,$this->_currency($inv->print['invoice']['billed_amt']),0,0,'R'); + + $y += 5; + $this->SetY($y); + $this->SetX($x+8); + $this->Cell(0,0,'Balance Due'); + $this->SetX($x+135); + $this->Cell(0,0,$this->_currency($inv->print['invoice']['total_amt']-$inv->print['invoice']['billed_amt']),0,0,'R'); + } + } +} +?> diff --git a/modules/invoice/auth.inc.php b/modules/invoice/auth.inc.php index 59fea1f5..8588bf9b 100644 --- a/modules/invoice/auth.inc.php +++ b/modules/invoice/auth.inc.php @@ -1,13 +1,41 @@ - 'invoice', 'method' => 'user_search'), -Array ('module' => 'invoice', 'method' => 'user_search_show'), -Array ('module' => 'invoice', 'method' => 'user_view'), -Array ('module' => 'invoice', 'method' => 'pdf'), -Array ('module' => 'invoice', 'method' => 'checkoutnow'), -Array ('module' => 'invoice', 'method' => 'checkout_multiple_preview'), -Array ('module' => 'invoice', 'method' => 'custom_tracking'), -Array ('module' => 'invoice', 'method' => 'has_unpaid'), + + * @copyright 2009 Deon George + * @link http://osb.leenooks.net + * + * @link http://www.agileco.com/ + * @copyright 2004-2008 Agileco, LLC. + * @license http://www.agileco.com/agilebill/license1-4.txt + * @author Tony Landis + * @package AgileBill + * @subpackage Modules:Invoice + */ + +/** + * The main AgileBill Invoice Class + * + * @package AgileBill + */ + +$auth_methods = array ( + array('module'=>'invoice','method'=>'user_search'), + array('module'=>'invoice','method'=>'user_search_show'), + array('module'=>'invoice','method'=>'user_view'), + array('module'=>'invoice','method'=>'pdf'), + array('module'=>'invoice','method'=>'checkoutnow'), + array('module'=>'invoice','method'=>'tpl_checkout_multiple_preview'), + array('module'=>'invoice','method'=>'custom_tracking'), + array('module'=>'invoice','method'=>'has_unpaid'), ); -?> \ No newline at end of file +?> diff --git a/modules/invoice/invoice.inc.php b/modules/invoice/invoice.inc.php index 9bd17e72..57841819 100644 --- a/modules/invoice/invoice.inc.php +++ b/modules/invoice/invoice.inc.php @@ -1,346 +1,612 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Modules:Invoice */ - - + /** - * The main AgileBill Invoice Class + * The main AgileBill Invoice Class + * + * @package AgileBill + * @subpackage Modules:Invoice */ -class invoice -{ - /** Enable summary invoice view that rolls multiple instances of the same sku w/identical base&setup price & attributes into one line item */ - var $summarizeInvoice=true; - - /** - * Holds sku's of line items to exclude from invoice summarys (pdf view only) - * - * @var array - */ - var $summarizeInvoiceExclude; - +class invoice extends OSB_module { + # Array holding all our print information + public $print = array(); + # Enable summary invoice view that rolls multiple instances of the same sku w/identical base&setup price & attributes into one line item + private $summarizeInvoice = true; + # Holds sku's of line items to exclude from invoice summarys (pdf view only) + # @todo not implemented + private $summarizeInvoiceExclude = array(); + /** Invoice type, 0=new, 1=recurr */ var $type=0; - - /** Invoice Creation Timestamp */ - var $date_orig; - - /** Last modification Timestamp */ - var $date_last; - - /** Invoice Id */ - var $record_id; - - /** Invoice Item Id */ - var $item_id=1; - - /** Parent Invoice Id for recurring */ - var $parent_id; - - /** Account Id for invoice */ - var $account_id; - - /** Affiliate Id of Invoice */ - var $affiliate_id; - - /** Account Billing Id */ - var $account_billing_id; - - /** Campaign Id */ - var $campaign_id; - - /** Reseller Id */ - var $reseller_id; - /** Billed Currency Id */ - var $billed_currency_id; - - /** Actual Billed Currency selected by Client */ - var $actual_billed_currency_id; - - /** Checkout Plugin Id */ - var $checkout_plugin_id; - - /** Array of checkout plugin data returned by checkout plugin */ - var $checkout_plugin_data; - + # Invoice Creation Timestamp + private $date_orig; + # Last modification Timestamp + private $date_last; + # Invoice Id + # @todo change to invoice_id? + public $record_id; + + /** Invoice Item Id */ + private $item_id=0; + + # Parent Invoice Id for recurring + public $parent_id; + # Account Id for invoice + public $account_id; + # Affiliate Id of Invoice + public $affiliate_id; + # Account Billing Id + public $account_billing_id; + # Campaign Id + public $campaign_id; + # Reseller Id + public $reseller_id; + # Billed Currency Id + public $billed_currency_id; + # Actual Billed Currency selected by Client + public $actual_billed_currency_id; + # Checkout Plugin Id + public $checkout_plugin_id; + # array of checkout plugin data returned by checkout plugin + public $checkout_plugin_data; + /** Current Notice Count */ var $notice_count=0; - + /** Last Notice Timestamp */ - var $notice_date; - - /** Due Date Timestamp */ - var $due_date; - + var $notice_date; + + # Due Date Timestamp + private $due_date; + /** Net Term Id */ var $net_term_id=false; - + /** Net Term Last Notice/Late fee Timestamp */ var $net_term_date_last; - + /** Net Term Interval Count */ var $net_term_intervals=0; - - /** Process Status */ - var $process_status=0; - - /** Billing Status */ - var $billing_status=0; - + + # Process Status + private $process_status = 0; + # Billing Status + private $billing_status = 0; + /** Suspend Billing Status */ var $suspend_billing=0; - - /** Printed Invoice Status */ - var $print_status=0; - + + # Printed Invoice Status + private $print_status = 0; + /** Refunded Invoice Status */ var $refund_status=0; - + /** Calcuate Taxes */ - var $tax=true; + var $tax=true; /** Calculate Discounts */ - var $discount=true; - - /** Total Invoice Amount */ - var $total_amt=0; - - /** Total Amount Billed */ - var $billed_amt=0; - + var $discount=true; + + # Total Invoice Amount + public $total_amt = 0; + # Total Amount Billed + private $billed_amt = 0; + /** Actual total amount billed (converted to local) */ var $actual_billed_amt=0; - - /** Total Tax Amount */ - var $tax_amt=0; - - /** Total Discount Amount */ - var $discount_amt=0; - + + # Total Tax Amount + public $tax_amt = 0; + # Total Discount Amount + public $discount_amt = 0; + /** Recurring Amount */ - var $recur_amt; - - /** Recurring Array for Later Processing */ + public $recur_amt = 0; + + /** Recurring array for Later Processing */ var $recur_arr; - - /** IP Address of User */ - var $ip=USER_IP; - - /** Array of the Invoice items */ + + # IP Address of User + private $ip = USER_IP; + + /** array of the Invoice items */ var $invoice_item; - - /** Array of the discounts for the Invoice items */ + + /** array of the discounts for the Invoice items */ var $item_discount; - - /** Array of the taxes for the Invoice Items */ + + /** array of the taxes for the Invoice Items */ var $item_tax; - + /** Tracking to determine payment options */ var $any_new=false; var $any_trial=false; var $any_recurring=false; - + /** Invoice Config Global Options */ var $invoice_delivery=1; - var $invoice_format=0; - var $notice_max=MAX_BILLING_NOTICE; - var $grace_period=GRACE_PERIOD; - - - + var $invoice_format=0; + var $notice_max=MAX_BILLING_NOTICE; + var $grace_period=GRACE_PERIOD; + /** - * Get the global level invoice settings + * Determine the number of days in advance an invoice should be generated. + * Invoices are generated when the greater of: + * + system default (setup:max_inv_gen_period), (to be deprecated) + * + system default (setup_invoice:invoice_advance_gen), */ - function setupGlobal() { - $db=&DB(); - $invopt=$db->Execute(sqlSelect($db,"setup_invoice","*","")); - if($invopt && $invopt->RecordCount()) { - $this->invoice_delivery=$invopt->fields['invoice_delivery']; - $this->invoice_format=$invopt->fields['invoice_show_itemized']; + public function invoice_days() { + $db = &DB(); + + # Get the max invoice days from the setup_invoice table + $days = 0; + + # First from the setup table. + $setup = $db->Execute(sqlSelect($db,'setup','max_inv_gen_period','')); + if (isset($setup->fields['max_inv_gen_period'])) + $days = $setup->fields['max_inv_gen_period']; + + # Then from the setup_invoice table. + $setup = $db->Execute(sqlSelect($db,'setup_invoice','invoice_advance_gen,advance_notice','')); + if (isset($setup->fields['invoice_advance_gen']) && $setup->fields['invoice_advance_gen'] > $days) + $days = $setup->fields['invoice_advance_gen']; + + if (isset($setup->fields['advance_notice']) && $setup->fields['advance_notice'] > $days) + $days = $setup->fields['advance_notice']; + + return $days; + } + + /** + * Return the SQL that determines which invoices need to be generated + * + * Invoices are generated when the greater of: + * + system default (setup:max_inv_gen_period), (to be deprecated) + * + system default (setup_invoice:invoice_advance_gen), + * + the account setting (account:invoice_advance_gen) + * + the net_terms setting (net_term:invoice_advance_gen) (linked from the account:net_term_id)) + * + * This function can be called to display the SQL that is need to generate upcoming invoices. + * + * @param string The SQL to use in the SELECT portion of the query, to return the fields + * @param int Days in advance of the normal invoice generation date to obtain + * @param int|array Limit the query to just a(n) (set of) Account ID(s) + * @param string The SQL to use in the ORDER BY portion of the query. + */ + public function sql_invoice_soon($fields=null,$adddays=0,$account=null,$orderby=null) { + global $C_list; + + $db = &DB(); + + # Get the max invoice days from the system configuration tables. + $days = $this->invoice_days(); + + # Pre-notification date for service + $max_date = date('Y-m-d',time()+(($adddays+$days)*86400)); + + if ($account) { + if (is_array($account)) + $account_where = sprintf('AND account.id IN (%s)',implode(',',$account)); + else + $account_where = sprintf('AND account.id=%s',$account); + + } else + $account_where = ''; + + if (is_null($fields)) + $fields = "DISTINCT service.id AS sid,account.id AS aid,invoice.id AS iid,FROM_UNIXTIME(service.date_next_invoice,'%Y-%m-%d') AS invoice_date,service.sku AS sku,service.price AS price,account.first_name AS first_name,account.last_name AS last_name,account.currency_id AS billed_currency_id"; + + if (is_null($orderby)) + $orderby = 'ORDER BY aid,invoice_date,sid'; + + $p=AGILE_DB_PREFIX; $s=DEFAULT_SITE; + + // @todo NET_TERM is not tested. + if ($C_list->is_installed('net_term')) { + $net_term = "LEFT JOIN {$p}net_term AS net_term ON (account.net_term_id=net_term.id AND net_term.site_id={$s})"; + $net_term_where = "OR ((net_term.invoice_advance_gen!='' OR net_term.invoice_advance_gen IS NOT NULL) AND service.date_next_invoice<=((86400*(net_term.invoice_advance_gen+{$adddays}+{$days}))+(UNIX_TIMESTAMP(CURDATE()))))"; + } else { + $net_term = ''; + $net_term_where = ''; + } + + $sql = " +SELECT {$fields} +FROM {$p}service AS service +JOIN {$p}account AS account ON (service.account_id=account.id AND account.site_id={$s}) +LEFT JOIN {$p}invoice AS invoice ON (service.invoice_id=invoice.id AND invoice.site_id={$s}) +{$net_term} +WHERE service.site_id={$s} +AND service.active=1 +AND price > 0 +AND (service.suspend_billing IS NULL OR service.suspend_billing=0) +AND (service.date_next_invoice>0 AND service.date_next_invoice IS NOT NULL) +AND ( + ((account.invoice_advance_gen!='' OR account.invoice_advance_gen IS NOT NULL) AND service.date_next_invoice<=((86400*(account.invoice_advance_gen+{$adddays}+{$days}))+(UNIX_TIMESTAMP(CURDATE())))) +{$net_term_where} + OR service.date_next_invoice<=UNIX_TIMESTAMP('{$max_date}') +) +{$account_where} {$orderby}"; + + return $sql; + } + + /** + * List all invoices that will be generated soon + */ + public function invoicesoon($VAR) { + global $smarty,$C_list; + + $db = &DB(); + + # Then from the setup_invoice table. + $setup = $db->Execute(sqlSelect($db,'setup_invoice','advance_notice','')); + + # Run the database query + $result = $db->Execute($this->sql_invoice_soon(null,$setup->fields['advance_notice'])); + + $invoice = array(); + $i = 0; + $amount = 0; + while (! $result->EOF) { + $result->fields['_C'] = ++$i%2 ? 'row1' : 'row2'; + array_push($invoice,$result->fields); + $amount += $result->fields['price']; + $result->MoveNext(); + } + + # Error reporting + if ($result === false) { + global $C_debug; + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); + + return false; + } + + $results = $result->RecordCount(); + + # Create the definition for fast-forwarding to a single record: + if ($results == 1 && ! isset($this->fast_forward)) + $smarty->assign('record_id',$record_id); + + # Create the search record: + if($results > 0) { + # create the search record + include_once(PATH_CORE.'search.inc.php'); + $search = new CORE_search; + + $arr['module'] = $this->module; + $arr['sql'] = $this->sql_invoice_soon(); +# $arr['limit'] = $limit; +# $arr['order_by']= $order_by; + $arr['results'] = $results; + $search->add($arr); + + # define the search id and other parameters for Smarty + $smarty->assign('search_id', $search->id); + + # page: + $smarty->assign('page', '1'); + + # limit: +# $smarty->assign('limit', $limit); + + # order_by: +# $smarty->assign('order_by', $order_by); + } + + # define the result count + $smarty->assign('results',$results); + $smarty->assign('invoice',$invoice); + $smarty->assign('total_amount',$C_list->format_currency($amount,DEFAULT_CURRENCY)); + } + + public function task_overdue() { + $db = &DB(); + + $rs = $db->Execute($q=sqlSelect($db,array('invoice','account'),'A.id,A.account_id,SUM(A.total_amt-A.billed_amt) as total,B.first_name,B.last_name,A.due_date',sprintf('A.status=1 AND A.total_amt-A.billed_amt>0 AND A.account_id=B.id AND A.due_date<%s',time()),false,false,false,'account_id,id')); + if ($rs && $rs->RecordCount()) { + $body = ''; + $account_total = 0; + $account_id = ''; + $i = 0; + $count = 0; + $grand_total = 0; + while (! $rs->EOF) { + if ($account_id != $rs->fields['account_id'] && $i) { + $body .= sprintf("Total: %3.2f\n\n",$account_total); + $account_total = 0; + $i = 0; + } + + if (! $i) + $body .= sprintf("%s %s (%s)\n",$rs->fields['last_name'],$rs->fields['first_name'],$rs->fields['account_id']); + + $body .= sprintf(" Invoice: %s, Due Date: %s, Amount: %3.2f\n",$rs->fields['id'],date('Y-m-d',$rs->fields['due_date']),$rs->fields['total']); + $account_total += $rs->fields['total']; + $grand_total += $rs->fields['total']; + $account_id = $rs->fields['account_id']; + $count++; + $i++; + $rs->MoveNext(); + } + + if ($account_total) + $body .= sprintf("Total: %3.2f\n",$account_total); + + $body .= "\n"; + + if ($count || $ground_total) + $body .= sprintf("%3.2f outstanding in %s invoices\n",$grand_total,$count); + + # Send the e-mail.... + require_once(PATH_INCLUDES.'phpmailer/class.phpmailer.php'); + $mail = new PHPMailer(); + + $mail->AddAddress('deon@leenooks.vpn','Deon George'); + $mail->From = SITE_EMAIL; + $mail->FromName = SITE_NAME; + $mail->Subject = 'Overdue invoices'; + $mail->Body = $body; + $mail->Send(); } } - + /** + * Get a list of unpaid invoices for an account + */ + public function unpaid($account_id) { + $db = &DB(); + $invoices = array(); + $rs = $db->Execute($q=sqlSelect($db,'invoice','id,SUM(total_amt-billed_amt) as total',array('account_id'=>$account_id,'billing_status'=>0,'refund_status'=>0),false,false,'','id')); + + if ($rs && $rs->RecordCount()) { + while (! $rs->EOF) { + $invoices[$rs->fields['id']] = $rs->fields['total']; + $rs->MoveNext(); + } + } + + return $invoices; + } + /** * Get the account level invoice options * * @param int $id Account Id */ - function setupAccount() { - if(!$this->account_id) return; - $db=&DB(); - $acctrs=$db->Execute(sqlSelect($db,"account","invoice_grace,invoice_advance_gen","id=$this->account_id")); - if($acctrs && $acctrs->RecordCount()) { - $this->advance_gen=$acctrs->fields['invoice_advance_gen']; - if($this->grace_period == GRACE_PERIOD && !empty($acctrs->fields['invoice_grace'])) $this->grace_period=$acctrs->fields['invoice_grace']; - } - } - + private function setupAccount() { + if (! $this->account_id) + return; + + $db = &DB(); + $acctrs = $db->Execute(sqlSelect($db,'account','invoice_grace,invoice_advance_gen',sprintf('id=%s',$this->account_id))); + if ($acctrs && $acctrs->RecordCount()) { + $this->advance_gen = $acctrs->fields['invoice_advance_gen']; + + if ($this->grace_period == GRACE_PERIOD && ! empty($acctrs->fields['invoice_grace'])) + $this->grace_period = $acctrs->fields['invoice_grace']; + } + } + + /** + * Return the invoice ID + */ + public function getInvoiceID() { + return sprintf('%02s-%06s-%06s',DEFAULT_SITE,$this->print['account']['id'],$this->getInvoiceNum()); + } + + public function getInvoiceNum() { + return $this->print['invoice']['id']; + } + + public function getPreviousBalance() { + static $bal = 0; + + if ($bal) + return $bal; + + foreach ($this->print['previousinvoices'] as $item) + $bal += $item['total_amt']-$item['billed_amt']; + + return $bal; + } + /** * Initialize new invoice creation * * @param bool $type 0=new 1=recur */ - function initNew($type=0) { - $this->type=$type; - $this->date_orig=time(); - $this->date_last=time(); - + public function initNew($type=0) { + $this->type = $type; + $this->date_orig = time(); + $this->date_last = time(); + global $C_list; - $this->net_term = $C_list->is_installed('net_term'); - - // get account invoice defaults - $this->setupAccount(); + $this->net_term = $C_list->is_installed('net_term'); } - + +/** HERE **/ /** * Commit the current invoice/items/discounts/taxes * * @param object $taxObj Object for Tax Calculation - * @param object $discountObj Object for Discount Calculation - * @param bool $email Send customer/admin e-mails + * @param object $discountObj Object for Discount Calculation + * @param bool $email Send customer/admin e-mails */ function commitNew(&$taxObj, &$discountObj, $email=true) { - - // init DB transaction - $db=&DB(); + # init DB transaction + $db = &DB(); $db->BeginTrans(); - - // get invoice id - if(empty($this->record_id)) $this->record_id = sqlGenID($db,"invoice"); - - // serialized records: - if(is_array($this->checkout_plugin_data)) $this->checkout_plugin_data=serialize($this->checkout_plugin_data); - if(is_array($this->recur_arr)) $this->recur_arr=serialize($this->recur_arr); - - // dates & defaults - if(empty($this->due_date)) $this->due_date=time(); - if(empty($this->date_orig)) $this->date_orig=time(); - if(empty($this->date_last)) $this->date_last=time(); - if(empty($this->notice_next_date)) $this->notice_next_date=$this->due_date+86400; - - // net terms - if ($this->net_term && !$this->billing_status && $this->total_amt>0) { + + # Get invoice id + if (empty($this->record_id)) + $this->record_id = sqlGenID($db,'invoice'); + + # Serialized records: + if (is_array($this->checkout_plugin_data)) + $this->checkout_plugin_data=serialize($this->checkout_plugin_data); + if (is_array($this->recur_arr)) + $this->recur_arr=serialize($this->recur_arr); + + # Dates & defaults + if (empty($this->due_date)) + $this->due_date = time(); + if (empty($this->date_orig)) + $this->date_orig = time(); + if (empty($this->date_last)) + $this->date_last = time(); + if (empty($this->notice_next_date)) + $this->notice_next_date = $this->due_date+86400; + + # net terms + if ($this->net_term && ! $this->billing_status && $this->total_amt>0) { include_once(PATH_MODULES.'net_term/net_term.inc.php'); - $net=new net_term; + $net = new net_term; + $this->net_term_id = $net->termsAllowed($this->account_id, $this->checkout_plugin_id); - if(empty($this->net_term_date_last)) $this->net_term_date_last=time(); - } - - // insert invoice - $fields=Array( + if (empty($this->net_term_date_last)) + $this->net_term_date_last = time(); + } + + # Insert invoice + $fields=array( 'date_orig'=>$this->date_orig, - 'date_last'=>$this->date_last, - 'parent_id'=>$this->parent_id, - 'type'=>$this->type, - 'process_status'=>$this->process_status, - 'billing_status'=>$this->billing_status, - 'suspend_billing'=>$this->suspend_billing, - 'refund_status'=>$this->refund_status, - 'print_status'=>$this->print_status, - 'account_id'=>$this->account_id, - 'account_billing_id'=>$this->account_billing_id, - 'affiliate_id'=>$this->affiliate_id, - 'campaign_id'=>$this->campaign_id, - 'reseller_id'=>$this->reseller_id, - 'checkout_plugin_id'=>$this->checkout_plugin_id, + 'date_last'=>$this->date_last, + 'parent_id'=>$this->parent_id, + 'type'=>$this->type, + 'process_status'=>$this->process_status, + 'billing_status'=>$this->billing_status, + 'suspend_billing'=>$this->suspend_billing, + 'refund_status'=>$this->refund_status, + 'print_status'=>$this->print_status, + 'account_id'=>$this->account_id, + 'account_billing_id'=>$this->account_billing_id, + 'affiliate_id'=>$this->affiliate_id, + 'campaign_id'=>$this->campaign_id, + 'reseller_id'=>$this->reseller_id, + 'checkout_plugin_id'=>$this->checkout_plugin_id, 'checkout_plugin_data'=>$this->checkout_plugin_data, - 'tax_amt'=>$this->tax_amt, - 'discount_amt'=>$this->discount_amt, - 'total_amt'=>$this->total_amt, - 'billed_amt'=>$this->billed_amt, - 'recur_amt'=>$this->recur_amt, - 'recur_arr'=>$this->recur_arr, - 'actual_billed_amt'=>$this->actual_billed_amt, - 'billed_currency_id'=>$this->billed_currency_id, - 'actual_billed_currency_id'=>$this->actual_billed_currency_id, - 'notice_count'=>$this->notice_count, - 'notice_max'=>$this->notice_max, + 'tax_amt'=>$this->tax_amt, + 'discount_amt'=>$this->discount_amt, + 'total_amt'=>$this->total_amt, + 'billed_amt'=>$this->billed_amt, + 'recur_amt'=>$this->recur_amt, + 'recur_arr'=>$this->recur_arr, + 'actual_billed_amt'=>$this->actual_billed_amt, + 'billed_currency_id'=>$this->billed_currency_id, + 'actual_billed_currency_id'=>$this->actual_billed_currency_id, + 'notice_count'=>$this->notice_count, + 'notice_max'=>$this->notice_max, 'notice_next_date'=>$this->notice_next_date, - 'due_date'=>$this->due_date, - 'grace_period'=>$this->grace_period, - 'net_term_id'=>$this->net_term_id, - 'net_term_date_last'=>$this->net_term_date_last, - 'net_term_intervals'=>$this->net_term_intervals, - 'ip'=>$this->ip + 'due_date'=>$this->due_date, + 'grace_period'=>$this->grace_period, + 'net_term_id'=>$this->net_term_id, + 'net_term_date_last'=>$this->net_term_date_last, + 'net_term_intervals'=>$this->net_term_intervals, + 'ip'=>$this->ip ); - $db->Execute($sql=sqlInsert($db, "invoice", $fields, $this->record_id)); - - // loop through invoice items - if(is_array($this->invoice_item)) { - foreach($this->invoice_item as $id=>$fields) { - // get an invoice_item id - $invoice_item_id = sqlGenID($db, "invoice_item"); - - // domain sku's + $db->Execute(sqlInsert($db,'invoice',$fields,$this->record_id)); + + # Loop through invoice items + if (is_array($this->invoice_item)) { + foreach ($this->invoice_item as $id=>$fields) { + # Get an invoice_item id + $invoice_item_id = sqlGenID($db,'invoice_item'); + + # Domain sku's if ($fields['item_type'] == 2) { - $fields['sku'] = "DOMAIN-".strtoupper($fields['domain_type']); + $fields['sku'] = sprintf('DOMAIN-%s',strtoupper($fields['domain_type'])); $fields['price_type'] = '0'; } - - // build e-mail item details - if($email) { - $email_instructions=''; - if($fields['item_type']<2 && !empty($fields['product_id'])) { + + # Build e-mail item details + if ($email) { + $email_instructions = ''; + + if ($fields['item_type']<2 && !empty($fields['product_id'])) { // product, get email instructions and translated name - $translate_prod=$db->Execute(sqlSelect($db,"product_translate","email_template,name","product_id={$fields['product_id']} and language_id=::".SESS_LANGUAGE."::")); - if($translate_prod && $translate_prod->RecordCount()) { + $translate_prod = $db->Execute( + sqlSelect($db,'product_translate','email_template,name',array('product_id'=>$fields['product_id'],'language_id'=>SESS_LANGUAGE))); + + if ($translate_prod && $translate_prod->RecordCount()) { $instructions=$translate_prod->fields['email_template']; $name=$translate_prod->fields['name']; + } else { - $name=$fields["sku"]; + $name = $fields['sku']; } - } elseif ($fields['item_type'] == 2) { + + } elseif ($fields['item_type'] == 2) { $name=strtoupper($fields['domain_name'].".".$fields['domain_tld']); + } else { - if(!empty($fields['product_name'])) $name=$fields['product_name']; else $name=$fields['sku']; + if (! empty($fields['product_name'])) + $name = $fields['product_name']; + else + $name = $fields['sku']; } - // add to e-mail array - $email_arr[] = array('Qty' => '('.$fields["quantity"].')', 'Item' => 'SKU '.$fields["sku"], 'Price' => number_format($fields["total_amt"],2), 'Name' => $name, 'Instructions' => $instructions); - } - - // insert the invoice item_id + + // add to e-mail array + $email_arr[] = array('Qty' => '('.$fields["quantity"].')', 'Item' => 'SKU '.$fields["sku"], 'Price' => number_format($fields["total_amt"],2), 'Name' => $name, 'Instructions' => $instructions); + } + + // insert the invoice item_id $fields['invoice_id']=$this->record_id; $fields['date_orig']=time(); $attr = serialize($fields['product_attr']); $fields['product_attr']=$fields['product_attr_cart']; - $fields['product_attr_cart']=$attr; - $db->Execute($sql=sqlInsert($db, "invoice_item", $fields, $invoice_item_id)); - + $fields['product_attr_cart']=$attr; + $db->Execute(sqlInsert($db,'invoice_item',$fields,$invoice_item_id)); + + # Load tax object for tax calculation + include_once(PATH_MODULES.'tax/tax.inc.php'); + $taxObj = new tax; + + # Load discount object for discount calculation + include_once(PATH_MODULES.'discount/discount.inc.php'); + $discountObj = new discount; + $discountObj->available_discounts($this->account_id); + // insert taxes - if($this->tax && $this->tax_amt > 0 && !empty($this->tax_arr[$id])) { - $taxObj->invoice_item($this->record_id, $invoice_item_id, $this->account_id, $this->tax_arr[$id]); - } - + if ($this->tax && $this->tax_amt > 0 && ! empty($this->tax_arr[$id])) + $taxObj->invoice_item($this->record_id,$invoice_item_id,$this->account_id,$this->tax_arr[$id]); + // insert discounts - if($this->discount && $this->discount_amt>0 && !empty($this->discount_arr[$id])) { - $discountObj->invoice_item($this->record_id, $invoice_item_id, $this->account_id, $this->discount_arr[$id]); - } + if($this->discount && $this->discount_amt>0 && !empty($this->discount_arr[$id])) + $discountObj->invoice_item($this->record_id, $invoice_item_id, $this->account_id, $this->discount_arr[$id]); } } - + // complete DB transaction $db->CompleteTrans(); - + // complete building e-mail notices and send - if($email) { + if ($email) { include_once(PATH_MODULES.'email_template/email_template.inc.php'); - + // Create the products order list for the e-mail: $e_itm_usr = ''; $e_itm_adm = ''; @@ -348,28 +614,28 @@ class invoice foreach($email_arr as $i=>$em) { $e_itm_usr .= $em['Qty'].' '.$em['Item'].' ('.$em['Name'].') '.$em['Price']; $e_itm_adm .= $em['Qty'].' '.$em['Item'].' ('.$em['Name'].') '.$em['Price']."\r\n"; - if(!empty($email_arr[$i]['Instructions'])) $e_itm_usr .= "\r\n * " . $email_item_arr[$i]['Instructions']; - $e_itm_usr .= "\r\n"; - } - $e_arr_user = Array('%products%' => $e_itm_usr); - $e_arr_adm = Array('%products%' => $e_itm_adm); + if(!empty($email_arr[$i]['Instructions'])) $e_itm_usr .= "\r\n * " . $email_item_arr[$i]['Instructions']; + $e_itm_usr .= "\r\n"; + } + $e_arr_user = array('%products%' => $e_itm_usr); + $e_arr_adm = array('%products%' => $e_itm_adm); } - - // e-mail invoice creation confirmation + + // e-mail invoice creation confirmation $mail = new email_template; - $mail->send('invoice_confirm_user', $this->account_id, $this->record_id, $this->checkout_plugin_id, $e_arr_user); + $mail->send('invoice_confirm_user', $this->account_id, $this->record_id, $this->checkout_plugin_id, $e_arr_user); $email = new email_template; - $email->send('admin->invoice_confirm_admin', $this->account_id, $this->record_id, $this->checkout_plugin_id, $e_arr_adm); + $email->send('admin->invoice_confirm_admin', $this->account_id, $this->record_id, $this->checkout_plugin_id, $e_arr_adm); } - + // net terms? if($this->net_term_id) { - $this->approveInvoice(array('id'=>$this->record_id), $this); + $this->approveInvoice(array('id'=>$this->record_id), $this); return $this->record_id; - } - + } + // Determine the approval status by checkout plugin type & settings: - if($email && $this->billing_status == 0 && $this->billed_amt > 0 ) { + if($email && $this->billing_status == 0 && $this->billed_amt > 0) { global $C_list; if($this->checkout_type == 'redirect') { // User e-mail alert of due invoice @@ -380,7 +646,7 @@ class invoice $email = new email_template; $email->send('admin->invoice_due_admin', $this->account_id, $this->record_id, $admin_currency, $C_list->date($this->due_date)); } - } elseif($this->billed_amt>0 ) { + } elseif($this->billed_amt>0) { if($email) { // User alert of payment processed $email = new email_template; @@ -390,196 +656,230 @@ class invoice $email->send('admin->invoice_paid_admin', $this->account_id, $this->record_id, $this->billed_currency_id, ''); } $this->autoApproveInvoice($this->record_id); - } elseif($this->billed_amt == 0 && $this->billing_status == 1 ) { + } elseif($this->billed_amt == 0 && $this->billing_status == 1) { $this->autoApproveInvoice($this->record_id); } - + // return invoice id return $this->record_id; } - + /** * Add an invoice item * * @param int $id Reference ID for use in Cart or false - * @param object $taxObj Object for Tax Calculation - * @param object $discountObj Object for Discount Calculation - * @param int $item_type 0/1=Product/Service/Hosting 2=Domain 3=Add Hoc - * @param string $taxable True, False, or 'validate' to locate the specified $product id and verify - * @param int $service_id If this is for a service upgrade, this will be defined - * @param int $parent_id Item Parent Id - * @param int $product_id Item Product Id - * @param array $product_attr Item attributes from the cart/prev service - * @param string $product_name Item product name - * @param string $sku Item Product SKU - * @param int $quantity Item Quantity - * @param float $price_base Item Base price - * @param float $price_setup Item Setup Price - * @param float $discount_manual Ad Hoc Discount Amount - * @param int $recurring_schedule Item recurring schedule, 0=week, 1=month, 2=quarter, 3=semi-annual, 4=annual, 5=bi-year - * @param int $date_start Date service started - * @param int $date_stop Date service stops - * @param string $domain_name Domain name - * @param string $domain_tld Domain TLD - * @param int $domain_term Domain Term - * @param string $domain_type Domain Type (register, transfer, renew, park, ns_transfer) + * @param object $cartrs RS from cart query */ - function addItem($id, &$taxObj, &$discountObj, $item_type, $taxable=false, $service_id=false, $parent_id=false, $product_id=false, $product_attr=false, $product_name=false, $sku=false, $quantity=1, $price_base=false, $price_setup=false, $discount_manual=false, $recurring_schedule=false, $date_start=false, $date_stop=false, $domain_name=false, $domain_tld=false, $domain_term=false, $domain_type=false) { - $tax_amt=0; - $total_amt=0; - $discount_amt=0; - - // define correct qty - if($quantity<=0) $quantity=1; - - // determine the reference id for this item - if($id>0) { - $this->item_id=$id; + public function addItem($id,$cartrs) { + # Setup Variables + $item_type = $cartrs->fields['cart_type']; + $product_id = $cartrs->fields['product_id']; + $recurring_schedule = $cartrs->fields['recurr_schedule']; + $domain_tld = $cartrs->fields['domain_tld']; + $domain_term = $cartrs->fields['domain_term']; + $domain_type = $cartrs->fields['domain_type']; + + # Define correct qty + if ($cartrs->fields['quantity']<0) + $quantity = 1; + else + $quantity = $cartrs->fields['quantity']; + + if (! empty($cartrs->fields['product_attr']) && ! is_array($cartrs->fields['product_attr'])) + $product_attr = unserialize($result->fields['product_attr']); + else + $product_attr = array(); + + # Special processing for ADHOC items + if ($item_type == 3) { + $taxable = $cartrs->fields['cart_type']; + $product_name = $cartrs->fields['ad_hoc_name']; + $sku = $cartrs->fields['ad_hoc_sku']; + $price_base = $cartrs->fields['ad_hoc_amount']; + $price_setup = $cartrs->fields['ad_hoc_setup']; + $discount_manual = $cartrs->fields['ad_hoc_discount']; + } else { + $taxable = false; + $product_name = ''; + $sku = ''; + $price_base = false; + $price_setup = false; + $discount_manual = false; + } + + $tax_amt = 0; + $total_amt = 0; + $discount_amt = 0; + $item = null; + + # Load tax object for tax calculation + include_once(PATH_MODULES.'tax/tax.inc.php'); + $taxObj = new tax; + + # Load discount object for discount calculation + include_once(PATH_MODULES.'discount/discount.inc.php'); + $discountObj = new discount; + $discountObj->available_discounts($this->account_id); + + # Determine the reference id for this item + if ($id>0) + $this->item_id=$id; + else $this->item_id++; - } - - // get the product details - if($product_id && $item_type<2) { - $db=&DB(); - $product=$db->Execute(sqlSelect($db,"product","*","id=$product_id")); - if($product && $product->RecordCount()) { - $taxable = $product->fields['taxable']; - $this->product["$this->item_id"] = $product->fields; - } - - // get the tld details - } elseif($item_type==2) { - $db=&DB(); - $tld=$db->Execute(sqlSelect($db,"host_tld","*","name=::$domain_tld::")); - if($tld && $tld->RecordCount()) - $taxable = $tld->fields['taxable']; - } - - // get the product pricing details if product - $price_type=0; - if($price_base===false && $price_setup===false && $product_id && $item_type<2) { - if($product && $product->RecordCount()) { - $price_type=$product->fields['price_type']; - $sku=$product->fields['sku']; - include_once(PATH_MODULES.'product/product.inc.php'); - $productObj=new product; - // get pricing for this product: - $prod_price = $productObj->price_prod($product->fields, $recurring_schedule, $this->account_id); - $price_base = $prod_price["base"]; - $price_setup = $prod_price["setup"]; - - // calculate any product attributes fees - $attr_price = $productObj->price_attr($product->fields, $product_attr, $recurring_schedule, $this->account_id); - $price_base += $attr_price["base"]; - $price_setup += $attr_price["setup"]; + if ($product_id) { + include_once(PATH_MODULES.'product/product.inc.php'); + $item_object = new product; - // determine price type for checkout - if ($product->fields["price_type"] == '0') - $this->any_new=true; - else if ($product->fields["price_type"] == '1') - $this->any_recurring=true; - else if ($product->fields["price_type"] == '2') - $this->any_trial=true; - - } else { - $this->any_new=true; - } - } else { - $this->any_new=true; + $item = $item_object->getID($product_id); + $this->product[$this->item_id] = $item; } - - // get the TLD pricing details if domain - if($price_base===false && $price_setup===false && $domain_tld && $domain_term && $domain_type) { - include_once(PATH_MODULES.'host_tld/host_tld.inc.php'); - $tldObj = new host_tld; - $tldprice = $tldObj->price_tld_arr($domain_tld, $domain_type, false, false, false, $this->account_id); - if($domain_type == "park") { - $price_base = $tldprice; - } else { - $price_base = $tldprice["$domain_term"]; - $this->tld_arr["$this->item_id"] = $tldprice; - } + + switch ($item_type) { + # Get the tld details + case '2': + include_once(PATH_MODULES.'host_tld/host_tld.inc.php'); + $item_object = new host_tld; + + $item = $item_object->getName($domain_tld); + + # Get the TLD pricing + if ($price_base===false && $price_setup===false && $domain_tld && $domain_term && $domain_type) { + $tldprice = $item_object->price_tld_arr($domain_tld,$domain_type,false,false,false,$this->account_id); + + if ($domain_type == 'park') { + $price_base = $tldprice; + } else { + $price_base = $tldprice[$domain_term]; + $this->tld_arr[$this->item_id] = $tldprice; + } + } + + $price_recur = $price_base; + + break; + + default: + # Get the product pricing + $price_type = 0; + if ($price_base===false && $price_setup===false && $this->product[$this->item_id]) { + $price_type = $this->product[$this->item_id]['price_type']; + $sku = $this->product[$this->item_id]['sku']; + + # Get pricing for this product: + $prod_price = $item_object->price_prod($this->product[$this->item_id],$recurring_schedule,$this->account_id); + $price_base = $prod_price['base']; + $price_setup = $prod_price['setup']; + + $prod_price = $item_object->price_prod($this->product[$this->item_id],$recurring_schedule,$this->account_id,false); + $price_recur = $prod_price['base']; + + # Calculate any product attributes fees + $attr_price = $item_object->price_attr($this->product[$this->item_id],$product_attr,$recurring_schedule,$this->account_id); + $price_base += $attr_price['base']; + $price_setup += $attr_price['setup']; + # @todo this cant be the right value for recurring addons? + $price_recur += $attr_price['base']; + + # Determine price type for checkout + switch ($price_type) { + case 0: $this->any_new = true; break; + case 1: $this->any_recurring = true; break; + case 2: $this->any_trial = true; break; + } + + } else { + $this->any_new = true; + $price_recur = $price_base; + } + + break; } - - // set total amount for this line item before attributes, taxes, or discounts + + if ($item && isset($item['taxable'])) + $taxable = $item['taxable']; + + # Set total amount for this line item before attributes, taxes, or discounts $price_base *= $quantity; $price_setup *= $quantity; - $total_amt = ($price_setup + $price_base); - - // format product attributes for storage - $product_attr_cart=false; - if(($item_type==0 || $item_type>2) && is_array($product_attr)) $product_attr_cart = $this->get_product_attr_cart($product_attr); - - // recurring taxes and arrays - if($price_base>0 && $price_type==1) - { - // increment the total invoice recurring amount - $this->recur_amt += $price_base; - - // determine taxes for the recurring amount - if($this->tax && $taxable && $price_base>0 && $this->account_id) { - $recur_tax_arr = $taxObj->calculate($price_base, $this->country_id, $this->state); - if(is_array($recur_tax_arr)) foreach($recur_tax_arr as $tx) $this->recur_amt += $tx['rate']; - } - - // get the recurring arrays for price and invoice - if($product && $product->RecordCount()) { - $this->price_arr["$this->item_id"] = $productObj->price_recurr_arr($product->fields, $this->account_id); - $this->recur_arr[] = Array ( + $total_amt = ($price_setup+$price_base); + +//echo '
    ';print_r(array('q'=>$quantity,'pb'=>$price_base,'pt'=>$price_type,'pr'=>$price_recur,'id'=>$id,'iid'=>$this->item_id,'p'=>$product->fields));
    +
    +		# Format product attributes for storage
    +		$product_attr_cart = false;
    +		if (($item_type==0 || $item_type>2) && is_array($product_attr))
    +			$product_attr_cart = $this->get_product_attr_cart($product_attr);
    +
    +		# Recurring taxes and arrays
    +		if (($price_recur || $price_base) && $price_type==1) {
    +			$this->recur_amt += $price_recur;
    +
    +			# Determine taxes for the recurring amount
    +			if ($this->tax && $taxable && $price_recur>0 && $this->account_id) {
    +				$recur_tax_arr = $taxObj->calculate($price_recur,$this->country_id,$this->state);
    +				if (is_array($recur_tax_arr))
    +					foreach ($recur_tax_arr as $tx)
    +						$this->recur_amt += $tx['rate'];
    +			}
    +
    +			# Get the recurring arrays for price and invoice
    +			if ($item_object) {
    +				$this->price_arr[$this->item_id] = $item_object->price_recurr_arr($this->product[$this->item_id],$this->account_id);
    +				$this->recur_arr[] = array(
     					'price' 		 => $price_base*$quantity,
     					'recurr_schedule'=> $recurring_schedule,
    -					'recurr_type' 	 => $product->fields['price_recurr_type'],
    -					'recurr_weekday' => $product->fields['price_recurr_weekday'],
    -					'recurr_week' 	 => $product->fields['price_recurr_week']
    -				);		
    -			}	 								
    +					'recurr_type' 	 => $this->product[$this->item_id]['price_recurr_type'],
    +					'recurr_weekday' => $this->product[$this->item_id]['price_recurr_weekday'],
    +					'recurr_week' 	 => $this->product[$this->item_id]['price_recurr_week']
    +				);
    +			}
     		}
    -		 			
    -		// calculate any ad-hoc line item level (admin) discounts
    -		if($this->discount && $discount_manual>0) {
    +
    +		# Calculate any ad-hoc line item level (admin) discounts
    +		if ($this->discount && $discount_manual>0) {
     			$total_amt -= $discount_manual;
     			$discount_amt += $discount_manual;
    -			$this->discount_amt += $discount_amt; 
    +			$this->discount_amt += $discount_amt;
     			$discountObj->add_manual_discount($discount_manual,'MISC',$this->item_id);
     		}
    -				
    -		// account level discounts
    -		if($this->discount && $this->account_id)  {		
    -			// calculate any database level discounts for this item (both account specific and session specific)
    -			$discount_amt = $discountObj->calc_all_discounts(0, $this->item_id, $product_id, $total_amt, $this->account_id, $this->total_amt+$total_amt);
    -			$total_amt -= $discount_amt; 
    -			$this->discount_amt += $discount_amt; 			
    +
    +		# Account level discounts
    +		if ($this->discount && $this->account_id) {
    +			# Calculate any database level discounts for this item (both account specific and session specific)
    +			$discount_amt = $discountObj->calc_all_discounts(0,$this->item_id,$product_id,$total_amt,$this->account_id,$this->total_amt+$total_amt);
    +			$total_amt -= $discount_amt;
    +			$this->discount_amt += $discount_amt;
     		}
    -				
    -		// add to total discount array
    -		if(is_array($discountObj->discount_arr)) {
    -			$this->discount_arr["$this->item_id"] = $discountObj->discount_arr;
    +
    +		# Add to total discount array
    +		if (is_array($discountObj->discount_arr)) {
    +			$this->discount_arr[$this->item_id] = $discountObj->discount_arr;
     		}
    -		
    -		// increment invoice total amount
    +
    +		# Increment invoice total amount
     		$this->total_amt += $total_amt;
    - 
    -		// calculate any taxes for current item 
    -		if($this->tax && $taxable && $total_amt>0 && $this->account_id) {  
    -			$tax_arr = $taxObj->calculate($total_amt, $this->country_id, $this->state);				   
    +
    +		// calculate any taxes for current item
    +		if ($this->tax && $taxable && $total_amt>0 && $this->account_id) {
    +			$tax_arr = $taxObj->calculate($total_amt, $this->country_id, $this->state);
     			if(is_array($tax_arr)) {
    -				foreach($tax_arr as $tx) $tax_amt += $tx['rate']; 
    -				$this->item_tax["$this->item_id"] = $tax_arr;
    -				$this->tax_arr["$this->item_id"] = $tax_arr; 
    +				foreach($tax_arr as $tx) $tax_amt += $tx['rate'];
    +				$this->item_tax[$this->item_id] = $tax_arr;
    +				$this->tax_arr[$this->item_id] = $tax_arr;
     			}
     			$this->tax_amt += $tax_amt;
    -			$this->total_amt += $tax_amt;		
    +			$this->total_amt += $tax_amt;
     		}
    -		
    +
     		// store the fields to an array
    -		$this->invoice_item["$this->item_id"]=Array(
    +		$this->invoice_item[$this->item_id] = array(
     			'item_type'=>$item_type,
     			'price_type'=>$price_type,
     			'taxable'=>$taxable,
    -			'service_id'=>$service_id,
    -			'parent_id'=>$parent_id,
    +			'service_id'=>$cartrs->fields['service_id'],
    +			'parent_id'=>$cartrs->fields['parent_id'],
     			'product_id'=>$product_id,
     			'product_attr'=>$product_attr,
     			'product_attr_cart'=>$product_attr_cart,
    @@ -589,58 +889,58 @@ class invoice
     			'price_base'=>$price_base,
     			'price_setup'=>$price_setup,
     			'recurring_schedule'=>$recurring_schedule,
    -			'date_start'=>$date_start,
    -			'date_stop'=>$date_stop,
    -			'domain_name'=>$domain_name,
    +			'date_start'=>'',
    +			'date_stop'=>'',
    +			'domain_name'=>$cartrs->fields['domain_name'],
     			'domain_tld'=>$domain_tld,
     			'domain_term'=>$domain_term,
    -			'domain_type'=>$domain_type, 
    +			'domain_type'=>$domain_type,
     			'total_amt'=>$total_amt,
     			'tax_amt'=>$tax_amt,
     			'discount_amt'=>$discount_amt
     		);
     	}
    -	
    +
     	/**
     	 * Group all taxes to lump sums
     	 */
    -	function group_taxes() { 
    +	public function group_taxes() {
     		if(is_array($this->tax_arr)) {
    -			foreach($this->tax_arr as $taxarr) foreach($taxarr as $taxes) $arr[$taxes["name"]]+=$taxes["rate"];  
    +			foreach($this->tax_arr as $taxarr) foreach($taxarr as $taxes) $arr[$taxes["name"]]+=$taxes["rate"];
     			if(is_array($arr)) {
    -				foreach($arr as $a=>$b) $ret[] = Array('name'=>$a, 'rate'=>$b);	
    -				return $ret;		 
    -			} 
    -		} 
    +				foreach($arr as $a=>$b) $ret[] = array('name'=>$a, 'rate'=>$b);
    +				return $ret;
    +			}
    +		}
     	}
    -	  
    +
     	/**
     	 * Group all discounts to lump sums
     	 */
    -	function group_discounts() { 
    -		if(is_array($this->discount_arr)) { 
    -			foreach($this->discount_arr as $discarr) foreach($discarr as $discounts) $arr[$discounts["discount"]]+=$discounts["amount"];  
    +	public function group_discounts() {
    +		if(is_array($this->discount_arr)) {
    +			foreach($this->discount_arr as $discarr) foreach($discarr as $discounts) $arr[$discounts["discount"]]+=$discounts["amount"];
     			if(is_array($arr)) {
    -				foreach($arr as $a=>$b) $ret[] = Array('name'=>$a, 'total'=>$b);	
    -				return $ret;		 
    +				foreach($arr as $a=>$b) $ret[] = array('name'=>$a, 'total'=>$b);
    +				return $ret;
     			}
    -		} 
    -	}	
    -	
    +		}
    +	}
    +
     	/**
     	 * Build a formatted product attribute list
     	 *
     	 * @param array $attributes
     	 * @return string Formatted product attribute list
     	 */
    -	function get_product_attr_cart($attributes) {
    +	public function get_product_attr_cart($attributes) {
     		# Set the attribute array:
     		if(!empty($attributes) && is_array($attributes)) {
     			$db=&DB();
    -			$product_attr = false; 
    +			$product_attr = false;
     			foreach($attributes as $id=>$value) {
     				if (!empty($value)) {
    -					if(is_numeric($id)) { 
    +					if(is_numeric($id)) {
     						$attr = $db->Execute(sqlSelect($db,"product_attr","name","id=$id"));
     						if ($attr && $attr->RecordCount()) $product_attr .= "{$attr->fields['name']}==".ereg_replace("\r\n", "
    ", $value)."\r\n"; } else { @@ -651,95 +951,82 @@ class invoice } return $product_attr; } - - - - /** Custom Tracking - */ - function custom_tracking($VAR) - { + + /** + * Custom Tracking + * @todo: should this be here, or under the affilate module? what does it do? + */ + public function custom_tracking($VAR) { # Get the invoice id - if(SESS_LOGGED == false) - return false; + if (SESS_LOGGED == false) + return false; # Check if we are in the iframe - if(empty($VAR['_escape']) || empty($VAR['confirm'])) - { - echo ''; + if (empty($VAR['_escape']) || empty($VAR['confirm'])) { + printf('', + md5(microtime())); return; } # Get the un-tracked invoice details $db = &DB(); - $sql = "SELECT * FROM ".AGILE_DB_PREFIX."invoice WHERE - ( custom_affiliate_status IS NULL OR - custom_affiliate_status = 0 ) - AND billing_status = ".$db->qstr(1)." - AND site_id = ".$db->qstr(DEFAULT_SITE)." - AND account_id = ".$db->qstr(SESS_ACCOUNT); - $result = $db->Execute($sql); + + $result = $db->Execute(sqlSelect($db,'invoice','*',sprintf('(custom_affiliate_status IS NULL OR custom_affiliate_status=0) AND billing_status=1 AND account_id=%s',SESS_ACCOUNT))); if ($result === false) { global $C_debug; - $C_debug->error('','', $db->ErrorMsg(). "\r\n\r\n". $sql); + $C_debug->error(__FILE__,__METHOD__,sprintf('%s (%s)',$db->ErrorMsg(),$sql)); + return false; } - if($result->RecordCount() == 0) { - echo 'none'; + + if ($result->RecordCount() == 0) return false; - } # Get the totals $invoice = ''; $total_amount = false; - while(!$result->EOF) - { - if(!empty($invoice)) - $invoice .= '-'; + while (! $result->EOF) { + if (! empty($invoice)) + $invoice .= '-'; + $invoice .= $result->fields['id']; - $amt = $result->fields["total_amt"]; + $amt = $result->fields['total_amt']; $total_amount += $amt; $result->MoveNext(); } - # echo the custom tracking code to the screen: - if(!is_file(PATH_FILES.'tracking.txt')) return false; + # Echo the custom tracking code to the screen: + if (! is_file(PATH_FILES.'tracking.txt')) + return false; + $tracking = file_get_contents(PATH_FILES.'tracking.txt'); - $tracking = ereg_replace('%%amount%%', "$total_amount", $tracking); - $tracking = ereg_replace('%%invoice%%', $invoice, $tracking); - $tracking = ereg_replace('%%affiliate%%', SESS_AFFILIATE, $tracking); - $tracking = ereg_replace('%%campaign%%', SESS_CAMPAIGN, $tracking); - $tracking = ereg_replace('%%account%%', SESS_ACCOUNT, $tracking); + $tracking = str_replace('%%amount%%',$total_amount,$tracking); + $tracking = str_replace('%%invoice%%',$invoice,$tracking); + $tracking = str_replace('%%affiliate%%',SESS_AFFILIATE,$tracking); + $tracking = str_replace('%%campaign%%',SESS_CAMPAIGN,$tracking); + $tracking = str_replace('%%account%%',SESS_ACCOUNT,$tracking); echo $tracking; - + # Update the record so it is not tracked again - $sql = "UPDATE ".AGILE_DB_PREFIX."invoice - SET - custom_affiliate_status = ".$db->qstr('1')." - WHERE - account_id = ".$db->qstr(SESS_ACCOUNT)." - AND - billing_status = ".$db->qstr(1)." - AND - site_id = ".$db->qstr(DEFAULT_SITE); - $rs = $db->Execute($sql); + $rs = $db->Execute(sqlUpdate($db,'invoice',array('custom_affiliate_status'=>1),sprintf('account_id=%s AND billing_status=1',SESS_ACCOUNT))); if ($rs === false) { global $C_debug; - $C_debug->error('','', $db->ErrorMsg(). "\r\n\r\n". $sql); + $C_debug->error(__FILE__,__METHOD__,sprintf('%s (%s)',$db->ErrorMsg(),$sql)); } + return true; } - + /** Performance: (for the admin dashboard) */ - function performance($VAR) + public function performance($VAR) { global $smarty, $C_list, $C_translate; - + # Get the period type, default to month if (empty($VAR['period'])) $p = 'm'; @@ -747,33 +1034,33 @@ class invoice $p = $VAR['period']; # Determine the correct period language: - if($p=='' or $p == 'm') + if($p=='' or $p == 'm') { $pTrans = $C_translate->translate('thismonth','invoice','') . ' '. $C_translate->translate('vs','invoice','') . ' ' . $C_translate->translate('lastmonth','invoice',''); $pFore = $C_translate->translate('thismonth','invoice',''); - } - elseif ($p == 'w') + } + elseif ($p == 'w') { $pTrans = $C_translate->translate('thisweek','invoice','') . ' '. $C_translate->translate('vs','invoice','') . ' ' . - $C_translate->translate('lastweek','invoice',''); - $pFore = $C_translate->translate('thisweek','invoice',''); + $C_translate->translate('lastweek','invoice',''); + $pFore = $C_translate->translate('thisweek','invoice',''); } - elseif ($p == 'y') + elseif ($p == 'y') { $pTrans = $C_translate->translate('thisyear','invoice','') . ' '. $C_translate->translate('vs','invoice','') . ' ' . - $C_translate->translate('lastyear','invoice',''); + $C_translate->translate('lastyear','invoice',''); $pFore = $C_translate->translate('thisyear','invoice',''); } - + $smarty->assign('period_compare', $pTrans); - $smarty->assign('period_forcast', $pFore); - - - + $smarty->assign('period_forcast', $pFore); + + + # Get the period start & end switch ($p) { case 'w': @@ -805,11 +1092,11 @@ class invoice $db = &DB(); $this_amt = 0; $sql = 'SELECT total_amt FROM ' . AGILE_DB_PREFIX . 'invoice WHERE - date_orig >= ' . $db->qstr( $this_start ) . ' AND - date_orig <= ' . $db->qstr( $this_end ) . ' AND + date_orig >= ' . $db->qstr($this_start) . ' AND + date_orig <= ' . $db->qstr($this_end) . ' AND site_id = ' . $db->qstr(DEFAULT_SITE); $rs = $db->Execute($sql); - while( !$rs->EOF ) { + while(!$rs->EOF) { $this_amt += $rs->fields['total_amt']; $rs->MoveNext(); } @@ -820,11 +1107,11 @@ class invoice ############################### $last_amt = 0; $sql = 'SELECT total_amt FROM ' . AGILE_DB_PREFIX . 'invoice WHERE - date_orig >= ' . $db->qstr( $last_start ) . ' AND - date_orig <= ' . $db->qstr( $last_end ) . ' AND + date_orig >= ' . $db->qstr($last_start) . ' AND + date_orig <= ' . $db->qstr($last_end) . ' AND site_id = ' . $db->qstr(DEFAULT_SITE); $rs = $db->Execute($sql); - while( !$rs->EOF ) { + while(!$rs->EOF) { $last_amt += $rs->fields['total_amt']; $rs->MoveNext(); } @@ -880,7 +1167,7 @@ class invoice ############################### # Get forcast change percentage ############################### - if($last_amt > 0 ) + if($last_amt > 0) @$forcast_change = $forcast_daily/$forcast_1_daily *100; else $forcast_change = 0; @@ -907,12 +1194,12 @@ class invoice ############################## $this_billed_amt = 0; $sql = 'SELECT billed_amt FROM ' . AGILE_DB_PREFIX . 'invoice WHERE - date_orig >= ' . $db->qstr( $this_start ) . ' AND - date_orig <= ' . $db->qstr( $this_end ) . ' AND - billed_amt > ' . $db->qstr( 0 ) . ' AND + date_orig >= ' . $db->qstr($this_start) . ' AND + date_orig <= ' . $db->qstr($this_end) . ' AND + billed_amt > ' . $db->qstr(0) . ' AND site_id = ' . $db->qstr(DEFAULT_SITE); $rs = $db->Execute($sql); - while( !$rs->EOF ) { + while(!$rs->EOF) { $this_billed_amt += $rs->fields['billed_amt']; $rs->MoveNext(); } @@ -923,12 +1210,12 @@ class invoice ############################### $last_billed_amt = 0; $sql = 'SELECT billed_amt FROM ' . AGILE_DB_PREFIX . 'invoice WHERE - date_orig >= ' . $db->qstr( $last_start ) . ' AND - date_orig <= ' . $db->qstr( $last_end ) . ' AND - billed_amt > ' . $db->qstr( 0 ) . ' AND + date_orig >= ' . $db->qstr($last_start) . ' AND + date_orig <= ' . $db->qstr($last_end) . ' AND + billed_amt > ' . $db->qstr(0) . ' AND site_id = ' . $db->qstr(DEFAULT_SITE); $rs = $db->Execute($sql); - while( !$rs->EOF ) { + while(!$rs->EOF) { $last_billed_amt += $rs->fields['billed_amt']; $rs->MoveNext(); } @@ -964,8 +1251,8 @@ class invoice # Get Users (current) ######################################### $sql = 'SELECT id FROM ' . AGILE_DB_PREFIX . 'account WHERE - date_orig >= ' . $db->qstr( $this_start ) . ' AND - date_orig <= ' . $db->qstr( $this_end ) . ' AND + date_orig >= ' . $db->qstr($this_start) . ' AND + date_orig <= ' . $db->qstr($this_end) . ' AND site_id = ' . $db->qstr(DEFAULT_SITE); $rs = $db->Execute($sql); $users_current = $rs->RecordCount(); @@ -975,8 +1262,8 @@ class invoice # Get Users (previous) ######################################### $sql = 'SELECT id FROM ' . AGILE_DB_PREFIX . 'account WHERE - date_orig >= ' . $db->qstr( $last_start ) . ' AND - date_orig <= ' . $db->qstr( $last_end ) . ' AND + date_orig >= ' . $db->qstr($last_start) . ' AND + date_orig <= ' . $db->qstr($last_end) . ' AND site_id = ' . $db->qstr(DEFAULT_SITE); $rs = $db->Execute($sql); $users_previous = $rs->RecordCount(); @@ -999,53 +1286,8 @@ class invoice $smarty->assign('users_change', $users_change); - # Get Tickets - if( $C_list->is_installed('ticket') ) - { - $smarty->assign('show_tickets', true); - - ######################################### - # Get Tickets (current) - ######################################### - $sql = 'SELECT id FROM ' . AGILE_DB_PREFIX . 'ticket WHERE - date_orig >= ' . $db->qstr( $this_start ) . ' AND - date_orig <= ' . $db->qstr( $this_end ) . ' AND - site_id = ' . $db->qstr(DEFAULT_SITE); - $rs = $db->Execute($sql); - $tickets_current = $rs->RecordCount(); - $smarty->assign('tickets_current', $tickets_current); - - ######################################### - # Get Tickets (previous) - ######################################### - $sql = 'SELECT id FROM ' . AGILE_DB_PREFIX . 'ticket WHERE - date_orig >= ' . $db->qstr( $last_start ) . ' AND - date_orig <= ' . $db->qstr( $last_end ) . ' AND - site_id = ' . $db->qstr(DEFAULT_SITE); - $rs = $db->Execute($sql); - $tickets_previous = $rs->RecordCount(); - $smarty->assign('tickets_previous', $tickets_previous); - - ############################### - # Get Tickets change percentage - ############################### - if($tickets_previous > 0) - @$tickets_change = $tickets_current/$tickets_current *100 -100; - else - $tickets_change = 0; - - if($tickets_change == 0) - $tickets_change = '-'; - elseif($tickets_change < 0) - $tickets_change = '' . number_format($tickets_change, 1). '%'; - else - $tickets_change = '+'.number_format($tickets_change, 1). '%'; - - $smarty->assign('tickets_change', $tickets_change); - } - # Get Affiliate stats - if( $C_list->is_installed('affiliate') ) + if($C_list->is_installed('affiliate')) { $smarty->assign('show_affiliates', true); @@ -1054,13 +1296,13 @@ class invoice ########################################### $this_amt = 0; $sql = 'SELECT total_amt FROM ' . AGILE_DB_PREFIX . 'invoice WHERE - date_orig >= ' . $db->qstr( $this_start ) . ' AND - date_orig <= ' . $db->qstr( $this_end ) . ' AND - affiliate_id != ' . $db->qstr( 0 ) . ' AND - affiliate_id != ' . $db->qstr( '' ) . ' AND + date_orig >= ' . $db->qstr($this_start) . ' AND + date_orig <= ' . $db->qstr($this_end) . ' AND + affiliate_id != ' . $db->qstr(0) . ' AND + affiliate_id != ' . $db->qstr('') . ' AND site_id = ' . $db->qstr(DEFAULT_SITE); $rs = $db->Execute($sql); - while( !$rs->EOF ) { + while(!$rs->EOF) { $this_amt += $rs->fields['total_amt']; $rs->MoveNext(); } @@ -1071,13 +1313,13 @@ class invoice ########################################## $last_amt = 0; $sql = 'SELECT total_amt FROM ' . AGILE_DB_PREFIX . 'invoice WHERE - date_orig >= ' . $db->qstr( $last_start ) . ' AND - date_orig <= ' . $db->qstr( $last_end ) . ' AND - affiliate_id != ' . $db->qstr( 0 ) . ' AND - affiliate_id != ' . $db->qstr( '' ) . ' AND + date_orig >= ' . $db->qstr($last_start) . ' AND + date_orig <= ' . $db->qstr($last_end) . ' AND + affiliate_id != ' . $db->qstr(0) . ' AND + affiliate_id != ' . $db->qstr('') . ' AND site_id = ' . $db->qstr(DEFAULT_SITE); $rs = $db->Execute($sql); - while( !$rs->EOF ) { + while(!$rs->EOF) { $last_amt += $rs->fields['total_amt']; $rs->MoveNext(); } @@ -1100,34 +1342,34 @@ class invoice $smarty->assign('affiliate_sales_change', $sales_change); } - - + + /** Get VoIP Performance Data - */ + */ if( $C_list->is_installed('voip') ) - { - + { + # Avg. Call Duration for this period $rs = $db->Execute(sqlSelect($db, "voip_cdr", "avg(ceiling(billsec/60))", "disposition='ANSWERED' AND date_orig >= $this_start AND date_orig <= $this_end")); - if(empty($rs->fields[0])) $acd=0; else $acd = $rs->fields[0]; - $smarty->assign('acd',$acd); - + if(empty($rs->fields[0])) $acd=0; else $acd = $rs->fields[0]; + $smarty->assign('acd',$acd); + # Avg. Call Duration for last period $rs = $db->Execute(sqlSelect($db, "voip_cdr", "avg(ceiling(billsec/60))", "disposition='ANSWERED' AND date_orig >= $last_start AND date_orig <= $last_end")); - if(empty($rs->fields[0])) $acd_last=0; else $acd_last = $rs->fields[0]; + if(empty($rs->fields[0])) $acd_last=0; else $acd_last = $rs->fields[0]; $smarty->assign('acd_last',$acd_last); - + # Get Avg. Call Duration change Percentage if($acd > 0) $acd_change = $acd/$acd_last*100-100; else $acd_change = 0; - if($acd_change == 0) + if($acd_change == 0) $acd_change = '-'; elseif ($acd_change < 0) $acd_change = '' . number_format($acd_change, 1). '%'; - else + else $acd_change = '+'.number_format($acd_change, 1). '%'; $smarty->assign('acd_change', $acd_change); - - + + # Avg. Successful Rate for this period $rs = $db->Execute(sqlSelect($db, "voip_cdr", "count(*)", "disposition='ANSWERED' AND date_orig >= $this_start AND date_orig <= $this_end")); $rs1 = $db->Execute(sqlSelect($db, "voip_cdr", "count(*)", "date_orig >= $this_start AND date_orig <= $this_end")); @@ -1135,12 +1377,12 @@ class invoice $asr = number_format(($rs->fields[0] / $rs1->fields[0]) * 100,3)." %"; else $asr = "-"; - $smarty->assign('asr', $asr); - + $smarty->assign('asr', $asr); + # Number of CDRs for this period $cdrs = $rs1->fields[0]; - $smarty->assign('cdrs', number_format($cdrs,0)); - + $smarty->assign('cdrs', number_format($cdrs,0)); + # Avg. Successful Rate for last period $rs = $db->Execute(sqlSelect($db, "voip_cdr", "count(*)", "disposition='ANSWERED' AND date_orig >= $last_start AND date_orig <= $last_end")); $rs1 = $db->Execute(sqlSelect($db, "voip_cdr", "count(*)", "date_orig >= $last_start AND date_orig <= $last_end")); @@ -1148,87 +1390,87 @@ class invoice $asr_last = number_format(($rs->fields[0] / $rs1->fields[0]) * 100,3)." %"; else $asr_last = "-"; - $smarty->assign('asr_last', $asr_last); - + $smarty->assign('asr_last', $asr_last); + # Number of CDRS for last period $cdrs_last = $rs1->fields[0]; - $smarty->assign('cdrs_last', number_format($cdrs_last,0)); - + $smarty->assign('cdrs_last', number_format($cdrs_last,0)); + # Get Avg. Successful Rate change Percentage if($asr > 0) $asr_change = $asr/$asr_last*100-100; else $asr_change = 0; - if($asr_change == 0) + if($asr_change == 0) $asr_change = '-'; elseif ($asr_change < 0) $asr_change = '' . number_format($asr_change, 1). '%'; - else + else $asr_change = '+'.number_format($asr_change, 1). '%'; $smarty->assign('asr_change', $asr_change); - - + + # Get Number of CDRs change Percentage if($cdrs > 0) $cdrs_change = $cdrs/$cdrs_last*100-100; else $cdrs_change = 0; - if($cdrs_change == 0) + if($cdrs_change == 0) $cdrs_change = '-'; elseif ($cdrs_change < 0) $cdrs_change = '' . number_format($cdrs_change, 1). '%'; - else + else $cdrs_change = '+'.number_format($cdrs_change, 1). '%'; $smarty->assign('cdrs_change', $cdrs_change); } - - + + # Generate the Calendar Overview include_once(PATH_MODULES.'core/calendar.inc.php'); - $calendar = new calendar; + $calendar = new calendar; $start = $calendar->start; - $end = $calendar->end; - + $end = $calendar->end; + global $C_list; $C_list->currency(DEFAULT_CURRENCY); $currency_symbol=$C_list->format_currency[DEFAULT_CURRENCY]['symbol']; - + # Get the paid/due invoice statistics $rs = $db->Execute($sql=sqlSelect($db,"invoice","date_orig,total_amt,billing_status,refund_status,billed_amt,suspend_billing","date_orig >= $start and date_orig <= $end")); - if($rs && $rs->RecordCount()) { + if($rs && $rs->RecordCount()) { while(!$rs->EOF) { $day = date("j", $rs->fields['date_orig']); - - if($rs->fields['billed_amt'] > 0 && ($rs->fields['billing_status'] == 1 || $rs->fields['refund_status'] != 1)) { + + if($rs->fields['billed_amt'] > 0 && ($rs->fields['billing_status'] == 1 || $rs->fields['refund_status'] != 1)) { $paid[$day] += $rs->fields['billed_amt']; } - if ($rs->fields['billing_status'] != 1 && $rs->fields['refund_status'] != 1 ) { + if ($rs->fields['billing_status'] != 1 && $rs->fields['refund_status'] != 1) { $amt = $rs->fields['total_amt'] - $rs->fields['billed_amt']; $due[$day] += $amt; - } - + } + $rs->MoveNext(); - } - + } + if(is_array($paid)) - foreach($paid as $day=>$item) + foreach($paid as $day=>$item) $calendar->add("Paid - {$currency_symbol}". number_format($item,2), $day, 'green', 'green'); - + if(is_array($due)) - foreach($due as $day=>$item) - $calendar->add("Due - {$currency_symbol}". number_format($item,2), $day,'red','red'); + foreach($due as $day=>$item) + $calendar->add("Due - {$currency_symbol}". number_format($item,2), $day,'red','red'); } - - # Get the upcoming due services + + # Get the upcoming due services $rs = $db->Execute($sql=sqlSelect($db,"service","date_next_invoice,price","price > 0 AND date_next_invoice >= $start AND date_next_invoice <= $end AND suspend_billing <> 1")); - if($rs && $rs->RecordCount()) { + if($rs && $rs->RecordCount()) { while(!$rs->EOF) { - $day = date("j", $rs->fields['date_next_invoice']); - $sdue[$day] += $rs->fields['price']; + $day = date("j", $rs->fields['date_next_invoice']); + $sdue[$day] += $rs->fields['price']; $rs->MoveNext(); - } + } foreach($sdue as $day=>$item) { $calendar->add("Recurring - {$currency_symbol}". number_format($item,2), $day, 'grey', 'grey'); - } - } - + } + } + $calout= $calendar->generate(); $smarty->assign("calendar", $calout); - + return; } @@ -1246,7 +1488,7 @@ class invoice $invoice = $db->Execute($q); if ($invoice === false) { global $C_debug; - $C_debug->error('invoice.inc.php','autoApproveInvoice', $db->ErrorMsg()); + $C_debug->error(__FILE__,'autoApproveInvoice', $db->ErrorMsg()); return false; } @@ -1257,7 +1499,7 @@ class invoice $checkout = $db->Execute($q); if ($checkout === false) { global $C_debug; - $C_debug->error('invoice.inc.php','autoApproveInvoice', $db->ErrorMsg()); + $C_debug->error(__FILE__,'autoApproveInvoice', $db->ErrorMsg()); return false; } @@ -1268,17 +1510,17 @@ class invoice $account = $db->Execute($q); if ($account === false) { global $C_debug; - $C_debug->error('invoice.inc.php','autoApproveInvoice', $db->ErrorMsg()); + $C_debug->error(__FILE__,'autoApproveInvoice', $db->ErrorMsg()); return false; } # is this a recurring invoices, and is manual approvale req? - if ( $invoice->fields['type'] == 1 && $checkout->fields['manual_approval_recur'] != 1) { + if ($invoice->fields['type'] == 1 && $checkout->fields['manual_approval_recur'] != 1) { $do = true; } # Manual approval required for all? - if( $invoice->fields['type'] != 1 && $checkout->fields['manual_approval_all'] != 1) { + if($invoice->fields['type'] != 1 && $checkout->fields['manual_approval_all'] != 1) { $do = true; } @@ -1317,7 +1559,7 @@ class invoice $groups = $db->Execute($q); if ($groups === false) { global $C_debug; - $C_debug->error('invoice.inc.php','autoApproveInvoice', $db->ErrorMsg()); + $C_debug->error(__FILE__,'autoApproveInvoice', $db->ErrorMsg()); } $arr = unserialize($checkout->fields['manual_approval_group']); @@ -1360,7 +1602,7 @@ class invoice $invoice = $db->Execute($q); if ($invoice === false) { global $C_debug; - $C_debug->error('invoice.inc.php','approveInvoice', $db->ErrorMsg()); + $C_debug->error(__FILE__,'approveInvoice', $db->ErrorMsg()); return false; } @@ -1376,7 +1618,7 @@ class invoice $result = $db->Execute($q); if ($result === false) { global $C_debug; - $C_debug->error('invoice.inc.php','approveInvoice', $db->ErrorMsg()); + $C_debug->error(__FILE__,'approveInvoice', $db->ErrorMsg()); return false; } @@ -1390,7 +1632,7 @@ class invoice $srvc = new service; # Determine if services have already been created for this invoice: - if($invoice->fields['type'] != 1 ) + if($invoice->fields['type'] != 1) { $q = "SELECT id FROM ".AGILE_DB_PREFIX."service WHERE invoice_id = ".$db->qstr($VAR['id'])." AND @@ -1398,7 +1640,7 @@ class invoice $service = $db->Execute($q); if ($service === false) { global $C_debug; - $C_debug->error('invoice.inc.php','approveInvoice', $db->ErrorMsg()); + $C_debug->error(__FILE__,'approveInvoice', $db->ErrorMsg()); return false; } if ($service->RecordCount() > 0) @@ -1414,13 +1656,13 @@ class invoice # Get the parent items in this invoice : $q = "SELECT * FROM ".AGILE_DB_PREFIX."invoice_item WHERE - ( parent_id = 0 OR parent_id IS NULL OR parent_id = '') AND + (parent_id = 0 OR parent_id IS NULL OR parent_id = '') AND invoice_id = ".$db->qstr($VAR['id'])." AND site_id = ".$db->qstr(DEFAULT_SITE); $ii = $db->Execute($q); if ($ii === false) { global $C_debug; - $C_debug->error('invoice.inc.php','approveInvoice', $db->ErrorMsg()); + $C_debug->error(__FILE__,'approveInvoice', $db->ErrorMsg()); return false; } while(!$ii->EOF) @@ -1438,7 +1680,7 @@ class invoice $iii = $db->Execute($q); if ($iii === false) { global $C_debug; - $C_debug->error('invoice.inc.php','approveInvoice', $db->ErrorMsg()); + $C_debug->error(__FILE__,'approveInvoice', $db->ErrorMsg()); return false; } while(!$iii->EOF) @@ -1451,18 +1693,18 @@ class invoice else { $srvc = new service; - if($ii->fields['item_type'] == 2 && $ii->fields['domain_type'] == 'renew' ) { + if($ii->fields['item_type'] == 2 && $ii->fields['domain_type'] == 'renew') { # this is a domain renewal - $srvc->renewDomain( $ii, $invoice->fields['account_billing_id'] ); + $srvc->renewDomain($ii, $invoice->fields['account_billing_id']); } else { # this is an upgrade for an existing service - $srvc->modifyService( $ii, $invoice->fields['account_billing_id'] ); + $srvc->modifyService($ii, $invoice->fields['account_billing_id']); } } $ii->MoveNext(); } } - elseif ($invoice->fields['type'] == 1 ) + elseif ($invoice->fields['type'] == 1) { # recurring invoice, just update assoc services # Loop through invoice items & approve assoc services @@ -1472,7 +1714,7 @@ class invoice $service = $db->Execute($q); if ($service === false) { global $C_debug; - $C_debug->error('invoice.inc.php','voidInvoice', $db->ErrorMsg()); + $C_debug->error(__FILE__,'voidInvoice', $db->ErrorMsg()); return false; } if ($service->RecordCount() > 0) @@ -1509,7 +1751,7 @@ class invoice $memo = $db->Execute($q); if ($memo === false) { global $C_debug; - $C_debug->error('invoice.inc.php','approveInvoice', $db->ErrorMsg()); + $C_debug->error(__FILE__,'approveInvoice', $db->ErrorMsg()); return false; } return true; @@ -1530,7 +1772,7 @@ class invoice $update = $db->Execute($q); if ($update === false) { global $C_debug; - $C_debug->error('invoice.inc.php','voidInvoice', $db->ErrorMsg()); + $C_debug->error(__FILE__,'voidInvoice', $db->ErrorMsg()); return false; } @@ -1541,7 +1783,7 @@ class invoice $service = $db->Execute($q); if ($service === false) { global $C_debug; - $C_debug->error('invoice.inc.php','voidInvoice', $db->ErrorMsg()); + $C_debug->error(__FILE__,'voidInvoice', $db->ErrorMsg()); return false; } if ($service->RecordCount() > 0) @@ -1564,7 +1806,7 @@ class invoice $service = $db->Execute($q); if ($service === false) { global $C_debug; - $C_debug->error('invoice.inc.php','voidInvoice', $db->ErrorMsg()); + $C_debug->error(__FILE__,'voidInvoice', $db->ErrorMsg()); return false; } if ($service->RecordCount() > 0) @@ -1578,7 +1820,7 @@ class invoice $srvc->voidService($service->fields['service_id']); $service->MoveNext(); } - } + } # if voided, create a memo $id = $db->GenID(AGILE_DB_PREFIX . 'invoice_memo_id'); @@ -1594,7 +1836,7 @@ class invoice $insert = $db->Execute($q); if ($insert === false) { global $C_debug; - $C_debug->error('invoice.inc.php','voidInvoice', $db->ErrorMsg()); + $C_debug->error(__FILE__,'voidInvoice', $db->ErrorMsg()); return false; } return true; @@ -1608,20 +1850,20 @@ class invoice global $C_translate, $C_debug; # validate amt - if( $VAR['amount'] <= 0) { - $C_debug->alert( "Payment amount to low!" ); + if($VAR['amount'] <= 0) { + $C_debug->alert("Payment amount to low!"); return false; } # get the invoice details $db = &DB(); $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'invoice WHERE - id = ' . $db->qstr( $VAR['id'] ) . ' AND + id = ' . $db->qstr($VAR['id']) . ' AND site_id = ' . $db->qstr(DEFAULT_SITE); $rs = $db->Execute($sql); if ($rs === false) { global $C_debug; - $C_debug->error('invoice.inc.php','reconcileInvoice', $db->ErrorMsg()); + $C_debug->error(__FILE__,'reconcileInvoice', $db->ErrorMsg()); return false; } @@ -1660,13 +1902,13 @@ class invoice # Update the invoice record $sql = 'UPDATE ' . AGILE_DB_PREFIX . 'invoice SET - billed_amt = ' . $db->qstr( $update ) . ', - billing_status = ' . $db->qstr( $billed ) . ' + billed_amt = ' . $db->qstr($update) . ', + billing_status = ' . $db->qstr($billed) . ' WHERE - id = ' . $db->qstr( $VAR['id'] ) . ' AND + id = ' . $db->qstr($VAR['id']) . ' AND site_id = ' . $db->qstr(DEFAULT_SITE); $db->Execute($sql); - + # Create a memo $id = $db->GenID(AGILE_DB_PREFIX . 'invoice_memo_id'); $q = "INSERT INTO ".AGILE_DB_PREFIX."invoice_memo @@ -1679,13 +1921,13 @@ class invoice type = ".$db->qstr('reconcile').", memo = ".$db->qstr('+ '.number_format($VAR['amount'],2) . " \r\n" . @$VAR['memo']); $db->Execute($q); - - + + # Reciept printing include_once PATH_MODULES.'invoice/receipt_print.php'; $receipt = new receipt_print; $receipt->add($rs, number_format($VAR['amount'],2), number_format($update,2)); - + # Auto update if billed complete if($billed) @@ -1727,27 +1969,27 @@ class invoice } $msg = $C_translate->translate('ref_comp','invoice',''); - $C_debug->alert( $msg ); + $C_debug->alert($msg); return; } - /** REFUND INVOICE + /** REFUND INVOICE */ function refund($VAR) { global $C_translate, $C_debug; # validate amt - if( $VAR['amount'] <= 0) { - $C_debug->alert( "Refund amount to low!" ); + if($VAR['amount'] <= 0) { + $C_debug->alert("Refund amount to low!"); return false; } # get the invoice details $db = &DB(); $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'invoice WHERE - id = ' . $db->qstr( $VAR['id'] ) . ' AND + id = ' . $db->qstr($VAR['id']) . ' AND site_id = ' . $db->qstr(DEFAULT_SITE); $rs = $db->Execute($sql); if(@$rs->RecordCount() == 0) return false; @@ -1761,21 +2003,21 @@ class invoice $update = $billed_amt - $amt; if($update>0) $billing_status=1; else $billing_status=0; - + # Update the invoice record echo $sql = 'UPDATE ' . AGILE_DB_PREFIX . 'invoice SET - billed_amt = ' . $db->qstr( $update ) . ', - billing_status = '.$billing_status.', + billed_amt = '.$db->qstr($update).', + billing_status = '.$billing_status.', suspend_billing = 1, - refund_status = 1 + refund_status = 1 WHERE - id = ' . $db->qstr( $VAR['id'] ) . ' AND + id = ' . $db->qstr($VAR['id']) . ' AND site_id = ' . $db->qstr(DEFAULT_SITE); $update2 = $db->Execute($sql); if ($update2 === false) { global $C_debug; - $C_debug->error('invoice.inc.php','refundInvoice', $db->ErrorMsg()); + $C_debug->error(__FILE__,'refundInvoice', $db->ErrorMsg()); return false; } @@ -1793,22 +2035,22 @@ class invoice $insert = $db->Execute($q); if ($insert === false) { global $C_debug; - $C_debug->error('invoice.inc.php','refundInvoice', $db->ErrorMsg()); + $C_debug->error(__FILE__,'refundInvoice', $db->ErrorMsg()); return false; } # Void: $this->voidInvoice($VAR, $this); - - # Call into the checkout plugin and attempt realtime refund + + # Call into the checkout plugin and attempt realtime refund $billing = $db->Execute($sql=sqlSelect($db, array('account_billing','checkout'), 'A.*,B.checkout_plugin', "A.id = ::{$rs->fields['account_billing_id']}:: AND A.checkout_plugin_id=B.id")); if($billing && $billing->RecordCount() && !empty($billing->fields['checkout_plugin'])) { $plugin_file = PATH_PLUGINS.'checkout/'. $billing->fields['checkout_plugin'] .'.php'; if(is_file($plugin_file)) { - include_once ( $plugin_file ); - eval( '$PLG = new plg_chout_' . $billing->fields['checkout_plugin'] . '("'.$billing->fields['checkout_plugin_id'].'");'); - if(is_callable(Array($PLG,"refund"))) $PLG->refund($rs->fields, $billing->fields, $amt); + include_once ($plugin_file); + eval('$PLG = new plg_chout_' . $billing->fields['checkout_plugin'] . '("'.$billing->fields['checkout_plugin_id'].'");'); + if(is_callable(array($PLG,"refund"))) $PLG->refund($rs->fields, $billing->fields, $amt); } } @@ -1817,63 +2059,71 @@ class invoice echo ' '; return; } - + $msg = $C_translate->translate('ref_comp','invoice',''); - $C_debug->alert( $msg ); + $C_debug->alert($msg); return; } # Get translated/hardcoded line item description for PDF invoice - function getLineItemDesc($sku,$id,$domain=false,$item_name) - { - if(!empty($item_name)) return $item_name; + # @uses CORE_list; + private function getLineItemDesc($sku,$id,$domain=false,$item_name) { + if (! empty($item_name)) + return $item_name; + global $C_translate; - if(!empty($sku) && $sku == 'DOMAIN-PARK' || $sku == 'DOMAIN-TRANSFER' || $sku == 'DOMAIN-REGISTER' || $sku == 'DOMAIN-RENEW') { - if($sku == 'DOMAIN-REGISTER') $name=$C_translate->translate('register','cart',''); - elseif ($sku == 'DOMAIN-TRANSFER') $name=$C_translate->translate('transfer','cart',''); - elseif ($sku == 'DOMAIN-PARK') $name=$C_translate->translate('park','cart',''); - elseif ($sku == 'DOMAIN-RENEW') $name=$C_translate->translate('renew','cart',''); - if($domain) return "$domain \r\n ( $name )"; - else return $name; - } else { - include_once(PATH_CORE.'list.inc.php'); - $C_list=new CORE_list; - if(empty($this->product_desc["$id"])) { - $desc = $C_list->translate("product_translate", "name", "product_id", $id, "translate_product"); - $this->product_desc["$id"] = $desc['name']; + + if (! empty($sku) && in_array($sku,array('DOMAIN-PARK','DOMAIN-TRANSFER','DOMAIN-REGISTER','DOMAIN-RENEW'))) { + switch ($sku) { + case 'DOMAIN-REGISTER': $name = $C_translate->translate('register','cart',''); break; + case 'DOMAIN-TRANSFER': $name = $C_translate->translate('transfer','cart',''); break; + case 'DOMAIN-PARK': $name = $C_translate->translate('park','cart',''); break; + case 'DOMAIN-RENEW': $name = $C_translate->translate('renew','cart',''); break; } - if(!empty($this->product_desc["$id"])) - return $this->product_desc["$id"]; - else - return $sku; - } - return $sku; + + if ($domain) + return sprinf("%s\r\n ( %s )",$domain,$name); + else + return $name; + + } else { + include_once(PATH_CORE.'list.inc.php'); + $C_list = new CORE_list; + + if (empty($this->product_desc[$id])) { + $desc = $C_list->translate('product_translate','name','product_id',$id,'translate_product'); + $this->product_desc[$id] = $desc['name']; + } + + if (! empty($this->product_desc[$id])) + return $this->product_desc[$id]; + else + return $sku ? $sku : 'Other Item'; + } + } + + // @todo: To be depreciated + function delivery_task() { + return $this->task_mail_invoices(); } /** * Task based function to e-mail or store printable PDF of all unprinted invoices + * @todo This seems to be hard limited to do 100 invoices in a run - why? (make it configurable, or remove the limit?) */ - function delivery_task() - { - # get all unprinted invoices - $db=&DB(); - $invcfg = $db->Execute(sqlSelect($db,"setup_invoice","*","id=::".DEFAULT_SITE."::")); - $rs = $db->SelectLimit($sql=sqlSelect($db,Array("invoice","account"), - "A.id,B.email,B.first_name,B.last_name,B.invoice_delivery,B.invoice_show_itemized", - "(A.billing_status=0 OR A.billing_status IS NULL) AND (A.print_status=0 OR A.print_status=NULL) and A.account_id=B.id and (B.invoice_delivery is not null AND B.invoice_delivery>0)"),100); - if($rs && $rs->RecordCount()) - { - //define('FPDF_FONTPATH', PATH_INCLUDES.'pdf/font/'); - require_once(PATH_INCLUDES.'pdf/fpdi.php'); - require_once(PATH_INCLUDES.'pdf/fpdf_tpl.php'); - require_once(PATH_INCLUDES.'pdf/fpdf.php'); - require_once(PATH_INCLUDES.'pdf/pdf_invoice_'.$invcfg->fields['invoice_pdf_plugin'].'.inc.php'); - - // Send the e-mail.... - require_once(PATH_INCLUDES."phpmailer/class.phpmailer.php"); + public function task_mail_invoices() { + # Get all unprinted invoices + $db = &DB(); + $rs = $db->SelectLimit(sqlSelect($db,array('invoice','account'), + 'A.id,B.email,B.first_name,B.last_name,B.invoice_delivery,B.invoice_show_itemized', + '(A.billing_status=0 OR A.billing_status IS NULL) AND (A.print_status=0 OR A.print_status=NULL) and A.account_id=B.id and (B.invoice_delivery IS NOT NULL AND B.invoice_delivery>0)'),100); + if ($rs && $rs->RecordCount()) { + # Send the e-mail.... + require_once(PATH_INCLUDES.'phpmailer/class.phpmailer.php'); $mail = new PHPMailer(); - $mail->From = SITE_EMAIL; + + $mail->From = SITE_EMAIL; $mail->FromName = SITE_NAME; /* @@ -1884,319 +2134,326 @@ class invoice $mail->Mailer = "smtp"; $mail->Debug = true; */ - - while(!$rs->EOF) - { - $pdf = new pdf_invoice_overview(); - $pdf->companyName = SITE_NAME; - $pdf->companyAddress = SITE_ADDRESS; - $pdf->companyCity = SITE_CITY; - $pdf->companyState = SITE_STATE; - $pdf->companyZip = SITE_ZIP; - - # load the setup_invoice fields into the pdf class - $pdf->load_setup($invcfg); - - $pagecount = $pdf->setSourceFile($pdf->getTemplate()); - $tplidx = $pdf->ImportPage(1); - - $pdf->addPage(); - $pdf->useTemplate($tplidx); - - # override the show itemized, based on the customers choice - if($rs->fields['invoice_show_itemized'] == 0 || $rs->fields['invoice_show_itemized'] == 1) - $pdf->show_itemized = $rs->fields['invoice_show_itemized']; - - $this->pdfInvoiceSummary($rs->fields['id'], $pdf); - $file = tempnam(PATH_FILES, "pdf_inv_".$rs->fields['id']).".pdf"; - $pdf->Output($file,'F'); - $pdf->closeParsers(); - - if($rs->fields['invoice_delivery'] == 1) { - $mail->AddAddress($rs->fields['email'], $rs->fields['first_name']. ' ' . $rs->fields['last_name']); - $mail->Subject = "Printable Invoice No. ". $rs->fields['id']; - $mail->Body = "Please find the printable version of invoice number {$rs->fields['id']} attached.\r\n\r\nThank you,\r\n".SITE_NAME; - $mail->AddAttachment($file, "INVOICE_{$rs->fields['id']}.pdf"); - - if($mail->Send()) { - $fields=Array('print_status'=>1); - $db->Execute(sqlUpdate($db,"invoice",$fields,"id=".$rs->fields['id'])); - } else { - echo "Unable to email invoice # {$rs->fields['id']} to {$rs->fields['email']}
    "; - } - - $mail->ClearAddresses(); - $mail->ClearAttachments(); - } else if($rs->fields['invoice_delivery'] == 2) { - if(copy($file,AGILE_PDF_INVOICE_PATH."invoice_".$rs->fields['id'].".pdf")) { - $fields=Array('print_status'=>1); - $db->Execute(sqlUpdate($db,"invoice",$fields,"id=".$rs->fields['id'])); - } + while (! $rs->EOF) { + if (! $pdf = $this->initInvoicePDF(array('id'=>$rs->fields['id']))) + continue; + + $this->pdfInvoiceSummary($rs->fields['id'],$pdf); + + switch ($rs->fields['invoice_delivery']) { + # Email Invoice + case 1: + $file = $pdf->Output(null,'S'); + + $mail->AddAddress($rs->fields['email'], sprintf('%s %s',$rs->fields['first_name'],$rs->fields['last_name'])); + $mail->Subject = sprintf('%s %s: %s',SITE_NAME,_('Invoice'),$rs->fields['id']); + $mail->Body = sprintf("Please find the printable version of invoice number %s attached.\r\n\r\nThank you,\r\n%s",$rs->fields['id'],SITE_NAME); + $mail->AddStringAttachment($file,sprintf('%s.pdf',$this->getInvoiceID()),'base64','application/pdf'); + + if ($mail->Send()) + $db->Execute(sqlUpdate($db,'invoice',array('print_status'=>1),array('id'=>$rs->fields['id']))); + else + printf('Unable to email invoice # %s to %s
    ',$rs->fields['id'],$rs->fields['email']); + + $mail->ClearAddresses(); + $mail->ClearAttachments(); + + break; + + # Print Invoice + case 2: + $file = tempnam(PATH_FILES,sprintf('pdf_inv_%s.pdf',$this->getInvoiceID())); + $pdf->Output($file,'F'); + + if (copy($file,sprintf('%sinvoice_%s.pdf',AGILE_PDF_INVOICE_PATH,$this->getInvoiceID()))) + $db->Execute(sqlUpdate($db,'invoice',array('print_status'=>1),array('id'=>$rs->fields['id']))); + + unlink($file); + break; + + default: + printf('Unknown invoice_delivery: %s for %s
    ',$rs->fields['invoice_delivery'],$rs->fields['id']); } - - // delete tmp file and clean up vars used - unlink($file); - unset($pdf->itemsSummary); - unset($pdf); unset($tplidx); unset($pagecount); - - $rs->MoveNext(); - } - } + + $rs->MoveNext(); + } + } } - - - /** Display a PDF invoice - */ - function pdf($VAR) - { + + /** + * Initialise an invoice + * + * This function is responsible for getting all the information required to render an invoice. + */ + private function initInvoicePrint($VAR) { # Check invoice - if(empty($VAR['id'])) { + if (! isset($VAR['id'])) { echo 'No Invoice Specified.'; + return false; } # Check admin authentication: global $C_auth; + $db = &DB(); + if ($C_auth->auth_method_by_name('invoice','view') == false) { # Validate on account level - $db = &DB(); - $rs = $db->Execute(sqlSelect($db,"invoice","account_id", "id = ::{$VAR['id']}::")); - if ($rs->fields['account_id'] != SESS_ACCOUNT) { - // todo: redirect to login page if not logged + $rs = $db->Execute(sqlSelect($db,'invoice','account_id',array('id'=>$VAR['id']))); + + # @todo redirect to login page if not logged + if ($rs->fields['account_id'] != SESS_ACCOUNT) return false; - } } - $db =& DB(); - $invcfg = $db->Execute(sqlSelect($db,"setup_invoice","*","id=::".DEFAULT_SITE."::")); - - if (!defined('FPDF_FONTPATH')) - define('FPDF_FONTPATH', PATH_INCLUDES.'pdf/font/'); - require_once(PATH_INCLUDES.'pdf/fpdi.php'); - require_once(PATH_INCLUDES.'pdf/fpdf_tpl.php'); - require_once(PATH_INCLUDES.'pdf/fpdf.php'); - require_once(PATH_INCLUDES.'pdf/pdf_invoice_'.$invcfg->fields['invoice_pdf_plugin'].'.inc.php'); - - ob_start(); - - $pdf = new pdf_invoice_overview(); - $pdf->companyName = SITE_NAME; - $pdf->companyAddress = SITE_ADDRESS; - $pdf->companyCity = SITE_CITY; - $pdf->companyState = SITE_STATE; - $pdf->companyZip = SITE_ZIP; - - # load the setup_invoice - $pdf->load_setup($invcfg); - - $pagecount = $pdf->setSourceFile($pdf->getTemplate()); - $tplidx = $pdf->ImportPage(1); + $invoice = array(); + + #@todo this should be in setup_invoice + $invoice['site']['TAXID'] = SITE_TAXID; + $invoice['site']['NAME'] = SITE_NAME; + $invoice['site']['ADDRESS'] = SITE_ADDRESS; + $invoice['site']['CITY'] = SITE_CITY; + $invoice['site']['STATE'] = SITE_STATE; + $invoice['site']['ZIP'] = SITE_ZIP; + $invoice['site']['FAX'] = SITE_FAX; + $invoice['site']['PHONE'] = SITE_PHONE; + $invoice['site']['EMAIL'] = SITE_EMAIL; + $invoice['site']['URL'] = URL; + + # Invoice Configuration + $rs = $db->Execute(sqlSelect($db,'setup_invoice','*','')); + $invoice['invcfg'] = $rs->fields; + + # Invoice details + $rs = $db->Execute($a=sqlSelect($db,array('invoice','currency'),'A.*,B.symbol',sprintf('A.id=%s AND B.id=A.billed_currency_id',$VAR['id']))); + $invoice['invoice'] = $rs->fields; + + # Account detail: + $rs = $db->Execute($q = sqlSelect($db,'account','*',array('id'=>$invoice['invoice']['account_id']))); + $invoice['account'] = $rs->fields; + + # Invoice Item details + $invoice['invoiceitems'] = array(); + $rs = $db->Execute($b=sqlSelect($db,'invoice_item','*',array('invoice_id'=>$VAR['id']))); + while (! $rs->EOF) { + array_push($invoice['invoiceitems'],$rs->fields); + $rs->moveNext(); + } + + # Get previous invoices + $invoice['previousinvoices'] = array(); + $rs = $db->Execute($q=sqlSelect($db,'invoice','*',sprintf('account_id=%s AND (billed_amt < total_amt OR billed_amt IS NULL) AND date_orig < %s', + $invoice['invoice']['account_id'],$invoice['invoice']['date_orig']))); + + while (! $rs->EOF) { + array_push($invoice['previousinvoices'],$rs->fields); + $rs->moveNext(); + } + + # If we get here, all is OK. + return $invoice; + } + + /** + * Initialise a PDF invoice + * + * This function is resonsible for setting up a PDF invoice + */ + private function initInvoicePDF($VAR) { + # Get our invoice details + if (! $this->print = $this->initInvoicePrint($VAR)) + return false; + + #@todo since the view template dynamic finds available plugins, this should also find the plugin (incase the prefix/dir is moved). + require_once(sprintf('%sinvoice/PDF/pdf_invoice_%s.inc.php',PATH_MODULES,$this->print['invcfg']['invoice_pdf_plugin'])); + + $pdf = new pdf_invoice_overview($this); + + #@todo This should be deprecated + $null = false; + $pdf->load_setup($null); + + if ($pdf->getTemplate()) { + $pagecount = $pdf->setSourceFile($pdf->getTemplate()); + $tplidx = $pdf->ImportPage(1); + } + $pdf->addPage(); - $pdf->useTemplate($tplidx); - $this->pdfInvoiceSummary($VAR['id'], $pdf); - $pdf->Output('invoice.pdf','D'); - $pdf->closeParsers(); - - ob_end_flush(); + + # If we are using FPDI + if (isset($tplidx)) + $pdf->useTemplate($tplidx); + + # If we get here, all is OK. + return $pdf; + } + + /** + * Display a PDF invoice in the browser for download. + */ + public function pdf($VAR) { + if (! $pdf = $this->initInvoicePDF($VAR)) + return false; + + $this->pdfInvoiceSummary($VAR['id'],$pdf); + $pdf->Output(sprintf('%s.pdf',$this->getInvoiceID()),'I'); } /** Export multiple invoices */ - function pdfExport(&$rs) - { + function pdfExport(&$rs) + { $db =& DB(); $invcfg = $db->Execute(sqlSelect($db,"setup_invoice","*","")); - - define('FPDF_FONTPATH', PATH_INCLUDES.'pdf/font/'); - require_once(PATH_INCLUDES.'pdf/fpdi.php'); - require_once(PATH_INCLUDES.'pdf/fpdf_tpl.php'); - require_once(PATH_INCLUDES.'pdf/fpdf.php'); - require_once(PATH_INCLUDES.'pdf/pdf_invoice_'.$invcfg->fields['invoice_pdf_plugin'].'.inc.php'); - - ob_start(); - $pdf = new pdf_invoice_overview(); + + ob_start(); + $pdf = new pdf_invoice_overview(); $pdf->companyName = SITE_NAME; $pdf->companyAddress = SITE_ADDRESS; $pdf->companyCity = SITE_CITY; $pdf->companyState = SITE_STATE; - $pdf->companyZip = SITE_ZIP; - $pdf->load_setup($invcfg); + $pdf->companyZip = SITE_ZIP; + $pdf->load_setup($invcfg); + if ($pdf->getTemplate()) $pagecount = $pdf->setSourceFile($pdf->getTemplate()); - $tplidx = $pdf->ImportPage(1); - while(!$rs->EOF) { + $tplidx = $pdf->ImportPage(1); + while(!$rs->EOF) { $pdf->addPage(); - $pdf->useTemplate($tplidx); - $this->pdfInvoiceSummary($rs->fields['id'], $pdf); + $pdf->useTemplate($tplidx); + $this->pdfInvoiceSummary($rs->fields['id'], $pdf); $rs->MoveNext(); unset($pdf->itemsSummary); - } + } $pdf->Output(); - $pdf->closeParsers(); - ob_end_flush(); + ob_end_flush(); } - - - function pdfInvoiceSummary($id, &$pdf) - { + /** + * Render an invoice with the summary page + * @todo Draw discounts + * @todo Draw tax details + */ + private function pdfInvoiceSummary($id,$pdf) { # Invoice details: - $db = &DB(); - $invoice = $db->Execute( $sql = sqlSelect($db, array("invoice", "currency"), "A.*, B.symbol", "A.id = ::$id:: AND B.id = A.billed_currency_id")); - $pdf->setInvoiceFields($invoice->fields); - $pdf->setDueAmt($invoice->fields['total_amt'] - $invoice->fields['billed_amt']); - $pdf->setCurrency($invoice->fields['symbol']); - $pdf->setDateRange( mktime(0,0,0,date('m',$invoice->fields['due_date'])-1, date('d',$invoice->fields['due_date']), date('Y',$invoice->fields['due_date'])), $invoice->fields['due_date']); - $pdf->drawInvoiceNo(); - $pdf->drawInvoiceDueDate(); - $pdf->drawInvoiceTotalAmt(); - $pdf->drawInvoiceDueAmt(); - $pdf->drawInvoicePaidAmt(); - $pdf->drawInvoiceDiscountAmt(); - $pdf->drawInvoiceTaxAmt(); - $pdf->drawInvoiceShippingAmt(); - $pdf->drawInvoiceRange(); - if($invoice->fields['billing_status'] !=1 && $invoice->fields['suspend_billing'] != 1 && $invoice->fields['due_date'] <= time()) - $pdf->drawInvoiceDueNotice(); - elseif($invoice->fields['billing_status'] == 1) - $pdf->drawInvoicePaidNotice(); - - # Account details: - $account = $db->Execute("SELECT * FROM ".AGILE_DB_PREFIX."account WHERE id = ".$db->qstr($invoice->fields['account_id'])." AND site_id = ".$db->qstr(DEFAULT_SITE)); - $pdf->setAccountFields($account->fields); - $pdf->drawAccountId(); - $pdf->drawAccountUsername(); - $pdf->drawAccountName(); - $pdf->drawAccountMailing(); - - # Company details: - $pdf->drawCompanyAddress(); - $pdf->drawCompanyLogo(); - - ## Get the summary items - $items = & $db->Execute("select sku, item_type, product_name, product_id, sum(quantity) as quantity, (sum(total_amt)) as amount, price_setup, price_base from ".AGILE_DB_PREFIX."invoice_item where invoice_id=".$db->qstr($id)." group by sku, item_type"); - $i = 0; - if($items && $items->RecordCount()) { - while (!$items->EOF) { - $items_arr[$i] = $items->fields; - $desc = $this->getLineItemDesc($items->fields['sku'], $items->fields['product_id'], false, $items->fields['product_name']); - $items_arr[$i]['name'] = $desc; - $i++; - if ($items->fields['price_setup']) { - $items_arr[$i]['name'] = $desc." Set-up Charge"; - $items_arr[$i]['amount'] = $items->fields['price_setup']; - $i++; - } - $items->MoveNext(); - } - } - if ($invoice->fields['discount_amt']) { - $items_arr[$i]['name'] = 'Discount'; - $items_arr[$i]['amount'] = -($invoice->fields['discount_amt']); - $i++; - } - if ($invoice->fields['tax_amt']) { - $trs = $db->Execute($sql=sqlSelect($db, Array('invoice_item_tax','tax'),"A.amount,B.description","A.tax_id=B.id AND A.invoice_id=::$id::")); - if($trs && $trs->RecordCount()) { - unset($taxes); - while(!$trs->EOF) { - $taxes["{$trs->fields['description']}"] += $trs->fields["amount"]; - $trs->MoveNext(); - } - foreach($taxes as $txds=>$txamt) { - $items_arr[$i]['name'] = $txds; - $items_arr[$i]['amount'] = $txamt; - $i++; - } - } - } - $pdf->drawSummaryLineItems($items_arr); - unset($items_arr); + $db = &DB(); + + # Draw Invoice Basics + $pdf->drawCompanyLogo(); + $pdf->drawCompanyAddress($this); + + $pdf->drawInvoiceHeader($this); + $pdf->drawNews($this->print['invcfg']['news']); + $pdf->drawRemittenceStub($this); + $pdf->drawPaymentMethods($this); + + if ($this->print['invoice']['billing_status'] !=1 && $this->print['invoice']['suspend_billing'] != 1 && $this->print['invoice']['due_date'] <= time()) + $pdf->drawInvoiceDueNotice(); + elseif($this->print['invoice']['billing_status'] == 1) + $pdf->drawInvoicePaidNotice(); + + if ($this->getPreviousBalance()) + $pdf->drawSummaryInvoicesDue($this->print['previousinvoices']); + + $pdf->drawSummaryLineItems($this); unset($pdf->itemsSummary); - - ## BEGIN loop for enumerating information in multiple ways on the invoice + + # BEGIN loop for enumerating information in multiple ways on the invoice $iteration = 0; - while($pdf->drawLineItems_pre($iteration)) { - ## Get the line items: - $items = & $db->Execute( sqlSelect($db, "invoice_item", "*", "invoice_id = ::$id::") ); - if ($items && $items->RecordCount()) { - while ( !$items->EOF ) { - #$items_arr[] = $items->fields; - // get the date range if set - if(!empty($items->fields['date_start']) && !empty($items->fields['date_stop'])) { + while ($pdf->drawLineItems_pre($iteration)) { + # Get the line items: + $items = $db->Execute(sqlSelect($db,'invoice_item','*',array('invoice_id'=>$this->getInvoiceNum()))); + if ($items && $items->RecordCount()) { + while (! $items->EOF) { + # Get the date range if set + if (! empty($items->fields['date_start']) && ! empty($items->fields['date_stop'])) { global $C_translate; - $C_translate->value('invoice','start', date(UNIX_DATE_FORMAT,$items->fields['date_start'])); - $C_translate->value('invoice','stop', date(UNIX_DATE_FORMAT,$items->fields['date_stop'])); - #$smart_items[$ii]['range'] = $C_translate->translate('recur_date_range','invoice',''); + $C_translate->value('invoice','start',date(UNIX_DATE_FORMAT,$items->fields['date_start'])); + $C_translate->value('invoice','stop',date(UNIX_DATE_FORMAT,$items->fields['date_stop'])); } - + $cost = $items->fields['price_base']; $total = $cost * $items->fields['quantity']; - $desc = $this->getLineItemDesc($items->fields['sku'],$items->fields['product_id'], strtolower($items->fields['domain_name'].'.'.$items->fields['domain_tld']), $items->fields['product_name']); + $desc = $this->getLineItemDesc($items->fields['sku'],$items->fields['product_id'],strtolower($items->fields['domain_name'].'.'.$items->fields['domain_tld']),$items->fields['product_name']); $line = array( - "name" => $desc, - 'amount' => $cost, - 'sku'=>$items->fields['sku'], - 'qty'=>$items->fields['quantity'], - 'cost'=>$cost, - 'attr'=>$items->fields['product_attr'], - 'price_type'=>$items->fields['price_type'], - 'price_base'=>$items->fields['price_base'], + 'name' => $desc, + 'domain' => $items->fields['domain_name'], + 'amount' => $cost, + 'sku'=>$items->fields['sku'], + 'qty'=>$items->fields['quantity'], + 'cost'=>$cost, + 'attr'=>$items->fields['product_attr'], + 'price_type'=>$items->fields['price_type'], + 'price_base'=>$items->fields['price_base'], 'item_type'=>$items->fields['item_type'], + 'daterange'=>sprintf('%s - %s',date(UNIX_DATE_FORMAT,$items->fields['date_start']),date(UNIX_DATE_FORMAT,$items->fields['date_stop'])), 'total_amt'=>$items->fields['total_amt'] - ); - $pdf->drawLineItems($db, $line); + ); + + $pdf->drawLineItems($db,$line,$this->getInvoiceNum()); + if ($items->fields['price_setup']) { - $desc .= " Set-up Charge"; + $desc .= ' Set-up Charge'; $total = $items->fields['price_setup']; - $line = array("name" => $desc, 'amount' => $total, 'qty'=>'1', 'sku'=>$items->fields['sku'], 'cost'=>$total, 'price_base'=>$total, 'price_type'=>999); - $pdf->drawLineItems($db, $line); + $line = array('name'=>$desc,'amount'=>$total,'qty'=>'1','sku'=>$items->fields['sku'],'cost'=>$total,'price_base'=>$total,'price_type'=>999); + $pdf->drawLineItems($db,$line,$this->getInvoiceNum()); } + $items->MoveNext(); } - } - if ($invoice->fields['discount_amt']) { + } + + if ($this->print['invoice']['discount_amt']) { $desc = 'Discount'; - $total = -($invoice->fields['discount_amt']); - $line = array("name" => $desc, 'amount' => $total, 'qty'=>'1', 'cost'=>$total, 'price_base'=>$total, 'price_type'=>999); - $pdf->drawLineItems($db, $line); + $total = -($this->print['invoice']['discount_amt']); + $line = array('name'=>$desc,'amount'=>$total,'qty'=>'1','cost'=>$total,'price_base'=>$total,'price_type'=>999); + $pdf->drawLineItems($db,$line,$this->getInvoiceNum()); } - if ($invoice->fields['tax_amt']) { - $trs = $db->Execute($sql=sqlSelect($db, Array('invoice_item_tax','tax'),"A.amount,B.description","A.tax_id=B.id AND A.invoice_id=::$id::")); - if($trs && $trs->RecordCount()) { - unset($taxes); - while(!$trs->EOF) { - $taxes["{$trs->fields['description']}"] += $trs->fields["amount"]; - $trs->MoveNext(); - } - foreach($taxes as $txds=>$txamt) { - $line = array("name" => $txds, 'amount' => $txamt, 'qty'=>'1', 'cost'=>$txamt, 'price_base'=>$txamt, 'price_type'=>999); - $pdf->drawLineItems($db, $line); + + if ($this->print['invoice']['tax_amt']) { + $trs = $db->Execute(sqlSelect($db,array('invoice_item_tax','tax'),'A.amount,B.description',sprintf('A.tax_id=B.id AND A.invoice_id=%s',$this->getInvoiceNum()))); + if ($trs && $trs->RecordCount()) { + $taxes = array(); + + while (! $trs->EOF) { + if (! isset($taxes[$trs->fields['description']])) + $taxes[$trs->fields['description']] = $trs->fields['amount']; + else + $taxes[$trs->fields['description']] += $trs->fields['amount']; + + $trs->MoveNext(); } - } + + foreach ($taxes as $txds=>$txamt) { + $line = array('name'=>$txds,'amount'=>$txamt,'total_amt'=>$txamt,'price_type'=>999); + $pdf->drawLineItems($db,$line,$this->getInvoiceNum()); + } + } } + # Increment the iteration ++$iteration; } + # Custom functions: - $pdf->drawCustom(); - unset($db); + $pdf->drawCustom(); + unset($db); } - /** RESEND DUE NOTICE + /** RESEND DUE NOTICE */ function resend($VAR) { global $C_debug; - + # User invoice creation confirmation include_once(PATH_MODULES.'email_template/email_template.inc.php'); $mail = new email_template; $mail->send('invoice_resend', $VAR['account_id'], $VAR['id'], '', ''); - + # Alert $C_debug->alert('Sent payment due notice to user'); - + # Update invoice $db = &DB(); $q = "SELECT notice_count FROM ".AGILE_DB_PREFIX."invoice WHERE @@ -2211,414 +2468,510 @@ class invoice $rs = $db->Execute($q); } - + /** - * Generate all invoices for recurring services/charges/domains + * Generate all invoices for recurring services/charges/domains */ - function generate() { - - // check if charge module installed + public function generate() { + # Check if charge module installed global $C_list; - $charge_installed = $C_list->is_installed('charge'); - + $isChargeInstalled = $C_list->is_installed('charge'); + // get services to be billed grouped by account and date - if(MAX_INV_GEN_PERIOD <= 0) $max_date = time()+86400; else $max_date = time()+(MAX_INV_GEN_PERIOD*86400); - $p=AGILE_DB_PREFIX; $s=DEFAULT_SITE; - $ids=false; - $account=false; - $date=false; - $invoice=false; - $sql = "SELECT DISTINCT service.id as serviceId, account.id as accountId, invoice.id as invoiceId, from_unixtime(service.date_next_invoice,'%Y-%m-%d') as dayGroup - FROM {$p}service as service + if (! defined('MAX_INV_GEN_PERIOD') || MAX_INV_GEN_PERIOD <= 0) + $max_date = time()+86400; + else + $max_date = time()+(MAX_INV_GEN_PERIOD*86400); + + #$p=AGILE_DB_PREFIX; $s=DEFAULT_SITE; +/* + $sql = "SELECT DISTINCT service.id as serviceId, account.id as accountId, invoice.id as invoiceId, from_unixtime(service.date_next_invoice,'%Y-%m-%d') as dayGroup + FROM {$p}service as service JOIN {$p}account as account ON ( service.account_id=account.id and account.site_id={$s} ) LEFT JOIN {$p}invoice as invoice ON ( service.invoice_id=invoice.id and invoice.site_id={$s} ) - WHERE service.site_id={$s} - AND service.active = 1 - AND ( service.suspend_billing IS NULL OR service.suspend_billing = 0 ) + WHERE service.site_id={$s} + AND service.active = 1 + AND ( service.suspend_billing IS NULL OR service.suspend_billing = 0 ) AND ( service.date_next_invoice > 0 AND service.date_next_invoice IS NOT NULL ) - AND + AND (( - ( account.invoice_advance_gen!='' OR account.invoice_advance_gen is not null ) AND service.date_next_invoice <= (UNIX_TIMESTAMP(CURDATE())+(account.invoice_advance_gen*86400)) - ) OR ( - ( account.invoice_advance_gen='' OR account.invoice_advance_gen is null ) AND service.date_next_invoice <= {$max_date} + (account.invoice_advance_gen!='' OR account.invoice_advance_gen is not null) AND service.date_next_invoice <= (UNIX_TIMESTAMP(CURDATE())+(account.invoice_advance_gen*86400)) + ) OR ( + (account.invoice_advance_gen='' OR account.invoice_advance_gen is null) AND service.date_next_invoice <= {$max_date} )) - ORDER BY accountId, dayGroup, serviceId"; + ORDER BY accountId, dayGroup, serviceId"; +*/ $db=&DB(); - #$db->debug=true; - $rs=$db->Execute($sql); - if($rs === false) {global $C_debug; $C_debug->error('invoice.inc.php','generate()', $sql . " \r\n\r\n " . @$db->ErrorMsg()); } - if($rs && $rs->RecordCount()) { - while(!$rs->EOF) { - if( $ids && ($rs->fields['accountId'] != $account ) || ($rs->fields['dayGroup'] != $date) ) { - $this->generateInvoices($ids, $account, $invoice, $charge_installed); - $ids=false; + $rs = $db->Execute($sql = $this->sql_invoice_soon()); + if (! $rs) { + global $C_debug; + + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); + + } elseif($rs->RecordCount()) { + $ids = ''; + $account = ''; + $date = ''; + $invoice = ''; + + while (! $rs->EOF) { + if ($ids && (($rs->fields['aid'] != $account) || ($rs->fields['invoice_date'] != $date))) { + $this->generateInvoices($ids,$account,$invoice,$isChargeInstalled); + $ids = ''; } - - // set the current account and date - $account=$rs->fields['accountId']; - $invoice=$rs->fields['invoiceId']; - $date=$rs->fields['dayGroup']; - - // add to id list - if($ids) $ids.=","; - $ids.=$rs->fields['serviceId']; + + # Set the current account and date + $account = $rs->fields['aid']; + $invoice = $rs->fields['iid']; + $date = $rs->fields['invoice_date']; + + # Add to id list + if ($ids) + $ids .= ','.$rs->fields['sid']; + else + $ids = $rs->fields['sid']; + $rs->MoveNext(); } - if($ids) $this->generateInvoices($ids, $account, $invoice, $charge_installed); + + if ($ids) + $this->generateInvoices($ids,$account,$invoice,$isChargeInstalled); } - - // Generate invoices for any domains expiring in X days. - if($C_list->is_installed('host_tld')) $this->generateDomains(); - + + // Generate invoices for any domains expiring in X days. + if ($C_list->is_installed('host_tld')) + $this->generateDomains(); + return true; } - - - function generateInvoices($ids, $account_id, $invoice_id, $charge_installed=false) { - if(empty($ids)) return false; - - # load required elements - include_once(PATH_MODULES . 'service/service.inc.php'); - include_once(PATH_MODULES . 'discount/discount.inc.php'); - include_once(PATH_MODULES . 'tax/tax.inc.php'); + public function generateinvoice_account($VAR) { + # Check if charge module installed + global $C_list; + + $charge_installed = $C_list->is_installed('charge'); + + $db = &DB(); + $rs = $db->Execute($q = $this->sql_invoice_soon(null,0,$VAR['account_id'])); + + if (! $rs) { + global $C_debug; + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); + + return; + } + + # Set the invoice and date + $invoice = $rs->fields['iid']; + $date = $rs->fields['invoice_date']; + $ids = ''; + + while (! $rs->EOF) { + if ($ids && ($rs->fields['invoice_date'] != $date)) { + $this->generateInvoices($ids,$VAR['account_id'],$invoice,$charge_installed); + $ids = ''; + } + + # Add to id list + if ($ids) + $ids .= ','; + + $ids .= $rs->fields['sid']; + $rs->MoveNext(); + } + + if ($ids) + $this->generateInvoices($ids,$VAR['account_id'],$invoice,$charge_installed); + + if (isset($VAR['_page_next'])) + define('REDIRECT_PAGE','?_page='.$VAR['_page_next']); + } + + /** + * Generate an Invoice + */ + private function generateInvoices($ids,$account_id,$invoice_id,$charge_installed=false) { + if (empty($ids)) + return false; + + # Load required elements + include_once(PATH_MODULES.'service/service.inc.php'); + $serviceObj = new service; + + include_once(PATH_MODULES.'discount/discount.inc.php'); + $discountObj = new discount; + + include_once(PATH_MODULES.'tax/tax.inc.php'); $taxObj = new tax; - $serviceObj = new service; - - # start a transaction - $db=&DB(); - #$db->debug=true; - if(AGILE_DB_TYPE == 'mysqlt') { + + # Start a transaction + $db = &DB(); + if (AGILE_DB_TYPE == 'mysqlt') { $db->StartTrans(); - if(!$db->hasTransactions) { + + if (! $db->hasTransactions) { global $C_debug; - $msg= "Transactions not supported in 'mysql' driver. Use 'mysqlt' or 'mysqli' driver"; + + $msg = "Transactions not supported in 'mysql' driver. Use 'mysqlt' or 'mysqli' driver"; $C_debug->alert($msg); - $C_debug->error('invoice.inc.php','generateInvoices()', "Transactions not supported in 'mysql' driver. Use 'mysqlt' or 'mysqli' driver"); - return false; + $C_debug->error(__FILE__,__METHOD__,$msg); + + return false; } } - - # generate an invoice id - $invoice = sqlGenID($db, 'invoice'); - - # check for any discounts for the parent invoice or account_id + + # Generate an invoice id + $invoice = sqlGenID($db,'invoice'); + + # Check for any discounts for the parent invoice or account_id # applied at checkout and should continue to be applied if recurring type discount - $discountObj = new discount; - $discountObj->available_discounts($account_id, 1, $invoice_id); - - # beginning totals - $sub_total=0; - $taxable_amount=0; - $tax_amt=0; - $discount_amt=0; - - # get the full account and service and invoice details + $discountObj->available_discounts($account_id,1,$invoice_id); + + # Beginning totals + $sub_total = 0; + $total = 0; + $taxable_amount = 0; + $tax_amt = 0; + $discount_amt = 0; + + # Get the full account and service and invoice details $p=AGILE_DB_PREFIX; $s=DEFAULT_SITE; - $sql = "SELECT DISTINCT - service.id, service.parent_id, service.invoice_id, service.invoice_item_id, service.account_id, service.account_billing_id, service.product_id, - service.sku, service.active, service.bind, service.type, service.price, service.price_type, service.taxable, service.date_last_invoice, service.date_next_invoice, - service.recur_type, service.recur_schedule, service.recur_weekday, service.recur_week, service.domain_name, - service.domain_tld, service.domain_type, service.domain_term, service.prod_attr, service.prod_attr_cart, - account.currency_id, account.first_name, account.last_name, account.country_id, account.state, account.invoice_grace, account.invoice_advance_gen, account.affiliate_id as account_affiliate_id, - invoice.affiliate_id, invoice.campaign_id, invoice.reseller_id, invoice.checkout_plugin_id, invoice.checkout_plugin_data, invoice.billed_currency_id, invoice.actual_billed_currency_id - FROM {$p}service as service - JOIN {$p}account as account ON ( service.account_id=account.id and account.site_id={$s} ) - LEFT JOIN {$p}invoice as invoice ON ( service.invoice_id=invoice.id and invoice.site_id={$s} ) - WHERE service.id in ({$ids})"; - $service=$db->Execute($sql); - if($service === false) {global $C_debug; $C_debug->error('invoice.inc.php','generateInvoices()1', $sql . " \r\n\r\n " . @$db->ErrorMsg()); $db->FailTrans(); return false; } - if($service && $service->RecordCount()) { - while(!$service->EOF) { - - if(empty($service->fields['billed_currency_id'])) $service->fields['billed_currency_id'] = DEFAULT_CURRENCY; - if(empty($service->fields['actual_billed_currency_id'])) $service->fields['actual_billed_currency_id'] = $service->fields['billed_currency_id']; - - $this->account_id=$service->fields['account_id']; - $this->parent_id=$service->fields['invoice_id']; - $this->account_billing_id=$service->fields['account_billing_id']; - if(!empty($service->fields['account_affiliate_id'])) - $this->affiliate_id=$service->fields['account_affiliate_id']; - else - $this->affiliate_id=$service->fields['affiliate_id']; - $this->campaign_id=$service->fields['campaign_id']; - $this->reseller_id=$service->fields['reseller_id']; - $this->checkout_plugin_id=$service->fields['checkout_plugin_id']; - $this->checkout_plugin_data=$service->fields['checkout_plugin_data']; - $this->billed_currency_id=$service->fields['billed_currency_id']; - $this->actual_billed_currency_id=$service->fields['actual_billed_currency_id']; - $this->invoice_grace=$service->fields['invoice_grace']; - - $item_tax_amt=0; - $item_total_amt=0; - $item_discount_amt=0; - - # gen item_id - $item = sqlGenID($db, "invoice_item"); - + $sql = "SELECT DISTINCT + service.id, service.parent_id, service.invoice_id, service.invoice_item_id, service.account_id, service.account_billing_id, service.product_id, + service.sku, service.active, service.bind, service.type, service.price, service.price_type, service.taxable, service.date_last_invoice, service.date_next_invoice, + service.recur_type, service.recur_schedule, service.recur_weekday, service.recur_week, service.domain_name, + service.domain_tld, service.domain_type, service.domain_term, service.prod_attr, service.prod_attr_cart, + account.currency_id, account.first_name, account.last_name, account.country_id, account.state, account.invoice_grace, account.invoice_advance_gen, account.affiliate_id as account_affiliate_id, + invoice.affiliate_id, invoice.campaign_id, invoice.reseller_id, invoice.checkout_plugin_id, invoice.checkout_plugin_data, invoice.billed_currency_id, invoice.actual_billed_currency_id + FROM {$p}service as service + JOIN {$p}account as account ON (service.account_id=account.id AND account.site_id={$s}) + LEFT JOIN {$p}invoice as invoice ON (service.invoice_id=invoice.id AND invoice.site_id={$s}) + WHERE service.id in ({$ids})"; + + $service = $db->Execute($sql); + if ($service === false) { + global $C_debug; + + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); + $db->FailTrans(); + + return false; + } + + if ($service && $service->RecordCount()) { + while (! $service->EOF) { + if (empty($service->fields['billed_currency_id'])) + $service->fields['billed_currency_id'] = DEFAULT_CURRENCY; + if (empty($service->fields['actual_billed_currency_id'])) + $service->fields['actual_billed_currency_id'] = $service->fields['billed_currency_id']; + + $this->account_id = $service->fields['account_id']; + $this->parent_id = $service->fields['invoice_id']; + $this->account_billing_id = $service->fields['account_billing_id']; + + if (! empty($service->fields['account_affiliate_id'])) + $this->affiliate_id = $service->fields['account_affiliate_id']; + else + $this->affiliate_id = $service->fields['affiliate_id']; + + $this->campaign_id = $service->fields['campaign_id']; + $this->reseller_id = $service->fields['reseller_id']; + $this->checkout_plugin_id = $service->fields['checkout_plugin_id']; + $this->checkout_plugin_data = $service->fields['checkout_plugin_data']; + $this->billed_currency_id = $service->fields['billed_currency_id']; + $this->actual_billed_currency_id = $service->fields['actual_billed_currency_id']; + $this->invoice_grace = $service->fields['invoice_grace']; + + $item_tax_amt = 0; + $item_total_amt = 0; + $item_discount_amt = 0; + + # Gen item_id + $item = sqlGenID($db,'invoice_item'); + # Calculate any recurring discounts for this item - $item_total_amt = $service->fields['price']; - $item_discount_amt = $discountObj->calc_all_discounts(1, $item, $service->fields['product_id'], $service->fields['price'], $service->fields['account_id'], $sub_total+$service->fields['price']); + $item_total_amt = $service->fields['price']; + $item_discount_amt = $discountObj->calc_all_discounts(1,$item,$service->fields['product_id'],$service->fields['price'],$service->fields['account_id'],$sub_total+$service->fields['price']); $item_total_amt -= $item_discount_amt; $sub_total += $item_total_amt; $discount_amt += $item_discount_amt; - - # calculate any taxes for this item - if($service->fields['taxable'] == 1) { - $item_tax_amt=0; - $item_tax_arr = $taxObj->calculate($item_total_amt, $service->fields['country_id'], $service->fields['state']); - if(is_array($item_tax_arr)) foreach($item_tax_arr as $tx) $item_tax_amt += $tx['rate']; - $tax_amt += $item_tax_amt; + + # Calculate any taxes for this item + if ($service->fields['taxable'] == 1) { + $item_tax_amt = 0; + $item_tax_arr = $taxObj->calculate($item_total_amt,$service->fields['country_id'],$service->fields['state']); + + if (is_array($item_tax_arr)) + foreach($item_tax_arr as $tx) + $item_tax_amt += $tx['rate']; + + $tax_amt += $item_tax_amt; } - + # Calculate next invoice date - $next_invoice = $serviceObj->calcNextInvoiceDate($service->fields['date_next_invoice'], $service->fields['recur_schedule'], $service->fields['recur_type'], $service->fields['recur_weekday']); + $next_invoice = $serviceObj->calcNextInvoiceDate($service->fields['date_next_invoice'],$service->fields['recur_schedule'],$service->fields['recur_type'],$service->fields['recur_weekday']); $due_date = $service->fields['date_next_invoice']; - $recur_schedule=0; - if(!empty($service->fields['recur_schedule'])) $recur_schedule = $service->fields['recur_schedule']; - - // create the invoice item - $sql="INSERT INTO {$p}invoice_item SET - id=$item, - site_id=$s, - date_orig=".time().", - invoice_id = $invoice, - account_id={$service->fields['account_id']}, - service_id={$service->fields['id']}, - product_id={$service->fields['product_id']}, - product_attr=".$db->qstr($service->fields['prod_attr']).", - product_attr_cart=".$db->qstr($service->fields['prod_attr_cart']).", - sku=".$db->qstr($service->fields['sku']).", - quantity=1, - item_type=0, - price_type={$service->fields['price_type']}, - price_base={$service->fields['price']}, - price_setup=0, - recurring_schedule={$recur_schedule}, - date_start={$service->fields['date_next_invoice']}, - date_stop=$next_invoice, - domain_name=".$db->qstr($service->fields['domain_name']).", - domain_tld=".$db->qstr($service->fields['domain_tld']).", - domain_type=".$db->qstr($service->fields['domain_type']).", - tax_amt=$tax_amt, - total_amt=$item_total_amt, - discount_amt=$item_discount_amt"; - $itemrs=$db->Execute($sql); - if($itemrs === false) {global $C_debug; $C_debug->error('invoice.inc.php','generateInvoices()2', $sql . " \r\n\r\n " . @$db->ErrorMsg()); $db->FailTrans(); return false; } - - // Insert tax records - $taxObj->invoice_item($invoice, $item, $service->fields['account_id'], @$item_tax_arr); - + + $recur_schedule = 0; + if (! empty($service->fields['recur_schedule'])) + $recur_schedule = $service->fields['recur_schedule']; + + # Create the invoice item + $itemrs = $db->Execute(sqlInsert($db,'invoice_item',array( + 'date_orig'=>time(), + 'invoice_id'=>$invoice, + 'account_id'=>$service->fields['account_id'], + 'service_id'=>$service->fields['id'], + 'product_id'=>$service->fields['product_id'], + 'product_attr'=>$service->fields['prod_attr'], + 'product_attr_cart'=>$service->fields['prod_attr_cart'], + 'sku'=>$service->fields['sku'], + 'quantity'=>1, + 'item_type'=>0, + 'price_type'=>$service->fields['price_type'], + 'price_base'=>$service->fields['price'], + 'price_setup'=>0, + 'recurring_schedule'=>$recur_schedule, + 'date_start'=>$service->fields['date_next_invoice'], + 'date_stop'=>$next_invoice, + 'domain_name'=>$service->fields['domain_name'], + 'domain_tld'=>$service->fields['domain_tld'], + 'domain_type'=>$service->fields['domain_type'], + 'tax_amt'=>$tax_amt, + 'total_amt'=>$item_total_amt, + 'discount_amt'=>$item_discount_amt + ),$item)); + + if ($itemrs === false) { + global $C_debug; + + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); + $db->FailTrans(); + + return false; + } + + # Insert tax records + $taxObj->invoice_item($invoice,$item,$service->fields['account_id'],@$item_tax_arr); + # Insert discount records - $discountObj->invoice_item($invoice, $item, $service->fields['account_id'], @$discountObj->discount_arr); - - // Update the last & next invoice date for this service - $sql="UPDATE {$p}service - SET - date_last_invoice = {$service->fields['date_next_invoice']}, - date_next_invoice = $next_invoice - WHERE - site_id=$s AND id = {$service->fields['id']} "; - $srvsrs = $db->Execute($sql); - if($srvsrs === false) {global $C_debug; $C_debug->error('invoice.inc.php','generateInvoices()3', $sql . " \r\n\r\n " . @$db->ErrorMsg()); $db->FailTrans(); return false; } - - // get any charges for this service and create them as invoice items - if($charge_installed) { + $discountObj->invoice_item($invoice,$item,$service->fields['account_id'],@$discountObj->discount_arr); + + # Update the last & next invoice date for this service + $srvsrs = $db->Execute(sqlUpdate($db,'service',array('date_last_invoice'=>$service->fields['date_next_invoice'],'date_next_invoice'=>$next_invoice),array('id'=>$service->fields['id']))); + if ($srvsrs === false) { + global $C_debug; + + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); + $db->FailTrans(); + + return false; + } + + # Get any charges for this service and create them as invoice items + if ($charge_installed) { $sql = "SELECT * FROM ".AGILE_DB_PREFIX."charge WHERE (status=0 or status is null) and site_id=".DEFAULT_SITE." AND service_id = ".$service->fields['id']." AND date_orig < ". $service->fields['date_next_invoice']; $charge = $db->Execute($sql); - if($charge && $charge->RecordCount()) { - while(!$charge->EOF) { + if($charge && $charge->RecordCount()) { + while(!$charge->EOF) { $item_tax_amt=0; $item_total_amt=0; $item_discount_amt=0; - + // Calculate any recurring discounts for this charge item - $item_total_amt = ($charge->fields['quantity']*$charge->fields['amount']); + $item_total_amt = ($charge->fields['quantity']*$charge->fields['amount']); $item_discount_amt = $discountObj->calc_all_discounts(1, $item, $charge->fields['product_id'], $item_total_amt, $service->fields['account_id'], $sub_total+$item_total_amt); $item_total_amt -= $item_discount_amt; $sub_total += $item_total_amt; - $discount_amt += $item_discount_amt; - + $discount_amt += $item_discount_amt; + // calculate any taxes for this item if($charge->fields['taxable'] == 1) { - $item_tax_amt=0; - $item_tax_arr = $taxObj->calculate($chargeamt, $service->fields['country_id'], $service->fields['state']); - if(is_array($item_tax_arr)) foreach($item_tax_arr as $tx) $item_tax_amt += $tx['rate']; - $tax_amt += $item_tax_amt; - } - + $item_tax_amt=0; + $item_tax_arr = $taxObj->calculate($chargeamt, $service->fields['country_id'], $service->fields['state']); + if(is_array($item_tax_arr)) foreach($item_tax_arr as $tx) $item_tax_amt += $tx['rate']; + $tax_amt += $item_tax_amt; + } + // create the invoice item $charge_item_id = sqlGenID($db, 'invoice_item'); - - $sql = "INSERT INTO {$p}invoice_item SET - id = $charge_item_id, + + $sql = "INSERT INTO {$p}invoice_item SET + id = $charge_item_id, site_id = $s, charge_id = {$charge->fields['id']}, date_orig = ".time().", - invoice_id = $invoice, - account_id = ".$this->account_id.", + invoice_id = $invoice, + account_id = ".$this->account_id.", service_id = ".$db->qstr($service->fields['id']).", - product_id = ".$db->qstr($charge->fields['product_id']).", - product_attr= ".$db->qstr($charge->fields['attributes']).", - sku = ".$db->qstr($service->fields['sku']).", - price_base = ".$db->qstr($charge->fields['amount']).", - quantity = ".$charge->fields['quantity'].", + product_id = ".$db->qstr($charge->fields['product_id']).", + product_attr= ".$db->qstr($charge->fields['attributes']).", + sku = ".$db->qstr($service->fields['sku']).", + price_base = ".$db->qstr($charge->fields['amount']).", + quantity = ".$charge->fields['quantity'].", item_type = 5, price_type = 0, - price_setup = 0, - tax_amt = $item_tax_amt, - total_amt = $item_total_amt, + price_setup = 0, + tax_amt = $item_tax_amt, + total_amt = $item_total_amt, discount_amt= $item_discount_amt"; - $itemrs=$db->Execute($sql); + $itemrs=$db->Execute($sql); if($itemrs === false) {global $C_debug; $C_debug->error('invoice.inc.php','generateInvoices()4', $sql . " \r\n\r\n " . @$db->ErrorMsg()); $db->FailTrans(); return false; } - + # Insert tax records - $taxObj->invoice_item($invoice, $charge_item_id, $charge->fields['account_id'], @$item_tax_arr); - + $taxObj->invoice_item($invoice, $charge_item_id, $charge->fields['account_id'], @$item_tax_arr); + # Insert discount records $discountObj->invoice_item($invoice, $charge_item_id, $charge->fields['account_id'], @$discountObj->discount_arr); - + # update charge status $chargers=$db->Execute("UPDATE ".AGILE_DB_PREFIX."charge set status=1 WHERE id={$charge->fields['id']} AND site_id=".DEFAULT_SITE); if($chargers === false) {global $C_debug; $C_debug->error('invoice.inc.php','generateInvoices()2', $sql . " \r\n\r\n " . @$db->ErrorMsg()); $db->FailTrans(); return false; } - + $charge->MoveNext(); - } - } - } - $service->MoveNext(); + } + } + } + $service->MoveNext(); } - - // add any taxes - @$total = $sub_total + $tax_amt; - - // get invoice grace period from global/account - if(!empty($this->invoice_grace)) $grace_period=$this->invoice_grace; else $grace_period=GRACE_PERIOD; - - $sql = "INSERT INTO {$p}invoice SET - id=$invoice, - site_id=$s, - date_orig = ".time().", - date_last = ".time().", - notice_next_date = ".time().", - type = 1, - process_status = 0, - billing_status = 0, - suspend_billing = 0, - print_status = 0, - refund_status = 0, - billed_amt = 0, - actual_billed_amt = 0, - notice_count = 0, - parent_id = ".$db->qstr($this->parent_id).", - account_id = {$this->account_id}, - account_billing_id = ".$db->qstr($this->account_billing_id).", - affiliate_id = ".$db->qstr($this->affiliate_id).", - campaign_id = ".$db->qstr($this->campaign_id).", - reseller_id = ".$db->qstr($this->reseller_id).", - checkout_plugin_id = ".$db->qstr($this->checkout_plugin_id).", - checkout_plugin_data = ".$db->qstr($this->checkout_plugin_data).", - actual_billed_currency_id = ".$db->qstr($this->actual_billed_currency_id).", - billed_currency_id = ".$db->qstr($this->billed_currency_id).", - notice_max = ".$db->qstr(MAX_BILLING_NOTICE).", - grace_period = ".$db->qstr($grace_period).", - tax_amt = ".$tax_amt.", - discount_amt = ".$discount_amt.", - total_amt = ".$total.", - due_date = $due_date"; - $invoicers=$db->Execute($sql); - if($invoicers === false) {global $C_debug; $C_debug->error('invoice.inc.php','generateInvoices()2', $sql . " \r\n\r\n " . @$db->ErrorMsg()); $db->FailTrans(); return false; } - } - - if(AGILE_DB_TYPE == 'mysqlt') $db->CompleteTrans(); + + # Add any taxes + $total = $sub_total+$tax_amt; + + # Get invoice grace period from global/account + if (! empty($this->invoice_grace)) + $grace_period = $this->invoice_grace; + else + $grace_period = GRACE_PERIOD; + + $invoicers = $db->Execute($a=sqlInsert($db,'invoice',array( + 'date_orig'=>time(), + 'date_last'=>time(), + 'notice_next_date'=>time(), + 'type'=>1, + 'process_status'=>0, + 'billing_status'=>0, + 'suspend_billing'=>0, + 'print_status'=>0, + 'refund_status'=>0, + 'billed_amt'=>0, + 'actual_billed_amt'=>0, + 'notice_count'=>0, + 'parent_id'=>$this->parent_id, + 'account_id'=>$this->account_id, + 'account_billing_id'=>$this->account_billing_id, + 'affiliate_id'=>$this->affiliate_id, + 'campaign_id'=>$this->campaign_id, + 'reseller_id'=>$this->reseller_id, + 'checkout_plugin_id'=>$this->checkout_plugin_id, + 'checkout_plugin_data'=>$this->checkout_plugin_data, + 'actual_billed_currency_id'=>$this->actual_billed_currency_id, + 'billed_currency_id'=>$this->billed_currency_id, + 'notice_max'=>MAX_BILLING_NOTICE, + 'grace_period'=>$grace_period, + 'tax_amt'=>$tax_amt, + 'discount_amt'=>$discount_amt, + 'total_amt'=>$total, + 'due_date'=>$due_date + ),$invoice)); + + if ($invoicers === false) { + global $C_debug; + + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); + $db->FailTrans(); + + return false; + } + } + + if (AGILE_DB_TYPE == 'mysqlt') + $db->CompleteTrans(); } - - - - - /** Invoice expiring domains + + /** Invoice expiring domains */ function generateDomains() - { + { $db = &DB(); define('DEFAULT_DOMAIN_INVOICE', 30); //how far out to generate expiring domain invoices $expire = time() + (DEFAULT_DOMAIN_INVOICE*86400); - + ### Get domains expiring soon: $rs = $db->Execute( sqlSelect( $db, 'service', '*', " active=1 AND domain_date_expire <= $expire AND type = 'domain' AND queue = 'none' AND ( domain_type = 'register' OR domain_type = 'transfer' OR domain_type = 'renew' ) AND ( suspend_billing = 0 OR suspend_billing IS NULL) " ) ); - + if($rs && $rs->RecordCount() > 0 ) { while(!$rs->EOF) { # Check that this domain has not already been invoiced - $invoiced = $db->Execute( sqlSelect ($db, Array('invoice_item','invoice'), Array('A.*','B.*'), + $invoiced = $db->Execute(sqlSelect ($db, array('invoice_item','invoice'), array('A.*','B.*'), " A.invoice_id = B.id AND A.service_id = {$rs->fields['id']} AND A.sku = 'DOMAIN-RENEW' AND domain_type = 'renew' AND - date_start = {$rs->fields['date_last_invoice']} AND date_stop = {$rs->fields['domain_date_expire']}" ) ); - + date_start = {$rs->fields['date_last_invoice']} AND date_stop = {$rs->fields['domain_date_expire']}" ) ); + if($invoiced && $invoiced->RecordCount() == 0) { # Not previously invoiced, generate now! $this->generatedomaininvoice( $rs->fields, $this ); - } + } $rs->MoveNext(); } } } - - /** Invoice expiring domains p2 + + /** Invoice expiring domains p2 */ - function generatedomaininvoice( $VAR ) + function generatedomaininvoice($VAR) { include_once(PATH_MODULES . 'tax/tax.inc.php'); $taxObj = new tax; - + $db = &DB(); - + if( is_array( $VAR ) ) { $expire = time(); - $rs = $db->Execute( sqlSelect($db, 'service', '*', " id = ::{$VAR['id']}:: AND active=1 + $rs = $db->Execute(sqlSelect($db, 'service', '*', " id = ::{$VAR['id']}:: AND active=1 AND type = 'domain' AND queue = 'none' AND - ( domain_type = 'register' OR domain_type = 'transfer' OR domain_type = 'renew' ) AND - ( suspend_billing = 0 OR suspend_billing IS NULL ) " )); + (domain_type = 'register' OR domain_type = 'transfer' OR domain_type = 'renew') AND + (suspend_billing = 0 OR suspend_billing IS NULL) ")); $service = $rs->fields; } else { $service = $VAR; - } - + } + if(empty($service['id'])) { global $C_debug; $C_debug->alert("Unable to generate domain renweal invoice due to domain status."); return false; } - + # Get the parent invoice details: if(!empty($service['invoice_id'])) { - $rs = $db->Execute( sqlSelect($db, 'invoice', '*', " id = {$service['invoice_id']} ", "" ) ); + $rs = $db->Execute(sqlSelect($db, 'invoice', '*', " id = {$service['invoice_id']} ", "")); $invoice = $rs->fields; } else { $invoice = false; } - + # Get the account details: - $rs = $db->Execute( sqlSelect($db, 'account', '*', " id = {$service['account_id']} ", "" ) ); + $rs = $db->Execute(sqlSelect($db, 'account', '*', " id = {$service['account_id']} ", "")); $account = $rs->fields; - + # Get the account price include_once(PATH_MODULES.'host_tld/host_tld.inc.php'); - $tldObj=new host_tld; - $tld_arr = $tldObj->price_tld_arr($service['domain_tld'], 'renew', false, false, false, $service['account_id']); + $tldObj=new host_tld; + $tld_arr = $tldObj->price_tld_arr($service['domain_tld'], 'renew', false, false, false, $service['account_id']); foreach($tld_arr as $term => $price) break; - + # Calculate taxes: - $rs = $db->Execute($sql=sqlSelect($db,"host_tld","taxable","name = ::{$service['domain_tld']}::")); + $rs = $db->Execute($sql=sqlSelect($db,"host_tld","taxable","name = ::{$service['domain_tld']}::")); if( $service['taxable'] || @$rs->fields['taxable'] ) { $tax_arr = $taxObj->calculate($price, $account["country_id"], $account["state"]); } else { $tax_arr = false; } - + $total = $price; - + $tax_amt = 0; if(is_array($tax_arr)) { foreach($tax_arr as $tx) { @@ -2626,15 +2979,15 @@ class invoice } $total += $tax_amt; } - + # calculate the dates $expire = $service['domain_date_expire'] + ($term*86400); $due_date = $service['domain_date_expire'] - (86400*3); - + # Create the invoice - $id = sqlGenID( $db, "invoice" ); - $insert = $db->Execute( $sql = sqlInsert($db, "invoice", - Array( + $id = sqlGenID($db, "invoice"); + $insert = $db->Execute($sql = sqlInsert($db, "invoice", + array( 'date_orig' => time(), 'date_last' => time(), 'type' => 2, @@ -2662,12 +3015,12 @@ class invoice 'notice_max' => MAX_BILLING_NOTICE, 'grace_period' => 0, 'due_date' => $due_date - ), $id ) ) ; - + ), $id)) ; + # create the invoice item: if($insert) { - $db->Execute ( $idx = sqlInsert($db, "invoice_item", - Array( + $db->Execute ($idx = sqlInsert($db, "invoice_item", + array( 'date_orig' => time(), 'invoice_id' => $id, 'account_id' => $service['account_id'], @@ -2686,22 +3039,22 @@ class invoice 'domain_term' => $term, 'tax_amt' => $tax_amt, 'total_amt' => $price - ) ) ); - + ))); + # Insert tax records - $taxObj->invoice_item($id, $idx, $service['account_id'], @$item_tax_arr); - + $taxObj->invoice_item($id, $idx, $service['account_id'], @$item_tax_arr); + # Update the service record - $fields=Array('active' => 0); + $fields=array('active' => 0); $db->Execute(sqlUpdate($db,"service",$fields,"id = {$service['id']}")); - + global $C_debug; $C_debug->alert("Generated domain renewal invoice for {$service['domain_name']}.{$service['domain_tld']}"); return $id; } } - - + + /** Run AutoBilling and Due Notices */ @@ -2714,21 +3067,21 @@ class invoice $mail = new email_template; # get all due invoices - $db = &DB(); + $db = &DB(); #$db->debug = true; - + if(empty($VAR['invoice_id'])) { $this->bill_one = false; $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'invoice - WHERE notice_next_date <= ' . $db->qstr( time() ) . ' + WHERE notice_next_date <= ' . $db->qstr( time() ) . ' AND ( billing_status = 0 OR billing_status IS NULL - ) AND ( + ) AND ( suspend_billing = 0 OR suspend_billing IS NULL - ) + ) AND site_id = ' . $db->qstr(DEFAULT_SITE); $invoice = $db->Execute($sql); if($invoice->RecordCount() == 0) { @@ -2742,7 +3095,7 @@ class invoice WHERE ( billing_status = 0 OR billing_status IS NULL - ) + ) AND id = ' . $db->qstr($VAR['invoice_id']) . ' AND site_id = ' . $db->qstr(DEFAULT_SITE); $invoice = $db->Execute($sql); @@ -2758,7 +3111,7 @@ class invoice while(!$invoice->EOF) { $db->StartTrans(); - + $due = true; # get currency code @@ -2770,7 +3123,7 @@ class invoice id = ". $db->qstr($cyid)." AND site_id = ". $db->qstr(DEFAULT_SITE); $currb = $db->Execute($q); - $this->format_currency[$cyid] = Array ( 'convert' => unserialize($currb->fields["convert_array"]), + $this->format_currency[$cyid] = array('convert' => unserialize($currb->fields["convert_array"]), 'iso' => $currb->fields["three_digit"]); } @@ -2782,12 +3135,12 @@ class invoice id = ".$db->qstr($billed_currency_id)." AND site_id = ".$db->qstr(DEFAULT_SITE); $currb = $db->Execute($q); - $this->format_currency[$billed_currency_id] = Array ( 'convert' => unserialize($currb->fields["convert_array"]), + $this->format_currency[$billed_currency_id] = array('convert' => unserialize($currb->fields["convert_array"]), 'iso' => $currb->fields["three_digit"]); } # attempt to autobill? - if(!empty( $invoice->fields['account_billing_id'] )) + if(!empty($invoice->fields['account_billing_id'])) { # get checkout plugin details: $billing =& $db->Execute($sql=sqlSelect($db, array('account_billing','checkout'), 'A.*,B.checkout_plugin', @@ -2797,14 +3150,14 @@ class invoice $plugin_file = PATH_PLUGINS.'checkout/'. $billing->fields['checkout_plugin'] .'.php'; if(!is_file($plugin_file)) { $err = $plugin_file .' missing when autobilling invoice id ' . $invoice->fields['id']; - $C_debug->error('invoice.inc.php','autobill()', $err); + $C_debug->error(__FILE__,__METHOD__,$err); } else { - include_once ( $plugin_file ); - eval( '$PLG = new plg_chout_' . $billing->fields['checkout_plugin'] . '("'.$billing->fields['checkout_plugin_id'].'");'); + include_once ($plugin_file); + eval('$PLG = new plg_chout_' . $billing->fields['checkout_plugin'] . '("'.$billing->fields['checkout_plugin_id'].'");'); } } else { $err = 'account_billing.id '.$invoice->fields['account_billing_id'].' empty or not associated with a checkout plugin when autobilling invoice id ' . $invoice->fields['id']; - $C_debug->error('invoice.inc.php','autobill()', $err); + $C_debug->error(__FILE__,__METHOD__,$err); } } @@ -2815,26 +3168,26 @@ class invoice if($amount <= 0) $due = false; if(!empty($PLG) && is_object($PLG) && $PLG->type == 'gateway' && $amount > 0) - { + { # attempt autobilling if account billing exists and gateway plugin - if($invoice->fields['account_billing_id'] > 0 ) + if($invoice->fields['account_billing_id'] > 0) { /* get the account details */ $account = $db->Execute(sqlSelect($db,"account","id,email","id=::{$invoice->fields['account_id']}")); - + /* Convert the invoice amount to the actual billed currency amount */ - if($cyid != $invoice->fields['billed_currency_id']) { + if($cyid != $invoice->fields['billed_currency_id']) { $conversion = $this->format_currency[$billed_currency_id]["convert"][$cyid]["rate"]; $amount *= $conversion; $actual_billed_amt = $invoice->fields['actual_billed_amt'] + $amount; } - - /* load the billing details from the database */ + + /* load the billing details from the database */ $PLG->setBillingFromDBObj($billing, true); - + /* attempt to auto-bill */ if(!$checkout_plugin_data = $PLG->bill_checkout( number_format($amount,2), $invoice->fields['id'], $this->format_currency[$cyid]['iso'], $account->fields, 0,0) ) { - $due = true; + $due = true; $email = new email_template; $email->send('invoice_decline_user', $invoice->fields['account_id'], $invoice->fields['id'],$C_list->format_currency($invoice->fields['total_amt'],$cyid), $C_list->date($invoice->fields['due_date'])); $email = new email_template; @@ -2884,7 +3237,7 @@ class invoice notice_count = ' . $db->qstr($invoice->fields['notice_count']+1) . ', notice_next_date = ' . $db->qstr(time()+86400*3) . ' WHERE - id = ' . $db->qstr( $invoice->fields['id'] ) . ' AND + id = ' . $db->qstr($invoice->fields['id']) . ' AND site_id = ' . $db->qstr(DEFAULT_SITE); $db->Execute($sql); } @@ -2905,10 +3258,10 @@ class invoice notice_count = ' . $db->qstr($invoice->fields['notice_count']+1) . ', suspend_billing = ' . $db->qstr('1') . ' WHERE - id = ' . $db->qstr( $invoice->fields['id'] ) . ' AND + id = ' . $db->qstr($invoice->fields['id']) . ' AND site_id = ' . $db->qstr(DEFAULT_SITE); - $db->Execute($sql); - } + $db->Execute($sql); + } } else { @@ -2919,7 +3272,7 @@ class invoice billed_amt = ' . $db->qstr($billed_amt) . ', actual_billed_amt = ' . $db->qstr($actual_billed_amt) . ' WHERE - id = ' . $db->qstr( $invoice->fields['id'] ) . ' AND + id = ' . $db->qstr($invoice->fields['id']) . ' AND site_id = ' . $db->qstr(DEFAULT_SITE); $db->Execute($sql); @@ -2936,168 +3289,180 @@ class invoice } $invoice->MoveNext(); unset($PLG); - + /* finish transaction */ $db->CompleteTrans(); } } - - /** * Find out if a user has unpaid invoices */ - function has_unpaid($VAR) { - if(!SESS_LOGGED) return false; - $db=&DB(); - $inv=$db->Execute($sql=sqlSelect($db,"invoice","SUM(total_amt-billed_amt) as total", - "account_id=".SESS_ACCOUNT." AND billing_status=0 AND refund_status=0")); - if($inv && $inv->RecordCount() && $inv->fields['total']>0) { - global $smarty, $C_list; - //$act= $db->Execute(sqlSelect($db,"account","currency_id","id=)); - $smarty->assign('has_unpaid', $C_list->format_currency_num($inv->fields['total'],SESS_CURRENCY)); - } + public function has_unpaid($VAR) { + global $smarty, $C_list; + + if (! SESS_LOGGED) + return false; + + $total = 0; + foreach ($this->unpaid(SESS_ACCOUNT) as $amount) + $total += $amount; + + if ($total) + $smarty->assign('has_unpaid',$C_list->format_currency_num($total,SESS_CURRENCY)); } - /** * Get the totals for multiple invoices or for a group of invoices stored in temp + * + * The retrieved invoice numbers are stored in $this->invoice; + * + * @param string If invoice is 'MULTI-*', get unpaid invoices from the temporary_data table, otherwise + * get the unpaid invoices listed, or all invoices if blank. */ - function multiple_invoice_total($invoice,$account_id=SESS_ACCOUNT) - { + private function multiple_invoice_total($invoice,$account_id=SESS_ACCOUNT) { + $this->invoice = array(); $db = &DB(); - if(empty($invoice) || eregi(",", $invoice)) { + + if (! preg_match('/^MULTI-/',$invoice)) { $id_list=''; - if(!empty($invoice)) { - $id = explode(',', $invoice); - for($i=0; $iqstr($id[$i])." "; - $ii++; - } else { - $id_list .= " OR id = " .$db->qstr($id[$i]). " "; - $ii++; - } - } - } - if(!empty($id_list)) $id_list = "( $id_list ) AND "; - } - // get invoice totals - $total=0; - $inv=$db->Execute($sql=sqlSelect($db,"invoice","id,total_amt,billed_amt", "$id_list account_id=".SESS_ACCOUNT." AND billing_status=0 AND refund_status=0")); - if($inv && $inv->RecordCount()) { - while(!$inv->EOF) { - $this->invoice[] = $inv->fields['id']; - $total += ($inv->fields['total_amt']-$inv->fields['billed_amt']); - $inv->MoveNext(); + + if ($invoice = preg_replace('/,$/','',$invoice)) + $id_list = sprintf('id in (%s) AND',$invoice); + + # Get invoice totals + $total = 0; + $rs = $db->Execute(sqlSelect($db,'invoice','id,total_amt,billed_amt',sprintf('%s account_id=%s AND billing_status=0 AND refund_status=0',$id_list,SESS_ACCOUNT))); + if ($rs && $rs->RecordCount()) { + while (! $rs->EOF) { + $this->invoice[$rs->fields['id']] = $rs->fields['total_amt']-$rs->fields['billed_amt']; + $total += $this->invoice[$rs->fields['id']]; + $rs->MoveNext(); } + return $total; - } else { - return false; } + } else { - // get total from temp data - $inv=$db->Execute($sql=sqlSelect($db,"temporary_data","data,field1 as total","field2=::$invoice::")); - if($inv && $inv->RecordCount() && $inv->fields['total'] > 0) { - if(!empty($inv->fields['field2'])) $this->invoice=unserialize($inv->fields['data']); - return $inv->fields['total']; - } else { - return false; - } + # Get total from temp data + $rs = $db->Execute(sqlSelect($db,'temporary_data','data,field1',array('field2'=>$invoice))); + if ($rs && $rs->RecordCount() && $rs->fields['field1'] > 0) { + $this->invoice = unserialize($rs->fields['data']); + return $rs->fields['field1']; + } } - return false; + + return false; } /** * Preview checkout of multiple invoices */ - function checkout_multiple_preview($VAR) - { + public function tpl_checkout_multiple_preview($VAR) { global $smarty,$C_list; - if(!SESS_LOGGED) return false; - - $db=&DB(); - $total = $this->multiple_invoice_total(@$VAR['id'],SESS_ACCOUNT); - if($total > 0 && count($this->invoice) > 1) - { - // get country id for checkout options - $account=sqlSelect($db, "account", "country_id", "id=".SESS_ACCOUNT); - - // get payment options + + if (! SESS_LOGGED) + return false; + + # If the ID is blank, this will get all unpaid invoices. + if (! isset($VAR['id'])) + $VAR['id'] = ''; + + $total = $this->multiple_invoice_total($VAR['id'],SESS_ACCOUNT); + $db = &DB(); + + if ($total > 0 && count($this->invoice) > 1) { + # Get country id for checkout options + $account = $db->Execute(sqlSelect($db,'account','country_id',array('id'=>SESS_ACCOUNT))); + + # Get payment options include_once(PATH_MODULES.'checkout/checkout.inc.php'); $checkout = new checkout; - $checkoutoptions = $checkout->get_checkout_options(SESS_ACCOUNT, $total, false, $account->fields['country_id'],true); - - // get a temporary id (48 hours) - $id=sqlGenID($db, "temporary_data"); - $invoice["id"] = "MULTI-$id"; - $invoice["total"] = $total; - $fields=Array('date_orig'=>time(), 'date_expire'=>time()+86400*3, 'field2'=> $invoice['id'], 'field1'=>$total, 'data'=>serialize($this->invoice)); - $id = & $db->Execute(sqlInsert($db,"temporary_data",$fields)); - - $smarty->assign('invoice', $invoice); - $smarty->assign('total', $C_list->format_currency_num($total,SESS_CURRENCY)); - $smarty->assign('checkoutoptions', $checkoutoptions); - - } elseif (count($this->invoice) == 1) { - $id = $this->invoice[0]; - echo ""; + + $checkoutoptions = $checkout->get_checkout_options(SESS_ACCOUNT,$total,false,$account->fields['country_id'],true); + + # Get a temporary id (48 hours) + $id = sqlGenID($db,'temporary_data'); + $invoice['id'] = sprintf('MULTI-%s',$id); + $invoice['total'] = $total; + + $fields = array('date_orig'=>time(),'date_expire'=>time()+86400*3,'field2'=>$invoice['id'],'field1'=>$total,'data'=>serialize($this->invoice)); + $rs = $db->Execute($q=sqlInsert($db,'temporary_data',$fields,$id)); + + $smarty->assign('record',$invoice); + $smarty->assign('total',$C_list->format_currency_num($total,SESS_CURRENCY)); + $smarty->assign('checkoutoptions',$checkoutoptions); + + } elseif (count($this->invoice) == 1) { + printf("",key($this->invoice)); + } else { - echo "No due invoices selected for payment."; + echo _('No due invoices selected for payment.'); } } - - - /** Run checkout plugin for billing - */ - function checkoutnow($VAR) - { - global $C_translate, $smarty, $C_list, $VAR; - + + + /** + * Make a payment now + */ + public function checkoutnow($VAR) { + global $C_translate,$smarty,$C_list,$VAR; + # Validate user logged in: - if(SESS_LOGGED != '1') { - echo ''; + if (SESS_LOGGED != '1') { + echo ''; return false; } - - $db = &DB(); - if(eregi("MULTI-", @$VAR['invoice_id'])) { - // get multi-invoice details - $total = $this->multiple_invoice_total(@$VAR['invoice_id'],SESS_ACCOUNT); - if(!$total) return false; - $recur_amt=false; - $recur_arr=false; - $account_id=SESS_ACCOUNT; - $this->invoice[]=$VAR['invoice_id']; - $this->invoice_id=$VAR['invoice_id']; + + # If the ID is blank, this will get all unpaid invoices. + if (! isset($VAR['invoice_id'])) + return false; + + # Some defaults + $recur_amt = 0; + + $db = &DB(); + if(preg_match('/^MULTI-/',@$VAR['invoice_id'])) { + # Get multi-invoice details + $total = $this->multiple_invoice_total($VAR['invoice_id'],SESS_ACCOUNT); + if (! $total) + return false; + + $recur_arr = false; + $account_id = SESS_ACCOUNT; + $this->invoice_id = $VAR['invoice_id']; $CURRENCY = DEFAULT_CURRENCY; - $multi=true; + $multi = true; + } else { # Validate the invoice selected, & get the totals: - $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'invoice WHERE site_id = '.$db->qstr(DEFAULT_SITE).' AND id = ' . $db->qstr($VAR['invoice_id']); - $result = $db->Execute($sql); - if(!$result || $result->RecordCount() == 0) return false; - + $result = $db->Execute($q=sqlSelect($db,'invoice','*',array('id'=>$VAR['invoice_id']))); + if (! $result || $result->RecordCount() == 0) + return false; + # Determine the price & currency - if($result->fields['billed_currency_id'] != $result->fields['actual_billed_currency_id']) { + if ($result->fields['billed_currency_id'] != $result->fields['actual_billed_currency_id']) { global $C_list; + $CURRENCY = $result->fields['actual_billed_currency_id']; if($result->fields['billed_amt'] <= 0) - $total = $C_list->format_currency_decimal ($result->fields['total_amt'], $CURRENCY); + $total = $C_list->format_currency_decimal($result->fields['total_amt'],$CURRENCY); else - $total = $C_list->format_currency_decimal ($result->fields['total_amt'], $CURRENCY) - $result->fields['actual_billed_amt']; + $total = $C_list->format_currency_decimal($result->fields['total_amt'],$CURRENCY)-$result->fields['actual_billed_amt']; + } else { $CURRENCY = $result->fields['billed_currency_id']; $total = $result->fields['total_amt']-$result->fields['billed_amt']; } - $recur_amt=$result->fields['recur_amt']; - if($recur_amt>0) $recur_amt = $C_list->format_currency_decimal ($recur_amt, $CURRENCY); - @$recur_arr=unserialize($result->fields['recur_arr']); - $account_id=$result->fields['account_id']; - $this->invoice_id=$result->fields['id']; - $this->invoice[]=$result->fields['id']; - $multi=false; + + if ($result->fields['recur_amt'] > 0) + $recur_amt = $C_list->format_currency_decimal($result->fields['recur_amt'],$CURRENCY); + + @$recur_arr = unserialize($result->fields['recur_arr']); + $account_id = $result->fields['account_id']; + $this->invoice_id = $result->fields['id']; + $this->invoice[$result->fields['id']] = $total; + $multi = false; } $amount = round($total, 2); @@ -3105,31 +3470,31 @@ class invoice $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'account WHERE site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND id = ' . $db->qstr($account_id); $account = $db->Execute($sql); if (!$account || !$account->RecordCount()) return false; - + # Validate checkout option selected is allowed for purchase: $q = "SELECT * FROM ".AGILE_DB_PREFIX."checkout WHERE site_id = ".$db->qstr(DEFAULT_SITE)." AND id = ".$db->qstr(@$VAR['option'])." AND active = 1 AND "; - if($recur_amt>0 && @$billed_amt == 0 ) $q .= "allow_recurring = 1 "; else $q .= "allow_new = 1 "; + if($recur_amt>0 && @$billed_amt == 0) $q .= "allow_recurring = 1 "; else $q .= "allow_new = 1 "; $chopt = $db->Execute($q); if (!$chopt || !$chopt->RecordCount()) return false; if($chopt && $chopt->RecordCount()) { $show = true; - if ( @$chopt->fields["total_maximum"] != "" && $total > $chopt->fields["total_maximum"] ) $show = false; - if ( @$chopt->fields["total_miniumum"] != "" && $total < $chopt->fields["total_miniumum"] ) $show = false; + if ( @$chopt->fields["total_maximum"] != "" && $total > $chopt->fields["total_maximum"] ) $show = false; + if ( @$chopt->fields["total_miniumum"] != "" && $total < $chopt->fields["total_miniumum"] ) $show = false; } if(!$show) { echo ' '; return false; - } - + } + # Load the checkout plugin: $plugin_file = PATH_PLUGINS . 'checkout/'. $chopt->fields["checkout_plugin"] . '.php'; include_once ( $plugin_file ); - eval ( '$PLG = new plg_chout_' . $chopt->fields["checkout_plugin"] . '("'.@$VAR["option"].'");'); - - if(!empty($VAR['account_billing_id']) && @$VAR['new_card']==2) { + eval ( '$PLG = new plg_chout_' . $chopt->fields["checkout_plugin"] . '("'.@$VAR["option"].'",$multi);'); + + if(!empty($VAR['account_billing_id']) && @$VAR['new_card']==2) { /* validate credit card on file details */ - $account_billing_id=$VAR['account_billing_id']; - if(!$PLG->setBillingFromDB($account_id, $account_billing_id, $VAR['option'])) { + $account_billing_id=$VAR['account_billing_id']; + if(!$PLG->setBillingFromDB($account_id, $account_billing_id, $VAR['option'])) { global $C_debug; $C_debug->alert("Sorry, we cannot use that billing record for this purchase."); return false; @@ -3138,38 +3503,39 @@ class invoice /* use passed in vars */ $PLG->setBillingFromParams($VAR); } - + # Set Invoice Vars: $this->total_amt = $amount; $this->currency_iso = $C_list->currency_iso($CURRENCY); - $this->currency_iso_admin = $C_list->currency_iso($CURRENCY); - $this->account_id = $account_id; + $this->currency_iso_admin = $C_list->currency_iso($CURRENCY); + $this->account_id = $account_id; $this->actual_billed_currency_id = $CURRENCY; $this->billed_currency_id = $CURRENCY; $this->checkout_plugin_id = @$VAR["option"]; - + # Run the plugin bill_checkout() method: - $this->checkout_plugin_data = $PLG->bill_checkout( $amount, $this->invoice_id, $this->currency_iso, $account->fields, $recur_amt, $recur_arr); + $this->checkout_plugin_data = $PLG->bill_checkout($amount, $this->invoice_id, $this->currency_iso, $account->fields, $recur_amt, $recur_arr,$this->invoice); # redirect if(!empty($this->checkout_plugin_data['redirect'])) echo $this->checkout_plugin_data['redirect']; - + # determine results if( $this->checkout_plugin_data === false ) { - if(!empty($PLG->redirect)) echo $PLG->redirect; - return false; - } elseif ($PLG->type == "gateway" && empty($PLG->redirect)) { + if(!empty($PLG->redirect)) echo $PLG->redirect; + return false; + } elseif ($PLG->type == "gateway" && empty($PLG->redirect)) { if(empty($this->admin_checkout)) { $VAR['_page'] = "invoice:thankyou"; } else { $VAR['_page'] = "invoice:view"; - } + } } elseif ($PLG->type == "redirect") { + echo "
    Please wait while we redirect you to the secure payment site.... - {$PLG->redirect}
    "; - } - + {$PLG->redirect}"; + } + # Call the Plugin method for storing the checkout data, if new data entered: $this->account_billing_id = $PLG->store_billing($VAR, $PLG); @@ -3190,24 +3556,24 @@ class invoice checkout_plugin_data = " .$db->qstr(serialize($this->checkout_plugin_data)). " WHERE site_id = ".$db->qstr(DEFAULT_SITE)." AND - id = ".$db->qstr($this->invoice_id); + id = ".$db->qstr($this->invoice_id); $rst = $db->Execute($q); if ($rst === false) { global $C_debug; - $C_debug->error('invoice.inc.php','checkoutnow', $db->ErrorMsg()); + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); return false; } // loop through each invoice paid - foreach($this->invoice as $this->invoice_id) { + foreach($this->invoice as $this->invoice_id) { # Send billed e-mail notice to user $email = new email_template; $email->send('invoice_paid_user', $this->account_id, $this->invoice_id, $this->currency_iso, ''); - + # Admin alert of payment processed $email = new email_template; $email->send('admin->invoice_paid_admin', $this->account_id, $this->invoice_id, $this->currency_iso_admin, ''); - + # Submit the invoice for approval $arr['id'] = $this->invoice_id; $this->approveInvoice($arr, $this); @@ -3217,1159 +3583,465 @@ class invoice # Just update the last_date and plugin data $q = "UPDATE ".AGILE_DB_PREFIX."invoice - SET + SET account_billing_id = " .$db->qstr($this->account_billing_id). ", date_last = " .$db->qstr(time()). ", checkout_plugin_id = " .$db->qstr($this->checkout_plugin_id) .", checkout_plugin_data = " .$db->qstr(serialize($this->checkout_plugin_data)). " WHERE site_id = ".$db->qstr(DEFAULT_SITE)." AND - id = ".$db->qstr($this->invoice_id); + id = ".$db->qstr($this->invoice_id); $rst = $db->Execute($q); if ($rst === false) { global $C_debug; - $C_debug->error('invoice.inc.php','checkoutnow', $db->ErrorMsg()); + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); return false; } # Admin e-mail alert of manual payment processing - if ( $PLG->name == 'MANUAL' ) { + if ( $PLG->name == 'MANUAL' ) { $date_due = $C_list->date(time()); - foreach($this->invoice as $this->invoice_id) { + foreach($this->invoice as $this->invoice_id) { $email = new email_template; $email->send('admin->invoice_due_admin', $this->account_id, $this->invoice_id, '', $date_due); } - - global $C_debug; - $C_debug->alert($C_translate->translate('manual_alert','checkout')); - } - } - } - - /** create modified array for invoice summarization - */ - function summarizeLineItems($smart_items) - { + global $C_debug; + $C_debug->alert($C_translate->translate('manual_alert','checkout')); + } + } + } + + /** + * Create modified array for invoice summarization + * + * This function will summarise the invoice items based on the same + * SKU, BASE_PRICE, SETUP_PRICE & PRODUCT_ATTR + */ + public function summarizeLineItems($smart_items) { //$ignore['SKU']=true; - $sum=false; - if(is_array($smart_items)) { - foreach($smart_items as $it) { - if(empty($sum["{$it["sku"]}"])) { - // unique line item - if(empty($ignore["{$it["sku"]}"])) $sum["{$it["sku"]}"][] = $it; + $sum = array(); + + if (is_array($smart_items)) { + foreach ($smart_items as $it) { + # Unique line item + if (! isset($sum[$it['sku']])) { + if (! isset($ignore[$it['sku']])) + $sum[$it['sku']] = array($it); + $sum[$it['sku']][0]['summaryname'] = $this->getLineItemDesc($it['sku'],$it['product_id'],false,$it['sku'] ? false : $it['product_name']); + } else { - // is unique price/attributes? - $unique=true; - foreach($sum["{$it["sku"]}"] as $sid => $flds) { - if( $flds["price_base"] == $it["price_base"] && $flds["price_setup"] == $it["price_setup"] && $flds['product_attr'] == $it['product_attr'] ) { - $sum["{$it["sku"]}"]["$sid"]["quantity"] += 1; + # Is unique price/attributes? + $unique = true; + foreach ($sum[$it['sku']] as $sid => $flds) { + if ($flds['price_base'] == $it['price_base'] && + $flds['price_setup'] == $it['price_setup'] && + $flds['product_attr'] == $it['product_attr']) { + + $sum[$it['sku']][$sid]['quantity'] += 1; $unique = false; break; } } - // unique line item - if($unique) $sum["{$it["sku"]}"][] = $it; + + # Unique line item + if ($unique) { + $a = count($sum[$it['sku']]); + array_push($sum[$it['sku']],$it); + $sum[$it['sku']][$a]['summaryname'] = $this->getLineItemDesc($it['sku'],$it['product_id'],false,$it['sku'] ? false : $it['product_name']); + } } } } - if(!empty($sum)) { - unset($smart_items); - foreach($sum as $sku => $item) foreach($item as $sitem) $smart_items[] = $sitem; + if (count($sum)) { + $smart_items = array(); + foreach ($sum as $sku => $item) + foreach ($item as $sitem) + array_push($smart_items,$sitem); + return $smart_items; } } - - - - /** VIEW - */ - function view($VAR) - { - global $C_translate, $C_list; - $this->invoice_construct(); - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); + + /** + * View an Invoice + * Shown both in the admin pages and after checkout + * + * @uses net_term + */ + public function view($VAR) { + global $C_translate,$C_list; $db = &DB(); - # set the field list for this method: - $arr = $this->method[$type]; + if ($smart = parent::view($VAR)) { + # Get the product checkout plugin name + if (! empty($smart['checkout_plugin_id'])) { + $cplg = $db->Execute(sqlSelect($db,'checkout','name',sprintf('id=%s',$smart['checkout_plugin_id']))); - # loop through the field list to create the sql queries - $field_list = ''; - $i=0; - while (list ($key, $value) = each ($arr)) - { - if($i == 0) - { - $field_var = $this->table . '_' . $value; - $field_list .= $value; + if ($cplg && $cplg->RecordCount()) + $smart['checkout_plugin'] = $cplg->fields['name']; } + + if ($smart['total_amt'] == 0) + $smart['balance'] = 0; else - { - $field_var = $this->table . '_' . $value; - $field_list .= "," . $value; - } - $i++; - } + $smart['balance'] = $smart['total_amt']-$smart['billed_amt']; - if(isset($VAR["id"])) - { - $id = explode(',',$VAR["id"]); - for($i=0; $iqstr($id[$i])." "; - $ii++; + # Get the tax details + if (! empty($smart['tax_amt'])) { + $trs = $db->Execute(sqlSelect($db,array('invoice_item_tax','tax'),'A.amount,B.description',sprintf('A.tax_id=B.id AND A.invoice_id=%s',$smart['id']))); + + if ($trs && $trs->RecordCount()) { + $taxes = array(); + while (!$trs->EOF) { + @$taxes[$trs->fields['description']] += $trs->fields['amount']; + $trs->MoveNext(); } - else - { - $id_list .= " OR id = " .$db->qstr($id[$i]). " "; - $ii++; + + $smart['tax_arr'] = array(); + foreach ($taxes as $txds => $txamt) + array_push($smart['tax_arr'],array('description'=>$txds,'amount'=>$txamt)); + } + } + + # Get the discount details + if (! empty($smart['discount_amt'])) { + $drs = $db->Execute(sqlSelect($db,'invoice_item_discount','amount,discount',sprintf('invoice_id=%s',$smart['id']))); + + if ($drs && $drs->RecordCount()) { + $discounts = array(); + while(!$drs->EOF) { + @$discounts[$drs->fields['discount']] += $drs->fields["amount"]; + $drs->MoveNext(); } + + $dhtml = ''; + foreach ($discounts as $dsds=>$dsamt) + $dhtml .= sprintf('%s -
    ',$dsds,$dsds,number_format($dsamt,2)); + + $smart['discount_popup'] = $dhtml; + + $dhtml = ''; + foreach ($discounts as $dsds=>$dsamt) + $dhtml .= sprintf('%s - %s
    ',$dsds,number_format($dsamt,2)); + + $smart['discount_popup_user'] = $dhtml; } } - } - if($ii>0) - { - $any_trial = false; - $any_recurring = false; - $any_new = false; + # Get the checkout plugin details + if (! empty($smart['checkout_plugin_data'])) { + $plugin_data = unserialize($smart['checkout_plugin_data']); - # generate the full query - $q = "SELECT - $field_list - FROM - ".AGILE_DB_PREFIX."$this->table - WHERE - $id_list - AND site_id = '" . DEFAULT_SITE . "' - ORDER BY $this->order_by - LIMIT 0,1"; - $result = $db->Execute($q); - if ($result === false) - { - global $C_debug; - $C_debug->error('invoice.inc.php','view', $db->ErrorMsg()); - - if(isset($this->trigger["$type"])) - { - include_once(PATH_CORE . 'trigger.inc.php'); - $trigger = new CORE_trigger; - $trigger->trigger($this->trigger["$type"], 0, $VAR); - } - return; - } - - ### Set it as a class variable: - $this->result = $result; - - # put the results into a smarty accessable array - $i=0; - $ii=0; - $class_name = TRUE; - while (!$result->EOF) - { - $smart[$i] = $result->fields; - - ## get the product plugin name - if(!empty($result->fields['checkout_plugin_id'])) { - $cplg = $db->Execute(sqlSelect($db,"checkout","name","id = {$result->fields['checkout_plugin_id']}")); - if($cplg && $cplg->RecordCount()) $smart[$i]['checkout_plugin'] = $cplg->fields['name']; - } - - if($result->fields['total_amt'] == 0) - $smart[$i]['balance'] = 0; + if (is_array($plugin_data)) + $smart['checkout_plugin_data'] = $plugin_data; else - $smart[$i]['balance'] = $result->fields['total_amt'] - $result->fields['billed_amt']; + $smart['checkout_plugin_data'] = array(0=>$smart['checkout_plugin_data']); + } - ## Get the tax details - if( !empty($result->fields['tax_amt']) ) { - $trs = $db->Execute($sql=sqlSelect($db, Array('invoice_item_tax','tax'),"A.amount,B.description","A.tax_id=B.id AND A.invoice_id={$result->fields['id']}")); - if($trs && $trs->RecordCount()) { - while(!$trs->EOF) { - $taxes["{$trs->fields['description']}"] += $trs->fields["amount"]; - $trs->MoveNext(); - } - foreach($taxes as $txds=>$txamt) - $smart[$i]["tax_arr"][] = Array('description'=>$txds, 'amount'=>$txamt); + # Get the line items + $q = sqlSelect($db,'invoice_item','*',sprintf('invoice_id=%s',$smart['id'])); + if ($C_list->is_installed('voip')) + $q .= ' AND item_type!=5'; + + $items = $db->Execute($q); + if ($items === false) { + global $C_debug; + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); + + return false; + } + + # Get the term dates + include_once(PATH_MODULES.'net_term/net_term.inc.php'); + $net_term = new net_term; + + $smart['termdates'] = $net_term->getTermDates($smart['net_term_id'],$smart['date_orig'],$smart['due_date']); + + $ii =0; + while (! $items->EOF) { + $smart_items[$ii] = $items->fields; + + # Get the product attribs + if (! empty($items->fields['product_attr'])) { + @$attrib = explode("\r\n",$items->fields['product_attr']); + $js = ''; + + for ($attr_i=0; $attr_i%s
    : %s
    ',$attributei[0],$attributei[1]); } + + $smart_items[$ii]['attribute_popup'] = $js; } - ## Get the discount details - if( !empty($result->fields['discount_amt']) ) { - $drs = $db->Execute($sql=sqlSelect($db, 'invoice_item_discount',"amount,discount","invoice_id={$result->fields['id']}")); - if($drs && $drs->RecordCount()) { - while(!$drs->EOF) { - $discounts["{$drs->fields['discount']}"] += $drs->fields["amount"]; - $drs->MoveNext(); - } - $dhtml=''; - foreach($discounts as $dsds=>$dsamt) $dhtml .= ''.$dsds.' - '. number_format($dsamt, 2) . "
    "; - $smart[$i]['discount_popup'] = $dhtml; - $dhtml=''; - foreach($discounts as $dsds=>$dsamt) $dhtml .= $dsds.' - '. number_format($dsamt, 2) . "
    "; - $smart[$i]['discount_popup_user'] = $dhtml; - - } - } + # Get the date range if set + if (! empty($items->fields['date_start']) && ! empty($items->fields['date_stop'])) { + $C_translate->value('invoice','start',date(UNIX_DATE_FORMAT,$items->fields['date_start'])); + $C_translate->value('invoice','stop',date(UNIX_DATE_FORMAT,$items->fields['date_stop'])); - ## Get the checkout plugin details: - if(!empty($result->fields['checkout_plugin_data'])) { - $plugin_data = unserialize($result->fields['checkout_plugin_data']); - if(is_array($plugin_data)) { - $smart[$i]['checkout_plugin_data'] = $plugin_data; - } else { - $smart[$i]['checkout_plugin_data'] = Array(0 => $result->fields['checkout_plugin_data']); - } + $smart_items[$ii]['range'] = $C_translate->translate('recur_date_range','invoice',''); } - ## Get the line items: - $q = "SELECT * FROM ".AGILE_DB_PREFIX."invoice_item WHERE - invoice_id = ". $db->qstr($result->fields['id'])." AND - site_id = ". $db->qstr(DEFAULT_SITE); - if($C_list->is_installed('voip')) { - $q .= " AND item_type!=5"; - } - $items = $db->Execute($q); - if ($items === false) { + # Set charge type for payment option list + $any_new = true; + if ($items->fields['price_type']=='1' && ! empty($smart['recurr_arr']) && is_array(unserialize($smart['recurr_arr']))) + $any_recurring = true; + + $items->MoveNext(); + $ii++; + } + + # Create a summary (for duplicate skus w/identical price,and attributes, roll into a single value + if ($this->summarizeInvoice) + $smart_items = $this->summarizeLineItems($smart_items); + + # Get the checkout (payment) options + if ($VAR['_page'] != 'invoice:view') { + # Get the converted amount due: + if ($smart['billed_currency_id'] != $smart['actual_billed_currency_id']) { + global $C_list; + + $CURRENCY = $smart['actual_billed_currency_id']; + if ($smart['billed_amt'] <= 0) + $total = $C_list->format_currency_decimal($smart['total_amt'],$CURRENCY); + else + $total = $C_list->format_currency_decimal($smart['total_amt'],$CURRENCY)-$smart['actual_billed_amt']; + + } else { + $CURRENCY = $smart['billed_currency_id']; + $total = $smart['total_amt']-$smart['billed_amt']; + } + + $q = sqlSelect($db,'checkout','*','active=1'); + + if ($any_trial) + $q .= sprintf(' AND allow_trial = %s',$db->qstr('1')); + + if ($any_recurring) + $q .= sprintf(' AND allow_recurring = %s',$db->qstr('1')); + + if ($any_new) + $q .= sprintf(' AND allow_new = %s',$db->qstr('1')); + + $chopt = $db->Execute($q); + + if ($chopt === false) { global $C_debug; - $C_debug->error('invoice.inc.php','view', $db->ErrorMsg()); + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); + return false; } - $ii =0; - while ( !$items->EOF ) - { - $smart_items[$ii] = $items->fields; - // get the product attribs - if(!empty($items->fields['product_attr'])) - { - @$attrib = explode("\r\n", $items->fields['product_attr']); - $js=''; - for($attr_i = 0; $attr_i < count( $attrib ); $attr_i++) - { - $attributei = explode('==', $attrib[$attr_i]); - if(!empty($attributei[0]) && !empty($attributei[1])) { - $js .= "" . $attributei[0] . " : ". $attributei[1] . "
    "; - } - } - $smart_items[$ii]['attribute_popup'] = $js; - } + if ($chopt != false && $chopt->RecordCount() > 0) { + while (! $chopt->EOF) { + $show = true; - // get the date range if set - if(!empty($items->fields['date_start']) && !empty($items->fields['date_stop'])) - { - $C_translate->value('invoice','start', date(UNIX_DATE_FORMAT,$items->fields['date_start'])); - $C_translate->value('invoice','stop', date(UNIX_DATE_FORMAT,$items->fields['date_stop'])); - $smart_items[$ii]['range'] = $C_translate->translate('recur_date_range','invoice',''); - } + # Check that the cart total is not to high: + if ($chopt->fields['total_maximum'] != '' && $smart['total_amt'] >= $chopt->fields['total_maximum']) + $show = false; - // Set charge type for payment option list: - $any_new = true; - if ($items->fields["price_type"] == '1' && !empty($result->fields['recurr_arr']) && is_array(unserialize($result->fields['recurr_arr']))) - $any_recurring = true; - $items->MoveNext(); - $ii++; - } + # Check that the cart total is not to low: + if ($chopt->fields['total_miniumum'] != '' && $smart['total_amt'] <= $chopt->fields['total_miniumum']) + $show = false; - ## Create a summary (for duplicate skus w/identical price,and attributes, roll into a single value - if($this->summarizeInvoice) { - $tmp = $smart_items; - unset($smart_items); - $smart_items = $this->summarizeLineItems($tmp); - } + # Check that the group requirement is met: + if ($show && ! empty($chopt->fields['required_groups'])) { + global $C_auth; - ### GET THE CHECKOUT (PAYMENT) OPTIONS - if($VAR['_page'] != 'invoice:view') - { - # get the converted amount due: - if($result->fields['billed_currency_id'] != $result->fields['actual_billed_currency_id']) - { - global $C_list; - $CURRENCY = $result->fields['actual_billed_currency_id']; - if($result->fields['billed_amt'] <= 0) - $total = $C_list->format_currency_decimal ($result->fields['total_amt'], $CURRENCY); - else - $total = $C_list->format_currency_decimal ($result->fields['total_amt'], $CURRENCY) - $result->fields['actual_billed_amt']; - } else { - $CURRENCY = $result->fields['billed_currency_id']; - $total = $result->fields['total_amt']-$result->fields['billed_amt']; - } - - $q = "SELECT * FROM ".AGILE_DB_PREFIX."checkout WHERE site_id = ". DEFAULT_SITE ." AND active = 1"; - if($any_trial) $q .= " AND allow_trial = ".$db->qstr('1'); - if($any_recurring) $q .= " AND allow_recurring = ".$db->qstr('1'); - if($any_new) $q .= " AND allow_new = ".$db->qstr('1'); - $chopt = $db->Execute($q); - if ($chopt === false) { - global $C_debug; - $C_debug->error('invoice.inc.php','view', $db->ErrorMsg()); - return false; - } - if($chopt != false && $chopt->RecordCount() > 0) { - while( !$chopt->EOF ) { - $show = true; - - # Check that the cart total is not to high: - if ( $chopt->fields["total_maximum"] != "" && - $result->fields['total_amt'] >= $chopt->fields["total_maximum"] ) { + $arr = unserialize($chopt->fields['required_groups']); + if (count($arr) > 0 && ! empty($arr[0])) $show = false; - } - # Check that the cart total is not to low: - if ( $chopt->fields["total_miniumum"] != "" && - $result->fields['total_amt'] <= $chopt->fields["total_miniumum"] ) { - $show = false; - } - - # Check that the group requirement is met: - if ( $show && !empty ( $chopt->fields["required_groups"] ) ) { - global $C_auth; - $arr = unserialize ( $chopt->fields["required_groups"] ); - if(count($arr) > 0 && !empty($arr[0])) $show = false; - for ( $i=0; $iauth_group_by_id($arr[$i])) { - $show = true; - $i=count($arr); - } + for ($i=0; $iauth_group_by_id($arr)) { + $show = true; + $i = count($arr); } } + } - # Check that the customer is not ordering a blocked SKU: - if ( $show && !empty ( $chopt->fields["excluded_products"] ) ) { - $arr = unserialize ( $chopt->fields["excluded_products"] ); - if(count($arr) > 0) { - for($i=0; $ifields['excluded_products'])) { + $arr = unserialize($chopt->fields['excluded_products']); + if (count($arr) > 0) { + for ($i=0; $ifields['default_when_amount'])) { + $arr = unserialize($chopt->fields['default_when_amount']); - $list_ord = 100; - if ( $show ) { + for ($idx=0; $idx= $arr[$idx]) + $list_ord--; - # Check if this method should be the default method: - # By Amount: - if ( !empty ( $chopt->fields["default_when_amount"] ) ) { - $arr = unserialize ( $chopt->fields["default_when_amount"] ); - for ( $idx=0; $idx= $arr[$idx] ) $list_ord--; - $idx=count($arr); - } + $idx = count($arr); } - - # By Currency - if ( !empty ( $chopt->fields["default_when_currency"] ) ) { - $arr = unserialize ( $chopt->fields["default_when_currency"] ); - for ( $idx=0; $idxfields["default_when_group"] ) ) { - $arr = unserialize ( $chopt->fields["default_when_group"] ); - global $C_auth; - for ( $idx=0; $idxauth_group_by_id( $arr[$idx] ) ) $list_ord--; - $idx=count($arr); - } - } - - # By Country - if ( !empty ( $chopt->fields["default_when_country"] ) ) { - $arr = unserialize ( $chopt->fields["default_when_country"] ); - for ( $idx=0; $idxfields["country_id"] == $arr[$idx] ) $list_ord--; - $idx=count($arr); - } - } - - # Add to the array - $checkout_optionsx[] = Array ('sort' => $list_ord, - 'fields' => $chopt->fields); } - $chopt->MoveNext(); + + # By Currency + if (! empty($chopt->fields['default_when_currency'])) { + $arr = unserialize($chopt->fields['default_when_currency']); + + for ($idx=0; $idxfields['default_when_group'])) { + $arr = unserialize($chopt->fields['default_when_group']); + global $C_auth; + + for ($idx=0; $idxauth_group_by_id($arr[$idx])) + $list_ord--; + + $idx = count($arr); + } + } + + # By Country + if (! empty($chopt->fields['default_when_country'])) { + $arr = unserialize($chopt->fields['default_when_country']); + + for ($idx=0; $idxfields['country_id'] == $arr[$idx]) + $list_ord--; + + $idx = count($arr); + } + } + + # Add to the array + $checkout_optionsx[] = array('sort'=>$list_ord,'fields'=>$chopt->fields); } - # Sort the checkout_options array by the [fields] element - if(count($checkout_optionsx) > 0 ) { - foreach ( $checkout_optionsx as $key => $row ) - $sort[$key] = $row["sort"]; - array_multisort ( $sort, SORT_ASC, $checkout_optionsx ); - } + $chopt->MoveNext(); + } + + # Sort the checkout_options array by the [fields] element + if (count($checkout_optionsx)>0) { + foreach ($checkout_optionsx as $key => $row) + $sort[$key] = $row['sort']; + + array_multisort($sort,SORT_ASC,$checkout_optionsx); } } - - $result->MoveNext(); - $i++; } - - # get the result count: - $results = $result->RecordCount(); - - ### No results: - if($result->RecordCount() == 0) - { + # No results + if (count($smart) == 0) { global $C_debug; - $C_debug->error("CORE:database.inc.php", "view()", "The selected record does not - exist any longer, or your account is not authorized to view it"); + $C_debug->error(__FILE__, __METHOD__,'The selected record does not exist any longer, or your account is not authorized to view it'); + return; } - # define the DB vars as a Smarty accessible block + # Define the DB vars as a Smarty accessible block global $smarty; - # define the results - $smarty->assign('cart', $smart_items); - $smarty->assign($this->table, $smart); - #$smarty->assign('results', $search->results); - $smarty->assign('checkoutoptions', $checkout_optionsx); + # Define the results + $smarty->assign('cart',$smart_items); + $smarty->assign('record',$smart); + $smarty->assign('checkoutoptions',$checkout_optionsx); } } - /** UPDATE - */ - function update($VAR) - { - $this->invoice_construct(); - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - /** DELETE - */ - function delete($VAR) - { - $this->invoice_construct(); - $dbx = new CORE_database; + /** + * Delete an invoice + */ + public function delete($VAR) { $db = &DB(); - ### Get the array - if(isset($VAR["delete_id"])) - $id = explode(',', $VAR["delete_id"]); - elseif (isset($VAR["id"])) - $id = explode(',', $VAR["id"]); + # Get the array + if (isset($VAR['delete_id'])) + $ids = explode(',',preg_replace('/,$/','',$VAR['delete_id'])); + elseif (isset($VAR['id'])) + $ids = explode(',',preg_replace('/,$/','',$VAR['id'])); - ### Load the service module + # Load the service module include_once(PATH_MODULES.'service/service.inc.php'); $service = new service; - ### Loop: - for($i=0; $iassociated_DELETE = array(); + array_push($this->associated_DELETE,array('table'=>'invoice_commission','field'=>'invoice_id')); + array_push($this->associated_DELETE,array('table'=>'invoice_item','field'=>'invoice_id')); + array_push($this->associated_DELETE,array('table'=>'invoice_memo','field'=>'invoice_id')); +// array_push($this->associated_DELETE,array('table'=>'service','field'=>'invoice_id')); + array_push($this->associated_DELETE,array('table'=>'invoice_item_tax','field'=>'invoice_id')); + array_push($this->associated_DELETE,array('table'=>'invoice_item_discount','field'=>'invoice_id')); + + $result = parent::delete($VAR); } } - /** SEARCH FORM - */ - function search_form($VAR) - { - $this->invoice_construct(); - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - /** SEARCH - */ - function search($VAR) - { - $this->invoice_construct(); - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - - $db = &DB(); - - include_once(PATH_CORE . 'validate.inc.php'); - $validate = new CORE_validate; - - # set the search criteria array - $arr = $VAR; - - # convert invoice_discount_arr - if(!empty($VAR['invoice_discount_arr'])) - $arr['invoice_discount_arr'] = '%"'.$VAR['invoice_discount_arr'].'"%'; - - - # loop through the submitted field_names to get the WHERE statement - $where_list = ''; - $i=0; - while (list ($key, $value) = each ($arr)) - { - if($i == 0) - { - if($value != '') - { - $pat = "^" . $this->module . "_"; - if(eregi($pat, $key)) - { - $field = eregi_replace($pat,"",$key); - if(eregi('%',$value)) - { - # do any data conversion for this field (date, encrypt, etc...) - if(isset($this->field["$field"]["convert"]) && $this->field["$field"]["convert"] != 'array') - { - $value = $validate->convert($field, $value, $this->field["$field"]["convert"]); - } - - $where_list .= " WHERE ".AGILE_DB_PREFIX."invoice.".$field . " LIKE " . $db->qstr($value, get_magic_quotes_gpc()); - $i++; - } - else - { - # check if array - if(is_array($value)) - { - for($i_arr=0; $i_arr < count($value); $i_arr++) - { - if($value["$i_arr"] != '') - { - # determine any field options (=, >, <, etc...) - $f_opt = '='; - $pat_field = $this->module.'_'.$field; - $VAR['field_option']["$pat_field"]["$i_arr"]; - if(isset($VAR['field_option']["$pat_field"]["$i_arr"])) - { - $f_opt = $VAR['field_option']["$pat_field"]["$i_arr"]; - # error checking, safety precaution - if($f_opt != '=' && $f_opt != '>' && $f_opt != '<' && $f_opt != '>=' && $f_opt != '<=' && $f_opt != '!=') - $f_opt = '='; - } - - # do any data conversion for this field (date, encrypt, etc...) - if(isset($this->field["$field"]["convert"]) && $this->field["$field"]["convert"] != 'array') - { - $value["$i_arr"] = $validate->convert($field, $value["$i_arr"], $this->field["$field"]["convert"]); - } - - - if($i_arr == 0) - { - $where_list .= " WHERE ".AGILE_DB_PREFIX."invoice.".$field . " $f_opt " . $db->qstr($value["$i_arr"], get_magic_quotes_gpc()); - $i++; - } - else - { - $where_list .= " AND ".AGILE_DB_PREFIX."invoice.".$field . " $f_opt " . $db->qstr($value["$i_arr"], get_magic_quotes_gpc()); - $i++; - } - } - } - } - else - { - $where_list .= " WHERE ".AGILE_DB_PREFIX."invoice.".$field . " = " . $db->qstr($value, get_magic_quotes_gpc()); - $i++; - } - } - } - } - } - else - { - if($value != '') - { - $pat = "^" . $this->module . "_"; - if(eregi($pat, $key)) - { - $field = eregi_replace($pat,"",$key); - if(eregi('%',$value)) - { - # do any data conversion for this field (date, encrypt, etc...) - if(isset($this->field["$field"]["convert"]) && $this->field["$field"]["convert"] != 'array') - { - $value = $validate->convert($field, $value, $this->field["$field"]["convert"]); - } - - $where_list .= " AND ".AGILE_DB_PREFIX."invoice.".$field . " LIKE " . $db->qstr($value, get_magic_quotes_gpc()); - $i++; - } - else - { - # check if array - if(is_array($value)) - { - for($i_arr=0; $i_arr < count($value); $i_arr++) - { - if($value["$i_arr"] != '') - { - # determine any field options (=, >, <, etc...) - $f_opt = '='; - $pat_field = $this->module.'_'.$field; - if(isset($VAR['field_option']["$pat_field"]["$i_arr"])) - { - $f_opt = $VAR['field_option']["$pat_field"]["$i_arr"]; - - # error checking, safety precaution - if($f_opt != '=' && $f_opt != '>' && $f_opt != '<' && $f_opt != '>=' && $f_opt != '<=' && $f_opt != '!=') - $f_opt = '='; - } - - # do any data conversion for this field (date, encrypt, etc...) - if(isset($this->field["$field"]["convert"]) && $this->field["$field"]["convert"] != 'array') - { - $value["$i_arr"] = $validate->convert($field, $value["$i_arr"], $this->field["$field"]["convert"]); - } - - $where_list .= " AND ".AGILE_DB_PREFIX."invoice.". $field . " $f_opt " . $db->qstr($value["$i_arr"], get_magic_quotes_gpc()); - $i++; - } - } - } - else - { - $where_list .= " AND ".AGILE_DB_PREFIX."invoice.". $field . " = ". $db->qstr($value, get_magic_quotes_gpc()); - $i++; - } - } - } - } - } - } - - - - # Code for attribute searches: - if(!empty($VAR['join_product_id']) && !empty($VAR['item_attributes'])) - { - $attr_arr = $VAR['item_attributes']; - for($ati=0; $atiqstr("%{$attr_arr[$ati]['0']}=={$attr_arr[$ati]['1']}%"); - } - } - } - - # get limit type - if(isset($VAR['limit'])) - { - $limit = $VAR['limit']; - } - else - { - $limit = $this->limit; - } - - # get order by - if(isset($VAR['order_by'])) - { - $order_by = $VAR['order_by']; - } - else - { - $order_by = $this->order_by; - } - - - ## SELECT FROM - $p = AGILE_DB_PREFIX; - $q = "SELECT DISTINCT {$p}invoice.id FROM ".AGILE_DB_PREFIX."invoice "; - $q_save = "SELECT DISTINCT %%fieldList%%,{$p}invoice.id FROM {$p}invoice "; - - ## LEFT JOIN - if( !empty($VAR['join_product_id']) || !empty($VAR['join_service_id']) || - !empty($VAR['join_domain_name']) || !empty($VAR['join_domain_tld']) || - !empty($VAR['join_memo_text']) ) - { - # JOIN ON PRODUCT DETAILS: - if(!empty($VAR['join_product_id']) || !empty($VAR['join_service_id']) || !empty($VAR['join_domain_name']) || !empty($VAR['join_domain_tld'])) - { - $q .= " LEFT JOIN {$p}invoice_item ON {$p}invoice_item.invoice_id = {$p}invoice.id"; - $q_save .= " LEFT JOIN {$p}invoice_item ON {$p}invoice_item.invoice_id = {$p}invoice.id"; - - if($where_list == '') { - $q .= " WHERE {$p}invoice_item.site_id = " . $db->qstr(DEFAULT_SITE); - $q_save .= " WHERE {$p}invoice_item.site_id = " . $db->qstr(DEFAULT_SITE); - } else { - $q .= $where_list ." AND {$p}invoice_item.site_id = " . $db->qstr(DEFAULT_SITE); - $q_save .= $where_list ." AND {$p}invoice_item.site_id = " . $db->qstr(DEFAULT_SITE); - } - - # AND (invoice_item.product_id) - if(!empty($VAR['join_product_id'])) { - $q .= " AND {$p}invoice_item.product_id = " . $db->qstr($VAR['join_product_id']); - $q_save .= " AND {$p}invoice_item.product_id = " . $db->qstr($VAR['join_product_id']); - } - - # AND (invoice_item.service_id) - if(!empty($VAR['join_service_id'])) { - $q .= " AND {$p}invoice_item.service_id = " . $db->qstr($VAR['join_service_id']); - $q_save .= " AND {$p}invoice_item.service_id = " . $db->qstr($VAR['join_service_id']); - } - - # AND (invoice_item.domain_name) - if(!empty($VAR['join_domain_name'])) { - if(!ereg('%',$VAR['join_domain_name']) ) $qtype = ' = '; else $qtype = ' LIKE '; - $q .= " AND {$p}invoice_item.domain_name $qtype " . $db->qstr($VAR['join_domain_name']); - $q_save .= " AND {$p}invoice_item.domain_name $qtype " . $db->qstr($VAR['join_domain_name']); - - } - - # AND (invoice_item.domain_tld) - if(!empty($VAR['join_domain_tld'])) { - if(!ereg('%',$VAR['join_domain_tld']) ) $qtype = ' = '; else $qtype = ' LIKE '; - $q .= " AND {$p}invoice_item.domain_tld $qtype " . $db->qstr($VAR['join_domain_tld']); - $q_save .= " AND {$p}invoice_item.domain_tld $qtype " . $db->qstr($VAR['join_domain_tld']); - } - } - - # JOIN ON MEMO TEXT: - if(!empty($VAR['join_memo_text'])) - { - $q .= " LEFT JOIN {$p}invoice_memo ON {$p}invoice_memo.invoice_id = {$p}invoice.id"; - $q_save .= " LEFT JOIN {$p}invoice_memo ON {$p}invoice_memo.invoice_id = {$p}invoice.id"; - - if($where_list == '') { - $q .= " WHERE {$p}invoice_memo.site_id = " . $db->qstr(DEFAULT_SITE); - $q_save .= " WHERE {$p}invoice_memo.site_id = " . $db->qstr(DEFAULT_SITE); - } else { - $q .= $where_list ." AND {$p}invoice_memo.site_id = " . $db->qstr(DEFAULT_SITE); - $q_save .= $where_list ." AND {$p}invoice_memo.site_id = " . $db->qstr(DEFAULT_SITE); - } - - $q .= " AND {$p}invoice_memo.memo LIKE " . $db->qstr('%'. $VAR['join_memo_text'] .'%'); - $q_save .= " AND {$p}invoice_memo.memo LIKE " . $db->qstr('%'. $VAR['join_memo_text'] .'%'); - } - - $q .= " AND {$p}invoice.site_id = ". DEFAULT_SITE; - $q_save .= ' AND '; - } - else - { - if($where_list == '') { - $q .= "WHERE {$p}invoice.site_id = ". DEFAULT_SITE; - $q_save .= ' WHERE '; - } - else - { - $q .= $where_list . " AND {$p}invoice.site_id = ". DEFAULT_SITE; - $q_save .= $where_list . ' AND '; - } - } - - - ///////////////// debug - #echo $q; - #exit; - - # run the database query - $result = $db->Execute($q); - - # error reporting - if ($result === false) - { - global $C_debug; - $C_debug->error('invoice.inc.php','search', $db->ErrorMsg()); - return false; - } - - # get the result count: - $results = $result->RecordCount(); - - # get the first record id: - if($results == 1) $record_id = $result->fields['id']; - - # define the DB vars as a Smarty accessible block - global $smarty; - - # Create the definition for fast-forwarding to a single record: - if ($results == 1 && !isset($this->fast_forward)) - { - $smarty->assign('record_id', $record_id); - } - - # create the search record: - if($results > 0) - { - # create the search record - include_once(PATH_CORE . 'search.inc.php'); - $search = new CORE_search; - $arr['module'] = $this->module; - $arr['sql'] = $q_save; - $arr['limit'] = $limit; - $arr['order_by']= $order_by; - $arr['results'] = $results; - $search->add($arr); - - # define the search id and other parameters for Smarty - $smarty->assign('search_id', $search->id); - - # page: - $smarty->assign('page', '1'); - - # limit: - $smarty->assign('limit', $limit); - - # order_by: - $smarty->assign('order_by', $order_by); - } - - # define the result count - $smarty->assign('results', $results); - } - - /** SEARCH SHOW - */ - function search_show($VAR) - { - $this->invoice_construct(); - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - - # set the field list for this method: - $arr = $this->method[$type]; - $field_list = ''; - $i=0; - while (list ($key, $value) = each ($arr)) - { - if($i == 0) - { - $field_var = $this->table . '_' . $value; - $field_list .= AGILE_DB_PREFIX . "invoice" . "." . $value; - - // determine if this record is linked to another table/field - if($this->field[$value]["asso_table"] != "") - { - $this->linked[] = array('field' => $value, 'link_table' => $this->field[$value]["asso_table"], 'link_field' => $this->field[$value]["asso_field"]); - } - } - else - { - $field_var = $this->table . '_' . $value; - $field_list .= "," . AGILE_DB_PREFIX . "invoice" . "." . $value; - - // determine if this record is linked to another table/field - if($this->field[$value]["asso_table"] != "") - { - $this->linked[] = array('field' => $value, 'link_table' => $this->field[$value]["asso_table"], 'link_field' => $this->field[$value]["asso_field"]); - } - } - $i++; - } - - - # get the search details: - if(isset($VAR['search_id'])) { - include_once(PATH_CORE . 'search.inc.php'); - $search = new CORE_search; - $search->get($VAR['search_id']); - } else { - # invalid search! - echo '
    The search terms submitted were invalid!'; # translate... # alert - - if(isset($this->trigger["$type"])) { - include_once(PATH_CORE . 'trigger.inc.php'); - $trigger = new CORE_trigger; - $trigger->trigger($this->trigger["$type"], 0, $VAR); - } - } - - # get the sort order details: - if(isset($VAR['order_by']) && $VAR['order_by'] != "") { - $order_by = ' ORDER BY ' . $VAR['order_by']; - $smarty_order = $VAR['order_by']; - } else { - $order_by = ' ORDER BY ' . $this->order_by; - $smarty_order = $search->order_by; - } - - - # determine the sort order - if(isset($VAR['desc'])) { - $order_by .= ' DESC'; - $smarty_sort = 'desc='; - } else if(isset($VAR['asc'])) { - $order_by .= ' ASC'; - $smarty_sort = 'asc='; - } else { - if (!eregi('date',$smarty_order)) { - $order_by .= ' ASC'; - $smarty_sort = 'asc='; - } else { - $order_by .= ' DESC'; - $smarty_sort = 'desc='; - } - } - - - # determine the offset & limit - $current_page=1; - $offset=-1; - if (!empty($VAR['page'])) $current_page = $VAR['page']; - if (empty($search->limit)) $search->limit=25; - if($current_page>1) $offset = (($current_page * $search->limit) - $search->limit); - - # generate the full query - $db = &DB(); - $q = eregi_replace("%%fieldList%%", $field_list, $search->sql); - $q = eregi_replace("%%tableList%%", AGILE_DB_PREFIX.$construct->table, $q); - $q = eregi_replace("%%whereList%%", "", $q); - $q .= " ".AGILE_DB_PREFIX . "invoice.site_id = '" . DEFAULT_SITE . "'"; - $q .= $order_by; - - ////////////////// - #echo "
    $q
    "; - - $result = $db->SelectLimit($q, $search->limit, $offset); - - # error reporting - if ($result === false) - { - global $C_debug; - $C_debug->error('invoice.inc.php','search', $db->ErrorMsg()); - - if(isset($this->trigger["$type"])) - { - include_once(PATH_CORE . 'trigger.inc.php'); - $trigger = new CORE_trigger; - $trigger->trigger($this->trigger["$type"], 0, $VAR); - } - return; - } - - - # put the results into a smarty accessable array - $i=0; - $class_name = TRUE; - while (!$result->EOF) { - $smart[$i] = $result->fields; - $amount += $result->fields['total_amt']; - if($class_name) - { - $smart[$i]['_C'] = 'row1'; - $class_name = FALSE; - } else { - $smart[$i]['_C'] = 'row2'; - $class_name = TRUE; - } - - $result->MoveNext(); - $i++; - } - - - # get any linked fields - if($i > 0) - { - $db_join = new CORE_database; - $this->result = $db_join->join_fields($smart, $this->linked); - } - else - { - $this->result = $smart; - } - - # get the result count: - $results = $result->RecordCount(); - - # define the DB vars as a Smarty accessible block - global $smarty; - - # define the results - $smarty->assign($this->table, $this->result); - $smarty->assign('page', $VAR['page']); - $smarty->assign('order', $smarty_order); - $smarty->assign('sort', $smarty_sort); - $smarty->assign('limit', $search->limit); - $smarty->assign('search_id',$search->id); - $smarty->assign('results', $search->results); - - global $C_list; - $smarty->assign('total_amount', $C_list->format_currency($amount,DEFAULT_CURRENCY)); - - # get the total pages for this search: - if(empty($search->limit)) - $this->pages = 1; - else - $this->pages = intval($search->results / $search->limit); - if ($search->results % $search->limit) $this->pages++; - - # total pages - $smarty->assign('pages', $this->pages); - - # current page - $smarty->assign('page', $current_page); - $page_arr = ''; - for($i=0; $i <= $this->pages; $i++) - { - if ($this->page != $i) $page_arr[] = $i; - } - - # page array for menu - $smarty->assign('page_arr', $page_arr); - } - - /** USER SEARCH - */ - function user_search($VAR) - { - if(!SESS_LOGGED) return false; - $VAR['invoice_account_id'] = SESS_ACCOUNT; - $this->invoice_construct(); - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - /** USER SEARCH SHOW - */ - function user_search_show($VAR) - { - if(!SESS_LOGGED) return false; - $this->invoice_construct(); - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } - - /** USER VIEW - */ - function user_view($VAR) - { + /** + * User view an invoice + */ + public function user_view($VAR) { global $C_auth; - if(!SESS_LOGGED) return false; - // verify the account_id for this order is the SESS_ACCOUNT - if ( $C_auth->auth_method_by_name('invoice','view') == false) - { - $id = explode(',',$VAR['id']); + if (! SESS_LOGGED) + return false; + + # Verify the account_id for this order is the SESS_ACCOUNT + if ($C_auth->auth_method_by_name('invoice','view') == false) { + $id = preg_replace('/,$/','',$VAR['id']); $db = &DB(); - $q = "SELECT account_id FROM ".AGILE_DB_PREFIX."invoice WHERE - id = ".$db->qstr($id[0])." AND - site_id = ".$db->qstr(DEFAULT_SITE); - $rs = $db->Execute($q); + $rs = $db->Execute($q=sqlSelect($db,'invoice','account_id',array('id'=>$id))); if ($rs === false) { global $C_debug; - $C_debug->error('invoice.inc.php','user_view', $db->ErrorMsg()); + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); + return false; } - if ($rs->fields['account_id'] != SESS_ACCOUNT) return false; + + if ($rs->fields['account_id'] != SESS_ACCOUNT) + return false; } - $this->view($VAR, $this); + + $this->view($VAR,$this); } - - /** SEARCH EXPORT - */ - function search_export($VAR) - { - $this->invoice_construct(); - - # require the export class - require_once (PATH_CORE . "export.inc.php"); - - # Call the correct export function for inline browser display, download, email, or web save. - if($VAR["format"] == "excel") - { - $type = "export_excel"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $export = new CORE_export; - $export->search_excel($VAR, $this, $type); - } - - else if ($VAR["format"] == "pdf") - { - $type = "export_pdf"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $export = new CORE_export; - $export->pdf_invoice($VAR, $this, $type); - } - - else if ($VAR["format"] == "xml") - { - $type = "export_xml"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $export = new CORE_export; - $export->search_xml($VAR, $this, $type); - } - - else if ($VAR["format"] == "csv") - { - $type = "export_csv"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $export = new CORE_export; - $export->search_csv($VAR, $this, $type); - } - - else if ($VAR["format"] == "tab") - { - $type = "export_tab"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $export = new CORE_export; - $export->search_tab($VAR, $this, $type); - } - } - - function invoice_construct() - { - $this->module = "invoice"; - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - include_once(PATH_CORE.'xml.inc.php'); - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } -} +} ?> diff --git a/modules/invoice/invoice_base_fpdf.inc.php b/modules/invoice/invoice_base_fpdf.inc.php new file mode 100644 index 00000000..3a9b8295 --- /dev/null +++ b/modules/invoice/invoice_base_fpdf.inc.php @@ -0,0 +1,197 @@ + + * @copyright 2009 Deon George + * @link http://osb.leenooks.net + * + * @link http://www.agileco.com/ + * @copyright 2004-2008 Agileco, LLC. + * @license http://www.agileco.com/agilebill/license1-4.txt + * @author Tony Landis + * @package AgileBill + * @subpackage Module:Invoice + */ + +define('FPDF_FONTPATH',PATH_INCLUDES.'fpdf/font/'); +require_once(PATH_INCLUDES.'fpdf/fpdf.php'); + +/** + * PDF Invoice Base + * + * @package AgileBill + * @subpackage Module:Invoice + */ +abstract class pdf_invoice_base extends fpdf { + protected $billToCompany = true; + protected $itemsSummaryMax = 16; + protected $itemsPreviousMax = 5; + protected $news = ''; + protected $pageType = 'blank'; + protected $show_itemized = true; + protected $show_service_range = false; + private $invoiceCurrency = '$'; + private $invoiceDecimals = 2; + + # Store previous invoices due + private $itemsPrevious = array(); + # Stores the invoice items + protected $invoice; + protected $itemsFull; + protected $account; + # Iteration of drawing the items on the invoice + protected $iteration; + # Store the date range, that the invoice covers + protected $dateRange; + + public function __construct($inv) { + parent::__construct(); + + $this->SetCreator('Open Source Billing'); + $this->SetAuthor($inv->print['site']['NAME']); + $this->SetTitle(sprintf('%s Invoice',$inv->print['site']['NAME'])); + $this->SetSubject(sprintf('Invoice #%06s',$inv->getInvoiceNum())); + $this->SetKeywords($inv->getInvoiceID()); + $this->SetAutoPageBreak(TRUE,25); + $this->SetDisplayMode('fullwidth'); + + return $this; + } + + public function load_setup(&$rs) { + if (! $rs) { + $db =& DB(); + $rs = $db->Execute(sqlSelect($db,'setup_invoice','*','')); + } + + $this->billToCompany = $rs->fields['bill_to_company']; + $this->invoiceCurrency = $rs->fields['invoice_currency']; + $this->invoiceDecimals = $rs->fields['invoice_decimals']; + $this->itemsSummaryMax = $rs->fields['items_summary_max']; + $this->news = $rs->fields['news']; + $this->pageType = $rs->fields['page_type']; + $this->show_itemized = $rs->fields['invoice_show_itemized']; + $this->show_service_range = $rs->fields['invoice_show_service_dates']; + } + + abstract public function drawCompanyLogo(); + abstract public function drawCompanyAddress($inv); + abstract public function drawInvoiceHeader($inv); + + /** + * Enable re-iteration of the invoices items, so that they can be displayed many ways + */ + abstract public function drawLineItems_pre($iteration); + + /** + * This is called for each line item. + */ + abstract public function drawLineItems($db,$line,$invnum); + + /** + * Draws the summary on the first page + */ + abstract public function drawSummaryLineItems($inv); + abstract public function drawPaymentMethods($inv); + + public function drawRemittenceStub() {} + public function drawCustom() {} + public function drawInvoiceDueNotice() {} + public function drawInvoicePaidNotice() {} + public function setLateFeeNotice() {} + + /** + * Get a blank invoice template + */ + public function getTemplate() { + return false; + } + + /** + * Assigns the invoice fields to this object. + */ + public function setInvoiceFields($flds) { + $this->invoice = $flds; + } + + /** + * Assigns the account fields to this object. + */ + public function setAccountFields($flds) { + $this->account = $flds; + } + + public function setItemsFull($items) { + $this->itemsFull = $items; + } + + public function setItemsPrevious($items) { + $this->itemsPrevious = $items; + } + + public function setDateRange($periodStart,$periodEnd) { + $this->dateRange = sprintf('%s - %s',date(UNIX_DATE_FORMAT,$periodStart),date(UNIX_DATE_FORMAT,$periodEnd)); + } + + public function setCurrency($currency) { + $this->invoiceCurrency = $currency; + } + + public function setDecimals($decimals) { + $this->invoiceDecimals = $decimals; + } + + /** + * Render an amount into a currency display + */ + protected function _currency($num) { + global $C_list; + + if ($this->invoiceDecimals>3) + return $this->invoiceCurrency.number_format($num,$this->invoiceDecimals); + else + return $C_list->format_currency_num($num,$this->invoice['actual_billed_currency_id']); + } + + protected function Rotate($angle,$x=-1,$y=-1) { + if ($x==-1) + $x = $this->x; + if ($y==-1) + $y = $this->y; + if ($this->angle!=0) + $this->_out('Q'); + $this->angle = $angle; + + if ($angle != 0) { + $angle *= M_PI/180; + $c = cos($angle); + $s = sin($angle); + $cx = $x*$this->k; + $cy = ($this->h-$y)*$this->k; + $this->_out(sprintf('q %.5f %.5f %.5f %.5f %.2f %.2f cm 1 0 0 1 %.2f %.2f cm',$c,$s,-$s,$c,$cx,$cy,-$cx,-$cy)); + } + } + + /** + * Add a watermark to the PDF + */ + public function addWaterMark($text) { + $this->SetFont('arial','B',50); + $this->SetTextColor(203,203,203); + $this->Rotate(0); + $this->Text(10,50,$text); + $this->Rotate(0); + $this->SetTextColor(0,0,0); + } +} +?> diff --git a/modules/invoice/invoice_base_fpdi.inc.php b/modules/invoice/invoice_base_fpdi.inc.php new file mode 100644 index 00000000..7f498b46 --- /dev/null +++ b/modules/invoice/invoice_base_fpdi.inc.php @@ -0,0 +1,314 @@ + + * @copyright 2009 Deon George + * @link http://osb.leenooks.net + * + * @link http://www.agileco.com/ + * @copyright 2004-2008 Agileco, LLC. + * @license http://www.agileco.com/agilebill/license1-4.txt + * @author Tony Landis + * @package AgileBill + * @subpackage Module:Invoice + */ + +define('FPDF_FONTPATH',PATH_INCLUDES.'pdf/font/'); +require_once(PATH_INCLUDES.'pdf/fpdi.php'); +require_once(PATH_INCLUDES.'pdf/fpdf_tpl.php'); +require_once(PATH_INCLUDES.'pdf/fpdf.php'); + +/** + * PDF Invoice Base + * + * @package AgileBill + * @subpackage Module:Invoice + */ +abstract class pdf_invoice_base extends fpdi { + protected $billToCompany = true; + protected $itemsSummaryMax = 16; + protected $itemsPreviousMax = 5; + protected $news = ''; + protected $pageType = 'blank'; + protected $show_itemized = true; + protected $show_service_range = false; + private $invoiceCurrency = '$'; + private $invoiceDecimals = 2; + + # Store previous invoices due + private $itemsPrevious = array(); + # Stores the invoice items + protected $invoice; + protected $itemsFull; + protected $account; + # Iteration of drawing the items on the invoice + protected $iteration; + # Store the date range, that the invoice covers + protected $dateRange; + + public function __construct($inv) { + parent::__construct(); + + $this->SetCreator('Open Source Billing'); + $this->SetAuthor($inv->print['site']['NAME']); + $this->SetTitle(sprintf('%s Invoice',$inv->print['site']['NAME'])); + $this->SetSubject(sprintf('Invoice #%06s',$inv->getInvoiceNum())); + $this->SetKeywords($inv->getInvoiceID()); + $this->SetAutoPageBreak(TRUE,25); + $this->SetDisplayMode('fullwidth'); + + return $this; + } + + public function load_setup(&$rs) { + if (! $rs) { + $db =& DB(); + $rs = $db->Execute(sqlSelect($db,'setup_invoice','*','')); + } + + $this->billToCompany = $rs->fields['bill_to_company']; + $this->invoiceCurrency = $rs->fields['invoice_currency']; + $this->invoiceDecimals = $rs->fields['invoice_decimals']; + $this->itemsSummaryMax = $rs->fields['items_summary_max']; + $this->news = $rs->fields['news']; + $this->pageType = $rs->fields['page_type']; + $this->show_itemized = $rs->fields['invoice_show_itemized']; + $this->show_service_range = $rs->fields['invoice_show_service_dates']; + } + + abstract public function drawCompanyLogo(); + abstract public function drawCompanyAddress($inv); + abstract public function drawInvoiceHeader($inv); + + /** + * Enable re-iteration of the invoices items, so that they can be displayed many ways + */ + abstract public function drawLineItems_pre($iteration); + + /** + * This is called for each line item. + */ + abstract public function drawLineItems($db,$line,$invnum); + + /** + * Draws the summary on the first page + */ + abstract public function drawSummaryLineItems($inv); + abstract public function drawPaymentMethods($inv); + + public function drawRemittenceStub() {} + public function drawCustom() {} + public function drawInvoiceDueNotice() {} + public function drawInvoicePaidNotice() {} + public function setLateFeeNotice() {} + + /** + * Get a blank invoice template + */ + public function getTemplate() { + return PATH_THEMES.DEFAULT_THEME.'/invoice/invoice-'.$this->pageType.'.pdf'; + } + + /** + * Assigns the invoice fields to this object. + */ + public function setInvoiceFields($flds) { + $this->invoice = $flds; + } + + /** + * Assigns the account fields to this object. + */ + public function setAccountFields($flds) { + $this->account = $flds; + } + + public function setItemsFull($items) { + $this->itemsFull = $items; + } + + public function setItemsPrevious($items) { + $this->itemsPrevious = $items; + } + + public function setDateRange($periodStart,$periodEnd) { + $this->dateRange = sprintf('%s - %s',date(UNIX_DATE_FORMAT,$periodStart),date(UNIX_DATE_FORMAT,$periodEnd)); + } + + public function setCurrency($currency) { + $this->invoiceCurrency = $currency; + } + + public function setDecimals($decimals) { + $this->invoiceDecimals = $decimals; + } + + /** + * Render an amount into a currency display + */ + protected function _currency($num) { + global $C_list; + + if ($this->invoiceDecimals>3) + return $this->invoiceCurrency.number_format($num,$this->invoiceDecimals); + else + return $C_list->format_currency_num($num,$this->invoice['actual_billed_currency_id']); + } + + /** + * Override fpdf functions + */ + public function _putpages() { + $nb = $this->page; + if (! empty($this->AliasNbPages)) { + //Replace number of pages + for ($n=1;$n<=$nb;$n++) + $this->pages[$n]=($this->compress) ? gzcompress(str_replace($this->AliasNbPages,$nb,gzuncompress($this->pages[$n]))) : str_replace($this->AliasNbPages,$nb,$this->pages[$n]) ; + } + + if ($this->DefOrientation=='P') { + $wPt=$this->fwPt; + $hPt=$this->fhPt; + } else { + $wPt=$this->fhPt; + $hPt=$this->fwPt; + } + + $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; + for($n=1;$n<=$nb;$n++) { + //Page + $this->_newobj(); + $this->_out('<_out('/Parent 1 0 R'); + if (isset($this->OrientationChanges[$n])) + $this->_out(sprintf('/MediaBox [0 0 %.2f %.2f]',$hPt,$wPt)); + $this->_out('/Resources 2 0 R'); + if(isset($this->PageLinks[$n])) { + //Links + $annots='/Annots ['; + foreach($this->PageLinks[$n] as $pl) { + $rect=sprintf('%.2f %.2f %.2f %.2f',$pl[0],$pl[1],$pl[0]+$pl[2],$pl[1]-$pl[3]); + $annots.='<_textstring($pl[4]).'>>>>'; + else { + $l=$this->links[$pl[4]]; + $h=isset($this->OrientationChanges[$l[0]]) ? $wPt : $hPt; + $annots.=sprintf('/Dest [%d 0 R /XYZ 0 %.2f null]>>',1+2*$l[0],$h-$l[1]*$this->k); + } + } + $this->_out($annots.']'); + } + $this->_out('/Contents '.($this->n+1).' 0 R>>'); + $this->_out('endobj'); + //Page content + $this->_newobj(); + $this->_out('<<'.$filter.'/Length '.strlen($this->pages[$n]).'>>'); + $this->_putstream($this->pages[$n]); + $this->_out('endobj'); + } + + //Pages root + $this->offsets[1]=strlen($this->buffer); + $this->_out('1 0 obj'); + $this->_out('<_out($kids.']'); + $this->_out('/Count '.$nb); + $this->_out(sprintf('/MediaBox [0 0 %.2f %.2f]',$wPt,$hPt)); + $this->_out('>>'); + $this->_out('endobj'); + } + + public function _endpage() { + //End of page contents + $this->pages[$this->page] = ($this->compress) ? gzcompress($this->pages[$this->page]) : $this->pages[$this->page]; + $this->state=1; + } + + protected function RoundedRect($x,$y,$w,$h,$r,$style='') { + $k = $this->k; + $hp = $this->h; + + if ($style=='F') + $op = 'f'; + elseif ($style=='FD' || $style=='DF') + $op = 'B'; + else + $op = 'S'; + + $MyArc = 4/3*(sqrt(2)-1); + $this->_out(sprintf('%.2f %.2f m',($x+$r)*$k,($hp-$y)*$k)); + $xc = $x+$w-$r ; + $yc = $y+$r; + $this->_out(sprintf('%.2f %.2f l',$xc*$k,($hp-$y)*$k)); + + $this->_Arc($xc+$r*$MyArc,$yc-$r,$xc+$r,$yc-$r*$MyArc,$xc+$r,$yc); + $xc = $x+$w-$r; + $yc = $y+$h-$r; + $this->_out(sprintf('%.2f %.2f l',($x+$w)*$k,($hp-$yc)*$k)); + + $this->_Arc($xc+$r,$yc+$r*$MyArc,$xc+$r*$MyArc,$yc+$r,$xc,$yc+$r); + $xc = $x+$r; + $yc = $y+$h-$r; + $this->_out(sprintf('%.2f %.2f l',$xc*$k,($hp-($y+$h))*$k)); + + $this->_Arc($xc-$r*$MyArc,$yc+$r,$xc-$r,$yc+$r*$MyArc,$xc-$r,$yc); + $xc = $x+$r; + $yc = $y+$r; + $this->_out(sprintf('%.2f %.2f l',($x)*$k,($hp-$yc)*$k)); + + $this->_Arc($xc-$r,$yc-$r*$MyArc,$xc-$r*$MyArc,$yc-$r,$xc,$yc-$r); + $this->_out($op); + } + + private function _Arc($x1,$y1,$x2,$y2,$x3,$y3) { + $h = $this->h; + $this->_out(sprintf('%.2f %.2f %.2f %.2f %.2f %.2f c ', + $x1*$this->k,($h-$y1)*$this->k,$x2*$this->k,($h-$y2)*$this->k,$x3*$this->k,($h-$y3)*$this->k)); + } + + protected function Rotate($angle,$x=-1,$y=-1) { + if ($x==-1) + $x = $this->x; + if ($y==-1) + $y = $this->y; + if ($this->angle!=0) + $this->_out('Q'); + $this->angle = $angle; + + if ($angle != 0) { + $angle *= M_PI/180; + $c = cos($angle); + $s = sin($angle); + $cx = $x*$this->k; + $cy = ($this->h-$y)*$this->k; + $this->_out(sprintf('q %.5f %.5f %.5f %.5f %.2f %.2f cm 1 0 0 1 %.2f %.2f cm',$c,$s,-$s,$c,$cx,$cy,-$cx,-$cy)); + } + } + + /** + * Add a watermark to the PDF + */ + public function addWaterMark($text) { + $this->SetFont('arial','B',50); + $this->SetTextColor(203,203,203); + $this->Rotate(0); + $this->Text(10,50,$text); + $this->Rotate(0); + $this->SetTextColor(0,0,0); + } +} +?> diff --git a/modules/invoice/invoice_base_tcpdf.inc.php b/modules/invoice/invoice_base_tcpdf.inc.php new file mode 100644 index 00000000..49a1c7e1 --- /dev/null +++ b/modules/invoice/invoice_base_tcpdf.inc.php @@ -0,0 +1,182 @@ + + * @copyright 2009 Deon George + * @link http://osb.leenooks.net + * + * @link http://www.agileco.com/ + * @copyright 2004-2008 Agileco, LLC. + * @license http://www.agileco.com/agilebill/license1-4.txt + * @author Tony Landis + * @package AgileBill + * @subpackage Module:Invoice + */ + +define('FPDF_FONTPATH',PATH_INCLUDES.'tcpdf/fonts/'); +require_once(PATH_INCLUDES.'tcpdf/tcpdf.php'); + +/** + * PDF Invoice Base + * + * @package AgileBill + * @subpackage Module:Invoice + */ +abstract class pdf_invoice_base extends TCPDF { + protected $billToCompany = true; + protected $itemsSummaryMax = 16; + protected $itemsPreviousMax = 5; + protected $news = ''; + protected $pageType = 'blank'; + protected $show_itemized = true; + protected $show_service_range = false; + private $invoiceCurrency = '$'; + private $invoiceDecimals = 2; + + # Store previous invoices due + private $itemsPrevious = array(); + # Stores the invoice items + protected $invoice; + protected $itemsFull; + protected $account; + # Iteration of drawing the items on the invoice + protected $iteration; + # Store the date range, that the invoice covers + protected $dateRange; + + public function __construct($inv) { + parent::__construct(); + + $this->SetCreator('Open Source Billing'); + $this->SetAuthor($inv->print['site']['NAME']); + $this->SetTitle(sprintf('%s Invoice',$inv->print['site']['NAME'])); + $this->SetSubject(sprintf('Invoice #%06s',$inv->getInvoiceNum())); + $this->SetKeywords($inv->getInvoiceID()); + $this->SetAutoPageBreak(TRUE,25); + $this->SetHeaderMargin(1); + $this->SetFooterMargin(10); + $this->SetDisplayMode('fullwidth'); + #$this->setHeaderFont(array('helvetica','',8)); + $this->setFooterFont(array('helvetica','',8)); + + return $this; + } + + public function load_setup(&$rs) { + if (! $rs) { + $db =& DB(); + $rs = $db->Execute(sqlSelect($db,'setup_invoice','*','')); + } + + $this->billToCompany = $rs->fields['bill_to_company']; + $this->invoiceCurrency = $rs->fields['invoice_currency']; + $this->invoiceDecimals = $rs->fields['invoice_decimals']; + $this->itemsSummaryMax = $rs->fields['items_summary_max']; + $this->news = $rs->fields['news']; + $this->pageType = $rs->fields['page_type']; + $this->show_itemized = $rs->fields['invoice_show_itemized']; + $this->show_service_range = $rs->fields['invoice_show_service_dates']; + } + + abstract public function drawCompanyLogo(); + abstract public function drawCompanyAddress($inv); + abstract public function drawInvoiceHeader($inv); + + /** + * Enable re-iteration of the invoices items, so that they can be displayed many ways + */ + abstract public function drawLineItems_pre($iteration); + + /** + * This is called for each line item. + */ + abstract public function drawLineItems($db,$line,$invnum); + + /** + * Draws the summary on the first page + */ + abstract public function drawSummaryLineItems($inv); + abstract public function drawPaymentMethods($inv); + + public function drawRemittenceStub() {} + public function drawCustom() {} + public function drawInvoiceDueNotice() {} + public function drawInvoicePaidNotice() {} + public function setLateFeeNotice() {} + + /** + * Get a blank invoice template + */ + public function getTemplate() { + return false; + } + + /** + * Assigns the invoice fields to this object. + */ + public function setInvoiceFields($flds) { + $this->invoice = $flds; + } + + /** + * Assigns the account fields to this object. + */ + public function setAccountFields($flds) { + $this->account = $flds; + } + + public function setItemsFull($items) { + $this->itemsFull = $items; + } + + public function setItemsPrevious($items) { + $this->itemsPrevious = $items; + } + + public function setDateRange($periodStart,$periodEnd) { + $this->dateRange = sprintf('%s - %s',date(UNIX_DATE_FORMAT,$periodStart),date(UNIX_DATE_FORMAT,$periodEnd)); + } + + public function setCurrency($currency) { + $this->invoiceCurrency = $currency; + } + + public function setDecimals($decimals) { + $this->invoiceDecimals = $decimals; + } + + /** + * Render an amount into a currency display + */ + protected function _currency($num) { + global $C_list; + + if ($this->invoiceDecimals>3) + return $this->invoiceCurrency.number_format($num,$this->invoiceDecimals); + else + return $C_list->format_currency_num($num,$this->invoice['actual_billed_currency_id']); + } + + /** + * Add a watermark to the PDF + */ + public function addWaterMark($text) { + $this->SetFont('helvetica','B',50); + $this->SetTextColor(203,203,203); + $this->Rotate(0); + $this->Text(10,50,$text); + $this->Rotate(0); + $this->SetTextColor(0,0,0); + } +} +?> diff --git a/modules/invoice/invoice_construct.xml b/modules/invoice/invoice_construct.xml index 3634b321..24bca908 100644 --- a/modules/invoice/invoice_construct.xml +++ b/modules/invoice/invoice_construct.xml @@ -1,182 +1,304 @@ - - invoice - - invoice
    - - - - 0 - - date_orig - - 25 - - - date_orig - date_last - parent_id - billing_status - process_status - suspend_billing - refund_status - account_id - affiliate_id - campaign_id - reseller_id - total_amt - due_date - checkout_plugin_id - tax_id - - - - - I4 - 1 - 1 - - - I4 - 1 - - - I8 - date-time - - - I8 - date-now - - - I4 - - - L - - - L - - - L - - - L - - - L - - - L - - - I8 - account - first_name,last_name - - - I4 - - - C(32) - - - I4 - - - L - - - C(32) - - - I4 - - - C(255) - array - - - I4 - - - F - - - C(255) - array - - - F - - - F - - - F - - - F - - - I4 - - - F - - - I4 - - - I4 - - - I4 - - - I8 - date-time - - - I4 - - - I8 - date-time - - - X - - - X - - - L - - - I8 - - - I4 - - - C(32) - - - - - id,site_id,date_orig,date_last,type,process_status,billing_status,suspend_billing,print_status,account_id,account_billing_id,affiliate_id,campaign_id,reseller_id,checkout_plugin_id,checkout_plugin_data,tax_id,tax_amt,discount_arr,discount_amt,total_amt,billed_amt,billed_currency_id,actual_billed_amt,actual_billed_currency_id,notice_count,notice_max,notice_next_date,grace_period,due_date - id,site_id,date_orig,date_last,type,process_status,billing_status,suspend_billing,print_status,account_id,account_billing_id,affiliate_id,campaign_id,reseller_id,checkout_plugin_id,checkout_plugin_data,tax_id,tax_amt,discount_arr,discount_amt,total_amt,billed_amt,billed_currency_id,actual_billed_amt,actual_billed_currency_id,notice_count,notice_max,notice_next_date,grace_period,due_date,net_term_date_last,net_term_id,net_term_intervals - id,site_id,date_orig,date_last,type,process_status,billing_status,suspend_billing,print_status,account_id,account_billing_id,affiliate_id,campaign_id,reseller_id,checkout_plugin_id,checkout_plugin_data,tax_id,tax_amt,discount_arr,discount_amt,total_amt,billed_amt,billed_currency_id,actual_billed_amt,actual_billed_currency_id,notice_count,notice_max,notice_next_date,grace_period,due_date - id,site_id,date_orig,date_last,type,process_status,billing_status,suspend_billing,print_status,account_id,account_billing_id,affiliate_id,campaign_id,reseller_id,checkout_plugin_id,checkout_plugin_data,tax_id,tax_amt,discount_arr,discount_amt,total_amt,billed_amt,billed_currency_id,actual_billed_amt,actual_billed_currency_id,notice_count,notice_max,notice_next_date,grace_period,due_date,net_term_date_last,net_term_id,net_term_intervals,ip - id,site_id,date_orig,date_last,type,process_status,billing_status,suspend_billing,print_status,account_id,account_billing_id,affiliate_id,campaign_id,reseller_id,checkout_plugin_id,checkout_plugin_data,tax_id,tax_amt,discount_arr,discount_amt,total_amt,billed_amt,billed_currency_id,actual_billed_amt,actual_billed_currency_id,notice_count,notice_max,notice_next_date,grace_period,due_date,net_term_date_last,net_term_id,net_term_intervals,ip - id,date_orig,date_last,process_status,billing_status,suspend_billing,print_status,account_id,account_billing_id,affiliate_id,campaign_id,reseller_id,checkout_plugin_id,tax_id,tax_amt,discount_amt,total_amt,billed_amt,billed_currency_id,actual_billed_amt,actual_billed_currency_id,notice_count,notice_max,notice_next_date,grace_period,due_date,net_term_date_last,net_term_id,net_term_intervals - id,date_orig,date_last,process_status,billing_status,suspend_billing,print_status,account_id,account_billing_id,affiliate_id,campaign_id,reseller_id,checkout_plugin_id,tax_id,tax_amt,discount_amt,total_amt,billed_amt,billed_currency_id,actual_billed_amt,actual_billed_currency_id,notice_count,notice_max,notice_next_date,grace_period,due_date,net_term_date_last,net_term_id,net_term_intervals - id,date_orig,date_last,process_status,billing_status,suspend_billing,print_status,account_id,account_billing_id,affiliate_id,campaign_id,reseller_id,checkout_plugin_id,tax_id,tax_amt,discount_amt,total_amt,billed_amt,billed_currency_id,actual_billed_amt,actual_billed_currency_id,notice_count,notice_max,notice_next_date,grace_period,due_date,net_term_date_last,net_term_id,net_term_intervals - id,date_orig,date_last,process_status,billing_status,suspend_billing,print_status,account_id,account_billing_id,affiliate_id,campaign_id,reseller_id,checkout_plugin_id,tax_id,tax_amt,discount_amt,total_amt,billed_amt,billed_currency_id,actual_billed_amt,actual_billed_currency_id,notice_count,notice_max,notice_next_date,grace_period,due_date,net_term_date_last,net_term_id,net_term_intervals - id,date_orig,date_last,process_status,billing_status,suspend_billing,print_status,account_id,account_billing_id,affiliate_id,campaign_id,reseller_id,checkout_plugin_id,tax_id,tax_amt,discount_amt,total_amt,billed_amt,billed_currency_id,actual_billed_amt,actual_billed_currency_id,notice_count,notice_max,notice_next_date,grace_period,due_date,net_term_date_last,net_term_id,net_term_intervals - - - 0 + + invoice + + invoice
    + + + + 0 + + date_orig + + 25 + + 1 + + + + date_orig + date_last + parent_id + billing_status + process_status + suspend_billing + refund_status + account_id + affiliate_id + campaign_id + reseller_id + total_amt + due_date + checkout_plugin_id + tax_id + net_term_id + + + + + + + Invoice + 1 + I4 + 1 + + + + 1 + I4 + + + + date-now + Invoice Date + I8 + + + + date-now + Date Updated + I8 + + + + Active + L + + + + I4 + + + + L + + + + L + + + + Invoice Status + L + + + + Refund Status + L + + + + L + + + + L + + + + I8 + account + first_name,last_name + + + + I4 + + + + C(32) + + + + I4 + + + + L + + + + C(32) + + + + I4 + + + + C(255) + array + + + + Taxes + I4 + + + + Total Taxes + F + + + + C(255) + array + + + + Total Discounts + F + + + + F + + + + Amount + F + + + + Amount Paid + F + + + + I4 + + + + F + + + + I4 + + + + I4 + + + + I4 + + + + I8 + date-time + + + + I4 + + + + Date Due + I8 + date-time + + + + X + + + + X + + + + L + + + + I8 + + + + I4 + + + + C(32) + + + + + + id,site_id,date_orig,date_last,type,process_status,billing_status,suspend_billing,print_status,account_id,account_billing_id,affiliate_id,campaign_id,reseller_id,checkout_plugin_id,checkout_plugin_data,tax_id,tax_amt,discount_arr,discount_amt,total_amt,billed_amt,billed_currency_id,actual_billed_amt,actual_billed_currency_id,notice_count,notice_max,notice_next_date,grace_period,due_date + id,site_id,date_orig,date_last,type,process_status,billing_status,suspend_billing,print_status,account_id,account_billing_id,affiliate_id,campaign_id,reseller_id,checkout_plugin_id,checkout_plugin_data,tax_id,tax_amt,discount_arr,discount_amt,total_amt,billed_amt,billed_currency_id,actual_billed_amt,actual_billed_currency_id,notice_count,notice_max,notice_next_date,grace_period,due_date,net_term_date_last,net_term_id,net_term_intervals + id,site_id,date_orig,date_last,type,process_status,billing_status,suspend_billing,print_status,account_id,account_billing_id,affiliate_id,campaign_id,reseller_id,checkout_plugin_id,checkout_plugin_data,tax_id,tax_amt,discount_arr,discount_amt,total_amt,billed_amt,billed_currency_id,actual_billed_amt,actual_billed_currency_id,notice_count,notice_max,notice_next_date,grace_period,due_date + id,site_id,date_orig,date_last,type,process_status,billing_status,suspend_billing,print_status,account_id,account_billing_id,affiliate_id,campaign_id,reseller_id,checkout_plugin_id,checkout_plugin_data,tax_id,tax_amt,discount_arr,discount_amt,total_amt,billed_amt,billed_currency_id,actual_billed_amt,actual_billed_currency_id,notice_count,notice_max,notice_next_date,grace_period,due_date,net_term_date_last,net_term_id,net_term_intervals,ip + id,site_id,date_orig,date_last,type,process_status,billing_status,suspend_billing,print_status,account_id,account_billing_id,affiliate_id,campaign_id,reseller_id,checkout_plugin_id,checkout_plugin_data,tax_id,tax_amt,discount_arr,discount_amt,total_amt,billed_amt,billed_currency_id,actual_billed_amt,actual_billed_currency_id,notice_count,notice_max,notice_next_date,grace_period,due_date,net_term_date_last,net_term_id,net_term_intervals,ip + id,date_orig,date_last,process_status,billing_status,suspend_billing,print_status,account_id,account_billing_id,affiliate_id,campaign_id,reseller_id,checkout_plugin_id,tax_id,tax_amt,discount_amt,total_amt,billed_amt,billed_currency_id,actual_billed_amt,actual_billed_currency_id,notice_count,notice_max,notice_next_date,grace_period,due_date,net_term_date_last,net_term_id,net_term_intervals + id,date_orig,date_last,process_status,billing_status,suspend_billing,print_status,account_id,account_billing_id,affiliate_id,campaign_id,reseller_id,checkout_plugin_id,tax_id,tax_amt,discount_amt,total_amt,billed_amt,billed_currency_id,actual_billed_amt,actual_billed_currency_id,notice_count,notice_max,notice_next_date,grace_period,due_date,net_term_date_last,net_term_id,net_term_intervals + id,date_orig,date_last,process_status,billing_status,suspend_billing,print_status,account_id,account_billing_id,affiliate_id,campaign_id,reseller_id,checkout_plugin_id,tax_id,tax_amt,discount_amt,total_amt,billed_amt,billed_currency_id,actual_billed_amt,actual_billed_currency_id,notice_count,notice_max,notice_next_date,grace_period,due_date,net_term_date_last,net_term_id,net_term_intervals + id,date_orig,date_last,process_status,billing_status,suspend_billing,print_status,account_id,account_billing_id,affiliate_id,campaign_id,reseller_id,checkout_plugin_id,tax_id,tax_amt,discount_amt,total_amt,billed_amt,billed_currency_id,actual_billed_amt,actual_billed_currency_id,notice_count,notice_max,notice_next_date,grace_period,due_date,net_term_date_last,net_term_id,net_term_intervals + id,date_orig,date_last,process_status,billing_status,suspend_billing,print_status,account_id,account_billing_id,affiliate_id,campaign_id,reseller_id,checkout_plugin_id,tax_id,tax_amt,discount_amt,total_amt,billed_amt,billed_currency_id,actual_billed_amt,actual_billed_currency_id,notice_count,notice_max,notice_next_date,grace_period,due_date,net_term_date_last,net_term_id,net_term_intervals + + + + + + + + <user_view>Invoice</user_view> + + + + + + + id + checkbox + 25px + + + id + + + account_id + + + date_orig + date + + + due_date + date + + + total_amt + currency + + + 120px + + + + + + id + checkbox + 25px + + + id + + + date_orig + date + + + total_amt + currency + + + 60px + + +
    diff --git a/modules/invoice/invoice_fpdf.inc.php b/modules/invoice/invoice_fpdf.inc.php deleted file mode 100644 index 82af25b7..00000000 --- a/modules/invoice/invoice_fpdf.inc.php +++ /dev/null @@ -1,393 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -require_once(PATH_INCLUDES.'pdf/fpdf.php'); -define('EURO', chr(128) ); -define('EURO_VAL', 6.55957 ); - -class INVOICE_FPDF extends FPDF -{ - // private variables - var $colonnes; - var $format; - var $angle=0; - - // private functions - function RoundedRect($x, $y, $w, $h, $r, $style = '') - { - $k = $this->k; - $hp = $this->h; - if($style=='F') - $op='f'; - elseif($style=='FD' or $style=='DF') - $op='B'; - else - $op='S'; - $MyArc = 4/3 * (sqrt(2) - 1); - $this->_out(sprintf('%.2f %.2f m',($x+$r)*$k,($hp-$y)*$k )); - $xc = $x+$w-$r ; - $yc = $y+$r; - $this->_out(sprintf('%.2f %.2f l', $xc*$k,($hp-$y)*$k )); - - $this->_Arc($xc + $r*$MyArc, $yc - $r, $xc + $r, $yc - $r*$MyArc, $xc + $r, $yc); - $xc = $x+$w-$r ; - $yc = $y+$h-$r; - $this->_out(sprintf('%.2f %.2f l',($x+$w)*$k,($hp-$yc)*$k)); - $this->_Arc($xc + $r, $yc + $r*$MyArc, $xc + $r*$MyArc, $yc + $r, $xc, $yc + $r); - $xc = $x+$r ; - $yc = $y+$h-$r; - $this->_out(sprintf('%.2f %.2f l',$xc*$k,($hp-($y+$h))*$k)); - $this->_Arc($xc - $r*$MyArc, $yc + $r, $xc - $r, $yc + $r*$MyArc, $xc - $r, $yc); - $xc = $x+$r ; - $yc = $y+$r; - $this->_out(sprintf('%.2f %.2f l',($x)*$k,($hp-$yc)*$k )); - $this->_Arc($xc - $r, $yc - $r*$MyArc, $xc - $r*$MyArc, $yc - $r, $xc, $yc - $r); - $this->_out($op); - } - - function _Arc($x1, $y1, $x2, $y2, $x3, $y3) - { - $h = $this->h; - $this->_out(sprintf('%.2f %.2f %.2f %.2f %.2f %.2f c ', $x1*$this->k, ($h-$y1)*$this->k, - $x2*$this->k, ($h-$y2)*$this->k, $x3*$this->k, ($h-$y3)*$this->k)); - } - - function Rotate($angle,$x=-1,$y=-1) - { - if($x==-1) - $x=$this->x; - if($y==-1) - $y=$this->y; - if($this->angle!=0) - $this->_out('Q'); - $this->angle=$angle; - if($angle!=0) - { - $angle*=M_PI/180; - $c=cos($angle); - $s=sin($angle); - $cx=$x*$this->k; - $cy=($this->h-$y)*$this->k; - $this->_out(sprintf('q %.5f %.5f %.5f %.5f %.2f %.2f cm 1 0 0 1 %.2f %.2f cm',$c,$s,-$s,$c,$cx,$cy,-$cx,-$cy)); - } - } - - function _endpage() - { - if($this->angle!=0) - { - $this->angle=0; - $this->_out('Q'); - } - parent::_endpage(); - } - - // public functions - function sizeOfText( $texte, $largeur ) - { - $index = 0; - $nb_lines = 0; - $loop = TRUE; - while ( $loop ) - { - $pos = strpos($texte, "\n"); - if (!$pos) - { - $loop = FALSE; - $ligne = $texte; - } - else - { - $ligne = substr( $texte, $index, $pos); - $texte = substr( $texte, $pos+1 ); - } - $length = floor( $this->GetStringWidth( $ligne ) ); - //$res = 1 + floor( $length / $largeur) ; - $nb_lines += $res; - } - return $nb_lines; - } - - // Company - function addCompany( $nom, $adresse ) - { - $this->Image(PATH_THEMES.'default/images/invoice_logo.jpg',11,8,50); - $x1 = 10; - $y1 = 20; - $this->SetXY( $x1, $y1 ); - $this->SetFont('Arial','B',12); - $length = $this->GetStringWidth( $nom ); - $this->Cell( $length, 2, $nom); - $this->SetXY( $x1, $y1 + 4 ); - $this->SetFont('Arial','',10); - $length = $this->GetStringWidth( $adresse ); - $lignes = $this->sizeOfText( $adresse, $length) ; - $this->MultiCell($length, 4, $adresse); - } - - function addDate( $date ) - { - global $C_translate; - - $r1 = $this->w - 40; - $r2 = $r1 + 30; - $y1 = 8; - $y2 = $y1 ; - $mid = $y1 + ($y2 / 2); - $this->RoundedRect($r1, $y1, ($r2 - $r1), $y2, 3.5, 'D'); - $this->Line( $r1, $mid, $r2, $mid); - $this->SetXY( $r1 + ($r2-$r1)/2 - 5, $y1 ); - $this->SetFont( "Helvetica", "B", 10); - $this->Cell(10,5, $C_translate->translate('pdf_date','invoice',''), 0, 0, "C"); - $this->SetXY( $r1 + ($r2-$r1)/2 - 5, $y1+4 ); - $this->SetFont( "Helvetica", "", 10); - $this->Cell(10,5,$date, 0,0, "C"); - } - - function addPageNumber( $page ) - { - global $C_translate; - - $r1 = $this->w - 59; - $r2 = $r1 + 19; - $y1 = 8; - $y2 = $y1; - $mid = $y1 + ($y2 / 2); - $this->RoundedRect($r1, $y1, ($r2 - $r1), $y2, 3.5, 'D'); - $this->Line( $r1, $mid, $r2, $mid); - $this->SetXY( $r1 + ($r2-$r1)/2 - 5, $y1 ); - $this->SetFont( "Helvetica", "B", 10); - $this->Cell(10,5, $C_translate->translate('pdf_page','invoice',''), 0, 0, "C"); - $this->SetXY( $r1 + ($r2-$r1)/2 - 5, $y1+4 ); - $this->SetFont( "Helvetica", "", 10); - $this->Cell(10,5,$page, 0,0, "C"); - } - - // Client address - function addClient( $adresse ) - { - $r1 = 140; - $r2 = $r1 + 68; - $y1 = 35; - $this->SetXY( $r1, $y1); - $this->MultiCell( 60, 4, $adresse); - } - - // Invoice number - function addInvoiceNo($id) - { - global $C_translate; - - $r1 = 10; - $r2 = $r1 + 60; - $y1 = 65; - $y2 = $y1+10; - $mid = $y1 + (($y2-$y1) / 2); - $this->RoundedRect($r1, $y1, ($r2 - $r1), ($y2-$y1), 2.5, 'D'); - $this->Line( $r1, $mid, $r2, $mid); - $this->SetXY( $r1 + ($r2-$r1)/2 - 20 , $y1+1 ); - $this->SetFont( "Helvetica", "B", 10); - $this->Cell(40, 4, $C_translate->translate('pdf_invoice_number','invoice',''), 0, 0, "C"); - $this->SetFont( "Helvetica", "", 10); - $this->SetXY( $r1 + 9 , $y1+5 ); - $this->Cell(40, 5, $id, '', '', "C"); - } - - // Payment Status - function addStatus( $mode ) - { - global $C_translate; - - $r1 = 75; - $r2 = $r1 + 60; - $y1 = 65; - $y2 = $y1+10; - $mid = $y1 + (($y2-$y1) / 2); - $this->RoundedRect($r1, $y1, ($r2 - $r1), ($y2-$y1), 2.5, 'D'); - $this->Line( $r1, $mid, $r2, $mid); - $this->SetXY( $r1 + ($r2-$r1)/2 -5 , $y1+1 ); - $this->SetFont( "Helvetica", "B", 10); - $this->Cell(10,4, $C_translate->translate('pdf_payment_status','invoice',''), 0, 0, "C"); - $this->SetXY( $r1 + ($r2-$r1)/2 -5 , $y1 + 5 ); - $this->SetFont( "Helvetica", "", 10); - $this->Cell(10,5,$mode, 0,0, "C"); - } - - // Due date - function addDueDate( $date ) - { - global $C_translate; - - $r1 = 140; - $r2 = $r1 + 60; - $y1 = 65; - $y2 = $y1+10; - $mid = $y1 + (($y2-$y1) / 2); - $this->RoundedRect($r1, $y1, ($r2 - $r1), ($y2-$y1), 2.5, 'D'); - $this->Line( $r1, $mid, $r2, $mid); - $this->SetXY( $r1 + ($r2 - $r1)/2 - 5 , $y1+1 ); - $this->SetFont( "Helvetica", "B", 10); - $this->Cell(10,4, $C_translate->translate('pdf_date_due','invoice',''), 0, 0, "C"); - $this->SetXY( $r1 + ($r2-$r1)/2 - 5 , $y1 + 5 ); - $this->SetFont( "Helvetica", "", 10); - $this->Cell(10,5,$date, 0,0, "C"); - } - - function addCols( $tab ) - { - global $colonnes; - - $r1 = 10; - $r2 = $this->w - ($r1 * 2) ; - $y1 = 80; - $y2 = $this->h - 50 - $y1; - $this->SetXY( $r1, $y1 ); - $this->Rect( $r1, $y1, $r2, $y2, "D"); - $this->Line( $r1, $y1+6, $r1+$r2, $y1+6); - $colX = $r1; - $colonnes = $tab; - while ( list( $lib, $pos ) = each ($tab) ) - { - $this->SetXY( $colX, $y1+2 ); - $this->Cell( $pos, 1, $lib, 0, 0, "C"); - $colX += $pos; - $this->Line( $colX, $y1, $colX, $y1+$y2); - } - } - - function addLineFormat( $tab ) - { - global $format, $colonnes; - - while ( list( $lib, $pos ) = each ($colonnes) ) - { - if ( isset( $tab["$lib"] ) ) - $format[ $lib ] = $tab["$lib"]; - } - } - - function lineVert( $tab ) - { - global $colonnes; - - reset( $colonnes ); - $maxSize=0; - while ( list( $lib, $pos ) = each ($colonnes) ) - { - $texte = $tab[ $lib ]; - $longCell = $pos -2; - $size = $this->sizeOfText( $texte, $longCell ); - if ($size > $maxSize) - $maxSize = $size; - } - return $maxSize; - } - - function addLine( $ligne, $tab ) - { - global $colonnes, $format; - - $ordonnee = 10; - $maxSize = $ligne; - - reset( $colonnes ); - while ( list( $lib, $pos ) = each ($colonnes) ) - { - $longCell = $pos -2; - $texte = $tab[ $lib ]; - $length = $this->GetStringWidth( $texte ); - $tailleTexte = $this->sizeOfText( $texte, $length ); - $formText = $format[ $lib ]; - $this->SetXY( $ordonnee, $ligne-1); - $this->MultiCell( $longCell, 4 , $texte, 0, $formText); - if ( $maxSize < ($this->GetY() ) ) - $maxSize = $this->GetY() ; - $ordonnee += $pos; - } - return ( $maxSize - $ligne ); - } - - function addTotals($a, $b, $a_total, $a_paid, $a_due, $b_total, $b_paid, $b_due, $a_disc, $b_disc) - { - global $C_translate; - - $r1 = $this->w - 102; - $r2 = $r1 + 92; - $y1 = $this->h - 45; - $y2 = $y1+25; - $this->RoundedRect($r1, $y1, ($r2 - $r1), ($y2-$y1), 2.5, 'D'); - $this->Line( $r1+20, $y1, $r1+20, $y2); // avant EUROS - $this->Line( $r1+20, $y1+4, $r2, $y1+4); // Sous Euros & Francs - $this->Line( $r1+55, $y1, $r1+55, $y2); // Entre Euros & Francs - $this->SetFont( "Arial", "B", 8); - $this->SetXY( $r1+30, $y1 ); - $this->Cell(15,4, $a, 0, 0, "C"); - $this->SetFont( "Arial", "", 8); - $this->SetXY( $r1+65, $y1 ); - $this->Cell(15,4, $b, 0, 0, "C"); - $this->SetFont( "Arial", "B", 6); - - $this->SetXY( $r1, $y1+5 ); - $this->Cell(20,4, $C_translate->translate('pdf_discounts','invoice',''), 0, 0, "C"); - $this->SetXY( $r1, $y1+10 ); - $this->Cell(20,4, $C_translate->translate('pdf_total','invoice',''), 0, 0, "C"); - $this->SetXY( $r1, $y1+15 ); - $this->Cell(20,4, $C_translate->translate('pdf_paid','invoice',''), 0, 0, "C"); - $this->SetXY( $r1, $y1+20 ); - $this->Cell(20,4, $C_translate->translate('pdf_due','invoice',''), 0, 0, "C"); - - $re = $this->w - 65; - $rf = $this->w - 28; - $y1 = $this->h - 40; - - // A total - $this->SetFont( "Arial", "", 8); - $this->SetXY( $re, $y1+0 ); - $this->Cell( 17,4, $a_disc, '', '', 'R'); - $this->SetXY( $re, $y1+5 ); - $this->Cell( 17,4, $a_total, '', '', 'R'); - $this->SetXY( $re, $y1+10 ); - $this->Cell( 17,4, $a_paid, '', '', 'R'); - $this->SetXY( $re, $y1+15 ); - $this->Cell( 17,4, $a_due, '', '', 'R'); - $this->SetXY( $rf, $y1+5 ); - - // B Total - if(!empty($b)) { - $this->Cell( 17,4, $b_total, '', '', 'R'); - $this->SetXY( $rf, $y1+10 ); - $this->Cell( 17,4, $b_paid, '', '', 'R'); - $this->SetXY( $rf, $y1+14.8 ); - $this->Cell( 17,4, $b_due, '', '', 'R'); - } - } - - // watermark - function addWatermark( $text ) - { - $this->SetFont('Arial','B',50); - $this->SetTextColor(203,203,203); - $this->Rotate(0); - $this->Text(10,50,$text); - $this->Rotate(0); - $this->SetTextColor(0,0,0); - } -} -?> \ No newline at end of file diff --git a/modules/invoice/invoice_install.xml b/modules/invoice/invoice_install.xml index b538d418..85be723b 100644 --- a/modules/invoice/invoice_install.xml +++ b/modules/invoice/invoice_install.xml @@ -1,65 +1,99 @@ + + - invoice - invoice - + + + + Invoices + 1 + + invoice + + + + invoice + + + + base - - - - add - 1 - - - update - - - delete - - - view - - 1 - - - search - - 1 - - - search_form - - - search_show - - - resend - - - search_export - - - approveinvoice - - - voidinvoice - - - performance - - - refund - - - reconcile - - - autobill - - - generatedomaininvoice - - - - \ No newline at end of file + + + + + Add + 1 + add + + + + delete + + + + List + 1 + search + + + + + Search + 1 + search_form + + + + search_show + + + + update + + + + view + + + + Upcoming Invoices + 1 + Invoice Soon + + + resend + + + search_export + + + approveinvoice + + + voidinvoice + + + performance + + + refund + + + reconcile + + + autobill + + + generatedomaininvoice + + + generateinvoice + + + generateinvoice_account + + + diff --git a/modules/invoice/receipt_print.php b/modules/invoice/receipt_print.php index bb13b33a..e565188e 100644 --- a/modules/invoice/receipt_print.php +++ b/modules/invoice/receipt_print.php @@ -77,8 +77,8 @@ class receipt_print extends FPDF // draw the logo function drawCompanyLogo() { $width = 50; - if(is_file(PATH_THEMES.'default/images/invoice_logo.jpg')) - $this->Image(PATH_THEMES.'default/images/invoice_logo.jpg',0,0,$width); + if(is_file(PATH_THEMES.'default/images/logo-invoice.png')) + $this->Image(PATH_THEMES.'default/images/logo-invoice.png',0,0,$width); } // draw the company address @@ -90,4 +90,4 @@ class receipt_print extends FPDF $this->SetXY(0,40); $this->Cell(50,10, SITE_CITY. ", ". SITE_STATE . " " . SITE_ZIP); } } -?> \ No newline at end of file +?> diff --git a/modules/invoice_item/invoice_item.inc.php b/modules/invoice_item/invoice_item.inc.php index cba6deb1..6869a66d 100644 --- a/modules/invoice_item/invoice_item.inc.php +++ b/modules/invoice_item/invoice_item.inc.php @@ -1,126 +1,33 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Module:Invoice */ - -class invoice_item -{ - - # Open the constructor for this mod - function invoice_item() - { - # name of this module: - $this->module = "invoice_item"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } +/** + * The main AgileBill Invoice Item Class + * + * @package AgileBill + * @subpackage Module:Invoice + */ +class invoice_item extends OSB_module { } -?> \ No newline at end of file +?> diff --git a/modules/invoice_item/invoice_item_construct.xml b/modules/invoice_item/invoice_item_construct.xml index 2fc978f6..b27ff4ab 100644 --- a/modules/invoice_item/invoice_item_construct.xml +++ b/modules/invoice_item/invoice_item_construct.xml @@ -1,130 +1,133 @@ - - invoice_item - - invoice_item
    - - invoice - - 0 - - sku - - 25 - - - parent_id - invoice_id,site_id - product_id - account_id - service_id,site_id - service_id,invoice_id - sku - domain_name,domain_tld - date_orig - site_id,charge_id - - - - - I8 - 1 - 1 - - - I4 - 1 - - - I8 - - - I8 - - - I8 - - - I8 - - - I8 - - - I8 - - - I8 - - - C(128) - - - I4 - - - L - - - X2 - array - - - X2 - - - C(128) - - - F - - - F - - - F - - - L - - - F - - - F - - - I4 - - - C(128) - - - C(16) - - - I4 - - - C(16) - - - I8 - - - I8 - - - - - id,site_id,date_orig,invoice_id,product_id,sku,quantity,item_type,product_attr,product_attr_cart,price_base,price_setup,recurring_schedule,domain_name,domain_tld,domain_term,domain_type,invoice_item_parent_id - id,site_id,date_orig,invoice_id,product_id,sku,quantity,item_type,product_attr,product_attr_cart,price_base,price_setup,recurring_schedule,domain_name,domain_tld,domain_term,domain_type,invoice_item_parent_id - id,site_id,date_orig,invoice_id,product_id,sku,quantity,item_type,product_attr,product_attr_cart,price_base,price_setup,recurring_schedule,domain_name,domain_tld,domain_term,domain_type,invoice_item_parent_id - id,site_id,date_orig,invoice_id,product_id,sku,quantity,item_type,product_attr,product_attr_cart,price_base,price_setup,recurring_schedule,domain_name,domain_tld,domain_term,domain_type,invoice_item_parent_id - id,site_id,date_orig,invoice_id,product_id,sku,quantity,item_type,product_attr,product_attr_cart,price_base,price_setup,recurring_schedule,domain_name,domain_tld,domain_term,domain_type,invoice_item_parent_id - - - 0 + + invoice_item + + invoice_item
    + + invoice + + 0 + + sku + + 25 + + + parent_id + invoice_id,site_id + product_id + account_id + service_id,site_id + service_id,invoice_id + sku + domain_name,domain_tld + date_orig + site_id,charge_id + + + + + I8 + 1 + 1 + + + I4 + 1 + + + I8 + + + I8 + + + I8 + + + I8 + + + I8 + + + I8 + + + I8 + + + C(128) + + + I4 + + + + L + + + X2 + array + + + X2 + + + C(128) + + + F + + + F + + + F + + + + L + + + F + + + F + + + + I4 + + + C(128) + + + C(16) + + + I4 + + + C(16) + + + I8 + + + I8 + + + + + id,site_id,date_orig,invoice_id,product_id,sku,quantity,item_type,product_attr,product_attr_cart,price_base,price_setup,recurring_schedule,domain_name,domain_tld,domain_term,domain_type,invoice_item_parent_id + id,site_id,date_orig,invoice_id,product_id,sku,quantity,item_type,product_attr,product_attr_cart,price_base,price_setup,recurring_schedule,domain_name,domain_tld,domain_term,domain_type,invoice_item_parent_id + id,site_id,date_orig,invoice_id,product_id,sku,quantity,item_type,product_attr,product_attr_cart,price_base,price_setup,recurring_schedule,domain_name,domain_tld,domain_term,domain_type,invoice_item_parent_id + id,site_id,date_orig,invoice_id,product_id,sku,quantity,item_type,product_attr,product_attr_cart,price_base,price_setup,recurring_schedule,domain_name,domain_tld,domain_term,domain_type,invoice_item_parent_id + id,site_id,date_orig,invoice_id,product_id,sku,quantity,item_type,product_attr,product_attr_cart,price_base,price_setup,recurring_schedule,domain_name,domain_tld,domain_term,domain_type,invoice_item_parent_id + + + 0
    diff --git a/modules/invoice_memo/invoice_memo.inc.php b/modules/invoice_memo/invoice_memo.inc.php index e3e32144..aa844b61 100644 --- a/modules/invoice_memo/invoice_memo.inc.php +++ b/modules/invoice_memo/invoice_memo.inc.php @@ -1,126 +1,33 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Module:Invoice */ - -class invoice_memo -{ - - # Open the constructor for this mod - function invoice_memo() - { - # name of this module: - $this->module = "invoice_memo"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } +/** + * The main AgileBill Invoice Memo Class + * + * @package AgileBill + * @subpackage Module:Invoice + */ +class invoice_memo extends OSB_module { } -?> \ No newline at end of file +?> diff --git a/modules/invoice_memo/invoice_memo_construct.xml b/modules/invoice_memo/invoice_memo_construct.xml index 5fa4eab3..70bc8a1b 100644 --- a/modules/invoice_memo/invoice_memo_construct.xml +++ b/modules/invoice_memo/invoice_memo_construct.xml @@ -1,63 +1,100 @@ - - invoice_memo - - invoice_memo
    - - invoice - - 0 - - date_orig - - 25 - - - invoice_id - memo - - - - - I8 - - - I4 - - - I8 - date-time - date-now - - - C(32) - - - I8 - account - username - - - C(32) - any - - - C(255) - any - - - C(32) - - - - - id,site_id,date_orig,invoice_id,account_id,type,memo - id,site_id,date_orig,invoice_id,account_id,type,memo - id,site_id,date_orig,invoice_id,account_id,type,memo - id,site_id,date_orig,invoice_id,account_id,type,memo - id,site_id,date_orig,invoice_id,account_id,type,memo - - - 0 + + invoice_memo + + invoice_memo
    + + invoice + + 0 + + date_orig + + 25 + + + + invoice_id + memo + + + + + <add>Add Invoice Memo</add> + <view>Invoice Memo</view> + + + + + + I8 + + + I4 + + + Date + I8 + date-time + date-now + + + Invoice + C(32) + + + Account + I8 + account + username + + + Type + C(32) + any + + + Memo + C(255) + any + + + C(32) + + + + + + date_orig,invoice_id,account_id,type,memo + id,site_id,date_orig,invoice_id,account_id,type,memo + id,site_id,date_orig,invoice_id,account_id,type,memo + id,site_id,date_orig,invoice_id,account_id,type,memo + id,site_id,date_orig,invoice_id,account_id,type,memo + + + + 0 + + + + + + id + 25px + + + date_orig + + + account_id + + + type + + + memo + + +
    diff --git a/modules/invoice_memo/invoice_memo_install.xml b/modules/invoice_memo/invoice_memo_install.xml index ad6cacaf..7eb63e1c 100644 --- a/modules/invoice_memo/invoice_memo_install.xml +++ b/modules/invoice_memo/invoice_memo_install.xml @@ -2,9 +2,10 @@ invoice_memo invoice - + invoice + @@ -32,4 +33,4 @@ - \ No newline at end of file + diff --git a/modules/log_error/log_error.inc.php b/modules/log_error/log_error.inc.php index af7fea0c..f6fd54f6 100644 --- a/modules/log_error/log_error.inc.php +++ b/modules/log_error/log_error.inc.php @@ -1,167 +1,33 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Module:Log */ - -class log_error -{ - - # Open the constructor for this mod - function log_error() - { - # name of this module: - $this->module = "log_error"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - ############################## - ## GRAPH STATISTICS ## - ############################## - function graph($start, $end, $constraint, $default) - { - global $C_translate; - - $db = &DB(); - $sql = 'SELECT date_orig FROM ' . AGILE_DB_PREFIX . 'log_error WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - date_orig >= ' . $db->qstr($start) . ' AND - date_orig <= ' . $db->qstr($end); - - $result = $db->Execute($sql); - - if($result->RecordCount() == 0) - { - $arr['title'] = $C_translate->translate('search_no_results','',''); - $arr['results'] = $default; - return $arr; - } - - $ii=0; - while(!$result->EOF) - { - $d = $result->fields['date_orig']; - for($i=0; $i= $constraint[$i]["start"] && $d < $constraint[$i]["end"]) - $default[$i]++; - $ii++; - } - $result->MoveNext(); - } - - $C_translate->value['log_error']['count'] = $result->RecordCount(); - $title = $C_translate->translate('statistics','log_error',''); - $arr['title'] = $title; - $arr['results'] = $default; - return $arr; - } - - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } +/** + * The main AgileBill Log Error Class + * + * @package AgileBill + * @subpackage Module:Log + */ +class log_error extends OSB_module { } -?> \ No newline at end of file +?> diff --git a/modules/log_error/log_error_construct.xml b/modules/log_error/log_error_construct.xml index 2b93c970..3b11f65f 100644 --- a/modules/log_error/log_error_construct.xml +++ b/modules/log_error/log_error_construct.xml @@ -1,55 +1,101 @@ - - log_error - - log_error
    - - - - 0 - - date_orig - - 25 - - - - I8 - 1 - 1 - - - I4 - 1 - - - I8 - date - - - I8 - account - username - - - C(64) - - - C(64) - - - X2 - - - - - id,site_id,date_orig,account_id,module,method,message - id,site_id,date_orig,account_id,module,method,message - id,site_id,date_orig,account_id,module,method,message - id,site_id,date_orig,account_id,module,method,message - id,site_id,date_orig,account_id,module,method,message - - - 0 + + log_error + + log_error
    + + + + 0 + + date_orig + + 25 + + 0 + + + + + + + + + + 1 + I8 + 1 + + + + 1 + I4 + + + + date-now + Date Created + I8 + + + Account + I8 + account + username + + + Module + C(64) + + + Method + C(64) + + + Message + X2 + + + + + + id,site_id,date_orig,account_id,module,method,message + id,site_id,date_orig,account_id,module,method,message + id,site_id,date_orig,account_id,module,method,message + id,site_id,date_orig,account_id,module,method,message + id,site_id,date_orig,account_id,module,method,message + + + + + + + + <search_form>Search</search_form> + + + + + + + id + checkbox + 25px + + + date_orig + date + 15% + + + message + 45% + + + module + 40% + + +
    diff --git a/modules/log_error/log_error_install.xml b/modules/log_error/log_error_install.xml index ff50dd6e..14c91633 100644 --- a/modules/log_error/log_error_install.xml +++ b/modules/log_error/log_error_install.xml @@ -1,37 +1,55 @@ + + - log_error - setup - + + + + Error Log + 1 + + log_error + + + + setup + + + + base - - - - search - - - 1 - - - view - - - 1 - - - delete - - - update - - - search_form - - - search_show - - - - - \ No newline at end of file + + + + + delete + + + + List + 1 + search + + + + + Search + 1 + search_form + + + + search_show + + + + update + + + + view + + + + diff --git a/modules/login_log/login_log.inc.php b/modules/login_log/login_log.inc.php index 490f69db..7b2f4888 100644 --- a/modules/login_log/login_log.inc.php +++ b/modules/login_log/login_log.inc.php @@ -1,169 +1,33 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Module:Log */ - -class login_log -{ - - # Open the constructor for this mod - function login_log() - { - # name of this module: - $this->module = "login_log"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - - ############################## - ## GRAPH STATISTICS ## - ############################## - function graph($start, $end, $constraint, $default) - { - global $C_translate; - - - $db = &DB(); - $sql = 'SELECT date_orig FROM ' . AGILE_DB_PREFIX . 'login_log WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - date_orig >= ' . $db->qstr($start) . ' AND - date_orig <= ' . $db->qstr($end); - - $result = $db->Execute($sql); - if($result->RecordCount() == 0) - { - $arr['title'] = $C_translate->translate('search_no_results','',''); - $arr['results'] = $default; - return $arr; - } - $ii=0; - while(!$result->EOF) - { - $d = $result->fields['date_orig']; - for($i=0; $i= $constraint[$i]["start"] && $d < $constraint[$i]["end"]) - $default[$i]++; - $ii++; - } - $result->MoveNext(); - } - - $C_translate->value['login_log']['count'] = $result->RecordCount(); - $title = $C_translate->translate('statistics_login','login_log',''); - $arr['title'] = $title; - $arr['results'] = $default; - return $arr; - } - - - - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } +/** + * The main AgileBill Login Log Class + * + * @package AgileBill + * @subpackage Module:Log + */ +class login_log extends OSB_module { } -?> \ No newline at end of file +?> diff --git a/modules/login_log/login_log_construct.xml b/modules/login_log/login_log_construct.xml index 3317d443..20bafc86 100644 --- a/modules/login_log/login_log_construct.xml +++ b/modules/login_log/login_log_construct.xml @@ -1,56 +1,100 @@ - - login_log - - login_log
    - - - - 0 - - date_orig - - 25 - - - account_id - ip - - - - - I4 - 1 - - - I4 - 1 - - - I8 - date-now - - - I8 - account - username - - - L - - - C(32) - - - - - id,site_id,date_orig,account_id,status,ip - id,site_id,date_orig,account_id,status,ip - id,site_id,date_orig,account_id,status,ip - id,site_id,date_orig,account_id,status,ip - id,site_id,date_orig,account_id,status,ip - - - 0 + + login_log + + login_log
    + + + + 0 + + date_orig + + 25 + + 0 + + + + account_id + ip + + + + + + + 1 + I4 + 1 + + + + 1 + I4 + + + + date-now + Date Created + I8 + + + I8 + account + username + Account + + + L + Active + + + C(32) + IP Address + + + + + + id,site_id,date_orig,account_id,status,ip + id,site_id,date_orig,account_id,status,ip + id,site_id,date_orig,account_id,status,ip + id,site_id,date_orig,account_id,status,ip + id,site_id,date_orig,account_id,status,ip + + + + + + + + <search_form>Search</search_form> + + + + + + + id + checkbox + 25px + + + account_id + + + date_orig + date + + + ip + + + literal + 60px + + +
    diff --git a/modules/login_log/login_log_install.xml b/modules/login_log/login_log_install.xml index 7d6665de..bb237dda 100644 --- a/modules/login_log/login_log_install.xml +++ b/modules/login_log/login_log_install.xml @@ -1,32 +1,55 @@ + + - login_log - account_admin - + + + + Login Log + 1 + + login_log + + + + account + + + + base - - - - search - - - view - - 1 - - - delete - - - update - - - search_form - - - search_show - - - - \ No newline at end of file + + + + + delete + + + + List + 1 + search + + + + + Search + 1 + search_form + + + + search_show + + + + update + + + + view + + + + diff --git a/modules/module.inc.php b/modules/module.inc.php new file mode 100644 index 00000000..0936caab --- /dev/null +++ b/modules/module.inc.php @@ -0,0 +1,461 @@ +. + * + * Originally authored by Deon George + * + * @author Deon George + * @copyright 2009 Deon George + * @link http://osb.leenooks.net + * @license http://www.gnu.org/licenses/ + * @package AgileBill + * @subpackage Modules + */ + +/** + * Module Abstract Class + * This abstract class provides the basic variables and methods for all modules. + * + * @package AgileBill + * @subpackage Modules + */ +abstract class OSB_module { + # Validation error array + public $val_error = array(); + + /** + * Initialise the module + */ + public function __construct() { + $f = sprintf('%s%s/%s_construct.xml',PATH_MODULES,get_class($this),get_class($this)); + + if (is_file($f)) { + # Open the construct file for parsing + $C_xml = new CORE_xml; + $construct = $C_xml->xml_to_array($f); + + # Required attributes of the construct file. + foreach (array('module','table','field') as $index) { + if (! isset($construct['construct'][$index])) + printf('ERROR: Missing [%s] for [%s]',$index,$f); + else + $this->{$index} = $construct['construct'][$index]; + } + + # Optional attributes of the construct file. + foreach (array('method','trigger','cache','order_by','limit','title','tpl') as $index) + if (isset($construct['construct'][$index])) + $this->{$index} = $construct['construct'][$index]; + + # Bind our language translation path + bindtextdomain($this->module,PATH_LANGUAGE); + bind_textdomain_codeset($this->module,'UTF-8'); + } + } + + public function getlist() { + # Open the construct file for parsing + $C_xml = new CORE_xml; + + $dh = opendir(PATH_MODULES); + $modules = array(); + + while ($module=readdir($dh)) + if (! in_array($module,array('.','..')) && is_dir(PATH_MODULES.$module) && is_file($f=sprintf('%s/%s/%s_install.xml',PATH_MODULES,$module,$module))) { + + $install = $C_xml->xml_to_array($f); + + # Determine the type + if (! isset($install['install']['module_properties']['type'])) + $type = 'plugin'; + else + $type = $install['install']['module_properties']['type']; + + # Store the data + foreach (array('parent','name','notes','sub_modules','dependancy','type','table-only','method-only') as $index) + if (isset($install['install']['module_properties'][$index])) + $modules[$type][$module][$index] = $install['install']['module_properties'][$index]; + + } + + return $modules; + } + + /** + * Basic module helper when interacting with the database. + */ + private function database($type,$VAR,$method=null) { + if ($type) + $this->method[$type] = explode(',',$this->method[$type]); + + if (is_null($method) && $type) + $method = $type; + + $db = new CORE_database; + + if (method_exists($db,$method)) + return $db->$method($VAR,$this,$type); + + else { + global $C_debug; + + $C_debug->error(__FILE__,__METHOD__,sprintf('Method doesnt exist')); + } + } + + /** + * Export module helper + */ + private function export($type,$VAR,$method=null) { + # Require the export class + require_once(PATH_CORE.'export.inc.php'); + + $this->method[$type] = explode(',',$this->method[$type]); + + if (is_null($method) && $type) + $method = $type; + + $export = new CORE_export; + + if (method_exists($export,$method)) + $export->$method($VAR,$this,$type); + + else { + global $C_debug; + $C_debug->error(__FILE__,__METHOD__,sprintf('Method doesnt exist')); + } + } + + /** ADMIN INTERFACE METHODS **/ + + /** + * Add Records to the database + */ + public function add($VAR) { + if ($id = $this->database('add',$VAR)) + return $id; + + global $VAR; + + # If update fails, return to the add page. + if (isset($VAR['_page']) && $VAR['_page'] == sprintf('%s:%s',$this->module,'view')) + $VAR['_page'] = sprintf('%s:%s',$this->module,'add'); + + return false; + } + + /** + * Delete Records in the database + */ + public function delete($VAR) { + return $this->database('',$VAR,'mass_delete'); + } + + /** + * Search for Records in the database + */ + public function search($VAR) { + $this->database('search',$VAR); + } + + /** + * Export Records from the database + */ + public function search_export($VAR) { + switch ($VAR['format']) { + case 'csv': + $this->export('export_csv',$VAR,'search_csv'); + break; + + case 'excel': + $this->export('export_excel',$VAR,'search_excel'); + break; + + case 'pdf': + $this->export('export_pdf',$VAR,'pdf_invoice'); + break; + + case 'tab': + $this->export('export_tab',$VAR,'search_tab'); + break; + + case 'xml': + $this->export('export_xml',$VAR,'search_xml'); + break; + + default: + global $C_debug; + $C_debug->error(__FILE__,__METHOD__,sprintf('Export method doesnt exist')); + } + } + + /** + * Search for Records in the database + */ + public function search_form($VAR) { + $this->database('search',$VAR,'search_form'); + } + + /** + * Show the Records from a Search in the database + */ + public function search_show($VAR) { + return $this->database('search',$VAR,'search_show'); + } + + /** + * Update Records in the database + */ + public function update($VAR) { + return $this->database('update',$VAR); + } + + /** + * View a Record in the database + */ + public function view($VAR) { + #@todo implement showing the modified attributes if a update fails. + return $this->database('view',$VAR); + } + + /** USER INTERFACE METHODS **/ + + /** + * Add Records to the database + */ + public function user_add($VAR) { + return $this->database('user_add',$VAR,'add'); + } + + /** + * Search for Records in the database + */ + public function user_search($VAR) { + if (! SESS_LOGGED) return false; + + $VAR[$this->module.'_account_id'] = SESS_ACCOUNT; + $this->database('search',$VAR); + } + + /** + * Show the Records from a Search in the database + */ + public function user_search_show($VAR) { + if (! SESS_LOGGED) return false; + + $this->database('search',$VAR,'search_show'); + } + + /** + * Static Vars + */ + public function static_var($VAR) { + global $smarty; + + require_once(PATH_CORE.'static_var.inc.php'); + $static_var = new CORE_static_var; + + if (preg_match('/search/',$VAR['_page'])) + $arr = $static_var->generate_form($this->module,'add','search'); + else + $arr = $static_var->generate_form($this->module,'add','update'); + + if (gettype($arr) == 'array') { + # Set everything as a smarty array, and return + $smarty->assign('show_static_var',true); + $smarty->assign('static_var',$arr); + return true; + + } else { + # Or if no results + $smarty->assign('show_static_var',false); + return false; + } + } + + /** + * Render the results of a search + * + * This function can also be used to only render the headers, and the tpl file can be responsible for rendering the data + * + * If $args is null, we only render the header + */ + public function tpl_search_show($VAR,$object,$args) { + global $C_list; + + require_once(PATH_CORE.'translate.inc.php'); + $C_translate = new CORE_translate; + + list($class,$method) = explode(':',$VAR['_page']); + + if (! isset($this->tpl[$method])) + return; + + # If we are only rendering the headers, then skip the table definitions + if (! is_null($args)) { + echo '
    '; + echo ''; + } + + # Display the search heading + echo ''; + + foreach ($this->tpl[$method] as $index => $details) { + switch ($index) { + case 'blank': + case 'checkbox': + case 'icon': + case 'last': + printf('',isset($details['width']) ? sprintf(' style="width: %s;"',$details['width']) : ''); + break; + + default: + printf(''; + } + } + + echo ''; + + # Loop through each record + if (is_array($args) && count($args[0])) { + foreach ($args[0] as $key => $values) { + printf('', + $values['id'],$values['id'],$this->module,$values['id'],$values['id'],$values['id'],$values['_C'],$values['_C']); + + foreach ($this->tpl[$method] as $index => $details) { + switch ($details['type']) { + case 'bool': + printf('',$values[$details['field']] ? $C_translate->translate('true') : $C_translate->translate('false')); + + break; + + case 'bool_icon': + echo ''; + + break; + + case 'checkbox': + echo ''; + + break; + + case 'currency': + printf('',$C_list->format_currency($values[$details['field']],DEFAULT_CURRENCY)); + + break; + + case 'date': + printf('',date(UNIX_DATE_FORMAT,$values[$details['field']]),date(DEFAULT_TIME_FORMAT,$values[$details['field']])); + + break; + + case 'literal': + printf('',str_replace('%%id%%',$values['id'],$details['data'])); + + break; + + default: + printf('',$values[$details['field']]); + } + } + + echo ''; + } + } + + if (! is_null($args)) { + echo '
     ',isset($details['width']) ? sprintf(' style="width: %s;"',$details['width']) : ''); + printf('', + isset($details['translate']) ? $C_translate->translate($details['translate'],$this->module) : $C_translate->tf(array('module'=>$this->module,'field'=>$details['field']),null), + $details['field']); + echo '
    %s'; + + if ($values[$details['field']]) + printf('True',DEFAULT_THEME,isset($details['true']) ? $details['true'] : 'go_16.gif'); + else + printf('False',DEFAULT_THEME,isset($details['false']) ? $details['false'] : 'stop_16.gif'); + + echo ''; + printf('', + $values['id'],$values['id'],$values['id'],$values['id'],$values['_C']); + printf('',$values['id'],$values['_C'],$values['id']); + echo '%s%s %s%s %s
    '; + echo '
    '; + } + } + + /** + * Get a record from the table by ID + */ + protected function getID($id) { + $db = &DB(); + $record = $db->Execute(sqlSelect($db,$this->table,'*',array('id'=>$id))); + + if ($record && $record->RecordCount() == 1) + return $record->fields; + else + return array(); + } + + /** + * Get a record from the table by Name + */ + protected function getName($name) { + $db = &DB(); + $record = $db->Execute(sqlSelect($db,$this->table,'*',array('name'=>$name))); + + if ($record && $record->RecordCount() == 1) + return $record->fields; + else + return array(); + } + + /** + * Graph Statistics + */ + public function graph($start,$end,$constraint,$default) { + global $C_translate; + + $db = &DB(); + $result = $db->Execute(sqlSelect($db,$this->table,sprintf('date_orig>=%s AND date_orig<=',$start,$end))); + + if ($result->RecordCount() == 0) { + $arr['title'] = $C_translate->translate('search_no_results','',''); + $arr['results'] = $default; + + return $arr; + } + + while (! $result->EOF) { + $d = $result->fields['date_orig']; + + for ($i=0; $i= $constraint[$i]['start'] && $d < $constraint[$i]['end']) + $default[$i]++; + } + + $result->MoveNext(); + } + + $C_translate->value[$this->table]['count'] = $result->RecordCount(); + $title = $C_translate->translate('statistics',$this->table,''); + $arr['title'] = $title; + $arr['results'] = $default; + + return $arr; + } +} +?> diff --git a/modules/module/module.inc.php b/modules/module/module.inc.php index fb090dd2..88a9ae54 100644 --- a/modules/module/module.inc.php +++ b/modules/module/module.inc.php @@ -1,101 +1,554 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Modules:Module */ - -class module -{ - # Open the constructor for this mod - function module() - { - # name of this module: - $this->module = "module"; +/** + * The main AgileBill Module Class + * + * @package AgileBill + * @subpackage Modules:Module + */ +class module extends OSB_module { + /** + * Initialise the module + */ + public function __construct() { + parent::__construct(); - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - - # core modules for installation/deletion: - $this->core_mods= Array( 'account', - 'account_admin', - 'account_group', - 'backup', - 'blocked_email', - 'blocked_ip', - 'country', - 'currency', - 'email_template', - 'email_template_translate', - 'group', - 'group_method', - 'login_lock', - 'login_log', - 'log_error', - 'module', - 'module_method', - 'newsletter', - 'newsletter_subscriber', - 'session', - 'session_auth_inc', - 'setup', - 'setup_email', - 'staff', - 'staff_department', - 'static_relation', - 'static_var', - 'static_var_record', - 'task', - 'temporary_data' ); - - - $this->dev_inst_excl = Array( 'module', - 'module_method', - 'group_method', - 'backup', - 'login_log', - 'session', - 'weblog', - 'temporary_data', - 'setup', - 'session_auth_cache'); + $this->dev_inst_excl = array( + 'staff','staff_department', + 'blocked_email','blocked_ip', + 'module','module_method', + 'setup_email','email_template','email_template_translate', + 'group_method', + 'backup', + 'login_log', + 'session', + 'weblog', + 'temporary_data', + 'setup', + 'session_auth_cache' + ); } + /** MODULE INSTALLATION **/ - ### Send php/mysql/server/license details and check versions - function remote_version_check($VAR) { + /** + * Main module installer + * + * This function will install a module. + * @uses CORE_xml + */ + public function install($VAR) { + global $smarty,$C_translate; + + static $list = array(); + if (! $list) + $list = $this->getlist(); + + $module = trim($VAR['install_name']); + $nodata = isset($VAR['no-data']) ? $VAR['no-data'] : false; + $type = isset($VAR['type']) ? $VAR['type'] : false; + $installed = false; + + # If module is installed, we'll just return + $db = &DB(); + $result = $db->Execute(sqlSelect($db,'module','name',array('name'=>$module))); + if ($result && $result->RecordCount() > 0) + $installed = true; + + # Check this module for any errors + if ($installed || $this->install_error_check($VAR)) { + + printf('- Module [%s] install check passed(%s).
    ',$module,$nodata); + + $error = array(); + $arr_s = array(); + $arr_sub = ''; + + # See if this module has any defined sub_modules + if ($type && isset($list[$type][$module]['sub_modules'])) + $arr_sub .= $list[$type][$module]['sub_modules']; + + # See if this module has any defined sub_modules as a result of being a parent. + if ($type && isset($list[$type][$module]['modules']) && count($list[$type][$module]['modules'])) + $arr_sub .= implode(',',array_keys($list[$type][$module]['modules'])); + + # Get sub_modules of this package + if ($arr_sub) { + if (preg_match('/,/',$arr_sub)) + $arr_s = explode(',',$arr_sub); + else + array_push($arr_s,$arr_sub); + + printf('- Module [%s] has sub modules [%s] (%s).
    ',$module,implode('|',$arr_s),$nodata); + + foreach ($arr_s as $submodule) { + $result = $db->Execute(sqlSelect($db,'module','name',array('name'=>$submodule))); + $installed = false; + if ($result && $result->RecordCount() > 0) + $installed = true; + + if (! $installed && ! $this->install_error_check(array( + 'install_name'=>$submodule, + 'module_group'=>$VAR['module_group'], + 'no-data'=>isset($VAR['no-data']) ? $VAR['no-data'] : false, + 'no-class'=>isset($VAR['no-class']) ? $VAR['no-class'] : false + ))) + array_push($error,$C_translate->translate('install_sub_module_err','module','sub_module='.$submodule)); + } + } + + # Check for error + if (count($error)) { + array_push($error,$C_translate->translate('install_failed','module','')); + + # Set the errors as a Smarty Object + if ($smarty) + $smarty->assign('form_validation',$error); + + return false; + } + + # Install the SQL + printf('- Module [%s] install SQL.
    ',$module); + if ($this->install_sql($module,$nodata)) { + # Loop through the sub-modules and install each of them + for ($i=0; $iinstall_sql($arr_s[$i],$nodata)) + return false; + + # Insert default data + if (! $nodata) + $this->install_sql_data($arr_s[$i]); + } + + } else + return false; + + if ($nodata) + return true; + + printf('- Module [%s] install DATA.
    ',$module); + # Insert default data + $this->install_sql_data($module); + + } else { + #printf('- Module [%s] failed install check.
    ',$module); + return false; + } + + # Update the current user's authentication so the update group access applies to them global $C_auth; - if(!$C_auth->auth_method_by_name("module","upgrade")) return false; + if ($C_auth) + $C_auth->auth_update(); + + return true; + } + + /** + * Module installation checking + */ + public function install_error_check($VAR) { + global $smarty, $C_translate; + + # Core modules just install the database, so we'll return OK here. + if (isset($VAR['type']) && $VAR['type'] == 'core') + return true; + + $error = array(); + $module = isset($VAR['install_name']) ? trim($VAR['install_name']) : ''; + + # Check that the module name is defined + if (! trim($module)) + array_push($error,$C_translate->translate('install_enter_name','module','')); + + # Check that at least one group is defined: + if (! isset($VAR['module_group'])) + array_push($error,$C_translate->translate('install_select_group','module','')); + + # Check if the module already exists in the Database + $db = &DB(); + + $result = $db->Execute(sqlSelect($db,'module','name',array('name'=>$module))); + if ($result && $result->RecordCount() > 0) + array_push($error,$C_translate->translate('install_module_exists','module','')); + + $xml_construct = sprintf('%s%s/%s_install.xml',PATH_MODULES,$module,$module); + + # Check if the module exists in the file structure: + if (! is_dir(sprintf('%s%s',PATH_MODULES,$module))) + array_push($error,$C_translate->translate('install_missing_dir','module','')); + + if (! file_exists(sprintf('%s%s/%s.inc.php',PATH_MODULES,$module,$module)) && (! isset($VAR['no-class']) || ! $VAR['no-class'])) + array_push($error,$C_translate->translate('install_missing_class','module','')); + + if (! file_exists($xml_construct)) + array_push($error,$C_translate->translate('install_missing_construct','module','')); + + if (! file_exists(sprintf('%s%s/%s_install.xml',PATH_MODULES,$module,$module))) + array_push($error,$C_translate->translate('install_missing_install','module','')); + + if (count($error)) { + array_push($error,$C_translate->translate('install_failed','module','')); + + # Set the errors as a Smarty Object + if ($smarty) + $smarty->assign('form_validation',$error); + + #printf('Problem with: %s',$module); + #echo '
    ';print_r($error);
    +			return false;
    +		}
    +
    +		# Load the install XML file...
    +		$C_xml = new CORE_xml;
    +		$install = $C_xml->xml_to_array($xml_construct);
    +		$this->install = $install;
    +
    +		# Get the module properties:
    +		$name = $install['install']['module_properties']['name'];
    +
    +		if (isset($install['install']['module_properties']['parent']) && $install['install']['module_properties']['parent'] != $module)
    +			$parent = $install['install']['module_properties']['parent'];
    +		else
    +			$parent = '';
    +
    +		# Get dependancies
    +		if (isset($install['install']['module_properties']['dependancy']))
    +			$dependancy = sprintf('%s,%s',$parent,$install['install']['module_properties']['dependancy']);
    +		else
    +			$dependancy = $parent;
    +
    +		if ($dependancy) {
    +			if (preg_match('/,/', $dependancy))
    +				$depend = explode(',',$dependancy);
    +			else
    +				$depend = array($dependancy);
    +
    +			# Check to be sure the dependancies are installed:
    +			for ($i=0; $i < count($depend); $i++) {
    +				$result = $db->Execute(sqlSelect($db,'module','name',array('name'=>$depend[$i],'status'=>1)));
    +
    +				if (! $result || ($result && ! $result->RecordCount()))
    +					array_push($error,sprintf(_('Module %s depends on %s, which is not installed?'),$module,$depend[$i]));
    +			}
    +		}
    +
    +		# check for error:
    +		if (count($error)) {
    +			array_push($error,$C_translate->translate('install_failed','module',''));
    +
    +			# Set the errors as a Smarty Object
    +			if ($smarty)
    +				$smarty->assign('form_validation',$error);
    +			else {
    +				printf('Problem with: %s',$module);
    +				echo '
    ';print_r($error);
    +			}
    +
    +			return false;
    +		}
    +
    +		return true;
    +	}
    +
    +	/**
    +	 * Module SQL Install
    +	 */
    +	public function install_sql($module,$nodata=false) {
    +		global $VAR,$smarty;
    +
    +		#printf('Installing Step 1: %s...
    ',$module); + + # Load the install XML file + $C_xml = new CORE_xml; + $xml = sprintf('%s%s/%s_install.xml',PATH_MODULES,$module,$module); + if (! is_file($xml)) + return false; + + $install = $C_xml->xml_to_array($xml); + + # Load the construct XML file + $C_xml = new CORE_xml; + $xml = sprintf('%s%s/%s_construct.xml',PATH_MODULES,$module,$module); + if (! is_file($xml)) + return false; + $construct = $C_xml->xml_to_array($xml); + + $db = &DB(); + $t = $db->MetaTables(); + + # Check that this Module has any db installation required + if (isset($construct['construct']['table']) && ! in_array(AGILE_DB_PREFIX.$construct['construct']['table'],$t)) { + # Create the module DB table + $table = $construct['construct']['table']; + + # Create the module DB fields + $arr_field = $construct['construct']['field']; + + # Loop through the fields to build the list: + $index_flds = ''; + while (list($key,$value) = each($arr_field)) { + $field = $key; + $t_s = $arr_field[$key]['type']; + + if (isset($arr_field[$key]['index'])) { + if (empty($index_flds)) + $index_flds .= $key; + else + $index_flds .= ','.$key; + } + + if (preg_match('/[(]/',$t_s)) { + $ts = explode('(',$t_s); + $type = $ts[0]; + $size = preg_replace('/[)]/','',$ts[1]); + $flds[] = array($field,$type,$size); + + } else { + $flds[] = array($field,$t_s); + } + } + + # Multi site? + if (DEFAULT_SITE==1) { + # Create the table & colums using the ADODB Data Dictionary functions + $dict = NewDataDictionary($db); + + $table_options = array('mysql' => 'TYPE=MyISAM'); + $sqlarray = $dict->CreateTableSQL(AGILE_DB_PREFIX.$table,$flds,$table_options); + $result = $db->Execute($sqlarray[0]); + + if ($result === false) { + global $C_debug; + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg().' '.print_r($sqlarray[0],true)); + + echo $db->ErrorMsg(); + + return false; + } + + # Create unique index on site_id,id (mysql specific) + $db->Execute(sprintf('CREATE UNIQUE INDEX IDS on %s%s (site_id,id)',AGILE_DB_PREFIX,$table)); + + # Create any custom indexes + if (isset($construct['construct']['index']) && count($construct['construct']['index'])) { + $new_indexes = $construct['construct']['index']; + while (list($index,$fields) = each($new_indexes)) { + $dict = NewDataDictionary($db); + + if (preg_match('/fulltext/',$index) && AGILE_DB_TYPE == 'mysql') + $sqlarray = $dict->CreateIndexSQL($index,AGILE_DB_PREFIX.$table,$fields,array('FULLTEXT')); + else + $sqlarray = $dict->CreateIndexSQL($index,AGILE_DB_PREFIX.$table,$fields); + + $db->Execute($sqlarray[0]); + } + } + } + } + + if ($nodata) + return true; + + #printf('Installing Step 2: %s...
    ',$module); + + # Get the module properties: + $menu_display = isset($install['install']['module_properties']['menu_display']) ? $install['install']['module_properties']['menu_display'] : ''; + $notes = isset($install['install']['module_properties']['notes']) ? $install['install']['module_properties']['notes'] : ''; + + # Get the parent module... + $db = &DB(); + $module_id = $db->GenID(AGILE_DB_PREFIX.'module_id'); + + if (isset($install['install']['module_properties']['parent'])) { + $result = $db->Execute(sqlSelect($db,'module','id',array('name'=>$install['install']['module_properties']['parent']))); + + # Error checking + if ($result === false) { + global $C_debug; + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); + + return false; + } + + if (! trim($result->fields['id'])) + $parent_id = $module_id; + else + $parent_id = $result->fields['id']; + + } else { + $parent_id = $module_id; + } + + /* Create the module record, & get the module ID + * get the ID of the parent, and create it as child if needed... + * else the record is a child of itself... */ + + $result = $db->Execute(sqlInsert($db,'module',array( + 'name'=>$module, + 'parent_id'=>$parent_id, + 'notes'=>$notes, + 'status'=>1, + 'menu_display'=>$menu_display, + 'date_orig'=>time(), + 'date_last'=>time()),$module_id) + ); + + #printf('Installing Step 3: %s...
    ',$module); + + # Create the module_method records, and get the ID for each one + if (isset($install['install']['module_method'])) + $methods = $install['install']['module_method']; + else + $methods = $install['install']['sql_inserts']['module_method']; + + if (! empty($methods) && is_array($methods)) { + while (list($key,$value) = each($methods)) { + $name = $key; + $method_id = $db->GenID(AGILE_DB_PREFIX.'module_method_id'); + $notes = isset($methods[$key]['notes']) ? $methods[$key]['notes'] : ''; + $page = isset($methods[$key]['page']) ? $methods[$key]['page'] : ''; + $menu_display = isset($methods[$key]['menu_display']) ? 1 : 0; + + $result = $db->Execute(sqlInsert($db,'module_method',array( + 'name'=>$name, + 'module_id'=>$module_id, + 'notes'=>$notes, + 'page'=>$page, + 'menu_display'=>$menu_display + ),$method_id)); + + # Error checking + if ($result === false) { + global $C_debug; + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); + + return false; + } + + #printf('Installing Step 4: %s:%s...
    ',$module,$name); + + /* Create the group_method records, with the ID from each + * of the above methods... + * Get the groups to add to (FROM THE install.tpl form!) */ + for ($i=0; $iExecute(sqlInsert($db,'group_method',array('method_id'=>$method_id,'module_id'=>$module_id,'group_id'=>$VAR['module_group'][$i]))); + + # Error checking + if ($result === false) { + global $C_debug; + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); + + return false; + } + } + } + } + + printf('Finished %s...
    ',$module); + + # All done! + return true; + } + + /** + * Install Default Data + */ + public function install_sql_data($module) { + # Check the file + $f = sprintf('%s%s/%s_install_data.xml',PATH_MODULES,$module,$module); + + if (is_file($f)) { + # open the XML backup file: + $C_xml = new CORE_xml; + $backup = $C_xml->xml_to_array($f); + + $db = &DB(); + $arr = $backup['install']; + + # Loop through each table in this array + if (is_array($arr)) { + while (list($table,$records) = each($arr)) { + $runsql = false; + $sqls = sprintf('INSERT INTO %s%s SET ',AGILE_DB_PREFIX,$table); + + if (is_array($records)) { + $sql = ''; + $sqlcount = 0; + + # Loop through each of the fields for this module + while (list($fld,$val) = each($records)) { + if (is_array($val)) { + $sql = ''; + $sqlcount = 0; + + # Loop through each of the fields for this module + while (list($fld2,$val2) = each($val)) { + if ($sqlcount != 0) + $sql .= ', '; + + $sql .= $fld2 .' = '.$db->qstr($val2); + $sqlcount++; + } + + $result = $db->Execute(sprintf('%s %s',$sqls,$sql)); + + } else { + if ($sqlcount != 0) + $sql .= ', '; + + $sql .= sprintf('%s = %s',$fld,$db->qstr($val)); + $sqlcount++; + $runsql = true; + } + + } + + if ($runsql) { + $result = $db->Execute(sprintf('%s %s',$sqls,$sql)); + + if ($result === false) + @$this->error .= sprintf('
    %s %s',$sqls,$sql); + } + } + } + } + } + } + + /** + * Check Version + */ + public function remote_version_check($VAR) { + global $C_auth; + if (! $C_auth->auth_method_by_name('module','upgrade')) + return false; if(is_file(PATH_AGILE.'Version.txt')) - $f['version']=trim(file_get_contents(PATH_AGILE.'Version.txt')); + $f['version']=trim(file_get_contents(PATH_AGILE.'VERSION')); else $f['version']='SVN'; @@ -105,37 +558,39 @@ class module $f['os']=$_ENV['OS']; $f['proc']=$_ENV['PROCESSOR_ARCHITECTURE']; $f['arch']=$_ENV['PROCESSOR_ARCHITEW6432']; - $f['server']=$_SERVER["SERVER_SOFTWARE"]; + $f['server']=$_SERVER["SERVER_SOFTWARE"]; global $smarty; $smarty->assign('send', $f); - } + } + + /** OLD FUNCTIONS **/ ### Get remote hash file and check for inconsitancys in local files function remote_update($VAR) { - $ver = $VAR['ver']; + $ver = $VAR['ver']; $mis=0; $md5=0; $i=0; $msg = ''; - # Get the core modules & compare + # Get the core modules & compare if(defined('DEMO_VERSION')) $url_core = 'http://agileco.com/downloads/trial/'.$ver.'.hash.txt'; - else + else $url_core = 'http://agileco.com/downloads/commercial/'.$ver.'.hash.txt'; @$data = file_get_contents($url_core); if(empty($data)) { $msg .= 'Failed to retrieve MD5 Hash file at http://agileco.com/downloads/commercial/'.$ver.'.hash.txt...
    '; - } else { - $arr = explode("|",$data); + } else { + $arr = explode("|",$data); foreach($arr as $arx) { $rx = explode(',',$arx); @$ar['name'] = $rx[1]; - @$ar['md5'] = $rx[0]; - if(!empty($ar['name']) && !empty($ar['md5']) && + @$ar['md5'] = $rx[0]; + if(!empty($ar['name']) && !empty($ar['md5']) && !ereg("^install/", $ar['name']) && !ereg("^test.php", $ar['name'])) { @@ -143,31 +598,31 @@ class module { $core_mis[] = $ar["name"]; $mis++; - } + } elseif(md5_file(PATH_AGILE.$ar["name"]) != $ar["md5"]) - { + { $core_md5[] = $ar["name"]; $md5++; } } $i++; - } - $smart[] = Array ('name' => 'Core', 'md5' => @$core_md5, 'mis' => @$core_mis ); + } + $smart[] = array ('name' => 'Core', 'md5' => @$core_md5, 'mis' => @$core_mis ); } - ### Get each optional module && compare + ### Get each optional module && compare if(!defined('DEMO_VERSION')) - { - @$modules = $VAR["module"]; + { + @$modules = $VAR["module"]; foreach($modules as $module) { $data = ''; @$data = file_get_contents('http://agileco.com/downloads/commercial/'.$module.'.hash.txt'); if(empty($data)) { $msg .= 'Failed to retrieve MD5 Hash file at http://agileco.com/downloads/commercial/'.$module.'.hash.txt...
    '; - } else { - $arr = explode("|",$data); + } else { + $arr = explode("|",$data); foreach($arr as $arx) { $rx = explode(',',$arx); @@ -175,15 +630,15 @@ class module @$ar['md5'] = $rx[0]; # check if file exists locally... - if(!empty($ar['name']) && !empty($ar['md5']) ) + if(!empty($ar['name']) && !empty($ar['md5']) ) { if(!is_file(PATH_AGILE.$ar["name"])) { $f_mis[] = $ar["name"]; $mis++; - } + } elseif(md5_file(PATH_AGILE.$ar["name"]) != $ar["md5"]) - { + { $f_md5[] = $ar["name"]; $md5++; } @@ -191,15 +646,15 @@ class module $i++; } - $smart[] = Array ('name' => $module, 'md5' => @$f_md5, 'mis' => @$f_mis ); + $smart[] = array ('name' => $module, 'md5' => @$f_md5, 'mis' => @$f_mis ); unset($f_mis); unset($f_md5); - } + } } - } + } global $smarty; - $smarty->assign('modules', $smart); + $smarty->assign('modules', $smart); $smarty->assign('md5', $md5); $smarty->assign('mis', $mis); @@ -207,7 +662,7 @@ class module global $C_debug; $C_debug->alert($msg); } - } + } @@ -263,7 +718,7 @@ class module fclose($file); } } - } + } ############################## @@ -298,44 +753,10 @@ class module } - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - ############################## ## DELETE ## ############################## - function delete($VAR) - { + function delete($VAR) { # set the core modules: $core = $this->core_mods; @@ -344,26 +765,22 @@ class module elseif (isset($VAR["id"])) $id = explode(',',$VAR["id"]); - for($i=0; $ixml_to_array($xml_construct); + $construct = $C_xml->xml_to_array($xml_construct); ### Check that this Module has any db installation required... - if(isset($construct["construct"]["table"])) + if(DEFAULT_SITE==1 && isset($construct["construct"]["table"])) { ### Create the module DB table $table = $construct["construct"]["table"]; @@ -423,620 +839,18 @@ class module $sql = $dict->DropTableSQL(AGILE_DB_PREFIX.''.$table); $db->Execute($sql[0]); } - } + } } - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); } - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } - - - - ################################### - ## INSTALL ERROR CHECKING: MODULE ## - ################################### - function install_error_check($VAR) - { - global $smarty, $C_translate; - - ########################################### - ### Check that the module name is defined: - if(!isset($VAR["install_name"])) - { - $error[] = $C_translate->translate('install_enter_name','module',''); - } - else if ($VAR["install_name"] == '') - { - $error[] = $C_translate->translate('install_enter_name','module',''); - } - $module = trim($VAR["install_name"]); - - - ########################################### - ### Check that at least one group is defined: - if(!isset($VAR["module_group"])) - $error[] = $C_translate->translate('install_select_group','module',''); - - - ########################################### - ### Check if the module already exists in the Database: - $db = &DB(); - $q = 'SELECT name FROM '.AGILE_DB_PREFIX.'module WHERE - name = '.$db->qstr($module).' AND - site_id = '.$db->qstr(DEFAULT_SITE); - $result = $db->Execute($q); - if($result->RecordCount() > 0) - $error[] = $C_translate->translate('install_module_exists','module',''); - - ####################################################### - ### Check if the module exists in the file structure: - if (!is_dir(PATH_MODULES . '' . $module)) - $error[] = $C_translate->translate('install_missing_dir','module',''); - - if (!file_exists(PATH_MODULES . '' . $module . '/' . $module . '.inc.php')) - $error[] = $C_translate->translate('install_missing_class','module',''); - - if (!file_exists(PATH_MODULES . '' . $module . '/' . $module . '_construct.xml')) - $error[] = $C_translate->translate('install_missing_construct','module',''); - - if (!file_exists(PATH_MODULES . '' . $module . '/' . $module . '_install.xml')) - $error[] = $C_translate->translate('install_missing_install','module',''); - - if(isset($error)) - { - $error[] = $C_translate->translate('install_failed','module',''); - - # set the errors as a Smarty Object - $smarty->assign('form_validation', $error); - return false; - } - - - ########################################### - ### Load the install XML file... - $xml_construct = PATH_MODULES . "" . $module . "/" . $module . "_install.xml"; - $C_xml = new CORE_xml; - $install = $C_xml->xml_to_array($xml_construct); - $this->install = $install; - - /* - echo "
    ";
    -		print_r($install);
    -		echo "
    "; - */ - - ########################################### - ### Get the module properties: - $name = $install["install"]["module_properties"]["name"]; - - if(isset($install["install"]["module_properties"]["parent"])) - $parent = $install["install"]["module_properties"]["parent"]; - else - $parent = 0; - - - ############################################ - ### Get dependancies.... - if(isset($install["install"]["module_properties"]["dependancy"])) - $dependancy = $install["install"]["module_properties"]["dependancy"]; - else - $dependancy = false; - - if($dependancy) - { - if(ereg(',', $dependancy)) - $depend = explode(',', $dependancy); - else - $depend[0] = $dependancy; - - ################################################### - ### Check to be sure the dependancies are installed: - - for($i=0; $i < count($depend); $i++) - { - $db = &DB(); - $q = 'SELECT name FROM '.AGILE_DB_PREFIX.'module WHERE - name = '.$db->qstr($depend["$i"]).' AND - status = '.$db->qstr("1").' AND - site_id = '.$db->qstr(DEFAULT_SITE); - $result = $db->Execute($q); - if($result->RecordCount() == 0) - $error[] = $C_translate->translate('install_module_depend','module','depend='.$depend["$i"]); - } - } - - # check for error: - if(isset($error)) - { - $error[] = $C_translate->translate('install_failed','module',''); - - # set the errors as a Smarty Object - $smarty->assign('form_validation', $error); - return false; - } - - return true; - } - - - - ##################################### - ## INSTALL ERROR CHECKING: MODULE ## - ##################################### - function install_error_check_sub($module) - { - global $smarty; - - if ($module == '') - { - return true; - } - - ######################################################## - ### Check if the module already exists in the Database: - $db = &DB(); - $q = 'SELECT name FROM '.AGILE_DB_PREFIX.'module WHERE - name = '.$db->qstr($module).' AND - site_id = '.$db->qstr(DEFAULT_SITE); - $result = $db->Execute($q); - if($result->RecordCount() > 0) - $error[] = 'This module already exists in the database!'; - - ###################################################### - ### Check if the module exists in the file structure: - if (!is_dir(PATH_MODULES . '' . $module)) - $error[] = 'The specified module directory does not exist!'; - - if (!file_exists(PATH_MODULES . '' . $module . '/' . $module . '.inc.php')) - $error[] = 'The specified module class file does not exist!'; - - if (!file_exists(PATH_MODULES . '' . $module . '/' . $module . '_construct.xml')) - $error[] = 'The specified module construct file does not exist!'; - - if (!file_exists(PATH_MODULES . '' . $module . '/' . $module . '_install.xml')) - $error[] = 'The specified module installation file does not exist!'; - - if(isset($error)) - { - $error[] = 'Module Installation Failed'; - - # set the errors as a Smarty Object - $smarty->assign('form_validation', $error); - return false; - } - - return true; - } - - - ################################### - ## INSTALL ERROR CHECKING ## - ################################### - function install_sql($module) - { - global $VAR, $smarty; - - ########################################### - ### Load the install XML file... - $C_xml = new CORE_xml; - $xml_install = PATH_MODULES . "" . $module . "/" . $module . "_install.xml"; - $install = $C_xml->xml_to_array($xml_install); - - ########################################### - ### Load the construct XML file... - $C_xml = new CORE_xml; - $xml_construct = PATH_MODULES . "" . $module . "/" . $module . "_construct.xml"; - $construct = $C_xml->xml_to_array($xml_construct); - - ### Check that this Module has any db installation required... - if(isset($construct["construct"]["table"])) - { - ### Create the module DB table - $table = $construct["construct"]["table"]; - - ### Create the module DB fields - $arr_field = $construct["construct"]["field"]; - - ### Loop through the fields to build the list: - #$index_flds = 'id,site_id'; - $index_flds = ''; - while (list ($key, $value) = each($arr_field)) - { - $field = $key; - $t_s = $arr_field["$key"]["type"]; - if(isset($arr_field["$key"]["index"])) - { - if(empty($index_flds)) - $index_flds .= $key; - else - $index_flds .= ','.$key; - } - - if(ereg('[(]',$t_s)) - { - $ts = explode('(',$t_s); - $type = $ts[0]; - $size = ereg_replace('[)]', '', $ts[1]); - $flds[] = Array($field, $type, $size); - } - else - { - $flds[] = Array($field, $t_s); - } - } - - ### Multi site? - if(DEFAULT_SITE==1) - { - ### Create the table & colums using the ADODB Data Dictionary functions: - $db = &DB(); - $dict = NewDataDictionary($db); - $table_options = array('mysql' => 'TYPE=MyISAM'); - $sqlarray = $dict->CreateTableSQL(AGILE_DB_PREFIX.''.$table, $flds, $table_options); - $result = $db->Execute($sqlarray[0]); - if ($result === false) - { - global $C_debug; - $C_debug->error('module.inc.php','install_db (1)', $db->ErrorMsg() . ' '. print_r($sqlarray[0])); - return false; - } - - # Create unique index on site_id,id (mysql specific) - $db->Execute("CREATE UNIQUE INDEX IDS on ".AGILE_DB_PREFIX."$table (site_id, id)"); - - # Create any custom indexes - if(@$new_indexes = $construct["construct"]["index"]) - { - while (list ($index, $fields) = each($new_indexes)) - { - $dict = NewDataDictionary($db); - if(eregi("fulltext", $index) && AGILE_DB_TYPE == 'mysql') - $sqlarray = $dict->CreateIndexSQL($index, AGILE_DB_PREFIX.$table, $fields, array('FULLTEXT')); - else - $sqlarray = $dict->CreateIndexSQL($index, AGILE_DB_PREFIX.$table, $fields); - $db->Execute($sqlarray[0]); - } - } - } - } - - - - ################################################################## - ### Get the module properties: - - if(isset($install["install"]["module_properties"]["menu_display"])) - $menu_display = $install["install"]["module_properties"]["menu_display"]; - else - $menu_display = ''; - - if(isset($install["install"]["module_properties"]["notes"])) - $notes = $install["install"]["module_properties"]["notes"]; - else - $notes = ''; - - ################################################################### - ### Get the parent module... - - $db = &DB(); - $module_id = $db->GenID(AGILE_DB_PREFIX . "" . 'module_id'); - if(isset($install["install"]["module_properties"]["parent"])) - { - $q = 'SELECT id FROM '.AGILE_DB_PREFIX.'module WHERE - site_id = '.$db->qstr(DEFAULT_SITE).' AND - name = '.$db->qstr($install["install"]["module_properties"]["parent"]); - $result = $db->Execute($q); - - - - # Error checking - if ($result === false) - { - global $C_debug; - $C_debug->error('module.inc.php','install_db', $db->ErrorMsg()); - return false; - } - - if($result->fields["id"] == '') - $parent_id = $module_id; - else - $parent_id = $result->fields["id"]; - - } - else - { - $parent_id = $module_id; - } - - - - ################################################################## - ### Create the module record, & get the module ID - ### get the ID of the parent, and create it as child if needed... - ### else the record is a child of itself... - - $q = 'INSERT INTO '.AGILE_DB_PREFIX.'module SET - id = ' .$db->qstr($module_id).', - site_id = ' .$db->qstr(DEFAULT_SITE).', - name = ' .$db->qstr($module).', - parent_id = ' .$db->qstr($parent_id).', - notes = ' .$db->qstr($notes).', - status = ' .$db->qstr('1').', - menu_display = '.$db->qstr($menu_display); - $result = $db->Execute($q); - - ################################################################### - ### Create the module_method records, and get the ID for each one - - @$methods = $install["install"]["sql_inserts"]["module_method"]; - - if(!empty($methods) && is_array($methods)) - { - while (list ($key, $value) = each($methods)) - { - - $name = $key; - $method_id = $db->GenID(AGILE_DB_PREFIX.'module_method_id'); - - if(isset($methods[$key]["notes"])) - $notes = $methods[$key]["notes"]; - else - $notes = ''; - - if(isset($methods[$key]["page"])) - $page = $methods[$key]["page"]; - else - $page = ''; - - if(isset($methods[$key]["menu_display"])) - $menu_display = '1'; - else - $menu_display = '0'; - - $q = 'INSERT INTO '.AGILE_DB_PREFIX .'module_method SET - id = '.$db->qstr($method_id).', - site_id = '.$db->qstr(DEFAULT_SITE).', - name = '.$db->qstr($name).', - module_id = '.$db->qstr($module_id).', - notes = '.$db->qstr($notes).', - page = '.$db->qstr($page).', - menu_display = '.$db->qstr($menu_display); - - $result = $db->Execute($q); - - # Error checking - if ($result === false) - { - global $C_debug; - $C_debug->error('module.inc.php','install_db :: module_method', $db->ErrorMsg()); - return false; - } - - - ############################################################### - ### Create the group_method records, with the ID from each - ### of the above methods... - ### Get the groups to add to (FROM THE install.tpl form!) - - for($i=0; $iGenID(AGILE_DB_PREFIX . 'group_method_id'); - $q = 'INSERT INTO '.AGILE_DB_PREFIX .'group_method SET - id = '.$db->qstr($group_method_id).', - site_id = '.$db->qstr(DEFAULT_SITE).', - method_id = '.$db->qstr($method_id).', - module_id = '.$db->qstr($module_id).', - group_id = '.$db->qstr($VAR["module_group"][$i]); - - $result = $db->Execute($q); - - # Error checking - if ($result === false) - { - global $C_debug; - $C_debug->error('module.inc.php','install_db :: group_method_id', $db->ErrorMsg()); - return false; - } - } - } - } - - //$db->Execute ( sqlDelete(&$db, 'module', "name IS NULL or name = '' OR parent_id IS NULL or parent_id = ''") ); - - # all done! - return true; - } - - - ############################################## - ## INSTALL DEFAULT DATA ## - ############################################## - function install_sql_data($module) - { - # check the file: - $f = PATH_MODULES . '' . $module . '/' . $module . '_install_data.xml'; - - if(is_file($f)) - { - # open the XML backup file: - $C_xml = new CORE_xml; - $backup = $C_xml->xml_to_array($f); - $db = &DB(); - $arr = $backup['install']; - - # loop through each table in this array - if(is_array($arr) ) - { - while (list ($table,$records) = each ($arr)) - { - $runsql = false; - $sqls = 'INSERT INTO '.AGILE_DB_PREFIX.'' . $table . ' SET '; - - if (is_array($records) ) - { - # loop through each of the fields for this module - $sql = ''; - $sqlcount = 0; - while (list ($fld,$val) = each ($records)) - { - if (is_array($val)) - { - # loop through each of the fields for this module - $sql = ''; - $sqlcount = 0; - while (list ($fld2,$val2) = each ($val)) - { - if ($sqlcount != 0) $sql .= ', '; - $sql .= $fld2 .' = '.$db->qstr($val2); - $sqlcount++; - } - ## echo '
    ' . $sqls. ' ' . $sql; - $result = $db->Execute($sqls. ' ' . $sql); - - } - else - { - if ($sqlcount != 0) $sql .= ', '; - $sql .= $fld .' = '.$db->qstr($val); - $sqlcount++; - $runsql = true; - } - - } - if ($runsql) - { - ## echo '
    ' . $sqls. ' ' . $sql; - $result = $db->Execute($sqls. ' ' . $sql); - if($result === false) - @$this->error .= "
    ". $sqls. ' ' . $sql; - } - } - } - } - } - } - - - ################################### - ## MAIN INSTALLER ## - ################################### - function install($VAR) - { - global $smarty, $C_translate; - - # check this module for any errors: - if($this->install_error_check($VAR)) - { - - ### Get sub_modules of this package - if(isset($this->install["install"]["module_properties"]["sub_modules"])) - { - ### Check Each Sub-module: - $arr_sub = $this->install["install"]["module_properties"]["sub_modules"]; - - if(ereg(',', $arr_sub)) - $arr_s = explode(',', $arr_sub); - else - $arr_s[] = $arr_sub; - - for($i=0; $iinstall_error_check_sub($arr_s[$i])) - $error[] = $C_translate->translate('install_sub_module_err','module','sub_module='.$arr_s[$i]); - } - } - - # check for error: - if(isset($error)) - { - $error[] = $C_translate->translate('install_failed','module',''); - - # set the errors as a Smarty Object - $smarty->assign('form_validation', $error); - return false; - } - - - ### install the SQL... - $module = trim($VAR["install_name"]); - if($this->install_sql($module)) - { - ### Loop through the sub-modules and install each of them - if(isset($arr_s)) - { - for($i=0; $iinstall_sql($arr_s[$i])) - { - ### Errors in install_sql(), then delete any SQL changes! - ### set smarty error - return; - } - - } - } - } - else - { - ### Errors in install_sql(), then delete any SQL changes! - ### set smarty error - return; - } - - ### Insert default data: - $this->install_sql_data($module); - } - - # update the current user's authentication so the update group access applies - # to them - global $C_auth; - $C_auth->auth_update(); - } - - - - - - - ################################### - ## AUTO UPGRADER ## - ################################### - function upgrade($VAR) - { - if(!isset($VAR['module_name']) || !isset($VAR['module_group'])) - { - echo "You must select both the module(s) to upgrade and the groups to grant access to new methods to."; + /** + * Module upgrader + * + * This function will update the schema if required + */ + public function upgrade($VAR) { + if (! isset($VAR['module_name']) || ! isset($VAR['module_group'])) { + echo 'You must select both the module(s) to upgrade and the groups to grant access to new methods to.'; return; } @@ -1046,290 +860,247 @@ class module $method_new_count = 0; $fields_new_count = 0; - # loop through each module + # Loop through each module $modules = $VAR['module_name']; - for($i=0; $iExecute(sqlSelect($db,"module","*","id=::{$modules[$i]}:: or name=::{$modules[$i]}::")); + # Get the module details + $db = &DB(); + $db_module = $db->Execute(sqlSelect($db,'module','*',sprintf('id=::%s:: OR name=::%s::',$modules[$i],$modules[$i]))); $module_name = $db_module->fields['name']; - $module_id = $db_module->fields['id']; + $module_id = $db_module->fields['id']; - ######################################################################### - # Update the Methods from the _install.xml file - # get the install xml file - ######################################################################### - - $install_xml = PATH_MODULES.$module_name.'/'.$module_name.'_install.xml'; - if(is_file($install_xml)) - { + # Update the Methods from the _install.xml file get the install xml file + $install_xml = sprintf('%s%s/%s_install.xml',PATH_MODULES,$module_name,$module_name); + if (is_file($install_xml)) { $C_xml = new CORE_xml; - @$methods = $C_xml->xml_to_array($install_xml); - @$methods = $methods['install']['sql_inserts']['module_method']; + $methods = $C_xml->xml_to_array($install_xml); + + $methods = $methods['install']['sql_inserts']['module_method']; # loop through the methods - if(is_array($methods)) - { - while (list ($key, $value) = each($methods)) - { - # increment method count + if (is_array($methods)) { + while (list($key,$value) = each($methods)) { + # Increment method count $method_count++; - # see if this method exists - $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'module_method WHERE - name = ' . $db->qstr( $key ) . ' AND - module_id = ' . $db->qstr( $module_id ) . ' AND - site_id = ' . $db->qstr(DEFAULT_SITE); - $method_db = $db->Execute($sql); - if ($method_db === false) { + # See if this method exists + $method_db = $db->Execute(sqlSelect($db,'module_method','*',array('name'=>$key,'module_id'=>$module_id))); + if ($method_db === false) { global $C_debug; - $C_debug->error('module.inc.php','upgrade', $db->ErrorMsg()); + + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); } - if($method_db->RecordCount() == 0) - { - # increment method count + + if ($method_db->RecordCount() == 0) { + # Increment method count $method_new_count++; - ### add this method - @$notes = $methods[$key]["notes"]; - @$page = $methods[$key]["page"]; - @$menu_display = $methods[$key]["menu_display"]; + # Add this method + @$notes = $methods[$key]['notes']; + @$page = $methods[$key]['page']; + @$menu_display = $methods[$key]['menu_display']; - $method_id = sqlGenID($db, 'module_method'); - $fields=Array('name'=>$key, 'module_id'=>$module_id, 'notes'=>$notes, 'page'=>$page, 'menu_display'=>$menu_display); - $db->Execute(sqlInsert($db,"module_method",$fields, $method_id)); - if ($result === false) { + $method_id = sqlGenID($db,'module_method'); + $fields=array('name'=>$key,'module_id'=>$module_id,'notes'=>$notes,'page'=>$page,'menu_display'=>$menu_display); + $db->Execute(sqlInsert($db,'module_method',$fields,$method_id)); + + if ($result === false) { global $C_debug; - $C_debug->error('module.inc.php','upgrade', $db->ErrorMsg()); + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); } - ### Create the group_method records, with the ID from each - for($ii=0; $iiGenID(AGILE_DB_PREFIX . "" . 'group_method_id'); - $q = 'INSERT INTO '.AGILE_DB_PREFIX .'group_method SET - id = '.$db->qstr($group_method_id).', - site_id = '.$db->qstr(DEFAULT_SITE).', - method_id = '.$db->qstr($method_id).', - module_id = '.$db->qstr($module_id).', - group_id = '.$db->qstr($VAR["module_group"][$ii]); - $result = $db->Execute($q); + # Create the group_method records, with the ID from each + for ($ii=0; $iiExecute(sqlInsert($db,'group_method',array('method_id'=>$method_id,'module_id'=>$module_id,'group_id'=>$VAR['module_group'][$ii]))); + if ($result === false) { global $C_debug; - $C_debug->error('module.inc.php','upgrade', $db->ErrorMsg()); + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); } } } } - } + } } - - ######################################################################### - # Update the DB Fields from the _construct.xml file - # get the install xml file - ######################################################################### - - $construct_xml = PATH_MODULES.$module_name.'/'.$module_name.'_construct.xml'; - if(is_file($construct_xml)) - { + # Update the DB Fields from the _construct.xml file get the install xml file + $construct_xml = sprintf('%s%s/%s_construct.xml',PATH_MODULES,$module_name,$module_name); + if (is_file($construct_xml)) { $C_xml = new CORE_xml; $construct = $C_xml->xml_to_array($construct_xml); + @$fields = $construct['construct']['field']; - ### Check that this Module has any db installation required... - if(!empty($construct["construct"]["table"]) && $construct["construct"]["table"] == $module_name) - { - ### Create the module DB table - $table = $construct["construct"]["table"]; + # Check that this Module has any db installation required... + if (! empty($construct['construct']['table']) && $construct['construct']['table'] == $module_name) { + # Create the module DB table + $table = $construct['construct']['table']; $db = &DB(); - $db_fields = $db->MetaColumns(AGILE_DB_PREFIX.$table, true); + $db_fields = $db->MetaColumns(AGILE_DB_PREFIX.$table,true); - ### Create the module DB fields - $arr_field = $construct["construct"]["field"]; + # Create the module DB fields + $arr_field = $construct['construct']['field']; - ### Loop through the fields to build the list: - while (list ($key, $value) = each($arr_field)) - { + # Loop through the fields to build the list: + $flds = array(); + while (list($key,$value) = each($arr_field)) { $field = $key; $FIELD = strtoupper($key); - if(!isset($db_fields[$FIELD])) - { - # increment field count + if (! isset($db_fields[$FIELD])) { + # Increment field count $fields_new_count++; - $t_s = $arr_field["$key"]["type"]; - if(ereg('[(]',$t_s)) - { + $t_s = $arr_field[$key]['type']; + + if (preg_match('/[(]/',$t_s)) { $ts = explode('(',$t_s); $type = $ts[0]; - $size = ereg_replace(')', '', $ts[1]); - $flds[] = Array($field, $type, $size); - } - else - { - $flds[] = Array($field, $t_s); + $size = preg_replace('/[)]/','',$ts[1]); + array_push($flds,array($field,$type,$size)); + + } else { + array_push($flds,array($field,$t_s)); } } } - ### Add any new columns: - if(is_array(@$flds)) - { + # Add any new columns: + if (count($flds)) { $dict = NewDataDictionary($db); - $sqlarray = $dict->AddColumnSQL(AGILE_DB_PREFIX.$table, $flds); + $sqlarray = $dict->AddColumnSQL(AGILE_DB_PREFIX.$table,$flds); $result = $db->Execute($sqlarray[0]); if ($result === false) { global $C_debug; - $C_debug->error('module.inc.php','install_db', $db->ErrorMsg()); + + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); echo $db->ErrorMsg(); } - unset($flds); } - - ### Remove any unused columns - while (list ($key, $value) = each($db_fields)) - { + # Remove any unused columns + $flds = array(); + while (list ($key,$value) = each($db_fields)) { $fieldname = strtolower($key); - if(!isset($construct["construct"]["field"][$fieldname])) $flds[] = $key; + + if (! isset($construct['construct']['field'][$fieldname])) + array_push($flds,$key); } - if(is_array(@$flds)) - { - $dict = NewDataDictionary($db); - $sqlarray = $dict->DropColumnSQL(AGILE_DB_PREFIX.$table, $flds); - $sqlarray[0]; + if (count($flds)) { + $dict = NewDataDictionary($db); + $sqlarray = $dict->DropColumnSQL(AGILE_DB_PREFIX.$table,$flds); $result = $db->Execute($sqlarray[0]); if ($result === false) { global $C_debug; - $C_debug->error('module.inc.php','install_db', $db->ErrorMsg()); + + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); echo $db->ErrorMsg(); } - unset($flds); - } + } - - #################################################### - ### Update Indexes: + # Update Indexes # Get old database indexes $dict = NewDataDictionary($db); $oldindex = $dict->MetaIndexes(AGILE_DB_PREFIX.$table); # check if the 'site_id' index exists: - if(!empty($oldindex['site_id']) && $oldindex['site_id'] = 'id,site_id') { + if (! empty($oldindex['site_id']) && $oldindex['site_id'] = 'id,site_id') { $dict = NewDataDictionary($db); - $sqlarray = $dict->DropIndexSQL('site_id', AGILE_DB_PREFIX.$table); + $sqlarray = $dict->DropIndexSQL('site_id',AGILE_DB_PREFIX.$table); $db->Execute($sqlarray[0]); } # check that that UNIQUE index for site_id,id exists - if(empty($oldindex['IDS']) || $oldindex['IDS']['unique'] != 1) - { - $db=&DB(); - $db->Execute("alter table ".AGILE_DB_PREFIX."$table drop primary key"); - $db->Execute("CREATE UNIQUE INDEX IDS on ".AGILE_DB_PREFIX."$table (site_id, id)"); + if (empty($oldindex['IDS']) || $oldindex['IDS']['unique'] != 1) { + $db->Execute(sprintf('ALTER TABLE %s DROP PRIMARY KEY',AGILE_DB_PREFIX.$table)); + $db->Execute(sprintf('CREATE UNIQUE INDEX IDS ON %s (site_id,id)',AGILE_DB_PREFIX.$table)); } $dict = NewDataDictionary($db); $oldindex = $dict->MetaIndexes(AGILE_DB_PREFIX.$table); - # Current construct invoices - if(@$new_indexes = $construct["construct"]["index"]) - { - while (list ($index, $fields) = each($new_indexes)) - { - if(is_array(@$oldindex[$index])) - { - # already exists - compare fields: - $oldfields = implode(",", $oldindex[$index]['columns']); + # Current construct invoices + if(@$new_indexes = $construct['construct']['index']) { + while (list($index,$fields) = each($new_indexes)) { + if (is_array(@$oldindex[$index])) { + # Already exists - compare fields: + $oldfields = implode(',',$oldindex[$index]['columns']); - if($oldfields != $fields) - { - # index changed - drop: + if ($oldfields != $fields) { + # Index changed - drop: $dict = NewDataDictionary($db); - $sqlarray = $dict->DropIndexSQL($index, AGILE_DB_PREFIX.$table); - - $db->Execute($sqlarray[0]); + $sqlarray = $dict->DropIndexSQL($index,AGILE_DB_PREFIX.$table); + $db->Execute($sqlarray[0]); # create index - $dict = NewDataDictionary($db); + $dict = NewDataDictionary($db); - if(eregi("fulltext", $index) && AGILE_DB_TYPE == 'mysql') - $sqlarray = $dict->CreateIndexSQL($index, AGILE_DB_PREFIX.$table, $fields, array('FULLTEXT')); - else - $sqlarray = $dict->CreateIndexSQL($index, AGILE_DB_PREFIX.$table, $fields); - $db->Execute($sqlarray[0]); - } - } - else - { - # index does not exist - create! + if (preg_match('/fulltext/',$index) && AGILE_DB_TYPE == 'mysql') + $sqlarray = $dict->CreateIndexSQL($index,AGILE_DB_PREFIX.$table,$fields,array('FULLTEXT')); + else + $sqlarray = $dict->CreateIndexSQL($index,AGILE_DB_PREFIX.$table,$fields); + + $db->Execute($sqlarray[0]); + } + + } else { + # Index does not exist - create! $dict = NewDataDictionary($db); - if(eregi("fulltext", $index) && AGILE_DB_TYPE == 'mysql') - $sqlarray = $dict->CreateIndexSQL($index, AGILE_DB_PREFIX.$table, $fields, array('FULLTEXT')); - else - $sqlarray = $dict->CreateIndexSQL($index, AGILE_DB_PREFIX.$table, $fields); + if (preg_match('/fulltext/',$index) && AGILE_DB_TYPE == 'mysql') + $sqlarray = $dict->CreateIndexSQL($index,AGILE_DB_PREFIX.$table,$fields,array('FULLTEXT')); + else + $sqlarray = $dict->CreateIndexSQL($index,AGILE_DB_PREFIX.$table,$fields); + $db->Execute($sqlarray[0]); } - - $verify_index[] = $index; } # Check for removed indexes: - if(!empty($oldindex)) - { + if (! empty($oldindex)) { reset($oldindex); - while (list ($index, $fields) = each($oldindex)) - { - if(!isset($new_indexes[$index]) && $index != 'IDS') - { + + while (list($index,$fields) = each($oldindex)) { + if (! isset($new_indexes[$index]) && $index != 'IDS') { $dict = NewDataDictionary($db); - $sqlarray = $dict->DropIndexSQL($index, AGILE_DB_PREFIX.$table); - $db->Execute($sqlarray[0]); + $sqlarray = $dict->DropIndexSQL($index,AGILE_DB_PREFIX.$table); + $db->Execute($sqlarray[0]); } - } + } + } + + } else { + # Remove all old indexes + if (! empty($oldindex)) { + reset($oldindex); + + while (list($index,$fields) = each($oldindex)) { + if($index != 'IDS') { + $dict = NewDataDictionary($db); + $sqlarray = $dict->DropIndexSQL($index,AGILE_DB_PREFIX.$table); + $db->Execute($sqlarray[0]); + } + } } } - else - { - # remove all old indexes - if(!empty($oldindex)) - { - reset($oldindex); - while (list ($index, $fields) = each($oldindex)) - { - if($index != 'IDS') - { - $dict = NewDataDictionary($db); - $sqlarray = $dict->DropIndexSQL($index, AGILE_DB_PREFIX.$table); - $db->Execute($sqlarray[0]); - } - } - } - } } } } - $msg = "Successfully checked $module_count module(s), $method_count method(s), ". - "and $fields_count db fields.
    ". - "Added $method_new_count method(s) and $fields_new_count db field(s)."; + $msg = sprintf('Successfully checked %s module(s), %s method(s), and %s db fields.
    Added %s method(s) and %s db field(s).', + $module_count,$method_count,$fields_count,$method_new_count,$fields_new_count); - - if(!empty($fields_new_count) > 0) { - $js = ''; + if (! empty($fields_new_count) > 0) { global $smarty; - if(is_object($smarty)) - $smarty->assign('js', $js); + + if (is_object($smarty)) + $smarty->assign('js',''); else echo ''; } @@ -1337,16 +1108,17 @@ class module # Display the message. global $C_debug; - if(is_object($C_debug)) + + if (is_object($C_debug)) $C_debug->alert($msg); else echo $msg; - # update the current user's authentication so the update group access applies - # to them + # update the current user's authentication so the update group access applies to them global $C_auth; - if(is_object($C_auth)) $C_auth->auth_update(); + if (is_object($C_auth)) + $C_auth->auth_update(); } @@ -1358,16 +1130,16 @@ class module include_once('dev.inc.php'); $db = &DB(); - if(is_array($VAR['module'])) + if(is_array($VAR['module'])) { for($ix = 0; $ix - - module - - module
    - - module,account - - 0 - - name - - 25 - - - parent_id - menu_display - status,menu_display - - - - - I4 - 1 - 1 - - - I4 - 1 - - - I8 - - - I8 - - - I4 - 1 - - - C(128) - 3 - 128 - any - 1 - - - X2 - - - L - - - L - - - - - name,notes,status,date_orig,date_last,menu_display,parent_id - notes,status,date_orig,date_last,menu_display,parent_id - id,name,notes,status,date_orig,date_last,menu_display,parent_id - id,name,notes,status,date_orig,date_last,menu_display,parent_id - id,name,notes,status,date_orig,date_last,menu_display,parent_id - id,name,notes,status,date_orig,date_last,menu_display,parent_id - id,name,notes,status,date_orig,date_last,menu_display,parent_id - id,name,notes,status - id,name,notes,status,date_orig,date_last,menu_display,parent_id - id,name,notes,status,date_orig,date_last,menu_display,parent_id - - - - - module:method - module:method - - + + module + + module
    + + module,account + + 0 + + name + + 25 + + 0 + + + + parent_id + menu_display + status,menu_display + + + + + + + 1 + I4 + 1 + + + + 1 + I4 + + + + date-now + Date Created + I8 + + + + date-now + Date Updated + I8 + + + + Active + L + + + Parent + I4 + 1 + + + Name + C(128) + 3 + 128 + any + 1 + + + Notes + X2 + + + Menu + Display on Menu + L + + + + + + name,notes,status,date_orig,date_last,menu_display,parent_id + notes,status,date_orig,date_last,menu_display,parent_id + id,name,notes,status,date_orig,date_last,menu_display,parent_id + id,name,notes,status,date_orig,date_last,menu_display,parent_id + id,name,notes,status,date_orig,date_last,menu_display,parent_id + id,name,notes,status,date_orig,date_last,menu_display,parent_id + id,name,notes,status,date_orig,date_last,menu_display,parent_id + id,name,notes,status + id,name,notes,status,date_orig,date_last,menu_display,parent_id + id,name,notes,status,date_orig,date_last,menu_display,parent_id + + + + + + module:method + module:method + + + + + + <add>Add Module</add> + <install>Install Module</install> + + + + + + + id + checkbox + 25px + + + name + + + notes + + + status + bool_icon + 20px + + +
    diff --git a/modules/module/module_install.xml b/modules/module/module_install.xml index d6aad6d3..9aa03dbf 100644 --- a/modules/module/module_install.xml +++ b/modules/module/module_install.xml @@ -1,63 +1,84 @@ + + - module - setup - + + + + Modules + 1 + + module + + + + setup + + + + core - - - - search - - - view - - - 1 - - - add - - 1 - - - delete - - - update - - - search_show - - - - dev_add - 1 - - - failure - - - install - - - 1 - - - translate - - - dev_install_gen - - - upgrade - - 1 - - - remote_update - - - - \ No newline at end of file + + + + + Add + 1 + add + + + + delete + + + + List + 1 + search + + + + + search_show + + + + update + + + + view + + + + dev_add + 1 + + + failure + + + Install + install + + + 1 + + + translate + + + dev_install_gen + + + Upgrade + upgrade + + 1 + + + remote_update + + + diff --git a/modules/module_method/module_method.inc.php b/modules/module_method/module_method.inc.php index d7b8504e..ba10385b 100644 --- a/modules/module_method/module_method.inc.php +++ b/modules/module_method/module_method.inc.php @@ -1,311 +1,171 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Module:Method */ - -class module_method -{ - # Open the constructor for this mod - function module_method() - { - # name of this module: - $this->module = "module_method"; +/** + * The main AgileBill Module Method Class + * + * @package AgileBill + * @subpackage Module:Method + */ +class module_method extends OSB_module { + /** + * View methods + */ + public function view_methods($VAR) { + $type = 'search'; + $this->method[$type] = explode(',',$this->method[$type]); + $db = new CORE_database; - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; + $this->this_search_show($VAR,$this,$type); } - - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } - - ############################## - ## VIEW METHODS ## - ############################## - - function view_methods($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $this->this_search_show($VAR, $this, $type); - } - ############################## ## VIEW METHODS p.2 ##### ############################## - - function this_search_show($VAR, $construct, $type) - { + function this_search_show($VAR,$construct,$type) { global $VAR; # Get the list of parents for this group $this->group_parent_list($VAR['module_method_group_id']); + # Generate the full query + $db = &DB(); + $result = $db->Execute(sqlSelect($db,'module_method','*',array('module_id'=>$VAR['module_method_module_id']))); - # generate the full query - $q = "SELECT * FROM - ".AGILE_DB_PREFIX."module_method - WHERE - module_id = ".$VAR['module_method_module_id']; - $db = &DB(); - $result = $db->Execute($q); + # Put the results into a smarty accessable array + $i = 0; + $class_name = true; - - - # put the results into a smarty accessable array - $i=0; - $class_name = TRUE; - - while (!$result->EOF) { - $smart[$i] = $result->fields; + while (! $result->EOF) { + $smart[$i] = $result->fields; $method_id = $smart[$i]['id']; - ## Get the auth status for this method & group - $q1 = 'SELECT id FROM '.AGILE_DB_PREFIX.'group_method WHERE - method_id = '.$smart[$i]['id'].' AND - group_id = '.$VAR['module_method_group_id']; - $db1 = &DB(); - $resulta = $db1->Execute($q1); - #echo "
    $q1"; + # Get the auth status for this method & group + $resulta = $db->Execute(sqlSelect($db,'group_method','id',array('method_id'=>$smart[$i]['id'],'group_id'=>$VAR['module_method_group_id']))); - ## authorized by current group - if($resulta->RecordCount() >= 1) - { - #echo "
    1 - This group matches!"; + # Authorized by current group + if ($resulta->RecordCount() >= 1) { $smart[$i]['checked'] = '1'; - } - else - { - # get the parent group id(s) for this group + + } else { + # Get the parent group id(s) for this group $match = false; - for($ii=0; $ii < count($this->group); $ii++) - { - if($match == false && $this->group[$ii] != $VAR['module_method_group_id']) - { - $q2 = 'SELECT id FROM '.AGILE_DB_PREFIX.'group_method - WHERE method_id = '.$method_id.' - AND group_id = '.$this->group[$ii]; + for ($ii=0; $ii < count($this->group); $ii++) { + if ($match == false && $this->group[$ii] != $VAR['module_method_group_id']) { + $resultb = $db->Execute(sqlSelect($db,'group_method','id',array('method_id'=>$method_id,'group_id'=>$this->group[$ii]))); - $db2 = &DB(); - $resultb = $db2->Execute($q2); - - #echo "
    $q2"; - if($resultb->RecordCount() >= 1) + if ($resultb->RecordCount() >= 1) $match = true; } } - - ## authorized by parent - if($match) - { - #echo "
    2 - This Parent Matches!"; + # authorized by parent + if ($match) $smart[$i]['checked'] = '2'; - } else - { - ## not authorized - #echo "
    3 - NO matches"; - $smart[$i]['checked'] = '3'; - } + $smart[$i]['checked'] = '3'; } - - if($class_name) - { + if ($class_name) { $smart[$i]['_C'] = 'row2'; - $class_name = FALSE; + $class_name = false; + } else { $smart[$i]['_C'] = 'row1'; - $class_name = TRUE; + $class_name = true; } $result->MoveNext(); $i++; - } # get any linked fields - if($i > 0) - { + if ($i > 0) { $db_join = new CORE_database; $this->result = $db_join->join_fields($smart, $this->linked); - } - else - { + } else { $this->result = $smart; } - # get the result count: $results = $result->RecordCount(); # define the DB vars as a Smarty accessible block global $smarty; # define the results - $smarty->assign($construct->table, $this->result); - $smarty->assign('page', $VAR['page']); - $smarty->assign('order', 1111); - $smarty->assign('sort', 1111); - $smarty->assign('limit', 1111); + $smarty->assign($construct->table,$this->result); + $smarty->assign('page',$VAR['page']); + $smarty->assign('order',1111); + $smarty->assign('sort',1111); + $smarty->assign('limit',1111); $smarty->assign('search_id',1111); - $smarty->assign('results', $results); + $smarty->assign('results',$results); # get the total pages for this search: $this->pages = 1; - if ($search->results % $search->limit) $this->pages++; + if ($search->results % $search->limit) + $this->pages++; + # total pages - $smarty->assign('pages', $this->pages); + $smarty->assign('pages',$this->pages); # current page - $smarty->assign('page', $current_page); + $smarty->assign('page',$current_page); $page_arr = ''; - for($i=0; $i <= $this->pages; $i++) - { - if ($this->page != $i) $page_arr[] = $i; - } + for ($i=0; $i <= $this->pages; $i++) + if ($this->page != $i) + $page_arr[] = $i; + # page array for menu - $smarty->assign('page_arr', $page_arr); - + $smarty->assign('page_arr',$page_arr); } - /** * Get any inherited groups (parent) for a specified group * @return void * @since Version 1.0 * @param int Group Id */ - function group_parent_list($group) - { + function group_parent_list($group) { # check if this group is a child with an active parent $db = &DB(); - $q = "SELECT id,parent_id FROM " . AGILE_DB_PREFIX . "group - WHERE id = '$group' - AND site_id = '" . DEFAULT_SITE . "'"; - $result = $db->Execute($q); + $result = $db->Execute(sqlSelect($db,'group','id,parent_id',array('id'=>$group))); # error handling - if ($result === false) - { + if ($result === false) { global $C_debug; - $C_debug->error('auth.inc.php','group_parent_list', $db->ErrorMsg()); + + $C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg()); } - # loop through the results - while (!$result->EOF) - { + # loop through the results + while (! $result->EOF) { # add this group to the list $this->group[] = $result->fields['id']; # get inherited groups and check that the associated # group is active before adding to the list of authorized groups. - if($result->fields['parent_id'] != 0) - { + if ($result->fields['parent_id'] != 0) $this->group_parent_list($result->fields['parent_id']); - } # move to next record $result->MoveNext(); @@ -318,49 +178,25 @@ class module_method * @since Version 1.0 * @param int Group Id */ - - function update_relations() - { + function update_relations() { global $VAR; + $db = &DB(); - if(isset($VAR['id']) && $VAR['id'] != '') - { - $arr = explode(',', $VAR['id']); + if (isset($VAR['id']) && $VAR['id'] != '') + $arr = explode(',',$VAR['id']); + else + return; + + for ($i=0; $iExecute(sqlDelete($db,'group_method',array('module_id'=>$VAR['module_method_module_id'],'group_id'=>$VAR['module_method_group_id']))); + + if ($arr[$i] == 0) + return; + + $db->Execute(sqlInsert($db,'group_method',array('method_id'=>$arr[$i],'module_id'=>$VAR['module_method_module_id'],'group_id'=>$VAR['module_method_group_id']))); } - else { return;} - - - - for($i=0; $iExecute($q); - } - - if($arr[$i] == 0) return; - - # determine the record id: - $this->record_id = $db->GenID(AGILE_DB_PREFIX . 'group_method_id'); - - # generate the full query - $q = "INSERT INTO ".AGILE_DB_PREFIX."group_method - SET - id = '".$this->record_id."', - site_id = '" . DEFAULT_SITE . "', - method_id = '".$arr[$i]."', - module_id = '".$VAR['module_method_module_id']."', - group_id = '".$VAR['module_method_group_id']."'"; - $db = &DB(); - $result = $db->Execute($q); - } - } + } } -?> \ No newline at end of file +?> diff --git a/modules/module_method/module_method_construct.xml b/modules/module_method/module_method_construct.xml index 02bdcb1e..aa980ae1 100644 --- a/modules/module_method/module_method_construct.xml +++ b/modules/module_method/module_method_construct.xml @@ -1,66 +1,106 @@ - - module_method - - module_method
    - - module - - 0 - - name - - 25 - - - module_id - menu_display - - - - - I4 - 1 - 1 - - - I4 - 1 - - - I4 - module - name - any - 1 - - - C(64) - 1 - 64 - non_numeric - - - - C2(128) - - - C(128) - - - L - - - - - id,site_id,module_id,name,notes,page,menu_display - id,site_id,module_id,name,notes,page,menu_display - id,site_id,module_id,name,notes,page,menu_display - id,site_id,module_id,name,notes,page,menu_display - id,site_id,module_id,name,notes,page,menu_display - id,site_id,module_id,name,notes,page,menu_display - - - 0 + + module_method + + module_method
    + + module + + 0 + + name + + 25 + + 1 + + + + module_id + menu_display + + + + + + + 1 + I4 + 1 + + + + 1 + I4 + + + Module + I4 + module + name + any + 1 + + + Name + C(64) + 1 + 64 + non_numeric + + + + C2(128) + + + C(128) + + + Menu + L + + + + + + module_id,name,notes,page,menu_display + id,site_id,module_id,name,notes,page,menu_display + id,site_id,module_id,name,notes,page,menu_display + id,site_id,module_id,name,notes,page,menu_display + id,site_id,module_id,name,notes,page,menu_display + id,site_id,module_id,name,notes,page,menu_display + + + + + + + + <add>Add Method</add> + <update_relations>Update Authorisation</update_relations> + <view>Methods</view> + + + + + + + id + checkbox + 25px + + + name + + + module_id + + + menu_display + bool + 15px + + +
    diff --git a/modules/module_method/module_method_install.xml b/modules/module_method/module_method_install.xml index 5b64df37..e58b8bc4 100644 --- a/modules/module_method/module_method_install.xml +++ b/modules/module_method/module_method_install.xml @@ -1,40 +1,62 @@ + + + + + + + + 0 + module_method - module + + + module + + + + core - - - - search - - - view - - - add - - - delete - - - update - - - search_form - - - search_show - - - - view_methods - - - - update_relations - - - - \ No newline at end of file + + + + + add + + + + delete + + + + search + + + + + search_form + + + + search_show + + + + update + + + + view + + + + view_methods + + + + update_relations + + + diff --git a/modules/net_term/net_term.inc.php b/modules/net_term/net_term.inc.php index c753de78..2b45a7d5 100644 --- a/modules/net_term/net_term.inc.php +++ b/modules/net_term/net_term.inc.php @@ -1,59 +1,239 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Modules:Invoice */ - -class net_term -{ - var $taxable=1; # are late fees taxable? 0/1 - # Open the constructor for this mod - function net_term() - { - # name of this module: - $this->module = "net_term"; +/** + * The main AgileBill Net Term Class + * + * @package AgileBill + * @subpackage Modules:Invoice + */ +class net_term extends OSB_module { + var $taxable=1; # @todo (to move to net_term) are late fees taxable? 0/1 - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; + # Does this term period determine that the service should be suspended + private $toSuspend = false; + # Does this term period determine that the invoice should be sent + private $sendInv = false; + # Which notice number should be sent. + private $notice = false; + # Should we send the final notice + private $lastNotice = false; - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); + private function getTermDetails($tid) { + static $CACHE = array(); - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; + if (! isset($CACHED[$tid])) { + $db = &DB(); + $CACHED[$tid] = $db->Execute(sqlSelect($db,'net_term','*',sprintf('status=1 AND id=%s',$tid))); + } + + return $CACHED[$tid]; } - ### Check usergroup&checkout plugin to determin if net terms available (get best) - function termsAllowed($account_id,$checkout_plugin_id) - { + /** + * Set the TermID of this object + * From this we can work out if what interval this is + * @return boolean true if this term is valid, false if not valid + */ + public function checkTermDetails($tid,$date,$prepaid=false) { + # If date > today and prepaid, then suspend + if ($prepaid && time()-$date > 0) { + $this->toSuspend = true; + + return true; + } + + $rs = $this->getTermDetails($tid); + if ($rs && $rs->RecordCount()==1) { + $terms = explode(',',$rs->fields['terms']); + sort($terms); + + # If the date is outside the first term date, then we'll return here + if (time()-$date < $terms[0]*86400) + return false; + + $c = -1; + foreach ($terms as $i => $d) { + $dd = time()-$d*86400; + + # If this is prepaid, is this our last notice? + if ($prepaid && (isset($terms[$i+1]) && (time()-$date > $terms[$i+1]*86400))) { + $this->lastNotice = true; + break; + } + + # If we matched a term period, we need to exit + if ($date >= $dd || ($prepaid && $d > 0)) + break; + $c++; + } + + if ($this->lastNotice) + return true; + + # If we went 1 loop only, then this must be the first match and thus an invoice needs to go out. + if ($c==0) + $this->sendInv = true; + # If we came out with no matches, then we must be in the suspend time + elseif ((! $prepaid && ($date < $dd)) || ($prepaid && $d > 0)) + $this->toSuspend = true; + else + $this->notice = $c; + + return true; + } + + return false; + } + + /** + * Return if this term deterimes that the service should be suspended. + */ + public function getSuspend() { + return $toSuspend; + } + + /** + * Return if this term deterimes that the invoice should be generated. + */ + public function sendInvoice() { + return $sendInv; + } + + /** + * Return the notice number + */ + public function getNoticeNumber() { + return $this->notice; + } + + /** + * Get an array of the term dates, including invoice creation and suspension + * + * Optionally pass the invoice created date. + */ + public function getTermDates($id,$created=null,$due=null) { + $td = array(); + $db = &DB(); + + $query = $db->Execute(sqlSelect($db,'net_term','terms',sprintf('id=%s',$id))); + if ($query && $query->RecordCount()) { + $terms = explode(',',$query->fields['terms']); + sort($terms); + + if (is_null($due)) + $due = time(); + + if (! is_null($created)) + array_push($td,array('date'=>$created,'desc'=>'Invoice Created')); + + $duedate = false; + foreach ($terms as $index => $days) { + if ($created && $created >= $due+$days*86400) + continue; + + if (! $duedate && $days>0) + array_push($td,array('date'=>$due-$days*86400,'desc'=>'Invoice Due')); + + if ($days == 0) { + $desc = 'Invoice Due'; + $duedate = true; + } elseif ($index == 0 && ! count($td)) + $desc = 'Invoice Created'; + elseif ($index == count($terms)-1) + $desc = 'Service Suspension'; + else + $desc = 'Notice'; + + array_push($td,array('date'=>$due+$days*86400,'desc'=>$desc)); + $i++; + } + } + + return $td; + } + + # Check usergroup&checkout plugin to determin if net terms available (get best) + public function termsAllowed($account_id,$checkout_plugin_id) { $db=&DB(); - $rs=&$db->Execute($sql=sqlSelect($db,"net_term","*","status=1 AND checkout_id=$checkout_plugin_id","fee ASC")); - if($rs && $rs->RecordCount() > 0) { - global $C_auth; + $rs=&$db->Execute($sql=sqlSelect($db,"net_term","*","status=1 AND checkout_id=$checkout_plugin_id","fee ASC")); + if($rs && $rs->RecordCount() > 0) { + global $C_auth; while(!$rs->EOF) { - $availarr = unserialize($rs->fields['group_avail']); + $availarr = unserialize($rs->fields['group_avail']); if(is_array($availarr)) { foreach($availarr as $g) { if($C_auth->auth_group_by_account_id($account_id,$g)) return $rs->fields['id']; @@ -64,42 +244,41 @@ class net_term return 0; } - ### Task to generate late charges & insert into charge module: - function task($VAR) - { + # Task to generate late charges & insert into charge module: + function task($VAR) { require_once(PATH_MODULES.'email_template/email_template.inc.php'); require_once(PATH_MODULES.'invoice/invoice.inc.php'); $invoice = new invoice; # get active net terms $db=&DB(); - $rs=&$db->Execute($sql=sqlSelect($db,"net_term","*","status=1")); - if($rs && $rs->RecordCount() > 0) - { - // loop through net terms + $rs=&$db->Execute($sql=sqlSelect($db,"net_term","*","status=1")); + if($rs && $rs->RecordCount() > 0) + { + // loop through net terms while(!$rs->EOF) { - $id = $rs->fields['id']; - $last_interval = mktime(0,0,0,date('m'), date('d')-$rs->fields['terms'], date('Y')); + $id = $rs->fields['id']; + $last_interval = mktime(0,0,0,date('m'), date('d')-$rs->fields['terms'], date('Y')); $i=&$db->Execute($sql=sqlSelect($db,"invoice", - "id,account_id,total_amt,billed_amt,due_date,net_term_date_last,net_term_intervals", + "id,account_id,total_amt,billed_amt,due_date,net_term_date_last,net_term_intervals", "net_term_id = $id AND (suspend_billing = 0 OR suspend_billing IS NULL) AND - (billing_status = 0 OR billing_status IS NULL) AND + (billing_status = 0 OR billing_status IS NULL) AND due_date <= $last_interval AND - net_term_date_last <= $last_interval")); - if($i && $i->RecordCount() > 0) - { + net_term_date_last <= $last_interval")); + if($i && $i->RecordCount() > 0) + { // loop through invoices - while(!$i->EOF) - { - $terms = $rs->fields['terms']; + while(!$i->EOF) + { + $terms = $rs->fields['terms']; echo "
    " . $start_interval = $i->fields['net_term_date_last']; - echo "
    " . $stop_interval = $start_interval+(86400*$terms); + echo "
    " . $stop_interval = $start_interval+(86400*$terms); echo "
    ". date(UNIX_DATE_FORMAT,$start_interval); @@ -108,138 +287,59 @@ class net_term // suspend invoice $arr['id'] = $i->fields['id']; - $na =& $invoice->voidInvoice($arr,$invoice); + $na =& $invoice->voidInvoice($arr,$invoice); // suspend billing status $fields=Array('suspend_billing'=>1); - $db->Execute($sql=sqlUpdate($db,"invoice",$fields,"id = {$i->fields['id']}")); + $db->Execute($sql=sqlUpdate($db,"invoice",$fields,"id = {$i->fields['id']}")); // send suspend e-mail if($rs->fields['enable_emails']) { $email = new email_template; - $email->send('net_term_suspend', $i->fields['account_id'], $i->fields['id'], $rs->fields['suspend_intervals'], $i->fields['net_term_intervals']); + $email->send('net_term_suspend', $i->fields['account_id'], $i->fields['id'], $rs->fields['suspend_intervals'], $i->fields['net_term_intervals']); } - } - else + } + else { // calc late fee - if($rs->fields['fee_type'] == 1) + if($rs->fields['fee_type'] == 2) $fee = $rs->fields['fee']; - else + elseif($rs->fields['fee_type'] == 1) $fee = ($i->fields['total_amt'] - $i->fields['billed_amt']) * $rs->fields['fee']; // create late charge - if($fee>0) + if($fee>0) { $fields=Array( 'date_orig'=> time(), - 'status'=> 0, - 'account_id'=> $i->fields['account_id'], + 'status'=> 0, + 'account_id'=> $i->fields['account_id'], 'amount'=> $fee, 'sweep_type'=> $rs->fields['sweep_type'], 'taxable'=> $this->taxable, 'quantity' => 1, 'attributes'=> "Name=={$rs->fields['name']}\r\nInterval==".date(UNIX_DATE_FORMAT,$start_interval)." - ".date(UNIX_DATE_FORMAT,$stop_interval), // todo: translate - 'description'=> $rs->fields['sku']); + 'description'=> $rs->fields['sku']); $db->Execute($sql=sqlInsert($db,"charge",$fields)); // update invoice $_fields['net_term_intervals'] = $i->fields['net_term_intervals']+1; - $_fields['net_term_date_last'] = $stop_interval; - $db->Execute($sql=sqlUpdate($db,"invoice",$_fields,"id={$i->fields['id']}")); + $_fields['net_term_date_last'] = $stop_interval; + $db->Execute($sql=sqlUpdate($db,"invoice",$_fields,"id={$i->fields['id']}")); echo "

    $sql"; - } + } // send late fee/payment reminder e-mail: if($rs->fields['enable_emails']){ $email = new email_template; - $email->send('net_term_late_notice', $i->fields['account_id'], $i->fields['id'], number_format($fee,2), number_format($rs->fields['suspend_intervals']-$i->fields['net_term_intervals'])); - } + $email->send('net_term_late_notice', $i->fields['account_id'], $i->fields['id'], number_format($fee,2), number_format($rs->fields['suspend_intervals']-$i->fields['net_term_intervals'])); + } } $i->MoveNext(); - } + } } $rs->MoveNext(); } - } + } } - - - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } - } -?> \ No newline at end of file +?> diff --git a/modules/net_term/net_term_construct.xml b/modules/net_term/net_term_construct.xml index 18afc37d..6e9606af 100644 --- a/modules/net_term/net_term_construct.xml +++ b/modules/net_term/net_term_construct.xml @@ -1,70 +1,135 @@ - - net_term - net_term
    - charge - 0 - name - 35 - - - I4 - 1 - - - I4 - - - L - - - X2 - any - array - - - I4 - checkout - name - - - C(16) - 2 - 16 - alphanumeric - 1 - - - C(16) - alphanumeric - - - L - - - F - float - - - I4 - numeric - - - L - - - I4 - - - I4 - - - - id,status,group_avail,checkout_id,name,sku,fee_type,fee,suspend_intervals,enable_emails,sweep_type,terms - id,status,group_avail,checkout_id,name,sku,fee_type,fee,suspend_intervals,enable_emails,sweep_type,terms - id,status,group_avail,checkout_id,name,sku,fee_type,fee,suspend_intervals,enable_emails,sweep_type,terms - id,status,group_avail,checkout_id,name,sku,fee_type,fee,suspend_intervals,enable_emails,sweep_type,terms - id,status,checkout_id,name,sku,fee_type,fee,suspend_intervals,enable_emails,sweep_type,terms - - 0 -
    \ No newline at end of file + + + net_term + + net_term
    + + + + 0 + + name + + 25 + + 1 + + + + + + + + + + 1 + I4 + 1 + + + + 1 + I4 + + + + Active + L + + + + X2 + any + array + + + + X2 + array + + + + C(16) + 2 + 16 + alphanumeric + 1 + + + + C(16) + alphanumeric + + + + L + + + + F + + + I4 + + + + I4 + + + + L + + + + I4 + + + + C(32) + any + + + + I4 + + + + + + status,group_avail,name,fee_type,fee,fee_day,suspend_day,enable_emails,sweep_type,terms,checkout_id + id,status,group_avail,name,fee_type,fee,fee_day,suspend_day,enable_emails,sweep_type,terms,checkout_id + id,status,name,fee + id,status,group_avail,name,fee_type,fee,fee_day,suspend_day,enable_emails,sweep_type,terms,checkout_id + id,status,group_avail,name,fee_type,fee,fee_day,suspend_day,enable_emails,sweep_type,terms,checkout_id + + + + + + + + + + + + + + id + checkbox + 25px + + + status + bool_icon + 20px + + + name + + + fee + + + +
    diff --git a/modules/net_term/net_term_install.xml b/modules/net_term/net_term_install.xml index 22ad2fba..42d4e63e 100644 --- a/modules/net_term/net_term_install.xml +++ b/modules/net_term/net_term_install.xml @@ -1,37 +1,55 @@ - - - net_term - setup - This module controls the groups and checkout plugins that net terms will be available to - 1 - charge - - - - - - add - %%:add - 1 - - - update - - - delete - - - view - core:search&module=%%&_escape=1 - 1 - - - search - - - search_show - - - - \ No newline at end of file + + + + + + + Terms + + 1 + + net_term + + + + setup + + + + + + + + + + Add + 1 + add + + + + delete + + + + List + 1 + search + + + + + search_show + + + + update + + + + view + + + + diff --git a/modules/product/base_product_plugin.inc.php b/modules/product/base_product_plugin.inc.php index 4f643105..c6e9edc5 100644 --- a/modules/product/base_product_plugin.inc.php +++ b/modules/product/base_product_plugin.inc.php @@ -1,128 +1,193 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Modules:Product */ - + /** - * Basic Product Plugin Class for AgileBill - * + * The main AgileBill Base Product Plugin Class + * + * @package AgileBill + * @subpackage Modules:Product */ -class base_product_plugin -{ - var $name = ''; - var $tax_based = false; - var $remote_based = true; - var $account; - var $product; - var $product_attr; - +abstract class base_product_plugin { + # Plugin Name + protected $name = ''; + # If this plugin provisions remote services + public $remote_based = false; + # Account Using this Plugin + protected $account; + # Product this Plugin is Refering + protected $product; + # Product Actributes + protected $product_attr; + /** * Provision new service + * + * Some available variables: + * * All the fields on the account table, eg: id,username,email,first_name,last_name + * $this->account['username']; + * * All the fields in the service table, eg: id,host_username,host_password + * $this->service['id']; + * * All the fields captured by the custom product plugin configuration template + * $this->plugin_data['my_field']; */ - function p_new() - { - return true; + protected function p_new() { + # Do some background logging of what is going on + global $C_debug; + $C_debug->error(__FILE__,__METHOD__,print_r(array($this->plugin_data,$this->service),true)); + + return true; } - + /** * Modify service */ - function p_edit() - { + protected function p_edit() { + # Do some background logging of what is going on + global $C_debug; + $C_debug->error(__FILE__,__METHOD__,print_r(array($this->plugin_data,$this->service),true)); + return true; } /** * Suspend service */ - function p_inactive() - { + protected function p_inactive() { + # Do some background logging of what is going on + global $C_debug; + $C_debug->error(__FILE__,__METHOD__,print_r(array($this->plugin_data,$this->service),true)); + return true; } /** * Activate service */ - function p_active() - { + protected function p_active() { + # Do some background logging of what is going on + global $C_debug; + $C_debug->error(__FILE__,__METHOD__,print_r(array($this->plugin_data,$this->service),true)); + return true; } /** - * Delete service + * Delete service */ - function p_delete() - { + protected function p_delete() { + # Do some background logging of what is going on + global $C_debug; + $C_debug->error(__FILE__,__METHOD__,print_r(array($this->plugin_data,$this->service),true)); + return true; } - - function p_one($id) - { + + /** + * Delete items from a cart + * Return is not used + */ + public function delete_cart($VAR,$cart) { + return; + } + + /** + * Validate items added to cart + */ + public function validate_cart($VAR,$cart) { + return true; + } + + /** + * Process a Service + */ + public function p_one($id) { global $C_debug; - - /* Get the service details */ + $db = &DB(); - $rs = $db->Execute(sqlSelect($db,"service","*","id=::$id::")); - if(!$rs || !$rs->RecordCount()) return false; + + /* Get the service details */ + $rs = $db->Execute(sqlSelect($db,'service','*',sprintf('id=::%s::',$id))); + if (! $rs || ! $rs->RecordCount()) + return false; + $this->service = $rs->fields; @$this->plugin_data = unserialize($this->service['prod_plugin_data']); @$this->prod_attr_cart = unserialize($this->service['prod_attr_cart']); - - /* Get the account details */ - $acct = $db->Execute(sqlSelect($db,"account","*","id=::{$this->service['account_id']}::")); - if($acct && $acct->RecordCount()) $this->account = $acct->fields; - /* Get the product details */ - if(!empty($this->service['product_id'])) { - $product = $db->Execute(sqlSelect($db,"product","*","id = ::{$this->service['product_id']}::")); - $this->product = $product->fields; - @$this->product_attr = unserialize($product->fields['prod_plugin_data']); - } - - /* determine the correct action */ - switch ($this->service['queue']) - { + # Get the account details + $acct = $db->Execute(sqlSelect($db,'account','*',sprintf('id=::%s::',$this->service['account_id']))); + if ($acct && $acct->RecordCount()) + $this->account = $acct->fields; + + # Get the product details + if (! empty($this->service['product_id'])) { + $product = $db->Execute(sqlSelect($db,'product','*',sprintf('id = ::%s::',$this->service['product_id']))); + $this->product = $product->fields; + @$this->product_attr = unserialize($product->fields['prod_plugin_data']); + } + + # Determine the correct action + switch ($this->service['queue']) { case 'new': - $result = $this->p_new(); - break; + $result = $this->p_new(); + break; + case 'active': - $result = $this->p_active(); - break; + $result = $this->p_active(); + break; + case 'inactive': $result = $this->p_inactive(); - break; - case 'edit': + break; + + case 'edit': if ($this->service['active'] == 1) $this->p_active(); else $this->p_inactive(); + $result = $this->p_edit(); - break; + + break; + case 'delete': $result = $this->p_delete(); + break; + + default: + $result = false; } - if(@$result !== false) { - $sql = 'UPDATE '.AGILE_DB_PREFIX.'service SET queue='.$db->qstr('none') . ', date_last='.$db->qstr(time()) . ' WHERE id ='.$db->qstr($rs->fields['id']).' AND site_id='.$db->qstr(DEFAULT_SITE); - $upd = $db->Execute($sql); - } else { + + if ($result) { + $sql = sprintf("UPDATE %sservice SET queue='none', date_last=%s WHERE id =%s AND site_id=%s", + AGILE_DB_PREFIX,$db->qstr(time()),$db->qstr($rs->fields['id']),$db->qstr(DEFAULT_SITE)); + $db->Execute($sql); + + } else { $C_debug->error($this->name.'php', $this->service['queue'], @$result); } } } -?> \ No newline at end of file +?> diff --git a/modules/product/product.inc.php b/modules/product/product.inc.php index 339fbb0f..f1c15260 100644 --- a/modules/product/product.inc.php +++ b/modules/product/product.inc.php @@ -1,161 +1,211 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Modules:Product */ - -class product -{ + +/** + * The main AgileBill Product Class + * + * @package AgileBill + * @subpackage Modules:Product + */ +class product extends OSB_module { + # Holds the array of available attributes for the current product + private $attr = array(); + /** - * Holds the array of available attributes for the current product - * @var array + * Show the product details, used when an admin adds a product to a customers account */ - var $attr; - - /** Admin: View details */ - function admin_details($VAR) { + public function admin_details($VAR) { $this->session_id = SESS; - if(!empty($VAR['account_id'])) { - $this->account_id = $VAR['account_id']; - $db=&DB(); - $rs = $db->Execute(sqlSelect($db,"session","id","account_id={$this->account_id}")); - if($rs && $rs->RecordCount()) $this->session_id = $rs->fields['id']; - } - $this->details($VAR, $this); + + if (! empty($VAR['account_id'])) { + $this->account_id = $VAR['account_id']; + $db = &DB(); + $rs = $db->Execute(sqlSelect($db,'session','id',sprintf('account_id=%s',$this->account_id))); + + if ($rs && $rs->RecordCount()) + $this->session_id = $rs->fields['id']; + } + + $this->details($VAR); } - /** User: View details */ - function details($VAR, &$product_obj) { - global $smarty; - if(empty($VAR['id'])) return false; + /** + * Show the product details to the user - used on the order form + */ + public function details($VAR) { + global $smarty, $C_auth; + + if (empty($VAR['id'])) + return false; - # able to view inactive items? $db = &DB(); - global $C_auth; - if($C_auth->auth_method_by_name('invoice','add')) $active = ''; else $active = " AND active=1"; - - $result = $db->Execute(sqlSelect($db,"product","*","id=::{$VAR['id']}:: $active")); - if($result->RecordCount() == 0) return false; - # check for group settings: + # Able to view inactive items? + if (! $C_auth->auth_method_by_name('invoice','add')) + $active = ''; + else + $active = ' AND active=1'; + + $result = $db->Execute($sql = sqlSelect($db,'product','*',sprintf('id=::%s::%s',$VAR['id'],$active))); + if (! count($result->RecordCount())) + return false; + + # Check for group settings $groups = unserialize($result->fields['group_avail']); $auth = false; - for($ii=0; $iiauth_group_by_id($groups[$ii])) { + for ($ii=0; $iiauth_group_by_id($groups[$ii])) { $auth = true; + break; } } - if(!$auth) return false; - # define the DB vars as a Smarty accessible block - $smarty->assign('product', $result->fields); + if (!$auth) + return false; + + # Define the DB vars as a Smarty accessible block + $smarty->assign('product',$result->fields); # If trial, get the sku of the trial product: - if($result->fields["price_type"] == '2') { - $trial = $db->Execute(sqlSelect($db,"*","product","id=::{$result->fields["price_trial_prod"]}::")); - $smarty->assign('trial', $trial->fields); + if($result->fields['price_type'] == '2') { + $trial = $db->Execute(sqlSelect($db,'*','product',sprintf('id=::%s::',$result->fields['price_trial_prod']))); + $smarty->assign('trial',$trial->fields); } # Get the best price for base, setup, & any attributes: $this->price_arr($result->fields); - $smarty->assign('price', $this->price); + $smarty->assign('price',$this->price); # Get any attributes & attribute pricing: $this->attr_arr($VAR['id']); - $smarty->assign('attr', $this->attr); + $smarty->assign('attr',$this->attr); return true; } /** - * Get Atribute values for product details page, sets $this->attr + * Return the best price for a product, based on group details + * Determine the best price based on the base rate, not based on the best setup price. + * + * @param array Price Group Array + * @return array Best Price and Setup Price + */ + private function best_price($fields,$account,$recurr_schedule,$show=false) { + global $C_auth; + + $ret = array(); + @$g_ar = unserialize($fields['price_group']); + + if (is_array($g_ar)) { + $g_ar = $g_ar[$recurr_schedule]; + + if (count($g_ar) > 0) { + while (list($group,$vals) = each($g_ar)) { + if (! $show || (isset($g_ar['show']) && $g_ar['show'])) + if ($C_auth->auth_group_by_account_id($account,$group)) { + if ($vals['price_base'] != '' && (! isset($ret['base']) || $vals['price_base'] < $ret['base'])) { + $ret['base'] = $vals['price_base']; + $ret['setup'] = $vals['price_setup']; + } + } + } + } + } + + return $ret; + } + + /** + * Get Attribute values for product details page, sets $this->attr * * @param int $product_id The product id - * @return unknown */ - function attr_arr($product_id) - { - global $C_auth; - # set the current account - if(empty($this->account_id)) $this->account_id = SESS_ACCOUNT; - $db = &DB(); - $result = $db->Execute(sqlSelect($db,"product_attr","*","product_id=::$product_id::","sort_order")); - if(!$result || $result->RecordCount() == 0) { - $this->attr = false; + private function attr_arr($product_id) { + # Set the current account + if (empty($this->account_id)) + $this->account_id = SESS_ACCOUNT; + + $db = &DB(); + $result = $db->Execute(sqlSelect($db,'product_attr','*',sprintf('product_id=::%s::',$product_id),'sort_order')); + if (! $result || $result->RecordCount() == 0) { + $this->attr = array(); + return false; - } - # loop through each attribute to get the values: - $i=0; - while( !$result->EOF ) { - $this->attr[$i]["id"] = $result->fields["id"]; - $this->attr[$i]["type"] = $result->fields["collect_type"]; - $this->attr[$i]["default"] = $result->fields["collect_default"]; - $this->attr[$i]["name"] = $result->fields["name"]; - $this->attr[$i]["description"] = $result->fields["description"]; - $this->attr[$i]["required"] = $result->fields["required"]; - #get the best base & setup price - $g_ar = unserialize($result->fields["price_group"]); - $ret['base'] = $result->fields["price_base"]; - $ret['setup'] = $result->fields["price_setup"]; - if($ret['base'] != 0 && $ret['setup']!= 0) { - if(count($g_ar) > 0) { - while (list ($group, $vals) = each ($g_ar)) { - if ($C_auth->auth_group_by_account_id($this->account_id, $group)) { - if($vals["price_base"] != "" && $vals["price_base"] < $ret['base']) - $ret['base'] = $vals["price_base"]; - if($vals["price_setup"] != "" && $vals["price_setup"] < $ret['setup']) - $ret['setup'] = $vals["price_setup"]; - } - } - } - } - # if menu, get the menu values as an array: - if($result->fields["collect_type"] == '2') { - $pat="\r\n"; + } + + # Loop through each attribute to get the values + $i = 0; + while (! $result->EOF) { + $this->attr[$i]['id'] = $result->fields['id']; + $this->attr[$i]['type'] = $result->fields['collect_type']; + $this->attr[$i]['default'] = $result->fields['collect_default']; + $this->attr[$i]['name'] = $result->fields['name']; + $this->attr[$i]['description'] = $result->fields['description']; + $this->attr[$i]['required'] = $result->fields['required']; + + # Get the best base & setup price + $ret = $this->best_price(unserialize($result->fields['price_group'])); + $this->attr[$i]['price_base'] = $ret['base']; + $this->attr[$i]['price_setup'] = $ret['setup']; + + # If menu, get the menu values as an array + if ($result->fields['collect_type'] == '2') { + $pat = "\r\n"; $tarr = false; - $marr = explode($pat,$result->fields["collect_default"]); - for($ii=0;$ii '', 'base' => 0, 'setup' => 0); + $marr = explode($pat,$result->fields['collect_default']); + + for ($ii=0; $ii'','base'=>0,'setup'=>0); + } else { - # populated line, determine base/setup price: - if(ereg('==', $marr[$ii])) { + # Populated line, determine base/setup price: + if (preg_match('/==/',$marr[$ii])) { # Use custom prices - $marrp = explode("==", $marr[$ii]); - $tarr[] = Array ('name' => @$marrp[0], 'base' => @$marrp[1], 'setup' => @$marrp[2]); + $marrp = explode('==',$marr[$ii]); + $tarr[] = array('name'=>@$marrp[0],'base'=>@$marrp[1],'setup'=>@$marrp[2]); + } else { # Use default prices - $tarr[] = Array ('name' => $marr[$ii], 'base' => $ret['base'], 'setup' => $ret['setup']); + $tarr[] = array('name'=>$marr[$ii],'base'=>$ret['base'],'setup'=>$ret['setup']); } } } - $this->attr[$i]["default"] = $tarr; + + $this->attr[$i]['default'] = $tarr; } - $this->attr[$i]["price_base"] = $ret["base"]; - $this->attr[$i]["price_setup"] = $ret["setup"]; $result->MoveNext(); $i++; } + return true; } +/** HERE **/ /** * Calculate the cost for the attributes in the cart * @@ -164,44 +214,50 @@ class product * @param int $recurr_schedule The recurring schedule, 0-5 * @param int $account The account id * @param bool $prorate Apply prorating or not - * @return unknown + * @return array */ - function price_attr($fields, $cart_attr, $recurr_schedule, $account=SESS_ACCOUNT, $prorate=true) - { + function price_attr($fields,$cart_attr,$recurr_schedule,$account=SESS_ACCOUNT,$prorate=true) { global $C_auth; + $ret['base'] = 0; $ret['setup'] = 0; $product_id = $fields['id']; - + # Get the vars: - if(!empty($cart_attr) && !is_array($cart_attr)) $cart_attr = unserialize($cart_attr); - if(!is_array($cart_attr)) return false; - - # get the attributes for this product - $db = &DB(); - $result = $db->Execute(sqlSelect($db, "product_attr", "*","product_id=::$product_id::","sort_order")); - if(!$result || $result->RecordCount() == 0) { - $this->attr = false; + if (! empty($cart_attr) && ! is_array($cart_attr)) + $cart_attr = unserialize($cart_attr); + if (! is_array($cart_attr)) + return false; + + # Get the attributes for this product + $db = &DB(); + $result = $db->Execute(sqlSelect($db,'product_attr','*',sprintf('product_id=::%s::',$product_id),'sort_order')); + if (!$result || $result->RecordCount() == 0) { + $this->attr = false; + return false; } - # loop through each attribute to get the values & validate the input: - $i=0; - while( !$result->EOF ) { + # Loop through each attribute to get the values & validate the input + $i = 0; + while (! $result->EOF) { $calc = false; - reset($cart_attr); - # loop through each attribute defined in the cart - foreach($cart_attr as $id=>$val) { - $menu_def = true; - # if defined in the cart: - if(!empty($val) && is_numeric($id) && $id == $result->fields["id"]) { - # get the best base & setup price - $g_ar = unserialize($result->fields["price_group"]); - $curr['base'] = $result->fields["price_base"]; - $curr['setup'] = $result->fields["price_setup"]; - ### if menu, get the base & setup amount from the selected item: - if($result->fields["collect_type"] == '2') { - $marr = explode("\r\n",$result->fields["collect_default"]); + reset($cart_attr); + + # Loop through each attribute defined in the cart + foreach ($cart_attr as $id=>$val) { + $menu_def = true; + + # If defined in the cart: + if (! empty($val) && is_numeric($id) && $id == $result->fields['id']) { + # Get the best base & setup price + $g_ar = unserialize($result->fields['price_group']); + $curr['base'] = $result->fields['price_base']; + $curr['setup'] = $result->fields['price_setup']; + + # If menu, get the base & setup amount from the selected item: + if ($result->fields['collect_type'] == '2') { + $marr = explode("\r\n",$result->fields['collect_default']); # Loop through each menu option for($ii=0;$iiattr[$i]["default"] = $tarr; - } + $this->attr[$i]['default'] = $tarr; + } - ### determine best group pricing + # Determine best group pricing if($menu_def) { if($curr['base'] > 0 || $curr['setup'] > 0) { if(count($g_ar) > 0) { @@ -228,11 +284,11 @@ class product // check if better pricing exist for current group if (is_numeric($group) && $C_auth->auth_group_by_account_id($account, $group)) { // calculate the base price - if($vals["price_base"] != "" && $vals["price_base"] < $curr['base']) @$ret['base'] += $vals["price_base"]; - else @$ret['base'] += $curr["base"]; + if($vals['price_base'] != '' && $vals['price_base'] < $curr['base']) @$ret['base'] += $vals['price_base']; + else @$ret['base'] += $curr['base']; // calculate the setup price - if($vals["price_setup"] != "" && $vals["price_setup"] < $curr['setup']) @$ret['setup'] += $vals["price_setup"]; - else @$ret['setup'] += $curr["setup"]; + if($vals['price_setup'] != '' && $vals['price_setup'] < $curr['setup']) @$ret['setup'] += $vals['price_setup']; + else @$ret['setup'] += $curr['setup']; $idx++; } } @@ -244,86 +300,130 @@ class product $result->MoveNext(); $i++; } - - # check the subscription schedule and calculate actual rate for this schedule: - $arr = Array(.23, 1, 3, 6, 12, 24, 36); - if($fields["price_recurr_type"] == 1) - $ret['base'] *= $arr[$recurr_schedule]; - - # check for any prorating for the selected schedule: - if($fields["price_recurr_type"] == 1 && $prorate==true) - $prorate = $this->prorate($recurr_schedule, $fields["price_recurr_weekday"], $fields["price_recurr_week"]); - - # calculate the prorated recurring amount: - if (@$prorate > 0 && $ret["base"] > 0) $ret["base"] *= $prorate; - return Array('base' => @round($ret["base"], 2), 'setup' => @$ret["setup"]); + # check the subscription schedule and calculate actual rate for this schedule: + $arr = array(.23, 1, 3, 6, 12, 24, 36); + if($fields['price_recurr_type'] == 1) + $ret['base'] *= $arr[$recurr_schedule]; + + # check for any prorating for the selected schedule: + if($fields['price_recurr_type'] == 1 && $prorate==true) + $prorate = $this->prorate($recurr_schedule, $fields['price_recurr_weekday'], $fields['price_recurr_week']); + + # calculate the prorated recurring amount: + if (@$prorate > 0 && $ret['base'] > 0) $ret['base'] *= $prorate; + + return array('base' => @round($ret['base'],2), 'setup' => @$ret['setup']); } - + /** - * Get the start & end of set billing schedules + * Get the start & end of set billing schedules * - * @param int $type - * @param int $weekday - * @param int $week - * @return float + * @param int $type Type of Recur + * @param int $weekday Day of Month for fixed billing + * @param int $week Unused + * @return array */ - function recurrDates($type, $weekday, $week) { - if ($type == 0) { - $period_start = time(); - $period_end = $period_start + (86400*7); - return Array('start' => $period_start, 'end' => $period_end); - } elseif ($type == 1) { - $inc_months = 1; - } elseif ($type == 2) { - $inc_months = 3; - } elseif ($type == 3) { - $inc_months = 6; - } elseif ($type == 4) { - $inc_months = 12; - } elseif ($type == 5) { - $inc_months = 24; - } else { - return false; - } - $d = mktime(0, 0 ,0 ,date('m', time()), $weekday, date('y', time())); - if($d < time()) - $period_start = $d; + public function recurrDates($type,$weekday,$week,$period_date=false) { + # Make the period consistent, eg: Quarterly = Jan-Mar,Apr-Jun; HalfYearly = Jan-Jun,Jul-Dec + $strict = false; + $used_months = 0; + + if (! $period_date) + $period_date = strtotime('today'); + + switch ($type) { + # Weekly + case 0: + $period_end = $period_date+(86400*7); + return array('start'=>$period_date,'date'=>$period_date,'end'=>$period_end); + + # Monthly + case 1: + $inc_months = 1; + break; + + # Quarterly + case 2: + # @todo Make this configurable. + $strict = true; + $inc_months = 3; + break; + + # Half Yearly + case 3: + # @todo Make this configurable. + $strict = true; + $inc_months = 6; + break; + + # Yearly + case 4: + $inc_months = 12; + break; + + # Biennial + case 5: + $inc_months = 24; + break; + + # Triennial + case 6: + $inc_months = 36; + break; + + default: + return false; + } + + if ($strict && $type > 0 && $type < 5) + $used_months = $inc_months-(($inc_months-(date('n',$period_date)%$inc_months))%$inc_months+1); + + $d = mktime(0,0,0,date('m',$period_date)-$used_months,$weekday,date('y',$period_date)); + if ($d <= $period_date) + $period_start = $d; else - $period_start = mktime(0,0,0,date('m', $d)-1, $weekday, date('y', $d)); - $period_end = mktime(0,0,0,date('m', $period_start)+$inc_months, $weekday, date('y', $period_start)); - return Array('start' => $period_start, 'end' => $period_end); + $period_start = mktime(0,0,0,date('m',$d)-1-$used_months,$weekday,date('y',$d)); + + $period_end = mktime(0,0,0,date('m',$period_start)+$inc_months,$weekday,date('y',$period_start)); + + return array('start'=>$period_start,'date'=>$period_date,'end' => $period_end); } - + /** - * Determine Prorate Amount + * Determine Prorate Amount * * @param int $type * @param int $weekday * @param int $week * @return float */ - function prorate($type, $weekday, $week) - { - $arr = $this->recurrDates($type, $weekday, $week); - if(!$arr) return 0; - $total_time = $arr['end'] - $arr['start']; - $remain_time = $arr['end'] - time(); + private function prorate($type,$weekday,$week,$period_start=false) { + $arr = $this->recurrDates($type,$weekday,$week,$period_start); + + if (!$arr) + return 0; + + $total_time = $arr['end']-$arr['start']; + $remain_time = $arr['end']-$arr['date']; $percent_remain = ($remain_time/$total_time) ; - return round($percent_remain,2); + + return round($percent_remain,4); } - + /** * Get the lowest price for one-time or recurring product fees * - * @param array $fields Array containing all product fields + * @param array $fields array containing all product fields */ function price_arr($fields) { global $C_auth; - if(empty($this->account_id)) $this->account_id = SESS_ACCOUNT; + + if (empty($this->account_id)) $this->account_id = SESS_ACCOUNT; $type = $fields['price_type']; $g_ar = unserialize($fields["price_group"]); +//echo '
    '.__METHOD__;print_r($fields);die();
     		if($type != "1")
     		{
     			# get the best base price (trial or one-time charges):
    @@ -378,6 +478,7 @@ class product
     				}
     			}
     		}
    +
     		$this->price = $ret;
     	}
     
    @@ -387,12 +488,14 @@ class product
     	 * @param int $group Group ID
     	 * @return bool
     	 */
    -	function group_pricing($group) {
    +	private function group_pricing($group) {
     		$db = &DB();
    -		$rs = $db->Execute(sqlSelect($db,"group","pricing","id=$group"));
    -		if($rs && $rs->fields['pricing']==1) return true;
    +		$rs = $db->Execute(sqlSelect($db,'group','pricing',sprintf('id=%s',$group)));
    +
    +		if ($rs && $rs->fields['pricing']==1)
    +			return true;
     	}
    -	
    +
     	/**
     	 * Best Price for Product
     	 *
    @@ -402,60 +505,59 @@ class product
     	 * @param bool $prorate
     	 * @return array
     	 */
    -	function price_prod($fields, $recurr_schedule, $account=SESS_ACCOUNT, $prorate=true) {
    -		global $C_auth;
    -		$type = $fields['price_type'];
    -		@$g_ar = unserialize($fields["price_group"]);
    -		if($type != "1") {
    -			# get the best base price (trial or one-time charges)
    -			$ret['base']  = $fields["price_base"];
    -			$ret['setup'] = $fields["price_setup"]; 
    -			if(is_array($g_ar) && count($g_ar) > 0 ) {
    -				while (list ($group, $vals) = each ($g_ar)) {
    +	function price_prod($fields,$recurr_schedule,$account=SESS_ACCOUNT,$prorate=true) {
    +		switch ($fields['price_type']) {
    +			# Recurring charge, return best base/setup rates for all available payment schedules
    +			case 1:
    +				# Check for any prorating for the selected schedule:
    +				if ($fields['price_recurr_type'] == 1 && $prorate==true)
    +					$prorate = $this->prorate($recurr_schedule,$fields['price_recurr_weekday'],$fields['price_recurr_week']);
    +
    +				$ret = $this->best_price($fields,$account,$recurr_schedule,true);
    +
    +				if (! count($ret))
    +					return false;
    +
    +				# Calculate the prorated recurring amount:
    +				if ($prorate > 0 && $ret['base'] > 0)
    +					$ret['base'] *= $prorate;
    +
    +				break;
    +
    +			# Get the best base price (trial or one-time charges)
    +			# @todo - need to optimise (call best_price())
    +			default:
    +				global $C_auth;
    +
    +				@$g_ar = unserialize($fields['price_group']);
    +				if (! is_array($g_ar) || ! count($g_ar))
    +					return false;
    +
    +				$ret['base']  = $fields['price_base'];
    +				$ret['setup'] = $fields['price_setup'];
    +
    +				while (list($group,$vals) = each($g_ar)) {
     					if (is_numeric($group) && $C_auth->auth_group_by_account_id($account,$group)) {
    -						if($this->group_pricing($group)) {
    -							if($vals["price_base"] != "" && $vals["price_base"] < $ret['base']) $ret['base']= $vals["price_base"];
    -							if($vals["price_setup"] != "" && $vals["price_setup"] <  $ret['setup']) $ret['setup'] = $vals["price_setup"];
    +						if ($this->group_pricing($group)) {
    +							if ($vals['price_base'] != '' && $vals['price_base'] < $ret['base'])
    +								$ret['base']= $vals['price_base'];
    +							if ($vals['price_setup'] != '' && $vals['price_setup'] <  $ret['setup'])
    +								$ret['setup'] = $vals['price_setup'];
     						}
     					}
     				}
    -			}
    -			return Array('base' => $ret["base"], 'setup' => $ret["setup"]);
    -		} else {
    -			## Recurring charge, return best base/setup rates for all available payment schedules
    -			if(is_array($g_ar) && count($g_ar) > 0) {
    -				$i = $recurr_schedule; 
    -				# check for any prorating for the selected schedule:
    -				if($fields["price_recurr_type"] == 1 && $prorate==true)
    -				$prorate = $this->prorate($recurr_schedule, $fields["price_recurr_weekday"], $fields["price_recurr_week"]); 
    -				while (list ($group, $vals) = each ($g_ar[$i])) {
    -					if($g_ar[$i]["show"] == "1") {
    -						if (is_numeric($group) && $C_auth->auth_group_by_account_id($account, $group)) {
    -							if($this->group_pricing($group)) {
    -								if($vals["price_base"] != "")
    -								if(empty($ret['base']) || $vals["price_base"] < $ret['base']) $ret['base'] = $vals["price_base"];
    -								if($vals["price_setup"] != "")
    -									if(empty($ret['setup']) || $vals["price_setup"] < $ret['setup'])
    -										$ret['setup'] = $vals["price_setup"];
    -							}
    -						}
    -					}
    -				}
    -			}
    -			if(empty($ret)) return false; 
    -			
    -			# calculate the prorated recurring amount:
    -			if (@$prorate > 0 && $ret["base"] > 0)  $ret["base"] *= $prorate;
    +
     		}
    -		return Array('base' => @round($ret["base"], 2), 'setup' => @$ret["setup"]);
    +
    +		return array('base'=>round($ret['base'],2),'setup'=>$ret['setup']);
     	}
    -	
    +
     	/**
     	 * Get the lowest (recurring) price
     	 *
     	 * @param array $fields
     	 * @param int $account
    -	 * @return array Recurring Price 
    +	 * @return array Recurring Price
     	 */
     	function price_recurr_arr($fields, $account) {
     		global $C_auth;
    @@ -464,7 +566,7 @@ class product
     			for($i=0; $iauth_group_by_account_id($account,$group)) { 
    +						if (is_numeric($group) && $C_auth->auth_group_by_account_id($account,$group)) {
     							if($vals["price_base"] != "")
     								if(empty($ret[$i]['base']) || $vals["price_base"] < $ret[$i]['base']) $ret[$i]['base'] = $vals["price_base"];
     
    @@ -477,9 +579,9 @@ class product
     		}
     		return $ret;
     	}
    -	
    -	/** 
    -	 * Clone Existing Product 
    +
    +	/**
    +	 * Clone Existing Product
     	 */
     	function cloner($VAR)
     	{
    @@ -504,8 +606,8 @@ class product
     		# Clone product
     		$new_prod_id = $db->GenID(AGILE_DB_PREFIX.'product_id');
     		$sql = "INSERT INTO {$p}product SET
    -    				id  = $new_prod_id, 
    -    				sku = " . $db->qstr($sku); 
    +    				id  = $new_prod_id,
    +    				sku = " . $db->qstr($sku);
     		while(list($field,$value) = each($result->fields)) {
     			if($field != 'sku' && $field != 'id' && !is_numeric($field) )
     			$sql .= ",$field = ".$db->qstr($value);
    @@ -521,8 +623,8 @@ class product
     		{
     			$id = $db->GenID(AGILE_DB_PREFIX.'product_translate_id');
     			$sql = "INSERT INTO {$p}product_translate SET
    -	    				id  = $id, 
    -	    				product_id = $new_prod_id"; 
    +	    				id  = $id,
    +	    				product_id = $new_prod_id";
     			while(list($field,$value) = each($result->fields)) {
     				if($field != 'product_id' && $field != 'id' && !is_numeric($field)  )
     				$sql .= ",$field = ".$db->qstr($value);
    @@ -540,8 +642,8 @@ class product
     		{
     			$id = $db->GenID(AGILE_DB_PREFIX.'product_attr_id');
     			$sql = "INSERT INTO {$p}product_attr SET
    -	    				id  = $id, 
    -	    				product_id = $new_prod_id"; 
    +	    				id  = $id,
    +	    				product_id = $new_prod_id";
     			while(list($field,$value) = each($result->fields)) {
     				if($field != 'product_id' && $field != 'id' && !is_numeric($field) )
     				$sql .= ",$field = ".$db->qstr($value);
    @@ -596,9 +698,9 @@ class product
     		}
     
     		# Defaults for product groups:
    -		$VAR['product_group_avail'] = Array('0');
    +		$VAR['product_group_avail'] = array('0');
     
    -		$this->product_construct();
    +#		$this->product_construct();
     		$type 		= "add";
     		$this->method["$type"] = explode(",", $this->method["$type"]);
     		$db 		= new CORE_database;
    @@ -620,17 +722,9 @@ class product
     		}
     	}
     
    -	function view($VAR) {
    -		$this->product_construct();
    -		$type = "view";
    -		$this->method["$type"] = explode(",", $this->method["$type"]);
    -		$db = new CORE_database;
    -		$db->view($VAR, $this, $type);
    -	}
    -
     	function update($VAR) {
     		global $_FILES;
    -		$imgarr = Array('jpeg','jpg','gif','bmp','tif','tiff','png');
    +		$imgarr = array('jpeg','jpg','gif','bmp','tif','tiff','png');
     		if(isset($_FILES['upload_file1']) && $_FILES['upload_file1']['size'] > 0)
     		{
     			for($i=0; $iproduct_construct();
    +#		$this->product_construct();
     		$type = "update";
     		$this->method["$type"] = explode(",", $this->method["$type"]);
     		$db = new CORE_database;
    @@ -667,54 +761,14 @@ class product
     
     	function delete($VAR) {
     		$this->associated_DELETE =
    -		Array (
    -		Array ( 'table' => 'product_translate', 'field' => 'product_id'),
    -		Array ( 'table' => 'product_attr', 		'field' => 'product_id'),
    -		Array ( 'table' => 'product_img', 		'field' => 'product_id')
    +		array(
    +		array( 'table' => 'product_translate', 'field' => 'product_id'),
    +		array( 'table' => 'product_attr', 		'field' => 'product_id'),
    +		array( 'table' => 'product_img', 		'field' => 'product_id')
     		);
    -		$this->product_construct();
    +#		$this->product_construct();
     		$db = new CORE_database;
     		$db->mass_delete($VAR, $this, "");
     	}
    -
    -	function search_form($VAR) {
    -		$this->product_construct();
    -		$type = "search";
    -		$this->method["$type"] = explode(",", $this->method["$type"]);
    -		$db = new CORE_database;
    -		$db->search_form($VAR, $this, $type);
    -	}
    -
    -	function search($VAR)
    -	{
    -		$this->product_construct();
    -		$type = "search";
    -		$this->method["$type"] = explode(",", $this->method["$type"]);
    -		$db = new CORE_database;
    -		$db->search($VAR, $this, $type);
    -	}
    -
    -	function search_show($VAR) {
    -		$this->product_construct();
    -		$type = "search";
    -		$this->method["$type"] = explode(",", $this->method["$type"]);
    -		$db = new CORE_database;
    -		$db->search_show($VAR, $this, $type);
    -	}
    -	
    -	function product_construct() {
    -		$this->module = "product";
    -		$this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml";
    -		$C_xml 			= new CORE_xml;
    -		$construct 		= $C_xml->xml_to_array($this->xml_construct);
    -		$this->method   = $construct["construct"]["method"];
    -		$this->trigger  = $construct["construct"]["trigger"];
    -		$this->field    = $construct["construct"]["field"];
    -		$this->table 	= $construct["construct"]["table"];
    -		$this->module 	= $construct["construct"]["module"];
    -		$this->cache	= $construct["construct"]["cache"];
    -		$this->order_by = $construct["construct"]["order_by"];
    -		$this->limit	= $construct["construct"]["limit"];
    -	}
     }
    -?>
    \ No newline at end of file
    +?>
    diff --git a/modules/product/product_construct.xml b/modules/product/product_construct.xml
    index fd29405b..591a031f 100644
    --- a/modules/product/product_construct.xml
    +++ b/modules/product/product_construct.xml
    @@ -1,204 +1,258 @@
     
     
    -    
    -    product
    -    
    -    product
    - - - - 0 - - sku - - 25 - - - sku - active - - - - - I4 - 1 - 1 - - - I4 - 1 - - - I8 - date-time - - - I8 - date-now - - - C(32) - 1 - 1 - 32 - alphanumeric - - - L - - - L - - - I4 - - - L - - - X2 - any - array - 1 - - - C(255) - any - array - 1 - - - L - - - I4 - - - X2 - array - - - L - - - L - - - X2 - array - - - F - - - L - - - F - - - I4 - - - F - 1 - 32 - float - - - F - - - X2 - array - - - I4 - - - L - - - I4 - - - I4 - - - L - - - L - - - I4 - - - I4 - - - I4 - product - sku - - - X2 - product - sku - array - - - I4 - - - X2 - product - sku - array - 1 - - - X2 - array - - - I4 - - - I4 - - - C(128) - - - L - - - C(128) - - - X2 - array - - - L - - - L - - - X2 - array - - - - - id,site_id,date_orig,date_last,sku,taxable,active,group_avail,position,cart_multiple,avail_category_id,discount,discount_amount,price_type,price_base,price_setup,price_group,price_recurr_type,price_recurr_weekday,price_recurr_week,price_recurr_schedule,price_recurr_cancel,price_trial_length_type,price_trial_length,price_trial_prod,assoc_req_prod,assoc_req_prod_type,assoc_grant_prod,assoc_grant_group,assoc_grant_group_type,assoc_grant_group_days,thumbnail,price_recurr_default,price_recurr_modify,modify_waive_setup,modify_product_arr - id,site_id,date_orig,date_last,sku,taxable,active,group_avail,position,cart_multiple,avail_category_id,discount,discount_amount,price_type,price_base,price_setup,price_group,price_recurr_type,price_recurr_weekday,price_recurr_week,price_recurr_schedule,price_recurr_cancel,price_trial_length_type,price_trial_length,price_trial_prod,assoc_req_prod,assoc_req_prod_type,assoc_grant_prod,assoc_grant_group,assoc_grant_group_type,assoc_grant_group_days,thumbnail,price_recurr_default,host,host_server_id,host_provision_plugin_data,host_allow_domain,host_allow_host_only,host_discount_tld,host_discount_tld_amt,prod_plugin,prod_plugin_file,prod_plugin_data,price_recurr_modify,modify_waive_setup,modify_product_arr - id,site_id - id,site_id,date_orig,date_last,sku,taxable,active,group_avail,position,cart_multiple,avail_category_id,discount,discount_amount,price_type,price_base,price_setup,price_group,price_recurr_type,price_recurr_weekday,price_recurr_week,price_recurr_schedule,price_recurr_cancel,price_trial_length_type,price_trial_length,price_trial_prod,assoc_req_prod,assoc_req_prod_type,assoc_grant_prod,assoc_grant_group,assoc_grant_group_type,assoc_grant_group_days,thumbnail,price_recurr_default,host,host_server_id,host_provision_plugin_data,host_allow_domain,host_allow_host_only,host_discount_tld,host_discount_tld_amt,prod_plugin,prod_plugin_file,prod_plugin_data,price_recurr_modify,modify_waive_setup,modify_product_arr - id,site_id,date_orig,date_last,sku,taxable,active,group_avail,position,cart_multiple,avail_category_id,price_type,price_recurr_schedule,price_recurr_cancel,price_base,price_setup - - - 0 + + product + + product
    + + + + 0 + + sku + + 25 + + 0 + + + + sku + active + + + + + + + 1 + I4 + 1 + + + + 1 + I4 + + + + date-now + Date Created + I8 + + + + date-now + Date Updated + I8 + + + C(32) + 1 + 1 + 32 + alphanumeric + SKU + + + L + + + + Status + L + + + I4 + + + L + + + X2 + any + array + 1 + + + C(255) + any + array + 1 + + + L + + + I4 + + + X2 + array + + + L + + + L + + + X2 + array + + + F + + + L + + + F + + + I4 + + + Base Price + F + 1 + 32 + float + + + F + + + X2 + array + + + Default Billing Schedule + I4 + + + + Recurring Billing Schedule + L + + + Day of Month to Bill + I4 + + + I4 + + + L + + + L + + + I4 + + + I4 + + + I4 + product + sku + + + X2 + product + sku + array + + + I4 + + + X2 + product + sku + array + 1 + + + X2 + array + + + I4 + + + I4 + + + Product Thumbnail + C(128) + + + L + + + C(128) + + + X2 + array + + + L + + + L + + + X2 + array + + + + + + id,site_id,date_orig,date_last,sku,taxable,active,group_avail,position,cart_multiple,avail_category_id,discount,discount_amount,price_type,price_base,price_setup,price_group,price_recurr_type,price_recurr_weekday,price_recurr_week,price_recurr_schedule,price_recurr_cancel,price_trial_length_type,price_trial_length,price_trial_prod,assoc_req_prod,assoc_req_prod_type,assoc_grant_prod,assoc_grant_group,assoc_grant_group_type,assoc_grant_group_days,thumbnail,price_recurr_default,price_recurr_modify,modify_waive_setup,modify_product_arr + id,site_id,date_orig,date_last,sku,taxable,active,group_avail,position,cart_multiple,avail_category_id,discount,discount_amount,price_type,price_base,price_setup,price_group,price_recurr_type,price_recurr_weekday,price_recurr_week,price_recurr_schedule,price_recurr_cancel,price_trial_length_type,price_trial_length,price_trial_prod,assoc_req_prod,assoc_req_prod_type,assoc_grant_prod,assoc_grant_group,assoc_grant_group_type,assoc_grant_group_days,thumbnail,price_recurr_default,host,host_server_id,host_provision_plugin_data,host_allow_domain,host_allow_host_only,host_discount_tld,host_discount_tld_amt,prod_plugin,prod_plugin_file,prod_plugin_data,price_recurr_modify,modify_waive_setup,modify_product_arr + id,site_id + id,site_id,date_orig,date_last,sku,taxable,active,group_avail,position,cart_multiple,avail_category_id,discount,discount_amount,price_type,price_base,price_setup,price_group,price_recurr_type,price_recurr_weekday,price_recurr_week,price_recurr_schedule,price_recurr_cancel,price_trial_length_type,price_trial_length,price_trial_prod,assoc_req_prod,assoc_req_prod_type,assoc_grant_prod,assoc_grant_group,assoc_grant_group_type,assoc_grant_group_days,thumbnail,price_recurr_default,host,host_server_id,host_provision_plugin_data,host_allow_domain,host_allow_host_only,host_discount_tld,host_discount_tld_amt,prod_plugin,prod_plugin_file,prod_plugin_data,price_recurr_modify,modify_waive_setup,modify_product_arr + id,site_id,date_orig,date_last,sku,taxable,active,group_avail,position,cart_multiple,avail_category_id,price_type,price_recurr_schedule,price_recurr_cancel,price_base,price_setup + + + + + + + + <view>Products</view> + + + + + + + id + checkbox + 25px + + + sku + + + price_base + + + active + 20px + + + description + 48% + + + 20px + + +
    diff --git a/modules/product/product_install.xml b/modules/product/product_install.xml index dbada672..fa6c8a25 100644 --- a/modules/product/product_install.xml +++ b/modules/product/product_install.xml @@ -1,45 +1,65 @@ + + - product - product - + + + + Products + 1 + + product + + + + product + + + + base - - - - search_show - - - search_form - - - search - - 1 - - - delete - - - view - - 1 - - - update - - - add - - 1 - - - admin_details - - - cloner - - - - \ No newline at end of file + + + + + Add + 1 + add + + + + delete + + + + List + 1 + search + + + + + search_form + + + + search_show + + + + update + + + + view + + + + admin_details + + + cloner + + + diff --git a/modules/product_attr/product_attr_construct.xml b/modules/product_attr/product_attr_construct.xml index a9fd3799..731fa777 100644 --- a/modules/product_attr/product_attr_construct.xml +++ b/modules/product_attr/product_attr_construct.xml @@ -1,80 +1,96 @@ - - product_attr - - product_attr
    - - product - - 0 - - sort_order,name - - 25 - - - product_id - collect_type - - - - - I4 - 1 - 1 - - - I4 - 1 - - - I4 - 1 - - - C(32) - 1 - 32 - any - - - C(255) - - - I4 - - - I4 - - - C(255) - - - L - - - F - 1 - 32 - float - - - F - - - X2 - array - - - - - id,site_id,name,description,sort_order,collect_type,collect_default,price_base,price_setup,price_group,product_id,required - id,site_id,name,description,sort_order,collect_type,collect_default,price_base,price_setup,price_group,product_id,required - id,site_id,name,description,sort_order,collect_type,collect_default,price_base,price_setup,price_group,product_id,required - id,site_id,name,description,sort_order,collect_type,collect_default,price_base,price_setup,price_group,product_id,required - id,site_id,name,sort_order,collect_type,collect_default,price_base,price_group,product_id,required - - - 0 + + product_attr + + product_attr
    + + product + + 0 + + sort_order,name + + 25 + + 0 + + + + product_id + collect_type + + + + + + + 1 + I4 + 1 + + + + 1 + I4 + + + I4 + 1 + + + C(32) + 1 + 32 + any + + + C(255) + + + I4 + + + I4 + + + C(255) + + + L + + + F + 1 + 32 + float + + + F + + + X2 + array + + + + + + id,site_id,name,description,sort_order,collect_type,collect_default,price_base,price_setup,price_group,product_id,required + id,site_id,name,description,sort_order,collect_type,collect_default,price_base,price_setup,price_group,product_id,required + id,site_id,name,description,sort_order,collect_type,collect_default,price_base,price_setup,price_group,product_id,required + id,site_id,name,description,sort_order,collect_type,collect_default,price_base,price_setup,price_group,product_id,required + id,site_id,name,sort_order,collect_type,collect_default,price_base,price_group,product_id,required + + + + + + + + + + + +
    diff --git a/modules/product_attr/product_attr_install.xml b/modules/product_attr/product_attr_install.xml index 855cdb65..6e413ed0 100644 --- a/modules/product_attr/product_attr_install.xml +++ b/modules/product_attr/product_attr_install.xml @@ -1,30 +1,55 @@ + + - product_attr - product - + product + + + + 0 + + product_attr + + + + product + + + + base - - - - search_show - - - search - - - view - - - delete - - - add - - - update - - - - \ No newline at end of file + + + + + add + + + + delete + + + + search + + + + + search_form + + + + search_show + + + + update + + + + view + + + + diff --git a/modules/product_cat/product_cat.inc.php b/modules/product_cat/product_cat.inc.php index 1a7db9ac..caae861b 100644 --- a/modules/product_cat/product_cat.inc.php +++ b/modules/product_cat/product_cat.inc.php @@ -1,612 +1,367 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Module:Product */ - -class product_cat -{ - # Open the constructor for this mod - function product_cat() - { - # name of this module: - $this->module = "product_cat"; +/** + * The main AgileBill Product Category Class + * + * @package AgileBill + * @subpackage Module:Product + */ +class product_cat extends OSB_module { + /** + * User Menu + * List the available categories + */ + public function user_menu($VAR) { + global $smarty,$C_auth; - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; + $db = &DB(); + $result = $db->Execute(sqlSelect($db,'product_cat','*','status=1 AND (parent_id=0 OR parent_id IS NULL OR parent_id=id)','position')); + $smart = array(); - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - - ############################## - ## USER CATEGORY ARR SMARTY ## - ############################## - function user_menu($VAR) - { - global $smarty, $C_auth; - $db = &DB(); - $dbc = new CORE_database; - $sql = $dbc->sql_select( "product_cat", "*", - "status = 1 AND (parent_id = 0 OR parent_id IS NULL OR parent_id = id)", "position", $db); - $result = $db->Execute($sql); - if($result->RecordCount() == 0) { + if ($result->RecordCount() == 0) { return false; - } else { - while(!$result->EOF) { - # check for group settings: + + } else { + while (! $result->EOF) { + # Check for group settings: $groups = unserialize($result->fields['group_avail']); $auth = false; - for($ii=0; $iiauth_group_by_id($groups[$ii])) $auth = true; + for ($ii=0; $iiauth_group_by_id($groups[$ii])) + $auth = true; } - if($auth) { - # Create the array for smarty - $smart[] = $result->fields; + if ($auth) { + # Create the array for smarty + array_push($smart,$result->fields); $i++; } - $result->MoveNext(); + + $result->MoveNext(); } - $smarty->assign('product_cat', $smart); - } + + $smarty->assign('product_cat',$smart); + } } + /** + * User view a category + */ + public function user_view($VAR) { + global $smarty,$C_auth; - ############################## - ## USER VIEW A CATEGORY ## - ############################## - function user_view($VAR) - { - global $smarty, $C_auth; - $db = &DB(); + $db = &DB(); - ### Get the category information: - $sql = sqlSelect($db, "product_cat", "id,position,template,name,thumbnail,group_avail,parent_id,max", "status = 1 AND id = ::{$VAR['id']}::"); - $result = $db->Execute($sql); + # Get the category information: + $result = $db->Execute(sqlSelect($db,'product_cat','id,position,template,name,thumbnail,group_avail,parent_id,max',array('status'=>1,'id'=>$VAR['id']))); - if(!$result || $result->RecordCount() == 0) { + if (! $result || $result->RecordCount() == 0) { return false; - } else { - # check for group settings: + } else { + # Check for group settings $groups = unserialize($result->fields['group_avail']); - # max results per page: - $max = $result->fields['max']; - if(empty($max)) $max = 25; - $count = 0; - if(empty($VAR['page']) || !is_numeric($VAR['page']) || $VAR['page'] <= 1 ) { - $page = 1; + # Max results per page: + $max = $result->fields['max']; + + if (empty($max)) + $max = 25; + + if (empty($VAR['page']) || ! is_numeric($VAR['page']) || $VAR['page'] <= 1) { + $page = 1; $start = 0; + } else { $page = $VAR['page']; $start = ($page-1)*$max; - } - - $auth = false; - for($ii=0; $iiauth_group_by_id($groups[$ii])) $auth = true; - } - - if($auth) { - $smart[] = $result->fields; - $smarty->assign('product_cat_arr', $smart); - } else { - return false; } - $parent_id = $result->fields['parent_id']; - if(!$parent_id) $parent_id = '0'; - } + $auth = false; + for ($ii=0; $iiauth_group_by_id($groups[$ii])) + $auth = true; + } - ### Get the items in this category: - $sql = sqlSelect($db, "product", "id,sku,thumbnail,avail_category_id,price_base,price_setup,group_avail", "active = 1", "position,sku"); - $result = $db->Execute($sql); - if(!$result || $result->RecordCount() == 0) { + if ($auth) + $smarty->assign('product_cat_arr',array($result->fields)); + else + return false; + + $parent_id = $result->fields['parent_id']; + if (! $parent_id) + $parent_id = '0'; + } + + # Get the items in this category: + $result = $db->Execute(sqlSelect($db,'product','id,sku,thumbnail,avail_category_id,price_base,price_setup,group_avail',array('active'=>1),'position,sku')); + if (! $result || $result->RecordCount() == 0) { return false; - } else { - while(!$result->EOF) { + + } else { + $count = 0; + $smart_prod = array(); + while (! $result->EOF) { # check that this item can be displayed in the current category: - $cat = false; - $cats = unserialize($result->fields['avail_category_id']); - for($i=0; $ifields['avail_category_id']); + for ($i=0; $ifields['group_avail']); $auth = false; - for($ii=0; $iiauth_group_by_id($groups[$ii])) { + for ($ii=0; $iiauth_group_by_id($groups[$ii])) { $auth = true; break; } - } + } - ### Paging - if($auth) { - if($count >= $start && $count < $max*$page) - $smart_prod[] = $result->fields; + # Paging + if ($auth) { + if ($count >= $start && $count < $max*$page) + array_push($smart_prod,$result->fields); $count++; } } $result->MoveNext(); - } + } $results = $count; - $pages = intval($results / $max); - if ($results % $max) $pages++; + $pages = intval($results / $max); + if ($results % $max) + $pages++; - for($i=1;$i<=$pages;$i++) $pagearr[$i] = $i; + for ($i=1;$i<=$pages;$i++) + $pagearr[$i] = $i; - $smarty->assign('product_arr', $smart_prod); - $smarty->assign('page_page', $page); - $smarty->assign('page_results', $results); - $smarty->assign('page_pages', $pages); - $smarty->assign('page_arr', $pagearr); + $smarty->assign('product_arr',$smart_prod); + $smarty->assign('page_page',$page); + $smarty->assign('page_results',$results); + $smarty->assign('page_pages',$pages); + $smarty->assign('page_arr',$pagearr); } - ### Get any sub-categories: - $sql = sqlSelect($db, "product_cat", "*", "status = 1 AND parent_id = ::{$VAR['id']}::","position,name"); - $result = $db->Execute($sql); - if($result && $result->RecordCount()) { - while(!$result->EOF) { - $smart_sub_cat[] = $result->fields; + # Get any sub-categories: + $result = $db->Execute($q=sqlSelect($db,'product_cat','*',array('status'=>1,'parent_id'=>$VAR['id']),'position,name')); + $smart_sub_cat = array(); + + if ($result && $result->RecordCount()) { + while (! $result->EOF) { + array_push($smart_sub_cat,$result->fields); $result->MoveNext(); } - $smarty->assign('product_sub_cat', $smart_sub_cat); - } - ### Get any parent categores: - $p = AGILE_DB_PREFIX; - $d = DEFAULT_SITE; - $smart_parent_cat = Array(); - for($i=0; $i<=5; $i++) - { - if($parent_id > 0 ) - { + $smarty->assign('product_sub_cat',$smart_sub_cat); + } + + # Get any parent categores: + $smart_parent_cat = array(); + for ($i=0; $i<=5; $i++) { + if ($parent_id > 0 ) { # Get parent id & add to array - $sql = "SELECT - {$p}product_cat.id, - {$p}product_cat.parent_id, - {$p}product_cat.template, - {$p}product_cat_translate.name - FROM - {$p}product_cat,{$p}product_cat_translate - WHERE - {$p}product_cat.site_id = {$d} - AND - {$p}product_cat_translate.site_id = {$d} - AND - {$p}product_cat.id = $parent_id - AND - {$p}product_cat_translate.product_cat_id = $parent_id - AND - {$p}product_cat_translate.language_id = '".SESS_LANGUAGE."'"; - $result = $db->Execute($sql); - if($result && $result->RecordCount()) - { - $parent_id = $result->fields['parent_id']; - $smart_parent_cat[] = $result->fields; + $result = $db->Execute(sqlSelect($db,array('product_cat','product_cat_translate'),'A.id,A.parent_id,A.template,B.name',array('A.id'=>$parent_id,'B.product_cat_id'=>$parent_id,'B.language_id'=>SESS_LANGUAGE))); + if ($result && $result->RecordCount()) { + $parent_id = $result->fields['parent_id']; + array_push($smart_parent_cat,$result->fields); } - } + } } $smart_parent_cat = array_reverse($smart_parent_cat); - ## Get the current category: - $sql = "SELECT - {$p}product_cat.id, - {$p}product_cat.parent_id, - {$p}product_cat.template, - {$p}product_cat_translate.name - FROM - {$p}product_cat,{$p}product_cat_translate - WHERE - {$p}product_cat.site_id = {$d} - AND - {$p}product_cat_translate.site_id = {$d} - AND - {$p}product_cat.id = ".$db->qstr($VAR['id'])." - AND - {$p}product_cat_translate.product_cat_id = ".$db->qstr($VAR['id'])." - AND - {$p}product_cat_translate.language_id = '".SESS_LANGUAGE."'"; - $result = $db->Execute($sql); - if($result && $result->RecordCount()) - $smart_parent_cat[] = $result->fields; - - $smarty->assign('parent_cat', $smart_parent_cat); + # Get the current category: + $result = $db->Execute(sqlSelect($db,array('product_cat','product_cat_translate'),'A.id,A.parent_id,A.template,B.name',array('A.id'=>$VAR['id'],'B.product_cat_id'=>$VAR['id'],'B.language_id'=>SESS_LANGUAGE))); + if ($result && $result->RecordCount()) + $smart_parent_cat[] = $result->fields; + $smarty->assign('parent_cat',$smart_parent_cat); } + /** + * This function will build a nested option list + * showing the heirachy of the product categories + * + * @see tpl_admin_menu_parent + */ + private function build_nested_option_list($arr,$start,$level,$current) { + $option = ''; + for ($i=0; $isql_select( "product_cat", "*", "", "parent_id,position,name", $db); - $result = $db->Execute($sql); + if ($id == $current || $arr[$start][$i]['sel']) + $sel = ' selected="selected"'; + else + $sel = ''; - # Get current id - if(!empty($VAR['id'])) { - $cid = ereg_replace(",","", $VAR['id']); - } else { - $current = ''; + if ($level == 0) + $option .= sprintf('',$id,$sel,$arr[$start][$i]['name']); + else + $option .= sprintf('',$id,$sel,str_repeat(' ',$level-1),$arr[$start][$i]['name']); + + if (isset($arr[$id])) + $option .= $this->build_nested_option_list($arr,$id,$level+1,$current); } + return $option; + } + + /** + * Select a parent for a category + */ + public function tpl_admin_menu_parent($VAR) { + global $smarty,$C_auth; + + $db = &DB(); + + # Get current id + if (! empty($VAR['id'])) + $cid = str_replace(',','',$VAR['id']); + else + $current = ''; + # Loop and put in array - while(!$result->EOF) { - if($result->fields['parent_id'] == "" || $result->fields['parent_id'] == 0 || $result->fields['parent_id'] == $result->fields['id']) { + $result = $db->Execute(sqlSelect($db,'product_cat','*','','parent_id,position,name')); + + while (! $result->EOF) { + if ($result->fields['parent_id'] == '' || $result->fields['parent_id'] == 0 || $result->fields['parent_id'] == $result->fields['id']) $arr[0][] = $result->fields; - } else { - $arr["{$result->fields['parent_id']}"][] = $result->fields; - } + else + $arr[$result->fields['parent_id']][] = $result->fields; # get current parent_id - if($cid > 0 && $result->fields['id'] == $cid) + if ($cid > 0 && $result->fields['id'] == $cid) $current = $result->fields['parent_id']; $result->MoveNext(); - } - - # Create menu - $option = ''; - - for($i=0; $i'.$arr[0][$i]["name"].''; - - ########################## - # get the sub-categories # (LEVEL 2) - if(isset($arr[$id])) - { - for($ii=0; $ii-  '.$arr[$id][$ii]["name"].''; - } - - ########################## - # get the sub-categories # (LEVEL 3) - if(isset($arr[$idx])) - { - for($iii=0; $iii  -  '.$arr[$idx][$iii]["name"].''; - } - - ########################## - # get the sub-categories # (LEVEL 4) - if(isset($arr[$idx2])) - { - for($iiii=0; $iiii    -  '.$arr[$idx2][$iiii]["name"].''; - } - - ########################## - # get the sub-categories # (LEVEL 5) - if(isset($arr[$idx3])) - { - for($iiiii=0; $iiiii      -  '.$arr[$idx3][$iiiii]["name"].''; - } - } - } - } - } } + # Create menu echo ''; + echo ''; + echo $this->build_nested_option_list($arr,0,0,$current); + echo ''; } + /** + * Select a product category for a product + */ + public function tpl_admin_menu_product($VAR) { + global $smarty,$C_auth; - ############################## - ## ADMIN MULTI SELECT MENU ## - ############################## - function admin_menu_product($VAR) - { - global $smarty, $C_auth; - $db = &DB(); - $dbc = new CORE_database; + $db = &DB(); + $dbc = new CORE_database; # Get current category id - if(!empty($VAR['id'])) { - $product_id = ereg_replace(",","", $VAR['id']); - $sql = $dbc->sql_select("product", "avail_category_id", "id = $product_id","", $db); - $product = $db->Execute($sql); + if (! empty($VAR['id'])) { + $product_id = str_replace(',','',$VAR['id']); + $product = $db->Execute(sqlSelect($db,'product','avail_category_id',array('id'=>$product_id))); $current = unserialize($product->fields['avail_category_id']); + } else { $current = ''; } # Loop and put in array - $sql = $dbc->sql_select( "product_cat", "*", "", "parent_id,position,name", $db); - $result = $db->Execute($sql); - while(!$result->EOF) - { - # determine if selected + $result = $db->Execute(sqlSelect($db,'product_cat','*','','parent_id,position,name')); + + while (! $result->EOF) { + # Determine if selected $select = false; - for($ix=0; $ixfields['id']) { + for ($ix=0; $ixfields['id']) { $result->fields['sel'] = 'selected'; break; } - } + } - # set array - if($result->fields['parent_id'] == "" || $result->fields['parent_id'] == 0 || $result->fields['parent_id'] == $result->fields['id']) { - $arr[0][] = $result->fields; - } else { - $arr["{$result->fields['parent_id']}"][] = $result->fields; - } + # set array + if ($result->fields['parent_id'] == '' || $result->fields['parent_id'] == 0 || $result->fields['parent_id'] == $result->fields['id']) + $arr[0][] = $result->fields; + else + $arr[$result->fields['parent_id']][] = $result->fields; $result->MoveNext(); - } + } # Create menu - $option = ''; + echo ''; + } - for($i=0; $i'.$arr[0][$i]["name"].''; - - ########################## - # get the sub-categories # (LEVEL 2) - if(isset($arr[$id])) - { - for($ii=0; $ii-  '.$arr[$id][$ii]["name"].''; - } - - ########################## - # get the sub-categories # (LEVEL 3) - if(isset($arr[$idx])) - { - for($iii=0; $iii  -  '.$arr[$idx][$iii]["name"].''; - } - - ########################## - # get the sub-categories # (LEVEL 4) - if(isset($arr[$idx2])) - { - for($iiii=0; $iiii    -  '.$arr[$idx2][$iiii]["name"].''; - } - - ########################## - # get the sub-categories # (LEVEL 5) - if(isset($arr[$idx3])) - { - for($iiiii=0; $iiiii      -  '.$arr[$idx3][$iiiii]["name"].''; - } - } - } - } - } - } - - echo ''; - } - - - - ############################## - ## ADD ## - ############################## - function add($VAR) - { + /** + * Update an entry + */ + public function update($VAR) { global $_FILES; - #################################################################### - ### Validate the thumbnail upoad: - if(isset($_FILES['upload_file1']) && $_FILES['upload_file1']['size'] > 0) - { - $VAR['product_cat_thumbnail'] = "cat_thmb_".$_FILES['upload_file1']['name']; + # Validate the thumbnail upload + if (isset($_FILES['upload_file1']) && $_FILES['upload_file1']['size'] > 0) + $VAR['product_cat_thumbnail'] = sprintf('cat_thmb_%s',$_FILES['upload_file1']['name']); + elseif ($VAR['delthumb'] == 1) + $VAR['product_cat_thumbnail'] = ''; + + # Validate the image upload + if (isset($_FILES['upload_file2']) && $_FILES['upload_file2']['size'] > 0) + $VAR['product_cat_image'] = sprintf('cat_img_%s',$_FILES['upload_file2']['name']); + elseif ( $VAR['delimg'] == 1 ) + $VAR['product_cat_image'] = ''; + + $result = parent::update($VAR); + + # Copy the image(s) + if ($result) { + # Copy 1ST file upload + if (isset($_FILES['upload_file1']) && $_FILES['upload_file1']['size'] > 0) + copy($_FILES['upload_file1']['tmp_name'],sprintf('%scat_thmb_%s',PATH_IMAGES,$_FILES['upload_file1']['name'])); + + # Copy the 2ND file upload + if (isset($_FILES['upload_file2']) && $_FILES['upload_file2']['size'] > 0) + copy($_FILES['upload_file2']['tmp_name'],sprintf('%scat_img_',PATH_IMAGES,$_FILES['upload_file2']['name'])); } - - ### Validate the image upoad: - if(isset($_FILES['upload_file2']) && $_FILES['upload_file2']['size'] > 0) - { - $VAR['product_cat_image'] = "cat_img_".$_FILES['upload_file2']['name']; - } - - - #################################################################### - ## Attempt to add the record: - - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $result = $db->add($VAR, $this, $type); - - - #################################################################### - ### Copy the image(s) - if($result) - { - ### Copy 1ST file upoad: - if(isset($_FILES['upload_file1']) && $_FILES['upload_file1']['size'] > 0) - copy($_FILES['upload_file1']['tmp_name'], PATH_IMAGES . "cat_thmb_" . $_FILES['upload_file1']['name']); - - ### Copy the 2ND file upoad: - if(isset($_FILES['upload_file2']) && $_FILES['upload_file2']['size'] > 0) - copy($_FILES['upload_file2']['tmp_name'], PATH_IMAGES . "cat_img_" . $_FILES['upload_file2']['name']); - } - } + /** + * Delete an Entry + */ + public function delete($VAR) { + $this->associated_DELETE = array(); + array_push($this->associated_DELETE,array('table' =>'product_cat_translate','field'=>'product_cat_id')); - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - global $_FILES; - - #################################################################### - ### Validate the thumbnail upoad: - if(isset($_FILES['upload_file1']) && $_FILES['upload_file1']['size'] > 0) - { - $VAR['product_cat_thumbnail'] = "cat_thmb_".$_FILES['upload_file1']['name']; - } elseif ( $VAR['delthumb'] == 1 ) { - $VAR['product_cat_thumbnail'] = ""; - } - - ### Validate the image upoad: - if(isset($_FILES['upload_file2']) && $_FILES['upload_file2']['size'] > 0) - { - $VAR['product_cat_image'] = "cat_img_".$_FILES['upload_file2']['name']; - } elseif ( $VAR['delimg'] == 1 ) { - $VAR['product_cat_image'] = ""; - } - - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $result = $db->update($VAR, $this, $type); - - #################################################################### - ### Copy the image(s) - if($result) - { - ### Copy 1ST file upoad: - if(isset($_FILES['upload_file1']) && $_FILES['upload_file1']['size'] > 0) - copy($_FILES['upload_file1']['tmp_name'], PATH_IMAGES . "cat_thmb_" . $_FILES['upload_file1']['name']); - - ### Copy the 2ND file upoad: - if(isset($_FILES['upload_file2']) && $_FILES['upload_file2']['size'] > 0) - copy($_FILES['upload_file2']['tmp_name'], PATH_IMAGES . "cat_img_" . $_FILES['upload_file2']['name']); - } + parent::delete($VAR); } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $this->associated_DELETE = - Array ( Array ( 'table' => 'product_cat_translate', 'field' => 'product_cat_id') ); - - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } } -?> \ No newline at end of file +?> diff --git a/modules/product_cat/product_cat_construct.xml b/modules/product_cat/product_cat_construct.xml index 377f31f4..9ba49da2 100644 --- a/modules/product_cat/product_cat_construct.xml +++ b/modules/product_cat/product_cat_construct.xml @@ -1,77 +1,122 @@ - - product_cat - - product_cat
    - - product - - 0 - - position - - 25 - - - status - position - name - - - - - I4 - 1 - - - I4 - - - I4 - - - X2 - array - any - - - C(32) - 2 - 32 - any - - - C(255) - - - L - - - - C(128) - - - C(128) - - - I4 - - - I4 - numeric - - - - - id,site_id,name,notes,status,template,thumbnail,image,position,max,group_avail,parent_id - id,site_id,name,notes,status,template,thumbnail,image,position,max,group_avail,parent_id - id,site_id,name,notes,status,template,thumbnail,image,position,max,group_avail,parent_id - id,site_id,name,notes,status,template,thumbnail,image,position,max,group_avail,parent_id - id,site_id,name,notes,status,template,thumbnail,image,position,max,group_avail,parent_id - - - 0 + + product_cat + + product_cat
    + + product + + 0 + + position + + 25 + + 0 + + + + status + position + name + + + + + + + 1 + I4 + 1 + + + + 1 + I4 + + + I4 + Parent + + + X2 + array + any + Available to Groups + + + C(32) + 2 + 32 + any + Category + + + C(255) + Notes + + + L + Active + + + + C(128) + Image Thumbnail + + + C(128) + Image + + + I4 + Position + + + I4 + numeric + Max Entries to Display + + + + + + id,site_id,name,notes,status,template,thumbnail,image,position,max,group_avail,parent_id + id,site_id,name,notes,status,template,thumbnail,image,position,max,group_avail,parent_id + id,site_id,name,notes,status,template,thumbnail,image,position,max,group_avail,parent_id + id,site_id,name,notes,status,template,thumbnail,image,position,max,group_avail,parent_id + id,site_id,name,notes,status,template,thumbnail,image,position,max,group_avail,parent_id + + + + + + + + <add>Add Product Category</add> + <view>Product Categories</view> + + + + + + + id + checkbox + 25px + + + name + + + status + bool + 20px + + +
    diff --git a/modules/product_cat/product_cat_install.xml b/modules/product_cat/product_cat_install.xml index de5650a5..13c5254a 100644 --- a/modules/product_cat/product_cat_install.xml +++ b/modules/product_cat/product_cat_install.xml @@ -1,40 +1,59 @@ + + - product_cat - product - - 1 + product + + Product Category + + 1 + + product_cat + + + + product + + + + base - - - - add - - 1 - - - search_form - - - - search - - - view - - 1 - - - delete - - - update - - - search_show - - - - - \ No newline at end of file + + + + + Add + 1 + add + + + + delete + + + + List + 1 + search + + + + + search_form + + + + search_show + + + + update + + + + view + + + + diff --git a/modules/product_cat_translate/product_cat_translate.inc.php b/modules/product_cat_translate/product_cat_translate.inc.php index e2e6c04a..87c574b2 100644 --- a/modules/product_cat_translate/product_cat_translate.inc.php +++ b/modules/product_cat_translate/product_cat_translate.inc.php @@ -18,109 +18,6 @@ * @version 1.4.93 */ -class product_cat_translate -{ - - # Open the constructor for this mod - function product_cat_translate() - { - # name of this module: - $this->module = "product_cat_translate"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } - +class product_cat_translate extends OSB_module { } -?> \ No newline at end of file +?> diff --git a/modules/product_cat_translate/product_cat_translate_construct.xml b/modules/product_cat_translate/product_cat_translate_construct.xml index 2a36daa3..908df80d 100644 --- a/modules/product_cat_translate/product_cat_translate_construct.xml +++ b/modules/product_cat_translate/product_cat_translate_construct.xml @@ -1,57 +1,76 @@ - - product_cat_translate - - product_cat_translate
    - - product - - 0 - - product_cat_id - - 25 - - - - I4 - 1 - 1 - - - I4 - 1 - - - I4 - product_cat - name - any - - - C(16) - - - C(128) - 2 - 128 - any - - - X2 - any - 1 - - - - - id,site_id,product_cat_id,language_id,name,description - id,site_id,product_cat_id,language_id,name,description - id,site_id,product_cat_id,language_id,name,description - id,site_id,product_cat_id,language_id,name,description - id,site_id,product_cat_id,language_id,name - - - 0 + + product_cat_translate + + product_cat_translate
    + + product + + 0 + + product_cat_id + + 25 + + 0 + + + + + + + + + + 1 + I4 + 1 + + + + 1 + I4 + + + I4 + product_cat + name + any + + + C(16) + + + C(128) + 2 + 128 + any + + + X2 + any + 1 + + + + + + id,site_id,product_cat_id,language_id,name,description + id,site_id,product_cat_id,language_id,name,description + id,site_id,product_cat_id,language_id,name,description + id,site_id,product_cat_id,language_id,name,description + id,site_id,product_cat_id,language_id,name + + + + + + + + + + + +
    diff --git a/modules/product_cat_translate/product_cat_translate_install.xml b/modules/product_cat_translate/product_cat_translate_install.xml index f7dfdb60..5d10e310 100644 --- a/modules/product_cat_translate/product_cat_translate_install.xml +++ b/modules/product_cat_translate/product_cat_translate_install.xml @@ -1,32 +1,55 @@ + + - product_cat_translate - product_cat - + product_cat + + + + 0 + + product_cat_translate + + + + product_cat + + + + base - - - - search - - 1 - - - delete - - - view - - - update - - - add - - - search_show - - - - \ No newline at end of file + + + + + add + + + + delete + + + + search + + + + + search_form + + + + search_show + + + + update + + + + view + + + + diff --git a/modules/product_cat_translate/product_cat_translate_install_data.xml b/modules/product_cat_translate/product_cat_translate_install_data.xml index c015e675..3bdc8496 100644 --- a/modules/product_cat_translate/product_cat_translate_install_data.xml +++ b/modules/product_cat_translate/product_cat_translate_install_data.xml @@ -26,7 +26,8 @@ test test + 6 - \ No newline at end of file + diff --git a/modules/product_img/product_img_construct.xml b/modules/product_img/product_img_construct.xml index 44226dfd..dd12e407 100644 --- a/modules/product_img/product_img_construct.xml +++ b/modules/product_img/product_img_construct.xml @@ -1,53 +1,69 @@ - - product_img - - product_img
    - - product - - 0 - - product_id - - 25 - - - product_id - - - - - I4 - 1 - 1 - - - I4 - 1 - - - I4 - - - L - - - C(255) - - - C(128) - - - - - id,site_id,product_id,type,url,name - id,site_id,product_id,type,url,name - id,site_id,product_id,type,url,name - id,site_id,product_id,type,url,name - id,site_id,product_id,type,url,name - - - 0 + + product_img + + product_img
    + + product + + 0 + + product_id + + 25 + + 0 + + + + product_id + + + + + + + 1 + I4 + 1 + + + + 1 + I4 + + + I4 + + + L + + + C(255) + + + C(128) + + + + + + id,site_id,product_id,type,url,name + id,site_id,product_id,type,url,name + id,site_id,product_id,type,url,name + id,site_id,product_id,type,url,name + id,site_id,product_id,type,url,name + + + + + + + + + + + +
    diff --git a/modules/product_img/product_img_install.xml b/modules/product_img/product_img_install.xml index ed57992f..b17efdc6 100644 --- a/modules/product_img/product_img_install.xml +++ b/modules/product_img/product_img_install.xml @@ -1,30 +1,55 @@ + + - product_img - product - + product + + + + 0 + + product_img + + + + product + + + + base - - - - search_show - - - search - - - view - - - delete - - - update - - - add - - - - \ No newline at end of file + + + + + add + + + + delete + + + + search + + + + + search_form + + + + search_show + + + + update + + + + view + + + + diff --git a/modules/product_translate/product_translate_construct.xml b/modules/product_translate/product_translate_construct.xml index 80c54b45..9374caf1 100644 --- a/modules/product_translate/product_translate_construct.xml +++ b/modules/product_translate/product_translate_construct.xml @@ -1,69 +1,85 @@ - - product_translate - - product_translate
    - - product - - 0 - - product_id - - 25 - - - product_id - language_id - name - - - - - I4 - 1 - 1 - - - I4 - 1 - - - I4 - product - sku - any - - - C(16) - - - C(128) - 1 - 128 - any - - - X2 - 1 - - - X2 - 1 - - - X2 - - - - - id,site_id,product_id,language_id,name,description_short,description_full,email_template - id,site_id,product_id,language_id,name,description_short,description_full,email_template - id,site_id,product_id,language_id,name,description_short,description_full,email_template - id,site_id,product_id,language_id,name,description_short,description_full,email_template - id,site_id,product_id,language_id,name,description_short,description_full,email_template - - - 0 + + product_translate + + product_translate
    + + product + + 0 + + product_id + + 25 + + 0 + + + + product_id + language_id + name + + + + + + + 1 + I4 + 1 + + + + 1 + I4 + + + I4 + product + sku + any + + + C(16) + + + C(128) + 1 + 128 + any + + + X2 + 1 + + + X2 + 1 + + + X2 + + + + + + id,site_id,product_id,language_id,name,description_short,description_full,email_template + id,site_id,product_id,language_id,name,description_short,description_full,email_template + id,site_id,product_id,language_id,name,description_short,description_full,email_template + id,site_id,product_id,language_id,name,description_short,description_full,email_template + id,site_id,product_id,language_id,name,description_short,description_full,email_template + + + + + + + + + + + +
    diff --git a/modules/product_translate/product_translate_install.xml b/modules/product_translate/product_translate_install.xml index a67ff112..0fe865b5 100644 --- a/modules/product_translate/product_translate_install.xml +++ b/modules/product_translate/product_translate_install.xml @@ -1,30 +1,55 @@ + + - product_translate - product - + product + + + + 0 + + product_translate + + + + product + + + + base - - - - add - - - update - - - search_show - - - search - - - view - - - delete - - - - \ No newline at end of file + + + + + add + + + + delete + + + + search + + + + + search_form + + + + search_show + + + + update + + + + view + + + + diff --git a/modules/search/search_construct.xml b/modules/search/search_construct.xml index 61914993..9015a25c 100644 --- a/modules/search/search_construct.xml +++ b/modules/search/search_construct.xml @@ -1,65 +1,85 @@ - - search - - search
    - - - - 0 - - - - 25 - - - date_expire - session_id - account_id - module - - - - - I8 - 1 - 1 - - - I8 - 1 - - - I8 - - - I8 - - - C(32) - - - I8 - - - C(64) - - - X2 - - - C(255) - - - I4 - - - I4 - - - - - - 0 + + search + + search
    + + + + 0 + + + + 25 + + 0 + + + + date_expire + session_id + account_id + module + + + + + + + 1 + I8 + 1 + + + + 1 + I8 + + + + date-now + Date Created + I8 + + + I8 + + + C(32) + + + I8 + + + C(64) + + + X2 + + + C(255) + + + I4 + + + I4 + + + + + + + + + + + + + + + + +
    diff --git a/modules/search/search_install.xml b/modules/search/search_install.xml index a3c0abbe..6935a5c4 100644 --- a/modules/search/search_install.xml +++ b/modules/search/search_install.xml @@ -1,11 +1,26 @@ + + + + + + + + 0 + search - search + + + + + + + base - - - - - \ No newline at end of file + + + + + diff --git a/modules/search/search_install_data.xml b/modules/search/search_install_data.xml deleted file mode 100644 index 7598d93f..00000000 --- a/modules/search/search_install_data.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - 3066 - 1 - 1112338630 - 1112374630 - c48c8cec9298a40a1995ad479b5c4e37 - 1 - 0 - SELECT %%fieldList%% FROM %%tableList%% WHERE %%whereList%% - name - 25 - 66 - - - 3067 - 1 - 1112338637 - 1112374637 - c48c8cec9298a40a1995ad479b5c4e37 - 1 - 0 - - name - 25 - 7 - - - 3068 - 1 - 1112343270 - 1112379270 - b3662a1982e7ba3c5308973b354fb6f7 - 1 - 0 - SELECT %%fieldList%% FROM %%tableList%% WHERE %%whereList%% - site_id - 10 - 1 - - - 3069 - 1 - 1112343320 - 1112379320 - 6528fd5472182bd2b622f97b76567655 - 1 - 0 - SELECT %%fieldList%% FROM %%tableList%% WHERE %%whereList%% - name - 25 - 25 - - - 3069 - - \ No newline at end of file diff --git a/modules/search_saved/search_saved_install.xml b/modules/search_saved/search_saved_install.xml index f4dd392c..e676f050 100644 --- a/modules/search_saved/search_saved_install.xml +++ b/modules/search_saved/search_saved_install.xml @@ -1,11 +1,11 @@ search_saved - search_saved + search - \ No newline at end of file + diff --git a/modules/service/service.inc.php b/modules/service/service.inc.php index 336361b6..c270fd34 100644 --- a/modules/service/service.inc.php +++ b/modules/service/service.inc.php @@ -1,25 +1,49 @@ - + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Module:Service */ - -class service -{ + +/** + * The main AgileBill Service Class + * + * @package AgileBill + * @subpackage Module:Service + */ +class service extends OSB_module { + /** + * SQL Join details + */ + public function sql_join($table,$value) { + switch ($table) { + case 'invoice_item': + return sprintf('%sinvoice.id=%sinvoice_item.invoice_id AND %sinvoice_item.service_id=%s',AGILE_DB_PREFIX,AGILE_DB_PREFIX,AGILE_DB_PREFIX,$value); + break; + + default: + printf("ERROR: Unknown join :%s",$table); + return; + } + } + ############################## ## Resend hosting details ## ############################## @@ -53,8 +77,8 @@ class service active = ' . $db->qstr(1) . ' AND price_type = ' . $db->qstr(0) . ' AND group_type = ' . $db->qstr(0) . ' AND - group_days > ' . $db->qstr(0) . ' AND - site_id = ' . $db->qstr(DEFAULT_SITE); + group_days > ' . $db->qstr(0) . ' AND + site_id = ' . $db->qstr(DEFAULT_SITE); $service = $db->Execute($sql); $total = $service->RecordCount(); @@ -70,13 +94,13 @@ class service # should we send email notification? todo $sql = 'UPDATE ' . AGILE_DB_PREFIX . 'service - SET + SET queue = ' . $db->qstr("inactive") . ', date_last = ' . $db->qstr(time()) . ', active = ' . $db->qstr(0) . ' - WHERE - id = ' . $db->qstr($service->fields['id']) . ' AND - site_id = ' . $db->qstr(DEFAULT_SITE); + WHERE + id = ' . $db->qstr($service->fields['id']) . ' AND + site_id = ' . $db->qstr(DEFAULT_SITE); $db->Execute($sql); $i++; } @@ -95,12 +119,12 @@ class service # would normally be due for billing now. $sql = 'SELECT id - FROM ' . AGILE_DB_PREFIX . 'service WHERE + FROM ' . AGILE_DB_PREFIX . 'service WHERE queue != ' . $db->qstr("inactive") . ' AND active = ' . $db->qstr(1) . ' AND suspend_billing = ' . $db->qstr(1) . ' AND - date_next_invoice <= ' . $db->qstr(time()) . ' AND - site_id = ' . $db->qstr(DEFAULT_SITE); + date_next_invoice <= ' . $db->qstr(time()) . ' AND + site_id = ' . $db->qstr(DEFAULT_SITE); $service = $db->Execute($sql); $total = $service->RecordCount(); if($total > 0) { @@ -121,13 +145,13 @@ class service return true; } - + /** User reactivate */ function user_reactivate($VAR) { if(!SESS_LOGGED || empty($VAR['id'])) return false; - + global $C_debug, $C_translate, $smarty; - + /* get service details */ $db =& DB(); $rs = $db->Execute(sqlSelect($db,"service","*","id=::{$VAR['id']}::")); @@ -136,10 +160,10 @@ class service /* can reinstate? */ if(!$suspend_billing || SESS_ACCOUNT != $account_id || !$recur_cancel) { - $C_debug->alert('This service cannot be reactivated at this time.'); + $C_debug->alert('This service cannot be reactivated at this time.'); return false; } - + /* invoice date needs moved? */ if($active == 1 && $date_next_invoice >= time()) { /* no, change the suspend_billing status */ @@ -149,10 +173,10 @@ class service } else { /* no, change the suspend_billing status */ $fields=Array('suspend_billing'=>0, 'date_next_invoice'=>time()+86400); - $db->Execute(sqlUpdate($db,"service",$fields,"id=::{$VAR['id']}:: ")); + $db->Execute(sqlUpdate($db,"service",$fields,"id=::{$VAR['id']}:: ")); $C_debug->alert('An invoice for this service will be generated within the next 24 hours and service will be reactivated immediately after payment of that invoice is made.'); } - } + } } @@ -196,81 +220,58 @@ class service - ############################## - ## ADMIN MODIFY RECURR SCHED # - ############################## - function admin_changeschedule($VAR) - { - global $C_translate, $C_debug; + /** + * Called when an admin changes the billing schedule + */ + public function admin_changeschedule($VAR) { + # Quick validation that we were called correctly + if (! isset($VAR['id']) || ! isset($VAR['service_recur_schedule']) || ! is_numeric($VAR['service_recur_schedule']) || ($VAR['service_recur_schedule'] > 6)) + return false; - if(!isset($VAR['id']) || !isset($VAR['service_recur_schedule'])) return false; - - # get the account id & confirm changing the schedule is allowed + # Get the account id & confirm changing the schedule is allowed $db = &DB(); - $dbm = new CORE_database; - $sql = $dbm->sql_select("service","*","id = {$VAR['id']}", "", $db); - $service = $db->Execute($sql); + $service = $db->Execute(sqlSelect($db,'service','*',array('id'=>$VAR['id']))); - # prev schedule - $prev = $service->fields['recur_schedule']; - - # current schedule - $cur = $VAR['service_recur_schedule']; - if(!is_numeric($cur) || $cur > 6) - return false; - - # validate a change has occurred - if($cur != $prev) - { - $this->changeschedule($cur, $prev, $service, $VAR); - } + # Validate a change has occurred + if ($service && ($service->RecordCount() == 1) && $VAR['service_recur_schedule'] != $service->fields['recur_schedule']) + $this->changeschedule($VAR['service_recur_schedule'],$service->fields['recur_schedule'],$service,$VAR); } + /** + * Change the billing schedule for a service + */ + private function changeschedule($cur,$prev,&$service,$VAR) { + global $C_translate,$C_debug,$C_auth; - - ############################## - ## CANCEL SERVICES ## - ############################## - function changeschedule($cur, $prev, &$service, $VAR) - { - global $C_translate, $C_debug, $C_auth; $db = &DB(); # Get the associated product: - $product = $service->fields['product_id']; + $product_id = $service->fields['product_id']; # Validate a product is associated with this service: - if($product > 0 ) - { - $dbm = new CORE_database; - + if ($product_id > 0 ) { # Get the product details: - $sql = $dbm->sql_select('product','*',"id = $product", '', $db); - $prod = $db->Execute($sql); + $product = $db->Execute(sqlSelect($db,'product','*',array('id'=>$product_id))); # Get the price for the associated product and billing schedule - if($prod->fields['price_recurr_default'] == $cur) - { + if ($product->fields['price_recurr_default'] == $cur) { # Use default base price: - $price = $prod->fields['price_base']; - } - else - { - $arr = unserialize($prod->fields['price_group']); - if(is_array($arr)) - { + $price = $product->fields['price_base']; + + } else { + $arr = unserialize($product->fields['price_group']); + if(is_array($arr)) { # Get the base price for the selected period: $price = false; - $parr = $arr["$cur"]; + $parr = $arr[$cur]; # Loop through each group price and assign this user the lowest available price: - while(list($group, $parr2) = each($parr)) - { - if(isset($parr2["price_base"])) { - $arr_price = $parr2["price_base"]; - if($arr_price != '' && $C_auth->auth_group_by_id($group)) - if($price == false || $price > $arr_price) - $price = $arr_price; + while(list($group, $parr2) = each($parr)) { + if (isset($parr2['price_base'])) { + $arr_price = $parr2['price_base']; + if ($arr_price != '' && $C_auth->auth_group_by_id($group)) + if ($price == false || $price > $arr_price) + $price = $arr_price; } } } @@ -284,6 +285,7 @@ class service id = {$VAR['id']} AND site_id = ".$db->qstr(DEFAULT_SITE); $db->Execute($q); +echo '
    ';print_r(array('c'=>$cur,'p'=>$prev,'q'=>$q,'s'=>$service,'v'=>$VAR,'pr'=>$product_id,'pro'=>$product));
     		} else {
     			# Update service status
     			$q = "UPDATE ".AGILE_DB_PREFIX."service SET recur_schedule = $cur WHERE id = {$VAR['id']} AND site_id = ".$db->qstr(DEFAULT_SITE);
    @@ -388,7 +390,7 @@ class service
     		$fields=Array('date_orig'=>time(), 'staff_id'=> SESS_ACCOUNT, 'service_id'=>$id, 'type'=> 'approve', 'memo'=> "Approved Service");
     		$db->Execute($sql=sqlInsert($db,"service_memo",$fields));
     
    -		# Run queue now 
    +		# Run queue now
     		$this->queue_one($id, false);
     		return true;
     	}
    @@ -416,17 +418,17 @@ class service
     		$this->queue_one($id);
     		return true;
     	}
    -	
    +
     	/** queue all services */
    -	function queue($VAR) {		
    +	function queue($VAR) {
     		if(!empty($VAR['id']) && !empty($VAR["do"])) {
     			/** queue one */
     			$this->queue_one($VAR['id'], false);
     		} else {
     			/** queue all services */
     			$db = &DB();
    -			$rs = $db->Execute(sqlSelect($db, "service", "*", "queue!='none'"));			 
    -			if ($rs && $rs->RecordCount()) { 
    +			$rs = $db->Execute(sqlSelect($db, "service", "*", "queue!='none'"));
    +			if ($rs && $rs->RecordCount()) {
     				while ( !$rs->EOF ) {
     					$this->queue_one($rs->fields['id'], $rs->fields);
     					$rs->MoveNext();
    @@ -434,10 +436,10 @@ class service
     			}
     		}
     	}
    -		
    -	/** queue one service 
    +
    +	/** queue one service
     	 * @param int $id
    -	 * @param array $service Fields of service row 
    +	 * @param array $service Fields of service row
     	 */
     	function queue_one($id, $service=false) {
     		if(!$service) {
    @@ -446,36 +448,36 @@ class service
     			if(!$rs || !$rs->RecordCount()) return false;
     			$service=$rs->fields;
     			$this->service = $rs->fields;
    -		} else { 
    +		} else {
     			$this->service = $service;
    -		}  
    -		switch($service['type']) 
    -		{		
    -			case 'group': 
    +		}
    +		switch($service['type'])
    +		{
    +			case 'group':
     				$this->queue_group($id);
     				break;
    -			case 'host': 
    +			case 'host':
     				$this->queue_host($id);
     				break;
    -			case 'domain': 
    +			case 'domain':
     				$this->queue_domain($id);
     				break;
    -			case 'product': 
    +			case 'product':
     				$this->queue_product($id);
     				break;
    -			case 'host_group': 
    +			case 'host_group':
     				$this->queue_host($id);
     				$this->queue_group($id, false);
    -				break;				
    -			case 'product_group': 
    +				break;
    +			case 'product_group':
     				$this->queue_product($id);
     				$this->queue_group($id, false);
    -				break;	
    +				break;
     		}
     	}
     
    -	/** set queue action to 'none' 
    -	 * @param int $id Service ID 
    +	/** set queue action to 'none'
    +	 * @param int $id Service ID
     	 */
     	function queue_complete($id=false) {
     		if(!$id) return false;
    @@ -483,7 +485,7 @@ class service
     		$db->Execute("UPDATE ".AGILE_DB_PREFIX."service SET queue = ".$db->qstr( 'none' )." WHERE id=".$db->qstr( $id )." AND site_id=".$db->qstr(DEFAULT_SITE));
     	}
     
    -	/** group type service queue 
    +	/** group type service queue
     	 * @param int $id Service ID
     	 * @param bool $update Update service queue to 'none' after running
     	 */
    @@ -493,8 +495,8 @@ class service
     		$db = &DB();
     		$q = "SELECT * FROM  ".AGILE_DB_PREFIX."service WHERE id = ".$db->qstr( $id )." AND site_id = ".$db->qstr(DEFAULT_SITE);;
     		$rs = $db->Execute($q);
    -		if ($rs && $rs->RecordCount()) { 
    -			
    +		if ($rs && $rs->RecordCount()) {
    +
     			# Get the groups to grant access to:
     			$groups = unserialize($rs->fields['group_grant']);
     			if(!is_array($groups)) return false;
    @@ -598,25 +600,25 @@ class service
     	{
     		global $VAR;
     
    -		# Get the plugin name type (task based / real time) 
    +		# Get the plugin name type (task based / real time)
     		$file = $this->service['prod_plugin_name'];
     		if(!empty($file)) {
     			$path = PATH_PLUGINS . 'product/'.$file.'.php';
    -			if(is_file($path)) 
    +			if(is_file($path))
     			{
     				require_once ($path);
     				eval ( '$_plg = new plgn_prov_'.$file.';' );
    -				 
    -				# If realtime, load module and run command now 
    +
    +				# If realtime, load module and run command now
     				if(!empty($_plg) && is_object($_plg))
    -					if($_plg->remote_based == true) 
    -						$_plg->p_one($id); 
    -						 
    -							
    +					if($_plg->remote_based == true)
    +						$_plg->p_one($id);
    +
    +
     			} else {
     				return false;
     			}
    -		} 
    +		}
     		return true;
     	}
     
    @@ -627,7 +629,7 @@ class service
     	{
     		include_once(PATH_MODULES.'product/product.inc.php');
     		$product  = new product;
    -					
    +
     		$trial = false;
     
     		$db= &DB();
    @@ -660,11 +662,11 @@ class service
     		        	  id 		=  ".$db->qstr($prod->fields['price_trial_prod'])." AND
     		        	  site_id 	=  ".$db->qstr(DEFAULT_SITE);
     			$prod = $db->Execute($q);
    -			
    +
     			/* set the product id to the perm item */
    -			$item->fields['product_id']= $prod->fields['id'];			
    +			$item->fields['product_id']= $prod->fields['id'];
     			$this->recurring_schedule = $item->fields['recurring_schedule'];
    - 
    +
     			### Get the price
     			$price = $product->price_prod($prod->fields, $prod->fields['price_recurr_default'], $invoice->fields['account_id'], false);
     			$this->price  = @$price['base'] / $item->fields['quantity'];
    @@ -723,7 +725,7 @@ class service
     
     		# Parent ID
     		$this->parent_id = $service_id;
    -		
    +
     		# determine if groups defined:
     		$groups_defined=false;
     		if(!empty($prod->fields['assoc_grant_group'])) {
    @@ -1024,18 +1026,18 @@ class service
     
     		# Create the item record:
     		$q = "UPDATE ".AGILE_DB_PREFIX."service SET
    -		        date_last				= ". $db->qstr( time() ) .", 
    +		        date_last				= ". $db->qstr( time() ) .",
     		        invoice_id				= ". $db->qstr( $item->fields['invoice_id'] ) .",
    -		        invoice_item_id			= ". $db->qstr( $item->fields['id'] ) .", 
    +		        invoice_item_id			= ". $db->qstr( $item->fields['id'] ) .",
     		        account_billing_id 		= ". $db->qstr( $billing_id ) .",
     		        product_id				= ". $db->qstr( $prod->fields['id'] ) .",
     		        sku						= ". $db->qstr( $item->fields['sku'] ) .",
    -		        active					= ". $db->qstr( 1 ) .", 
    +		        active					= ". $db->qstr( 1 ) .",
     		        type					= ". $db->qstr( $this->type ) .",
    -		        queue					= ". $db->qstr( 'edit' ) .", 
    +		        queue					= ". $db->qstr( 'edit' ) .",
     		        price					= ". $db->qstr( @$this->price ) .",
     		        price_type				= ". $db->qstr( $prod->fields['price_type'] ) .",
    -		        taxable					= ". $db->qstr( $prod->fields['taxable'] ) .", 
    +		        taxable					= ". $db->qstr( $prod->fields['taxable'] ) .",
     		        date_last_invoice		= ". $db->qstr( @$this->last_invoice ) .",
     		        date_next_invoice		= ". $db->qstr( @$this->next_invoice ) .",
     		        recur_schedule			= ". $db->qstr( @$this->recurring_schedule ) .",
    @@ -1043,15 +1045,15 @@ class service
     		        recur_weekday			= ". $db->qstr( $prod->fields['price_recurr_weekday'] ) .",
     		        recur_week				= ". $db->qstr( $prod->fields['price_recurr_week'] ) .",
     		        recur_schedule_change 	= ". $db->qstr( $prod->fields['price_recurr_schedule'] ) .",
    -		        recur_cancel			= ". $db->qstr( $prod->fields['price_recurr_cancel'] ) .", 
    -		        recur_modify			= ". $db->qstr( $prod->fields['price_recurr_modify'] ) .", 
    +		        recur_cancel			= ". $db->qstr( $prod->fields['price_recurr_cancel'] ) .",
    +		        recur_modify			= ". $db->qstr( $prod->fields['price_recurr_modify'] ) .",
     		        group_grant				= ". $db->qstr( $prod->fields['assoc_grant_group'] ) .",
     		        group_type				= ". $db->qstr( $prod->fields['assoc_grant_group_type'] ) .",
    -		        group_days				= ". $db->qstr( $prod->fields['assoc_grant_group_days'] ) .",  
    -		        host_provision_plugin_data=".$db->qstr( @$host_arr ) .", 
    +		        group_days				= ". $db->qstr( $prod->fields['assoc_grant_group_days'] ) .",
    +		        host_provision_plugin_data=".$db->qstr( @$host_arr ) .",
     		        prod_plugin_name		= ". $db->qstr( @$prod->fields["prod_plugin_file"] ) .",
    -		        prod_plugin_data		= ". $db->qstr( @$prod->fields["prod_plugin_data"] ) . " 
    -		        WHERE 
    +		        prod_plugin_data		= ". $db->qstr( @$prod->fields["prod_plugin_data"] ) . "
    +		        WHERE
     		        site_id = ".DEFAULT_SITE . " AND id = $service_id";
     		$rs = $db->Execute($q);
     		if ($rs === false) {
    @@ -1059,7 +1061,7 @@ class service
     			$C_debug->error('service.inc.php','invoiceItemToService', $q . " | " . @$db->ErrorMsg());
     		}
     
    -		# Run the queue on this item: 
    +		# Run the queue on this item:
     		$this->queue_one($service_id, false);
     		return true;
     	}
    @@ -1077,6 +1079,7 @@ class service
     	 */
     	function calcNextInvoiceDate($s, $schedule, $type, $weekday, $week=false)
     	{
    +//echo '
    ';print_r(array('s'=>$s,'schedule'=>$schedule,'type'=>$type,'weekday'=>$weekday));
       		# Anniversary billing routine:
     		if($type == 0)
     		{
    @@ -1102,17 +1105,17 @@ class service
     		{
     			if($schedule == 0) {
     				return mktime (0, 0, 0, date("m", $s), 	date("d", $s)+7, 	date("Y", $s));
    -			} elseif ($type == 1) {
    +			} elseif ($schedule == 1) {
     				$inc_months = 1;
    -			}  elseif ($type == 2) {
    +			}  elseif ($schedule == 2) {
     				$inc_months = 3;
    -			} elseif ($type == 3) {
    +			} elseif ($schedule == 3) {
     				$inc_months = 6;
    -			} elseif ($type == 4) {
    +			} elseif ($schedule == 4) {
     				$inc_months = 12;
    -			} elseif ($type == 5) {
    +			} elseif ($schedule == 5) {
     				$inc_months = 24;
    -			} elseif ($type == 6) {
    +			} elseif ($schedule == 6) {
     				$inc_months = 36;
     			} else {
     				return false;
    @@ -1208,7 +1211,7 @@ class service
     		if($VAR['service_price_type'] == 1)
     		{
     			if(!empty($VAR['date_last_invoice']))
    -			$last_invoice = $validate->DateToEpoch(DEFAULT_DATE_FORMAT,$VAR['date_last_invoice']);
    +			$last_invoice = $validate->convert_date($VAR['date_last_invoice'],DEFAULT_DATE_FORMAT);
     			else
     			$last_invoice = time();
     
    @@ -1288,33 +1291,33 @@ class service
     		        id						= ". $db->qstr( $id ) .",
     		        site_id					= ". $db->qstr( DEFAULT_SITE ) .",
     		        date_orig				= ". $db->qstr( time() ) .",
    -		        date_last				= ". $db->qstr( time() ) .",  
    +		        date_last				= ". $db->qstr( time() ) .",
     		        account_id				= ". $db->qstr( $VAR['service_account_id'] ) .",
     		        account_billing_id 		= ". $db->qstr( @$VAR['ccnum'] ) .",
     		        product_id				= ". $db->qstr( @$product_id ) .",
     		        sku						= ". $db->qstr( @$product_sku ) .",
    -		        active					= ". $db->qstr( '1' ) .", 
    +		        active					= ". $db->qstr( '1' ) .",
     		        type					= ". $db->qstr( $VAR['service_type'] ) .",
    -		        queue					= ". $db->qstr( 'new' ) .", 
    +		        queue					= ". $db->qstr( 'new' ) .",
     		        price					= ". $db->qstr( @$VAR['product_price_base'] ) .",
     		        price_type				= ". $db->qstr( @$VAR['service_price_type'] ) .",
    -		        taxable					= ". $db->qstr( @$VAR['product_taxable'] ) .", 
    +		        taxable					= ". $db->qstr( @$VAR['product_taxable'] ) .",
     		        date_last_invoice		= ". $db->qstr( @$last_invoice ) .",
     		        date_next_invoice		= ". $db->qstr( @$next_invoice ) .",
     		        recur_schedule			= ". $db->qstr( @$VAR['product_price_recurr_default'] ) .",
     		        recur_type				= ". $db->qstr( @$VAR['product_price_recurr_type'] ) .",
    -		        recur_weekday			= ". $db->qstr( @$VAR['product_price_recurr_weekday'] ) .", 
    +		        recur_weekday			= ". $db->qstr( @$VAR['product_price_recurr_weekday'] ) .",
     		        recur_schedule_change 	= ". $db->qstr( @$VAR['product_price_recurr_schedule'] ) .",
    -		        recur_cancel			= ". $db->qstr( @$VAR['product_price_recurr_cancel'] ) .", 
    -		        recur_modify			= ". $db->qstr( @$VAR['product_price_recurr_modify'] ) .", 
    +		        recur_cancel			= ". $db->qstr( @$VAR['product_price_recurr_cancel'] ) .",
    +		        recur_modify			= ". $db->qstr( @$VAR['product_price_recurr_modify'] ) .",
     		        group_grant				= ". $db->qstr( serialize(@$VAR['product_assoc_grant_group']) ) .",
     		        group_type				= ". $db->qstr( @$VAR['product_assoc_grant_group_type'] ) .",
    -		        group_days				= ". $db->qstr( @$VAR['product_assoc_grant_group_days'] ) .", 
    +		        group_days				= ". $db->qstr( @$VAR['product_assoc_grant_group_days'] ) .",
     		        host_server_id			= ". $db->qstr( @$VAR['product_host_server_id'] ) .",
     		        host_provision_plugin_data=".$db->qstr( serialize(@$VAR['product_host_provision_plugin_data']) ) .",
     		        host_ip					= ". $db->qstr( @$VAR['host_ip'] ) .",
     		        host_username			= ". $db->qstr( @$VAR['host_username'] ) .",
    -		        host_password			= ". $db->qstr( @$VAR['host_password'] ) .", 
    +		        host_password			= ". $db->qstr( @$VAR['host_password'] ) .",
     		        domain_name				= ". $db->qstr( @$domain_name ) .",
     		        domain_tld				= ". $db->qstr( @$domain_tld ) .",
     		        domain_term				= ". $db->qstr( @$domain_term ) .",
    @@ -1326,7 +1329,7 @@ class service
     		        prod_plugin_data		= ". $db->qstr( serialize(@$VAR["product_prod_plugin_data"]) );
     			$rs = $db->Execute($q);
     
    -			if($VAR['service_type'] == 'group' || $VAR['service_type'] = 'product' || $VAR['service_type'] = 'product_group') $this->queue_one($id, false);	
    +			if($VAR['service_type'] == 'group' || $VAR['service_type'] = 'product' || $VAR['service_type'] = 'product_group') $this->queue_one($id, false);
     
     			global $VAR;
     			$VAR["id"] = $id;
    @@ -1336,244 +1339,234 @@ class service
     		}
     	}
     
    -	##############################
    -	## 	Data for add template	##
    -	##############################
    -	function add_tpl($VAR)
    -	{
    -		global $smarty, $C_validate;
    -		$db 	= &DB();
    -		$dbm	= new CORE_database;
    +	/**
    +	 * Add a service to an account - data for the add template
    +	 */
    +	public function tpl_add($VAR) {
    +		global $smarty,$C_validate;
     
    -		if(!empty($VAR['product_id']) && $VAR['clearall'] == 0)
    -		{
    -			if(!empty($VAR['changeproduct'])) {
    +		$db = &DB();
    +
    +		if (! empty($VAR['product_id']) && $VAR['clearall'] == 0) {
    +			if (! empty($VAR['changeproduct'])) {
     				# Get selected product ID and use it as a template
    -				$sql = $dbm->sql_select('product', '*', "id = {$VAR['product_id']}", "",$db);
    -				$rs = $db->Execute($sql);
    +				$rs = $db->Execute(sqlSelect($db,'product','*',sprintf('id=%s',$VAR['product_id'])));
     
    -				# get assoc groups
    -				if( !empty($rs->fields['assoc_grant_group']) )  {
    +				# Get assoc groups
    +				if (! empty($rs->fields['assoc_grant_group'])) {
     					$groups = unserialize($rs->fields['assoc_grant_group']);
    -					if(!empty($groups[0])) $rs->fields['group'] = $groups;
    +
    +					if (! empty($groups[0]))
    +						$rs->fields['group'] = $groups;
     				}
    +
     				$fields = $rs->fields;
     			}
     		}
     
    -		# get changes submitted, if product not changed:
    -		if(empty($VAR['clearall']) && empty($VAR['changeproduct'])) {
    -			foreach($VAR as $key => $val) {
    -				if(!empty($val)) {
    -					$key = ereg_replace('^product_','', $key);
    -					if(is_array($val))
    -					$fields["$key"] = serialize($val);
    +		# Get changes submitted, if product not changed:
    +		if (empty($VAR['clearall']) && empty($VAR['changeproduct'])) {
    +			foreach ($VAR as $key => $val) {
    +				if (! empty($val)) {
    +					$key = ereg_replace('^product_','',$key);
    +					if (is_array($val))
    +					$fields[$key] = serialize($val);
     					else
    -					$fields["$key"] = $val;
    +					$fields[$key] = $val;
     				}
     			}
     		}
    -		$smarty->assign('product', @$fields);
    +
    +		$smarty->assign('product',@$fields);
     
     		# Get all available products
    -		$sql = $dbm->sql_select('product',
    -		'id,sku',
    -		"prod_plugin = 1 OR
    -									price_type = 1 OR 
    -									( assoc_grant_group_type = 0 OR assoc_grant_group_type >= 1 ) OR 
    -									host = 1",
    -									"sku",
    -									$db);
    -									$rs = $db->Execute($sql);
    -									while(!$rs->EOF) {
    -										$prod[]=$rs->fields;
    -										$rs->MoveNext();
    -									}
    -									if(!empty($prod))
    -									$smarty->assign('prod_menu',$prod);
    +		$prod = array();
    +		$rs = $db->Execute($q = sqlSelect($db,'product','id,sku','(prod_plugin=1 OR price_type=1 OR (assoc_grant_group_type=0 OR assoc_grant_group_type>=1) OR host=1)','sku'));
    +		while (! $rs->EOF) {
    +			array_push($prod,$rs->fields);
    +			$rs->MoveNext();
    +		}
    +
    +		if (! empty($prod))
    +			$smarty->assign('prod_menu',$prod);
     	}
     
    -
    -	##############################
    -	##	USER MODIFY SERVICE	    ##
    -	##############################
    -	function user_modify($VAR)
    -	{
    -		global $smarty, $C_debug, $C_translate;
    +	/**
    +	 * Allow a user to modify a service
    +	 */
    +	public function user_modify($VAR) {
    +		global $smarty;
     
     		# Validate user is logged in
    -		if(empty($VAR['service_id']) || SESS_LOGGED == false) return;
    +		if (empty($VAR['service_id']) || SESS_LOGGED == false)
    +			return;
     
     		# Validate user is auth for current service id:
    -		$service_id = $VAR['service_id'];
     		$db = &DB();
    -		$dbm = new CORE_database;
    -		$rs = $db->Execute( $sql = $dbm->sql_select('service', '*', "account_id = ".SESS_ACCOUNT." AND id = $service_id AND recur_modify = 1", "", $db ) );
    -		if($rs === false || $rs->RecordCount() == 0) return false;
    +		$rs = $db->Execute(sqlSelect($db,'service','*',array('account_id'=>SESS_ACCOUNT,'id'=>$VAR['service_id'],'recur_modify'=>1)));
    +		if (! $rs || ! $rs->RecordCount())
    +			return false;
     
    -		$this->modify($VAR, $this);
    +		$this->modify($VAR);
     	}
     
     
    -	##############################
    -	##	USER MODIFY SERVICE	    ##
    -	##############################
    -	function modify($VAR)
    -	{
    -		global $smarty, $C_debug, $C_translate;
    +	/**
    +	 * Modify Service
    +	 */
    +	public function modify($VAR) {
    +		global $smarty,$C_debug,$C_translate;
    +		$dbm = new CORE_database;
     
     		# Get service details:
    -		$service_id = $VAR['service_id'];
     		$db = &DB();
    -		$dbm = new CORE_database;
    -		$rs = $db->Execute( $sql = $dbm->sql_select('service', '*', "id = $service_id", "", $db ) );
    -		if($rs === false || $rs->RecordCount() == 0) return false;
    +		$rs = $db->Execute(sqlSelect($db,'service','*',array('id'=>$VAR['service_id'])));
    +		if (! $rs || ! $rs->RecordCount())
    +			return false;
     
    -		# if product id not set, generate array
    -		if(empty($VAR['id']))
    -		{
    +		# If product id not set, generate array
    +		if (empty($VAR['id'])) {
     			$product_id = $rs->fields['product_id'];
    -			if(empty($product_id)) return false;
    -			$prod = $db->Execute( $dbm->sql_select( 'product', 'modify_waive_setup,modify_product_arr', "id = $product_id", "", $db ) );
    -			if($prod === false || $prod->RecordCount() == 0) return false;
    -			$arr = unserialize( $prod->fields['modify_product_arr'] );
    -			if(!is_array($arr) || count($arr) == 0 || empty($arr[0])) return false;
    +			if (empty($product_id))
    +				return false;
     
    -			foreach($arr as $pid) {
    -				$prod = $db->Execute( $dbm->sql_select( 'product', 'id,sku,price_base', "id = $pid", "", $db ) );
    -				if($prod === false || $prod->RecordCount() == 0) {} else {
    -					$smart[] = $prod->fields;
    -				}
    +			$prod = $db->Execute(sqlSelect($db,'product','modify_waive_setup,modify_product_arr',array('id'=>$product_id)));
    +			if (! $prod || ! $prod->RecordCount())
    +				return false;
    +
    +			$arr = unserialize($prod->fields['modify_product_arr']);
    +			if (! is_array($arr) || ! count($arr) || empty($arr[0]))
    +				return false;
    +
    +			$smart = array();
    +			foreach ($arr as $pid) {
    +				$prod = $db->Execute(sqlselect($db,'product','id,sku,price_base',array('id'=>$pid)));
    +
    +				if ($prod && $prod->RecordCount())
    +					array_push($smart,$prod->fields);
     			}
    -			$smarty->assign('product_arr', $smart);
    -		}
    -		elseif(empty($VAR['confirm_modify']))
    -		{
    -			# validate selected product is authorized
    +
    +			$smarty->assign('product_arr',$smart);
    +
    +		} elseif(empty($VAR['confirm_modify'])) {
    +			# Validate selected product is authorized
     			$do = true;
     			$product_id = $rs->fields['product_id'];
    -			$sql = $dbm->sql_select( 'product', 'modify_waive_setup,modify_product_arr', "id = $product_id", "", $db ) ;
    -			$prod = $db->Execute( $sql );
    -			if($prod === false || $prod->RecordCount() == 0) $do = false;
    -			$arr = unserialize( $prod->fields['modify_product_arr'] );
    -			if(!is_array($arr) || count($arr) == 0 || empty($arr[0])) $do = false;
    -			if($do) { $do = false;
    -			foreach($arr as $pid)
    -			if( $pid == $VAR['id'] ) { $do = true; break; }
    -			}
    -			$smarty->assign('product_show', $do);
    +			$prod = $db->Execute(sqlSelect($db,'product','modify_waive_setup,modify_product_arr',array('id'=>$product_id)));
    +			if (! $prod || ! $prod->RecordCount())
    +				$do = false;
     
    -			# determine if setup fees are ignored
    -			$smarty->assign('waive_setup',  $prod->fields['modify_waive_setup']);
    +			$arr = unserialize($prod->fields['modify_product_arr']);
    +			if (! is_array($arr) || ! count($arr) || empty($arr[0]))
    +				$do = false;
    +
    +			if ($do) {
    +				$do = false;
    +				foreach($arr as $pid)
    +					if ($pid == $VAR['id']) {
    +						$do = true;
    +						break;
    +					}
    +			}
    +
    +			$smarty->assign('product_show',$do);
    +
    +			# Determine if setup fees are ignored
    +			$smarty->assign('waive_setup',$prod->fields['modify_waive_setup']);
     		}
     	}
     
    -
    -	##############################
    -	##		VIEW			    ##
    -	##############################
    -	function view($VAR)
    -	{
    +	/**
    +	 * View a record
    +	 */
    +	public function view($VAR) {
     		global $smarty,$C_auth;
    -		$this->construct();
    -		$type = "view";
    -		$this->method["$type"] = explode(",", $this->method["$type"]);
    -		$db = new CORE_database;
    -		$smart = $db->view($VAR, $this, $type);
    +
    +		$smart = parent::view($VAR);
     
     		$dbm = new CORE_database;
     		$db  = &DB();
     
    -		# Add the change recur schedule options to the array:
    -		for($i=0; $iSelectLimit($sql,5);
    -			if($inv != false && $inv->RecordCount() > 0)  {
    -				while(!$inv->EOF) {
    -					if($inv->fields['total_amt'] > $inv->fields['billed_amt'] && $inv->fields['suspend_billing'] != 1) {
    -						$inv->fields['due'] = $inv->fields['total_amt'] - $inv->fields['billed_amt'];
    -					}
    -					$smart[$i]["invoice"][] = $inv->fields;
    +		# Get the invoice days, to see if the next invoice can be generated
    +		require_once PATH_MODULES.'invoice/invoice.inc.php';
    +		$invoice = new invoice($VAR);
    +
    +		# Get recent invoice details for this service
    +		$sql = sprintf('SELECT A.id,A.date_orig,A.total_amt,A.billed_amt,A.process_status FROM %sinvoice_item B INNER JOIN %sinvoice A ON (B.invoice_id=A.id AND service_id=%s) WHERE A.site_id=%s AND B.site_id=%s ORDER BY A.id DESC',AGILE_DB_PREFIX,AGILE_DB_PREFIX,$smart['id'],DEFAULT_SITE,DEFAULT_SITE);
    +
    +		$inv = $db->SelectLimit($sql,5);
    +		if ($inv && $inv->RecordCount() > 0) {
    +			while (! $inv->EOF) {
    +				if ($inv->fields['total_amt'] > $inv->fields['billed_amt'] && $inv->fields['suspend_billing'] != 1)
    +					$inv->fields['due'] = $inv->fields['total_amt']-$inv->fields['billed_amt'];
    +
    +					$smart['invoice'][] = $inv->fields;
     					$inv->MoveNext();
    -				}
     			}
    +		}
     
    -			# allow modification of service plan?
    -			if(!empty($VAR['user']) && !empty($smart[$i]['product_id'])) {
    -			} elseif(empty($VAR['user']) ) {
    -			} else {
    -				$smart[$i]['recur_modify'] = "0";
    -			}
    +		# Allow modification of service plan?
    +		if (! empty($VAR['user']) && ! empty($smart['product_id'])) {
    +		} elseif (empty($VAR['user'])) {
    +		} else {
    +			$smart['recur_modify'] = '0';
    +		}
     
    -			# get recurring details?
    -			if(!empty($VAR['user']) && $smart[$i]['recur_schedule_change'] == 1 && !empty($smart[$i]['product_id']))
    +		# Get recurring details?
    +		if (! empty($VAR['user']) && $smart['recur_schedule_change'] == 1 && ! empty($smart['product_id']))
     			$do = true;
    -			elseif(empty($VAR['user']) && !empty($smart[$i]['product_id']))
    +		elseif (empty($VAR['user']) && ! empty($smart['product_id']))
     			$do = true;
    -			else
    +		else
     			$do = false;
     
    -			if($do && $smart[$i]['date_next_invoice'] > 0 && !empty($smart[$i]['product_id']))
    -			{
    -				# Get the product details:
    -				$sql 	= $dbm->sql_select('product','*',"id = {$smart[$i]['product_id']}", '', $db);
    -				$prod 	= $db->Execute($sql);
    -				$fields = $prod->fields;
    +		if ($do && $smart['date_next_invoice'] > 0 && !empty($smart['product_id'])) {
    +			# Get the product details:
    +			$prod = $db->Execute(sqlSelect($db,'product','*',array('id'=>$smart['product_id'])));
     
    -				global $C_auth;
    -				$g_ar = unserialize($fields["price_group"]);
    -				if(is_array($g_arr)) {
    -					foreach($g_ar as $period => $price_arr) {
    -						foreach($price_arr as $group => $vals) {
    -							if(@$price_arr["show"] == "1") {
    -								if (is_numeric($group) && $C_auth->auth_group_by_account_id($smart[$i]['account_id'], $group)) {
    -									if($vals["price_base"] != "" && $vals["price_base"] > 0)
    -									if(empty($ret[$period]['base']) || $vals["price_base"] < $ret[$period]['base'])
    -									$ret[$period]['base'] = $vals["price_base"];
    -								}
    +			global $C_auth;
    +			$g_ar = unserialize($prod->fields['price_group']);
    +
    +			if (is_array($g_ar)) {
    +				foreach ($g_ar as $period => $price_arr) {
    +					foreach ($price_arr as $group => $vals) {
    +						if (@$price_arr['show'] == '1') {
    +							if (is_numeric($group) && $C_auth->auth_group_by_account_id($smart['account_id'],$group)) {
    +								if ($vals['price_base'] != '' && $vals['price_base'] > 0)
    +									if (empty($ret[$period]['base']) || $vals['price_base'] < $ret[$period]['base'])
    +										$ret[$period]['base'] = $vals['price_base'];
     							}
     						}
     					}
     				}
    -
    -				if(!is_array($ret))  {
    -					if(!empty($VAR['user'])) {
    -						$ret["{$smart[$i]["recur_schedule"]}"]["base"] = $smart[$i]["price"];
    -						$smarty->assign('recur_price', $ret);
    -					} else {
    -						$smarty->assign('recur_price', false);
    -					}
    -				} else {
    -					$smarty->assign('recur_price', $ret);
    -				}
    -			} else {
    -				$smarty->assign('recur_price', false);
     			}
    +
    +			# Make sure the current billing price is set correctly.
    +			$ret[$smart['recur_schedule']]['base'] = $smart['price'];
    +			ksort($ret);
    +
    +			if (! is_array($ret)) {
    +				if (! empty($VAR['user'])) {
    +					$ret[$smart['recur_schedule']]['base'] = $smart['price'];
    +					$smarty->assign('recur_price',$ret);
    +
    +				} else {
    +					$smarty->assign('recur_price',false);
    +				}
    +
    +			} else {
    +				$smarty->assign('recur_price',$ret);
    +			}
    +
    +		} else {
    +			$smarty->assign('recur_price',false);
     		}
     
    -		$smarty->clear_assign('service');
    -		$smarty->assign('service', $smart);
    +		if ($smart['date_next_invoice'] && $smart['date_next_invoice']-86400*$invoice->invoice_days() < time())
    +			$smart['generate_invoice'] = true;
    +
    +		$smarty->clear_assign('record');
    +		$smarty->assign('record',$smart);
     	}
     
     
    @@ -1718,22 +1711,6 @@ class service
     		}
     	}
     
    -	function search_form($VAR) {
    -		$this->construct();
    -		$type = "search";
    -		$this->method["$type"] = explode(",", $this->method["$type"]);
    -		$db = new CORE_database;
    -		$db->search_form($VAR, $this, $type);
    -	}
    -
    -	function search($VAR)   {
    -		$this->construct();
    -		$type = "search";
    -		$this->method["$type"] = explode(",", $this->method["$type"]);
    -		$db = new CORE_database;
    -		$db->search($VAR, $this, $type);
    -	}
    -
     	function search_show($VAR)  {
     		$this->construct();
     		$type = "search";
    @@ -1767,7 +1744,7 @@ class service
     	}
     
     	/**
    -    	 * User initiate domain renewal 
    +    	 * User initiate domain renewal
         	 */
     	function user_renew_domain($VAR)
     	{
    @@ -1817,21 +1794,25 @@ class service
     	}
     
     
    -	function user_view($VAR) {
    -		# Check that the correct account owns this billing record
    -		$dbx     = &DB();
    -		$sql    = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'service WHERE
    -                       id           =  ' . $dbx->qstr( @$VAR['id'] ) . ' AND
    -                       account_id   =  ' . $dbx->qstr( SESS_ACCOUNT ) . ' AND
    -                       site_id      =  ' . $dbx->qstr(DEFAULT_SITE);
    -		$rs = $dbx->Execute($sql);
    -		if (@$rs->RecordCount() == 0)
    -		{
    +	/**
    +	 * User view a service
    +	 */
    +	public function user_view($VAR) {
    +		# Check that user is logged in
    +		if (SESS_LOGGED != '1') {
    +			echo 'Sorry, you must be logged in!';
    +
     			return false;
     		}
    -		$this->construct();
    +
    +		# Check that the correct account owns this billing record
    +		$db = &DB();
    +		$rs = $db->Execute(sqlSelect($db,'service','*',array('id'=>$VAR['id'],'account_id'=>SESS_ACCOUNT)));
    +		if (! $rs || $rs->RecordCount() == 0)
    +			return false;
    +
     		$VAR['user'] = true;
    -		$this->view($VAR, $this);
    +		$this->view($VAR);
     	}
     
     	function search_export($VAR) {
    @@ -1889,4 +1870,4 @@ class service
     		$this->limit	= $construct["construct"]["limit"];
     	}
     }
    -?>
    \ No newline at end of file
    +?>
    diff --git a/modules/service/service_construct.xml b/modules/service/service_construct.xml
    index b63187db..4c8ba87c 100644
    --- a/modules/service/service_construct.xml
    +++ b/modules/service/service_construct.xml
    @@ -1,214 +1,308 @@
     
     
    -    
    -    service
    -    
    -    service
    - - - - 0 - - date_orig - - 30 - - - site_id,date_orig - site_id,parent_id - site_id,invoice_id - site_id,invoice_item_id - site_id,account_id - site_id,account_billing_id - site_id,sku - site_id,active - site_id,type - site_id,suspend_billing - site_id,price - site_id,price_type - site_id,queue - site_id,date_next_invoice - site_id,recur_type - site_id,host_server_id - site_id,host_username - site_id,domain_name,domain_tld - site_id,domain_date_expire - - - - - I8 - - - I4 - - - I8 - date-time - - - I8 - date-now - - - I8 - - - I8 - - - I8 - - - I8 - account - first_name,last_name - any - - - I8 - - - I8 - - - C(32) - any - - - L - - - L - - - C(16) - any - - - L - - - F - - - I4 - any - - - L - - - C(16) - - - I8 - date-time - - - I8 - date-time - - - I4 - - - I4 - - - I4 - - - I4 - - - L - - - C(16) - - - X2 - array - - - I4 - - - I4 - - - I4 - - - X2 - array - - - C(16) - - - C(128) - - - C(128) - - - C(128) - - - C(16) - - - I4 - - - C(16) - - - I8 - date - - - I4 - - - I4 - - - X2 - - - X2 - - - C(128) - - - X2 - array - - - L - - - L - - - - - - id,site_id,date_orig,date_last,parent_id,invoice_id,invoice_item_id,account_id,account_billing_id,product_id,sku,active,bind,type,price,price_type,taxable,queue,date_last_invoice,date_next_invoice,recur_type,recur_schedule,recur_weekday,recur_week,recur_schedule_change,recur_cancel,group_grant,group_type,group_days,host_server_id,host_provision_plugin_data,host_ip,host_username,host_password,domain_name,domain_tld,domain_term,domain_type,domain_date_expire,domain_host_tld_id,domain_host_registrar_id,suspend_billing,prod_plugin_name,prod_plugin_data,recur_modify - id,site_id,date_orig,date_last,parent_id,invoice_id,invoice_item_id,account_id,account_billing_id,product_id,sku,active,bind,type,price,price_type,taxable,queue,date_last_invoice,date_next_invoice,recur_type,recur_schedule,recur_weekday,recur_week,recur_schedule_change,recur_cancel,group_grant,group_type,group_days,host_server_id,host_provision_plugin_data,host_ip,host_username,host_password,domain_name,domain_tld,domain_term,domain_type,domain_date_expire,domain_host_tld_id,domain_host_registrar_id,suspend_billing,prod_plugin_name,prod_plugin_data,recur_modify - id,site_id,date_orig,date_last,parent_id,invoice_id,invoice_item_id,account_id,account_billing_id,product_id,sku,active,bind,type,price,price_type,taxable,queue,date_last_invoice,date_next_invoice,recur_type,recur_schedule,recur_weekday,recur_week,recur_schedule_change,recur_cancel,group_grant,group_type,group_days,host_server_id,host_provision_plugin_data,host_ip,host_username,host_password,domain_name,domain_tld,domain_term,domain_type,domain_date_expire,domain_host_tld_id,domain_host_registrar_id,suspend_billing,prod_plugin_name,prod_plugin_data,recur_modify - id,site_id,date_orig,date_last,parent_id,invoice_id,invoice_item_id,account_id,account_billing_id,product_id,sku,active,bind,type,price,price_type,taxable,queue,date_last_invoice,date_next_invoice,recur_type,recur_schedule,recur_weekday,recur_week,recur_schedule_change,recur_cancel,group_grant,group_type,group_days,host_server_id,host_provision_plugin_data,host_ip,host_username,host_password,domain_name,domain_tld,domain_term,domain_type,domain_date_expire,domain_host_tld_id,domain_host_registrar_id,suspend_billing,prod_plugin_name,prod_plugin_data,recur_modify - id,site_id,date_orig,date_last,parent_id,invoice_id,invoice_item_id,account_id,account_billing_id,product_id,sku,active,bind,type,price,price_type,taxable,queue,date_last_invoice,date_next_invoice,recur_type,recur_schedule,recur_weekday,recur_week,recur_schedule_change,recur_cancel,group_grant,group_type,group_days,host_server_id,host_provision_plugin_data,host_ip,host_username,host_password,domain_name,domain_tld,domain_term,domain_type,domain_date_expire,domain_host_tld_id,domain_host_registrar_id,suspend_billing,prod_plugin_name,prod_plugin_data,recur_modify - id,date_orig,date_last,parent_id,invoice_id,invoice_item_id,account_id,account_billing_id,product_id,sku,active,bind,type,price,price_type,taxable,queue,date_last_invoice,date_next_invoice,recur_type,recur_schedule,recur_weekday,host_server_id,host_ip,host_username,host_password,domain_name,domain_tld,domain_term,domain_type,domain_date_expire,domain_host_tld_id,domain_host_registrar_id,suspend_billing - id,date_orig,date_last,parent_id,invoice_id,invoice_item_id,account_id,account_billing_id,product_id,sku,active,bind,type,price,price_type,taxable,queue,date_last_invoice,date_next_invoice,recur_type,recur_schedule,recur_weekday,host_server_id,host_ip,host_username,host_password,domain_name,domain_tld,domain_term,domain_type,domain_date_expire,domain_host_tld_id,domain_host_registrar_id,suspend_billing - id,date_orig,date_last,parent_id,invoice_id,invoice_item_id,account_id,account_billing_id,product_id,sku,active,bind,type,price,price_type,taxable,queue,date_last_invoice,date_next_invoice,recur_type,recur_schedule,recur_weekday,host_server_id,host_ip,host_username,host_password,domain_name,domain_tld,domain_term,domain_type,domain_date_expire,domain_host_tld_id,domain_host_registrar_id,suspend_billing - id,date_orig,date_last,parent_id,invoice_id,invoice_item_id,account_id,account_billing_id,product_id,sku,active,bind,type,price,price_type,taxable,queue,date_last_invoice,date_next_invoice,recur_type,recur_schedule,recur_weekday,host_server_id,host_ip,host_username,host_password,domain_name,domain_tld,domain_term,domain_type,domain_date_expire,domain_host_tld_id,domain_host_registrar_id,suspend_billing - id,date_orig,date_last,parent_id,invoice_id,invoice_item_id,account_id,account_billing_id,product_id,sku,active,bind,type,price,price_type,taxable,queue,date_last_invoice,date_next_invoice,recur_type,recur_schedule,recur_weekday,host_server_id,host_ip,host_username,host_password,domain_name,domain_tld,domain_term,domain_type,domain_date_expire,domain_host_tld_id,domain_host_registrar_id,suspend_billing - - - 0 + + service + + service
    + + + + 0 + + date_orig + + 25 + + 1 + + + + site_id,date_orig + site_id,parent_id + site_id,invoice_id + site_id,invoice_item_id + site_id,account_id + site_id,account_billing_id + site_id,sku + site_id,active + site_id,type + site_id,suspend_billing + site_id,price + site_id,price_type + site_id,queue + site_id,date_next_invoice + site_id,recur_type + site_id,host_server_id + site_id,host_username + site_id,domain_name,domain_tld + site_id,domain_date_expire + + + + + + + 1 + I8 + 1 + + + + 1 + I4 + + + + date-now + Date Created + I8 + + + + date-now + Date Updated + I8 + + + I8 + + + Invoice + I8 + + + I8 + + + Account + I8 + account + first_name,last_name + any + + + I8 + + + I8 + + + SKU + C(32) + any + + + Active + L + + + L + + + Type + C(16) + any + + + Suspend Billing Activity + L + + + Price + F + + + Price Type + I4 + any + + + Taxable + L + + + Queue + C(16) + + + Last Invoice + I8 + date-time + + + Next Invoice + I8 + date-time + + + Type + I4 + + + Schedule + I4 + + + I4 + + + I4 + + + User Change Schedule + L + + + User May Cancel + C(16) + + + X2 + array + + + I4 + + + I4 + + + I4 + + + X2 + array + + + C(16) + + + Hosting User Name + C(128) + + + Hosting Password + C(128) + + + Domain Name + C(128) + + + C(16) + + + Renewal Period + I4 + + + C(16) + + + Date Expire + I8 + date + + + I4 + + + I4 + + + X2 + + + X2 + + + C(128) + + + X2 + array + + + User May Modify + L + + + L + + + + + + id,site_id,date_orig,date_last,parent_id,invoice_id,invoice_item_id,account_id,account_billing_id,product_id,sku,active,bind,type,price,price_type,taxable,queue,date_last_invoice,date_next_invoice,recur_type,recur_schedule,recur_weekday,recur_week,recur_schedule_change,recur_cancel,group_grant,group_type,group_days,host_server_id,host_provision_plugin_data,host_ip,host_username,host_password,domain_name,domain_tld,domain_term,domain_type,domain_date_expire,domain_host_tld_id,domain_host_registrar_id,suspend_billing,prod_plugin_name,prod_plugin_data,recur_modify + id,site_id,date_orig,date_last,parent_id,invoice_id,invoice_item_id,account_id,account_billing_id,product_id,sku,active,bind,type,price,taxable,queue,date_last_invoice,date_next_invoice,recur_type,recur_schedule,recur_weekday,recur_week,recur_schedule_change,recur_cancel,group_grant,group_type,group_days,host_server_id,host_provision_plugin_data,host_ip,host_username,host_password,domain_name,domain_tld,domain_term,domain_type,domain_date_expire,domain_host_tld_id,domain_host_registrar_id,suspend_billing,prod_plugin_name,prod_plugin_data,recur_modify + id,site_id,date_orig,date_last,parent_id,invoice_id,invoice_item_id,account_id,account_billing_id,product_id,sku,active,bind,type,price,price_type,taxable,queue,date_last_invoice,date_next_invoice,recur_type,recur_schedule,recur_weekday,recur_week,recur_schedule_change,recur_cancel,group_grant,group_type,group_days,host_server_id,host_provision_plugin_data,host_ip,host_username,host_password,domain_name,domain_tld,domain_term,domain_type,domain_date_expire,domain_host_tld_id,domain_host_registrar_id,suspend_billing,prod_plugin_name,prod_plugin_data,recur_modify + id,site_id,date_orig,date_last,parent_id,invoice_id,invoice_item_id,account_id,account_billing_id,product_id,sku,active,bind,type,price,price_type,taxable,queue,date_last_invoice,date_next_invoice,recur_type,recur_schedule,recur_weekday,recur_week,recur_schedule_change,recur_cancel,group_grant,group_type,group_days,host_server_id,host_provision_plugin_data,host_ip,host_username,host_password,domain_name,domain_tld,domain_term,domain_type,domain_date_expire,domain_host_tld_id,domain_host_registrar_id,suspend_billing,prod_plugin_name,prod_plugin_data,recur_modify + id,site_id,date_orig,date_last,parent_id,invoice_id,invoice_item_id,account_id,account_billing_id,product_id,sku,active,bind,type,price,price_type,taxable,queue,date_last_invoice,date_next_invoice,recur_type,recur_schedule,recur_weekday,recur_week,recur_schedule_change,recur_cancel,group_grant,group_type,group_days,host_server_id,host_provision_plugin_data,host_ip,host_username,host_password,domain_name,domain_tld,domain_term,domain_type,domain_date_expire,domain_host_tld_id,domain_host_registrar_id,suspend_billing,prod_plugin_name,prod_plugin_data,recur_modify + id,date_orig,date_last,parent_id,invoice_id,invoice_item_id,account_id,account_billing_id,product_id,sku,active,bind,type,price,price_type,taxable,queue,date_last_invoice,date_next_invoice,recur_type,recur_schedule,recur_weekday,host_server_id,host_ip,host_username,host_password,domain_name,domain_tld,domain_term,domain_type,domain_date_expire,domain_host_tld_id,domain_host_registrar_id,suspend_billing + id,date_orig,date_last,parent_id,invoice_id,invoice_item_id,account_id,account_billing_id,product_id,sku,active,bind,type,price,price_type,taxable,queue,date_last_invoice,date_next_invoice,recur_type,recur_schedule,recur_weekday,host_server_id,host_ip,host_username,host_password,domain_name,domain_tld,domain_term,domain_type,domain_date_expire,domain_host_tld_id,domain_host_registrar_id,suspend_billing + id,date_orig,date_last,parent_id,invoice_id,invoice_item_id,account_id,account_billing_id,product_id,sku,active,bind,type,price,price_type,taxable,queue,date_last_invoice,date_next_invoice,recur_type,recur_schedule,recur_weekday,host_server_id,host_ip,host_username,host_password,domain_name,domain_tld,domain_term,domain_type,domain_date_expire,domain_host_tld_id,domain_host_registrar_id,suspend_billing + id,date_orig,date_last,parent_id,invoice_id,invoice_item_id,account_id,account_billing_id,product_id,sku,active,bind,type,price,price_type,taxable,queue,date_last_invoice,date_next_invoice,recur_type,recur_schedule,recur_weekday,host_server_id,host_ip,host_username,host_password,domain_name,domain_tld,domain_term,domain_type,domain_date_expire,domain_host_tld_id,domain_host_registrar_id,suspend_billing + id,date_orig,date_last,parent_id,invoice_id,invoice_item_id,account_id,account_billing_id,product_id,sku,active,bind,type,price,price_type,taxable,queue,date_last_invoice,date_next_invoice,recur_type,recur_schedule,recur_weekday,host_server_id,host_ip,host_username,host_password,domain_name,domain_tld,domain_term,domain_type,domain_date_expire,domain_host_tld_id,domain_host_registrar_id,suspend_billing + + + + + + + + <add>Add Service</add> + <search_form>Search</search_form> + <user_modify>Modify Service</user_modify> + <user_view>Service</user_view> + <view>Service</view> + + + + + + + id + checkbox + 25px + + + account_id + + + sku + + + queue + + + price + + + 20px + + + + + id + checkbox + 25px + + + date_orig + date + + + sku + + + queue + + + price + + + 20px + + +
    diff --git a/modules/service/service_install.xml b/modules/service/service_install.xml index fde41d7e..f4608701 100644 --- a/modules/service/service_install.xml +++ b/modules/service/service_install.xml @@ -1,60 +1,82 @@ + + - service - account_admin - + + + + Service + 1 + + service + + + + account + + + + - - - - add - - 1 - - - view - - 1 - - - search - - 1 - - - update - - - delete - - - search_form - - - search_show - - - search_export - - - queue - - - admin_changeschedule - - - cancelservice - - - resend_hosting_email - - - add_tpl - - - modify - - - - \ No newline at end of file + + + + + Add + 1 + add + + + + delete + + + + List + 1 + search + + + + + Search + 1 + search_form + + + + search_show + + + + update + + + + view + + + + admin_changeschedule + + + cancelservice + + + modify + + + queue + + + resend_hosting_email + + + search_export + + + tpl_add + + + diff --git a/modules/service_memo/service_memo.inc.php b/modules/service_memo/service_memo.inc.php index 461aea3a..0bc23e9c 100644 --- a/modules/service_memo/service_memo.inc.php +++ b/modules/service_memo/service_memo.inc.php @@ -1,125 +1,33 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Module:Service */ - -class service_memo -{ - # Open the constructor for this mod - function service_memo() - { - # name of this module: - $this->module = "service_memo"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } +/** + * The main AgileBill Service Memo Class + * + * @package AgileBill + * @subpackage Module:Service + */ +class service_memo extends OSB_module { } -?> \ No newline at end of file +?> diff --git a/modules/service_memo/service_memo_construct.xml b/modules/service_memo/service_memo_construct.xml index 6d9b6451..5582a8b2 100644 --- a/modules/service_memo/service_memo_construct.xml +++ b/modules/service_memo/service_memo_construct.xml @@ -1,63 +1,100 @@ - - service_memo - - service_memo
    - - service - - 0 - - date_orig - - 25 - - - service_id - memo - - - - - I8 - - - I4 - - - I8 - date-time - date-now - - - I8 - account - username - - - I8 - - - C(32) - any - - - C(255) - any - - - C(32) - - - - - id,site_id,date_orig,staff_id,service_id,type,memo - id,site_id,date_orig,staff_id,service_id,type,memo - id,site_id,date_orig,staff_id,service_id,type,memo - id,site_id,date_orig,staff_id,service_id,type,memo - id,site_id,date_orig,staff_id,service_id,type,memo - - - 0 + + service_memo + + service_memo
    + + service + + 0 + + date_orig + + 25 + + + + service_id + memo + + + + + <add>Add Service Memo</add> + <view>Service Memo</view> + + + + + + I8 + + + I4 + + + Date + I8 + date-time + date-now + + + Staff + I8 + account + username + + + Service + I8 + + + Type + C(32) + any + + + Memo + C(255) + any + + + C(32) + + + + + + date_orig,staff_id,service_id,type,memo + id,site_id,date_orig,staff_id,service_id,type,memo + id,site_id,date_orig,staff_id,service_id,type,memo + id,site_id,date_orig,staff_id,service_id,type,memo + id,site_id,date_orig,staff_id,service_id,type,memo + + + + 0 + + + + + + id + 25px + + + date_orig + + + staff_id + + + type + + + memo + + +
    diff --git a/modules/service_memo/service_memo_install.xml b/modules/service_memo/service_memo_install.xml index b7bec6db..1ef0818c 100644 --- a/modules/service_memo/service_memo_install.xml +++ b/modules/service_memo/service_memo_install.xml @@ -1,10 +1,11 @@ service_memo - service_memo - + service + service + @@ -23,11 +24,11 @@ search - search_form + search_form - search_show + search_show - \ No newline at end of file + diff --git a/modules/session/session.inc.php b/modules/session/session.inc.php index adf60b6f..fc766ac0 100644 --- a/modules/session/session.inc.php +++ b/modules/session/session.inc.php @@ -1,144 +1,33 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Modules:Session */ - -class session -{ - # Open the constructor for this mod - function session() - { - # name of this module: - $this->module = "session"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - - ############################## - ## GRAPH STATISTICS ## - ############################## - function graph($start, $end, $constraint, $default) - { - global $C_translate; - - - $db = &DB(); - $sql = 'SELECT date_orig FROM ' . AGILE_DB_PREFIX . 'session WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - date_orig >= ' . $db->qstr($start) . ' AND - date_orig <= ' . $db->qstr($end); - - $result = $db->Execute($sql); - if($result->RecordCount() == 0) - { - $arr['title'] = $C_translate->translate('search_no_results','',''); - $arr['results'] = $default; - return $arr; - } - $ii=0; - while(!$result->EOF) - { - $d = $result->fields['date_orig']; - for($i=0; $i= $constraint[$i]["start"] && $d < $constraint[$i]["end"]) - $default[$i]++; - $ii++; - } - $result->MoveNext(); - } - - $C_translate->value['session']['count'] = $result->RecordCount(); - $title = $C_translate->translate('statistics','session',''); - $arr['title'] = $title; - $arr['results'] = $default; - return $arr; - } - - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } +/** + * The main AgileBill Session Class + * + * @package AgileBill + * @subpackage Modules:Session + */ +class session extends OSB_module { } -?> \ No newline at end of file +?> diff --git a/modules/session/session_construct.xml b/modules/session/session_construct.xml index a1c136fb..db30d4bd 100644 --- a/modules/session/session_construct.xml +++ b/modules/session/session_construct.xml @@ -1,95 +1,153 @@ - - session - - session
    - - - - 0 - - date_last - - 25 - - - date_expire - logged - account_id - campaign_id - - - - - C(32) - 1 - 1 - - - I4 - 1 - - - I8 - date - - - I8 - date - - - I8 - date - - - L - - - C(128) - - - C(32) - - - I4 - - - C(32) - - - I4 - - - I4 - - - I8 - account - username - - - I4 - - - C(32) - - - I4 - - - C(255) - - - C(255) - - - - - id,site_id,date_orig,date_last,date_expire,logged,ip,theme_id,country_id,language_id,currency_id,weight_id,account_id,reseller_id,affiliate_id,discounts - id,site_id,date_orig,date_last,date_expire,logged,ip,theme_id,country_id,language_id,currency_id,weight_id,account_id,reseller_id,affiliate_id,discounts - id,site_id,date_orig,date_last,date_expire,logged,ip,theme_id,country_id,language_id,currency_id,weight_id,account_id,reseller_id,affiliate_id,discounts - - - 0 + + session + + session
    + + + + 0 + + date_last + + 25 + + 0 + + + + date_expire + logged + account_id + campaign_id + + + + + + + 1 + C(32) + 1 + + + + 1 + I4 + + + + date-now + Date Created + I8 + + + + date-now + Date Updated + I8 + + + I8 + date + Date Expire + + + L + Session Logged + + + C(128) + IP Address + + + C(32) + Theme + + + I4 + Country + + + C(32) + Language + + + I4 + Currency + + + I4 + Weight Unit + + + I8 + account + username + Account + + + I4 + Reseller + + + C(32) + Affiliate + + + I4 + Campaign + + + C(255) + + + C(255) + + + + + + id,site_id,date_orig,date_last,date_expire,logged,ip,theme_id,country_id,language_id,currency_id,weight_id,account_id,reseller_id,affiliate_id,discounts + id,site_id,date_orig,date_last,date_expire,logged,ip,theme_id,country_id,language_id,currency_id,weight_id,account_id,reseller_id,affiliate_id,discounts + id,site_id,date_orig,date_last,date_expire,logged,ip,theme_id,country_id,language_id,currency_id,weight_id,account_id,reseller_id,affiliate_id,discounts + + + + + + + + <search_form>Search</search_form> + <view>Session</view> + + + + + + + id + checkbox + 25px + + + date_orig + date + + + date_last + date + + + ip + + + account_id + + + 60px + + +
    diff --git a/modules/session/session_install.xml b/modules/session/session_install.xml index 9eb4637a..06290e5a 100644 --- a/modules/session/session_install.xml +++ b/modules/session/session_install.xml @@ -1,35 +1,53 @@ + + - session - account_admin - + + + + Session + 1 + + session + + + + account + + + + base - - - - search - - 1 - - - view - - 1 - - - delete - - - update - - - search_form - - - search_show - - - - - \ No newline at end of file + + + + + delete + + + + List + 1 + search + + + + + search_form + + + + search_show + + + + update + + + + view + + + + diff --git a/modules/session_auth_cache/session_auth_cache_install.xml b/modules/session_auth_cache/session_auth_cache_install.xml index 2e42b8fc..c8dbc345 100644 --- a/modules/session_auth_cache/session_auth_cache_install.xml +++ b/modules/session_auth_cache/session_auth_cache_install.xml @@ -1,11 +1,12 @@ session_auth_cache - session_auth_cache + session + base - \ No newline at end of file + diff --git a/modules/setup/setup.inc.php b/modules/setup/setup.inc.php index 6f1592ed..31f37d19 100644 --- a/modules/setup/setup.inc.php +++ b/modules/setup/setup.inc.php @@ -1,152 +1,77 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Modules:Setup */ - -class setup -{ - # Open the constructor for this mod - function setup() - { - # name of this module: - $this->module = "setup"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - ############################## - ## SEARCH ## - ############################## - - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - - function update($VAR) - { +/** + * The main AgileBill Setup Class + * + * @package AgileBill + * @subpackage Modules:Setup + */ +class setup extends OSB_module { + /** + * Update the Database with setup configuration + */ + public function update($VAR) { if ($VAR['setup_currency_id'] != DEFAULT_CURRENCY) $curr = true; else - $curr = false; + $curr = false; - # make sure the index.php file is not included at the end: - if(!empty($VAR['setup_ssl_url'])) - $VAR['setup_ssl_url'] = eregi_replace('index.php', '', $VAR['setup_ssl_url']); - if(!empty($VAR['setup_nonssl_url'])) - $VAR['setup_nonssl_url'] = eregi_replace('index.php', '', $VAR['setup_nonssl_url']); + foreach (array('setup_ssl_url','setup_nonssl_url') as $index) { + # Make sure the index.php file is not included at the end: + if (! empty($VAR[$index])) + $VAR[$index] = preg_replace('/index.php$/','',$VAR[$index]); - # Validate trailing slash is on the end of the URL: - if(!empty($VAR['setup_ssl_url']) && !ereg('/$', $VAR['setup_ssl_url'])) - $VAR['setup_ssl_url'] .= '/'; - # Validate trailing slash is on the end of the URL: - if(!empty($VAR['setup_nonssl_url']) && !ereg('/$', $VAR['setup_nonssl_url'])) - $VAR['setup_nonssl_url'] .= '/'; + # Validate trailing slash is on the end of the URL: + if (! empty($VAR[$index]) && ! preg_match('#/$#',$VAR[$index])) + $VAR[$index] .= '/'; + } - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $rs = $db->update($VAR, $this, $type); + $result = parent::update($VAR); - if($rs && $curr) - { - /* Start: Update all sessions & accounts */ + # Start: Update all sessions & accounts + if ($result && $curr) { $db = &DB(); - $sql = "UPDATE ".AGILE_DB_PREFIX."session - SET - currency_id = ".$db->qstr($VAR['setup_currency_id'])." - WHERE - site_id = ".$db->qstr(DEFAULT_SITE)." AND - currency_id != ".$db->qstr($VAR['setup_currency_id']); - $rs = $db->Execute($sql); - $sql = "UPDATE ".AGILE_DB_PREFIX."account - SET - currency_id = ".$db->qstr($VAR['setup_currency_id'])." - WHERE - site_id = ".$db->qstr(DEFAULT_SITE)." AND - currency_id != ".$db->qstr($VAR['setup_currency_id']); - $rs = $db->Execute($sql); - /* End: SQL Insert Statement */ + $rs = $db->Execute(sqlUpdate($db,'session',array('currency_id'=>$VAR['setup_currency_id']),sprintf('currency_id !=',$VAR['setup_currency_id']))); + $rs = $db->Execute(sqlUpdate($db,'account',array('currency_id'=>$VAR['setup_currency_id']),sprintf('currency_id !=',$VAR['setup_currency_id']))); } # Clear out the cache entry - if (defined("AGILE_CORE_CACHE_DIR") && AGILE_CORE_CACHE_DIR != '') { + if (defined('AGILE_CORE_CACHE_DIR') && AGILE_CORE_CACHE_DIR != '') { $tfile = AGILE_CORE_CACHE_DIR."core-setup"; - if (file_exists($tfile)) { - unlink(AGILE_CORE_CACHE_DIR."core-setup"); - } + + if (file_exists($tfile)) + unlink(AGILE_CORE_CACHE_DIR.'core-setup'); } } - - ############################## - ## PHP_INFO ## - ############################## - - function _php_info() { + /** + * Call PHP Info + */ + public function _php_info() { phpinfo(); } } -?> \ No newline at end of file +?> diff --git a/modules/setup/setup_construct.xml b/modules/setup/setup_construct.xml index c0e2abc7..181b5f38 100644 --- a/modules/setup/setup_construct.xml +++ b/modules/setup/setup_construct.xml @@ -1,266 +1,372 @@ - - setup - - setup
    - - - - 0 - - site_id - - 10 - - - - I4 - 1 - 1 - - - I4 - 1 - 1 - - - I4 - - - C(16) - - - I4 - - - I4 - - - C(16) - default - - - C(16) - default_admin - - - I4 - 1 - - - I4 - - - I4 - - - I4 - - - I4 - - - X - 1 - 255 - any - - - X - 1 - 255 - any - - - I4 - 1 - 999999 - numeric - - - C(32) - 1 - 32 - - - I4 - 1 - 999999 - numeric - - - L - 0 - - - C(16) - 1 - - - X - 1 - 255 - any - - - X - 1 - 255 - email - - - X - - - X - any - array - - - C(128) - array - - - I4 - 1 - 100 - numeric - - - L - - - I4 - 1 - 100000 - numeric - - - I4 - 1 - 100000 - numeric - - - I4 - 1 - 100000000 - numeric - - - I4 - 1 - 1000000000 - numeric - - - L - - - L - - - L - - - L - - - L - - - C(128) - - - C(32) - - - C(16) - - - C(16) - - - C(32) - - - C(32) - - - L - - - L - - - C(64) - - - L - - - L - - - L - - - L - - - L - - - L - - - L - - - L - - - L - - - L - - - L - - - L - - - L - - - C(2) - - - C(2) - - - C(2) - - - C(2) - - - C(128) - - - X2 - - - - - id,db_cache,newsletter_registration,default_account_status,cache_sessions,site_id,setup_email_id,country_id,language_id,currency_id,weight_id,theme_id,group_id,affiliate_id,affiliate_template_id,reseller_id,ssl_url,nonssl_url,login_expire,cookie_name,cookie_expire,session_ip_match,error_reporting,site_name,site_email,time_format,date_format,date_time_format,decimal_place,debug,login_attempt_try,login_attempt_time,login_attempt_lock,search_expire,weblog,admin_theme_id,license_key,license_code,site_address,site_city,site_state,site_zip,site_phone,site_fax,os,path_curl,show_affiliate_link,show_ticket_link,show_newsletter_link,show_contact_link,show_domain_link,show_cart_link,show_checkout_link,show_cat_block,show_product_link,show_file_block,show_static_block,show_affiliate_code,show_discount_code,billing_weekday,grace_period,max_billing_notice,max_inv_gen_period,auto_affiliate - id,db_cache,newsletter_registration,default_account_status,cache_sessions,site_id,setup_email_id,country_id,language_id,currency_id,weight_id,theme_id,group_id,affiliate_id,affiliate_template_id,reseller_id,ssl_url,nonssl_url,login_expire,cookie_name,cookie_expire,session_ip_match,error_reporting,site_name,site_email,time_format,date_format,date_time_format,decimal_place,debug,login_attempt_try,login_attempt_time,login_attempt_lock,search_expire,weblog,admin_theme_id,license_key,license_code,site_address,site_city,site_state,site_zip,site_phone,site_fax,os,path_curl,show_affiliate_link,show_ticket_link,show_newsletter_link,show_contact_link,show_domain_link,show_cart_link,show_checkout_link,show_cat_block,show_file_block,show_product_link,show_static_block,show_affiliate_code,show_discount_code,billing_weekday,grace_period,max_billing_notice,max_inv_gen_period,auto_affiliate - id,site_id,newsletter_registration,setup_email_id,country_id,language_id,currency_id,weight_id,theme_id,group_id,affiliate_id,reseller_id,ssl_url,nonssl_url,login_expire,cookie_name,cookie_expire,affiliate_template_id,session_ip_match,error_reporting,site_name,site_email,time_format,date_format,date_time_format,decimal_place,debug,login_attempt_try,login_attempt_time,login_attempt_lock,search_expire,weblog,admin_theme_id,license_key,license_code,max_inv_gen_period - id,site_id,newsletter_registration,setup_email_id,country_id,language_id,currency_id,weight_id,theme_id,group_id,affiliate_id,reseller_id,ssl_url,nonssl_url,login_expire,cookie_name,affiliate_template_id,cookie_expire,session_ip_match,error_reporting,site_name,site_email,time_format,date_format,date_time_format,decimal_place,debug,login_attempt_try,login_attempt_time,login_attempt_lock,search_expire,weblog,admin_theme_id,license_key,license_code,max_inv_gen_period - - - 0 + + setup + + setup
    + + + + 0 + + site_id + + 10 + + 1 + + + + + + + + + + 1 + I4 + 1 + + + + 1 + I4 + 1 + + + + date-now + Date Created + I8 + + + + Active + L + + + I4 + Country Name + + + C(16) + Language + + + I4 + Currency + + + I4 + Weight Unit + + + C(16) + default + Theme + + + C(16) + default_admin + Admin Theme + + + I4 + 1 + Default Group for New Users + + + + I4 + + + + I4 + + + + I4 + + + + I4 + + + X + 1 + 255 + any + SSL URL for Site + + + X + 1 + 255 + any + NON SSL URL for Site + + + I4 + 1 + 999999 + numeric + Login Expire Time + + + C(32) + 1 + 32 + Cookie Name + + + I4 + 1 + 999999 + numeric + Cookie Expire Time + + + + L + 0 + + + C(16) + 1 + Debug Error Reporting + + + X + 1 + 255 + any + Company Name + + + X + 1 + 255 + email + Site Email Address + + + X + Time Format + + + X + any + array + Date Format + + + + C(128) + array + + + I4 + 1 + 100 + numeric + Decimal Places + Decimal Places to use when showing currency on the website + + + L + Debugging Enabled + + + I4 + 1 + 100000 + numeric + Allows Login Attempts + + + I4 + 1 + 100000 + numeric + Allows Login Attempt Time + + + I4 + 1 + 100000000 + numeric + Account Lock Time + + + I4 + 1 + 1000000000 + numeric + Search Expire Time + + + L + Cache DB Connections + + + L + Newsletter Registration + Show Newsletter registration on the Register Page + + + L + Accounts Require Verification + Users who register will need to verify their account by clicking on a URL that is sent to them via email + + + L + Cache Sessions + + + + L + + + C(128) + Site Address + + + C(32) + Site City + + + C(16) + Site State + + + C(16) + Site Postal Code + + + C(32) + Site Phone Number + + + C(32) + Site Fax Number + + + L + Site Operating System + + + L + Automatically make new users affliates + + + + C(64) + Path to CURL + + + + L + + + L + Show Newsletter Link + Show Newsletter Link on Registration Page + + + L + Show Domain Link + + + L + Show Contact Us Link + + + L + Show Cart Link + + + L + Show Checkout Link + + + L + Show Product Link + + + L + Show Product Category Block + + + L + Show Static Page Block + + + + L + + + + L + + + + C(2) + + + + C(2) + + + + C(2) + + + + C(2) + + + + C(128) + + + + X2 + + + + + + id,db_cache,newsletter_registration,default_account_status,cache_sessions,site_id,setup_email_id,country_id,language_id,currency_id,weight_id,theme_id,group_id,affiliate_id,affiliate_template_id,reseller_id,ssl_url,nonssl_url,login_expire,cookie_name,cookie_expire,session_ip_match,error_reporting,site_name,site_email,time_format,date_format,date_time_format,decimal_place,debug,login_attempt_try,login_attempt_time,login_attempt_lock,search_expire,weblog,admin_theme_id,site_address,site_city,site_state,site_zip,site_phone,site_fax,os,path_curl,show_affiliate_link,show_newsletter_link,show_contact_link,show_domain_link,show_cart_link,show_checkout_link,show_cat_block,show_product_link,show_static_block,show_affiliate_code,show_discount_code,billing_weekday,grace_period,max_billing_notice,max_inv_gen_period,auto_affiliate + id,db_cache,newsletter_registration,default_account_status,cache_sessions,site_id,setup_email_id,country_id,language_id,currency_id,weight_id,theme_id,group_id,affiliate_id,affiliate_template_id,reseller_id,ssl_url,nonssl_url,login_expire,cookie_name,cookie_expire,session_ip_match,error_reporting,site_name,site_email,time_format,date_format,date_time_format,decimal_place,debug,login_attempt_try,login_attempt_time,login_attempt_lock,search_expire,weblog,admin_theme_id,site_address,site_city,site_state,site_zip,site_phone,site_fax,os,path_curl,show_affiliate_link,show_newsletter_link,show_contact_link,show_domain_link,show_cart_link,show_checkout_link,show_cat_block,show_product_link,show_static_block,show_affiliate_code,show_discount_code,billing_weekday,grace_period,max_billing_notice,max_inv_gen_period,auto_affiliate + id,site_id,newsletter_registration,setup_email_id,country_id,language_id,currency_id,weight_id,theme_id,group_id,affiliate_id,reseller_id,ssl_url,nonssl_url,login_expire,cookie_name,cookie_expire,affiliate_template_id,session_ip_match,error_reporting,site_name,site_email,time_format,date_format,date_time_format,decimal_place,debug,login_attempt_try,login_attempt_time,login_attempt_lock,search_expire,weblog,admin_theme_id,max_inv_gen_period + id,site_id,newsletter_registration,setup_email_id,country_id,language_id,currency_id,weight_id,theme_id,group_id,affiliate_id,reseller_id,ssl_url,nonssl_url,login_expire,cookie_name,affiliate_template_id,cookie_expire,session_ip_match,error_reporting,site_name,site_email,time_format,date_format,date_time_format,decimal_place,debug,login_attempt_try,login_attempt_time,login_attempt_lock,search_expire,weblog,admin_theme_id,max_inv_gen_period + + + + + + + + <view>Setup Company</view> + + + + + + + id + checkbox + 25px + + + id + + + site_name + + + nonssl_url + + +
    diff --git a/modules/setup/setup_install.xml b/modules/setup/setup_install.xml index 0436af8b..ade06424 100644 --- a/modules/setup/setup_install.xml +++ b/modules/setup/setup_install.xml @@ -1,31 +1,52 @@ + + - setup - setup - + + + + Setup + 1 + + setup + + + + + + + + base - - - - search - - - view - - - update - - 1 - - - search_show - - <_php_info> - _php_info - - 1 - - - - \ No newline at end of file + + + + + Update + 1 + search + + + + + search_show + + + + update + + + + view + + + <_php_info> + PHP Info + 1 + _php_info + + + + + diff --git a/modules/setup/setup_install_data.xml b/modules/setup/setup_install_data.xml index 57acb83f..df5dbfd2 100644 --- a/modules/setup/setup_install_data.xml +++ b/modules/setup/setup_install_data.xml @@ -1,64 +1,68 @@ - - 1 - 1 - 840 - english - 1 - 1 - default - default_admin - 2 - 1 - 0 - 0 - 1 - - - 86400 - CookieName - 0 - 0 - E_ALL - Company.com - sales@company.com - g:i A - - - 2 - 1 - 10 - 60 - 60 - 600 - 0 - 1 - 0 - 1 - 0 - 0 - 0 - 0 - 1 - 0 - 1 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - 1 - 1 - 3 - 3 - 7 - 63689401-9161-10043421 - 0 - - - 2 - - \ No newline at end of file + + 1 + 1 + 61 + english + 6 + 1 + default + default_admin + 2 + + + + + + + 86400 + CookieName + 0 + 0 + E_ALL + ACME Web Billing + sales@example.com + 100 Street Road + Melbourne + VIC + 3000 + +61 3 1234 5678 + +61 3 1234 5679 + g:i A + + + 2 + 1 + 10 + 60 + 60 + 600 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 3 + 3 + 7 + 63689401-9161-10043421 + 0 + + + 2 + + diff --git a/modules/setup_email/setup_email.inc.php b/modules/setup_email/setup_email.inc.php index 67a1a6cd..8804aefa 100644 --- a/modules/setup_email/setup_email.inc.php +++ b/modules/setup_email/setup_email.inc.php @@ -1,125 +1,33 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Module:Setup */ - -class setup_email -{ - # Open the constructor for this mod - function setup_email() - { - # name of this module: - $this->module = "setup_email"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } +/** + * The main AgileBill Setup Email Class + * + * @package AgileBill + * @subpackage Module:Setup + */ +class setup_email extends OSB_module { } -?> \ No newline at end of file +?> diff --git a/modules/setup_email/setup_email_construct.xml b/modules/setup_email/setup_email_construct.xml index acd1645d..7543f4eb 100644 --- a/modules/setup_email/setup_email_construct.xml +++ b/modules/setup_email/setup_email_construct.xml @@ -1,95 +1,154 @@ - - setup_email - - setup_email
    - - - - 0 - - name - - 25 - - - - I4 - - - I4 - 1 - - - I8 - - - C(128) - 1 - 128 - any - - - X2 - - - L - - - C(128) - 1 - 128 - any - - - C(128) - 1 - 128 - any - - - X2 - - - X2 - - - C(128) - - - C(128) - - - C(128) - - - C(4) - - - C(128) - - - C(128) - - - C(128) - - - C(4) - - - L - - - - - id,site_id,account_id,name,notes,type,from_name,from_email,cc_list,bcc_list,server,username,password,piping,piping_host,piping_username,piping_password,piping_action,queue - id,site_id,account_id,name,notes,type,from_name,from_email,cc_list,bcc_list,server,username,password,piping,piping_host,piping_username,piping_password,piping_action,queue - id,site_id,account_id,name,notes,type,from_name,from_email,cc_list,bcc_list,server,username,password,piping,piping_host,piping_username,piping_password,piping_action,queue - id,site_id,account_id,name,notes,type,from_name,from_email,cc_list,bcc_list,server,username,password,piping,piping_host,piping_username,piping_password,piping_action,queue - id,site_id,account_id,name,notes,type,from_name,from_email,cc_list,bcc_list,server,username,password,piping,piping_host,piping_username,piping_password,piping_action,queue - - - 0 + + setup_email + + setup_email
    + + + + 0 + + name + + 25 + + 1 + + + + + + + + + + 1 + I4 + 1 + + + + 1 + I4 + + + I8 + + + Name + 1 + 128 + C(128) + any + + + Notes + X2 + + + SMTP Account + L + + + From Name + C(128) + 1 + 128 + any + + + From Email + C(128) + 1 + 128 + any + + + CC List + X2 + + + BCC List + X2 + + + Server + required only for SMTP - smtp.srv1.com;mail.srv2.com + C(128) + + + Username + required only for SMTP + C(128) + + + Password + required only for SMTP + C(128) + + + Message Retrieval Method + C(4) + + + Host for Message Retrieval + C(128) + + + Username + C(128) + + + Password + C(128) + + + Action after Message Retrieval + C(4) + + + Queue E-mails + L + + + + + + id,site_id,account_id,name,notes,type,from_name,from_email,cc_list,bcc_list,server,username,password,piping,piping_host,piping_username,piping_password,piping_action,queue + id,site_id,account_id,name,notes,type,from_name,from_email,cc_list,bcc_list,server,username,password,piping,piping_host,piping_username,piping_password,piping_action,queue + id,site_id,account_id,name,notes,type,from_name,from_email,cc_list,bcc_list,server,username,password,piping,piping_host,piping_username,piping_password,piping_action,queue + id,site_id,account_id,name,notes,type,from_name,from_email,cc_list,bcc_list,server,username,password,piping,piping_host,piping_username,piping_password,piping_action,queue + id,site_id,account_id,name,notes,type,from_name,from_email,cc_list,bcc_list,server,username,password,piping,piping_host,piping_username,piping_password,piping_action,queue + + + + + + + + + + + + + + id + checkbox + 25px + + + name + + + type + + + from_name + + + from_email + + +
    diff --git a/modules/setup_email/setup_email_install.xml b/modules/setup_email/setup_email_install.xml index 246bf193..2516e9ee 100644 --- a/modules/setup_email/setup_email_install.xml +++ b/modules/setup_email/setup_email_install.xml @@ -1,36 +1,55 @@ + + - setup_email - setup - + + + + Setup Email + 1 + + setup_email + + + + setup + + + + base - - - - search - - - view - - - 1 - - - add - - 1 - - - delete - - - update - - - search_show - - - - - \ No newline at end of file + + + + + Add + 1 + add + + + + delete + + + + List + 1 + search + + + + + search_show + + + + update + + + + view + + + + diff --git a/modules/setup_invoice/setup_invoice.inc.php b/modules/setup_invoice/setup_invoice.inc.php index 02ad1d10..01abe5f8 100644 --- a/modules/setup_invoice/setup_invoice.inc.php +++ b/modules/setup_invoice/setup_invoice.inc.php @@ -1,71 +1,33 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Modules:Invoice */ - -class setup_invoice -{ - function setup_invoice() - { - $this->module = "setup_invoice"; - $this->xml_construct = PATH_MODULES . $this->module . "/" . $this->module . "_construct.xml"; - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } - - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $rs = $db->update($VAR, $this, $type); - } +/** + * The main AgileBill Invoice Setup Class + * + * @package AgileBill + * @subpackage Modules:Invoice + */ +class setup_invoice extends OSB_module { } -?> \ No newline at end of file +?> diff --git a/modules/setup_invoice/setup_invoice_construct.xml b/modules/setup_invoice/setup_invoice_construct.xml index d5707d73..b98e407e 100644 --- a/modules/setup_invoice/setup_invoice_construct.xml +++ b/modules/setup_invoice/setup_invoice_construct.xml @@ -1,84 +1,151 @@ - - setup_invoice - setup_invoice
    - - 0 - site_id - 10 - - - I4 - 1 - 1 - - - I4 - 1 - 1 - - - L + + + setup_invoice + + setup_invoice
    + + + + 15 + + site_id + + 25 + + 1 + + + + + + + + + + 1 + I4 + 1 + + + + 1 + I4 + 1 + + + L 1 - - - C(8) - - - I4 - 5 - - - I4 + Bill to company name + This field controls whether generated invoices should be addressed to the company name, or to the account holders name +
    + + C(8) + Currency Symbol to use on invoice + When rendering invoices, this symbol will be used to show the currency eg: $ + + + I4 + 2 + Number of decimals to use for money amounts + + + I4 16 - - - X - default - - - I4 - 1 - - - I4 - - - L - 1 - - - L - 0 - - - I4 - - - I4 - - - I4 - + Maximum number of summary line items to use on the summary page + + + X + + News to show on invoices + The news will show on the summary page + + + C(8) + blank + PDF Template for invoices + This is only applicable for FPDI templates + + + I4 + Invoice delivery method + + + L + 1 + Show itemised items on the invoice + + + L + 1 + Show date ranges with items + When showing itemised items, show the date ranges that the items are valid for + + + + I4 + + + I4 + Generate invoices days in advance + Generate invoices this many days before the due date of the service item + + + + I4 + C(16) overview + PDF Plugin for invoices + PDF Plugin to use when generating PDF invoices + C(64) + C(64) I4 + Upcoming invoices days in advance + Show upcoming invoices this many days before they would be generated -
    - - id,bill_to_company,invoice_currency,invoice_decimals,items_summary_max,news,page_type,invoice_show_itemized,invoice_show_service_dates,invoice_delivery,invoice_grace,invoice_advance_gen,invoice_terms,invoice_pdf_plugin,contact_us_url,contact_us_phone,advance_notice - id,bill_to_company,invoice_currency,invoice_decimals,items_summary_max,news,page_type,invoice_show_itemized,invoice_show_service_dates,invoice_delivery,invoice_grace,invoice_advance_gen,invoice_terms,invoice_pdf_plugin,contact_us_url,contact_us_phone,advance_notice - id,bill_to_company,invoice_currency,invoice_decimals,items_summary_max,news,page_type,invoice_show_itemized,invoice_show_service_dates,invoice_delivery,invoice_grace,invoice_advance_gen,invoice_terms,invoice_pdf_plugin,contact_us_url,contact_us_phone,advance_notice - id,bill_to_company,invoice_currency,invoice_decimals,items_summary_max,news,page_type,invoice_show_itemized,invoice_show_service_dates,invoice_delivery,invoice_grace,invoice_advance_gen,invoice_terms,invoice_pdf_plugin,contact_us_url,contact_us_phone,advance_notice - - 0 + + + + + id,bill_to_company,invoice_currency,invoice_decimals,items_summary_max,news,page_type,invoice_show_itemized,invoice_show_service_dates,invoice_delivery,invoice_grace,invoice_advance_gen,invoice_terms,invoice_pdf_plugin,advance_notice,invoice_advance_gen + id,bill_to_company,invoice_currency,invoice_decimals,items_summary_max,news,page_type,invoice_show_itemized,invoice_show_service_dates,invoice_delivery,invoice_grace,invoice_advance_gen,invoice_terms,invoice_pdf_plugin,advance_notice,invoice_advance_gen + id,bill_to_company,invoice_currency,invoice_decimals,items_summary_max,news,page_type,invoice_show_itemized,invoice_show_service_dates,invoice_delivery,invoice_grace,invoice_advance_gen,invoice_terms,invoice_pdf_plugin,advance_notice + id,bill_to_company,invoice_currency,invoice_decimals,items_summary_max,news,page_type,invoice_show_itemized,invoice_show_service_dates,invoice_delivery,invoice_grace,invoice_advance_gen,invoice_terms,invoice_pdf_plugin,advance_notice + + + + + + + + <view>Setup Invoice</view> + + + + + + + id + checkbox + 25px + + + id + + + news + 70% + + +
    diff --git a/modules/setup_invoice/setup_invoice_install.xml b/modules/setup_invoice/setup_invoice_install.xml index 533c7cc8..77112368 100644 --- a/modules/setup_invoice/setup_invoice_install.xml +++ b/modules/setup_invoice/setup_invoice_install.xml @@ -1,26 +1,45 @@ + + - setup_invoice - setup - + + + + Setup Invoice + 1 + + setup_invoice + + + + setup + + + + - - - - search - - - view - core:search&module=%%&_escape=1&_next_page_one=view - 1 - - - update - - - search_show - - - - \ No newline at end of file + + + + + List + 1 + search + + + + + search_show + + + + update + + + + view + + + + diff --git a/modules/setup_invoice/setup_invoice_install_data.xml b/modules/setup_invoice/setup_invoice_install_data.xml index 394dcb02..08ec5f45 100644 --- a/modules/setup_invoice/setup_invoice_install_data.xml +++ b/modules/setup_invoice/setup_invoice_install_data.xml @@ -1,22 +1,25 @@ - - 1 - 1 - 1 - $ - 5 - 16 - - 1 - 0 - 1 - 0 - 0 - 0 - overview - - - 2 - - \ No newline at end of file + + 1 + 1 + 1 + $ + 2 + 16 + + blank + 1 + 1 + 0 + 0 + 0 + itemised_fpdf + itemised_fpdf + 7 + + + + 2 + + diff --git a/modules/staff/staff.inc.php b/modules/staff/staff.inc.php index b6fd741b..1f464ea3 100644 --- a/modules/staff/staff.inc.php +++ b/modules/staff/staff.inc.php @@ -1,374 +1,213 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Module:Staff */ - -class staff -{ - # Open the constructor for this mod - function staff() - { - # name of this module: - $this->module = "staff"; +/** + * The main AgileBill Staff Class + * + * @package AgileBill + * @subpackage Module:Staff + */ +class staff extends OSB_module { + /** + * EMAIL ONE STAFF MEMBER + */ + function contact($VAR) { + global $C_translate,$C_debug,$C_vars; - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - ############################## - ## EMAIL ONE STAFF MEMBER ## - ############################## - function contact($VAR) - { - global $C_translate, $C_debug, $C_vars; - - ## Validate the required vars (account_id, message, subject) - if(@$VAR['mail_email'] != "" && @$VAR['mail_name'] != "" && @$VAR['mail_subject'] != "" && @$VAR['mail_message'] != "") - { - include_once(PATH_CORE . 'validate.inc.php'); + # Validate the required vars (account_id, message, subject) + if (@$VAR['mail_email'] != '' && @$VAR['mail_name'] != '' && @$VAR['mail_subject'] != '' && @$VAR['mail_message'] != '') { + include_once(PATH_CORE.'validate.inc.php'); $validate = new CORE_validate; - if(!$validate->validate_email($VAR['mail_email'],'')) - { + + if (! $validate->validate_email($VAR['mail_email'],'')) { $C_debug->alert($C_translate->translate('validate_email','','')); $C_vars->strip_slashes_all(); + return; } - @$s = $VAR['mail_staff_id']; - @$d = $VAR['mail_department_id']; + @$s = $VAR['mail_staff_id']; + @$d = $VAR['mail_department_id']; + # Nothing to do + if ($s > 0) { - if ($s > 0) - { - ## Nothing to do - } - else if($d > 0) - { + } elseif($d > 0) { + # Verify the specified department && get the associated account: + $db = &DB(); + $dept = $db->Execute(sqlSelect($db,'staff_department','default_staff_id')); - ## Verify the specified department && get the associated account: - $db = &DB(); - $sql = 'SELECT default_staff_id FROM ' . AGILE_DB_PREFIX . 'staff_department WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - id = ' . $db->qstr($d); - $dept = $db->Execute($sql); - - if($dept->RecordCount() == 0) - { + if ($dept->RecordCount() == 0) { $C_debug->alert($C_translate->translate('error_dept_non_exist','staff','')); $C_vars->strip_slashes_all(); + return; } $s = $dept->fields['default_staff_id']; - } - else - { - ## staff/dept not specified + } else { + # staff/dept not specified $C_debug->alert($C_translate->translate('error_staff_dept','staff','')); $C_vars->strip_slashes_all(); + return; } - ## Verify the specified staff account && get the associated account: - $db = &DB(); - $sql = 'SELECT account_id FROM ' . AGILE_DB_PREFIX . 'staff WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - id = ' . $db->qstr($s); - $staff = $db->Execute($sql); + $db = &DB(); + $staff = $db->Execute(sqlSelect($db,'staff','account_id')); - if($staff->RecordCount() == 0) - { + if ($staff->RecordCount() == 0) { $C_debug->alert($C_translate->translate('error_staff_non_exist','staff','')); $C_vars->strip_slashes_all(); + return; } $account_id = $staff->fields['account_id']; - $sql = 'SELECT email,first_name,last_name FROM ' . AGILE_DB_PREFIX . 'account WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - id = ' . $db->qstr($account_id); - $account = $db->Execute($sql); + $account = $db->Execute(sqlSelect($db,'account','email,first_name,last_name')); - if($account->RecordCount() == 0) - { + if ($account->RecordCount() == 0) { $C_debug->alert($C_translate->translate('error_staff_non_exist','staff','')); $C_vars->strip_slashes_all(); + return; } - ### Validate any static vars, if defined + # Validate any static vars, if defined $this->validated = true; - if(!empty($VAR['static_relation'])) - { - require_once(PATH_CORE . 'static_var.inc.php'); + + if (! empty($VAR['static_relation'])) { + require_once(PATH_CORE.'static_var.inc.php'); $static_var = new CORE_static_var; - if(!isset($this->val_error)) - $this->val_error = false; + if (! isset($this->val_error)) + $this->val_error = false; $all_error = $static_var->validate_form('staff', $this->val_error); - if($all_error != false && gettype($all_error) == 'array') - { + if ($all_error != false && gettype($all_error) == 'array') { $this->validated = false; - } - else - { + + } else { $this->validated = true; # Get the fields and values and append to the message text... - while(list($id,$value) = each($VAR['static_relation'])) - { - if(!empty($value) && !empty($id)) - { + while (list($id,$value) = each($VAR['static_relation'])) { + if (! empty($value) && ! empty($id)) { # Get the name: $db = &DB(); - $sql = "SELECT static_var_id FROM ".AGILE_DB_PREFIX."static_relation WHERE - id = ".$db->qstr($id)." AND - site_id = ".$db->qstr(DEFAULT_SITE); - $rs = $db->Execute($sql); + $rs = $db->Execute(sqlSelect($db,'static_relation','static_var_id')); $var_id = $rs->fields['static_var_id']; - $sql = "SELECT name FROM ".AGILE_DB_PREFIX."static_var WHERE - id = ".$db->qstr($var_id)." AND - site_id = ".$db->qstr(DEFAULT_SITE); - $rs = $db->Execute($sql); + $rs = $db->Execute(sqlSelect($db,'static_var','name')); $name = $rs->fields['name']; - $ul = eregi_replace(".", "-", $name); + $ul = str_replace('.','-',$name); $VAR['mail_message'] .= "\r\n\r\n"; - $VAR['mail_message'] .= "$ul"; - $VAR['mail_message'] .= "\r\n"; - $VAR['mail_message'] .= "$name"; + $VAR['mail_message'] .= $ul; $VAR['mail_message'] .= "\r\n"; - $VAR['mail_message'] .= "$ul"; + $VAR['mail_message'] .= $name; $VAR['mail_message'] .= "\r\n"; - $VAR['mail_message'] .= "$value"; + $VAR['mail_message'] .= $ul; + $VAR['mail_message'] .= "\r\n"; + $VAR['mail_message'] .= $value; } - } + } } } - - - if(!$this->validated) - { - global $smarty; + if (! $this->validated) { + global $smarty; # set the errors as a Smarty Object - $smarty->assign('form_validation', $all_error); + $smarty->assign('form_validation',$all_error); # set the page to be loaded - if(!defined("FORCE_PAGE")) - define('FORCE_PAGE', $VAR['_page_current']); + if (! defined('FORCE_PAGE')) + define('FORCE_PAGE', $VAR['_page_current']); global $C_vars; $C_vars->strip_slashes_all(); return; - } + } - ################################################################ - ## OK to send the email: - - $E['from_html'] = true; - $E['from_name'] = $VAR['mail_name']; - $E['from_email'] = $VAR['mail_email']; + # OK to send the email: + $E['from_html'] = true; + $E['from_name'] = $VAR['mail_name']; + $E['from_email'] = $VAR['mail_email']; $db = &DB(); - $q = "SELECT * FROM ".AGILE_DB_PREFIX."setup_email WHERE - site_id = ".$db->qstr(DEFAULT_SITE)." AND - id = ".$db->qstr(DEFAULT_SETUP_EMAIL); - $setup_email = $db->Execute($q); + $setup_email = $db->Execute(sqlSelect($db,'setup_email','*')); - $E['priority'] = $VAR['mail_priority']; - $E['html'] = '0'; - $E['subject'] = $VAR['mail_subject']; - $E['body_text'] = $VAR['mail_message']; - $E['to_email'] = $account->fields['email']; - $E['to_name'] = $account->fields['first_name']; + $E['priority'] = $VAR['mail_priority']; + $E['html'] = '0'; + $E['subject'] = $VAR['mail_subject']; + $E['body_text'] = $VAR['mail_message']; + $E['to_email'] = $account->fields['email']; + $E['to_name'] = $account->fields['first_name']; - if($setup_email->fields['type'] == 0) - { + if ($setup_email->fields['type'] == 0) { $type = 0; - } - else - { + + } else { $type = 1; - $E['server'] = $setup_email->fields['server']; - $E['account'] = $setup_email->fields['username']; - $E['password'] = $setup_email->fields['password']; - } + $E['server'] = $setup_email->fields['server']; + $E['account'] = $setup_email->fields['username']; + $E['password'] = $setup_email->fields['password']; + } - if($setup_email->fields['cc_list'] != '') - $E['cc_list'] = explode(',', $setup_email->fields['cc_list']); + if ($setup_email->fields['cc_list'] != '') + $E['cc_list'] = explode(',',$setup_email->fields['cc_list']); - if($setup_email->fields['bcc_list'] != '') - $E['bcc_list'] = explode(',', $setup_email->fields['bcc_list']); + if ($setup_email->fields['bcc_list'] != '') + $E['bcc_list'] = explode(',',$setup_email->fields['bcc_list']); - - ### Call the mail() or smtp() function to send - require_once(PATH_CORE . 'email.inc.php'); + # Call the mail() or smtp() function to send + require_once(PATH_CORE.'email.inc.php'); $email = new CORE_email; - if($type == 0) - { + if ($type == 0) $email->PHP_Mail($E); - } else - { $email->SMTP_Mail($E); - } - } - else - { - ## Error message: + + } else { + # Error message: $C_debug->alert($C_translate->translate('error_req_fields','staff','')); $C_vars->strip_slashes_all(); + return; } - ## Success message: + # Success message: $C_debug->alert($C_translate->translate('mail_sent','staff','')); # Stripslashes $C_vars->strip_slashes_all(); } - - - - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } - - ############################## - ## STATIC VARS ## - ############################## - - function static_var($VAR) - { - global $smarty; - require_once(PATH_CORE . 'static_var.inc.php'); - $static_var = new CORE_static_var; - $arr = $static_var->generate_form('staff', 'add', 'update'); - - if(gettype($arr) == 'array') - { - ### Set everything as a smarty array, and return: - $smarty->assign('show_static_var', true); - $smarty->assign('static_var', $arr); - return true; - } - else - { - ### Or if no results: - $smarty->assign('show_static_var', false); - return false; - } - } } -?> \ No newline at end of file +?> diff --git a/modules/staff/staff_construct.xml b/modules/staff/staff_construct.xml index d634db8e..76d909e8 100644 --- a/modules/staff/staff_construct.xml +++ b/modules/staff/staff_construct.xml @@ -1,69 +1,115 @@ - - staff - - staff
    - - - - 0 - - id - - 25 - - - - I4 - 1 - 1 - - - I4 - - - I8 - date-now - - - C(16) - - - I8 - account - username - any - - - C(255) - any - array - - - C(128) - 1 - 128 - any - - - L - - - L - - - X2 - - - - - id,site_id,date_orig,account_id,department_avail,nickname,notify_new,notify_change,signature - id,site_id,date_orig,account_id,department_avail,nickname,notify_new,notify_change,signature - id,site_id,date_orig,account_id,department_avail,nickname,notify_new,notify_change,signature - id,site_id,date_orig,account_id,department_avail,nickname,notify_new,notify_change,signature - id,site_id,date_orig,account_id,department_avail,nickname,notify_new,notify_change,signature - - - 0 + + staff + + staff
    + + + + 0 + + id + + 25 + + 0 + + + + + + + + + + 1 + I4 + 1 + + + + 1 + I4 + + + + date-now + Date Created + I8 + + + C(16) + + + account + username + Account + I8 + any + + + C(255) + any + array + + + Nick Name + 1 + 128 + C(128) + any + + + L + + + L + + + Signature + X2 + + + + + + account_id,department_avail,nickname + id,site_id,date_orig,account_id,department_avail,nickname,notify_new,notify_change,signature + id,site_id,date_orig,account_id,department_avail,nickname,notify_new,notify_change,signature + id,site_id,date_orig,account_id,department_avail,nickname,notify_new,notify_change,signature + id,site_id,date_orig,account_id,department_avail,nickname,notify_new,notify_change,signature + + + + + + + + + + + + + + id + checkbox + 25px + + + nickname + + + account_id + + + notify_new + bool + + + notify_change + bool + + +
    diff --git a/modules/staff/staff_install.xml b/modules/staff/staff_install.xml index a9559e16..5d261e8f 100644 --- a/modules/staff/staff_install.xml +++ b/modules/staff/staff_install.xml @@ -1,38 +1,59 @@ + + - staff - account_admin - + + + + Staff + 1 + + staff + + + + account + + + + base - - - - search - - 1 - - - view - - 1 - - - add - 1 - - - delete - - - update - - - search_form - - - search_show - - - - \ No newline at end of file + + + + + Add + 1 + add + + + + delete + + + + List + 1 + search + + + + + search_form + + + + search_show + + + + update + + + + view + + + + diff --git a/modules/staff_department/staff_department.inc.php b/modules/staff_department/staff_department.inc.php index cca015b7..9e8be4f0 100644 --- a/modules/staff_department/staff_department.inc.php +++ b/modules/staff_department/staff_department.inc.php @@ -1,125 +1,33 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Module:Staff */ - -class staff_department -{ - # Open the constructor for this mod - function staff_department() - { - # name of this module: - $this->module = "staff_department"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } +/** + * The main AgileBill Staff Department Class + * + * @package AgileBill + * @subpackage Module:Staff + */ +class staff_department extends OSB_module { } -?> \ No newline at end of file +?> diff --git a/modules/staff_department/staff_department_construct.xml b/modules/staff_department/staff_department_construct.xml index 9daa524a..3cfd163e 100644 --- a/modules/staff_department/staff_department_construct.xml +++ b/modules/staff_department/staff_department_construct.xml @@ -1,54 +1,93 @@ - - staff_department - - staff_department
    - - staff - - 0 - - name - - 25 - - - - I4 - 1 - 1 - - - I4 - 1 - - - C(32) - 3 - 32 - - - X2 - - - I8 - staff - nickname - any - - - L - - - - - id,site_id,name,description,default_staff_id,contact_display - id,site_id,name,description,default_staff_id,contact_display - id,site_id,name,description,default_staff_id,contact_display - id,site_id,name,description,default_staff_id,contact_display - id,site_id,name,description,default_staff_id,contact_display - - - 0 + + staff_department + + staff_department
    + + staff + + 0 + + name + + 25 + + 1 + + + + + + + + + + 1 + I4 + 1 + + + + 1 + I4 + + + Department + C(32) + 3 + 32 + any + + + Description + X2 + + + Default Staff + I8 + staff + nickname + any + + + L + + + + + + date_orig,name,description,default_staff_id,contact_display + id,site_id,name,description,default_staff_id,contact_display + id,site_id,name,description,default_staff_id,contact_display + id,site_id,name,description,default_staff_id,contact_display + id,site_id,name,description,default_staff_id,contact_display + + + + + + + + + + + + + id + checkbox + 25px + + + name + + + default_staff_id + + + contact_display + bool + + +
    diff --git a/modules/staff_department/staff_department_install.xml b/modules/staff_department/staff_department_install.xml index 7d6cb381..26669704 100644 --- a/modules/staff_department/staff_department_install.xml +++ b/modules/staff_department/staff_department_install.xml @@ -1,33 +1,53 @@ + + - staff_department - setup - + + + + Staff Departments + 1 + + staff_department + + + + setup + + - - - - search - - - view - - 1 - - - add - 1 - - - delete - - - update - - - search_show - - - - \ No newline at end of file + + + + + Add + 1 + add + + + + delete + + + + List + 1 + search + + + + + search_show + + + + update + + + + view + + + + diff --git a/modules/staff_department/staff_department_install_data.xml b/modules/staff_department/staff_department_install_data.xml index c06bb912..1dc16e4e 100644 --- a/modules/staff_department/staff_department_install_data.xml +++ b/modules/staff_department/staff_department_install_data.xml @@ -1,14 +1,15 @@ - - 1 - 1 - Sales - This is the sales dept. - 1 - 1 - - - 1 - - \ No newline at end of file + + 1 + 1 + Sales + This is the sales dept. + 1 + 1 + + + + 1 + + diff --git a/modules/static_page/static_page.inc.php b/modules/static_page/static_page.inc.php index 8913886d..932df00c 100644 --- a/modules/static_page/static_page.inc.php +++ b/modules/static_page/static_page.inc.php @@ -1,423 +1,164 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Modules:StaticPage */ - -class static_page -{ - # Open the constructor for this mod - function static_page() - { - # name of this module: - $this->module = "static_page"; +/** + * The main AgileBill Static Page Class + * + * @package AgileBill + * @subpackage Modules:StaticPage + */ +class static_page extends OSB_module { + /** + * Delete a record + */ + public function delete($VAR) { + $this->associate_DELETE = array(); - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; + array_push($this->associated_DELETE,array('table'=>'static_page_translate','field'=>'static_page_id')); - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); + return parent::delete($VAR); + } - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } + /** + * Get a list of pages for a category + * + * @uses static_page_category + * @uses static_page_translate + */ + public function get_category_page_list($VAR) { + include_once(PATH_MODULES.'static_page_category/static_page_category.inc.php'); + $spc = new static_page_category(); - - ############################## - ## GET AUTH CATEGORIES ## - ############################## - - function page_list($VAR) - { - /* check if current session is authorized for any ticket departments.. - and return true/false... - */ - global $smarty; - if(!isset($VAR['id'])) - { - global $C_debug; - $smarty->assign('static_page_display', false); + # Check we have an ID and are authorised to see the pages in that ID. + if (! isset($VAR['id']) || ! $spc->get_page_categories($VAR)) return false; - } - ### Check if user is auth for the selected category: - $db = &DB(); - $sql = 'SELECT DISTINCT id,name,group_avail FROM ' . AGILE_DB_PREFIX . 'static_page_category WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - status = ' . $db->qstr('1') .' AND - id = ' . $db->qstr($VAR['id']); - $result = $db->Execute($sql); + $db = &DB(); + $result = $db->Execute( + sqlSelect($db,'static_page','id,name,date_expire,date_start',array('static_page_category_id'=>$VAR['id'],'status'=>1),'sort_order,date_orig,name')); - if($result->RecordCount() == 0) - { - global $C_debug; - $smarty->assign('static_page_display', false); + if (! $result || $result->RecordCount() == 0) return false; - } - global $C_auth; - $iii = 0; - - while(!$result->EOF) - { - @$arr = unserialize($result->fields['group_avail']); - - for($i=0; $iauth_group_by_id($arr[$i])) - { - $iii++; - $i=count($arr); - } - } - $result->MoveNext(); - } - - if($iii == 0) - { - global $C_debug; - $smarty->assign('static_page_display', false); - return false; - } - - - $sql = 'SELECT id,name,date_expire,date_start - FROM ' . AGILE_DB_PREFIX . 'static_page WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - static_page_category_id = ' . $db->qstr($VAR['id']) . ' AND - status = ' . $db->qstr('1') .' - ORDER BY sort_order,date_orig,name'; - $result = $db->Execute($sql); - - if($result->RecordCount() == 0) - { - $smarty->assign('static_page_category_display', false); - return false; - } + include_once(PATH_MODULES.'static_page_translate/static_page_translate.inc.php'); + $spt = new static_page_translate(); global $C_auth; $ii = 0; - while(!$result->EOF) - { + $pages = array(); + while (! $result->EOF) { $start = $result->fields['date_start']; - $expire= $result->fields['date_expire']; + $expire = $result->fields['date_expire']; - ### Check that it is not expired - if (( $start == "0" || $start <= time()+2 ) && - ( $expire == "0" || $expire >= time() ) ) - { + # Check that it is not expired + if (($start == '0' || $start <= time()+2) && ($expire == '0' || $expire >= time())) { - ### Get the translated name, for the current session language - $sql = 'SELECT body_intro, title, language_id - FROM ' . AGILE_DB_PREFIX . 'static_page_translate WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - static_page_id = ' . $db->qstr($result->fields['id']) . ' AND - language_id = ' . $db->qstr(SESS_LANGUAGE); - $translate = $db->Execute($sql); + # Get the translated name, for the current session language + $translate = $spt->get_translated_page(array('id'=>$result->fields['id'],'language_id'=>SESS_LANGUAGE)); - if($translate->RecordCount() > 0) - { - $arr_smarty[] = Array ( - 'name' => $result->fields['name'], - 'title' => $translate->fields['title'], - 'intro' => $translate->fields['body_intro'], - ); - $ii++; - } - else - { - ### Get the translated name, for the default langauge - $sql = 'SELECT body_intro, title, language_id - FROM ' . AGILE_DB_PREFIX . 'static_page_translate WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - static_page_id = ' . $db->qstr($result->fields['id']) . ' AND - language_id = ' . $db->qstr(DEFAULT_LANGUAGE); - $translate = $db->Execute($sql); - if($translate->RecordCount() > 0) - { - $arr_smarty[] = Array ( - 'name' => $result->fields['name'], - 'title' => $translate->fields['title'], - 'intro' => $translate->fields['body_intro'], - ); - $ii++; + if ($translate) { + $translate['name'] = $result->fields['name']; + array_push($pages,$translate); + + } else { + # Get the translated name, for the default langauge + $translate = $spt->get_translated_page(array('id'=>$result->fields['id'],'language_id'=>DEFAULT_LANGUAGE)); + + if ($translate) { + $translate['name'] = $result->fields['name']; + array_push($pages,$translate); } } } + $result->MoveNext(); } - - - if($ii == "0") - { - $smarty->assign('static_page_display', false); - return false; - } - else - { - $smarty->assign('static_page_display', true); - $smarty->assign('static_page_results', $arr_smarty); - return true; - } + return $pages; } - - - - - ######################################################################## - ### Show the page - - function page_show($VAR) - { - /* check if current session is authorized for any ticket departments.. - and return true/false... - */ + public function page_list($VAR) { global $smarty; - if(!isset($VAR['id']) && !isset($VAR['name'])) - { - global $C_debug; - $smarty->assign('static_page_display', false); - return false; - } - ### Check if user is auth for the selected category: - $db = &DB(); - $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'static_page WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - status = ' . $db->qstr('1') .' AND - name = ' . $db->qstr(@$VAR['name']) .' OR - id = ' . $db->qstr(@$VAR['id']); - $page = $db->Execute($sql); + $smart = $this->get_category_page_list($VAR); - if($page->RecordCount() == 0) - { - global $C_debug; - $smarty->assign('static_page_display', false); - return false; - } - - - $category_id = $page->fields['static_page_category_id']; - $page_id = $page->fields['id']; - - ### Check if user is auth for the selected category: - $db = &DB(); - $sql = 'SELECT DISTINCT id,name,group_avail FROM ' . AGILE_DB_PREFIX . 'static_page_category WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - status = ' . $db->qstr('1') .' AND - id = ' . $db->qstr($category_id); - $result = $db->Execute($sql); - - - if($result->RecordCount() == 0) - { - global $C_debug; - $smarty->assign('static_page_display', false); - return false; - } - - - - - - global $C_auth; - $iii = 0; - $id = $result->fields['id']; - - - while(!$result->EOF) - { - @$arr = unserialize($result->fields['group_avail']); - - for($i=0; $iauth_group_by_id($arr[$i])) - { - $iii++; - $i=count($arr); - } - } - $result->MoveNext(); - } - - if($iii == 0) - { - global $C_debug; - $smarty->assign('static_page_display', false); - return false; - } - - - - ### Check that it is not expired - $ii = 0; - $start = $page->fields['date_start']; - $expire= $page->fields['date_expire']; - - ### Check that it is not expired - if (( $start == "0" || $start <= time()+2 ) && - ( $expire == "0" || $expire >= time() ) ) - { - - ### Get the translated name, for the current session language - $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'static_page_translate WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - static_page_id = ' . $db->qstr($page->fields['id']) . ' AND - language_id = ' . $db->qstr(SESS_LANGUAGE); - $translate = $db->Execute($sql); - - if($translate->RecordCount() > 0) - { - $arr_smarty = Array ( - 'name' => $result->fields['name'], - 'title' => $translate->fields['title'], - 'body' => $translate->fields['body_full'], - ); - $ii++; - } - else - { - ### Get the translated name, for the default langauge - $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'static_page_translate WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - static_page_id = ' . $db->qstr($page->fields['id']) . ' AND - language_id = ' . $db->qstr(DEFAULT_LANGUAGE); - $translate = $db->Execute($sql); - if($translate->RecordCount() > 0) - { - $arr_smarty = Array ( - 'name' => $result->fields['name'], - 'title' => $translate->fields['title'], - 'body' => $translate->fields['body_full'], - ); - $ii++; - } - - } - } - - - if($ii == "0") - { - $smarty->assign('static_page_display', false); + if (! $smart || ! count($smart)) { + $smarty->assign('static_page_display',false); return false; - } - else - { - $smarty->assign('static_page_display', true); - $smarty->assign('static_page_results', $arr_smarty); + + } else { + $smarty->assign('static_page_display',true); + $smarty->assign('static_page_results',$smart); return true; } } + /** + * Show a page + */ + public function page_show($VAR) { + global $smarty; + if (! isset($VAR['id']) && !isset($VAR['name'])) { + $smarty->assign('static_page_display', false); + return false; + } - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); + # Get the page. + $db = &DB(); + $page = $db->Execute($q=sqlSelect($db,'static_page','*',sprintf('status=1 AND (name=::%s:: OR id=::%s::)',@$VAR['name'],@$VAR['id']))); + + if (! $page || $page->RecordCount() == 0) { + $smarty->assign('static_page_display',false); + return false; + } + + # Check we have an ID and are authorised to see the pages in that ID. + $smart = $this->get_category_page_list(array('id'=>$page->fields['static_page_category_id'])); + if (! $smart) { + $smarty->assign('static_page_display',false); + return false; + } + + $pageValid = false; + foreach ($smart as $key => $values) + if ($values['name'] == $page->fields['name']) { + $pageValid = true; + break; + } + + if (! $pageValid) { + $smarty->assign('static_page_display',false); + return false; + + } else { + $smarty->assign('static_page_display',true); + $smarty->assign('static_page_results',$values); + return true; + } } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $this->associated_DELETE[] = - Array( - 'table' => 'static_page_translate', - 'field' => 'static_page_id' - ); - - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } } -?> \ No newline at end of file +?> diff --git a/modules/static_page/static_page_construct.xml b/modules/static_page/static_page_construct.xml index a79c7a26..ed0aa93e 100644 --- a/modules/static_page/static_page_construct.xml +++ b/modules/static_page/static_page_construct.xml @@ -1,82 +1,123 @@ - - static_page - - static_page
    - - - - 0 - - sort_order,date_orig,name - - 35 - - - static_page_category_id - date_start - date_expire - name - - - - - I4 - 1 - 1 - - - I4 - 1 - - - I4 - static_page_category - name - 1 - - - I8 - date-now - - - I8 - date-now - - - I8 - date - - - I8 - date - - - I4 - - - L - - - C(128) - 1 - 128 - any - 1 - - - X2 - - - - - id,site_id,static_page_category_id,sort_order,date_start,date_orig,date_last,date_expire,status,name,description - id,site_id,static_page_category_id,sort_order,date_start,date_orig,date_orig,date_last,date_expire,status,name,description - id,site_id,static_page_category_id,sort_order,date_start,date_orig,date_orig,date_last,date_expire,status,name,description - id,site_id,static_page_category_id,sort_order,date_start,date_orig,date_orig,date_last,date_expire,status,name,description - id,site_id,static_page_category_id,sort_order,date_start,date_orig,date_orig,date_last,date_expire,status,name,description - - - 0 + + static_page + + static_page
    + + + + 0 + + sort_order,date_orig,name + + 35 + + 0 + + + + static_page_category_id + date_start + date_expire + name + + + + + + + 1 + I4 + 1 + + + + 1 + I4 + + + + date-now + Date Created + I8 + + + + date-now + Date Updated + I8 + + + I4 + static_page_category + name + 1 + + + I8 + date + + + I8 + date + + + I4 + + + L + + + C(128) + 1 + 128 + any + 1 + + + X2 + + + + + + static_page_category_id,sort_order,date_start,date_expire,status,name,description + id,site_id,static_page_category_id,sort_order,date_start,date_orig,date_orig,date_last,date_expire,status,name,description + id,site_id,static_page_category_id,sort_order,date_start,date_orig,date_orig,date_last,date_expire,status,name,description + id,site_id,static_page_category_id,sort_order,date_start,date_orig,date_orig,date_last,date_expire,status,name,description + id,site_id,static_page_category_id,sort_order,date_start,date_orig,date_orig,date_last,date_expire,status,name,description + + + + + + + + <add>Add Static Page</add> + <search>Search</search> + <view>Static Page</view> + + + + + + + id + checkbox + 25px + + + name + + + static_page_category_id + + + status + bool_icon + 20px + + +
    diff --git a/modules/static_page/static_page_install.xml b/modules/static_page/static_page_install.xml index b6812f6e..f4e22213 100644 --- a/modules/static_page/static_page_install.xml +++ b/modules/static_page/static_page_install.xml @@ -1,43 +1,59 @@ + + - static_page - static_page - + + + + Static Pages + 1 + + static_page + + + + + static_page_category,static_page_translate + + - - - - search - - - 1 - - - view - - - 1 - - - add - - 1 - - - delete - - - update - - - search_form - - - search_show - - - - - \ No newline at end of file + + + + + Add + 1 + add + + + + delete + + + + List + 1 + search + + + + + search_form + + + + search_show + + + + update + + + + view + + + + diff --git a/modules/static_page_category/static_page_category.inc.php b/modules/static_page_category/static_page_category.inc.php index b460edfd..bc64c50d 100644 --- a/modules/static_page_category/static_page_category.inc.php +++ b/modules/static_page_category/static_page_category.inc.php @@ -1,199 +1,83 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Modules:StaticPages */ - -class static_page_category -{ - # Open the constructor for this mod - function static_page_category_construct() - { - # name of this module: - $this->module = "static_page_category"; +/** + * The main AgileBill Static Page Categories Class + * + * @package AgileBill + * @subpackage Modules:StaticPages + */ +class static_page_category extends OSB_module { + /** + * Get the page categories + */ + public function get_page_categories($VAR) { + global $C_auth; - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; + $categories = array(); + $db = &DB(); - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); + if (isset($VAR['id']) && trim($VAR['id'])) + $result = $db->Execute(sqlSelect($db,'static_page_category','id,name,group_avail',array('status'=>1,'id'=>$VAR['id']),'sort_order,name')); + else + $result = $db->Execute(sqlSelect($db,'static_page_category','id,name,group_avail',array('status'=>1),'sort_order,name')); - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; + if ($result && $result->RecordCount()) + while (! $result->EOF) { + @$arr = unserialize($result->fields['group_avail']); + + for ($i=0; $iauth_group_by_id($arr[$i])) { + array_push($categories,array('name'=>$result->fields['name'],'id'=>$result->fields['id'])); + $i=count($arr); + } + } + + $result->MoveNext(); + } + + return $categories; } - - ############################## - ## GET AUTH CATEGORIES ## - ############################## - - function category_list($VAR) - { - - - /* check if current session is authorized for any ticket departments.. - and return true/false... - */ + /** + * Get all the page categories to a user + */ + public function menu() { global $smarty; - $db = &DB(); - $sql = 'SELECT DISTINCT id,name,group_avail FROM ' . AGILE_DB_PREFIX . 'static_page_category WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - status = ' . $db->qstr('1') .' - ORDER BY sort_order,name'; - $result = $db->Execute($sql); + $smart = $this->get_page_categories(array()); - if($result->RecordCount() == 0) - { - $smarty->assign('static_page_category_display', false); - return false; - } - - global $C_auth; - $ii = 0; - - while(!$result->EOF) - { - @$arr = unserialize($result->fields['group_avail']); - - for($i=0; $iauth_group_by_id($arr[$i])) - { - ### Add to the array - $ii++; - $arr_smarty[] = Array( 'name' => $result->fields['name'], - 'id' => $result->fields['id']); - $i=count($arr); - } - } - $result->MoveNext(); - } - - if($ii == "0") - { - $smarty->assign('static_page_category_display', false); + if (! count($smart)) { + $smarty->assign('static_page_category_display',false); return false; - } - else - { - $smarty->assign('static_page_category_display', true); - $smarty->assign('static_page_category_results', $arr_smarty); + + } else { + $smarty->assign('static_page_category_display',true); + $smarty->assign('static_page_category_results',$smart); + return true; } } - - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $this->static_page_category_construct(); - - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $this->static_page_category_construct(); - - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $this->static_page_category_construct(); - - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $this->static_page_category_construct(); - - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $this->static_page_category_construct(); - - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $this->static_page_category_construct(); - - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $this->static_page_category_construct(); - - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } } -?> \ No newline at end of file +?> diff --git a/modules/static_page_category/static_page_category_construct.xml b/modules/static_page_category/static_page_category_construct.xml index 21d28f13..57196a22 100644 --- a/modules/static_page_category/static_page_category_construct.xml +++ b/modules/static_page_category/static_page_category_construct.xml @@ -1,68 +1,104 @@ - - static_page_category - - static_page_category
    - - static_page - - 0 - - sort_order,name - - 35 - - - name - status - - - - - I4 - 1 - 1 - - - I4 - 1 - - - I8 - date-now - - - C(255) - any - array - - - C(128) - 1 - 128 - any - - 1 - - - X2 - - - L - - - I4 - - - - - id,site_id,date_orig,group_avail,name,description,status,sort_order - id,site_id,date_orig,group_avail,name,description,status,sort_order - id,site_id,date_orig,group_avail,name,description,status,sort_order - id,site_id,date_orig,group_avail,name,description,status,sort_order - id,site_id,date_orig,group_avail,name,description,status,sort_order - - - 0 + + static_page_category + + static_page_category
    + + static_page + + 0 + + sort_order,name + + 35 + + 1 + + + + name + status + + + + + + + 1 + I4 + 1 + + + + 1 + I4 + + + + date-now + Date Created + I8 + + + C(255) + any + array + + + C(128) + 1 + 128 + any + 1 + + + X2 + + + L + + + I4 + + + + + + group_avail,name,description,status,sort_order + id,site_id,date_orig,group_avail,name,description,status,sort_order + id,site_id,date_orig,group_avail,name,description,status,sort_order + id,site_id,date_orig,group_avail,name,description,status,sort_order + id,site_id,date_orig,group_avail,name,description,status,sort_order + + + + + + + + <menu>Page Categories</menu> + + + + + + + id + checkbox + 25px + + + name + + + sort_order + + + status + bool_icon + 20px + + +
    diff --git a/modules/static_page_category/static_page_category_install.xml b/modules/static_page_category/static_page_category_install.xml index 28f83236..dab29678 100644 --- a/modules/static_page_category/static_page_category_install.xml +++ b/modules/static_page_category/static_page_category_install.xml @@ -1,36 +1,55 @@ + + - static_page_category - static_page - + + + + Static Page Categories + 1 + + static_page_category + + + + static_page + + + + - - - - search - - - view - - - 1 - - - add - - 1 - - - delete - - - update - - - search_show - - - - - \ No newline at end of file + + + + + Add + 1 + add + + + + delete + + + + List + 1 + search + + + + + search_show + + + + update + + + + view + + + + diff --git a/modules/static_page_category/static_page_category_install_data.xml b/modules/static_page_category/static_page_category_install_data.xml index 59c67cd7..cc50b4e5 100644 --- a/modules/static_page_category/static_page_category_install_data.xml +++ b/modules/static_page_category/static_page_category_install_data.xml @@ -1,15 +1,16 @@ - - 1 - 1 - - News - Company News - 1 - 1 - - - 1 - - \ No newline at end of file + + 1 + 1 + + News + Company News + 1 + 1 + + + + 1 + + diff --git a/modules/static_page_translate/static_page_translate.inc.php b/modules/static_page_translate/static_page_translate.inc.php index 9e3e8828..5ebc7efc 100644 --- a/modules/static_page_translate/static_page_translate.inc.php +++ b/modules/static_page_translate/static_page_translate.inc.php @@ -1,125 +1,46 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Module:StaticPage */ - -class static_page_translate -{ - # Open the constructor for this mod - function static_page_translate() - { - # name of this module: - $this->module = "static_page_translate"; +/** + * The main AgileBill Static Page Translation Class + * + * @package AgileBill + * @subpackage Module:StaticPage + */ +class static_page_translate extends OSB_module { + /** + * Get a translated page + */ + public function get_translated_page($VAR) { + $db = &DB(); - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; + if (! isset($VAR['id']) || ! isset($VAR['language_id'])) + return array(); - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; + $result = $db->Execute(sqlSelect($db,'static_page_translate','body_intro,title,body_full',array('static_page_id'=>$VAR['id'],'language_id'=>$VAR['language_id']))); + if ($result && $result->RecordCount() == 1) + return array('title'=>$result->fields['title'],'intro'=>$result->fields['body_intro'],'body'=>$result->fields['body_full']); } - - - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } } -?> \ No newline at end of file +?> diff --git a/modules/static_page_translate/static_page_translate_construct.xml b/modules/static_page_translate/static_page_translate_construct.xml index 9f66d718..7ce859e6 100644 --- a/modules/static_page_translate/static_page_translate_construct.xml +++ b/modules/static_page_translate/static_page_translate_construct.xml @@ -1,78 +1,108 @@ + + static_page_translate + + static_page_translate
    + + static_page + + 0 + + static_page_id + + 25 + + 0 - - static_page_translate + + + - - static_page_translate
    - - - static_page - - - 0 - - - static_page_id - - - 35 - - - - - I4 - 1 - 1 - - - I4 - 1 - - - I8 - date-now - - - I8 - date-now - - - I4 - static_page - name - - - C(16) - - - X2 + + + + + 1 + I4 + 1 + + + + 1 + I4 + + + + date-now + Date Created + I8 + + + + date-now + Date Updated + I8 + + + I4 + static_page + name + + + C(16) + + + X2 1 - - - X2 - 1 + + + X2 + 1 1 - - - <type>C(128)</type> - <min_len>1</min_len> - <max_len>128</max_len> - <validate>any</validate> - <unique>1</unique> - - + + + <type>C(128)</type> + <min_len>1</min_len> + <max_len>128</max_len> + <validate>any</validate> + <unique>1</unique> + + - - - id,site_id,date_orig,date_last,static_page_id,language_id,body_intro,body_full,title - id,site_id,date_orig,date_last,static_page_id,language_id,body_intro,body_full,title - id,site_id,date_orig,date_last,static_page_id,language_id,body_intro,body_full,title - id,site_id,date_orig,date_last,static_page_id,language_id,body_intro,body_full,title - id,site_id,date_orig,date_last,static_page_id,language_id,body_intro,body_full,title - + + + static_page_id,language_id,body_intro,body_full,title + id,site_id,date_orig,date_last,static_page_id,language_id,body_intro,body_full,title + id,site_id,date_orig,date_last,static_page_id,language_id,body_intro,body_full,title + id,site_id,date_orig,date_last,static_page_id,language_id,body_intro,body_full,title + id,site_id,date_orig,date_last,static_page_id,language_id,body_intro,body_full,title + - - 0 -
    \ No newline at end of file + + + + + + + + + + + + id + checkbox + 25px + + + static_page_id + + + language_id + + + <field>title</field> + + + + diff --git a/modules/static_page_translate/static_page_translate_install.xml b/modules/static_page_translate/static_page_translate_install.xml index aaeb777b..8af53307 100644 --- a/modules/static_page_translate/static_page_translate_install.xml +++ b/modules/static_page_translate/static_page_translate_install.xml @@ -1,29 +1,51 @@ + + + + static_page + + + + 0 + static_page_translate - static_page_translate + + + static_page + + + + - - - - search - - - view - - - add - - - delete - - - update - - - search_show - - - - \ No newline at end of file + + + + + add + + + + delete + + + + search + + + + + search_show + + + + update + + + + view + + + + diff --git a/modules/static_relation/static_relation.inc.php b/modules/static_relation/static_relation.inc.php index 037ba12a..9c780e5e 100644 --- a/modules/static_relation/static_relation.inc.php +++ b/modules/static_relation/static_relation.inc.php @@ -1,128 +1,43 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Module:Static Vars */ - -class static_relation -{ - # Open the constructor for this mod - function static_relation() - { - # name of this module: - $this->module = "static_relation"; +/** + * The main AgileBill Static Variable Relationships Class + * + * @package AgileBill + * @subpackage Module:Static Vars + */ +class static_relation extends OSB_module { + /** + * Delete a Static Relationship + */ + public function delete($VAR) { + $this->associated_DELETE = array(); - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; + array_push($this->associated_DELETE,array('table'=>'static_var_record','field'=>'static_var_relation_id')); - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; + parent::delete($VAR); } - - - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $this->associated_DELETE[] = Array( 'table' => 'static_var_record', - 'field' => 'static_var_relation_id'); - - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } } -?> \ No newline at end of file +?> diff --git a/modules/static_relation/static_relation_construct.xml b/modules/static_relation/static_relation_construct.xml index 65ba37f3..1a61e843 100644 --- a/modules/static_relation/static_relation_construct.xml +++ b/modules/static_relation/static_relation_construct.xml @@ -1,70 +1,113 @@ - - static_relation - - static_relation
    - - - - 0 - - module_id - - 25 - - - static_var_id - module_id - sort_order - - - - - I4 - 1 - 1 - - - C(16) - 1 - - - I8 - static_var - name - any - - - I4 - module - name - any - - - X2 - 1 - - - C2(255) - 1 - 255 - - - L - - - I4 - - - - - id,site_id,static_var_id,module_id,default_value,description,required,sort_order - id,site_id,static_var_id,module_id,default_value,description,required,sort_order - id,site_id,static_var_id,module_id,default_value,description,required,sort_order - id,site_id,static_var_id,module_id,default_value,description,required,sort_order - id,site_id,static_var_id,module_id,default_value,description,required,sort_order - - - 0 + + static_relation + + static_relation
    + + static_var + + 0 + + module_id + + 25 + + 1 + + + + static_var_id + module_id + sort_order + + + + + + + 1 + I4 + 1 + + + + 1 + C(16) + + + I8 + static_var + name + any + Field Name + + + I4 + module + name + any + Module + + + X2 + 1 + Default Value + + + C2(255) + 1 + 255 + Description + + + L + Required + + + I4 + Sort Order + + + + + + date_orig,static_var_id,module_id,default_value,description,required,sort_order + id,site_id,static_var_id,module_id,default_value,description,required,sort_order + id,site_id,static_var_id,module_id,default_value,description,required,sort_order + id,site_id,static_var_id,module_id,default_value,description,required,sort_order + id,site_id,static_var_id,module_id,default_value,description,required,sort_order + + + + + + + + <add>Add Static Relationships</add> + <view>Static Relationships</view> + + + + + + + id + checkbox + 25px + + + static_var_id + + + module_id + + + sort_order + + + default_value + + +
    diff --git a/modules/static_relation/static_relation_install.xml b/modules/static_relation/static_relation_install.xml index 8e0aa935..4ccaa1ee 100644 --- a/modules/static_relation/static_relation_install.xml +++ b/modules/static_relation/static_relation_install.xml @@ -1,31 +1,51 @@ + + + + + + + + 0 + static_relation - setup - + + + + static_var + + + + base - - - - update - - - delete - - - add - - - - view - - - search - - - search_show - - - - - \ No newline at end of file + + + + + add + + + + delete + + + + search + + + + + search_show + + + + update + + + + view + + + + diff --git a/modules/static_var/static_var.inc.php b/modules/static_var/static_var.inc.php index ef5bbfac..437163a1 100644 --- a/modules/static_var/static_var.inc.php +++ b/modules/static_var/static_var.inc.php @@ -1,132 +1,44 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Module:Static Vars */ - -class static_var -{ - # Open the constructor for this mod - function static_var() - { - # name of this module: - $this->module = "static_var"; +/** + * The main AgileBill Static Variables Class + * + * @package AgileBill + * @subpackage Module:Static Vars + */ +class static_var extends OSB_module { + /** + * Delete Static Variables + */ + public function delete($VAR) { + $this->associate_DELETE = array(); - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; + array_push($this->associated_DELETE,array('table'=>'static_relation','field'=>'static_var_id')); + array_push($this->associated_DELETE,array('table'=>'static_var_record','field'=>'static_var_id')); - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; + return parent::delete($VAR); } - - - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - - $this->associated_DELETE[] = Array( 'table' => 'static_relation', - 'field' => 'static_var_id'); - $this->associated_DELETE[] = Array( 'table' => 'static_var_record', - 'field' => 'static_var_id'); - - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } - } -?> \ No newline at end of file +?> diff --git a/modules/static_var/static_var_construct.xml b/modules/static_var/static_var_construct.xml index bfe2e35a..5cb947f8 100644 --- a/modules/static_var/static_var_construct.xml +++ b/modules/static_var/static_var_construct.xml @@ -1,64 +1,107 @@ - - static_var - - static_var
    - - - - 0 - - name - - 25 - - - name - - - - - I4 - 1 - 1 - - - I4 - 1 - - - C(255) - 1 - 255 - any - 1 - 1 - - - C2(255) - 1 - 255 - any - - - C(128) - - - C(128) - - - C(128) - - - - - id,site_id,name,description,input_format,validation_type,convert_type - id,site_id,name,description,input_format,validation_type,convert_type - id,site_id,name,description,input_format,validation_type,convert_type - id,site_id,name,description,input_format,validation_type,convert_type - id,site_id,name,description,input_format,validation_type,convert_type - - - 0 + + static_var + + static_var
    + + static_relation + + 0 + + name + + 25 + + 0 + + + + name + + + + + + + 1 + I4 + 1 + + + + 1 + I4 + + + C(255) + 1 + 255 + any + 1 + 1 + Field Name + + + C2(255) + 1 + 255 + any + Description + + + C(128) + Type of Input + + + C(128) + Validation to use + + + C(128) + Convert + When this data is stored in the database, it will be converted into this format + + + + + + name,description,input_format,validation_type,convert_type + id,site_id,name,description,input_format,validation_type,convert_type + id,site_id,name,description,input_format,validation_type,convert_type + id,site_id,name,description,input_format,validation_type,convert_type + id,site_id,name,description,input_format,validation_type,convert_type + + + + + + + + <add>Add Static Variable</add> + <view>Static Variables</view> + + + + + + + id + checkbox + 25px + + + name + + + input_format + + + validation_type + + + convert_type + + +
    diff --git a/modules/static_var/static_var_install.xml b/modules/static_var/static_var_install.xml index 9188145f..2a920a2d 100644 --- a/modules/static_var/static_var_install.xml +++ b/modules/static_var/static_var_install.xml @@ -1,36 +1,55 @@ + + - static_var - setup - + + + + Custom Fields + 1 + + static_var + + + + setup + + + + base - - - - search - - - view - - - 1 - - - add - - 1 - - - delete - - - update - - - search_show - - - - - \ No newline at end of file + + + + + Add + 1 + add + + + + delete + + + + List + 1 + search + + + + + search_show + + + + update + + + + view + + + + diff --git a/modules/static_var/static_var_install_data.xml b/modules/static_var/static_var_install_data.xml index 79b98826..95be13f7 100644 --- a/modules/static_var/static_var_install_data.xml +++ b/modules/static_var/static_var_install_data.xml @@ -1,60 +1,61 @@ - - 2 - 1 - Address - Collect the main address - medium_text - address - none - - - 10 - 1 - Status - Get the satus - status - none - none - - - 11 - 1 - Accept User Agreement? - Requires user to check in order to continue - checkbox - any - none - - - 12 - 1 - Date - Date - calendar - date - date - - - 14 - 1 - Zip Code - Collect Users zip code - small_text - zip - none - - - 15 - 1 - Misc - misc - medium_text - none - none - - - 16 - - \ No newline at end of file + + 2 + 1 + Address + Collect the main address + medium_text + address + none + + + 10 + 1 + Status + Get the status + status + none + none + + + 11 + 1 + Accept User Agreement? + Requires user to check in order to continue + checkbox + any + none + + + 12 + 1 + Date + Date + calendar + date + date + + + 14 + 1 + Zip Code + Collect Users zip code + small_text + zip + none + + + 15 + 1 + Misc + misc + medium_text + none + none + + + + 16 + + diff --git a/modules/static_var_record/static_var_record.inc.php b/modules/static_var_record/static_var_record.inc.php index 2be97a23..3e2a633b 100644 --- a/modules/static_var_record/static_var_record.inc.php +++ b/modules/static_var_record/static_var_record.inc.php @@ -1,47 +1,33 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Module:Static Vars */ - -class static_var_record -{ - # Open the constructor for this mod - function static_var_record() - { - # name of this module: - $this->module = "static_var_record"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } +/** + * The main AgileBill Static Variables Data Class + * + * @package AgileBill + * @subpackage Module:Static Vars + */ +class static_var_record extends OSB_module { } -?> \ No newline at end of file +?> diff --git a/modules/static_var_record/static_var_record_construct.xml b/modules/static_var_record/static_var_record_construct.xml index 7635a3ee..d7a7fad5 100644 --- a/modules/static_var_record/static_var_record_construct.xml +++ b/modules/static_var_record/static_var_record_construct.xml @@ -1,54 +1,74 @@ - - static_var_record - - static_var_record
    - - - - 0 - - id - - 25 - - - record_id - module_id - static_var_id - static_var_relation_id - - - - - I8 - - - I8 - - - I8 - 1 - - - I4 - 1 - - - I4 - 1 - - - I4 - 1 - - - X2 - - - - - - 0 + + static_var_record + + static_var_record
    + + static_var,static_var_relation + + 0 + + id + + 25 + + 1 + + + + record_id + module_id + static_var_id + static_var_relation_id + + + + + + + 1 + I8 + 1 + + + + 1 + I8 + + + I8 + 1 + + + I4 + 1 + + + I4 + 1 + + + I4 + 1 + + + X2 + + + + + + + + + + + + + + + + +
    diff --git a/modules/static_var_record/static_var_record_install.xml b/modules/static_var_record/static_var_record_install.xml index 3e70a95b..92b44935 100644 --- a/modules/static_var_record/static_var_record_install.xml +++ b/modules/static_var_record/static_var_record_install.xml @@ -1,11 +1,26 @@ + + + + + + + + 0 + static_var_record + + + static_var - + + + + base - - - - - \ No newline at end of file + + + + + diff --git a/modules/task/task.inc.php b/modules/task/task.inc.php index 9330e5d9..e3fd0cb9 100644 --- a/modules/task/task.inc.php +++ b/modules/task/task.inc.php @@ -1,99 +1,74 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Module:Task */ - -class task -{ - # Open the constructor for this mod - function task() - { - # name of this module: - $this->module = "task"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - - - ############################## - ## RUN ALL DUE TASKS ## - ############################## - function run_all() - { - # ensure that tasks complete and dont hang on - # running=1 - set_time_limit(2 * 60 * 60); +/** + * The main AgileBill Task Class + * + * @package AgileBill + * @subpackage Module:Task + */ +class task extends OSB_module { + /** + * Run all scheduled tasks + */ + public function run_all() { + # Ensure that tasks complete and dont hang on running=1 + set_time_limit(2*60*60); # Loop through the tasks: global $VAR; - $db = &DB(); - $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'task WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - ( running = 0 OR running IS NULL )'; - $result = $db->Execute($sql); - if($result->RecordCount() > 0) - { - include_once(PATH_INCLUDES . 'cron/cron.inc.php'); + $db = &DB(); + $result = $db->Execute(sqlSelect($db,'task','*','(running=0 OR running IS NULL) AND status=1')); + if ($result && $result->RecordCount() > 0) { + include_once(PATH_INCLUDES.'cron/cron.inc.php'); $cron = new cron; - while(!$result->EOF) - { + + while (! $result->EOF) { $_r = false; $_s = (int) $result->fields['date_start']; $_e = (int) $result->fields['date_expire']; - $_l = (int) $result->fields['date_last']; - $_c = $result->fields['int_min'] . " "; - $_c .= $result->fields['int_hour'] . " "; - $_c .= $result->fields['int_month_day'] . " "; - $_c .= $result->fields['int_month'] . " "; - $_c .= $result->fields['int_week_day']; + $_l = (int) $result->fields['date_run']; + $_c = sprintf('%s %s %s %s %s', + $result->fields['int_min'], + $result->fields['int_hour'], + $result->fields['int_month_day'], + $result->fields['int_month'], + $result->fields['int_week_day']); $_n = (int) time(); - - if(!$_l > 0) $_l = $_n-86400*365; + if (! $_l > 0) + $_l = $_n-86400*365; # Verify it has not expired: - if ($_s <= $_n || $_s == "" || $_s == "0") - { + if ($_s <= $_n || $_s == '' || $_s == '0') { # Verify it is past the start date: - if ($_e >= $_n || $_e == "" || $_e == "0") - { + if ($_e >= $_n || $_e == '' || $_e == '0') { # Verify that it is time to run: - if($cron->due($_l, $_n, $_c)) - { + if ($cron->due($_l,$_n,$_c)) { # Run the task: $this->id = $result->fields['id']; - $this->run($VAR, $this); + $this->run($VAR); } } } @@ -102,206 +77,105 @@ class task } } + /** + * Run a task + * + * @uses task_log + */ + public function run($VAR) { + global $VAR,$C_auth,$_ENV,$_SERVER,$_COOKIE,$C_list; - ############################## - ## RUN ## - ############################## - function run($VAR) - { - # check auth: (windows) - global $VAR, $C_auth, $_ENV, $_SERVER, $_COOKIE; $noauth = false; $debug_out = false; - if (!empty($_ENV['S']) || - @$_ENV['SESSIONNAME'] == "Console" || - @$_SERVER['SESSIONNAME'] == "Console" || - @$_SERVER['CLIENTNAME'] == "Console" || - @empty($_COOKIE)) - { + if (isset($_ENV['S']) || + (isset($_ENV['SESSIONNAME']) && $_ENV['SESSIONNAME'] == 'Console') || + (isset($_SERVER['SESSIONNAME']) && $_SERVER['SESSIONNAME'] == 'Console') || + (isset($_SERVER['CLIENTNAME']) && $_SERVER['CLIENTNAME'] == 'Console') || + empty($_COOKIE)) { $debug_out = true; $noauth = true; + } elseif($C_auth->auth_method_by_name('task','run')) { $noauth = true; + } else { $noauth = false; } if (isset($this->id)) - $id = $this->id; - elseif ( isset ($VAR['id'])) - $id = $VAR['id']; - else return; + $id = $this->id; + elseif (isset($VAR['id'])) + $id = $VAR['id']; + else + return; - ############################### # Get task details - $db = &DB(); - $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'task WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - id = ' . $db->qstr($id); - $result = $db->Execute($sql); - if($result->RecordCount() == 0) return; + $db = &DB(); + $result = $db->Execute(sqlSelect($db,'task','*',array('id'=>$id))); + if (! $result || $result->RecordCount() == 0) + return; $type = $result->fields['type']; $cmd = $result->fields['command']; $log = $result->fields['log']; - ################################# - # Flip Run Toggle - $sql = 'UPDATE ' . AGILE_DB_PREFIX . 'task SET - running = 1 WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - id = ' . $db->qstr("$id"); - $db->Execute($sql); + # Record task running + $db->Execute(sqlUpdate($db,'task',array('running'=>1),array('id'=>$id))); - ############################### # Run task - if ( $type == 0 ) - { - ### Internal function: - global $C_method; - $arr = explode(":",$cmd); + switch ($type) { + case 0: + # Internal function: + global $C_method; + $arr = explode(":",$cmd); - if($noauth) { - # run from console, no auth req - $C_method->exe_noauth($arr[0],$arr[1]); - #if($debug_out) - # echo $cmd."
    "; - } - else - { - # run from web, auth required - $C_method->exe($arr[0],$arr[1]); - } + if ($noauth) { + # run from console, no auth req + $C_method->exe_noauth($arr[0],$arr[1]); + } else { + # run from web, auth required + $C_method->exe($arr[0],$arr[1]); + } - if($C_method->result) + if ($C_method->result) + $result = 1; + else + $result = 0; + + @$message = $C_method->error; + break; + + case 1: + $message = `$cmd`; $result = 1; - else - $result = 0; - @$message = $C_method->error; - } - elseif ( $type == 1) - { - ### System command - $message = `$cmd`; - $result = 1; + break; + + default: + printf('ERROR: Unknown task type [%s]',$type); } - - ############################### # Update last run date & flip run toggle - $sql = 'UPDATE ' . AGILE_DB_PREFIX . 'task SET - running = 0, - date_last = ' . $db->qstr(time()) . ' - WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - id = ' . $db->qstr("$id"); - $db->Execute($sql); + $db->Execute(sqlUpdate($db,'task',array('running'=>0,'date_run'=>time()),array('id'=>$id))); - - ############################### # Store task log if required - /* - if($log == '1') - { - $idx = $db->GenID(AGILE_DB_PREFIX . "" . 'task_log_id'); - $sql = 'INSERT INTO ' . AGILE_DB_PREFIX . 'task_log SET - site_id = ' . $db->qstr(DEFAULT_SITE) . ', - id = ' . $db->qstr($idx) . ', - task_id = ' . $db->qstr($id) . ', - result = ' . $db->qstr(@$result) . ', - message = ' . $db->qstr(@$message) . ', - date_orig= ' . $db->qstr(time()); - $result = $db->Execute($sql); + if ($log && $C_list->is_installed('task_log')) { + include_once(PATH_MODULES.'task_log/task_log.inc.php'); + $tl = new task_log; + + $VAR['task_log_task_id'] = $id; + $VAR['task_log_result'] = $result; + $VAR['task_log_message'] = $message; + if (! isset($VAR['_page_current'])) + $VAR['_page_current'] = ''; + $result = $tl->add($VAR); } - */ - - ############################### # If admin, print success message - - if ( DEFAULT_ADMIN_THEME == SESS_THEME ) - { - global $C_translate, $C_debug; - #$C_debug->alert ( $C_translate->translate('true','','') ); + if (DEFAULT_ADMIN_THEME == SESS_THEME) { + global $C_translate,$C_debug; + $C_debug->alert($C_translate->translate('true','','')); } } - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } - } -?> \ No newline at end of file +?> diff --git a/modules/task/task_construct.xml b/modules/task/task_construct.xml index fc3883c8..cd652315 100644 --- a/modules/task/task_construct.xml +++ b/modules/task/task_construct.xml @@ -1,108 +1,185 @@ - - task - - task
    - - - - 0 - - name - - 25 - - - date_start - date_expire - - - - - I4 - 1 - 1 - - - I4 - 1 - - - I8 - date-time - - - I8 - date-time - - - I8 - date - - - C(32) - 3 - 32 - any - - - C(255) - - - L - - - I4 - - - C(128) - 2 - 128 - any - - - C(32) - 1 - 32 - any - - - C(32) - 1 - 32 - any - - - C(32) - 1 - 32 - any - - - C(32) - 1 - 32 - any - - - C(32) - 1 - 32 - any - - - L - - - - - id,site_id,date_start,date_expire,date_last,name,description,log,type,command,int_min,int_hour,int_month_day,int_month,int_week_day,running - id,site_id,date_start,date_expire,date_last,name,description,log,type,command,int_min,int_hour,int_month_day,int_month,int_week_day,running - id,site_id,date_start,date_expire,date_last,name,description,log,type,command,int_min,int_hour,int_month_day,int_month,int_week_day,running - id,site_id,date_start,date_expire,date_last,name,description,log,type,command,int_min,int_hour,int_month_day,int_month,int_week_day,running - id,site_id,date_start,date_expire,date_last,name,description,log,type,command,int_min,int_hour,int_month_day,int_month,int_week_day,running - - - 0 + + task + + task
    + + + + 0 + + name + + 25 + + 1 + + + + date_start + date_expire + + + + + + + 1 + I4 + 1 + + + + 1 + I4 + + + + Date Created + I8 + + + + date-now + Date Updated + I8 + + + + date-now + Date Last Run + I8 + + + + Active + I4 + + + Date Start + I8 + date-time + + + Date Expire + I8 + date-time + + + Name + C(32) + 3 + 32 + any + + + Description + C(255) + + + + Log + L + + + + Type + I4 + + + Command + C(128) + 2 + 128 + any + + + Minute + C(32) + 1 + 32 + any + + + Hour + C(32) + 1 + 32 + any + + + Month + C(32) + 1 + 32 + any + + + Day + C(32) + 1 + 32 + any + + + Week Day + C(32) + 1 + 32 + any + + + + L + + + + + + date_start,date_expire,date_last,name,description,log,type,command,int_min,int_hour,int_month_day,int_month,int_week_day + id,site_id,status,date_start,date_expire,date_last,name,description,log,type,command,int_min,int_hour,int_month_day,int_month,int_week_day,running + id,site_id,date_start,date_expire,date_last,name,description,log,type,command,int_min,int_hour,int_month_day,int_month,int_week_day,running + id,site_id,status,date_start,date_expire,date_last,name,description,log,type,command,int_min,int_hour,int_month_day,int_month,int_week_day,running + id,site_id,status,date_start,date_expire,date_last,name,description,log,type,command,int_min,int_hour,int_month_day,int_month,int_week_day,running + + + + + + + + <add>Add Task</add> + <view>Task</view> + + + + + + + id + checkbox + 25px + + + name + + + date_last + date + + + date_run + date + + + command + + + status + bool_icon + 20px + + +
    diff --git a/modules/task/task_install.xml b/modules/task/task_install.xml index 2a0e27d3..7fe1b894 100644 --- a/modules/task/task_install.xml +++ b/modules/task/task_install.xml @@ -1,36 +1,61 @@ + + - task - setup - + + + + Task + 1 + + task + + + + setup + + base - - - - search - - - run - - - view - - 1 - - - add - 1 - - - delete - - - update - - - search_show - - - - \ No newline at end of file + + + + + Add + 1 + add + + + + delete + + + + List + 1 + search + + + + + search_form + + + + search_show + + + + update + + + + view + + + + run + + + + diff --git a/modules/task/task_install_data.xml b/modules/task/task_install_data.xml index ca7bbb06..0c5bcabb 100644 --- a/modules/task/task_install_data.xml +++ b/modules/task/task_install_data.xml @@ -131,22 +131,6 @@ * * - - 58 - 1 - 0 - 0 - 1112256262 - Ticket Piping - Grabs new e-mails for any of the ticket departments configured for email piping. - 0 - ticket:piping - 0-59/5 - * - * - * - * - 59 1 @@ -171,16 +155,16 @@ 0 1132899627 Invoice Delivery - Delivers the invoices via email and/or writes the invoices to the export directory. + Delivers the invoices via email. 0 - invoice:delivery_task + invoice:task_email_invoices 0 * * * * 0 - + 61 1 @@ -265,7 +249,7 @@ * * 0 - + 66 1 @@ -282,7 +266,7 @@ * * 0 - + 67 1 diff --git a/modules/task_log/task_log.inc.php b/modules/task_log/task_log.inc.php index bcf1dc78..f85eec47 100644 --- a/modules/task_log/task_log.inc.php +++ b/modules/task_log/task_log.inc.php @@ -1,126 +1,33 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Module:Task */ - -class task_log -{ - - # Open the constructor for this mod - function task_log() - { - # name of this module: - $this->module = "task_log"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } +/** + * The main AgileBill Task Log Class + * + * @package AgileBill + * @subpackage Module:Task + */ +class task_log extends OSB_module { } -?> \ No newline at end of file +?> diff --git a/modules/task_log/task_log_construct.xml b/modules/task_log/task_log_construct.xml index adfbfa93..4dddb53b 100644 --- a/modules/task_log/task_log_construct.xml +++ b/modules/task_log/task_log_construct.xml @@ -1,56 +1,73 @@ - - task_log - - task_log
    - - task - - 0 - - task_id - - 25 - - - task_id - - - - - I8 - 1 - 1 - - - I4 - 1 - - - I4 - task - name - 1 - - - I8 - - - L - - - X - - - - - id,site_id,task_id,date_orig,result,message - id,site_id,task_id,date_orig,result,message - id,site_id,task_id,date_orig,result,message - id,site_id,task_id,date_orig,result,message - id,site_id,task_id,date_orig,result,message - - - 0 + + task_log + + task_log
    + + task + + 0 + + task_id + + 25 + + 1 + + + + task_id + + + + + + + 1 + I8 + 1 + + + + 1 + I4 + + + + I8 + + + task + name + 1 + I4 + + + L + + + X + + + + + + task_id,result,message + id,site_id,task_id,date_orig,result,message + id,site_id,task_id,date_orig,result,message + id,site_id,task_id,date_orig,result,message + id,site_id,task_id,date_orig,result,message + + + + + + + + <view>Task Log</view> + + + +
    diff --git a/modules/task_log/task_log_install.xml b/modules/task_log/task_log_install.xml index 5bf3d6e8..7c4b819b 100644 --- a/modules/task_log/task_log_install.xml +++ b/modules/task_log/task_log_install.xml @@ -1,32 +1,41 @@ + + + + task + + + + 0 + + task_log + + + + task + + base + - - - task_log - task - Stores the task logs - task - - - - - - - update - - - search_show - - - view - - - delete - - - search - - - + + + + delete + + + + search + + + + + search_show + + + + view + + + diff --git a/modules/tax/tax.inc.php b/modules/tax/tax.inc.php index ba51578d..2c8911b3 100644 --- a/modules/tax/tax.inc.php +++ b/modules/tax/tax.inc.php @@ -1,174 +1,128 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Modules:Tax */ - -class tax -{ - /** - * Calculate all applicable taxes for a given product - * @return Array - */ - function calculate($taxable_amount, $country_id, $zone) - { - $arr=false; - $db = &DB(); - $result = $db->Execute(sqlSelect($db,"tax","id,description,rate", - "(zone = '' OR zone IS NULL OR zone = ::*:: OR zone = ::$zone::) AND - (country_id = ::$country_id:: OR country_id = '' OR country_id IS NULL)","zone")); - if(!$result || $result->RecordCount() == 0) { - return false; - } else { - while(!$result->EOF) { - $arr[] = Array( 'rate' => round($result->fields["rate"] * $taxable_amount,2), - 'name' => $result->fields["description"], - 'id' => $result->fields["id"]); +/** + * The main AgileBill Tax Class + * + * @package AgileBill + * @subpackage Modules:Tax + */ +class tax extends OSB_module { + /** + * Calculate all applicable taxes for a given product + * @return Array + */ + public function calculate($taxable_amount,$country_id,$zone) { + $db = &DB(); + $arr = array(); + + $result = $db->Execute( + sqlSelect($db,'tax','id,description,rate', + sprintf("(zone='' OR zone IS NULL OR zone=::*:: OR zone=::%s::) AND (country_id=::%s:: OR country_id='' OR country_id IS NULL)",$zone,$country_id), + 'zone')); + + if (! $result || ! $result->RecordCount()) + return false; + + else + while (! $result->EOF) { + array_push($arr, + array('rate'=>round($result->fields['rate']*$taxable_amount,2), + 'name' => $result->fields['description'], + 'id' => $result->fields['id'])); $result->MoveNext(); } - } - return $arr; + + return count($arr) ? $arr : false; } /** - * Insert invoice_item_tax Records - */ - function invoice_item($invoice_id, $invoice_item_id, $account_id, $tax_arr) { - $db =& DB(); - if(!is_array($tax_arr)) return false; - foreach($tax_arr as $tax) { - $sql="INSERT INTO ".AGILE_DB_PREFIX."invoice_item_tax SET id=".sqlGenID($db,"invoice_item_tax").", site_id=".DEFAULT_SITE.", date_orig=".time().", invoice_id={$invoice_id}, invoice_item_id={$invoice_item_id}, account_id={$account_id}, tax_id={$tax["id"]}, amount=".$db->qstr($tax["rate"]); - $db->Execute($sql); - } - } - - /** - * Generate the HTML for tax id collection on account creation/update form + * Insert invoice_item_tax Records */ - function get_tax_ids() { - $db=&DB(); - $rs=$db->Execute($sql=sqlSelect($db,"tax","*","tax_id_collect=1 AND zone=::*::")); - if($rs && $rs->RecordCount()) { - while(!$rs->EOF) { - $arr[$rs->fields["tax_id_name"]] = $rs->fields; + public function invoice_item($invoice_id,$invoice_item_id,$account_id,$tax_arr) { + $db = &DB(); + + if (! is_array($tax_arr)) + return false; + + foreach ($tax_arr as $tax) + $db->Execute(sqlInsert($db,'invoice_item_tax',array('date_orig'=>time(),'invoice_id'=>$invoice_id,'invoice_item_id'=>$invoice_item_id,'account_id'=>$account_id,'tax_id'=>$tax['id'],'amount'=>$tax['rate']))); + } + + /** + * Generate the HTML for tax id collection on account creation/update form + */ + public function get_tax_ids() { + $db = &DB(); + + $rs = $db->Execute(sqlSelect($db,'tax','*',array('tax_id_collect'=>1,'zone'=>'*'))); + + if ($rs && $rs->RecordCount()) { + while (! $rs->EOF) { + $arr[$rs->fields['tax_id_name']] = $rs->fields; $rs->MoveNext(); } + } else { return false; } - foreach($arr as $val) $ret[] = $val; - + + $ret = array(); + foreach ($arr as $val) + array_push($ret,$val); + global $smarty; - $smarty->assign('tax_ids', $ret); + $smarty->assign('tax_ids',$ret); } - - + /** * Validate inputted tax id on account addition/update */ - function TaxIdsValidate($country_id, $tax_id, $exempt=false) { - $db=&DB(); - $rs=$db->Execute(sqlSelect($db,"tax","*","country_id=$country_id AND zone=::*:: AND tax_id_collect=1 AND tax_id_req=1")); - if($rs && $rs->RecordCount()) { + function TaxIdsValidate($country_id, $tax_id, $exempt=false) { + $db = &DB(); + + $rs = $db->Execute(sqlSelect($db,'tax','*',array('country_id'=>$country_id,'zone'=>'*','tax_id_collect'=>1,'tax_id_req'=>1))); + + if ($rs && $rs->RecordCount()) { $this->errField = $rs->fields['tax_id_name']; - - if(empty($tax_id)) - if($rs->fields['tax_id_exempt'] && $exempt) + + if (empty($tax_id)) + if ($rs->fields['tax_id_exempt'] && $exempt) return true; else return false; - - if(!empty($rs->fields['tax_id_regex'])) { - $regex=$rs->fields['tax_id_regex']; - if(!ereg("$regex", trim($tax_id))) return false; + + if (! empty($rs->fields['tax_id_regex'])) { + $regex = $rs->fields['tax_id_regex']; + + if (! preg_match("/$regex/",trim($tax_id))) + return false; } } + return true; } - - function tax_construct() { - $this->module = "tax"; - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - function add($VAR) { - $this->tax_construct(); - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - function view($VAR) { - $this->tax_construct(); - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - function update($VAR) { - $this->tax_construct(); - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - function delete($VAR) { - $this->tax_construct(); - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - function search_form($VAR) { - $this->tax_construct(); - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - function search($VAR) { - $this->tax_construct(); - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - function search_show($VAR) { - $this->tax_construct(); - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } } -?> \ No newline at end of file +?> diff --git a/modules/tax/tax_construct.xml b/modules/tax/tax_construct.xml index 67c946a2..06aed5c5 100644 --- a/modules/tax/tax_construct.xml +++ b/modules/tax/tax_construct.xml @@ -1,82 +1,138 @@ - - tax - - tax
    - - setup - - 0 - - zone - - 25 - - - country_id - zone - - - - - I4 - 1 - 1 - - - I4 - 1 - - - I4 - country - name - any - - - C(128) - 1 - 128 - - - C(255) - 1 - 255 - any - - - F - 2 - 6 - any - - - - L - - - C(32) - - - L - - - L - - - C(255) - - - - - - id,site_id,country_id,zone,description,rate,tax_id_collect,tax_id_name,tax_id_req,tax_id_exempt,tax_id_regex - id,site_id,country_id,zone,description,rate,tax_id_collect,tax_id_name,tax_id_req,tax_id_exempt,tax_id_regex - id,site_id,country_id,zone,description,rate,tax_id_collect,tax_id_name,tax_id_req,tax_id_exempt,tax_id_regex - id,site_id,country_id,zone,description,rate,tax_id_collect,tax_id_name,tax_id_req,tax_id_exempt,tax_id_regex - id,site_id,country_id,zone,description,rate,tax_id_collect,tax_id_name,tax_id_req,tax_id_exempt,tax_id_regex - - - 0 + + tax + + tax
    + + setup + + 15 + + zone + + 25 + + 1 + + + + country_id + zone + + + + + + + 1 + I4 + 1 + + + + 1 + I4 + + + + Date Created + I8 + + + + date-now + Date Updated + I8 + + + Country + I4 + country + name + any + + + Zone + C(128) + 1 + 128 + + + Description + C(255) + 1 + 255 + any + + + Tax Rate + F + 2 + 6 + any + + + Collect Tax ID + L + + + Tax ID Name + C(32) + + + Tax ID Required + L + + + Tax ID Exempt + L + + + Tax ID Regexp + C(255) + + + + + + country_id,zone,description,rate,tax_id_collect,tax_id_name,tax_id_req,tax_id_regex + id,site_id,country_id,zone,description,rate,tax_id_collect,tax_id_name,tax_id_req,tax_id_exempt,tax_id_regex + id,site_id,country_id,zone,description,rate,tax_id_collect,tax_id_name,tax_id_req,tax_id_exempt,tax_id_regex + id,site_id,country_id,zone,description,rate,tax_id_collect,tax_id_name,tax_id_req,tax_id_exempt,tax_id_regex + id,site_id,country_id,zone,description,rate,tax_id_collect,tax_id_name,tax_id_req,tax_id_exempt,tax_id_regex + + + + + + + + <add>Add Tax Definition</add> + <search_form>Search</search_form> + <view>Tax</view> + + + + + + + id + checkbox + 25px + + + country_id + + + zone + + + description + + + rate + + +
    diff --git a/modules/tax/tax_install.xml b/modules/tax/tax_install.xml index 3746434d..7ae36b9c 100644 --- a/modules/tax/tax_install.xml +++ b/modules/tax/tax_install.xml @@ -1,40 +1,57 @@ + + - tax - setup - - 1 + setup + + Tax + + 1 + + tax + + + + setup + + - - - - add - - 1 - - - update - - - delete - - - view - - 1 - - - search - - - search_form - - - - search_show - - - - - \ No newline at end of file + + + + + Add + 1 + add + + + + delete + + + + Search + 1 + search + + + + + search_form + + + + search_show + + + + update + + + + view + + + + diff --git a/modules/tax/tax_install_data.xml b/modules/tax/tax_install_data.xml new file mode 100644 index 00000000..96db265c --- /dev/null +++ b/modules/tax/tax_install_data.xml @@ -0,0 +1,18 @@ + + + + 1 + 1 + 61 + + GST + 0.1 + + + + + + + 2 + + diff --git a/modules/temporary_data/temporary_data.inc.php b/modules/temporary_data/temporary_data.inc.php index 6ac77461..d088cd8e 100644 --- a/modules/temporary_data/temporary_data.inc.php +++ b/modules/temporary_data/temporary_data.inc.php @@ -1,47 +1,33 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Module:TemporaryData */ - -class temporary_data -{ - # Open the constructor for this mod - function temporary_data() - { - # name of this module: - $this->module = "temporary_data"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } +/** + * The main AgileBill Temporary Data Class + * + * @package AgileBill + * @subpackage Module:TemporaryData + */ +class temporary_data extends OSB_module { } -?> \ No newline at end of file +?> diff --git a/modules/temporary_data/temporary_data_construct.xml b/modules/temporary_data/temporary_data_construct.xml index a0074e22..98ca7c9a 100644 --- a/modules/temporary_data/temporary_data_construct.xml +++ b/modules/temporary_data/temporary_data_construct.xml @@ -1,53 +1,80 @@ - - temporary_data - - temporary_data
    - - - - 0 - - id - - 25 - - - date_expire - - - - - I8 - 1 - 1 - - - I4 - 1 - - - I8 - - - I8 - - - X2 - - - C(128) - - - C(128) - - - C(128) - - - - - - 0 + + temporary_data + + temporary_data
    + + + + 0 + + id + + 25 + + 1 + + + + date_expire + + + + + + + 1 + I8 + 1 + + + + 1 + I4 + + + + date-now + Date Created + I8 + + + I8 + + + Module + I4 + module + name + any + + + X2 + + + C(128) + + + C(128) + + + C(128) + + + + + + + + + + + + + + + + +
    diff --git a/modules/temporary_data/temporary_data_install.xml b/modules/temporary_data/temporary_data_install.xml index c5c8a2a5..4bb98a5b 100644 --- a/modules/temporary_data/temporary_data_install.xml +++ b/modules/temporary_data/temporary_data_install.xml @@ -1,11 +1,26 @@ + + + + + + + + 0 + temporary_data - setup + + + setup + + + + base - - - - - \ No newline at end of file + + + + + diff --git a/modules/ticket/auth.inc.php b/modules/ticket/auth.inc.php deleted file mode 100644 index e2a2a64c..00000000 --- a/modules/ticket/auth.inc.php +++ /dev/null @@ -1,15 +0,0 @@ - 'ticket', 'method' => 'user_add'), -Array ('module' => 'ticket', 'method' => 'user_list'), -Array ('module' => 'ticket', 'method' => 'user_view'), -Array ('module' => 'ticket', 'method' => 'user_update'), -Array ('module' => 'ticket', 'method' => 'user_reply'), -Array ('module' => 'ticket', 'method' => 'is_user_auth'), -Array ('module' => 'ticket', 'method' => 'is_key_match'), -Array ('module' => 'ticket', 'method' => 'pending_verify'), -Array ('module' => 'ticket', 'method' => 'static_var'), -Array ('module' => 'ticket', 'method' => 'view') -); -?> \ No newline at end of file diff --git a/modules/ticket/ticket.inc.php b/modules/ticket/ticket.inc.php deleted file mode 100644 index 05051b12..00000000 --- a/modules/ticket/ticket.inc.php +++ /dev/null @@ -1,2710 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -class ticket -{ - var $in_ticket_id; - - /** - * Return a smarty array of matching tickets for departmnet/status search - */ - function search_status($VAR) { - extract($VAR); - - global $smarty; - $smarty->assign("count", '0'); - - if(empty($department) || empty($status)) return false; - - $db=&DB(); - $p=AGILE_DB_PREFIX; - $sql = "SELECT DISTINCT - A.id, A.subject, A.status, A.email, A.date_orig, A.body, B.email as email_acct, CONCAT(B.first_name,' ',B.last_name) as name, B.company, C.name as department - FROM - {$p}ticket as A - left join {$p}account as B on ((B.id=A.account_id OR B.email=A.email) AND B.site_id=".DEFAULT_SITE.") - left join {$p}ticket_department as C on (A.department_id=C.id AND C.site_id=".DEFAULT_SITE.") - WHERE - A.site_id=".DEFAULT_SITE." AND department_id=".$db->qstr($department); - switch($status) { - case 'new': - $sql.= " AND (A.last_reply=0 OR A.last_reply IS NULL ) AND (A.status=0 OR A.status IS NULL)"; - break; - case 'staff': - $sql.= " AND A.date_orig != A.date_last AND A.last_reply=2 AND A.status=0"; - break; - case 'user': - $sql.= " AND A.date_orig != A.date_last AND A.last_reply=1 AND A.status=0"; - break; - case 'hold': - $sql.= " AND A.status=1"; - break; - case 'pending': - $sql.= " AND A.status=3"; - break; - case 'closed': - $sql.= " AND A.status=2"; - break; - } - $rs=$db->Execute($sql); - if($rs && $rs->RecordCount()) { - while(!$rs->EOF) { - if(empty($rs->fields["email"])) $rs->fields['email'] = $rs->fields['email_acct']; - if(!empty($rs->fields["company"])) $rs->fields['email'] = $rs->fields['company']; - elseif(!empty($rs->fields["name"])) $rs->fields['email'] = $rs->fields['name']; - $smart[]=$rs->fields; - $rs->MoveNext(); - } - $smarty->assign("results", $smart); - $count=$rs->RecordCount(); - } else { - return false; - } - $smarty->assign("count", $count); - } - - - - /** - * Return a smarty array of matching tickets for full search - */ - function search_quick($VAR) { - extract($VAR); - - global $smarty; - $smarty->assign("count", '0'); - - if(empty($query)) return false; - if($query_type=='all' || $query_type=='text') $this->search_text($query); - if($query_type=='all' || $query_type=='sender') $this->search_user($query); - if(!$this->in_ticket_id) return false; - - $db=&DB(); - $p=AGILE_DB_PREFIX; - $sql = "SELECT DISTINCT FIELD(A.id,".$this->search_sql_in_ticket_id().") as rank, - A.id, A.subject, A.status, A.email, A.date_orig, A.body, B.email as email_acct, CONCAT(B.first_name,' ',B.last_name) as name, B.company, C.name as department - FROM - {$p}ticket as A - left join {$p}account as B on ((B.id=A.account_id OR B.email=A.email) AND B.site_id=".DEFAULT_SITE.") - left join {$p}ticket_department as C on (A.department_id=C.id AND C.site_id=".DEFAULT_SITE.") - WHERE - A.site_id=".DEFAULT_SITE." AND A.id in (".$this->search_sql_in_ticket_id().") "; - if($department!='all') $sql.= " AND A.department_id=".$db->qstr($department); - if($status!='all') $sql.= " AND A.status=".$db->qstr($status); - $sql .= " ORDER BY rank"; - #echo "
    ". $sql; - $rs=$db->Execute($sql); - if($rs && $rs->RecordCount()) { - while(!$rs->EOF) { - if(empty($rs->fields["email"])) $rs->fields['email'] = $rs->fields['email_acct']; - if(!empty($rs->fields["company"])) $rs->fields['email'] = $rs->fields['company']; - elseif(!empty($rs->fields["name"])) $rs->fields['email'] = $rs->fields['name']; - $smart[]=$rs->fields; - $rs->MoveNext(); - } - $smarty->assign("results", $smart); - $count=$rs->RecordCount(); - } else { - return false; - } - $smarty->assign("count", $count); - } - - /** - * Retrieve list of ticket ids that match the fulltext - */ - function search_text($query, $offset=0, $limit=100) { - $db=&DB(); - $p=AGILE_DB_PREFIX; - $sql = "select distinct - ticket_id from {$p}ticket_message WHERE MATCH (message) AGAINST (".$db->qstr($query)." IN BOOLEAN MODE) - union select distinct id from {$p}ticket WHERE MATCH (subject, body) AGAINST (".$db->qstr($query)." IN BOOLEAN MODE) - union select distinct ticket_id from {$p}ticket_attachment WHERE MATCH (content) AGAINST (".$db->qstr($query)." IN BOOLEAN MODE)"; - $rs=$db->SelectLimit($sql, $limit, $offset); - if($rs && $rs->RecordCount()) { - while(!$rs->EOF) { - $this->search_add_in_ticket_id($rs->fields['ticket_id']); - $rs->MoveNext(); - } - return true; - } - return false; - } - - /** - * Retrieve list of ticket ids that match the provided email, name, or company - */ - function search_user($query, $offset=0, $limit=100) { - $db=&DB(); - $p=AGILE_DB_PREFIX; - $sql = "select distinct A.id from {$p}ticket as A, {$p}account as B - WHERE ( - A.site_id=".DEFAULT_SITE." AND A.email LIKE ".$db->qstr('%'.$query.'%')." AND B.id is null - OR - ( - A.account_id=B.id AND A.site_id=".DEFAULT_SITE." AND B.site_id=".DEFAULT_SITE." AND - ( - MATCH (B.first_name,B.last_name,B.email,B.company) AGAINST (".$db->qstr($query)." IN BOOLEAN MODE) - ) - ) - )"; - $rs=$db->SelectLimit($sql, $limit, $offset); - if($rs && $rs->RecordCount()) { - while(!$rs->EOF) { - $this->search_add_in_ticket_id($rs->fields['id']); - $rs->MoveNext(); - } - return true; - } - return false; - } - - /** - * Add ticket id to in_ticket_id array - */ - function search_add_in_ticket_id($id) { - if(!is_array($this->in_ticket_id) || !in_array($id, $this->in_ticket_id)) $this->in_ticket_id[]=$id; - } - - /** - * Format in_ticket_id to string for sql query - */ - function search_sql_in_ticket_id() { - if(is_array($this->in_ticket_id)) { - return implode(",", $this->in_ticket_id); - } else { - return false; - } - } - - - - ############################## - ## Show Merge List ## - ############################## - function merge_list($VAR) - { - $id = ereg_replace(',','', $VAR['id']); - - global $C_translate; - - # Get account id / email: - $db = &DB(); - $sql= "SELECT account_id,email FROM ".AGILE_DB_PREFIX."ticket - WHERE site_id = '".DEFAULT_SITE."' AND - id = '{$id}'"; - $rs = $db->Execute($sql); - $account_id = $rs->fields['account_id']; - $email = $rs->fields['email']; - - # Get available tickets: - if($account_id > 0) - { - $sql= "SELECT id,subject,date_orig FROM ".AGILE_DB_PREFIX."ticket WHERE site_id = '".DEFAULT_SITE."' - AND ( account_id = '{$account_id}' OR email = '{$email}' ) - AND id != '{$id}' - ORDER BY subject,date_orig"; - } else { - $sql= "SELECT id,subject,date_orig FROM ".AGILE_DB_PREFIX."ticket WHERE site_id = '".DEFAULT_SITE."' - AND email = '{$email}' - AND id != '{$id}' - ORDER BY subject,date_orig"; - } - $result = $db->Execute($sql); - - if ($result === false) - { - global $C_debug; - $C_debug->error('ticket.inc.php','merge_list', $db->ErrorMsg()); - } else { - $return = ''; - - $return .= ''; - if($i > 0) - echo $return; - } - } - - ############################## - ## Merge the ticket ## - ############################## - function merge($VAR) - { - $db = &DB(); - $sql = "SELECT * FROM ".AGILE_DB_PREFIX."ticket - WHERE site_id = '".DEFAULT_SITE."' - AND id = '{$VAR['id']}'"; - $from = $db->Execute($sql); - - $db = &DB(); - $sql = "SELECT * FROM ".AGILE_DB_PREFIX."ticket - WHERE site_id = '".DEFAULT_SITE."' - AND id = '{$VAR['merge_id']}'"; - $to = $db->Execute($sql); - - ### Validate both exist - if($from->RecordCount() == 0 || $to->RecordCount() == 0) - return false; - - ### Update TO ticket record - $sql = "UPDATE ".AGILE_DB_PREFIX."ticket_message SET - ticket_id = ".$db->qstr($VAR['id'])." - WHERE - site_id = '".DEFAULT_SITE."' - AND - ticket_id = ".$db->qstr($VAR['merge_id']); - $rs = $db->Execute($sql); - - ### Create new ticket_message record for the ticket being removed: - $id = $db->GenID(AGILE_DB_PREFIX . 'ticket_message_id'); - $sql = "INSERT INTO ".AGILE_DB_PREFIX."ticket_message SET - id = '{$id}', - site_id = '".DEFAULT_SITE."', - ticket_id = '{$VAR['id']}', - staff_id = '".SESS_ACCOUNT."', - date_orig = '{$to->fields['date_orig']}', - message = ".$db->qstr($to->fields['body']); - $rs = $db->Execute($sql); - - ### Delete the old ticket... - $sql = "DELETE FROM ".AGILE_DB_PREFIX."ticket WHERE - site_id = '".DEFAULT_SITE."' - AND - id = '{$VAR['merge_id']}'"; - $rs = $db->Execute($sql); - - } - - ############################## - ## Verify Pending Ticket ## - ############################## - function pending_verify($VAR) - { - global $C_auth, $smarty; - - ### Get user account details: - $db = &DB(); - $sql = 'SELECT email FROM ' . AGILE_DB_PREFIX . 'account WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - id = ' . $db->qstr(SESS_ACCOUNT); - $account = $db->Execute($sql); - - ### Get ticket details - $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'ticket WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - id = ' . $db->qstr(@$VAR['id']); - $ticket = $db->Execute($sql); - $department_id = $ticket->fields['department_id']; - - if($ticket->fields['status'] != '3') return false; - - ### Get the available groups: - $sql = 'SELECT group_id FROM ' . AGILE_DB_PREFIX . 'ticket_department WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - id = ' . $db->qstr($department_id); - $dept = $db->Execute($sql); - $groups = unserialize($dept->fields['group_id']); - - ### Check if this account is authed for the ticket department - $this->auth = false; - for($i=0; $iauth_group_by_account_id(SESS_ACCOUNT, $groups[$i])) { - $this->auth = true; - } - } - - if($this->auth) - { - # Update ticket details - $sql = 'UPDATE ' . AGILE_DB_PREFIX . 'ticket SET - status = ' . $db->qstr(0) . ', - account_id = ' . $db->qstr(SESS_ACCOUNT) . ' - WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - id = ' . $db->qstr(@$VAR['id']); - $rs = $db->Execute($sql); - - - ### Get any staff members who should be mailed - $sql = 'SELECT id,account_id,department_avail FROM ' . AGILE_DB_PREFIX . 'staff - WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - notify_new = ' . $db->qstr("1"); - $result = $db->Execute($sql); - - if($result->RecordCount() > 0) - { - while(!$result->EOF) - { - @$avail = unserialize($result->fields['department_avail']); - for($i=0; $ifields['priority']; - $VAR['ticket_subject'] = $ticket->fields['subject']; - $VAR['ticket_body'] = $ticket->fields['body']; - require_once(PATH_MODULES . 'email_template/email_template.inc.php'); - $my = new email_template; - $my->send('ticket_user_add_staff', $result->fields['account_id'], $VAR['id'], $avail[$i], ''); - $i = count($avail); - } - } - $result->MoveNext(); - } - } - - # Redirect to new page - $smart = ""; - $smarty->assign('pending_status', $smart); - } - else - { - $smart = $C_translate->translate('user_pending_verify','ticket',''); - $smarty->assign('pending_status', $smart); - } - } - - - ############################## - ## Overview ## - ############################## - function piping($VAR) - { - # get ticket departments w/piping enabled - $db = &DB(); - $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'ticket_department WHERE site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND piping = 1'; - $result = $db->Execute($sql); - if($result && $result->RecordCount()) { - while(!$result->EOF) - { - $id = $result->fields['id']; - $email = $result->fields['piping_setup_email_id']; - - # Get all messages from this account: - include_once ( PATH_CORE . 'email_piping.inc.php' ); - $email_piping = new email_piping($email); - if(!empty($email_piping->results) && is_array($email_piping->results)) - for ($i=0; $iresults); $i++) - $this->piping_add_ticket( $email_piping->results[$i], $id); - $result->MoveNext(); - } - } - } - - - ############################## - ## Overview ## - ############################## - function piping_add_ticket($arr,$department_id) - { - # Check values - if (empty($arr['uniqueId']) || empty($arr['body'])) - return false; - - # Check if duplicate: - $db = &DB(); - $sql = 'SELECT id FROM ' . AGILE_DB_PREFIX . 'ticket WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - piping_unique_id = ' . $db->qstr($arr['uniqueId']); - $result = $db->Execute($sql); - if($result->RecordCount() > 0) - return false; - - # Determine user's account id: - $sql = 'SELECT id FROM ' . AGILE_DB_PREFIX . 'account WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - email = ' . $db->qstr($arr['from']); - $result = $db->Execute($sql); - - if($result->RecordCount() == 0) - $account_id = 0; - else - $account_id = $result->fields['id']; - - - ### Do any authentication required: - $C_auth = new CORE_auth(false); - $status = 3; - $this->auth = false; - - ### Get available groups for this department: - $sql = 'SELECT group_id FROM ' . AGILE_DB_PREFIX . 'ticket_department WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - id = ' . $db->qstr($department_id); - $result = $db->Execute($sql); - @$groups = unserialize($result->fields['group_id']); - - if($account_id == 0) - { - ### Unknown account, is this this department authorized for the All Users group id (0) - $this->auth = true; - for($i=0; $iauth_group_by_account_id($account_id, $groups[$i])) { - $status = 0; - $i=count($groups); - $this->auth = true; - } - } - } - - if($this->auth) - { - # Create the new ticket record: - $ticket_id = $db->GenID(AGILE_DB_PREFIX . 'ticket_id'); - $sql = 'INSERT INTO ' . AGILE_DB_PREFIX . 'ticket - SET - id = ' . $db->qstr($ticket_id) . ', - site_id = ' . $db->qstr(DEFAULT_SITE) . ', - date_orig = ' . $db->qstr(time()) . ', - date_last = ' . $db->qstr(time()) . ', - account_id = ' . $db->qstr($account_id) . ', - department_id = ' . $db->qstr($department_id) . ', - status = ' . $db->qstr($status) . ', - priority = ' . $db->qstr( '0' ) . ', - subject = ' . $db->qstr( $arr['subject'] ) . ', - body = ' . $db->qstr( @$arr['body'] ) . ', - last_reply = ' . $db->qstr( '0' ) . ', - piping_unique_id= ' . $db->qstr( $arr['uniqueId'] ) . ', - email = ' . $db->qstr($arr['from']); - $result = $db->Execute($sql); - - // insert any attachments - if(!empty($arr['attach']) && is_array($arr['attach'])) { - foreach($arr['attach'] as $attach) { - @$data = file_get_contents($attach['tmp']); - if(!empty($data)) { - // get file size - $size=filesize($attach['tmp']); - $filesizename = array(" Bytes", " KB", " MB", " GB", " TB", " PB", " EB", " ZB", " YB"); - $size=round($size/pow(1024, ($i = floor(log($size, 1024)))), 2) . $filesizename[$i]; - - // insert record - $fields=Array('ticket_id'=>$ticket_id, 'ticket_message_id'=>0, 'name'=>$attach['file'], 'size'=>$size, 'type'=> $attach['type'], 'content'=> $data); - $db->Execute($sql=sqlInsert($db,"ticket_attachment",$fields)); - } - @$u=unlink($attach['tmp']); - } - } - } - - ### Do any emails... - require_once(PATH_MODULES . 'email_template/email_template.inc.php'); - $my = new email_template; - - if($account_id) - $ticket_account_id = $account_id; - else - $ticket_account_id = trim($arr['from']); - - - ### Send the user ticket confirmation message: - global $VAR; - $VAR['ticket_subject'] = $arr['subject']; - $VAR['email'] = trim($arr['from']); - $VAR['key'] = $this->key($arr['from']); - - if($status == 0 && $this->auth) - { - ### Mail the user the new_ticket email template - $my->send('ticket_piping_add_user', $ticket_account_id, $ticket_id, '', ''); - } - elseif ($status == 3 && $this->auth) - { - ### Mail the user the new_ticket email template (pending) - $my->send('ticket_piping_add_user_pending', $ticket_account_id, $ticket_id, '', ''); - } - elseif (!$this->auth) - { - ### Mail the user the new_ticket email template (unauthorized) - $my->send('ticket_piping_add_user_unauth', $ticket_account_id, '', '', ''); - } - - if($status == 0) - { - ### Get any staff members who should be mailed - $dba = &DB(); - $sql = 'SELECT id,account_id,department_avail FROM ' . AGILE_DB_PREFIX . 'staff - WHERE - site_id = ' . $dba->qstr(DEFAULT_SITE) . ' AND - notify_new = ' . $dba->qstr("1"); - $result = $dba->Execute($sql); - - if($result->RecordCount() > 0) - { - while(!$result->EOF) - { - @$avail = unserialize($result->fields['department_avail']); - for($i=0; $isend('ticket_staff_add', $result->fields['account_id'], $ticket_id, $avail[$i], ''); - $i = count($avail); - } - } - $result->MoveNext(); - } - } - } - } - - - - ############################## - ## Overview ## - ############################## - function overview($VAR) - { - # get the authorized ticket departments: - $dbs = &DB(); - $sql = 'SELECT id, department_avail FROM ' . AGILE_DB_PREFIX . 'staff WHERE - site_id = ' . $dbs->qstr(DEFAULT_SITE) . ' AND - account_id = ' . $dbs->qstr(SESS_ACCOUNT); - $result = $dbs->Execute($sql); - - $cats = unserialize($result->fields['department_avail']); - - for($i=0; $ifields['id']; - $smart[$i]['name'] = $cat->fields['name']; - - if($class_name) - { - $smart[$i]['class'] = 'row1'; - $class_name = FALSE; - } else { - $smart[$i]['class'] = 'row2'; - $class_name = TRUE; - } - - - # Get New - $sql = 'SELECT id FROM ' . AGILE_DB_PREFIX . 'ticket WHERE - site_id = ' . $dbs->qstr(DEFAULT_SITE) . ' AND - date_orig = date_last AND - department_id = ' . $dbs->qstr($cats[$i]) . ' AND - ( last_reply = 0 OR last_reply IS NULL ) AND - ( status = 0 OR status IS NULL )'; - $rs = $dbs->Execute($sql); - $smart[$i]['new'] = $rs->RecordCount(); - - - # Get Awaiting Reply - $sql = 'SELECT id FROM ' . AGILE_DB_PREFIX . 'ticket WHERE - site_id = ' . $dbs->qstr(DEFAULT_SITE) . ' AND - date_orig != date_last AND - department_id = ' . $dbs->qstr($cats[$i]) . ' AND - last_reply = 2 AND - status = 0'; - $rs = $dbs->Execute($sql); - $smart[$i]['waiting'] = $rs->RecordCount(); - - - # Get Awaiting Customer - $sql = 'SELECT id FROM ' . AGILE_DB_PREFIX . 'ticket WHERE - site_id = ' . $dbs->qstr(DEFAULT_SITE) . ' AND - date_orig != date_last AND - department_id = ' . $dbs->qstr($cats[$i]) . ' AND - last_reply = 1 AND - status = 0'; - $rs = $dbs->Execute($sql); - $smart[$i]['customer'] = $rs->RecordCount(); - - - # On Hold - $sql = 'SELECT id FROM ' . AGILE_DB_PREFIX . 'ticket WHERE - site_id = ' . $dbs->qstr(DEFAULT_SITE) . ' AND - department_id = ' . $dbs->qstr($cats[$i]) . ' AND - status = ' . $dbs->qstr( '1' ); - $rs = $dbs->Execute($sql); - $smart[$i]['hold'] = $rs->RecordCount(); - - # PENDING - $sql = 'SELECT id FROM ' . AGILE_DB_PREFIX . 'ticket WHERE - site_id = ' . $dbs->qstr(DEFAULT_SITE) . ' AND - department_id = ' . $dbs->qstr($cats[$i]) . ' AND - status = ' . $dbs->qstr( '3' ); - $rs = $dbs->Execute($sql); - $smart[$i]['pending'] = $rs->RecordCount(); - - # Get Resolved - $sql = 'SELECT id FROM ' . AGILE_DB_PREFIX . 'ticket WHERE - site_id = ' . $dbs->qstr(DEFAULT_SITE) . ' AND - department_id = ' . $dbs->qstr($cats[$i]) . ' AND - status = ' . $dbs->qstr( '2' ); - $rs = $dbs->Execute($sql); - $smart[$i]['resolved'] = $rs->RecordCount(); - - - } - global $smarty; - $smarty->assign('overview', $smart); - } - - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $this->construct(); - global $C_vars,$C_list,$C_debug; - - ### Strip Slashes: - global $C_vars; - $C_vars->strip_slashes_all(); - - ### Get the current staff id: - $dbs = &DB(); - $sql = 'SELECT id FROM ' . AGILE_DB_PREFIX . 'staff WHERE - site_id = ' . $dbs->qstr(DEFAULT_SITE) . ' AND - account_id = ' . $dbs->qstr(SESS_ACCOUNT); - $result = $dbs->Execute($sql); - - if($result->RecordCount() == 0) - { - ### ERROR: this account does not have a staff id - global $C_debug, $C_translate; - $C_debug->alert($C_translate->translate('staff_no_account','ticket','')); - $C_vars->strip_slashes_all(); - return; - } - else - { - $staff_id = $result->fields['id']; - $VAR['ticket_staff_id'] = $staff_id; - } - - ### Validate either the user account_id or email has been provided. - include_once(PATH_CORE . 'validate.inc.php' ); - $C_validate = new CORE_validate; - $validate = false; - - if(empty($VAR['ticket_account_id']) && empty($VAR['ticket_email'])) { - $validate = false; - } elseif($C_validate->validate_email(@$VAR['ticket_email'], false) ) { - $validate = true; - } - - ### Set the e-mail from the account for this ticket if none provided: - if(!empty($VAR['ticket_account_id']) && empty($VAR['ticket_email'])) { - $sql = 'SELECT id,email FROM ' . AGILE_DB_PREFIX . 'account WHERE - site_id = ' . $dbs->qstr(DEFAULT_SITE) . ' AND - id = ' . $dbs->qstr(@$VAR['ticket_account_id']); - $account = $dbs->Execute($sql); - if($account->RecordCount() == 0) - { - $validate = false; - } else { - $this->email = trim($account->fields['email']); - $VAR['ticket_email'] = trim($account->fields['email']); - $validate = true; - } - } - - ### Everything pass inspection? - if( !$validate ) - { - $C_debug->alert("A valid user account or e-mail address must be provided!"); - define('FORCE_PAGE', "ticket:add"); - return; - } - - ### Set times: - $VAR['ticket_date_orig'] = $C_list->date_time(time()); - $VAR['ticket_date_last'] = $C_list->date_time(time()); - $VAR['ticket_last_reply'] = "0"; - $VAR['ticket_status'] = "0"; - - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $this->record_id = $db->add($VAR, $this, $type); - - if($this->record_id) - { - ################################################################### - ### Insert the static vars... - - require_once(PATH_CORE . 'static_var.inc.php'); - $static_var = new CORE_static_var; - $static_var->add($VAR, 'ticket', $this->record_id); - - ################################################################### - ### Mail the user the new_ticket email template - - require_once(PATH_MODULES . 'email_template/email_template.inc.php'); - $my = new email_template; - - if(empty($this->email)) { - global $VAR; - $VAR['key'] = $this->key($VAR['ticket_email']); - $VAR['email'] = trim($VAR['ticket_email']); - $my->send('ticket_staff_add_user', $VAR['ticket_email'], $this->record_id, '', ''); - } else { - global $VAR; - $VAR['key'] = $this->key($this->email); - $VAR['email'] = trim($this->email); - $my->send('ticket_staff_add_user', $VAR['ticket_account_id'], $this->record_id, '', ''); - } - - ################################################################### - ### Get any staff members who should be mailed - - $dba = &DB(); - $sql = 'SELECT id,account_id,department_avail FROM ' . AGILE_DB_PREFIX . 'staff - WHERE - site_id = ' . $dba->qstr(DEFAULT_SITE) . ' AND - notify_new = ' . $dba->qstr("1"); - $result = $dba->Execute($sql); - - if($result->RecordCount() > 0) - { - while(!$result->EOF) - { - @$avail = unserialize($result->fields['department_avail']); - for($i=0; $isend('ticket_staff_add', $result->fields['account_id'], $this->record_id, $avail[$i], ''); - $i = count($avail); - } - } - $result->MoveNext(); - } - } - } - } - - - - - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $this->construct(); - ### Get the departments this staff member is authorized for: - - $dbs = &DB(); - $sql = 'SELECT id,department_avail,signature FROM ' . AGILE_DB_PREFIX . 'staff WHERE - site_id = ' . $dbs->qstr(DEFAULT_SITE) . ' AND - account_id = ' . $dbs->qstr(SESS_ACCOUNT); - $result = $dbs->Execute($sql); - - if($result->RecordCount() == 0) - { - ### ERROR: this account does not have a staff id - global $C_debug, $C_translate; - $C_debug->alert($C_translate->translate('staff_no_account','ticket','')); - return; - - } - else - { - $staff_id = $result->fields['id']; - @$avail = unserialize($result->fields['department_avail']); - global $smarty; - $smarty->assign('signature',$result->fields['signature']); - - ### Loop through the records to define the custom SQL: - for($i=0; $icustom_EXP[] = Array('field' => 'department_id', 'value' => $avail[$i]); - } - } - - - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = &DB(); - - # set the field list for this method: - $arr = $this->method[$type]; - if(isset($VAR["id"])) - { - $id = explode(',',$VAR["id"]); - for($i=0; $iqstr($id[$i])." "; - $ii++; - } - else - { - $id_list .= " OR id = " .$db->qstr($id[$i]). " "; - $ii++; - } - } - } - } - - if($ii>0) - { - # generate the full query - $q = "SELECT * FROM - ".AGILE_DB_PREFIX."$this->table - WHERE - $id_list - AND site_id = " . $db->qstr(DEFAULT_SITE) . " - ORDER BY $this->order_by "; - - $result = $db->Execute($q); - - # error reporting - if ($result === false) - { - global $C_debug; - $C_debug->error('database.inc.php','view', $db->ErrorMsg()); - return; - } - - - # put the results into a smarty accessable array - $i=0; - $class_name = TRUE; - $staffs=''; - while (!$result->EOF) - { - $smart[$i] = $result->fields; - $smart[$i]["i"] = $i; - - // get any attachments for ticket - $attach = $db->Execute(sqlSelect($db,"ticket_attachment","id,name,size,type","ticket_id={$result->fields['id']}")); - if($attach && $attach->RecordCount()) { - while(!$attach->EOF) { - $smart[$i]['attachments'][] = $attach->fields; - $attach->MoveNext(); - } - } - - ### Get any replies... - $dba = &DB(); - $p = AGILE_DB_PREFIX; - $s = DEFAULT_SITE; - $sql = " SELECT DISTINCT - A.* - FROM - {$p}ticket_message AS A - WHERE - A.site_id = $s - AND - A.ticket_id = {$result->fields['id']} - ORDER BY - A.date_orig"; - - $replys = $dba->Execute($sql); - $ii=0; - while (!$replys->EOF) - { - # Get the staff name: - if( $replys->fields['staff_id'] > 0 ) - { - $dbm = new CORE_database(); - $rss = $db->Execute( - $sql = $dbm->sql_select( - 'staff', // tables (for one table, delete array) - 'nickname', // fields (for one field, delete array) - "id = {$replys->fields['staff_id']} ", // conditions - "", // order - $db - ) - ); - $replys->fields['staff_nickname'] = $rss->fields['nickname']; - } - else - { - if(!empty($result->fields['email'])) { - $replys->fields['user_name'] = $result->fields['email']; - } elseif(!empty($result->fields['account_id'])) { - $db = &DB(); - $dbm = new CORE_database(); - $rss = $db->Execute( - $dbm->sql_select( - 'account', // tables (for one table, delete array) - 'first_name,last_name', // fields (for one field, delete array) - "id = {$result->fields['account_id']}", // conditions - "", // order - $db - ) - ); - $replys->fields['user_name'] = $rss->fields['first_name'].' ' .$rss->fields['last_name']; - } else { - $replys->fields['user_name'] = 'User'; - } - } - - $ii++; - if($ii >= $replys->RecordCount()) - $replys->fields['last'] = true; - else - $replys->fields['last'] = false; - - $reply[] = $replys->fields; - $replys->MoveNext(); - - } - $smart[$i]["reply"] = $reply; - - - ### Get the static vars: - require_once(PATH_CORE . 'static_var.inc.php'); - $static_var = new CORE_static_var; - $arr = $static_var->view_form($this->module, $result->fields['id']); - if(gettype($arr) == 'array') - { - $smart[$i]["static_var"] = $arr; - } - - // Get the user authentication details - if($result->fields['account_id'] > 0) { - - // get services - $sql = "SELECT id,from_unixtime(date_orig,'%m-%d-%Y') as date_orig,active,sku FROM {$p}service - WHERE account_id={$result->fields['account_id']} AND site_id = ".DEFAULT_SITE." - GROUP BY sku,active - ORDER BY date_orig"; - $authsrvc = $db->Execute($sql); - if($authsrvc && $authsrvc->RecordCount()) { - while(!$authsrvc->EOF) { - $smart[$i]['authsrvc'][] = $authsrvc->fields; - $authsrvc->MoveNext(); - } - } - - // get groups - $sql = "SELECT DISTINCT B.id,B.name,A.active,from_unixtime(A.date_orig,'%m-%d-%Y') as date_orig FROM {$p}account_group as A - JOIN {$p}group as B ON (B.id=A.group_id AND B.site_id=".DEFAULT_SITE.") - WHERE A.account_id = {$result->fields['account_id']} AND A.site_id = ".DEFAULT_SITE." - AND A.group_id>1001"; - $authgrp = $db->Execute($sql); - if($authgrp && $authgrp->RecordCount()) { - while(!$authgrp->EOF) { - $smart[$i]['authgrp'][] = $authgrp->fields; - $authgrp->MoveNext(); - } - } - - // get ordered products - $sql = "SELECT count(*) as qty, B.id,from_unixtime(B.date_orig,'%m-%d-%Y') as dateorg,A.sku FROM {$p}invoice_item as A - JOIN {$p}invoice as B ON (B.id=A.invoice_id AND B.site_id=".DEFAULT_SITE." AND billing_status=1 AND process_status=1 ) - WHERE A.account_id = {$result->fields['account_id']} AND A.site_id = ".DEFAULT_SITE." - GROUP BY sku,dateorg"; - $authsku = $db->Execute($sql); - if($authsku && $authsku->RecordCount()) { - while(!$authsku->EOF) { - $smart[$i]['authsku'][] = $authsku->fields; - $authsku->MoveNext(); - } - } - } - - $i++; - $result->MoveNext(); - } - - # get the result count: - $results = $i; - - ### No results: - if($i == 0) - { - global $C_debug; - $C_debug->error("CORE:database.inc.php", "view()", "The selected record does not - exist any longer, or your account is not authorized to view it"); - return; - } - - # define the results - global $smarty; - $smarty->assign($this->table, $smart); - $smarty->assign('results', $search->results); - } - } - - - - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $this->construct(); - - $db =& DB(); - # get current department - $rs = $db->Execute(sqlSelect($db,"ticket","ticket_department_id","id=::".$VAR['ticket_id']."::")); - @$old_ticket_department_id = $rs->fields[0]; - - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - - # if the ticket was moved to a new department, send email notice to staff members - if ($old_ticket_department_id != $VAR['ticket_department_id']) - $this->send_staff_emails($VAR['ticket_id'], SESS_ACCOUNT, $old_ticket_department_id, 'change'); - } - - function send_staff_emails($id, $staff_account_id = 0, $old_department_id = 0, $notify_type='new' ) - { - $db=&DB(); - $rs = $db->Execute(sqlSelect($db,"ticket","*","id=::$id::")); - require_once(PATH_MODULES.'email_template/email_template.inc.php'); - - $sql = 'SELECT id,account_id,department_avail - FROM '.AGILE_DB_PREFIX.'staff - WHERE - notify_'.$notify_type.'=1 AND - account_id != '.$staff_account_id.' AND - site_id = '.DEFAULT_SITE; - $result = $db->Execute($sql); - - if($result->RecordCount() > 0) - { - while(!$result->EOF) - { - $bSend = false; - - @$avail = unserialize($result->fields['department_avail']); - for($i=0; $ifields['department_id']) $bSend = true; - - if($old_department_id && $result->fields['department_id'] == $old_department_id) { - $bSend = false; - $i = count($avail); - } - - if($bSend) { - ### Mail staff members the new_ticket email template - global $VAR, $C_translate; - $VAR['ticket_priority'] = 'Normal (e-mail)'; - $VAR['ticket_subject'] = $rs->fields['subject']; - $VAR['ticket_body'] = $rs->fields['body']; - if($rs->fields['status'] == 0) { - $VAR['ticket_status'] = $C_translate->translate('status_open','ticket',''); - } else if($rs->fields['status'] == 1) { - $VAR['ticket_status'] = $C_translate->translate('status_hold','ticket',''); - } else if($rs->fields['status'] == 2) { - $VAR['ticket_status'] = $C_translate->translate('status_close','ticket',''); - } else if($rs->fields['status'] == 3) { - $VAR['ticket_status'] = $C_translate->translate('status_pending','ticket',''); - } - # Find other bodies for ticket - $rs1 = $db->Execute(sqlSelect($db,"ticket_message","*","ticket_id=::".$id."::")); - if($rs1 && $rs1->RecordCount()) { - while(!$rs1->EOF) { - if($rs1->fields['date_orig'] >= $rs->fields['date_orig']) { - $VAR['ticket_body'] = $rs1->fields['message']; - } - $rs1->MoveNext(); - } - } - $my = new email_template; - $my->send('ticket_staff_add', $result->fields['account_id'], $id, $avail[$i], ''); - $i = count($avail); - } - } - $result->MoveNext(); - } - } - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $this->construct(); - $this->associated_DELETE[] = Array( 'table' => 'ticket_message', 'field' => 'ticket_id'); - $this->associated_DELETE[] = Array( 'table' => 'ticket_attachment', 'field' => 'ticket_id'); - - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $this->construct(); - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $this->construct(); - - ### Get the departments this staff member is authorized for: - - $dbs = &DB(); - $sql = 'SELECT id, department_avail FROM ' . AGILE_DB_PREFIX . 'staff WHERE - site_id = ' . $dbs->qstr(DEFAULT_SITE) . ' AND - account_id = ' . $dbs->qstr(SESS_ACCOUNT); - $result = $dbs->Execute($sql); - - if($result->RecordCount() == 0) - { - ### ERROR: this account does not have a staff id - global $C_debug, $C_translate; - $C_debug->alert($C_translate->translate('staff_no_account','ticket','')); - return; - - } - else - { - $staff_id = $result->fields['id']; - @$avail = unserialize($result->fields['department_avail']); - } - - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - - $db = &DB(); - - include_once(PATH_CORE . 'validate.inc.php'); - $validate = new CORE_validate; - - # set the search criteria array - $arr = $VAR; - - # loop through the submitted field_names to get the WHERE statement - $where_list = ''; - $i=0; - while (list ($key, $value) = each ($arr)) - { - if($i == 0) - { - if($value != '') - { - $pat = "^" . $this->module . "_"; - if(eregi($pat, $key)) - { - $field = eregi_replace($pat,"",$key); - if(eregi('%',$value)) - { - # do any data conversion for this field (date, encrypt, etc...) - if(isset($this->field["$field"]["convert"])) - { - $value = $validate->convert($field, $value, $this->field["$field"]["convert"]); - } - - $where_list .= " WHERE ".AGILE_DB_PREFIX."ticket.".$field . " LIKE " . $db->qstr($value, get_magic_quotes_gpc()); - $i++; - } - else - { - # check if array - if(is_array($value)) - { - for($i_arr=0; $i_arr < count($value); $i_arr++) - { - if($value["$i_arr"] != '') - { - # determine any field options (=, >, <, etc...) - $f_opt = '='; - $pat_field = $this->module.'_'.$field; - $VAR['field_option']["$pat_field"]["$i_arr"]; - if(isset($VAR['field_option']["$pat_field"]["$i_arr"])) - { - $f_opt = $VAR['field_option']["$pat_field"]["$i_arr"]; - # error checking, safety precaution - if($f_opt != '=' && $f_opt != '>' && $f_opt != '<' && $f_opt != '>=' && $f_opt != '<=' && $f_opt != '!=') - $f_opt = '='; - } - - # do any data conversion for this field (date, encrypt, etc...) - if(isset($this->field["$field"]["convert"])) - { - $value["$i_arr"] = $validate->convert($field, $value["$i_arr"], $this->field["$field"]["convert"]); - } - - - if($i_arr == 0) - { - $where_list .= " WHERE ".AGILE_DB_PREFIX."ticket.".$field . " $f_opt " . $db->qstr($value["$i_arr"], get_magic_quotes_gpc()); - $i++; - } - else - { - $where_list .= " AND ".AGILE_DB_PREFIX."ticket.".$field . " $f_opt " . $db->qstr($value["$i_arr"], get_magic_quotes_gpc()); - $i++; - } - } - } - } - else - { - $where_list .= " WHERE ".AGILE_DB_PREFIX."ticket.".$field . " = " . $db->qstr($value, get_magic_quotes_gpc()); - $i++; - } - } - } - } - } - else - { - if($value != '') - { - $pat = "^" . $this->module . "_"; - if(eregi($pat, $key)) - { - $field = eregi_replace($pat,"",$key); - if(eregi('%',$value)) - { - # do any data conversion for this field (date, encrypt, etc...) - if(isset($this->field["$field"]["convert"])) - { - $value = $validate->convert($field, $value, $this->field["$field"]["convert"]); - } - - $where_list .= " AND ".AGILE_DB_PREFIX."ticket.".$field . " LIKE " . $db->qstr($value, get_magic_quotes_gpc()); - $i++; - } - else - { - # check if array - if(is_array($value)) - { - for($i_arr=0; $i_arr < count($value); $i_arr++) - { - if($value["$i_arr"] != '') - { - # determine any field options (=, >, <, etc...) - $f_opt = '='; - $pat_field = $this->module.'_'.$field; - if(isset($VAR['field_option']["$pat_field"]["$i_arr"])) - { - $f_opt = $VAR['field_option']["$pat_field"]["$i_arr"]; - - # error checking, safety precaution - if($f_opt != '=' && $f_opt != '>' && $f_opt != '<' && $f_opt != '>=' && $f_opt != '<=' && $f_opt != '!=') - $f_opt = '='; - } - - # do any data conversion for this field (date, encrypt, etc...) - if(isset($this->field["$field"]["convert"])) - { - $value["$i_arr"] = $validate->convert($field, $value["$i_arr"], $this->field["$field"]["convert"]); - } - - $where_list .= " AND ".AGILE_DB_PREFIX."ticket.". $field . " $f_opt " . $db->qstr($value["$i_arr"], get_magic_quotes_gpc()); - $i++; - } - } - } - else - { - $where_list .= " AND ".AGILE_DB_PREFIX."ticket.". $field . " = ". $db->qstr($value, get_magic_quotes_gpc()); - $i++; - } - } - } - } - } - } - - #### finalize the WHERE statement - if($where_list == '') - { - $where_list .= ' WHERE '; - } - else - { - $where_list .= ' AND '; - } - - - # get limit type - if(isset($VAR['limit'])) - { - $limit = $VAR['limit']; - } - else - { - $limit = $this->limit; - } - - # get order by - if(isset($VAR['order_by'])) - { - $order_by = $VAR['order_by']; - } - else - { - $order_by = $this->order_by; - } - - $pre = AGILE_DB_PREFIX; - - # Dept ID; - if(!empty($staff_id) && count($avail) > 0) - { - $where_list .= ' ( '; - - ### Loop through the records to define the custom SQL: - for($i=0; $i 0) - $where_list .= " OR "; - $where_list .= " {$pre}ticket.department_id = ".$db->qstr($avail[$i]); - } - - $where_list .= ' ) AND '; - } - - - $q = "SELECT DISTINCT ".AGILE_DB_PREFIX."ticket.id FROM ".AGILE_DB_PREFIX."ticket "; - $q_save = "SELECT DISTINCT %%fieldList%% FROM ".AGILE_DB_PREFIX."ticket "; - - - ######## GET ANY STATIC VARS TO SEARCH ########## - $join_list = ''; - if(!empty($VAR["static_relation"]) && count( $VAR["static_relation"] > 0 )) { - while(list($idx, $value) = each ($VAR["static_relation"])) { - if($value != "") { - - $join_list .= " INNER JOIN {$pre}static_var_record AS s{$idx} ON - ( - s{$idx}.record_id = {$pre}{$this->table}.id - AND - s{$idx}.static_var_relation_id = '{$idx}' - AND - s{$idx}.site_id = ".$db->qstr(DEFAULT_SITE)." - AND"; - if(ereg("%", $value)) - $join_list .= " s{$idx}.value LIKE ".$db->qstr($VAR["static_relation"]["$idx"]); - else - $join_list .= " s{$idx}.value = ".$db->qstr($VAR["static_relation"]["$idx"]); - $join_list .= " ) "; - } - } - } - ######## END STATIC VAR SEARCH ################## - - - # standard where list - $q .= $join_list . $where_list ." ".AGILE_DB_PREFIX."ticket.site_id = " . $db->qstr(DEFAULT_SITE); - $q_save .= $join_list . $where_list ." %%whereList%% "; - - - ################## DEBUG ################## - #echo "
    " . $q;
    -		#echo "

    " . $q_save; - #exit; - - # run the database query - $result = $db->Execute($q); - - # error reporting - if ($result === false) - { - global $C_debug; - $C_debug->error('ticket.inc.php','search', $db->ErrorMsg()); - return false; - } - - # get the result count: - $results = $result->RecordCount(); - - # get the first record id: - if($results == 1) $record_id = $result->fields['id']; - - # define the DB vars as a Smarty accessible block - global $smarty; - - # Create the definition for fast-forwarding to a single record: - if ($results == 1 && !isset($this->fast_forward)) - { - $smarty->assign('record_id', $record_id); - } - - # create the search record: - if($results > 0) - { - # create the search record - include_once(PATH_CORE . 'search.inc.php'); - $search = new CORE_search; - $arr['module'] = $this->module; - $arr['sql'] = $q_save; - $arr['limit'] = $limit; - $arr['order_by']= $order_by; - $arr['results'] = $results; - $search->add($arr); - - # define the search id and other parameters for Smarty - $smarty->assign('search_id', $search->id); - - # page: - $smarty->assign('page', '1'); - - # limit: - $smarty->assign('limit', $limit); - - # order_by: - $smarty->assign('order_by', $order_by); - } - - # define the result count - $smarty->assign('results', $results); - } - - - - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $this->construct(); - ### Get the departments this staff member is authorized for: - - $dbs = &DB(); - $sql = 'SELECT id, department_avail FROM ' . AGILE_DB_PREFIX . 'staff WHERE - site_id = ' . $dbs->qstr(DEFAULT_SITE) . ' AND - account_id = ' . $dbs->qstr(SESS_ACCOUNT); - $result = $dbs->Execute($sql); - - if($result->RecordCount() == 0) - { - ### ERROR: this account does not have a staff id - global $C_debug, $C_translate; - $C_debug->alert($C_translate->translate('staff_no_account','ticket','')); - return; - - } - else - { - $staff_id = $result->fields['id']; - @$avail = unserialize($result->fields['department_avail']); - } - - - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - - # set the field list for this method: - $arr = $this->method[$type]; - - $field_list = ''; - $i=0; - while (list ($key, $value) = each ($arr)) - { - if($i == 0) - { - $field_var = $this->table . '_' . $value; - $field_list .= AGILE_DB_PREFIX . "ticket" . "." . $value; - - // determine if this record is linked to another table/field - if($this->field[$value]["asso_table"] != "") - { - $this->linked[] = array('field' => $value, 'link_table' => $this->field[$value]["asso_table"], 'link_field' => $this->field[$value]["asso_field"]); - } - } - else - { - $field_var = $this->table . '_' . $value; - $field_list .= "," . AGILE_DB_PREFIX . "ticket" . "." . $value; - - // determine if this record is linked to another table/field - if($this->field[$value]["asso_table"] != "") - { - $this->linked[] = array('field' => $value, 'link_table' => $this->field[$value]["asso_table"], 'link_field' => $this->field[$value]["asso_field"]); - } - } - $i++; - } - - - # get the search details: - if(isset($VAR['search_id'])) { - include_once(PATH_CORE . 'search.inc.php'); - $search = new CORE_search; - $search->get($VAR['search_id']); - } else { - # invalid search! - echo '
    The search terms submitted were invalid!'; # translate... # alert - - if(isset($this->trigger["$type"])) { - include_once(PATH_CORE . 'trigger.inc.php'); - $trigger = new CORE_trigger; - $trigger->trigger($this->trigger["$type"], 0, $VAR); - } - } - - # get the sort order details: - if(isset($VAR['order_by']) && $VAR['order_by'] != "") { - $order_by = ' ORDER BY ' . AGILE_DB_PREFIX . 'ticket.'.$VAR['order_by']; - $smarty_order = $VAR['order_by']; - } else { - $order_by = ' ORDER BY ' . AGILE_DB_PREFIX . 'ticket.'.$this->order_by; - $smarty_order = $search->order_by; - } - - - # determine the sort order - if(isset($VAR['desc'])) { - $order_by .= ' DESC'; - $smarty_sort = 'desc='; - } else if(isset($VAR['asc'])) { - $order_by .= ' ASC'; - $smarty_sort = 'asc='; - } else { - if (!eregi('date',$smarty_order)) { - $order_by .= ' ASC'; - $smarty_sort = 'asc='; - } else { - $order_by .= ' DESC'; - $smarty_sort = 'desc='; - } - } - - - # generate the full query - - $db = &DB(); - $q = eregi_replace("%%fieldList%%", $field_list, $search->sql); - $q = eregi_replace("%%tableList%%", AGILE_DB_PREFIX.$construct->table, $q); - $q = eregi_replace("%%whereList%%", "", $q); - $q .= " ".AGILE_DB_PREFIX . "ticket."."site_id = " . $db->qstr(DEFAULT_SITE); - $q .= $order_by; - - ////////////////// - #echo "
     $q 

    "; - $current_page=1; - $offset=-1; - if (!empty($VAR['page'])) $current_page = $VAR['page']; - if (empty($search->limit)) $search->limit=25; - if($current_page>1) $offset = (($current_page * $search->limit) - $search->limit); - $result = $db->SelectLimit($q, $search->limit, $offset); - - # error reporting - if ($result === false) - { - global $C_debug; - $C_debug->error('ticket.inc.php','search_show', $db->ErrorMsg()); - - if(isset($this->trigger["$type"])) - { - include_once(PATH_CORE . 'trigger.inc.php'); - $trigger = new CORE_trigger; - $trigger->trigger($this->trigger["$type"], 0, $VAR); - } - return; - } - - - # put the results into a smarty accessable array - $i=0; - $class_name = TRUE; - while (!$result->EOF) { - $smart[$i] = $result->fields; - - if($class_name) - { - $smart[$i]['_C'] = 'row1'; - $class_name = FALSE; - } else { - $smart[$i]['_C'] = 'row2'; - $class_name = TRUE; - } - $result->MoveNext(); - $i++; - } - - - # get any linked fields - if($i > 0) - { - $db_join = new CORE_database; - $this->result = $db_join->join_fields($smart, $this->linked); - } - else - { - $this->result = $smart; - } - - # get the result count: - $results = $result->RecordCount(); - - # define the DB vars as a Smarty accessible block - global $smarty; - - # define the results - $smarty->assign($this->table, $this->result); - $smarty->assign('page', $VAR['page']); - $smarty->assign('order', $smarty_order); - $smarty->assign('sort', $smarty_sort); - $smarty->assign('limit', $search->limit); - $smarty->assign('search_id',$search->id); - $smarty->assign('results', $search->results); - - # get the total pages for this search: - if(empty($search->limit)) - $this->pages = 1; - else - $this->pages = intval($search->results / $search->limit); - if ($search->results % $search->limit) $this->pages++; - - # total pages - $smarty->assign('pages', $this->pages); - - # current page - $smarty->assign('page', $current_page); - $page_arr = ''; - for($i=0; $i <= $this->pages; $i++) - { - if ($this->page != $i) $page_arr[] = $i; - } - - # page array for menu - $smarty->assign('page_arr', $page_arr); - } - - - - - - - ############################## - ## STATIC VARS ## - ############################## - - function static_var($VAR) - { - $this->construct(); - global $smarty; - - require_once(PATH_CORE . 'static_var.inc.php'); - $static_var = new CORE_static_var; - - if(ereg('search', $VAR['_page'])) - $arr = $static_var->generate_form($this->module, 'user_add', 'search'); - else - $arr = $static_var->generate_form($this->module, 'user_add', 'update'); - - if(gettype($arr) == 'array') - { - ### Set everything as a smarty array, and return: - $smarty->assign('show_static_var', true); - $smarty->assign('static_var', $arr); - return true; - } - else - { - ### Or if no results: - $smarty->assign('show_static_var', false); - return false; - } - } - - - - ############################## - ## REPLY ## - ############################## - - function reply($VAR) - { - $this->construct(); - global $smarty; - - if(!isset($VAR['ticket_id']) || $VAR['ticket_id'] == '') - ### ERROR: ID must be set!! - { - global $C_debug, $C_translate, $C_vars; - $C_debug->alert($C_translate->translate('user_ticket_nonexist','ticket','')); - $C_vars->strip_slashes_all(); - return false; - } - - if(!isset($VAR['ticket_reply']) || $VAR['ticket_reply'] == '') - ### ERROR: Ticket Reply must be set!! - { - global $C_debug, $C_translate, $C_vars; - $C_debug->alert($C_translate->translate('staff_response_required','ticket','')); - $C_vars->strip_slashes_all(); - return; - } - - - ### Get the ticket record - $db = &DB(); - $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'ticket WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - id = ' . $db->qstr($VAR['ticket_id']); - $ticket = $db->Execute($sql); - if($ticket->RecordCount() == 0) - { - ### ERROR: ticket doesn't exist! - global $C_debug, $C_translate; - $C_debug->alert($C_translate->translate('user_ticket_nonexist','ticket','')); - return false; - } - - $status = $ticket->fields['status']; - $department_id = $ticket->fields['department_id']; - - ### Get the staff ID: - $dbs = &DB(); - $sql = 'SELECT id FROM ' . AGILE_DB_PREFIX . 'staff WHERE - site_id = ' . $dbs->qstr(DEFAULT_SITE) . ' AND - account_id = ' . $dbs->qstr(SESS_ACCOUNT); - $staff = $dbs->Execute($sql); - $staff_id = $staff->fields['id']; - - ### Update the ticket status: - $sql = 'UPDATE ' . AGILE_DB_PREFIX . 'ticket SET - date_last = ' . $dbs->qstr(time()) .', - last_reply = ' . $dbs->qstr( '1' ) .', - staff_id = ' . $dbs->qstr($staff_id) .' - WHERE - site_id = ' . $dbs->qstr(DEFAULT_SITE) . ' AND - id = ' . $dbs->qstr($VAR['ticket_id']); - $update = $dbs->Execute($sql); - - ### Add the message Record to the DB - $db = &DB(); - $id = $db->GenID(AGILE_DB_PREFIX . "" . 'ticket_message_id'); - $sql = 'INSERT INTO ' . AGILE_DB_PREFIX . 'ticket_message SET - site_id = ' . $db->qstr(DEFAULT_SITE) . ', - staff_id = ' . $db->qstr($staff_id) . ', - id = ' . $db->qstr($id) . ', - ticket_id = ' . $db->qstr($VAR['ticket_id']) . ', - date_orig = ' . $db->qstr(time()) . ', - message = ' . $db->qstr(htmlspecialchars($VAR['ticket_reply']), get_magic_quotes_gpc()) ; - $result = $db->Execute($sql); - - - if(!empty($VAR['enable_user_notice'])) - { - ################################################################### - ### Mail the user the new_ticket email template - - require_once(PATH_MODULES . 'email_template/email_template.inc.php'); - $my = new email_template; - - if(!empty($ticket->fields["email"])) - { - global $VAR; - $VAR['key'] = $this->key($ticket->fields["email"]); - $VAR['email'] = trim($ticket->fields["email"]); - $VAR['message'] = trim(htmlspecialchars($VAR['ticket_reply'])); - $my->send('ticket_staff_update_user', $ticket->fields["email"], $VAR['ticket_id'], '', ''); - } - else - { - $sql = 'SELECT email FROM ' . AGILE_DB_PREFIX . 'account WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - id = ' . $db->qstr($ticket->fields['account_id']); - $account = $db->Execute($sql); - global $VAR; - $VAR['key'] = $this->key($ticket->fields["email"]); - $VAR['email'] = trim($account->fields['email']); - $VAR['message'] = trim(htmlspecialchars($VAR['ticket_reply'])); - $my->send('ticket_staff_update_user', $ticket->fields["account_id"], $VAR['ticket_id'], '', ''); - } - - global $C_debug, $C_translate; - $C_debug->alert($C_translate->translate('staff_response_success','ticket','')); - } - - # send the reply to the staff members - $this->send_staff_emails($VAR['ticket_id'], SESS_ACCOUNT, 0, 'change'); - } - - - - - ############################## - ## USER LIST ## - ############################## - - function user_list($VAR) - { - $this->construct(); - global $C_debug, $C_translate, $smarty; - - if(SESS_LOGGED == false) { - if(!$this->is_key_match($VAR)) { - $C_debug->alert($C_translate->translate('login_required', '', '')); - return false; - } - } - - $db = &DB(); - $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'ticket WHERE site_id = ' . $db->qstr(DEFAULT_SITE); - - if(SESS_LOGGED == true) { - $sql .= ' AND ( - account_id = ' . $db->qstr(SESS_ACCOUNT) . ' - ) '; - } - - if (SESS_LOGGED == true && !empty($VAR['email']) ) - $sql .= ' OR '; - else if (SESS_LOGGED == false && !empty($VAR['email']) ) - $sql .= ' AND '; - - if ( !empty($VAR['email']) ) { - $sql .= ' ( - email = ' . $db->qstr(@$VAR['email']) . ' - AND - email != ' . $db->qstr('') . ' - AND - email IS NOT NULL - ) - ORDER BY status, date_last DESC'; - } - - $result = $db->Execute($sql); - - if($result->RecordCount() == 0) - { - ### Or if no results: - $smarty->assign('ticket_results', false); - return false; - } - else - { - while (!$result->EOF) - { - $smart[] = $result->fields; - $result->MoveNext(); - } - - ## Set everything as a smarty array, and return: - $smarty->assign('ticket_results', $smart); - return true; - } - } - - - - - - - - ############################## - ## USER UPDATE ## - ############################## - - function user_update($VAR) - { - $this->construct(); - global $smarty; - - if(SESS_LOGGED == false) { - if(!$this->is_key_match($VAR)) { - $smarty->assign('ticket', false); - return false; - } - } - - if(!isset($VAR['id']) || $VAR['id'] == '') - ### ERROR: ID must be set!! - { - global $C_debug, $C_translate; - $C_debug->alert($C_translate->translate('user_ticket_nonexist','ticket','')); - } - - ### Check it this is a request to close the ticket - if(isset($VAR['ticket_status'])) - { - ### Close the ticket - $db = &DB(); - $sql = 'UPDATE ' . AGILE_DB_PREFIX . 'ticket - SET - status = ' . $db->qstr('2') .', - date_last = ' . $db->qstr(time()) .' - WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' - AND - ( - account_id = ' . $db->qstr(SESS_ACCOUNT) . ' OR - email = ' . $db->qstr(@$VAR["email"]) . ' - ) - AND - id = ' . $db->qstr($VAR['id']); - $ticket = $db->Execute($sql); - return; - } - - - if(!isset($VAR['ticket_reply']) || $VAR['ticket_reply'] == '') - ### ERROR: Ticket Reply must be set!! - { - global $C_debug, $C_translate; - $C_debug->alert($C_translate->translate('staff_response_required','ticket','')); - } - - ### Get the ticket record - $db = &DB(); - $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'ticket - WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' - AND - ( - account_id = ' . $db->qstr(SESS_ACCOUNT) . ' OR - email = ' . $db->qstr(@$VAR["email"]) . ' - ) - AND - id = ' . $db->qstr($VAR['id']); - $ticket = $db->Execute($sql); - if($ticket->RecordCount() == 0) - { - ### ERROR: ticket doesn't exist! - global $C_debug, $C_translate; - $C_debug->alert($C_translate->translate('user_ticket_nonexist','ticket','')); - return false; - } - - $status = $ticket->fields['status']; - $department_id = $ticket->fields['department_id']; - $authorized = false; - - - if($status == '2') - { - if(SESS_LOGGED == true) - { - ### Check if user is auth for this department still! - $db = &DB(); - $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'ticket_department WHERE - id = ' . $db->qstr($department_id) . ' AND - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - status = ' . $db->qstr('1'); - $result = $db->Execute($sql); - if($result->RecordCount() == 0) - { - ### ERROR: not authorized to reopen this ticket! - global $C_debug, $C_translate; - $C_debug->alert($C_translate->translate('user_not_auth_reopen','ticket','')); - return false; - } - $i = 0; - $arr = unserialize($result->fields['group_id']); - global $C_auth; - for($i=0; $iauth_group_by_id($arr[$i])) $authorized = true; - } - } - else - { - ### Check if this department is authorized for the 'All Users' group id (0): - $db = &DB(); - $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'ticket_department WHERE - id = ' . $db->qstr($department_id) . ' AND - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - status = ' . $db->qstr('1'); - $result = $db->Execute($sql); - if($result->RecordCount() == 0) - { - ### ERROR: not authorized to reopen this ticket! - global $C_debug, $C_translate; - $C_debug->alert($C_translate->translate('user_not_auth_reopen','ticket','')); - return false; - } - $i = 0; - $arr = unserialize($result->fields['group_id']); - global $C_auth; - for($i=0; $ialert($C_translate->translate('user_not_auth_reopen','ticket','')); - return false; - } - elseif (!$authorized && SESS_LOGGED == false) - { - ### ERROR: not authorized to reopen this ticket & should try to login! - global $C_debug, $C_translate; - $C_debug->alert($C_translate->translate('user_not_auth_reopen_login','ticket','')); - return false; - } - - if($status == '0' || $status == '2') - $status = '0'; - else - $status = '1'; - - - ### Update the ticket status: - $sql = 'UPDATE ' . AGILE_DB_PREFIX . 'ticket SET - status = ' . $db->qstr($status) .', - last_reply = ' . $db->qstr( '2' ) .', - date_last = ' . $db->qstr(time()) .' - WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - account_id = ' . $db->qstr(SESS_ACCOUNT) . ' AND - id = ' . $db->qstr($VAR['id']); - $update = $db->Execute($sql); - - - ### Add the message Record to the DB - $db = &DB(); - $id = $db->GenID(AGILE_DB_PREFIX . "" . 'ticket_message_id'); - $sql = 'INSERT INTO ' . AGILE_DB_PREFIX . 'ticket_message SET - site_id = ' . $db->qstr(DEFAULT_SITE) . ', - id = ' . $db->qstr($id) . ', - ticket_id = ' . $db->qstr($VAR['id']) . ', - date_orig = ' . $db->qstr(time()) . ', - message = ' . $db->qstr(htmlspecialchars($VAR['ticket_reply']), get_magic_quotes_gpc()) ; - $result = $db->Execute($sql); - - - ################################################################### - ### Mail the user the new_ticket email template - - require_once(PATH_MODULES . 'email_template/email_template.inc.php'); - $my = new email_template; - - global $VAR; - $VAR['email'] = trim($ticket->fields['email']); - $VAR['key'] = $this->key($ticket->fields['email']); - - if(SESS_LOGGED) - $my->send('ticket_user_update', SESS_ACCOUNT, $VAR['id'], '', ''); - else - $my->send('ticket_user_update', $ticket->fields['email'], $VAR['id'], '', ''); - - - - ################################################################### - ### Get any staff members who should be mailed - - $db = &DB(); - $sql = 'SELECT id,account_id,department_avail FROM ' . AGILE_DB_PREFIX . 'staff - WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - notify_change = ' . $db->qstr("1"); - $result = $db->Execute($sql); - - if($result->RecordCount() > 0) - { - while(!$result->EOF) - { - @$avail = unserialize($result->fields['department_avail']); - for($i=0; $isend('ticket_user_update_staff', $result->fields['account_id'], $VAR['id'], $avail[$i], ''); - $i = count($avail); - } - } - $result->MoveNext(); - } - } - global $C_debug, $C_translate; - $C_debug->alert($C_translate->translate('user_update_success','ticket','')); - return; - } - - - - - ############################## - ## USER VIEW ## - ############################## - - function user_view($VAR) - { - $this->construct(); - global $C_debug, $C_translate, $smarty; - - if(SESS_LOGGED == false) { - if(!$this->is_key_match($VAR)) { - $smarty->assign('ticket', false); - return false; - } - } - - if(empty($VAR['id'])) - ### ERROR: ID must be set!! - { - global $C_debug, $C_translate; - $C_debug->alert($C_translate->translate('user_ticket_nonexist','ticket','')); - $smarty->assign('ticket', false); - return false; - } - - ### Get the ticket record - $db = &DB(); - $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'ticket - WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' - AND - ( - account_id = ' . $db->qstr(SESS_ACCOUNT) . ' - OR - email = ' . $db->qstr(@$VAR['email']) . ' - ) - AND - id = ' . $db->qstr($VAR['id']); - - $result = $db->Execute($sql); - - if($result->RecordCount() == 0) - { - ### Or if no results: - $smarty->assign('ticket', false); - return false; - } - else - { - ### Get any replies... - $db = &DB(); - $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'ticket_message WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - ticket_id = ' . $db->qstr($VAR['id']) . ' - ORDER BY date_orig'; - - $replys = $db->Execute($sql); - - while (!$replys->EOF) - { - $reply[] = $replys->fields; - $replys->MoveNext(); - } - - ## Set everything as a smarty array, and return: - $smarty->assign('ticket', $result->fields); - $smarty->assign('ticket_reply', $reply); - - ### Get the static vars: - require_once(PATH_CORE . 'static_var.inc.php'); - $static_var = new CORE_static_var; - $arr = $static_var->view_form($this->module, $VAR['id']); - - if(gettype($arr) == 'array') - { - ### Set everything as a smarty array, and return: - $smarty->assign('show_static_var', true); - $smarty->assign('static_var', $arr); - return true; - } - else - { - ### Or if no results: - $smarty->assign('show_static_var', false); - return false; - } - } - } - - - - ############################## - ## USER ADD ## - ############################## - - function user_add($VAR) - { - $this->construct(); - global $C_debug, $C_translate, $C_vars, $smarty; - - ### Strip Slashes - global $VAR; - $C_vars->strip_slashes_all(); - - #################################################################### - ### Check that the required fields are set: - ### ticket_department_id, ticket_subject, ticket_body - #################################################################### - - $fields = Array('priority', - 'department_id', - 'subject', - 'body'); - - for($i=0; $itable . '_' . $field; - if(!isset($VAR["$field_name"]) || trim($VAR["$field_name"]) == "") - { - $this->val_error[] = Array('field' => $this->table . '_' . $field, - 'field_trans' => $C_translate->translate('field_' . $field, $this->module, ""), # translate - 'error' => $C_translate->translate('validate_any',"", "")); - } - } - - - - #################################################################### - ### Get required static_Vars and validate them... return an array - ### w/ ALL errors... - #################################################################### - - require_once(PATH_CORE . 'static_var.inc.php'); - $static_var = new CORE_static_var; - if(!isset($this->val_error)) $this->val_error = false; - $all_error = $static_var->validate_form($this->module, $this->val_error); - - if($all_error != false && gettype($all_error) == 'array') - $this->validated = false; - else - $this->validated = true; - - ### Validate e-mail - if(!SESS_LOGGED) - { - - include_once(PATH_CORE . 'validate.inc.php' ); - $C_validate = new CORE_validate; - - if(empty($VAR['ticket_email'])) { - $this->validated = false; - $smarty->assign('ticket_email', true); - $all_error[] = Array ( 'field' => 'ticket_email', - 'field_trans' => $C_translate->translate('field_email', "ticket", ""), - 'error' => $C_translate->translate('validate_any',"", "")); - } - elseif (!$C_validate->validate_email(@$VAR['ticket_email'], false)) - { - $this->validated = false; - $smarty->assign('ticket_email', true); - $all_error[] = Array ( 'field' => 'ticket_email', - 'field_trans' => $C_translate->translate('field_email', "ticket", ""), - 'error' => $C_translate->translate('validate_email',"", "")); - } - - $this->email = $VAR['ticket_email']; - - } else { - # Get the e-mail addy from the user's account - $db = &DB(); - $sql = 'SELECT email FROM ' . AGILE_DB_PREFIX . 'account WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - id = ' . $db->qstr(SESS_ACCOUNT); - $result = $db->Execute($sql); - $VAR['ticket_email'] = $result->fields['email']; - $this->email = $result->fields['email']; - } - - - ################################################################### - ### Check that the user is authorized for this department - - $db = &DB(); - $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'ticket_department WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - id = ' . $db->qstr($VAR['ticket_department_id']) . ' AND - status = ' . $db->qstr('1'); - $result = $db->Execute($sql); - - if($result->RecordCount() == 0) - { - ################################################################### - ### ERROR: The selected department is inactive or invalid - - $C_debug->alert($C_translate->translate('department_invalid', 'ticket', '')); - return false; - } - - global $C_auth; - $i = 0; - - - $dept_auth = false; - while(!$result->EOF) - { - $arr = unserialize($result->fields['group_id']); - - if(!SESS_LOGGED) - { - ### Check if the specified department is authorized for the 'All Users' group (0): - for($i=0; $ialert($C_translate->translate('login_required', '', '')); - return false; - } - } - else - { - for($i=0; $iauth_group_by_id($arr[$i])) { - $dept_auth = true; - } - } - } - $result->MoveNext(); - } - - if(!$dept_auth) - { - ################################################################### - ### ERROR: The current user does not have access to the selected department! - - $C_debug->alert($C_translate->translate('department_not_auth', 'ticket', '')); - return false; - } - else - { - - #################################################################### - # If validation was failed, skip the db insert & - # set the errors & origonal fields as Smarty objects, - # and change the page to be loaded. - #################################################################### - - if(!$this->validated) - { - global $smarty; - - # set the errors as a Smarty Object - $smarty->assign('form_validation', $all_error); - - # set the page to be loaded - if(!defined("FORCE_PAGE")) - { - define('FORCE_PAGE', $VAR['_page_current']); - } - - global $C_vars; - $C_vars->strip_slashes_all(); - - return; - } - - ################################################################### - ### Assemble the SQL & Insert the ticket - - $db = &DB(); - $id = $db->GenID(AGILE_DB_PREFIX . 'ticket_id'); - $sql = 'INSERT INTO ' . AGILE_DB_PREFIX . 'ticket SET - site_id = ' . $db->qstr(DEFAULT_SITE) . ', - id = ' . $db->qstr($id) . ', - date_orig = ' . $db->qstr(time()) . ', - date_last = ' . $db->qstr(time()) . ', - date_expire = ' . $db->qstr(time()+86400*7) . ', - account_id = ' . $db->qstr(SESS_ACCOUNT) . ', - department_id=' . $db->qstr($VAR['ticket_department_id']) . ', - status = ' . $db->qstr(0) . ', - last_reply = 0, - priority = ' . $db->qstr($VAR['ticket_priority']) . ', - subject = ' . $db->qstr($VAR['ticket_subject']) . ', - email = ' . $db->qstr($VAR['ticket_email']) . ', - body = ' . $db->qstr(htmlspecialchars($VAR['ticket_body'])) ; - $result = $db->Execute($sql); - - # error reporting: - if ($result === false) - { - global $C_debug; - $C_debug->error('ticket.inc.php','user_add', $db->ErrorMsg()); - return false; - } - - - ################################################################### - ### Insert the static vars... - - $static_var->add($VAR, $this->module, $id); - - - ################################################################### - ### Mail the user the new_ticket email template - - require_once(PATH_MODULES . 'email_template/email_template.inc.php'); - - $VAR['email'] = trim($this->email); - $VAR['key'] = $this->key($this->email); - - $my = new email_template; - $my->send('ticket_user_add', $this->email, $id, '', ''); - - unset($VAR['key']); - unset($VAR['email']); - - ################################################################### - ### Get any staff members who should be mailed - - $db = &DB(); - $sql = 'SELECT id,account_id,department_avail FROM ' . AGILE_DB_PREFIX . 'staff - WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - notify_new = ' . $db->qstr("1"); - $result = $db->Execute($sql); - - if($result->RecordCount() > 0) - { - while(!$result->EOF) - { - @$avail = unserialize($result->fields['department_avail']); - for($i=0; $isend('ticket_user_add_staff', $result->fields['account_id'], $id, $avail[$i], 'sql3'); - $i = count($avail); - } - } - $result->MoveNext(); - } - } - } - - global $C_debug, $C_translate; - $C_debug->alert($C_translate->translate('user_add_success','ticket','')); - } - - - - ############################## - ## DOES KEY MATCH? ## - ############################## - function is_key_match($VAR) - { - - global $smarty; - - if (SESS_LOGGED == true) - { - $smarty->assign('ticket_key', true); - return true; - } - - if (empty($VAR['key']) || empty($VAR['email'])) - { - $smarty->assign('ticket_key', false); - return false; - } - - if (strtolower($VAR['key']) == strtolower( $this->key( $VAR['email'] ) ) ) - { - $smarty->assign('ticket_key', true); - return true; - - ### define as cookies: - - - } else { - $smarty->assign('ticket_key', false); - return false; - } - } - - - ############################## - ## GENERATE KEY ## - ############################## - function key ($email) { - $key = strtoupper( md5(strtolower(trim($email)) . md5(LICENSE_KEY)) ); - return $key; - } - - - ############################## - ## IS USER AUTH FOR DEPTS? ## - ############################## - - function is_user_auth($VAR) - { - /* check if current session is authorized for any ticket departments.. - and return true/false... - */ - global $smarty; - $db = &DB(); - $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'ticket_department WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - status = ' . $db->qstr('1'); - $result = $db->Execute($sql); - if($result->RecordCount() == 0) - { - $smarty->assign('display', false); - return false; - } - - global $C_auth; - $ii = 0; - - while(!$result->EOF) - { - @$arr = unserialize($result->fields['group_id']); - - for($i=0; $iauth_group_by_id($arr[$i])) - { - ### Add to the array - $ii++; - $arr_smarty[] = Array( 'name' => $result->fields['name'], - 'description' => $result->fields['description'], - 'id' => $result->fields['id']); - $i=count($arr); - } - } - $result->MoveNext(); - } - - if($ii == "0") - { - $smarty->assign('display', false); - return false; - } - else - { - $smarty->assign('display', true); - $smarty->assign('results', $arr_smarty); - return true; - } - } - - # Open the constructor for this mod - function construct() - { - # name of this module: - $this->module = "ticket"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - if(defined('AJAX')) { - require_once(PATH_CORE.'xml.inc.php'); - require_once(PATH_CORE.'translate.inc.php'); - $C_translate= new CORE_translate; - global $C_translate; - } - - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } -} -?> diff --git a/modules/ticket/ticket_construct.xml b/modules/ticket/ticket_construct.xml deleted file mode 100644 index 3366589a..00000000 --- a/modules/ticket/ticket_construct.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - ticket - ticket
    - - 0 - status,date_last - 25 - - email - piping_unique_id - subject - site_id,last_reply - site_id,priority - site_id,staff_id - site_id,department_id - site_id,account_id - site_id,date_expire - subject,body - account_id - site_id,account_id - - - - I8 - 1 - 1 - - - I4 - 1 - - - I8 - date-time - - - I8 - date-now - - - I8 - - - I8 - account - email - - - I4 - ticket_department - name - any - - - I4 - staff - nickname - - - C(4) - any - - - C(4) - any - - - C(4) - - - C(255) - 1 - 255 - any - - - X2 - any - - - C(32) - - - C(128) - - - - - id,site_id,date_orig,date_last,date_expire,account_id,department_id,staff_id,status,priority,subject,body,email,last_reply - id,site_id,date_orig,date_last,date_expire,account_id,department_id,staff_id,status,priority,subject,body,email,last_reply - id,site_id,date_orig,date_last,date_expire,account_id,department_id,staff_id,status,priority,subject,body,email,last_reply - id,site_id,date_orig,date_last,date_expire,account_id,department_id,staff_id,status,priority,subject,body,email,last_reply - id,site_id,date_orig,date_last,date_expire,account_id,department_id,staff_id,status,priority,subject,body,email,last_reply - - - 0 -
    diff --git a/modules/ticket/ticket_install.xml b/modules/ticket/ticket_install.xml deleted file mode 100644 index 0accc065..00000000 --- a/modules/ticket/ticket_install.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - ticket - ticket - - 1 - staff - ticket_department,ticket_message,ticket_attachment - - - - - search - - - 1 - - - view - - - 1 - - - add - - 1 - - - delete - - - update - - - search_form - - - search_show - - - - reply - - - - merge - - - overview - 1 - - - - search_quick - - - search_status - - - - \ No newline at end of file diff --git a/modules/ticket_attachment/auth.inc.php b/modules/ticket_attachment/auth.inc.php deleted file mode 100644 index 9f13e458..00000000 --- a/modules/ticket_attachment/auth.inc.php +++ /dev/null @@ -1,6 +0,0 @@ - 'ticket_attachment', 'method'=> 'download') -); -?> \ No newline at end of file diff --git a/modules/ticket_attachment/ticket_attachment.inc.php b/modules/ticket_attachment/ticket_attachment.inc.php deleted file mode 100644 index 033d8a8e..00000000 --- a/modules/ticket_attachment/ticket_attachment.inc.php +++ /dev/null @@ -1,56 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -class ticket_attachment -{ - function download($VAR) { - if(empty($VAR['id'])) return false; - - $id=$VAR['id']; - - // get ticket id - $db=&DB(); - $rs=$db->Execute(sqlSelect($db, Array("ticket_attachment","ticket"), "A.ticket_id,B.department_id,B.account_id","A.id=::$id:: AND A.ticket_id=B.id")); - if(!$rs || $rs->RecordCount()==0) return false; - - // is this an admin? - global $C_auth; - if($C_auth->auth_method_by_name("ticket","view")) { - - // get the data & type - $rs=$db->Execute(sqlSelect($db, "ticket_attachment", "*", "id=::$id::")); - - // set the header - require_once(PATH_CORE.'file_extensions.inc.php'); - $ft = new file_extensions; - $type = $ft->set_headers_ext($rs->fields['type'], $rs->fields['name']); - - if (empty($type)) { - echo imap_qprint($rs->fields['content']); - } elseif(eregi("^text", $type)) { - echo imap_base64($rs->fields['content']); - } else { - echo imap_base64($rs->fields['content']); - } - exit; - } - } -} -?> \ No newline at end of file diff --git a/modules/ticket_attachment/ticket_attachment_construct.xml b/modules/ticket_attachment/ticket_attachment_construct.xml deleted file mode 100644 index c5dd02f0..00000000 --- a/modules/ticket_attachment/ticket_attachment_construct.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - ticket_attachment - ticket_attachment
    - - 0 - name - 25 - - site_id,ticket_id - site_id,ticket_message_id - content - - - - I4 - 1 - - - I4 - - - I4 - - - I8 - - - C(255) - - - C(16) - - - C(64) - - - X2 - - - - 0 -
    \ No newline at end of file diff --git a/modules/ticket_attachment/ticket_attachment_install.xml b/modules/ticket_attachment/ticket_attachment_install.xml deleted file mode 100644 index 5da3eeb3..00000000 --- a/modules/ticket_attachment/ticket_attachment_install.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - ticket_attachment - ticket - - - - - - - \ No newline at end of file diff --git a/modules/ticket_department/ticket_department.inc.php b/modules/ticket_department/ticket_department.inc.php deleted file mode 100644 index 20bfcb0b..00000000 --- a/modules/ticket_department/ticket_department.inc.php +++ /dev/null @@ -1,126 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -class ticket_department -{ - - # Open the constructor for this mod - function ticket_department() - { - # name of this module: - $this->module = "ticket_department"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } - -} -?> \ No newline at end of file diff --git a/modules/ticket_department/ticket_department_construct.xml b/modules/ticket_department/ticket_department_construct.xml deleted file mode 100644 index 9722721e..00000000 --- a/modules/ticket_department/ticket_department_construct.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - ticket_department - - ticket_department
    - - - - 0 - - name - - 25 - - - status - name - piping - - - - - I4 - 1 - 1 - - - I4 - 1 - - - X2 - any - array - - - I4 - setup_email - name - any - - - C(128) - 1 - 128 - any - - - X2 - - - I4 - - - L - - - I4 - setup_email - name - - - - - id,site_id,group_id,setup_email_id,name,description,status,piping,piping_setup_email_id - id,site_id,group_id,setup_email_id,name,description,status,piping,piping_setup_email_id - id,site_id,group_id,setup_email_id,name,description,status,piping,piping_setup_email_id - id,site_id,group_id,setup_email_id,name,description,status,piping,piping_setup_email_id - id,site_id,group_id,setup_email_id,name,description,status,piping,piping_setup_email_id - - - 0 -
    diff --git a/modules/ticket_department/ticket_department_install.xml b/modules/ticket_department/ticket_department_install.xml deleted file mode 100644 index 790c10b8..00000000 --- a/modules/ticket_department/ticket_department_install.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - ticket_department - ticket - - 1 - - - - - search - - - view - - - 1 - - - add - - 1 - - - delete - - - update - - - search_show - - - - - \ No newline at end of file diff --git a/modules/ticket_department/ticket_department_install_data.xml b/modules/ticket_department/ticket_department_install_data.xml deleted file mode 100644 index 5d6c9492..00000000 --- a/modules/ticket_department/ticket_department_install_data.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - 1 - 1 - - 1 - Standard Support - All Users Can create tickets in this department - 1 - 0 - 1 - - - 4 - 1 - - 1 - Registered Users - adsfsfda - 1 - 0 - 1 - - - 5 - - \ No newline at end of file diff --git a/modules/ticket_message/ticket_message.inc.php b/modules/ticket_message/ticket_message.inc.php deleted file mode 100644 index 0c51d9d1..00000000 --- a/modules/ticket_message/ticket_message.inc.php +++ /dev/null @@ -1,166 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -class ticket_message -{ - - # Open the constructor for this mod - function ticket_message() - { - # name of this module: - $this->module = "ticket_message"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - - ############################## - ## GRAPH STATISTICS ## - ############################## - function graph($start, $end, $constraint, $default) - { - global $C_translate; - - $db = &DB(); - $sql = 'SELECT date_orig FROM ' . AGILE_DB_PREFIX . 'ticket WHERE - site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND - date_orig >= ' . $db->qstr($start) . ' AND - date_orig <= ' . $db->qstr($end); - - $result = $db->Execute($sql); - if($result->RecordCount() == 0) - { - $arr['title'] = $C_translate->translate('search_no_results','',''); - $arr['results'] = $default; - return $arr; - } - $ii=0; - while(!$result->EOF) - { - $d = $result->fields['date_orig']; - for($i=0; $i= $constraint[$i]["start"] && $d < $constraint[$i]["end"]) - $default[$i]++; - $ii++; - } - $result->MoveNext(); - } - - $C_translate->value['ticket_message']['count'] = $result->RecordCount(); - $title = $C_translate->translate('statistics','ticket_message',''); - $arr['title'] = $title; - $arr['results'] = $default; - return $arr; - } - - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } - -} -?> \ No newline at end of file diff --git a/modules/ticket_message/ticket_message_construct.xml b/modules/ticket_message/ticket_message_construct.xml deleted file mode 100644 index cb982e80..00000000 --- a/modules/ticket_message/ticket_message_construct.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - ticket_message - ticket_message
    - - 0 - id - 25 - - site_id,ticket_id - site_id,staff_id - message - - - - I8 - 1 - 1 - - - I4 - 1 - - - I8 - - - I8 - - - I8 - date-time - - - X2 - - - - id,site_id,ticket_id,date_orig,message - id,site_id,ticket_id,date_orig,message - id,site_id,ticket_id,date_orig,message - id,site_id,ticket_id,date_orig,message - id,site_id,ticket_id,date_orig,message - - 0 -
    diff --git a/modules/ticket_message/ticket_message_install.xml b/modules/ticket_message/ticket_message_install.xml deleted file mode 100644 index 8f585763..00000000 --- a/modules/ticket_message/ticket_message_install.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - ticket_message - ticket - - - - - - search - - - view - - - add - - - delete - - - update - - - search_show - - - - - \ No newline at end of file diff --git a/modules/ticket_message/ticket_message_install_data.xml b/modules/ticket_message/ticket_message_install_data.xml deleted file mode 100644 index 48392c93..00000000 --- a/modules/ticket_message/ticket_message_install_data.xml +++ /dev/null @@ -1,153 +0,0 @@ - - - - 37 - 1 - 130 - 1111719473 - Mucho teto - -Do you like? - - - - - 38 - 1 - 130 - 1 - 1111719538 - This is my response - -I hope you are not as dumb as you look - -If you read, you can see! - - - 39 - 1 - 139 - 1 - 1111720020 - bling bling! - - - 40 - 1 - 139 - 1 - 1111720065 - blick gha - - - 41 - 1 - 135 - 1111720398 - Well, what now? - - - 42 - 1 - 135 - 1 - 1111720431 - Now is when yo uget off my site! - - - 44 - 1 - 139 - 1111723391 - Monkey doo - - - 56 - 1 - 128 - 1 - 1111736587 - adsfasd -asdf -afsd -dfsa -fasdfasd - - - 57 - 1 - 128 - 1 - 1111736598 - This is a wonderfull subject... - - - 62 - 1 - 128 - 1 - 1111736688 - afds -afsd -afsd - - - - 63 - 1 - 128 - 1 - 1111736691 - 2 - - - - 78 - 1 - 139 - 1 - 1111719977 - Whoa... - - - 79 - 1 - 139 - 1 - 1111723270 - adsf -adfs -dfs -fdsa -dsf - -Regards, -Tony Landis -http://agileco.com - - - 80 - 1 - 139 - 1 - 1111719634 - af -afsd -sdf -afsd -afsd -f -ds - - - 81 - 1 - 139 - 1 - 1111742436 - Hoky poky - - - 86 - - \ No newline at end of file diff --git a/plugins/checkout/CLASS_MONERIS/mpgClasses.php b/plugins/checkout/CLASS_MONERIS/mpgClasses.php index 638157bc..b5687168 100644 --- a/plugins/checkout/CLASS_MONERIS/mpgClasses.php +++ b/plugins/checkout/CLASS_MONERIS/mpgClasses.php @@ -1,4 +1,3 @@ - + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Checkout:Paypal */ - -if(defined('PATH_MODULES')) include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php'); else include_once('../../modules/checkout/base_checkout_plugin.class.php'); -class plg_chout_PAYPAL extends base_checkout_plugin -{ - function plg_chout_PAYPAL($checkout_id=false) { +if (defined('PATH_MODULES')) + include_once(PATH_PLUGINS.'checkout/PAYPAL/PAYPAL.php'); +else + include_once('PAYPAL/PAYPAL.php'); - $this->name = 'PAYPAL'; - $this->type = 'redirect'; - $this->recurr_only = false; - $this->return_url = SSL_URL . 'plugins/checkout/'. $this->name .'.php'; - $this->success_url = URL . '?_page=invoice:thankyou&_next_page=invoice:user_view&id='; - $this->decline_url = URL . '?_page=invoice:user_view&id='; - $this->support_cur = Array ('AUD', 'USD', 'GBP', 'EUR', 'CAD', 'JPY'); - $this->getDetails($checkout_id); - } +/** + * The main AgileBill Paypal Payment Class + * + * @package AgileBill + * @subpackage Checkout:Paypal + */ +class plg_chout_PAYPAL extends plg_chout_base_PAYPAL { + public function __construct($checkout_id=false,$multi=false) { + $this->name = 'PAYPAL'; + parent::__construct($checkout_id,$multi); - # Validate the user submitted billing details at checkout: - function validate($VAR) { - return true; + $this->recurr_only = false; } # Perform the checkout transaction (new purchase): - function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) { + public function bill_checkout($amount,$invoice,$currency_iso,$acct_fields,$total_recurring=false,$recurr_bill_arr=array(),$invoices=array()) { + # Validate we have configured the account + if (! $this->cfg['email']) { + global $C_debug; + $C_debug->alert(_('Sorry, unable to use this payment method, it has not been configured properly.')); + + return false; + } # Validate the currency: - if(!$this->validate_currency($currency_iso)) return false; + if (! $this->validate_currency($currency_iso)) + return false; # Special JPY formatting: - if($currency_iso == 'JPY') $amount = round($amount); + if ($currency_iso == 'JPY') + $amount = round($amount); # Set the vars - $vals = Array ( - Array ('cmd', '_xclick'), - Array ('bn', 'Agileco.AgileBill'), - Array ('business', $this->cfg['email']), - Array ('item_name', SITE_NAME. ' - Invoice # '.$invoice), - Array ('amount', $amount), - Array ('return', $this->success_url.$invoice), - Array ('cancel_return', $this->decline_url.$invoice), - Array ('notify_url', $this->return_url), - Array ('currency_code', $currency_iso), - Array ('invoice', $invoice), - Array ('first_name', $acct_fields['first_name']), - Array ('last_name', $acct_fields['last_name']), - Array ('payer_business_name', $acct_fields['company']), - Array ('address_street', $acct_fields['address1']), - Array ('address_city', $acct_fields['city']), - Array ('address_state', $acct_fields['state']), - Array ('address_zip', $acct_fields['zip']), - Array ('address_country', $acct_fields['country_id']), - Array ('payer_email', $acct_fields['email']), - Array ('payer_id', $acct_fields['id']) + $vals = array( + array('cmd','_cart'), + array('upload','1'), + array('bn','osb_BuyNow_WPS_AU'), + array('no_shipping','1'), + array('no_note','1'), + array('rm','2'), + array('business',$this->cfg['email']), + array('tax_cart','0'), + array('return',$this->success_url.$invoice), + array('cancel_return',$this->decline_url.$invoice), + array('notify_url',$this->return_url), + array('currency_code',$currency_iso), + array('invoice',$invoice), + array('first_name',$acct_fields['first_name']), + array('last_name',$acct_fields['last_name']), + array('payer_business_name',$acct_fields['company']), + array('address_street',$acct_fields['address1']), + array('address_city',$acct_fields['city']), + array('address_state',$acct_fields['state']), + array('address_zip',$acct_fields['zip']), + array('address_country',$acct_fields['country_id']), + array('payer_email',$acct_fields['email']), + array('payer_id',$acct_fields['id']) ); - $this->post_vars("https://www.paypal.com/cgi-bin/webscr", $vals); - return true; - } + if (! $invoices) + $invoices[$invoice] = $amount; + $i = 1; + foreach ($invoices as $id => $total) { + array_push($vals,array('item_number_'.$i,'INVOICE')); + array_push($vals,array('item_name_'.$i,sprintf('%s - %s #%s',SITE_NAME,_('Invoice'),$id))); + array_push($vals,array('amount_'.$i,$total)); + $i++; + } - # Stores new billing details, & return account_billing_id (gateway only) - function store_billing($VAR) { - return 0; - } + # Calculate the payment fee to be added + switch ($this->cfg['feetype']) { + case '2': + array_push($vals,array('item_number_'.$i,'PAYFEE')); + array_push($vals,array('item_name_'.$i,_('Payment Processing Fee'))); + array_push($vals,array('amount_'.$i,round($this->cfg['fee'],2))); - # Perform a transaction for an (new invoice): - function bill_invoice($VAR) { - return true; - } + break; - # Issue a refund for a paid invoice (captured charges w/gateway) - function refund($VAR) { - return true; - } + case '1': + array_push($vals,array('item_number_'.$i,'PAYFEE')); + array_push($vals,array('item_name_'.$i,_('Payment Processing Fee'))); + array_push($vals,array('amount_'.$i,round($amount*$this->cfg['fee'],2))); + + break; + } + + $this->post_vars(sprintf('%s/cgi-bin/webscr',$this->getLocation()),$vals); - # Void a authorized charge (gateways only) - function void($VAR) { return true; } # Postback Validation - function postback() - { - # read the post from PayPal system and add 'cmd' - global $_POST; + public function postback() { + # Read the post from PayPal system and add 'cmd' + global $_POST,$C_debug; + $req = 'cmd=_notify-validate'; foreach ($_POST as $key => $value) { $value = urlencode(stripslashes($value)); - $req .= "&$key=$value"; + $req .= sprintf('&%s=%s',$key,$value); } - # post back to PayPal system to validate - $header .= "POST /cgi-bin/webscr HTTP/1.0\r\n"; + $C_debug->error(__FILE__,__METHOD__,sprintf("%s: %s - Invoice: %s\r\n%s",$this->name,$_POST['txn_type'],$_POST['invoice'],$req)); + + # Post back to PayPal system to validate + $header = "POST /cgi-bin/webscr HTTP/1.0\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; - $header .= "Content-Length: " . strlen($req) . "\r\n\r\n"; - $fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30); + $header .= sprintf("Content-Length: %s\r\n\r\n",strlen($req)); - # needed for validation - $this->status = $_POST['payment_status']; + $fp = fsockopen($this->getLocation(false,true),80,$errno,$errstr,30); - # needed for return - $ret['invoice_id'] = $_POST['invoice']; - $ret['transaction_id'] = $_POST['txn_id']; - $ret['amount'] = $_POST['mc_gross']; - $ret['currency'] = $_POST['mc_currency']; + # Needed for validation + $ret['invoice_id'] = $_POST['invoice']; + $ret['transaction_id'] = $_POST['txn_id']; + $ret['currency'] = $_POST['mc_currency']; - $do = true; + if (! empty($_POST['mc_gross'])) + $ret['amount'] = $_POST['mc_gross']; + else + $ret['amount'] = $_POST['payment_gross']; - # validate vars - if ($fp) { - fputs ($fp, $header . $req); - while (!feof($fp)) { - $res = fgets ($fp, 1024); - if (strcmp ($res, "VERIFIED") == 0) - { - # check the payment_status is Completed - if($this->status == 'Completed' || $this->status == 'Canceled_Reversal') - $ret['status'] = true; - else - $ret['status'] = false; + # Validate + if (! $fp) { + $C_debug->error(__FILE__,__METHOD__,sprintf('Unable to connect to %s',$this->getLocation(false,true))); - # get the processor details: - $db = &DB(); - $q = "SELECT id,active,plugin_data FROM ".AGILE_DB_PREFIX."checkout WHERE - site_id = ".$db->qstr(DEFAULT_SITE)." AND - checkout_plugin = ".$db->qstr($this->name); - $rs = $db->Execute($q); - while(!$rs->EOF) - { - $ret['checkout_id'] = $rs->fields["id"]; - $this->cfg = unserialize($rs->fields["plugin_data"]); - if($_POST['receiver_email'] == $this->cfg['email']) - { + } else { + fputs($fp,$header.$req); + + while (! feof($fp)) { + $res = trim(strtoupper(fgets($fp,1024))); + + # HTTP traffic + if (! $res + || preg_match('/^HTTP/',$res) + || preg_match('/^DATE/',$res) + || preg_match('/^SERVER/',$res) + || preg_match('/^SET-COOKIE/',$res) + || preg_match('/^CONNECTION/',$res) + || preg_match('/^CONTENT-TYPE/',$res)) + continue; + + switch ($res) { + case 'VERIFIED': + # Get the payment status + $ret['status'] = true; + switch($_POST['txn_type']) { + case 'cart': $ret['status'] = true; break; + default: $ret['status'] = false; break; + } + + if ($ret['status'] != false) { + switch($_POST['payment_status']) { + case 'Canceled_Reversal': $ret['status'] = true; break; + case 'Completed': $ret['status'] = true; break; + default: $ret['status'] = false; break; + } + } + + # Get the processor details + $this->getDetailsName($this->name); + $cfg = unserialize($this->flds['plugin_data']); + if ($_POST['receiver_email'] == $cfg['email']) { include_once(PATH_MODULES.'checkout/checkout.inc.php'); $checkout = new checkout; $checkout->postback($ret); - return; } - $rs->MoveNext(); - } + + fclose($fp); + + header('HTTP/1.1 200 OK'); + header('Status: 200 OK'); + return; + + break; + + default: + # Log for manual investigation + $C_debug->error(__FILE__,__METHOD__,sprintf('Postback for Invoice %s is %s (%s)',$ret['invoice_id'],$res,serialize($res))); + + fclose($fp); + + header('HTTP/1.0 404 Not Found'); + return false; } } - fclose ($fp); } + + header('HTTP/1.0 500 Temporary Failure'); } } # Postback Function -if(empty($VAR) && empty($VAR['do'])) { +if (empty($VAR) && empty($VAR['do'])) { include_once('../../config.inc.php'); - require_once(PATH_ADODB . 'adodb.inc.php'); - require_once(PATH_CORE . 'database.inc.php'); - require_once(PATH_CORE . 'setup.inc.php'); - $C_debug = new CORE_debugger; - $C_db = &DB(); - $C_setup = new CORE_setup; + require_once(PATH_ADODB.'adodb.inc.php'); + require_once(PATH_CORE.'database.inc.php'); + require_once(PATH_CORE.'setup.inc.php'); + $C_debug = new CORE_debugger; + $C_db = &DB(); + $C_setup = new CORE_setup; $plg = new plg_chout_PAYPAL; - $plg->postback(); -} -?> \ No newline at end of file + $plg->postback(); +} +?> diff --git a/plugins/checkout/PAYPAL/PAYPAL.php b/plugins/checkout/PAYPAL/PAYPAL.php new file mode 100644 index 00000000..e9f616f8 --- /dev/null +++ b/plugins/checkout/PAYPAL/PAYPAL.php @@ -0,0 +1,91 @@ +. + * + * Originally authored by Deon George + * + * @author Deon George + * @copyright 2009 Deon George + * @link http://osb.leenooks.net + * @license http://www.gnu.org/licenses/ + * @package AgileBill + * @subpackage Checkout:Paypal + */ + +# When we are called back after a payment, we come directly here, and thus our config.inc hasnt been parsed. +if (defined('PATH_MODULES')) + include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php'); +else + include_once('../../modules/checkout/base_checkout_plugin.class.php'); + +abstract class plg_chout_base_PAYPAL extends base_checkout_plugin { + public function __construct($checkout_id=false,$multi=false) { + $this->type = 'redirect'; + $this->return_url = sprintf('%splugins/checkout/%s.php',SSL_URL,$this->name); + + if ($multi) { + $this->success_url = URL.'?_page=invoice:thankyou&_next_page=invoice:user_view&id='; + $this->decline_url = URL.'?_page=invoice:checkout_multiple&id='; + } else { + $this->success_url = URL.'?_page=invoice:thankyou&_next_page=account:account&id='; + $this->decline_url = URL.'?_page=invoice:user_view&id='; + } + + $this->support_cur = array('AUD','USD','GBP','EUR','CAD','JPY'); + $this->getDetails($checkout_id); + } + + protected function getLocation($uri=true,$nojs=false) { + switch ($this->cfg['mode']) { + case 1: + return ($uri ? 'https://' : '').'www.paypal.com'; + break; + case 0: + if (! $nojs) + echo ''; + return ($uri ? 'https://' : '').'www.sandbox.paypal.com'; + break; + + default: + return false; + } + } + + # Validate the user submitted billing details at checkout: + function validate($VAR) { + return true; + } + + # Perform a transaction for an (new invoice): + function bill_invoice($VAR) { + return true; + } + + # Issue a refund for a paid invoice (captured charges w/gateway) + function refund($VAR) { + return true; + } + + # Void a authorized charge (gateways only) + function void($VAR) { + return true; + } + + # Stores new billing details, & return account_billing_id (gateway only) + public function store_billing($VAR) { + return null; + } +} diff --git a/plugins/checkout/PAYPAL_RECURRING.php b/plugins/checkout/PAYPAL_RECURRING.php index b2caeab9..9800b4a4 100644 --- a/plugins/checkout/PAYPAL_RECURRING.php +++ b/plugins/checkout/PAYPAL_RECURRING.php @@ -1,308 +1,293 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Checkout:Paypal */ - -if(defined('PATH_MODULES')) include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php'); else include_once('../../modules/checkout/base_checkout_plugin.class.php'); -class plg_chout_PAYPAL_RECURRING extends base_checkout_plugin -{ - # Get the config values for this checkout plugin: - function plg_chout_PAYPAL_RECURRING($checkout_id=false) { +if (defined('PATH_MODULES')) + include_once(PATH_PLUGINS.'checkout/PAYPAL/PAYPAL.php'); +else + include_once('PAYPAL/PAYPAL.php'); - $this->name = 'PAYPAL_RECURRING'; - $this->type = 'redirect'; // redirect, gateway, or other - $this->recurr_only = true; - $this->return_url = SSL_URL . 'plugins/checkout/'. $this->name .'.php'; - $this->success_url = URL . '?_page=invoice:thankyou&_next_page=invoice:user_view&id='; - $this->decline_url = URL . '?_page=invoice:user_view&id='; - $this->support_cur = Array ('AUD', 'USD', 'GBP', 'EUR', 'CAD', 'JPY'); - $this->getDetails($checkout_id); - } +/** + * The main AgileBill Paypal Payment Class + * + * @package AgileBill + * @subpackage Checkout:Paypal + */ +class plg_chout_PAYPAL_RECURRING extends plg_chout_base_PAYPAL { + public function __construct($checkout_id=false,$multi=false) { + $this->name = 'PAYPAL_RECURRING'; + parent::__construct($checkout_id,$multi); - # Validate the user submitted billing details at checkout: - function validate($VAR) { - return true; + $this->recurr_only = true; } # Perform the checkout transaction (new purchase): - function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) { + public function bill_checkout($amount,$invoice,$currency_iso,$acct_fields,$total_recurring=false,$recurr_bill_arr=array()) { + global $C_debug; + + # Validate we have configured the account + if (! $this->cfg['email']) { + $C_debug->alert(_('Sorry, unable to use this payment method, it has not been configured properly.')); + + return false; + } # Validate the currency: - if(!$this->validate_currency($currency_iso)) return false; + if (! $this->validate_currency($currency_iso)) + return false; # Special JPY formatting: - if($currency_iso == 'JPY') $amount = round($amount); + if ($currency_iso == 'JPY') + $amount = round($amount); # Get the regular period for this subscription: - $sched = $recurr_bill_arr[0]["recurr_schedule"]; - if($sched == 0) { - $p3 = '1'; - $t3 = 'W'; - } elseif ($sched == 1) { - $p3 = '1'; - $t3 = 'M'; - } elseif ($sched == 2) { - $p3 = '3'; - $t3 = 'M'; - } elseif ($sched == 3) { - $p3 = '6'; - $t3 = 'M'; - } elseif ($sched == 4) { - $p3 = '1'; - $t3 = 'Y'; - } elseif ($sched == 5) { - $p3 = '2'; - $t3 = 'Y'; + switch($recurr_bill_arr[0]['recurr_schedule']) { + case 0: $p3 = '1'; $t3 = 'W'; break; + case 1: $p3 = '1'; $t3 = 'M'; break; + case 2: $p3 = '3'; $t3 = 'M'; break; + case 3: $p3 = '6'; $t3 = 'M'; break; + case 4: $p3 = '1'; $t3 = 'Y'; break; + case 5: $p3 = '2'; $t3 = 'Y'; break; + default: + $C_debug->error(__FILE__,__METHOD__,sprintf('Unknown recurr_schedule %s',$recurr_bill_arr[0]['recurr_schedule'])); + return false; } - $url = "https://www.paypal.com/cgi-bin/webscr"; + + # Calculate the payment fee to be adde + $fee = $fee_recurring = 0; + switch ($this->cfg['feetype']) { + case '2': + $fee = $fee_recurring = $this->cfg['fee']; + printf('', + sprintf(_('Please note, a payment processing fee of %3.2f will automatically be added to this payment schedule.'),$this->cfg['fee'])); + break; + + case '1': + $fee = round($amount*$this->cfg['fee'],2); + $fee_recurring = round($total_recurring*$this->cfg['fee'],2); + printf('', + sprintf(_('Please note, a payment processing fee of %3.2f%% will automatically be added to this payment schedule.'),$this->cfg['fee']*100)); + break; + } + $amount += $fee; + $total_recurring += $fee_recurring; + + # Set the vars + $vals = array( + array('cmd','_xclick-subscriptions'), + array('txn_type','subscr_signup'), + array('bn','osb_BuyNow_WPS_AU'), + array('no_shipping','1'), + array('no_note','1'), + array('rm','2'), + array('business',$this->cfg['email']), + array('tax_cart','0'), + array('return',$this->success_url.$invoice), + array('cancel_return',$this->decline_url.$invoice), + array('notify_url',$this->return_url), + array('currency_code',$currency_iso), + array('invoice',$invoice), + array('first_name',$acct_fields['first_name']), + array('last_name',$acct_fields['last_name']), + array('payer_business_name',$acct_fields['company']), + array('address_street',$acct_fields['address1']), + array('address_city',$acct_fields['city']), + array('address_state',$acct_fields['state']), + array('address_zip',$acct_fields['zip']), + array('address_country',$acct_fields['country_id']), + array('payer_email',$acct_fields['email']), + array('payer_id',$acct_fields['id']), + array('a1',$amount), + array('a3',$total_recurring), + array('p3',$p3), + array('t3',$t3), + array('sra',1), + array('src',1), + array('item_name','Automatic Payment'), + array('usr_manage',0) + ); # Get the next bill date for this subscription: - if($recurr_bill_arr[0]["recurr_type"] == "1") - { + # @todo Dont we already know this next date? + if ($recurr_bill_arr[0]['recurr_type'] == '1') { # Pro-rate billing: - include_once ( PATH_MODULES . 'product/product.inc.php' ); + include_once(PATH_MODULES.'product/product.inc.php'); $product = new product; - $arr = $product->recurrDates($recurr_bill_arr[0]["recurr_schedule"], $recurr_bill_arr[0]["recurr_weekday"], $recurr_bill_arr[0]["recurr_week"]); - $remain_time = $arr['end'] - time(); - $period1 = round($remain_time/86400); - $subscr_date = date("Y-m-d", $arr["end"]); - $vals = Array ( - Array ('cmd', '_xclick-subscriptions'), - Array ('bn', 'Agileco.AgileBill'), - Array ('business', $this->cfg['email']), - Array ('item_name', "Invoice No:". $invoice), - Array ('return', $this->success_url.$invoice), - Array ('cancel_return', $this->decline_url.$invoice), - Array ('notify_url', $this->return_url), - Array ('currency_code', $currency_iso), - Array ('invoice', $invoice), - Array ('first_name', $acct_fields['first_name']), - Array ('last_name', $acct_fields['last_name']), - Array ('payer_business_name', $acct_fields['company']), - Array ('address_street', $acct_fields['address1']), - Array ('address_city', $acct_fields['city']), - Array ('address_state', $acct_fields['state']), - Array ('address_zip', $acct_fields['zip']), - Array ('address_country', $acct_fields['country_id']), - Array ('payer_email', $acct_fields['email']), - Array ('payer_id', $acct_fields['id']) , - Array ('txn_type', 'subscr_signup'), + $arr = $product->recurrDates($recurr_bill_arr[0]['recurr_schedule'],$recurr_bill_arr[0]['recurr_weekday'],$recurr_bill_arr[0]['recurr_week']); + $remain_time = $arr['end']-$arr['date']; + $period1 = round($remain_time/86400); - Array ('a1', $amount), - Array ('p1', $period1), - Array ('t1', 'D'), + switch($recurr_bill_arr[0]['recurr_schedule']) { + case 0: + array_push($vals,array('p1',round($period1/7))); + array_push($vals,array('t1','W')); + break; - Array ('a3', $total_recurring), - Array ('p3', $p3), - Array ('t3', $t3), + case 1: + case 2: + case 3: + array_push($vals,array('p1',round($period1/365*12))); + array_push($vals,array('t1','M')); + break; - Array ('src', "1"), - Array ('sra', "1") - ); + case 4: + case 5: + array_push($vals,array('p1',round($period1/365))); + array_push($vals,array('t1','Y')); + break; + default: + $C_debug->error(__FILE__,__METHOD__,sprintf('Unknown recurr_schedule %s',$recurr_bill_arr[0]['recurr_schedule'])); + return false; + } - } - else - { - - # Bill on anniversary: - $vals = Array ( - Array ('cmd', '_xclick-subscriptions'), - Array ('business', $this->cfg['email']), - Array ('item_name', "Invoice No:". $invoice), - Array ('return', $this->success_url.$invoice), - Array ('cancel_return', $this->decline_url.$invoice), - Array ('notify_url', $this->return_url), - Array ('currency_code', $currency_iso), - Array ('invoice', $invoice), - Array ('first_name', $acct_fields['first_name']), - Array ('last_name', $acct_fields['last_name']), - Array ('payer_business_name', $acct_fields['company']), - Array ('address_street', $acct_fields['address1']), - Array ('address_city', $acct_fields['city']), - Array ('address_state', $acct_fields['state']), - Array ('address_zip', $acct_fields['zip']), - Array ('address_country', $acct_fields['country_id']), - Array ('payer_email', $acct_fields['email']), - Array ('payer_id', $acct_fields['id']) , - Array ('txn_type', 'subscr_signup'), - - Array ('a1', $amount), - Array ('p1', $p3), - Array ('t1', $t3), - - Array ('a3', $total_recurring), - Array ('p3', $p3), - Array ('t3', $t3), - - Array ('src', "1"), - Array ('sra', "1") - ); + # Bill on anniversary: + } else { + array_push($vals,array('p1',$p3)); + array_push($vals,array('t1',$t3)); } - $this->post_vars($url, $vals); - return true; - } + $this->post_vars(sprintf('%s/cgi-bin/webscr',$this->getLocation()),$vals); - # Stores new billing details, & return account_billing_id (gateway only) - function store_billing($VAR) { - return 0; - } - - # Perform a transaction for an (new invoice): - function bill_invoice($VAR) { - return true; - } - - # Issue a refund for a paid invoice (captured charges w/gateway) - function refund($VAR) { - return true; - } - - # Void a authorized charge (gateways only) - function void($VAR) { return true; } # Postback Validation - function postback() - { - # read the post from PayPal system and add 'cmd' - global $_POST, $C_debug; + public function postback() { + # Read the post from PayPal system and add 'cmd' + global $_POST,$C_debug; - # Log paypal postback: - foreach ($_POST as $key => $value) @$debug .= "\r\n$key=$value"; - $C_debug->error('PAYPAL_RECUR:'. $_POST['txn_type'], 'Invoice: '. $_POST['invoice'], "$debug" ); - - # Assemble postback string $req = 'cmd=_notify-validate'; + foreach ($_POST as $key => $value) { $value = urlencode(stripslashes($value)); - $req .= "&$key=$value"; + $req .= sprintf('&%s=%s',$key,$value); } - # post back to PayPal system to validate + $C_debug->error(__FILE__,__METHOD__,sprintf("%s: %s - Invoice: %s\r\n%s",$this->name,$_POST['txn_type'],$_POST['invoice'],$req)); + + # Post back to PayPal system to validate $header = "POST /cgi-bin/webscr HTTP/1.0\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; - $header .= "Content-Length: " . strlen($req) . "\r\n\r\n"; - $domain = 'www.paypal.com'; - #$domain = 'www.sandbox.paypal.com'; - $fp = fsockopen ($domain, 80, $errno, $errstr, 30); + $header .= sprintf("Content-Length: %s\r\n\r\n",strlen($req)); + + $fp = fsockopen($this->getLocation(false,true),80,$errno,$errstr,30); + + # Needed for validation + $ret['invoice_id'] = $_POST['invoice']; + $ret['transaction_id'] = $_POST['txn_id']; + $ret['currency'] = $_POST['mc_currency']; + + if (! empty($_POST['mc_gross'])) + $ret['amount'] = $_POST['mc_gross']; + else + $ret['amount'] = $_POST['payment_gross']; - # needed for validation - $ret['invoice_id'] = $_POST['invoice']; - $ret['transaction_id'] = $_POST['txn_id']; - $ret['currency'] = $_POST['mc_currency']; $ret['subscription_id'] = $_POST['subscr_id']; - if (!empty($_POST['mc_gross'])) - $ret['amount'] = $_POST['mc_gross']; - else - $ret['amount'] = $_POST['payment_gross']; + # Validate + if (! $fp) { + $C_debug->error(__FILE__,__METHOD__,sprintf('Unable to connect to %s',$this->getLocation(false,true))); - # validate - $do = true; - $force = true; // force approved reply - if (!$fp) - { - # HTTP ERROR: - $C_debug->error('PAYPAL_RECURRING.php', 'postback()', "Unable to connect to domain $domain" ); - } - else - { - fputs ($fp, $header . $req); - while (!feof($fp)) - { - $res = fgets ($fp, 1024); - if (!$force && strcmp ($res, "INVALID") == 0) - { - # Log for manual investigation: - $C_debug->error('PAYPAL_RECURRING.php', 'postback()', "Postback for Invoice {$ret['invoice_id']} is INVALID, PayPal subscription id {$ret['subscription_id']}"); - header("HTTP/1.0 404 Not Found"); - return false; - } - else if ($force || strcmp ($res, "VERIFIED") == 0) - { - # get the payment status - $ret['status'] = true; - switch($_POST['txn_type']) { - case "subscr_cancel": $ret['status'] = false; break; - case "subscr_failed": $ret['status'] = false; break; - case "subscr_eot": $ret['status'] = false; break; - } + } else { + fputs($fp,$header.$req); - if($ret['status'] != false) { - switch($_POST['payment_status']) { - case "Canceled_Reversal": $ret['status'] = true; break; - case "Completed": $ret['status'] = true; break; - case "Denied": $ret['status'] = false; break; - case "Failed": $ret['status'] = false; break; - case "Pending": $ret['status'] = false; break; - case "Refunded": $ret['status'] = false; break; - case "Reversed": $ret['status'] = false; break; + while (! feof($fp)) { + $res = trim(strtoupper(fgets($fp,1024))); + + # HTTP traffic + if (! $res + || preg_match('/^HTTP/',$res) + || preg_match('/^DATE/',$res) + || preg_match('/^SERVER/',$res) + || preg_match('/^SET-COOKIE/',$res) + || preg_match('/^CONNECTION/',$res) + || preg_match('/^CONTENT-TYPE/',$res)) + continue; + + switch ($res) { + case 'VERIFIED': + # Get the payment status + $ret['status'] = true; + switch($_POST['txn_type']) { + case 'subscr_cancel': $ret['status'] = false; break; + case 'subscr_failed': $ret['status'] = false; break; + case 'subscr_eot': $ret['status'] = false; break; } - } - # get the processor details: - $db = &DB(); - $q = "SELECT id,active,plugin_data FROM ".AGILE_DB_PREFIX."checkout WHERE - site_id = ".$db->qstr(DEFAULT_SITE)." AND - checkout_plugin = ".$db->qstr($this->name); - $rs = $db->Execute($q); - while(!$rs->EOF) - { - $ret['checkout_id'] = $rs->fields["id"]; - $this->cfg = unserialize($rs->fields["plugin_data"]); - if($_POST['business'] == $this->cfg['email']) - { + if ($ret['status'] != false) { + switch($_POST['payment_status']) { + case 'Canceled_Reversal': $ret['status'] = true; break; + case 'Completed': $ret['status'] = true; break; + default: $ret['status'] = false; break; + } + } + + # Get the processor details + $this->getDetailsName($this->name); + $cfg = unserialize($this->flds['plugin_data']); + if ($_POST['receiver_email'] == $cfg['email']) { include_once(PATH_MODULES.'checkout/checkout.inc.php'); $checkout = new checkout; $checkout->postback($ret); - - header("HTTP/1.1 200 OK"); - header("Status: 200 OK"); - - fclose ($fp); - return; } - $rs->MoveNext(); - } + + fclose($fp); + + header('HTTP/1.1 200 OK'); + header('Status: 200 OK'); + return; + + break; + + default: + # Log for manual investigation + $C_debug->error(__FILE__,__METHOD__,sprintf('Postback for Invoice %s is %s, PayPal subscription id %s',$ret['invoice_id'],$res,$ret['subscription_id'])); + + fclose($fp); + + header('HTTP/1.0 404 Not Found'); + return false; } } - fclose ($fp); } - header("HTTP/1.0 404 Not Found"); + + header('HTTP/1.0 500 Temporary Failure'); } } # Postback Function -if(empty($VAR) && empty($VAR['do'])) { +if (empty($VAR) && empty($VAR['do'])) { include_once('../../config.inc.php'); - require_once(PATH_ADODB . 'adodb.inc.php'); - require_once(PATH_CORE . 'database.inc.php'); - require_once(PATH_CORE . 'setup.inc.php'); - $C_debug = new CORE_debugger; - $C_db = &DB(); - $C_setup = new CORE_setup; + require_once(PATH_ADODB.'adodb.inc.php'); + require_once(PATH_CORE.'database.inc.php'); + require_once(PATH_CORE.'setup.inc.php'); + $C_debug = new CORE_debugger; + $C_db = &DB(); + $C_setup = new CORE_setup; $plg = new plg_chout_PAYPAL_RECURRING; $plg->postback(); } -?> \ No newline at end of file +?> diff --git a/plugins/checkout/REMIT_BANK_WIRE.php b/plugins/checkout/REMIT_BANK_WIRE.php index 41d7dc42..bab4a293 100644 --- a/plugins/checkout/REMIT_BANK_WIRE.php +++ b/plugins/checkout/REMIT_BANK_WIRE.php @@ -37,9 +37,7 @@ class plg_chout_REMIT_BANK_WIRE extends base_checkout_plugin # Perform the checkout transaction (new purchase): function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) { - $this->redirect = ''; + $this->redirect = sprintf('',SSL_URL,$invoice,$this->checkout_id); return true; } @@ -63,4 +61,4 @@ class plg_chout_REMIT_BANK_WIRE extends base_checkout_plugin return true; } } -?> \ No newline at end of file +?> diff --git a/plugins/checkout/REMIT_CHECK.php b/plugins/checkout/REMIT_CHECK.php index 48b4114c..e2906b14 100644 --- a/plugins/checkout/REMIT_CHECK.php +++ b/plugins/checkout/REMIT_CHECK.php @@ -37,9 +37,7 @@ class plg_chout_REMIT_CHECK extends base_checkout_plugin # Perform the checkout transaction (new purchase): function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) { - $this->redirect = ''; + $this->redirect = sprintf('',SSL_URL,$invoice,$this->checkout_id); return true; } @@ -63,4 +61,4 @@ class plg_chout_REMIT_CHECK extends base_checkout_plugin return true; } } -?> \ No newline at end of file +?> diff --git a/plugins/db_mapping/Apache_mod_auth_mysql.php b/plugins/db_mapping/Apache_mod_auth_mysql.php deleted file mode 100644 index e43271d5..00000000 --- a/plugins/db_mapping/Apache_mod_auth_mysql.php +++ /dev/null @@ -1,380 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - - -################################################################################ -### Database Map for: Apache mod_auth_mysql -################################################################################ - -// Define the way to store passwords in the database -// If you choose plaintext, the "Sync" feature will not work -define('MOD_AUTH_MYSQL_PW', 'md5'); // md5 or plaintext - -class map_APACHE_MOD_AUTH_MYSQL -{ - - ############################################################################ - ### Define the settings for this database map - ############################################################################ - - function map_APACHE_MOD_AUTH_MYSQL () - { - $this->map = - Array ( - 'map' => 'Apache_mod_auth_mysql', - 'db_type' => 'mysql', - 'notes' => 'This is for the Apache mod_auth_mysql', - 'group_type' => 'status', // db, db-status, status, none - - ### Define the account mapping properties - 'account_map_field' => 'mysql_auth', - 'account_status_field' => 'groups', - 'account_default_status' => '', - - 'account_sync_field'=> - Array - ( - 'delete' => '1' - ), - - 'account_fields' => - Array - ( - 'id' => - Array - ( - 'map_field' => 'id' - ), - 'date_orig' => - Array - ( - 'map_field' => false - ), - - 'date_last' => - Array - ( - 'map_field' => false - ), - - 'date_expire' => - Array - ( - 'map_field' => false - ), - - 'language_id' => - Array - ( - 'map_field' => false - ), - - 'country_id' => - Array - ( - 'map_field' => false - ), - - 'username' => - Array - ( - 'map_field' => 'username' - ), - - 'password' => - Array - ( - 'map_field' => 'passwd' - ), - - 'misc' => - Array - ( - 'map_field' => false - ), - - 'first_name' => - Array - ( - 'map_field' => false - ), - - 'last_name' => - Array - ( - 'map_field' => false, - ), - - 'middle_name' => - Array - ( - 'map_field' => false - ), - - 'company' => - Array - ( - 'map_field' => false - ), - - 'status' => - Array - ( - 'map_field' => false - ), - - 'email' => - Array - ( - 'map_field' => false - ), - - 'email_type' => - Array - ( - 'map_field' => false - ) - ), - - ### Define any extra fields for account table in the target db: - 'extra_field' => false - - ); - - } - - - - ######################################################################## - ### Syncronize all accounts & groups - ######################################################################## - - function sync($id, $file) - { - $db_map = new db_mapping; - $this = $db_map->MAP_sync ($id, $file, $this); - } - - - - ######################################################################## - ### Create a new account in the target DB - ######################################################################## - - function account_add($account_id) - { - if(MOD_AUTH_MYSQL_PW == 'md5') - { - $db_map = new db_mapping; - $db_map->MAP_account_add ($account_id, $this); - } - elseif(MOD_AUTH_MYSQL_PW == 'plaintext') - { - $db_map_misc = new dbmapping_mod_auth_mysql; - $db_map_misc->MAP_account_add ($account_id, $this); - - ### Sync the groups for this account: - $remote_account_id = $this->account_group_sync( $account_id ); - } - - ### Sync the groups for this account: - $this->account_group_sync( $account_id ); - } - - - ######################################################################## - ### Edit an existing account in the target DB - ######################################################################## - - function account_edit($account_id, $old_username) - { - - if(MOD_AUTH_MYSQL_PW == 'md5') - { - $db_map = new db_mapping; - $db_map->MAP_account_edit ($account_id, $old_username, $this); - } - elseif(MOD_AUTH_MYSQL_PW == 'plaintext') - { - $db_map_misc = new dbmapping_mod_auth_mysql; - $db_map_misc->MAP_account_edit ($account_id, $old_username, $this); - - ### Update the groups in the remote db - $this->account_group_sync($account_id); - } - - ### Update the groups in the remote db - $this->account_group_sync($account_id); - } - - - - ######################################################################## - ### Delete an existing account from the target DB - ######################################################################## - - function account_delete($account_id, $username) - { - $db_map = new db_mapping; - $remote_account_id = $db_map->MAP_account_delete ($account_id, $username, $this); - } - - - - ######################################################################## - ### Export / Update all accounts / groups to the target DB - ######################################################################## - - function account_import($remote_account_id) - { - $msg = 'Import from not supported with this plugin...'; - global $C_debug; - $C_debug->alert($msg); - } - - - - - ######################################################################## - ### Create the cookie/session for login sync - ######################################################################## - - function login($account_id, $cookie) - { - return false; - } - - - ######################################################################## - ### Delete the cookie/session on account logout - ######################################################################## - - function logout($account_id, $cookie) - { - return false; - } - - - ######################################################################## - ### Syncronize the groups for a specific account in the remote DB - ######################################################################## - - function account_group_sync($account_id) - { - if ( $this->map['group_type'] == 'db') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_db ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'status') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_status ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'db-status') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_db_status ($account_id, $this); - } - else - { - return false; - } - } -} - - - - -class dbmapping_mod_auth_mysql extends db_mapping -{ - - ### ADD ACCOUNT - function MAP_account_add ($account_id, $MAP_this) - { - ### Get the account details from AB - $db = &DB(); - $sql= 'SELECT username FROM '.AGILE_DB_PREFIX.'account WHERE - id = '.$db->qstr($account_id).' AND - site_id = '.$db->qstr(DEFAULT_SITE); - $account = $db->Execute($sql); - if ($account === false) { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_login_get_account_username', $db->ErrorMsg()); - } - unset($db); - - $username = $account->fields['username']; - @$password = $MAP_this->plaintext_password; - - ### Insert the new account into VB3 - $dbm = new db_mapping; - $dbm = $dbm->DB_connect(false, $MAP_this->map['map']); - $sql = 'INSERT INTO mysql_auth SET - username = '.$dbm->qstr($username) . ', - passwd = '.$dbm->qstr($password) ; - $result = $dbm->Execute($sql); - if ($result === false) { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_login_get_remote_account_id', $dbm->ErrorMsg()); - return false; - } - } - - - - ### EDIT ACCOUNT - function MAP_account_edit($account_id, $old_username, $MAP_this) - { - ### Get the account details from AB - $db = &DB(); - $sql= 'SELECT username FROM '.AGILE_DB_PREFIX.'account WHERE - id = '.$db->qstr($account_id).' AND - site_id = '.$db->qstr(DEFAULT_SITE); - $account = $db->Execute($sql); - if ($account === false) { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_login_get_account_username', $db->ErrorMsg()); - } - unset($db); - $username = $account->fields['username']; - @$password = $MAP_this->plaintext_password; - - ### Update the account in VB3 - $dbm = new db_mapping; - $dbm = $dbm->DB_connect(false, $MAP_this->map['map']); - $sql = 'UPDATE mysql_auth SET '; - - if(@$MAP_this->plaintext_password != false) - $sql .= ' password = '.$dbm->qstr($password) . ', '; - - $sql .= ' username = '.$dbm->qstr($username) . ' - WHERE - username = '.$dbm->qstr($old_username) ; - - $result = $dbm->Execute($sql); - if ($result === false) { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_login_get_remote_account_id', $dbm->ErrorMsg()); - return false; - } - } -} -?> \ No newline at end of file diff --git a/plugins/db_mapping/Apache_mod_auth_mysql_group.php b/plugins/db_mapping/Apache_mod_auth_mysql_group.php deleted file mode 100644 index 29c6db55..00000000 --- a/plugins/db_mapping/Apache_mod_auth_mysql_group.php +++ /dev/null @@ -1,380 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - - -################################################################################ -### Database Map for: Apache mod_auth_mysql_group -################################################################################ - -// Define the way to store passwords in the database -// If you choose plaintext, the "Sync" feature will not work -define('MOD_AUTH_MYSQL_PW', 'md5'); // md5 or plaintext - -class map_APACHE_MOD_AUTH_MYSQL_GROUP -{ - - ############################################################################ - ### Define the settings for this database map - ############################################################################ - - function map_APACHE_MOD_AUTH_MYSQL_GROUP () - { - $this->map = - Array ( - 'map' => 'Apache_mod_auth_mysql_group', - 'db_type' => 'mysql', - 'notes' => 'This is for the Apache mod_auth_mysql with multi-group support', - 'group_type' => 'db', // db, db-status, status, none - - ### Define the account mapping properties - 'account_map_field' => 'mysql_auth', - 'account_status_field' => 'groups', - 'account_default_status' => '', - - 'account_sync_field'=> - Array - ( - 'delete' => '1' - ), - - 'account_fields' => - Array - ( - 'id' => - Array - ( - 'map_field' => 'id' - ), - 'date_orig' => - Array - ( - 'map_field' => false - ), - - 'date_last' => - Array - ( - 'map_field' => false - ), - - 'date_expire' => - Array - ( - 'map_field' => false - ), - - 'language_id' => - Array - ( - 'map_field' => false - ), - - 'country_id' => - Array - ( - 'map_field' => false - ), - - 'username' => - Array - ( - 'map_field' => 'username' - ), - - 'password' => - Array - ( - 'map_field' => 'passwd' - ), - - 'misc' => - Array - ( - 'map_field' => false - ), - - 'first_name' => - Array - ( - 'map_field' => false - ), - - 'last_name' => - Array - ( - 'map_field' => false, - ), - - 'middle_name' => - Array - ( - 'map_field' => false - ), - - 'company' => - Array - ( - 'map_field' => false - ), - - 'status' => - Array - ( - 'map_field' => false - ), - - 'email' => - Array - ( - 'map_field' => false - ), - - 'email_type' => - Array - ( - 'map_field' => false - ) - ), - - ### Define any extra fields for account table in the target db: - 'extra_field' => false - - ); - - } - - - - ######################################################################## - ### Syncronize all accounts & groups - ######################################################################## - - function sync($id, $file) - { - $db_map = new db_mapping; - $db_map->MAP_sync ($id, $file, $this); - } - - - - ######################################################################## - ### Create a new account in the target DB - ######################################################################## - - function account_add($account_id) - { - if(MOD_AUTH_MYSQL_PW == 'md5') - { - $db_map = new db_mapping; - $db_map->MAP_account_add ($account_id, $this); - } - elseif(MOD_AUTH_MYSQL_PW == 'plaintext') - { - $db_map_misc = new dbmapping_mod_auth_mysql; - $db_map_misc->MAP_account_add ($account_id, $this); - - ### Sync the groups for this account: - $remote_account_id = $this->account_group_sync( $account_id ); - } - - ### Sync the groups for this account: - $this->account_group_sync( $account_id ); - } - - - ######################################################################## - ### Edit an existing account in the target DB - ######################################################################## - - function account_edit($account_id, $old_username) - { - - if(MOD_AUTH_MYSQL_PW == 'md5') - { - $db_map = new db_mapping; - $db_map->MAP_account_edit ($account_id, $old_username, $this); - } - elseif(MOD_AUTH_MYSQL_PW == 'plaintext') - { - $db_map_misc = new dbmapping_mod_auth_mysql; - $db_map_misc->MAP_account_edit ($account_id, $old_username, $this); - - ### Update the groups in the remote db - $this->account_group_sync($account_id); - } - - ### Update the groups in the remote db - $this->account_group_sync($account_id); - } - - - - ######################################################################## - ### Delete an existing account from the target DB - ######################################################################## - - function account_delete($account_id, $username) - { - $db_map = new db_mapping; - $remote_account_id = $db_map->MAP_account_delete ($account_id, $username, $this); - } - - - - ######################################################################## - ### Export / Update all accounts / groups to the target DB - ######################################################################## - - function account_import($remote_account_id) - { - $msg = 'Import from not supported with this plugin...'; - global $C_debug; - $C_debug->alert($msg); - } - - - - - ######################################################################## - ### Create the cookie/session for login sync - ######################################################################## - - function login($account_id, $cookie) - { - return false; - } - - - ######################################################################## - ### Delete the cookie/session on account logout - ######################################################################## - - function logout($account_id, $cookie) - { - return false; - } - - - ######################################################################## - ### Syncronize the groups for a specific account in the remote DB - ######################################################################## - - function account_group_sync($account_id) - { - if ( $this->map['group_type'] == 'db') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_db ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'status') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_status ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'db-status') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_db_status ($account_id, $this); - } - else - { - return false; - } - } -} - - - - -class dbmapping_mod_auth_mysql extends db_mapping -{ - - ### ADD ACCOUNT - function MAP_account_add ($account_id, $MAP_this) - { - ### Get the account details from AB - $db = &DB(); - $sql= 'SELECT username FROM '.AGILE_DB_PREFIX.'account WHERE - id = '.$db->qstr($account_id).' AND - site_id = '.$db->qstr(DEFAULT_SITE); - $account = $db->Execute($sql); - if ($account === false) { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_login_get_account_username', $db->ErrorMsg()); - } - unset($db); - - $username = $account->fields['username']; - @$password = $MAP_this->plaintext_password; - - ### Insert the new account into VB3 - $dbm = new db_mapping; - $dbm = $dbm->DB_connect(false, $MAP_this->map['map']); - $sql = 'INSERT INTO mysql_auth SET - username = '.$dbm->qstr($username) . ', - passwd = '.$dbm->qstr($password) ; - $result = $dbm->Execute($sql); - if ($result === false) { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_login_get_remote_account_id', $dbm->ErrorMsg()); - return false; - } - } - - - - ### EDIT ACCOUNT - function MAP_account_edit($account_id, $old_username, $MAP_this) - { - ### Get the account details from AB - $db = &DB(); - $sql= 'SELECT username FROM '.AGILE_DB_PREFIX.'account WHERE - id = '.$db->qstr($account_id).' AND - site_id = '.$db->qstr(DEFAULT_SITE); - $account = $db->Execute($sql); - if ($account === false) { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_login_get_account_username', $db->ErrorMsg()); - } - unset($db); - $username = $account->fields['username']; - @$password = $MAP_this->plaintext_password; - - ### Update the account in VB3 - $dbm = new db_mapping; - $dbm = $dbm->DB_connect(false, $MAP_this->map['map']); - $sql = 'UPDATE mysql_auth SET '; - - if(@$MAP_this->plaintext_password != false) - $sql .= ' password = '.$dbm->qstr($password) . ', '; - - $sql .= ' username = '.$dbm->qstr($username) . ' - WHERE - username = '.$dbm->qstr($old_username) ; - - $result = $dbm->Execute($sql); - if ($result === false) { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_login_get_remote_account_id', $dbm->ErrorMsg()); - return false; - } - } -} -?> \ No newline at end of file diff --git a/plugins/db_mapping/Drupal_431.php b/plugins/db_mapping/Drupal_431.php deleted file mode 100644 index d844b59d..00000000 --- a/plugins/db_mapping/Drupal_431.php +++ /dev/null @@ -1,299 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -################################################################################ -### Database Map for: Drupal 4.3.1 -### Last Update: 12-10-2003 -################################################################################ -class map_DRUPAL_431 -{ - - ############################################################################ - ### Define the settings for this database map - ############################################################################ - - function map_DRUPAL_431 () - { - $this->map = - Array ( - 'map' => 'Drupal_431', - 'db_type' => 'mysql', - 'notes' => 'This is for Drupal 4.3.1', - 'group_type' => 'db-status', // db, status, none - - ### Define the group fields in the target db - 'group_map' => - Array - ( - 'table' => 'role', - 'id' => 'rid', - 'name' => 'name' - ), - - - ### Define the account mapping properties - 'account_map_field' => 'users', - 'account_status_field' => 'rid', - 'account_default_status' => '1', - - 'account_sync_field'=> - Array - ( - 'delete' => '1' - ), - - 'account_fields' => - Array - ( - 'id' => - Array - ( - 'map_field' => 'uid', - 'unique' => true - ), - 'date_orig' => - Array - ( - 'map_field' => 'timestamp' - ), - - 'date_last' => - Array - ( - 'map_field' => false - ), - - 'date_expire' => - Array - ( - 'map_field' => false - ), - - 'language_id' => - Array - ( - 'map_field' => false - ), - - 'country_id' => - Array - ( - 'map_field' => false - ), - - 'username' => - Array - ( - 'map_field' => 'name' - ), - - 'password' => - Array - ( - 'map_field' => 'pass' - ), - - 'misc' => - Array - ( - 'map_field' => false - ), - - 'first_name' => - Array - ( - 'map_field' => false - ), - - 'last_name' => - Array - ( - 'map_field' => false - ), - - 'middle_name' => - Array - ( - 'map_field' => false - ), - - 'company' => - Array - ( - 'map_field' => false - ), - - 'status' => - Array - ( - 'map_field' => false - ), - - 'email' => - Array - ( - 'map_field' => 'mail' - ), - - 'email_type' => - Array - ( - 'map_field' => false - ) - ), - - ### Define any extra fields for account table in the target db: - 'extra_field' => - Array ( - Array - ( - 'name' => 'status', - 'value' => '1', - 'add' => 1, - 'edit' => 0 - ) - ) - ); - - } - - - - - - ######################################################################## - ### Syncronize all accounts & groups - ######################################################################## - - function sync($id, $file) - { - $db_map = new db_mapping; - $this = $db_map->MAP_sync ($id, $file, $this); - } - - - - ######################################################################## - ### Create a new account in the target DB - ######################################################################## - - function account_add($account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_add ($account_id, $this); - - ### Sync the groups for this account: - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync( $account_id ); - } - - - - ######################################################################## - ### Edit an existing account in the target DB - ######################################################################## - - function account_edit($account_id, $old_username) - { - $db_map = new db_mapping; - $db_map->MAP_account_edit ($account_id, $old_username, $this); - - ### Update the groups in the remote db - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync($account_id); - } - - - - ######################################################################## - ### Delete an existing account from the target DB - ######################################################################## - - function account_delete($account_id, $username) - { - $db_map = new db_mapping; - $db_map->MAP_account_delete ($account_id, $username, $this); - } - - - - ######################################################################## - ### Export / Update all accounts / groups to the target DB - ######################################################################## - - function account_import($remote_account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_import ($remote_account_id, $this); - } - - - - - ######################################################################## - ### Create the cookie/session for login sync - ######################################################################## - - function login($account_id) - { - return; - } - - - ######################################################################## - ### Delete the cookie/session on account logout - ######################################################################## - - function logout($account_id) - { - return; - } - - - ######################################################################## - ### Syncronize the groups for a specific account in the remote DB - ######################################################################## - - function account_group_sync($account_id) - { - if ( $this->map['group_type'] == 'db') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_db ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'status') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_status ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'db-status') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_db_status ($account_id, $this); - } - else - { - return false; - } - } -} -?> \ No newline at end of file diff --git a/plugins/db_mapping/Expression_Engine_1_1.php b/plugins/db_mapping/Expression_Engine_1_1.php deleted file mode 100644 index 92fff33b..00000000 --- a/plugins/db_mapping/Expression_Engine_1_1.php +++ /dev/null @@ -1,341 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -################################################################################ -### Database Map for: pMachine Pro 2.1 -### Last Update: 12-17-2003 -################################################################################ -class map_EXPRESSION_ENGINE_1_1 -{ - - ############################################################################ - ### Define the settings for this database map - ############################################################################ - - function map_Expression_Engine_1_1 () - { - $this->map = - Array ( - 'map' => 'Expression_Engine_1_1', - 'db_type' => 'mysql', - 'notes' => 'Expression Engine v1.1', - 'group_type' => 'db-status', // db, db-status, status, none - - ### Define the group fields in the target db - 'group_map' => - Array - ( - 'table' => 'member_groups', - 'id' => 'group_id', - 'name' => 'group_title' - ), - - - ### Define the account mapping properties - 'account_map_field' => 'members', - 'account_status_field' => 'group_id', - 'account_default_status' => '5', - - 'account_sync_field'=> - Array - ( - 'delete' => '1' - ), - - 'account_fields' => - Array - ( - 'id' => - Array - ( - 'map_field' => 'member_id' - ), - 'date_orig' => - Array - ( - 'map_field' => 'join_date' - ), - - 'date_last' => - Array - ( - 'map_field' => 'last_visit' - ), - - 'date_expire' => - Array - ( - 'map_field' => false - ), - - 'language_id' => - Array - ( - 'map_field' => 'language' - ), - - 'country_id' => - Array - ( - 'map_field' => false - ), - - 'username' => - Array - ( - 'map_field' => 'username' - ), - - 'password' => - Array - ( - 'map_field' => 'password' - ), - - 'misc' => - Array - ( - 'map_field' => false - ), - - 'first_name' => - Array - ( - 'map_field' => 'screen_name', - ), - - 'last_name' => - Array - ( - 'map_field' => false, - ), - - 'middle_name' => - Array - ( - 'map_field' => false - ), - - 'company' => - Array - ( - 'map_field' => false - ), - - 'status' => - Array - ( - 'map_field' => false - ), - - 'email' => - Array - ( - 'map_field' => 'email' - ), - - 'email_type' => - Array - ( - 'map_field' => false - ) - ), - - ### Define any extra fields for account table in the target db: - 'extra_field' => - Array - ( - Array - ( - 'name' => 'timezone', - 'value' => 'UTC', - 'add' => 1, - 'edit' => 0 - ), - Array - ( - 'name' => 'daylight_savings', - 'value' => 'n', - 'add' => 1, - 'edit' => 0 - ), - Array - ( - 'name' => 'localization_is_site_default', - 'value' => 'n', - 'add' => 1, - 'edit' => 0 - ), - Array - ( - 'name' => 'time_format', - 'value' => 'us', - 'add' => 1, - 'edit' => 0 - ), - Array - ( - 'name' => 'template_size', - 'value' => '28', - 'add' => 1, - 'edit' => 0 - ), - Array - ( - 'name' => 'notepad_size', - 'value' => '18', - 'add' => 1, - 'edit' => 0 - ), - Array - ( - 'name' => 'unique_id', - 'value' => 'random|32', - 'add' => 1, - 'edit' => 0 - ) - ) - ); - - } - - - - ######################################################################## - ### Syncronize all accounts & groups - ######################################################################## - - function sync($id, $file) - { - $db_map = new db_mapping; - $this = $db_map->MAP_sync ($id, $file, $this); - } - - - - ######################################################################## - ### Create a new account in the target DB - ######################################################################## - - function account_add($account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_add ($account_id, $this); - - ### Sync the groups for this account: - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync( $account_id ); - } - - - - ######################################################################## - ### Edit an existing account in the target DB - ######################################################################## - - function account_edit($account_id, $old_username) - { - $db_map = new db_mapping; - $db_map->MAP_account_edit ($account_id, $old_username, $this); - - return true; - - ### Update the groups in the remote db - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync($account_id); - } - - - - ######################################################################## - ### Delete an existing account from the target DB - ######################################################################## - - function account_delete($account_id, $username) - { - $db_map = new db_mapping; - $db_map->MAP_account_delete ($account_id, $username, $this); - } - - - - ######################################################################## - ### Export / Update all accounts / groups to the target DB - ######################################################################## - - function account_import($remote_account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_import ($remote_account_id, $this); - } - - - - - ######################################################################## - ### Create the cookie/session for login sync - ######################################################################## - - function login($account_id) - { - return; - } - - - ######################################################################## - ### Delete the cookie/session on account logout - ######################################################################## - - function logout($account_id) - { - return; - } - - - ######################################################################## - ### Syncronize the groups for a specific account in the remote DB - ######################################################################## - - function account_group_sync($account_id) - { - if ( $this->map['group_type'] == 'db') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_db ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'status') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_status ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'db-status') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_db_status ($account_id, $this); - } - else - { - return false; - } - } -} -?> \ No newline at end of file diff --git a/plugins/db_mapping/FlySpray_95.php b/plugins/db_mapping/FlySpray_95.php deleted file mode 100644 index 7a09f2c2..00000000 --- a/plugins/db_mapping/FlySpray_95.php +++ /dev/null @@ -1,349 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -################################################################################ -### Database Map for: Flyspray 0.9.5 -### Last Update: 9-20-04 -### -### You must modify the structure of the flyspray_users.user_pass field to -### varchar(32) prior to installing this plugin. -### Also, you must force all registrations, logins, and account modifications -### to occur in AgileBill. -################################################################################ -class map_FLYSPRAY_95 -{ - - ############################################################################ - ### Define the settings for this database map - ############################################################################ - - function map_FlySpray_95 () - { - $this->map = - Array ( - 'map' => 'FlySpray_95', - 'db_type' => 'mysql', - 'notes' => 'FlySpray_95', - 'group_type' => 'db-status', // db, db-status, status, none - - ### Define the group fields in the target db - 'group_map' => - Array - ( - 'table' => 'flyspray_groups', - 'id' => 'group_id', - 'name' => 'group_name' - ), - - - ### Define the account mapping properties - 'account_map_field' => 'flyspray_users', - 'account_status_field' => 'group_in', - 'account_default_status' => '0', - - 'account_sync_field'=> - Array - ( - 'delete' => '1' - ), - - 'account_fields' => - Array - ( - 'id' => - Array - ( - 'map_field' => 'user_id' - ), - 'date_orig' => - Array - ( - 'map_field' => false - ), - - 'date_last' => - Array - ( - 'map_field' => false - ), - - 'date_expire' => - Array - ( - 'map_field' => false - ), - - 'language_id' => - Array - ( - 'map_field' => false - ), - - 'country_id' => - Array - ( - 'map_field' => false - ), - - 'username' => - Array - ( - 'map_field' => 'user_name' - ), - - 'password' => - Array - ( - 'map_field' => 'user_pass' - ), - - 'misc' => - Array - ( - 'map_field' => false - ), - - 'first_name' => - Array - ( - 'map_field' => 'real_name', - ), - - 'last_name' => - Array - ( - 'map_field' => false, - ), - - 'middle_name' => - Array - ( - 'map_field' => false - ), - - 'company' => - Array - ( - 'map_field' => false - ), - - 'status' => - Array - ( - 'map_field' => false - ), - - 'email' => - Array - ( - 'map_field' => 'email_address' - ), - - 'email_type' => - Array - ( - 'map_field' => false - ) - ), - - ### Define any extra fields for account table in the target db: - 'extra_field' => - Array - ( - Array - ( - 'name' => 'account_enabled', - 'value' => '1', - 'add' => 1, - 'edit' => 0 - ), - Array - ( - 'name' => 'notify_type', - 'value' => '1', - 'add' => 1, - 'edit' => 0 - ) - ) - ); - - } - - - - ######################################################################## - ### Syncronize all accounts & groups - ######################################################################## - - function sync($id, $file) - { - $db_map = new db_mapping; - $this = $db_map->MAP_sync ($id, $file, $this); - } - - - - ######################################################################## - ### Create a new account in the target DB - ######################################################################## - - function account_add($account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_add ($account_id, $this); - - ### Sync the groups for this account: - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync( $account_id ); - } - - - - ######################################################################## - ### Edit an existing account in the target DB - ######################################################################## - - function account_edit($account_id, $old_username) - { - $db_map = new db_mapping; - $db_map->MAP_account_edit ($account_id, $old_username, $this); - - return true; - - ### Update the groups in the remote db - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync($account_id); - } - - - - ######################################################################## - ### Delete an existing account from the target DB - ######################################################################## - - function account_delete($account_id, $username) - { - $db_map = new db_mapping; - $db_map->MAP_account_delete ($account_id, $username, $this); - } - - - - ######################################################################## - ### Export / Update all accounts / groups to the target DB - ######################################################################## - - function account_import($remote_account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_import ($remote_account_id, $this); - } - - - - - ######################################################################## - ### Create the cookie/session for login sync - ######################################################################## - - function login($account_id) - { - # Get the remote account details: - $db = &DB(); - $sql= 'SELECT username FROM '.AGILE_DB_PREFIX.'account WHERE - id = '.$db->qstr($account_id).' AND - site_id = '.$db->qstr(DEFAULT_SITE); - $result = $db->Execute($sql); - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','login', $db->ErrorMsg()); - return; - } - - $username = $result->fields['username']; - - ### Get the remote account id from the username - $dbm = new db_mapping; - $db2 = $dbm->DB_connect(false, $this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($this->map['map']) .';' ); - $sql = 'SELECT user_id,user_pass FROM flyspray_users - WHERE user_name = '.$db2->qstr($username); - $result = $db2->Execute($sql); - if ($result === false) - { - global $C_debug; - echo $db2->ErrorMsg(); - $C_debug->error('db_mapping.inc.php','login', $db2->ErrorMsg()); - return; - } - - $remote_account_id = $result->fields['user_id']; - $remote_user_pass = $result->fields['user_pass']; - - #session_start(); - setcookie('flyspray_userid', $remote_account_id, time()+60*60*24*30, "/"); - setcookie('flyspray_passhash', crypt("{$remote_user_pass}", "4t6dcHiefIkeYcn48B"), time()+60*60*24*30, "/"); - return true; - } - - - ######################################################################## - ### Delete the cookie/session on account logout - ######################################################################## - - function logout($account_id) - { - setcookie('flyspray_userid', '', time()-60, '/'); - setcookie('flyspray_passhash', '', time()-60, '/'); - return true; - } - - - ######################################################################## - ### Syncronize the groups for a specific account in the remote DB - ######################################################################## - - function account_group_sync($account_id) - { - if ( $this->map['group_type'] == 'db') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_db ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'status') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_status ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'db-status') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_db_status ($account_id, $this); - } - else - { - return false; - } - } -} -?> \ No newline at end of file diff --git a/plugins/db_mapping/GeekLog_138.php b/plugins/db_mapping/GeekLog_138.php deleted file mode 100644 index 65a62679..00000000 --- a/plugins/db_mapping/GeekLog_138.php +++ /dev/null @@ -1,277 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -################################################################################ -### Database Map for: GeekLog 1.3.8-1sr3 -### Last Update: 12-17-2003 -################################################################################ - -class map_GEEKLOG_138 -{ - - ############################################################################ - ### Define the settings for this database map - ############################################################################ - - function map_GEEKLOG_138 () - { - $this->map = - Array ( - 'map' => 'GeekLog_138', - 'db_type' => 'mysql', - 'notes' => 'This is for GeekLog 1.3.8-1sr3', - 'group_type' => 'db', // db, status, none - - ### Define the group fields in the target db - 'group_map' => - Array - ( - 'table' => 'gl_groups', - 'id' => 'grp_id', - 'name' => 'grp_name' - ), - - - ### Define the group-to-account relation fields in the target db - 'group_account_map' => - Array - ( - 'table' => 'access', - 'id' => 'acc_ft_id', - 'account_id'=> 'acc_ft_id', - 'group_id' => 'acc_grp_id' - ), - - ## Should records be deleted? - 'account_sync_field'=> - Array - ( - 'delete' => '1' - ), - - ### Define the account mapping properties - 'account_map_field' => 'users', - 'account_fields' => - Array - ( - 'id' => - Array - ( - 'map_field' => 'uid' - ), - 'date_orig' => - Array - ( - 'map_field' => false - ), - - 'date_last' => - Array - ( - 'map_field' => false - ), - - 'date_expire' => - Array - ( - 'map_field' => false - ), - - 'language_id' => - Array - ( - 'map_field' => false - ), - - 'country_id' => - Array - ( - 'map_field' => false - ), - - 'username' => - Array - ( - 'map_field' => 'username' - ), - - 'password' => - Array - ( - 'map_field' => 'passwd' - ), - - 'misc' => - Array - ( - 'map_field' => false - ), - - 'first_name' => - Array - ( - 'map_field' => 'fullname' - ), - - 'last_name' => - Array - ( - 'map_field' => false, - ), - - 'middle_name' => - Array - ( - 'map_field' => false - ), - - 'company' => - Array - ( - 'map_field' => false - ), - - 'status' => - Array - ( - 'map_field' => false - ), - - 'email' => - Array - ( - 'map_field' => 'email' - ), - - 'email_type' => - Array - ( - 'map_field' => false - ) - ), - - ### Define any extra fields for account table in the target db: - 'extra_field' => false - ); - - } - - ######################################################################## - ### Syncronize all accounts & groups - ######################################################################## - - function sync($id, $file) - { - $db_map = new db_mapping; - $this = $db_map->MAP_sync ($id, $file, $this); - } - - ######################################################################## - ### Create a new account in the target DB - ######################################################################## - - function account_add($account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_add ($account_id, $this); - - ### Sync the groups for this account: - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync( $account_id ); - } - - ######################################################################## - ### Edit an existing account in the target DB - ######################################################################## - - function account_edit($account_id, $old_username) - { - $db_map = new db_mapping; - $db_map->MAP_account_edit ($account_id, $old_username, $this); - - ### Update the groups in the remote db - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync($account_id); - } - - ######################################################################## - ### Delete an existing account from the target DB - ######################################################################## - - function account_delete($account_id, $username) - { - $db_map = new db_mapping; - $db_map->MAP_account_delete ($account_id, $username, $this); - } - - ######################################################################## - ### Export / Update all accounts / groups to the target DB - ######################################################################## - - function account_import($remote_account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_import ($remote_account_id, $this); - } - - ######################################################################## - ### Create the cookie/session for login sync - ######################################################################## - - function login($account_id) - { - return; - } - - ######################################################################## - ### Delete the cookie/session on account logout - ######################################################################## - - function logout($account_id) - { - return; - } - - ######################################################################## - ### Syncronize the groups for a specific account in the remote DB - ######################################################################## - - function account_group_sync($account_id) - { - if ( $this->map['group_type'] == 'db') - { - $db_map = new db_mapping; - $db_map->MAP_account_group_sync_db ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'status') - { - $db_map = new db_mapping; - $db_map->MAP_account_group_sync_status ($account_id, $this); - } - else - { - return false; - } - } - -} -?> \ No newline at end of file diff --git a/plugins/db_mapping/HiveMail_122.php b/plugins/db_mapping/HiveMail_122.php deleted file mode 100644 index 3b926240..00000000 --- a/plugins/db_mapping/HiveMail_122.php +++ /dev/null @@ -1,360 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -################################################################################ -### Database Map for: HiveMail 1.2.2 through 1.3 -### Last Update: 12-17-2003 -################################################################################ - -class map_HIVEMAIL_122 -{ - - ############################################################################ - ### Define the settings for this database map - ############################################################################ - - function map_HIVEMAIL_122 () - { - $this->map = - Array ( - 'map' => 'HiveMail_122', - 'db_type' => 'mysql', - 'notes' => 'This is for HiveMail 1.2.2 through 1.3', - 'group_type' => 'db-status', // db, db-status, status, none - - - ### Define the group fields in the target db - 'group_map' => - Array - ( - 'table' => 'hive_usergroup', - 'id' => 'usergroupid', - 'name' => 'title' - ), - - - ### Define the account mapping properties - 'account_map_field' => 'hive_user', - 'account_status_field' => 'usergroupid', - 'account_default_status' => '2', - - 'account_sync_field'=> - Array - ( - 'delete' => '1' - ), - - 'account_fields' => - Array - ( - 'id' => - Array - ( - 'map_field' => 'userid' - ), - 'date_orig' => - Array - ( - 'map_field' => 'regdate' - ), - - 'date_last' => - Array - ( - 'map_field' => 'lastactivity' - ), - - 'date_expire' => - Array - ( - 'map_field' => false - ), - - 'language_id' => - Array - ( - 'map_field' => false - ), - - 'country_id' => - Array - ( - 'map_field' => false - ), - - 'username' => - Array - ( - 'map_field' => 'username' - ), - - 'password' => - Array - ( - 'map_field' => 'password' - ), - - 'misc' => - Array - ( - 'map_field' => false - ), - - 'first_name' => - Array - ( - 'map_field' => 'realname', - ), - - 'last_name' => - Array - ( - 'map_field' => false, - ), - - 'middle_name' => - Array - ( - 'map_field' => false - ), - - 'company' => - Array - ( - 'map_field' => false - ), - - 'status' => - Array - ( - 'map_field' => false - ), - - 'email' => - Array - ( - 'map_field' => 'altemail' - ), - - 'email_type' => - Array - ( - 'map_field' => false - ) - ), - - ### Define any extra fields for account table in the target db: - 'extra_field' => - Array - ( - Array - ( - 'name' => 'cols', - 'value' => 'a:6:{i:0;s:8:"priority";i:1;s:6:"attach";i:2;s:4:"from";i:3;s:7:"subject";i:4;s:8:"datetime";i:5;s:4:"size";}', - 'add' => 1, - 'edit' => 0 - ), - - Array - ( - 'name' => 'font', - 'value' => 'Verdana|10|Regular|Black|None', - 'add' => 1, - 'edit' => 0 - ), - - Array - ( - 'name' => 'sendread', - 'value' => '1', - 'add' => 1, - 'edit' => 0 - ), - - Array - ( - 'name' => 'skinid', - 'value' => '1', - 'add' => 1, - 'edit' => 0 - ), - - Array - ( - 'name' => 'options', - 'value' => '879818066', - 'add' => 1, - 'edit' => 0 - ) - ) - ); - - } - - - - - - ######################################################################## - ### Syncronize all accounts & groups - ######################################################################## - - function sync($id, $file) - { - $db_map = new db_mapping; - $this = $db_map->MAP_sync ($id, $file, $this); - } - - - - ######################################################################## - ### Create a new account in the target DB - ######################################################################## - - function account_add($account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_add ($account_id, $this); - - ### Sync the groups for this account: - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $remote_account_id = $this->account_group_sync( $account_id ); - - ### Create the alias record: - $dbm = new db_mapping; - $db2 = $dbm->DB_connect(false, $this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($this->map['map']) .';' ); - $sql = "SELECT username FROM " . - $db_prefix . "hive_user WHERE - userid = " . - $db2->qstr($remote_account_id); - $result = $db2->Execute($sql); - $remote_username = $result->fields['username']; - - $sql = "INSERT INTO " . - $db_prefix . "hive_alias SET - userid = " . - $db2->qstr($remote_account_id) . ", - alias = " . - $db2->qstr($remote_username); - $group_result = $db2->Execute($sql); - } - - - - ######################################################################## - ### Edit an existing account in the target DB - ######################################################################## - - function account_edit($account_id, $old_username) - { - $db_map = new db_mapping; - $remote_account_id = $db_map->MAP_account_edit ($account_id, $old_username, $this); - - ### Update the groups in the remote db - if( $this->map['group_type'] != 'none' ) - $this->account_group_sync($account_id); - } - - - - ######################################################################## - ### Delete an existing account from the target DB - ######################################################################## - - function account_delete($account_id, $username) - { - $db_map = new db_mapping; - $remote_account_id = $db_map->MAP_account_delete ($account_id, $username, $this); - - ### Update the remote account: - $dbm = new db_mapping; - $db2 = $dbm->DB_connect(false, $this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($this->map['map']) .';' ); - $sql = "DELETE FROM " . - $db_prefix . "hive_alias WHERE userid = " . - $db2->qstr($remote_account_id); - $group_result = $db2->Execute($sql); - } - - - - ######################################################################## - ### Export / Update all accounts / groups to the target DB - ######################################################################## - - function account_import($remote_account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_import ($remote_account_id, $this); - } - - - - - ######################################################################## - ### Create the cookie/session for login sync - ######################################################################## - - function login($account_id) - { - return; - } - - - ######################################################################## - ### Delete the cookie/session on account logout - ######################################################################## - - function logout($account_id) - { - return; - } - - - ######################################################################## - ### Syncronize the groups for a specific account in the remote DB - ######################################################################## - - function account_group_sync($account_id) - { - if ( $this->map['group_type'] == 'db') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_db ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'status') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_status ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'db-status') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_db_status ($account_id, $this); - } - else - { - return false; - } - } -} -?> \ No newline at end of file diff --git a/plugins/db_mapping/Invision_Power_Board_13.php b/plugins/db_mapping/Invision_Power_Board_13.php deleted file mode 100644 index 3cfb02b7..00000000 --- a/plugins/db_mapping/Invision_Power_Board_13.php +++ /dev/null @@ -1,853 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -################################################################################ -### Database Map for: Invision Power Board 1.3 -### Last Update: 12-11-2003 -################################################################################ - -class map_INVISION_POWER_BOARD_13 -{ - - ############################################################################ - ### Define the settings for this database map - ############################################################################ - - function map_INVISION_POWER_BOARD_13 () - { - - $this->map = - Array ( - 'map' => 'Invision_Power_Board_13', - 'db_type' => 'mysql', - 'notes' => 'This is for Invision Power Board 1.3', - 'group_type' => 'db-status', // db, status, none - - ### Define the account mapping properties - 'account_map_field' => 'members', - 'account_status_field' => 'mgroup', - 'account_default_status' => '1', - - ### Define the group fields in the target db - 'group_map' => - Array - ( - 'table' => 'groups', - 'id' => 'g_id', - 'name' => 'g_title' - ), - - 'account_sync_field'=> - Array - ( - 'delete' => '1' - ), - - 'account_fields' => - Array - ( - 'id' => - Array - ( - 'map_field' => 'id', - 'unique' => true - ), - 'date_orig' => - Array - ( - 'map_field' => 'joined' - ), - - 'date_last' => - Array - ( - 'map_field' => false - ), - - 'date_expire' => - Array - ( - 'map_field' => false - ), - - 'language_id' => - Array - ( - 'map_field' => false - ), - - 'country_id' => - Array - ( - 'map_field' => false - ), - - 'username' => - Array - ( - 'map_field' => 'name' - ), - - 'password' => - Array - ( - 'map_field' => 'password' - ), - - 'misc' => - Array - ( - 'map_field' => false - ), - - 'first_name' => - Array - ( - 'map_field' => false, - ), - - 'last_name' => - Array - ( - 'map_field' => false, - ), - - 'middle_name' => - Array - ( - 'map_field' => false - ), - - 'company' => - Array - ( - 'map_field' => false - ), - - 'status' => - Array - ( - 'map_field' => false - ), - - 'email' => - Array - ( - 'map_field' => 'email' - ), - - 'email_type' => - Array - ( - 'map_field' => false - ) - ), - - ### Define any extra fields for account table in the target db: - 'extra_field' => - Array ( - - Array - ( - 'name' => 'ip_address', - 'value' => USER_IP, - 'add' => 1, - 'edit' => 0 - ), - - Array - ( - 'name' => 'view_sigs', - 'value' => 1, - 'add' => 1, - 'edit' => 0 - ), - Array - ( - 'name' => 'view_avs', - 'value' => 1, - 'add' => 1, - 'edit' => 0 - ), - Array - ( - 'name' => 'view_pop', - 'value' => 1, - 'add' => 1, - 'edit' => 0 - ), - Array - ( - 'name' => 'view_img', - 'value' => 1, - 'add' => 1, - 'edit' => 0 - ), - Array - ( - 'name' => 'vdirs', - 'value' => 'in:Inbox|sent:Sent Items', - 'add' => 1, - 'edit' => 0 - ), - Array - ( - 'name' => 'last_visit', - 'value' => mktime(), - 'add' => 1, - 'edit' => 0 - ) - ) - - ); - } - - - ######################################################################## - ### Syncronize all accounts & groups - ######################################################################## - - function sync($id, $file) - { - $db_map = new db_mapping; - $this = $db_map->MAP_sync ($id, $file, $this); - } - - ######################################################################## - ### Create a new account in the target DB - ######################################################################## - - function account_add($account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_add ($account_id, $this); - - ### Sync the groups for this account: - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync( $account_id ); - - ## Run any Misc IBF operations - $db_map_misc = new dbmapping_misc; - $db_map_misc->MAP_account_add_misc($account_id, $this); - - } - - ######################################################################## - ### Edit an existing account in the target DB - ######################################################################## - - function account_edit($account_id, $old_username) - { - $db_map = new db_mapping; - $db_map->MAP_account_edit ($account_id, $old_username, $this); - - ### Update the groups in the remote db - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync($account_id); - } - - ######################################################################## - ### Delete an existing account from the target DB - ######################################################################## - - function account_delete($account_id, $username) - { - - ###Run any Misc IBF operations before acturally deleteing member - $db_map_misc = new dbmapping_misc; - $db_map_misc->MAP_account_delete_misc ($account_id, $username, $this); - - - ### Delete the member - $db_map = new db_mapping; - $db_map->MAP_account_delete ($account_id, $username, $this); - - } - - ######################################################################## - ### Export / Update all accounts / groups to the target DB - ######################################################################## - - function account_import($remote_account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_import ($remote_account_id, $this); - } - - ######################################################################## - ### Create the cookie/session for login sync - ######################################################################## - - function login($account_id) - { - $db_map_misc = new dbmapping_misc; - $db_map_misc->MAP_account_login ($account_id, $this); - } - - ######################################################################## - ### Delete the cookie/session on account logout - ######################################################################## - - function logout($account_id) - { - $db_map_misc = new dbmapping_misc; - $db_map_misc->MAP_account_logout ($account_id, $this); - } - - ######################################################################## - ### Syncronize the groups for a specific account in the remote DB - ######################################################################## - - function account_group_sync($account_id) - { - if ( $this->map['group_type'] == 'db') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_db ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'status') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_status ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'db-status') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_db_status ($account_id, $this); - } - else - { - return false; - } - } -} - -########################################################################################################## -### Extended IBF class by Marcel Evenson marcele@danami.com -########################################################################################################### -### Misc IBF Functions -########################################################################################################### - -############################################################################ -### MISC DEFINITIONS FOR IBF FILE OPERATIONS -############################################################################ - -// DATA DIRECTORY FOR MEMBER PROFILE PICTURES / AVATARS (NO TRAILING SLASH) -define ("IBF_DATA_DIR",'/home/www/devel/httpdocs/members/uploads'); -// COOKIE DOMAIN (NO TRAILING SLASH) -define ("IBF_COOKIE_DOMAIN",'www.dreamdevel.com'); -// COOKIE PATH (TRAILING SLASH) -define ("IBF_COOKIE_PATH",'/members/'); - -### END DEFINITIONS - -########################################################################################################### -### Misc IBF class extends db_mapping################################################################ -########################################################################################################### - -class dbmapping_misc extends db_mapping -{ - - ######################################################################## - #>>>>> IBF Misc add account - ######################################################################## - - function MAP_account_add_misc ( $account_id, $MAP_this ) - { - - ### Get the username from the account_id - $db = &DB(); - $sql= 'SELECT username FROM '.AGILE_DB_PREFIX.'account WHERE - id = '.$db->qstr($account_id).' AND - site_id = '.$db->qstr(DEFAULT_SITE); - $result = $db->Execute($sql); - - ### error reporting: - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_add_misc_get_username', $db->ErrorMsg()); - return; - } - - $username = $result->fields['username']; - - ### Get the remote account id from the username - $dbm = new db_mapping; - $db = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = 'SELECT id FROM ' . $db_prefix . 'members WHERE name = '.$db->qstr($username); - $result = $db->Execute($sql); - - ### error reporting: - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_add_misc_get_remote_account_id', $db->ErrorMsg()); - return; - } - - $remote_account_id = $result->fields['id']; - - ### Get the member count from the remote db - $dbm = new db_mapping; - $db = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = 'SELECT MEM_COUNT FROM ' . $db_prefix . 'stats'; - $result = $db->Execute($sql); - - ### error reporting: - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_add_misc_get_remote_stats', $db->ErrorMsg()); - return; - } - - $mem_count = $result->fields['MEM_COUNT'] + 1; - - if ($remote_account_id != "") { - - ### Update the IBF stats - $dbm = new db_mapping; - $db = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = 'UPDATE ' . $db_prefix . 'stats SET - MEM_COUNT ='.$db->qstr($mem_count).', - LAST_MEM_NAME ='.$db->qstr($username).', - LAST_MEM_ID ='.$db->qstr($remote_account_id); - $result = $db->Execute($sql); - - ### error reporting: - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_add_misc_update_stats', $db->ErrorMsg()); - $smarty->assign('db_mapping_result', $db->ErrorMsg()); - return; - } - } - } - - - ######################################################################## - #>>>>> IBF Misc delete account - ######################################################################## - - function MAP_account_delete_misc ($account_id, $username, $MAP_this) - { - - ### Get the remote account id from the username - $dbm = new db_mapping; - $db = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = 'SELECT id FROM ' . $db_prefix . 'members - WHERE name = '.$db->qstr($username); - $result = $db->Execute($sql); - - ### error reporting: - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_delete_misc_get_remote_account_id', $db->ErrorMsg()); - return; - } - - $remote_account_id = $result->fields['id']; - - if ($remote_account_id != "") { - - ### Convert their posts and topics into guest postings.. - $dbm = new db_mapping; - $db = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = 'UPDATE ' . $db_prefix . 'posts SET - author_id='.$db->qstr(0).' - WHERE author_id='.$db->qstr($remote_account_id); - $result = $db->Execute($sql); - - ### error reporting: - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_update_misc_posts_to_guests', $db->ErrorMsg()); - $smarty->assign('db_mapping_result', $db->ErrorMsg()); - return; - } - - ### Convert their posts and topics into guest postings.. - $dbm = new db_mapping; - $db = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = 'UPDATE ' . $db_prefix . 'topics SET - starter_id='.$db->qstr(0).' - WHERE starter_id='.$db->qstr($remote_account_id); - $result = $db->Execute($sql); - - ### error reporting: - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_update_misc_topics_to_guests', $db->ErrorMsg()); - $smarty->assign('db_mapping_result', $db->ErrorMsg()); - return; - } - - ### Delete their profile listings - $dbm = new db_mapping; - $db = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = 'DELETE FROM ' . $db_prefix . 'pfields_content WHERE member_id='.$db->qstr($remote_account_id); - $result = $db->Execute($sql); - - ### error reporting: - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_delete_misc_topics_to_guests', $db->ErrorMsg()); - $smarty->assign('db_mapping_result', $db->ErrorMsg()); - return; - } - - ### Delete member extra content - $dbm = new db_mapping; - $db = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = 'DELETE FROM ' . $db_prefix . 'member_extra WHERE id='.$db->qstr($remote_account_id); - $result = $db->Execute($sql); - - ### error reporting: - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_delete_misc_member_extra_content', $db->ErrorMsg()); - $smarty->assign('db_mapping_result', $db->ErrorMsg()); - return; - } - - ### Delete member messages - $dbm = new db_mapping; - $db = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = 'DELETE FROM ' . $db_prefix . 'messages WHERE member_id='.$db->qstr($remote_account_id); - $result = $db->Execute($sql); - - ### error reporting: - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_delete_misc_member_messages', $db->ErrorMsg()); - $smarty->assign('db_mapping_result', $db->ErrorMsg()); - return; - } - - ### Delete member contacts - $dbm = new db_mapping; - $db = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = 'DELETE FROM ' . $db_prefix . 'contacts WHERE member_id='.$db->qstr($remote_account_id).' - OR contact_id='.$db->qstr($remote_account_id); - $result = $db->Execute($sql); - - ### error reporting: - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_delete_misc_member_contacts', $db->ErrorMsg()); - $smarty->assign('db_mapping_result', $db->ErrorMsg()); - return; - } - - ### Delete member subscriptions tracker - $dbm = new db_mapping; - $db = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = 'DELETE FROM ' . $db_prefix . 'tracker WHERE member_id='.$db->qstr($remote_account_id); - $result = $db->Execute($sql); - - ### error reporting: - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_delete_misc_member_sub_tracker', $db->ErrorMsg()); - $smarty->assign('db_mapping_result', $db->ErrorMsg()); - return; - } - - ### Delete member subscriptions forum tracker - $dbm = new db_mapping; - $db = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = 'DELETE FROM ' . $db_prefix . 'forum_tracker WHERE member_id='.$db->qstr($remote_account_id); - $result = $db->Execute($sql); - - ### error reporting: - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_delete_misc_member_sub_forum_tracker', $db->ErrorMsg()); - $smarty->assign('db_mapping_result', $db->ErrorMsg()); - return; - } - - ### Delete member warn_logs - $dbm = new db_mapping; - $db = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = 'DELETE FROM ' . $db_prefix . 'warn_logs WHERE wlog_mid='.$db->qstr($remote_account_id); - $result = $db->Execute($sql); - - ### error reporting: - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_delete_misc_member_warn_logs', $db->ErrorMsg()); - $smarty->assign('db_mapping_result', $db->ErrorMsg()); - return; - } - - ### Delete member from validating - $dbm = new db_mapping; - $db = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = 'DELETE FROM ' . $db_prefix . 'validating WHERE member_id='.$db->qstr($remote_account_id); - $result = $db->Execute($sql); - - ### error reporting: - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_delete_misc_member_validating', $db->ErrorMsg()); - $smarty->assign('db_mapping_result', $db->ErrorMsg()); - return; - } - - ### Delete IBF member avatar picture - $delete_avatars = new dbmapping_misc; - $delete_avatars->ibf_delete_avatars($remote_account_id); - - ### Delete IBF member profile picture - $delete_photos = new dbmapping_misc; - $delete_photos->ibf_delete_photos($remote_account_id); - - ### Get the member count from the remote db - $dbm = new db_mapping; - $db = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = 'SELECT MEM_COUNT FROM ' . $db_prefix . 'stats'; - $result = $db->Execute($sql); - - ### error reporting: - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_add_misc_get_remote_stats', $db->ErrorMsg()); - return; - } - - $mem_count = $result->fields['MEM_COUNT'] - 1; - - ### Update the IBF stats - $dbm = new db_mapping; - $db = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = 'UPDATE ' . $db_prefix . 'stats SET MEM_COUNT='.$db->qstr($mem_count); - $result = $db->Execute($sql); - - ### error reporting: - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_delete_misc_update_stats', $db->ErrorMsg()); - $smarty->assign('db_mapping_result', $db->ErrorMsg()); - return; - } - } - } - - ######################################################################## - #>>>>> IBF login - ######################################################################## - - function MAP_account_login ($account_id, $MAP_this) - { - - $user_agent = addslashes($_SERVER['HTTP_USER_AGENT']); - $today = time(); - - ### Get the username from the account_id - $db = &DB(); - $sql= 'SELECT username,password FROM '.AGILE_DB_PREFIX.'account WHERE - id = '.$db->qstr($account_id).' AND - site_id = '.$db->qstr(DEFAULT_SITE); - $result = $db->Execute($sql); - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_login_get_account_username', $db->ErrorMsg()); - } - - $username = $result->fields['username']; - - ### Get the remote account id from the username - $dbm = new db_mapping; - $dbm = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = 'SELECT id FROM ' . $db_prefix . 'members - WHERE name = '.$db->qstr($username); - $result = $dbm->Execute($sql); - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_login_get_remote_account_id', $db->ErrorMsg()); - } - - $remote_account_id = $result->fields['id']; - - if ($remote_account_id != "") - { - ### Select required info for the session table - $dbm = new db_mapping; - $dbm = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = 'SELECT name,mgroup,password FROM ' . $db_prefix . 'members - WHERE id='.$db->qstr($remote_account_id); - $result = $dbm->Execute($sql); - if ($result === false) { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_login_get_info', $db->ErrorMsg()); - } - - $account_member_name = $result->fields['name']; - $account_mgroup = $result->fields['mgroup']; - $account_password = $result->fields['password']; - - ### cookies - setcookie("session_id",SESS,0,'/'); - setcookie("member_id",$remote_account_id,0,'/'); - setcookie("pass_hash",$account_password,0,'/'); - - - ### Delete any old sessions - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = 'DELETE FROM ' . $db_prefix . 'sessions WHERE member_id='.$db->qstr($remote_account_id).' OR id='.$db->qstr(SESS); - $result = $dbm->Execute($sql); - if ($result === false) { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_login_delete_sessions', $db->ErrorMsg()); - $smarty->assign('db_mapping_result', $db->ErrorMsg()); - } - - ### Insert new session into remote db - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = 'INSERT INTO ' . $db_prefix . 'sessions SET - id = '.$db->qstr(SESS).', - member_name = '.$db->qstr($account_member_name).', - member_id = '.$db->qstr($remote_account_id).', - ip_address = '.$db->qstr(USER_IP).', - browser = '.$db->qstr($user_agent).', - running_time = '.$db->qstr($today).', - login_type = '.$db->qstr('-1').', - location = '.$db->qstr('idx,,').', - member_group = '.$db->qstr($account_mgroup).', - in_forum = '.$db->qstr(0).', - in_topic = '.$db->qstr(0); - $result = $dbm->Execute($sql); - if ($result === false) { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_login_insert_session', $db->ErrorMsg()); - $smarty->assign('db_mapping_result', $db->ErrorMsg()); - } - } - } - - ######################################################################## - #>>>>> IBF logout - ######################################################################## - - function MAP_account_logout ($account_id, $MAP_this) - { - - ### Clear the session info in IBF - $dbm = new db_mapping; - $db = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = 'UPDATE ' . $db_prefix . 'sessions SET - member_name ='.$db->qstr('NULL').', - member_id ='.$db->qstr(0).', - login_type ='.$db->qstr(0).', - member_group ='.$db->qstr(2).' - WHERE id ='.$db->qstr(SESS); - $result = $db->Execute($sql); - - ### error reporting: - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_logout_delete_account_session', $db->ErrorMsg()); - $smarty->assign('db_mapping_result', $db->ErrorMsg()); - return; - } - - - ### Clear the IBF cookies - setcookie("session_id",0,0,'/'); - setcookie("member_id",0,0,'/'); - setcookie("pass_hash",0,0,'/'); - return; - - } - - - ######################################################################## - ### MISC FILE OPERATIONS FOR INVISION POWER BOARD - ######################################################################## - - function ibf_delete_photos($remote_account_id) - { - - - foreach( array( 'swf', 'jpg', 'jpeg', 'gif', 'png' ) as $ext ) - { - if ( @file_exists(IBF_DATA_DIR."/photo-".$remote_account_id.".".$ext ) ) - { - @unlink(IBF_DATA_DIR."/photo-".$remote_account_id.".".$ext ); - } - } - - } - - function ibf_delete_avatars($remote_account_id) - { - - foreach( array( 'swf', 'jpg', 'jpeg', 'gif', 'png' ) as $ext ) - { - if ( @file_exists(IBF_DATA_DIR."/av-".$remote_account_id.".".$ext ) ) - { - @unlink(IBF_DATA_DIR."/av-".$remote_account_id.".".$ext ); - } - } - } - -} - -?> \ No newline at end of file diff --git a/plugins/db_mapping/Invision_Power_Board_2.php b/plugins/db_mapping/Invision_Power_Board_2.php deleted file mode 100644 index 5b1a734d..00000000 --- a/plugins/db_mapping/Invision_Power_Board_2.php +++ /dev/null @@ -1,479 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - - -################################################################################ -### Database Map for: Invision Power Board 2 -### Last Update: 10-28-2004 -################################################################################ - -class map_INVISION_POWER_BOARD_2 -{ - - ############################################################################ - ### Define the settings for this database map - ############################################################################ - - function map_INVISION_POWER_BOARD_2 () - { - - $this->map = - Array ( - 'map' => 'Invision_Power_Board_2', - 'db_type' => 'mysql', - 'notes' => 'This is for Invision Power Board 2.x', - 'group_type' => 'db-status', // db, status, none - - ### Define the group fields in the target db - 'group_map' => - Array - ( - 'table' => 'groups', - 'id' => 'g_id', - 'name' => 'g_title' - ), - - - ### Define the account mapping properties - 'account_map_field' => 'members', - 'account_status_field' => 'mgroup', - 'account_default_status' => '1', - - 'account_sync_field'=> - Array - ( - 'delete' => '1' - ), - - 'account_fields' => - Array - ( - 'id' => - Array - ( - 'map_field' => 'id', - 'unique' => true - ), - 'date_orig' => - Array - ( - 'map_field' => 'joined' - ), - - 'date_last' => - Array - ( - 'map_field' => false - ), - - 'date_expire' => - Array - ( - 'map_field' => false - ), - - 'language_id' => - Array - ( - 'map_field' => false - ), - - 'country_id' => - Array - ( - 'map_field' => false - ), - - 'username' => - Array - ( - 'map_field' => 'name' - ), - - 'password' => - Array - ( - 'map_field' => 'legacy_password' - ), - - 'misc' => - Array - ( - 'map_field' => false - ), - - 'first_name' => - Array - ( - 'map_field' => false - ), - - 'last_name' => - Array - ( - 'map_field' => false - ), - - 'middle_name' => - Array - ( - 'map_field' => false - ), - - 'company' => - Array - ( - 'map_field' => false - ), - - 'status' => - Array - ( - 'map_field' => false - ), - - 'email' => - Array - ( - 'map_field' => 'email' - ), - - 'email_type' => - Array - ( - 'map_field' => false - ) - ), - - ### Define any extra fields for account table in the target db: - 'extra_field' => - Array ( - - Array - ( - 'name' => 'ip_address', - 'value' => USER_IP, - 'add' => 1, - 'edit' => 0 - ), - - Array - ( - 'name' => 'view_sigs', - 'value' => 1, - 'add' => 1, - 'edit' => 0 - ), - Array - ( - 'name' => 'view_avs', - 'value' => 1, - 'add' => 1, - 'edit' => 0 - ), - Array - ( - 'name' => 'view_pop', - 'value' => 1, - 'add' => 1, - 'edit' => 0 - ), - Array - ( - 'name' => 'view_img', - 'value' => 1, - 'add' => 1, - 'edit' => 0 - ), - Array - ( - 'name' => 'last_visit', - 'value' => mktime(), - 'add' => 1, - 'edit' => 0 - ) - ) - - ); - } - - - - - ######################################################################## - ### Syncronize all accounts & groups - ######################################################################## - - function sync($id, $file) - { - $db_map = new db_mapping; - $this = $db_map->MAP_sync ($id, $file, $this); - } - - - - ######################################################################## - ### Create a new account in the target DB - ######################################################################## - - function account_add($account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_add ($account_id, $this); - - ### Sync the groups for this account: - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync( $account_id ); - } - - - - ######################################################################## - ### Edit an existing account in the target DB - ######################################################################## - - function account_edit($account_id, $old_username) - { - $db_map = new db_mapping; - $db_map->MAP_account_edit ($account_id, $old_username, $this); - - ### Update the groups in the remote db - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync($account_id); - return true; - } - - - - ######################################################################## - ### Delete an existing account from the target DB - ######################################################################## - - function account_delete($account_id, $username) - { - $db_map = new db_mapping; - $db_map->MAP_account_delete ($account_id, $username, $this); - } - - - - ######################################################################## - ### Export / Update all accounts / groups to the target DB - ######################################################################## - - function account_import($remote_account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_import ($remote_account_id, $this); - } - - - - - ######################################################################## - ### Create the cookie/session for login sync - ######################################################################## - - function login($account_id) - { - $db_map_misc = new dbmapping_misc; - $db_map_misc->MAP_account_login ($account_id, $this); - } - - - ######################################################################## - ### Delete the cookie/session on account logout - ######################################################################## - - function logout($account_id) - { - $db_map_misc = new dbmapping_misc; - $db_map_misc->MAP_account_logout ($account_id, $this); - } - - - ######################################################################## - ### Syncronize the groups for a specific account in the remote DB - ######################################################################## - - function account_group_sync($account_id) - { - if ( $this->map['group_type'] == 'db') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_db ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'status') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_status ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'db-status') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_db_status ($account_id, $this); - } - else - { - return false; - } - } -} - - - - -########################################################################################################### -### Misc IBF class extends db_mapping################################################################ -########################################################################################################### - -class dbmapping_misc extends db_mapping -{ - ######################################################################## - #>>>>> IBF login - ######################################################################## - - function MAP_account_login ($account_id, $MAP_this) - { - - $user_agent = addslashes($_SERVER['HTTP_USER_AGENT']); - $today = time(); - - ### Get the username from the account_id - $db = &DB(); - $sql= 'SELECT username,password FROM '.AGILE_DB_PREFIX.'account WHERE - id = '.$db->qstr($account_id).' AND - site_id = '.$db->qstr(DEFAULT_SITE); - $result = $db->Execute($sql); - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_login_get_account_username', $db->ErrorMsg()); - } - unset($db); - - $username = $result->fields['username']; - - ### Get the remote account id from the username - $dbm = new db_mapping; - $dbm = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = 'SELECT id FROM ' . $db_prefix . 'members - WHERE name = '.$dbm->qstr($username); - $result = $dbm->Execute($sql); - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_login_get_remote_account_id', $dbm->ErrorMsg()); - return false; - } - - $remote_account_id = $result->fields['id']; - - if (!empty($remote_account_id)) - { - ### Select required info for the session table - $sql = 'SELECT name,mgroup,legacy_password FROM ' . $db_prefix . 'members - WHERE id='.$dbm->qstr($remote_account_id); - $result = $dbm->Execute($sql); - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_login_get_remote_account_id', $dbm->ErrorMsg()); - return false; - } - - $account_member_name = $result->fields['name']; - $account_mgroup = $result->fields['mgroup']; - $account_password = $result->fields['legacy_password']; - - ### cookies - setcookie("session_id",SESS,0,'/'); - setcookie("member_id",$remote_account_id,0,'/'); - setcookie("pass_hash",$account_password,0,'/'); - - ### Delete any old sessions - $sql = 'DELETE FROM ' . $db_prefix . 'sessions WHERE member_id='.$dbm->qstr($remote_account_id).' OR id='.$dbm->qstr(SESS); - $result = $dbm->Execute($sql); - if ($result === false) { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_login_delete_sessions', $dbm->ErrorMsg()); - } - - ### Insert new session into remote db - $sql = 'INSERT INTO ' . $db_prefix . 'sessions SET - id = '.$dbm->qstr(SESS).', - member_name = '.$dbm->qstr($account_member_name).', - member_id = '.$dbm->qstr($remote_account_id).', - ip_address = '.$dbm->qstr(USER_IP).', - browser = '.$dbm->qstr($user_agent).', - running_time = '.$dbm->qstr($today).', - login_type = '.$dbm->qstr('-1').', - location = '.$dbm->qstr('idx,,').', - member_group = '.$dbm->qstr($account_mgroup).', - in_forum = '.$dbm->qstr(0).', - in_topic = '.$dbm->qstr(0); - $result = $dbm->Execute($sql); - if ($result === false) { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_login_insert_session', $dbm->ErrorMsg()); - } - } - } - - ######################################################################## - #>>>>> IBF logout - ######################################################################## - - function MAP_account_logout ($account_id, $MAP_this) - { - - ### Clear the session info in IBF - $dbm = new db_mapping; - $db = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = 'UPDATE ' . $db_prefix . 'sessions SET - member_name ='.$db->qstr('NULL').', - member_id ='.$db->qstr(0).', - login_type ='.$db->qstr(0).', - member_group ='.$db->qstr(2).' - WHERE id ='.$db->qstr(SESS); - $result = $db->Execute($sql); - - ### error reporting: - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_logout_delete_account_session', $db->ErrorMsg()); - $smarty->assign('db_mapping_result', $db->ErrorMsg()); - return; - } - - ### Clear the IBF cookies - setcookie("session_id",0,0,'/'); - setcookie("member_id",0,0,'/'); - setcookie("pass_hash",0,0,'/'); - return; - } -} - -?> \ No newline at end of file diff --git a/plugins/db_mapping/Mambo_4O14.php b/plugins/db_mapping/Mambo_4O14.php deleted file mode 100644 index 89f42a41..00000000 --- a/plugins/db_mapping/Mambo_4O14.php +++ /dev/null @@ -1,322 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -################################################################################ -### Database Map for: Mambo 4.0.14 -### Last Update: 9-30-2004 -################################################################################ - -class map_MAMBO_4O14 -{ - - ############################################################################ - ### Define the settings for this database map - ############################################################################ - - function map_MAMBO_4O14 () - { - $this->map = - Array ( - 'map' => 'Mambo_4O14', - 'db_type' => 'mysql', - 'notes' => 'This is for Mambo 4.0.14', - 'group_type' => 'db-status', // db, db-status, status, none - - - ### Define the group fields in the target db - 'group_map' => - Array - ( - 'table' => 'groups', - 'id' => 'id', - 'name' => 'name' - ), - - - ### Define the account mapping properties - 'account_map_field' => 'users', - 'account_status_field' => 'gid', - 'account_default_status' => '1', - - 'account_sync_field'=> - Array - ( - 'add' => 'username,email,password', - 'edit' => 'username,email,password', - 'import' => 'username,email,password', - 'export' => 'username,email,password', - 'delete' => '1' - ), - - 'account_fields' => - Array - ( - 'id' => - Array - ( - 'map_field' => 'id' - ), - 'date_orig' => - Array - ( - 'map_field' => false - ), - - 'date_last' => - Array - ( - 'map_field' => false - ), - - 'date_expire' => - Array - ( - 'map_field' => false - ), - - 'language_id' => - Array - ( - 'map_field' => false - ), - - 'country_id' => - Array - ( - 'map_field' => false - ), - - 'username' => - Array - ( - 'map_field' => 'username' - ), - - 'password' => - Array - ( - 'map_field' => 'password' - ), - - 'misc' => - Array - ( - 'map_field' => false - ), - - 'first_name' => - Array - ( - 'map_field' => 'name', - ), - - 'last_name' => - Array - ( - 'map_field' => false, - ), - - 'middle_name' => - Array - ( - 'map_field' => false - ), - - 'company' => - Array - ( - 'map_field' => false - ), - - 'status' => - Array - ( - 'map_field' => false - ), - - 'email' => - Array - ( - 'map_field' => 'email' - ), - - 'email_type' => - Array - ( - 'map_field' => false - ) - ), - - ### Define any extra fields for account table in the target db: - 'extra_field' => - Array - ( - Array - ( - 'name' => 'usertype', - 'value' => 'user', - 'add' => 1, - 'edit' => 0 - ) - ) - ); - - } - - - - - - ######################################################################## - ### Syncronize all accounts & groups - ######################################################################## - - function sync($id, $file) - { - $db_map = new db_mapping; - $this = $db_map->MAP_sync ($id, $file, $this); - } - - - - ######################################################################## - ### Create a new account in the target DB - ######################################################################## - - function account_add($account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_add ($account_id, $this); - - ### Sync the groups for this account: - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $remote_account_id = $this->account_group_sync( $account_id ); - - ### Update the remote account: - $dbm = new db_mapping; - $db2 = $dbm->DB_connect(false, $this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($this->map['map']) .';' ); - $sql = "INSERT INTO " . - $db_prefix . "userfield SET userid = " . - $db2->qstr($remote_account_id); - $group_result = $db2->Execute($sql); - } - - - - ######################################################################## - ### Edit an existing account in the target DB - ######################################################################## - - function account_edit($account_id, $old_username) - { - $db_map = new db_mapping; - $db_map->MAP_account_edit ($account_id, $old_username, $this); - - ### Update the groups in the remote db - if( $this->map['group_type'] != 'none' ) - $this->account_group_sync($account_id); - } - - - - ######################################################################## - ### Delete an existing account from the target DB - ######################################################################## - - function account_delete($account_id, $username) - { - $db_map = new db_mapping; - $remote_account_id = $db_map->MAP_account_delete ($account_id, $username, $this); - - ### Update the remote account: - $dbm = new db_mapping; - $db2 = $dbm->DB_connect(false, $this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($this->map['map']) .';' ); - $sql = "DELETE FROM " . - $db_prefix . "userfield WHERE userid = " . - $db2->qstr($remote_account_id); - $group_result = $db2->Execute($sql); - } - - - - ######################################################################## - ### Export / Update all accounts / groups to the target DB - ######################################################################## - - function account_import($remote_account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_import ($remote_account_id, $this); - } - - - - - ######################################################################## - ### Create the cookie/session for login sync - ######################################################################## - - function login($account_id) - { - return; - } - - - ######################################################################## - ### Delete the cookie/session on account logout - ######################################################################## - - function logout($account_id) - { - return; - } - - - ######################################################################## - ### Syncronize the groups for a specific account in the remote DB - ######################################################################## - - function account_group_sync($account_id) - { - if ( $this->map['group_type'] == 'db') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_db ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'status') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_status ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'db-status') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_db_status ($account_id, $this); - } - else - { - return false; - } - } -} -?> diff --git a/plugins/db_mapping/Mambo_4_5.php b/plugins/db_mapping/Mambo_4_5.php deleted file mode 100644 index 4108ad8e..00000000 --- a/plugins/db_mapping/Mambo_4_5.php +++ /dev/null @@ -1,468 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -################################################################################ -### Database Map for: Mambo 4.5.x -### Last Update: 4-20-2005 -################################################################################ - -class map_MAMBO_4_5 -{ - - ############################################################################ - ### Define the settings for this database map - ############################################################################ - - function map_MAMBO_4_5 () - { - $this->map = - Array ( - 'map' => 'Mambo_4_5', - 'db_type' => 'mysql', - 'notes' => 'This is for Mambo 4.5.x', - 'group_type' => 'db-status', // db, db-status, status, none - - - ### Define the group fields in the target db - 'group_map' => - Array - ( - 'table' => 'core_acl_aro_groups', - 'id' => 'group_id', - 'name' => 'name' - ), - - - ## Should records be deleted? - 'account_sync_field'=> - Array - ( - 'delete' => '1' - ), - - - # Set the user table & fields - 'account_map_field' => 'users', - 'account_status_field' => 'gid', - 'account_fields' => - Array - ( - 'id' => - Array - ( - 'map_field' => 'id' - ), - 'date_orig' => - Array - ( - 'map_field' => false - ), - - 'date_last' => - Array - ( - 'map_field' => false - ), - - 'date_expire' => - Array - ( - 'map_field' => false - ), - - 'language_id' => - Array - ( - 'map_field' => false - ), - - 'country_id' => - Array - ( - 'map_field' => false - ), - - 'username' => - Array - ( - 'map_field' => 'username' - ), - - 'password' => - Array - ( - 'map_field' => 'password' - ), - - 'misc' => - Array - ( - 'map_field' => false - ), - - 'first_name' => - Array - ( - 'map_field' => 'name', - ), - - 'last_name' => - Array - ( - 'map_field' => false, - ), - - 'middle_name' => - Array - ( - 'map_field' => false - ), - - 'company' => - Array - ( - 'map_field' => false - ), - - 'status' => - Array - ( - 'map_field' => false - ), - - 'email' => - Array - ( - 'map_field' => 'email' - ), - - 'email_type' => - Array - ( - 'map_field' => false - ) - ), - - ### Define any extra fields for account table in the target db: - 'extra_field' => - Array - ( - Array - ( - 'name' => 'gid', - 'value' => '29', - 'add' => 1, - 'edit' => 0 - ), - Array - ( - 'name' => 'registerDate', - 'value' => '2005-04-20 18:54:29', - 'add' => 1, - 'edit' => 0 - ) - ) - ); - - } - - - ######################################################################## - ### Syncronize all accounts & groups - ######################################################################## - - function sync($id, $file) - { - $db_map = new db_mapping; - $db_map->MAP_sync ($id, $file); - } - - ######################################################################## - ### Create a new account in the target DB - ######################################################################## - - function account_add($account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_add ($account_id); - - ### Sync the groups for this account: - $this->account_group_sync( $account_id ); - } - - ######################################################################## - ### Edit an existing account in the target DB - ######################################################################## - - function account_edit($account_id, $old_username) - { - $db_map = new db_mapping; - $db_map->MAP_account_edit ($account_id, $old_username); - - ### Update the groups in the remote db - $this->account_group_sync($account_id); - } - - ######################################################################## - ### Delete an existing account from the target DB - ######################################################################## - - function account_delete($account_id, $username) - { - $db_map = new db_mapping; - $db_map->MAP_account_delete ($account_id, $username); - } - - ######################################################################## - ### Export / Update all accounts / groups to the target DB - ######################################################################## - - function account_import($remote_account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_import ($remote_account_id); - } - - ######################################################################## - ### Create the cookie/session for login sync - ######################################################################## - - function login($account_id) - { - global $_COOKIE; - - ### Get the local account details - $db = &DB(); - $sql= 'SELECT username,email FROM '.AGILE_DB_PREFIX.'account WHERE - site_id = '.$db->qstr(DEFAULT_SITE).' AND - id = '.$db->qstr($account_id); - $result = $db->Execute($sql); - $user = $result->fields['username']; - - $dbm = new db_mapping; - $db2 = $dbm->DB_connect(false, $this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($this->map['map']) .';' ); - - ### Get the remote account_id - $sql = "SELECT * FROM " . $db_prefix . 'users WHERE username = ' . $db2->qstr($user); - $acct = $db2->Execute($sql); - - ### Determine if remote session exists: - @$session_id = $_COOKIE['sessioncookie']; - $sql = "SELECT * FROM " . $db_prefix . 'session WHERE session_id = ' . $db2->qstr( md5 ($session_id) ); - $result = $db2->Execute($sql); - if ($result === false) - { - global $C_debug; - $C_debug->error('Mambo_4_5.php','account_group_sync:2', $db2->ErrorMsg()); - return; - } - - if($result->RecordCount() == 0) - { - ### New session - $session_id = SESS; - $sql = "INSERT INTO " . $db_prefix . "session SET - time = ". time().", - session_id = ". $db2->qstr( md5 ( $session_id ) ). ", - guest = 0, - userid = " . $acct->fields['id'].", - gid = " . $acct->fields['gid'].", - usertype = " . $db2->qstr($acct->fields['usertype']).", - username = " . $db2->qstr($user); - $db2->Execute($sql); - } else { - ### Update session - $sql = "UPDATE " . $db_prefix . "session SET - time = ". time().", - session_id = ". $db2->qstr( md5 ( $session_id ) ). ", - guest = 0, - userid = " . $acct->fields['id'].", - gid = " . $acct->fields['gid'].", - usertype = " . $db2->qstr($acct->fields['usertype']).", - username = " . $db2->qstr($user) . " - WHERE - session_id = " . $db2->qstr( md5( $session_id) ); - $db2->Execute($sql); - } - - // set mambo session cookie - if(COOKIE_EXPIRE == 0 ) - $cookie_expire = (time() + 86400*365); - else - $cookie_expire = (time() + (COOKIE_EXPIRE*60)); - setcookie( "sessioncookie", $session_id, $cookie_expire, "/" ); - return true; - } - - - ######################################################################## - ### Delete the cookie/session on account logout - ######################################################################## - - function logout($account_id) - { - ### Get the local account details - $db = &DB(); - $sql= 'SELECT username,email FROM '.AGILE_DB_PREFIX.'account WHERE - site_id = '.$db->qstr(DEFAULT_SITE).' AND - id = '.$db->qstr($account_id); - $result = $db->Execute($sql); - $user = $result->fields['username']; - - @$session_id = $_COOKIE['sessioncookie']; - if(!empty($session_id)) { - $dbm = new db_mapping; - $db2 = $dbm->DB_connect(false, $this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($this->map['map']) .';' ); - $sql = "UPDATE " . $db_prefix . "session SET - guest = 1, - userid = '', - gid = '', - usertype = '', - username = '' - WHERE - session_id = " . $db2->qstr( md5($session_id) ) . " - OR - username = " . $db2->qstr($user) ; - $db2->Execute($sql); - $acct = $db2->Execute($sql); - } - setcookie( "usercookie", "", time() - 1800, "/" ); - return true; - } - - - ######################################################################## - ### Syncronize the groups for a specific account in the remote DB - ######################################################################## - - function account_group_sync($account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_group_sync_db_status($account_id); - - - ### Get the local account details - $db = &DB(); - $sql= 'SELECT username,email FROM '.AGILE_DB_PREFIX.'account WHERE - site_id = '.$db->qstr(DEFAULT_SITE).' AND - id = '.$db->qstr($account_id); - $result = $db->Execute($sql); - if ($result === false) - { - global $C_debug; - $C_debug->error('Mambo_4_5.php','account_group_sync:1', $db->ErrorMsg()); - return; - } - - $user = $result->fields['username']; - $email = $result->fields['email']; - - - ### Get the remote account id, username, and group ID: - $dbm = new db_mapping; - $db2 = $dbm->DB_connect(false, $this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($this->map['map']) .';' ); - $sql = "SELECT id,gid,username FROM " . - $db_prefix . "" . $this->map['account_map_field'] . ' WHERE ' . - $this->map['account_fields']['username']['map_field'] . " = " . - $db2->qstr($user); - $result = $db2->Execute($sql); - if ($result === false) - { - global $C_debug; - $C_debug->error('Mambo_4_5.php','account_group_sync:2', $db2->ErrorMsg()); - return; - } - - $id = $result->fields['id']; - $user = $result->fields['username']; - $gid = $result->fields['gid']; - - # Clear old values: - $sql = "DELETE FROM " . $db_prefix . "core_acl_aro WHERE value = $id"; - $result = $db2->Execute($sql); - - # add the core_acl_aro record - $sql = "INSERT INTO " . $db_prefix . "core_acl_aro SET - section_value = 'users', - value = $id, - name = ".$db2->qstr($user); - $result = $db2->Execute($sql); - - - # Get the ID just inserted: - $sql = "SELECT aro_id FROM " . $db_prefix . "core_acl_aro WHERE value = $id"; - $result = $db2->Execute($sql); - $aro_id = $result->fields['aro_id']; - - $sql = "DELETE FROM " . $db_prefix . "core_acl_groups_aro_map WHERE aro_id = $aro_id"; - $result = $db2->Execute($sql); - - if($gid > 0 && $aro_id > 0) - { - # add the core_acl_groups_aro_map record - $sql = "INSERT INTO " . $db_prefix . "core_acl_groups_aro_map SET - group_id = $gid, - aro_id = $aro_id"; - $result = $db2->Execute($sql); - - # unblock - $sql = "UPDATE " . $db_prefix . $this->map['account_map_field'] . " - SET block = 0 - WHERE id = $id"; - $result = $db2->Execute($sql); - } - else - { - /* - This member gets access to nothing. - - Mambo doesn't have a group we can grant the users - that allows them only public access articles. Lame. - - After studying mambo's group system in depth, - it makes no sense how something so complicated (6 tables?) can not - be used to control access to the articles?! Wit a CMS system, it is - all about the content and if you have groups, you should be able to - display/hide content based on the user's group membership. - - However, with mambo, apparently you can set the articles so they can - be viewed by a) all users, (b) registered users, (c) Special. - - Since I can find no way to map the users to option (c), and obviously - non-paying members will still be registered after their subscription - expires, our options are now to delete the user entirely (NO!) - or set the user to blocked (lesser of two evils but will cause confusion - since mambo will tell the user the login info they submitted is invalid) - - Lets block the user and be done with it... Sigh... - */ - - $sql = "UPDATE " . $db_prefix . $this->map['account_map_field'] . " - SET block = 1 - WHERE id = $id"; - $result = $db2->Execute($sql); - } - } - -} -?> \ No newline at end of file diff --git a/plugins/db_mapping/Mantis_18rc1.php b/plugins/db_mapping/Mantis_18rc1.php deleted file mode 100644 index 78d8fac3..00000000 --- a/plugins/db_mapping/Mantis_18rc1.php +++ /dev/null @@ -1,321 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -################################################################################ -### Database Map for: Mantis 0.18.rc1 -### Last Update: 12-11-2003 -################################################################################ - -class map_MANTIS_18RC1 -{ - - ############################################################################ - ### Define the settings for this database map - ############################################################################ - - function map_MANTIS_18RC1 () - { - $this->map = - Array ( - 'map' => 'Mantis_18rc1', - 'db_type' => 'mysql', - 'notes' => 'This is for Mantis 0.18.rc1', - 'group_type' => 'status', // db, status, none - - - ### Define the account mapping properties - 'account_map_field' => '_user_table', - 'account_status_field' => 'access_level', - 'account_default_status' => '25', - - 'account_sync_field'=> - Array - ( - 'add' => 'username,email,password,enabled,protected,access_level', - 'edit' => 'username,email,password,enabled,protected,access_level', - 'import' => 'username,email,password,enabled,protected,access_level', - 'export' => 'username,email,password,enabled,protected,access_level', - 'delete' => '1' - ), - - 'account_fields' => - Array - ( - 'id' => - Array - ( - 'map_field' => 'id' - ), - 'date_orig' => - Array - ( - 'map_field' => false - ), - - 'date_last' => - Array - ( - 'map_field' => false - ), - - 'date_expire' => - Array - ( - 'map_field' => false - ), - - 'language_id' => - Array - ( - 'map_field' => false - ), - - 'country_id' => - Array - ( - 'map_field' => false - ), - - 'username' => - Array - ( - 'map_field' => 'username' - ), - - 'password' => - Array - ( - 'map_field' => 'password' - ), - - 'misc' => - Array - ( - 'map_field' => false - ), - - 'first_name' => - Array - ( - 'map_field' => false, - ), - - 'last_name' => - Array - ( - 'map_field' => false, - ), - - 'middle_name' => - Array - ( - 'map_field' => false - ), - - 'company' => - Array - ( - 'map_field' => false - ), - - 'status' => - Array - ( - 'map_field' => false - ), - - 'email' => - Array - ( - 'map_field' => 'email' - ), - - 'email_type' => - Array - ( - 'map_field' => false - ) - ), - - ### Define any extra fields for account table in the target db: - 'extra_field' => - Array ( - Array - ( - 'name' => 'enabled', - 'value' => '1', - 'add' => 1, - 'edit' => 0 - ), - - Array - ( - 'name' => 'protected', - 'value' => '0', - 'add' => 1, - 'edit' => 0 - ), - - Array - ( - 'name' => 'access_level', - 'value' => '25', - 'add' => 1, - 'edit' => 0 - ), - - Array - ( - 'name' => 'cookie_string', - 'value' => 'random|64', - 'add' => 1, - 'edit' => 0 - ) - ) - ); - - } - - ######################################################################## - ### Syncronize all accounts & groups - ######################################################################## - - function sync($id, $file) - { - $db_map = new db_mapping; - $this = $db_map->MAP_sync ($id, $file, $this); - } - - ######################################################################## - ### Create a new account in the target DB - ######################################################################## - - function account_add($account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_add ($account_id, $this); - - ### Sync the groups for this account: - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync( $account_id ); - } - - ######################################################################## - ### Edit an existing account in the target DB - ######################################################################## - - function account_edit($account_id, $old_username) - { - $db_map = new db_mapping; - $db_map->MAP_account_edit ($account_id, $old_username, $this); - - ### Update the groups in the remote db - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync($account_id); - } - - ######################################################################## - ### Delete an existing account from the target DB - ######################################################################## - - function account_delete($account_id, $username) - { - $db_map = new db_mapping; - $db_map->MAP_account_delete ($account_id, $username, $this); - } - - ######################################################################## - ### Export / Update all accounts / groups to the target DB - ######################################################################## - - function account_import($remote_account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_import ($remote_account_id, $this); - } - - ######################################################################## - ### Create the cookie/session for login sync - ######################################################################## - - function login($account_id, $cookie_name) - { - ### Get the username login/account creation: - global $VAR; - @$username = $VAR['_username']; - if(empty($username)) - @$username = $VAR['account_username']; - - ### Get the cookie-string value from Mantis: - $dbm = new db_mapping; - $db = $dbm->DB_connect(false, $this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($this->map['map']) .';' ); - $sql = 'SELECT cookie_string FROM ' . $db_prefix . '_user_table WHERE - username ='.$db->qstr($username); - $result = $db->Execute($sql); - - ### error reporting: - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_logout_add_account_session', $db->ErrorMsg()); - $smarty->assign('db_mapping_result', $db->ErrorMsg()); - return; - } - - # Create/Update the cookie - $string = $result->fields['cookie_string']; - return setcookie($cookie_name, $string, 0, '/'); - } - - ######################################################################## - ### Delete the cookie/session on account logout - ######################################################################## - - function logout($account_id, $cookie_name) - { - return setcookie( $cookie_name, '', -1, '/'); - } - - ######################################################################## - ### Syncronize the groups for a specific account in the remote DB - ######################################################################## - - function account_group_sync($account_id) - { - if ( $this->map['group_type'] == 'db') - { - $db_map = new db_mapping; - $db_map->MAP_account_group_sync_db ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'status') - { - $db_map = new db_mapping; - $db_map->MAP_account_group_sync_status ($account_id, $this); - } - else - { - return false; - } - } -} -?> \ No newline at end of file diff --git a/plugins/db_mapping/PostNuke_726.php b/plugins/db_mapping/PostNuke_726.php deleted file mode 100644 index b36e0dab..00000000 --- a/plugins/db_mapping/PostNuke_726.php +++ /dev/null @@ -1,316 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -################################################################################ -### Database Map for: PostNuke 0.726 -### Last Update: 12-14-2003 -################################################################################ - -class map_POSTNUKE_726 -{ - - ############################################################################ - ### Define the settings for this database map - ############################################################################ - - function map_POSTNUKE_726 () - { - $this->map = - Array ( - 'map' => 'PostNuke_726', - 'db_type' => 'mysql', - 'notes' => 'This is for PostNuke 0.726', - 'group_type' => 'db', // db, status, none - - ### Define the group fields in the target db - 'group_map' => - Array - ( - 'table' => '_groups', - 'id' => 'pn_gid', - 'name' => 'pn_name' - ), - - - ### Define the group-to-account relation fields in the target db - 'group_account_map' => - Array - ( - 'table' => '_group_membership', - 'id' => 'pn_gid', - 'account_id'=> 'pn_uid', - 'group_id' => 'pn_gid' - ), - - - - ### Define the account mapping properties - 'account_map_field' => '_users', - 'account_sync_field'=> - Array - ( - 'add' => 'name,uname,email,pass,theme,last_login', - 'edit' => 'uid,name,uname,email,pass,theme,last_login', - 'import' => 'name,uname,email,pass,theme,last_login', - 'export' => 'name,uname,email,pass,theme,last_login', - 'delete' => '1' - ), - - 'account_fields' => - Array - ( - 'id' => - Array - ( - 'map_field' => 'pn_uid' - ), - 'date_orig' => - Array - ( - 'map_field' => 'pn_user_regdate' - ), - - 'date_last' => - Array - ( - 'map_field' => false - ), - - 'date_expire' => - Array - ( - 'map_field' => false - ), - - 'language_id' => - Array - ( - 'map_field' => false - ), - - 'country_id' => - Array - ( - 'map_field' => false - ), - - 'username' => - Array - ( - 'map_field' => 'pn_uname' - ), - - 'password' => - Array - ( - 'map_field' => 'pn_pass' - ), - - 'misc' => - Array - ( - 'map_field' => false - ), - - 'first_name' => - Array - ( - 'map_field' => 'pn_name' - ), - - 'last_name' => - Array - ( - 'map_field' => false, - ), - - 'middle_name' => - Array - ( - 'map_field' => false - ), - - 'company' => - Array - ( - 'map_field' => false - ), - - 'status' => - Array - ( - 'map_field' => false - ), - - 'email' => - Array - ( - 'map_field' => 'pn_email' - ), - - 'email_type' => - Array - ( - 'map_field' => false - ) - ), - - ### Define any extra fields for account table in the target db: - 'extra_field' => - Array ( - Array - ( - 'name' => 'pn_user_avatar ', - 'value' => 'blank.gif', - 'add' => 1, - 'edit' => 0 - ) - ) - ); - - } - - - - - - ######################################################################## - ### Syncronize all accounts & groups - ######################################################################## - - function sync($id, $file) - { - $db_map = new db_mapping; - $this &= $db_map->MAP_sync ($id, $file, $this); - } - - - - ######################################################################## - ### Create a new account in the target DB - ######################################################################## - - function account_add($account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_add ($account_id, $this); - - ### Sync the groups for this account: - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync( $account_id ); - } - - - - ######################################################################## - ### Edit an existing account in the target DB - ######################################################################## - - function account_edit($account_id, $old_username) - { - $db_map = new db_mapping; - $db_map->MAP_account_edit ($account_id, $old_username, $this); - - ### Update the groups in the remote db - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync($account_id); - } - - - - ######################################################################## - ### Delete an existing account from the target DB - ######################################################################## - - function account_delete($account_id, $username) - { - $db_map = new db_mapping; - $db_map->MAP_account_delete ($account_id, $username, $this); - } - - - - - - - - ######################################################################## - ### Export / Update all accounts / groups to the target DB - ######################################################################## - - function account_import($remote_account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_import ($remote_account_id, $this); - } - - - - - ######################################################################## - ### Create the cookie/session for login sync - ######################################################################## - - function login($account_id) - { - return; - } - - - - - ######################################################################## - ### Delete the cookie/session on account logout - ######################################################################## - - function logout($account_id) - { - return; - } - - - - - ######################################################################## - ### Syncronize the groups for a specific account in the remote DB - ######################################################################## - - function account_group_sync($account_id) - { - if ( $this->map['group_type'] == 'db') - { - $db_map = new db_mapping; - $db_map->MAP_account_group_sync_db ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'status') - { - $db_map = new db_mapping; - $db_map->MAP_account_group_sync_status ($account_id, $this); - } - else - { - return false; - } - } - -} -?> \ No newline at end of file diff --git a/plugins/db_mapping/SMF_101.php b/plugins/db_mapping/SMF_101.php deleted file mode 100644 index 1d85c716..00000000 --- a/plugins/db_mapping/SMF_101.php +++ /dev/null @@ -1,603 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - - -################################################################################ -### Database Map for: SMF 1.0.1 -### Last Update: 2-21-2004 -################################################################################ - -class map_SMF_101 -{ - ############################################################################ - ### Define the settings for this database map - ############################################################################ - - function map_SMF_101 () - { - $this->map = - - Array ( - - 'map' => 'SMF_101', - - 'db_type' => 'mysql', - - 'notes' => 'This is for SMF 1.0.1', - - 'group_type' => 'db-status', // db, status, none - - - - - - - - ### Define the account mapping properties - - 'account_map_field' => 'members', - - 'account_status_field' => 'membergroups', - - 'account_default_status' => 'Newbie', - - - - - - ### Define the group fields in the target db - - 'group_map' => - - Array - - ( - - 'table' => 'membergroups', - - 'id' => 'ID_GROUP', - - 'name' => 'groupName' - - ), - - - - - - 'account_sync_field'=> - - Array - - ( - - 'delete' => '1' - - ), - - - - - - 'account_fields' => - - Array - - ( - - 'id' => - - Array - - ( - - 'map_field' => 'ID_MEMBER' - - ), - - 'date_orig' => - - Array - - ( - - 'map_field' => 'dateRegistered' - - ), - - - - 'date_last' => - - Array - - ( - - 'map_field' => 'lastLogin' - - ), - - - - 'date_expire' => - - Array - - ( - - 'map_field' => false - - ), - - - - 'language_id' => - - Array - - ( - - 'map_field' => false - - ), - - - - 'country_id' => - - Array - - ( - - 'map_field' => false - - ), - - - - 'username' => - - Array - - ( - - 'map_field' => 'memberName' - - ), - - - - 'password' => - - Array - - ( - - 'map_field' => 'passwd' - - ), - - - - 'misc' => - - Array - - ( - - 'map_field' => false - - ), - - - - 'first_name' => - - Array - - ( - - 'map_field' => 'realName', - - ), - - - - 'last_name' => - - Array - - ( - - 'map_field' => false, - - ), - - - - 'middle_name' => - - Array - - ( - - 'map_field' => false - - ), - - - - 'company' => - - Array - - ( - - 'map_field' => false - - ), - - - - 'status' => - - Array - - ( - - 'map_field' => false - - ), - - - - 'email' => - - Array - - ( - - 'map_field' => 'emailAddress' - - ), - - - - 'email_type' => - - Array - - ( - - 'map_field' => false - - ) - - ), - - - - ### Define any extra fields for account table in the target db: - - 'extra_field' => - - Array ( - - Array - - ( - - 'name' => 'lngfile', - - 'value' => 'english', - - 'add' => 1, - - 'edit' => 0 - - ), - - - - Array - - ( - - 'name' => 'hideEmail', - - 'value' => '1', - - 'add' => 1, - - 'edit' => 0 - - ), - - - Array - - ( - - 'name' => 'im_email_notify', - - 'value' => '1', - - 'add' => 1, - - 'edit' => 0 - - ) - - ) - - ); - - - - } - - - - - - - - - - - - ######################################################################## - - ### Syncronize all accounts & groups - - ######################################################################## - - - - function sync($id, $file) - - { - - $db_map = new db_mapping; - - $this = $db_map->MAP_sync ($id, $file, $this); - - } - - - - - - - - ######################################################################## - - ### Create a new account in the target DB - - ######################################################################## - - - - function account_add($account_id) - - { - - $db_map = new db_mapping; - - $db_map->MAP_account_add ($account_id, $this); - - - - ### Sync the groups for this account: - - if( $this->map['group_type'] != 'none' && - - $this->map['group_type'] != 'add_remove' ) - - $this->account_group_sync( $account_id ); - - } - - - - - - - - ######################################################################## - - ### Edit an existing account in the target DB - - ######################################################################## - - - - function account_edit($account_id, $old_username) - - { - - $db_map = new db_mapping; - - $db_map->MAP_account_edit ($account_id, $old_username, $this); - - - - ### Update the groups in the remote db - - if( $this->map['group_type'] != 'none' && - - $this->map['group_type'] != 'add_remove' ) - - $this->account_group_sync($account_id); - - } - - - - - - - - ######################################################################## - - ### Delete an existing account from the target DB - - ######################################################################## - - - - function account_delete($account_id, $username) - - { - - $db_map = new db_mapping; - - $db_map->MAP_account_delete ($account_id, $username, $this); - - } - - - - - - - - ######################################################################## - - ### Export / Update all accounts / groups to the target DB - - ######################################################################## - - - - function account_import($remote_account_id) - - { - - $db_map = new db_mapping; - - $db_map->MAP_account_import ($remote_account_id, $this); - - } - - - - - - - - - - ######################################################################## - - ### Create the cookie/session for login sync - - ######################################################################## - - - - function login($account_id) - - { - - return; - - } - - - - - - ######################################################################## - - ### Delete the cookie/session on account logout - - ######################################################################## - - - - function logout($account_id) - - { - - return; - - } - - - - - - ######################################################################## - - ### Syncronize the groups for a specific account in the remote DB - - ######################################################################## - - - - function account_group_sync($account_id) - - { - - if ( $this->map['group_type'] == 'db') - - { - - $db_map = new db_mapping; - - return $db_map->MAP_account_group_sync_db ($account_id, $this); - - } - - elseif ( $this->map['group_type'] == 'status') - - { - - $db_map = new db_mapping; - - return $db_map->MAP_account_group_sync_status ($account_id, $this); - - } - - elseif ( $this->map['group_type'] == 'db-status') - - { - - $db_map = new db_mapping; - - return $db_map->MAP_account_group_sync_db_status ($account_id, $this); - - } - - else - - { - - return false; - - } - - } - -} - -?> - diff --git a/plugins/db_mapping/SMF_102.php b/plugins/db_mapping/SMF_102.php deleted file mode 100644 index 92f2a737..00000000 --- a/plugins/db_mapping/SMF_102.php +++ /dev/null @@ -1,483 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - - -################################################################################ -### Database Map for: SMF 1.0.2 -### Last Update: 2-21-2004 -################################################################################ -class map_SMF_102 -{ - ############################################################################ - ### Define the settings for this database map - ############################################################################ - - function map_SMF_102 () - - { - - $this->map = - - Array ( - - 'map' => 'SMF_102', - - 'db_type' => 'mysql', - - 'notes' => 'This is for SMF 1.0.2', - - 'group_type' => 'db-status', // db, status, none - - - - - - - - ### Define the account mapping properties - - 'account_map_field' => 'members', - - 'account_status_field' => 'ID_GROUP', - - 'account_default_status' => '4', - - - - - - ### Define the group fields in the target db - - 'group_map' => - Array - ( - 'table' => 'membergroups', - 'id' => 'ID_GROUP', - 'name' => 'groupName' - ), - - - - - - 'account_sync_field'=> - Array - ( - 'delete' => '1' - ), - - - - - - 'account_fields' => - - Array - - ( - - 'id' => - - Array - - ( - - 'map_field' => 'ID_MEMBER' - - ), - - 'date_orig' => - - Array - - ( - - 'map_field' => 'dateRegistered' - - ), - - - - 'date_last' => - - Array - - ( - - 'map_field' => 'lastLogin' - - ), - - - - 'date_expire' => - - Array - - ( - - 'map_field' => false - - ), - - - - 'language_id' => - - Array - - ( - - 'map_field' => false - - ), - - - - 'country_id' => - - Array - - ( - - 'map_field' => false - - ), - - - - 'username' => - - Array - - ( - - 'map_field' => 'memberName' - - ), - - - - 'password' => - - Array - - ( - - 'map_field' => 'passwd' - - ), - - - - 'misc' => - - Array - - ( - - 'map_field' => false - - ), - - - - 'first_name' => - - Array - - ( - - 'map_field' => 'realName', - - ), - - - - 'last_name' => - - Array - - ( - - 'map_field' => false, - - ), - - - - 'middle_name' => - - Array - - ( - - 'map_field' => false - - ), - - - - 'company' => - - Array - - ( - - 'map_field' => false - - ), - - - - 'status' => - - Array - - ( - - 'map_field' => false - - ), - - - - 'email' => - - Array - - ( - - 'map_field' => 'emailAddress' - - ), - - - - 'email_type' => - - Array - - ( - - 'map_field' => false - - ) - - ), - - - - ### Define any extra fields for account table in the target db: - - 'extra_field' => - - Array ( - - Array - - ( - - 'name' => 'lngfile', - - 'value' => 'english', - - 'add' => 1, - - 'edit' => 0 - - ), - - - - Array - - ( - - 'name' => 'hideEmail', - - 'value' => '1', - - 'add' => 1, - - 'edit' => 0 - - ), - - - Array - - ( - - 'name' => 'im_email_notify', - - 'value' => '1', - - 'add' => 1, - - 'edit' => 0 - - ) - - ) - - ); - - - - } - - ######################################################################## - ### Syncronize all accounts & groups - ######################################################################## - function sync($id, $file) { - $db_map = new db_mapping; - $db_map->MAP_sync ($id, $file, $this); - } - - ######################################################################## - ### Create a new account in the target DB - ######################################################################## - function account_add($account_id) { - $db_map_misc = new dbmapping_smf; - $db_map_misc->MAP_account_add ($account_id, $this); - - ### Sync the groups for this account: - $remote_account_id = $this->account_group_sync( $account_id ); - } - - ######################################################################## - ### Edit an existing account in the target DB - ######################################################################## - - function account_edit($account_id, $old_username) { - $db_map_misc = new dbmapping_smf; - $db_map_misc->MAP_account_edit ($account_id, $old_username, $this); - - ### Update the groups in the remote db - $this->account_group_sync($account_id); - } - - ######################################################################## - ### Delete an existing account from the target DB - ######################################################################## - function account_delete($account_id, $username) { - $db_map = new db_mapping; - $db_map->MAP_account_delete ($account_id, $username, $this); - } - - ######################################################################## - ### Export / Update all accounts / groups to the target DB - ######################################################################## - function account_import($remote_account_id) { - $db_map = new db_mapping; - $db_map->MAP_account_import ($remote_account_id, $this); - } - - ######################################################################## - ### Create the cookie/session for login sync - ######################################################################## - function login($account_id) { - return; - } - - ######################################################################## - ### Delete the cookie/session on account logout - ######################################################################## - function logout($account_id) { - return; - } - - ######################################################################## - ### Syncronize the groups for a specific account in the remote DB - ######################################################################## - function account_group_sync($account_id) { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_db_status ($account_id, $this); - } - -} - - -class dbmapping_smf extends db_mapping -{ - ### ADD ACCOUNT - function MAP_account_add ($account_id, $MAP_this) - { - ### Get the account details from AB - $db = &DB(); - $sql= 'SELECT * FROM '.AGILE_DB_PREFIX.'account WHERE id = '.$db->qstr($account_id).' AND site_id = '.$db->qstr(DEFAULT_SITE); - $account = $db->Execute($sql); - unset($db); - - ### Insert the new account into SMF - $dbm = new db_mapping; - $dbm = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = "INSERT INTO {$db_prefix}members SET - dateRegistered = {$account->fields['date_orig']}, - lastLogin = {$account->fields['date_last']}, - passwd = '{$account->fields['password']}', - memberName = ".$dbm->qstr($account->fields['username']).", - realName = ".$dbm->qstr($account->fields['username']).", - emailAddress = ".$dbm->qstr($account->fields['email']).", - lngfile = 'english', - ID_GROUP = '4', - hideEmail = '1', - im_email_notify = '1'"; - $result = $dbm->Execute($sql); - if ($result === false) { - global $C_debug; - $C_debug->error('SMF_102.php','MAP_account_add', $dbm->ErrorMsg()); - return false; - } - } - - - ### EDIT ACCOUNT - function MAP_account_edit($account_id, $old_username, $MAP_this) - { - ### Get the account details from AB - $db = &DB(); - $sql= 'SELECT * FROM '.AGILE_DB_PREFIX.'account WHERE id = '.$db->qstr($account_id).' AND site_id = '.$db->qstr(DEFAULT_SITE); - $account = $db->Execute($sql); - unset($db); - - ### UPDATE the account into SMF - $dbm = new db_mapping; - $dbm = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = "UPDATE {$db_prefix}members SET - passwd = ".$dbm->qstr($account->fields['password']).", - memberName = ".$dbm->qstr($account->fields['username']).", - realName = ".$dbm->qstr($account->fields['username']).", - emailAddress = ".$dbm->qstr($account->fields['email'])." - WHERE - memberName = ".$dbm->qstr( $old_username ); - $result = $dbm->Execute($sql); - if ($result === false) { - global $C_debug; - $C_debug->error('SMF_102.php','MAP_account_edit', $dbm->ErrorMsg()); - return false; - } - } -} - -?> \ No newline at end of file diff --git a/plugins/db_mapping/SendStudio_2004.php b/plugins/db_mapping/SendStudio_2004.php deleted file mode 100644 index 432a5b19..00000000 --- a/plugins/db_mapping/SendStudio_2004.php +++ /dev/null @@ -1,396 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -################################################################################ -### Database Map for: SendStudio 2004 -################################################################################ - -class map_SendStudio_2004 -{ - - ############################################################################ - ### Define the settings for this database map - ############################################################################ - - function map_SendStudio_2004 () - { - $this->map = - Array ( - 'map' => 'SendStudio_2004', - 'db_type' => 'mysql', - 'notes' => 'This is for SendStudio 2004', - 'group_type' => 'status', // db, status, none - - - ### Define the account mapping properties - 'account_map_field' => 'admins', - 'account_status_field' => 'Status', - 'account_default_status' => '0', - - 'account_sync_field'=> - Array - ( - 'delete' => '1' - ), - - 'account_fields' => - Array - ( - 'id' => - Array - ( - 'map_field' => 'AdminID' - ), - 'date_orig' => - Array - ( - 'map_field' => false - ), - - 'date_last' => - Array - ( - 'map_field' => false - ), - - 'date_expire' => - Array - ( - 'map_field' => false - ), - - 'language_id' => - Array - ( - 'map_field' => false - ), - - 'country_id' => - Array - ( - 'map_field' => false - ), - - 'username' => - Array - ( - 'map_field' => 'UserName' - ), - - 'password' => - Array - ( - 'map_field' => 'Password' - ), - - 'misc' => - Array - ( - 'map_field' => false - ), - - 'first_name' => - Array - ( - 'map_field' => 'AdminName' - ), - - 'last_name' => - Array - ( - 'map_field' => false, - ), - - 'middle_name' => - Array - ( - 'map_field' => false - ), - - 'company' => - Array - ( - 'map_field' => false - ), - - 'status' => - Array - ( - 'map_field' => false - ), - - 'email' => - Array - ( - 'map_field' => 'Email' - ), - - 'email_type' => - Array - ( - 'map_field' => false - ) - ), - - ### Define any extra fields for account table in the target db: - 'extra_field' => - Array ( - Array - ( - 'name' => 'Manager', - 'value' => '0', - 'add' => 1, - 'edit' => 0 - ), - Array - ( - 'name' => 'Root', - 'value' => '0', - 'add' => 1, - 'edit' => 0 - ), - Array - ( - 'name' => 'LoginString', - 'value' => '0', - 'add' => 1, - 'edit' => 0 - ), - - Array - ( - 'name' => 'MaxLists', - 'value' => '1', - 'add' => 1, - 'edit' => 0 - ), - Array - ( - 'name' => 'PerHour', - 'value' => '1', - 'add' => 1, - 'edit' => 0, - ), - Array - ( - 'name' => 'PerMonth', - 'value' => '1', - 'add' => 1, - 'edit' => 0, - ), - Array - ( - 'name' => 'DisplaySummaries', - 'value' => '1', - 'add' => 1, - 'edit' => 0, - ), - Array - ( - 'name' => 'Attachments', - 'value' => '1', - 'add' => 1, - 'edit' => 0, - ) - ) - ); - - } - - - - - - ######################################################################## - ### Syncronize all accounts & groups - ######################################################################## - - function sync($id, $file) - { - $db_map = new db_mapping; - $this = $db_map->MAP_sync ($id, $file, $this); - } - - - - ######################################################################## - ### Create a new account in the target DB - ######################################################################## - - function account_add($account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_add ($account_id, $this); - - ### Sync the groups for this account: - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync( $account_id ); - - ### Do the custom stuff: - $custom = new dbmapping_sendstudio_2004; - $custom->MAP_account_add($account_id, $this); - } - - - - ######################################################################## - ### Edit an existing account in the target DB - ######################################################################## - - function account_edit($account_id, $old_username) - { - $db_map = new db_mapping; - $db_map->MAP_account_edit ($account_id, $old_username, $this); - - ### Update the groups in the remote db - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync($account_id); - } - - - - ######################################################################## - ### Delete an existing account from the target DB - ######################################################################## - - function account_delete($account_id, $username) - { - $db_map = new db_mapping; - $db_map->MAP_account_delete ($account_id, $username, $this); - } - - - - ######################################################################## - ### Export / Update all accounts / groups to the target DB - ######################################################################## - - function account_import($remote_account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_import ($remote_account_id, $this); - } - - - - - ######################################################################## - ### Create the cookie/session for login sync - ######################################################################## - - function login($account_id) - { - return; - } - - - ######################################################################## - ### Delete the cookie/session on account logout - ######################################################################## - - function logout($account_id) - { - return; - } - - - ######################################################################## - ### Syncronize the groups for a specific account in the remote DB - ######################################################################## - - function account_group_sync($account_id) - { - if ( $this->map['group_type'] == 'db') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_db ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'status') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_status ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'db-status') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_db_status ($account_id, $this); - } - else - { - return false; - } - } -} - -class dbmapping_sendstudio_2004 -{ - function MAP_account_add ($account_id, $MAP_this) - { - ### Array of SectionIDS for the 'allow_functions' table: - $SectionID = Array(10, 14, 12, 18, 19, 1, 2, 4, 7, 5, 8, 11, 6, 13, 17, 16); - - ### Get the username from the account_id - $db = &DB(); - $sql= 'SELECT username,password FROM '.AGILE_DB_PREFIX.'account WHERE - id = '.$db->qstr($account_id).' AND - site_id = '.$db->qstr(DEFAULT_SITE); - $result = $db->Execute($sql); - if ($result === false) - { - global $C_debug; - $C_debug->error('SendStudio_2004.php','MAP_account_add', $db->ErrorMsg()); - } - unset($db); - $username = $result->fields['username']; - - ### Get the remote account id from the username - $dbm = new db_mapping; - $dbm = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = 'SELECT AdminID FROM ' . $db_prefix . 'admins - WHERE Username = '.$dbm->qstr($username); - $result = $dbm->Execute($sql); - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_login_get_remote_account_id', $dbm->ErrorMsg()); - return false; - } - - $remote_account_id = $result->fields['AdminID']; - - if (!empty($remote_account_id)) - { - - for($i=0; $i 'Support_Logic_111', - - 'db_type' => 'mysql', - - 'notes' => 'This is for Support-Logic 1.1.1', - - 'group_type' => 'none', // db, status, none - - - - - - ### Define the account mapping properties - - 'account_map_field' => 'users', - - - - 'account_sync_field'=> - - Array - - ( - - 'add' => 'username,password,email', - - 'edit' => 'username,password,email', - - 'import' => 'username,password,email', - - 'export' => 'username,password,email', - - 'delete' => '1' - - ), - - - - 'account_fields' => - - Array - - ( - - 'id' => - - Array - - ( - - 'map_field' => 'id', - - ), - - 'date_orig' => - - Array - - ( - - 'map_field' => false - - ), - - - - 'date_last' => - - Array - - ( - - 'map_field' => false - - ), - - - - 'date_expire' => - - Array - - ( - - 'map_field' => false - - ), - - - - 'language_id' => - - Array - - ( - - 'map_field' => false - - ), - - - - 'country_id' => - - Array - - ( - - 'map_field' => false - - ), - - - - 'username' => - - Array - - ( - - 'map_field' => 'username' - - ), - - - - 'password' => - - Array - - ( - - 'map_field' => 'password' - - ), - - - - 'misc' => - - Array - - ( - - 'map_field' => false - - ), - - - - 'first_name' => - - Array - - ( - - 'map_field' => false, - - ), - - - - 'last_name' => - - Array - - ( - - 'map_field' => false, - - ), - - - - 'middle_name' => - - Array - - ( - - 'map_field' => false - - ), - - - - 'company' => - - Array - - ( - - 'map_field' => false - - ), - - - - 'status' => - - Array - - ( - - 'map_field' => false - - ), - - - - 'email' => - - Array - - ( - - 'map_field' => 'email' - - ), - - - - 'email_type' => - - Array - - ( - - 'map_field' => false - - ) - - ), - - - - ### Define any extra fields for account table in the target db: - - 'extra_field' => - - Array ( - - Array - - ( - - 'name' => 'language', - - 'value' => 'en', - - 'add' => 1, - - 'edit' => 0 - - ), - - - - Array - - ( - - 'name' => 'get_email', - - 'value' => 'yes', - - 'add' => 1, - - 'edit' => 0 - - ) - - ) - ); - - - - } - - - - - - - - - - - - ######################################################################## - - ### Syncronize all accounts & groups - - ######################################################################## - - - - function sync($id, $file) - - { - - $db_map = new db_mapping; - - $this = $db_map->MAP_sync ($id, $file, $this); - - } - - - - - - - - ######################################################################## - - ### Create a new account in the target DB - - ######################################################################## - - - - function account_add($account_id) - - { - - $db_map = new db_mapping; - - $db_map->MAP_account_add ($account_id, $this); - - - - ### Sync the groups for this account: - - if( $this->map['group_type'] != 'none' && - - $this->map['group_type'] != 'add_remove' ) - - $this->account_group_sync( $account_id ); - - } - - - - - - - - ######################################################################## - - ### Edit an existing account in the target DB - - ######################################################################## - - - - function account_edit($account_id, $old_username) - - { - - $db_map = new db_mapping; - - $db_map->MAP_account_edit ($account_id, $old_username, $this); - - - - ### Update the groups in the remote db - - if( $this->map['group_type'] != 'none' && - - $this->map['group_type'] != 'add_remove' ) - - $this->account_group_sync($account_id); - - } - - - - - - - - ######################################################################## - - ### Delete an existing account from the target DB - - ######################################################################## - - - - function account_delete($account_id, $username) - - { - - $db_map = new db_mapping; - - $db_map->MAP_account_delete ($account_id, $username, $this); - - } - - - - - - - - ######################################################################## - - ### Export / Update all accounts / groups to the target DB - - ######################################################################## - - ### Importing of accounts is disabled. Uncomment the below 2 lines - ### to allow account importing. The reason is because if email piping - ### is turned on then you'll get a ton of accounts imported with usernames - ### as the email etc etc. - - - function account_import($remote_account_id) - - { - - ##$db_map = new db_mapping; - - ##$db_map->MAP_account_import ($remote_account_id, $this); - - } - - - - - - - - - - ######################################################################## - - ### Create the cookie/session for login sync - - ######################################################################## - - - - function login($account_id) - - { - - return; - - } - - - - - - ######################################################################## - - ### Delete the cookie/session on account logout - - ######################################################################## - - - - function logout($account_id) - - { - - return; - - } - - - - - - ######################################################################## - - ### Syncronize the groups for a specific account in the remote DB - - ######################################################################## - - - - function account_group_sync($account_id) - - { - - if ( $this->map['group_type'] == 'db') - - { - - $db_map = new db_mapping; - - return $db_map->MAP_account_group_sync_db ($account_id, $this); - - } - - elseif ( $this->map['group_type'] == 'status') - - { - - $db_map = new db_mapping; - - return $db_map->MAP_account_group_sync_status ($account_id, $this); - - } - - elseif ( $this->map['group_type'] == 'db-status') - - { - - $db_map = new db_mapping; - - return $db_map->MAP_account_group_sync_db_status ($account_id, $this); - - } - - else - - { - - return false; - - } - - } - -} - -?> - diff --git a/plugins/db_mapping/WowBB_162.php b/plugins/db_mapping/WowBB_162.php deleted file mode 100644 index c40f56d2..00000000 --- a/plugins/db_mapping/WowBB_162.php +++ /dev/null @@ -1,350 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -################################################################################ -### Database Map for: WowBB 162 -### Last Update: 4-5-2003 -################################################################################ - -class map_WOWBB_162 -{ - - ############################################################################ - ### Define the settings for this database map - ############################################################################ - - function map_WOWBB_162 () - { - - $this->map = - Array ( - 'map' => 'WowBB_162', - 'db_type' => 'mysql', - 'notes' => 'This is for WowBB 162', - 'group_type' => 'db-status', // db, db-status, status, none - - ### Define the account mapping properties - 'account_map_field' => 'users', - 'account_status_field' => 'user_group_id', - 'account_default_status' => '1', - - ### Define the group fields in the target db - 'group_map' => - Array - ( - 'table' => 'user_groups', - 'id' => 'user_group_id', - 'name' => 'user_group_name' - ), - - 'account_sync_field'=> - Array - ( - 'delete' => '1' - ), - - 'account_fields' => - Array - ( - - 'id' => - Array - ( - 'map_field' => 'user_id', - 'unique' => true - ), - 'date_orig' => - Array - ( - 'map_field' => false - ), - - 'date_last' => - Array - ( - 'map_field' => false - ), - - 'date_expire' => - Array - ( - 'map_field' => false - ), - - 'language_id' => - Array - ( - 'map_field' => false - ), - - 'country_id' => - Array - ( - 'map_field' => false - ), - - 'username' => - Array - ( - 'map_field' => 'user_name' - ), - - 'password' => - Array - ( - 'map_field' => 'user_password' - ), - - 'misc' => - Array - ( - 'map_field' => false - ), - - 'first_name' => - Array - ( - 'map_field' => false, - ), - - 'last_name' => - Array - ( - 'map_field' => false, - ), - - 'middle_name' => - Array - ( - 'map_field' => false - ), - - 'company' => - Array - ( - 'map_field' => false - ), - - 'status' => - Array - ( - 'map_field' => false - ), - - 'email' => - Array - ( - 'map_field' => 'user_email' - ), - - 'email_type' => - Array - ( - 'map_field' => false - ) - ), - - ### Define any extra fields for account table in the target db: - 'extra_field' => - Array ( - - Array - ( - 'name' => 'user_topic_notification', - 'value' => 1, - 'add' => 1, - 'edit' => 0 - ), - Array - ( - 'name' => 'user_pm_notification', - 'value' => 1, - 'add' => 1, - 'edit' => 0 - ), - Array - ( - 'name' => 'user_enable_pm', - 'value' => 1, - 'add' => 1, - 'edit' => 0 - ), - Array - ( - 'name' => 'user_invisible', - 'value' => 0, - 'add' => 1, - 'edit' => 0 - ), - Array - ( - 'name' => 'user_unread_pm', - 'value' => 0, - 'add' => 1, - 'edit' => 0 - ), - Array - ( - 'name' => 'user_admin_emails', - 'value' => 1, - 'add' => 1, - 'edit' => 0 - ), - Array - ( - 'name' => 'user_forum_digest', - 'value' => 1, - 'add' => 1, - 'edit' => 0 - ), - Array - ( - 'name' => 'user_joined', - 'value' => strftime('%Y-%m-%d %H:%M:%S'), - 'add' => 1, - 'edit' => 0 - ) - ) - ); - } - - - - - - ######################################################################## - ### Syncronize all accounts & groups - ######################################################################## - - function sync($id, $file) - { - $db_map = new db_mapping; - $this = $db_map->MAP_sync ($id, $file, $this); - } - - - - ######################################################################## - ### Create a new account in the target DB - ######################################################################## - - function account_add($account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_add ($account_id, $this); - - ### Sync the groups for this account: - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync( $account_id ); - } - - - - ######################################################################## - ### Edit an existing account in the target DB - ######################################################################## - - function account_edit($account_id, $old_username) - { - $db_map = new db_mapping; - $db_map->MAP_account_edit ($account_id, $old_username, $this); - - ### Update the groups in the remote db - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync($account_id); - } - - - - ######################################################################## - ### Delete an existing account from the target DB - ######################################################################## - - function account_delete($account_id, $username) - { - $db_map = new db_mapping; - $db_map->MAP_account_delete ($account_id, $username, $this); - } - - - - ######################################################################## - ### Export / Update all accounts / groups to the target DB - ######################################################################## - - function account_import($remote_account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_import ($remote_account_id, $this); - } - - - - - ######################################################################## - ### Create the cookie/session for login sync - ######################################################################## - - function login($account_id) - { - return; - } - - - ######################################################################## - ### Delete the cookie/session on account logout - ######################################################################## - - function logout($account_id) - { - return; - } - - - ######################################################################## - ### Syncronize the groups for a specific account in the remote DB - ######################################################################## - - function account_group_sync($account_id) - { - if ( $this->map['group_type'] == 'db') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_db ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'status') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_status ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'db-status') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_db_status ($account_id, $this); - } - else - { - return false; - } - } -} -?> \ No newline at end of file diff --git a/plugins/db_mapping/XMB_Forums_19.php b/plugins/db_mapping/XMB_Forums_19.php deleted file mode 100644 index b390d006..00000000 --- a/plugins/db_mapping/XMB_Forums_19.php +++ /dev/null @@ -1,299 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -################################################################################ -### Database Map for: Mantis 0.18.rc1 -### Last Update: 12-11-2003 -################################################################################ - - -class map_XMB_FORUMS_19 -{ - ############################################################################ - ### Define the settings for this database map - ############################################################################ - - function map_XMB_FORUMS_19 () - { - $this->map = - Array ( - 'map' => 'XMB_Forums_19', - 'db_type' => 'mysql', - 'notes' => 'This is for XMB Forums 1.9', - 'group_type' => 'none', // db, status, none - - - ### Define the account mapping properties - 'account_map_field' => 'members', - - 'account_sync_field'=> - Array - ( - 'delete' => '1' - ), - - 'account_fields' => - Array - ( - 'id' => - Array - ( - 'map_field' => 'uid' - ), - 'date_orig' => - Array - ( - 'map_field' => 'regdate' - ), - - 'date_last' => - Array - ( - 'map_field' => false - ), - - 'date_expire' => - Array - ( - 'map_field' => false - ), - - 'language_id' => - Array - ( - 'map_field' => false - ), - - 'country_id' => - Array - ( - 'map_field' => false - ), - - 'username' => - Array - ( - 'map_field' => 'username' - ), - - 'password' => - Array - ( - 'map_field' => 'password' - ), - - 'misc' => - Array - ( - 'map_field' => false - ), - - 'first_name' => - Array - ( - 'map_field' => false, - ), - - 'last_name' => - Array - ( - 'map_field' => false, - ), - - 'middle_name' => - Array - ( - 'map_field' => false - ), - - 'company' => - Array - ( - 'map_field' => false - ), - - 'status' => - Array - ( - 'map_field' => false - ), - - 'email' => - Array - ( - 'map_field' => 'email' - ), - - 'email_type' => - Array - ( - 'map_field' => false - ) - ), - - ### Define any extra fields for account table in the target db: - 'extra_field' => - Array ( - Array - ( - 'name' => 'status', - 'value' => 'Member', - 'add' => 1, - 'edit' => 0 - ), - - Array - ( - 'name' => 'showemail', - 'value' => 'no', - 'add' => 1, - 'edit' => 0 - ), - - Array - ( - 'name' => 'langfile', - 'value' => 'English', - 'add' => 1, - 'edit' => 0 - ) - ) - ); - - } - - - - - - ######################################################################## - ### Syncronize all accounts & groups - ######################################################################## - - function sync($id, $file) - { - $db_map = new db_mapping; - $this = $db_map->MAP_sync ($id, $file, $this); - } - - - - ######################################################################## - ### Create a new account in the target DB - ######################################################################## - - function account_add($account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_add ($account_id, $this); - - ### Sync the groups for this account: - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync( $account_id ); - } - - - - ######################################################################## - ### Edit an existing account in the target DB - ######################################################################## - - function account_edit($account_id, $old_username) - { - $db_map = new db_mapping; - $db_map->MAP_account_edit ($account_id, $old_username, $this); - - ### Update the groups in the remote db - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync($account_id); - } - - - - ######################################################################## - ### Delete an existing account from the target DB - ######################################################################## - - function account_delete($account_id, $username) - { - $db_map = new db_mapping; - $db_map->MAP_account_delete ($account_id, $username, $this); - } - - - - ######################################################################## - ### Export / Update all accounts / groups to the target DB - ######################################################################## - - function account_import($remote_account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_import ($remote_account_id, $this); - } - - - - - ######################################################################## - ### Create the cookie/session for login sync - ######################################################################## - - function login($account_id) - { - return; - } - - - ######################################################################## - ### Delete the cookie/session on account logout - ######################################################################## - - function logout($account_id) - { - return; - } - - - ######################################################################## - ### Syncronize the groups for a specific account in the remote DB - ######################################################################## - - function account_group_sync($account_id) - { - if ( $this->map['group_type'] == 'db') - { - $db_map = new db_mapping; - $db_map->MAP_account_group_sync_db ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'status') - { - $db_map = new db_mapping; - $db_map->MAP_account_group_sync_status ($account_id, $this); - } - else - { - return false; - } - } -} -?> diff --git a/plugins/db_mapping/Xaraya_914.php b/plugins/db_mapping/Xaraya_914.php deleted file mode 100644 index 889d48f4..00000000 --- a/plugins/db_mapping/Xaraya_914.php +++ /dev/null @@ -1,349 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -################################################################################ -### Database Map for: Xaraya 0.9.1.4 -### Last Update: 12-14-2003 -################################################################################ - - -class map_XARAYA_914 -{ - - ############################################################################ - ### Define the settings for this database map - ############################################################################ - - function map_XARAYA_914 () - { - $this->map = - Array ( - 'map' => 'Xaraya_914', - 'db_type' => 'mysql', - 'notes' => 'This is for Xaraya 0.9.1.4', - 'group_type' => 'db', // db, status, none - - ### Define the group fields in the target db - 'group_map' => - Array - ( - 'table' => '_privileges', - 'id' => 'xar_pid', - 'name' => 'xar_name' - ), - - - ### Define the group-to-account relation fields in the target db - 'group_account_map' => - Array - ( - 'table' => '_role_members', - 'id' => 'xar_uid', - 'account_id'=> 'xar_uid', - 'group_id' => 'xar_parentid' - ), - - - - ### Define the account mapping properties - 'account_map_field' => '_roles', - 'account_sync_field'=> - Array - ( - 'add' => 'name,uname,email,pass,theme,last_login', - 'edit' => 'uid,name,uname,email,pass,theme,last_login', - 'import' => 'name,uname,email,pass,theme,last_login', - 'export' => 'name,uname,email,pass,theme,last_login', - 'delete' => '1' - ), - - 'account_fields' => - Array - ( - 'id' => - Array - ( - 'map_field' => 'xar_uid' - ), - 'date_orig' => - Array - ( - 'map_field' => false - ), - - 'date_last' => - Array - ( - 'map_field' => 'xar_date_reg' - ), - - 'date_expire' => - Array - ( - 'map_field' => false - ), - - 'language_id' => - Array - ( - 'map_field' => false - ), - - 'country_id' => - Array - ( - 'map_field' => false - ), - - 'username' => - Array - ( - 'map_field' => 'xar_uname' - ), - - 'password' => - Array - ( - 'map_field' => 'xar_pass' - ), - - 'misc' => - Array - ( - 'map_field' => false - ), - - 'first_name' => - Array - ( - 'map_field' => 'xar_name' - ), - - 'last_name' => - Array - ( - 'map_field' => false, - ), - - 'middle_name' => - Array - ( - 'map_field' => false - ), - - 'company' => - Array - ( - 'map_field' => false - ), - - 'status' => - Array - ( - 'map_field' => false - ), - - 'email' => - Array - ( - 'map_field' => 'xar_email' - ), - - 'email_type' => - Array - ( - 'map_field' => false - ) - ), - - ### Define any extra fields for account table in the target db: - 'extra_field' => - Array ( - Array - ( - 'name' => 'xar_type', - 'value' => '0', - 'add' => 1, - 'edit' => 0 - ), - - Array - ( - 'name' => 'xar_users', - 'value' => '0', - 'add' => 1, - 'edit' => 0 - ), - - Array - ( - 'name' => 'xar_valcode', - 'value' => 'createdbyagile', - 'add' => 1, - 'edit' => 0 - ), - - Array - ( - 'name' => 'xar_state', - 'value' => '3', - 'add' => 1, - 'edit' => 0 - ), - - Array - ( - 'name' => 'xar_auth_module', - 'value' => 'authsystem', - 'add' => 1, - 'edit' => 0 - ) - ) - ); - - } - - - - - - ######################################################################## - ### Syncronize all accounts & groups - ######################################################################## - - function sync($id, $file) - { - $db_map = new db_mapping; - $this = $db_map->MAP_sync ($id, $file, $this); - } - - - - ######################################################################## - ### Create a new account in the target DB - ######################################################################## - - function account_add($account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_add ($account_id, $this); - - ### Sync the groups for this account: - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync( $account_id ); - } - - - - ######################################################################## - ### Edit an existing account in the target DB - ######################################################################## - - function account_edit($account_id, $old_username) - { - $db_map = new db_mapping; - $db_map->MAP_account_edit ($account_id, $old_username, $this); - - ### Update the groups in the remote db - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync($account_id); - } - - - - ######################################################################## - ### Delete an existing account from the target DB - ######################################################################## - - function account_delete($account_id, $username) - { - $db_map = new db_mapping; - $db_map->MAP_account_delete ($account_id, $username, $this); - } - - - - - - - - ######################################################################## - ### Export / Update all accounts / groups to the target DB - ######################################################################## - - function account_import($remote_account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_import ($remote_account_id, $this); - } - - - - - ######################################################################## - ### Create the cookie/session for login sync - ######################################################################## - - function login($account_id) - { - return; - } - - - - - ######################################################################## - ### Delete the cookie/session on account logout - ######################################################################## - - function logout($account_id) - { - return; - } - - - - - ######################################################################## - ### Syncronize the groups for a specific account in the remote DB - ######################################################################## - - function account_group_sync($account_id) - { - if ( $this->map['group_type'] == 'db') - { - $db_map = new db_mapping; - $db_map->MAP_account_group_sync_db ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'status') - { - $db_map = new db_mapping; - $db_map->MAP_account_group_sync_status ($account_id, $this); - } - else - { - return false; - } - } - -} -?> diff --git a/plugins/db_mapping/Xoops_2.php b/plugins/db_mapping/Xoops_2.php deleted file mode 100644 index ebb8129d..00000000 --- a/plugins/db_mapping/Xoops_2.php +++ /dev/null @@ -1,318 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -################################################################################ -### Database Map for: Xoops 2 -### Last Update: 12-10-2003 -################################################################################ - - -class map_XOOPS_2 -{ - - ############################################################################ - ### Define the settings for this database map - ############################################################################ - - function map_XOOPS_2 () - { - $this->map = - Array ( - 'map' => 'Xoops_2', - 'db_type' => 'mysql', - 'notes' => 'This is for Xoops 2', - 'group_type' => 'db', // db, status, none - - ### Define the group fields in the target db - 'group_map' => - Array - ( - 'table' => '_groups', - 'id' => 'groupid', - 'name' => 'name' - ), - - - ### Define the group-to-account relation fields in the target db - 'group_account_map' => - Array - ( - 'table' => '_groups_users_link', - 'id' => 'linkid', - 'account_id'=> 'uid', - 'group_id' => 'groupid' - ), - - - - ### Define the account mapping properties - 'account_map_field' => '_users', - 'account_sync_field'=> - Array - ( - 'add' => 'name,uname,email,pass,theme,last_login', - 'edit' => 'uid,name,uname,email,pass,theme,last_login', - 'import' => 'name,uname,email,pass,theme,last_login', - 'export' => 'name,uname,email,pass,theme,last_login', - 'delete' => '1' - ), - - 'account_fields' => - Array - ( - 'id' => - Array - ( - 'map_field' => 'uid' - ), - 'date_orig' => - Array - ( - 'map_field' => false - ), - - 'date_last' => - Array - ( - 'map_field' => 'last_login' - ), - - 'date_expire' => - Array - ( - 'map_field' => false - ), - - 'language_id' => - Array - ( - 'map_field' => false - ), - - 'country_id' => - Array - ( - 'map_field' => false - ), - - 'username' => - Array - ( - 'map_field' => 'uname' - ), - - 'password' => - Array - ( - 'map_field' => 'pass' - ), - - 'misc' => - Array - ( - 'map_field' => false - ), - - 'first_name' => - Array - ( - 'map_field' => 'name', - 'convert_export' => '%%first_name%% %%last_name%%' - ), - - 'last_name' => - Array - ( - 'map_field' => false, - ), - - 'middle_name' => - Array - ( - 'map_field' => false - ), - - 'company' => - Array - ( - 'map_field' => false - ), - - 'status' => - Array - ( - 'map_field' => false - ), - - 'email' => - Array - ( - 'map_field' => 'email' - ), - - 'email_type' => - Array - ( - 'map_field' => false - ) - ), - - ### Define any extra fields for account table in the target db: - 'extra_field' => - Array ( - Array - ( - 'name' => 'theme', - 'value' => 'default', - 'add' => 1, - 'edit' => 0 - ) - ) - ); - - } - - - - - - ######################################################################## - ### Syncronize all accounts & groups - ######################################################################## - - function sync($id, $file) - { - $db_map = new db_mapping; - $db_map->MAP_sync ($id, $file, $this); - } - - - - ######################################################################## - ### Create a new account in the target DB - ######################################################################## - - function account_add($account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_add ($account_id, $this); - - ### Sync the groups for this account: - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync( $account_id ); - } - - - - ######################################################################## - ### Edit an existing account in the target DB - ######################################################################## - - function account_edit($account_id, $old_username) - { - $db_map = new db_mapping; - $db_map->MAP_account_edit ($account_id, $old_username, $this); - - ### Update the groups in the remote db - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync($account_id); - } - - - - ######################################################################## - ### Delete an existing account from the target DB - ######################################################################## - - function account_delete($account_id, $username) - { - $db_map = new db_mapping; - $db_map->MAP_account_delete ($account_id, $username, $this); - } - - - - - - - - ######################################################################## - ### Export / Update all accounts / groups to the target DB - ######################################################################## - - function account_import($remote_account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_import ($remote_account_id, $this); - } - - - - - ######################################################################## - ### Create the cookie/session for login sync - ######################################################################## - - function login($account_id) - { - return; - } - - - - - ######################################################################## - ### Delete the cookie/session on account logout - ######################################################################## - - function logout($account_id) - { - return; - } - - - - - ######################################################################## - ### Syncronize the groups for a specific account in the remote DB - ######################################################################## - - function account_group_sync($account_id) - { - if ( $this->map['group_type'] == 'db') - { - $db_map = new db_mapping; - $db_map->MAP_account_group_sync_db ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'status') - { - $db_map = new db_mapping; - $db_map->MAP_account_group_sync_status ($account_id, $this); - } - else - { - return false; - } - } - -} -?> diff --git a/plugins/db_mapping/YabbSe_151.php b/plugins/db_mapping/YabbSe_151.php deleted file mode 100644 index 70575a4e..00000000 --- a/plugins/db_mapping/YabbSe_151.php +++ /dev/null @@ -1,295 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -################################################################################ -### Database Map for: YabbSE 1.5.1 -### Last Update: 12-10-2003 -################################################################################ - - -class map_YABBSE_151 -{ - - ############################################################################ - ### Define the settings for this database map - ############################################################################ - - function map_YABBSE_151 () - { - $this->map = - Array ( - 'map' => 'YabbSe_151', - 'db_type' => 'mysql', - 'notes' => 'This is for YabbSE 1.5.1', - 'group_type' => 'db-status', // db, status, none - - - - ### Define the account mapping properties - 'account_map_field' => 'members', - 'account_status_field' => 'memberGroup', - 'account_default_status' => 'Newbie', - - - ### Define the group fields in the target db - 'group_map' => - Array - ( - 'table' => 'membergroups', - 'id' => 'membergroup', - 'name' => 'membergroup' - ), - - - 'account_sync_field'=> - Array - ( - 'delete' => '1' - ), - - - 'account_fields' => - Array - ( - 'id' => - Array - ( - 'map_field' => 'ID_MEMBER' - ), - 'date_orig' => - Array - ( - 'map_field' => 'dateRegistered' - ), - - 'date_last' => - Array - ( - 'map_field' => 'lastLogin' - ), - - 'date_expire' => - Array - ( - 'map_field' => false - ), - - 'language_id' => - Array - ( - 'map_field' => false - ), - - 'country_id' => - Array - ( - 'map_field' => false - ), - - 'username' => - Array - ( - 'map_field' => 'memberName' - ), - - 'password' => - Array - ( - 'map_field' => 'passwd' - ), - - 'misc' => - Array - ( - 'map_field' => false - ), - - 'first_name' => - Array - ( - 'map_field' => 'realName', - ), - - 'last_name' => - Array - ( - 'map_field' => false, - ), - - 'middle_name' => - Array - ( - 'map_field' => false - ), - - 'company' => - Array - ( - 'map_field' => false - ), - - 'status' => - Array - ( - 'map_field' => false - ), - - 'email' => - Array - ( - 'map_field' => 'emailAddress' - ), - - 'email_type' => - Array - ( - 'map_field' => false - ) - ), - - ### Define any extra fields for account table in the target db: - 'extra_field' => false - ); - - } - - - - - - ######################################################################## - ### Syncronize all accounts & groups - ######################################################################## - - function sync($id, $file) - { - $db_map = new db_mapping; - $this = $db_map->MAP_sync ($id, $file, $this); - } - - - - ######################################################################## - ### Create a new account in the target DB - ######################################################################## - - function account_add($account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_add ($account_id, $this); - - ### Sync the groups for this account: - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync( $account_id ); - } - - - - ######################################################################## - ### Edit an existing account in the target DB - ######################################################################## - - function account_edit($account_id, $old_username) - { - $db_map = new db_mapping; - $db_map->MAP_account_edit ($account_id, $old_username, $this); - - ### Update the groups in the remote db - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync($account_id); - } - - - - ######################################################################## - ### Delete an existing account from the target DB - ######################################################################## - - function account_delete($account_id, $username) - { - $db_map = new db_mapping; - $db_map->MAP_account_delete ($account_id, $username, $this); - } - - - - ######################################################################## - ### Export / Update all accounts / groups to the target DB - ######################################################################## - - function account_import($remote_account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_import ($remote_account_id, $this); - } - - - - - ######################################################################## - ### Create the cookie/session for login sync - ######################################################################## - - function login($account_id) - { - return; - } - - - ######################################################################## - ### Delete the cookie/session on account logout - ######################################################################## - - function logout($account_id) - { - return; - } - - - ######################################################################## - ### Syncronize the groups for a specific account in the remote DB - ######################################################################## - - function account_group_sync($account_id) - { - if ( $this->map['group_type'] == 'db') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_db ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'status') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_status ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'db-status') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_db_status ($account_id, $this); - } - else - { - return false; - } - } -} -?> diff --git a/plugins/db_mapping/miniBB_17.php b/plugins/db_mapping/miniBB_17.php deleted file mode 100644 index a8e5c447..00000000 --- a/plugins/db_mapping/miniBB_17.php +++ /dev/null @@ -1,284 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -################################################################################ -### Database Map for: miniBB 1.7 -### Last Update: 12-16-2003 -################################################################################ - - -class map_MINIBB_17 -{ - - ############################################################################ - ### Define the settings for this database map - ############################################################################ - - function map_MINIBB_17 () - { - $this->map = - Array ( - 'map' => 'miniBB_17', - 'db_type' => 'mysql', - 'notes' => 'This is for miniBB 1.7', - 'group_type' => 'none', // db, status, none - - - ### Define the account mapping properties - 'account_map_field' => 'minibb_users', - - 'account_sync_field'=> - Array - ( - 'add' => 'username,email,password,enabled,protected,access_level', - 'edit' => 'username,email,password,enabled,protected,access_level', - 'import' => 'username,email,password,enabled,protected,access_level', - 'export' => 'username,email,password,enabled,protected,access_level', - 'delete' => '1' - ), - - 'account_fields' => - Array - ( - 'id' => - Array - ( - 'map_field' => 'user_id', - ), - 'date_orig' => - Array - ( - 'map_field' => false - ), - - 'date_last' => - Array - ( - 'map_field' => false - ), - - 'date_expire' => - Array - ( - 'map_field' => false - ), - - 'language_id' => - Array - ( - 'map_field' => false - ), - - 'country_id' => - Array - ( - 'map_field' => false - ), - - 'username' => - Array - ( - 'map_field' => 'username' - ), - - 'password' => - Array - ( - 'map_field' => 'user_password' - ), - - 'misc' => - Array - ( - 'map_field' => false - ), - - 'first_name' => - Array - ( - 'map_field' => false, - ), - - 'last_name' => - Array - ( - 'map_field' => false, - ), - - 'middle_name' => - Array - ( - 'map_field' => false - ), - - 'company' => - Array - ( - 'map_field' => false - ), - - 'status' => - Array - ( - 'map_field' => false - ), - - 'email' => - Array - ( - 'map_field' => 'user_email' - ), - - 'email_type' => - Array - ( - 'map_field' => false - ) - ), - - ### Define any extra fields for account table in the target db: - 'extra_field' => false - ); - - } - - - - - - ######################################################################## - ### Syncronize all accounts & groups - ######################################################################## - - function sync($id, $file) - { - $db_map = new db_mapping; - $this = $db_map->MAP_sync ($id, $file, $this); - } - - - - ######################################################################## - ### Create a new account in the target DB - ######################################################################## - - function account_add($account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_add ($account_id, $this); - - ### Sync the groups for this account: - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync( $account_id ); - } - - - - ######################################################################## - ### Edit an existing account in the target DB - ######################################################################## - - function account_edit($account_id, $old_username) - { - $db_map = new db_mapping; - $db_map->MAP_account_edit ($account_id, $old_username, $this); - - ### Update the groups in the remote db - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync($account_id); - } - - - - ######################################################################## - ### Delete an existing account from the target DB - ######################################################################## - - function account_delete($account_id, $username) - { - $db_map = new db_mapping; - $db_map->MAP_account_delete ($account_id, $username, $this); - } - - - - ######################################################################## - ### Export / Update all accounts / groups to the target DB - ######################################################################## - - function account_import($remote_account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_import ($remote_account_id, $this); - } - - - - - ######################################################################## - ### Create the cookie/session for login sync - ######################################################################## - - function login($account_id) - { - return; - } - - - ######################################################################## - ### Delete the cookie/session on account logout - ######################################################################## - - function logout($account_id) - { - return; - } - - - ######################################################################## - ### Syncronize the groups for a specific account in the remote DB - ######################################################################## - - function account_group_sync($account_id) - { - if ( $this->map['group_type'] == 'db') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_db ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'status') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_status ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'db-status') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_db_status ($account_id, $this); - } - else - { - return false; - } - } -} -?> diff --git a/plugins/db_mapping/osCommerce_22.php b/plugins/db_mapping/osCommerce_22.php deleted file mode 100644 index 2ab394d3..00000000 --- a/plugins/db_mapping/osCommerce_22.php +++ /dev/null @@ -1,303 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -################################################################################ -### Database Map for: osCommerce 2.2ms2 -### Last Update: 12-16-2003 -################################################################################ - - -class map_OSCOMMERCE_22 -{ - - ############################################################################ - ### Define the settings for this database map - ############################################################################ - - function map_OSCOMMERCE_22 () - { - $this->map = - Array ( - 'map' => 'osCommerce_22', - 'db_type' => 'mysql', - 'notes' => 'This is for osCommerce 2.2ms2', - 'group_type' => 'none', - 'install' => true, - - - ### Define the account mapping properties - 'account_map_field' => 'customers', - - - 'account_fields' => - Array - ( - 'id' => - Array - ( - 'map_field' => 'customers_id', - ), - 'date_orig' => - Array - ( - 'map_field' => false - ), - - 'date_last' => - Array - ( - 'map_field' => false - ), - - 'date_expire' => - Array - ( - 'map_field' => false - ), - - 'language_id' => - Array - ( - 'map_field' => false - ), - - 'country_id' => - Array - ( - 'map_field' => false - ), - - 'username' => - Array - ( - 'map_field' => 'customers_username' - ), - - 'password' => - Array - ( - 'map_field' => 'customers_password' - ), - - 'misc' => - Array - ( - 'map_field' => false - ), - - 'first_name' => - Array - ( - 'map_field' => 'customers_firstname', - ), - - 'last_name' => - Array - ( - 'map_field' => 'customers_lastname', - ), - - 'middle_name' => - Array - ( - 'map_field' => false - ), - - 'company' => - Array - ( - 'map_field' => false - ), - - 'status' => - Array - ( - 'map_field' => false - ), - - 'email' => - Array - ( - 'map_field' => 'customers_email_address' - ), - - 'email_type' => - Array - ( - 'map_field' => false - ) - ), - - ### Define any extra fields for account table in the target db: - 'extra_field' => false - ); - - } - - - ######################################################################## - ### Install syncronization - ######################################################################## - - function install() - { - - ### Add the 'customers_username' field: - $dbm = new db_mapping; - $db = $dbm->DB_connect(false, $this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($this->map['map']) .';' ); - $sql = "ALTER TABLE customers ADD customers_username VARCHAR( 128 ) NOT NULL"; - $result = $db->Execute($sql); - - ### move the customer's email to the username field... - $sql = "SELECT customers_id, customers_email_address FROM customers"; - $result = $db->Execute($sql); - while ( !$result->EOF ) - { - $sql = 'UPDATE customers SET - customers_username = ' . $db->qstr($result->fields['customers_email_address']) . ' - WHERE customers_id = ' . $db->qstr($result->fields['customers_id']); - $update = $db->Execute($sql); - $result->MoveNext(); - } - } - - - ######################################################################## - ### Syncronize all accounts & groups - ######################################################################## - - function sync($id, $file) - { - $db_map = new db_mapping; - $db_map->MAP_sync ($id, $file, $this); - } - - - - ######################################################################## - ### Create a new account in the target DB - ######################################################################## - - function account_add($account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_add ($account_id, $this); - - ### todo: add the customers_info record - ### todo: add the address_book_id record - } - - - - ######################################################################## - ### Edit an existing account in the target DB - ######################################################################## - - function account_edit($account_id, $old_username) - { - $db_map = new db_mapping; - $db_map->MAP_account_edit ($account_id, $old_username, $this); - - ### Update the groups in the remote db - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync($account_id); - } - - - - ######################################################################## - ### Delete an existing account from the target DB - ######################################################################## - - function account_delete($account_id, $username) - { - $db_map = new db_mapping; - $db_map->MAP_account_delete ($account_id, $username, $this); - } - - - - ######################################################################## - ### Export / Update all accounts / groups to the target DB - ######################################################################## - - function account_import($remote_account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_import ($remote_account_id, $this); - } - - - - - ######################################################################## - ### Create the cookie/session for login sync - ######################################################################## - - function login($account_id) - { - return; - } - - - ######################################################################## - ### Delete the cookie/session on account logout - ######################################################################## - - function logout($account_id) - { - return; - } - - - ######################################################################## - ### Syncronize the groups for a specific account in the remote DB - ######################################################################## - - function account_group_sync($account_id) - { - if ( $this->map['group_type'] == 'db') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_db ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'status') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_status ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'db-status') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_db_status ($account_id, $this); - } - else - { - return false; - } - } -} - - - - -?> diff --git a/plugins/db_mapping/osCommerce_22/notes.txt b/plugins/db_mapping/osCommerce_22/notes.txt deleted file mode 100644 index d806eb8c..00000000 --- a/plugins/db_mapping/osCommerce_22/notes.txt +++ /dev/null @@ -1,4 +0,0 @@ -NOTES: - -Copy the password_funcs.php file to your /catalog/includes/ directory over the -existing file by that name. diff --git a/plugins/db_mapping/osCommerce_22/password_funcs.php b/plugins/db_mapping/osCommerce_22/password_funcs.php deleted file mode 100644 index 934e3059..00000000 --- a/plugins/db_mapping/osCommerce_22/password_funcs.php +++ /dev/null @@ -1,39 +0,0 @@ - diff --git a/plugins/db_mapping/pMachine_Pro_21.php b/plugins/db_mapping/pMachine_Pro_21.php deleted file mode 100644 index d31f0cdb..00000000 --- a/plugins/db_mapping/pMachine_Pro_21.php +++ /dev/null @@ -1,286 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -################################################################################ -### Database Map for: pMachine Pro 2.1 -### Last Update: 12-17-2003 -################################################################################ - - -class map_PMACHINE_PRO_21 -{ - - ############################################################################ - ### Define the settings for this database map - ############################################################################ - - function map_PMACHINE_PRO_21 () - { - $this->map = - Array ( - 'map' => 'pMachine_Pro_21', - 'db_type' => 'mysql', - 'notes' => 'This is for pMachine Pro 2.1', - 'group_type' => 'status', // db, status, none - - - ### Define the account mapping properties - 'account_map_field' => 'pm_members', - 'account_status_field' => 'status', - 'account_default_status' => '25', - - 'account_sync_field'=> - Array - ( - 'delete' => '1' - ), - - 'account_fields' => - Array - ( - 'id' => - Array - ( - 'map_field' => 'id' - ), - 'date_orig' => - Array - ( - 'map_field' => 'joindate' - ), - - 'date_last' => - Array - ( - 'map_field' => false - ), - - 'date_expire' => - Array - ( - 'map_field' => false - ), - - 'language_id' => - Array - ( - 'map_field' => false - ), - - 'country_id' => - Array - ( - 'map_field' => false - ), - - 'username' => - Array - ( - 'map_field' => 'username' - ), - - 'password' => - Array - ( - 'map_field' => 'password' - ), - - 'misc' => - Array - ( - 'map_field' => false - ), - - 'first_name' => - Array - ( - 'map_field' => 'signature', - ), - - 'last_name' => - Array - ( - 'map_field' => false, - ), - - 'middle_name' => - Array - ( - 'map_field' => false - ), - - 'company' => - Array - ( - 'map_field' => false - ), - - 'status' => - Array - ( - 'map_field' => false - ), - - 'email' => - Array - ( - 'map_field' => 'email' - ), - - 'email_type' => - Array - ( - 'map_field' => false - ) - ), - - ### Define any extra fields for account table in the target db: - 'extra_field' => - Array ( - Array - ( - 'name' => 'member_id', - 'value' => 'random|64', - 'add' => 1, - 'edit' => 0 - ) - ) - ); - - } - - - - - - ######################################################################## - ### Syncronize all accounts & groups - ######################################################################## - - function sync($id, $file) - { - $db_map = new db_mapping; - $this = $db_map->MAP_sync ($id, $file, $this); - } - - - - ######################################################################## - ### Create a new account in the target DB - ######################################################################## - - function account_add($account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_add ($account_id, $this); - - ### Sync the groups for this account: - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync( $account_id ); - } - - - - ######################################################################## - ### Edit an existing account in the target DB - ######################################################################## - - function account_edit($account_id, $old_username) - { - $db_map = new db_mapping; - $db_map->MAP_account_edit ($account_id, $old_username, $this); - - ### Update the groups in the remote db - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync($account_id); - } - - - - ######################################################################## - ### Delete an existing account from the target DB - ######################################################################## - - function account_delete($account_id, $username) - { - $db_map = new db_mapping; - $db_map->MAP_account_delete ($account_id, $username, $this); - } - - - - ######################################################################## - ### Export / Update all accounts / groups to the target DB - ######################################################################## - - function account_import($remote_account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_import ($remote_account_id, $this); - } - - - - - ######################################################################## - ### Create the cookie/session for login sync - ######################################################################## - - function login($account_id) - { - return; - } - - - ######################################################################## - ### Delete the cookie/session on account logout - ######################################################################## - - function logout($account_id) - { - return; - } - - - ######################################################################## - ### Syncronize the groups for a specific account in the remote DB - ######################################################################## - - function account_group_sync($account_id) - { - if ( $this->map['group_type'] == 'db') - { - $db_map = new db_mapping; - $db_map->MAP_account_group_sync_db ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'status') - { - $db_map = new db_mapping; - $db_map->MAP_account_group_sync_status ($account_id, $this); - } - else - { - return false; - } - } -} -?> diff --git a/plugins/db_mapping/phorum_345.php b/plugins/db_mapping/phorum_345.php deleted file mode 100644 index d0da83a3..00000000 --- a/plugins/db_mapping/phorum_345.php +++ /dev/null @@ -1,304 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -################################################################################ -### Database Map for: phorum 3.4.5 -### Last Update: 12-17-2003 -################################################################################ - - -class map_PHORUM_345 -{ - - ############################################################################ - ### Define the settings for this database map - ############################################################################ - - function map_PHORUM_345 () - { - $this->map = - Array ( - 'map' => 'phorum_345', - 'db_type' => 'mysql', - 'notes' => 'This is for phorum 3.4.5', - 'group_type' => 'db', // db, status, none - - ### Define the group fields in the target db - 'group_map' => - Array - ( - 'table' => 'forums_groups', - 'id' => 'id', - 'name' => 'name' - ), - - - ### Define the group-to-account relation fields in the target db - 'group_account_map' => - Array - ( - 'table' => 'forums_user2group', - 'id' => 'user_id', - 'account_id'=> 'user_id', - 'group_id' => 'group_id' - ), - - - - ### Define the account mapping properties - 'account_map_field' => 'forums_auth', - 'account_sync_field'=> - Array - ( - 'delete' => '1' - ), - - 'account_fields' => - Array - ( - 'id' => - Array - ( - 'map_field' => 'id' - ), - 'date_orig' => - Array - ( - 'map_field' => false - ), - - 'date_last' => - Array - ( - 'map_field' => false - ), - - 'date_expire' => - Array - ( - 'map_field' => false - ), - - 'language_id' => - Array - ( - 'map_field' => false - ), - - 'country_id' => - Array - ( - 'map_field' => false - ), - - 'username' => - Array - ( - 'map_field' => 'username' - ), - - 'password' => - Array - ( - 'map_field' => 'password' - ), - - 'misc' => - Array - ( - 'map_field' => false - ), - - 'first_name' => - Array - ( - 'map_field' => 'name' - ), - - 'last_name' => - Array - ( - 'map_field' => false, - ), - - 'middle_name' => - Array - ( - 'map_field' => false - ), - - 'company' => - Array - ( - 'map_field' => false - ), - - 'status' => - Array - ( - 'map_field' => false - ), - - 'email' => - Array - ( - 'map_field' => 'email' - ), - - 'email_type' => - Array - ( - 'map_field' => false - ) - ), - - ### Define any extra fields for account table in the target db: - 'extra_field' =>false - ); - - } - - - - - - ######################################################################## - ### Syncronize all accounts & groups - ######################################################################## - - function sync($id, $file) - { - $db_map = new db_mapping; - $this = $db_map->MAP_sync ($id, $file, $this); - } - - - - ######################################################################## - ### Create a new account in the target DB - ######################################################################## - - function account_add($account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_add ($account_id, $this); - - ### Sync the groups for this account: - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync( $account_id ); - } - - - - ######################################################################## - ### Edit an existing account in the target DB - ######################################################################## - - function account_edit($account_id, $old_username) - { - $db_map = new db_mapping; - $db_map->MAP_account_edit ($account_id, $old_username, $this); - - ### Update the groups in the remote db - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync($account_id); - } - - - - ######################################################################## - ### Delete an existing account from the target DB - ######################################################################## - - function account_delete($account_id, $username) - { - $db_map = new db_mapping; - $db_map->MAP_account_delete ($account_id, $username, $this); - } - - - - - - - - ######################################################################## - ### Export / Update all accounts / groups to the target DB - ######################################################################## - - function account_import($remote_account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_import ($remote_account_id, $this); - } - - - - - ######################################################################## - ### Create the cookie/session for login sync - ######################################################################## - - function login($account_id) - { - return; - } - - - - - ######################################################################## - ### Delete the cookie/session on account logout - ######################################################################## - - function logout($account_id) - { - return; - } - - - - - ######################################################################## - ### Syncronize the groups for a specific account in the remote DB - ######################################################################## - - function account_group_sync($account_id) - { - if ( $this->map['group_type'] == 'db') - { - $db_map = new db_mapping; - $db_map->MAP_account_group_sync_db ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'status') - { - $db_map = new db_mapping; - $db_map->MAP_account_group_sync_status ($account_id, $this); - } - else - { - return false; - } - } - -} -?> diff --git a/plugins/db_mapping/phpBB_2O6.php b/plugins/db_mapping/phpBB_2O6.php deleted file mode 100644 index a8a017c9..00000000 --- a/plugins/db_mapping/phpBB_2O6.php +++ /dev/null @@ -1,334 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -################################################################################ -### Database Map for: phpBB 2.0.6 -### Last Update: 12-14-2003 -################################################################################ - - -class map_PHPBB_2O6 -{ - - ############################################################################ - ### Define the settings for this database map - ############################################################################ - - function map_PHPBB_2O6 () - { - $this->map = - Array ( - 'map' => 'phpBB_2O6', - 'db_type' => 'mysql', - 'notes' => 'This is for phpBB 2.0.6', - 'group_type' => 'db', // db, status, none - - ### Define the group fields in the target db - 'group_map' => - Array - ( - 'table' => '_groups', - 'id' => 'group_id', - 'name' => 'group_name' - ), - - - ### Define the group-to-account relation fields in the target db - 'group_account_map' => - Array - ( - 'table' => '_user_group', - 'id' => 'group_id', - 'account_id'=> 'user_id', - 'group_id' => 'group_id' - ), - - - - ### Define the account mapping properties - 'account_map_field' => '_users', - 'account_sync_field'=> - Array - ( - 'add' => 'name,uname,email,pass,theme,last_login', - 'edit' => 'uid,name,uname,email,pass,theme,last_login', - 'import' => 'name,uname,email,pass,theme,last_login', - 'export' => 'name,uname,email,pass,theme,last_login', - 'delete' => '1' - ), - - 'account_fields' => - Array - ( - 'id' => - Array - ( - 'map_field' => 'user_id', - 'unique' => '1' - ), - 'date_orig' => - Array - ( - 'map_field' => 'user_regdate' - ), - - 'date_last' => - Array - ( - 'map_field' => false - ), - - 'date_expire' => - Array - ( - 'map_field' => false - ), - - 'language_id' => - Array - ( - 'map_field' => false - ), - - 'country_id' => - Array - ( - 'map_field' => false - ), - - 'username' => - Array - ( - 'map_field' => 'username' - ), - - 'password' => - Array - ( - 'map_field' => 'user_password' - ), - - 'misc' => - Array - ( - 'map_field' => false - ), - - 'first_name' => - Array - ( - 'map_field' => false - ), - - 'last_name' => - Array - ( - 'map_field' => false, - ), - - 'middle_name' => - Array - ( - 'map_field' => false - ), - - 'company' => - Array - ( - 'map_field' => false - ), - - 'status' => - Array - ( - 'map_field' => 'user_active' - ), - - 'email' => - Array - ( - 'map_field' => 'user_email' - ), - - 'email_type' => - Array - ( - 'map_field' => false - ) - ), - - ### Define any extra fields for account table in the target db: - 'extra_field' => - Array ( - Array - ( - 'name' => 'user_lang', - 'value' => 'english', - 'add' => 1, - 'edit' => 0 - ), - - Array - ( - 'name' => 'user_dateformat', - 'value' => 'd M Y h:i a', - 'add' => 1, - 'edit' => 0 - ), - - Array - ( - 'name' => 'user_level', - 'value' => '1', - 'add' => 1, - 'edit' => 0 - ) - ) - ); - - } - - - - - - ######################################################################## - ### Syncronize all accounts & groups - ######################################################################## - - function sync($id, $file) - { - $db_map = new db_mapping; - $db_map->MAP_sync ($id, $file, $this); - } - - - - ######################################################################## - ### Create a new account in the target DB - ######################################################################## - - function account_add($account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_add ($account_id, $this); - - ### Sync the groups for this account: - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync( $account_id ); - } - - - - ######################################################################## - ### Edit an existing account in the target DB - ######################################################################## - - function account_edit($account_id, $old_username) - { - $db_map = new db_mapping; - $db_map->MAP_account_edit ($account_id, $old_username, $this); - - ### Update the groups in the remote db - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync($account_id); - } - - - - ######################################################################## - ### Delete an existing account from the target DB - ######################################################################## - - function account_delete($account_id, $username) - { - $db_map = new db_mapping; - $db_map->MAP_account_delete ($account_id, $username, $this); - } - - - - - - - - ######################################################################## - ### Export / Update all accounts / groups to the target DB - ######################################################################## - - function account_import($remote_account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_import ($remote_account_id, $this); - } - - - - - ######################################################################## - ### Create the cookie/session for login sync - ######################################################################## - - function login($account_id) - { - return; - } - - - - - ######################################################################## - ### Delete the cookie/session on account logout - ######################################################################## - - function logout($account_id) - { - return; - } - - - - - ######################################################################## - ### Syncronize the groups for a specific account in the remote DB - ######################################################################## - - function account_group_sync($account_id) - { - if ( $this->map['group_type'] == 'db') - { - $db_map = new db_mapping; - $db_map->MAP_account_group_sync_db ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'status') - { - $db_map = new db_mapping; - $db_map->MAP_account_group_sync_status ($account_id, $this); - } - else - { - return false; - } - } - -} -?> diff --git a/plugins/db_mapping/phpNuke_69.php b/plugins/db_mapping/phpNuke_69.php deleted file mode 100644 index 22e28caa..00000000 --- a/plugins/db_mapping/phpNuke_69.php +++ /dev/null @@ -1,286 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -################################################################################ -### Database Map for: phpNuke 6.9 -### Last Update: 12-16-2003 -################################################################################ - - -class map_PHPNUKE_69 -{ - - ############################################################################ - ### Define the settings for this database map - ############################################################################ - - function map_PHPNUKE_69 () - { - $this->map = - Array ( - 'map' => 'phpNuke_69', - 'db_type' => 'mysql', - 'notes' => 'This is for phpNuke 6.9', - 'group_type' => 'status', // db, status, none - - - ### Define the account mapping properties - 'account_map_field' => '_users', - 'account_status_field' => 'user_active', - 'account_default_status' => '1', - - 'account_sync_field'=> - Array - ( - 'add' => 'username,email,password,enabled,protected,access_level', - 'edit' => 'username,email,password,enabled,protected,access_level', - 'import' => 'username,email,password,enabled,protected,access_level', - 'export' => 'username,email,password,enabled,protected,access_level', - 'delete' => '1' - ), - - 'account_fields' => - Array - ( - 'id' => - Array - ( - 'map_field' => 'user_id', - ), - 'date_orig' => - Array - ( - 'map_field' => false - ), - - 'date_last' => - Array - ( - 'map_field' => false - ), - - 'date_expire' => - Array - ( - 'map_field' => false - ), - - 'language_id' => - Array - ( - 'map_field' => false - ), - - 'country_id' => - Array - ( - 'map_field' => false - ), - - 'username' => - Array - ( - 'map_field' => 'username' - ), - - 'password' => - Array - ( - 'map_field' => 'user_password' - ), - - 'misc' => - Array - ( - 'map_field' => false - ), - - 'first_name' => - Array - ( - 'map_field' => 'name', - ), - - 'last_name' => - Array - ( - 'map_field' => false, - ), - - 'middle_name' => - Array - ( - 'map_field' => false - ), - - 'company' => - Array - ( - 'map_field' => false - ), - - 'status' => - Array - ( - 'map_field' => 'user_active' - ), - - 'email' => - Array - ( - 'map_field' => 'user_email' - ), - - 'email_type' => - Array - ( - 'map_field' => false - ) - ), - - ### Define any extra fields for account table in the target db: - 'extra_field' => false - ); - - } - - - - - - ######################################################################## - ### Syncronize all accounts & groups - ######################################################################## - - function sync($id, $file) - { - $db_map = new db_mapping; - $this = $db_map->MAP_sync ($id, $file, $this); - } - - - - ######################################################################## - ### Create a new account in the target DB - ######################################################################## - - function account_add($account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_add ($account_id, $this); - - ### Sync the groups for this account: - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync( $account_id ); - } - - - - ######################################################################## - ### Edit an existing account in the target DB - ######################################################################## - - function account_edit($account_id, $old_username) - { - $db_map = new db_mapping; - $db_map->MAP_account_edit ($account_id, $old_username, $this); - - ### Update the groups in the remote db - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync($account_id); - } - - - - ######################################################################## - ### Delete an existing account from the target DB - ######################################################################## - - function account_delete($account_id, $username) - { - $db_map = new db_mapping; - $db_map->MAP_account_delete ($account_id, $username, $this); - } - - - - ######################################################################## - ### Export / Update all accounts / groups to the target DB - ######################################################################## - - function account_import($remote_account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_import ($remote_account_id, $this); - } - - - - - ######################################################################## - ### Create the cookie/session for login sync - ######################################################################## - - function login($account_id) - { - return; - } - - - ######################################################################## - ### Delete the cookie/session on account logout - ######################################################################## - - function logout($account_id) - { - return; - } - - - ######################################################################## - ### Syncronize the groups for a specific account in the remote DB - ######################################################################## - - function account_group_sync($account_id) - { - if ( $this->map['group_type'] == 'db') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_db ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'status') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_status ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'db-status') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_db_status ($account_id, $this); - } - else - { - return false; - } - } -} -?> diff --git a/plugins/db_mapping/punBB_101.php b/plugins/db_mapping/punBB_101.php deleted file mode 100644 index 09a61337..00000000 --- a/plugins/db_mapping/punBB_101.php +++ /dev/null @@ -1,322 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -################################################################################ -### Database Map for: punBB 1.0.1 -### Last Update: 12-14-2003 -################################################################################ - - -class map_PUNBB_101 -{ - - ############################################################################ - ### Define the settings for this database map - ############################################################################ - - function map_PUNBB_101 () - { - $this->map = - Array ( - 'map' => 'punBB_101', - 'db_type' => 'mysql', - 'notes' => 'This is for punBB 1.0.1', - 'group_type' => 'status', // db, status, none - - - ### Define the account mapping properties - 'account_map_field' => 'users', - 'account_status_field' => 'status', - 'account_default_status' => '-1', - - 'account_sync_field'=> - Array - ( - 'add' => 'username,email,password,enabled,protected,access_level', - 'edit' => 'username,email,password,enabled,protected,access_level', - 'import' => 'username,email,password,enabled,protected,access_level', - 'export' => 'username,email,password,enabled,protected,access_level', - 'delete' => '1' - ), - - 'account_fields' => - Array - ( - 'id' => - Array - ( - 'map_field' => 'id' - ), - 'date_orig' => - Array - ( - 'map_field' => 'registered' - ), - - 'date_last' => - Array - ( - 'map_field' => false - ), - - 'date_expire' => - Array - ( - 'map_field' => false - ), - - 'language_id' => - Array - ( - 'map_field' => false - ), - - 'country_id' => - Array - ( - 'map_field' => false - ), - - 'username' => - Array - ( - 'map_field' => 'username' - ), - - 'password' => - Array - ( - 'map_field' => 'password' - ), - - 'misc' => - Array - ( - 'map_field' => false - ), - - 'first_name' => - Array - ( - 'map_field' => false, - ), - - 'last_name' => - Array - ( - 'map_field' => false, - ), - - 'middle_name' => - Array - ( - 'map_field' => false - ), - - 'company' => - Array - ( - 'map_field' => false - ), - - 'status' => - Array - ( - 'map_field' => false - ), - - 'email' => - Array - ( - 'map_field' => 'email' - ), - - 'email_type' => - Array - ( - 'map_field' => false - ) - ), - - ### Define any extra fields for account table in the target db: - 'extra_field' => - Array ( - Array - ( - 'name' => 'save_pass', - 'value' => '1', - 'add' => 1, - 'edit' => 0 - ), - - Array - ( - 'name' => 'smilies', - 'value' => '1', - 'add' => 1, - 'edit' => 0 - ), - - Array - ( - 'name' => 'show_img', - 'value' => '1', - 'add' => 1, - 'edit' => 0 - ), - - Array - ( - 'name' => 'show_sig', - 'value' => '1', - 'add' => 1, - 'edit' => 0 - ), - - Array - ( - 'name' => 'link_to_new_win', - 'value' => '1', - 'add' => 1, - 'edit' => 0 - ), - ) - ); - - } - - - - - - ######################################################################## - ### Syncronize all accounts & groups - ######################################################################## - - function sync($id, $file) - { - $db_map = new db_mapping; - $this = $db_map->MAP_sync ($id, $file, $this); - } - - - - ######################################################################## - ### Create a new account in the target DB - ######################################################################## - - function account_add($account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_add ($account_id, $this); - - ### Sync the groups for this account: - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync( $account_id ); - } - - - - ######################################################################## - ### Edit an existing account in the target DB - ######################################################################## - - function account_edit($account_id, $old_username) - { - $db_map = new db_mapping; - $db_map->MAP_account_edit ($account_id, $old_username, $this); - - ### Update the groups in the remote db - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync($account_id); - } - - - - ######################################################################## - ### Delete an existing account from the target DB - ######################################################################## - - function account_delete($account_id, $username) - { - $db_map = new db_mapping; - $db_map->MAP_account_delete ($account_id, $username, $this); - } - - - - ######################################################################## - ### Export / Update all accounts / groups to the target DB - ######################################################################## - - function account_import($remote_account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_import ($remote_account_id, $this); - } - - - - - ######################################################################## - ### Create the cookie/session for login sync - ######################################################################## - - function login($account_id) - { - return; - } - - - ######################################################################## - ### Delete the cookie/session on account logout - ######################################################################## - - function logout($account_id) - { - return; - } - - - ######################################################################## - ### Syncronize the groups for a specific account in the remote DB - ######################################################################## - - function account_group_sync($account_id) - { - if ( $this->map['group_type'] == 'db') - { - $db_map = new db_mapping; - $db_map->MAP_account_group_sync_db ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'status') - { - $db_map = new db_mapping; - $db_map->MAP_account_group_sync_status ($account_id, $this); - } - else - { - return false; - } - } -} -?> diff --git a/plugins/db_mapping/vBulletin_229.php b/plugins/db_mapping/vBulletin_229.php deleted file mode 100644 index f69ba1d2..00000000 --- a/plugins/db_mapping/vBulletin_229.php +++ /dev/null @@ -1,313 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -################################################################################ -### Database Map for: vBulletin 229 -### Last Update: 12-14-2003 -################################################################################ - - -class map_VBULLETIN_229 -{ - - ############################################################################ - ### Define the settings for this database map - ############################################################################ - - function map_VBULLETIN_229 () - { - $this->map = - Array ( - 'map' => 'vBulletin_229', - 'db_type' => 'mysql', - 'notes' => 'This is for vBulletin 229', - 'group_type' => 'db-status', // db, db-status, status, none - - - ### Define the group fields in the target db - 'group_map' => - Array - ( - 'table' => 'usergroup', - 'id' => 'usergroupid', - 'name' => 'title' - ), - - - ### Define the account mapping properties - 'account_map_field' => 'user', - 'account_status_field' => 'usergroupid', - 'account_default_status' => '2', - - 'account_sync_field'=> - Array - ( - 'add' => 'username,email,password', - 'edit' => 'username,email,password', - 'import' => 'username,email,password', - 'export' => 'username,email,password', - 'delete' => '1' - ), - - 'account_fields' => - Array - ( - 'id' => - Array - ( - 'map_field' => 'userid' - ), - 'date_orig' => - Array - ( - 'map_field' => 'joindate' - ), - - 'date_last' => - Array - ( - 'map_field' => 'lastactivity' - ), - - 'date_expire' => - Array - ( - 'map_field' => false - ), - - 'language_id' => - Array - ( - 'map_field' => false - ), - - 'country_id' => - Array - ( - 'map_field' => false - ), - - 'username' => - Array - ( - 'map_field' => 'username' - ), - - 'password' => - Array - ( - 'map_field' => 'password' - ), - - 'misc' => - Array - ( - 'map_field' => false - ), - - 'first_name' => - Array - ( - 'map_field' => false, - ), - - 'last_name' => - Array - ( - 'map_field' => false, - ), - - 'middle_name' => - Array - ( - 'map_field' => false - ), - - 'company' => - Array - ( - 'map_field' => false - ), - - 'status' => - Array - ( - 'map_field' => false - ), - - 'email' => - Array - ( - 'map_field' => 'email' - ), - - 'email_type' => - Array - ( - 'map_field' => false - ) - ), - - ### Define any extra fields for account table in the target db: - 'extra_field' => false - ); - - } - - - - - - ######################################################################## - ### Syncronize all accounts & groups - ######################################################################## - - function sync($id, $file) - { - $db_map = new db_mapping; - $this = $db_map->MAP_sync ($id, $file, $this); - } - - - - ######################################################################## - ### Create a new account in the target DB - ######################################################################## - - function account_add($account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_add ($account_id, $this); - - ### Sync the groups for this account: - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $remote_account_id = $this->account_group_sync( $account_id ); - - ### Update the remote account: - $dbm = new db_mapping; - $db2 = $dbm->DB_connect(false, $this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($this->map['map']) .';' ); - $sql = "INSERT INTO " . - $db_prefix . "userfield SET userid = " . - $db2->qstr($remote_account_id); - $group_result = $db2->Execute($sql); - } - - - - ######################################################################## - ### Edit an existing account in the target DB - ######################################################################## - - function account_edit($account_id, $old_username) - { - $db_map = new db_mapping; - $db_map->MAP_account_edit ($account_id, $old_username, $this); - - ### Update the groups in the remote db - if( $this->map['group_type'] != 'none' ) - $this->account_group_sync($account_id); - } - - - - ######################################################################## - ### Delete an existing account from the target DB - ######################################################################## - - function account_delete($account_id, $username) - { - $db_map = new db_mapping; - $remote_account_id = $db_map->MAP_account_delete ($account_id, $username, $this); - - ### Update the remote account: - $dbm = new db_mapping; - $db2 = $dbm->DB_connect(false, $this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($this->map['map']) .';' ); - $sql = "DELETE FROM " . - $db_prefix . "userfield WHERE userid = " . - $db2->qstr($remote_account_id); - $group_result = $db2->Execute($sql); - } - - - - ######################################################################## - ### Export / Update all accounts / groups to the target DB - ######################################################################## - - function account_import($remote_account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_import ($remote_account_id, $this); - } - - - - - ######################################################################## - ### Create the cookie/session for login sync - ######################################################################## - - function login($account_id) - { - return; - } - - - ######################################################################## - ### Delete the cookie/session on account logout - ######################################################################## - - function logout($account_id) - { - return; - } - - - ######################################################################## - ### Syncronize the groups for a specific account in the remote DB - ######################################################################## - - function account_group_sync($account_id) - { - if ( $this->map['group_type'] == 'db') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_db ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'status') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_status ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'db-status') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_db_status ($account_id, $this); - } - else - { - return false; - } - } -} -?> diff --git a/plugins/db_mapping/vBulletin_3.php b/plugins/db_mapping/vBulletin_3.php deleted file mode 100644 index 4625ef48..00000000 --- a/plugins/db_mapping/vBulletin_3.php +++ /dev/null @@ -1,532 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -define('VB3_COOKIE_PREFIX', 'bb'); - -################################################################################ -### Database Map for: vBulletin 3.x -################################################################################ - - -class map_VBULLETIN_3 -{ - - ############################################################################ - ### Define the settings for this database map - ############################################################################ - - function map_VBULLETIN_3 () - { - $this->map = - Array ( - 'map' => 'vBulletin_3', - 'db_type' => 'mysql', - 'notes' => 'This is for vBulletin 3', - 'group_type' => 'db-status', // db, db-status, status, none - - - ### Define the group fields in the target db - 'group_map' => - Array - ( - 'table' => 'usergroup', - 'id' => 'usergroupid', - 'name' => 'title' - ), - - - ### Define the account mapping properties - 'account_map_field' => 'user', - 'account_status_field' => 'usergroupid', - 'account_default_status' => '2', - - 'account_sync_field'=> - Array - ( - 'add' => 'username,email,password', - 'edit' => 'username,email,password', - 'import' => 'username,email,password', - 'export' => 'username,email,password', - 'delete' => '1' - ), - - 'account_fields' => - Array - ( - 'id' => - Array - ( - 'map_field' => 'userid' - ), - 'date_orig' => - Array - ( - 'map_field' => 'joindate' - ), - - 'date_last' => - Array - ( - 'map_field' => 'lastactivity' - ), - - 'date_expire' => - Array - ( - 'map_field' => false - ), - - 'language_id' => - Array - ( - 'map_field' => false - ), - - 'country_id' => - Array - ( - 'map_field' => false - ), - - 'username' => - Array - ( - 'map_field' => 'username' - ), - - 'password' => - Array - ( - 'map_field' => 'password' - ), - - 'misc' => - Array - ( - 'map_field' => false - ), - - 'first_name' => - Array - ( - 'map_field' => false, - ), - - 'last_name' => - Array - ( - 'map_field' => false, - ), - - 'middle_name' => - Array - ( - 'map_field' => false - ), - - 'company' => - Array - ( - 'map_field' => false - ), - - 'status' => - Array - ( - 'map_field' => false - ), - - 'email' => - Array - ( - 'map_field' => 'email' - ), - - 'email_type' => - Array - ( - 'map_field' => false - ) - ), - - ### Define any extra fields for account table in the target db: - 'extra_field' => - Array ( 0 ) - ); - - } - - - - - - ######################################################################## - ### Syncronize all accounts & groups - ######################################################################## - - function sync($id, $file) - { - $db_map = new db_mapping; - $db_map->MAP_sync ($id, $file, $this); - } - - - - ######################################################################## - ### Create a new account in the target DB - ######################################################################## - - function account_add($account_id) - { - $db_map_misc = new dbmapping_vb3; - $db_map_misc->MAP_account_add ($account_id, $this); - - ### Sync the groups for this account: - $remote_account_id = $this->account_group_sync( $account_id ); - } - - - - ######################################################################## - ### Edit an existing account in the target DB - ######################################################################## - - function account_edit($account_id, $old_username) - { - $db_map_misc = new dbmapping_vb3; - $db_map_misc->MAP_account_edit ($account_id, $old_username, $this); - - ### Update the groups in the remote db - $this->account_group_sync($account_id); - } - - - - ######################################################################## - ### Delete an existing account from the target DB - ######################################################################## - - function account_delete($account_id, $username) - { - $db_map_misc = new dbmapping_vb3; - $db_map_misc->MAP_account_delete ($account_id, $username, $this); - - /* - $db_map = new db_mapping; - $remote_account_id = $db_map->MAP_account_delete ($account_id, $username, $this); - - ### Update the remote account: - $dbm = new db_mapping; - $db2 = $dbm->DB_connect(false, $this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($this->map['map']) .';' ); - $sql = "DELETE FROM " . - $db_prefix . "userfield WHERE userid = " . - $db2->qstr($remote_account_id); - $db2->Execute($sql); - - $sql = "DELETE FROM " . - $db_prefix . "usertextfield WHERE userid = " . - $db2->qstr($remote_account_id); - $db2->Execute($sql); - */ - } - - - - ######################################################################## - ### Export / Update all accounts / groups to the target DB - ######################################################################## - - function account_import($remote_account_id) - { - $msg = 'Import from VB3 not supported due to the unique password encryption used in VB3'; - global $C_debug; - $C_debug->alert($msg); - } - - - - - ######################################################################## - ### Create the cookie/session for login sync - ######################################################################## - - function login($account_id, $cookie) - { - $db_map_misc = new dbmapping_vb3; - $db_map_misc->MAP_account_login ($account_id, $cookie, $this); - } - - - ######################################################################## - ### Delete the cookie/session on account logout - ######################################################################## - - function logout($account_id, $cookie) - { - $db_map_misc = new dbmapping_vb3; - $db_map_misc->MAP_account_logout ($account_id, $cookie, $this); - } - - - ######################################################################## - ### Syncronize the groups for a specific account in the remote DB - ######################################################################## - - function account_group_sync($account_id) - { - if ( $this->map['group_type'] == 'db') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_db ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'status') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_status ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'db-status') - { - $db_map = new db_mapping; - return $db_map->MAP_account_group_sync_db_status ($account_id, $this); - } - else - { - return false; - } - } -} - - - - - - - - - -class dbmapping_vb3 extends db_mapping -{ - - ### ADD ACCOUNT - function MAP_account_add ($account_id, $MAP_this) - { - ### Get the account details from AB - $db = &DB(); - $sql= 'SELECT username,email,password FROM '.AGILE_DB_PREFIX.'account WHERE - id = '.$db->qstr($account_id).' AND - site_id = '.$db->qstr(DEFAULT_SITE); - $account = $db->Execute($sql); - if ($account === false) { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_login_get_account_username', $db->ErrorMsg()); - } - unset($db); - - # GENERATE SALT: - $salt = ''; - for ($i = 0; $i < 3; $i++) - $salt .= chr(rand(32, 126)); - - $username = $account->fields['username']; - $email = $account->fields['email']; - $password = md5( $account->fields['password'] . $salt ); - - /* - # GENERATE PASSWORD: - if(!empty($MAP_this->plaintext_password)) - $password = md5(md5(@$MAP_this->plaintext_password) . $salt); - else - $password = md5( $account->fields['password'] . $salt ); - */ - - ### Insert the new account into VB3 - $dbm = new db_mapping; - $dbm = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = 'INSERT INTO ' . $db_prefix . 'user SET - displaygroupid = '.$dbm->qstr(0) . ', - username = '.$dbm->qstr($username) . ', - password = '.$dbm->qstr($password) . ', - passworddate = '.$dbm->qstr(date("Y-m-d")) . ', - email = '.$dbm->qstr($email) . ', - styleid = '.$dbm->qstr(0) . ', - showvbcode = '.$dbm->qstr(2) . ', - customtitle = '.$dbm->qstr(0) . ', - joindate = '.$dbm->qstr(time()) . ', - daysprune = '.$dbm->qstr(0) . ', - lastvisit = '.$dbm->qstr(time()) . ', - lastactivity = '.$dbm->qstr(time()) . ', - reputationlevelid = '.$dbm->qstr(1) . ', - options = '.$dbm->qstr('2135') . ', - salt = '.$dbm->qstr($salt) ; - $result = $dbm->Execute($sql); - if ($result === false) { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_login_get_remote_account_id', $dbm->ErrorMsg()); - return false; - } - } - - - - ### EDIT ACCOUNT - function MAP_account_edit($account_id, $old_username, $MAP_this) - { - ### Get the account details from AB - $db = &DB(); - $sql= 'SELECT username,email,password FROM '.AGILE_DB_PREFIX.'account WHERE - id = '.$db->qstr($account_id).' AND - site_id = '.$db->qstr(DEFAULT_SITE); - $account = $db->Execute($sql); - if ($account === false) { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_login_get_account_username', $db->ErrorMsg()); - } - unset($db); - - # GENERATE SALT: - $salt = ''; - for ($i = 0; $i < 3; $i++) - $salt .= chr(rand(32, 126)); - - $username = $account->fields['username']; - $email = $account->fields['email']; - $password = md5( $account->fields['password'] . $salt ); - - /* - if(!empty($MAP_this->plaintext_password)) - { - $password = md5(md5($MAP_this->plaintext_password) . $salt); - } else { - $password = md5( $account->fields['password'] . $salt ); - } - */ - - ### Update the account in VB3 - $dbm = new db_mapping; - $dbm = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = 'UPDATE ' . $db_prefix . 'user SET '; - - if(@$MAP_this->plaintext_password != false) - $sql .= ' password = '.$dbm->qstr($password) . ', - salt = '.$dbm->qstr($salt) . ','; - - $sql .= ' passworddate = '.$dbm->qstr(date("Y-m-d")) . ', - username = '.$dbm->qstr($username) . ', - email = '.$dbm->qstr($email) . ' - WHERE - username = '.$dbm->qstr($old_username) ; - - $result = $dbm->Execute($sql); - if ($result === false) { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_login_get_remote_account_id', $dbm->ErrorMsg()); - return false; - } - } - - - function MAP_account_delete ($account_id, $username, $MAP_this) - { - global $C_debug; - - ### Get the remote account id from the username - $dbm = new db_mapping; - $db2 = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = 'SELECT userid FROM ' . $db_prefix . 'user - WHERE username = '.$db2->qstr($username); - $result = $db2->Execute($sql); - if ($result === false) { - $C_debug->error('vBulletin_3.php','MAP_account_delete (1)', $db2->ErrorMsg() . ' ' . $sql); - return false; - } - - $vb_user_id = $result->fields['userid']; - - # Suspend the user user: - $sql = "UPDATE " . $db_prefix . "user SET usergroupid = '1' WHERE userid = " . $db2->qstr($vb_user_id); - $result = $db2->Execute($sql); - if ($result === false) { - $C_debug->error('vBulletin_3.php','MAP_account_delete (2)', $db2->ErrorMsg() . ' ' . $sql); - } - } - - - ### LOGIN - function MAP_account_login ($account_id, $cookie, $MAP_this) - { - ### Get the username from the account_id - $db = &DB(); - $sql= 'SELECT username,password FROM '.AGILE_DB_PREFIX.'account WHERE - id = '.$db->qstr($account_id).' AND - site_id = '.$db->qstr(DEFAULT_SITE); - $result = $db->Execute($sql); - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_login_get_account_username', $db->ErrorMsg()); - } - unset($db); - - $username = $result->fields['username']; - $password = $result->fields['username']; - - ### Get the remote account id from the username - $dbm = new db_mapping; - $dbm = $dbm->DB_connect(false, $MAP_this->map['map']); - eval ( '@$db_prefix = DB2_PREFIX'. strtoupper($MAP_this->map['map']) .';' ); - $sql = 'SELECT userid,password FROM ' . $db_prefix . 'user - WHERE username = '.$dbm->qstr($username); - $result = $dbm->Execute($sql); - if ($result === false) - { - global $C_debug; - $C_debug->error('db_mapping.inc.php','Map_account_login_get_remote_account_id', $dbm->ErrorMsg()); - return false; - } - - $vb_user_id = $result->fields['userid']; - $password = $result->fields['password']; - - if (!empty($vb_user_id)) - { - # GENERATE COOKIES FOR LOGIN - setcookie(VB3_COOKIE_PREFIX.'userid', $vb_user_id, 0, '/'); - setcookie(VB3_COOKIE_PREFIX.'password', md5($password . trim($cookie)), 0, '/'); - setcookie(VB3_COOKIE_PREFIX.'lastactivity', time(), 0, '/'); - } - } - - - ### LOGOUT - function MAP_account_logout ($account_id, $cookie, $MAP_this) - { - setcookie(VB3_COOKIE_PREFIX.'userid' ); - setcookie(VB3_COOKIE_PREFIX.'password' ); - setcookie(VB3_COOKIE_PREFIX.'lastactivity' ); - setcookie(VB3_COOKIE_PREFIX.'lastvisit' ); - setcookie(VB3_COOKIE_PREFIX.'sessionhash' ); - } -} - -?> \ No newline at end of file diff --git a/plugins/db_mapping/xcart_gold_351.php b/plugins/db_mapping/xcart_gold_351.php deleted file mode 100644 index 0601cf23..00000000 --- a/plugins/db_mapping/xcart_gold_351.php +++ /dev/null @@ -1,306 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -################################################################################ -### Database Map for: X-Cart Gold 3.5.10 -### Last Update: 12-17-2003 -################################################################################ - - -class map_XCART_GOLD_351 -{ - - ############################################################################ - ### Define the settings for this database map - ############################################################################ - - function map_XCART_GOLD_351 () - { - $this->map = - Array ( - 'map' => 'xcart_gold_351', - 'db_type' => 'mysql', - 'notes' => 'This is for X-Cart Gold 3.5.10', - 'group_type' => 'none', - - - ### Define the account mapping properties - 'account_map_field' => 'xcart_customers', - - 'account_fields' => - Array - ( - 'id' => - Array - ( - 'map_field' => 'login' - ), - 'date_orig' => - Array - ( - 'map_field' => 'first_login' - ), - - 'date_last' => - Array - ( - 'map_field' => 'last_login' - ), - - 'date_expire' => - Array - ( - 'map_field' => false - ), - - 'language_id' => - Array - ( - 'map_field' => false - ), - - 'country_id' => - Array - ( - 'map_field' => false - ), - - 'username' => - Array - ( - 'map_field' => 'login' - ), - - 'password' => - Array - ( - 'map_field' => 'password' - ), - - 'title' => - Array - ( - 'map_field' => 'title' - ), - - 'company' => - Array - ( - 'map_field' => 'company', - ), - - 'first_name' => - Array - ( - 'map_field' => false, - ), - - 'first_name' => - Array - ( - 'map_field' => false, - ), - - 'last_name' => - Array - ( - 'map_field' => false, - ), - - 'middle_name' => - Array - ( - 'map_field' => false - ), - - 'company' => - Array - ( - 'map_field' => false - ), - - 'status' => - Array - ( - 'map_field' => false - ), - - 'email' => - Array - ( - 'map_field' => 'email' - ), - - 'email_type' => - Array - ( - 'map_field' => false - ) - ), - - ### Define any extra fields for account table in the target db: - 'extra_field' => - Array ( - Array - ( - 'name' => 'usertype', - 'value' => 'C', - 'add' => 1, - 'edit' => 0 - ), - - Array - ( - 'name' => 'status', - 'value' => 'Y', - 'add' => 1, - 'edit' => 0 - ), - - Array - ( - 'name' => 'language', - 'value' => 'US', - 'add' => 1, - 'edit' => 0 - ) - ) - ); - - } - - - - - - ######################################################################## - ### Syncronize all accounts & groups - ######################################################################## - - function sync($id, $file) - { - $db_map = new db_mapping; - $this = $db_map->MAP_sync ($id, $file, $this); - } - - - - ######################################################################## - ### Create a new account in the target DB - ######################################################################## - - function account_add($account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_add ($account_id, $this); - - ### Sync the groups for this account: - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync( $account_id ); - } - - - - ######################################################################## - ### Edit an existing account in the target DB - ######################################################################## - - function account_edit($account_id, $old_username) - { - $db_map = new db_mapping; - $db_map->MAP_account_edit ($account_id, $old_username, $this); - - ### Update the groups in the remote db - if( $this->map['group_type'] != 'none' && - $this->map['group_type'] != 'add_remove' ) - $this->account_group_sync($account_id); - } - - - - ######################################################################## - ### Delete an existing account from the target DB - ######################################################################## - - function account_delete($account_id, $username) - { - $db_map = new db_mapping; - $db_map->MAP_account_delete ($account_id, $username, $this); - } - - - - ######################################################################## - ### Export / Update all accounts / groups to the target DB - ######################################################################## - - function account_import($remote_account_id) - { - $db_map = new db_mapping; - $db_map->MAP_account_import ($remote_account_id, $this); - } - - - - - ######################################################################## - ### Create the cookie/session for login sync - ######################################################################## - - function login($account_id) - { - return; - } - - - ######################################################################## - ### Delete the cookie/session on account logout - ######################################################################## - - function logout($account_id) - { - return; - } - - - ######################################################################## - ### Syncronize the groups for a specific account in the remote DB - ######################################################################## - - function account_group_sync($account_id) - { - if ( $this->map['group_type'] == 'db') - { - $db_map = new db_mapping; - $db_map->MAP_account_group_sync_db ($account_id, $this); - } - elseif ( $this->map['group_type'] == 'status') - { - $db_map = new db_mapping; - $db_map->MAP_account_group_sync_status ($account_id, $this); - } - else - { - return false; - } - } -} -?> diff --git a/plugins/import/WHMCS.php b/plugins/import/WHMCS.php new file mode 100644 index 00000000..30851812 --- /dev/null +++ b/plugins/import/WHMCS.php @@ -0,0 +1,1103 @@ +. + * + * Originally authored by Deon George + * + * @author Deon George + * @copyright 2009 Deon George + * @link http://osb.leenooks.net + * @license http://www.gnu.org/licenses/ + * @package AgileBill + * @subpackage Import + */ + +DEFINE('WHMCS_DIR','/var/www/whmcs/'); +include_once WHMCS_DIR.'includes/functions.php'; + +/** + * WHMCS import module + * + * @package AgileBill + * @subpackage Import + */ +class import_plugin extends import { + private $encryption_key; + + public function __construct() { + # Configure the database name, host, and login: + $this->host = 'localhost'; + $this->db = ''; + $this->user = ''; + $this->pass = ''; + $this->type = 'mysql'; + + # If importing CC details, enter the gateway plugin to use for recurring charges: + $this->gateway = 'AUTHORIZE_NET'; + + # Do not change anything past this line: + $this->name = 'WHMCS'; + $this->plugin = 'WHMCS'; + $this->select_limit = 50; + + $this->instructions = ' +Preliminary Instructions:

    +
      +
    1. Open '. __FILE__ .' and edit the database settings, and the location to your WHMCS_DIR...
    2. +
    3. If you will be importing credit card details, paste the Checkout Plugin name from the checkout plugin list page to the "$this->gateway" value +that will be used to process all recurring charges... this should be a gateway such as AUTHORIZE_NET or LINKPOINT.
    4. +
    5. Make sure you have your TLD configurations set, before importing domains.
    6. +
    7. HINT: Before importing products, ensure that you have configured your map file, this will set the SKU, and will save you changing this data if you need to undo and re-import.
    8. +
    '; + + array_push($this->actions,array( + 'name' => 'test', + 'desc' => 'Step 1: Test the database connection', + 'depn' => false + )); + + array_push($this->actions,array( + 'name' => 'product_cat', + 'desc' => 'Step 2: Import the Product Categories', + 'depn' => array('test') + )); + + array_push($this->actions,array( + 'name' => 'products', + 'desc' => 'Step 3: Import the Products', + 'depn' => array('test','product_cat') + )); + + array_push($this->actions,array( + 'name' => 'accounts', + 'desc' => 'Step 4: Import the Accounts', + 'depn' => array('test') + )); + + array_push($this->actions,array( + 'name' => 'pre_services', + 'desc' => 'Step 5: Edit the Products (update the SKU details if necessary) then click Ready', + 'depn' => array('products') + )); + + array_push($this->actions,array( + 'name' => 'services', + 'desc' => 'Step 6: Import the Services', + 'depn' => array('pre_services','accounts') + )); + + array_push($this->actions,array( + 'name' => 'pre_tld', + 'desc' => 'Step 7: Set up your TLD then click Ready', + 'depn' => array('test') + )); + + array_push($this->actions,array( + 'name' => 'domains', + 'desc' => 'Step 8: Import the Domains', + 'depn' => array('pre_tld','accounts') + )); + + array_push($this->actions,array( + 'name' => 'invoices', + 'desc' => 'Step 9: Import the Invoices', + 'depn' => array('services','accounts') + )); + + array_push($this->actions,array( + 'name' => 'invoice_items', + 'desc' => 'Step 10: Import the Invoices Items', + 'depn' => array('invoices') + )); + } + + protected function pre_services() { + $this->pre_test(); + } + + protected function pre_tld() { + $this->pre_test(); + } + + /** + * Product Categories + */ + protected function product_cat() { + global $VAR,$C_debug; + + # Connect to the remote DB + $dbr = &NewADOConnection($this->type); + $dbr->Connect($this->host,$this->user,$this->pass,$this->db); + + # Determine the offset for the account + if (empty($VAR['offset'])) + $VAR['offset'] = 0; + + $offset = sprintf('%s,%s',$VAR['offset'],$this->select_limit); + $remote_table = 'tblproductgroups'; + $ab_table = 'product_cat'; + + # Select + $sql = sprintf('SELECT * FROM %s',$remote_table); + $rs = $dbr->SelectLimit($sql,$this->select_limit,$offset); + + if ($rs === false) { + $C_debug->alert(sprintf('Query to the table "%s" failed!',$remote_table)); + + return false; + } + + if ($rs->RecordCount() == 0) { + $C_debug->alert('No more records to process!'); + printf("",$VAR['plugin']); + + return; + } + + $msg = sprintf('Processing %s Records...
    ',$rs->RecordCount()); + + $map = array(); + $map['name'] = 'name'; + $map['position'] = 'order'; + + # Loop through each remote item + while (! $rs->EOF) { + $msg .= sprintf('
    Processing : %s...',$rs->fields['name']); + + # Start a new transaction for the insert: + $db = &DB(); + $db->StartTrans(); + + $update = array(); + foreach ($map as $a => $b) + $update[$a] = $rs->fields[$b]; + + $update['parent_id'] = 0; + $update['group_avail'] = serialize(array('0'=>'0')); + $update['template'] = 'Paged Listing'; + $update['notes'] = 'Imported from WHMCS'; + $update['thumbnail'] = ''; + $update['image'] = ''; + $update['max'] = '10'; + + if ($rs->fields['hidden'] == 'on') + $update['status'] = 0; + else + $update['status'] = 1; + + # Import the item + $db->Execute(sqlInsert($db,$ab_table,$update)); + $id = $db->Execute(sqlSelect($db,$ab_table,'id',$update,'','0,1')); + + # Insert the import record + $this->import_transaction($this->plugin,$VAR['action'],$ab_table,$id->fields['id'],$remote_table,$rs->fields['id'],$db); + + # Complete the transaction + $db->CompleteTrans(); + $rs->MoveNext(); + } + + $C_debug->alert($msg); + + printf("", + $VAR['offset']+$this->select_limit,$VAR['action'],$VAR['plugin']); + } + + /** + * Products + */ + protected function products() { + global $VAR,$C_debug; + + # Connect to the remote DB + $dbr = &NewADOConnection($this->type); + $dbr->Connect($this->host,$this->user,$this->pass,$this->db); + + # Determine the offset for the account + if (empty($VAR['offset'])) + $VAR['offset'] = 0; + + $offset = sprintf('%s,%s',$VAR['offset'],$this->select_limit); + $remote_table = 'tblproducts'; + $ab_table = 'product'; + + # Select + $sql = sprintf('SELECT * FROM %s',$remote_table); + $rs = $dbr->SelectLimit($sql,$this->select_limit,$offset); + + if ($rs === false) { + $C_debug->alert(sprintf('Query to the table "%s" failed!',$remote_table)); + + return false; + } + + if ($rs->RecordCount() == 0) { + $C_debug->alert('No more records to process!'); + printf("",$VAR['plugin']); + + return; + } + + # Load Categories Imported + $db = &DB(); + $imprs = $db->Execute(sqlSelect($db,'import','ab_id,remote_id',sprintf('plugin=::%s:: AND action=::%s::',$this->plugin,'product_cat'))); + while (! $imprs->EOF) { + $cat[$imprs->fields['remote_id']] = $imprs->fields['ab_id']; + $imprs->MoveNext(); + } + + $msg = sprintf('Processing %s Records...
    ',$rs->RecordCount()); + + # If there is a map file, open it + $pmap = $this->read_map(); + + # Table mapping + $map = array(); + $map['price_setup'] = 'msetupfee'; + $map['price_base'] = 'monthly'; + + # Loop through each remote item + while (! $rs->EOF) { + $msg .= sprintf('
    Processing : %s...',$rs->fields['name']); + + # Start a new transaction for the insert: + $db = &DB(); + $db->StartTrans(); + + $update = array(); + foreach ($map as $a => $b) + $update[$a] = $rs->fields[$b]; + + $update['date_last'] = time(); + $update['sku'] = sprintf('IMPORT-%s',$rs->fields['id']); + $update['taxable'] = 1; + $update['group_avail'] = serialize(array('0'=>'0')); + $update['avail_category_id'] = serialize(array('0'=>$cat[$rs->fields['gid']])); + $update['price_type'] = 1; + $update['price_recurr_default'] = 1; + $update['price_recurr_weekday'] = 1; + $update['price_recurr_week'] = 1; + $update['price_recurr_schedule'] = 0; + $update['price_recurr_type'] = 1; + + if ($rs->fields['hidden'] == 'on') + $update['active'] = 0; + else + $update['active'] = 1; + + # Pricing + $pricing = array(); + # * Weekly + $pricing[0]['show'] = '0'; + $pricing[0][0]['price_base'] = '0'; + $pricing[0][0]['price_setup'] = '0'; + # * Monthly + $pricing[1]['show'] = $rs->fields['monthly'] > 0 ? '1' : '0'; + $pricing[1][0]['price_base'] = $rs->fields['monthly']; + $pricing[1][0]['price_setup'] = $rs->fields['msetupfee']; + # * Quarterly + $pricing[2]['show'] = $rs->fields['quarterly'] > 0 ? '1' : '0'; + $pricing[2][0]['price_base'] = $rs->fields['quarterly']; + $pricing[2][0]['price_setup'] = $rs->fields['qsetupfee']; + # * 6 Months + $pricing[3]['show'] = $rs->fields['semiannual'] > 0 ? '1' : '0'; + $pricing[3][0]['price_base'] = $rs->fields['semiannual']; + $pricing[3][0]['price_setup'] = $rs->fields['ssetupfee']; + # * 12 Months + $pricing[4]['show'] = $rs->fields['annual'] > 0 ? '1' : '0'; + $pricing[4][0]['price_base'] = $rs->fields['annual']; + $pricing[4][0]['price_setup'] = $rs->fields['asetupfee']; + # * 24 Months + $pricing[5]['show'] = $rs->fields['biennial'] > 0 ? '1' : '0'; + $pricing[5][0]['price_base'] = $rs->fields['biennial']; + $pricing[5][0]['price_setup'] = $rs->fields['bsetupfee']; + # * 36 Months + $pricing[6]['show'] = '0'; + $pricing[6][0]['price_base'] = '0'; + $pricing[6][0]['price_setup'] = '0'; + + $update['price_group'] = serialize($pricing); + + # Get the fixed items in the map table. + if (isset($pmap[$ab_table][$rs->fields['id']*1])) + foreach ($pmap[$ab_table][$rs->fields['id']*1] as $field => $value) + $update[$field] = $value; + + # Import the item + $db->Execute(sqlInsert($db,$ab_table,$update)); + $id = $db->Execute(sqlSelect($db,$ab_table,'id',$update,'','0,1')); + + # Insert the import record + $this->import_transaction($this->plugin,$VAR['action'],$ab_table,$id->fields['id'],$remote_table,$rs->fields['id'],$db); + + # Add translations + $submap = array(); + $submap['name'] = 'name'; + $submap['description_short'] = 'name'; + $submap['description_full'] = 'description'; + + $update = array(); + foreach ($submap as $a => $b) + $update[$a] = $rs->fields[$b]; + + $update['language_id'] = DEFAULT_LANGUAGE; + $update['product_id'] = $id->fields['id']; + + # @todo For some reason sqlInsert() generates an error, so we need to produce the SQL and run it normally + $update['site_id'] = DEFAULT_SITE; + # @todo It seems translations are referenced by 'id', rather than 'product_id' + $update['id'] = $id->fields['id']; + $sql = sprintf("INSERT INTO %s (%s) VALUES ('%s')",AGILE_DB_PREFIX.'product_translate',implode(',',array_keys($update)),implode("','",$update)); + $pdrs = $db->Execute($sql); + if (! $pdrs && $db->_errorMsg) { + printf("
    * %s\n%s
    ",$db->_errorMsg,$sql); + } + + $this->import_transaction($this->plugin,$VAR['action'],'product_translate',$update['id'],'',$rs->fields['id'],$db); + + # Complete the transaction + $db->CompleteTrans(); + $rs->MoveNext(); + } + + $C_debug->alert($msg); + + printf("", + $VAR['offset']+$this->select_limit,$VAR['action'],$VAR['plugin']); + } + + /** + * Accounts + */ + protected function accounts() { + global $VAR,$C_debug; + + # Files to your WHMCS installation (required to decrypt encrypted fields) + include_once WHMCS_DIR.'dbconnect.php'; + + # Connect to the remote DB + $dbr = &NewADOConnection($this->type); + $dbr->Connect($this->host,$this->user,$this->pass,$this->db); + + # Determine the offset for the account + if (empty($VAR['offset'])) + $VAR['offset'] = 0; + + $offset = sprintf('%s,%s',$VAR['offset'],$this->select_limit); + $remote_table = 'tblclients'; + $ab_table = 'account'; + + # Select + $sql = sprintf('SELECT * FROM %s',$remote_table); + $rs = $dbr->SelectLimit($sql,$this->select_limit,$offset); + + if ($rs === false) { + $C_debug->alert(sprintf('Query to the table "%s" failed!',$remote_table)); + + return false; + } + + if ($rs->RecordCount() == 0) { + $C_debug->alert('No more records to process!'); + printf("",$VAR['plugin']); + + return; + } + + $msg = sprintf('Processing %s Records...
    ',$rs->RecordCount()); + + $map = array(); + $map['username'] = 'email'; + #$map['email'] = 'email'; + $map['first_name'] = 'firstname'; + $map['last_name'] = 'lastname'; + $map['company'] = 'companyname'; + $map['address1'] = 'address1'; + $map['address2'] = 'address2'; + $map['city'] = 'city'; + $map['state'] = 'state'; + $map['zip'] = 'postcode'; + + # Loop through each remote item + while (! $rs->EOF) { + $msg .= sprintf('
    Processing : %s...',$rs->fields['email']); + + # Start a new transaction for the insert: + $db = &DB(); + $db->StartTrans(); + + $update = array(); + foreach ($map as $a => $b) + $update[$a] = $rs->fields[$b]; + + $update['date_last'] = time(); + $update['language_id'] = DEFAULT_LANGUAGE; + # @todo Work out currency based on country address + $update['country_id'] = '36'; + $update['currency_id'] = '6'; + $update['theme_id'] = DEFAULT_THEME; + $update['email_type'] = '1'; + $update['invoice_delivery'] = '1'; + $update['invoice_show_itemized'] = '1'; + $update['invoice_grace'] = '0'; + $update['invoice_advance_gen'] = '0'; + + if ($rs->fields['status'] == 'Active') + $update['status'] = 1; + else + $update['status'] = 0; + + $update['password'] = md5(decrypt($rs->fields['password'],$encryption_key)); + + # Import the item + $db->Execute(sqlInsert($db,$ab_table,$update)); + $id = $db->Execute(sqlSelect($db,$ab_table,'id',$update,'','0,1')); + + # Insert the import record + $this->import_transaction($this->plugin,$VAR['action'],$ab_table,$id->fields['id'],$remote_table,$rs->fields['id'],$db); + + # Complete the transaction + $db->CompleteTrans(); + $rs->MoveNext(); + } + + $C_debug->alert($msg); + + printf("", + $VAR['offset']+$this->select_limit,$VAR['action'],$VAR['plugin']); + } + + /** + * Services + */ + protected function services() { + global $VAR,$C_debug; + + # Files to your WHMCS installation (required to decrypt encrypted fields) + include_once WHMCS_DIR.'dbconnect.php'; + + # Connect to the remote DB + $dbr = &NewADOConnection($this->type); + $dbr->Connect($this->host,$this->user,$this->pass,$this->db); + + # Determine the offset for the account + if (empty($VAR['offset'])) + $VAR['offset'] = 0; + + $offset = sprintf('%s,%s',$VAR['offset'],$this->select_limit); + $remote_table = 'tblhosting'; + $ab_table = 'service'; + + # Select + $sql = ' +SELECT tblhosting.id as id, userid, packageid, domainstatus, domain, amount, regdate, lastupdate, billingcycle, username, password, nextinvoicedate, tblproducts.name as product +FROM tblhosting,tblproducts where tblhosting.packageid=tblproducts.id'; + $rs = $dbr->SelectLimit($sql,$this->select_limit,$offset); + + if ($rs === false) { + $C_debug->alert(sprintf('Query to the table "%s" failed!',$remote_table)); + + return false; + } + + if ($rs->RecordCount() == 0) { + $C_debug->alert('No more records to process!'); + printf("",$VAR['plugin']); + + return; + } + + $db = &DB(); + + # Load Products Imported + $imprs = $db->Execute(sqlSelect($db,'import','ab_id,remote_id',sprintf('plugin=::%s:: AND action=::%s:: AND remote_table=::%s::',$this->plugin,'products','tblproducts'))); + while (! $imprs->EOF) { + $prod[$imprs->fields['remote_id']] = $imprs->fields['ab_id']; + $imprs->MoveNext(); + } + + # Load Accounts Imported + $imprs = $db->Execute(sqlSelect($db,'import','ab_id,remote_id',sprintf('plugin=::%s:: AND action=::%s:: AND remote_table=::%s::',$this->plugin,'accounts','tblclients'))); + while (! $imprs->EOF) { + $account[$imprs->fields['remote_id']] = $imprs->fields['ab_id']; + $imprs->MoveNext(); + } + + $msg = sprintf('Processing %s Records...
    ',$rs->RecordCount()); + + $map = array(); + # @todo This amount includes tax, and needs to exclude it. + $map['price'] = 'amount'; + + # Loop through each remote item + while (! $rs->EOF) { + $msg .= sprintf('
    Processing : %s...',$rs->fields['id']); + + # Start a new transaction for the insert: + $db = &DB(); + $db->StartTrans(); + + $update = array(); + foreach ($map as $a => $b) + $update[$a] = $rs->fields[$b]; + + # @todo This amount includes tax, and needs to work out tax. + $update['price'] = sprintf('%3.2f',$update['price']/11*10); + + if (preg_match('/^ADSL/',$rs->fields['product'])) { + $update['prod_plugin_name'] = 'ADSL'; + $update['type'] = 'product'; + + $sql = sprintf("SELECT fieldname,value FROM tblcustomfieldsvalues,tblcustomfields WHERE tblcustomfieldsvalues.fieldid=tblcustomfields.id AND tblcustomfieldsvalues.relid=%s AND tblcustomfields.relid=%s AND type='product'",$rs->fields['id'],$rs->fields['packageid']); + + $plugin = array(); + $update['prod_attr'] = ''; + + # Connect to the remote DB + $dbr = NewADOConnection($this->type); + $dbr->Connect($this->host,$this->user,$this->pass,$this->db); + + $adsl = $dbr->Execute($sql); + + if ($adsl && $adsl->RecordCount()) { + while (! $adsl->EOF) { + if (trim($adsl->fields['value'])) { + $plugin[$adsl->fields['fieldname']] = $adsl->fields['value']; + $update['prod_attr'] .= sprintf("%s==%s\r\n",$adsl->fields['fieldname'],$adsl->fields['value']); + $update['host_username'] = $rs->fields['username']; + $update['host_password'] = decrypt($rs->fields['password'],$encryption_key); + } + + $adsl->MoveNext(); + } + + $update['prod_plugin_data'] = serialize($plugin); + } + + } elseif ($rs->fields['domain']) { + $update['type'] = 'host'; + $update['domain_name'] = $rs->fields['domain']; + $update['host_username'] = $rs->fields['username']; + $update['host_password'] = decrypt($rs->fields['password'],$encryption_key); + } + + # Strip the leading zeros + $rs->fields['packageid'] *= 1; + $rs->fields['userid'] *= 1; + $update['product_id'] = $prod[$rs->fields['packageid']]; + $update['account_id'] = $account[$rs->fields['userid']]; + + $db = &DB(); + $sku = $db->Execute(sqlSelect($db,'product','sku',sprintf('id=%s',$update['product_id']),'','0,1')); + $update['sku'] = $sku->fields['sku']; + + if ($rs->fields['domainstatus'] == 'Active') + $update['active'] = 1; + else + $update['active'] = 0; + + $update['taxable'] = 1; + $update['recur_schedule_change'] = 0; + $update['suspend_billing'] = 0; + $update['recur_cancel'] = 0; + $update['recur_modify'] = 0; + + switch ($rs->fields['billingcycle']) { + case 'Annually': + $update['recur_schedule'] = 4; //monthly + $update['recur_type'] = 0; + + break; + + case 'Monthly': + $update['recur_schedule'] = 1; //monthly + $update['recur_type'] = 1; + $update['recur_type'] = 1; + $update['recur_weekday'] = 1; + + break; + + case 'Quarterly': + $update['recur_schedule'] = 2; //quarterly + $update['recur_type'] = 1; + $update['recur_weekday'] = 1; + + break; + + case 'Biennially': + $update['recur_schedule'] = 5; //two-years + $update['recur_type'] = 0; + + break; + + default: + $update['recur_schedule'] = 0; //free? + $update['recur_type'] = 0; + }; + + $update['date_next_invoice'] = strtotime($rs->fields['nextinvoicedate']); + $update['date_orig'] = strtotime($rs->fields['regdate']); + $update['date_last'] = strtotime($rs->fields['lastupdate']); + + # Import the item + $db->Execute(sqlInsert($db,$ab_table,$update)); + $id = $db->Execute(sqlSelect($db,$ab_table,'id',$update,'','0,1')); + + # Insert the import record + $this->import_transaction($this->plugin,$VAR['action'],$ab_table,$id->fields['id'],$remote_table,$rs->fields['id'],$db); + + # Complete the transaction + $db->CompleteTrans(); + $rs->MoveNext(); + } + + $C_debug->alert($msg); + + printf("", + $VAR['offset']+$this->select_limit,$VAR['action'],$VAR['plugin']); + } + + /** + * Domains + */ + protected function domains() { + global $VAR,$C_debug; + + # Files to your WHMCS installation (required to decrypt encrypted fields) + include_once WHMCS_DIR.'dbconnect.php'; + + # Connect to the remote DB + $dbr = &NewADOConnection($this->type); + $dbr->Connect($this->host,$this->user,$this->pass,$this->db); + + # Determine the offset for the account + if (empty($VAR['offset'])) + $VAR['offset'] = 0; + + $offset = sprintf('%s,%s',$VAR['offset'],$this->select_limit); + $remote_table = 'tbldomains'; + $ab_table = 'service'; + + # Select + $sql = sprintf('SELECT * FROM %s',$remote_table); + $rs = $dbr->SelectLimit($sql,$this->select_limit,$offset); + + if ($rs === false) { + $C_debug->alert(sprintf('Query to the table "%s" failed!',$remote_table)); + + return false; + } + + if ($rs->RecordCount() == 0) { + $C_debug->alert('No more records to process!'); + printf("",$VAR['plugin']); + + return; + } + + $db = &DB(); + + # Load Accounts Imported + $imprs = $db->Execute(sqlSelect($db,'import','ab_id,remote_id',sprintf('plugin=::%s:: AND action=::%s:: AND remote_table=::%s::',$this->plugin,'accounts','tblclients'))); + while (! $imprs->EOF) { + $account[$imprs->fields['remote_id']] = $imprs->fields['ab_id']; + $imprs->MoveNext(); + } + + $msg = sprintf('Processing %s Records...
    ',$rs->RecordCount()); + + $map = array(); + $map['domain_term'] = 'registrationperiod'; + + # Loop through each remote item + while (! $rs->EOF) { + $msg .= sprintf('
    Processing : %s...',$rs->fields['domain']); + + # Start a new transaction for the insert: + $db = &DB(); + $db->StartTrans(); + + $update = array(); + foreach ($map as $a => $b) + $update[$a] = $rs->fields[$b]; + + # @todo Determine price from register details + $update['price'] = 45*$update['domain_term']; + + $update['type'] = 'domain'; + $update['sku'] = 'DOMAIN-RENEW'; + + # Strip the leading zeros + $rs->fields['userid'] *= 1; + $update['account_id'] = $account[$rs->fields['userid']]; + + if ($rs->fields['status'] == 'Active') + $update['active'] = 1; + else + $update['active'] = 0; + + $update['price_type'] = 0; + $update['taxable'] = 1; + $update['domain_date_expire'] = strtotime($rs->fields['expirydate']); + + switch ($rs->fields['type']) { + case 'Register': + default: + $update['domain_type'] = 'register'; + break; + } + + $update['date_next_invoice'] = strtotime($rs->fields['nextinvoicedate']); + $update['date_orig'] = strtotime($rs->fields['registrationdate']); + $update['date_last'] = time(); + + # Work out TLD and REGISTER PLUGIN + $arr = explode('.',strtolower($rs->fields['domain'])); + $update['domain_tld'] = ''; + $update['domain_name'] = $arr[0]; + + for ($i=1; $iExecute(sqlSelect($db,'host_tld','id,registrar_plugin_id',sprintf('name=::%s::',$update['domain_tld']))); + $update['domain_host_tld_id'] = $tldrs->fields['id']; + $update['domain_host_registrar_id'] = $tldrs->fields['registrar_plugin_id']; + + # Import the item + $db->Execute(sqlInsert($db,$ab_table,$update)); + $id = $db->Execute(sqlSelect($db,$ab_table,'id',$update,'','0,1')); + + # Insert the import record + $this->import_transaction($this->plugin,$VAR['action'],$ab_table,$id->fields['id'],$remote_table,$rs->fields['id'],$db); + + # Complete the transaction + $db->CompleteTrans(); + $rs->MoveNext(); + } + + $C_debug->alert($msg); + + printf("", + $VAR['offset']+$this->select_limit,$VAR['action'],$VAR['plugin']); + } + + /** + * Invoices + */ + protected function invoices() { + global $VAR,$C_debug; + + # Connect to the remote DB + $dbr = &NewADOConnection($this->type); + $dbr->Connect($this->host,$this->user,$this->pass,$this->db); + + # Determine the offset for the account + if (empty($VAR['offset'])) + $VAR['offset'] = 0; + + $offset = sprintf('%s,%s',$VAR['offset'],$this->select_limit); + $remote_table = 'tblinvoices'; + $ab_table = 'invoice'; + + # Select + $sql = sprintf('SELECT * FROM %s',$remote_table); + $rs = $dbr->SelectLimit($sql,$this->select_limit,$offset); + + if ($rs === false) { + $C_debug->alert(sprintf('Query to the table "%s" failed!',$remote_table)); + + return false; + } + + if ($rs->RecordCount() == 0) { + $C_debug->alert('No more records to process!'); + printf("",$VAR['plugin']); + + return; + } + + $db = &DB(); + + # Load Accounts Imported + $imprs = $db->Execute(sqlSelect($db,'import','ab_id,remote_id',sprintf('plugin=::%s:: AND action=::%s:: AND remote_table=::%s::',$this->plugin,'accounts','tblclients'))); + while (! $imprs->EOF) { + $account[$imprs->fields['remote_id']] = $imprs->fields['ab_id']; + $imprs->MoveNext(); + } + + $msg = sprintf('Processing %s Records...
    ',$rs->RecordCount()); + + $map = array(); + # Our invoice ID should be preserved + $map['tax_amt'] = 'tax'; + $map['total_amt'] = 'total'; + + # Loop through each remote item + while (! $rs->EOF) { + $msg .= sprintf('
    Processing : %s...',$rs->fields['id']); + + # Start a new transaction for the insert: + $db = &DB(); + $db->StartTrans(); + + $update = array(); + foreach ($map as $a => $b) + $update[$a] = $rs->fields[$b]; + + # Strip the leading zeros + $rs->fields['userid'] *= 1; + $update['account_id'] = $account[$rs->fields['userid']]; + + # @todo Might be nice to automatically work out the currency + $update['billed_currency_id'] = 6; + $update['actual_billed_currency_id'] = 6; + $update['type'] = 1; + + $update['date_orig'] = strtotime($rs->fields['date']); + $update['due_date'] = strtotime($rs->fields['duedate']); + $update['refund_status'] = 0; + + $update['total_amt'] += $rs->fields['credit']; + switch ($rs->fields['status']) { + case 'Unpaid': + $update['billed_amt'] = 0; + $update['process_status'] = 1; + $update['billing_status'] = 0; + $update['status'] = 1; + + break; + + case 'Paid': + $update['billed_amt'] = $rs->fields['total']+$rs->fields['credit']; + $update['process_status'] = 1; + $update['billing_status'] = 1; + $update['status'] = 1; + + break; + + case 'Cancelled': + $update['billed_amt'] = 0; + $update['process_status'] = 0; + $update['billing_status'] = 0; + $update['status'] = 0; + + break; + } + + # Import the item + $db->Execute(sqlInsert($db,$ab_table,$update,$rs->fields['id'])); + + # Insert the import record + $this->import_transaction($this->plugin,$VAR['action'],$ab_table,$rs->fields['id'],$remote_table,$rs->fields['id'],$db); + + # Complete the transaction + $db->CompleteTrans(); + $rs->MoveNext(); + } + + $C_debug->alert($msg); + + printf("", + $VAR['offset']+$this->select_limit,$VAR['action'],$VAR['plugin']); + } + + /** + * Invoice Items + */ + protected function invoice_items() { + global $VAR,$C_debug; + + # Connect to the remote DB + $dbr = &NewADOConnection($this->type); + $dbr->Connect($this->host,$this->user,$this->pass,$this->db); + + # Determine the offset for the account + if (empty($VAR['offset'])) + $VAR['offset'] = 0; + + $offset = sprintf('%s,%s',$VAR['offset'],$this->select_limit); + $remote_table = 'tblinvoiceitems'; + $ab_table = 'invoice_item'; + + # Select + $sql = sprintf('SELECT * FROM %s',$remote_table); + $rs = $dbr->SelectLimit($sql,$this->select_limit,$offset); + + if ($rs === false) { + $C_debug->alert(sprintf('Query to the table "%s" failed!',$remote_table)); + + return false; + } + + if ($rs->RecordCount() == 0) { + $C_debug->alert('No more records to process!'); + printf("",$VAR['plugin']); + + return; + } + + $db = &DB(); + + # Load Products Imported + $imprs = $db->Execute(sqlSelect($db,'import','ab_id,remote_id',sprintf('plugin=::%s:: AND action=::%s:: AND remote_table=::%s::',$this->plugin,'services','tblhosting'))); + while (! $imprs->EOF) { + $service[$imprs->fields['remote_id']] = $imprs->fields['ab_id']; + $imprs->MoveNext(); + } + + # Load Accounts Imported + $imprs = $db->Execute(sqlSelect($db,'import','ab_id,remote_id',sprintf('plugin=::%s:: AND action=::%s:: AND remote_table=::%s::',$this->plugin,'accounts','tblclients'))); + while (! $imprs->EOF) { + $account[$imprs->fields['remote_id']] = $imprs->fields['ab_id']; + $imprs->MoveNext(); + } + + # Load Domains Imported + $imprs = $db->Execute(sqlSelect($db,'import','ab_id,remote_id',sprintf('plugin=::%s:: AND action=::%s:: AND remote_table=::%s::',$this->plugin,'domains','tbldomains'))); + while (! $imprs->EOF) { + $domain[$imprs->fields['remote_id']] = $imprs->fields['ab_id']; + $imprs->MoveNext(); + } + + # Load Products Imported + $imprs = $db->Execute(sqlSelect($db,'import','ab_id,remote_id',sprintf('plugin=::%s:: AND action=::%s:: AND remote_table=::%s::',$this->plugin,'products','tblproducts'))); + while (! $imprs->EOF) { + $prod[$imprs->fields['remote_id']] = $imprs->fields['ab_id']; + $imprs->MoveNext(); + } + + $msg = sprintf('Processing %s Records...
    ',$rs->RecordCount()); + + $map = array(); + # Our invoice ID should be preserved + $map['invoice_id'] = 'invoiceid'; + $map['product_name'] = 'description'; + + # Loop through each remote item + while (! $rs->EOF) { + $msg .= sprintf('
    Processing : %s...',$rs->fields['id']); + + # Start a new transaction for the insert: + $db = &DB(); + $db->StartTrans(); + + $update = array(); + foreach ($map as $a => $b) + $update[$a] = $rs->fields[$b]; + + # Strip the leading zeros + $rs->fields['relid'] *= 1; + $rs->fields['userid'] *= 1; + + $update['account_id'] = $account[$rs->fields['userid']]; + $update['item_type'] = 3; + $update['price_type'] = 0; + + $product = ''; + switch ($rs->fields['type']) { + case 'Addon': + break; + + case 'Domain': + if (isset($domain[$rs->fields['relid']])) + $update['service_id'] = $domain[$rs->fields['relid']]; + + $update['sku'] = 'DOMAIN-REGISTER'; + break; + + + default: + if (isset($service[$rs->fields['relid']])) + $update['service_id'] = $service[$rs->fields['relid']]; + + # Get the Product + $dbr = &NewADOConnection($this->type); + $dbr->Connect($this->host,$this->user,$this->pass,$this->db); + + $tldrs = $dbr->Execute(sprintf('SELECT packageid FROM tblhosting WHERE id=%s',$rs->fields['relid'])); + if (isset($tldrs->fields['packageid'])) { + $tldrs->fields['packageid'] *= 1; + $update['product_id'] = $prod[$tldrs->fields['packageid']]; + + $db = &DB(); + $sku = $db->Execute(sqlSelect($db,'product','sku',sprintf('id=%s',$update['product_id']),'','0,1')); + $update['sku'] = $sku->fields['sku']; + + $prod_name = $dbr->Execute(sprintf('SELECT name,paytype from tblproducts WHERE id=%s',$tldrs->fields['packageid'])); + $product = $prod_name->fields['name']; + + if ($prod_name->fields['paytype'] == 'recurring') { + $update['price_type'] = 1; + $update['item_type'] = 0; + } + } + } + + # Detect the dates and domain from the product_name + if ($update['product_name']) { + # Chop of the dates. + $reg = '/\s+\(([0-9]+\/[0-9]+\/[0-9]+)\s+-\s+([0-9]+\/[0-9]+\/[0-9]+)\)$/'; + + $matches = array(); + if (preg_match($reg,$update['product_name'],$matches)) { + $update['date_start'] = strtotime(str_replace('/','-',$matches[1])); + $update['date_stop'] = strtotime(str_replace('/','-',$matches[2])); + $update['product_name'] = str_replace($matches[0],'',$update['product_name']); + + # Find the domain portion + if (isset($product) && $product) { + $product_reg = str_replace('/','\/',$product); + if (preg_match("/^{$product_reg}\s+/",$update['product_name'])) { + $aaa = preg_replace("/^{$product_reg}\s+-\s+/",'',$update['product_name']); + + if ($update['product_name'] != $product) { + $update['domain_name'] = $aaa; + $update['product_name'] = preg_replace("/\s+-\s+{$aaa}/",'',$update['product_name']); + } + } + } + } + } + + $update['quantity'] = 1; + $update['tax_amt'] = sprintf('%3.2f',$rs->fields['amount']/11); + $update['total_amt'] = $rs->fields['amount']-$update['tax_amt']; + $update['price_base'] = $rs->fields['amount']-$update['tax_amt']; + + # Import the item + $db = &DB(); + $id = sqlGenID($db,$ab_table); + $result = $db->Execute(sqlInsert($db,$ab_table,$update,$id)); + + # Insert the import record + $this->import_transaction($this->plugin,$VAR['action'],$ab_table,$id,$remote_table,$rs->fields['id'],$db); + + # Complete the transaction + $db->CompleteTrans(); + $rs->MoveNext(); + } + + $C_debug->alert($msg); + + printf("", + $VAR['offset']+$this->select_limit,$VAR['action'],$VAR['plugin']); + } +} +?> diff --git a/plugins/import/WHMCS_map.xml b/plugins/import/WHMCS_map.xml new file mode 100644 index 00000000..9d6403d7 --- /dev/null +++ b/plugins/import/WHMCS_map.xml @@ -0,0 +1,11 @@ + + + + 1 + example 2 + + + 2 + example 2 + + diff --git a/plugins/product/EXAMPLE.php b/plugins/product/EXAMPLE.php index c227c853..06c2778d 100644 --- a/plugins/product/EXAMPLE.php +++ b/plugins/product/EXAMPLE.php @@ -1,91 +1,117 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Plugins */ - -/** - * Product Plugin for AgileBill - * - * @copyright 2005,2006, and onward, Agileco, LLC. All rights reserverd. - * @license All usage subject to license terms of Agileco, LLC. - * - */ - + require_once PATH_MODULES.'product/base_product_plugin.inc.php'; -class plgn_prov_EXAMPLE extends base_product_plugin -{ - - var $name='EXAMPLE'; /* change this to your plugin name! */ - - /* create new service */ - function p_new() - { - /* do some background logging of what is going on */ - global $C_debug; - $C_debug->error('EXAMPLE.php', 'p_new ('.$this->service['queue'].')', print_r(array($this->plugin_data, $this->service),true) ); - - /* some available variables */ - $this->account['username']; /* all the fields on the account table, eg: id, username, email, first_name, last_name */ - $this->service['id']; /* all the fields in the service table, eg: id, host_username, host_password, etc */ - $this->plugin_data['my_field']; /* all the fields captured by the custom product plugin configuration template */ - - return true; - } - - /* edit existing service */ - function p_edit() { +/** + * Example Product Plugin - use this template to write your own plugins + * + * @package AgileBill + * @subpackage Plugins + */ +class plgn_prov_EXAMPLE extends base_product_plugin { + # Plugin Name + protected $name = 'EXAMPLE'; /* Change this to your plugin name! */ + # If this plugin provisions remote services + public $remote_based = false; - /* do some background logging of what is going on */ - global $C_debug; - $C_debug->error('EXAMPLE.php', 'p_edit ('.$this->service['queue'].')', print_r(array($this->plugin_data, $this->service),true) ); - - return true; - } - - /* deactivate existing service */ - function p_inactive() { + /** + * Provision new service + * + * Some available variables: + * * All the fields on the account table, eg: id,username,email,first_name,last_name + * $this->account['username']; + * * All the fields in the service table, eg: id,host_username,host_password + * $this->service['id']; + * * All the fields captured by the custom product plugin configuration template + * $this->plugin_data['my_field']; + */ + protected function p_new() { + # Do some background logging of what is going on + global $C_debug; + $C_debug->error(__FILE__,__METHOD__,print_r(array($this->plugin_data,$this->service),true)); - /* do some background logging of what is going on */ - global $C_debug; - $C_debug->error('EXAMPLE.php', 'p_inactive ('.$this->service['queue'].')', print_r(array($this->plugin_data, $this->service),true) ); - - return true; - } - - /* reactivate existing service */ - function p_active() { - - /* do some background logging of what is going on */ - global $C_debug; - $C_debug->error('EXAMPLE.php', 'p_active ('.$this->service['queue'].')', print_r(array($this->plugin_data, $this->service),true) ); - - return true; - } - - /* delete existing service */ - function p_delete() { - - /* do some background logging of what is going on */ - global $C_debug; - $C_debug->error('EXAMPLE.php', 'p_delete ('.$this->service['queue'].')', print_r(array($this->plugin_data, $this->service),true) ); - - return true; - } + return true; + } + + /** + * Modify service + */ + protected function p_edit() { + # Do some background logging of what is going on + global $C_debug; + $C_debug->error(__FILE__,__METHOD__,print_r(array($this->plugin_data,$this->service),true)); + + return true; + } + + /** + * Suspend service + */ + protected function p_inactive() { + # Do some background logging of what is going on + global $C_debug; + $C_debug->error(__FILE__,__METHOD__,print_r(array($this->plugin_data,$this->service),true)); + + return true; + } + + /** + * Activate service + */ + protected function p_active() { + # Do some background logging of what is going on + global $C_debug; + $C_debug->error(__FILE__,__METHOD__,print_r(array($this->plugin_data,$this->service),true)); + + return true; + } + + /** + * Delete service + */ + protected function p_delete() { + # Do some background logging of what is going on + global $C_debug; + $C_debug->error(__FILE__,__METHOD__,print_r(array($this->plugin_data,$this->service),true)); + + return true; + } + + /** + * Delete items from a cart + * Return is not used + */ + public function delete_cart($VAR,$cart) { + return; + } + + /** + * Validate items added to cart + */ + public function validate_cart($VAR,$cart) { + return true; + } } -?> \ No newline at end of file +?> diff --git a/reports/ticket/department.xml b/reports/ticket/department.xml deleted file mode 100644 index b334fbd2..00000000 --- a/reports/ticket/department.xml +++ /dev/null @@ -1,37 +0,0 @@ - -Department Ticket Statistics - - - SELECT B.name, count(A.id) as total from %%AGILE_DB_PREFIX%%ticket A join %%AGILE_DB_PREFIX%%ticket_department B on A.department_id=B.id - A.site_id = %%DEFAULT_SITE%% - GROUP BY name ORDER BY total DESC - - - - - SELECT B.name, count(A.id) as total from %%AGILE_DB_PREFIX%%ticket A join %%AGILE_DB_PREFIX%%ticket_department B on A.department_id=B.id - A.site_id = %%DEFAULT_SITE%% - GROUP BY name ORDER BY total DESC - 0 - - Department - name - true - true - true - - - Tickets - total - true - - - - SELECT from_unixtime(A.date_orig,"%Y-%u") as yearmonth, count(A.id) as total, B.name from %%AGILE_DB_PREFIX%%ticket A left join %%AGILE_DB_PREFIX%%ticket_department B on A.department_id=B.id - A.site_id = %%DEFAULT_SITE%% - GROUP BY yearmonth ORDER BY yearmonth ASC - - - - - \ No newline at end of file diff --git a/reports/ticket/staff.xml b/reports/ticket/staff.xml deleted file mode 100644 index 8af54fb7..00000000 --- a/reports/ticket/staff.xml +++ /dev/null @@ -1,37 +0,0 @@ - -Staff Ticket Statistics - - - SELECT B.nickname, count(A.id) as total from %%AGILE_DB_PREFIX%%ticket A join %%AGILE_DB_PREFIX%%staff B on A.staff_id=B.id - A.site_id = %%DEFAULT_SITE%% - GROUP BY nickname ORDER BY total DESC - - - - - SELECT B.nickname, count(A.id) as total from %%AGILE_DB_PREFIX%%ticket A join %%AGILE_DB_PREFIX%%staff B on A.staff_id=B.id - A.site_id = %%DEFAULT_SITE%% - GROUP BY nickname ORDER BY total DESC - 0 - - Staff - nickname - true - true - true - - - Tickets - total - true - - - - SELECT from_unixtime(A.date_orig,"%Y-%u") as yearmonth, count(A.id) as total, B.nickname from %%AGILE_DB_PREFIX%%ticket A left join %%AGILE_DB_PREFIX%%staff B on A.staff_id=B.id - A.site_id = %%DEFAULT_SITE%% - GROUP BY yearmonth ORDER BY yearmonth ASC - - - - - \ No newline at end of file diff --git a/reports/ticket/ticket_volume.xml b/reports/ticket/ticket_volume.xml deleted file mode 100644 index 27d31bc1..00000000 --- a/reports/ticket/ticket_volume.xml +++ /dev/null @@ -1,158 +0,0 @@ - -New Ticket Statistics - - By Year - SELECT from_unixtime(A.date_orig,"%Y") as yearmonth, count(A.id) as total from %%AGILE_DB_PREFIX%%ticket A - A.site_id = %%DEFAULT_SITE%% - GROUP BY yearmonth ORDER BY yearmonth - 0 - - Year: - yearmonth - true - - - true - true - false - - - - false - - - - - Total Tickets - total - true - - - - - - SELECT from_unixtime(A.date_orig,"%Y") as yearmonth, count(A.id) as total from %%AGILE_DB_PREFIX%%ticket A - A.site_id = %%DEFAULT_SITE%% - GROUP BY yearmonth ORDER BY yearmonth - - - - - - By Month - SELECT from_unixtime(A.date_orig,"%Y-%m") as yearmonth, count(A.id) as total from %%AGILE_DB_PREFIX%%ticket A - A.site_id = %%DEFAULT_SITE%% - GROUP BY yearmonth ORDER BY yearmonth - 0 - - Year and Month: - yearmonth - true - - - true - true - false - - - - false - - - - - Total Tickets - total - true - - - - - - SELECT from_unixtime(A.date_orig,"%Y-%m") as yearmonth, count(A.id) as total from %%AGILE_DB_PREFIX%%ticket A - A.site_id = %%DEFAULT_SITE%% - GROUP BY yearmonth ORDER BY yearmonth - - - - - - - By Week - SELECT from_unixtime(A.date_orig,"%Y-%u") as yearmonth, count(A.id) as total from %%AGILE_DB_PREFIX%%ticket A - A.site_id = %%DEFAULT_SITE%% - GROUP BY yearmonth ORDER BY yearmonth - 0 - - Year and Week: - yearmonth - true - - - true - true - false - - - - false - - - - - Total Tickets - total - true - - - - - - SELECT from_unixtime(A.date_orig,"%Y-%u") as yearmonth, count(A.id) as total from %%AGILE_DB_PREFIX%%ticket A - A.site_id = %%DEFAULT_SITE%% - GROUP BY yearmonth ORDER BY yearmonth - - - - - - - - By Day - SELECT from_unixtime(A.date_orig,"%Y-%m-%d") as yearmonth, count(A.id) as total from %%AGILE_DB_PREFIX%%ticket A - A.site_id = %%DEFAULT_SITE%% - GROUP BY yearmonth ORDER BY yearmonth - 0 - - Year, Month, and Day: - yearmonth - true - - - true - true - false - - - - false - - - - - Total Tickets - total - true - - - - - - SELECT from_unixtime(A.date_orig,"%Y-%m-%d") as yearmonth, count(A.id) as total from %%AGILE_DB_PREFIX%%ticket A - A.site_id = %%DEFAULT_SITE%% - GROUP BY yearmonth ORDER BY yearmonth - - - - - \ No newline at end of file diff --git a/task.php b/task.php deleted file mode 100644 index 3ee0196a..00000000 --- a/task.php +++ /dev/null @@ -1,54 +0,0 @@ -f; -require_once('includes/adodb/adodb.inc.php'); -require_once('includes/smarty/Smarty.class.php'); -require_once(PATH_CORE.'auth.inc.php'); -require_once(PATH_CORE.'database.inc.php'); -require_once(PATH_CORE.'list.inc.php'); -require_once(PATH_CORE.'method.inc.php'); -require_once(PATH_CORE.'session.inc.php'); -require_once(PATH_CORE.'theme.inc.php'); -require_once(PATH_CORE.'translate.inc.php'); -require_once(PATH_CORE.'setup.inc.php'); -require_once(PATH_CORE.'xml.inc.php'); -require_once(PATH_CORE.'crypt.inc.php'); -$C_debug = new CORE_debugger; -$C_setup = new CORE_setup; -$C_sess = new CORE_session; -$C_sess->session_constant(); -$C_translate= new CORE_translate; -$C_method = new CORE_method; -if ((isset($VAR['_login'])) && (isset($VAR['_username'])) && (isset($VAR['_password']))) { - require_once(PATH_CORE . 'login.inc.php'); - $C_login = new CORE_login_handler(); - $C_login->login($VAR); -} elseif (isset($VAR['_logout'])) { - require_once(PATH_CORE . 'login.inc.php'); - $C_login = new CORE_login_handler(); - $C_login->logout($VAR); -} -$C_sess->session_constant_log(); -$force = false; -$C_auth = new CORE_auth ($force); -$smarty = new Smarty; -$C_list = new CORE_list; -$C_block = new CORE_block; - - -require_once(PATH_MODULES . 'task/task.inc.php'); -$task = new task; - -if(!empty($VAR['id'])) $task->id=$VAR['id']; -elseif(!empty($_SERVER["argv"])) $task->id = $_SERVER["argv"][0]; - -set_time_limit(0); - -if(@$task->id) { - $task->run($VAR, &$task); -} else { - $task->run_all(); -} -?> \ No newline at end of file diff --git a/test.php b/test.php index 1718bffe..3247d35f 100644 --- a/test.php +++ b/test.php @@ -1,29 +1,34 @@ + * @copyright 2009 Deon George + * @link http://osb.leenooks.net * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt - * @author Tony Landis + * @author Tony Landis * @package AgileBill - * @version 1.4.93 + * @subpackage Core */ +/** + * The main AgileBill Test Page + */ -if(@$do == 'phpinfo' || @$_GET['do'] == 'phpinfo' || @$HTTP_GET_VARS['do'] == 'phpinfo'){ +if (@$do == 'phpinfo' || @$_GET['do'] == 'phpinfo' || @$HTTP_GET_VARS['do'] == 'phpinfo') { phpinfo(); exit; -} - +} error_reporting(0); $disabled_functions = ini_get('disable_functions'); @@ -32,205 +37,184 @@ phpinfo(); $php_info .= ob_get_contents(); ob_end_clean(); - ############################################################### -# GD -if (extension_loaded('gd')) -{ - $gd['font'] = "FFFFFF"; - $gd['back'] = "009900"; - $gd['text'] = "OK"; +# GD +if (extension_loaded('gd')) { + $gd['font'] = 'FFFFFF'; + $gd['back'] = '009900'; + $gd['text'] = 'OK'; } else { - $gd['font'] = "FFFFFF"; - $gd['back'] = "990000"; - $gd['text'] = "Failed."; -} - -############################################################### -# SSL - -$sslx = false; -if ( function_exists('curl_init') && !eregi('curl_init', $disabled_functions) && $curl_version = curl_version()) -{ - if (eregi('openssl', @$curl_version['ssl_version'] )) - { - $sslx = true; - } -} else { - if ( phpversion() >= '4.3.0' && function_exists("fsockopen") && - !eregi('fsockopen', $disabled_functions) && function_exists("openssl_public_decrypt")) - $sslx = true; -} - - -if ($sslx == true) -{ - $ssl['font'] = "FFFFFF"; - $ssl['back'] = "009900"; - $ssl['text'] = "OK"; -} else { - $ssl['font'] = "FFFFFF"; - $ssl['back'] = "990000"; - $ssl['text'] = "Failed!"; -} - -############################################################### -# PHP -if(phpversion() >= '5.0' ) -{ - $php['font'] = "FFFFFF"; - $php['back'] = "009900"; - $php['text'] = "OK"; -} else { - $php['font'] = "FFFFFF"; - $php['back'] = "990000"; - $php['text'] = "Failed! (PHP 5.0 or later is required)"; -} - -############################################################### -# MYSQL -if(is_callable("mysql_connect") && is_callable("mysql_get_client_info") && mysql_get_client_info() >= 4) -{ - $mysql['font'] = "FFFFFF"; - $mysql['back'] = "009900"; - $mysql['text'] = "OK"; -} else { - $mysql['font'] = "FFFFFF"; - $mysql['back'] = "990000"; - $mysql['text'] = "Failed! (MySQL 4.0 or later is required)"; -} - - -############################################################### -# XML -if(is_callable("xml_parser_create")) -{ - $xml['font'] = "FFFFFF"; - $xml['back'] = "009900"; - $xml['text'] = "OK"; -} else { - $xml['font'] = "FFFFFF"; - $xml['back'] = "990000"; - $xml['text'] = "Failed!"; + $gd['font'] = 'FFFFFF'; + $gd['back'] = '990000'; + $gd['text'] = 'Failed.'; } ############################################################### -# IMAP -if(is_callable("imap_open")) -{ - $imap['font'] = "FFFFFF"; - $imap['back'] = "009900"; - $imap['text'] = "OK"; +# SSL + +$sslx = false; +if (function_exists('curl_init') && ! preg_match('/curl_init/',$disabled_functions) && $curl_version = curl_version()) { + if (preg_match('/openssl/',@$curl_version['ssl_version'])) + $sslx = true; + } else { - $imap['font'] = "FFFFFF"; - $imap['back'] = "990000"; - $imap['text'] = "Failed!"; + if (phpversion() >= '4.3.0' && function_exists('fsockopen') && + ! preg_match('/fsockopen/',$disabled_functions) && function_exists('openssl_public_decrypt')) + $sslx = true; } +if ($sslx == true) { + $ssl['font'] = 'FFFFFF'; + $ssl['back'] = '009900'; + $ssl['text'] = 'OK'; +} else { + $ssl['font'] = 'FFFFFF'; + $ssl['back'] = '990000'; + $ssl['text'] = 'Failed!'; +} -?> +############################################################### +# PHP +if (phpversion() >= '5.0') { + $php['font'] = 'FFFFFF'; + $php['back'] = '009900'; + $php['text'] = 'OK'; +} else { + $php['font'] = 'FFFFFF'; + $php['back'] = '990000'; + $php['text'] = 'Failed! (PHP 5.0 or later is required)'; +} + +############################################################### +# MYSQL +if (is_callable('mysql_connect') && is_callable('mysql_get_client_info') && mysql_get_client_info() >= 4) { + $mysql['font'] = 'FFFFFF'; + $mysql['back'] = '009900'; + $mysql['text'] = 'OK'; +} else { + $mysql['font'] = 'FFFFFF'; + $mysql['back'] = '990000'; + $mysql['text'] = 'Failed! (MySQL 4.0 or later is required)'; +} + +############################################################### +# XML +if (is_callable('xml_parser_create')) { + $xml['font'] = 'FFFFFF'; + $xml['back'] = '009900'; + $xml['text'] = 'OK'; +} else { + $xml['font'] = 'FFFFFF'; + $xml['back'] = '990000'; + $xml['text'] = 'Failed!'; +} + +############################################################### +# IMAP +if (is_callable('imap_open')) { + $imap['font'] = 'FFFFFF'; + $imap['back'] = '009900'; + $imap['text'] = 'OK'; +} else { + $imap['font'] = 'FFFFFF'; + $imap['back'] = '990000'; + $imap['text'] = 'Failed!'; +} +?> + + AgileBill Compatibility Test - + + + -
    +
    + + + + + + + +
    + + + + +
    +
    Absolute Requirements
    +
    +
    + + + + + + + + + + + + + + + + +
    MySQL + + + +
    PHP + + +
    XML + +
    +
    + +
    +
    - - - - - - -
    - - + -
    -
    Absolute - Requirements
    -
    + + + + +
    +
    Optional Requirements
    +
    +
    -
    - - "> - - - + + - "> - - - - - "> - - - - -
    MySQL"> - - - -
    + + + + + + + + + + + +
    SSL Connectivity + +
    GD + +
    +
    PHP"> - - - -
    XML"> - - - -
    -
    -
    -
    - - - - - - - -
    - - - - -
    -
    Optional - Requirements
    -
    -
    - - "> - - - - - "> - - - - -
    SSL - Connectivity"> - - - -
    GD"> - - - -
    -
    - - -

    -
    +

    +
    diff --git a/themes/default/blocks/account/account.tpl b/themes/default/blocks/account/account.tpl index 3b6e5ae2..e69cf8eb 100644 --- a/themes/default/blocks/account/account.tpl +++ b/themes/default/blocks/account/account.tpl @@ -1,262 +1,165 @@ -{if $smarty.const.SESS_LOGGED != true } - { $block->display("account:login") } +{assign var=meth value=':'|explode:$VAR._page} + + +{if $smarty.const.SESS_LOGGED != true} + {$block->display('account:user_login')} {else} -{if $list->is_installed('radius') } - {$block->display('radius:user')} -{/if} - -{$method->exe("invoice","has_unpaid")} - {if $has_unpaid} - - - - + {if $list->is_installed('radius')} + {$block->display('radius:user')} + {/if} + + {$method->exe('invoice','has_unpaid')} + {if $has_unpaid} +
    - - - - -
    - - - - -
    - - - - -
    - - - - -
    {translate module=invoice total=$has_unpaid}due_invoices_notice{/translate}
    -
    -
    -
    -
    + + +
    + + + + +
    + + + + +
    + + + + +
    + + + + +
    +
    + {t}You presently have unpaid invoices that total:{/t} {$has_unpaid}
    + To pay all unpaid invoices now, please CLICK HERE.
    + To select the invoices you wish to pay, please CLICK HERE. +
    +
    +
    +
    +
    +
    -

     

    - {/if} +
    + {/if} - - - - - +
    - - - - -
    - - - - -
    - - - - -
    - - - - -
    -
    - - {translate module=account}account_link{/translate}
    - {translate module=account}billing_link{/translate}
    - {translate module=account}discount_link{/translate}
    - {if $smarty.const.SHOW_CONTACT_LINK} - {translate}contact{/translate}
    - {/if} - {if $smarty.const.SHOW_NEWSLETTER_LINK} - {translate module=account}newsletter_link{/translate}
    - {/if} - {if $list->is_installed('affiliate') && $smarty.const.SHOW_AFFILIATE_LINK == 1 } - {translate module=account}affiliate_link{/translate} - {/if} - -
    -
    -
    -
    -
    -
    + + +
    + + + + +
    + {t}View Account{/t}
    + {t}Billing Details{/t}
    + {t module=account}Discounts{/t}
    + {if $smarty.const.SHOW_CONTACT_LINK}{t}Contact{/t}
    {/if} + {if $smarty.const.SHOW_NEWSLETTER_LINK}{t}Newsletter{/t}
    {/if} + {if $list->is_installed('affiliate') && $smarty.const.SHOW_AFFILIATE_LINK == 1}{t}Affiliate{/t}{/if} +
    +
    - +
    -

     

    - - - - - - + +
    - - - - -
    - - - - -
    - - - - - - -
    - - - - - - - -
    -
    - {translate module=invoice} - menu - {/translate} -
    -
    - - - - - - - - - - - - - -
    - {translate module=invoice} - {/translate} - Due Invoices - {translate module=invoice} - menu_view - {/translate} -
    - {translate module=invoice} - {/translate} - Paid Invoices - {translate module=invoice} - menu_view - {/translate} -
    - {translate module=invoice} - {/translate} - All Invoices - {translate module=invoice} - menu_view - {/translate} -
    -
    -
    -
    -
    -
    - - - - -
    - - - - -
    - - - - - - -
    - - - - - - - -
    -
    - {translate module=service} - menu - {/translate} -
    -
    - - - - - - - - - - - - - -
    Active Services - {translate module=invoice} - menu_view - {/translate} -
    Inactive Services - {translate module=invoice} - menu_view - {/translate} -
    All Services - {translate module=invoice} - menu_view - {/translate} -
    -
    -
    -
    -
    -
    + + + +
    + + + + +
    + + + + + + + +
    {t}Invoices{/t}
    + + + + + + + + + + + + + +
    {t}Due Invoices{/t} + {t}List{/t} +
    {t}Paid Invoices{/t} + {t}List{/t} +
    {t}All Invoices{/t} + {t}List{/t} +
    +
    +
    +
    + + + + +
    + + + + + + + +
    {t}Services{/t}
    + + + + + + + + + + + + + +
    {t}Active Services{/t} + {t}List{/t} +
    {t}Inactive Services{/t} + {t}List{/t} +
    {t}All Services{/t} + {t}List{/t} +
    +
    +
    +
    +
    +
    -
    -
    - - - - - {if $list->is_installed('ticket') && $smarty.const.SHOW_TICKET_LINK == 1 } - - {/if} - - {if $list->is_installed('file') } - - {/if} - - {if $list->is_installed('htaccess') } - - {/if} +{if $list->is_installed('file') } +
    - {$block->display('ticket:user')} - - {$block->display('file:file')} - - {$block->display('htaccess:htaccess')} -
    + + +
    {$block->display('file:file')}
    +{/if} -{ $method->exe("invoice","custom_tracking") } +{$method->exe('invoice','custom_tracking')} -{/if} \ No newline at end of file +{/if} diff --git a/themes/default/blocks/account/add.tpl b/themes/default/blocks/account/add.tpl index c6a9192c..278cbb73 100644 --- a/themes/default/blocks/account/add.tpl +++ b/themes/default/blocks/account/add.tpl @@ -1,317 +1,267 @@ - -{if $smarty.const.SESS_LOGGED} -{literal}{/literal} -{else} - - - - - - +{assign var=meth value=':'|explode:$VAR._page} + {if $form_validation} -{ $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} + -
    - - - - + +
    - - - - - - + + +
    -
    - {translate module=account} - title_add - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $method->exe_noauth("tax","get_tax_ids")} - {if $tax_ids} - - {foreach from=$tax_ids item=tax} - - - - -
    - {translate module=account} - field_username - {/translate} - - -
    - {translate module=account} - field_password - {/translate} - - -
    - {translate module=account} - field_confirm_password - {/translate} - - -
    - {translate module=account} - field_email - {/translate} - - -
    - {translate module=account} - field_company - {/translate} - - -
    - {translate module=account} - field_first_name - {/translate} - - -
    - {translate module=account} - field_middle_name - {/translate} - - -
    - {translate module=account} - field_last_name - {/translate} - - -
    - {translate module=account} - field_title - {/translate} - - -
    - {translate module=account} - field_address1 - {/translate} - - -
    - {translate module=account} - field_address2 - {/translate} - - -
    - {translate module=account} - field_city - {/translate} - - -
    - {translate module=account} - field_state - {/translate} - - -
    - {translate module=account} - field_zip - {/translate} - - -
    - {translate module=account} - field_country_id - {/translate} - - {if $VAR.account_country_id != ""} - { $list->menu("no", "account_country_id", "country", "name", $VAR.account_country_id, "form_field\" onChange=\"taxIdsDisplay(this.value)") } - {else} - { $list->menu("no", "account_country_id", "country", "name", $smarty.const.DEFAULT_COUNTRY, "form_field\" onChange=\"taxIdsDisplay(this.value)") } - {/if} -
    - {$tax.tax_id_name} - - - + + + + + - -
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {$method->exe_noauth('tax','get_tax_ids')} + {if $tax_ids} + + + {/if} - - - {/foreach} - {/if} - - { $method->exe("account","static_var")} - {foreach from=$static_var item=record} - - - - - {/foreach} - - { if $smarty.const.NEWSLETTER_REGISTRATION == "1"} - - - - {/if} - - - - - - - - + + {/if} - - - - -
    {osb f=tt}
    + + + + + + + + + + + + + + + + +
    {osb f=tf field=username}{t}Leave blank to allow the system auto-generate{/t}
    {osb f=tf field=password}{t}Leave blank to allow the system auto-generate{/t}
    {t}Send user welcome email?{/t} 
    +
    + + + + + + + + + + + +
    {osb f=tf field=status}{osb f=tf field=email}{osb f=tf field=company}
    + {if $VAR.account_status == ''} + {if $smarty.const.DEFAULT_ACCOUNT_STATUS != '1'} + {$list->bool('account_status','1')} + {else} + {$list->bool('account_status','0')} + {/if} + {else} + {$list->bool('account_status',$VAR.account_status)} + {/if} +
    +
    + + + + + + + + + + + +
    {osb f=tf field=first_name}{osb f=tf field=middle_name}{osb f=tf field=last_name}
    +
    + + + + + + + + + + + +
    {osb f=tf field=title}{osb f=tf field=address1}{osb f=tf field=address2}
    {$list->menu_staticlist('nametitle','account_title','account_title','','form_menu','all')}
    +
    + + + + + + + + + + + +
    {osb f=tf field=city}{osb f=tf field=state}{osb f=tf field=zip}
    +
    + + + + + + + + + + + +
    {osb f=tf field=country_id}{osb f=tf field=date_expire}{osb f=tf field=email_type}
    + {if $VAR.account_country_id != ''} + {$list->mmenu('no','account_country_id','country','name',$VAR.account_country_id,'','form_field" onchange="taxIdsDisplay(this.value)')} + {else} + {$list->mmenu('no','account_country_id','country','name',$smarty.const.DEFAULT_COUNTRY,'','form_field" onchange="taxIdsDisplay(this.value)')} + {/if} + {$list->calender_add('account_date_expire',$VAR.account_date_expire,'form_field')}{$list->bool('account_email_type',$VAR.account_email_type)}
    +
    + + + + + + + + + + + +
    {osb f=tf field=language_id}{osb f=tf field=theme_id}{osb f=tf field=currency_id}
    + {if $VAR.account_language_id != ''} + {$list->menu_files('','account_language_id',$VAR.account_language_id,'language','','_core.xml','form_menu')} + {else} + {$list->menu_files('','account_language_id',$smarty.const.DEFAULT_LANGUAGE,'language','','_core.xml','form_menu')} + {/if} + + {if $VAR.account_theme_id != ''} + {$list->menu_files('','account_theme_id',$VAR.account_theme_id,'theme','','.user_theme','form_menu')} + {else} + {$list->menu_files('','account_theme_id',$smarty.const.DEFAULT_THEME,'theme','','.user_theme','form_menu')} + {/if} + + {if $VAR.account_currency_id != ''} + {$list->mmenu('no','account_currency_id','currency','name',$VAR.account_currency_id,'','form_menu')} + {else} + {$list->mmenu('no','account_currency_id','currency','name',$smarty.const.DEFAULT_CURRENCY,'','form_menu')} + {/if} +
    +
    + + + + + + + + + + + +
    {translate}authorized_groups{/translate}{if $list->is_installed('affiliate')}{osb f=tf field=affiliate_id}{/if}{osb f=tf field=misc}
    {$list->select_groups($VAR.groups,'groups','form_field','10','')} + {if $list->is_installed('affiliate')} + {osb f=html_select_affiliate name='account_affiliate_id' default=$VAR.account_affiliate_id}
    +
    + {osb f=tf field=campaign_id}
    + {$list->mmenu('','account_campaign_id','campaign','name',$VAR.account_campaign_id,'','form_menu',true)} + {/if} +
    + +
    +
    + + + {foreach from=$tax_ids item=tax} + + + + + {/foreach} +
    {$tax.tax_id_name} + + +
    +
    - {$record.name} - - {$record.html} -
    - {translate module=account} - subscribe_newsletters - {/translate} - - { $method->exe("newsletter", "check_list_registration") } -
    - {translate module=account} - field_email_html - {/translate} - - { $list->bool("account_email_type", $VAR.account_email_type, "form_menu") } -
      - - - - - {if $VAR._page == ""} - - {else} - + {$method->exe('account','static_var')} + {if $static_var} +
    + + {$block->display('core:method_error')} + {foreach from=$static_var item=record} + + + + + {/foreach} +
    {$record.name}{$record.html}
    +
    -
    -
    - -{/if} +
    + + + + + + {include file='file:../core/add_tr_submit.tpl'} +
      
    +
    +
    + + {if $VAR.account_account_id} +
    + +
    + {/if} + diff --git a/themes/default/blocks/account/login.tpl b/themes/default/blocks/account/login.tpl deleted file mode 100644 index 64e300df..00000000 --- a/themes/default/blocks/account/login.tpl +++ /dev/null @@ -1,107 +0,0 @@ -{if $smarty.const.SESS_LOGGED == true } - { $block->display("account:account") } -{else} - - - - - - - -
    - - - - -
    - - - - - - -
    - - - - - - - -
    -
    - {translate} - account_login - {/translate} -
    -
    - - - - - - - - - - - - - - - - - {if $smarty.const.DEFAULT_ACCOUNT_STATUS == "1"} - - - - {/if} -
    - {translate} - username - {/translate} - - -
    - {translate} - password - {/translate} - - -
    - - {if $VAR._page != ""} - - {else} - - {/if} - - {if $VAR._htaccess_id != "" || $VAR._htaccess_dir_id != ""} - - - {/if} - - -
    - {translate} - reset_password - {/translate} -
    - {translate} - verify - {/translate} -
    -
    -
    -
    - -
    - - - - -
    - { $block->display("account:add") } -
    -
    -{/if} \ No newline at end of file diff --git a/themes/default/blocks/account/login_cookie.tpl b/themes/default/blocks/account/login_cookie.tpl deleted file mode 100644 index cfd31122..00000000 --- a/themes/default/blocks/account/login_cookie.tpl +++ /dev/null @@ -1,40 +0,0 @@ -{if $SESS_LOGGED != "1"} {translate}login_required{/translate}
    -
    -{ $block->display("account:login")} -{else} -
    - - - - -
    - - - - -
    - { $method->exe("htaccess","check_smarty") } - {if $htaccess_auth == "1" } - {translate module=htaccess} - success_login - {/translate} -
    -
    - {$VAR._next_page} -
    - -
    - {else} - {translate module=htaccess} - failed_login - {/translate} - {/if} -
    -
    -
    -{/if} diff --git a/themes/default/blocks/account/login_htaccess.tpl b/themes/default/blocks/account/login_htaccess.tpl deleted file mode 100644 index a02a1052..00000000 --- a/themes/default/blocks/account/login_htaccess.tpl +++ /dev/null @@ -1,40 +0,0 @@ -{if $SESS_LOGGED != "1"} {translate}login_required{/translate}
    -
    -{ $block->display("account:login_small")} -{else} -
    - - - - -
    - - - - -
    - { $method->exe("htaccess","check_smarty") } - {if $htaccess_auth == "1" } - {translate module=htaccess} - success_login - {/translate} -
    -
    - {$htaccess_url} -
    - -
    - {else} - {translate module=htaccess} - failed_login - {/translate} - {/if} -
    -
    -
    -{/if} diff --git a/themes/default/blocks/account/login_small.tpl b/themes/default/blocks/account/login_small.tpl deleted file mode 100644 index 3a48d3d1..00000000 --- a/themes/default/blocks/account/login_small.tpl +++ /dev/null @@ -1,61 +0,0 @@ -
    - - - - - - - - - - - - - - - - - {if $smarty.const.DEFAULT_ACCOUNT_STATUS == "1"} - - - - {/if} -
    - {translate} - username - {/translate} -
    - -
    - {translate} - password - {/translate} -
    - -
    - - {if $VAR._page == ""} - - {else} - - {/if} - {if $VAR._htaccess_id != "" || $VAR._htaccess_dir_id != ""} - - - {/if} - -
    - {translate} - register - {/translate} -
    - {translate} - reset_password - {/translate} -
    - {translate} - verify - {/translate} -
    -
    - diff --git a/themes/default/blocks/account/mail_multi.tpl b/themes/default/blocks/account/mail_multi.tpl new file mode 100644 index 00000000..af4c5505 --- /dev/null +++ b/themes/default/blocks/account/mail_multi.tpl @@ -0,0 +1,68 @@ +{assign var=meth value=':'|explode:$VAR._page} + + +{$method->exe('account','search_form')} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    {t}Mail From{/t} + {if $VAR.mail_email_id != ''} + {$list->menu('','mail_email_id','setup_email','name',$smarty.const.DEFAULT_SETUP_EMAIL,'form_menu')} + {else} + {$list->menu('','mail_email_id','setup_email','name',$setup.mail_email_id,'form_menu')} + {/if} +
    {t}Mail To{/t} + {t}Send to all search results{/t} +
    {t}Subject{/t}
    {t}Message{/t}
    {t}Priority{/t}{$list->bool('mail_priority',$VAR.mail_priority)}
      + + + + +
    +
    +
    + +
    +{/if} + +{$block->display('core:bottom_frame')} diff --git a/themes/default/blocks/account/mail_one.tpl b/themes/default/blocks/account/mail_one.tpl new file mode 100644 index 00000000..8fd76a03 --- /dev/null +++ b/themes/default/blocks/account/mail_one.tpl @@ -0,0 +1,67 @@ +{assign var=meth value=':'|explode:$VAR._page} + + +{$method->exe('account','search_form')} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    {t}Mail From{/t} + {if $VAR.mail_email_id != ''} + {$list->menu('','mail_email_id','setup_email','name',$smarty.const.DEFAULT_SETUP_EMAIL,'form_menu')} + {else} + {$list->menu('','mail_email_id','setup_email','name',$setup.mail_email_id,'form_menu')} + {/if} +
    {t}Mail To{/t}{osb f=html_select_account name='mail_account_id' default=$VAR.mail_account_id}
    {t}Subject{/t}
    {t}Message{/t}
    {t}Priority{/t}{$list->bool('mail_priority',$VAR.mail_priority)}
      + + + +
    +
    +
    + + + +
    +{/if} diff --git a/themes/default/blocks/account/merge.tpl b/themes/default/blocks/account/merge.tpl new file mode 100644 index 00000000..d73aea60 --- /dev/null +++ b/themes/default/blocks/account/merge.tpl @@ -0,0 +1,44 @@ +{assign var=meth value=':'|explode:$VAR._page} + + +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + +
    Select the account you wish to merge with the current account.
    +
    + This action will delete the selected account and associate all its invoices, services, logs, and other records with the current account.
    +
    + Warning: This action cannot be undone! +
     
    {osb f=html_select_account name='merge_acct_id'} + + + + +
    +
    +
    + +
    diff --git a/themes/default/blocks/account/password.tpl b/themes/default/blocks/account/password.tpl deleted file mode 100644 index e2907746..00000000 --- a/themes/default/blocks/account/password.tpl +++ /dev/null @@ -1,73 +0,0 @@ -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=account} - title_password_reset - {/translate} -
    -
    - - - - - - - - - - -
    - {translate module=account} - password_reset - {/translate} -
    -
    -
    - - - - - - - - - - - - - -
    - {translate module=account} - field_email - {/translate} - - -
    - {translate module=account} - field_username - {/translate} - - -
    - -
    -
    -
    -
    - - -
    - diff --git a/themes/default/blocks/account/password_reset.tpl b/themes/default/blocks/account/password_reset.tpl deleted file mode 100644 index 1af9c59f..00000000 --- a/themes/default/blocks/account/password_reset.tpl +++ /dev/null @@ -1,90 +0,0 @@ -{if $VAR.validate == ""} {translate module=account here="test"}password_reset_bad_url -{/translate} -
    -
    - - - -{translate}submit{/translate}
    -{elseif $pw_changed != true} - -{if $VAR.type == 'expired'} -

    Your current password has expired. Please select a new password below in order to login.

    -{/if} - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=account} - title_password_new - {/translate} -
    -
    - - - - - - - - - - -
    - {translate module=account} - password_reset_instructions - {/translate} -
    -
    -
    - - - - - - - - - - - - - -
    - {translate module=account} - field_update_password - {/translate} - - -
    - {translate module=account} - field_confirm_password - {/translate} - - -
    - -
    -
    -
    -
    - - - -
    - {else} - {html_button name=account action="document.location='?_page=account:account'"} - {/if} \ No newline at end of file diff --git a/themes/default/blocks/account/search_form.tpl b/themes/default/blocks/account/search_form.tpl new file mode 100644 index 00000000..91c68973 --- /dev/null +++ b/themes/default/blocks/account/search_form.tpl @@ -0,0 +1,322 @@ +{assign var=meth value=':'|explode:$VAR._page} + + +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {if $list->is_installed('affiliate')} + + + + + {/if} + {if $list->is_installed('campaign')} + + + + + {/if} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {$method->exe('account','static_var')} + {foreach from=$static_var item=record} + + + + + {/foreach} + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=username}  {t}"%" for partial match{/t}
    {osb f=tf field=email}  {t}"%" for partial match{/t}
    {osb f=tf field=first_name}  {t}"%" for partial match{/t}
    {osb f=tf field=middle_name}  {t}"%" for partial match{/t}
    {osb f=tf field=last_name}  {t}"%" for partial match{/t}
    {osb f=tf field=company}  {t}"%" for partial match{/t}
    {osb f=tf field=address1}  {t}"%" for partial match{/t}
    {osb f=tf field=address2}  {t}"%" for partial match{/t}
    {osb f=tf field=city}  {t}"%" for partial match{/t}
    {osb f=tf field=state}  {t}"%" for partial match{/t}
    {osb f=tf field=zip}  {t}"%" for partial match{/t}
    {osb f=tf field=misc}  {t}"%" for partial match{/t}
    {osb f=tf field=date_orig}{$list->calender_search('account_date_orig',$VAR.account_date_orig,'form_field','')}
    {osb f=tf field=date_expire}{$list->calender_search('account_date_expire',$VAR.account_date_expire,'form_field','')}
    {osb f=tf field=affiliate_id}{osb f=html_select_affiliate name='account_affiliate_id' default=$VAR.account_affiliate_id}
    {osb f=tf field=campaign_id}{$list->menu('no','account_campaign_id','campaign','name','','form_menu',true)}
    {osb f=tf field=country_id}{$list->menu('no','account_country_id','country','name','','form_menu',true)}
    {osb f=tf field=language_id}{$list->menu_files('','account_language_id','all','language','','_core.xml','form_menu')}
    {osb f=tf field=currency_id}{$list->menu('no','account_currency_id','currency','name','','form_menu',true)}
    {osb f=tf field=theme_id}{$list->menu_files('','account_theme_id','all','theme','','.user_theme','form_menu')}
    {osb f=tf field=status}{$list->bool('account_status','all','form_menu')}
    {osb f=tf field=account_group}{$list->menu('no','account_group','group','name','','form_menu',true)}
    {osb f=tf field=title}{$list->menu_staticlist('nametitle','account_title','account_title','','form_menu','all')}
    {$record.name}{$record.html}
    {t}Results per page{/t}
    {t}Order results by{/t} + +
      
      + + + + +
      
    +
    +
    + +
    + +
    + + + + + +
    + + + + + + + +
    Custom Group Search
    + + + + + + + + + + + {$method->exe('account','static_var')} + {foreach from=$static_var item=record} + {/foreach} + + + + + + + + + +
    {osb f=tf field=date_orig} + + {$list->calender_add('dates','','','val')}
    + + {$list->calender_add('dates','','','val')} +
    {translate module=account}account_group{/translate}{$list->menu_multi('','groups','group','name','10','10','form_menu')}
      
      + + + +
    +
    +
    + +
    + +{if $list->is_installed('product')} +
    + + + + + +
    + + + + + + + +
    Custom Product Search
    + + + + + + + + + + + {$method->exe('account','static_var')} + {foreach from=$static_var item=record} + {/foreach} + + + + + + + + + +
    {osb f=tf field=date_orig} + + {$list->calender_add('dates','','','val')}
    + + {$list->calender_add('dates','','','val')} +
    {translate module=account}account_group{/translate}{$list->menu_multi('','products','product','sku','10','10','form_menu')}
      
      + + + +
    +
    +
    + +
    +{/if} + +{if $list->is_installed('account_billing')} +
    +
    + + + + + +
    + + + + + + + +
    {translate module=account_billing}title_search{/translate}
    + + + + + + + + + + + + + + {include file='file:../core/search_post.tpl'} +
    {osb f=tf field=card_num4}
    {osb f=tf field=checkout_plugin_id}{$list->menu('no','account_billing_checkout_plugin_id','checkout','name','','form_menu',true)}
    {osb f=tf field=card_type}{$list->card_type_menu($VAR.account_billing_card_type,$VAR.option,'account_billing_card_type','form_menu',true)}
    +
    +
    + +
    +{/if} +{/if} diff --git a/themes/default/blocks/account/search_show.tpl b/themes/default/blocks/account/search_show.tpl new file mode 100644 index 00000000..2fd9e7c8 --- /dev/null +++ b/themes/default/blocks/account/search_show.tpl @@ -0,0 +1,12 @@ +{assign var=meth value=':'|explode:$VAR._page} + + +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/search_show_pre.tpl'} + {$method->exe_noauth($meth.0,'tpl_search_show',$search_show)} + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl' mail=true} +{/if} diff --git a/themes/default/blocks/account/sub_account.tpl b/themes/default/blocks/account/sub_account.tpl index 9b9a2c72..0e3e7125 100644 --- a/themes/default/blocks/account/sub_account.tpl +++ b/themes/default/blocks/account/sub_account.tpl @@ -1,29 +1,36 @@ - - - +
    - - - - - - -
    {translate module=account}title_view_sub_account{/translate}
    - - - - - - {foreach from=$subaccount item=sub} - - - - - - - {/foreach} - -
     
    {$sub.first_name} {$sub.last_name}{$sub.username}{$sub.email}
    +{assign var=meth value=':'|explode:$VAR._page} + + + + + - -
    + + + + + + + +
    {translate module=account}title_view_sub_account{/translate}
    + + + + + + + {foreach from=$subaccount item=sub} + + + + + + + {/foreach} + +
      + +
    {$sub.first_name} {$sub.last_name}{$sub.username}{$sub.email}
    +
    -
    \ No newline at end of file +
    diff --git a/themes/default/blocks/account/sub_account_add.tpl b/themes/default/blocks/account/sub_account_add.tpl index a4e80197..fe659a17 100644 --- a/themes/default/blocks/account/sub_account_add.tpl +++ b/themes/default/blocks/account/sub_account_add.tpl @@ -1,280 +1,208 @@ +{assign var=meth value=':'|explode:$VAR._page} + + {if !$smarty.const.SESS_LOGGED} -{literal}{/literal} + {$block->display('account:user_login')} {else} - - - - - - - -{if $form_validation} -{ $block->display("core:alert_fields") } -{/if} - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=account} - title_add_sub_account - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $method->exe_noauth("tax","get_tax_ids")} - {if $tax_ids} - - {foreach from=$tax_ids item=tax} - - - - - {/foreach} - {/if} - - { $method->exe("account","static_var")} - {foreach from=$static_var item=record} - - - - - {/foreach} - - { if $smarty.const.NEWSLETTER_REGISTRATION == "1"} - - - - {/if} - - - - - - { $method->exe_noauth("account","get_auth_groups") } {if $groups} - - - - - {/if} - - - - - -
    - {translate module=account} - field_username - {/translate} -
    - {translate module=account} - field_password - {/translate} -
    - {translate module=account} - field_confirm_password - {/translate} -
    - {translate module=account} - field_email - {/translate} -
    - {translate module=account} - field_company - {/translate} -
    - {translate module=account} - field_first_name - {/translate} -
    - {translate module=account} - field_middle_name - {/translate} -
    - {translate module=account} - field_last_name - {/translate} -
    - {translate module=account} - field_title - {/translate} -
    - {translate module=account} - field_address1 - {/translate} -
    - {translate module=account} - field_address2 - {/translate} -
    - {translate module=account} - field_city - {/translate} -
    - {translate module=account} - field_state - {/translate} -
    - {translate module=account} - field_zip - {/translate} -
    - {translate module=account} - field_country_id - {/translate} - {if $VAR.account_country_id != ""} - { $list->menu("no", "account_country_id", "country", "name", $VAR.account_country_id, "form_field\" onChange=\"taxIdsDisplay(this.value)") } - {else} - { $list->menu("no", "account_country_id", "country", "name", $smarty.const.DEFAULT_COUNTRY, "form_field\" onChange=\"taxIdsDisplay(this.value)") } - {/if}
    - {$tax.tax_id_name} - - - {/if}
    - {$record.name} - {$record.html}
    - {translate module=account} - subscribe_newsletters - {/translate} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - { $method->exe("newsletter", "check_list_registration") }
    - {translate module=account} - field_email_html - {/translate} - { $list->bool("account_email_type", $VAR.account_email_type, "form_menu") }
    {translate} authorized_groups {/translate} - {foreach from=$groups item=group} - {$group.name}
    - {/foreach} -
      - - {if $VAR._page == ""} - - {else} - - {/if} -
    -
    -
    -
    + +
    + + + + + +
    + + + + + + + +
    +
    {translate module=account}title_add_sub_account{/translate}
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {foreach from=$tax_ids item=tax} + + + + + {/foreach} + + {$method->exe('account','static_var')} + {foreach from=$static_var item=record} + + + + + {/foreach} + + {if $smarty.const.NEWSLETTER_REGISTRATION == '1'} + + + + + {/if} + + + + + + + {$method->exe_noauth('account','get_auth_groups')} + {if $groups} + + + + + {/if} + + + + + +
    {translate module=account}field_username{/translate} + +
    {translate module=account}field_password{/translate} + +
    {translate module=account}field_confirm_password{/translate} + +
    {translate module=account}field_email{/translate} + +
    {translate module=account}field_company{/translate} + +
    {translate module=account}field_first_name{/translate} + +
    {translate module=account}field_middle_name{/translate} + +
    {translate module=account}field_last_name{/translate} + +
    {translate module=account}field_title{/translate}{$list->menu_nametitles('account_title','account_title',$VAR.account_title,'form_menu','')}
    {translate module=account}field_address1{/translate} + +
    {translate module=account}field_address2{/translate} + +
    {translate module=account}field_city{/translate} + +
    {translate module=account}field_state{/translate} + +
    {translate module=account}field_zip{/translate} + +
    {translate module=account}field_country_id{/translate} + {if $VAR.account_country_id != ''} + {$list->menu('no','account_country_id','country','name',$VAR.account_country_id,'form_field" onChange="taxIdsDisplay(this.value)',true)} + {else} + {$list->menu('no','account_country_id','country','name',$smarty.const.DEFAULT_COUNTRY,'form_field" onChange="taxIdsDisplay(this.value)',true)} + {/if} + + {$method->exe_noauth('tax','get_tax_ids')} + + {if $tax_ids} + + {/if} +
    {$tax.tax_id_name} + + +
    {$record.name}{$record.html}
    {translate module=account}subscribe_newsletters{/translate}{$method->exe('newsletter','check_list_registration')}
    {translate module=account}field_email_type{/translate}{$list->bool('account_email_type',$VAR.account_email_type)}
    {translate} authorized_groups {/translate} + {foreach from=$groups item=group} + {$group.name}
    + {/foreach} +
      + + + {if $VAR._page == ''} + + {else} + + {/if} + +
    +
    +
    + +
    {/if} diff --git a/themes/default/blocks/account/sub_account_view.tpl b/themes/default/blocks/account/sub_account_view.tpl index 8fc56d01..f9938867 100644 --- a/themes/default/blocks/account/sub_account_view.tpl +++ b/themes/default/blocks/account/sub_account_view.tpl @@ -1,3 +1,3 @@ -

    Delete this Sub-Account (cannot be undone!)

    -

    Back to account

    \ No newline at end of file +

    Delete this Sub-Account (cannot be undone!)

    +

    Back to account

    diff --git a/themes/default/blocks/account/user_add.tpl b/themes/default/blocks/account/user_add.tpl new file mode 100644 index 00000000..b57370f1 --- /dev/null +++ b/themes/default/blocks/account/user_add.tpl @@ -0,0 +1,169 @@ +{assign var=meth value=':'|explode:$VAR._page} + + + +{if $smarty.const.SESS_LOGGED} + {literal}{/literal} + +{else} + + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} + + +
    + + + + + +
    + + + + + + + +
    {osb f=tt module=account method=user_add}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {foreach from=$tax_ids item=tax} + + + + + + {$method->exe('account','static_var')} + {foreach from=$static_var item=record} + + + + + {/foreach} + + {if $smarty.const.NEWSLETTER_REGISTRATION == "1"} + + + + + {/if} + + + + + + + + + +
    {osb f=tf module=account field=username}
    {osb f=tf module=account field=password}
    {t}Confirm Password{/t}
    {osb f=tf module=account field=email}
    {osb f=tf module=account field=company}
    {osb f=tf module=account field=first_name}
    {osb f=tf module=account field=middle_name}
    {osb f=tf module=account field=last_name}
    {osb f=tf module=account field=title}{$list->menu_staticlist('nametitle','account_title','account_title','','form_menu','all')}
    {osb f=tf module=account field=address1}
    {osb f=tf module=account field=address2}
    {osb f=tf module=account field=city}
    {osb f=tf module=account field=state}
    {osb f=tf module=account field=zip}
    {osb f=tf module=account field=country_id} + {if $VAR.account_country_id != ''} + {$list->menu('no','account_country_id','country','name',$VAR.account_country_id,'form_field" onchange="taxIdsDisplay(this.value)',true)} + {else} + {$list->menu('no','account_country_id','country','name',$smarty.const.DEFAULT_COUNTRY,'form_field" onchange="taxIdsDisplay(this.value)',true)} + {/if} + + {$method->exe_noauth('tax','get_tax_ids')} + {if $tax_ids} + + +
    {$tax.tax_id_name} + + + {/foreach} + {/if} +
    {$record.name}{$record.html}
    {t module=account}subscribe_newsletters{/t}{$method->exe('newsletter','check_list_registration')}
    {osb f=tf module=account field=email_type}{$list->bool('account_email_type',$VAR.account_email_type)}
      + + + {if $VAR._page == ''} + + {else} + + {/if} + + +
    +
    +
    + +
    +{/if} diff --git a/themes/default/blocks/account/user_login.tpl b/themes/default/blocks/account/user_login.tpl new file mode 100644 index 00000000..a9f0e7c9 --- /dev/null +++ b/themes/default/blocks/account/user_login.tpl @@ -0,0 +1,69 @@ +{assign var=meth value=':'|explode:$VAR._page} + + +{if $smarty.const.SESS_LOGGED == true} + {$block->display('account:account')} +{else} + + + + + + + +
    +
    + + + + +
    + + + + + + + +
    {t}Account Login{/t}
    + + + + + + + + + + + + + + + + + {if $smarty.const.DEFAULT_ACCOUNT_STATUS == '1'} + + + + {/if} +
    {t}Username{/t}
    {t}Password{/t}
    + + {if $VAR._page != ''} + + {else} + + {/if} +
    {t}Reset Password{/t}
    {t}Verify Account{/t}
    +
    +
    +
    + +
      + + + + +
    {$block->display('account:user_add')}
    +
    +{/if} diff --git a/themes/default/blocks/account/user_password.tpl b/themes/default/blocks/account/user_password.tpl new file mode 100644 index 00000000..4c027332 --- /dev/null +++ b/themes/default/blocks/account/user_password.tpl @@ -0,0 +1,49 @@ +{assign var=meth value=':'|explode:$VAR._page} + + +
    + + + + + +
    + + + + + + + +
    {osb f=tt module=account method=user_password}
    + + + + + + + +
    {t}If you have forgotten your password, we can issue you a temporary access code via email that will allow you to change your password. To start this process, please enter either your e-mail address or username to begin. Please do not enter both, simply providing one or the other will do just fine.{/t}
    + + + + + + + + + + + + + +
    {osb f=tf field=email}
    {osb f=tf field=username}
     
    +
    +
    +
    + +
    + + +
    +
    diff --git a/themes/default/blocks/account/user_password_reset.tpl b/themes/default/blocks/account/user_password_reset.tpl new file mode 100644 index 00000000..0566d426 --- /dev/null +++ b/themes/default/blocks/account/user_password_reset.tpl @@ -0,0 +1,68 @@ +{assign var=meth value=':'|explode:$VAR._page} + + +{if $VAR.validate == ''} +{t}The link you followed has either expired, or been malformed by your email reader. If you suspect that it did not copy correctly from your email reader, please paste the entire link from your email reader to the address bar in your browser. Otherwise, you can restart your password reset request by clicking the link below:{/t}
    +
    +{t}Submit{/t} +
    + +{elseif $pw_changed != true} + + {if $VAR.type == 'expired'} +

    Your current password has expired. Please select a new password below in order to login.

    + {/if} + +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + +
    {t}Please enter the new password for your account below.{/t}
    +
    +
    + + + + + + + + + + + + + +
    {osb f=tf field=password}
    {t}Confirm Password{/t}
     
    +
    +
    +
    + +
    + + + +
    +
    + +{else} + +{/if} diff --git a/themes/default/blocks/account/user_verify.tpl b/themes/default/blocks/account/user_verify.tpl new file mode 100644 index 00000000..eaf0653a --- /dev/null +++ b/themes/default/blocks/account/user_verify.tpl @@ -0,0 +1,107 @@ +{assign var=meth value=':'|explode:$VAR._page} + + +{if $VAR.verify != ''} + {$method->exe_noauth('account','user_verify')} +{else} + {assign var='verify_results' value='none'} +{/if} + +{if $verify_results == false || $VAR.verify == ''} +
    + + + + + +
    + + + + + + + +
    {osb f=tt module=account method=user_verify}
    + + + + + + + +
    {t}Please enter the verification code from the email you recieved below. If you have not recieved the verification email, or are having trouble, you can use the form below to request that the verification email be resent.{/t}
    +
    +
    + + + + + + + + + +
    {t}Verification Code{/t}
    +
    +
    +
    + +
    + + +
    +
    +{/if} + +{if $verify_results != '1'} +
    +
    + + + + + +
    + + + + + + + +
    {osb f=tt module=account method=user_verify_resend}
    + + + + + + + +
    {t}If you are having trouble with the verification code, or never received the verification email, you can use this form to request that we resend the verification email to you. Please enter either your username or email address, not both.{/t}
    +
    +
    + + + + + + + + + + + + + +
    {osb f=tf module=account field=email}
    {osb f=tf module=account field=username}
    +
    +
    +
    + +
    + + +
    +
    +{/if} diff --git a/themes/default/blocks/account/user_view.tpl b/themes/default/blocks/account/user_view.tpl new file mode 100644 index 00000000..df99d6e0 --- /dev/null +++ b/themes/default/blocks/account/user_view.tpl @@ -0,0 +1,197 @@ +{assign var=meth value=':'|explode:$VAR._page} + + + +{if $smarty.const.SESS_LOGGED != true} + {$block->display('account:user_login')} +{else} + + {$method->exe($meth.0,$meth.1)} + {if ($method->result == false)} + {$block->display('core:method_error')} + {else} + + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} + + +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {foreach from=$tax_ids item=tax} + + + + + {/foreach} + + + + + + + + + + + + + + + + + + + {foreach from=$static_var item=record} + + + + + {/foreach} + + {if $issubaccount} + {$method->exe_noauth('account','get_auth_groups')} + {if $groups} + + + + + {/if} + {/if} + + + + {include file='file:../core/view_td_submit.tpl'} + +
    {osb f=tf field=date_last}{$list->date_time($record.date_last)}
    {osb f=tf field=username}{$record.username}
    {osb f=tf field=password}
    {t}Confirm Password{/t}
    {osb f=tf field=email}
    {osb f=tf field=company}
    {osb f=tf field=first_name}
    {osb f=tf field=middle_name}
    {osb f=tf field=last_name}
    {osb f=tf field=title}{$list->menu_staticlist('nametitle','account_title','account_title',$record.title,'form_menu','')}
    {osb f=tf field=address1}
    {osb f=tf field=address2}
    {osb f=tf field=city}
    {osb f=tf field=state}
    {osb f=tf field=zip}
    {osb f=tf field=country_id} + {$list->menu('no','cid','country','name',$record.country_id,'form_field" onchange="taxIdsDisplay(this.value)')} + {$method->exe_noauth('tax','get_tax_ids')} + + {if $tax_ids} + + {/if} +
    {$tax.tax_id_name} + + +
    {osb f=tf field=language_id}{$list->menu_files('','lid',$record.language_id,'language','','_core.xml','form_menu')}
    {osb f=tf field=currency_id} + {$list->currency_list('cyid_arr')} + +
    {osb f=tf field=theme_id}{$list->menu_files('','tid',$record.theme_id,'theme','','.user_theme','form_menu')}
    {osb f=tf field=email_type}{$list->bool('account_email_type',$record.email_type)}
    {$record.name}{$record.html}
    {translate} authorized_groups {/translate} + {foreach from=$groups item=group} + {$group.name}
    + {/foreach} +
    +
    +
    + + {include file='file:../core/view_post.tpl'} +
    + + {if $record.max_child > 0} + {$block->display('account:sub_account')} + {elseif $issubaccount == true} + {$block->display('account:sub_account_view')} + {/if} + + {/if} +{/if} diff --git a/themes/default/blocks/account/verify.tpl b/themes/default/blocks/account/verify.tpl deleted file mode 100644 index d5489d4e..00000000 --- a/themes/default/blocks/account/verify.tpl +++ /dev/null @@ -1,157 +0,0 @@ - -{if $VAR.verify != ""} - {$method->exe("account","verify")} -{else} - {assign var="verify_results" value="none"} -{/if} - - -{if $verify_results == "1"} - {translate module=account} -validate_success -{/translate} -{/if} -{if $verify_results == "0"} -{translate module=account} -validate_fail -{/translate} -{/if} - -{if $verify_results == false || $VAR.verify == ""} -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=account} - title_verification_code - {/translate} -
    -
    - - - - - - - - - - -
    - {translate module=account} - verification_code_instructions - {/translate} -
    -
    -
    - - - - - - - - - -
    - {translate module=account} - verification_code - {/translate} - - -
    - -
    -
    -
    -
    - -
    -{/if} - -{if $verify_results != "1"} -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=account} - title_verify_resend - {/translate} -
    -
    - - - - - - - - - - -
    - {translate module=account} - verify_resend_instructions - {/translate} -
    -
    -
    - - - - - - - - - - - - - -
    - {translate module=account} - field_email - {/translate} - - -
    - {translate module=account} - field_username - {/translate} - - -
    - -
    -
    -
    -
    - - -
    -{/if} diff --git a/themes/default/blocks/account/view.tpl b/themes/default/blocks/account/view.tpl index 3cb26457..49a130be 100644 --- a/themes/default/blocks/account/view.tpl +++ b/themes/default/blocks/account/view.tpl @@ -1,369 +1,519 @@ - - - - - +{assign var=meth value=':'|explode:$VAR._page} + - -{if $smarty.const.SESS_LOGGED != true } - { $block->display("account:login") } +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} + + + - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=account} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $method->exe_noauth("tax","get_tax_ids")} - {if $tax_ids} - - {foreach from=$tax_ids item=tax} - - - - - {/foreach} - {/if} - - - - - - - - - - - - - - - - - - {foreach from=$static_var item=record} - - - - - {/foreach} - - { if $issubaccount } - { $method->exe_noauth("account","get_auth_groups") } {if $groups} - - - - - {/if} - {/if} - - - - - -
    - {translate module=account} - field_date_last - {/translate} - - {$list->date_time($account.date_last)} -
    - {translate module=account} - field_username - {/translate} - - {$account.username} - - -
    - {translate module=account} - field_update_password - {/translate} - - -
    - {translate module=account} - field_confirm_password - {/translate} - - -
    - {translate module=account} - field_email - {/translate} - - -
    - {translate module=account} - field_company - {/translate} - - -
    - {translate module=account} - field_first_name - {/translate} - - -
    - {translate module=account} - field_middle_name - {/translate} - - -
    - {translate module=account} - field_last_name - {/translate} - - -
    - {translate module=account} - field_title - {/translate} - - -
    - {translate module=account} - field_address1 - {/translate} - - -
    - {translate module=account} - field_address2 - {/translate} - - -
    - {translate module=account} - field_city - {/translate} - - -
    - {translate module=account} - field_state - {/translate} - - -
    - {translate module=account} - field_zip - {/translate} - - -
    - {translate module=account} - field_country_id - {/translate} - - { $list->menu("no", "cid", "country", "name", $account.country_id, "form_field\" onChange=\"taxIdsDisplay(this.value)") } -
    - {$tax.tax_id_name} - - - -
    - {translate module=account} - field_language_id - {/translate} - - { $list->menu_files("", "lid", $account.language_id, "language", "", "_core.xml", "form_menu") } -
    - {translate module=account} - field_currency_id - {/translate} - - - {$list->currency_list("cyid_arr")} - - -
    - {translate module=account} - field_theme_id - {/translate} - - { $list->menu_files("", "tid", $account.theme_id, "theme", "", ".user_theme", "form_menu") } -
    - {translate module=account} - field_email_html - {/translate} - - { $list->bool("account_email_type", $account.email_type, "form_menu") } -
    - {$record.name} - - {$record.html} -
    {translate} authorized_groups {/translate} - {foreach from=$groups item=group} - {$group.name}
    - {/foreach} -
    - -
    -
    -
    - - - - -
    - - {if $account.max_child > 0} - { $block->display("account:sub_account") } - {else if $issubaccount == true} - { $block->display("account:sub_account_view") } - {/if} - - {/foreach} -{/if} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} + + +
    + + + + + +
    + + + + + + + + + + + + + + {include file='file:../core/view_tr_submit_delete.tpl'} +
    {osb f=tt}
    + + + + + + +
    + + + + + +
    +
    + {t}Account Overview{/t} + | {t}Login & Contact Details{/t} + | {t}Account Settings{/t} + | {t}Notes{/t} + {if $record.static_var}| {t}Custom Fields{/t}{/if} +
    + + + + +
    + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {t}Account Overview{/t}
     {$record.first_name} {$record.middle_name} {$record.last_name}
     {$record.address1} {if $record.address2 != ''}, {$record.address2}{/if}
     {$record.city}, {$record.state} {$record.zip}
     {$record.email}
    {osb f=tf field=date_orig}
     {$list->date_time($record.date_orig)}
    {osb f=tf field=date_last}
     {$list->date_time($record.date_last)}
    {t module=account}last_activity{/t}
     {if $record.last_activity}{$list->date_time($record.last_activity)}{else}{t module=account}none{/t}{/if}
      + {if $record.last_ip != ''} + {$record.last_ip} +   [ ? ] + {/if} +
    +
    + + + + + {if $record.invoice} + + + + {foreach from=$record.invoice item=invoice} + + + + + + + + + {/foreach} + {/if} + + {if $record.service} + + + + {foreach from=$record.service item=service} + + + + + + + + + {/foreach} + {/if} + +
     
    {t}Invoice Overview{/t}
      + {if $invoice.process_status == '1'} + + {else} + + {/if} + {$invoice.id} + {if $invoice.due > 0} + {$list->format_currency_num($invoice.total_amt,'')} + {else} + {$list->format_currency_num($invoice.total_amt,'')} + {/if} + + {if $invoice.due > 0} + {$list->format_currency_num($invoice.due,'')} + {else} + {$list->format_currency_num('0','')} + {/if} +     {$list->date($invoice.date_orig)}

    {t}Service Overview{/t}
      + {if $service.active == '1'} + + {else} + + {/if} + {$service.id} + {$list->format_currency_num($service.price,'')} + {$service.sku|truncate:18:'...'}     + {if $service.type == 'domain'} + {$service.domain_name|lower}.{$service.domain_tld|lower} + {else} + {t module=service}{$service.type}{/t} + {/if} +
    +
    + + + {if $record.duesoon} + + + + {foreach from=$record.duesoon item=service} + + + + + + + + + + + {/foreach} + {/if} +
     

    {t}Invoices Due Soon{/t}
      + {if $service.active == '1'} + + {else} + + {/if} + {$service.sid}{$list->format_currency_num($service.price,'')}{$service.sku|truncate:18:'...'}     + {if $service.type == 'domain'} + {$service.domain_name|lower}.{$service.domain_tld|lower} + {else} + {t module=service}{$service.type}{/t} + {/if} +     {$list->date($service.date_next_invoice)}    {$list->date($service.bill_date)}
    +
    +
    + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=username}{osb f=tf field=password}{osb f=tf field=email}
    {osb f=tf field=first_name}{osb f=tf field=middle_name}{osb f=tf field=last_name}
    {osb f=tf field=title}{osb f=tf field=address1}{osb f=tf field=address2}
    {$list->menu_staticlist('nametitle','account_title','account_title',$record.title,'form_menu',true)}
    {osb f=tf field=city}{osb f=tf field=state}{osb f=tf field=zip}
    {osb f=tf field=country_id}{osb f=tf field=status}{osb f=tf field=company}
    {$list->menu('no','account_country_id','country','name',$record.country_id,'" onchange="submit()')}{$list->bool('account_status',$record.status,'" onchange="submit()')}
    + + {$method->exe_noauth('tax','get_tax_ids')} + {if $tax_ids} + + + {foreach from=$tax_ids item=tax} + + + + + {/foreach} +
    {$tax.tax_id_name} + + +
    + {/if} +
    + + +
    + + + + + + + + + + + + + + + +
    {osb f=tf field=currency_id}{osb f=tf field=language_id}{osb f=tf field=date_expire}
    {$list->menu('no','account_currency_id','currency','name',$record.currency_id,'" onchange="submit()')}{$list->menu_files('','account_language_id',$record.language_id,'language','','_core.xml',"\" onchange=\"document.getElementById('view').submit()")}{$list->calender_view('account_date_expire',$record.date_expire,'form_field')}
    + + + + + + + +
    {t}authorized_groups{/t}
    {$list->select_groups($record.groups,'groups','form_field','10',$record.own_account)}
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {if $record.parent_id == 0 || $record.parent_id == ''} + + + + + + + + + {/if} +
    {osb f=tf field=email_type}{osb f=tf field=theme_id}
    {$list->bool('account_email_type',$record.email_type,'" onchange="submit()')}{$list->menu_files('','account_theme_id',$record.theme_id,'theme','','.user_theme','onchange="submit()"')}
    {if $list->is_installed('affiliate')}{osb f=tf field=affiliate_id}{/if}{if $list->is_installed('campaign')}{osb f=tf field=campaign_id}{/if}
    {if $list->is_installed('affiliate')}{osb f=autoselect module=account return=id field=account_affiliate_id default=$record.affiliate_id}{/if}{if $list->is_installed('campaign')}{$list->menu('no','account_campaign_id','campaign','name',$record.campaign_id,'" onchange="submit()"',true)}{/if}
    {osb f=tf field=invoice_delivery}{osb f=tf field=invoice_show_itemized}
    {$list->menu_staticlist('invoice_delivery','account_invoice_delivery','account_invoice_delivery',$record.invoice_delivery,'form_menu','')}{$list->menu_staticlist('invoice_show_itemized','account_invoice_show_itemized','account_invoice_show_itemized',$record.invoice_show_itemized,'form_menu','')}
    {osb f=tf field=invoice_grace}{osb f=tf field=invoice_advance_gen}
    {osb f=tf field=parent_id} 
    {osb f=autoselect module=account return=id field=account_parent_id default=$record.parent_id} 
    {osb f=tf field=max_child} 
     
    +
    +
    + + +
    + {if $record.static_var} + + {foreach from=$record.static_var item=custom} + + + + + {/foreach} +
    {$custom.name}{$custom.html}
    + {/if} +
    + + +
    + + + + +
    +
    +
    +
    + + {include file='file:../core/view_post.tpl'} +
    + +
    +
    + + + + {/if} diff --git a/themes/default/blocks/account_admin/add.tpl b/themes/default/blocks/account_admin/add.tpl deleted file mode 100644 index ec987c07..00000000 --- a/themes/default/blocks/account_admin/add.tpl +++ /dev/null @@ -1,457 +0,0 @@ - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $method->exe_noauth("tax","get_tax_ids")} - {if $tax_ids} - - - - - {/if} - - - - - - - -
    -
    - {translate module=account_admin} - title_add - {/translate} -
    -
    - - - - - - - - - - - - - - - - -
    - {translate module=account_admin} - field_username - {/translate} - - - - {translate module=account_admin} - blank_to_autogen - {/translate} -
    - {translate module=account_admin} - field_password - {/translate} - - - - {translate module=account_admin} - blank_to_autogen - {/translate} -
    - {translate module=account_admin} - welcome_email - {/translate} - - -  
    -
    - - - - - - - - - - - -
    - {translate module=account_admin} - field_status - {/translate} - - {translate module=account_admin} - field_email - {/translate} - - {translate module=account_admin} - field_company - {/translate} -
    - {if $VAR.account_admin_status == "" } - {if $smarty.const.DEFAULT_ACCOUNT_STATUS != "1"} - { $list->bool("account_admin_status", "1", "form_menu") } - {else} - { $list->bool("account_admin_status", "0", "form_menu") } - {/if} - {else} - { $list->bool("account_admin_status", $VAR.account_admin_status, "form_menu") } - {/if} - - - - -
    -
    - - - - - - - - - - - - -
    - {translate module=account_admin} - field_first_name - {/translate} - - {translate module=account_admin} - field_middle_name - {/translate} - - {translate module=account_admin} - field_last_name - {/translate} -
    - - - - - -
    -
    - - - - - - - - - - - -
    - {translate module=account_admin} - field_title - {/translate} - - {translate module=account_admin} - field_address1 - {/translate} - - {translate module=account_admin} - field_address2 - {/translate} -
    - - - - - -
    -
    - - - - - - - - - - - -
    - {translate module=account_admin} - field_city - {/translate} - - {translate module=account_admin} - field_state - {/translate} - - {translate module=account_admin} - field_zip - {/translate} -
    - - - - - -
    -
    - - - - - - - - - - - -
    - {translate module=account_admin} - field_country_id - {/translate} - - {translate module=account_admin} - field_date_expire - {/translate} - - {translate module=account_admin} - field_email_html - {/translate} -
    - {if $VAR.account_admin_country_id != ""} - { $list->menu("no", "account_admin_country_id", "country", "name", $VAR.account_admin_country_id, "form_field\" onChange=\"taxIdsDisplay(this.value)") } - {else} - { $list->menu("no", "account_admin_country_id", "country", "name", $smarty.const.DEFAULT_COUNTRY, "form_field\" onChange=\"taxIdsDisplay(this.value)") } - {/if} - - { $list->calender_add("account_admin_date_expire", $VAR.account_admin_date_expire, "form_field") } - - { $list->bool("account_admin_email_html", $VAR.account_email_type, "form_menu") } -
    -
    - - - - - - - - - - - -
    - {translate module=account_admin} - field_language_id - {/translate} - - {translate module=account_admin} - field_theme_id - {/translate} - - {translate module=account_admin} - field_currency_id - {/translate} -
    - {if $VAR.account_admin_language_id != ""} - { $list->menu_files("", "account_admin_language_id", $VAR.account_admin_language_id, "language", "", "_core.xml", "form_menu") } - {else} - { $list->menu_files("", "account_admin_language_id", $smarty.const.DEFAULT_LANGUAGE, "language", "", "_core.xml", "form_menu") } - {/if} - - {if $VAR.account_admin_theme_id != ""} - { $list->menu_files("", "account_admin_theme_id", $VAR.account_admin_theme_id, "theme", "", ".user_theme", "form_menu") } - {else} - { $list->menu_files("", "account_admin_theme_id", $smarty.const.DEFAULT_THEME, "theme", "", ".user_theme", "form_menu") } - {/if} - - {if $VAR.account_admin_currency_id != ""} - { $list->menu("no", "account_admin_currency_id", "currency", "name", $VAR.account_admin_currency_id, "form_menu") } - {else} - { $list->menu("no", "account_admin_currency_id", "currency", "name", $smarty.const.DEFAULT_CURRENCY, "form_menu") } - {/if} -
    -
    - - - - - - - - - - - -
    - {translate} - authorized_groups - {/translate} - - {if $list->is_installed('affiliate') } - {translate module=account_admin} - field_affiliate_id - {/translate} - {/if} - - {translate module=account_admin} - field_misc - {/translate} -
    - { $list->select_groups($VAR.groups,"groups","form_field","10","") } - - {if $list->is_installed('affiliate') } - {html_select_affiliate name="account_admin_affiliate_id" default=$VAR.account_admin_affiliate_id} -
    -
    - - {translate module=account_admin} - field_campaign_id - {/translate} -
    - { $list->menu("no", "account_admin_campaign_id", "campaign", "name", $VAR.account_admin_campaign_id, "", all) } - {/if} -
    - -
    -
    - - {foreach from=$tax_ids item=tax} - - - - - {/foreach} -
    - {$tax.tax_id_name} - - - -
    -
    - - { $method->exe("account","static_var")} - {foreach from=$static_var item=record} - - - - - {/foreach} -
    - {$record.name} - - {$record.html} -
    -
    - - { $method->exe("account","static_var")} - { $block->display("core:method_error") } - {foreach from=$static_var item=record} - {/foreach} - - - - -
      - - - - - {if $VAR.account_admin_account_id} - - {/if} -
    -
    -
    -
    diff --git a/themes/default/blocks/account_admin/iframe_mail_one.tpl b/themes/default/blocks/account_admin/iframe_mail_one.tpl deleted file mode 100644 index c795918e..00000000 --- a/themes/default/blocks/account_admin/iframe_mail_one.tpl +++ /dev/null @@ -1,102 +0,0 @@ -{ $block->display("core:top_clean") } - -{ $method->exe("account_admin","search_form") } -{ if ($method->result == FALSE) } - { $block->display("core:method_error") } -{else} -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=account_admin} - title_mail - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=account_admin} - mail_from - {/translate} - - {if $VAR.mail_email_id != ""} - { $list->menu("", "mail_email_id", "setup_email", "name", $smarty.const.DEFAULT_SETUP_EMAIL, "form_menu") } - {else} - { $list->menu("", "mail_email_id", "setup_email", "name", $setup.mail_email_id, "form_menu") } - {/if} -
    - {translate module=account_admin} - mail_to - {/translate} - - {html_select_account name="mail_account_id" default=$VAR.mail_account_id} -
    - {translate module=account_admin} - mail_subject - {/translate} - - -
    - {translate module=account_admin} - mail_message - {/translate} - - -
    - {translate module=account_admin} - mail_priority - {/translate} - - -
      - - - - -
    -
    -
    -
    - -{/if} diff --git a/themes/default/blocks/account_admin/mail_multi.tpl b/themes/default/blocks/account_admin/mail_multi.tpl deleted file mode 100644 index 6d2f6f8b..00000000 --- a/themes/default/blocks/account_admin/mail_multi.tpl +++ /dev/null @@ -1,96 +0,0 @@ -{ $method->exe("account_admin","search_form") } -{ if ($method->result == FALSE) } - { $block->display("core:method_error") } -{else} -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=account_admin} - title_mail - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=account_admin} - mail_from - {/translate} - - {if $VAR.mail_email_id != ""} - { $list->menu("", "mail_email_id", "setup_email", "name", $smarty.const.DEFAULT_SETUP_EMAIL, "form_menu") } - {else} - { $list->menu("", "mail_email_id", "setup_email", "name", $setup.mail_email_id, "form_menu") } - {/if} -
    - {translate module=account_admin} - mail_to - {/translate} - {translate - module=account_admin} mail_multi {/translate}
    - {translate module=account_admin} - mail_subject - {/translate} - - -
    - {translate module=account_admin} - mail_message - {/translate} - - -
    - {translate module=account_admin} - mail_priority - {/translate} - - -
      - - - - -
    -
    -
    -
    -{/if} diff --git a/themes/default/blocks/account_admin/mail_one.tpl b/themes/default/blocks/account_admin/mail_one.tpl deleted file mode 100644 index 2fb8dec0..00000000 --- a/themes/default/blocks/account_admin/mail_one.tpl +++ /dev/null @@ -1,96 +0,0 @@ -{ $method->exe("account_admin","search_form") } -{ if ($method->result == FALSE) } - { $block->display("core:method_error") } -{else} -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=account_admin} - title_mail - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=account_admin} - mail_from - {/translate} - - {if $VAR.mail_email_id != ""} - { $list->menu("", "mail_email_id", "setup_email", "name", $smarty.const.DEFAULT_SETUP_EMAIL, "form_menu") } - {else} - { $list->menu("", "mail_email_id", "setup_email", "name", $setup.mail_email_id, "form_menu") } - {/if} -
    - {translate module=account_admin} - mail_to - {/translate} - - {html_select_account name="mail_account_id" default=$VAR.mail_account_id} -
    - {translate module=account_admin} - mail_subject - {/translate} - - -
    - {translate module=account_admin} - mail_message - {/translate} - - -
    - {translate module=account_admin} - mail_priority - {/translate} - - -
      - - - -
    -
    -
    -
    -{/if} diff --git a/themes/default/blocks/account_admin/merge.tpl b/themes/default/blocks/account_admin/merge.tpl deleted file mode 100644 index 47312f25..00000000 --- a/themes/default/blocks/account_admin/merge.tpl +++ /dev/null @@ -1,55 +0,0 @@ - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=account_admin} - title_merge - {/translate} -
    -
    - - - - - - - - - - -
    - {translate module=account_admin} - merge_account - {/translate} -
     
    - - - - - -
    - {html_select_account name="merge_acct_id"} - - - - - -
    -
    -
    -
    -
    - \ No newline at end of file diff --git a/themes/default/blocks/account_admin/search_form.tpl b/themes/default/blocks/account_admin/search_form.tpl deleted file mode 100644 index eb15b13a..00000000 --- a/themes/default/blocks/account_admin/search_form.tpl +++ /dev/null @@ -1,567 +0,0 @@ -{ $method->exe("account_admin","search_form") } -{ if ($method->result == FALSE) } - { $block->display("core:method_error") } -{else} - -
    - - - - -
    - - - - - - - -
    -
    - {translate module=account_admin} - title_search - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $method->exe("account","static_var")} - {foreach from=$static_var item=record} - - - - - {/foreach} - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=account_admin} - field_username - {/translate} - - - {translate} - search_partial - {/translate} -
    - {translate module=account_admin} - field_email - {/translate} - - - {translate} - search_partial - {/translate} -
    - {translate module=account_admin} - field_first_name - {/translate} - - - {translate} - search_partial - {/translate} -
    - {translate module=account_admin} - field_middle_name - {/translate} - - - {translate} - search_partial - {/translate} -
    - {translate module=account_admin} - field_last_name - {/translate} - - - {translate} - search_partial - {/translate} -
    - {translate module=account_admin} - field_company - {/translate} - - - {translate} - search_partial - {/translate} -
    - {translate module=account_admin} - field_address1 - {/translate} - - - {translate} - search_partial - {/translate} -
    - {translate module=account_admin} - field_address2 - {/translate} - - - {translate} - search_partial - {/translate} -
    - {translate module=account_admin} - field_city - {/translate} - - - {translate} - search_partial - {/translate} -
    - {translate module=account_admin} - field_state - {/translate} - - - {translate} - search_partial - {/translate} -
    - {translate module=account_admin} - field_zip - {/translate} - - - {translate} - search_partial - {/translate} -
    - {translate module=account_admin} - field_misc - {/translate} - - - {translate} - search_partial - {/translate} -
    - {translate module=account_admin} - field_date_orig - {/translate} - - { $list->calender_search("account_admin_date_orig", - $VAR.account_admin_date_orig, "form_field", "") } -
    - {translate module=account_admin} - field_date_expire - {/translate} - - { $list->calender_search("account_admin_date_expire", - $VAR.account_admin_date_expire, "form_field", "") } -
    - {translate module=account_admin} - field_affiliate_id - {/translate} - - {html_select_affiliate name="account_admin_affiliate_id" default=$VAR.account_admin_affiliate_id} -
    - {translate module=account_admin} - field_campaign_id - {/translate} - - { $list->menu("no", "account_admin_campaign_id", "campaign", "name", "all", "form_menu") } -
    - {translate module=account_admin} - field_country_id - {/translate} - - { $list->menu("", "account_admin_country_id", - "country", "name", "all", "form_menu") } -
    - {translate module=account_admin} - field_language_id - {/translate} - - { $list->menu_files("", "account_admin_language_id", - "all", "language", "", "_core.xml", "form_menu") } -
    - {translate module=account_admin} - field_currency_id - {/translate} - - { $list->menu("", "account_admin_currency_id", - "currency", "name", "all", "form_menu") } -
    - {translate module=account_admin} - field_theme_id - {/translate} - - { $list->menu_files("", "account_admin_theme_id", - "all", "theme", "", ".user_theme", "form_menu") } -
    - {translate module=account_admin} - field_status - {/translate} - - { $list->bool("account_admin_status", "all", - "form_menu") } -
    - {translate module=account_admin} - account_group - {/translate} - - { $list->menu("", "account_group", "group", "name", "all", "form_menu") } -
    - {translate module=account_admin} - field_title - {/translate} - - -
    - {$record.name} - - {$record.html} -
    - {translate} - search_results_per - {/translate} - - -
    - {translate} - search_order_by - {/translate} - - -
      
      - - - - - -
      
    -
    -
    -
    - -
    - - - - -
    - - - - - - -
    Custom Group Search
    - - - - - - - - - { $method->exe("account","static_var")} {foreach from=$static_var item=record} {/foreach} - - - - - - - -
    {translate module=account_admin} field_date_orig {/translate} - - { $list->calender_add("dates[val][]", '', "") }
    - { $list->calender_add("dates[val][]", '', "") }
    {translate module=account_admin} account_group {/translate} { $list->menu_multi('', "groups", "group", "name", "10", "all", "form_menu") } -
      
      - - - -
    -
    - - - - -
    - - - - -
    - - - - - - -
    Custom Product Search
    - - - - - - - - - { $method->exe("account","static_var")} {foreach from=$static_var item=record} {/foreach} - - - - - - - -
    {translate module=account_admin} field_date_orig {/translate} - - { $list->calender_add("dates[val][]", '', "") }
    - { $list->calender_add("dates[val][]", '', "") }
    {translate module=account_admin} account_group {/translate} { $list->menu_multi('', "products", "product", "sku", "10", "all", "form_menu") } -
      
      - - - -
    -
    -
    - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=account_billing}title_search{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=account_billing} - field_card_num4 - {/translate} -
    - {translate module=account_billing} - field_checkout_plugin_id - {/translate} - { $list->menu("no", "account_billing_checkout_plugin_id", "checkout", "name", "all", "form_menu") }
    - {translate module=account_billing} - field_card_type - {/translate} - -  
    - - - - -
    -
    -
    -
    -{/if} -

    diff --git a/themes/default/blocks/account_admin/search_show.tpl b/themes/default/blocks/account_admin/search_show.tpl deleted file mode 100644 index 27b3b63c..00000000 --- a/themes/default/blocks/account_admin/search_show.tpl +++ /dev/null @@ -1,155 +0,0 @@ -{$method->exe("account_admin","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} -{else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - -{literal} - - -{/literal} - - -
    - - - -
    - - - - - - -
    - - - - - - - - - - - - - {foreach from=$account item=record} - - - - - - - - - - {literal} - - {/literal} - {/foreach} - -
       - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -  
    - - - {if $record.status == "1"} - - {else} - - {/if} -   - {$record.last_name} -   - {$record.first_name} -   - {$record.username|truncate:25} -   - {$record.email|truncate:25} - - - - - - {translate module=account_admin}view_login_logs{/translate} - - {translate module=account_admin}view_login_logs{/translate} -
    -
    - -{if $VAR._print != TRUE} -
    -
    - -
    - - - - - - - -

    - - - - - -
    {translate}search_export_image{/translate} - - {translate}search_print_image{/translate} - {translate}search_new_image{/translate} - {translate module=%%module%%}title_add{/translate} -
    - -
    -{/if} {/if}
    diff --git a/themes/default/blocks/account_admin/view.tpl b/themes/default/blocks/account_admin/view.tpl deleted file mode 100644 index c81732cf..00000000 --- a/themes/default/blocks/account_admin/view.tpl +++ /dev/null @@ -1,1042 +0,0 @@ -{ $method->exe("account_admin","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} - -{literal} - - -{/literal} - - -{foreach from=$account item=account_admin} - - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - -
    - - - - -
    - - - - - - - - - - - - - - - - - - {if $account_admin.static_var} - {/if} -
    -
    - {translate module=account_admin} - title_view - {/translate} -
    -
    - - - - -
    - - - - - - -
    - - - - - -
    -
    -
    - -
    - - - -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    {translate module=account_admin}menu_overview{/translate}
      - {$account_admin.first_name} - {$account_admin.middle_name} - {$account_admin.last_name} -
      - {$account_admin.address1} - {if $account_admin.address2 != ""} - , - {$account_admin.address2} - {/if} -
      - {$account_admin.city} - , - {$account_admin.state} - {$account_admin.zip} -
      - {$account_admin.email} -
    - {translate module=account_admin} - field_date_orig - {/translate} -
      - {$list->date_time($account_admin.date_orig)} -
    - {translate module=account_admin} - field_date_last - {/translate} -
      - {$list->date_time($account_admin.date_last)} - -
    {translate module=account_admin}last_activity{/translate}
      - {$list->date_time($account_admin.last_activity)} -
      - {if $account_admin.last_ip != ""} - - {$account_admin.last_ip} -   [ ? - ] - {/if} -
    -
    - - - {if $account_admin.invoice} - - - - {foreach from=$account_admin.invoice item=invoice} - - - - - - - - - {/foreach} - {/if} - - {if $account_admin.service} - - - - {foreach from=$account_admin.service item=service} - - - - - - - - - {/foreach} - {/if} - -
    {translate module=account_admin}invoice_overview{/translate}
      - {if $invoice.process_status == "1"} - - {else} - - {/if} - - {$invoice.id} - - {if $invoice.due > 0} - - {$list->format_currency_num($invoice.total_amt, '')} - - {else} - - {$list->format_currency_num($invoice.total_amt, '')} - - {/if} - - {if $invoice.due > 0} - - {$list->format_currency_num($invoice.due, '')} - - {else} - - {$list->format_currency_num('0', '')} - - {/if} -      - {$list->date($invoice.date_orig)} -

    - {translate module=account_admin}service_overview{/translate}
      - {if $service.active == "1"} - - {else} - - {/if} - - {$service.id} - - {$list->format_currency_num($service.price, '')} - - {$service.sku} -      - {if $service.type == 'domain'} - {$service.domain_name|lower} - . - {$service.domain_tld|lower} - {else} - {translate module=service} - {$service.type} - {/translate} - {/if} -
    -
    -
    - -
    - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - -
    - {translate module=account_admin} - field_username - {/translate} - - {translate module=account_admin} - field_password - {/translate} - - {translate module=account_admin} - field_email - {/translate} -
    - - - - - -
    -
    - - - - - - - - - - - -
    - {translate module=account_admin} - field_first_name - {/translate} - - {translate module=account_admin} - field_middle_name - {/translate} - - {translate module=account_admin} - field_last_name - {/translate} -
    - - - - - -
    -
    - - - - - - - - - - - -
    - {translate module=account_admin} - field_title - {/translate} - - {translate module=account_admin} - field_address1 - {/translate} - - {translate module=account_admin} - field_address2 - {/translate} -
    - - - - - -
    -
    - - - - - - - - - - - -
    - {translate module=account_admin} - field_city - {/translate} - - {translate module=account_admin} - field_state - {/translate} - - {translate module=account_admin} - field_zip - {/translate} -
    - - - - - -
    -
    - - - - - - - - - - - -
    - {translate module=account_admin} - field_country_id - {/translate} - - {translate module=account_admin} - field_status - {/translate} - - {translate module=account_admin} - field_company - {/translate} -
    - { $list->menu("no", "account_admin_country_id", "country", "name", $account_admin.country_id, "\" onChange=\"submit()\"") } - - { $list->bool("account_admin_status", $account_admin.status, "onChange=\"submit()\"") } - - -
    - - { $method->exe_noauth("tax","get_tax_ids")} - {if $tax_ids} - - - {foreach from=$tax_ids item=tax} - - - - - {/foreach} -
    - {$tax.tax_id_name} - - - -
    - {/if} - -
    -
    - -
    - - - - - - - -
    - - - - - - - - - - - -
    - {translate module=account_admin} - field_currency_id - {/translate} - - {translate module=account_admin} - field_language_id - {/translate} - - {translate module=account_admin} - field_date_expire - {/translate} -
    - { $list->menu("no", "account_admin_currency_id", "currency", "name", $account_admin.currency_id, "\" onChange=\"submit()\"") } - - { $list->menu_files("", "account_admin_language_id", $account_admin.language_id, "language", "", "_core.xml", "\" onChange=\"document.getElementById('update_form').submit()") } - - { $list->calender_view("account_admin_date_expire", $account_admin.date_expire, "form_field", $account_admin.id) } -
    -
    - - - - - -
    - - - - - - - -
    - {translate} - authorized_groups - {/translate} -
    - { $list->select_groups($account_admin.groups,"groups","form_field","10", $account_admin.own_account) } -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {if $account_admin.parent_id == 0 || $account_admin.parent_id == ''} - - - - - - - - - {/if} -
    - {translate module=account_admin} - field_email_html - {/translate} - - {translate module=account_admin} - field_theme_id - {/translate} -
    - { $list->bool("account_admin_email_type", $account_admin.email_type, "onChange=\"submit()\"") } - - { $list->menu_files("", "account_admin_theme_id", $account_admin.theme_id, "theme", "", ".user_theme", "onChange=\"submit()\"") } -
    - {if $list->is_installed('affiliate') } - {translate module=account_admin} - field_affiliate_id - {/translate} - {/if} - - {if $list->is_installed('campaign') } - {translate module=account_admin} - field_campaign_id - {/translate} - {/if} -
    - {if $list->is_installed('affiliate') } - {html_select_affiliate name="account_admin_affiliate_id" default=$account_admin.affiliate_id} - {/if} - - {if $list->is_installed('campaign') } - { $list->menu("no", "account_admin_campaign_id", "campaign", "name", $account_admin.campaign_id, "\" onChange=\"submit()\"", all) } - {/if} -
    {translate module=account_admin} field_invoice_delivery {/translate}{translate module=account_admin} field_invoice_show_itemized {/translate}
    {translate module=account_admin} field_invoice_grace {/translate}{translate module=account_admin} field_invoice_advance_gen{/translate}
    {translate module=account_admin}field_parent_id{/translate} 
    {html_select_account name="account_admin_parent_id" default=$account_admin.parent_id} 
    {translate module=account_admin}field_max_child{/translate} 
     
    -
    -
    -
    - -
    - {if $account_admin.static_var} - - - - -
    - - {foreach from=$account_admin.static_var item=record} - - - - - {/foreach} -
    - {$record.name} - - {$record.html} -
    -
    - {/if} -
    - -
    - - - - -
    - - - - -
    - -
    -
    -
    -
    - - - - - - -
    - - - - - - - - - - -
    -
    -
    -
    - -
    - -
    - - -{/foreach} -{/if} \ No newline at end of file diff --git a/themes/default/blocks/account_memo/add.tpl b/themes/default/blocks/account_memo/add.tpl index df7a9678..6f026d9e 100644 --- a/themes/default/blocks/account_memo/add.tpl +++ b/themes/default/blocks/account_memo/add.tpl @@ -1,60 +1,40 @@ -{ $block->display("core:top_clean") } +{assign var=meth value=':'|explode:$VAR._page} + - + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} -
    + - - - - -
    - - - - - - - -
    -
    - {translate module=account_memo}title_add{/translate} -
    -
    - - - - - - - - - -
    - {translate module=account_memo} - field_memo - {/translate} - - -
    - - - - - - - - - - -
    -
    -
    -
    - + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + {include file='file:../core/add_tr_submit.tpl'} +
    {osb f=tf field=memo}
    +
    +
    + +
    + + + +
    + diff --git a/themes/default/blocks/account_memo/search_show.tpl b/themes/default/blocks/account_memo/search_show.tpl index 3d186b6f..3943201b 100644 --- a/themes/default/blocks/account_memo/search_show.tpl +++ b/themes/default/blocks/account_memo/search_show.tpl @@ -1,140 +1,36 @@ -{ $block->display("core:top_clean") } +{assign var=meth value=':'|explode:$VAR._page} + -{$method->exe("account_memo","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    + {include file='file:../core/search_show_pre.tpl'} + + + + +
    + + {$method->exe_noauth($meth.0,'tpl_search_show')} + {foreach from=$search_show item=record} + {include file='file:../core/search_show_tr_record.tpl'} + + + + + + {/foreach} +
    {$list->date_time($record.date_orig)} + {if $record.staff_id == '0'} + {translate module=account_memo}system{/translate} + {else} + {$record.staff_id} + {/if} + {t}{$record.type}{/t}{$record.memo|truncate:30}
    +
    - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - - - {foreach from=$account_memo item=record} - - - - - - - - - - - - - - - {literal} - - {/literal} - {/foreach} - - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -
    - -   - {$list->date_time($record.date_orig)} -   - {if $record.staff_id == '0'} - {translate module=account_memo} - system - {/translate} - {else} - {$record.staff_id} - {/if} -   - {translate module=account_memo} - {$record.type} - {/translate} -   - {$record.memo|truncate:30} -
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - - -
    -
    + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/account_memo/view.tpl b/themes/default/blocks/account_memo/view.tpl index 989dad73..d16a9eb7 100644 --- a/themes/default/blocks/account_memo/view.tpl +++ b/themes/default/blocks/account_memo/view.tpl @@ -1,143 +1,67 @@ -{ $block->display("core:top_clean") } +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("account_memo","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} -{literal} - - -{/literal} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - -{foreach from=$account_memo item=account_memo} + +
    + + + + + +
    + + + + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + +
    {osb f=tf field=date_orig}{$list->date_time($record.date_orig)}
    {osb f=tf field=staff_id} + {if $record.staff_id == '0'} + {t}System{/t} + {else} + {osb f=html_select_account name='account_memo_staff_id' default=$record.staff_id} + {/if} +
    {osb f=tf field=memo}{$record.memo|nl2br}
    +
    + + + + {include file='file:../core/view_td_delete.tpl'} + +
     
    +
    +
    + + {include file='file:../core/view_post.tpl'} +
    - -{if $form_validation} - { $block->display("core:alert_fields") } {/if} - - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=account_memo}title_view{/translate} -
    -
    - - - - - - - - - - - - - - - - - -
    - {translate module=account_memo} - field_date_orig - {/translate} - - {$list->date_time($account_memo.date_orig)} -
    - {translate module=account_memo} - field_staff_id - {/translate} - - {if $account_memo.staff_id == '0'} - {translate module=account_memo} - system - {/translate} - {else} - {html_select_account name="account_memo_staff_id" default=$account_memo.staff_id} - {/if} -
    - {translate module=account_memo} - field_memo - {/translate} - - {$account_memo.memo|nl2br} -
    - - - - - -
      - -
    -
    -
    -
    - -
    - - - - -
    -
    - -{/foreach} -
    - - {translate module=account_memo} - title_add - {/translate} - - {/if} -
    diff --git a/themes/default/blocks/affiliate/add.tpl b/themes/default/blocks/affiliate/add.tpl index 740a7f2e..9482c4e1 100644 --- a/themes/default/blocks/affiliate/add.tpl +++ b/themes/default/blocks/affiliate/add.tpl @@ -1,59 +1,45 @@ +{assign var=meth value=':'|explode:$VAR._page} + + + +{if $form_validation} + {$block->display('core:alert_fields')} +{/if} + -
    - - - - -
    - - - - - - - -
    -
    - {translate module=affiliate}title_add{/translate} -
    -
    - - - - - - - - - - - - - -
    - {translate module=affiliate} - field_account_id - {/translate} - - {html_select_account name="affiliate_account_id" default=$VAR.affiliate_account_id} -
    - {translate module=affiliate} - affiliate_template - {/translate} - - {if $VAR.affiliate_affiliate_plugin_id == "" } - { $list->menu("", "affiliate_template_id", "affiliate_template", "name", $smarty.const.DEFAULT_AFFILIATE_TEMPLATE, "form_menu") } - {else} - { $list->menu("", "affiliate_template_id", "affiliate_template", "name", $VAR.affiliate_affiliate_plugin_id, "form_menu") } - {/if} -
    - - - - - - -
    -
    -
    -
    +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + {include file='file:../core/add_tr_submit.tpl'} +
    {osb f=tf field=account_id}{osb f=autoselect module=account return=id field=affiliate_account_id default=$VAR.affiliate_account_id}
    {osb f=tf field=affiliate_template} + {if $VAR.affiliate_affiliate_plugin_id == ''} + {$list->menu('no','affiliate_template_id','affiliate_template','name',$smarty.const.DEFAULT_AFFILIATE_TEMPLATE,'form_menu')} + {else} + {$list->menu('no','affiliate_template_id','affiliate_template','name',$VAR.affiliate_affiliate_plugin_id,'form_menu')} + {/if} +
    +
    +
    + +
    diff --git a/themes/default/blocks/affiliate/affiliate.tpl b/themes/default/blocks/affiliate/affiliate.tpl index 61d5f23b..c0549e65 100644 --- a/themes/default/blocks/affiliate/affiliate.tpl +++ b/themes/default/blocks/affiliate/affiliate.tpl @@ -1,19 +1,16 @@ -{if $SESS_LOGGED == "1" } +{if $SESS_LOGGED == '1'} + {$method->exe('affiliate','user_view')} -{ $method->exe("affiliate","user_view") } -{ if ($affiliate_user_view == false) } - - -{ $block->display("affiliate:user_add") } + + {if ($affiliate_user_view == false)} + {$block->display('affiliate:user_add')} + + {else} + {$block->display('affiliate:user_view')} + {/if} {else} - -{ $block->display("affiliate:user_view") } - -{/if} -{else} - - -{ $block->display("account:login") } + + {$block->display('account:user_login')} {/if} diff --git a/themes/default/blocks/affiliate/mail_multi.tpl b/themes/default/blocks/affiliate/mail_multi.tpl index 674c2ecc..ebf822b9 100644 --- a/themes/default/blocks/affiliate/mail_multi.tpl +++ b/themes/default/blocks/affiliate/mail_multi.tpl @@ -1,94 +1,65 @@ -{ $method->exe("affiliate","search_form") } { if ($method->result == FALSE) } -{ $block->display("core:method_error") } {else} -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=account_admin} - title_mail - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=account_admin} - mail_from - {/translate} - - {if $VAR.mail_email_id != ""} - { $list->menu("", "mail_email_id", "setup_email", "name", $smarty.const.DEFAULT_SETUP_EMAIL, "form_menu") } - {else} - { $list->menu("", "mail_email_id", "setup_email", "name", $setup.mail_email_id, "form_menu") } - {/if} -
    - {translate module=account_admin} - mail_to - {/translate} - {translate - module=account_admin} mail_multi {/translate}
    - {translate module=account_admin} - mail_subject - {/translate} - - -
    - {translate module=account_admin} - mail_message - {/translate} - - -
    - {translate module=account_admin} - mail_priority - {/translate} - - -
      - - - - -
    -
    -
    -
    +{assign var=meth value=':'|explode:$VAR._page} + + +{$method->exe($meth.0,'search_form')} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=from} + {if $VAR.mail_email_id != ''} + {$list->menu('','mail_email_id','setup_email','name',$smarty.const.DEFAULT_SETUP_EMAIL,'form_menu')} + {else} + {$list->menu('','mail_email_id','setup_email','name',$setup.mail_email_id,'form_menu')} + {/if} +
    {osb f=tf field=to}{osb f=tf field=multi}
    {osb f=tf field=subject}
    {osb f=tf field=message}
    {osb f=tf field=priority}{$list->bool('mail_priority',false,'form_menu')}
     
    +
    +
    + +
    + + + +
    +
    {/if} diff --git a/themes/default/blocks/affiliate/new_tier_iframe.tpl b/themes/default/blocks/affiliate/new_tier_iframe.tpl index 59f7bc37..72bbdbc8 100644 --- a/themes/default/blocks/affiliate/new_tier_iframe.tpl +++ b/themes/default/blocks/affiliate/new_tier_iframe.tpl @@ -1,62 +1,59 @@ - - - {$smarty.const.SITE_NAME} - + + + + + {$smarty.const.SITE_NAME} + + + - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=affiliate} - field_new_commission_rate - {/translate} -
    -
    - - - {literal} - {/literal} - - -
    -
    -
    - - - +{assign var=meth value=':'|explode:$VAR._page} + + + + +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + {section name=i start=0 loop=$VAR.tiers step=1} + + + + + {/section} +
    {t}Tier{/t} {$smarty.section.i.index+1} + + +
    +
    +
    + +
    + + diff --git a/themes/default/blocks/affiliate/plugin_EBULLION.tpl b/themes/default/blocks/affiliate/plugin_EBULLION.tpl index 37963cfc..bc06b01d 100644 --- a/themes/default/blocks/affiliate/plugin_EBULLION.tpl +++ b/themes/default/blocks/affiliate/plugin_EBULLION.tpl @@ -1,13 +1,6 @@ - - - - - + + + +
    - {translate module=affiliate} - plugin_ebullion_acct - {/translate} - - -
    {t}E-Bullion Account Number{/t}
    diff --git a/themes/default/blocks/affiliate/plugin_MAIL_CHECK.tpl b/themes/default/blocks/affiliate/plugin_MAIL_CHECK.tpl index 748bae14..7823441f 100644 --- a/themes/default/blocks/affiliate/plugin_MAIL_CHECK.tpl +++ b/themes/default/blocks/affiliate/plugin_MAIL_CHECK.tpl @@ -1,63 +1,26 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + +
    - {translate module=affiliate} - plugin_mail_check_payee - {/translate} - - -
    - {translate module=affiliate} - plugin_mail_check_address - {/translate} - - -
    - {translate module=affiliate} - plugin_mail_check_city - {/translate} - - -
    - {translate module=affiliate} - plugin_mail_check_state - {/translate} - - -
    - {translate module=affiliate} - plugin_mail_check_zip - {/translate} - - -
    - {translate module=affiliate} - plugin_mail_check_email - {/translate} - - -
    {t}Make Commission Checks Payable To{/t}
    {t}Address{/t}
    {t}City{/t}
    {t}State{/t}
    {t}Postal Code{/t}
    {t}Contact E-mail{/t}
    diff --git a/themes/default/blocks/affiliate/plugin_MONEYBOOKERS.tpl b/themes/default/blocks/affiliate/plugin_MONEYBOOKERS.tpl index 82f834c4..58ee8f1b 100644 --- a/themes/default/blocks/affiliate/plugin_MONEYBOOKERS.tpl +++ b/themes/default/blocks/affiliate/plugin_MONEYBOOKERS.tpl @@ -1,13 +1,6 @@ - - - - - + + + +
    - {translate module=affiliate} - plugin_moneybookers_email - {/translate} - - -
    {t}MoneyBookers E-mail{/t}
    diff --git a/themes/default/blocks/affiliate/plugin_PAYPAL.tpl b/themes/default/blocks/affiliate/plugin_PAYPAL.tpl index 8fc3c6f0..4c255bbc 100644 --- a/themes/default/blocks/affiliate/plugin_PAYPAL.tpl +++ b/themes/default/blocks/affiliate/plugin_PAYPAL.tpl @@ -1,13 +1,6 @@ - - - - - + + + +
    - {translate module=affiliate} - plugin_paypal_email - {/translate} - - -
    {t}PayPal E-mail{/t}
    diff --git a/themes/default/blocks/affiliate/recurr_tier_iframe.tpl b/themes/default/blocks/affiliate/recurr_tier_iframe.tpl index 879e810f..4a2f9e16 100644 --- a/themes/default/blocks/affiliate/recurr_tier_iframe.tpl +++ b/themes/default/blocks/affiliate/recurr_tier_iframe.tpl @@ -1,63 +1,59 @@ - - - - {$smarty.const.SITE_NAME} - + + + + + {$smarty.const.SITE_NAME} + + + - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=affiliate} - field_recurr_commission_rate - {/translate} -
    -
    - - - {literal} - {/literal} +{assign var=meth value=':'|explode:$VAR._page} + -
    -
    -
    - - - - + + +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + {section name=i start=0 loop=$VAR.tiers step=1} + + + + + {/section} +
    {t}Tier{/t} {$smarty.section.i.index+1} + + +
    +
    +
    + +
    + + diff --git a/themes/default/blocks/affiliate/search_form.tpl b/themes/default/blocks/affiliate/search_form.tpl index caa22c00..e9caa96b 100644 --- a/themes/default/blocks/affiliate/search_form.tpl +++ b/themes/default/blocks/affiliate/search_form.tpl @@ -1,149 +1,64 @@ -{ $method->exe("affiliate","search_form") } -{ if ($method->result == FALSE) } - { $block->display("core:method_error") } -{else} -
    - - - - -
    - - - - - - - -
    -
    - {translate module=affiliate}title_search{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - { $method->exe("affiliate","static_var")} - {foreach from=$static_var item=record} - - - - - {/foreach} - - - - - - - - - - - - - - - - -
    - {translate module=affiliate} - field_id - {/translate} - - -    - {translate} - search_partial - {/translate} -
    - {translate module=affiliate} - field_date_orig - {/translate} - - { $list->calender_search("affiliate_date_orig", $VAR.affiliate_date_orig, "form_field", "") } -
    - {translate module=affiliate} - field_status - {/translate} - - { $list->bool("affiliate_status", "all", "form_menu") } -
    - {translate module=affiliate} - field_account_id - {/translate} - - {html_select_account name="affiliate_account_id" default=$VAR.affiliate_account_id} -
    - {translate module=affiliate} - field_parent_affiliate_id - {/translate} - - {html_select_affiliate name="affiliate_parent_affiliate_id" default=$VAR.affiliate_parent_affiliate_id} -
    - {translate module=affiliate} - field_recurr_max_commission_periods - {/translate} - - -    - {translate} - search_partial - {/translate} -
    - {$record.name} - - {$record.html} -
    - {translate} - search_results_per - {/translate} - - -
    - {translate} - search_order_by - {/translate} - - -
    - - - - -
    -
    -
    -
    -{ $block->display("core:saved_searches") } -{ $block->display("core:recent_searches") } +{assign var=meth value=':'|explode:$VAR._page} + + +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + {$method->exe('affiliate','static_var')} + {foreach from=$static_var item=record} + + + + + {/foreach} + {include file='file:../core/search_post.tpl'} +
    {osb f=tf field=id}  {t}"%" for partial match{/t}
    {osb f=tf field=date_orig}{$list->calender_search('affiliate_date_orig',$VAR.affiliate_date_orig,'form_field','')}
    {osb f=tf field=status}{$list->bool('affiliate_status','all','form_menu')}
    {osb f=tf field=account_id}{osb f=html_select_account name="affiliate_account_id" default=$VAR.affiliate_account_id}
    {osb f=tf field=parent_affiliate_id}{osb f=html_select_affiliate name="affiliate_parent_affiliate_id" default=$VAR.affiliate_parent_affiliate_id}
    {osb f=tf field=recurr_max_commission_periods}  {t}"%" for partial match{/t}
    {$record.name}{$record.html}
    +
    +
    +
    + + {$block->display('core:saved_searches')} + {$block->display('core:recent_searches')} {/if} diff --git a/themes/default/blocks/affiliate/search_show.tpl b/themes/default/blocks/affiliate/search_show.tpl index 019051c5..c1e12a38 100644 --- a/themes/default/blocks/affiliate/search_show.tpl +++ b/themes/default/blocks/affiliate/search_show.tpl @@ -1,158 +1,37 @@ +{assign var=meth value=':'|explode:$VAR._page} + - -{$method->exe("affiliate","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    + {include file='file:../core/search_show_pre.tpl'} + + + + +
    + + {$method->exe_noauth($meth.0,'tpl_search_show')} + {foreach from=$search_show item=record} + {include file='file:../core/search_show_tr_record.tpl'} + + + + + + + + + {/foreach} +
    {$record.id} {$record.first_name} {$record.last_name}{$record.stats_sessions}{$record.stats_accounts}{$list->format_currency($record.stats_invoices_amt,'')} ({$record.stats_invoices}){$list->format_currency($record.stats_commissions,'')}{$list->bool('',$record.status,'')} + Email Affiliate + Referred Sessions + Referred Invoices +
    +
    - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - - - - {foreach from=$affiliate item=record} - - - - - - - - - - - {literal} - - {/literal} - {/foreach} - -
      - {literal} - - {/literal} - - {translate module=affiliate} - sessions - {/translate} - - {translate module=affiliate} - accounts - {/translate} - - {translate module=affiliate} - invoices - {/translate} - - {translate module=affiliate} - commissions - {/translate} - - {literal} - - {/literal} -  
    - -   - {$record.id}   - {$record.first_name} - {$record.last_name}  - {$record.stats_sessions} -   - {$record.stats_accounts} -   - {$list->format_currency($record.stats_invoices_amt,'')} - ({$record.stats_invoices})  - {$list->format_currency($record.stats_commissions,'')} -   - {if $record.status == "1"} - {translate} - true - {/translate} - {else} - {translate} - false - {/translate} - {/if} - - - - -
    -
    -{if $VAR._print != TRUE}
    -
    -

    - - - - - -

    - - - - -
    {translate}search_export_image{/translate} - - - {translate}search_print_image{/translate} - {translate}search_new_image{/translate} - {translate module=affiliate}title_add{/translate} -
    -
    -{/if} {/if}
    + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl' mail=true} +{/if} diff --git a/themes/default/blocks/affiliate/user_add.tpl b/themes/default/blocks/affiliate/user_add.tpl index 97c21446..a4f8de53 100644 --- a/themes/default/blocks/affiliate/user_add.tpl +++ b/themes/default/blocks/affiliate/user_add.tpl @@ -1,212 +1,150 @@ +{assign var=meth value=':'|explode:$VAR._page} + + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} - -
    + + - - - - -
    - - - - - - - -
    -
    - {translate module=affiliate} - title_user_add - {/translate} -
    -
    - - - - - - - -
    - {translate module=affiliate} - user_add_instruct - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - {foreach from=$static_var item=record} - - - - - {/foreach} - - - - -
    - {translate module=affiliate} - field_max_tiers - {/translate} - - {$affiliate_template.max_tiers} -
    - {translate module=affiliate} - field_commission_minimum - {/translate} - - { $list->format_currency($affiliate_template.commission_minimum,"") } -
    - {translate module=affiliate} - field_new_commission_type - {/translate} - - {if $affiliate_template.new_commission_type == "0"} - {translate module=affiliate} - none - {/translate} - {/if} - {if $affiliate_template.new_commission_type == "1"} - {translate module=affiliate} - percent - {/translate} - {/if} - {if $affiliate_template.new_commission_type == "2"} - {translate module=affiliate} - flat - {/translate} - {/if} -
    - {translate module=affiliate} - field_recurr_commission_type - {/translate} - - {if $affiliate_template.recurr_commission_type == "0"} - {translate module=affiliate} - none - {/translate} - {/if} - {if $affiliate_template.recurr_commission_type == "1"} - {translate module=affiliate} - percent - {/translate} - {/if} - {if $affiliate_template.recurr_commission_type == "2"} - {translate module=affiliate} - flat - {/translate} - {/if} -
    - {translate module=affiliate} - field_affiliate_plugin - {/translate} - - { $list->menu_files("", "affiliate_affiliate_plugin", $VAR.affiliate_affiliate_plugin, "affiliate_plugin", "", ".php", "form_menu") } -
    - {$record.name} - - {$record.html} -
    -
    - - - - -
    -
    -
    -
    - - - - - -
    - -
    - {literal} - {/literal} - -
    + {literal} + // create the hidden fields for the tier rates + for(i=0; i<99; i++) { + new_array[i] = ''; + rec_array[i] = ''; + } + {/literal} + + {$list->unserial($affiliate_template.new_commission_rate,'new_commission_rate')} + {foreach key=key item=item from=$new_commission_rate} + {if $item} + new_array[{$key}] = '{$item}'; + {/if} + {/foreach} + + {$list->unserial($affiliate_template.recurr_commission_rate,'recurr_commission_rate')} + {foreach key=key item=item from=$recurr_commission_rate} + {if $item} + rec_array[{$key}] = '{$item}'; + {/if} + {/foreach} + + {literal} + function UpdateTierValueNew(id,value) { + new_array[id] = value; + document.getElementById('new_'+id).value = value; + } + + function UpdateTierValueRecur(id,value) { + rec_array[id] = value; + document.getElementById('rec_'+id).value = value; + } + + function GetTierValueNew(id) { + return new_array[id]; + } + + function GetTierValueRecur(id) { + return rec_array[id]; + } + + function TierUpdate() { + {/literal} + var tiers = "{$affiliate_template.max_tiers}"; + var newc = "{$affiliate_template.new_commission_type}"; + var recc = "{$affiliate_template.recurr_commission_type}"; + {literal} + + if(tiers > 99) { + tiers = 99; + document.getElementById('affiliate_max_tiers').value = 99; + } + + if(newc != "0") + showIFrame('iframeNewTier',350,400,'?_page=affiliate:user_new_tier_iframe&_escape=1&tiers='+tiers); + if(recc != "0") + showIFrame('iframeRecTier',350,400,'?_page=affiliate:user_recurr_tier_iframe&_escape=1&tiers='+tiers); + } + {/literal} + + TierUpdate(); + //--> + + +
    + + + +
    + diff --git a/themes/default/blocks/affiliate/user_new_tier_iframe.tpl b/themes/default/blocks/affiliate/user_new_tier_iframe.tpl index 20668c8b..d7657316 100644 --- a/themes/default/blocks/affiliate/user_new_tier_iframe.tpl +++ b/themes/default/blocks/affiliate/user_new_tier_iframe.tpl @@ -1,62 +1,59 @@ - - - {$smarty.const.SITE_NAME} - + + + + + {$smarty.const.SITE_NAME} + + + - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=affiliate} - field_new_commission_rate - {/translate} -
    -
    - - - {literal} - {/literal} - - -
    -
    -
    - - - +{assign var=meth value=':'|explode:$VAR._page} + + + + +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + {section name=i start=0 loop=$VAR.tiers step=1} + + + + + {/section} +
    {t}Tier{/t} {$smarty.section.i.index+1} + + +
    +
    +
    + +
    + + diff --git a/themes/default/blocks/affiliate/user_recurr_tier_iframe.tpl b/themes/default/blocks/affiliate/user_recurr_tier_iframe.tpl index 909645c8..6d1610cb 100644 --- a/themes/default/blocks/affiliate/user_recurr_tier_iframe.tpl +++ b/themes/default/blocks/affiliate/user_recurr_tier_iframe.tpl @@ -1,62 +1,59 @@ - - - - {$smarty.const.SITE_NAME} - + + + + + {$smarty.const.SITE_NAME} + + + - -
    - - - - -
    - - - - - - - -
    -
    - {translate module=affiliate} - field_recurr_commission_rate - {/translate} -
    -
    - - - {literal} - {/literal} +{assign var=meth value=':'|explode:$VAR._page} + -
    -
    -
    - - - - + + +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + {section name=i start=0 loop=$VAR.tiers step=1} + + + + + {/section} +
    {t}Tier{/t} {$smarty.section.i.index+1} + + +
    +
    +
    + +
    + + diff --git a/themes/default/blocks/affiliate/user_view.tpl b/themes/default/blocks/affiliate/user_view.tpl index cd480f0d..6a6effa3 100644 --- a/themes/default/blocks/affiliate/user_view.tpl +++ b/themes/default/blocks/affiliate/user_view.tpl @@ -1,429 +1,245 @@ - +{assign var=meth value=':'|explode:$VAR._page} + + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} -
    - - - - - -
    - - - - - - - - - - - - - -
    -
    - {translate module=affiliate} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=affiliate} - field_id - {/translate} - - {$affiliate.id} -
    - {translate module=affiliate} - field_date_orig - {/translate} - - {$list->date_time($affiliate.date_orig)} -
    - {translate module=affiliate} - field_date_last - {/translate} - - {$list->date_time("")} -
    - {translate module=affiliate} - field_status - {/translate} - - {if $affiliate.status == "1"} - {translate} - true - {/translate} - {else} - {translate} - false - {/translate} - {/if} -
    - {translate module=affiliate} - field_max_tiers - {/translate} - - {$affiliate.max_tiers} -
    - {translate module=affiliate} - field_commission_minimum - {/translate} - - { $list->format_currency($affiliate.commission_minimum, "") } -
    - {translate module=affiliate} - field_recurr_max_commission_periods - {/translate} - {$affiliate.recurr_max_commission_periods}
    - {translate module=affiliate} - field_new_commission_type - {/translate} - - {if $affiliate.new_commission_type == "0"} - {translate module=affiliate} - none - {/translate} - {/if} - {if $affiliate.new_commission_type == "1"} - {translate module=affiliate} - percent - {/translate} - {/if} - {if $affiliate.new_commission_type == "2"} - {translate module=affiliate} - flat - {/translate} - {/if} -
    - {translate module=affiliate} - field_recurr_commission_type - {/translate} - - {if $affiliate.recurr_commission_type == "0"} - {translate module=affiliate} - none - {/translate} - {/if} - {if $affiliate.recurr_commission_type == "1"} - {translate module=affiliate} - percent - {/translate} - {/if} - {if $affiliate.recurr_commission_type == "2"} - {translate module=affiliate} - flat - {/translate} - {/if} -
    - - {foreach from=$static_var item=record} - - - - - {/foreach} -
    - {$record.name} - - {$record.html} -
    - -
    -
    - - - - - -
    - {translate module=affiliate} - field_affiliate_plugin - {/translate} - - { $list->menu_files("", "affiliate_affiliate_plugin", $affiliate.affiliate_plugin, "affiliate_plugin", "", ".php", "") } -
    - {assign var="afile" value=$affiliate.affiliate_plugin} - {assign var="ablock" value="affiliate:plugin_"} - {assign var="blockfile" value="$ablock$afile"} - { $block->display($blockfile) } -
    - - - - -
    - - - - - -
      - - - - - -
    -
    -
    -
    - -
    - - - - -
    - - - - - - - -
    -
    - {translate module=affiliate} - title_statistics - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - {foreach from=$affiliate.static_var item=record} - {/foreach} -
    - {translate module=affiliate} - sessions - {/translate} - - {$affiliate_stats.stats_sessions} -
    - {translate module=affiliate} - accounts - {/translate} - - {$affiliate_stats.stats_accounts} -
    - {translate module=affiliate} - invoices - {/translate} - - {$list->format_currency($affiliate_stats.stats_invoices_amt, '')} - ( - {$affiliate_stats.stats_invoices} - )   
    - {translate module=affiliate} - commissions - {/translate} - - {$list->format_currency($affiliate_stats.stats_commissions, '')} -
    - {translate module=affiliate} - commissions_due - {/translate} - - {$list->format_currency($affiliate_stats.commissions_due, '')} -
    -
    -
    - - {if $affiliate_campaign != ""} -
    - - - - -
    - - - - - - - -
    -
    - {translate module=affiliate} - title_campaigns - {/translate} -
    -
    - - - - {foreach from=$affiliate_campaign item=affiliate_campaign} - - - - - - {/foreach} -
    - {$affiliate_campaign.name} - - {translate module=affiliate} - campaign_code - {/translate} -
    -
    -
    - {/if} -
    - +
    + + + + + +
    + + + + + + + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=id}{$affiliate.id}
    {osb f=tf field=date_orig}{$list->date_time($affiliate.date_orig)}
    {osb f=tf field=date_last}{$list->date_time($affiliate.date_last)}
    {osb f=tf field=status}{$list->bool('',$affiliate.status,'')}
    {osb f=tf field=max_tiers}{$affiliate.max_tiers}
    {osb f=tf field=commission_minimum}{$list->format_currency($affiliate.commission_minimum,'')}
    {osb f=tf field=recurr_max_commission_periods}{$affiliate.recurr_max_commission_periods}
    {osb f=tf field=new_commission_type}{$list->menu_staticlist('commissiontype','','',$affiliate.new_commission_type,'')}
    {osb f=tf field=recurr_commission_type}{$list->menu_staticlist('commissiontype','','',$affiliate.recurr_commission_type,'')}
    + + {foreach from=$static_var item=record} + + + + + {/foreach} +
    {$record.name}{$record.html}
    +
    + + + + + +
    {osb f=tf field=affiliate_plugin}{$list->menu_files('','affiliate_affiliate_plugin',$affiliate.affiliate_plugin,'affiliate_plugin','','.php','')}
    + {assign var='afile' value=$affiliate.affiliate_plugin} + {assign var='ablock' value='affiliate:plugin_'} + {assign var='blockfile' value="$ablock$afile"} + {$block->display($blockfile)} +
    + + + + + +
     
    +
    +
    +
    + + + + +
    + + + + + + + +
    {t}Affiliate Statistics{/t}
    + + + + + + + + + + + + + + + + + + + + + +
    {t}Sessions{/t}{$affiliate_stats.stats_sessions}
    {t}Accounts{/t}{$affiliate_stats.stats_accounts}
    {t}Invoices{/t}{$list->format_currency($affiliate_stats.stats_invoices_amt,'')} ({$affiliate_stats.stats_invoices})
    {t}Commission{/t}{$list->format_currency($affiliate_stats.stats_commissions,'')}
    {t}Commissions Due{/t}{$list->format_currency($affiliate_stats.commissions_due,'')}
    +
    +
    + + {if $affiliate_campaign != ''} +
    + + + + +
    + + + + + + + +
    {t}Affiliate Links & Banners{/t}
    + + + {foreach from=$affiliate_campaign item=affiliate_campaign} + + + + + {/foreach} +
    {$affiliate_campaign.name}{translate module=affiliate}campaign_code{/translate}
    +
    +
    + {/if} + +
    + + + +
    +
    + +

    - - - - + + + +
    - - - - -
    - - - - - - - -
    -
    - {translate module=affiliate} - field_new_commission_rate - {/translate} -
    -
    - - { $list->unserial($affiliate.new_commission_rate,"new_commission_rate") } - {foreach key=key item=item from=$new_commission_rate} - {if $item} - - - - - {/if}{/foreach} -
    - {translate module=affiliate}tier{/translate} {math equation="x+y" x=$key y=1} - - {if $affiliate.new_commission_type == "0"} - {elseif $affiliate.new_commission_type == "1"} - {math equation="x*y" x=$item y=100} - % - {elseif $affiliate.new_commission_type == "2"} - {$list->format_currency($item, '')} - {/if} -
    -
    -
    -
    - - - - -
    - - - - - - - -
    -
    - {translate module=affiliate} - field_recurr_commission_rate - {/translate} -
    -
    - - - - { $list->unserial($affiliate.recurr_commission_rate,"recurr_commission_rate") } - {foreach key=key item=item from=$recurr_commission_rate} - {if $item} - - - - - {/if}{/foreach} -
    - {translate module=affiliate}tier{/translate} {math equation="x+y" x=$key y=1} - - {if $affiliate.recurr_commission_type == "0"} - {elseif $affiliate.recurr_commission_type == "1"} - {math equation="x*y" x=$item y=100} - % - {elseif $affiliate.recurr_commission_type == "2"} - {$list->format_currency($item, '')} - {/if} -
    - - -
    -
    -
    + + + + +
    + + + + + + + +
    {osb f=tt method=new_tier_iframe}
    + + {$list->unserial($affiliate.new_commission_rate,'new_commission_rate')} + {foreach key=key item=item from=$new_commission_rate} + {if $item} + + + + + {/if} + {/foreach} +
    {t}Tier{/t} {math equation="x+y" x=$key y=1} + {if $affiliate.new_commission_type == '0'} + {elseif $affiliate.new_commission_type == '1'} + {math equation="x*y" x=$item y=100}% + {elseif $affiliate.new_commission_type == '2'} + {$list->format_currency($item,'')} + {/if} +
    +
    +
    +
    + + + + +
    + + + + + + + +
    {osb f=tt method=recurr_tier_iframe}
    + + {$list->unserial($affiliate.recurr_commission_rate,'recurr_commission_rate')} + {foreach key=key item=item from=$recurr_commission_rate} + {if $item} + + + + + {/if} + {/foreach} +
    {t}Tier{/t} {math equation="x+y" x=$key y=1} + {if $affiliate.recurr_commission_type == '0'} + {elseif $affiliate.recurr_commission_type == '1'} + {math equation="x*y" x=$item y=100}% + {elseif $affiliate.recurr_commission_type == '2'} + {$list->format_currency($item, '')} + {/if} +
    +
    +
    +
    diff --git a/themes/default/blocks/affiliate/view.tpl b/themes/default/blocks/affiliate/view.tpl index 01f6cbae..bb5bb1d2 100644 --- a/themes/default/blocks/affiliate/view.tpl +++ b/themes/default/blocks/affiliate/view.tpl @@ -1,631 +1,225 @@ -{ $method->exe("affiliate","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{assign var=meth value=':'|explode:$VAR._page} + -{literal} - - -{/literal} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} - -{foreach from=$affiliate item=affiliate} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} + +
    - - - - - - + + + diff --git a/themes/default/blocks/cart/changeqty.tpl b/themes/default/blocks/cart/changeqty.tpl index 0df4cc88..4ed2edf7 100644 --- a/themes/default/blocks/cart/changeqty.tpl +++ b/themes/default/blocks/cart/changeqty.tpl @@ -1,17 +1,18 @@ -{$method->exe("cart","changeqty")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} -{else} +{$method->exe('cart','changeqty')} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} {if $js} - - javascript + + javascript {else} - no javascript + no javascript {/if} -{/if} - \ No newline at end of file +{/if} diff --git a/themes/default/blocks/charge/add.tpl b/themes/default/blocks/charge/add.tpl index c63fb747..76dbd31d 100644 --- a/themes/default/blocks/charge/add.tpl +++ b/themes/default/blocks/charge/add.tpl @@ -1,153 +1,78 @@ +{assign var=meth value=':'|explode:$VAR._page} + + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} - -
    - - - - - - + +
    -
    - {translate module=affiliate} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {foreach from=$affiliate.static_var item=record} - - - - - {/foreach} - - - - - -
    - {translate module=affiliate} - field_id - {/translate} - {$affiliate.id}
    - {translate module=affiliate} - field_date_orig - {/translate} - - {$list->date_time($affiliate.date_orig)} -
    - {translate module=affiliate} - field_date_last - {/translate} - - {$list->date_time("")} - -
    - {translate module=affiliate} - field_status - {/translate} - - { $list->bool("affiliate_status", $affiliate.status, "onChange=\"submit()\"") } -
    - {translate module=affiliate} - field_account_id - {/translate} - - {html_select_account name="affiliate_account_id" default=$affiliate.account_id} -
    - {translate module=affiliate} - field_parent_affiliate_id - {/translate} - - {html_select_affiliate name="affiliate_parent_affiliate_id" default=$affiliate.parent_affiliate_id} -
    - {translate module=affiliate} - field_avail_campaign_id - {/translate} - - { $list->menu_multi($affiliate.avail_campaign_id, "affiliate_avail_campaign_id", "campaign", "name", "", "2", "form_menu") } -
    - {translate module=affiliate} - field_max_tiers - {/translate} - - -
    - {translate module=affiliate} - field_commission_minimum - {/translate} - - -
    - {translate module=affiliate} - field_recurr_max_commission_periods - {/translate} - - -
    - {translate module=affiliate} - field_new_commission_type - {/translate} - - -
    - {translate module=affiliate} - field_recurr_commission_type - {/translate} - - -
    - {$record.name} - - {$record.html} -
    - {translate module=affiliate} - field_affiliate_plugin - {/translate} - - { $list->menu_files("", "affiliate_affiliate_plugin", $affiliate.affiliate_plugin, "affiliate_plugin", "", ".php", "\" onChange=\"document.getElementById('affiliate_view').submit()") } -
    - - {assign var="afile" value=$affiliate.affiliate_plugin} - {assign var="ablock" value="affiliate:plugin_"} - {assign var="blockfile" value="$ablock$afile"} - {if $afile != 'ACCOUNT_DISCOUNT'} - - { $block->display($blockfile) } + + + + +
    + + + + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {foreach from=$record.static_var item=rrecord} + + + + + {/foreach} + + + + + +
    {osb f=tf field=id}{$record.id} Email
    {osb f=tf field=date_orig}{$list->date_time($record.date_orig)}
    {osb f=tf field=date_last}{$list->date_time($record.date_last)}
    {osb f=tf field=status}{$list->bool('affiliate_status',$record.status,'" onchange="submit()')}
    {osb f=tf field=account_id}{osb f=html_select_account name='affiliate_account_id' default=$record.account_id}
    {osb f=tf field=parent_affiliate_id}{osb f=html_select_account name='affiliate_parent_affiliate_id' default=$record.parent_affiliate_id}
    {osb f=tf field=avail_campaign_id}{$list->menu_multi($record.avail_campaign_id,'affiliate_avail_campaign_id','campaign','name','','2','form_menu')}
    {osb f=tf field=max_tiers}
    {osb f=tf field=commission_minimum}
    {osb f=tf field=recurr_max_commission_periods}
    {osb f=tf field=new_commission_type}{$list->menu_staticlist('commissiontype','affiliate_new_commission_type','affiliate_new_commission_type',$record.new_commission_type,'form_menu" onchange="document.getElementById(\'view\').submit()')}
    {osb f=tf field=recurr_commission_type}{$list->menu_staticlist('commissiontype','affiliate_recurr_commission_type','affiliate_recurr_commission_type',$record.recurr_commission_type,'form_menu" onchange="document.getElementById(\'view\').submit()')}
    {$rrecord.name}{$rrecord.html}
    {osb f=tf field=affiliate_plugin}{$list->menu_files('','affiliate_affiliate_plugin',$record.affiliate_plugin,'affiliate_plugin','','.php','" onchange="document.getElementById(\'view\').submit()')}
    + {assign var="afile" value=$record.affiliate_plugin} + {assign var="ablock" value='affiliate:plugin_'} + {assign var="blockfile" value="$ablock$afile"} + {if $afile != 'ACCOUNT_DISCOUNT'} + {$block->display($blockfile)} + {/if} +
    + + {include file='file:../core/view_tr_submit_delete.tpl'} +
    +
    +
    + +
    + {section name=i start=0 loop=100 step=1} + + + {/section} +
    + {include file='file:../core/view_post.tpl'} + +

    + + + + +
    + + + + + + + +
    {t}Affiliate Statistics{/t}
    + + + + + + + + + + + + + + + + + + + + + +
    {t}Sessions{/t}{$record.stats_sessions}
    {t}Accounts{/t}{$record.stats_accounts}
    {t}Invoices{/t}{$list->format_currency($record.stats_invoices_amt,'')} ({$record.stats_invoices})
    {t}commissions{/t}{$list->format_currency($record.stats_commissions,'')}
    {t}commissions_due{/t}{$list->format_currency($record.commissions_due,'')}
    +
    +
    + + +

    + + + + + +
    + + {/literal} - - {/foreach} + function UpdateTierValueRecur(id,value) { + rec_array[id] = value; + document.getElementById('rec_'+id).value = value; + } + + function GetTierValueNew(id) { + return new_array[id]; + } + + function GetTierValueRecur(id) { + return rec_array[id]; + } + + function TierUpdate() { + var tiers = document.getElementById('affiliate_max_tiers').value; + + if(tiers > 99) { + tiers = 99; + document.getElementById('affiliate_max_tiers').value = 99; + } + showIFrame('iframeNewTier',400,400,'?_page=affiliate:new_tier_iframe&_escape=1&tiers='+tiers); + showIFrame('iframeRecTier',400,400,'?_page=affiliate:recurr_tier_iframe&_escape=1&tiers='+tiers); + } + {/literal} + + TierUpdate(); + //--> + {/if} diff --git a/themes/default/blocks/affiliate_commission/add.tpl b/themes/default/blocks/affiliate_commission/add.tpl index 418c87af..af230c34 100644 --- a/themes/default/blocks/affiliate_commission/add.tpl +++ b/themes/default/blocks/affiliate_commission/add.tpl @@ -1,63 +1,39 @@ - +{assign var=meth value=':'|explode:$VAR._page} + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} -
    + - - - - -
    - - - - - - - -
    -
    - {translate module=affiliate_commission}title_add{/translate} -
    -
    - - - - - - - - - - - - - -
    - {translate module=affiliate_commission} - field_date_begin - {/translate} - - { $list->calender_add("affiliate_commission_start_date", $VAR.affiliate_commission_start_date, "form_field") } -
    - {translate module=affiliate_commission} - field_date_end - {/translate} - - { $list->calender_add("affiliate_commission_end_date", $VAR.affiliate_commission_end_date, "form_field") } -
    - - - - - - -
    -
    -
    -
    + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + {include file='file:../core/add_tr_submit.tpl'} +
    {osb f=tf field=date_begin}{$list->calender_add('affiliate_commission_start_date',$VAR.affiliate_commission_start_date,'form_field')}
    {osb f=tf field=date_end}{$list->calender_add('affiliate_commission_end_date',$VAR.affiliate_commission_end_date,'form_field')}
    +
    +
    + + diff --git a/themes/default/blocks/affiliate_commission/search_form.tpl b/themes/default/blocks/affiliate_commission/search_form.tpl index 743be2e8..03e48ac6 100644 --- a/themes/default/blocks/affiliate_commission/search_form.tpl +++ b/themes/default/blocks/affiliate_commission/search_form.tpl @@ -1,108 +1,46 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("affiliate_commission","search_form") } -{ if ($method->result == FALSE) } - { $block->display("core:method_error") } +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=affiliate_commission}title_search{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=affiliate_commission} - field_date_orig - {/translate} - - { $list->calender_search("affiliate_commission_date_orig", $VAR.affiliate_commission_date_orig, "form_field", "") } -
    - {translate module=affiliate_commission} - field_notes_admin - {/translate} - - -    - {translate} - search_partial - {/translate} -
    - {translate module=affiliate_commission} - field_notes_affiliate - {/translate} - - -    - {translate} - search_partial - {/translate} -
    - {translate} - search_results_per - {/translate} - - -
    - {translate} - search_order_by - {/translate} - - -
    - - - - -
    -
    -
    -
    -{ $block->display("core:saved_searches") } -{ $block->display("core:recent_searches") } +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + {include file='file:../core/search_post.tpl'} +
    {osb f=tf field=date_orig}{$list->calender_search('affiliate_commission_date_orig',$VAR.affiliate_commission_date_orig,'form_field','')}
    {osb f=tf field=notes_admin}  {t}"%" for partial match{/t}
    {osb f=tf field=notes_affiliate}  {t}"%" for partial match{/t}
    +
    +
    + +
    + + {$block->display('core:saved_searches')} + {$block->display('core:recent_searches')} {/if} diff --git a/themes/default/blocks/affiliate_commission/search_show.tpl b/themes/default/blocks/affiliate_commission/search_show.tpl index d1095e12..a866df00 100644 --- a/themes/default/blocks/affiliate_commission/search_show.tpl +++ b/themes/default/blocks/affiliate_commission/search_show.tpl @@ -1,125 +1,36 @@ +{assign var=meth value=':'|explode:$VAR._page} + - -{$method->exe("affiliate_commission","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    + {include file='file:../core/search_show_pre.tpl'} + + + + +
    + + {$method->exe_noauth($meth.0,'tpl_search_show')} + {foreach from=$search_show item=record} + {include file='file:../core/search_show_tr_record.tpl'} + + + + + + {/foreach} +
    {$list->date_time($record.date_orig)} + {if $record.date_begin > 0} + {$list->date($record.date_begin)} + {else} + --- + {/if} + {$list->date($record.date_end)}{$list->format_currency($record.commissions,'')}
    +
    - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - {foreach from=$affiliate_commission item=record} - - - - - - - - {literal} - - {/literal} - {/foreach} - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -
    - -   - {$list->date_time($record.date_orig)} -   - {if $record.date_begin > 0} - {$list->date($record.date_begin)} - {else} - --- - {/if} -   - {$list->date($record.date_end)} -   - {$list->format_currency($record.commissions, '')} -
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/affiliate_commission/view.tpl b/themes/default/blocks/affiliate_commission/view.tpl index 5040cca1..dcb6fa6a 100644 --- a/themes/default/blocks/affiliate_commission/view.tpl +++ b/themes/default/blocks/affiliate_commission/view.tpl @@ -1,225 +1,115 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("affiliate_commission","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} -{literal} - - -{/literal} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - -{foreach from=$affiliate_commission item=affiliate_commission} + +
    - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - - - - - - - -
    - - - - - - - -
    -
    - {translate module=affiliate_commission}title_view{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=affiliate_commission} - field_date_orig - {/translate} - - {$list->date_time($affiliate_commission.date_orig)} -
    - {translate module=affiliate_commission} - field_date_begin - {/translate} - - {if $affiliate_commission.date_begin > 0} - {$list->date($affiliate_commission.date_begin)} - {else} - --- - {/if} -
    - {translate module=affiliate_commission} - field_date_end - {/translate} - - {$list->date($affiliate_commission.date_end)} -
    - {translate module=affiliate_commission} - field_commissions - {/translate} - {if $affiliate_commission.commissions > 0} - {$list->format_currency($affiliate_commission.commissions, '')} - {else}0{/if} -
    - {translate module=affiliate_commission} - field_status - {/translate} - - { $list->bool("affiliate_commission_status", $affiliate_commission.status, "form_menu") } -
    - {translate module=affiliate_commission} - field_notes_admin - {/translate} - - -
    - {translate module=affiliate_commission} - field_notes_affiliate - {/translate} - - -
    - - - - - - - -
      - -
    -
    -
    -
    - - - - -
    - - - - -
    - - - - - - - -
    -
    - {translate module=affiliate_commission} - title_view - {/translate} -
    -
    - - - {foreach from=$plugindata item=plugin} - - - - - - {/foreach} -
    - {$plugin.name} - - {$plugin.count} - {translate module=affiliate_commission} - commissions - {/translate} - - {if $plugin.count > 0} - - - {translate module=affiliate_commission} - export - {/translate} - - {else} - - {translate module=affiliate_commission} - do_nothing - {/translate} - {/if} -
    -
    -
    -
    - {/foreach} + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {translate module=affiliate_commission}field_date_orig{/translate}{$list->date_time($affiliate_commission.date_orig)}
    {translate module=affiliate_commission}field_date_begin{/translate} + {if $affiliate_commission.date_begin > 0} + {$list->date($affiliate_commission.date_begin)} + {else} + --- + {/if} +
    {translate module=affiliate_commission}field_date_end{/translate}{$list->date($affiliate_commission.date_end)}
    {translate module=affiliate_commission}field_commissions{/translate} + {if $affiliate_commission.commissions > 0} + {$list->format_currency($affiliate_commission.commissions,'')} + {else} + 0 + {/if} +
    {translate module=affiliate_commission}field_status{/translate}{$list->bool('affiliate_commission_status',$affiliate_commission.status,'form_menu')}
    {translate module=affiliate_commission}field_notes_admin{/translate}
    {translate module=affiliate_commission}field_notes_affiliate{/translate}
    + + {include file='file:../core/view_tr_submit_delete.tpl'} +
    +
    +
    +
    +

    + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + {foreach from=$plugindata item=plugin} + + + + + + {/foreach} +
    {$plugin.name}{$plugin.count} {translate module=affiliate_commission}commissions{/translate} + {if $plugin.count > 0} + {t}Run commission payment tool{/t} + {else} + {t}Nothing to do{/t} + {/if} +
    +
    +
    + {/if} diff --git a/themes/default/blocks/affiliate_template/add.tpl b/themes/default/blocks/affiliate_template/add.tpl index 24d16cb3..a9ab07d2 100644 --- a/themes/default/blocks/affiliate_template/add.tpl +++ b/themes/default/blocks/affiliate_template/add.tpl @@ -1,234 +1,155 @@ - +{assign var=meth value=':'|explode:$VAR._page} + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} -
    + - - - - -
    - - - - - - - -
    -
    - {translate module=affiliate_template}title_add{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=affiliate_template} - field_name - {/translate} - - -
    - {translate module=affiliate_template} - field_notes - {/translate} - - -
    - {translate module=affiliate_template} - field_status - {/translate} - - {if $VAR.affiliate_template_status != "" } - { $list->bool("affiliate_template_status", $VAR.affiliate_template_status, "form_menu") } - {else} - { $list->bool("affiliate_template_status", "1", "form_menu") } - {/if} -
    - {translate module=affiliate_template} - field_affiliate_plugin - {/translate} - - { $list->menu_files("", "affiliate_template_affiliate_plugin", $VAR.affiliate_template_affiliate_plugin, "affiliate_plugin", "", ".php", "form_menu") } -
    - {translate module=affiliate_template} - field_avail_campaign_id - {/translate} - - { $list->menu_multi($VAR.affiliate_template_avail_campaign_id, "affiliate_template_avail_campaign_id", "campaign", "name", "", "5", "form_menu") } -
    - {translate module=affiliate_template} - field_max_tiers - {/translate} - - {if $VAR.affiliate_template_max_tiers == ""} - - {else} - - {/if} -
    - {translate module=affiliate_template} - field_commission_minimum - {/translate} - - -
    - {translate module=affiliate_template} - field_new_commission_type - {/translate} - - -
    - {translate module=affiliate_template} - field_recurr_commission_type - {/translate} - - -
    - {translate module=affiliate_template} - field_recurr_max_commission_periods - {/translate} - - -
    - - - - -
    -
    -
    -
    - - - {literal} - {/literal} +
    diff --git a/themes/default/blocks/affiliate_template/search_show.tpl b/themes/default/blocks/affiliate_template/search_show.tpl index 0d10460e..2e593f28 100644 --- a/themes/default/blocks/affiliate_template/search_show.tpl +++ b/themes/default/blocks/affiliate_template/search_show.tpl @@ -1,129 +1,12 @@ +{assign var=meth value=':'|explode:$VAR._page} + - -{$method->exe("affiliate_template","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - {foreach from=$affiliate_template item=record} - - - - - - - - {literal} - - {/literal} - {/foreach} - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -
    - -   - {$record.name} -   - {if $record.status == "1"} - {translate} - true - {/translate} - {else} - {translate} - false - {/translate} - {/if} -   - {$record.max_tiers} -   - {$record.commission_minimum} -
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    + {include file='file:../core/search_show_pre.tpl'} + {$method->exe_noauth($meth.0,'tpl_search_show',$search_show)} + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/affiliate_template/view.tpl b/themes/default/blocks/affiliate_template/view.tpl index ad1fb8fa..fe3c194e 100644 --- a/themes/default/blocks/affiliate_template/view.tpl +++ b/themes/default/blocks/affiliate_template/view.tpl @@ -1,494 +1,155 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("affiliate_template","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} -{literal} - - -{/literal} + {/literal} - -{foreach from=$affiliate_template item=affiliate_template} + {$list->unserial($record.new_commission_rate,'new_commission_rate')} + {foreach key=key item=item from=$new_commission_rate} + {if $item} + UpdateTierValueNew({$key},"{$item}"); + {/if} + {/foreach} - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=affiliate_template}title_view{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=affiliate_template} - field_name - {/translate} - - -
    - {translate module=affiliate_template} - field_notes - {/translate} - - -
    - {translate module=affiliate_template} - field_status - {/translate} - - { $list->bool("affiliate_template_status", $affiliate_template.status, "form_menu") } -
    - {translate module=affiliate_template} - field_affiliate_plugin - {/translate} - - { $list->menu_files("", "affiliate_template_affiliate_plugin", $affiliate_template.affiliate_plugin, "affiliate_plugin", "", ".php", "form_menu") } -
    - {translate module=affiliate_template} - field_avail_campaign_id - {/translate} - - { $list->menu_multi($affiliate_template.avail_campaign_id, "affiliate_template_avail_campaign_id", "campaign", "name", "", "5", "form_menu") } -
    - {translate module=affiliate_template} - field_max_tiers - {/translate} - - -
    - {translate module=affiliate_template} - field_commission_minimum - {/translate} - - -
    - {translate module=affiliate_template} - field_new_commission_type - {/translate} - - -
    - {translate module=affiliate_template} - field_recurr_commission_type - {/translate} - - -
    - {translate module=affiliate_template} - field_recurr_max_commission_periods - {/translate} - - -
    -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    -
    - - - - - -
      - -
    -
    -
    -
    - - - - -
    - -
    - - - - -{literal} -{/literal} - - {/foreach} + {$list->unserial($record.recurr_commission_rate,'recurr_commission_rate')} + {foreach key=key item=item from=$recurr_commission_rate} + {if $item} + UpdateTierValueRecur({$key},"{$item}"); + {/if} + {/foreach} + + {literal} + function UpdateTierValueNew(id,value) { + new_array[id] = value; + document.getElementById('new_'+id).value = value; + } + + function UpdateTierValueRecur(id,value) { + rec_array[id] = value; + document.getElementById('rec_'+id).value = value; + } + + function GetTierValueNew(id) { + return new_array[id]; + } + + function GetTierValueRecur(id) { + return rec_array[id]; + } + + function TierUpdate() { + var tiers = document.getElementById('affiliate_template_max_tiers').value; + + if(tiers > 99) { + tiers = 99; + document.getElementById('affiliate_template_max_tiers').value = 99; + } + showIFrame('iframeNewTier',400,400,'?_page=affiliate:new_tier_iframe&_escape=1&tiers='+tiers); + showIFrame('iframeRecTier',400,400,'?_page=affiliate:recurr_tier_iframe&_escape=1&tiers='+tiers); + } + {/literal} + + TierUpdate(); + //--> + {/if} diff --git a/themes/default/blocks/blocked_email/add.tpl b/themes/default/blocks/blocked_email/add.tpl index 1b379a3c..5bf402b6 100644 --- a/themes/default/blocks/blocked_email/add.tpl +++ b/themes/default/blocks/blocked_email/add.tpl @@ -1,64 +1,42 @@ - +{assign var=meth value=':'|explode:$VAR._page} + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=blocked_email} - title_add - {/translate} -
    -
    - - - - - - - - - - - - - -
    - {translate module=blocked_email} - field_email - {/translate} - - -
    - {translate module=blocked_email} - field_notes - {/translate} - - -
    - - - - - -
    -
    -
    -
    +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + {include file='file:../core/add_tr_submit.tpl'} +
    {osb f=tf field=email}
    {osb f=tf field=notes}
    +
    +
    + +
    + +
    +
    diff --git a/themes/default/blocks/blocked_email/search_form.tpl b/themes/default/blocks/blocked_email/search_form.tpl index b9c2ef54..481bc6a6 100644 --- a/themes/default/blocks/blocked_email/search_form.tpl +++ b/themes/default/blocks/blocked_email/search_form.tpl @@ -1,100 +1,42 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("blocked_email","search_form") } -{ if ($method->result == FALSE) } - { $block->display("core:method_error") } +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=blocked_email} - title_search - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=blocked_email} - field_email - {/translate} - - -    - {translate} - search_partial - {/translate} -
    - {translate module=blocked_email} - field_notes - {/translate} - - -    - {translate} - search_partial - {/translate} -
    - {translate} - search_results_per - {/translate} - - -
    - {translate} - search_order_by - {/translate} - - -
    - - - - -
    -
    -
    -
    -{ $block->display("core:saved_searches") } -{ $block->display("core:recent_searches") } +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + {include file='file:../core/search_post.tpl'} +
    {osb f=tf filed=email}  {t}"%" for partial match{/t}
    {osb f=tf filed=notes}  {t}"%" for partial match{/t}
    +
    +
    + +
    + + {$block->display('core:saved_searches')} + {$block->display('core:recent_searches')} {/if} diff --git a/themes/default/blocks/blocked_email/search_show.tpl b/themes/default/blocks/blocked_email/search_show.tpl index 8095a63a..2e593f28 100644 --- a/themes/default/blocks/blocked_email/search_show.tpl +++ b/themes/default/blocks/blocked_email/search_show.tpl @@ -1,94 +1,12 @@ +{assign var=meth value=':'|explode:$VAR._page} + - -{$method->exe("blocked_email","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - {foreach from=$blocked_email item=record} - - - - - - - {literal} - - {/literal} - {/foreach} - - -
      - {literal} - - {/literal} -
    - -   {$record.email}
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    + {include file='file:../core/search_show_pre.tpl'} + {$method->exe_noauth($meth.0,'tpl_search_show',$search_show)} + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/blocked_email/view.tpl b/themes/default/blocks/blocked_email/view.tpl index 5d473c22..044fe311 100644 --- a/themes/default/blocks/blocked_email/view.tpl +++ b/themes/default/blocks/blocked_email/view.tpl @@ -1,127 +1,50 @@ -{ $method->exe("blocked_email","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} -{literal} - - -{/literal} +{assign var=meth value=':'|explode:$VAR._page} + - -{foreach from=$blocked_email item=blocked_email} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} - -{if $form_validation} - { $block->display("core:alert_fields") } + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} + + +
    + + + + + +
    + + + + + + + + {include file='file:../core/view_tr_submit_delete.tpl'} +
    {osb f=tt}
    + + + + + + + + + + + + + +
    {osb f=tf field=date_orig}{$list->date_time($record.date_orig)}
    {osb f=tf field=email}
    {osb f=tf field=notes}
    +
    +
    + +
    {/if} - - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=blocked_email} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - - - - - -
    - {translate module=blocked_email} - field_date_orig - {/translate} - - {$list->date_time($blocked_email.date_orig)} -
    - {translate module=blocked_email} - field_email - {/translate} - - -
    - {translate module=blocked_email} - field_notes - {/translate} - - -
    - - - - - -
    - - - -
    -
    -
    -
    - - - - -
    - {/foreach} - {/if} diff --git a/themes/default/blocks/blocked_ip/add.tpl b/themes/default/blocks/blocked_ip/add.tpl index 4ed53988..01d14ce9 100644 --- a/themes/default/blocks/blocked_ip/add.tpl +++ b/themes/default/blocks/blocked_ip/add.tpl @@ -1,63 +1,42 @@ - +{assign var=meth value=':'|explode:$VAR._page} + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} -
    - - - - +
    - - - - -
    -
    - {translate module=blocked_ip} - title_add - {/translate} -
    + + + + + - - - - -
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + {include file='file:../core/add_tr_submit.tpl'} +
    {osb f=tf field=ip}
    {osb f=tf field=notes}
    +
    - - - - - - - - - - - - - -
    - {translate module=blocked_ip} - field_ip - {/translate} - - -
    - {translate module=blocked_ip} - field_notes - {/translate} - - -
    - - - - -
    -
    -
    - +
    + +
    + +
    + diff --git a/themes/default/blocks/blocked_ip/search_form.tpl b/themes/default/blocks/blocked_ip/search_form.tpl index 4e997489..abf6f1a1 100644 --- a/themes/default/blocks/blocked_ip/search_form.tpl +++ b/themes/default/blocks/blocked_ip/search_form.tpl @@ -1,100 +1,42 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("blocked_ip","search_form") } -{ if ($method->result == FALSE) } - { $block->display("core:method_error") } +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} -
    - - - - - -
    - - - - - - - + + +
    -
    - {translate module=blocked_ip} - title_search - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=blocked_ip} - field_ip - {/translate} - - -    - {translate} - search_partial - {/translate} -
    - {translate module=blocked_ip} - field_notes - {/translate} - - -    - {translate} - search_partial - {/translate} -
    - {translate} - search_results_per - {/translate} - - -
    - {translate} - search_order_by - {/translate} - - -
    - - - - -
    -
    + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + {include file='file:../core/search_post.tpl'} +
    {osb f=tf field=ip}  {t}"%" for partial match{/t}
    {osb f=tf field=notes}  {t}"%" for partial match{/t}
    +
    +
    -
    -
    -{ $block->display("core:saved_searches") } -{ $block->display("core:recent_searches") } + + + + {$block->display('core:saved_searches')} + {$block->display('core:recent_searches')} {/if} diff --git a/themes/default/blocks/blocked_ip/search_show.tpl b/themes/default/blocks/blocked_ip/search_show.tpl index 11572971..2e593f28 100644 --- a/themes/default/blocks/blocked_ip/search_show.tpl +++ b/themes/default/blocks/blocked_ip/search_show.tpl @@ -1,94 +1,12 @@ +{assign var=meth value=':'|explode:$VAR._page} + - -{$method->exe("blocked_ip","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - {foreach from=$blocked_ip item=record} - - - - - - - {literal} - - {/literal} - {/foreach} - - -
      - {literal} - - {/literal} -
    - -   {$record.ip}
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    + {include file='file:../core/search_show_pre.tpl'} + {$method->exe_noauth($meth.0,'tpl_search_show',$search_show)} + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/blocked_ip/view.tpl b/themes/default/blocks/blocked_ip/view.tpl index 0c646182..84356703 100644 --- a/themes/default/blocks/blocked_ip/view.tpl +++ b/themes/default/blocks/blocked_ip/view.tpl @@ -1,118 +1,50 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("blocked_ip","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} -{literal} - - -{/literal} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} - -{foreach from=$blocked_ip item=blocked_ip} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=blocked_ip} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - -
    - {translate module=blocked_ip} - field_ip - {/translate} - - -
    - {translate module=blocked_ip} - field_notes - {/translate} - - -
    - - - - - -
    - - - -
    -
    -
    -
    - - - - -
    - {/foreach} + +
    + + + + + +
    + + + + + + + + {include file='file:../core/view_tr_submit_delete.tpl'} +
    {osb f=tt}
    + + + + + + + + + + + + + +
    {osb f=tf field=date_orig}{$list->date_time($record.date_orig)}
    {osb f=tf field=ip}
    {osb f=tf field=notes}
    +
    +
    + +
    {/if} diff --git a/themes/default/blocks/campaign/add.tpl b/themes/default/blocks/campaign/add.tpl index dd55641d..81939a2c 100644 --- a/themes/default/blocks/campaign/add.tpl +++ b/themes/default/blocks/campaign/add.tpl @@ -1,312 +1,76 @@ -{literal} -{/literal} - +{assign var=meth value=':'|explode:$VAR._page} + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=campaign}title_add{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=campaign} - field_date_orig - {/translate} - - {$list->date_time("")} - -
    - {translate module=campaign} - field_date_last - {/translate} - - {$list->date_time("")} - -
    - {translate module=campaign} - field_date_start - {/translate} - - { $list->calender_add("campaign_date_start", $VAR.campaign_date_start, "form_field") } -
    - {translate module=campaign} - field_date_expire - {/translate} - - { $list->calender_add("campaign_date_expire", $VAR.campaign_date_expire, "form_field") } -
    - {translate module=campaign} - field_status - {/translate} - - {if $VAR.campaign_status != ""} - { $list->bool("campaign_status", $VAR.campaign_status, "form_menu") } - {else} - { $list->bool("campaign_status", "1", "form_menu") } - {/if} -
    - {translate module=campaign} - field_name - {/translate} - - -
    - {translate module=campaign} - field_description - {/translate} - - -
    - {translate module=campaign} - field_budget - {/translate} - - -
    - {translate module=campaign} - field_url - {/translate} -
    -
    - -
    -
    -
      - {translate module=campaign} - files - {/translate} -
    - {translate module=campaign} - add_one - {/translate} - - -
    - {translate module=campaign} - add_two - {/translate} - - -
    - {translate module=campaign} - add_three - {/translate} - - -
    - {translate module=campaign} - add_four - {/translate} - - -
    - {translate module=campaign} - add_five - {/translate} - - -
    - {translate module=campaign} - add_six - {/translate} - - -
    - {translate module=campaign} - add_seven - {/translate} - - -
    - {translate module=campaign} - add_eight - {/translate} - - -
    - {translate module=campaign} - add_nine - {/translate} - - -
    - {translate module=campaign} - add_ten - {/translate} - - -
    - {translate module=campaign} - add_eleven - {/translate} - - -
    - {translate module=campaign} - add_twelve - {/translate} - - -
    - - - - -
    -
    -
    -
    +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/add_tr_submit.tpl'} +
    {osb f=tf field=date_start}{$list->calender_add('campaign_date_start',$VAR.campaign_date_start,'form_field')}
    {osb f=tf field=date_expire}{$list->calender_add('campaign_date_expire',$VAR.campaign_date_expire,'form_field')}
    {osb f=tf field=status} + {if $VAR.campaign_status != ''} + {$list->bool('campaign_status',$VAR.campaign_status,'form_menu')} + {else} + {$list->bool('campaign_status','1','form_menu')} + {/if} +
    {osb f=tf field=name}
    {osb f=tf field=description}
    {osb f=tf field=budget}
    {osb f=tf field=url}
    +
    +
    + +
    diff --git a/themes/default/blocks/campaign/click.tpl b/themes/default/blocks/campaign/click.tpl index 4e3adb9f..b5b392dc 100644 --- a/themes/default/blocks/campaign/click.tpl +++ b/themes/default/blocks/campaign/click.tpl @@ -1,5 +1,7 @@ -{ $method->exe("campaign","click") } -{ if ($method->result == FALSE) } -{ $block->display("core:method_error") } -{ /if } +{assign var=meth value=':'|explode:$VAR._page} + +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{/if} diff --git a/themes/default/blocks/campaign/display.tpl b/themes/default/blocks/campaign/display.tpl index c8a5a6ff..ed19aabf 100644 --- a/themes/default/blocks/campaign/display.tpl +++ b/themes/default/blocks/campaign/display.tpl @@ -1,5 +1,7 @@ -{ $method->exe("campaign","display") } -{ if ($method->result == FALSE) } -{ $block->display("core:method_error") } -{ /if } +{assign var=meth value=':'|explode:$VAR._page} + +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{/if} diff --git a/themes/default/blocks/campaign/search_form.tpl b/themes/default/blocks/campaign/search_form.tpl index 491c4367..50cffa9a 100644 --- a/themes/default/blocks/campaign/search_form.tpl +++ b/themes/default/blocks/campaign/search_form.tpl @@ -1,148 +1,62 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("campaign","search_form") } -{ if ($method->result == FALSE) } - { $block->display("core:method_error") } +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=campaign}title_search{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=campaign} - field_date_orig - {/translate} - - { $list->calender_search("campaign_date_orig", $VAR.campaign_date_orig, "form_field", "") } -
    - {translate module=campaign} - field_date_last - {/translate} - - { $list->calender_search("campaign_date_last", $VAR.campaign_date_last, "form_field", "") } -
    - {translate module=campaign} - field_date_start - {/translate} - - { $list->calender_search("campaign_date_start", $VAR.campaign_date_start, "form_field", "") } -
    - {translate module=campaign} - field_date_expire - {/translate} - - { $list->calender_search("campaign_date_expire", $VAR.campaign_date_expire, "form_field", "") } -
    - {translate module=campaign} - field_status - {/translate} - - { $list->bool("campaign_status", "all", "form_menu") } -
    - {translate module=campaign} - field_name - {/translate} - - -    - {translate} - search_partial - {/translate} -
    - {translate module=campaign} - field_description - {/translate} - - -    - {translate} - search_partial - {/translate} -
    - {translate} - search_results_per - {/translate} - - -
    - {translate} - search_order_by - {/translate} - - -
    - - - - -
    -
    -
    -
    -{ $block->display("core:saved_searches") } -{ $block->display("core:recent_searches") } +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/search_post.tpl'} +
    {osb f=tf field=date_orig}{$list->calender_search('campaign_date_orig',$VAR.campaign_date_orig,'form_field','')}
    {osb f=tf field=date_last}{$list->calender_search('campaign_date_last',$VAR.campaign_date_last,'form_field','')}
    {osb f=tf field=date_start}{$list->calender_search('campaign_date_start',$VAR.campaign_date_start,'form_field','')}
    {osb f=tf field=date_expire}{$list->calender_search('campaign_date_expire',$VAR.campaign_date_expire,'form_field','')}
    {osb f=tf field=status}{$list->bool('campaign_status','all','form_menu')}
    {osb f=tf field=name}  {t}"%" for partial match{/t}
    {osb f=tf field=description}  {t}"%" for partial match{/t}
    +
    +
    + +
    + + {$block->display('core:saved_searches')} + {$block->display('core:recent_searches')} {/if} diff --git a/themes/default/blocks/campaign/search_show.tpl b/themes/default/blocks/campaign/search_show.tpl index fd38cf40..66136e92 100644 --- a/themes/default/blocks/campaign/search_show.tpl +++ b/themes/default/blocks/campaign/search_show.tpl @@ -1,184 +1,37 @@ +{assign var=meth value=':'|explode:$VAR._page} + - -{$method->exe("campaign","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    + {include file='file:../core/search_show_pre.tpl'} + + + + +
    + + {$method->exe_noauth($meth.0,'tpl_search_show')} + {foreach from=$search_show item=record} + {include file='file:../core/search_show_tr_record.tpl'} + + + + + + + + + + + + + {/foreach} +
    {$record.name}{$list->format_currency_num($record.budget,'')}{$record.impressions_total|number_format}{$record.clicks_total|number_format}{$list->format_currency_num($record.cpc_avg,'')}{$list->format_currency_num($record.cpi_avg,'')}{$record.ctr_avg}{$list->format_currency_num($record.conversion_cost,'')}{$record.roi}{$list->format_currency_num($record.invoice_avg,'')}{$list->format_currency_num($record.invoices_revenue,'')} ({$record.invoices_referred})
    +
    - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - - - - - - - - {foreach from=$campaign item=record} - - - - - - - - - - - - - - - {literal} - - {/literal} - {/foreach} - -
      - {literal} - - {/literal} - - {translate module=campaign} - cost - {/translate} - - {translate module=campaign} - impr - {/translate} - - {translate module=campaign} - clicks - {/translate} - - {translate module=campaign} - cpc - {/translate} - - {translate module=campaign} - cpi - {/translate} - - {translate module=campaign} - conversion - {/translate} - - {translate module=campaign} - cost_conv - {/translate} - - {translate module=campaign} - roi_s - {/translate} - - {translate module=campaign} - avg_sale_s - {/translate} - - {translate module=campaign} - revenue - {/translate} -
    - -   - {$record.name} - - {$list->format_currency_num($record.budget,"")} - - {$record.impressions_total|number_format} - - {$record.clicks_total|number_format} - - {$list->format_currency_num($record.cpc_avg,"")} - - {$list->format_currency_num($record.cpi_avg, "")} - - {$record.ctr_avg} - - {$list->format_currency_num($record.conversion_cost,"")} - - {$record.roi} - - {$list->format_currency_num($record.invoice_avg,"")} - - {$list->format_currency_num($record.invoices_revenue,"")} - ( - {$record.invoices_referred} - )
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    - - - - -
    {translate}search_export_image{/translate} - {translate}search_print_image{/translate} - - {translate}search_new_image{/translate} - {translate module=campaign}title_add{/translate} -
    -
    + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/campaign/view.tpl b/themes/default/blocks/campaign/view.tpl index 7979d6ce..4e189a8f 100644 --- a/themes/default/blocks/campaign/view.tpl +++ b/themes/default/blocks/campaign/view.tpl @@ -1,1253 +1,240 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("campaign","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} - +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} -{literal} - - -{/literal} + } + {/literal} + image = new StringArray({$counter}); + {counter start=0 skip=1 assign=counter}{foreach from=$record.results key=key item=results}{if $results.file != ''} + image[{$counter}] = '{$key}'; + {counter}{/if}{/foreach} - -{foreach from=$campaign item=campaign} -

    - - {if $form_validation} - { $block->display("core:alert_fields") } - {/if} - -

    + var ran = 60/image.length + {literal} + function ranimage() { + currentdate = new Date() + core = currentdate.getSeconds() + core = Math.floor(core/ran) + return(image[core]) + } + {/literal} + var fileId = ranimage(); + var write1 = ''; + var write2 = ''; + document.write(write1+''+write2); +//--> +{/capture} + +
    - - - - - - - - - - - -
    - - - - - - - - - - {if $campaign.served1 != 0 || $campaign.clicked1 != 0 || $campaign.file1 != ""} - - - - - - - - {/if} - {if $campaign.served2 != 0 || $campaign.clicked2 != 0 || $campaign.file2 != ""} - - - - - - - - {/if} - {if $campaign.served3 != 0 || $campaign.clicked3 != 0 || $campaign.file3 != ""} - - - - - - - - {/if} - {if $campaign.served4 != 0 || $campaign.clicked4 != 0 || $campaign.file4 != ""} - - - - - - - - {/if} - {if $campaign.served5 != 0 || $campaign.clicked5 != 0 || $campaign.file5 != ""} - - - - - - - - {/if} - {if $campaign.served6 != 0 || $campaign.clicked6 != 0 || $campaign.file6 != ""} - - - - - - - - {/if} - {if $campaign.served7 != 0 || $campaign.clicked7 != 0 || $campaign.file7 != ""} - - - - - - - - {/if} - {if $campaign.served8 != 0 || $campaign.clicked8 != 0 || $campaign.file8 != ""} - - - - - - - - {/if} - {if $campaign.served9 != 0 || $campaign.clicked9 != 0 || $campaign.file9 != ""} - - - - - - - - {/if} - {if $campaign.served10 != 0 || $campaign.clicked10 != 0 || $campaign.file10 != ""} - - - - - - - - {/if} - {if $campaign.served11 != 0 || $campaign.clicked11 != 0 || $campaign.file11 != ""} - - - - - - - - {/if} - {if $campaign.served12 != 0 || $campaign.clicked12 != 0 || $campaign.file12 != ""} - - - - - - - - {/if} - - - - - - - -
    -
    - {translate module=campaign} - impressions - {/translate} -
    -
    -
    - {translate module=campaign} - clicks - {/translate} -
    -
    -
    - {translate module=campaign} - cost - {/translate} -
    -
    -
    - {translate module=campaign} - conversion - {/translate} -
    -
    - {translate module=campaign} - add_one - {/translate} - - {$campaign.served1|number_format} - {$campaign.impressions_percentage1} - - {$campaign.clicked1|number_format} - {$campaign.clicks_percentage1} - - {$list->format_currency_num($campaign.cost1,"")} - - {$campaign.ctr1} -
    - {translate module=campaign} - add_two - {/translate} - - {$campaign.served2|number_format} - {$campaign.impressions_percentage2} - - {$campaign.clicked2|number_format} - {$campaign.clicks_percentage2} - - {$list->format_currency_num($campaign.cost2,"")} - - {$campaign.ctr2} -
    - {translate module=campaign} - add_three - {/translate} - - {$campaign.served3|number_format} - {$campaign.impressions_percentage3} - - {$campaign.clicked3|number_format} - {$campaign.clicks_percentage3} - - {$list->format_currency_num($campaign.cost3,"")} - - {$campaign.ctr3} -
    - {translate module=campaign} - add_four - {/translate} - - {$campaign.served4|number_format} - {$campaign.impressions_percentage4} - - {$campaign.clicked4|number_format} - {$campaign.clicks_percentage4} - - {$list->format_currency_num($campaign.cost4,"")} - - {$campaign.ctr4} -
    - {translate module=campaign} - add_five - {/translate} - - {$campaign.served5|number_format} - {$campaign.impressions_percentage5} - - {$campaign.clicked5|number_format} - {$campaign.clicks_percentage5} - - {$list->format_currency_num($campaign.cost5,"")} - - {$campaign.ctr5} -
    - {translate module=campaign} - add_six - {/translate} - - {$campaign.served6|number_format} - {$campaign.impressions_percentage6} - - {$campaign.clicked6|number_format} - {$campaign.clicks_percentage6} - - {$list->format_currency_num($campaign.cost6,"")} - - {$campaign.ctr6} -
    - {translate module=campaign} - add_seven - {/translate} - - {$campaign.served7|number_format} - {$campaign.impressions_percentage7} - - {$campaign.clicked7|number_format} - {$campaign.clicks_percentage7} - - {$list->format_currency_num($campaign.cost7,"")} - - {$campaign.ctr7} -
    - {translate module=campaign} - add_eight - {/translate} - - {$campaign.served8|number_format} - {$campaign.impressions_percentage8} - - {$campaign.clicked8|number_format} - {$campaign.clicks_percentage8} - - {$list->format_currency_num($campaign.cost8,"")} - - {$campaign.ctr8} -
    - {translate module=campaign} - add_nine - {/translate} - - {$campaign.served9|number_format} - {$campaign.impressions_percentage9} - - {$campaign.clicked9|number_format} - {$campaign.clicks_percentage9} - - {$list->format_currency_num($campaign.cost9,"")} - - {$campaign.ctr9} -
    - {translate module=campaign} - add_ten - {/translate} - - {$campaign.served10|number_format} - {$campaign.impressions_percentage10} - - {$campaign.clicked10|number_format} - {$campaign.clicks_percentage10} - - {$list->format_currency_num($campaign.cost10,"")} - - {$campaign.ctr10} -
    - {translate module=campaign} - add_eleven - {/translate} - - {$campaign.served11|number_format} - {$campaign.impressions_percentage11} - - {$campaign.clicked11|number_format} - {$campaign.clicks_percentage11} - - {$list->format_currency_num($campaign.cost11,"")} - - {$campaign.ctr11} -
    - {translate module=campaign} - add_twelve - {/translate} - - {$campaign.served12|number_format} - {$campaign.impressions_percentage12} - - {$campaign.clicked12|number_format} - {$campaign.clicks_percentage12} - - {$list->format_currency_num($campaign.cost12,"")} - - {$campaign.ctr12} -
    - {$campaign.impressions_total|number_format} - - {$campaign.clicks_total|number_format} - {$campaign.clicks_percentage3} - - {$list->format_currency_num($campaign.budget,"")} - - {$campaign.ctr_avg} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=campaign}referred_invoices{/translate} - - - - {$campaign.invoices_referred} - - {translate module=campaign} - referred_accounts - {/translate} - - {$campaign.accounts_referred} -
    - {translate module=campaign} - revenue_generated - {/translate} - - {$list->format_currency_num($campaign.invoices_revenue, "")} - - {translate module=campaign} - avg_cpi - {/translate} - - {$list->format_currency_num($campaign.cpi_avg, "")} -
    - {translate module=campaign} - avg_cost_conversion - {/translate} - - {$list->format_currency_num($campaign.conversion_cost,"")} - - {translate module=campaign} - avg_cpc - {/translate} - - {$list->format_currency_num($campaign.cpc_avg,"")} -
    - {translate module=campaign} - avg_sale - {/translate} - - {$list->format_currency_num($campaign.invoice_avg,"")} - - {translate module=campaign} - impr_to_buy - {/translate} - - {$campaign.impr_to_buy} -
    - {translate module=campaign} - roi - {/translate} - - {$campaign.roi} - - {translate module=campaign} - click_to_buy - {/translate} - - {$campaign.click_to_buy} -
    -
    - -

    -
    - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - {translate module=campaign} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=campaign} - field_date_orig - {/translate} - - {$list->date_time($campaign.date_orig)} -
    - {translate module=campaign} - field_date_last - {/translate} - - {$list->date_time($campaign.date_last)} -
    - {translate module=campaign} - field_date_start - {/translate} - - { $list->calender_view("campaign_date_start", $campaign.date_start, "form_field", $campaign.id) } -
    - {translate module=campaign} - field_date_expire - {/translate} - - { $list->calender_view("campaign_date_expire", $campaign.date_expire, "form_field", $campaign.id) } -
    - {translate module=campaign} - field_status - {/translate} - - { $list->bool("campaign_status", $campaign.status, "form_menu") } -
    - {translate module=campaign} - field_name - {/translate} - - -
    - {translate module=campaign} - field_description - {/translate} - - -
    - {translate module=campaign} - field_budget - {/translate} - - -
    - {translate module=campaign} - field_url - {/translate} - - -
     
    - - - -
    -
    -

    -
    - - - - - {if $campaign.file1 != ""} - - - - - - - {/if} -
    - - - - - -
    - {translate module=campaign} - add_one - {/translate} - - - -
    -
    -
    -

    -
    -
    -
    - -
    -
    -
    -
    -
    -
    - - - - - {if $campaign.file2 != ""} - - - - - - - {/if} -
    - - - - - -
    - {translate module=campaign} - add_two - {/translate} - - -
    -
    -
    -
    -
    -
    - - -
    - - {translate module=campaign} - delete_file - {/translate} -
    -
    -
    -
    -
    -
    - - - - - {if $campaign.file3 != ""} - - - - - - - {/if} -
    - - - - - -
    - {translate module=campaign} - add_three - {/translate} - - -
    -
    -
    -
    -
    -
    - -
    - - {translate module=campaign} - delete_file - {/translate} -
    -
    -
    -
    -
    -
    - - - - - {if $campaign.file4 != ""} - - - - - - - {/if} -
    - - - - - -
    - {translate module=campaign} - add_four - {/translate} - - -
    -
    -
    -
    -
    -
    - - -
    - {translate module=campaign} - delete_file - {/translate} -

    -
    -
    -
    -
    -
    - - - - - {if $campaign.file5 != ""} - - - - - - - {/if} -
    - - - - - -
    - {translate module=campaign} - add_five - {/translate} - - -
    -
    -
    -

    -
    -
    -
    - -
    - - {translate module=campaign} - delete_file - {/translate} -
    -
    -
    -
    -
    -
    - - - - - {if $campaign.file6 != ""} - - - - - - - {/if} -
    - - - - - -
    - {translate module=campaign} - add_six - {/translate} - - -
    -
    -
    -

    -
    -
    -
    - -
    - - {translate module=campaign} - delete_file - {/translate} -
    -
    -
    -
    -
    -
    - - - - - {if $campaign.file7 != ""} - - - - - - - {/if} -
    - - - - - -
    - {translate module=campaign} - add_seven - {/translate} - - -
    -
    -
    -

    -
    -
    -
    - -
    - - {translate module=campaign} - delete_file - {/translate} -
    -
    -
    -
    -
    -
    - - - - - {if $campaign.file8 != ""} - - - - - - - {/if} -
    - - - - - -
    - {translate module=campaign} - add_eight - {/translate} - - -
    -
    -
    -

    -
    -
    -
    - -
    - - {translate module=campaign} - delete_file - {/translate} -
    -
    -
    -
    -
    -
    - - - - - {if $campaign.file9 != ""} - - - - - - - {/if} -
    - - - - - -
    - {translate module=campaign} - add_nine - {/translate} - - -
    -
    -
    -

    -
    -
    -
    - -
    - - {translate module=campaign} - delete_file - {/translate} -
    -
    -
    -
    -
    -
    - - - - - {if $campaign.file10 != ""} - - - - - - - {/if} -
    - - - - - -
    - {translate module=campaign} - add_ten - {/translate} - - -
    -
    -
    -

    -
    -
    -
    - -
    - - {translate module=campaign} - delete_file - {/translate} -
    -
    -
    -
    -
    -
    - - - - - {if $campaign.file11 != ""} - - - - - - - {/if} -
    - - - - - -
    - {translate module=campaign} - add_eleven - {/translate} - - -
    -
    -
    -

    -
    -
    -
    - -
    - - {translate module=campaign} - delete_file - {/translate} -
    -
    -
    -
    -
    -
    - - - - - {if $campaign.file12 != ""} - - - - - - - {/if} -
    - - - - - -
    - {translate module=campaign} - add_twelve - {/translate} - - -
    -
    -
    -

    -

    -
    -
    -
    - -
    - - {translate module=campaign} - delete_file - {/translate} -
    -
    -
    -
    -
    -
    -

     

    -


    -
    - {translate module=campaign} - random_code - {/translate} -

    -

    -
    -
    - -
    - - - - - -
    - - - -
    -
    -
    - -

    - - - - -

    -

     

    -
    - {/foreach} + {include file='file:../core/view_post.tpl'} + {/if} diff --git a/themes/default/blocks/cart/ad_hoc.tpl b/themes/default/blocks/cart/ad_hoc.tpl index 0bb95c0f..30e43b72 100644 --- a/themes/default/blocks/cart/ad_hoc.tpl +++ b/themes/default/blocks/cart/ad_hoc.tpl @@ -1,160 +1,75 @@ - -
    - - - - -
    - - - - - - - -
    -
    - {translate module=cart} - ad_hoc_heading - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=cart} - ad_hoc_sku - {/translate} - - -
    - {translate module=cart} - ad_hoc_name - {/translate} - - -
    - {translate module=cart} - ad_hoc_amount - {/translate} - - -
    - {translate module=cart} - quantity - {/translate} - - -
    - {translate module=cart} - ad_hoc_taxable - {/translate} - - -
    - {translate module=cart} - ad_hoc_attr - {/translate} - - -
    - - = - -
    - - - - - - - - - - - - - - - - - - -
    - - - - - -
    -
    -
    +{assign var=meth value=':'|explode:$VAR._page} + + + + + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf module=product field=sku}
    {osb f=tf module=product field=name}
    {osb f=tf module=product field=amount}
    {osb f=tf module=product field=quantity}
    {osb f=tf module=product field=taxable}
    {osb f=tf module=product field=attr} + {assign var=last value=11} + {section name=count start=1 loop=$last step=1} +
    + + = + +
    + {/section} +
     
    +
    +
    + +
    + + + + +
    -{literal} - -{/literal} \ No newline at end of file diff --git a/themes/default/blocks/cart/admin_changeqty.tpl b/themes/default/blocks/cart/admin_changeqty.tpl index 8ce54859..2f54344a 100644 --- a/themes/default/blocks/cart/admin_changeqty.tpl +++ b/themes/default/blocks/cart/admin_changeqty.tpl @@ -1,17 +1,18 @@ -{$method->exe("cart","admin_changeqty")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} -{else} +{$method->exe('cart','admin_changeqty')} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} {if $js} - - javascript + + javascript {else} - no javascript + no javascript {/if} -{/if} - \ No newline at end of file +{/if} diff --git a/themes/default/blocks/cart/admin_view.tpl b/themes/default/blocks/cart/admin_view.tpl index 7421846e..46da174f 100644 --- a/themes/default/blocks/cart/admin_view.tpl +++ b/themes/default/blocks/cart/admin_view.tpl @@ -1,543 +1,82 @@ -{ $block->display("core:top_clean") } +{assign var=meth value=':'|explode:$VAR._page} + -{$method->exe("cart","admin_view")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} + {if $results <= 0} - {translate module=cart} - empty - {/translate} - {else} - - {literal} - -{/literal} - -{foreach from=$cart item=cart} -
    - {if $cart.cart_type == "2"} - - - - - -
    - - - - - -
    - - - - - - - - {if $cart.cart_type == "1"} - {if $cart.host_type == "ns_transfer"} - {/if} - {if $cart.host_type == "ip"} - {/if} - {/if} -
    - - - - - - -
    - {$cart.domain_name|upper} - . - {$cart.domain_tld|upper} -   - - - - Remove from Cart
    -
       - {if $cart.host_type == "register"} - {translate module=cart} - register - {/translate} - {elseif $cart.host_type == "transfer"} - {translate module=cart} - transfer - {/translate} - {elseif $cart.host_type == "park"} - {translate module=cart} - park - {/translate} - {/if} -
    -
    - - - - - - - - - -
    - {translate module=cart} - base_price - {/translate} - -
    -
    - {$list->format_currency_num($cart.price, $smarty.const.SESS_CURRENCY)} -
    -
    -
    -
    -
    Ad Hoc Discount
    - {if $cart.host_type == 'register'} - - {/if} -
    -
    - {elseif $cart.cart_type == "3"} - - - - - -
    - - - - - -
    - - - - - - - - {if $cart.cart_type == "1"} - {if $cart.host_type == "ns_transfer"} - {/if} - {if $cart.host_type == "ip"} - {/if} - {/if} -
    - - - - - - -
    - {$cart.ad_hoc_name} - - - -
    -
       - {translate module=cart} - price_type - {/translate} - : - {translate module=cart} - price_type_one - {/translate} -
    -
    - - - - - - - - - - - - - -
    - {translate module=cart} - base_price - {/translate} - -
    - {$list->format_currency_num($cart.price_base, $smarty.const.SESS_CURRENCY)} -
    -
    -
    - {translate module=cart} - quantity - {/translate} - - - - - - -
    - -
    -
    Ad Hoc Discount
    -
    -
    - {else} - - - - - -
    - - - - - -
    - - - - - - - - - - - {if $cart.service_id > 0} - - - - {/if} - {if $cart.cart_type == "1"} - {if $cart.host_type == "ns_transfer"} - - - - {/if} - {if $cart.host_type == "ip"} - - - - {/if} - {/if} - {if $cart.attr} - - - - {/if} -
    - - - - - - -
    - {if $list->translate("product_translate","name", "product_id", $cart.product_id, "translate_product")} - {/if} - - {$translate_product.name} - - Remove from Cart -
    -
       - {translate module=cart} - price_type - {/translate} - : - {if $cart.product.price_type == "0"} - {translate module=cart} - price_type_one - {/translate} - {/if} - {if $cart.product.price_type == "1"} - {translate module=cart} - price_type_recurr - {/translate} - {/if} - {if $cart.product.price_type == "2"} - {translate module=cart} - price_type_trial - {/translate} - {/if} -
    - {if $cart.product.price_type == "1"} -    - - {/if} -
       - {translate module=cart service=$cart.service_id} - service_upgrade - {/translate} -
       - {translate module=cart} - host_type_domain - {/translate} - - - {$cart.domain_name} - . - {$cart.domain_tld} -
       - {translate module=cart} - host_type_ip - {/translate} -
    {$cart.attr}
    -
    - - - - - - - - - - - - - - - - - -
    - {translate module=cart} - base_price - {/translate} - -
    - {$list->format_currency_num($cart.price_base, $smarty.const.SESS_CURRENCY)} -
    -
    -
    - {translate module=cart} - setup_price - {/translate} - -
    - {$list->format_currency_num($cart.price_setup, $smarty.const.SESS_CURRENCY)} -
    -
    -
    - {translate module=cart} - quantity - {/translate} - - - - - - -
      - 0 }disabled{/if} /> -
    -
    Ad Hoc Discount
    -
    -
    - {/if} -
    - {foreach from=$cart.assoc item=cart_assoc} - - - - -
    - - - - - -
    - - - - - - - -
    - - - - - - -
    - {$cart_assoc.domain_name|upper} - . - {$cart_assoc.domain_tld|upper} -   - -
    -
       - {if $cart_assoc.host_type == "register"} - {translate module=cart} - host_type_register - {/translate} - {elseif $cart_assoc.host_type == "transfer"} - {translate module=cart} - host_type_transfer - {/translate} - {elseif $cart_assoc.host_type == "park"} - {translate module=cart} - host_type_park - {/translate} - {/if} - {$cart.product.sku} -
    -
    - - - - - -
    - {translate module=cart} - base_price - {/translate} - -
    - {$list->format_currency_num($cart_assoc.price, $smarty.const.SESS_CURRENCY)} -
    -
    -
    - {if $cart_assoc.host_type == 'register'} - - {/if} -
    -
    -
    -{/foreach} -
    -{/foreach} - - -{/if} + function changeRecurring(id,schedule) { + showIFrame('iframe',0,0,'?_page=cart:admin_changeqty&account_id='+acct+'&type=2&_escape=1&id='+id+'&schedule='+schedule); + } + + function changeQuantity(id,qty) { + if(qty == "0") qty = 1; + showIFrame('iframe',0,0,'?_page=cart:admin_changeqty&account_id='+acct+'&type=1&_escape=1&id='+id+'&qty='+qty); + } + + function deleteCart(id) { + document.getElementById('c'+id).style.display = 'none'; + showIFrame('iframe',0,0,'?_page=cart:admin_changeqty&account_id='+acct+'&_escape=1&id='+id+'&qty=0'); + } + + function updatePrice(id,base,setup,qty) { + document.getElementById("quantity_"+id).value = qty; + document.getElementById("def_base_price_"+id).style.display='none'; + document.getElementById("base_price_"+id).innerHTML = base; + + if(document.getElementById("def_setup_price_"+id)) + document.getElementById("def_setup_price_"+id).style.display='none'; + + if(document.getElementById("setup_price_"+id)) + document.getElementById("setup_price_"+id).innerHTML = setup; + } + + function ad_hoc_discount(id) { + var amount = document.getElementById('ad_hoc_discount_'+id).value; + var url = "ajax.php?do[]=checkout:admin_adddiscount&id="+id+"&amount="+amount; + http.open("GET", url, true); + http.onreadystatechange = function() { + if (http.readyState == 4) { + try { eval(http.responseText) } catch(e) {} + } + } + http.send(null); + } + + var http = getHTTPObject(); + var acct = '{$VAR.account_id}'; + {/literal} + //--> + + + + {foreach from=$cart item=cart} +
    + {if $cart.cart_type == '2'} + {include file='file:cart_table_type_2.tpl' showadmin=true} + {elseif $cart.cart_type == '3'} + {include file='file:cart_table_type_3.tpl' showadmin=true} + {else} + {include file='file:cart_table_type_x.tpl' showadmin=true} + {/if} +
    + + {include file='file:cart_table_assoc.tpl'} +
    + {/foreach} + + + + {/if} {/if} diff --git a/themes/default/blocks/cart/cart.tpl b/themes/default/blocks/cart/cart.tpl index 775ba32b..3ff04af9 100644 --- a/themes/default/blocks/cart/cart.tpl +++ b/themes/default/blocks/cart/cart.tpl @@ -1,466 +1,110 @@ -{$method->exe("cart","view")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{assign var=meth value=':'|explode:$VAR._page} + + +{$method->exe_noauth($meth.0,'user_view')} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} + {if $results <= 0} -{translate module=cart} -empty -{/translate} -

    -{$block->display("product:cat")} + {t}Your cart is empty, please select one or more products to continue{/t} + {$block->display('product_cat:user_menu')} + {else} + -{/literal} - -{foreach from=$cart item=cart} -
    - {if $cart.cart_type == "2"} - - - - - -
    - - - - - -
    - - - - - - - - {if $cart.cart_type == "1"} - {if $cart.host_type == "ns_transfer"} - {/if} - {if $cart.host_type == "ip"} - {/if} - {/if} -
    - - - - - - -
    - {$cart.domain_name|upper}.{$cart.domain_tld|upper} -   - - - - Remove from Cart
    -
       - {if $cart.host_type == "register"} - {translate module=cart} - register - {/translate} - {elseif $cart.host_type == "transfer"} - {translate module=cart} - transfer - {/translate} - {elseif $cart.host_type == "park"} - {translate module=cart} - park - {/translate} - {/if} -
    -
    - - - - - -
    - {translate module=cart} - base_price - {/translate} - -
    -
    - {$list->format_currency_num($cart.price, $smarty.const.SESS_CURRENCY)} -
    -
    -
    -
    -
    - {if $cart.host_type == 'register'} - - {/if} -
    -
    - {elseif $cart.cart_type == "3"} - - - - - -
    - - - - - -
    - - - - - - - - {if $cart.cart_type == "1"} - {if $cart.host_type == "ns_transfer"} - {/if} - {if $cart.host_type == "ip"} - {/if} - {/if} -
    - - - - - - -
    - {$cart.ad_hoc_name} - - -
    -
       - {translate module=cart} - price_type - {/translate} - : - {translate module=cart} - price_type_one - {/translate} -
    -
    - - - - - - - - - -
    - {translate module=cart} - base_price - {/translate} - -
    - {$list->format_currency_num($cart.price_base, $smarty.const.SESS_CURRENCY)} -
    -
    -
    - {translate module=cart} - quantity - {/translate} - - - - - - -
    - -
    -
    -
    -
    - {else} - - - - - -
    - - - - - -
    - - - - - - - - - - {if $cart.service_id > 0} - - - - {/if} {if $cart.cart_type == "1"} {if $cart.host_type == "ns_transfer"} - - - - {/if} {if $cart.host_type == "ip"} - - - - {/if} {/if} - {if $cart.attr} - - - - {/if} -
    - - - - - - -
    {if $list->translate("product_translate","name", "product_id", $cart.product_id, "translate_product")} {/if} {$translate_product.name} Remove from Cart
       {translate module=cart} price_type {/translate} : {if $cart.product.price_type == "0"} {translate module=cart} price_type_one {/translate} {/if} {if $cart.product.price_type == "1"} {translate module=cart} price_type_recurr {/translate} {/if} {if $cart.product.price_type == "2"} {translate module=cart} price_type_trial {/translate} {/if}
    {if $cart.product.price_type == "1"}    - - {/if}
       {translate module=cart service=$cart.service_id} service_upgrade {/translate}
       {translate module=cart} host_type_domain {/translate} - {$cart.domain_name}.{$cart.domain_tld}
       {translate module=cart} host_type_ip {/translate}
    {$cart.attr}
    - - - - - - - - - - - - - -
    - {translate module=cart} - base_price - {/translate} - -
    - {$list->format_currency_num($cart.price_base, $smarty.const.SESS_CURRENCY)} -
    -
    -
    - {translate module=cart} - setup_price - {/translate} - -
    - {$list->format_currency_num($cart.price_setup, $smarty.const.SESS_CURRENCY)} -
    -
    -
    - {translate module=cart} - quantity - {/translate} - - - - - - -
    - 0 }disabled{/if} /> -
    -
    -
    -
    + + + {foreach from=$cart item=cart} +
    + {if $cart.cart_type == '2'} + {include file='file:cart_table_type_2.tpl'} + {elseif $cart.cart_type == '3'} + {include file='file:cart_table_type_3.tpl'} + {else} + {include file='file:cart_table_type_x.tpl'} + {/if} +
    + + {include file='file:cart_table_assoc.tpl'} +
    + {/foreach} + + + + + + + + + +
    + + + + + + + +
    {t}Currency{/t}
    + + + + + +
    + {$list->currency_list('cyid_arr')} + + Currency
    +
    +
    +
    +
    + + + +
    +
    +
    + {/if} {/if} -
    - -{foreach from=$cart.assoc item=cart_assoc} - - - - -
    - - - - - -
    - - - - - - - -
    - - - - - - -
    - {$cart_assoc.domain_name|upper} - . - {$cart_assoc.domain_tld|upper} -   - -
    -
       - {if $cart_assoc.host_type == "register"} - {translate module=cart} host_type_register {/translate} - {elseif $cart_assoc.host_type == "transfer"} - {translate module=cart} host_type_transfer {/translate} - {elseif $cart_assoc.host_type == "park"} - {translate module=cart} host_type_park {/translate} - {/if} - {$cart.product.sku} -
    -
    - - - - - -
    - {translate module=cart} - base_price - {/translate} - -
    - {$list->format_currency_num($cart_assoc.price, $smarty.const.SESS_CURRENCY)} -
    -
    -
    - {if $cart_assoc.host_type == 'register'} - - {/if} -
    -
    -
    -{/foreach} - -
    -{/foreach} - - - - -
    - - - - - -
    - - - - - - - -
    - {translate} - currency - {/translate} -
    - - - - - -
    - {literal} - - {/literal} - {$list->currency_list("cyid_arr")} - - -
    -
    -
    -
    - - - -
    - -
    -
    -{/if} -{/if} - diff --git a/themes/default/blocks/cart/cart_table_assoc.tpl b/themes/default/blocks/cart/cart_table_assoc.tpl new file mode 100644 index 00000000..7e2e52e0 --- /dev/null +++ b/themes/default/blocks/cart/cart_table_assoc.tpl @@ -0,0 +1,48 @@ +{foreach from=$cart.assoc item=cart_assoc} + + + + +
    + + + + + +
    + + + + + + + +
    + + + + + +
    {$cart_assoc.domain_name|upper}.{$cart_assoc.domain_tld|upper} 
    +
      {$list->menu_staticlist('domaintype','','',$cart_assoc.host_type,'form_menu')} {$cart.product.sku}
    +
    + + + + + +
    {translate module=cart}base_price{/translate} +
    {$list->format_currency_num($cart_assoc.price, $smarty.const.SESS_CURRENCY)}
    +
    +
    + {if $cart_assoc.host_type == 'register'} + + {/if} +
    +
    +
    +{/foreach} diff --git a/themes/default/blocks/cart/cart_table_type_2.tpl b/themes/default/blocks/cart/cart_table_type_2.tpl new file mode 100644 index 00000000..af3f19fa --- /dev/null +++ b/themes/default/blocks/cart/cart_table_type_2.tpl @@ -0,0 +1,52 @@ + + + + + +
    + + + + + +
    + + + + + + + +
    + + + + + +
    {$cart.domain_name|upper}.{$cart.domain_tld|upper}{if $disable} {else}Remove from Cart{/if}
    +
     {$list->menu_staticlist('domaintype','','',$cart.host_type,'form_menu')}
    +
    + + + + + + {if $showadmin} + {include file='file:cart_tr_adhocdiscount.tpl'} + {/if} +
    {t}Base Price{/t} +
    +
    {$list->format_currency_num($cart.price, $smarty.const.SESS_CURRENCY)}
    +
    +
    +
    +
    + {if $cart.host_type == 'register'} + + {/if} +
    +
    diff --git a/themes/default/blocks/cart/cart_table_type_3.tpl b/themes/default/blocks/cart/cart_table_type_3.tpl new file mode 100644 index 00000000..5ca959a5 --- /dev/null +++ b/themes/default/blocks/cart/cart_table_type_3.tpl @@ -0,0 +1,47 @@ + + + + + +
    + + + + + +
    + + + + + + + + +
    {$cart.ad_hoc_name}{if $disable} {else}Remove from Cart{/if}
      {t}Pricing Structure{/t}: {$list->menu_staticlist('pricetype','','',0,'form_menu')}
    +
    + + + + + + + + + + {if $showadmin} + {include file='file:cart_tr_adhocdiscount.tpl'} + {/if} +
    {t}Base Price{/t} +
    {$list->format_currency_num($cart.price_base, $smarty.const.SESS_CURRENCY)}
    +
    +
    {t}Quantity{/t} + + + + + +
    Calc
    +
    +
    +
    diff --git a/themes/default/blocks/cart/cart_table_type_x.tpl b/themes/default/blocks/cart/cart_table_type_x.tpl new file mode 100644 index 00000000..7c653675 --- /dev/null +++ b/themes/default/blocks/cart/cart_table_type_x.tpl @@ -0,0 +1,91 @@ + + + + + +
    + + + + + +
    + + + + + + + + + + + + {if $cart.service_id > 0} + + + + {/if} + {if $cart.cart_type == '1'} + {if $cart.host_type == 'ns_transfer'} + + + + {/if} + {if $cart.host_type == 'ip'} + + + + {/if} + {/if} + {if $cart.attr} + + + + {/if} +
    {if $list->translate('product_translate','name','product_id',$cart.product_id,'translate_product')}{/if} {$translate_product.name}{if $disable} {else}Remove from Cart{/if}
      {t}Pricing Structure{/t}: {$list->menu_staticlist('pricetype','','',$cart.product.price_type,'form_menu')}
    + {if $cart.product.price_type == '1'}  + + {/if} +
      {translate module=cart service=$cart.service_id}service_upgrade{/translate}
      {t}For your existing domain{/t} - {$cart.domain_name}.{$cart.domain_tld}
      {t}This is an IP based hosting plan, IP address to be assigned.{/t}
    {$cart.attr}
    +
    + + + + + + + + + + + + + + {if $showadmin} + {include file='file:cart_tr_adhocdiscount.tpl'} + {/if} +
    {t}Base Price{/t} +
    {$list->format_currency_num($cart.price_base, $smarty.const.SESS_CURRENCY)}
    +
    +
    {t}Setup Price{/t} +
    {$list->format_currency_num($cart.price_setup, $smarty.const.SESS_CURRENCY)}
    +
    +
    {t}Quantity{/t} + + + + + +
    0}disabled="disabled"{/if}/>Calc
    +
    +
    +
    diff --git a/themes/default/blocks/cart/cart_tr_adhocdiscount.tpl b/themes/default/blocks/cart/cart_tr_adhocdiscount.tpl new file mode 100644 index 00000000..1b2a9e0c --- /dev/null +++ b/themes/default/blocks/cart/cart_tr_adhocdiscount.tpl @@ -0,0 +1,4 @@ +
    Ad Hoc Discount
    - - - -
    - - - - - - - -
    -
    - {translate module=charge}title_add{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=charge} - field_status - {/translate} - - { $list->bool("charge_status", $VAR.charge_status, "form_menu") } -
    - {translate module=charge} - field_sweep_type - {/translate} - - -
    - {translate module=charge} - field_account_id - {/translate} - - {html_select_account name="charge_account_id" default=$VAR.charge_account_id} -
    - {translate module=charge} - field_product_id - {/translate} - - {if $VAR.charge_product_id == ''} - { $list->menu("", "charge_product_id", "product", "sku", "all", "form_menu") } - {else} - { $list->menu("", "charge_product_id", "product", "sku", $VAR.charge_product_id, "form_menu") } - {/if} -
    - {translate module=charge} - field_service_id - {/translate} - - -
    - {translate module=charge} - field_amount - {/translate} - - -
    - {translate module=charge} - field_quantity - {/translate} - - -
    - {translate module=charge} - field_taxable - {/translate} - - { $list->bool("charge_taxable", $VAR.charge_taxable, "form_menu") } -
    - {translate module=charge} - field_attributes - {/translate} - - = -
    - = -
    - = -
    - = -
    - = -
    - = - -
    - - - - - -
    -
    -
    - +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/add_tr_submit.tpl'} +
    {osb f=tf field=status}{$list->bool('charge_status',$VAR.charge_status,'form_menu')}
    {osb f=tf field=sweep_type}{$list->menu_staticlist('charge_sweep','charge_sweep_type','charge_sweep_type',$VAR.charge_sweep_type,'form_menu')}
    {osb f=tf field=account_id}{osb f=autoselect module=account return=id field=charge_account_id default=$VAR.charge_account_id}
    {osb f=tf field=product_id} + {if $VAR.charge_product_id == ''} + {$list->menu('','charge_product_id','product','sku','','form_menu',true)} + {else} + {$list->menu('','charge_product_id','product','sku',$VAR.charge_product_id,'form_menu')} + {/if} +
    {osb f=tf field=service_id}
    {osb f=tf field=amount}
    {osb f=tf field=quantity}
    {osb f=tf field=taxable}{$list->bool('charge_taxable',$VAR.charge_taxable,'form_menu')}
    {osb f=tf field=attributes} + {section name=i start=0 loop=6 step=1} + = +
    + {/section} +
    +
    +
    + +
    diff --git a/themes/default/blocks/charge/search_form.tpl b/themes/default/blocks/charge/search_form.tpl index 0259669a..83ed8c40 100644 --- a/themes/default/blocks/charge/search_form.tpl +++ b/themes/default/blocks/charge/search_form.tpl @@ -1,187 +1,76 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("charge","search_form") } -{ if ($method->result == FALSE) } - { $block->display("core:method_error") } +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} -
    - {$COOKIE_FORM} - - - - -
    - - - - - - - -
    -
    - {translate module=charge}title_search{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - -
    - {translate module=charge} - field_date_orig - {/translate} - - { $list->calender_search("charge_date_orig", $VAR.charge_date_orig, "form_field", "") } -
    - {translate module=charge} - field_status - {/translate} - - { $list->bool("charge_status", "all", "form_menu") } -
    - {translate module=charge} - field_sweep_type - {/translate} - - -
    - {translate module=charge} - field_account_id - {/translate} - - {html_select_account name="charge_account_id" default=$VAR.charge_account_id} -
    - {translate module=charge} - field_product_id - {/translate} - - { $list->menu("", "charge_product_id", "product", "sku", "all", "form_menu") } -
    - {translate module=charge} - field_amount - {/translate} - - -    - {translate} - search_partial - {/translate} -
    - {translate module=charge} - field_quantity - {/translate} - - -   
    - {translate module=charge} - field_taxable - {/translate} - - { $list->bool("charge_taxable", "all", "form_menu") } -
    - {translate module=charge} - field_attributes - {/translate} - - = -
    - = -
    - = -
    - = -
    - = -
    - = - -
    - {translate} - search_results_per - {/translate} - - -
    - {translate} - search_order_by - {/translate} - - -
    - - - - -
    -
    -
    -
    -{ $block->display("core:saved_searches") } -{ $block->display("core:recent_searches") } + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/search_post.tpl'} +
    {osb f=tf field=date_orig}{$list->calender_search('charge_date_orig',$VAR.charge_date_orig,'form_field','')}
    {osb f=tf field=status}{$list->bool('charge_status','all')}
    {osb f=tf field=sweep_type}{$list->menu_staticlist('charge_sweep','charge_sweep_type','charge_sweep_type',$VAR.charge_sweep_type,'form_menu',true)}
    {osb f=tf field=account_id}{osb f=autoselect module=account return=id field=charge_account_id default=$VAR.charge_account_id}
    {osb f=tf field=product_id}{$list->menu('','charge_product_id','product','sku','','form_menu',true)}
    {osb f=tf field=amount}  {t}"%" for partial match{/t}
    {osb f=tf field=quantity}
    {osb f=tf field=taxable}{$list->bool('charge_taxable','all')}
    {osb f=tf field=attributes} + {section name=i start=0 loop=6 step=1} + = +
    + {/section} +
    +
    +
    + + + + {$block->display('core:saved_searches')} + {$block->display('core:recent_searches')} {/if} diff --git a/themes/default/blocks/charge/search_show.tpl b/themes/default/blocks/charge/search_show.tpl index 7f07c83a..2e593f28 100644 --- a/themes/default/blocks/charge/search_show.tpl +++ b/themes/default/blocks/charge/search_show.tpl @@ -1,142 +1,12 @@ +{assign var=meth value=':'|explode:$VAR._page} + - -{$method->exe("charge","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - {foreach from=$charge item=record} - - - - - - - - {literal} - - {/literal} - {/foreach} - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -
    - -   - {$list->date_time($record.date_orig)} -   - {$record.account_id} -   - {if $record.status == "1"} - {translate} - true - {/translate} - {else} - {translate} - false - {/translate} - {/if} - -
      - {$record.amount} -  
    -
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    - - - - -
    - {translate}search_export_image{/translate} - {translate}search_print_image{/translate} - {translate}search_new_image{/translate} - {translate module=charge}title_add{/translate} -
    -
    + {include file='file:../core/search_show_pre.tpl'} + {$method->exe_noauth($meth.0,'tpl_search_show',$search_show)} + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/charge/view.tpl b/themes/default/blocks/charge/view.tpl index 49c1ee15..aeb48f38 100644 --- a/themes/default/blocks/charge/view.tpl +++ b/themes/default/blocks/charge/view.tpl @@ -1,208 +1,80 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("charge","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} -{literal} - - - -{/literal} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - -{foreach from=$charge item=charge} + +
    - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - - - - - - -
    - - - - - - - -
    -
    - {translate module=charge}title_view{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=charge} - field_date_orig - {/translate} - {$list->date_time($charge.date_orig)} -
    - {translate module=charge} - field_status - {/translate} - { $list->bool("charge_status", $charge.status, "onChange=\"submit()\"") } -
    - {translate module=charge} - field_sweep_type - {/translate} - {if $charge.sweep_type == "0"} - Daily - {/if} - {if $charge.sweep_type == "1"} - Weekly - {/if} - {if $charge.sweep_type == "2"} - Monthly - {/if} - {if $charge.sweep_type == "3"} - Quarterly - {/if} - {if $charge.sweep_type == "4"} - Semi-Anually - {/if} - {if $charge.sweep_type == "5"} - Anually - {/if} - {if $charge.sweep_type == "6"} - On Service Rebill - {/if} -
    - {translate module=charge} - field_account_id - {/translate} - {html_select_account name="charge_account_id" default=$charge.account_id} -
    - {translate module=charge} - field_product_id - {/translate} - {$charge.product_id} -
    - {translate module=charge} - field_service_id - {/translate} - {$charge.service_id} -
    - {translate module=charge} - field_amount - {/translate} - - {$list->currency_iso("")} -
    - {translate module=charge} - field_quantity - {/translate} - - -
    - {translate module=charge} - field_taxable - {/translate} - {if $charge.taxable == "1"}{translate}true{/translate}{else}{translate}false{/translate}{/if} -
    - {translate module=charge} - field_attributes - {/translate} - {$charge.attributes|nl2br|replace:"==":" -> "} -
    - - -
    - -
    -
    -
    -
    - - - - -
    - {/foreach} + + + + +
    + + + + + + + + {include file='file:../core/view_tr_submit_delete.tpl'} +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=date_orig}{$list->date_time($record.date_orig)}
    {osb f=tf field=status}{$list->bool('charge_status',$record.status,'" onchange="submit()')}
    {osb f=tf field=sweep_type}{$list->menu_staticlist('charge_sweep','','charge_sweep_type',$record.sweep_type,'form_menu')}
    {osb f=tf field=account_id}{osb f=html_select_account name='charge_account_id' default=$record.account_id}
    {osb f=tf field=product_id}{$record.product_id}
    {osb f=tf field=service_id}{$record.service_id}
    {osb f=tf field=amount}{$list->currency_iso('')}
    {osb f=tf field=quantity}
    {osb f=tf field=taxable}{$list->bool('charge_taxable',$record.taxable,'')}
    {osb f=tf field=attributes}{$record.attributes|nl2br|replace:'==':' -> '}
    +
    +
    + + {include file='file:../core/view_post.tpl'} + {/if} diff --git a/themes/default/blocks/checkout/add.tpl b/themes/default/blocks/checkout/add.tpl index a7645e33..58c758e3 100644 --- a/themes/default/blocks/checkout/add.tpl +++ b/themes/default/blocks/checkout/add.tpl @@ -1,352 +1,187 @@ - +{assign var=meth value=':'|explode:$VAR._page} + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} -
    + - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - {translate module=checkout} - title_add - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=checkout} - field_name - {/translate} - - -
    - {translate module=checkout} - field_description - {/translate} - - -
    - {translate module=checkout} - field_active - {/translate} - - {if $VAR.checkout_active != ""} - { $list->bool("checkout_active", $VAR.checkout_active, "form_menu") } - {else} - { $list->bool("checkout_active", "1", "form_menu") } - {/if} -
    - {translate module=checkout} - field_graphic_url - {/translate} - - -
    - {translate module=checkout} - field_checkout_plugin - {/translate} - - { $list->menu_files("", "checkout_checkout_plugin", $VAR.checkout_checkout_plugin, "checkout_plugin", "", ".php", "form_menu") } -
    -
    - - - - - - - - - - - -
    - {translate module=checkout} - field_allow_new - {/translate} - - {translate module=checkout} - field_allow_recurring - {/translate} - - {translate module=checkout} - field_allow_trial - {/translate} -
    - { $list->bool("checkout_allow_new", $VAR.checkout_allow_new, "form_menu") } - - { $list->bool("checkout_allow_recurring", $VAR.checkout_allow_recurring, "form_menu") } - - { $list->bool("checkout_allow_trial", $VAR.checkout_allow_trial, "form_menu") } -
    -
    - - - - - - - - - - - -
    - {translate module=checkout} - field_total_minimum - {/translate} - - {translate module=checkout} - field_total_maximum - {/translate} - - {translate module=checkout} - field_max_decline_attempts - {/translate} -
    - - { $list->currency_iso("") } - - - { $list->currency_iso("") } - - - { $list->currency_iso("") } -
    -
    - - - - - - - - - -
    - {translate module=checkout} - field_required_groups - {/translate} - - {translate module=checkout} - field_excluded_products - {/translate} -
    - { $list->menu_multi($VAR.checkout_required_groups, "checkout_required_groups", "group", "name", "5", "5", "form_menu") } - - { $list->menu_multi($VAR.checkout_excluded_products, "checkout_excluded_products", "product", "sku", "5", "5", "form_menu") } -
    -
    - - - - - - - - - -
    - {translate module=checkout} - field_manual_approval_all - {/translate} - - {translate module=checkout} - field_manual_approval_recur - {/translate} -
    - { $list->bool("checkout_manual_approval_all", $VAR.checkout_manual_approval_all, "form_menu") } - - { $list->bool("checkout_manual_approval_recur", $VAR.manual_approval_recur, "form_menu") } -
    -
    - - - - - - - - - -
    - {translate module=checkout} - field_manual_approval_amount - {/translate} - - {translate module=checkout} - field_manual_approval_currency - {/translate} -
    - - { $list->currency_iso("") } - - { $list->menu_multi($VAR.checkout_manual_approval_currency, "checkout_manual_approval_currency", "currency", "name", "5", "5", "form_menu") } -
    -
    - - - - - - - - - -
    - {translate module=checkout} - field_manual_approval_country - {/translate} - - {translate module=checkout} - field_manual_approval_group - {/translate} -
    - { $list->menu_multi($VAR.checkout_manual_approval_country, "checkout_manual_approval_country", "country", "name", "5", "5", "form_menu") } - - { $list->menu_multi($VAR.checkout_manual_approval_group, "checkout_manual_approval_group", "group", "name", "5", "5", "form_menu") } -
    -
    - - - - - - - - - -
    - {translate module=checkout} - field_default_when_amount - {/translate} - - {translate module=checkout} - field_default_when_currency - {/translate} -
    - - { $list->currency_iso("") } - - { $list->menu_multi($VAR.checkout_default_when_currency, "checkout_default_when_currency", "currency", "name", "5", "5", "form_menu") } -
    -
    - - - - - - - - - -
    - {translate module=checkout} - field_default_when_country - {/translate} - - {translate module=checkout} - field_default_when_group - {/translate} -
    - { $list->menu_multi($VAR.checkout_default_when_country, "checkout_default_when_country", "country", "name", "5", "5", "form_menu") } - - { $list->menu_multi($VAR.checkout_default_when_group, "checkout_default_when_group", "group", "name", "5", "5", "form_menu") } -
    -
    - - - - - - - - - - - - - -
    - {translate module=checkout} - field_allowed_currencies - {/translate} - - {translate module=checkout} - field_email_template - {/translate} -
    - { $list->menu_multi($VAR.checkout_allowed_currencies, "checkout_allowed_currencies", "currency", "name", "5", "5", "form_menu") } - - -
    - - - - -
    -
    -
    -
    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=name}
    {osb f=tf field=description}
    {osb f=tf field=active} + {if $VAR.checkout_active != ''} + {$list->bool('checkout_active',$VAR.checkout_active,'form_menu')} + {else} + {$list->bool('checkout_active','1','form_menu')} + {/if} +
    {osb f=tf field=graphic_url}
    {osb f=tf field=checkout_plugin}{$list->menu_files('','checkout_checkout_plugin',$VAR.checkout_checkout_plugin,'checkout_plugin','','.php','form_menu')}
    +
    + + + + + + + + + + + +
    {osb f=tf field=allow_new}{osb f=tf field=allow_recurring}{osb f=tf field=allow_trial}
    {$list->bool('checkout_allow_new',$VAR.checkout_allow_new,'form_menu')}{$list->bool('checkout_allow_recurring',$VAR.checkout_allow_recurring,'form_menu')}{$list->bool('checkout_allow_trial',$VAR.checkout_allow_trial,'form_menu')}
    +
    + + + + + + + + + + + +
    {osb f=tf field=total_minimum}{osb f=tf field=total_maximum}{osb f=tf field=max_decline_attempts}
    {$list->currency_iso('')} {$list->currency_iso('')} {$list->currency_iso('')}
    +
    + + + + + + + + + +
    {osb f=tf field=required_groups}{osb f=tf field=excluded_products}
    {$list->menu_multi($VAR.checkout_required_groups,'checkout_required_groups','group','name','5','5','form_menu')}{$list->menu_multi($VAR.checkout_excluded_products,'checkout_excluded_products','product','sku','5','5','form_menu')}
    +
    + + + + + + + + + +
    {osb f=tf field=manual_approval_all}{osb f=tf field=manual_approval_recur}
    {$list->bool('checkout_manual_approval_all',$VAR.checkout_manual_approval_all,'form_menu')}{$list->bool('checkout_manual_approval_recur',$VAR.manual_approval_recur,'form_menu')}
    +
    + + + + + + + + + +
    {osb f=tf field=manual_approval_amount}{osb f=tf field=manual_approval_currency}
    {$list->currency_iso('')}{$list->menu_multi($VAR.checkout_manual_approval_currency,'checkout_manual_approval_currency','currency','name','5','5','form_menu')}
    +
    + + + + + + + + + +
    {osb f=tf field=manual_approval_country}{osb f=tf field=manual_approval_group}
    {$list->menu_multi($VAR.checkout_manual_approval_country,'checkout_manual_approval_country','country','name','5','5','form_menu')}{$list->menu_multi($VAR.checkout_manual_approval_group,'checkout_manual_approval_group','group','name','5','5','form_menu')}
    +
    + + + + + + + + + +
    {osb f=tf field=default_when_amount}{osb f=tf field=default_when_currency}
    {$list->currency_iso('')}{$list->menu_multi($VAR.checkout_default_when_currency,'checkout_default_when_currency','currency','name','5','5','form_menu')}
    +
    + + + + + + + + + +
    {osb f=tf field=default_when_country}{osb f=tf field=default_when_group}
    {$list->menu_multi($VAR.checkout_default_when_country,'checkout_default_when_country','country','name','5','5','form_menu')}{$list->menu_multi($VAR.checkout_default_when_group,'checkout_default_when_group','group','name','5','5','form_menu')}
    +
    + + + + + + + + + + {include file='file:../core/add_tr_submit.tpl'} +
    {osb f=tf field=allowed_currencies}{osb f=tf field=email_template}
    {$list->menu_multi($VAR.checkout_allowed_currencies,'checkout_allowed_currencies','currency','name','5','5','form_menu')}
    +
    +
    + + diff --git a/themes/default/blocks/checkout/admin_checkout.tpl b/themes/default/blocks/checkout/admin_checkout.tpl index 6cf443c9..9f813f1b 100644 --- a/themes/default/blocks/checkout/admin_checkout.tpl +++ b/themes/default/blocks/checkout/admin_checkout.tpl @@ -1,19 +1,22 @@ -{ $block->display("core:top_clean") } -{$method->exe("checkout","admin_preview")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{assign var=meth value=':'|explode:$VAR._page} + + +{$block->display('core:top_clean')} + +{$method->exe($meth.0,'admin_preview')} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} + {if $results == 0} - {translate module=cart} - empty - {/translate} + {translate module=cart}empty{/translate} {else} {if $SESS_LOGGED != "1"} -{ $block->display("account:login") } +{ $block->display("account:user_login") } {else} -
    +
    {foreach from=$cart item=cart}
    {if $cart.cart_type == "2"} @@ -21,7 +24,7 @@ - -
    - +
    + + +
    @@ -104,7 +107,7 @@
    - -
    - +
    - -
    @@ -175,7 +178,7 @@
    - -
    - +
    + diff --git a/themes/default/blocks/core/top_clean.tpl b/themes/default/blocks/core/top_clean.tpl index 011a1053..1063caf0 100644 --- a/themes/default/blocks/core/top_clean.tpl +++ b/themes/default/blocks/core/top_clean.tpl @@ -1,46 +1,47 @@ - - -{$smarty.const.SITE_NAME} + + + + +{$smarty.const.SITE_NAME} + + - - + {/literal} +//--> + - - + + - + - + + + - - - - - - {if $alert} - { $block->display("core:alert") } - {/if} \ No newline at end of file + +{if $alert} + {$block->display('core:alert')} +{/if} diff --git a/themes/default/blocks/core/user_search.tpl b/themes/default/blocks/core/user_search.tpl index fed4c06f..0441ae70 100644 --- a/themes/default/blocks/core/user_search.tpl +++ b/themes/default/blocks/core/user_search.tpl @@ -1,95 +1,4 @@ - +{assign var=meth value=':'|explode:$VAR._page} + - - - - - -{ $method->exe($VAR.module,"user_search") } -{ if ($method->result == FALSE) } -{ $block->display("core:method_error") } -{else} -{if $results > 0} -
    -
    -
    -
    - - {translate} - search_results - {/translate} -
    -
    - {translate} - alert_refresh_click - {/translate} -
    -
    - {if $results == "1" && $VAR._next_page_one != "" } - - - {translate}alert_click{/translate} - - - {else} - {if $VAR._next_page == ""} - - {translate}alert_click{/translate} -
    - {else} - - {translate}alert_click{/translate} -
    - {/if} - - {/if} -
    -
    - -{elseif $VAR._next_page_none != "" && $results == 10 } - -{else} - -
    -

     

    -

    - {translate} - search_no_results - {/translate} -

    - - -

     

    -

    - - -

    - -
    - {/if} -{/if} +{include file='file:search.tpl'} diff --git a/themes/default/blocks/core/user_search_show_pre.tpl b/themes/default/blocks/core/user_search_show_pre.tpl new file mode 100644 index 00000000..ce5a13d5 --- /dev/null +++ b/themes/default/blocks/core/user_search_show_pre.tpl @@ -0,0 +1,33 @@ + +

    {t count=$results 1=$results plural='%1 records were found.'}%1 record was found.{/t}

    + + + + + +
    + + +
    +
    + + diff --git a/themes/default/blocks/core/user_search_show_tr_record.tpl b/themes/default/blocks/core/user_search_show_tr_record.tpl new file mode 100644 index 00000000..cd9001c6 --- /dev/null +++ b/themes/default/blocks/core/user_search_show_tr_record.tpl @@ -0,0 +1,4 @@ +
    + diff --git a/themes/default/blocks/core/user_view_pre.tpl b/themes/default/blocks/core/user_view_pre.tpl new file mode 100644 index 00000000..815f9b16 --- /dev/null +++ b/themes/default/blocks/core/user_view_pre.tpl @@ -0,0 +1,7 @@ + + diff --git a/themes/default/blocks/core/view_post.tpl b/themes/default/blocks/core/view_post.tpl new file mode 100644 index 00000000..a073f680 --- /dev/null +++ b/themes/default/blocks/core/view_post.tpl @@ -0,0 +1,8 @@ +
    + + + + + + +
    diff --git a/themes/default/blocks/core/view_pre.tpl b/themes/default/blocks/core/view_pre.tpl new file mode 100644 index 00000000..1267e46b --- /dev/null +++ b/themes/default/blocks/core/view_pre.tpl @@ -0,0 +1,7 @@ + + diff --git a/themes/default/blocks/core/view_td_delete.tpl b/themes/default/blocks/core/view_td_delete.tpl new file mode 100644 index 00000000..1036e331 --- /dev/null +++ b/themes/default/blocks/core/view_td_delete.tpl @@ -0,0 +1,4 @@ + diff --git a/themes/default/blocks/core/view_td_submit.tpl b/themes/default/blocks/core/view_td_submit.tpl new file mode 100644 index 00000000..8cef36f5 --- /dev/null +++ b/themes/default/blocks/core/view_td_submit.tpl @@ -0,0 +1 @@ + diff --git a/themes/default/blocks/core/view_tr_submit_delete.tpl b/themes/default/blocks/core/view_tr_submit_delete.tpl new file mode 100644 index 00000000..70b25e66 --- /dev/null +++ b/themes/default/blocks/core/view_tr_submit_delete.tpl @@ -0,0 +1,11 @@ + + + + diff --git a/themes/default/blocks/country/add.tpl b/themes/default/blocks/country/add.tpl index 1802b3dc..dfe1b200 100644 --- a/themes/default/blocks/country/add.tpl +++ b/themes/default/blocks/country/add.tpl @@ -1,92 +1,51 @@ +{assign var=meth value=':'|explode:$VAR._page} + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} - - -
    @@ -364,7 +367,7 @@
    + + + + + + + + + + + diff --git a/themes/default/blocks/core/search_show_post-1.tpl b/themes/default/blocks/core/search_show_post-1.tpl new file mode 100644 index 00000000..d9e6f312 --- /dev/null +++ b/themes/default/blocks/core/search_show_post-1.tpl @@ -0,0 +1,16 @@ + + + + + +{if $VAR._print != true} +
    +
    + + + + + +
    +{/if} + diff --git a/themes/default/blocks/core/search_show_post-2.tpl b/themes/default/blocks/core/search_show_post-2.tpl new file mode 100644 index 00000000..07a04042 --- /dev/null +++ b/themes/default/blocks/core/search_show_post-2.tpl @@ -0,0 +1,20 @@ + + +{if $VAR._print != true} +
    +
    - +
    + + + + + + + diff --git a/themes/default/blocks/checkout_plugin/plugin_tr_mode.tpl b/themes/default/blocks/checkout_plugin/plugin_tr_mode.tpl new file mode 100644 index 00000000..c54aa773 --- /dev/null +++ b/themes/default/blocks/checkout_plugin/plugin_tr_mode.tpl @@ -0,0 +1,4 @@ + + + + diff --git a/themes/default/blocks/checkout_plugin/third_party.tpl b/themes/default/blocks/checkout_plugin/third_party.tpl index 3a251fad..b415d8a4 100644 --- a/themes/default/blocks/checkout_plugin/third_party.tpl +++ b/themes/default/blocks/checkout_plugin/third_party.tpl @@ -1,35 +1,34 @@ - - -{if $VAR.invoice_id == ""} -{if $VAR.admin != '' && $VAR.account_id != '' } - - - - -{else} - - -{/if} -{else} -{if $VAR.admin != '' && $VAR.account_id != '' } - - - - -{else} - -{if $VAR.invoice_id > 0} - -{else} - -{/if} -{/if} - -{/if} + + + {if $VAR.invoice_id == ''} + {if $VAR.admin != '' && $VAR.account_id != ''} + + + + + {else} + + + {/if} + {else} + {if $VAR.admin != '' && $VAR.account_id != ''} + + + + + {else} + + {if $VAR.invoice_id > 0} + + {else} + + {/if} + {/if} + + {/if} -
    -

    {translate module=checkout}redirect_html{/translate}

    - -
    - - \ No newline at end of file +
    +

    If you are not redirected shortly, please click here to redirect.

    + +
    + diff --git a/themes/default/blocks/checkout_plugin/third_party_noconf.tpl b/themes/default/blocks/checkout_plugin/third_party_noconf.tpl index 3734de8b..e02ea083 100644 --- a/themes/default/blocks/checkout_plugin/third_party_noconf.tpl +++ b/themes/default/blocks/checkout_plugin/third_party_noconf.tpl @@ -1,36 +1,35 @@ - - -{if $VAR.invoice_id == ""} -{if $VAR.admin != '' && $VAR.account_id != '' } - - - - -{else} - - -{/if} -{else} -{if $VAR.admin != '' && $VAR.account_id != '' } - - - - -{else} - -{if $VAR.invoice_id > 0} - -{else} - -{/if} -{/if} - -{/if} + + + {if $VAR.invoice_id == ''} + {if $VAR.admin != '' && $VAR.account_id != ''} + + + + + {else} + + + {/if} + {else} + {if $VAR.admin != '' && $VAR.account_id != ''} + + + + + {else} + + {if $VAR.invoice_id > 0} + + {else} + + {/if} + {/if} + + {/if} -
    -

    {translate module=checkout}redirect_html{/translate}

    - - -
    - - \ No newline at end of file +
    +

    If you are not redirected shortly, please click here to redirect.

    + + +
    + diff --git a/themes/default/blocks/core/add_tr_submit.tpl b/themes/default/blocks/core/add_tr_submit.tpl new file mode 100644 index 00000000..9ae24d9e --- /dev/null +++ b/themes/default/blocks/core/add_tr_submit.tpl @@ -0,0 +1,15 @@ + + + + diff --git a/themes/default/blocks/core/admin.tpl b/themes/default/blocks/core/admin.tpl deleted file mode 100644 index b8e79f2b..00000000 --- a/themes/default/blocks/core/admin.tpl +++ /dev/null @@ -1,448 +0,0 @@ -{if $SESS_LOGGED == true} - -{ $method->exe('invoice', 'performance') } -{if $method->result == TRUE} -
    @@ -599,7 +602,7 @@ {if $VAR.option!=''}{$method->exe("checkout","checkoutoption")}{if $plugin_template != false}{$block->display($plugin_template)}{/if}{/if} -

    +

    View More Payment Options

    diff --git a/themes/default/blocks/checkout/ajax.js b/themes/default/blocks/checkout/ajax.js index 5792cfd3..fce4e850 100644 --- a/themes/default/blocks/checkout/ajax.js +++ b/themes/default/blocks/checkout/ajax.js @@ -1,50 +1,61 @@ var http=getHTTPObject(); -var last_checkout_id = '{/literal}{$checkout.fields.id}{literal}'; -function changeCheckoutOption(option,type,invoice_id,account_id) { - var doRedirect=false; - var noConfirm=false; - if(type=='invoice' || type=='multi') - var url ='?_page=invoice:checkoutoption&option='+option+'&_escape=1&invoice_id='+invoice_id; - else - var url ='?_page=checkout:checkoutoption&option='+option+'&_escape=1'; - if(account_id) url += '&admin=1&account_id='+account_id; - http.open("GET", url, true); - http.onreadystatechange = function() { - if (http.readyState == 4) { - try { document.getElementById('checkout_options_show').style.display='block'; } catch(e) {} - try { document.getElementById('checkout_confirm_div').innerHTML = http.responseText } catch(e) {} - try { document.getElementById('checkout_confirm_div').style.display='block'; } catch(e) {} - try { document.getElementById('checkout_options').style.display='none'; } catch(e) {} - try { doRedirect=document.getElementById('doredirect').value } catch(e) { doRedirect=false; } - try { noConfirm=document.getElementById('noconf').value } catch(e) { noConfirm=false; } - if(doRedirect=='true') if(noConfirm) {checkoutNow(0);} else {verifyCheckout();} - } - } - http.send(null); -} +var last_checkout_id = '{$checkout.fields.id}'; + +function changeCheckoutOption(option,type,invoice_id,account_id) { + var doRedirect=false; + var noConfirm=false; + + if(type=='invoice' || type=='multi') + var url ='?_page=invoice:checkoutoption&option='+option+'&_escape=1&invoice_id='+invoice_id; + else + var url ='?_page=checkout:checkoutoption&option='+option+'&_escape=1'; + + if(account_id) + url += '&admin=1&account_id='+account_id; + + http.open('GET',url,true); + http.onreadystatechange = function() { + if (http.readyState == 4) { + try {document.getElementById('checkout_options_show').style.display='block';} catch(e) {} + try {document.getElementById('checkout_confirm_div').innerHTML = http.responseText} catch(e) {} + try {document.getElementById('checkout_confirm_div').style.display='block';} catch(e) {} + try {document.getElementById('checkout_options').style.display='none';} catch(e) {} + try {doRedirect=document.getElementById('doredirect').value} catch(e) {doRedirect=false;} + try {noConfirm=document.getElementById('noconf').value} catch(e) {noConfirm=false;} + + if(doRedirect=='true') if(noConfirm) {checkoutNow(0);} else {verifyCheckout();} + } + } + http.send(null); +} + function getCheckoutOption() { return getElementById("checkout_option").value; -} -function checkoutNow(type) { - try { document.getElementById('submit_checkout_form').disabled=true; } catch(e) {} - try { document.getElementById('checkout_form').submit(); } catch(e) { alert('Unable to submit checkout form for processing'); } -} +} + +function checkoutNow(type) { + try {document.getElementById('submit_checkout_form').disabled=true;} catch(e) {} + try {document.getElementById('checkout_form').submit();} catch(e) {alert('Unable to submit checkout form for processing');} +} + function verifyCheckout() { - if (confirm(confirmCheckoutMsg)) { - checkoutNow(0); + if (confirm(confirmCheckoutMsg)) { + checkoutNow(0); } else { document.getElementById('checkout_confirm_div').style.display='none'; document.getElementById('checkout_options_show').style.display='none'; document.getElementById('checkout_options').style.display='block'; } -} +} + function enter_new_card() { - try { document.getElementById('new_card').value=1; } catch(e) {} + try {document.getElementById('new_card').value=1;} catch(e) {} document.getElementById('onfile').style.display='none'; document.getElementById('newcard').style.display='block'; } + function editSavedCard(admin) { - try{var id=document.getElementById('account_billing_id').value;}catch(e){var id=false;} + try{var id=document.getElementById('account_billing_id').value;}catch(e){var id=false;} if(id) { if(admin) { var url = '?_page=account_billing:view&id='+id; @@ -53,4 +64,4 @@ function editSavedCard(admin) { } document.location=url; } -} \ No newline at end of file +} diff --git a/themes/default/blocks/checkout/checkout.tpl b/themes/default/blocks/checkout/checkout.tpl index 254dd65c..1242e972 100644 --- a/themes/default/blocks/checkout/checkout.tpl +++ b/themes/default/blocks/checkout/checkout.tpl @@ -1,689 +1,243 @@ -{if $SESS_LOGGED != "1"} - { $block->display("account:login") } +{assign var=meth value=':'|explode:$VAR._page} + + +{if $SESS_LOGGED != '1'} + {$block->display('account:user_login')} {else} - {$method->exe("checkout","preview")} - {if ($method->result == FALSE)} - {$block->display("core:method_error")} + {$method->exe('checkout','preview')} + {if ($method->result == false)} + {$block->display('core:method_error')} {else} {if $results == 0} - {translate module=cart} - empty - {/translate} -

    - {$block->display("product:cat")} + {t}Your cart is empty, please select one or more products to continue{/t}
    +
    + {$block->display('product_cat:user_menu')} {else} - - + + -

    -View More Payment Options -

    - - -
    -
    - - - -
    - - - - - - - -
    - - - - -
    {translate module=cart}payment_option{/translate}
    -
    - - {if $checkout} - {foreach from=$checkout item=checkout key=key} - - - - - {/foreach} - {else} - - - - {/if} -
    {if $checkout.fields.graphic_url==''}{$checkout.fields.name}{else}{$checkout.fields.name}{/if}{$checkout.fields.description}
    {translate module=cart}no_checkout_options{/translate}
    -
    -
    -
    - - - -{if $VAR.option=='' && $checkout_c == 1} - -{elseif $VAR.option>0} - -{/if} -{/if} - - -
    - - - - - - -
    - - - - - - - -
    - {translate} - currency - {/translate} -
    - - - - - -
    - {literal} - - {/literal} - {$list->currency_list("cyid_arr")} - - -
    -
    -
    - { if $smarty.const.SHOW_DISCOUNT_CODE == 1 } -
    - - - - - - - -
    - {translate module=checkout} - discounts - {/translate} -
    - - - - - -
    - {literal} - - {/literal} - -
    -
    -
    - {/if} -
    - { if $list->is_installed('affiliate') == 1 && $smarty.const.SHOW_AFFILIATE_CODE == 1 } -
    - - - - - - - - - -
    - {translate module=checkout} - affiliate - {/translate} -
    - - - - - -
    - - - -
    -
    -
    - {/if} -
    -
    - - -
    -

    {translate module=cart}remove_items{/translate}

    -

    {translate module=cart}hide_items{/translate}

    -{foreach from=$cart item=cart} -
    - {if $cart.cart_type == "2"} - - - - - -
    - - - - - -
    - - - - - - - - {if $cart.cart_type == "1"} - {if $cart.host_type == "ns_transfer"} - {/if} - {if $cart.host_type == "ip"} - {/if} - {/if} -
    - - - - -
    - {$cart.domain_name|upper} - . - {$cart.domain_tld|upper} -
    -
       - {if $cart.host_type == "register"} - {translate module=cart} - register - {/translate} - {elseif $cart.host_type == "transfer"} - {translate module=cart} - transfer - {/translate} - {elseif $cart.host_type == "park"} - {translate module=cart} - park - {/translate} - {/if} -
    -
    - - - - - -
    - {translate module=cart} - base_price - {/translate} - -
    -
    - {$list->format_currency_num($cart.price, $smarty.const.SESS_CURRENCY)} -
    -
    -
    -
    -
    - {if $cart.host_type == 'register'} - - {/if} -
    -
    - {elseif $cart.cart_type == "3"} - - - - - -
    - - - - - -
    - - - - - - - - {if $cart.cart_type == "1"} - {if $cart.host_type == "ns_transfer"} - {/if} - {if $cart.host_type == "ip"} - {/if} - {/if} -
    - - - - -
    - {$cart.ad_hoc_name} -
    -
       - {translate module=cart} - price_type - {/translate} - : - {translate module=cart} - price_type_one - {/translate} -
    -
    - - - - - - - - - -
    - {translate module=cart} - base_price - {/translate} - -
    - {$list->format_currency_num($cart.price_base, $smarty.const.SESS_CURRENCY)} -
    -
    -
    - {translate module=cart} - quantity - {/translate} - - {$cart.quantity} -
    -
    -
    - {else} - - - - - -
    - - - - - -
    - - - - - - - - - - - {if $cart.service_id != "" && $cart.service_id > 0} - - - - {/if} - {if $cart.cart_type == "1"} - {if $cart.host_type == "ns_transfer"} - - - - {/if} - - {if $cart.host_type == "ip"} - - - - {/if} - {/if} - {if $cart.attr} - - - - {/if} -
    - - - - -
    - {if $list->translate("product_translate","name", "product_id", $cart.product_id, "translate_product")} - {/if} - - {$translate_product.name} -
    -
       - {translate module=cart} - price_type - {/translate} - : - {if $cart.product.price_type == "0"} - {translate module=cart} - price_type_one - {/translate} - {/if} - {if $cart.product.price_type == "1"} - {translate module=cart} - price_type_recurr - {/translate} - {/if} - {if $cart.product.price_type == "2"} - {translate module=cart} - price_type_trial - {/translate} - {/if} -
    - {if $cart.product.price_type == "1"} -    - - {/if} -
       - {translate module=cart service=$cart.service_id} - service_upgrade - {/translate} -
       - {translate module=cart} - host_type_domain - {/translate} - - - {$cart.domain_name}.{$cart.domain_tld} -
       - {translate module=cart} - host_type_ip - {/translate} -
    {$cart.attr}
    -
    - - - - - - - - - - - - - -
    - {translate module=cart} - base_price - {/translate} - -
    - {$list->format_currency_num($cart.price_base, $smarty.const.SESS_CURRENCY)} -
    -
    -
    - {translate module=cart} - setup_price - {/translate} - -
    - {$list->format_currency_num($cart.price_setup, $smarty.const.SESS_CURRENCY)} -
    -
    -
    - {translate module=cart} - quantity - {/translate} - - {$cart.quantity} -
    -
    -
    -{/if} -
    - -{foreach from=$cart.assoc item=cart_assoc} - - - - -
    - - - - - -
    - - - - - - - -
    - - - - -
    - {$cart_assoc.domain_name|upper} - . - {$cart_assoc.domain_tld|upper} -
    -
       - {if $cart_assoc.host_type == "register"} - {translate module=cart} host_type_register {/translate} - {elseif $cart_assoc.host_type == "transfer"} - {translate module=cart} host_type_transfer {/translate} - {elseif $cart_assoc.host_type == "park"} - {translate module=cart} host_type_park {/translate} + +
    + {if $VAR.option != ''} + {$method->exe('checkout','checkoutoption')} + {if $plugin_template != false} + {$block->display($plugin_template)} {/if} - {$cart.product.sku} -
    -
    - - - - - -
    - {translate module=cart} - base_price - {/translate} - -
    - {$list->format_currency_num($cart_assoc.price, $smarty.const.SESS_CURRENCY)} -
    -
    -
    - {if $cart_assoc.host_type == 'register'} - - {/if} -
    -
    -
    -{/foreach} -
    -{/foreach} -
    - + {/if} + +

    + View More Payment Options +

    - - - - - - -
    -

    {translate module=cart}view_items{/translate}

    -
    - - - - - - - -
    - {translate module=checkout} - totals - {/translate} -
    - - - - - - {foreach from=$discount item=discount} - {if $discount.total > 0} - - - - - {/if} - {/foreach} - {if $tax != false} - {foreach from=$tax item=tax } - - - - - {/foreach} - {/if} - - - - -
    - {translate module=cart} - subtotal - {/translate} - - {$list->format_currency_num($sub_total, $smarty.const.SESS_CURRENCY)} -
    - {translate module=cart} - discount - {/translate} - ( - {$discount.name} - ) - - {$list->format_currency_num($discount.total, $smarty.const.SESS_CURRENCY)} -
    - {$tax.name} - - {$list->format_currency_num($tax.rate, $smarty.const.SESS_CURRENCY)} -
    - {translate module=cart} - total - {/translate} - - {$list->format_currency_num($total, $smarty.const.SESS_CURRENCY)} -
    -
    -
    + +
    + + + + +
    + + + + + + + +
    + + + + +
    {t}Please Select Your Preferred Payment Option{/t}
    +
    + + {if $checkout} + {foreach from=$checkout item=checkout key=key} + + + + + {/foreach} + {else} + + + + {/if} +
    {if $checkout.fields.graphic_url==''}{$checkout.fields.name}{else}{$checkout.fields.name}{/if}{$checkout.fields.description}
    {t}Sorry, no online payment option has been defined for this order type. Please contact customer service for ordering details.{/t}
    +
    +
    +
    +
    + + + {if $VAR.option=='' && $checkout_c == 1} + + {elseif $VAR.option>0} + + {/if} + {/if} + + + + + + + + +
    + + + + + + + +
    {t}Currency{/t}
    + + + + + +
    + {$list->currency_list("cyid_arr")} + +
    +
    +
    + {if $smarty.const.SHOW_DISCOUNT_CODE == 1} +
    + + + + + + + +
    {t}Discounts{/t}
    + + + + + +
    +
    +
    + {/if} +
    + {if $list->is_installed('affiliate') == 1 && $smarty.const.SHOW_AFFILIATE_CODE == 1} +
    + + + + + + + + +
    {t}Affiliate{/t}
    + + + + + +
    +
    +
    + {/if} +
    + + +
    +

    {t}To edit or remove items, click here.{/t}

    +

    {t}Click here to hide itemised list.{/t}

    + {foreach from=$cart item=cart} +
    + {if $cart.cart_type == '2'} + {include file='file:../cart/cart_table_type_2.tpl' disable=true} + {elseif $cart.cart_type == "3"} + {include file='file:../cart/cart_table_type_3.tpl'} + {else} + {include file='file:../cart/cart_table_type_x.tpl' disable=true} + {/if} +
    + + {include file='file:../cart/cart_table_assoc.tpl'} +
    + {/foreach} +
    + + + + + + + + +
    +

    {t}Click here for an itemised list of items in this purchase.{/t}

    +
    + + + + + + + +
    {t}Totals{/t}
    + + + + + + {foreach from=$discount item=discount} + {if $discount.total > 0} + + + + + {/if} + {/foreach} + {if $tax != false} + {foreach from=$tax item=tax } + + + + + {/foreach} + {/if} + + + + +
    {t}Sub-Total{/t}{$list->format_currency_num($sub_total, $smarty.const.SESS_CURRENCY)}
    {t}Discount{/t} ({$discount.name}) - {$list->format_currency_num($discount.total, $smarty.const.SESS_CURRENCY)}
    {$tax.name}{$list->format_currency_num($tax.rate, $smarty.const.SESS_CURRENCY)}
    {t}Total{/t}{$list->format_currency_num($total, $smarty.const.SESS_CURRENCY)}
    +
    +
    + {/if} {/if} -{/if} \ No newline at end of file diff --git a/themes/default/blocks/checkout/search_show.tpl b/themes/default/blocks/checkout/search_show.tpl index 497630c7..2e593f28 100644 --- a/themes/default/blocks/checkout/search_show.tpl +++ b/themes/default/blocks/checkout/search_show.tpl @@ -1,111 +1,12 @@ +{assign var=meth value=':'|explode:$VAR._page} + - -{$method->exe("checkout","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - - {foreach from=$checkout item=record} - - - - - - - - - - {literal} - - {/literal} - {/foreach} - - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -
    - -  {$record.name} {if $record.active == "1"}{translate}true{/translate}{else}{translate}false{/translate}{/if} {$record.checkout_plugin}
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    + {include file='file:../core/search_show_pre.tpl'} + {$method->exe_noauth($meth.0,'tpl_search_show',$search_show)} + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/checkout/view.tpl b/themes/default/blocks/checkout/view.tpl index 6c32a6cf..e4888887 100644 --- a/themes/default/blocks/checkout/view.tpl +++ b/themes/default/blocks/checkout/view.tpl @@ -1,398 +1,217 @@ -{ $method->exe("checkout","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{assign var=meth value=':'|explode:$VAR._page} + -{literal} - - -{/literal} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} - -{foreach from=$checkout item=checkout} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - {translate module=checkout} - title_add - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=checkout} - field_name - {/translate} - - -
    - {translate module=checkout} - field_description - {/translate} - - -
    - {translate module=checkout} - field_active - {/translate} - - { $list->bool("checkout_active", $checkout.active, " onchange=\"submit()\"") } -
    - {translate module=checkout} - field_graphic_url - {/translate} - - -
    - {translate module=checkout} - field_checkout_plugin - {/translate} - - { $checkout.checkout_plugin } - -
    - {assign var="ablock" value="checkout_plugin:plugin_cfg_"} - {assign var="afile" value=$checkout.checkout_plugin} - {assign var="blockfile" value="$ablock$afile"} - { $block->display($blockfile) } -
    - - - - - - - - - - - -
    - {translate module=checkout} - field_allow_new - {/translate} - - {translate module=checkout} - field_allow_recurring - {/translate} - - {translate module=checkout} - field_allow_trial - {/translate} -
    - { $list->bool("checkout_allow_new", $checkout.allow_new, "form_menu") } - - { $list->bool("checkout_allow_recurring", $checkout.allow_recurring, "form_menu") } - - { $list->bool("checkout_allow_trial", $checkout.allow_trial, "form_menu") } -
    -
    - - - - - - - - - - - -
    - {translate module=checkout} - field_total_minimum - {/translate} - - {translate module=checkout} - field_total_maximum - {/translate} - - {translate module=checkout} - field_max_decline_attempts - {/translate} -
    - - { $list->currency_iso("") } - - - { $list->currency_iso("") } - - - { $list->currency_iso("") } -
    -
    - - - - - - - - - -
    - {translate module=checkout} - field_required_groups - {/translate} - - {translate module=checkout} - field_excluded_products - {/translate} -
    - { $list->menu_multi($checkout.required_groups, "checkout_required_groups", "group", "name", "5", "5", "form_menu") } - - { $list->menu_multi($checkout.excluded_products, "checkout_excluded_products", "product", "sku", "5", "5", "form_menu") } -
    -
    - - - - - - - - - -
    - {translate module=checkout} - field_manual_approval_all - {/translate} - - {translate module=checkout} - field_manual_approval_recur - {/translate} -
    - { $list->bool("checkout_manual_approval_all", $checkout.manual_approval_all, "form_menu") } - - { $list->bool("checkout_manual_approval_recur", $checkout.manual_approval_recur, "form_menu") } -
    -
    - - - - - - - - - -
    - {translate module=checkout} - field_manual_approval_amount - {/translate} - - {translate module=checkout} - field_manual_approval_currency - {/translate} -
    - - { $list->currency_iso("") } - - { $list->menu_multi($checkout.manual_approval_currency, "checkout_manual_approval_currency", "currency", "three_digit", "5", "5", "form_menu") } -
    -
    - - - - - - - - - -
    - {translate module=checkout} - field_manual_approval_country - {/translate} - - {translate module=checkout} - field_manual_approval_group - {/translate} -
    - { $list->menu_multi($checkout.manual_approval_country, "checkout_manual_approval_country", "country", "name", "5", "5", "form_menu") } - - { $list->menu_multi($checkout.manual_approval_group, "checkout_manual_approval_group", "group", "name", "5", "5", "form_menu") } -
    -
    - - - - - - - - - -
    - {translate module=checkout} - field_default_when_amount - {/translate} - - {translate module=checkout} - field_default_when_currency - {/translate} -
    - - { $list->currency_iso("") } - - { $list->menu_multi($checkout.default_when_currency, "checkout_default_when_currency", "currency", "three_digit", "5", "5", "form_menu") } -
    -
    - - - - - - - - - -
    - {translate module=checkout} - field_default_when_country - {/translate} - - {translate module=checkout} - field_default_when_group - {/translate} -
    - { $list->menu_multi($checkout.default_when_country, "checkout_default_when_country", "country", "name", "5", "5", "form_menu") } - - { $list->menu_multi($checkout.default_when_group, "checkout_default_when_group", "group", "name", "5", "5", "form_menu") } -
    -
    - - - - - - - - - - - - - -
    - {translate module=checkout} - field_allowed_currencies - {/translate} - - {translate module=checkout} - field_email_template - {/translate} -
    - { $list->menu_multi($checkout.allowed_currencies, "checkout_allowed_currencies", "currency", "three_digit", "5", "5", "form_menu") } - - -
    - -
    -
    -
    - - - - -
    - {/foreach} + +
    + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=name}
    {osb f=tf field=description}
    {osb f=tf field=active}{$list->bool('checkout_active',$record.active,'" onchange="submit()')}
    {osb f=tf field=graphic_url}
    {osb f=tf field=checkout_plugin}{$record.checkout_plugin}
    + {assign var='ablock' value='checkout_plugin:plugin_cfg_'} + {assign var='afile' value=$record.checkout_plugin} + {assign var='blockfile' value="$ablock$afile"} + {$block->display($blockfile)} +
    + + + + + + + + + + + +
    {osb f=tf field=allow_new}{osb f=tf field=allow_recurring}{osb f=tf field=allow_trial}
    {$list->bool('checkout_allow_new',$record.allow_new)}{$list->bool('checkout_allow_recurring',$record.allow_recurring)}{$list->bool('checkout_allow_trial',$record.allow_trial)}
    +
    + + + + + + + + + + + +
    {osb f=tf field=total_minimum}{osb f=tf field=total_maximum}{osb f=tf field=max_decline_attempts}
    + + {$list->currency_iso('')} + + + {$list->currency_iso('')} + + + {$list->currency_iso('')} +
    +
    + + + + + + + + + +
    {osb f=tf field=required_groups}{osb f=tf field=excluded_products}
    {$list->menu_multi($record.required_groups,'checkout_required_groups','group','name','5','5','form_menu')}{$list->menu_multi($record.excluded_products,'checkout_excluded_products','product','sku','5','5','form_menu')}
    +
    + + + + + + + + + +
    {osb f=tf field=manual_approval_all}{osb f=tf field=manual_approval_recur}
    {$list->bool('checkout_manual_approval_all',$record.manual_approval_all)}{$list->bool('checkout_manual_approval_recur',$record.manual_approval_recur)}
    +
    + + + + + + + + + +
    {osb f=tf field=manual_approval_amount}{osb f=tf field=manual_approval_currency}
    + + {$list->currency_iso('')} + {$list->menu_multi($record.manual_approval_currency,'checkout_manual_approval_currency','currency','three_digit','5','5','form_menu')}
    +
    + + + + + + + + + +
    {osb f=tf field=manual_approval_country}{osb f=tf field=manual_approval_group}
    {$list->menu_multi($record.manual_approval_country,'checkout_manual_approval_country','country','name','5','5','form_menu')}{$list->menu_multi($record.manual_approval_group,'checkout_manual_approval_group','group','name','5','5','form_menu')}
    +
    + + + + + + + + + +
    {osb f=tf field=default_when_amount}{osb f=tf field=default_when_currency}
    + + {$list->currency_iso('')} + {$list->menu_multi($record.default_when_currency,'checkout_default_when_currency','currency','three_digit','5','5','form_menu')}
    +
    + + + + + + + + + +
    {osb f=tf field=default_when_country}{osb f=tf field=default_when_group}
    {$list->menu_multi($record.default_when_country,'checkout_default_when_country','country','name','5','5','form_menu')}{$list->menu_multi($record.default_when_group,'checkout_default_when_group','group','name','5','5','form_menu')}
    +
    + + + + + + + + + +
    {osb f=tf field=allowed_currencies}{osb f=tf field=email_template}
    {$list->menu_multi($record.allowed_currencies,'checkout_allowed_currencies','currency','three_digit','5','5','form_menu')}
    +
    + + + {include file='file:../core/view_td_submit.tpl'} + + +
     
    +
    +
    + + {include file='file:../core/view_post.tpl'} +
    {/if} diff --git a/themes/default/blocks/checkout_plugin/credit_card_avs.tpl b/themes/default/blocks/checkout_plugin/credit_card_avs.tpl index ff703c0d..6fa160f1 100644 --- a/themes/default/blocks/checkout_plugin/credit_card_avs.tpl +++ b/themes/default/blocks/checkout_plugin/credit_card_avs.tpl @@ -32,7 +32,7 @@ -
    +
    + + +
    @@ -78,7 +78,7 @@ -
    +
    @@ -213,4 +213,4 @@
    -
    \ No newline at end of file +
    diff --git a/themes/default/blocks/checkout_plugin/echeck.tpl b/themes/default/blocks/checkout_plugin/echeck.tpl index 9accc741..6df685ec 100644 --- a/themes/default/blocks/checkout_plugin/echeck.tpl +++ b/themes/default/blocks/checkout_plugin/echeck.tpl @@ -32,7 +32,7 @@ -
    +
    + + +
    @@ -78,7 +78,7 @@ -
    +
    @@ -165,4 +165,4 @@
    -
    \ No newline at end of file +
    diff --git a/themes/default/blocks/checkout_plugin/plugin_cfg_PAYPAL.tpl b/themes/default/blocks/checkout_plugin/plugin_cfg_PAYPAL.tpl index 496abbd7..dd85ffe5 100644 --- a/themes/default/blocks/checkout_plugin/plugin_cfg_PAYPAL.tpl +++ b/themes/default/blocks/checkout_plugin/plugin_cfg_PAYPAL.tpl @@ -1,34 +1,10 @@ -{$list->unserial($checkout.plugin_data, "plugin_data")} - +{$list->unserial($record.plugin_data,'plugin_data')} + - - - - - - - - + {include file='file:plugin_tr_mode.tpl'} + {include file='file:plugin_tr_fee.tpl'} + + + +
    - {translate module=checkout} - mode - {/translate} - - -
    PayPal Account E-mail - -
    PayPal Account E-mail
    - - - \ No newline at end of file diff --git a/themes/default/blocks/checkout_plugin/plugin_cfg_PAYPAL_RECURRING.tpl b/themes/default/blocks/checkout_plugin/plugin_cfg_PAYPAL_RECURRING.tpl index 496abbd7..dd85ffe5 100644 --- a/themes/default/blocks/checkout_plugin/plugin_cfg_PAYPAL_RECURRING.tpl +++ b/themes/default/blocks/checkout_plugin/plugin_cfg_PAYPAL_RECURRING.tpl @@ -1,34 +1,10 @@ -{$list->unserial($checkout.plugin_data, "plugin_data")} - +{$list->unserial($record.plugin_data,'plugin_data')} + - - - - - - - - + {include file='file:plugin_tr_mode.tpl'} + {include file='file:plugin_tr_fee.tpl'} + + + +
    - {translate module=checkout} - mode - {/translate} - - -
    PayPal Account E-mail - -
    PayPal Account E-mail
    - - - \ No newline at end of file diff --git a/themes/default/blocks/checkout_plugin/plugin_cfg_REMIT_BANK_WIRE.tpl b/themes/default/blocks/checkout_plugin/plugin_cfg_REMIT_BANK_WIRE.tpl index c9f66dee..81f87591 100644 --- a/themes/default/blocks/checkout_plugin/plugin_cfg_REMIT_BANK_WIRE.tpl +++ b/themes/default/blocks/checkout_plugin/plugin_cfg_REMIT_BANK_WIRE.tpl @@ -1,16 +1,24 @@ -{$list->unserial($checkout.plugin_data, "plugin_data")} - +{$list->unserial($record.plugin_data,'plugin_data')} + - - - - + + + + + + + + + + + + + + + + + + + +
    Bank Wire Instructions: - -
    {t}Bank Name{/t}
    {t}Bank Branch{/t}
    {t}Bank Address{/t}
    {t}Bank BSB Number{/t}
    {t}Bank Account Number{/t}
    - - - \ No newline at end of file diff --git a/themes/default/blocks/checkout_plugin/plugin_ord_PAYPAL.tpl b/themes/default/blocks/checkout_plugin/plugin_ord_PAYPAL.tpl index 23b504af..56c6c0ef 100644 --- a/themes/default/blocks/checkout_plugin/plugin_ord_PAYPAL.tpl +++ b/themes/default/blocks/checkout_plugin/plugin_ord_PAYPAL.tpl @@ -1,2 +1,2 @@ -{ $block->display("checkout_plugin:third_party") } \ No newline at end of file +{$block->display('checkout_plugin:third_party')} diff --git a/themes/default/blocks/checkout_plugin/plugin_ord_PAYPAL_RECURRING.tpl b/themes/default/blocks/checkout_plugin/plugin_ord_PAYPAL_RECURRING.tpl index 23b504af..56c6c0ef 100644 --- a/themes/default/blocks/checkout_plugin/plugin_ord_PAYPAL_RECURRING.tpl +++ b/themes/default/blocks/checkout_plugin/plugin_ord_PAYPAL_RECURRING.tpl @@ -1,2 +1,2 @@ -{ $block->display("checkout_plugin:third_party") } \ No newline at end of file +{$block->display('checkout_plugin:third_party')} diff --git a/themes/default/blocks/checkout_plugin/plugin_ord_REMIT_BANK_WIRE.tpl b/themes/default/blocks/checkout_plugin/plugin_ord_REMIT_BANK_WIRE.tpl index c5fd75af..b74ddfb7 100644 --- a/themes/default/blocks/checkout_plugin/plugin_ord_REMIT_BANK_WIRE.tpl +++ b/themes/default/blocks/checkout_plugin/plugin_ord_REMIT_BANK_WIRE.tpl @@ -1,2 +1,2 @@ - -{ $block->display("checkout_plugin:third_party_noconf") } \ No newline at end of file + +{$block->display('checkout_plugin:third_party_noconf')} diff --git a/themes/default/blocks/checkout_plugin/plugin_ord_REMIT_BANK_WIRE_ALERT.tpl b/themes/default/blocks/checkout_plugin/plugin_ord_REMIT_BANK_WIRE_ALERT.tpl index 5076b48e..aed67535 100644 --- a/themes/default/blocks/checkout_plugin/plugin_ord_REMIT_BANK_WIRE_ALERT.tpl +++ b/themes/default/blocks/checkout_plugin/plugin_ord_REMIT_BANK_WIRE_ALERT.tpl @@ -1,60 +1,53 @@ +{* show checkout/payment plugin details *} +{if $record.checkout_plugin_id != '0'} + {assign var=sql1 value=" AND id='"} + {assign var=sql2 value="' "} + {assign var=sql3 value=$record.checkout_plugin_id} + {assign var=sql value=$sql1$sql3$sql2} + {if $list->smarty_array('checkout','checkout_plugin',$sql,'checkout')} + {assign var=checkout_plugin value=$checkout[0].checkout_plugin} + {/if} +{/if} + +{if ! $record} + {$method->exe_noauth('checkout','tpl_get_plugindata')} + {$list->unserial($plugin_data,'plugin_data')} +{else} + {$list->unserial($record.plugin_data,'plugin_data')} +{/if} - - - -
    - - - - - {* show discount details *} - {if $invoice.discount_arr != '' && $invoice.discount_amt > 0} - {/if} - {* show checkout/payment plugin details *} - {if $invoice.checkout_plugin_id != '0'} - {assign var=sql1 value=" AND id='"} - {assign var=sql2 value="' "} - {assign var=sql3 value=$invoice.checkout_plugin_id} - {assign var=sql value=$sql1$sql3$sql2} - {if $list->smarty_array("checkout", "checkout_plugin", $sql, "checkout") } - {assign var=checkout_plugin value=$checkout[0].checkout_plugin} - - {/if} - {/if} - - - -
    -
    - - {translate} - alert - {/translate} - -
    -
    - - - - -
    -

    Please remit full payment for this purchase by bank - wire to:
    - Bank Name: ------------------
    - Bank Branch: --------------
    - Bank Address: ------------------
    - ABA Routing Number: ----------------
    - For further Credit to: ---------------
    - Bank of America Account Number: ----------------

    -

    - {translate module=checkout} - remit_alert - {/translate} -

    -
    -
    -
    -
    -
    -{ $block->display("invoice:user_view") } +
    + + + + + + + +
    {t}Payment Instructions{/t}
    + + + + +
    +

    {t}Please remit full payment for this purchase by{/t}:

    +
    + {t}Bank Transfer{/t} + + + + + + +
    {t}Bank Name{/t}{$plugin_data.bankname}
    {t}Bank Branch{/t}{$plugin_data.bankbranch}
    {t}Bank Address{/t}{$plugin_data.bankaddress}
    {t}Bank BSB{/t}{$plugin_data.bankbsb}
    {t}Bank Account Number{/t}{$plugin_data.bankaccount}
    +
    +

    {t}Thank you, invoice billing status will continue to be displayed as due until reciept your funds. be continue to be displayed as due, you can ignore this unless we contact you stating otherwise.{/t}

    +
    +
    +
    + +{$block->display('invoice:user_view')} diff --git a/themes/default/blocks/checkout_plugin/plugin_ord_REMIT_CHECK.tpl b/themes/default/blocks/checkout_plugin/plugin_ord_REMIT_CHECK.tpl index c5fd75af..b74ddfb7 100644 --- a/themes/default/blocks/checkout_plugin/plugin_ord_REMIT_CHECK.tpl +++ b/themes/default/blocks/checkout_plugin/plugin_ord_REMIT_CHECK.tpl @@ -1,2 +1,2 @@ - -{ $block->display("checkout_plugin:third_party_noconf") } \ No newline at end of file + +{$block->display('checkout_plugin:third_party_noconf')} diff --git a/themes/default/blocks/checkout_plugin/plugin_ord_REMIT_CHECK_ALERT.tpl b/themes/default/blocks/checkout_plugin/plugin_ord_REMIT_CHECK_ALERT.tpl index 81a4e1e4..37d15ae2 100644 --- a/themes/default/blocks/checkout_plugin/plugin_ord_REMIT_CHECK_ALERT.tpl +++ b/themes/default/blocks/checkout_plugin/plugin_ord_REMIT_CHECK_ALERT.tpl @@ -1,60 +1,42 @@ +{* show checkout/payment plugin details *} +{if $invoice.checkout_plugin_id != '0'} + {assign var=sql1 value=" AND id='"} + {assign var=sql2 value="' "} + {assign var=sql3 value=$invoice.checkout_plugin_id} + {assign var=sql value=$sql1$sql3$sql2} + {if $list->smarty_array('checkout','checkout_plugin',$sql,'checkout')} + {assign var=checkout_plugin value=$checkout[0].checkout_plugin} + {/if} +{/if} - - - -
    - - - - - {* show discount details *} - {if $invoice.discount_arr != '' && $invoice.discount_amt > 0} - {/if} - {* show checkout/payment plugin details *} - {if $invoice.checkout_plugin_id != '0'} - {assign var=sql1 value=" AND id='"} - {assign var=sql2 value="' "} - {assign var=sql3 value=$invoice.checkout_plugin_id} - {assign var=sql value=$sql1$sql3$sql2} - {if $list->smarty_array("checkout", "checkout_plugin", $sql, "checkout") } - {assign var=checkout_plugin value=$checkout[0].checkout_plugin} - - {/if} - {/if} - - - -
    -
    - {translate} - alert - {/translate} -
    -
    - - - - -
    -

    Please remit payment full payment for this purchase by - check to:
    - {$smarty.const.SITE_NAME}
    - {$smarty.const.SITE_ADDRESS} -
    - {$smarty.const.SITE_CITY} - , - {$smarty.const.SITE_STATE} - {$smarty.const.SITE_ZIP} -

    -

    - {translate module=checkout} - remit_alert - {/translate} -

    -
    -
    -
    -
    -
    -{ $block->display("invoice:user_view") } +
    + + + + + + + +
    {t}Payment Instructions{/t}
    + + + + +
    +

    {t}Please remit full payment for this purchase by{/t}:

    +
    + {t}Cheque Payment{/t} +

    {$smarty.const.SITE_NAME}
    + {$smarty.const.SITE_ADDRESS}
    + {$smarty.const.SITE_CITY}, {$smarty.const.SITE_STATE} {$smarty.const.SITE_ZIP}

    +
    +

    {t}Thank you, invoice billing status will be displayed as due until reciept and verification of your funds. In the meanwhile, your invoice will be continue to be displayed as due, you can ignore this unless we contact you stating otherwise.{/t}

    +
    +
    +
    + +{$block->display('invoice:user_view')} diff --git a/themes/default/blocks/checkout_plugin/plugin_tr_fee.tpl b/themes/default/blocks/checkout_plugin/plugin_tr_fee.tpl new file mode 100644 index 00000000..7aafa65e --- /dev/null +++ b/themes/default/blocks/checkout_plugin/plugin_tr_fee.tpl @@ -0,0 +1,28 @@ +
    {translate module=checkout}Payment Fee Type{/translate} + {$list->menu_staticlist('commissiontype','checkout_plugin_data_feetype','checkout_plugin_data[feetype]',$plugin_data.feetype,'form_menu" onchange="setFee(this.value)')} + +
    {translate module=checkout}Payment Fee{/translate}{$plugin_data.fee}
    {translate module=checkout}mode{/translate}{$list->menu_staticlist('copluginmode','checkout_plugin_data_mode','checkout_plugin_data[mode]',$plugin_data.mode,'form_menu')}
      + + + + + +
    - - - - - - -
    - -
    - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {if $show_tickets == true} - - - - - - - - {/if} - {if $show_affiliates == true} - - - - - - - - {/if} -
    - {translate module=invoice} - indicator - {/translate} - - {translate module=invoice} - period - {/translate} - - {translate module=invoice} - current - {/translate} - - {translate module=invoice} - previous - {/translate} - - {translate module=invoice} - change - {/translate} -
      - {translate module=invoice} - sales - {/translate} -   - {if $VAR.period == '' || $VAR.period == 'm'} - {translate module=invoice} - thismonth - {/translate} - {translate module=invoice} - vs - {/translate} - {translate module=invoice} - lastmonth - {/translate} - {/if} - {if $VAR.period == 'w'} - {translate module=invoice} - thisweek - {/translate} - {translate module=invoice} - vs - {/translate} - {translate module=invoice} - lastweek - {/translate} - {/if} - {if $VAR.period == 'y'} - {translate module=invoice} - thisyear - {/translate} - {translate module=invoice} - vs - {/translate} - {translate module=invoice} - lastyear - {/translate} - {/if} -   - { $list->format_currency_num($sales_current, '') } -   - { $list->format_currency_num($sales_previous, '')} - - {$sales_change} -
      - {translate module=invoice} - forcast - {/translate} -   - {if $VAR.period == '' || $VAR.period == 'm'} - {translate module=invoice} - thismonth - {/translate} - {/if} - {if $VAR.period == 'w'} - {translate module=invoice} - thisweek - {/translate} - {/if} - {if $VAR.period == 'y'} - {translate module=invoice} - thisyear - {/translate} - {/if} -   - { $list->format_currency_num($forcast_current, '') } -   -   - {$forcast_change} -
      - {translate module=invoice} - quota - {/translate} -   - {translate module=invoice} - today - {/translate} -   - { $list->format_currency_num($quota_current, '') } -   --
      - {translate module=invoice} - arcredits - {/translate} -   - {if $VAR.period == '' || $VAR.period == 'm'} - {translate module=invoice} - thismonth - {/translate} - {translate module=invoice} - vs - {/translate} - {translate module=invoice} - lastmonth - {/translate} - {/if} - {if $VAR.period == 'w'} - {translate module=invoice} - thisweek - {/translate} - {translate module=invoice} - vs - {/translate} - {translate module=invoice} - lastweek - {/translate} - {/if} - {if $VAR.period == 'y'} - {translate module=invoice} - thisyear - {/translate} - {translate module=invoice} - vs - {/translate} - {translate module=invoice} - lastyear - {/translate} - {/if} -   - { $list->format_currency_num($ar_credits_current, '') } -   - { $list->format_currency_num($ar_credits_previous, '')} - - {$ar_credit_change} -
      - {translate module=invoice} - arbalance - {/translate} -   - {if $VAR.period == '' || $VAR.period == 'm'} - {translate module=invoice} - thismonth - {/translate} - {translate module=invoice} - vs - {/translate} - {translate module=invoice} - lastmonth - {/translate} - {/if} - {if $VAR.period == 'w'} - {translate module=invoice} - thisweek - {/translate} - {translate module=invoice} - vs - {/translate} - {translate module=invoice} - lastweek - {/translate} - {/if} - {if $VAR.period == 'y'} - {translate module=invoice} - thisyear - {/translate} - {translate module=invoice} - vs - {/translate} - {translate module=invoice} - lastyear - {/translate} - {/if} -   - { $list->format_currency_num($ar_balance_current, '') } -   - { $list->format_currency_num($ar_balance_last, '')} - -
      - {translate module=invoice} - users - {/translate} -   - {if $VAR.period == '' || $VAR.period == 'm'} - {translate module=invoice} - thismonth - {/translate} - {translate module=invoice} - vs - {/translate} - {translate module=invoice} - lastmonth - {/translate} - {/if} - {if $VAR.period == 'w'} - {translate module=invoice} - thisweek - {/translate} - {translate module=invoice} - vs - {/translate} - {translate module=invoice} - lastweek - {/translate} - {/if} - {if $VAR.period == 'y'} - {translate module=invoice} - thisyear - {/translate} - {translate module=invoice} - vs - {/translate} - {translate module=invoice} - lastyear - {/translate} - {/if} -   - {$users_current} -   - {$users_previous} - - {$users_change} -
      - {translate module=invoice} - tickets - {/translate} -   - {if $VAR.period == '' || $VAR.period == 'm'} - {translate module=invoice} - thismonth - {/translate} - {translate module=invoice} - vs - {/translate} - {translate module=invoice} - lastmonth - {/translate} - {/if} - {if $VAR.period == 'w'} - {translate module=invoice} - thisweek - {/translate} - {translate module=invoice} - vs - {/translate} - {translate module=invoice} - lastweek - {/translate} - {/if} - {if $VAR.period == 'y'} - {translate module=invoice} - thisyear - {/translate} - {translate module=invoice} - vs - {/translate} - {translate module=invoice} - lastyear - {/translate} - {/if} -   - {$tickets_current} -   - {$tickets_previous} - - {$tickets_change} -
      - {translate module=invoice} - affiliatesales - {/translate} -   - {if $VAR.period == '' || $VAR.period == 'm'} - {translate module=invoice} - thismonth - {/translate} - {translate module=invoice} - vs - {/translate} - {translate module=invoice} - lastmonth - {/translate} - {/if} - {if $VAR.period == 'w'} - {translate module=invoice} - thisweek - {/translate} - {translate module=invoice} - vs - {/translate} - {translate module=invoice} - lastweek - {/translate} - {/if} - {if $VAR.period == 'y'} - {translate module=invoice} - thisyear - {/translate} - {translate module=invoice} - vs - {/translate} - {translate module=invoice} - lastyear - {/translate} - {/if} -   - { $list->format_currency_num($affiliate_sales_current, '') } -   - { $list->format_currency_num($affiliate_sales_previous, '')} - - {$affiliate_sales_change} -
    -
    -
    -

    -{/if} -{if $smarty.const.GD} -

    [GD failed]

    - - - - - -
    -

    [img] - {if $list->is_installed('affiliate') } -

    -

    - {/if} -

    -
    -
    [img]
    -
    -{/if} - -{else} - {$block->display('account:account')} -{/if} - diff --git a/themes/default/blocks/core/alert.tpl b/themes/default/blocks/core/alert.tpl index d1069df5..5cc7a70b 100644 --- a/themes/default/blocks/core/alert.tpl +++ b/themes/default/blocks/core/alert.tpl @@ -1,37 +1,27 @@ - - - +
    - - - - - - - + + + +
    -
    - {translate} - alert - {/translate} -
    -
    - - - - {foreach from=$alert item=alert} - {if $alert != ''} - - +
    - {$alert} -
    + + - -
    + + + - {/if} - {/foreach} - - -
    {t}Alert{/t}
    -
    -
    + + + {foreach from=$alert item=alert} + {if $alert != ''} + + + + {/if} + {/foreach} + +
    Alert{$alert}
    +
    +
    -
    +
    diff --git a/themes/default/blocks/core/alert_fields.tpl b/themes/default/blocks/core/alert_fields.tpl index 5780a176..77eaa6f0 100644 --- a/themes/default/blocks/core/alert_fields.tpl +++ b/themes/default/blocks/core/alert_fields.tpl @@ -1,31 +1,26 @@ - - - - +
    - - - - - - - -
    -
    - {translate}alert{/translate} -
    -
    - - {foreach from=$form_validation item=record} {assign var=$record.field value="true"} - - - - {/foreach} -
    - {$record.field_trans} - :    - {$record.error} -
    -
    -
    + + +
    + + + + + + + +
    {t}Alert{/t}
    + + {foreach from=$form_validation item=recordval} {assign var=$recordval.field value='true'} + + + + {/foreach} +
    Alert{$recordval.field_trans} :   {$recordval.error}
    +
    +
    -
    + +
    +
    +
    diff --git a/themes/default/blocks/core/htmlarea.tpl b/themes/default/blocks/core/htmlarea.tpl deleted file mode 100644 index 03e59cf3..00000000 --- a/themes/default/blocks/core/htmlarea.tpl +++ /dev/null @@ -1,3 +0,0 @@ -{htmlarea} -test -{/htmlarea} diff --git a/themes/default/blocks/core/invalid_page.tpl b/themes/default/blocks/core/invalid_page.tpl index 95e39688..6986e4ee 100644 --- a/themes/default/blocks/core/invalid_page.tpl +++ b/themes/default/blocks/core/invalid_page.tpl @@ -1 +1 @@ -

    Sorry, the page you specified does not exist on our server!
    +
    {t}Sorry, the page you specified does not exist on our server!{/t}
    diff --git a/themes/default/blocks/core/method_error.tpl b/themes/default/blocks/core/method_error.tpl index 616d6913..379419f8 100644 --- a/themes/default/blocks/core/method_error.tpl +++ b/themes/default/blocks/core/method_error.tpl @@ -1,7 +1,8 @@ -{if ($method->error == 'auth')} - {if $SESS_LOGGED==1} - {else} +{if ($method->error == 'auth')} + {if $SESS_LOGGED!=1} {translate}login_required{/translate} - { $block->display("account:login") } - {/if} -{else} {$method->error} {/if} \ No newline at end of file + {$block->display('account:user_login')} + {/if} +{else} + {$method->error} +{/if} diff --git a/themes/default/blocks/core/recent_searches.tpl b/themes/default/blocks/core/recent_searches.tpl index 079af304..c0d455ff 100644 --- a/themes/default/blocks/core/recent_searches.tpl +++ b/themes/default/blocks/core/recent_searches.tpl @@ -1,40 +1,34 @@ -{if $module_recent_js != FALSE} -
    +{if $module_recent_js != false} + - - - - - - - -
    -
    - {translate}search_recent{/translate} -
    -
    -
    - - - - - - - - -
    - -
    - -
    - {$module_recent_js} -
    -
    -
    -{/if} + + + + + + + +
    {t}Your Recent Searches{/t}
    + + + + + + + +
    + +
    + {$module_recent_js} +
    + +
    + +
    + +{/if} diff --git a/themes/default/blocks/core/saved_searches.tpl b/themes/default/blocks/core/saved_searches.tpl index 1fe26eaf..0d5a13f3 100644 --- a/themes/default/blocks/core/saved_searches.tpl +++ b/themes/default/blocks/core/saved_searches.tpl @@ -1,40 +1,34 @@ -{if $module_saved_js != FALSE} -
    +{if $module_saved_js != false} + - - - - - - - -
    -
    - {translate}search_saved_l{/translate} -
    -
    -
    - - - - - - - - -
    - -
    - -
    - {$module_saved_js} -
    -
    -
    -

    {/if}

    + + + + + + + +
    {t}Your Saved Searches{/t}
    + + + + + + + +
    + +
    + {$module_saved_js} +
    + +
    + +
    + +{/if} diff --git a/themes/default/blocks/core/search.tpl b/themes/default/blocks/core/search.tpl index 3bb2e9cc..a09e7dc6 100644 --- a/themes/default/blocks/core/search.tpl +++ b/themes/default/blocks/core/search.tpl @@ -1,98 +1,59 @@ - - -{$smarty.const.SITE_NAME} +{assign var=meth value=':'|explode:$VAR._page} + - + + +{$method->exe($VAR.module,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} - - - - - - - - -{ $method->exe($VAR.module,"search") } -{ if ($method->result == FALSE) } -{ $block->display("core:method_error") } {else} -{if $results > 0} -
    -
    -
    -
    - - {translate} - search_results - {/translate} -
    -
    - {translate} - alert_refresh_click - {/translate} -
    -
    - {if $results == "1" && $VAR._next_page_one != "" } - - - {translate}alert_click{/translate} - - - {else} - {if $VAR._next_page == ""} - - {translate}alert_click{/translate} -
    - {else} - - {translate}alert_click{/translate} -
    - {/if} - + + {else} + {if $VAR._next_page == ''} + {t}Click here to continue{/t}
    + {else} + {t}Click here to continue{/t}
    + {/if} + + + {/if} + {else} - var url = '?_page='+module+':{$VAR._next_page}&search_id={$search_id}&order_by={$order_by}&limit={$limit}&page=1{if $VAR._escape_next == "1" }&_escape=1&_escape_next=1{/if}'; - {/if} - document.location = url; - - {/if} -
    -
    - -{else} - -
    -

     

    -

    - {translate} - search_no_results - {/translate} -

    -
    - -

     

    -

    - - -

    -
    -
    - {/if} + {t}No results for your search were found.{/t}
    +
    + + + {/if} + + {/if} - - diff --git a/themes/default/blocks/core/search_iframe.tpl b/themes/default/blocks/core/search_iframe.tpl index 94d0b232..21059719 100644 --- a/themes/default/blocks/core/search_iframe.tpl +++ b/themes/default/blocks/core/search_iframe.tpl @@ -1,59 +1,54 @@ - - - + + + - - - - -{ $method->exe($VAR.module,"search") } -{ if ($method->result == FALSE) } -{ $block->display("core:method_error") } -{else} -{if $results > 0} + + + + +{$method->exe($VAR.module,'search')} +{if ($method->result == false)} + {$block->display('core:method_error')} - {if $results == "1" && $VAR._next_page_one != "" } - - {else} - - {/if} - {else} - -{/if} + {if $results > 0} + + + {else} + + {/if} {/if} diff --git a/themes/default/blocks/core/search_post.tpl b/themes/default/blocks/core/search_post.tpl new file mode 100644 index 00000000..45cc40af --- /dev/null +++ b/themes/default/blocks/core/search_post.tpl @@ -0,0 +1,23 @@ +
    {t}Results per page{/t}
    {t}Order results by{/t} + +
      + + + + +
    + + + +
    + {t}Search Export{/t} + {if $mail} + {t}Multi Mail{/t} + {/if} + {t}Search Print{/t} + {t}Search New{/t} + {osb f=tt method=add} +
    + +{/if} + diff --git a/themes/default/blocks/core/search_show_pre.tpl b/themes/default/blocks/core/search_show_pre.tpl new file mode 100644 index 00000000..f92f8201 --- /dev/null +++ b/themes/default/blocks/core/search_show_pre.tpl @@ -0,0 +1,33 @@ + +

    {t count=$results 1=$results plural='%1 records were found.'}%1 record was found.{/t}

    + + + + + +
    + + +
    +
    + + diff --git a/themes/default/blocks/core/search_show_tr_record.tpl b/themes/default/blocks/core/search_show_tr_record.tpl new file mode 100644 index 00000000..12b99d8c --- /dev/null +++ b/themes/default/blocks/core/search_show_tr_record.tpl @@ -0,0 +1,4 @@ +
    + +
    + + + + +
    + + + {include file='file:../core/view_td_submit.tpl'} + {include file='file:../core/view_td_delete.tpl'} + +
    +
    - - - -
    - - - - - - - -
    -
    - {translate module=country} - title_add - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=country} - field_name - {/translate} - - -
    - {translate module=country} - field_two_code - {/translate} - - -
    - {translate module=country} - field_three_code - {/translate} - - -
    - {translate module=country} - field_description - {/translate} - - -
    - {translate module=country} - field_notes - {/translate} - - -
    - - - - -
    -
    -
    - +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/add_tr_submit.tpl'} +
    {osb f=tf field=name}
    {osb f=tf field=two_code}
    {osb f=tf field=three_code}
    {osb f=tf field=description}
    {osb f=tf field=notes}
    +
    +
    + +
    diff --git a/themes/default/blocks/country/main.tpl b/themes/default/blocks/country/main.tpl deleted file mode 100644 index 15d3e367..00000000 --- a/themes/default/blocks/country/main.tpl +++ /dev/null @@ -1,26 +0,0 @@ - - - - -
    - - - - - - - -
    -
    - {translate module=country} - menu - {/translate} -
    -
    - - - - -
    {translate module=country}help_file{/translate}
    -
    -
    diff --git a/themes/default/blocks/country/search_show.tpl b/themes/default/blocks/country/search_show.tpl index d90c2d4f..1be09918 100644 --- a/themes/default/blocks/country/search_show.tpl +++ b/themes/default/blocks/country/search_show.tpl @@ -1,125 +1,12 @@ -{$method->exe("country","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{assign var=meth value=':'|explode:$VAR._page} + + +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - - - - - - {foreach from=$country item=record} - - - - - - - - - - - - - {literal} - - {/literal} - - {/foreach} - - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -
    - -   - {$record.name} -   - {$record.two_code} -   - {$record.three_code} -
    -
    - -{if $VAR._print != TRUE}
    - -
    - - - - - - -
    + {include file='file:../core/search_show_pre.tpl'} + {$method->exe_noauth($meth.0,'tpl_search_show',$search_show)} + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/country/view.tpl b/themes/default/blocks/country/view.tpl index 06190dfe..e573edf5 100644 --- a/themes/default/blocks/country/view.tpl +++ b/themes/default/blocks/country/view.tpl @@ -1,147 +1,59 @@ -{ $method->exe("country","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{assign var=meth value=':'|explode:$VAR._page} + -{literal} - - -{/literal} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} - -{foreach from=$country item=country} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=country} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=country} - field_name - {/translate} - - -
    - {translate module=country} - field_two_code - {/translate} - - -
    - {translate module=country} - field_three_code - {/translate} - - -
    - {translate module=country} - field_description - {/translate} - - -
    - {translate module=country} - field_notes - {/translate} - - -
    - - - - - -
    - - - -
    -
    -
    -
    - - - - -
    - {/foreach} + +
    + + + + + +
    + + + + + + + + {include file='file:../core/view_tr_submit_delete.tpl'} +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=name}
    {osb f=tf field=two_code}
    {osb f=tf field=three_code}
    {osb f=tf field=description}
    {osb f=tf field=notes}
    +
    +
    + + {include file='file:../core/view_post.tpl'} +
    {/if} diff --git a/themes/default/blocks/currency/add.tpl b/themes/default/blocks/currency/add.tpl index 8abe6eeb..162a8872 100644 --- a/themes/default/blocks/currency/add.tpl +++ b/themes/default/blocks/currency/add.tpl @@ -1,93 +1,51 @@ +{assign var=meth value=':'|explode:$VAR._page} + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=currency} - title_add - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=currency} - field_name - {/translate} - - -
    - {translate module=currency} - field_symbol - {/translate} - - -
    - {translate module=currency} - field_three_digit - {/translate} - - -
    - {translate module=currency} - field_status - {/translate} - - {$list->bool("currency_status",$VAR.currency_status, "form_menu")} -
    - {translate module=currency} - field_notes - {/translate} - - -
    - - - - -
    -
    -
    -
    +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/add_tr_submit.tpl'} +
    {osb f=tf field=name}
    {osb f=tf field=symbol}
    {osb f=tf field=three_digit}
    {osb f=tf field=status}{$list->bool('currency_status',$VAR.currency_status)}
    {osb f=tf field=notes}
    +
    +
    + +
    diff --git a/themes/default/blocks/currency/main.tpl b/themes/default/blocks/currency/main.tpl deleted file mode 100644 index 332ebb3a..00000000 --- a/themes/default/blocks/currency/main.tpl +++ /dev/null @@ -1,26 +0,0 @@ - - - - -
    - - - - - - - -
    -
    - {translate module=currency} - menu - {/translate} -
    -
    - - - - -
    {translate module=currency}help_file{/translate}
    -
    -
    diff --git a/themes/default/blocks/currency/search_show.tpl b/themes/default/blocks/currency/search_show.tpl index 42e28a55..2e593f28 100644 --- a/themes/default/blocks/currency/search_show.tpl +++ b/themes/default/blocks/currency/search_show.tpl @@ -1,114 +1,12 @@ -{$method->exe("currency","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{assign var=meth value=':'|explode:$VAR._page} + + +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - {foreach from=$currency item=record} - - - - - - - {literal} - - {/literal} - {/foreach} - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -
    - -   - {$record.name} -   - {$record.symbol} -   - {$record.three_digit} -
    -
    - -{if $VAR._print != TRUE}
    - -
    - - - - - - - -
    -
    + {include file='file:../core/search_show_pre.tpl'} + {$method->exe_noauth($meth.0,'tpl_search_show',$search_show)} + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/currency/view.tpl b/themes/default/blocks/currency/view.tpl index 7aac7c65..5dcc3d12 100644 --- a/themes/default/blocks/currency/view.tpl +++ b/themes/default/blocks/currency/view.tpl @@ -1,201 +1,105 @@ -{ $method->exe("currency","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{assign var=meth value=':'|explode:$VAR._page} + -{literal} - - -{/literal} - - -{foreach from=$currency item=currency} - - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=currency} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=currency} - field_name - {/translate} - - -
    - {translate module=currency} - field_symbol - {/translate} - - -
    - {translate module=currency} - field_three_digit - {/translate} - - -
    - {translate module=currency} - field_status - {/translate} - - {$list->bool("currency_status",$currency.status, "form_menu")} -
    - {translate module=currency} - field_notes - {/translate} - - -
    - {translate module=currency} - field_convert_array - {/translate} -
    - - -
    - - {assign var=sql1 value=" AND id != '"} - {assign var=sql2 value=$currency.id} - {assign var=sql3 value="' AND status = '1'"} - {assign var=sql value=$sql1$sql2$sql3} - { if $list->smarty_array("currency", "name,symbol,three_digit", $sql, "currency_arr") } - {$list->unserial($currency.convert_array, "convert")} - {foreach from=$currency_arr item=c_arr} - - - - - - - {/foreach} - {/if} -
    - - {$c_arr.three_digit} -   - {assign var=id value=$c_arr.id} - {assign var=convert_rate value=$convert.$id} - - - - {$c_arr.name} -
    -
    - - - - - - -
    - - - - - -
      - -
    -
    -
    -
    - - - - -
    - {/foreach} - -{literal}{/literal} - - - - + {/literal} + //--> + + + {/if} diff --git a/themes/default/blocks/db_mapping/add.tpl b/themes/default/blocks/db_mapping/add.tpl deleted file mode 100644 index 3c494df4..00000000 --- a/themes/default/blocks/db_mapping/add.tpl +++ /dev/null @@ -1,117 +0,0 @@ - - - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=db_mapping}title_add{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=db_mapping} - field_status - {/translate} - - { $list->bool("db_mapping_status", $VAR.db_mapping_status, "form_menu") } -
    - {translate module=db_mapping} - field_db_name - {/translate} - - -
    - {translate module=db_mapping} - field_db_host - {/translate} - - -
    - {translate module=db_mapping} - field_db_user - {/translate} - - -
    - {translate module=db_mapping} - field_db_pass - {/translate} - - -
    - {translate module=db_mapping} - field_db_prefix - {/translate} - - -
    - {translate module=db_mapping} - field_cookie_name - {/translate} - - -
       
    - - - - - - -
    -
    -
    -
    diff --git a/themes/default/blocks/db_mapping/group_map_db-status.tpl b/themes/default/blocks/db_mapping/group_map_db-status.tpl deleted file mode 100644 index 94e59918..00000000 --- a/themes/default/blocks/db_mapping/group_map_db-status.tpl +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - {$list->unserial($db_mapping.group_rank, "group_rank")} - {foreach from=$db_mapping_groups item=db_mapping_groups_local} - {if $db_mapping_groups_local.id != 0} - - - - - - - - {/if} - {/foreach} -
    Local GroupMapped To GroupAuthentication Rank
    - {$db_mapping_groups_local.name} - - {foreach from=$db_mapping_groups_local.remote item=db_mapping_groups_remote} - - {$db_mapping_groups_remote.name} -
    - {/foreach} -
    -
    -
    - {foreach from=$group_rank item=rank} - {if $db_mapping_groups_local.id == $rank.id} - {assign var=rank_val value=$rank.rank} - {if $rank_val == ""} - {assign var=rank_val value=0} - {/if} - {/if} - {/foreach} - - -
    -
    - diff --git a/themes/default/blocks/db_mapping/group_map_db.tpl b/themes/default/blocks/db_mapping/group_map_db.tpl deleted file mode 100644 index 471a863b..00000000 --- a/themes/default/blocks/db_mapping/group_map_db.tpl +++ /dev/null @@ -1,18 +0,0 @@ - - {foreach from=$db_mapping_groups item=db_mapping_groups_local} - - - - - {/foreach} -
    - {$db_mapping_groups_local.name} - - {foreach from=$db_mapping_groups_local.remote item=db_mapping_groups_remote} - - {$db_mapping_groups_remote.name} -
    - {/foreach} -
    -
    - diff --git a/themes/default/blocks/db_mapping/group_map_status.tpl b/themes/default/blocks/db_mapping/group_map_status.tpl deleted file mode 100644 index 1fdcfcbc..00000000 --- a/themes/default/blocks/db_mapping/group_map_status.tpl +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - {$list->unserial($db_mapping.group_rank, "group_rank")} - {foreach from=$db_mapping_groups item=db_mapping_groups_local} - {if $db_mapping_groups_local.id != 0} - - - - - - - - {/if} - {/foreach} -
    Local GroupMapped To GroupAuthentication Rank
    - {$db_mapping_groups_local.name} - - - -
    - {foreach from=$group_rank item=rank} - {if $db_mapping_groups_local.id == $rank.id} - {assign var=rank_val value=$rank.rank} - {if $rank_val == ""} - {assign var=rank_val value=0} - {/if} - {/if} - {/foreach} - - -
    -
    diff --git a/themes/default/blocks/db_mapping/main.tpl b/themes/default/blocks/db_mapping/main.tpl deleted file mode 100644 index 7a15a79d..00000000 --- a/themes/default/blocks/db_mapping/main.tpl +++ /dev/null @@ -1,27 +0,0 @@ - - - - - -
    - - - - - - - -
    -
    - {translate module=db_mapping} - menu - {/translate} -
    -
    - - - - -
    {translate module=db_mapping}help_file{/translate}
    -
    -
    diff --git a/themes/default/blocks/db_mapping/search_show.tpl b/themes/default/blocks/db_mapping/search_show.tpl deleted file mode 100644 index e50b6bf7..00000000 --- a/themes/default/blocks/db_mapping/search_show.tpl +++ /dev/null @@ -1,95 +0,0 @@ - - -{$method->exe("db_mapping","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} -{else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - {foreach from=$db_mapping item=record} - - - - - - {/foreach} - -
      - {translate module=db_mapping} - field_name - {/translate} -  
      - {if $record.status == "1"} - - {else} - - {/if} -   - {$record.name} - - -
    -
    -{if $VAR._print != TRUE}
    -
    -
    -
    -{/if} -{/if} -
    diff --git a/themes/default/blocks/db_mapping/view.tpl b/themes/default/blocks/db_mapping/view.tpl deleted file mode 100644 index f5d51fc8..00000000 --- a/themes/default/blocks/db_mapping/view.tpl +++ /dev/null @@ -1,199 +0,0 @@ -{ $method->exe("db_mapping","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} - -{literal} - - -{/literal} - - -{foreach from=$db_mapping item=db_mapping} - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - -
    - - - - - -
    - - - - - - - - - - - - - -
    -
    - {translate module=db_mapping} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=db_mapping} - field_map_file - {/translate} - - {$db_mapping.map_file} - .php
    - {translate module=db_mapping} - field_status - {/translate} - - { $list->bool("db_mapping_status", $db_mapping.status, "form_menu") } -
    - {translate module=db_mapping} - field_db_name - {/translate} - - -
    - {translate module=db_mapping} - field_db_host - {/translate} - - -
    - {translate module=db_mapping} - field_db_user - {/translate} - - -
    - {translate module=db_mapping} - field_db_pass - {/translate} - - -
    - {translate module=db_mapping} - field_db_prefix - {/translate} - - -
    - {translate module=db_mapping} - field_cookie_name - {/translate} - - -
    - - - - - -
    - - - -
    -
    Sync - all accounts and groups
    -
    -
    - {translate module=db_mapping} - field_group_map - {/translate} -
    -
    - {if $db_mapping_result != false} -
    - {$db_mapping_result} -
    - {else} - { $block->display($db_mapping_template) } - {/if} -
    -
    - - - - - - -
    - -{/foreach} -{/if} diff --git a/themes/default/blocks/discount/add.tpl b/themes/default/blocks/discount/add.tpl index 458af616..7e765de4 100644 --- a/themes/default/blocks/discount/add.tpl +++ b/themes/default/blocks/discount/add.tpl @@ -1,349 +1,177 @@ - +{assign var=meth value=':'|explode:$VAR._page} + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} -
    + - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - {translate module=discount} - title_add - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=discount} - field_date_start - {/translate} - - { $list->calender_add("discount_date_start", $VAR.discount_date_start, "form_field") } - -
    - {translate module=discount} - field_date_expire - {/translate} - - { $list->calender_add("discount_date_expire", $VAR.discount_date_expire, "form_field") } -
    - {translate module=discount} - field_status - {/translate} - - {if $VAR.discount_status == ''} - { $list->bool("discount_status", 1, "form_menu") } - {else} - { $list->bool("discount_status", $VAR.discount_status, "form_menu") } - {/if} -
    - {translate module=discount} - field_name - {/translate} - - -
    - {translate module=discount} - field_notes - {/translate} - - -
    -
    - - - - -
    -
    {translate module=discount}discount_restrictions{/translate}
    -
    -
    - - - - - - - - - - - - - - - - - - {if $list->is_installed("host_tld")} - - - - - {/if} - - - - -
    - {translate module=discount} - field_max_usage_account - {/translate} - - -
    - {translate module=discount} - field_max_usage_global - {/translate} - - -
    - {translate module=discount} - field_avail_account_id - {/translate} - - {html_select_account name="discount_avail_account_id" default=$VAR.discount_avail_account_id} -
    - {translate module=discount} - field_avail_product_id - {/translate} - - { $list->menu_multi($VAR.discount_avail_product_id, "discount_avail_product_id", "product", "sku", "", "10", "form_menu") } -
    - {translate module=discount} - field_avail_tld_id - {/translate} - - { $list->menu_multi($VAR.discount_avail_tld_id, "discount_avail_tld_id", "host_tld", "name", "", "10", "form_menu") } -
    - {translate module=discount} - field_avail_group_id - {/translate} - - { $list->menu_multi($VAR.discount_avail_group_id, 'discount_avail_group_id', 'group', 'name', '', '10', 'form_menu') } -
    -
    - - - - -
    -
    - {translate module=discount} - discount_new - {/translate} -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=discount} - field_new_status - {/translate} - - { $list->bool("discount_new_status", $VAR.discount_new_status, "form_menu") } -
    - {translate module=discount} - field_new_type - {/translate} - - -
    - {translate module=discount} - field_new_rate - {/translate} - - -
    - {translate module=discount} - field_new_max_discount - {/translate} - - -
    - {translate module=discount} - field_new_min_cost - {/translate} - - -
    -
    - - - - -
    -
    - {translate module=discount} - discount_recurr - {/translate} -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=discount} - field_recurr_status - {/translate} - - { $list->bool("discount_recurr_status", $VAR.discount_recurr_status, "form_menu") } -
    - {translate module=discount} - field_recurr_type - {/translate} - - -
    - {translate module=discount} - field_recurr_rate - {/translate} - - -
    - {translate module=discount} - field_recurr_max_discount - {/translate} - - -
    - {translate module=discount} - field_recurr_min_cost - {/translate} - - -
    -
    - - - - - -
    -
    - - - - -
    -
    -
    -
    -

     

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=date_start}{$list->calender_add('discount_date_start',$VAR.discount_date_start,'form_field')}
    {osb f=tf field=date_expire}{$list->calender_add('discount_date_expire',$VAR.discount_date_expire,'form_field')}
    {osb f=tf field=status} + {if $VAR.discount_status == ''} + {$list->bool('discount_status',1,'form_menu')} + {else} + {$list->bool('discount_status',$VAR.discount_status,'form_menu')} + {/if} +
    {osb f=tf field=name}
    {osb f=tf field=notes}
    +
    + + + + +
    {t}Discount Restrictions & Limitations{/t}
    +
    + + + + + + + + + + + + + + + + + + {if $list->is_installed('host_tld')} + + + + + {/if} + + + + +
    {osb f=tf field=max_usage_account}
    {osb f=tf field=max_usage_global}
    {osb f=tf field=avail_account_id}{osb f=autoselect module=account return=id field=discount_avail_account_id default=$VAR.discount_avail_account_id}
    {osb f=tf field=avail_product_id}{$list->menu_multi($VAR.discount_avail_product_id,'discount_avail_product_id','product','sku','','10','form_menu')}
    {osb f=tf field=avail_tld_id}{$list->menu_multi($VAR.discount_avail_tld_id,'discount_avail_tld_id','host_tld','name','','10','form_menu')}
    {osb f=tf field=avail_group_id}{$list->menu_multi($VAR.discount_avail_group_id,'discount_avail_group_id','group','name','','10','form_menu')}
    +
    + + + + +
    {t}Settings for new Charges & Orders{/t}
    +
    + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=new_status}{$list->bool('discount_new_status',$VAR.discount_new_status,'form_menu')}
    {osb f=tf field=new_type}{$list->menu_staticlist('discounttype','discount_new_type','discount_new_type',$VAR.discount_new_type,'form_menu')}
    {osb f=tf field=new_rate}
    {osb f=tf field=new_max_discount}
    {osb f=tf field=new_min_cost}
    +
    + + + + +
    {t}Settings for Recurring Charges{/t}
    +
    + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=recurr_status}{$list->bool('discount_recurr_status',$VAR.discount_recurr_status,'form_menu')}
    {osb f=tf field=recurr_type}{$list->menu_staticlist('discounttype','discount_recurr_type','discount_recurr_type',$VAR.discount_recurr_type,'form_menu')}
    {osb f=tf field=recurr_rate}
    {osb f=tf field=recurr_max_discount}
    {osb f=tf field=recurr_min_cost}
    +
    + + {include file='file:../core/add_tr_submit.tpl'} + + + + +
      
    +
    +
    + diff --git a/themes/default/blocks/discount/search_form.tpl b/themes/default/blocks/discount/search_form.tpl index 121ca501..5f99dd10 100644 --- a/themes/default/blocks/discount/search_form.tpl +++ b/themes/default/blocks/discount/search_form.tpl @@ -1,168 +1,70 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("discount","search_form") } -{ if ($method->result == FALSE) } - { $block->display("core:method_error") } +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=discount}title_search{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=discount} - field_date_orig - {/translate} - - { $list->calender_search("discount_date_orig", $VAR.discount_date_orig, "form_field", "") } -
    - {translate module=discount} - field_date_start - {/translate} - - { $list->calender_search("discount_date_start", $VAR.discount_date_start, "form_field", "") } -
    - {translate module=discount} - field_date_expire - {/translate} - - { $list->calender_search("discount_date_expire", $VAR.discount_date_expire, "form_field", "") } -
    - {translate module=discount} - field_status - {/translate} - - { $list->bool("discount_status", "all", "form_menu") } -
    - {translate module=discount} - field_name - {/translate} - - -    - {translate} - search_partial - {/translate} -
    - {translate module=discount} - field_notes - {/translate} - - -    - {translate} - search_partial - {/translate} -
    - {translate module=discount} - field_avail_account_id - {/translate} - - {html_select_account name="discount_avail_account_id" default=$VAR.discount_avail_account_id} -
    - {translate module=discount} - field_new_status - {/translate} - - { $list->bool("discount_new_status", "all", "form_menu") } -
    - {translate module=discount} - field_recurr_status - {/translate} - - { $list->bool("discount_recurr_status", "all", "form_menu") } -
    - {translate} - search_results_per - {/translate} - - -
    - {translate} - search_order_by - {/translate} - - -
    - - - - -
    -
    -
    -
    -{ $block->display("core:saved_searches") } -{ $block->display("core:recent_searches") } +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/search_post.tpl'} +
    {osb f=tf field=date_orig}{$list->calender_search('discount_date_orig',$VAR.discount_date_orig,'form_field','')}
    {osb f=tf field=date_start}{$list->calender_search('discount_date_start',$VAR.discount_date_start,'form_field','')}
    {osb f=tf field=date_expire}{$list->calender_search('discount_date_expire',$VAR.discount_date_expire,'form_field','')}
    {osb f=tf field=status}{$list->bool('discount_status','all')}
    {osb f=tf field=name}  {t}"%" for partial match{/t}
    {osb f=tf field=notes}  {t}"%" for partial match{/t}
    {osb f=tf field=avail_account_id}{osb f=autoselect module=account return=id field=discount_avail_account_id default=$VAR.discount_avail_account_id}
    {osb f=tf field=new_status}{$list->bool('discount_new_status','all')}
    {osb f=tf field=recurr_status}{$list->bool('discount_recurr_status','all')}
    +
    +
    + +
    + + {$block->display('core:saved_searches')} + {$block->display('core:recent_searches')} {/if} diff --git a/themes/default/blocks/discount/search_show.tpl b/themes/default/blocks/discount/search_show.tpl index cefdc955..81e4872b 100644 --- a/themes/default/blocks/discount/search_show.tpl +++ b/themes/default/blocks/discount/search_show.tpl @@ -1,140 +1,32 @@ +{assign var=meth value=':'|explode:$VAR._page} + - -{$method->exe("discount","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    + {include file='file:../core/search_show_pre.tpl'} + + + + +
    + + {$method->exe_noauth($meth.0,'tpl_search_show')} + {foreach from=$search_show item=record} + {include file='file:../core/search_show_tr_record.tpl'} + + + + + + + + {/foreach} +
    {$record.name}{$list->bool('',$record.status,'')}{$record.orders}{$list->format_currency($record.revenue,'')}{$list->format_currency($record.savings,'')}{$list->menu_staticlist('discounttype','','',$record.new_type,'')}
    +
    - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - - - {foreach from=$discount item=record} - - - - - - - - - - {literal} - - {/literal} - {/foreach} - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - {translate module=discount}invoice_count{/translate}{translate module=discount}revenue{/translate}{translate module=discount}savings{/translate} - {literal} - - {/literal} -
    - -   - {$record.name} -   - {if $record.status == "1"} - {translate} - true - {/translate} - {else} - {translate} - false - {/translate} - {/if} -     - {$record.orders} - -   - {$list->format_currency($record.revenue,'')} -   - {$list->format_currency($record.savings,'')} -   - {if $record.new_type == "0"} - {translate module=discount} - percent - {/translate} - {else} - {translate module=discount} - flat - {/translate} - {/if} -
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    - {/if} - {/if} -
    \ No newline at end of file + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} +{/if} diff --git a/themes/default/blocks/discount/view.tpl b/themes/default/blocks/discount/view.tpl index b122458f..5ec92bf3 100644 --- a/themes/default/blocks/discount/view.tpl +++ b/themes/default/blocks/discount/view.tpl @@ -1,405 +1,174 @@ -{ $method->exe("discount","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{assign var=meth value=':'|explode:$VAR._page} + -{literal} - - -{/literal} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} - -{foreach from=$discount item=discount} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - {translate module=discount} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=discount} - field_date_orig - {/translate} - - {$list->date_time($discount.date_orig)} -
    - {translate module=discount} - field_date_start - {/translate} - - { $list->calender_view("discount_date_start", $discount.date_start, "form_field", $discount.id) } -
    - {translate module=discount} - field_date_expire - {/translate} - - { $list->calender_view("discount_date_expire", $discount.date_expire, "form_field", $discount.id) } -
    - {translate module=discount} - field_status - {/translate} - - { $list->bool("discount_status", $discount.status, "onChange=\"submit()\"") } -
    - {translate module=discount} - field_name - {/translate} - - -
    - {translate module=discount} - field_notes - {/translate} - - -
    -
    - - - - -
    -
    - {translate module=discount} - discount_restrictions - {/translate} -
    -
    -
    - - - - - - - - - - - - - - - - - - {if $list->is_installed("host_tld")} - - - - - {/if} - - - - -
    - {translate module=discount} - field_max_usage_account - {/translate} - - -
    - {translate module=discount} - field_max_usage_global - {/translate} - - -
    - {translate module=discount} - field_avail_account_id - {/translate} - - {html_select_account name="discount_avail_account_id" default=$discount.avail_account_id} -
    - {translate module=discount} - field_avail_product_id - {/translate} - - { $list->menu_multi($discount.avail_product_id, "discount_avail_product_id", "product", "sku", "", "10", "form_menu") } -
    - {translate module=discount} - field_avail_tld_id - {/translate} - - { $list->menu_multi($discount.avail_tld_id, "discount_avail_tld_id", "host_tld", "name", "", "10", "form_menu") } -
    - {translate module=discount} - field_avail_group_id - {/translate} - - { $list->menu_multi($discount.avail_group_id, 'discount_avail_group_id', 'group', 'name', '', '10', 'form_menu') } -
    -
    - - - - -
    -
    - {translate module=discount} - discount_new - {/translate} -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=discount} - field_new_status - {/translate} - - { $list->bool("discount_new_status", $discount.new_status, "form_menu") } -
    - {translate module=discount} - field_new_type - {/translate} - - -
    - {translate module=discount} - field_new_rate - {/translate} - - -
    - {translate module=discount} - field_new_max_discount - {/translate} - - -
    - {translate module=discount} - field_new_min_cost - {/translate} - - -
    -
    - - - - -
    -
    - {translate module=discount} - discount_recurr - {/translate} -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=discount} - field_recurr_status - {/translate} - - { $list->bool("discount_recurr_status", $discount.recurr_status, "form_menu") } -
    - {translate module=discount} - field_recurr_type - {/translate} - - -
    - {translate module=discount} - field_recurr_rate - {/translate} - - -
    - {translate module=discount} - field_recurr_max_discount - {/translate} - - -
    - {translate module=discount} - field_recurr_min_cost - {/translate} - - -
    -
    - - - - - -
    - - -
    - -
    -
    -
    -
    - - - - -
    - {/foreach} + +
    + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/view_tr_submit_delete.tpl'} +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=date_orig}{$list->date_time($record.date_orig)}
    {osb f=tf field=date_start}{$list->calender_view('discount_date_start',$record.date_start,'form_field')}
    {osb f=tf field=date_expire}{$list->calender_view('discount_date_expire',$record.date_expire,'form_field')}
    {osb f=tf field=status}{$list->bool('discount_status',$record.status,'" onchange="submit()')}
    {osb f=tf field=name}
    {osb f=tf field=notes}
    +
    + + + + +
    {t}Discount Restrictions & Limitations{/t}
    +
    + + + + + + + + + + + + + + + + + + {if $list->is_installed('host_tld')} + + + + + {/if} + + + + +
    {osb f=tf field=max_usage_account}
    {osb f=tf field=max_usage_global}
    {osb f=tf field=avail_account_id}{osb f=autoselect module=account return=id field=discount_avail_account_id default=$record.avail_account_id}
    {osb f=tf field=avail_product_id}{$list->menu_multi($record.avail_product_id,'discount_avail_product_id','product','sku','','10','form_menu')}
    {osb f=tf field=avail_tld_id}{$list->menu_multi($record.avail_tld_id,'discount_avail_tld_id','host_tld','name','','10','form_menu')}
    {osb f=tf field=avail_group_id}{$list->menu_multi($record.avail_group_id,'discount_avail_group_id','group','name','','10','form_menu')}
    +
    + + + + +
    {t}Settings for new Charges & Orders{/t}
    +
    + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=new_status}{$list->bool('discount_new_status',$record.new_status)}
    {osb f=tf field=new_type}{$list->menu_staticlist('discounttype','discount_new_type','discount_new_type',$record.new_type,'form_menu')}
    {osb f=tf field=new_rate}
    {osb f=tf field=new_max_discount}
    {osb f=tf field=new_min_cost}
    +
    + + + + +
    {t}Settings for Recurring Charges{/t}
    +
    + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=recurr_status}{$list->bool('discount_recurr_status',$record.recurr_status)}
    {osb f=tf field=recurr_type}{$list->menu_staticlist('discounttype','discount_recurr_type','discount_recurr_type',$VAR.recurr_type,'form_menu')}
    {osb f=tf field=recurr_rate}
    {osb f=tf field=recurr_max_discount}
    {osb f=tf field=recurr_min_cost}
    +
    +
    + + {include file='file:../core/view_post.tpl'} +
    {/if} diff --git a/themes/default/blocks/email_log/search_form.tpl b/themes/default/blocks/email_log/search_form.tpl index 8d966674..4fe8a03c 100644 --- a/themes/default/blocks/email_log/search_form.tpl +++ b/themes/default/blocks/email_log/search_form.tpl @@ -1,123 +1,62 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("email_log","search_form") } -{ if ($method->result == FALSE) } - { $block->display("core:method_error") } +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} -
    - {$COOKIE_FORM} - - - - -
    - - - - - - - - - -
    -
    - {translate module=email_log}title_search{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - +
    - {translate module=email_log} - field_date_orig - {/translate} - { $list->calender_search("email_log_date_orig", $VAR.email_log_date_orig, "form_field", "") } -
    - {translate module=email_log} - field_account_id - {/translate}{html_select_account name="email_log_account_id" default=$VAR.email_log_account_id}
    - {translate module=email_log} - field_email - {/translate} -   {translate}search_partial{/translate} -
    - {translate module=email_log} - field_subject - {/translate} - -   {translate}search_partial{/translate}
    - {translate module=email_log} - field_message - {/translate} -   {translate}search_partial{/translate} -
    - {translate module=email_log} - field_urgent - {/translate} - { $list->bool("email_log_urgent", "all", "form_menu") } -
    - {translate module=email_log} - field_userread - {/translate} - { $list->bool("email_log_userread", "all", "form_menu") } -
    {translate}search_results_per{/translate} - -
    {translate}search_order_by{/translate} - -
    + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/search_post.tpl'} +
    {osb f=tf field=date_orig}{$list->calender_search('email_log_date_orig',$VAR.email_log_date_orig,'form_field','')}
    {osb f=tf field=account_id}{osb f=html_select_account name='email_log_account_id' default=$VAR.email_log_account_id}
    {osb f=tf field=email}  {t}"%" for partial match{/t}
    {osb f=tf field=subject}  {t}"%" for partial match{/t}
    {osb f=tf field=message}  {t}"%" for partial match{/t}
    {osb f=tf field=urgent}{$list->bool('email_log_urgent','all')}
    {osb f=tf field=userread}{$list->bool('email_log_userread','all')}
    +
    +
    -
    - - - - -
    -
    -
    - -{ $block->display("core:saved_searches") } -{ $block->display("core:recent_searches") } + + + {$block->display('core:saved_searches')} + {$block->display('core:recent_searches')} {/if} diff --git a/themes/default/blocks/email_log/search_show.tpl b/themes/default/blocks/email_log/search_show.tpl index 63a4a45b..2e593f28 100644 --- a/themes/default/blocks/email_log/search_show.tpl +++ b/themes/default/blocks/email_log/search_show.tpl @@ -1,105 +1,12 @@ +{assign var=meth value=':'|explode:$VAR._page} + - -{$method->exe("email_log","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - - {foreach from=$email_log item=record} - - - - - - - - - {literal} - - {/literal} - {/foreach} - -
      - {literal} - - {/literal} - {literal} - - {/literal} - {literal} - - {/literal}
    -  {$list->date_time($record.date_orig)} {$record.email} {$record.subject}
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    + {include file='file:../core/search_show_pre.tpl'} + {$method->exe_noauth($meth.0,'tpl_search_show',$search_show)} + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/email_log/user_list.tpl b/themes/default/blocks/email_log/user_list.tpl index f5922a07..0b69c9ad 100644 --- a/themes/default/blocks/email_log/user_list.tpl +++ b/themes/default/blocks/email_log/user_list.tpl @@ -1,50 +1,46 @@ -{ $method->exe("email_log","user_list") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{assign var=meth value=':'|explode:$VAR._page} + -{if $email_log} - - - - -
    - - - - - - - -
    -
    - {translate module=email_log}title_user_list{/translate} -
    -
    - - - - - - - {foreach from=$email_log item=log} - - - - - - {/foreach} -
    {translate module=email_log} - field_date_orig - {/translate}{translate module=email_log} - field_email - {/translate}{translate module=email_log} - field_subject - {/translate}
    {$list->date_time($log.date_orig)}{$log.email} - - {if $log.userread != 1 AND $log.urgent==1}{/if} - {$log.subject} - {if $log.userread != 1 AND $log.urgent==1}{/if} - -
    -
    -
    +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + + {if $email_log} + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + {foreach from=$email_log item=log} + + + + + + {/foreach} +
    {osb f=tf field=date_orig}{osb f=tf field=email}{osb f=tf field=subject}
    {$list->date_time($log.date_orig)}{$log.email} + + {if $log.userread != 1 AND $log.urgent==1}{/if} + {$log.subject} + {if $log.userread != 1 AND $log.urgent==1}{/if} + +
    +
    +
    + {/if} {/if} -{/if} \ No newline at end of file diff --git a/themes/default/blocks/email_log/user_view.tpl b/themes/default/blocks/email_log/user_view.tpl index 1078d70c..e81900eb 100644 --- a/themes/default/blocks/email_log/user_view.tpl +++ b/themes/default/blocks/email_log/user_view.tpl @@ -1,47 +1,38 @@ +{assign var=meth value=':'|explode:$VAR._page} + + {if $email_log} - - - - -
    - - - - - - - -
    -
    - {translate module=email_log}title_user_view{/translate} -
    -
    - - - - - - - - - - - - - - - - - -
    {translate module=email_log} - field_date_orig - {/translate}{$list->date_time($email_log.date_orig)}
    {translate module=email_log} - field_email - {/translate}{$email_log.email}
    {translate module=email_log} - field_subject - {/translate}{$email_log.subject}
    {translate module=email_log} - field_message - {/translate}
    -
    -
    -{/if} \ No newline at end of file + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + +
    {osb f=tf field=date_orig}{$list->date_time($email_log.date_orig)}
    {osb f=tf field=email}{$email_log.email}
    {osb f=tf field=subject}{$email_log.subject}
    {osb f=tf field=message}
    +
    +
    +{/if} diff --git a/themes/default/blocks/email_log/view.tpl b/themes/default/blocks/email_log/view.tpl index 0a25482d..3fe7cef6 100644 --- a/themes/default/blocks/email_log/view.tpl +++ b/themes/default/blocks/email_log/view.tpl @@ -1,111 +1,62 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("email_log","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} -{literal} - - -{/literal} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - -{foreach from=$email_log item=email_log} + +
    - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - - - - - - -
    - - - - - - - -
    -
    - {translate module=email_log}title_view{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=email_log} - field_account_id - {/translate}{html_select_account name="email_log_account_id" default=$email_log.account_id}
    {translate module=email_log} - field_date_orig - {/translate}{$list->date_time($email_log.date_orig)}
    {translate module=email_log} - field_email - {/translate}{$email_log.email}
    {translate module=email_log} - field_subject - {/translate} - {$email_log.subject}
    {translate module=email_log} - field_message - {/translate}
     
    -
    -
    - - - - -
    - {/foreach} + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/view_td_delete.tpl'} + +
    {osb f=tf field=account_id}{osb f=html_select_account name='email_log_account_id' default=$record.account_id}
    {osb f=tf field=date_orig}{$list->date_time($record.date_orig)}
    {osb f=tf field=email}{$record.email}
    {osb f=tf field=subject}{$record.subject}
    {osb f=tf field=message}
     
    +
    +
    + + {include file='file:../core/view_post.tpl'} + {/if} diff --git a/themes/default/blocks/email_queue/add.tpl b/themes/default/blocks/email_queue/add.tpl index 12f2abcc..dafeeb0e 100644 --- a/themes/default/blocks/email_queue/add.tpl +++ b/themes/default/blocks/email_queue/add.tpl @@ -1,141 +1,67 @@ - +{assign var=meth value=':'|explode:$VAR._page} + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} -
    -{$COOKIE_FORM} - - - - -
    - - - - - - - -
    -
    - {translate module=email_queue}title_add{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=email_queue} - field_date_orig - {/translate} - {$list->date_time("")} -
    - {translate module=email_queue} - field_date_last - {/translate} - {$list->date_time("")} -
    - {translate module=email_queue} - field_status - {/translate} - { $list->bool("email_queue_status", $VAR.email_queue_status, "form_menu") } -
    - {translate module=email_queue} - field_account_id - {/translate} - {html_select_account name="email_queue_account_id" default=$VAR.email_queue_account_id} -
    - {translate module=email_queue} - field_email_template - {/translate} - -
    - {translate module=email_queue} - field_sql1 - {/translate} - -
    - {translate module=email_queue} - field_sql2 - {/translate} - -
    - {translate module=email_queue} - field_sql3 - {/translate} - -
    - {translate module=email_queue} - field_sql4 - {/translate} - -
    - {translate module=email_queue} - field_sql5 - {/translate} - -
    - {translate module=email_queue} - field_var - {/translate} - -
    - - - - -
    -
    -
    -
    +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/add_tr_submit.tpl'} +
    {osb f=tf field=status}{$list->bool('email_queue_status',$VAR.email_queue_status,'form_menu')}
    {osb f=tf field=account_id}{osb f=autoselect module=account return=id field=email_queue_account_id default=$VAR.email_queue_account_id}
    {osb f=tf field=email_template}
    {osb f=tf field=sql1}
    {osb f=tf field=sql2}
    {osb f=tf field=sql3}
    {osb f=tf field=sql4}
    {osb f=tf field=sql5}
    {osb f=tf field=var}
    +
    +
    + +
    diff --git a/themes/default/blocks/email_queue/search_form.tpl b/themes/default/blocks/email_queue/search_form.tpl index 30b6dc49..c8b75e17 100644 --- a/themes/default/blocks/email_queue/search_form.tpl +++ b/themes/default/blocks/email_queue/search_form.tpl @@ -1,108 +1,53 @@ - -{ $method->exe("email_queue","search_form") } -{ if ($method->result == FALSE) } - { $block->display("core:method_error") } +{assign var=meth value=':'|explode:$VAR._page} + +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} -
    - {$COOKIE_FORM} - - - - -
    - - - - - - - - - -
    -
    - {translate module=email_queue}title_search{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - +
    - {translate module=email_queue} - field_date_orig - {/translate} - { $list->calender_search("email_queue_date_orig", $VAR.email_queue_date_orig, "form_field", "") } -
    - {translate module=email_queue} - field_date_last - {/translate} - { $list->calender_search("email_queue_date_last", $VAR.email_queue_date_last, "form_field", "") } -
    - {translate module=email_queue} - field_status - {/translate} - { $list->bool("email_queue_status", "all", "form_menu") } -
    - {translate module=email_queue} - field_account_id - {/translate} - {html_select_account name="email_queue_account_id" default=$VAR.email_queue_account_id} -
    - {translate module=email_queue} - field_email_template - {/translate} -   {translate}search_partial{/translate} -
    {translate}search_results_per{/translate} - -
    {translate}search_order_by{/translate} - -
    + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/search_post.tpl'} +
    {osb f=tf field=date_orig}{$list->calender_search('email_queue_date_orig',$VAR.email_queue_date_orig,'form_field','')}
    {osb f=tf field=date_last}{$list->calender_search('email_queue_date_last',$VAR.email_queue_date_last,'form_field','')}
    {osb f=tf field=status}{$list->bool('email_queue_status','all')}
    {osb f=tf field=account_id}{osb f=html_select_account name='email_queue_account_id' default=$VAR.email_queue_account_id}
    {osb f=tf field=email_template}  {t}"%" for partial match{/t}
    +
    +
    -
    - - - - -
    -
    -
    - -{ $block->display("core:saved_searches") } -{ $block->display("core:recent_searches") } + + + {$block->display('core:saved_searches')} + {$block->display('core:recent_searches')} {/if} diff --git a/themes/default/blocks/email_queue/search_show.tpl b/themes/default/blocks/email_queue/search_show.tpl index 32f3229a..2e593f28 100644 --- a/themes/default/blocks/email_queue/search_show.tpl +++ b/themes/default/blocks/email_queue/search_show.tpl @@ -1,119 +1,12 @@ +{assign var=meth value=':'|explode:$VAR._page} + - -{$method->exe("email_queue","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - - - {foreach from=$email_queue item=record} - - - - - - - - - - - {literal} - - {/literal} - {/foreach} - - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -
    - -  {$list->date_time($record.date_orig)} {if $record.status == "1"}{translate}true{/translate}{else}{translate}false{/translate}{/if} {$record.account_id} {$record.email_template}
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    + {include file='file:../core/search_show_pre.tpl'} + {$method->exe_noauth($meth.0,'tpl_search_show',$search_show)} + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/email_queue/view.tpl b/themes/default/blocks/email_queue/view.tpl index a2c8e2be..cc5eccfe 100644 --- a/themes/default/blocks/email_queue/view.tpl +++ b/themes/default/blocks/email_queue/view.tpl @@ -1,191 +1,83 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("email_queue","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} -{literal} - - -{/literal} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - -{foreach from=$email_queue item=email_queue} + +
    - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - - -{$COOKIE_FORM} - - - - -
    - - - - - - - -
    -
    - {translate module=email_queue}title_view{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=email_queue} - field_date_orig - {/translate} - {$list->date_time($email_queue.date_orig)} -
    - {translate module=email_queue} - field_date_last - {/translate} - {$list->date_time($email_queue.date_last)} -
    - {translate module=email_queue} - field_status - {/translate} - { $list->bool("email_queue_status", $email_queue.status, "form_menu") } -
    - {translate module=email_queue} - field_account_id - {/translate} - {html_select_account name="email_queue_account_id" default=$email_queue.account_id} -
    - {translate module=email_queue} - field_email_template - {/translate} - -
    - {translate module=email_queue} - field_sql1 - {/translate} - -
    - {translate module=email_queue} - field_sql2 - {/translate} - -
    - {translate module=email_queue} - field_sql3 - {/translate} - -
    - {translate module=email_queue} - field_sql4 - {/translate} - -
    - {translate module=email_queue} - field_sql5 - {/translate} - -
    - {translate module=email_queue} - field_var - {/translate} - -
    - - - - - -
    - - - -
    -
    -
    -
    - - - - -
    - {/foreach} + + + + +
    + + + + + + + + {include file='file:../core/view_tr_submit_delete.tpl'} +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=date_orig}{$list->date_time($record.date_orig)}
    {osb f=tf field=date_last}{$list->date_time($record.date_last)}
    {osb f=tf field=status}{$list->bool('email_queue_status',$record.status)}
    {osb f=tf field=account_id}{osb f=html_select_account name='email_queue_account_id' default=$record.account_id}
    {osb f=tf field=email_template}
    {osb f=tf field=sql1}
    {osb f=tf field=sql2}
    {osb f=tf field=sql3}
    {osb f=tf field=sql4}
    {osb f=tf field=sql5}
    {osb f=tf field=var}
    +
    +
    + + {include file='file:../core/view_post.tpl'} + {/if} diff --git a/themes/default/blocks/email_template/add.tpl b/themes/default/blocks/email_template/add.tpl index 38eb3363..015d6098 100644 --- a/themes/default/blocks/email_template/add.tpl +++ b/themes/default/blocks/email_template/add.tpl @@ -1,119 +1,63 @@ - +{assign var=meth value=':'|explode:$VAR._page} + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=email_template} - title_add - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=email_template} - field_name - {/translate} - - -
    - {translate module=email_template} - field_setup_email_id - {/translate} - - { $list->menu("", "email_template_setup_email_id", "setup_email", "name", $VAR.email_template_setup_email_id, "form_menu") } -
    - {translate module=email_template} - field_priority - {/translate} - - { $list->bool("email_template_priority", $VAR.email_template_priority, "form_menu") } -
       
    - {translate module=email_template} - field_sql_1 - {/translate} - - {translate module=email_template} - field_sql_2 - {/translate} -
    - - - -
    - {translate module=email_template} - field_sql_3 - {/translate} - - {translate module=email_template} - field_notes - {/translate} -
    - - - -
    - - - - - - -
    -
    -
    -
    +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/add_tr_submit.tpl'} +
    {osb f=tf field=name}
    {osb f=tf field=setup_email_id}{$list->menu('','email_template_setup_email_id','setup_email','name',$VAR.email_template_setup_email_id,'form_menu')}
    {osb f=tf field=priority}{$list->bool('email_template_priority',$VAR.email_template_priority,'form_menu')}
      
    {osb f=tf field=sql_1}{osb f=tf field=sql_2}
    {osb f=tf field=sql_3}{osb f=tf field=notes}
    +
    +
    + +
    diff --git a/themes/default/blocks/email_template/search_show.tpl b/themes/default/blocks/email_template/search_show.tpl index afeecb84..2e593f28 100644 --- a/themes/default/blocks/email_template/search_show.tpl +++ b/themes/default/blocks/email_template/search_show.tpl @@ -1,117 +1,12 @@ +{assign var=meth value=':'|explode:$VAR._page} + - -{$method->exe("email_template","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - {foreach from=$email_template item=record} - - - - - - - {literal} - - {/literal} - {/foreach} - -
      - {literal} - - {/literal} - - {literal} - - {/literal} -  
    - -   - {$record.name} -   - {if $record.priority == "1"} - {translate} - true - {/translate} - {else} - {translate} - false - {/translate} - {/if} -   - {if $record.status == "1"} - - {else} - - {/if} -
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    + {include file='file:../core/search_show_pre.tpl'} + {$method->exe_noauth($meth.0,'tpl_search_show',$search_show)} + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/email_template/view.tpl b/themes/default/blocks/email_template/view.tpl index a120ba73..f29bf9d9 100644 --- a/themes/default/blocks/email_template/view.tpl +++ b/themes/default/blocks/email_template/view.tpl @@ -1,210 +1,104 @@ -{ $method->exe("email_template","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{assign var=meth value=':'|explode:$VAR._page} + -{literal} - - -{/literal} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} - -{foreach from=$email_template item=email_template} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - -{if $form_validation} - { $block->display("core:alert_fields") } + +
    + + + + + +
    + + + + + + + + + + + {include file='file:../core/view_tr_submit_delete.tpl'} +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=name}{$record.name}
    {osb f=tf field=setup_email_id}{$list->menu('','email_template_setup_email_id','setup_email','name',$record.setup_email_id,'form_menu')}
    {osb f=tf field=status}{$list->bool('email_template_status',$record.status)}
    {osb f=tf field=priority}{$list->bool('email_template_priority',$record.priority)}
    {osb f=tf field=sql_1}{osb f=tf field=sql_2}
    {osb f=tf field=sql_3}{osb f=tf field=notes}
    +
    + + + + + +
    {t}View Translations for this Email Template{/t}
    +
    +
    + + {include file='file:../core/view_post.tpl'} +
    + + + + {/if} - -
    - - - - -
    - - - - - - - - - - -
    -
    - {translate module=email_template} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=email_template} - field_name - {/translate} - - {$email_template.name} -
    - {translate module=email_template} - field_setup_email_id - {/translate} - - { $list->menu("", "email_template_setup_email_id", "setup_email", "name", $email_template.setup_email_id, "form_menu") } -
    - {translate module=email_template} - field_status - {/translate} - - { $list->bool("email_template_status", $email_template.status,"form_menu") } -
    - {translate module=email_template} - field_priority - {/translate} - - { $list->bool("email_template_priority", $email_template.priority, "form_menu") } -
    - {translate module=email_template} - field_sql_1 - {/translate} - - {translate module=email_template} - field_sql_2 - {/translate} -
    - - - -
    - {translate module=email_template} - field_sql_3 - {/translate} - - {translate module=email_template} - field_notes - {/translate} -
    - - - -
    - - -
    - -
    -
    -
    - - - - - -
    - {translate module=email_template} - view_translations - {/translate} - - -
    -
    -
    - - - - -
    -
    - -
    - -{/foreach} -{/if} -{literal} - -{/literal} diff --git a/themes/default/blocks/email_template_translate/add.tpl b/themes/default/blocks/email_template_translate/add.tpl index e99e65ea..3a2e28b4 100644 --- a/themes/default/blocks/email_template_translate/add.tpl +++ b/themes/default/blocks/email_template_translate/add.tpl @@ -1,161 +1,95 @@ -{literal} - - -{/literal} +{assign var=meth value=':'|explode:$VAR._page} + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} + + + + -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=email_template_translate} - title_add - {/translate} -
    -
    - - - - - - - - - - - - - -
    - {translate module=email_template_translate} - field_email_template_id - {/translate} - - {if $VAR.id != ""} - { $list->menu("", "email_template_translate_email_template_id", "email_template", "name", $VAR.id, "form_menu") } - {else} - { $list->menu("", "email_template_translate_email_template_id", "email_template", "name", $VAR.email_template_translate_email_template_id, "form_menu") } - {/if} -
    - {translate module=email_template_translate} - field_language_id - {/translate} - - {if $VAR.email_template_translate_language_id == ""} - { $list->menu_files("", "email_template_translate_language_id", $smarty.const.DEFAULT_LANGUAGE, "language", "", "_core.xml", "form_menu") } - {else} - { $list->menu_files("", "email_template_translate_language_id", $VAR.email_template_translate_language_id, "language", "", "_core.xml", "form_menu") } - {/if} -
    - {translate module=email_template_translate} - field_subject - {/translate} - - -
    -
    - - - - - - - - - - - - - - - - - - - -
    - {translate module=email_template_translate} - field_message_text - {/translate} -
    - -
     
    - {translate module=email_template_translate} - field_message_html - {/translate} -
    - -
    - - - - - - - - - -
    - - - - -  
    -

    Site Name
    - Site E-mail
    - URL
    - SSL URL
    - Current Date

    -

    Variable (replace "variable")

    -

    Account field (replace "field")

    -
    -

    %site_name%
    - %site_email%
    - %url%
    - %ssl_url%
    - %date%

    -

    %var_variable%
    -
    - %acct_field%

    -
    -
    -

     

    -
    -
    -
    +
    + + + + + +
    + + + + + + + + + + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + +
    {osb f=tf field=email_template_id} + {if $VAR.id != ''} + {$list->menu('','email_template_translate_email_template_id','email_template','name',$VAR.id,'form_menu')} + {else} + {$list->menu('','email_template_translate_email_template_id','email_template','name',$VAR.email_template_translate_email_template_id,'form_menu')} + {/if} +
    {osb f=tf field=language_id} + {if $VAR.email_template_translate_language_id == ''} + {$list->menu_files('','email_template_translate_language_id',$smarty.const.DEFAULT_LANGUAGE,'language','','_core.xml','form_menu')} + {else} + {$list->menu_files('','email_template_translate_language_id',$VAR.email_template_translate_language_id,'language','','_core.xml','form_menu')} + {/if} +
    {osb f=tf field=subject}
    +
    + + + + + + + + + + + + + + + + +
    {osb f=tf field=message_text}
     
    {osb f=tf field=message_html}
    +
    + + + + + + {include file='file:../core/add_tr_submit.tpl'} +
      
    +
    + {include file='file:fields.tpl'} +
    +
    + +
    diff --git a/themes/default/blocks/email_template_translate/fields.tpl b/themes/default/blocks/email_template_translate/fields.tpl new file mode 100644 index 00000000..f18c546c --- /dev/null +++ b/themes/default/blocks/email_template_translate/fields.tpl @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf module=setup field=site_name}%site_name%
    {osb f=tf module=setup field=site_email}%site_email%
    {osb f=tf module=setup field=nonssl_url}%url%
    {osb f=tf module=setup field=ssl_url}%ssl_url%
    {t}Current Date{/t}%date%
    {t}Variable (replace "variable"){/t}%var_variable%
    {t}Account Field (replace "field"){/t}%acct_field%
    {t}SQL Query Value (replace "field"){/t}%sql[1|2|3]_field%
    diff --git a/themes/default/blocks/email_template_translate/search_show.tpl b/themes/default/blocks/email_template_translate/search_show.tpl index 93f32e71..2e593f28 100644 --- a/themes/default/blocks/email_template_translate/search_show.tpl +++ b/themes/default/blocks/email_template_translate/search_show.tpl @@ -1,120 +1,12 @@ +{assign var=meth value=':'|explode:$VAR._page} + - -{$method->exe("email_template_translate","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - - {foreach from=$email_template_translate item=record} - - - - - - - - - - - - - {literal} - - {/literal} - {/foreach} - - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -
    - -   - {$record.email_template_id} -   - {$record.language_id} -   - {$record.subject} -
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    + {include file='file:../core/search_show_pre.tpl'} + {$method->exe_noauth($meth.0,'tpl_search_show',$search_show)} + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/email_template_translate/view.tpl b/themes/default/blocks/email_template_translate/view.tpl index 5b421361..d8123dbb 100644 --- a/themes/default/blocks/email_template_translate/view.tpl +++ b/themes/default/blocks/email_template_translate/view.tpl @@ -1,199 +1,87 @@ -{literal} - - -{/literal} +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("email_template_translate","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} -{literal} - - -{/literal} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - -{foreach from=$email_template_translate item=email_template_translate} + + + - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=email_template_translate} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - -
    - {translate module=email_template_translate} - field_email_template_id - {/translate} - - { $list->menu("", "email_template_translate_email_template_id", "email_template", "name", $email_template_translate.email_template_id, "form_menu") } -
    - {translate module=email_template_translate} - field_language_id - {/translate} - - { $list->menu_files("", "email_template_translate_language_id", $email_template_translate.language_id, "language", "", "_core.xml", "form_menu") } -
    - {translate module=email_template_translate} - field_subject - {/translate} - - -
    -
    - - - - - - - - - - - - - - - - - - - -
    - {translate module=email_template_translate} - field_message_text - {/translate} -
    - -
     
    - {translate module=email_template_translate} - field_message_html - {/translate} -
    - -
    - - - - - - - - - -
    - - -
    - -
    -
    -

    Site Name
    - Site E-mail
    - URL
    - SSL URL
    - Current Date

    -

    Variable (replace "variable")

    -

    Account field (replace "field")

    -
    -

    %site_name%
    - %site_email%
    - %url%
    - %ssl_url%
    - %date%

    -

    %var_variable%
    -
    - %acct_field%

    -
    -
    -
    -
    -
    - - - - -
    - {/foreach} + +
    + + + + + +
    + + + + + + + + + + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + +
    {osb f=tf field=email_template_id}{$list->menu('','email_template_translate_email_template_id','email_template','name',$record.email_template_id,'form_menu')}
    {osb f=tf field=language_id}{$list->menu_files('','email_template_translate_language_id',$record.language_id,'language','','_core.xml','form_menu')}
    {osb f=tf field=subject}
    +
    + + + + + + + + + + + + + + + + +
    {osb f=tf field=message_text}
     
    {osb f=tf field=message_html}
    +
    + + {include file='file:../core/view_tr_submit_delete.tpl'} +
    +
    + {include file='file:fields.tpl'} +
    +
    + + {include file='file:../core/view_post.tpl'} +
    {/if} diff --git a/themes/default/blocks/faq/add.tpl b/themes/default/blocks/faq/add.tpl index a27dc829..867cf77f 100644 --- a/themes/default/blocks/faq/add.tpl +++ b/themes/default/blocks/faq/add.tpl @@ -1,95 +1,61 @@ - +{assign var=meth value=':'|explode:$VAR._page} + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} -
    -{$COOKIE_FORM} - - - - -
    - - - - - - - -
    -
    - {translate module=faq}title_add{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=faq} - field_sort_order - {/translate} - - -
    - {translate module=faq} - field_faq_category_id - {/translate} - - { $list->menu("", "faq_faq_category_id", "faq_category", "name", $VAR.faq_faq_category_id, "form_menu") } -
    - {translate module=faq} - field_status - {/translate} - - {if $VAR.faq_status != ""} - { $list->bool("faq_status", $VAR.faq_status, "form_menu") } - {else} - { $list->bool("faq_status", "1", "form_menu") } - {/if} -
    {translate module=faq} -field_name{/translate} - - -
    {translate module=faq_translate} -field_question - {/translate}
    {translate module=faq_translate} -field_answer - {/translate}
    - - - - -
    -
    -
    -
    +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/add_tr_submit.tpl'} +
    {osb f=tf field=sort_order}
    {osb f=tf field=faq_category_id}{$list->menu('','faq_faq_category_id','faq_category','name',$VAR.faq_faq_category_id,'form_menu')}
    {osb f=tf field=status} + {if $VAR.faq_status != ''} + {$list->bool('faq_status',$VAR.faq_status,'form_menu')} + {else} + {$list->bool('faq_status','1','form_menu')} + {/if} +
    {osb f=tf field=name}
    {osb f=tf field=question}
    {osb f=tf field=answer}
    +
    +
    + +
    diff --git a/themes/default/blocks/faq/faq.tpl b/themes/default/blocks/faq/faq.tpl index eff6c9a9..8c4842a3 100644 --- a/themes/default/blocks/faq/faq.tpl +++ b/themes/default/blocks/faq/faq.tpl @@ -1,100 +1,97 @@ - - - + + + {literal} - - {/literal} - +
    - - - -
    - - -
    -{ $method->exe("faq","faq_categories")} -{if faq_category_list} -

    {translate module=faq}faqs{/translate}

    -
      - {foreach from=$faq_category_list item=record key=key} -
    • - {$record.name} -
    • - {/foreach} -
    -{/if} -
    - - -{if $VAR.id} - {* show specified faq *} - -{elseif $VAR.category_id} - {* show specific faq category *} - -{elseif $VAR.search} - {* run a search *} - -{/if} - -
    \ No newline at end of file diff --git a/themes/default/blocks/faq/menu.tpl b/themes/default/blocks/faq/menu.tpl index d64b7af5..de9cb13f 100644 --- a/themes/default/blocks/faq/menu.tpl +++ b/themes/default/blocks/faq/menu.tpl @@ -1,30 +1,26 @@ -{ $method->exe("faq_category","category_list")} -{if $faq_category_list_display == true} - - - - - -
    +{assign var=meth value=':'|explode:$VAR._page} + + +{$method->exe('faq_category','category_list')} +{if ($method->result == false)} + {$block->display('core:method_error')} +{/if} + +{if $faq_category_list_display == true} + + + + + {/if} diff --git a/themes/default/blocks/faq/search_form.tpl b/themes/default/blocks/faq/search_form.tpl index 80e9d1ac..00662c0d 100644 --- a/themes/default/blocks/faq/search_form.tpl +++ b/themes/default/blocks/faq/search_form.tpl @@ -1,122 +1,58 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("faq","search_form") } -{ if ($method->result == FALSE) } - { $block->display("core:method_error") } +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} -
    - {$COOKIE_FORM} - - - - -
    - - - - - - - - - - - - - - - - - - - - -
    -
    - {translate module=faq}title_search{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +
    - {translate module=faq} - field_name - {/translate} -   {translate}search_partial{/translate} -
    - {translate module=faq} - field_faq_category_id - {/translate} - - { $list->menu("", "faq_faq_category_id", "faq_category", "name", "all", "form_menu") } -
    - {translate module=faq} - field_status - {/translate} - { $list->bool("faq_status", "all", "form_menu") } -
    - {translate module=faq} - field_date_orig - {/translate} - { $list->calender_search("faq_date_orig", $VAR.faq_date_orig, "form_field", "") } -
    - {translate module=faq} - field_date_last - {/translate} - { $list->calender_search("faq_date_last", $VAR.faq_date_last, "form_field", "") } -
    - {translate module=faq} - field_date_expire - {/translate} - { $list->calender_search("faq_date_expire", $VAR.faq_date_expire, "form_field", "") } -
    + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/search_post.tpl'} +
    {osb f=tf field=name}  {t}"%" for partial match{/t}
    {osb f=tf field=faq_category_id}{$list->menu('','faq_faq_category_id','faq_category','name','','form_menu',true)}
    {osb f=tf field=status}{$list->bool('faq_status','all','form_menu')}
    {osb f=tf field=date_orig}{$list->calender_search('faq_date_orig',$VAR.faq_date_orig,'form_field','')}
    {osb f=tf field=date_last}{$list->calender_search('faq_date_last',$VAR.faq_date_last,'form_field','')}
    {osb f=tf field=date_expire}{$list->calender_search('faq_date_expire',$VAR.faq_date_expire,'form_field','')}
    +
    +
    - -
    {translate}search_results_per{/translate} - -
    {translate}search_order_by{/translate} - -
    - - - - -
    -
    -
    - -{ $block->display("core:saved_searches") } -{ $block->display("core:recent_searches") } + + + {$block->display('core:saved_searches')} + {$block->display('core:recent_searches')} {/if} diff --git a/themes/default/blocks/faq/search_show.tpl b/themes/default/blocks/faq/search_show.tpl index 8a0af2c1..2e593f28 100644 --- a/themes/default/blocks/faq/search_show.tpl +++ b/themes/default/blocks/faq/search_show.tpl @@ -1,109 +1,12 @@ +{assign var=meth value=':'|explode:$VAR._page} + - -{$method->exe("faq","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - {foreach from=$faq item=record} - - - - - - - {literal} - - {/literal} - {/foreach} - -
      - {literal} - - {/literal} - - {literal} - - {/literal} -  
    - -   - {$record.name} -   - {$record.faq_category_id} -   - {if $record.status == "1"} - - {else} - - {/if} -
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    + {include file='file:../core/search_show_pre.tpl'} + {$method->exe_noauth($meth.0,'tpl_search_show',$search_show)} + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/faq/view.tpl b/themes/default/blocks/faq/view.tpl index bc6cb180..0ec59b73 100644 --- a/themes/default/blocks/faq/view.tpl +++ b/themes/default/blocks/faq/view.tpl @@ -1,216 +1,97 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("faq","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} -{literal} - - -{/literal} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - -{foreach from=$faq item=faq} + +
    - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} + + + + +
    + + + + + + + + {include file='file:../core/view_tr_submit_delete.tpl'} + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=date_orig}{$list->date_time($record.date_orig)}
    {osb f=tf field=date_last}{$list->date_time($record.date_last)}
    {osb f=tf field=sort_order}
    {osb f=tf field=date_start}{$list->calender_view('faq_date_start',$record.date_start,'form_field')}
    {osb f=tf field=date_expire}{$list->calender_view('faq_date_expire',$record.date_expire,'form_field')}
    {osb f=tf field=faq_category_id}{$list->menu('','faq_faq_category_id','faq_category','name',$record.faq_category_id,'form_menu')}
    {osb f=tf field=status}{$list->bool('faq_status',$record.status,'form_menu')}
    {osb f=tf field=name}
    +
    + + + + + +
    {t}View all translations for this FAQ{/t}{t}Add a translations for this FAQ{/t}
    +
    +
    - - -{$COOKIE_FORM} - - - - -
    - - - - - - - - - - -
    -
    - {translate module=faq} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=faq} - field_date_orig - {/translate} - - {$list->date_time($faq.date_orig)} -
    - {translate module=faq} - field_date_last - {/translate} - - {$list->date_time($faq.date_last)} -
    - {translate module=faq} - field_sort_order - {/translate} - - -
    - {translate module=faq} - field_date_start - {/translate} - - { $list->calender_view("faq_date_start", $faq.date_start, "form_field", $faq.id) } -
    - {translate module=faq} - field_date_expire - {/translate} - - { $list->calender_view("faq_date_expire", $faq.date_expire, "form_field", $faq.id) } -
    - {translate module=faq} - field_faq_category_id - {/translate} - - { $list->menu("", "faq_faq_category_id", "faq_category", "name", $faq.faq_category_id, "form_menu") } -
    - {translate module=faq} - field_status - {/translate} - - { $list->bool("faq_status", $faq.status, "form_menu") } -
    - {translate module=faq} - field_name - {/translate} - - -
    - - - - - -
    - - - -
    -
    -
    - - - - - -
    - {translate module=faq} - view_all - {/translate} - - {translate module=faq} - add_translation - {/translate} -
    -
    -
    - - - - - -
    + {include file='file:../core/view_post.tpl'} + -
    - -
    - - -{literal} - -{/literal} - - {/foreach} - - - - {/if} diff --git a/themes/default/blocks/faq_category/add.tpl b/themes/default/blocks/faq_category/add.tpl index 50e315f8..52653fc0 100644 --- a/themes/default/blocks/faq_category/add.tpl +++ b/themes/default/blocks/faq_category/add.tpl @@ -1,91 +1,51 @@ - +{assign var=meth value=':'|explode:$VAR._page} + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} -
    -{$COOKIE_FORM} - - - - -
    - - - - - - - -
    -
    - {translate module=faq_category}title_add{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=faq_category} - field_group_avail - {/translate} - - { $list->menu_multi($VAR.faq_category_group_avail, 'faq_category_group_avail', 'group', 'name', '', '10', 'form_menu') } -
    - {translate module=faq_category} - field_name - {/translate} - - -
    - {translate module=faq_category} - field_description - {/translate} - - -
    - {translate module=faq_category} - field_status - {/translate} - - { $list->bool("faq_category_status", $VAR.faq_category_status, "form_menu") } -
    - {translate module=faq_category} - field_sort_order - {/translate} - - -
    - - - - -
    -
    -
    -
    +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/add_tr_submit.tpl'} +
    {osb f=tf field=group_avail}{$list->menu_multi($VAR.faq_category_group_avail,'faq_category_group_avail','group','name','','10','form_menu')}
    {osb f=tf field=name}
    {osb f=tf field=description}
    {osb f=tf field=status}{$list->bool('faq_category_status',$VAR.faq_category_status,'form_menu')}
    {osb f=tf field=sort_order}
    +
    +
    + +
    diff --git a/themes/default/blocks/faq_category/faq_category.tpl b/themes/default/blocks/faq_category/faq_category.tpl index c9ad7947..3039edab 100644 --- a/themes/default/blocks/faq_category/faq_category.tpl +++ b/themes/default/blocks/faq_category/faq_category.tpl @@ -1,5 +1,12 @@ -{ $method->exe("faq_category","category_list")} { if ($method->result == FALSE) } { $block->display("core:method_error") } {/if} -{if $faq_category_list_display == true} +{assign var=meth value=':'|explode:$VAR._page} + + +{$method->exe($meth.0,'category_list')} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + + {if $faq_category_list_display == true}
    @@ -28,10 +35,8 @@
    -{else} - -{translate module=faq} - no_pages -{/translate} - + {else} + + {t}Sorry, no pages were found in this category, or your account is not authorized for this category.{/t} + {/if} {/if} diff --git a/themes/default/blocks/faq_category/search_show.tpl b/themes/default/blocks/faq_category/search_show.tpl index e3e87807..2e593f28 100644 --- a/themes/default/blocks/faq_category/search_show.tpl +++ b/themes/default/blocks/faq_category/search_show.tpl @@ -1,119 +1,12 @@ +{assign var=meth value=':'|explode:$VAR._page} + - -{$method->exe("faq_category","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - {foreach from=$faq_category item=record} - - - - - - - {literal} - - {/literal} - {/foreach} - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -
    - -   - {$record.name} -   - {if $record.status == "1"} - {translate} - true - {/translate} - {else} - {translate} - false - {/translate} - {/if} - - {$record.sort_order} -
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    + {include file='file:../core/search_show_pre.tpl'} + {$method->exe_noauth($meth.0,'tpl_search_show',$search_show)} + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/faq_category/view.tpl b/themes/default/blocks/faq_category/view.tpl index 88be0baa..904acb09 100644 --- a/themes/default/blocks/faq_category/view.tpl +++ b/themes/default/blocks/faq_category/view.tpl @@ -1,154 +1,63 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("faq_category","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} -{literal} - - -{/literal} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - -{foreach from=$faq_category item=faq_category} + +
    - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - - -{$COOKIE_FORM} - - - - -
    - - - - - - - -
    -
    - {translate module=faq_category} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=faq_category} - field_date_orig - {/translate} - - {$list->date_time("")} - -
    - {translate module=faq_category} - field_group_avail - {/translate} - - { $list->menu_multi($faq_category.group_avail, 'faq_category_group_avail', 'group', 'name', '', '10', 'form_menu') } -
    - {translate module=faq_category} - field_name - {/translate} - - -
    - {translate module=faq_category} - field_description - {/translate} - - -
    - {translate module=faq_category} - field_status - {/translate} - - { $list->bool("faq_category_status", $faq_category.status, "form_menu") } -
    - {translate module=faq_category} - field_sort_order - {/translate} - - -
    - - - - - -
    - - - -
    -
    -
    -
    - - - - -
    - {/foreach} + + + + +
    + + + + + + + + {include file='file:../core/view_tr_submit_delete.tpl'} +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=date_orig}{$list->date_time($record.date_orig)}
    {osb f=tf field=group_avail}{$list->menu_multi($record.group_avail,'faq_category_group_avail','group','name','','10','form_menu')}
    {osb f=tf field=name}
    {osb f=tf field=description}
    {osb f=tf field=status}{$list->bool('faq_category_status',$record.status,'form_menu')}
    {osb f=tf field=sort_order}
    +
    +
    + + {include file='file:../core/view_post.tpl'} + {/if} diff --git a/themes/default/blocks/faq_translate/add.tpl b/themes/default/blocks/faq_translate/add.tpl index 0784727c..c4aa53c5 100644 --- a/themes/default/blocks/faq_translate/add.tpl +++ b/themes/default/blocks/faq_translate/add.tpl @@ -1,95 +1,67 @@ -{literal} - - -{/literal} +{assign var=meth value=':'|explode:$VAR._page} + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} + + + -
    -{$COOKIE_FORM} - - - - -
    - - - - - - - -
    -
    - {translate module=faq_translate} - title_add - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=faq_translate} - field_faq_id - {/translate} - - {if $VAR.id == ""} - { $list->menu("", "faq_translate_faq_id", "faq", "name", $VAR.faq_translate_faq_id, "form_menu") } - {else} - { $list->menu("", "faq_translate_faq_id", "faq", "name", $VAR.id, "form_menu") } - {/if} -
    - {translate module=faq_translate} - field_language_id - {/translate} - - {if $VAR.faq_translate_language_id == ""} - { $list->menu_files("", "faq_translate_language_id", $smarty.const.DEFAULT_LANGUAGE, "language", "", "_core.xml", "form_menu") } - {else} - { $list->menu_files("", "faq_translate_language_id", $VAR.faq_translate_language_id, "language", "", "_core.xml", "form_menu") } - {/if} -
    - {translate module=faq_translate} - field_question - {/translate} - - -
    {translate module=faq_translate} -field_answer -{/translate}
     
    -

    - - - - -

    -
    -
    + + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + {include file='file:../core/add_tr_submit.tpl'} +
    {osb f=tf field=faq_id} + {if $VAR.id == ''} + {$list->menu('','faq_translate_faq_id','faq','name',$VAR.faq_translate_faq_id,'form_menu')} + {else} + {$list->menu('','faq_translate_faq_id','faq','name',$VAR.id,'form_menu')} + {/if} +
    {osb f=tf field=language_id} + {if $VAR.faq_translate_language_id == ''} + {$list->menu_files('','faq_translate_language_id',$smarty.const.DEFAULT_LANGUAGE,'language','','_core.xml','form_menu')} + {else} + {$list->menu_files('','faq_translate_language_id',$VAR.faq_translate_language_id,'language','','_core.xml','form_menu')} + {/if} +
    {osb f=tf field=question}
    {osb f=tf field=answer}
    +
    +
    +
    diff --git a/themes/default/blocks/faq_translate/search_show.tpl b/themes/default/blocks/faq_translate/search_show.tpl index 853a8833..ce002a02 100644 --- a/themes/default/blocks/faq_translate/search_show.tpl +++ b/themes/default/blocks/faq_translate/search_show.tpl @@ -1,120 +1,12 @@ +{assign var=meth value=':'|explode:$VAR._page} + - -{$method->exe("faq_translate","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - - {foreach from=$faq_translate item=record} - - - - - - - - - - - - - {literal} - - {/literal} - {/foreach} - - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -
    - -   - {$record.faq_id} -   - {$record.language_id} -   - {$record.question|truncate:"40"} -
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    + {include file='file:../core/search_show_pre.tpl'} + {$method->exe_noauth($meth.0,'tpl_search_show',$search_show)} + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/faq_translate/view.tpl b/themes/default/blocks/faq_translate/view.tpl index cdb279f8..66cbe5d1 100644 --- a/themes/default/blocks/faq_translate/view.tpl +++ b/themes/default/blocks/faq_translate/view.tpl @@ -1,136 +1,63 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("faq_translate","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} -{literal} - - - - + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} + + -{/literal} + +
    - -{foreach from=$faq_translate item=faq_translate} + + + + +
    + + + + + + + + {include file='file:../core/view_tr_submit_delete.tpl'} +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + +
    {translate module=faq_translate}field_faq_id{/translate}{$list->menu('','faq_translate_faq_id','faq','name',$record.faq_id,'form_menu')}
    {translate module=faq_translate}field_language_id{/translate}{$list->menu_files('','faq_translate_language_id',$record.language_id,'language','','_core.xml','form_menu')}
    {translate module=faq_translate}field_question{/translate}
    {translate module=faq_translate}field_answer{/translate}
    +
    +
    - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - - - - - - -
    - - - - - - - -
    -
    - {translate module=faq_translate} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=faq_translate} - field_faq_id - {/translate} - - { $list->menu("", "faq_translate_faq_id", "faq", "name", $faq_translate.faq_id, "form_menu") } -
    - {translate module=faq_translate} - field_language_id - {/translate} - - { $list->menu_files("", "faq_translate_language_id", $faq_translate.language_id, "language", "", "_core.xml", "form_menu") } -
    - {translate module=faq_translate} - field_question - {/translate} - - -
    {translate module=faq_translate} -field_answer -{/translate}
    - - - - -
    - {translate module=faq_translate} - view_all - {/translate} - - -
    -
    -
    - - - - - -
    - {/foreach} + {include file='file:../core/view_post.tpl'} + {/if} diff --git a/themes/default/blocks/file/add.tpl b/themes/default/blocks/file/add.tpl deleted file mode 100644 index d0e1a4b2..00000000 --- a/themes/default/blocks/file/add.tpl +++ /dev/null @@ -1,163 +0,0 @@ - - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - -
    - {$COOKIE_FORM} - - - - -
    - - - - - - - -
    -
    - {translate module=file}title_add{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=file} - field_file_category_id - {/translate} - - { $list->menu("no", "file_file_category_id", "file_category", "name", $VAR.file_file_category_id, "form_menu") } -
    - {translate module=file} - field_status - {/translate} - - {if $VAR.file_status != ""} - { $list->bool("file_status", $VAR.file_status, "form_menu") } - {else} - { $list->bool("file_status", "1", "form_menu") } - {/if} -
    - {translate module=file} - field_location_type - {/translate} - - - Upload from local computer
    - - Enter URL to file located on the Internet
    - - Select file already on the webserver
    - - - -
    - {translate module=file} - field_description - {/translate} - - -
    - {translate module=file} - field_sort_order - {/translate} - - -
    - {translate module=file} - field_group_avail - {/translate} - - { $list->select_groups($VAR.file_group_avail,"file_group_avail","form_field","10","") } -
    - {translate module=file} - field_date_start - {/translate} - - { $list->calender_add("file_date_start", $VAR.file_date_start, "form_field") } -
    - {translate module=file} - field_date_expire - {/translate} - - { $list->calender_add("file_date_expire", $VAR.file_date_expire, "form_field") } -
    - - - - - - -
    -
    -
    -
    diff --git a/themes/default/blocks/file/download.tpl b/themes/default/blocks/file/download.tpl deleted file mode 100644 index e0a54a5a..00000000 --- a/themes/default/blocks/file/download.tpl +++ /dev/null @@ -1,5 +0,0 @@ -{ $method->exe("file","download") } -{ if ($method->result == FALSE) } -{ $block->display("core:method_error") } -{ /if } - diff --git a/themes/default/blocks/file/file.tpl b/themes/default/blocks/file/file.tpl deleted file mode 100644 index 33cebd11..00000000 --- a/themes/default/blocks/file/file.tpl +++ /dev/null @@ -1,39 +0,0 @@ - - - - -
    - - - - -
    - - - - - - -
    - - - - - - - -
    - -
    - {translate module=file} - menu - {/translate} -
    -
    -
    - -
    -
    -
    -
    -
    \ No newline at end of file diff --git a/themes/default/blocks/file/file_list.tpl b/themes/default/blocks/file/file_list.tpl deleted file mode 100644 index 06a36c21..00000000 --- a/themes/default/blocks/file/file_list.tpl +++ /dev/null @@ -1,19 +0,0 @@ -{ $method->exe("file","category_list")} -{ if ($method->result == FALSE) } { $block->display("core:method_error") } -{/if} -{if $file_category_display == true} -{foreach from=$file_category_results item=record key=key} - - - - -
    - {assign var="desc" value=$record.description} - - - {$record.name} - -
    -{/foreach} -
    -{/if} \ No newline at end of file diff --git a/themes/default/blocks/file/list.tpl b/themes/default/blocks/file/list.tpl deleted file mode 100644 index 55b40bcd..00000000 --- a/themes/default/blocks/file/list.tpl +++ /dev/null @@ -1,72 +0,0 @@ -{ $method->exe("file","file_list")} { if ($method->result == FALSE) } { $block->display("core:method_error") } {/if} -{if $file_display == true} - - - - -
    - - - - - - - -
    - {translate module=file} - available_files - {/translate} -
    - {foreach from=$file_results item=record} - - - - - - - - - -
    - - {$record.name} - - {$record.size|number_format} - KB - - {translate module=file} - download - {/translate} -
    - - {/foreach} -
    -
    -


    - {else} - {translate module=file} - no_files - {/translate} - {/if} -

    - diff --git a/themes/default/blocks/file/menu.tpl b/themes/default/blocks/file/menu.tpl deleted file mode 100644 index a0d9feff..00000000 --- a/themes/default/blocks/file/menu.tpl +++ /dev/null @@ -1,32 +0,0 @@ -{ $method->exe("file","category_list")} -{ if ($method->result == FALSE) } { $block->display("core:method_error") } -{/if} -{if $file_category_display == true} - - - - - -
    -{/if} diff --git a/themes/default/blocks/file/search_form.tpl b/themes/default/blocks/file/search_form.tpl deleted file mode 100644 index b53ef9da..00000000 --- a/themes/default/blocks/file/search_form.tpl +++ /dev/null @@ -1,139 +0,0 @@ - -{ $method->exe("file","search_form") } -{ if ($method->result == FALSE) } - { $block->display("core:method_error") } -{else} - -
    - {$COOKIE_FORM} - - - - -
    - - - - - - - -
    -
    - {translate module=file}title_search{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=file} - field_file_category_id - {/translate} - - { $list->menu("no", "file_file_category_id", "file_category", "name", "all", "form_menu") } -
    - {translate module=file} - field_name - {/translate} - - -    - {translate} - search_partial - {/translate} -
    - {translate module=file} - field_description - {/translate} - - -    - {translate} - search_partial - {/translate} -
    - {translate module=file} - field_status - {/translate} - - { $list->bool("file_status", "all", "form_menu") } -
    - {translate module=file} - field_date_start - {/translate} - - { $list->calender_search("file_date_start", $VAR.file_date_start, "form_field", "") } -
    - {translate module=file} - field_date_expire - {/translate} - - { $list->calender_search("file_date_expire", $VAR.file_date_expire, "form_field", "") } -
    - {translate} - search_results_per - {/translate} - - -
    - {translate} - search_order_by - {/translate} - - -
    - - - - -
    -
    -
    -
    -{ $block->display("core:saved_searches") } -{ $block->display("core:recent_searches") } -{/if} diff --git a/themes/default/blocks/file/search_show.tpl b/themes/default/blocks/file/search_show.tpl deleted file mode 100644 index 1af2a3c7..00000000 --- a/themes/default/blocks/file/search_show.tpl +++ /dev/null @@ -1,115 +0,0 @@ - - -{$method->exe("file","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} -{else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - {foreach from=$file item=record} - - - - - - - - {literal} - - {/literal} - {/foreach} - -
      - {literal} - - {/literal} - - {literal} - - {/literal} -   
    - -   - {$record.name|truncate:"45"} -   - {$record.file_category_id} - - {translate - module=file} - download - {/translate} - - {if $record.status == "1"} -   - {else} - - {/if}
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    -{/if} -{/if} -
    diff --git a/themes/default/blocks/file/view.tpl b/themes/default/blocks/file/view.tpl deleted file mode 100644 index 2f678f0e..00000000 --- a/themes/default/blocks/file/view.tpl +++ /dev/null @@ -1,218 +0,0 @@ - -{ $method->exe("file","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} - -{literal} - - -{/literal} - - -{foreach from=$file item=file} - - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - -
    -{$COOKIE_FORM} - - - - -
    - - - - - - - - - - -
    -
    - {translate module=file} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=file} - field_date_last - {/translate} - - {$list->date_time("")} - -
    - {translate module=file} - field_size - {/translate} - - {$file.size} -
    - {translate module=file} - field_type - {/translate} - - {$file.type} -
    - {translate module=file} - field_file_category_id - {/translate} - - { $list->menu("no", "file_file_category_id", "file_category", "name", $file.file_category_id, "form_menu") } -
    - {translate module=file} - field_name - {/translate} - - -
    - {translate module=file} - field_description - {/translate} - - -
    - {translate module=file} - field_status - {/translate} - - { $list->bool("file_status", $file.status, "form_menu") } -
    - {translate module=file} - field_sort_order - {/translate} - - -
    - {translate module=file} - field_group_avail - {/translate} - - { $list->select_groups($file.group_avail,"file_group_avail","form_field","10","") } -
    - {translate module=file} - field_date_start - {/translate} - - { $list->calender_view("file_date_start", $file.date_start, "form_field", $file.id) } -
    - {translate module=file} - field_date_expire - {/translate} - - { $list->calender_view("file_date_expire", $file.date_expire, "form_field", $file.id) } -
    - - - - - -
    - - - -
    -
    -
    - - - - - -
    - {translate module=file} - test - {/translate} -  
    -
    -
    - - - - -
    - {/foreach} -{/if} diff --git a/themes/default/blocks/file_category/add.tpl b/themes/default/blocks/file_category/add.tpl deleted file mode 100644 index 5cc351fe..00000000 --- a/themes/default/blocks/file_category/add.tpl +++ /dev/null @@ -1,102 +0,0 @@ - - - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - -
    -{$COOKIE_FORM} - - - - -
    - - - - - - - -
    -
    - {translate module=file_category}title_add{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=file_category} - field_date_orig - {/translate} - {$list->date_time("")} -
    - {translate module=file_category} - field_name - {/translate} - -
    - {translate module=file_category} - field_description - {/translate} - -
    - {translate module=file_category} - field_status - {/translate} - {if $VAR.file_category_status == ""} - { $list->bool("file_category_status", "1", "form_menu") } - {else} - { $list->bool("file_category_status", $VAR.file_category_status, "form_menu") } - {/if} -
    - {translate module=file_category} - field_group_avail - {/translate} - { $list->select_groups($VAR.file_category_group_avail,"file_category_group_avail","form_field","10","") } -
    - {translate module=file_category} - field_sort_order - {/translate} - - -
    - - - - -
    -
    -
    -
    diff --git a/themes/default/blocks/file_category/search_form.tpl b/themes/default/blocks/file_category/search_form.tpl deleted file mode 100644 index 77fd65be..00000000 --- a/themes/default/blocks/file_category/search_form.tpl +++ /dev/null @@ -1,98 +0,0 @@ - -{ $method->exe("file_category","search_form") } -{ if ($method->result == FALSE) } - { $block->display("core:method_error") } -{else} - -
    - {$COOKIE_FORM} - - - - -
    - - - - - - - -
    -
    - {translate module=file_category}title_search{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=file_category} - field_date_orig - {/translate} - { $list->calender_search("file_category_date_orig", $VAR.file_category_date_orig, "form_field", "") } -
    - {translate module=file_category} - field_name - {/translate} -   {translate}search_partial{/translate} -
    - {translate module=file_category} - field_description - {/translate} -   {translate}search_partial{/translate} -
    - {translate module=file_category} - field_status - {/translate} - { $list->bool("file_category_status", "all", "form_menu") } -
    {translate}search_results_per{/translate} - -
    {translate}search_order_by{/translate} - -
    - - - - -
    -
    -
    -
    -{ $block->display("core:saved_searches") } -{ $block->display("core:recent_searches") } -{/if} diff --git a/themes/default/blocks/file_category/search_show.tpl b/themes/default/blocks/file_category/search_show.tpl deleted file mode 100644 index 3f99e206..00000000 --- a/themes/default/blocks/file_category/search_show.tpl +++ /dev/null @@ -1,107 +0,0 @@ - - -{$method->exe("file_category","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} -{else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - {foreach from=$file_category item=record} - - - - - - - - - - - {literal} - - {/literal} - {/foreach} - - -
      - {literal} - - {/literal} -  
    - -   - {$record.name} -   - {if $record.status == "1"} - - {else} - - {/if} -
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    -{/if} -{/if} -
    diff --git a/themes/default/blocks/file_category/view.tpl b/themes/default/blocks/file_category/view.tpl deleted file mode 100644 index fbf456d8..00000000 --- a/themes/default/blocks/file_category/view.tpl +++ /dev/null @@ -1,153 +0,0 @@ - -{ $method->exe("file_category","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} - -{literal} - - -{/literal} - - -{foreach from=$file_category item=file_category} - - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - -
    -{$COOKIE_FORM} - - - - -
    - - - - - - - -
    -
    - {translate module=file_category} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=file_category} - field_date_orig - {/translate} - - {$list->date_time($file_category.date_orig)} -
    - {translate module=file_category} - field_name - {/translate} - - -
    - {translate module=file_category} - field_description - {/translate} - - -
    - {translate module=file_category} - field_status - {/translate} - - { $list->bool("file_category_status", $file_category.status, "form_menu") } -
    - {translate module=file_category} - field_group_avail - {/translate} - - { $list->select_groups($file_category.group_avail,"file_category_group_avail","form_field","10","") } -
    - {translate module=file_category} - field_sort_order - {/translate} - - -
    - - - - - -
    - - - -
    -
    -
    -
    - - - - -
    - {/foreach} -{/if} diff --git a/themes/default/blocks/group/add.tpl b/themes/default/blocks/group/add.tpl index 02d75273..3a83c099 100644 --- a/themes/default/blocks/group/add.tpl +++ b/themes/default/blocks/group/add.tpl @@ -1,121 +1,72 @@ +{assign var=meth value=':'|explode:$VAR._page} + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=group} - title_add - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=group} - field_name - {/translate} - - -
    - {translate module=group} - field_notes - {/translate} - - -
    - {translate module=group} - field_date_start - {/translate} - - {if $VAR.group_date_start == ""} - {$list->calender_add("group_date_start", '', "form_field")} - {else} - {$list->calender_add("group_date_start", $VAR.group_date_start, "form_field")} - {/if} - {$VAR.group_date_start}
    - {translate module=group} - field_date_expire - {/translate} - - {if $VAR.group_date_expire == ""} - {$list->calender_add("group_date_expire", '', "form_field")} - {else} - {$list->calender_add("group_date_expire", $VAR.group_date_expire, "form_field")} - {/if} - {$VAR.group_date_expire}
    - {translate module=group} - field_status - {/translate} - - {$list->bool("group_status", $VAR.group_status, "form_menu")} -
    - {translate module=group} - field_pricing - {/translate} - - {$list->bool("group_pricing", $VAR.group_pricing, "form_menu")} -
    - {translate module=group} - field_parent_id - {/translate} - - { $list->menu("", "group_parent_id", "group", "name", $VAR.group_parent_id, "form_menu") } -
    - - - - - -
    -
    -
    -
    +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/add_tr_submit.tpl'} +
    {osb f=tf field=name}
    {osb f=tf field=notes}
    {osb f=tf field=date_start} + {if $VAR.group_date_start == ''} + {$list->calender_add('group_date_start','','form_field')} + {else} + {$list->calender_add('group_date_start',$VAR.group_date_start,'form_field')} + {/if} + {$VAR.group_date_start}
    {osb f=tf field=date_expire} + {if $VAR.group_date_expire == ''} + {$list->calender_add('group_date_expire','','form_field')} + {else} + {$list->calender_add('group_date_expire',$VAR.group_date_expire,'form_field')} + {/if} + {$VAR.group_date_expire} +
    {osb f=tf field=status}{$list->bool('group_status',$VAR.group_status)}
    {osb f=tf field=pricing}{$list->bool('group_pricing',$VAR.group_pricing)}
    {osb f=tf field=parent_id}{$list->menu('','group_parent_id','group','name',$VAR.group_parent_id,'form_menu')}
    +
    +
    + +
    diff --git a/themes/default/blocks/group/search_show.tpl b/themes/default/blocks/group/search_show.tpl index fd2204d8..20ff076b 100644 --- a/themes/default/blocks/group/search_show.tpl +++ b/themes/default/blocks/group/search_show.tpl @@ -1,65 +1,64 @@ -{$method->exe("group","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} -{else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -

    - - - - -
    - - - - - - - -
    -
    - {translate module=group} - title_visual - {/translate} -
    -
    - - - - -
    { $method->exe("group","visual_layout")}
    -
    -
    -

    - - - - -
    - - - - - - - -
    -
    - {translate module=group} - menu - {/translate} -
    -
    - - - - -
    {translate module=group}help_file{/translate}
    -
    -
    +{assign var=meth value=':'|explode:$VAR._page} + -{/if} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} +

    {t count=$results 1=$results plural='%1 records were found.'}%1 record was found.{/t}

    + + + + + +
    + + + + + + + +
    {osb f=tt method=tpl_title_visual}
    + + + + +
    {$method->exe('group','tpl_visual_layout')}
    +
    +
    + +
    +
    +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + +
    +{t}Groups are simply a set of permissions that accounts can be authorized for. Each group is simply a list of methods that accounts associated with the group can access. + +For example, if a particular group is authorized for the Account Administration methods, any account authorized for that group can access the Account Administration features. + +The group configuration is very flexible. For example, a group can have access to only some of the methods in a specific module. So, group(s) can be define for employees that allow them to view and search for accounts, but not to delete or edit them. + +The group hierarchy also allows for an unlimited number of child groups defined under a parent group. Those child groups can then have children of their own. The advantage of this system is that the child group(s) always inherit all it's parents permissions, and then you can add additional permissions to the child. This makes it possible to very quickly create a group that has all the permissions of an existing group, plus a few changes. + +The group hierarchy is shown above this help dialogue.{/t}
    +
    +
    +{/if} diff --git a/themes/default/blocks/group/view.tpl b/themes/default/blocks/group/view.tpl index 12be5c6c..4d97444b 100644 --- a/themes/default/blocks/group/view.tpl +++ b/themes/default/blocks/group/view.tpl @@ -1,217 +1,109 @@ -{ $method->exe("group","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} -{literal} - - -{/literal} +{assign var=meth value=':'|explode:$VAR._page} + - -{foreach from=$group item=group} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} + + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} + + +
    + + + + + +
    + + + + + + + + {include file='file:../core/view_tr_submit_delete.tpl'} +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=name}
    {osb f=tf field=notes}
    {osb f=tf field=date_orig}{$record.date_orig|date_format:$smarty.const.DEFAULT_DATE_FORMAT}
    {osb f=tf field=date_start}{$list->calender_view('group_date_start',$record.date_start,'form_field','')}
    {osb f=tf field=date_expire}{$list->calender_view('group_date_expire',$record.date_expire,'form_field','')}
    {osb f=tf field=status}{$list->bool('group_status',$record.status,'" onchange="submit()')}
    {osb f=tf field=pricing}{$list->bool('group_pricing',$record.pricing)}
    {osb f=tf field=parent_id}{$list->menu('','group_parent_id','group','name',$record.parent_id,'form_menu')}
    +
    +
    + +
    + {include file='file:../core/view_post.tpl'} +
    +
    + + + + + +
    + + + + + + + +
    {t}Update Group to Method Relationships{/t}
    + + + + + +
    {t}Select a module{/t}{$list->menu('no','module_method_module_id','module','name','','" onchange="showGroupPerm(this)',true)}
    +
    +
    + + + + - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=group} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=group} - field_name - {/translate} - - -
    - {translate module=group} - field_notes - {/translate} - - -
    - {translate module=group} - field_date_orig - {/translate} - - {$group.date_orig|date_format:$smarty.const.DEFAULT_DATE_FORMAT} -
    - {translate module=group} - field_date_start - {/translate} - - {$list->calender_view("group_date_start", $group.date_start, "form_field", $group.id)} -
    - {translate module=group} - field_date_expire - {/translate} - - {$list->calender_view("group_date_expire", $group.date_expire, "form_field", $group.id)} -
    - {translate module=group} - field_status - {/translate} - - {$list->bool("group_status", $group.status, "\" onChange\"submit()\"")} -
    - {translate module=group} - field_pricing - {/translate} - - {$list->bool("group_pricing", $group.pricing, "form_menu")} -
    - {translate module=group} - field_parent_id - {/translate} - - { $list->menu("", "group_parent_id", "group", "name", $group.parent_id, "form_menu") } -
    - - - - - - -
    - -
    -
    -
    -
    -
    - -
    - - - - -
    - - - - - - - -
    -
    - {translate module=group} - title_relation - {/translate} -
    -
    - - - - - -
    - {translate module=group} - select_module - {/translate} - - { $list->menu("no", "module_method_module_id", "module", "name", "all", "\" onChange=\"showGroupPerm(this)\"") } -
    -
    -
    -
    -{literal} - -{/literal} - - - - -{/foreach} {/if} diff --git a/themes/default/blocks/host_provision_plugin/plugin_cfg_WHM.tpl b/themes/default/blocks/host_provision_plugin/plugin_cfg_WHM.tpl index abcf035b..bff74ed9 100644 --- a/themes/default/blocks/host_provision_plugin/plugin_cfg_WHM.tpl +++ b/themes/default/blocks/host_provision_plugin/plugin_cfg_WHM.tpl @@ -1,38 +1,29 @@ -{$list->unserial($host_server.provision_plugin_data, "plugin_data")} - +{$list->unserial($host_server.provision_plugin_data,'plugin_data')} + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + +
    Connect Type - -
    Host - -
    Path to 'Accounting.php.inc' - -
    WHM User Account - -
    WHM Access Hash - -
    Connect Type + +
    Host
    Path to 'Accounting.php.inc'
    WHM User Account
    WHM Access Hash
    - diff --git a/themes/default/blocks/host_registrar_plugin/add.tpl b/themes/default/blocks/host_registrar_plugin/add.tpl index 9eb357be..ac7b0801 100644 --- a/themes/default/blocks/host_registrar_plugin/add.tpl +++ b/themes/default/blocks/host_registrar_plugin/add.tpl @@ -1,73 +1,46 @@ - +{assign var=meth value=':'|explode:$VAR._page} + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} -
    + - - - - -
    - - - - - - - -
    -
    - {translate module=host_registrar_plugin}title_add{/translate} -
    -
    - - - - - - - - - -
    - {translate module=host_registrar_plugin} - field_status - {/translate} - - { $list->bool("host_registrar_plugin_status", $VAR.host_registrar_plugin_status, "form_menu") } -
    - {translate module=host_registrar_plugin} - field_name - {/translate} - - -
    - - {assign var=thistype value="add"} - {assign var="afile" value=$VAR.host_registrar_plugin_file} - {assign var="ablock" value="host_registrar_plugin:plugin_cfg_"} - {assign var="blockfile" value="$ablock$afile"} - - - { $block->display($blockfile) } - - - - - - -
    - - - - - -
    -
    -
    -
    + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + +
    {osb f=tf field=status}{$list->bool('host_registrar_plugin_status',$VAR.host_registrar_plugin_status,'form_menu')}
    {osb f=tf field=name}
    + {assign var=thistype value='add'} + {assign var='afile' value=$VAR.host_registrar_plugin_file} + {assign var='ablock' value='host_registrar_plugin:plugin_cfg_'} + {assign var='blockfile' value="$ablock$afile"} + {$block->display($blockfile)} + + {include file='file:../core/add_tr_submit.tpl'} +
    +
    +
    + + diff --git a/themes/default/blocks/host_registrar_plugin/plugin_cfg_MANUAL.tpl b/themes/default/blocks/host_registrar_plugin/plugin_cfg_MANUAL.tpl index 2c077528..f01c6bea 100644 --- a/themes/default/blocks/host_registrar_plugin/plugin_cfg_MANUAL.tpl +++ b/themes/default/blocks/host_registrar_plugin/plugin_cfg_MANUAL.tpl @@ -1,87 +1,39 @@ -{ if $thistype != "add" } - {$list->unserial($host_registrar_plugin.plugin_data, "plugin_data")} -{ else} - {assign var=plugin_data value=$VAR.host_registrar_plugin_data} +{if $thistype != 'add'} + {$list->unserial($record.plugin_data,'plugin_data')} +{else} + {assign var=plugin_data value=$VAR.host_registrar_plugin_data} {/if} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    - {translate module=host_registrar_plugin} - primary_ns - {/translate} - - -
    - {translate module=host_registrar_plugin} - secondary_ns - {/translate} - - -
    - {translate module=host_registrar_plugin} - primary_nsip - {/translate} - - -
    - {translate module=host_registrar_plugin} - secondary_nsip - {/translate} - - -
    - {translate module=host_registrar_plugin} - manual_add_email - {/translate} - - { $list->menu("", "host_registrar_plugin_plugin_data[manual_add_email]", "staff", "nickname", $plugin_data.manual_add_email, "form_menu") } -
    - {translate module=host_registrar_plugin} - manual_renew_email - {/translate} - - { $list->menu("", "host_registrar_plugin_plugin_data[manual_renew_email]", "staff", "nickname", $plugin_data.manual_renew_email, "form_menu") } -
    - {translate module=host_registrar_plugin} - manual_transfer_email - {/translate} - - { $list->menu("", "host_registrar_plugin_plugin_data[manual_transfer_email]", "staff", "nickname", $plugin_data.manual_transfer_email, "form_menu") } -
    - {translate module=host_registrar_plugin} - manual_park_email - {/translate} - - { $list->menu("", "host_registrar_plugin_plugin_data[manual_park_email]", "staff", "nickname", $plugin_data.manual_park_email, "form_menu") } -
    {osb f=tf field=primary_ns}
    {osb f=tf field=secondary_ns}
    {osb f=tf field=primary_nsip}
    {osb f=tf field=secondary_nsip}
    {osb f=tf field=manual_add_email}{$list->menu('','host_registrar_plugin_plugin_data[manual_add_email]','staff','nickname',$plugin_data.manual_add_email,'form_menu')}
    {osb f=tf field=manual_renew_email}{$list->menu('','host_registrar_plugin_plugin_data[manual_renew_email]','staff','nickname',$plugin_data.manual_renew_email,'form_menu')}
    {osb f=tf field=manual_transfer_email}{$list->menu('','host_registrar_plugin_plugin_data[manual_transfer_email]','staff','nickname',$plugin_data.manual_transfer_email,'form_menu')}
    {osb f=tf field=manual_park_email}{$list->menu('','host_registrar_plugin_plugin_data[manual_park_email]','staff','nickname',$plugin_data.manual_park_email,'form_menu')}
    diff --git a/themes/default/blocks/host_registrar_plugin/search_show.tpl b/themes/default/blocks/host_registrar_plugin/search_show.tpl index d50c98a4..528fb9bb 100644 --- a/themes/default/blocks/host_registrar_plugin/search_show.tpl +++ b/themes/default/blocks/host_registrar_plugin/search_show.tpl @@ -1,98 +1,48 @@ +{assign var=meth value=':'|explode:$VAR._page} + - -{$method->exe("host_registrar_plugin","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    + {include file='file:../core/search_show_pre.tpl'} - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - {foreach from=$host_registrar_plugin item=record} - - - - - - {/foreach} - -
      - {translate module=host_registrar_plugin} - field_name - {/translate} -  
      - {if $record.status == "1"} - - {else} - - {/if} -   - {$record.name} - - -
    -
    + + + + + +
    + + + + + + + + + {foreach from=$host_registrar_plugin item=record} + + + + + + {/foreach} + +
     {translate module=host_registrar_plugin}field_name{/translate} 
    + {if $record.status == '1'} + Enabled + {else} + Disabled + {/if} + {$record.name} + {if $record.status == '1'} + {t}View / Edit Plugin{/t} + {else} + {t}Install Plugin{/t} + {/if} +
    +
    + {/if}
    diff --git a/themes/default/blocks/host_registrar_plugin/view.tpl b/themes/default/blocks/host_registrar_plugin/view.tpl index 6bb8f0a0..b7df672c 100644 --- a/themes/default/blocks/host_registrar_plugin/view.tpl +++ b/themes/default/blocks/host_registrar_plugin/view.tpl @@ -1,113 +1,52 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("host_registrar_plugin","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} -{literal} - - -{/literal} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - -{foreach from=$host_registrar_plugin item=host_registrar_plugin} + +
    - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - - - - - - - -
    - - - - - - - -
    -
    - {translate module=host_registrar_plugin}title_view{/translate} -
    -
    - - - - - - - - - -
    - {translate module=host_registrar_plugin} - field_status - {/translate} - - { $list->bool("host_registrar_plugin_status", $host_registrar_plugin.status, "form_menu") } -
    - {translate module=host_registrar_plugin} - field_name - {/translate} - - -
    - - {assign var=thistype value="edit"} - {assign var="afile" value=$host_registrar_plugin.file} - {assign var="ablock" value="host_registrar_plugin:plugin_cfg_"} - {assign var="blockfile" value="$ablock$afile"} - { $block->display($blockfile) } - - - - - - -
    - - -
    -
    -
    - - - - - -
    - {/foreach} + + + + +
    + + + + + + + + {include file='file:../core/view_tr_submit_delete.tpl'} +
    {osb f=tt}
    + + + + + + + + + +
    {osb f=tf field=status}{$list->bool('host_registrar_plugin_status',$record.status,'form_menu')}
    {osb f=tf field=name}
    + {assign var=thistype value='edit'} + {assign var='afile' value=$record.file} + {assign var='ablock' value='host_registrar_plugin:plugin_cfg_'} + {assign var='blockfile' value="$ablock$afile"} + {$block->display($blockfile)} +
    +
    + + {include file='file:../core/view_post.tpl'} + {/if} diff --git a/themes/default/blocks/host_server/add.tpl b/themes/default/blocks/host_server/add.tpl index ed36ef01..b7818674 100644 --- a/themes/default/blocks/host_server/add.tpl +++ b/themes/default/blocks/host_server/add.tpl @@ -1,179 +1,95 @@ - +{assign var=meth value=':'|explode:$VAR._page} + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} -
    + - - - - -
    - - - - - - - -
    -
    - {translate module=host_server}title_add{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=host_server} - field_status - {/translate} - - {if $VAR.host_server_status != ""} - { $list->bool("host_server_status", $VAR.host_server_status, "form_menu") } - {else} - { $list->bool("host_server_status", "1", "form_menu") } - {/if} -
    - {translate module=host_server} - field_debug - {/translate} - - { $list->bool("host_server_debug", $VAR.host_server_debug, "form_menu") } -
    - {translate module=host_server} - field_name - {/translate} - - -
    - {translate module=host_server} - field_notes - {/translate} - - -
    - {translate module=host_server} - field_provision_plugin - {/translate} - - { $list->menu_files("", "host_server_provision_plugin", $VAR.host_server_provision_plugin, "provision_plugin", "", ".php", "form_menu") } -
    - {translate module=host_server} - field_name_based - {/translate} - - {if $VAR.host_server_name_based != "" } - { $list->bool("host_server_name_based", $VAR.host_server_name_based, "form_menu") } - {else} - { $list->bool("host_server_name_based", "1", "form_menu") } - {/if} -
    - {translate module=host_server} - field_name_based_ip - {/translate} - - -
    - {translate module=host_server} - field_ip_based - {/translate} - - { $list->bool("host_server_ip_based", $VAR.host_server_ip_based, "form_menu") } -
    - {translate module=host_server} - field_ip_based_ip - {/translate} - - -
    - {translate module=host_registrar_plugin} - primary_ns - {/translate} - - -
    - {translate module=host_registrar_plugin} - secondary_ns - {/translate} - - -
    - {translate module=host_registrar_plugin} - primary_nsip - {/translate} - - -
    - {translate module=host_registrar_plugin} - secondary_nsip - {/translate} - - -
    - - - - -
    -
    -
    -
    + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/add_tr_submit.tpl'} +
    {osb f=tf field=status} + {if $VAR.host_server_status != ''} + {$list->bool('host_server_status',$VAR.host_server_status,'form_menu')} + {else} + {$list->bool('host_server_status','1','form_menu')} + {/if} +
    {osb f=tf field=debug}{$list->bool('host_server_debug',$VAR.host_server_debug,'form_menu')}
    {osb f=tf field=name}
    {osb f=tf field=notes}
    {osb f=tf field=provision_plugin}{$list->menu_files('','host_server_provision_plugin',$VAR.host_server_provision_plugin,'provision_plugin','','.php','form_menu')}
    {osb f=tf field=name_based} + {if $VAR.host_server_name_based != ''} + {$list->bool('host_server_name_based',$VAR.host_server_name_based,'form_menu')} + {else} + {$list->bool('host_server_name_based','1','form_menu')} + {/if} +
    {osb f=tf field=name_based_ip}
    {osb f=tf field=ip_based}{$list->bool('host_server_ip_based',$VAR.host_server_ip_based,'form_menu')}
    {osb f=tf field=ip_based_ip}
    {osb f=tf field=primary_ns}
    {osb f=tf field=secondary_ns}
    {osb f=tf field=primary_nsip}
    {osb f=tf field=secondary_nsip}
    +
    +
    + + diff --git a/themes/default/blocks/host_server/search_show.tpl b/themes/default/blocks/host_server/search_show.tpl index cbf3bca5..2e593f28 100644 --- a/themes/default/blocks/host_server/search_show.tpl +++ b/themes/default/blocks/host_server/search_show.tpl @@ -1,140 +1,12 @@ +{assign var=meth value=':'|explode:$VAR._page} + - -{$method->exe("host_server","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - - {foreach from=$host_server item=record} - - - - - - - - - {literal} - - {/literal} - {/foreach} - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -
    - -   - {if $record.status == "1"} - {translate} - true - {/translate} - {else} - {translate} - false - {/translate} - {/if} -   - {$record.name} -   - {$record.provision_plugin} -   - {$record.name_based_ip} -   - {$record.max_accounts} -
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    -
    + {include file='file:../core/search_show_pre.tpl'} + {$method->exe_noauth($meth.0,'tpl_search_show',$search_show)} + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/host_server/view.tpl b/themes/default/blocks/host_server/view.tpl index d13f5a0b..63293444 100644 --- a/themes/default/blocks/host_server/view.tpl +++ b/themes/default/blocks/host_server/view.tpl @@ -1,260 +1,109 @@ -{ $method->exe("host_server","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{assign var=meth value=':'|explode:$VAR._page} + -{literal} - - -{/literal} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} - -{foreach from=$host_server item=host_server} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=host_server}title_view{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - {if $next_server == true} - - - - - {/if} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=host_server} - field_status - {/translate} - - { $list->bool("host_server_status", $host_server.status, "onChange=\"submit()\"") } -
    - {translate module=host_server} - field_debug - {/translate} - - { $list->bool("host_server_debug", $host_server.debug, "onChange=\"submit()\"") } -
    - {translate module=host_server} - field_name - {/translate} - - -
    - {translate module=host_server} - field_notes - {/translate} - - -
    - {translate module=host_server} - field_max_accounts - {/translate} - - -
    - {translate module=host_server} - field_next_host_server_id - {/translate} - - -
    - {translate module=host_server} - field_name_based - {/translate} - - { $list->bool("host_server_name_based", $host_server.name_based, "form_menu") } -
    - {translate module=host_server} - field_name_based_ip - {/translate} - - -
    - {translate module=host_server} - field_ip_based - {/translate} - - { $list->bool("host_server_ip_based", $host_server.ip_based, "form_menu") } -
    - {translate module=host_server} - field_ip_based_ip - {/translate} - - -
    - {translate module=host_server} - field_provision_plugin - {/translate} - - { $list->menu_files("", "host_server_provision_plugin", $host_server.provision_plugin, "provision_plugin", "", ".php", "form_menu") } -
    - {translate module=host_registrar_plugin} - primary_ns - {/translate} - - -
    - {translate module=host_registrar_plugin} - secondary_ns - {/translate} - - -
    - {translate module=host_registrar_plugin} - primary_nsip - {/translate} - - -
    - {translate module=host_registrar_plugin} - secondary_nsip - {/translate} - - -
    - - {assign var="ablock" value="host_provision_plugin:plugin_cfg_"} - {assign var="afile" value=$host_server.provision_plugin} - {assign var="blockfile" value="$ablock$afile"} - { $block->display($blockfile) } - - - - - - -
    - - - - - - - -
      - -
    -
    -
    -
    - - - - -
    - {/foreach} + +
    + + + + + +
    + + + + + + + + {include file='file:../core/view_tr_submit_delete.tpl'} +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + {if $next_server == true} + + + + + {/if} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=status}{$list->bool('host_server_status',$record.status,'" onchange="submit()')}
    {osb f=tf field=debug}{$list->bool('host_server_debug',$record.debug,'" onchange="submit()')}
    {osb f=tf field=name}
    {osb f=tf field=notes}
    {osb f=tf field=max_accounts}
    {osb f=tf field=next_host_server_id} + +
    {osb f=tf field=name_based}{$list->bool('host_server_name_based',$record.name_based,'form_menu')}
    {osb f=tf field=name_based_ip}
    {osb f=tf field=ip_based}{$list->bool('host_server_ip_based',$record.ip_based,'form_menu')}
    {osb f=tf field=ip_based_ip}
    {osb f=tf field=provision_plugin}{$list->menu_files('','host_server_provision_plugin',$record.provision_plugin,'provision_plugin','','.php','form_menu')}
    {osb f=tf field=primary_ns}
    {osb f=tf field=secondary_ns}
    {osb f=tf field=primary_nsip}
    {osb f=tf field=secondary_nsip}
    + {assign var='ablock' value='host_provision_plugin:plugin_cfg_'} + {assign var='afile' value=$record.provision_plugin} + {assign var='blockfile' value="$ablock$afile"} + {$block->display($blockfile)} +
    +
    + + {include file='file:../core/view_post.tpl'} +
    {/if} diff --git a/themes/default/blocks/host_tld/add.tpl b/themes/default/blocks/host_tld/add.tpl index 8228e2f6..f81978f5 100644 --- a/themes/default/blocks/host_tld/add.tpl +++ b/themes/default/blocks/host_tld/add.tpl @@ -1,116 +1,65 @@ +{assign var=meth value=':'|explode:$VAR._page} + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} -
    + - - - - -
    - - - - - - - -
    -
    - {translate module=host_tld} - title_add - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=host_tld} - field_status - {/translate} - - { if $VAR.host_tld_status != ""} - { $list->bool("host_tld_status", $VAR.host_tld_status, "form_menu") } - {else} - { $list->bool("host_tld_status", "1", "form_menu") } - {/if} -
    - {translate module=host_tld} - field_name - {/translate} - - -
    - {translate module=host_tld} - field_whois_plugin - {/translate} - - { $list->menu_files("", "host_tld_whois_plugin", $VAR.host_tld_whois_plugin, "whois_plugin", "", ".php", "form_menu") } -
    - {translate module=host_tld} - field_registrar_plugin_id - {/translate} - - { $list->menu("", "host_tld_registrar_plugin_id", "host_registrar_plugin", "name", $VAR.host_tld_registrar_plugin_id, "form_menu") } -
    - {translate module=host_tld} - field_taxable - {/translate} - - { $list->bool("host_tld_taxable", $VAR.host_tld_taxable, "form_menu") } -
    - {translate module=host_tld} - field_auto_search - {/translate} - - { $list->bool("host_tld_auto_search", $VAR.host_tld_auto_search, "form_menu") } -
    - {translate module=host_tld} - field_default_term_new - {/translate} - - -
      - - - - -
    -
    -
    -
    + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/add_tr_submit.tpl'} +
    {osb f=tf field=status} + {if $VAR.host_tld_status != ''} + {$list->bool('host_tld_status',$VAR.host_tld_status)} + {else} + {$list->bool('host_tld_status','1')} + {/if} +
    {osb f=tf field=name}
    {osb f=tf field=whois_plugin}{$list->menu_files('','host_tld_whois_plugin',$VAR.host_tld_whois_plugin,'whois_plugin','','.php','form_menu')}
    {osb f=tf field=registrar_plugin_id}{$list->menu('','host_tld_registrar_plugin_id','host_registrar_plugin','name',$VAR.host_tld_registrar_plugin_id,'form_menu')}
    {osb f=tf field=taxable}{$list->bool('host_tld_taxable',$VAR.host_tld_taxable)}
    {osb f=tf field=auto_search}{$list->bool('host_tld_auto_search',$VAR.host_tld_auto_search)}
    {osb f=tf field=default_term_new}
    +
    +
    + + diff --git a/themes/default/blocks/host_tld/search_show.tpl b/themes/default/blocks/host_tld/search_show.tpl index 354e3d86..2e593f28 100644 --- a/themes/default/blocks/host_tld/search_show.tpl +++ b/themes/default/blocks/host_tld/search_show.tpl @@ -1,129 +1,12 @@ +{assign var=meth value=':'|explode:$VAR._page} + - -{$method->exe("host_tld","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - {foreach from=$host_tld item=record} - - - - - - - - {literal} - - {/literal} - {/foreach} - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -
    - -   - {$record.name} -   - {if $record.status == "1"} - {translate} - true - {/translate} - {else} - {translate} - false - {/translate} - {/if} -   - {$record.whois_plugin} -   - {$record.registrar_plugin_id} -
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    + {include file='file:../core/search_show_pre.tpl'} + {$method->exe_noauth($meth.0,'tpl_search_show',$search_show)} + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/host_tld/view.tpl b/themes/default/blocks/host_tld/view.tpl index eacf4451..bfa48e60 100644 --- a/themes/default/blocks/host_tld/view.tpl +++ b/themes/default/blocks/host_tld/view.tpl @@ -1,735 +1,144 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("host_tld","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} -{literal} - - -{/literal} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - -{foreach from=$host_tld item=host_tld} + +
    - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - {translate module=host_tld} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - -
    - {translate module=host_tld} - field_status - {/translate} - - { $list->bool("host_tld_status", $host_tld.status, "onChange=\"submit()\"") } -
    - {translate module=host_tld} - field_name - {/translate} - - -
    - {translate module=host_tld} - field_whois_plugin - {/translate} - - { $list->menu_files("", "host_tld_whois_plugin", $host_tld.whois_plugin, "whois_plugin", "", ".php", "form_menu") } -
    - {assign var="ablock" value="host_whois_plugin:plugin_cfg_"} - {assign var="afile" value=$host_tld.whois_plugin} - {assign var="blockfile" value="$ablock$afile"} - { $block->display($blockfile) } - - - - - - - - - - - - - - - - - - - -
    - {translate module=host_tld} - field_registrar_plugin_id - {/translate} - - { $list->menu("", "host_tld_registrar_plugin_id", "host_registrar_plugin", "name", $host_tld.registrar_plugin_id, "form_menu") } -
    - {translate module=host_tld} - field_taxable - {/translate} - - { $list->bool("host_tld_taxable", $host_tld.taxable, "form_menu") } -
    - {translate module=host_tld} - field_auto_search - {/translate} - - { $list->bool("host_tld_auto_search", $host_tld.auto_search, "form_menu") } -
    - {translate module=host_tld} - field_default_term_new - {/translate} - - - - - - -
    - - {$list->unserial($host_tld.price_group, "price")} - -
    - -
    -
    -
    -
    - - - - -
    - {translate module=host_tld} - parking - {/translate} -    - { $list->bool("host_tld_price_group[0][show]", $price[0].show, "form_menu") } -
    -
    - { if ($list->smarty_array("group","name"," AND pricing='1' ", "group_array")) } - {/if} - {foreach from=$group_array item=arr} - {assign var="idx" value=$arr.id} - - - - - - - -
    - {$arr.name} - - - {$list->currency_iso("")} -    
    - {/foreach} - -
    - - - - -
    - {translate module=host_tld} - year1 - {/translate} -    - { $list->bool("host_tld_price_group[1][show]", $price[1].show, "form_menu") } -
    -
    - - - - - - - -
    Registrations Renewals Transfers
    - {foreach from=$group_array item=arr} - {assign var="idx" value=$arr.id} - - - - - - - -
    - {$arr.name} - - - {$list->currency_iso("")} - - - {$list->currency_iso("")} - - - {$list->currency_iso("")} -
    - {/foreach} - -
    - - - - -
    - {translate module=host_tld} - year2 - {/translate} -    - { $list->bool("host_tld_price_group[2][show]", $price[2].show, "form_menu") } -
    -
    - - - - - - - -
    Registrations Renewals Transfers
    - {foreach from=$group_array item=arr} - {assign var="idx" value=$arr.id} - - - - - - - -
    - {$arr.name} - - - {$list->currency_iso("")} - - - {$list->currency_iso("")} - - - {$list->currency_iso("")} -
    - {/foreach} - - -
    - - - - -
    - {translate module=host_tld} - year3 - {/translate} -    - { $list->bool("host_tld_price_group[3][show]", $price[3].show, "form_menu") } -
    -
    - - - - - - - -
    Registrations Renewals Transfers
    - {foreach from=$group_array item=arr} - {assign var="idx" value=$arr.id} - - - - - - - -
    - {$arr.name} - - - {$list->currency_iso("")} - - - {$list->currency_iso("")} - - - {$list->currency_iso("")} -
    - {/foreach} - -
    - - - - -
    - {translate module=host_tld} - year4 - {/translate} -    - { $list->bool("host_tld_price_group[4][show]", $price[4].show, "form_menu") } -
    -
    - - - - - - - -
    Registrations Renewals Transfers
    - {foreach from=$group_array item=arr} - {assign var="idx" value=$arr.id} - - - - - - - -
    - {$arr.name} - - - {$list->currency_iso("")} - - - {$list->currency_iso("")} - - - {$list->currency_iso("")} -
    - {/foreach} - - -
    - - - - -
    - {translate module=host_tld} - year5 - {/translate} -    - { $list->bool("host_tld_price_group[5][show]", $price[5].show, "form_menu") } -
    -
    - - - - - - - -
    Registrations Renewals Transfers
    - {foreach from=$group_array item=arr} - {assign var="idx" value=$arr.id} - - - - - - - -
    - {$arr.name} - - - {$list->currency_iso("")} - - - {$list->currency_iso("")} - - - {$list->currency_iso("")} -
    - {/foreach} - - -
    - - - - -
    - {translate module=host_tld} - year6 - {/translate} -    - { $list->bool("host_tld_price_group[6][show]", $price[6].show, "form_menu") } -
    -
    - - - - - - - -
    Registrations Renewals Transfers
    - {foreach from=$group_array item=arr} - {assign var="idx" value=$arr.id} - - - - - - - -
    - {$arr.name} - - - {$list->currency_iso("")} - - - {$list->currency_iso("")} - - - {$list->currency_iso("")} -
    - {/foreach} - - -
    - - - - -
    - {translate module=host_tld} - year7 - {/translate} -    - { $list->bool("host_tld_price_group[7][show]", $price[7].show, "form_menu") } -
    -
    - - - - - - - -
    Registrations Renewals Transfers
    - {foreach from=$group_array item=arr} - {assign var="idx" value=$arr.id} - - - - - - - -
    - {$arr.name} - - - {$list->currency_iso("")} - - - {$list->currency_iso("")} - - - {$list->currency_iso("")} -
    - {/foreach} - - -
    - - - - -
    - {translate module=host_tld} - year8 - {/translate} -    - { $list->bool("host_tld_price_group[8][show]", $price[8].show, "form_menu") } -
    -
    - - - - - - - -
    Registrations Renewals Transfers
    - {foreach from=$group_array item=arr} - {assign var="idx" value=$arr.id} - - - - - - - -
    - {$arr.name} - - - {$list->currency_iso("")} - - - {$list->currency_iso("")} - - - {$list->currency_iso("")} -
    - {/foreach} - - -
    - - - - -
    - {translate module=host_tld} - year9 - {/translate} -    - { $list->bool("host_tld_price_group[9][show]", $price[9].show, "form_menu") } -
    -
    - - - - - - - -
    Registrations Renewals Transfers
    - {foreach from=$group_array item=arr} - {assign var="idx" value=$arr.id} - - - - - - - -
    - {$arr.name} - - - {$list->currency_iso("")} - - - {$list->currency_iso("")} - - - {$list->currency_iso("")} -
    - {/foreach} - - -
    - - - - -
    - {translate module=host_tld} - year10 - {/translate} -    - { $list->bool("host_tld_price_group[10][show]", $price[10].show, "form_menu") } -
    -
    - - - - - - - -
    Registrations Renewals Transfers
    - {foreach from=$group_array item=arr} - {assign var="idx" value=$arr.id} - - - - - - - -
    - {$arr.name} - - - {$list->currency_iso("")} - - - {$list->currency_iso("")} - - - {$list->currency_iso("")} -
    - {/foreach} - - -
    - - - - - -
    - - -
    - -
    -
    -
    -
    - - - - -
    - {/foreach} + + + + +
    + + + + + + + + + + + {if ($list->smarty_array('group','name'," AND pricing='1' ",'group_array'))}{/if} + + + + {section name=year start=1 loop=11 step=1} + {assign var="year" value=$smarty.section.year.index} + + + + + + + {/section} + {include file='file:../core/view_tr_submit_delete.tpl'} +
    {osb f=tt}
    + + + + + + + + + + + + + +
    {osb f=tf field=status}{$list->bool('host_tld_status',$record.status,'onChange="submit()')}
    {osb f=tf field=name}
    {osb f=tf field=whois_plugin}{$list->menu_files('','host_tld_whois_plugin',$record.whois_plugin,'whois_plugin','','.php','form_menu')}
    + {assign var="ablock" value="host_whois_plugin:plugin_cfg_"} + {assign var="afile" value=$record.whois_plugin} + {assign var="blockfile" value="$ablock$afile"} + {$block->display($blockfile)} + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=registrar_plugin_id}{$list->menu('','host_tld_registrar_plugin_id','host_registrar_plugin','name',$record.registrar_plugin_id,'form_menu')}
    {osb f=tf field=taxable}{$list->bool('host_tld_taxable',$record.taxable,'form_menu')}
    {osb f=tf field=auto_search}{$list->bool('host_tld_auto_search',$record.auto_search,'form_menu')}
    {osb f=tf field=default_term_new} + + + + + +
    + + {$list->unserial($record.price_group,'price')} +
    +
    +
    + + + + +
    {t}Offer domain parking for this TLD{/t}  {$list->bool('host_tld_price_group[0][show]',$price[0].show,'form_menu')}
    +
    + {foreach from=$group_array item=arr} + {assign var="idx" value=$arr.id} + + + + + + + +
    {$arr.name}{$list->currency_iso('')}  
    + {/foreach} +
    + + + + +
    {t}Offer purchase options for this TLD for year{/t}: {$year}  {$list->bool("host_tld_price_group[$year][show]",$price[$year].show,'form_menu')}
    +
    + + + + + + + +
     {t}Registrations{/t}{t}Renewals{/t}{t}Transfers{/t}
    + {foreach from=$group_array item=arr} + {assign var="idx" value=$arr.id} + + + + + + + +
    {$arr.name}{$list->currency_iso('')}{$list->currency_iso('')}{$list->currency_iso('')}
    + {/foreach} +
    +
    + + {include file='file:../core/view_post.tpl'} + {/if} diff --git a/themes/default/blocks/htaccess/add.tpl b/themes/default/blocks/htaccess/add.tpl deleted file mode 100644 index b561db26..00000000 --- a/themes/default/blocks/htaccess/add.tpl +++ /dev/null @@ -1,81 +0,0 @@ - - - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=htaccess}title_add{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=htaccess} - field_name - {/translate} - - -
    - {translate module=htaccess} - field_description - {/translate} - - -
    - {translate module=htaccess} - field_status - {/translate} - - { $list->bool("htaccess_status", $VAR.htaccess_status, "form_menu") } -
    - {translate module=htaccess} - field_group_avail - {/translate} - - { $list->select_groups($VAR.htaccess_group_avail,"htaccess_group_avail","form_field","10","") } -
    - - - - -
    -
    -
    -
    diff --git a/themes/default/blocks/htaccess/htaccess.tpl b/themes/default/blocks/htaccess/htaccess.tpl deleted file mode 100644 index a2d17226..00000000 --- a/themes/default/blocks/htaccess/htaccess.tpl +++ /dev/null @@ -1,38 +0,0 @@ - - - - -
    - - - - -
    - - - - - - -
    - - - - - - - -
    -
    - {translate module=htaccess} - downloads - {/translate} -
    -
    -
    - -
    -
    -
    -
    -
    \ No newline at end of file diff --git a/themes/default/blocks/htaccess/list.tpl b/themes/default/blocks/htaccess/list.tpl deleted file mode 100644 index 2a2a06a6..00000000 --- a/themes/default/blocks/htaccess/list.tpl +++ /dev/null @@ -1,27 +0,0 @@ -{ $method->exe("htaccess","list_dirs")} -{ if ($method->result == FALSE) } -{ $block->display("core:method_error") } -{/if} -{if $htaccess_display == true} -{popup_init src="$SSL_URL/includes/overlib/overlib.js"} -{foreach from=$htaccess_results item=record} - - - - -
    - - {assign var="desc" value=$record.description} - {if $desc == ''}{assign var="desc" value="No description available"}{/if} - - {$record.name} - -
    -{/foreach} -{else} - -{translate module=htaccess} -none_authorized -{/translate} - -{/if} diff --git a/themes/default/blocks/htaccess/search_show.tpl b/themes/default/blocks/htaccess/search_show.tpl deleted file mode 100644 index e6ca851f..00000000 --- a/themes/default/blocks/htaccess/search_show.tpl +++ /dev/null @@ -1,107 +0,0 @@ - - -{$method->exe("htaccess","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} -{else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - {foreach from=$htaccess item=record} - - - - - - - - - - - {literal} - - {/literal} - {/foreach} - - -
      - {literal} - - {/literal} -  
    - -   - {$record.name} -   - {if $record.status == "1"} - - {else} - - {/if} -
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    -{/if} -{/if} -
    diff --git a/themes/default/blocks/htaccess/view.tpl b/themes/default/blocks/htaccess/view.tpl deleted file mode 100644 index 889ff940..00000000 --- a/themes/default/blocks/htaccess/view.tpl +++ /dev/null @@ -1,223 +0,0 @@ - -{ $method->exe("htaccess","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} - -{literal} - - -{/literal} - - -{foreach from=$htaccess item=htaccess} - - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - -
    - - - - - -
    - - - - - - - - - - - - - -
    -
    - {translate module=htaccess} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=htaccess} - field_name - {/translate} - - -
    - {translate module=htaccess} - field_description - {/translate} - - -
    - {translate module=htaccess} - field_status - {/translate} - - { $list->bool("htaccess_status", $htaccess.status, "form_menu") } -
    - {translate module=htaccess} - field_group_avail - {/translate} - - { $list->select_groups($htaccess.group_avail,"htaccess_group_avail","form_field","10","") } -
    - - - - - -
    - - - -
    -
    -
    - - - - - -
    - {translate module=htaccess} - view_all - {/translate} - - -
    -
    - - - - - - - - - - - - - -
    -
    - - -
    -
    -
    - -
    -
    - {$list->unserial($htaccess.group_avail, "groups")} - {assign var="idx" value=0} - -
    - -
    -
    -
    - - - - -
    - {/foreach} -{/if} diff --git a/themes/default/blocks/htaccess_dir/add.tpl b/themes/default/blocks/htaccess_dir/add.tpl deleted file mode 100644 index 75d8a348..00000000 --- a/themes/default/blocks/htaccess_dir/add.tpl +++ /dev/null @@ -1,129 +0,0 @@ - - - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - - - - - -
    - - - - - - - - -
    -
    - {translate module=htaccess_dir} - title_add - {/translate} -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=htaccess_dir} - field_htaccess_id - {/translate} - - {if $VAR.id != "" } - { $list->menu("", "htaccess_dir_htaccess_id", "htaccess", "name", $VAR.id, "form_menu") } - {else} - { $list->menu("", "htaccess_dir_htaccess_id", "htaccess", "name", $VAR.htaccess_dir_htaccess_id, "form_menu") } - {/if} -
    - {translate module=htaccess_dir} - field_name - {/translate} - - -
    - {translate module=htaccess_dir} - field_description - {/translate} - - -
    - {translate module=htaccess_dir} - field_url - {/translate} - - -
    - {translate module=htaccess_dir} - field_path - {/translate} - - -
    - {translate module=htaccess_dir} - exclude_short - {/translate} - - { $list->menu_multi($htaccess_dir.exclude, 'htaccess_dir_exclude', 'htaccess_exclude', 'name', '', '12', 'form_menu') } -
    - {translate module=htaccess_dir} - field_status - {/translate} - - { $list->bool('htaccess_dir_status', $VAR.htaccess_dir_status, 'form_menu') } -
    - {translate module=htaccess_dir} - field_recursive - {/translate} - - { $list->bool('htaccess_dir_recursive', $VAR.htaccess_dir_recursive, 'form_menu') } -
    - - - - -
    -
    -
    -
    - diff --git a/themes/default/blocks/htaccess_dir/search_show.tpl b/themes/default/blocks/htaccess_dir/search_show.tpl deleted file mode 100644 index 2cac3d3b..00000000 --- a/themes/default/blocks/htaccess_dir/search_show.tpl +++ /dev/null @@ -1,119 +0,0 @@ - - -{$method->exe("htaccess_dir","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} -{else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - {foreach from=$htaccess_dir item=record} - - - - - - - {literal} - - {/literal} - {/foreach} - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -
    - -    - - {$record.name} -   - - {$record.htaccess_id} - -
    {$record.url} - {if $record.status == "1"} - - {else} - - {/if} -
    -
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    -{/if} -{/if} -
    diff --git a/themes/default/blocks/htaccess_dir/view.tpl b/themes/default/blocks/htaccess_dir/view.tpl deleted file mode 100644 index 5f152ff2..00000000 --- a/themes/default/blocks/htaccess_dir/view.tpl +++ /dev/null @@ -1,222 +0,0 @@ - -{ $method->exe("htaccess_dir","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} - -{literal} - - -{/literal} - - -{foreach from=$htaccess_dir item=htaccess_dir} - - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - - - - - - - -
    - - - - - - - - - - - - -
    -
    - {translate module=htaccess_dir} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=htaccess_dir} - field_htaccess_id - {/translate} - - { $list->menu("", "htaccess_dir_htaccess_id", "htaccess", "name", $htaccess_dir.htaccess_id, "form_menu") } -
    - {translate module=htaccess_dir} - field_name - {/translate} - - -
    - {translate module=htaccess_dir} - field_description - {/translate} - - -
    - {translate module=htaccess_dir} - field_url - {/translate} - - -  {$htaccess_dir.url}
    - {translate module=htaccess_dir} - field_path - {/translate} - - - -
    - {translate module=htaccess_dir} - field_status - {/translate} - - { $list->bool('htaccess_dir_status', $htaccess_dir.status, 'form_menu') } -
    - {translate module=htaccess_dir} - field_recursive - {/translate} - - { $list->bool('htaccess_dir_recursive', $htaccess_dir.recursive, 'form_menu') } -
      
    - - - - -
    - - - - - -
    - {translate module=htaccess_dir} - exclude_long - {/translate} - - { $list->menu_multi($htaccess_dir.exclude, 'htaccess_dir_exclude', 'htaccess_exclude', 'name', '', '12', 'form_menu') } -
    -


    - - {translate module=htaccess_dir} - field_htaccess - {/translate} -
    - -

    -

    - - - - -

    -
    - - - - -
    - - - - - -
    - - - -
    -
    -
    - - - - - - -
    -
    - - - - -
    -
    -
    -
    -
    -{/foreach} -{/if} diff --git a/themes/default/blocks/htaccess_exclude/add.tpl b/themes/default/blocks/htaccess_exclude/add.tpl deleted file mode 100644 index 049ae022..00000000 --- a/themes/default/blocks/htaccess_exclude/add.tpl +++ /dev/null @@ -1,59 +0,0 @@ - - - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=htaccess_exclude}title_add{/translate} -
    -
    - - - - - - - - - - - - - -
    - {translate module=htaccess_exclude} - field_name - {/translate} - -
    - {translate module=htaccess_exclude} - field_extension - {/translate} - -
    - - - - -
    -
    -
    -
    diff --git a/themes/default/blocks/htaccess_exclude/main.tpl b/themes/default/blocks/htaccess_exclude/main.tpl deleted file mode 100644 index 12a3d4e1..00000000 --- a/themes/default/blocks/htaccess_exclude/main.tpl +++ /dev/null @@ -1,27 +0,0 @@ - - - - - -
    - - - - - - - -
    -
    - {translate module=htaccess_exclude} - menu - {/translate} -
    -
    - - - - -
    {translate module=htaccess_exclude}help_file{/translate}
    -
    -
    diff --git a/themes/default/blocks/htaccess_exclude/search_form.tpl b/themes/default/blocks/htaccess_exclude/search_form.tpl deleted file mode 100644 index 9db3eaec..00000000 --- a/themes/default/blocks/htaccess_exclude/search_form.tpl +++ /dev/null @@ -1,80 +0,0 @@ - -{ $method->exe("htaccess_exclude","search_form") } -{ if ($method->result == FALSE) } - { $block->display("core:method_error") } -{else} - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=htaccess_exclude}title_search{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=htaccess_exclude} - field_name - {/translate} -   {translate}search_partial{/translate} -
    - {translate module=htaccess_exclude} - field_extension - {/translate} -   {translate}search_partial{/translate} -
    {translate}search_results_per{/translate} - -
    {translate}search_order_by{/translate} - -
    - - - - -
    -
    -
    -
    -{ $block->display("core:saved_searches") } -{ $block->display("core:recent_searches") } -{/if} diff --git a/themes/default/blocks/htaccess_exclude/search_show.tpl b/themes/default/blocks/htaccess_exclude/search_show.tpl deleted file mode 100644 index 769cab97..00000000 --- a/themes/default/blocks/htaccess_exclude/search_show.tpl +++ /dev/null @@ -1,103 +0,0 @@ - - -{$method->exe("htaccess_exclude","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} -{else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - {foreach from=$htaccess_exclude item=record} - - - - - - - - - {literal} - - {/literal} - {/foreach} - - -
      - {literal} - - {/literal} - - {literal} - - {/literal} -
    - -  {$record.name} {$record.extension}
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    -{/if} -{/if} -
    diff --git a/themes/default/blocks/htaccess_exclude/view.tpl b/themes/default/blocks/htaccess_exclude/view.tpl deleted file mode 100644 index 97fece7e..00000000 --- a/themes/default/blocks/htaccess_exclude/view.tpl +++ /dev/null @@ -1,114 +0,0 @@ - -{ $method->exe("htaccess_exclude","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} - -{literal} - - -{/literal} - - -{foreach from=$htaccess_exclude item=htaccess_exclude} - - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=htaccess_exclude}title_view{/translate} -
    -
    - - - - - - - - - - - - - -
    - {translate module=htaccess_exclude} - field_name - {/translate} - -
    - {translate module=htaccess_exclude} - field_extension - {/translate} - -
    - - - - - -
    - - - -
    -
    -
    -
    - - - - -
    - {/foreach} -{/if} diff --git a/themes/default/blocks/import/add.tpl b/themes/default/blocks/import/add.tpl deleted file mode 100644 index a006100b..00000000 --- a/themes/default/blocks/import/add.tpl +++ /dev/null @@ -1,104 +0,0 @@ - - - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - -
    -{$COOKIE_FORM} - - - - -
    - - - - - - - -
    -
    - {translate module=import}title_add{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=import} - field_date_orig - {/translate} - -
    - {translate module=import} - field_plugin - {/translate} - -
    - {translate module=import} - field_module - {/translate} - -
    - {translate module=import} - field_local_table - {/translate} - -
    - {translate module=import} - field_ab_table - {/translate} - -
    - {translate module=import} - field_remote_id - {/translate} - -
    - {translate module=import} - field_ab_id - {/translate} - -
    - - - - -
    -
    -
    -
    diff --git a/themes/default/blocks/import/import.tpl b/themes/default/blocks/import/import.tpl index 7179fcee..94e97af7 100644 --- a/themes/default/blocks/import/import.tpl +++ b/themes/default/blocks/import/import.tpl @@ -1,91 +1,48 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("import","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{$method->exe($meth.0,'view')} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} -{literal} - -{/literal} - - -
    -{$COOKIE_FORM} - - - - -
    - - - - - - - - - - {foreach from=$import item=import} + - - - - {/foreach} - - - - -
    -
    - {$name} -
    -
    - - - - -
    {$instructions}
    -
    - - - - - -
    - {$import.desc} - - {if $import.status == 'ready'} - - {translate module=import} - {$import.status} - {/translate} - - {elseif $import.status == 'done'} - - {translate module=import} - {$import.status} - {/translate} - ( - {$import.records} - ) - {elseif $import.status == 'pending' } - {translate module=import} - {$import.status} - {/translate} - {/if} -
    -
    - - - - - -
       
    -
    -
    - - - - -
    - + + + + +
    + + + + + + + + + {foreach from=$import item=record} + + + + {/foreach} +
    {$name}
    {$instructions}
    + + + + + +
    {$record.desc} + {if $record.status == 'ready'} + {t}{$record.status}{/t} + {elseif $record.status == 'done'} + {t}{$record.status}{/t} ({$record.records}) + {elseif $record.status == 'pending' } + {t}{$record.status}{/t} + {/if} +
    +
    +
    + + {/if} diff --git a/themes/default/blocks/import/search_show.tpl b/themes/default/blocks/import/search_show.tpl index eb455244..dfaec5b2 100644 --- a/themes/default/blocks/import/search_show.tpl +++ b/themes/default/blocks/import/search_show.tpl @@ -1,76 +1,30 @@ -{$method->exe("import","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{assign var=meth value=':'|explode:$VAR._page} + + +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - {literal} - - - {/literal} + {include file='file:../core/search_show_pre.tpl'} - -
    + + + + +
    + + {$method->exe_noauth($meth.0,'tpl_search_show')} + + {foreach from=$search_show item=record} + + + + + {/foreach} + +
    {$record.name|capitalize}
    +
    - -
    - - - - - - -
    - - - - - - - {foreach from=$import item=record} - - - - - {/foreach} - -
    - {translate module=import} - plugin - {/translate} -  
      - {$record.name|capitalize} - - -
    -
    - {/if} -
    \ No newline at end of file + + +{/if} diff --git a/themes/default/blocks/import/view.tpl b/themes/default/blocks/import/view.tpl index 429be997..68ed3d1a 100644 --- a/themes/default/blocks/import/view.tpl +++ b/themes/default/blocks/import/view.tpl @@ -1,154 +1,67 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("import","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} -{literal} - - -{/literal} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - -{foreach from=$import item=import} + +
    - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - - -{$COOKIE_FORM} - - - - -
    - - - - - - - -
    -
    - {translate module=import}title_view{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=import} - field_date_orig - {/translate} - -
    - {translate module=import} - field_plugin - {/translate} - -
    - {translate module=import} - field_module - {/translate} - -
    - {translate module=import} - field_local_table - {/translate} - -
    - {translate module=import} - field_ab_table - {/translate} - -
    - {translate module=import} - field_remote_id - {/translate} - -
    - {translate module=import} - field_ab_id - {/translate} - -
    - - - - - -
    - - - -
    -
    -
    -
    - - - - -
    - {/foreach} + + + + +
    + + + + + + + + {include file='file:../core/view_tr_submit_delete.tpl'} +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=date_orig}
    {osb f=tf field=plugin}
    {osb f=tf field=module}
    {osb f=tf field=local_table}
    {osb f=tf field=ab_table}
    {osb f=tf field=remote_id}
    {osb f=tf field=ab_id}
    +
    +
    + + {include file='file:../core/view_post.tpl'} + {/if} diff --git a/themes/default/blocks/invoice/add.tpl b/themes/default/blocks/invoice/add.tpl index cbcaa60e..860b2813 100644 --- a/themes/default/blocks/invoice/add.tpl +++ b/themes/default/blocks/invoice/add.tpl @@ -1,182 +1,108 @@ +{assign var=meth value=':'|explode:$VAR._page} + + -{if $VAR.invoice_account_id == "" } -
    - - - - -
    - - - - - - - -
    -
    - {translate module=invoice}title_add{/translate} -
    -
    - - - - - - { if $list->is_installed('affiliate') == 1 } - - - - {/if} - - - - - -
    - {translate module=invoice} - field_account_id - {/translate} - - {html_select_account name="invoice_account_id" default=$VAR.invoice_account_id} -
    - {translate module=invoice} - field_affiliate_id - {/translate} - - {html_select_affiliate name="aid" default=$VAR.aid} -
    - - - -
    -
    -
    -
    - -{else} -
    - - - - - -
    - - - - - - - - - - -
    -
    - {translate module=invoice} - title_add - {/translate} -
    -
    - - - - - - - - - -
    - {translate module=invoice} - field_account_id - {/translate} - - {html_select_account name="invoice_account_id" default=$VAR.invoice_account_id} -
    - {translate module=invoice} - add_product - {/translate} - - { $list->menu("no", "invoice_product_id", "product", "sku", "all", "\" onchange=\"showProduct(this.value)\"") } -
    -
    - - - - -
    - {translate module=invoice} - add_ad_hoc - {/translate} | - {if $list->is_installed('host_tld')} - - {translate module=invoice} - add_domain - {/translate} - - - - {/if} | - - {translate module=invoice} - add_discount - {/translate} - | - {translate module=invoice} - add_view_items - {/translate} - | - {translate module=invoice} - add_finalize - {/translate} - -
    -
    -
    + + + + + + +
    + + + + + + + + + + + +
    {osb f=tt}
    + + + + + + {if $list->is_installed('affiliate') == 1} + + + + + {/if} + {if $VAR.invoice_account_id} + + + + +
    {osb f=tf field=account_id}{osb f=autoselect module=account return=id field=invoice_account_id default=$VAR.invoice_account_id}
    {osb f=tf field=affiliate_id}{osb f=html_select_affiliate name='aid' default=$VAR.aid}
    {osb f=tf field=product_id}{$list->menu('no','invoice_product_id','product','sku','','" onchange="showProduct(this.value)',true)}
    +
    + + + + + {else} + + + {include file='file:../core/view_td_submit.tpl'} + + {/if} +
    + {t}Add adhoc item to Invoice{/t} + {if $list->is_installed('host_tld')} + | {t}Add a Domain to Invoice{/t} + + + {/if} + | {t}Discount User{/t} + | {t}View Items{/t} + | {t}Finalise Invoice{/t} +
     
    +
    +
    +
    -{literal} -
    -
    - -
    - -{/literal} -{/if} \ No newline at end of file + function showDiscount() { + showIFrame('iframe',getPageWidth(600),500,'?_page=discount:add&discount_avail_account_id={/literal}{$VAR.invoice_account_id}{literal}'); + } + + function domainSearch() { + var domain = document.getElementById('domain_name').value; + showIFrame('iframe',getPageWidth(600),500,'?_page=host_tld:admin_search&domain='+domain+'&account_id='+account_id); + } + + function addAdHoc() { + showIFrame('iframe',getPageWidth(600),500,'?_page=cart:ad_hoc&account_id='+account_id); + } + + function domainUpdate() { + } + {/literal} + + showCart(); + //--> + +{/if} diff --git a/themes/default/blocks/invoice/checkout_multiple.tpl b/themes/default/blocks/invoice/checkout_multiple.tpl index cf41df53..445a2ac3 100644 --- a/themes/default/blocks/invoice/checkout_multiple.tpl +++ b/themes/default/blocks/invoice/checkout_multiple.tpl @@ -1,38 +1,39 @@ -{$method->exe("invoice","checkout_multiple_preview")} +{$method->exe('invoice','tpl_checkout_multiple_preview')} {if $total} - - - - -
    - - - - -
    - - - - -
    - - - - -
    - - - - -
    {translate module=invoice total=$total}due_invoices_pay{/translate}
    -
    -
    -
    -
    -

    + + + + +
    + + + + +
    + + + + +
    + + + + +
    + + + + +
    +

    {t}The selected invoices total:{/t} {$total}.

    +

    {t}To make payment, please select a payment option below.{/t}

    +
    +
    +
    +
    +
    +
    {/if} - -{ $block->display("invoice:checkoutoptions") } -
    -
    + +{$block->display('invoice:checkoutoptions')} diff --git a/themes/default/blocks/invoice/checkoutoption.tpl b/themes/default/blocks/invoice/checkoutoption.tpl index d387b197..c425ca4a 100644 --- a/themes/default/blocks/invoice/checkoutoption.tpl +++ b/themes/default/blocks/invoice/checkoutoption.tpl @@ -1,7 +1,9 @@ -{$method->exe("checkout","checkoutoption")} -{if $plugin_template != false} - { $block->display($plugin_template) } -{else} -

    Sorry, that checkout option is not valid.

    -{/if} +{assign var=meth value=':'|explode:$VAR._page} + +{$method->exe('checkout','checkoutoption')} +{if $plugin_template != false} + {$block->display($plugin_template)} +{else} +

    {t}Sorry, that checkout option is not valid.{/t}

    +{/if} diff --git a/themes/default/blocks/invoice/checkoutoptions.tpl b/themes/default/blocks/invoice/checkoutoptions.tpl index 28d89325..8d4d34b1 100644 --- a/themes/default/blocks/invoice/checkoutoptions.tpl +++ b/themes/default/blocks/invoice/checkoutoptions.tpl @@ -1,63 +1,69 @@ - - + +
    - {if $VAR.option!=''}{$method->exe("checkout","checkoutoption")}{if $plugin_template != false}{$block->display($plugin_template)}{/if}{/if} + {if $VAR.option != ''} + {$method->exe('checkout','checkoutoption')} + + {if $plugin_template != false} + {$block->display($plugin_template)} + {/if} + {/if}
    -

    -View More Payment Options -

    - - +

    + {t}View More Payment Options{/t} +

    + +
    - - - - -
    - - - - - - - -
    - - - - -
    {translate module=invoice}pay_invoice{/translate}
    -
    - - {if $checkoutoptions} - {foreach from=$checkoutoptions item=checkout key=key} - - - - - {/foreach} - {else} - - - - {/if} -
    {if $checkout.fields.graphic_url==''}{$checkout.fields.name}{else}{$checkout.fields.name}{/if}{$checkout.fields.description}
    {translate module=cart}no_checkout_options{/translate}
    -
    -
    -
    + + + + +
    + + + + + + + +
    {t}Select Your Preferred Payment Option{/t}
    + + {if $checkoutoptions} + {foreach from=$checkoutoptions item=checkout key=key} + + + + + {/foreach} + {else} + + + + {/if} +
    {if $checkout.fields.graphic_url==''}{$checkout.fields.name}{else}{$checkout.fields.name}{/if}{$checkout.fields.description}
    {t}Sorry, no online payment option is available for this order. Please contact us for order information and payment options.{/t}
    +
    +
    +
    - + -{if $VAR.option=='' && $checkout_c == 1} - -{elseif $VAR.option>0} - -{/if} \ No newline at end of file +{if $VAR.option== '' && $checkout_c == 1} + +{elseif $VAR.option > 0} + +{/if} diff --git a/themes/default/blocks/invoice/invoicesoon.tpl b/themes/default/blocks/invoice/invoicesoon.tpl new file mode 100644 index 00000000..9c1b56c8 --- /dev/null +++ b/themes/default/blocks/invoice/invoicesoon.tpl @@ -0,0 +1,72 @@ +{assign var=meth value=':'|explode:$VAR._page} + + +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/search_show_pre.tpl'} + {translate amount=$total_amount module=invoice}search_result_amount{/translate}
    +
    + + + + + +
    + + + + + + + + + + + + + + {foreach from=$invoice item=record} + + + + + + + + + {/foreach} + +
      + + + + + + + +  
    + + + {$record.last_name}, {$record.first_name}{$record.sid} ({$record.sku}){$record.invoice_date}
    {$list->format_currency_num($record.price,$record.billed_currency_id)} 
    +
    + {if $record.billing_status == '1'} + + {else} + + {/if} + {if $record.process_status == '1'} + + {else} + + {/if} + Services + +
    +
    +
    + + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} +{/if} diff --git a/themes/default/blocks/invoice/search_form.tpl b/themes/default/blocks/invoice/search_form.tpl index a31a6a7e..c48a8a2f 100644 --- a/themes/default/blocks/invoice/search_form.tpl +++ b/themes/default/blocks/invoice/search_form.tpl @@ -1,296 +1,142 @@ -{ $method->exe("invoice","search_form") } -{ if ($method->result == FALSE) } - { $block->display("core:method_error") } -{else} -
    - - - - -
    - - - - - - - -
    -
    - {translate module=invoice}title_search{/translate} -
    -
    - - - - - - - - - - - {if $list->is_installed('affiliate')} - - - - - {/if} - - {if $list->is_installed('campaign')} - - - - - {/if} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {if $list->is_installed('host_server') } - - - - - {/if} - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=invoice} - field_id - {/translate} - - -    - {translate} - search_partial - {/translate} -
    - {translate module=invoice} - field_account_id - {/translate} - - {html_select_account name="invoice_account_id" default=$VAR.invoice_account_id} -
    - {translate module=invoice} - field_affiliate_id - {/translate} - - {html_select_affiliate name="invoice_affiliate_id" default=$VAR.invoice_affiliate_id} -
    - {translate module=invoice} - field_campaign_id - {/translate} - - { $list->menu("no", "invoice_campaign_id", "campaign", "name", "all", "form_menu") } -
    - {translate module=invoice} - field_process_status - {/translate} - - { $list->bool("invoice_process_status", "all", "form_menu") } -
    - {translate module=invoice} - field_refund_status - {/translate} - - { $list->bool("invoice_refund_status", "all", "form_menu") } -
    - {translate module=invoice} - paid - {/translate} - - { $list->bool("invoice_billing_status", "all", "form_menu") } -
    - {translate module=invoice} - field_print_status - {/translate} - - { $list->bool("invoice_print_status", "all", "form_menu") } -
    - {translate module=invoice} - field_checkout_plugin_id - {/translate} - - { $list->menu("", "invoice_checkout_plugin_id", "checkout", "name", "all", "form_menu") } -
    - {translate module=invoice} - field_billed_currency_id - {/translate} - - { $list->menu("", "invoice_billed_currency_id", "currency", "name", "all", "form_menu") } -
    - {translate module=invoice} - field_date_orig - {/translate} - - { $list->calender_search("invoice_date_orig", $VAR.invoice_date_orig, "form_field", "") } -
    - {translate module=invoice} - field_due_date - {/translate} - - { $list->calender_search("invoice_due_date", $VAR.invoice_due_date, "form_field", "") } -
    - {translate module=invoice} - field_notice_next_date - {/translate} - - { $list->calender_search("invoice_notice_next_date", $VAR.invoice_notice_next_date, "form_field", "") } -
    - {translate module=invoice} - search_memo - {/translate} - - -    - {translate} - search_partial - {/translate} -
    - {translate module=service} - field_domain_name - {/translate} - - - . - - {translate} - search_partial - {/translate} -
    - {translate module=product} - field_sku - {/translate} - - { $list->menu("", "join_product_id", "product", "sku", "all", "\" onchange=\"showAttributes(this)") } - {literal} - {/literal} -
    - - - -
    - {translate} - search_results_per - {/translate} - - -
    - {translate} - search_order_by - {/translate} - - -
    - - - - - -
    -
    -
    -
    -{ $block->display("core:saved_searches") } -{ $block->display("core:recent_searches") } +{assign var=meth value=':'|explode:$VAR._page} + + +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + +
    + + + + + +
    + + + + + + + +
    {translate module=invoice}title_search{/translate}
    + + + + + + + + + + {if $list->is_installed('affiliate')} + + + + + {/if} + {if $list->is_installed('campaign')} + + + + + {/if} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {if $list->is_installed('host_server')} + + + + + {/if} + + + + + + + + + + {include file='file:../core/search_post.tpl'} +
    {translate module=invoice}field_id{/translate}  {t}"%" for partial match{/t}
    {translate module=invoice}field_account_id{/translate}{osb f=html_select_account name='invoice_account_id' default=$VAR.invoice_account_id}
    {translate module=invoice}field_affiliate_id{/translate}{osb f=html_select_affiliate name='invoice_affiliate_id' default=$VAR.invoice_affiliate_id}
    {translate module=invoice}field_campaign_id{/translate}{$list->menu('no','invoice_campaign_id','campaign','name','','form_menu',true)}
    {translate module=invoice}field_process_status{/translate}{$list->bool('invoice_process_status','all')}
    {translate module=invoice}field_refund_status{/translate}{$list->bool('invoice_refund_status','all')}
    {translate module=invoice}paid{/translate}{$list->bool('invoice_billing_status','all')}
    {translate module=invoice}field_print_status{/translate}{$list->bool('invoice_print_status','all')}
    {translate module=invoice}field_checkout_plugin_id{/translate}{$list->menu('','invoice_checkout_plugin_id','checkout','name','','form_menu',true)}
    {translate module=invoice}field_billed_currency_id{/translate}{$list->menu('','invoice_billed_currency_id','currency','name','','form_menu',true)}
    {translate module=invoice}field_date_orig{/translate}{$list->calender_search('invoice_date_orig',$VAR.invoice_date_orig,'form_field','')}
    {translate module=invoice}field_due_date{/translate}{$list->calender_search('invoice_due_date',$VAR.invoice_due_date,'form_field','')}
    {translate module=invoice}field_notice_next_date{/translate}{$list->calender_search('invoice_notice_next_date',$VAR.invoice_notice_next_date,'form_field','')}
    {translate module=invoice}search_memo{/translate}  {t}"%" for partial match{/t}
    {translate module=service}field_domain_name{/translate} + +   {t}"%" for partial match{/t} +
    {translate module=product}field_sku{/translate} + {$list->menu('','join_product_id','product','sku','','" onchange="showAttributes(this)',true)} + {literal} + + {/literal} +
    + +
    +
    +
    + +
    + + {$block->display('core:saved_searches')} + {$block->display('core:recent_searches')} {/if} diff --git a/themes/default/blocks/invoice/search_show.tpl b/themes/default/blocks/invoice/search_show.tpl index 5c0dd93e..b9ff1897 100644 --- a/themes/default/blocks/invoice/search_show.tpl +++ b/themes/default/blocks/invoice/search_show.tpl @@ -1,148 +1,45 @@ -{$method->exe("invoice","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{assign var=meth value=':'|explode:$VAR._page} + + +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} - {translate amount=$total_amount module=invoice}search_result_amount{/translate} -

    + {include file='file:../core/search_show_pre.tpl'} + + + + +
    + + {$method->exe_noauth($meth.0,'tpl_search_show')} + {foreach from=$search_show item=record} + {include file='file:../core/search_show_tr_record.tpl'} + + + + + + + + {/foreach} +
    {$record.id}{$record.last_name}, {$record.first_name}{$list->date($record.date_orig)}{$list->date($record.due_date)}{$list->format_currency_num($record.total_amt, $record.billed_currency_id)} + {if $record.billing_status == '1'} + Status + {else} + Status + {/if} + {if $record.process_status == '1'} + Status + {else} + Status + {/if} + Services + Account +
    +
    - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - - {foreach from=$invoice item=record} - - - - - - - - - {literal} - - {/literal} - {/foreach} - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -  
    - -   - { $record.id} -   - {$record.last_name}, - {$record.first_name} -   - {$list->date_time($record.date_orig)} - -
    - {$list->format_currency_num($record.total_amt, $record.billed_currency_id)}  -
    -
    -
    - {if $record.billing_status == "1"} - - {else} - - {/if} - {if $record.process_status == "1"} - - {else} - - {/if} - Services -
    -
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    - - - - -
    {translate}search_export_image{/translate}  - {translate}search_print_image{/translate}  - {translate}search_new_image{/translate} {translate module=invoice}title_add{/translate}  -
    -
    + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/invoice/thankyou.tpl b/themes/default/blocks/invoice/thankyou.tpl index ebe718a4..93d00eaf 100644 --- a/themes/default/blocks/invoice/thankyou.tpl +++ b/themes/default/blocks/invoice/thankyou.tpl @@ -1,48 +1,30 @@ - - - -
    - - - - - - - -
    -
    - {translate module=invoice} - thank_you - {/translate} -
    -
    - - - - - - - - - - -
    - {translate module=invoice} - thank_you_text - {/translate} -
    - {if $VAR.id != ""} - - {translate module="invoice"} - invoice_link - {/translate} - - {/if} -
    - {translate module="invoice"} - account_link - {/translate} -
    -
    -
    +
    + + + + + + + +
    {translate module=invoice}thank_you{/translate}
    + + + + + + + + + + +
    {translate module=invoice}thank_you_text{/translate}
    + {if $VAR.id != ''} + {translate module="invoice"}invoice_link{/translate} + {/if} +
    {translate module="invoice"}account_link{/translate}
    +
    +
    diff --git a/themes/default/blocks/invoice/user_search_show.tpl b/themes/default/blocks/invoice/user_search_show.tpl index 94857e8a..ebbdb225 100644 --- a/themes/default/blocks/invoice/user_search_show.tpl +++ b/themes/default/blocks/invoice/user_search_show.tpl @@ -1,160 +1,70 @@ -{$method->exe("invoice","user_search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{assign var=meth value=':'|explode:$VAR._page} + + +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    + {$method->exe('invoice','has_unpaid')} + {if $has_unpaid} + + + + +
    + + + + + + + + + + +
     
    {t}You presently have unpaid invoices totaling:{/t} {$has_unpaid}.
     
    +
    + {/if} + {include file='file:../core/user_search_show_pre.tpl'} - {literal} - - - {/literal} + + + + + +
    + + {$method->exe_noauth($meth.0,'tpl_search_show')} + {foreach from=$search_show item=record} + {include file='file:../core/user_search_show_tr_record.tpl'} + + + + + + {/foreach} +
    {$record.id}{$list->date_time($record.date_orig)}
    {$list->format_currency_num($record.total_amt, $record.actual_billed_currency_id)}
    + {if $record.billing_status == '1'} + + {else} + + {/if} +   + {if $record.process_status == '1'} + + {else} + + {/if} +
    +
    + + - {$method->exe("invoice","has_unpaid")} - {if $has_unpaid} -
    - - - - -
    - - - - -
    - - - - - -
    - - - - -
    - - - - -
    {translate module=invoice total=$has_unpaid}due_invoices_notice{/translate}
    -
    -
    -
    -
    -

    +
    +
    + {if $has_unpaid}{/if} + +
    {/if} - - - -
    - - -
    - - - - - - -
    - - - - - - - - - - {foreach from=$invoice item=record} - - - - - - - - {literal} - - {/literal} - {/foreach} - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -  
    - -   - { $record.id} -   - {$list->date_time($record.date_orig)} - -
    - {$list->format_currency_num($record.total_amt, $record.actual_billed_currency_id)} -  
    -
    -
    -   - {if $record.billing_status == "1"} - - {else} - - {/if} -   - {if $record.process_status == "1"} - - {else} - - {/if} -
    -
    -
    -
    - {if $has_unpaid} - - {/if} - -{/if} diff --git a/themes/default/blocks/invoice/user_view.tpl b/themes/default/blocks/invoice/user_view.tpl index 7dbc9c0b..db640979 100644 --- a/themes/default/blocks/invoice/user_view.tpl +++ b/themes/default/blocks/invoice/user_view.tpl @@ -1,686 +1,427 @@ {if $smarty.const.SESS_LOGGED == false} -{$block->display("account:login")} + {$block->display('account:user_login')} {else} -{if $SESS_LOGGED == "1" } -{ $method->exe("invoice","user_view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} + {assign var=meth value=':'|explode:$VAR._page} + + {* Since this page can also be rendered via a checkout plugin, we need to change the $meth.0/1 to be account/user_view *} + {assign var=meth value=','|explode:'invoice,user_view'} - - - - - + {if $SESS_LOGGED == '1'} + {$method->exe($meth.0,$meth.1)} -{literal} - - -{/literal} + {if ($method->result == false)} + {$block->display('core:method_error')} + {else} - -{foreach from=$invoice item=invoice} + {include file='file:../core/user_view_pre.tpl'} - -{if $form_validation} -{ $block->display("core:alert_fields") } -{/if} - - -{ if $invoice.billing_status == "0" } - { $block->display("invoice:checkoutoptions") } -{/if} - - -
    - - - - -
    - - - - - - - - - - - {* show discount details *} - {if $invoice.discount_arr != '' && $invoice.discount_amt > 0} - - - - {/if} - - - {assign var=cc_user value=true} - {* show checkout/payment plugin details *} - {if $invoice.checkout_plugin_id != '0'} - {assign var=sql1 value=" AND id='"} - {assign var=sql2 value="' "} - {assign var=sql3 value=$invoice.checkout_plugin_id} - {assign var=sql value=$sql1$sql3$sql2} - {if $list->smarty_array("checkout", "checkout_plugin", $sql, "checkout") } - {assign var=checkout_plugin value=$checkout[0].checkout_plugin} - {assign var="ablock" value="checkout_plugin:plugin_inv_"} - {assign var="blockfile" value="$ablock$checkout_plugin"} - {$block->display($blockfile)} - {/if} - {/if} - - - - - - - - - - - - - - - -
    -
    - {translate module=invoice} - title_view - {/translate} - { $invoice.id } -
    -
    - - - - - - - - - - - -
    - {translate module=invoice} - field_date_orig - {/translate} - - {translate module=invoice} - field_date_last - {/translate} - - {translate module=invoice} - field_due_date - {/translate} -
    - {$list->date_time($invoice.date_orig)} - - {$list->date_time($invoice.date_last)} - - - {$list->date($invoice.due_date)} -
    -
    - - - - - - - - - - - -
    - {translate module=invoice} - field_process_status - {/translate} - - {translate module=invoice} - field_billing_status - {/translate} - - {translate module=invoice} - print_invoice - {/translate} -
    - {if $invoice.process_status == 1} - {translate}true{/translate} - {else} - {translate}false{/translate} - {/if} - - {if $invoice.balance == 0} - {translate module=invoice} - paid - {/translate} - {else} - {$list->format_currency_num($invoice.balance,$invoice.actual_billed_currency_id)} - {/if} - E-mail User
    -
    - - - - - - -
    - {translate module=invoice} - field_discount_amt - {/translate} - - {assign var=discount_details value=$invoice.discount_popup} - - {$list->format_currency_num($invoice.discount_amt, $invoice.actual_billed_currency_id)} -  
    -
    - - - - - - - - - - - -
    - {translate module=invoice} - field_tax_amt - {/translate} - {translate module=invoice} field_discount_amt {/translate} - {translate module=invoice} field_tax_id {/translate}
    - {$list->format_currency_num($invoice.tax_amt, $invoice.actual_billed_currency_id)} - {if $invoice.discount_amt > 0} - - - {else}---{/if} - {if $invoice.tax_amt > 0} {foreach from=$invoice.tax_arr item=taxz} {$taxz.description} - {$list->format_currency_num($taxz.amount, $invoice.actual_billed_currency_id)}
    -{/foreach} {else}---{/if}
    -
    - - - - - - - - - - - -
    - {translate module=invoice} - field_total_amt - {/translate} - - {translate module=invoice} - field_billed_amt - {/translate} -
    - {$list->format_currency_num($invoice.total_amt, $invoice.actual_billed_currency_id)} - - {$list->format_currency_num($invoice.billed_amt, $invoice.actual_billed_currency_id)} -  
    -
    -
    - {translate module=invoice} - products_ordered - {/translate} -
    -
    - - {foreach from=$cart item=cart} -
    - {if $cart.item_type == "2"} - - - - - -
    - - - - - -
    - - - - - - - - {if $cart.cart_type == "1"} - {if $cart.host_type == "ns_transfer"} - {/if} - {if $cart.host_type == "ip"} - {/if} - {/if} -
    - - - - - - -
    - {$cart.domain_name|upper} - . - {$cart.domain_tld|upper} -   - - - - -
    -
       - {if $cart.sku == "DOMAIN-REGISTER"} - {translate module=cart} - register - {/translate} - {elseif $cart.sku == "DOMAIN-TRANSFER"} - {translate module=cart} - transfer - {/translate} - {elseif $cart.sku == "DOMAIN-PARK"} - {translate module=cart} - park - {/translate} - {elseif $cart.sku == "DOMAIN-RENEW"} - {translate module=cart} - renew - {/translate} - {/if} -
    -
    - - - - - -
    - {translate module=cart} - base_price - {/translate} - -
    -
    - {$list->format_currency_num($cart.price_base, $invoice.actual_billed_currency_id)} -
    -
    -
    -
    -
    - {if $cart.sku != 'DOMAIN-PARK'} - - {/if} -
    -
    - {elseif $cart.item_type == "3"} - - - - - -
    - - - - - -
    - - - - - - - - {if $cart.cart_type == "1"} - {if $cart.host_type == "ns_transfer"} - {/if} - {if $cart.host_type == "ip"} - {/if} - {/if} -
    - - - - - - -
    - {$cart.product_name} - ( - {$cart.sku} - ) - - - - - - {if $cart.attribute_popup != ""} - - -
    - - - -
    - {/if} -
    -
       - {translate module=cart} - price_type_one - {/translate} -
    -
    - -
    - - - - - - - - - -
    - {translate module=cart} - base_price - {/translate} - -
    -
    - {$list->format_currency_num($cart.price_base, $invoice.actual_billed_currency_id)} -
    -
    -
    -
    -
    - {translate module=cart} - quantity - {/translate} - - {$cart.quantity} -
    -
    -
    -
    - {else} - - - - - -
    - - - - - -
    - - - - - - - - - - - {if $invoice.type != "1" && $cart.service_id > 0} - - - - {/if} - {if $cart.item_type == "1"} - {if $cart.domain_type == "ns_transfer"} - - - - {/if} - {if $cart.domain_type == "ip"} - - - - {/if} - {/if} -
    - - - - - - -
    - {if $list->translate("product_translate","name", "product_id", $cart.product_id, "translate_product")} - {/if} - - {$translate_product.name} -  ( - {$cart.sku} - )   - {if $cart.attribute_popup != ""} - - -
    - - - -
    - {/if} -
    -
       - {if $cart.range != ""} - {$cart.range} - {else} - {if $cart.price_type == "0"} - {translate module=cart} - price_type_one - {/translate} - {/if} - {if $cart.price_type == "1"} - {translate module=cart} - price_type_recurr - {/translate} - {/if} - {if $cart.price_type == "2"} - {translate module=cart} - price_type_trial - {/translate} - {/if} - {/if} -
       - {if $cart.price_type == "1"} - {$list->format_currency_num($cart.price_base, $invoice.actual_billed_currency_id)} - {if $cart.recurring_schedule == "0" } - {translate module=cart} - recurr_week - {/translate} - {/if} - {if $cart.recurring_schedule == "1" } - {translate module=cart} - recurr_month - {/translate} - {/if} - {if $cart.recurring_schedule == "2" } - {translate module=cart} - recurr_quarter - {/translate} - {/if} - {if $cart.recurring_schedule == "3" } - {translate module=cart} - recurr_semianual - {/translate} - {/if} - {if $cart.recurring_schedule == "4" } - {translate module=cart} - recurr_anual - {/translate} - {/if} - {if $cart.recurring_schedule == "5" } - {translate module=cart} - recurr_twoyear - {/translate} - {/if} - {if $cart.recurring_schedule == "6" } - {translate module=cart} - recurr_threeyear - {/translate} - {/if} -    +   - {$list->format_currency_num($cart.price_setup, $invoice.actual_billed_currency_id)} - {translate module=cart} - setup - {/translate} - {/if} -
       - {translate module=cart service=$cart.service_id} - service_upgrade - {/translate} -
       - {translate module=cart} - host_type_domain - {/translate} - - - {$cart.domain_name} - . - {$cart.domain_tld} -
       - {translate module=cart} - host_type_ip - {/translate} -
    -
    - -
    - - - - - - - - - - - - - -
    - {translate module=cart} - base_price - {/translate} - -
    - {$list->format_currency_num($cart.price_base, $invoice.actual_billed_currency_id)} -
    -
    -
    - {translate module=cart} - setup_price - {/translate} - -
    - {$list->format_currency_num($cart.price_setup, $invoice.actual_billed_currency_id)} -
    -
    -
    - {translate module=cart} - quantity - {/translate} - - {$cart.quantity} -
    -
    -
    -
    - {/if} - {/foreach} -
    -
    -
    - -
    -
    -
    - -{/foreach} -{/if} -{else} -{ $block->display("account:login") } -{/if} - - -{ $method->exe("invoice","custom_tracking") } + + + + + + + + {if $record.billing_status == '0'} + {$block->display('invoice:checkoutoptions')} + {/if} + + {if $record} +
    + + + + + +
    + + + + + + + + + + + + {* show discount details *} + {if $record.discount_arr != '' && $record.discount_amt > 0} + + + + {/if} + + {* show checkout/payment plugin details *} + + {assign var=cc_user value=true} + {if $record.checkout_plugin_id != '0'} + {assign var=sql1 value=" AND id='"} + {assign var=sql2 value="' "} + {assign var=sql3 value=$record.checkout_plugin_id} + {assign var=sql value=$sql1$sql3$sql2} + {if $list->smarty_array('checkout','checkout_plugin',$sql,'checkout')} + {assign var=checkout_plugin value=$checkout[0].checkout_plugin} + {assign var='ablock' value='checkout_plugin:plugin_inv_'} + {assign var='blockfile' value="$ablock$checkout_plugin"} + {$block->display($blockfile)} + {/if} + {/if} + + +
    {osb f=tt} {$record.id}
    + + + + + + + + + + + +
    {osb f=tf field=date_orig}{osb f=tf field=due_date}{osb f=tf field=total_amt}
    {$list->date($record.date_orig)}{$list->date($record.due_date)}{$list->format_currency_num($record.total_amt,$record.actual_billed_currency_id)}
    +
    + + + + + + + + + + + +
    {osb f=tf field=billed_amt}{t}Print Invoice{/t}{osb f=tf field=billing_status}
    {$list->format_currency_num($record.billed_amt,$record.actual_billed_currency_id)}Print + + {if $record.balance == 0} + {t}Paid{/t} + {else} + {$list->format_currency_num($record.balance,$record.actual_billed_currency_id)} + {/if} + +
    +
    + + + + + + +
    {osb f=tf field=discount_amt} + {assign var=discount_details value=$record.discount_popup} + {$list->format_currency_num($record.discount_amt,$record.actual_billed_currency_id)} 
    +
    +
    + + + + +
    + + + + +
    + + + + + + + + + + + +
    {osb f=tf field=tax_amt}{osb f=tf field=discount_amt} 
    {$list->format_currency_num($record.tax_amt,$record.actual_billed_currency_id)} + {if $record.discount_amt > 0} + + + {else}---{/if} +  
    +
    +
    +
    +
    +
    + + + + +
    + + + + + + + +
    {t}Products Ordered{/t}
    + + {foreach from=$cart item=cart} +
    + {if $cart.item_type == '2'} + {* include file='file:../cart/cart_table_type_2.tpl' disable=true *} + + + + + +
    + + + + + +
    + + + + + + + +
    + + + + + + +
    {$cart.domain_name|upper}.{$cart.domain_tld|upper}
      
    +
    + {if $cart.sku=='DOMAIN-REGISTER'} + {t}Register{/t} + {elseif $cart.sku=='DOMAIN-TRANSFER'} + {t}Transfer{/t} + {elseif $cart.sku=='DOMAIN-PARK'} + {t}Park{/t} + {elseif $cart.sku=='DOMAIN-RENEW'} + {t}Renew{/t} + {/if} +
    +
    + + + + + +
    {t}Base Price{/t} +
    +
    {$list->format_currency($cart.price_base,$record.actual_billed_currency_id)}
    +
    +
    +
    +
    + {if $cart.sku != 'DOMAIN-PARK'} + + {/if} +
    +
    + + {elseif $cart.item_type == '3'} + {* include file='file:../cart/cart_table_type_3.tpl' disable=true *} + + + + + +
    + + + + + +
    + + + + + + + +
    + + + + + + +
    {$cart.product_name}
    ({$cart.sku}) + {if $cart.attribute_popup != ''} + +
    + + Details + +
    + {/if} +
    +
    {t}One-time Charge{/t}
    +
    + +
    + + + + + + + + + +
    {t}Base Price{/t} +
    +
    {$list->format_currency($cart.price_base,$record.billed_currency_id)}
    +
    +
    +
    +
    {t}Quantity{/t}{$cart.quantity}
    +
    +
    +
    + + {else} + {* include file='file:../cart/cart_table_type_x.tpl' disable=true *} + + + + + +
    + + + + + +
    + + + + + + + + + + + {if $record.type != '1' && $cart.service_id > 0} + + + + {/if} + {if $cart.item_type == '1'} + {if $cart.domain_type == 'ns_transfer'} + + + + {/if} + {if $cart.domain_type == 'ip'} + + + + {/if} + {/if} +
    + + + + + + +
    {if $list->translate('product_translate','name','product_id',$cart.product_id,'translate_product')}{/if}
    {$translate_product.name}
    ({$cart.sku}) + {if $cart.attribute_popup != ''} + +
    + + Details + +
    + {/if} +
    +
    + {if $cart.range != ''} + {$cart.range} + {else} + {$list->menu_staticlist('pricetype','','',$cart.price_type,'form_menu')} + {/if} +
    + {if $cart.price_type == "1"} + {$list->format_currency_num($cart.price_base,$record.actual_billed_currency_id)} + {$list->menu_staticlist('recur_schedule','','',$cart.recurring_schedule,'form_menu')} + + + {$list->format_currency_num($cart.price_setup,$record.actual_billed_currency_id)} + {t}Setup{/t} + {/if} +
    {translate module=cart service=$cart.service_id}service_upgrade{/translate}
    {translate module=cart}host_type_domain{/translate} - {$cart.domain_name}. {$cart.domain_tld}
    {translate module=cart}host_type_ip{/translate}
    +
    + +
    + + + + + + + + + + + + + +
    {t}Base Price{/t} +
    {$list->format_currency($cart.price_base,$record.billed_currency_id)}
    +
    +
    {t}Setup Price{/t} +
    {$list->format_currency($cart.price_setup,$record.billed_currency_id)}
    +
    +
    {t}Quantity{/t}{$cart.quantity}
    +
    +
    +
    + {/if} + {/foreach} +
    +
    + +
    + {/if} + + {/if} + {else} + {$block->display('account:login')} + {/if} + + + {$method->exe('invoice','custom_tracking')} {/if} diff --git a/themes/default/blocks/invoice/view.tpl b/themes/default/blocks/invoice/view.tpl index f1cda4f9..c40cf00c 100644 --- a/themes/default/blocks/invoice/view.tpl +++ b/themes/default/blocks/invoice/view.tpl @@ -1,1231 +1,703 @@ -{ $method->exe("invoice","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} -{literal} - - -{/literal} - - -{foreach from=$invoice item=invoice} + {elseif $VAR.area == "affiliate"} + document.getElementById('affiliate').style.display='block'; + {/if} + {literal} + } + {/literal} + //--> + + + - -{if $form_validation} - { $block->display("core:alert_fields") } + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} + + +
    + + + + + +
    + + + + + + + + + + + + + + + + +
    {osb f=tt} {$record.id}
    + + + + +
    + + + + + + +
    + + + + + +
    +
    +
    + {t}Items Purchased{/t} + | {t}Billing Details{/t} + | {t}Services{/t} + {if $list->is_installed('affiliate')} + | {t}Affiliate & Campaign Details{/t} + {/if} + | {t}Memos{/t} +
    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=total_amt}{osb f=tf field=billing_status}{osb f=tf field=billed_amt}
     
    {$list->format_currency_num($record.total_amt,$record.billed_currency_id)}
      + {if $record.balance == 0} + {t}Paid{/t} + {else} + {$list->format_currency_num($record.balance,$record.billed_currency_id)} ({t}Reconcile Invoice{/t}) + {/if} +   + {if $record.billed_amt > 0} + {$list->format_currency_num($record.billed_amt,$record.billed_currency_id)} ({t}Refund Invoice{/t}) + {elseif $record.total_amt > 0} + --- + {/if} +
    {osb f=tf field=account_id}{osb f=tf field=due_date}{osb f=tf field=discount_amt}
     {osb f=html_select_account name='invoice_account_id' default=$record.account_id} {$list->date($record.due_date)}  + {if $record.discount_amt > 0} + + + {else} + --- + {/if} +
    {osb f=tf field=date_orig}{osb f=tf field=process_status}{osb f=tf field=tax_amt}
     {$list->date_time($record.date_orig)}  + {if $record.process_status == 1} + Yes ({t}Void Invoice & Services{/t}) + {elseif $record.billing_status == 1} + No ({t}Approve Invoice & Services{/t}) + {else} + {t}Pending Billing{/t} + {/if} +   + {if $record.tax_amt > 0} + {$list->format_currency_num($record.tax_amt,$record.billed_currency_id)} + {else} + --- + {/if} +
    {osb f=tf field=date_last}{osb f=tf field=print_status}{osb f=tf field=tax_id}
     {$list->date_time($record.date_last)}  + {$list->bool('',$record.print_status)} ({t}Print Invoice{/t}) + +   + {if $record.tax_amt > 0} + {foreach from=$record.tax_arr item=taxz} + {$taxz.description} - {$list->format_currency_num($taxz.amount,$record.billed_currency_id)}
    + {/foreach} + {else}---{/if} +
    +
    +
    + + + + + + +
    + {if $record.billing_status==0 || $record.refund_status==1 || $record.total_amt==0} + + {/if} +
    +
    +
    + +
    +
    + + + + + + +
    + + + + + + + {* show checkout/payment plugin details *} + {if $record.checkout_plugin_id != '0'} + {assign var=sql1 value=" AND id='"} + {assign var=sql2 value="' "} + {assign var=sql3 value=$record.checkout_plugin_id} + {assign var=sql value=$sql1$sql3$sql2} + {if $list->smarty_array('checkout','checkout_plugin',$sql,'checkout')} + {assign var=checkout_plugin value=$checkout[0].checkout_plugin} + {assign var='ablock' value='checkout_plugin:plugin_inv_'} + {assign var='blockfile' value="$ablock$checkout_plugin"} + {$block->display($blockfile)} + {/if} + {/if} + + + + + +
    {translate module=invoice}title_billing{/translate}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=notice_count} + {$record.notice_count} Resend Invoice + {osb f=tf field=due_date}{$list->calender_view('invoice_due_date',$record.due_date,'form_field')}
    {osb f=tf field=notice_max}{osb f=tf field=notice_next_date}{$list->calender_view('invoice_notice_next_date',$record.notice_next_date,'form_field')}
    {osb f=tf field=grace_period}{osb f=tf field=suspend_billing}{$list->bool('invoice_suspend_billing',$record.suspend_billing,'" onchange="submit()')}
    {osb f=tf field=checkout_plugin_id}{$record.checkout_plugin}Terms + {if $record.net_term_id} + + + + + {foreach from=$record.termdates item=td} + + + + + {/foreach} +
    {osb f=html_select name='net_term_id' table='net_term' field='name' method='net_term' default=$record.net_term_id}
    {$list->date($td.date)}{$td.desc}
    + {else} + Not Defined + {/if} +
    IP Address{$record.ip}
    +
    +
    +
    + +
    +
    + + + + + +
    + + + + + + + +
    {t}Affiliate & Campaign Details{/t}
    + + + + + + + + + + + +
    + + {if $record.affiliate_id != ''} + {assign var=affiliate_details value=$record.affiliate_popup} + {osb f=tf field=affiliate_id} + {else} + {osb f=tf field=affiliate_id} + {/if} + + {translate module=invoice}affiliate_commissions{/translate}{osb f=tf field=campaign_id}
    {osb f=html_select_affiliate name='invoice_affiliate_id' default=$record.affiliate_id} + {if $record.affiliate_commissions > 0} + {$list->format_currency($record.affiliate_commissions,'')} + {else} + ---- + {/if} + {$list->menu('no','invoice_campaign_id','campaign','name',$record.campaign_id,'" onchange="submit()',true)}
    +
    +
    +
    + +
    +
    + + + + + + +
    + + + + + + + +
    {translate module=invoice}title_items{/translate}
    + + {foreach from=$cart item=cart} +
    + {if $cart.item_type=='2'} + + + + + +
    + + + + + +
    + + + + + + + +
    + + + + + + +
    {$cart.domain_name|upper}.{$cart.domain_tld|upper}
      
    +
    + {if $cart.sku == 'DOMAIN-REGISTER'} + {t}Register{/t} + {elseif $cart.sku == 'DOMAIN-TRANSFER'} + {t}Transfer{/t} + {elseif $cart.sku == 'DOMAIN-PARK'} + {t}Park{/t} + {elseif $cart.sku == 'DOMAIN-RENEW'} + {t}Renew{/t} + {/if} +
    +
    + + + + + +
    {translate module=cart}base_price{/translate} +
    +
    {$list->format_currency($cart.price_base,$record.billed_currency_id)}
    +
    +
    +
    +
    + {if $cart.sku != 'DOMAIN-PARK'} + + {/if} +
    +
    + + {elseif $cart.item_type == '3'} + + + + + +
    + + + + + +
    + + + + + + + +
    + + + + + + +
    {$cart.product_name}
    {$cart.sku} + {if $cart.attribute_popup != ''} + +
    + + Details + +
    + {/if} +
    +
    {t}One-time Charge{/t}
    +
    + +
    + + + + + + + + + +
    {t}Base Price{/t} +
    +
    {$list->format_currency($cart.price_base,$record.billed_currency_id)}
    +
    +
    +
    +
    {t}Quantity{/t}{$cart.quantity}
    +
    +
    +
    + + {else} + + + + + +
    + + + + + +
    + + + + + + + + + + + + {if $record.type != '1' && $cart.service_id > 0} + + + + {/if} + + {if $cart.item_type == '1'} + {if $cart.domain_type == 'ns_transfer'} + + + + {/if} + {if $cart.domain_type == 'ip'} + + + + {/if} + {/if} +
    + + + + + + +
    {if $list->translate('product_translate','name','product_id',$cart.product_id,'translate_product')}{/if}
    {$translate_product.name}
      + {if $record.type == 1 || $cart.service_id > 0}{$cart.service_id} -{/if} + {$cart.sku} + {if $cart.domain_name != ''}({$cart.domain_name}. {$cart.domain_tld}){/if} + + {if $cart.attribute_popup != ''} + +
    + + Details + +
    + {/if} +
    +
    + {if $cart.range != ''} + {$cart.range} + {else} + {$list->menu_staticlist('pricetype','','',$cart.price_type,'','')} + {/if} +
    + {if $cart.price_type == '1'} + {$list->format_currency($cart.price_base,$record.billed_currency_id)} + {$list->menu_staticlist('recur_schedule','','',$cart.recurring_schedule,'','')} + +  {$list->format_currency($cart.price_setup,$record.billed_currency_id)} {t}Setup{/t} + {/if} +
    {translate module=cart service=$cart.service_id}service_upgrade{/translate}
    {translate module=cart}host_type_domain{/translate} - {$cart.domain_name}. {$cart.domain_tld}
    {translate module=cart}host_type_ip{/translate}
    +
    + +
    + + + + + + + + + + + + + +
    {t}Base Price{/t} +
    {$list->format_currency($cart.price_base,$record.billed_currency_id)}
    +
    +
    {t}Setup Price{/t} +
    {$list->format_currency($cart.price_setup,$record.billed_currency_id)}
    +
    +
    {t}Quantity{/t}{$cart.quantity}
    +
    +
    +
    + {/if} + {/foreach} +
    +
    +
    + + {include file='file:../core/view_post.tpl'} +
    + +
    +
    {/if} - -
    - - - - -
    - - - - - - - - - - - - - - - - -
    -
    - {translate module=invoice} - title_view - {/translate} - { $invoice.id } -
    -
    - - - - -
    - - - - - - -
    - - - - - -
    -
    -
    -
    - - {translate module=invoice} - title_items - {/translate} | - - - {translate module=invoice} - title_billing - {/translate} | - - - {translate module=invoice} - title_service - {/translate} | - - {if $list->is_installed("affiliate") } - - {translate module=invoice} - title_affiliate - {/translate} | - {/if} - - - - {translate module=invoice} - title_memo - {/translate} - - -
    -
    - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=invoice} - field_total_amt - {/translate} - - {translate module=invoice} - field_billing_status - {/translate} - - {translate module=invoice} - field_billed_amt - {/translate} -
      - {$list->format_currency_num($invoice.total_amt, $invoice.billed_currency_id)} -   - {if $invoice.balance == 0} - {translate module=invoice} - paid - {/translate} - {else} - {$list->format_currency_num($invoice.balance,$invoice.billed_currency_id)} - ( - {translate module=invoice} - jump_reconcile - {/translate} - ) - {/if} -   - {if $invoice.billed_amt > 0} - {$list->format_currency_num($invoice.billed_amt,$invoice.billed_currency_id)} - ( - {translate module=invoice} - jump_refund - {/translate} - ) - {elseif $invoice.total_amt > 0} - --- - {/if} -
    - {translate module=service} - field_account_id - {/translate} - - {translate module=invoice} - field_due_date - {/translate} - - {translate module=invoice} - field_discount_amt - {/translate} -
      - {html_select_account name="invoice_account_id" default=$invoice.account_id} -   - {$list->date($invoice.due_date)} -   - {if $invoice.discount_amt > 0} - - - {else}---{/if} -
    - {translate module=invoice} - field_date_orig - {/translate} - - {translate module=invoice} - field_process_status - {/translate} - - {translate module=invoice} - field_tax_amt - {/translate} -
      - {$list->date_time($invoice.date_orig)} -   - {if $invoice.process_status == 1} - Yes ( - {translate module=invoice} - jump_void - {/translate} - ) - {elseif $invoice.billing_status == 1} - No ( - {translate module=invoice} - jump_approve - {/translate} - ) - {else} - {translate module=invoice} - billing_pending - {/translate} - {/if} -   - {if $invoice.tax_amt > 0} - {$list->format_currency_num($invoice.tax_amt, $invoice.billed_currency_id)} - {else}---{/if} -
    - {translate module=invoice} - field_date_last - {/translate} - - {translate module=invoice} - field_print_status - {/translate} - - {translate module=invoice} - field_tax_id - {/translate} -
      - {$list->date_time($invoice.date_last)} - -   - {if $invoice.print_status == 1} - {translate} - true - {/translate} - {else} - {translate} - false - {/translate} - {/if} - - ( - {translate module=invoice} - jump_pdf - {/translate} ) -   - {if $invoice.tax_amt > 0} - {foreach from=$invoice.tax_arr item=taxz} - {$taxz.description} - {$list->format_currency_num($taxz.amount, $invoice.billed_currency_id)}
    - {/foreach} - {else}---{/if} -
    -
    -
    - - - - - - -
    - - - - {if $invoice.billing_status==0 || $invoice.refund_status==1 || $invoice.total_amt==0 } - - {/if} -
    -
    -
    - -
    -
    - - - - -
    - - - - - - - {* show checkout/payment plugin details *} - {if $invoice.checkout_plugin_id != '0'} - {assign var=sql1 value=" AND id='"} - {assign var=sql2 value="' "} - {assign var=sql3 value=$invoice.checkout_plugin_id} - {assign var=sql value=$sql1$sql3$sql2} - {if $list->smarty_array("checkout", "checkout_plugin", $sql, "checkout") } - {assign var=checkout_plugin value=$checkout[0].checkout_plugin} - {assign var="ablock" value="checkout_plugin:plugin_inv_"} - {assign var="blockfile" value="$ablock$checkout_plugin"} - {$block->display($blockfile)} - {/if} - {/if} - - - - - -
    -
    - {translate module=invoice} - title_billing - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=invoice} - field_notice_count - {/translate} - - - - - - -
    - { $invoice.notice_count } - Resend Invoice
    -
    - {translate module=invoice} - field_due_date - {/translate} - - { $list->calender_view("invoice_due_date", $invoice.due_date, "form_field", $invoice.id) } -
    - {translate module=invoice} - field_notice_max - {/translate} - - - - {translate module=invoice} - field_notice_next_date - {/translate} - - { $list->calender_view("invoice_notice_next_date", $invoice.notice_next_date, "form_field", $invoice.id) } -
    - - {translate module=invoice} - field_grace_period - {/translate} - - - - {translate module=invoice} - field_suspend_billing - {/translate} - - { $list->bool("invoice_suspend_billing", $invoice.suspend_billing, " onChange=\"submit()\"") } -
    {translate module=invoice}field_checkout_plugin_id{/translate}{$invoice.checkout_plugin}IP Address {$invoice.ip}
    -
    -
    -
    - -
    -
    - - - - -
    - - - - - - - -
    -
    - {translate module=invoice} - title_affiliate - {/translate} -
    -
    - - - - - - - - - - - -
    - {if $invoice.affiliate_id != ""} - {assign var=affiliate_details value=$invoice.affiliate_popup} - {translate module=invoice} - field_affiliate_id - {/translate} - {else} - {translate module=invoice} - field_affiliate_id - {/translate} - {/if} - - {translate module=invoice} - affiliate_commissions - {/translate} - - {translate module=invoice} - field_campaign_id - {/translate} -
    - {html_select_affiliate name="invoice_affiliate_id" default=$invoice.affiliate_id} - - {if $invoice.affiliate_commissions > 0} - {$list->format_currency($invoice.affiliate_commissions, '')} - {else} - ---- - {/if} - - {$list->menu("no", "invoice_campaign_id", "campaign", "name", $invoice.campaign_id, "\" onChange=\"submit()", all) } -
    -
    -
    - -
    - -
    -
    - - - - -
    - - - - - - - -
    -
    - {translate module=invoice} - title_items - {/translate} -
    -
    - - {foreach from=$cart item=cart} -
    - {if $cart.item_type == "2"} - - - - - -
    - - - - - -
    - - - - - - - - {if $cart.cart_type == "1"} - {if $cart.host_type == "ns_transfer"} - {/if} - {if $cart.host_type == "ip"} - {/if} - {/if} -
    - - - - - - -
    - {$cart.domain_name|upper} - . - {$cart.domain_tld|upper} -   - - - - -
    -
       - {if $cart.sku == "DOMAIN-REGISTER"} - {translate module=cart} - register - {/translate} - {elseif $cart.sku == "DOMAIN-TRANSFER"} - {translate module=cart} - transfer - {/translate} - {elseif $cart.sku == "DOMAIN-PARK"} - {translate module=cart} - park - {/translate} - {elseif $cart.sku == "DOMAIN-RENEW"} - {translate module=cart} - renew - {/translate} - {/if}
    -
    - - - - - -
    - {translate module=cart} - base_price - {/translate} - -
    -
    - {$list->format_currency($cart.price_base, $invoice.billed_currency_id)} -
    -
    -
    -
    -
    - {if $cart.sku != 'DOMAIN-PARK'} - - {/if} -
    -
    - {elseif $cart.item_type == "3"} - - - - - -
    - - - - - -
    - - - - - - - - {if $cart.cart_type == "1"} - {if $cart.host_type == "ns_transfer"} - {/if} - {if $cart.host_type == "ip"} - {/if} - {/if} -
    - - - - - - -
    - {$cart.product_name} - ( - {$cart.sku} - ) - - - - - - {if $cart.attribute_popup != ""} - -
    - - - -
    - {/if} -
    -
       - {translate module=cart} - price_type_one - {/translate} -
    -
    - -
    - - - - - - - - - -
    - {translate module=cart} - base_price - {/translate} - -
    -
    - {$list->format_currency($cart.price_base, $invoice.billed_currency_id)} -
    -
    -
    -
    -
    - {translate module=cart} - quantity - {/translate} - - {$cart.quantity} -
    -
    - -
    -
    - {else} - - - - - -
    - - - - - -
    - - - - - - - - - - - {if $invoice.type != "1" && $cart.service_id > 0} - - - - {/if} - {if $cart.item_type == "1"} - {if $cart.domain_type == "ns_transfer"} - - - - {/if} - {if $cart.domain_type == "ip"} - - - - {/if} - {/if} -
    - - - - - - -
    - {if $list->translate("product_translate","name", "product_id", $cart.product_id, "translate_product")} - {/if} - - {$translate_product.name} -   - {if $invoice.type == 1 || $cart.service_id > 0} - - {$cart.service_id} - - - {/if} - - {$cart.sku} - - {if $cart.domain_name != ""} - ( - {$cart.domain_name} - . - {$cart.domain_tld} - ) - {/if} - - {if $cart.attribute_popup != ""} - - -
    - - - -
    - {/if} -
    -
       - {if $cart.range != ""} - {$cart.range} - {else} - {if $cart.price_type == "0"} - {translate module=cart} - price_type_one - {/translate} - {/if} - {if $cart.price_type == "1"} - {translate module=cart} - price_type_recurr - {/translate} - {/if} - {if $cart.price_type == "2"} - {translate module=cart} - price_type_trial - {/translate} - {/if} - {/if} -
       - {if $cart.price_type == "1"} - {$list->format_currency($cart.price_base, $invoice.billed_currency_id)} - {if $cart.recurring_schedule == "0" } - {translate module=cart} - recurr_week - {/translate} - {/if} - {if $cart.recurring_schedule == "1" } - {translate module=cart} - recurr_month - {/translate} - {/if} - {if $cart.recurring_schedule == "2" } - {translate module=cart} - recurr_quarter - {/translate} - {/if} - {if $cart.recurring_schedule == "3" } - {translate module=cart} - recurr_semianual - {/translate} - {/if} - {if $cart.recurring_schedule == "4" } - {translate module=cart} - recurr_anual - {/translate} - {/if} - {if $cart.recurring_schedule == "5" } - {translate module=cart} - recurr_twoyear - {/translate} - {/if} - {if $cart.recurring_schedule == "6" } - {translate module=cart} - recurr_threeyear - {/translate} - {/if} -    +   - {$list->format_currency($cart.price_setup, $invoice.billed_currency_id)} - {translate module=cart} - setup - {/translate} - {/if} -
       - {translate module=cart service=$cart.service_id} - service_upgrade - {/translate} -
       - {translate module=cart} - host_type_domain - {/translate} - - - {$cart.domain_name} - . - {$cart.domain_tld} -
       - {translate module=cart} - host_type_ip - {/translate} -
    -
    - -
    - - - - - - - - - - - - - -
    - {translate module=cart} - base_price - {/translate} - -
    - {$list->format_currency($cart.price_base, $invoice.billed_currency_id)} -
    -
    -
    - {translate module=cart} - setup_price - {/translate} - -
    - {$list->format_currency($cart.price_setup, $invoice.billed_currency_id)} -
    -
    -
    - {translate module=cart} - quantity - {/translate} - - {$cart.quantity} -
    -
    -
    -
    - {/if} - {/foreach} -
    -
    -
    -
    - - - - - -
    -{/foreach} -{/if} + -
    - -
    - -{literal} - -{/literal} diff --git a/themes/default/blocks/invoice_item/add.tpl b/themes/default/blocks/invoice_item/add.tpl index 835bf694..45b5fa54 100644 --- a/themes/default/blocks/invoice_item/add.tpl +++ b/themes/default/blocks/invoice_item/add.tpl @@ -1,131 +1,76 @@ - - {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} -
    + - - - - -
    - - - - - - - -
    -
    - {translate module=invoice_item}title_add{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=invoice_item} - field_sku - {/translate} - -
    - {translate module=invoice_item} - field_item_type - {/translate} - { $list->bool("invoice_item_item_type", $VAR.invoice_item_item_type, "form_menu") } -
    - {translate module=invoice_item} - field_product_attr - {/translate} - -
    - {translate module=invoice_item} - field_price_base - {/translate} - -
    - {translate module=invoice_item} - field_price_setup - {/translate} - -
    - {translate module=invoice_item} - field_recurring_schedule - {/translate} - -
    - {translate module=invoice_item} - field_domain_name - {/translate} - -
    - {translate module=invoice_item} - field_domain_tld - {/translate} - -
    - {translate module=invoice_item} - field_domain_term - {/translate} - -
    - {translate module=invoice_item} - field_domain_type - {/translate} - -
    - - - - -
    -
    -
    -
    + + + + +
    + + + + + + + +
    {translate module=invoice_item}title_add{/translate}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {translate module=invoice_item}field_sku{/translate}
    {translate module=invoice_item}field_item_type{/translate}{$list->bool('invoice_item_item_type',$VAR.invoice_item_item_type)}
    {translate module=invoice_item}field_product_attr{/translate}
    {translate module=invoice_item}field_price_base{/translate}
    {translate module=invoice_item}field_price_setup{/translate}
    {translate module=invoice_item}field_recurring_schedule{/translate}
    {translate module=invoice_item}field_domain_name{/translate}
    {translate module=invoice_item}field_domain_tld{/translate}
    {translate module=invoice_item}field_domain_term{/translate}
    {translate module=invoice_item}field_domain_type{/translate}
    + + + + +
    +
    +
    + + diff --git a/themes/default/blocks/invoice_item/main.tpl b/themes/default/blocks/invoice_item/main.tpl index 90bcb3ec..d8a173f1 100644 --- a/themes/default/blocks/invoice_item/main.tpl +++ b/themes/default/blocks/invoice_item/main.tpl @@ -1,27 +1,20 @@ - - - - - -
    - - - - - - - -
    -
    - {translate module=invoice_item} - menu - {/translate} -
    -
    - - - - -
    {translate module=invoice_item}help_file{/translate}
    -
    -
    + + + + +
    + + + + + + + +
    {translate module=invoice_item}menu{/translate}
    + + + + +
    {translate module=invoice_item}help_file{/translate}
    +
    +
    diff --git a/themes/default/blocks/invoice_item/search_form.tpl b/themes/default/blocks/invoice_item/search_form.tpl index 2b981945..b1c5f6a6 100644 --- a/themes/default/blocks/invoice_item/search_form.tpl +++ b/themes/default/blocks/invoice_item/search_form.tpl @@ -1,152 +1,92 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("invoice_item","search_form") } -{ if ($method->result == FALSE) } - { $block->display("core:method_error") } +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} -
    - - - - - -
    - - - - - - - - - -
    -
    - {translate module=invoice_item}title_search{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - +
    - {translate module=invoice_item} - field_sku - {/translate} -   {translate}search_partial{/translate} -
    - {translate module=invoice_item} - field_item_type - {/translate} - { $list->bool("invoice_item_item_type", "all", "form_menu") } -
    - {translate module=invoice_item} - field_product_attr - {/translate} -   {translate}search_partial{/translate} -
    - {translate module=invoice_item} - field_price_base - {/translate} -   {translate}search_partial{/translate} -
    - {translate module=invoice_item} - field_price_setup - {/translate} -   {translate}search_partial{/translate} -
    - {translate module=invoice_item} - field_recurring_schedule - {/translate} -   {translate}search_partial{/translate} -
    - {translate module=invoice_item} - field_domain_name - {/translate} -   {translate}search_partial{/translate} -
    - {translate module=invoice_item} - field_domain_tld - {/translate} -   {translate}search_partial{/translate} -
    - {translate module=invoice_item} - field_domain_term - {/translate} -   {translate}search_partial{/translate} -
    - {translate module=invoice_item} - field_domain_type - {/translate} -   {translate}search_partial{/translate} -
    {translate}search_results_per{/translate} - -
    {translate}search_order_by{/translate} - -
    + + + +
    + + + + + + + +
    {translate module=invoice_item}title_search{/translate}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/search_post.tpl'} +
    {translate module=invoice_item}field_sku{/translate} +   {t}"%" for partial match{/t} +
    {translate module=invoice_item}field_item_type{/translate}{$list->bool('invoice_item_item_type','all')}
    {translate module=invoice_item}field_product_attr{/translate} +   {t}"%" for partial match{/t} +
    {translate module=invoice_item}field_price_base{/translate} +   {t}"%" for partial match{/t} +
    {translate module=invoice_item}field_price_setup{/translate} +   {t}"%" for partial match{/t} +
    {translate module=invoice_item}field_recurring_schedule{/translate} +   {t}"%" for partial match{/t} +
    {translate module=invoice_item}field_domain_name{/translate} +   {t}"%" for partial match{/t} +
    {translate module=invoice_item}field_domain_tld{/translate} +   {t}"%" for partial match{/t} +
    {translate module=invoice_item}field_domain_term{/translate} +   {t}"%" for partial match{/t} +
    {translate module=invoice_item}field_domain_type{/translate} +   {t}"%" for partial match{/t} +
    +
    +
    -
    - - - - -
    -
    -
    - -{ $block->display("core:saved_searches") } -{ $block->display("core:recent_searches") } + + + {$block->display('core:saved_searches')} + {$block->display('core:recent_searches')} {/if} diff --git a/themes/default/blocks/invoice_item/search_show.tpl b/themes/default/blocks/invoice_item/search_show.tpl index dad16d42..142200dd 100644 --- a/themes/default/blocks/invoice_item/search_show.tpl +++ b/themes/default/blocks/invoice_item/search_show.tpl @@ -1,167 +1,100 @@ +{assign var=meth value=':'|explode:$VAR._page} + - -{$method->exe("invoice_item","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    + {include file='file:../core/search_show_pre.tpl'} + + + - - {literal} - - {/literal} - {/foreach} - - -
    + - {literal} - - - {/literal} + + + + + + + + + + + + + + - -
    + + {foreach from=$invoice_item item=record} + + + + + + + + + + + + + + {/foreach} + - -
    -
      + {literal} + + {/literal} + + {literal} + + {/literal} + + {literal} + + {/literal} + + {literal} + + {/literal} + + {literal} + + {/literal} + + {literal} + + {/literal} + + {literal} + + {/literal} + + {literal} + + {/literal} + + {literal} + + {/literal} + + {literal} + + {/literal} +
    + + {literal} + + {/literal} +  {$record.sku} {if $record.item_type == "1"}{translate}true{/translate}{else}{translate}false{/translate}{/if} {$record.product_attr} {$record.price_base} {$record.price_setup} {$record.recurring_schedule} {$record.domain_name} {$record.domain_tld} {$record.domain_term} {$record.domain_type}
    - - - + +
    - - - - - - - - - - - - - - - - - - {foreach from=$invoice_item item=record} - - - - - - - - - - - - - +
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -
    - -  {$record.sku} {if $record.item_type == "1"}{translate}true{/translate}{else}{translate}false{/translate}{/if} {$record.product_attr} {$record.price_base} {$record.price_setup} {$record.recurring_schedule} {$record.domain_name} {$record.domain_tld} {$record.domain_term} {$record.domain_type}
    +
    -
    - - - - -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/invoice_item/view.tpl b/themes/default/blocks/invoice_item/view.tpl index c2937150..571dc5aa 100644 --- a/themes/default/blocks/invoice_item/view.tpl +++ b/themes/default/blocks/invoice_item/view.tpl @@ -1,181 +1,79 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("invoice_item","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} -{literal} - - -{/literal} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - -{foreach from=$invoice_item item=invoice_item} + +
    - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - - - - - - - -
    - - - - - - - -
    -
    - {translate module=invoice_item}title_view{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=invoice_item} - field_sku - {/translate} - {$list->date_time($invoice_item.sku)} -
    - {translate module=invoice_item} - field_item_type - {/translate} - {if $invoice_item.item_type == "1"}{translate}true{/translate}{else}{translate}false{/translate}{/if} -
    - {translate module=invoice_item} - field_product_attr - {/translate} - {$list->date_time($invoice_item.product_attr)} -
    - {translate module=invoice_item} - field_price_base - {/translate} - {$list->date_time($invoice_item.price_base)} -
    - {translate module=invoice_item} - field_price_setup - {/translate} - {$list->date_time($invoice_item.price_setup)} -
    - {translate module=invoice_item} - field_recurring_schedule - {/translate} - {$list->date_time($invoice_item.recurring_schedule)} -
    - {translate module=invoice_item} - field_domain_name - {/translate} - {$list->date_time($invoice_item.domain_name)} -
    - {translate module=invoice_item} - field_domain_tld - {/translate} - {$list->date_time($invoice_item.domain_tld)} -
    - {translate module=invoice_item} - field_domain_term - {/translate} - {$list->date_time($invoice_item.domain_term)} -
    - {translate module=invoice_item} - field_domain_type - {/translate} - {$list->date_time($invoice_item.domain_type)} -
    - - - - - -
    - - - -
    -
    -
    -
    - - - - -
    - {/foreach} + + + + +
    + + + + + + + + {include file='file:../core/view_tr_submit_delete.tpl'} +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=sku}{$list->date_time($record.sku)}
    {osb f=tf field=item_type}{if $record.item_type == '1'}{t}True{/t}{else}{t}False{/t}{/if}
    {osb f=tf field=product_attr}{$list->date_time($record.product_attr)}
    {osb f=tf field=price_base}{$list->date_time($record.price_base)}
    {osb f=tf field=price_setup}{$list->date_time($record.price_setup)}
    {osb f=tf field=recurring_schedule}{$list->date_time($record.recurring_schedule)}
    {osb f=tf field=domain_name}{$list->date_time($record.domain_name)}
    {osb f=tf field=domain_tld}{$list->date_time($record.domain_tld)}
    {osb f=tf field=domain_term}{$list->date_time($record.domain_term)}
    {osb f=tf field=domain_type}{$list->date_time($record.domain_type)}
    +
    +
    + + {include file='file:../core/view_post.tpl'} + {/if} diff --git a/themes/default/blocks/invoice_memo/add.tpl b/themes/default/blocks/invoice_memo/add.tpl index 4e78161c..28aeaf2c 100644 --- a/themes/default/blocks/invoice_memo/add.tpl +++ b/themes/default/blocks/invoice_memo/add.tpl @@ -1,60 +1,40 @@ -{ $block->display("core:top_clean") } +{assign var=meth value=':'|explode:$VAR._page} + - + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} -
    + - - - - -
    - - - - - - - -
    -
    - {translate module=invoice_memo}title_add{/translate} -
    -
    - - - - - - - - - -
    - {translate module=invoice_memo} - field_memo - {/translate} - - -
    - - - - - - - - - - -
    -
    -
    -
    - + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + {include file='file:../core/add_tr_submit.tpl'} +
    {osb f=tf field=memo}
    +
    +
    + +
    + + + +
    + diff --git a/themes/default/blocks/invoice_memo/search_show.tpl b/themes/default/blocks/invoice_memo/search_show.tpl index 12d81fd9..1224d791 100644 --- a/themes/default/blocks/invoice_memo/search_show.tpl +++ b/themes/default/blocks/invoice_memo/search_show.tpl @@ -1,140 +1,36 @@ -{ $block->display("core:top_clean") } +{assign var=meth value=':'|explode:$VAR._page} + -{$method->exe("invoice_memo","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    + {include file='file:../core/search_show_pre.tpl'} + + + + +
    + + {$method->exe_noauth($meth.0,'tpl_search_show')} + {foreach from=$search_show item=record} + {include file='file:../core/search_show_tr_record.tpl'} + + + + + + {/foreach} +
    {$list->date_time($record.date_orig)} + {if $record.account_id == '0'} + {translate module=invoice_memo}system{/translate} + {else} + {$record.account_id} + {/if} + {t}{$record.type}{/t}{$record.memo|truncate:30}
    +
    - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - - - {foreach from=$invoice_memo item=record} - - - - - - - - - - - - - - - {literal} - - {/literal} - {/foreach} - - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -
    - -   - {$list->date_time($record.date_orig)} -   - {if $record.account_id == '0'} - {translate module=invoice_memo} - system - {/translate} - {else} - {$record.account_id} - {/if} -   - {translate module=invoice_memo} - {$record.type} - {/translate} -   - {$record.memo|truncate:30} -
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - - -
    -
    + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/invoice_memo/view.tpl b/themes/default/blocks/invoice_memo/view.tpl index 35073a97..423d3c81 100644 --- a/themes/default/blocks/invoice_memo/view.tpl +++ b/themes/default/blocks/invoice_memo/view.tpl @@ -1,153 +1,71 @@ -{ $block->display("core:top_clean") } +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("invoice_memo","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} -{literal} - - -{/literal} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - -{foreach from=$invoice_memo item=invoice_memo} + +
    + + + + + +
    + + + + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + +
    {osb f=tf field=date_orig}{$list->date_time($record.date_orig)}
    {osb f=tf field=account_id} + {if $record.account_id == '0'} + {t}System{/t} + {else} + {osb f=html_select_account name='invoice_memo_account_id' default=$record.account_id} + {/if} +
    {osb f=tf field=type}{translate module=invoice_memo}{$record.type}{/translate}
    {osb f=tf field=memo}{$record.memo|nl2br}
    +
    + + + + {include file='file:../core/view_td_delete.tpl'} + +
     
    +
    +
    + + {include file='file:../core/view_post.tpl'} +
    - -{if $form_validation} - { $block->display("core:alert_fields") } {/if} - - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=invoice_memo}title_view{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=invoice_memo} - field_date_orig - {/translate} - - {$list->date_time($invoice_memo.date_orig)} -
    - {translate module=invoice_memo} - field_account_id - {/translate} - - {if $invoice_memo.account_id == '0'} - {translate module=invoice_memo} - system - {/translate} - {else} - {html_select_account name="invoice_memo_account_id" default=$invoice_memo.account_id} - {/if} -
    - {translate module=invoice_memo} - field_type - {/translate} - - {translate module=invoice_memo}{$invoice_memo.type}{/translate} -
    - {translate module=invoice_memo} - field_memo - {/translate} - - {$invoice_memo.memo|nl2br} -
    - - - - - -
      - -
    -
    -
    -
    - -
    - - - - -
    -
    - -{/foreach} -
    - - {translate module=invoice_memo} - title_add - {/translate} - - {/if} -
    diff --git a/themes/default/blocks/log_error/search_form.tpl b/themes/default/blocks/log_error/search_form.tpl index 163146fa..3687746d 100644 --- a/themes/default/blocks/log_error/search_form.tpl +++ b/themes/default/blocks/log_error/search_form.tpl @@ -1,130 +1,56 @@ -{ $method->exe("log_error","search_form") } -{ if ($method->result == FALSE) } - { $block->display("core:method_error") } +{assign var=meth value=':'|explode:$VAR._page} + + +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=log_error} - title_search - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=log_error} - field_message - {/translate} - - - {translate} - search_partial - {/translate} -
    - {translate module=log_error} - field_module - {/translate} - - - {translate} - search_partial - {/translate} -
    - {translate module=log_error} - field_method - {/translate} - - - {translate} - search_partial - {/translate} -
    - {translate module=log_error} - field_date_orig - {/translate} - - { $list->calender_search("log_error_date_orig", $VAR.log_error_date_orig, "form_field", "") } -
    - {translate module=log_error} - field_account_id - {/translate} - - {html_select_account name="log_error_account_id" default=$VAR.log_error_account_id} -
    - {translate} - search_results_per - {/translate} - - -
    - {translate} - search_order_by - {/translate} - - -
    - - - - -
    -
    -
    -
    -{ $block->display("core:saved_searches") } -{ $block->display("core:recent_searches") } +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/search_post.tpl'} +
    {osb f=tf field=message}  {t}"%" for partial match{/t}
    {osb f=tf field=module}  {t}"%" for partial match{/t}
    {osb f=tf field=method}  {t}"%" for partial match{/t}
    {osb f=tf field=date_orig}{$list->calender_search('log_error_date_orig',$VAR.log_error_date_orig,'form_field','')}
    {osb f=tf field=account_id}{osb f=html_select_account name='log_error_account_id' default=$VAR.log_error_account_id}
    +
    +
    + +
    + + {$block->display('core:saved_searches')} + {$block->display('core:recent_searches')} {/if} diff --git a/themes/default/blocks/log_error/search_show.tpl b/themes/default/blocks/log_error/search_show.tpl index 22a4ae6b..1be09918 100644 --- a/themes/default/blocks/log_error/search_show.tpl +++ b/themes/default/blocks/log_error/search_show.tpl @@ -1,114 +1,12 @@ -{$method->exe("log_error","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{assign var=meth value=':'|explode:$VAR._page} + + +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - {foreach from=$log_error item=record} - - - - - - - {literal} - - {/literal} - {/foreach} - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -
    - -   - {$list->date_time($record.date_orig)} -   - {$record.message|truncate:40} -   - {$record.module} -
    -
    - -{if $VAR._print != TRUE}
    - -
    - - - - - - - -
    -
    + {include file='file:../core/search_show_pre.tpl'} + {$method->exe_noauth($meth.0,'tpl_search_show',$search_show)} + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/log_error/view.tpl b/themes/default/blocks/log_error/view.tpl index 7c487aa5..f0f9bd4f 100644 --- a/themes/default/blocks/log_error/view.tpl +++ b/themes/default/blocks/log_error/view.tpl @@ -1,146 +1,72 @@ -{ $method->exe("log_error","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{assign var=meth value=':'|explode:$VAR._page} + -{literal} - - -{/literal} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} - -{foreach from=$log_error item=log_error} + + {if $record.id == $VAR.log_error_id} + {foreach from=$form_validation item=record} + {assign var=$record.field value='true'} + {$record.field_trans|upper}: {$record.error}
    + {/foreach} + {/if} - - {if $log_error.id == $VAR.log_error_id} - {foreach from=$form_validation item=record} - {assign var=$record.field value="true"} - {$record.field_trans|upper}: {$record.error}
    - {/foreach} - {/if} + +
    - - - - - - - -
    - - - - - - - -
    -
    - {translate module=log_error} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - - - - - -
    - {translate module=log_error} - field_date_orig - {/translate} - - {$list->date_time($log_error.date_orig)} -
    - {translate module=log_error} - field_account_id - {/translate} - - {html_select_account name="log_error_account_id" default=$log_error.account_id} -
    - {translate module=log_error} - field_module - {/translate} - - {$log_error.module} -
    - {translate module=log_error} - field_method - {/translate} - - {$log_error.method} -
    - - - - - - -
    -
    - -
    -
    - - - - - -
      - -
    -
    -
    -
    -
    - - - - -
    - {/foreach} + + + + +
    + + + + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + +
    {osb f=tf field=date_orig}{$list->date_time($record.date_orig)}
    {osb f=tf field=account_id}{osb f=html_select_account name='log_error_account_id' default=$record.account_id}
    {osb f=tf field=module}{$record.module}
    {osb f=tf field=method}{$record.method}
    + + + + +
    +
    + + + + {include file='file:../core/view_td_delete.tpl'} + +
     
    +
    +
    + + {include file='file:../core/view_post.tpl'} + {/if} diff --git a/themes/default/blocks/login_log/map.tpl b/themes/default/blocks/login_log/map.tpl index 4f8acc12..0d142c81 100644 --- a/themes/default/blocks/login_log/map.tpl +++ b/themes/default/blocks/login_log/map.tpl @@ -1,3 +1,5 @@ - \ No newline at end of file + diff --git a/themes/default/blocks/login_log/search_form.tpl b/themes/default/blocks/login_log/search_form.tpl index ff6ea0af..d6651708 100644 --- a/themes/default/blocks/login_log/search_form.tpl +++ b/themes/default/blocks/login_log/search_form.tpl @@ -1,114 +1,50 @@ -{ $method->exe("login_log","search_form") } -{ if ($method->result == FALSE) } - { $block->display("core:method_error") } +{assign var=meth value=':'|explode:$VAR._page} + + +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=login_log} - title_search - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=login_log} - field_account_id - {/translate} - - {html_select_account name="login_log_account_id" default=$VAR.login_log_account_id} -
    - {translate module=login_log} - field_ip - {/translate} - - - {translate} - search_partial - {/translate} -
    - {translate module=login_log} - field_date_orig - {/translate} - - { $list->calender_search("login_log_date_orig", $VAR.login_log_date_orig, "form_field", "") } -
    - {translate module=login_log} - field_status - {/translate} - - { $list->bool("login_log_status", "all", "form_menu") } -
    - {translate} - search_results_per - {/translate} - - -
    - {translate} - search_order_by - {/translate} - - -
    - - - - -
    -
    -
    -
    -{ $block->display("core:saved_searches") } -{ $block->display("core:recent_searches") } +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + {include file='file:../core/search_post.tpl'} +
    {osb f=tf field=account_id}{osb f=html_select_account name='login_log_account_id' default=$VAR.login_log_account_id}
    {osb f=tf field=ip}  {t}"%" for partial match{/t}
    {osb f=tf field=date_orig}{$list->calender_search('login_log_date_orig',$VAR.login_log_date_orig,'form_field','')}
    {osb f=tf field=status}{$list->bool('login_log_status','all')}
    +
    +
    + +
    + + {$block->display('core:saved_searches')} + {$block->display('core:recent_searches')} {/if} diff --git a/themes/default/blocks/login_log/search_show.tpl b/themes/default/blocks/login_log/search_show.tpl index 864bce5c..4562fc98 100644 --- a/themes/default/blocks/login_log/search_show.tpl +++ b/themes/default/blocks/login_log/search_show.tpl @@ -1,119 +1,37 @@ -{$method->exe("login_log","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{assign var=meth value=':'|explode:$VAR._page} + + +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - + {include file='file:../core/search_show_pre.tpl'} - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - - {foreach from=$login_log item=record} - - - - - - - - {literal} - - {/literal} - {/foreach} - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -  
    - -    - {$record.account_id} -   - {$list->date_time($record.date_orig)} -   - {$record.ip} - (whois) - (map)   {translate}search_export_image{/translate} - {if $record.status == "1"} - - {else} - - {/if} -
    -
    - -{if $VAR._print != TRUE}
    + + + + +
    + + {$method->exe_noauth($meth.0,'tpl_search_show')} + {foreach from=$search_show item=record} + {include file='file:../core/search_show_tr_record.tpl'} + + + + + + {/foreach} +
    {$record.account_id}{$list->date_time($record.date_orig)}{$record.ip} (whois) (map) + {translate}search_export_image{/translate} + {if $record.status == '1'} + Go + {else} + Stop + {/if} +
    +
    -
    - - - - -
    + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/login_log/whois.tpl b/themes/default/blocks/login_log/whois.tpl index b1507cab..86974ae7 100644 --- a/themes/default/blocks/login_log/whois.tpl +++ b/themes/default/blocks/login_log/whois.tpl @@ -1,3 +1,5 @@ - \ No newline at end of file + diff --git a/themes/default/blocks/module/add.tpl b/themes/default/blocks/module/add.tpl index a2ce640f..697ea2ba 100644 --- a/themes/default/blocks/module/add.tpl +++ b/themes/default/blocks/module/add.tpl @@ -1,121 +1,51 @@ +{assign var=meth value=':'|explode:$VAR._page} + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=module} - title_add - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=module} - field_name - {/translate} - - -
    - {translate module=module} - field_notes - {/translate} - - -
    - {translate} - field_date_orig - {/translate} - - {if $VAR.module_date_orig == ''} - { $list->calender_add("module_date_orig", 'now', "form_field") } - {else} - { $list->calender_add("module_date_orig", $VAR.module_date_orig, "form_field") } - {/if} -
    - {translate} - field_date_last - {/translate} - - {if $VAR.module_date_last == ''} - { $list->calender_add("module_date_last", 'now', "form_field") } - {else} - { $list->calender_add("module_date_last", $VAR.module_date_last, "form_field") } - {/if} -
    - {translate module=module} - field_parent_id - {/translate} - - { $list->menu("", "module_parent_id", "module", "name", $VAR.module, "form_menu") } -
    - {translate module=module} - field_menu_display - {/translate} - - { $list->bool("module_menu_display", $VAR.module_menu_display, "form_menu") } -
    - {translate module=module} - field_status - {/translate} - - { $list->bool("module_status", $VAR.module_status, "form_menu") } -
    - - - - -
    -
    -
    -
    +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/add_tr_submit.tpl'} +
    {osb f=tf field=name}
    {osb f=tf field=notes}
    {osb f=tf field=parent_id}{$list->menu('','module_parent_id','module','name',$VAR.module,'form_menu')}
    {osb f=tf field=menu_display}{$list->bool('module_menu_display',$VAR.module_menu_display)}
    {osb f=tf field=status}{$list->bool('module_status',$VAR.module_status)}
    +
    +
    + +
    diff --git a/themes/default/blocks/module/install.tpl b/themes/default/blocks/module/install.tpl index f63756f2..83faa6b4 100644 --- a/themes/default/blocks/module/install.tpl +++ b/themes/default/blocks/module/install.tpl @@ -1,57 +1,41 @@ +{assign var=meth value=':'|explode:$VAR._page} + -
    - - - - + +
    - - - - - - + +
    -
    - {translate module=module} - title_install - {/translate} -
    -
    - - - - + + +
    - {translate module=module} - install_name - {/translate} - - -
    + + + + {if $product.cart_multiple} + + + + {/if} + + {if $product.prod_plugin} + + + + {/if} +
    + + + + + + - - - {/if} - +
    +
    +
    +
    -{literal} - - -{/literal} + {/literal} + //--> + {/if} diff --git a/themes/default/blocks/product/details.tpl b/themes/default/blocks/product/details.tpl index 4875f433..f5725258 100644 --- a/themes/default/blocks/product/details.tpl +++ b/themes/default/blocks/product/details.tpl @@ -1,577 +1,334 @@ -{ $method->exe("product","details") } { if ($method->result == FALSE || !$product) } { $block->display("core:method_error") } {else} -{if $product} - - - - - - - {if $list->translate("product_translate","name,description_full", "product_id", $product.id, "translate_product")} - {/if} -
    {osb f=tt}
    + + + + - - - + + + - - - + + + - - - + + + - - - + +
    {t}Module Name{/t}
       
      
    - {translate module=module} - install_group - {/translate} - - {$list->select_groups("", module_group, "form_field", "1", "_1")} -
    {t}Install Group{/t}{$list->select_groups('',module_group,'form_field','1','_1')}
     
      
    - - - - +
    + + + +
    diff --git a/themes/default/blocks/module/install_2.tpl b/themes/default/blocks/module/install_2.tpl index a0d57b4c..49a3b760 100644 --- a/themes/default/blocks/module/install_2.tpl +++ b/themes/default/blocks/module/install_2.tpl @@ -1,64 +1,45 @@ {if $form_validation} - - - - -
    - - - - -
    - - - - - - - -
    -
    - {translate} - alert - {/translate} -
    -

    - {foreach from=$form_validation item=record} -   - {$record} -
    -
    - {/foreach} -
    -
    - -
    + + + + +
    + + + + +
    + + + + + + + +
    {t}alert{/t}
    +
    + {foreach from=$form_validation item=record} +   {$record}
    +
    + {/foreach} +
    +
    +
    {else} - - - - -
    - - - - - - - -
    -
    - {translate module=module} - module_installed - {/translate} -
    -
    -

    - Congratulations, the new module installation has been completed!
    -
    -
    -
    -
    + + + + +
    + + + + + + + +
    {t}Module Installed{/t}

    Congratulations, the new module installation has been completed!

    +
    {/if} diff --git a/themes/default/blocks/module/main.tpl b/themes/default/blocks/module/main.tpl deleted file mode 100644 index 498083b3..00000000 --- a/themes/default/blocks/module/main.tpl +++ /dev/null @@ -1,27 +0,0 @@ - - - - -
    - - - - - - - -
    -
    - {translate module=module} - menu - {/translate} -
    -
    - - - - -
    {translate module=module}help_file{/translate}
    -
    -
    -

     

    diff --git a/themes/default/blocks/module/search_show.tpl b/themes/default/blocks/module/search_show.tpl index 469b5ad9..2e593f28 100644 --- a/themes/default/blocks/module/search_show.tpl +++ b/themes/default/blocks/module/search_show.tpl @@ -1,121 +1,12 @@ -{$method->exe("module","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{assign var=meth value=':'|explode:$VAR._page} + + +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - - - - - - {foreach from=$module item=record} - - - - - - - - - {literal} - - {/literal} - - {/foreach} - - -
      - {literal} - - {/literal} - - {literal} - - {/literal} -  
    - -   - {$record.name} -   - {$record.notes|truncate:"50"} -   - {if $record.status == '1'} - - {else} - - {/if} -
    -
    - -{if $VAR._print != TRUE}
    - -
    - - - - - - - -
    -
    + {include file='file:../core/search_show_pre.tpl'} + {$method->exe_noauth($meth.0,'tpl_search_show',$search_show)} + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/module/view.tpl b/themes/default/blocks/module/view.tpl index cb93a73f..8acf804f 100644 --- a/themes/default/blocks/module/view.tpl +++ b/themes/default/blocks/module/view.tpl @@ -1,247 +1,116 @@ -{ $method->exe("module","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{assign var=meth value=':'|explode:$VAR._page} + -{literal} - - -{/literal} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} - -{foreach from=$module item=module} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=module} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=module} - field_name - {/translate} - - -
    - {translate module=module} - field_notes - {/translate} - - -
    - {translate module=module} - field_date_orig - {/translate} - - {$module.date_orig|date_format:$smarty.const.DEFAULT_DATE_FORMAT} -
    - {translate module=module} - field_date_last - {/translate} - - {$module.date_last|date_format:$smarty.const.DEFAULT_DATE_FORMAT} - -
    - {translate module=module} - field_parent_id - {/translate} - - { $list->menu("", "module_parent_id", "module", "name", $module.parent_id, "form_menu") } -
    - {translate module=module} - field_menu_display - {/translate} - - { $list->bool("module_menu_display", $module.menu_display, "form_menu") - } -
    - {translate module=module} - field_status - {/translate} - - { $list->bool("module_status", $module.status, "form_menu") } -
    - - - - - -
    - - - -
    -
    -
    -
    - - - - -
    - -

    - {translate module=module} - view_methods - {/translate} -  |  - {translate module=module} - add_methods - {/translate} -
    -

    - - - - -
    - - - - - - - -
    -
    - {translate module=group} - title_relation - {/translate} -
    -
    - - - - - -
    - {translate module=group} - select_module - {/translate} - - { $list->menu("no", "module_method_module_id", "group", "name", "all", "\" onChange=\"showGroupPerm(this)\"") } -
    -
    -
    -
    -

    - {literal} - - {/literal} -

    -
    - -
    -
    - - - - -
    -{/foreach} + +
    + + + + + +
    + + + + + + + + {include file='file:../core/view_tr_submit_delete.tpl'} +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=name}
    {osb f=tf field=notes}
    {osb f=tf field=date_orig}{$record.date_orig|date_format:$smarty.const.DEFAULT_DATE_FORMAT}
    {osb f=tf field=date_last} + {$record.date_last|date_format:$smarty.const.DEFAULT_DATE_FORMAT} + +
    {osb f=tf field=parent_id}{$list->menu('','module_parent_id','module','name',$record.parent_id,'form_menu')}
    {osb f=tf field=menu_display}{$list->bool('module_menu_display',$record.menu_display)}
    {osb f=tf field=status}{$list->bool('module_status',$record.status)}
    +
    +
    + + {include file='file:../core/view_post.tpl'} +
    + +

    {osb f=tt module=module_method method=view}  |  {osb f=tt module=module_method method=add}

    + + + + +
    + + + + + + + +
    {osb f=tt module=group method=title_relation}
    + + + + + +
    {t}Select Group{/t}{$list->menu('no','module_method_module_id','group','name','','" onchange="showGroupPerm(this)',true)}
    +
    +
    +
    + +
    + +
    {/if} diff --git a/themes/default/blocks/module_method/add.tpl b/themes/default/blocks/module_method/add.tpl index a4659b5e..e0aae24e 100644 --- a/themes/default/blocks/module_method/add.tpl +++ b/themes/default/blocks/module_method/add.tpl @@ -1,94 +1,51 @@ -{ $block->display("core:top_clean") } +{assign var=meth value=':'|explode:$VAR._page} + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=module_method} - title_add - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=module_method} - field_name - {/translate} - - -
    - {translate module=module_method} - field_notes - {/translate} - - -
    - {translate module=module_method} - field_module_id - {/translate} - - { $list->menu("", "module_method_module_id", "module", "name", $VAR.module_method_module_id, "form_menu") } -
    - {translate module=module_method} - field_menu_display - {/translate} - - { $list->bool("module_method_menu_display", $VAR.module_method_menu_display, "form_menu") } -
    - {translate module=module_method} - field_page - {/translate} - - -
    - - - - - -
    -
    -
    -
    +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/add_tr_submit.tpl'} +
    {osb f=tf field=name}
    {osb f=tf field=notes}
    {osb f=tf field=module_id}{$list->menu('','module_method_module_id','module','name',$VAR.module_method_module_id,'form_menu')}
    {osb f=tf field=menu_display}{$list->bool('module_method_menu_display',$VAR.module_method_menu_display)}
    {osb f=tf field=page}
    +
    +
    + +
    diff --git a/themes/default/blocks/module_method/search_show.tpl b/themes/default/blocks/module_method/search_show.tpl index f03b3778..ce002a02 100644 --- a/themes/default/blocks/module_method/search_show.tpl +++ b/themes/default/blocks/module_method/search_show.tpl @@ -1,136 +1,12 @@ -{ $block->display("core:top_clean") } +{assign var=meth value=':'|explode:$VAR._page} + -{$method->exe("module_method","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - - - - - - {foreach from=$module_method item=record} - - - - - - - - - - - - - {literal} - - {/literal} - - {/foreach} - - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -
    - -   - {$record.name} -   - {$record.module_id} -   - {if $record.menu_display == '1'} - {translate} - true - {/translate} - {else} - {translate} - false - {/translate} - {/if} -
    -
    - -{if $VAR._print != TRUE}
    - -
    - - - - - -
    -
    - + {include file='file:../core/search_show_pre.tpl'} + {$method->exe_noauth($meth.0,'tpl_search_show',$search_show)} + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/module_method/view.tpl b/themes/default/blocks/module_method/view.tpl index fc9e2ce0..adef3cf2 100644 --- a/themes/default/blocks/module_method/view.tpl +++ b/themes/default/blocks/module_method/view.tpl @@ -1,149 +1,59 @@ -{ $block->display("core:top_clean") } +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("module_method","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else}
    +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} -{literal} - - -{/literal} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - -{foreach from=$module_method item=module_method} + +
    - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - - - - - - - -
    - - - - - - - -
    -
    - {translate module=module_method} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=module_method} - field_name - {/translate} - - -
    - {translate module=module_method} - field_notes - {/translate} - - -
    - {translate module=module_method} - field_module_id - {/translate} - - { $list->menu("", "module_method_module_id", "module", "name", $module_method.module_id, "form_menu") } -
    - {translate module=module_method} - field_menu_display - {/translate} - - { $list->bool("module_method_menu_display", $module_method.menu_display, "form_menu") } -
    - {translate module=module_method} - field_page - {/translate} - - -
    - - - - - -
    - - - -
    -
    -
    -
    - - - - -
    - {/foreach} + + + + +
    + + + + + + + + {include file='file:../core/view_tr_submit_delete.tpl'} +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=name}
    {osb f=tf field=notes}
    {osb f=tf field=module_id}{$list->menu('','module_method_module_id','module','name',$record.module_id,'form_menu')}
    {osb f=tf field=menu_display}{$list->bool('module_method_menu_display',$record.menu_display)}
    {osb f=tf field=page}
    +
    +
    + + {include file='file:../core/view_post.tpl'} + {/if} diff --git a/themes/default/blocks/module_method/view_methods.tpl b/themes/default/blocks/module_method/view_methods.tpl index fed57af5..58e60d9b 100644 --- a/themes/default/blocks/module_method/view_methods.tpl +++ b/themes/default/blocks/module_method/view_methods.tpl @@ -1,135 +1,75 @@ -{ $block->display("core:top_clean") } +{assign var=meth value=':'|explode:$VAR._page} + -{$method->exe("module_method","view_methods")} +{$method->exe($meth.0,$meth.1)} {if ($method->result == FALSE)} - {$block->display("core:method_error")} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - + {include file='file:../core/search_show_pre.tpl'} + {$method->exe_noauth($meth.0,'tpl_search_show')} - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - {foreach from=$module_method item=record} - - {if $record.checked == "2"} - - - {else} - - - {/if} - - - - - {if $record.checked == "1"} - {literal} - - {/literal} - {elseif $record.checked == "3"} - {literal} - - {/literal} - {/if} - {/foreach} - - -
    - {translate module=module_method} - authorized - {/translate} - - {translate module=module_method} - field_name - {/translate} - - {translate module=module_method} - field_notes - {/translate} -
    - -
    - -   - {$record.name} -   - {$record.notes|truncate:"65"} -
    -
    - - {if $VAR._print != TRUE} -
    - {translate module=module_method} - note_inherit - {/translate}
    -
    -
    -
    - -
    -
    -
    - - - - - - - -
    - - -
    -
    -
    + + + + +
    + + + + + + + + + + {foreach from=$module_method item=record} + + {if $record.checked == '2'} + + + {else} + + + {/if} + + + + {/foreach} + + +
    {t}Authorised{/t}{osb f=tf field=name}{osb f=tf field=notes}
    {$record.name} + {$record.notes|truncate:'65'} + {if $record.checked == '1'} + + {elseif $record.checked == '3'} + + {/if} +
    +
    + + + + {if $VAR._print != true} +
    +
    {t}Note - Checkboxes that are greyed out indicate inheritance from parent groups{/t}
    +
    +
    +
    + +
    +
    + + + + + + +
    +
    +
    + + +
    + {/if} {/if} -{/if} -
    \ No newline at end of file + diff --git a/themes/default/blocks/net_term/add.tpl b/themes/default/blocks/net_term/add.tpl index 9be0cf9b..ac03141a 100644 --- a/themes/default/blocks/net_term/add.tpl +++ b/themes/default/blocks/net_term/add.tpl @@ -1,150 +1,75 @@ - +{assign var=meth value=':'|explode:$VAR._page} + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} -
    -{$COOKIE_FORM} - - - - -
    - - - - - - - -
    -
    - {translate module=net_term}title_add{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=net_term} - field_name - {/translate} - -
    - {translate module=net_term} - field_sku - {/translate} - -
    - {translate module=net_term} - field_terms - {/translate} - -
    - {translate module=net_term} - field_status - {/translate} - { $list->bool("net_term_status", 1, "form_menu") } -
    - {translate module=net_term} - field_group_avail - {/translate} - { $list->menu_multi($VAR.net_term_group_avail, "net_term_group_avail", "group", "name", "5", "5", "form_menu") } -
    - {translate module=net_term} - field_checkout_id - {/translate} - { $list->menu("no", "net_term_checkout_id", "checkout", "name", $VAR.net_term_checkout_id, "form_menu") } -
    - {translate module=net_term} - field_fee_type - {/translate} - -
    - {translate module=net_term} - field_fee - {/translate} - -
    - {translate module=net_term} - field_suspend_intervals - {/translate} - -
    - {translate module=net_term} - field_enable_emails - {/translate} - { $list->bool("net_term_enable_emails", 1, "form_menu") } -
    - {translate module=net_term} - field_sweep_type - {/translate} - -
    - - - - -
    -
    -
    + + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/add_tr_submit.tpl'} +
    {osb f=tf field=name}
    {osb f=tf field=terms}
    {osb f=tf field=status}{$list->bool('net_term_status',1)}
    {osb f=tf field=group_avail}{$list->menu_multi($VAR.net_term_group_avail,'net_term_group_avail','group','name','5','5','form_menu')}
    {osb f=tf field=checkout_id}{$list->menu_multi($VAR.net_term_checkout_id,'net_term_checkout_id','checkout','name','5','5','form_menu')}
    {osb f=tf field=fee_type}{$list->menu_staticlist('commissiontype','net_term_fee_type','net_term_fee_type',$VAR.net_term_fee_type,'form_menu')}
    {osb f=tf field=fee}
    {osb f=tf field=fee_day}
    {osb f=tf field=suspend_day}
    {osb f=tf field=enable_emails}{$list->bool('net_term_enable_emails',1)}
    {osb f=tf field=sweep_type}{$list->menu_staticlist('charge_sweep','net_term_sweep_type','net_term_sweep_type',$VAR.net_term_sweep_type,'form_menu')}
    +
    +
    +
    diff --git a/themes/default/blocks/net_term/search_show.tpl b/themes/default/blocks/net_term/search_show.tpl index 63eb3d53..2e593f28 100644 --- a/themes/default/blocks/net_term/search_show.tpl +++ b/themes/default/blocks/net_term/search_show.tpl @@ -1,127 +1,12 @@ +{assign var=meth value=':'|explode:$VAR._page} + - -{$method->exe("net_term","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - - - - {foreach from=$net_term item=record} - - - - - - - - - - - - {literal} - - {/literal} - {/foreach} - - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -
    - -  {if $record.status == "1"}{translate}true{/translate}{else}{translate}false{/translate}{/if} {$record.checkout_id} {$record.name} {$record.sku} {$record.fee}
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    + {include file='file:../core/search_show_pre.tpl'} + {$method->exe_noauth($meth.0,'tpl_search_show',$search_show)} + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/net_term/view.tpl b/themes/default/blocks/net_term/view.tpl index 85675bbf..da804207 100644 --- a/themes/default/blocks/net_term/view.tpl +++ b/themes/default/blocks/net_term/view.tpl @@ -1,191 +1,83 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("net_term","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} -{literal} - - -{/literal} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - -{foreach from=$net_term item=net_term} + +
    - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - - -{$COOKIE_FORM} - - - - -
    - - - - - - - -
    -
    - {translate module=net_term}title_view{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=net_term} - field_name - {/translate} - -
    - {translate module=net_term} - field_sku - {/translate} - -
    - {translate module=net_term} - field_terms - {/translate} - -
    - {translate module=net_term} - field_status - {/translate} - { $list->bool("net_term_status", $net_term.status, "form_menu") } -
    - {translate module=net_term} - field_group_avail - {/translate} - { $list->menu_multi($net_term.group_avail, "net_term_group_avail", "group", "name", "5", "5", "form_menu") } -
    - {translate module=net_term} - field_checkout_id - {/translate} - { $list->menu("", "net_term_checkout_id", "checkout", "name", $net_term.checkout_id, "form_menu") } -
    - {translate module=net_term} - field_fee_type - {/translate} - -
    - {translate module=net_term} - field_fee - {/translate} - -
    - {translate module=net_term} - field_suspend_intervals - {/translate} - -
    - {translate module=net_term} - field_enable_emails - {/translate} - { $list->bool("net_term_enable_emails", $net_term.enable_emails, "form_menu") } -
    - {translate module=net_term} - field_sweep_type - {/translate} - {if $net_term.sweep_type == "0"} Daily {/if} {if $net_term.sweep_type == "1"} Weekly {/if} {if $net_term.sweep_type == "2"} Monthly {/if} {if $net_term.sweep_type == "3"} Quarterly {/if} {if $net_term.sweep_type == "4"} Semi-Anually {/if} {if $net_term.sweep_type == "5"} Anually {/if} {if $net_term.sweep_type == "6"} On Service Rebill {/if}
    - - - - - -
    - - - -
    -
    -
    -
    - - - - -
    - {/foreach} + + + + +
    + + + + + + + + {include file='file:../core/view_tr_submit_delete.tpl'} +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=name}
    {osb f=tf field=terms}
    {osb f=tf field=status}{$list->bool('net_term_status',$record.status)}
    {osb f=tf field=group_avail}{$list->menu_multi($record.group_avail,'net_term_group_avail','group','name','5','5','form_menu')}
    {osb f=tf field=checkout_id}{$list->menu_multi($record.checkout_id,'net_term_checkout_id','checkout','name','5','5','form_menu')}
    {osb f=tf field=fee_type}{$list->menu_staticlist('commissiontype','net_term_fee_type','net_term_fee_type',$record.fee_type,'form_menu')}
    {osb f=tf field=fee}
    {osb f=tf field=fee_day}
    {osb f=tf field=suspend_day}
    {osb f=tf field=enable_emails}{$list->bool('net_term_enable_emails',$record.enable_emails)}
    {osb f=tf field=sweep_type}{$list->menu_staticlist('charge_sweep','net_term_sweep_type','net_term_sweep_type',$record.sweep_type,'form_menu')}
    +
    +
    + + {include file='file:../core/view_post.tpl'} + {/if} diff --git a/themes/default/blocks/product/add.tpl b/themes/default/blocks/product/add.tpl index 5e9da7b3..8b7c7d68 100644 --- a/themes/default/blocks/product/add.tpl +++ b/themes/default/blocks/product/add.tpl @@ -1,197 +1,111 @@ -{literal} - - -{/literal} +{assign var=meth value=':'|explode:$VAR._page} + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} - -
    + + + - - - - -
    - - - - - - - -
    -
    - {translate module=product}title_add{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=product} - field_sku - {/translate} - - {translate module=product_translate} - field_name - {/translate} -
    - - - -
    - {translate module=product} - field_price_type - {/translate} - - {translate module=product} - field_avail_category_id - {/translate} -
    - - {translate module=product} - price_type_one - {/translate} -
    - - {translate module=product} - price_type_recurr - {/translate} -
    - - {translate module=product} - price_type_trial - {/translate} -
    - { $list->menu_multi($VAR.product_avail_category_id, "product_avail_category_id", "product_cat", "name", "5", "", "form_menu") } -
    - - - - - -
    - {translate module=product} - field_price_base - {/translate} - - {translate module=product} - field_price_setup - {/translate} -
    -
    - {translate module=product} - field_taxable - {/translate} -
    - - - - - -
    - - {$list->currency_iso("")} - - - {$list->currency_iso("")} -
    -
    - {if $VAR.product_taxable != ""} - { $list->bool("product_taxable", $VAR.product_taxable, "form_menu") } - {else} - { $list->bool("product_taxable", "1", "form_menu") } - {/if} -
    -
    - - - - - - - - - - - - - - - - - - - -
    - {translate module=product_translate} - field_description_short - {/translate} -
    - -
     
    - {translate module=product_translate} - field_description_full - {/translate} -
    - -
    - - - - - - - - - -
    - -
    -
    -
    + +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=sku}{osb f=tf field=name}
    {osb f=tf field=price_type}{osb f=tf field=avail_category_id}
    + {$list->menu_staticlist('pricetype','','',0,'form_menu')}
    + {$list->menu_staticlist('pricetype','','',1,'form_menu')}
    + {$list->menu_staticlist('pricetype','','',2,'form_menu')} +
    {$list->menu_multi($VAR.product_avail_category_id,'product_avail_category_id','product_cat','name','5','5','form_menu')}
    + + + + + +
    {osb f=tf field=price_base}{osb f=tf field=price_setup}
    +
    {osb f=tf field=taxable}
    + + + + + +
    {$list->currency_iso('')} {$list->currency_iso('')}
    +
    + {if $VAR.product_taxable != ''} + {$list->bool('product_taxable',$VAR.product_taxable,'form_menu')} + {else} + {$list->bool('product_taxable','1','form_menu')} + {/if} +
    +
    + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=description_short}
     
    {osb f=tf field=description_full}
    + + {include file='file:../core/add_tr_submit.tpl'} +
    +
    +
    +
    + +
    + + +
    +
    diff --git a/themes/default/blocks/product/admin_details.tpl b/themes/default/blocks/product/admin_details.tpl index 16b23827..527dcd9b 100644 --- a/themes/default/blocks/product/admin_details.tpl +++ b/themes/default/blocks/product/admin_details.tpl @@ -1,495 +1,267 @@ -{ $block->display("core:top_clean") } +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("product","admin_details") } { if ($method->result == FALSE || !$product) } { $block->display("core:method_error") } {else} -
    - -
    -
    -
    -
    - - - - - - - {if $list->translate("product_translate","name,description_full", "product_id", $product.id, "translate_product")} - {/if} - - - - - - - - -
    - {$translate_product.name} -
    {$translate_product.description_full}
    - - - - - - - - - -
    - {translate module=product} - field_sku - {/translate} -
    - {$product.sku} - - {if $product.cart_multiple} Quantity: {/if} -
    - - - - - - - - - -
    - {translate module=product} - field_price_type - {/translate} -
    -
    - {translate module=product} - field_taxable - {/translate} -
    - {if $product.price_type == "0"} - {translate module=product} - price_type_one - {/translate} - {/if} - {if $product.price_type == "1"} - {translate module=product} - price_type_recurr - {/translate} - {/if} - {if $product.price_type == "2"} - {translate module=product} - price_type_trial - {/translate} - {/if} - - {if $product.taxable} - {translate} - true - {/translate} - {else} - {translate} - false - {/translate} - {/if} -
    - {if $product.price_type == "1" } - - - - - - - -
    - {translate module=product} - field_price_recurr_type - {/translate} -
    - -
    - {else} - - - - - - - - - -
    - {translate module=product} - field_price_base - {/translate} - - {translate module=product} - field_price_setup - {/translate} -
    - {$list->format_currency($price.base, $smarty.const.SESS_CURRENCY)} - - {$list->format_currency($price.setup, $smarty.const.SESS_CURRENCY)} -
    - {/if} - {if $product.price_type == "2"} - - - - -
    - {translate module=product sku=$trial.sku} - trial_desc - {/translate}
    - {if $product.price_trial_length_type == "0"} - {translate module=product sku1=$trial.sku length=$product.price_trial_length} - trial_length_days - {/translate} - {/if} - {if $product.price_trial_length_type == "1"} - {translate module=product sku1=$trial.sku length=$product.price_trial_length} - trial_length_weeks - {/translate} - {/if} - {if $product.price_trial_length_type == "2"} - {translate module=product sku1=$trial.sku length=$product.price_trial_length} - trial_length_months - {/translate} - {/if} -
    - {translate module=product sku2=$trial.sku} - trial_bill_desc - {/translate} -
    - {/if} - {if $attr}
    - {foreach from=$attr item=attr_arr key=key} - {assign var=attr_id value=$attr_arr.id} - {if $attr_arr.type == "0"} - - - - - - - {if $attr_arr.description} - - - - {/if} -
    - - - - - -
    - {$attr_arr.name} - - {if $attr_arr.price_base != 0} - {$list->format_currency($attr_arr.price_base, $smarty.const.SESS_CURRENCY)} - {/if} - {if $attr_arr.price_setup != 0} - {if $attr_arr.price_base != 0} - + - {/if} - {$list->format_currency($attr_arr.price_setup, $smarty.const.SESS_CURRENCY)} - {translate module=product} - setup - {/translate} - {/if} -
    -
    -    - - -   {$attr_arr.description} -
    - {elseif $attr_arr.type == "1"} - - - - - - {if $attr_arr.description} - - - - {/if} -
    - - - - - -
    - {$attr_arr.name} - - {if $attr_arr.price_base != 0} - {$list->format_currency($attr_arr.price_base, $smarty.const.SESS_CURRENCY)} - {/if} - {if $attr_arr.price_setup != 0} - {if $attr_arr.price_base != 0} - + - {/if} - {$list->format_currency($attr_arr.price_setup, $smarty.const.SESS_CURRENCY)} - {translate module=product} - setup - {/translate} - {/if} -
    -
    -    - -  {$attr_arr.description} -
    - {elseif $attr_arr.type == "2"} - - - - - - - - -
    - - - - - -
    - {$attr_arr.name} - - {if $attr_arr.price_base != 0} - {$list->format_currency($attr_arr.price_base, $smarty.const.SESS_CURRENCY)} - {/if} - {if $attr_arr.price_setup != 0} - {if $attr_arr.price_base != 0} - + - {/if} - {$list->format_currency($attr_arr.price_setup, $smarty.const.SESS_CURRENCY)} - {translate module=product} - setup - {/translate} - {/if} -
    -
    - -   - {$attr_arr.description} -
    - {/if} - {/foreach} - {/if} - - - {if $product.host} -
    - - - - - - - - -
    - - - - -
    - {translate module=product} - domain_options - {/translate} -
    -
    - {if $product.host_allow_domain} - - {translate module=product} - domain_register - {/translate} -
    - - {translate module=product} - domain_transfer - {/translate} - {/if} -
    - - {translate module=product} - domain_ns_transfer - {/translate} - {if $product.host_allow_host_only} -
    - - {translate module=product} - domain_ip - {/translate} -
    - {/if} - - - - -
    - {/if} - +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false) } + {$block->display('core:method_error')} +{else} - - {if $product.prod_plugin} -
    - {plugin type=product name=$product.prod_plugin_file name_prefix=order_ data=$product.prod_plugin_data admin=true } -
    - - - -
    - - - - - - - -
    - - - - - -
    -

    - {if $list->translate("product_translate","name,description_short,description_full","product_id", $product.id, "prod_translate") } - {$prod_translate.name} - {else} - {$product.sku} - {/if} -

    -
    -
    - - - - - - - - - {if $product.cart_multiple} - - - - {/if} - - {if $product.prod_plugin} - - - - {/if} - -
    - - - - -
    - {if $product.thumbnail != ""} - - {/if} - {$translate_product.description_full} -
    -
    - - - - - - - - - -
    - {translate module=product} - field_sku - {/translate} - - {translate} - currency - {/translate} -
    - {$product.sku} - - - - - - -
    - {literal} - - {/literal} - {$list->currency_list("cyid_arr")} - - -
    -
    - - - - - - - - - -
    - {translate module=product} - field_price_type - {/translate} -
    -
    - {translate module=product} - field_taxable - {/translate} -
    - {if $product.price_type == "0"} - {translate module=product} - price_type_one - {/translate} - {/if} - {if $product.price_type == "1"} - {translate module=product} - price_type_recurr - {/translate} - {/if} - {if $product.price_type == "2"} - {translate module=product} - price_type_trial - {/translate} - {/if} - - {if $product.taxable} - {translate} - true - {/translate} - {else} - {translate} - false - {/translate} - {/if} -
    - {if $product.price_type == "1" } - - - - - - - -
    - {translate module=product} - field_price_recurr_type - {/translate} -
    - -
    - {else} - - - - - - - - - -
    - {translate module=product} - field_price_base - {/translate} - - {translate module=product} - field_price_setup - {/translate} -
    - {$list->format_currency($price.base, $smarty.const.SESS_CURRENCY)} - - {$list->format_currency($price.setup, $smarty.const.SESS_CURRENCY)} -
    - {/if} - {if $product.price_type == "2"} - - - - -
    - {translate module=product sku=$trial.sku} - trial_desc - {/translate} - - {translate} - view - {/translate} -
    - {if $product.price_trial_length_type == "0"} - {translate module=product sku1=$trial.sku length=$product.price_trial_length} - trial_length_days - {/translate} - {/if} - {if $product.price_trial_length_type == "1"} - {translate module=product sku1=$trial.sku length=$product.price_trial_length} - trial_length_weeks - {/translate} - {/if} - {if $product.price_trial_length_type == "2"} - {translate module=product sku1=$trial.sku length=$product.price_trial_length} - trial_length_months - {/translate} - {/if} -
    - {translate module=product sku2=$trial.sku} - trial_bill_desc - {/translate} -
    - {/if} - {if $attr} -
    - {foreach from=$attr item=attr_arr key=key} - {assign var=attr_id value=$attr_arr.id} - {if $attr_arr.type == "0"} - - - - - - - -
    - - - - - -
    - {$attr_arr.name} - - {if $attr_arr.price_base != 0} - {$list->format_currency_num($attr_arr.price_base, $smarty.const.SESS_CURRENCY)} - {/if} - {if $attr_arr.price_setup != 0} - {if $attr_arr.price_base != 0} - + - {/if} - {$list->format_currency_num($attr_arr.price_setup, $smarty.const.SESS_CURRENCY)} - {translate module=product} - setup - {/translate} - {/if} -
    -
    - -   - {$attr_arr.description} -
    - {elseif $attr_arr.type == "1"} - - - - - - - -
    - - - - - -
    - {$attr_arr.name} - - {if $attr_arr.price_base != 0} - {$list->format_currency_num($attr_arr.price_base, $smarty.const.SESS_CURRENCY)} - {/if} - {if $attr_arr.price_setup != 0} - {if $attr_arr.price_base != 0} - + - {/if} - {$list->format_currency_num($attr_arr.price_setup, $smarty.const.SESS_CURRENCY)} - {translate module=product} - setup - {/translate} - {/if} -
    -
    - -   - {$attr_arr.description} -
    - {elseif $attr_arr.type == "3"} - - - - - - - -
    - - - - - -
    - {$attr_arr.name} - - {if $attr_arr.price_base != 0} - {$list->format_currency_num($attr_arr.price_base, $smarty.const.SESS_CURRENCY)} - {/if} - {if $attr_arr.price_setup != 0} - {if $attr_arr.price_base != 0} - + - {/if} - {$list->format_currency_num($attr_arr.price_setup, $smarty.const.SESS_CURRENCY)} - {translate module=product} - setup - {/translate} - {/if} -
    -
    - -   - {$attr_arr.description} -
    - {elseif $attr_arr.type == "2"} - - - - - - - -
    - - - - - -
    - {$attr_arr.name} - -
    -
    - -   - {$attr_arr.description} -
    - {/if} - {/foreach} - {/if} - {if $product.host} -
    - - - - - - - -
    - - - - -
    - {translate module=product} - domain_options - {/translate} -
    -
    - {if $product.host_allow_domain} - - {translate module=product} - domain_register - {/translate} -
    - - {translate module=product} - domain_transfer - {/translate} - {/if} -
    - - {translate module=product} - domain_ns_transfer - {/translate} - {if $product.host_allow_host_only} -
    - - {translate module=product} - domain_ip - {/translate} -
    - {/if} - - - - -
    - {/if} - {literal} - - + - {/literal} - {/if} -
    Quantity:
    - {plugin type=product name=$product.prod_plugin_file name_prefix=order_ data=$product.prod_plugin_data } -
    -
    -
    -
    - -

    - - + } + {/literal} + //--> + + {/if} +

    Quantity:
    {osb f=plugin type=product name=$product.prod_plugin_file name_prefix=order_ data=$product.prod_plugin_data}
    +
    +
    + +
    + + + + +
    + + +

    + +

    -{/if} \ No newline at end of file diff --git a/themes/default/blocks/product/iframe_associations.tpl b/themes/default/blocks/product/iframe_associations.tpl index 09360acf..aac222f7 100644 --- a/themes/default/blocks/product/iframe_associations.tpl +++ b/themes/default/blocks/product/iframe_associations.tpl @@ -1,197 +1,117 @@ -{ $block->display("core:top_clean") } - -{ $method->exe("product","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} - +{assign var=meth value=':'|explode:$VAR._page} + - -{foreach from=$product item=product} +{$method->exe($meth.0,'view')} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} -
    - - - - -
    - - - - - - - - - - - - {if $product.price_type == "1"} - - - - {/if} - - - - -
    - - - - -
    - - - - - -
    - - - - - - - - - - -
    - {translate module=product} - field_assoc_req_prod - {/translate} -
    - - {translate module=product} - assoc_req_all - {/translate} -
    - - {translate module=product} - assoc_req_one - {/translate} -
    -
    - { $list->menu_multi($product.assoc_req_prod, "product_assoc_req_prod", "product", "sku", "10", "", "form_menu") } -
    -
    -
    - - - - - -
    - {translate module=product} - field_assoc_grant_prod - {/translate} - - { $list->menu_multi($product.assoc_grant_prod, "product_assoc_grant_prod", "product", "sku", "10", "", "form_menu") } -
    -
    - - - - - -
    - - - - - - - - - - -
    - {translate module=product} - field_assoc_grant_group - {/translate} -
    -

    - - {translate module=product} - assoc_group_limited - {/translate} - -
    - - {translate module=product} - assoc_group_subscription - {/translate} -
    - - {translate module=product} - assoc_group_forever - {/translate} -

    -
    -
    - { $list->menu_multi($product.assoc_grant_group, "product_assoc_grant_group", "group", "name", "10", "", "form_menu") } -
    - -
    - - - - - -
    - - - - - - - - - - -
    - {translate module=product} - field_price_recurr_modify - {/translate} - { $list->bool("product_price_recurr_modify", $product.price_recurr_modify, "\" onChange=\"document.forms.product_view.submit()\"") } -
    -
    - -
    -
    - {if $product.host == 1} - {html_menu_product_host name="product_modify_product_arr" default=$product.modify_product_arr exclude=$product.id} - {else} - {html_menu_product_subscription name="product_modify_product_arr" default=$product.modify_product_arr exclude=$product.id} - {/if} -
    -
    - - - - -
    - -
    -
    -
    - - - - - - - - - - - - - - -
    +
    -{/foreach}{/if} + + + + +
    + + + + + + + + + + + {if $record.price_type == '1'} + + + + {/if} + + + +
    + + + + + + + + +
    {t}Product(s) Required for access to this Product{/t}
    + + {$list->menu_staticlist('assoc_prod_type','','product_assoc_req_prod_type',0,'form_menu',false)}
    + + {$list->menu_staticlist('assoc_prod_type','','product_assoc_req_prod_type',1,'form_menu',false)} +
    {$list->menu_multi($record.assoc_req_prod,'product_assoc_req_prod','product','sku','10','10','form_menu')}
    +
    + + + + + +
    {t}Purchasing This Product Grants Access to the Following Product(s){/t}{$list->menu_multi($record.assoc_grant_prod,'product_assoc_grant_prod','product','sku','10','10','form_menu')}
    +
    + + + + + + + + +
    {t}Purchasing This Product Grants Access to the Following Group(s){/t}
    + + {$list->menu_staticlist('assoc_grant_type','','product_assoc_grant_group_type',0,'form_menu',false)} +
    + + {$list->menu_staticlist('assoc_grant_type','','product_assoc_grant_group_type',1,'form_menu',false)}
    + + {$list->menu_staticlist('assoc_grant_type','','product_assoc_grant_group_type',2,'form_menu',false)} +
    {$list->menu_multi($record.assoc_grant_group,'product_assoc_grant_group','group','name','10','10','form_menu')}
    +
    + + + + + +
    {t}Allow Modification of Service?{/t} {$list->bool('product_price_recurr_modify',$record.price_recurr_modify,'" onChange="document.forms.product_view.submit()')} + + + {if $record.host == 1} + {osb f=html_menu_product_host name="product_modify_product_arr" default=$record.modify_product_arr exclude=$record.id size=10} + {else} + {osb f=html_menu_product_subscription name="product_modify_product_arr" default=$record.modify_product_arr exclude=$record.id size=10} + {/if} +
    +
    + + + + +
    +
    +
    + +
    + + + + + + + + + + + + + +
    +
    +{/if} diff --git a/themes/default/blocks/product/iframe_price_recurring.tpl b/themes/default/blocks/product/iframe_price_recurring.tpl index c10ec4de..0fdeff2c 100644 --- a/themes/default/blocks/product/iframe_price_recurring.tpl +++ b/themes/default/blocks/product/iframe_price_recurring.tpl @@ -1,66 +1,49 @@ { $block->display("core:top_clean") } - -{ $method->exe("product","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} - - -{foreach from=$product item=product} -{$list->unserial($product.price_group, "attr_group_array")} -
    +{ $method->exe("product","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} + +{$list->unserial($record.price_group, "attr_group_array")} +
    - - + - - +
    +
    - - + +
    -
    - {translate module=product} - field_price_group - {/translate} -
    -
    {translate module=product}field_price_group{/translate}
    +
    - - + - - +
    +
    - - +
    - {translate module=product} - weekly - {/translate} -    +
    + {translate module=product}weekly{/translate} +    { $list->bool("product_price_group[0][show]", $attr_group_array[0].show, "form_menu") }
    - { if ($list->smarty_array("group","name"," AND pricing='1' ", "group_array")) } + { if ($list->smarty_array("group","name"," AND pricing='1' ", "group_array")) } {foreach from=$group_array item=arr} {assign var="idx" value=$arr.id} - - - + + - @@ -73,15 +56,13 @@
    - {$arr.name} - - {translate module=product} - field_price_base - {/translate} +
    {$arr.name} + {translate module=product}field_price_base{/translate} {$list->currency_iso("")} - {translate module=product} - field_price_setup - {/translate} + + {translate module=product}field_price_setup{/translate} {$list->currency_iso("")}
    +
    - - + @@ -89,21 +70,15 @@ {foreach from=$group_array item=arr} {assign var="idx" value=$arr.id}
    - {translate module=product} - monthly - {/translate} -    +
    + {translate module=product}monthly{/translate} +    { $list->bool("product_price_group[1][show]", $attr_group_array[1].show, "form_menu") }
    - - - + + - @@ -112,15 +87,13 @@ {/foreach} - - +
    - {$arr.name} - - {translate module=product} - field_price_base - {/translate} +
    {$arr.name} + {translate module=product}field_price_base{/translate} {$list->currency_iso("")} - {translate module=product} - field_price_setup - {/translate} + + {translate module=product}field_price_setup{/translate} {$list->currency_iso("")}
    +
    - - + @@ -128,20 +101,20 @@ {foreach from=$group_array item=arr} {assign var="idx" value=$arr.id}
    - {translate module=product} - quarterly - {/translate} -    +
    + {translate module=product}quarterly{/translate} +    { $list->bool("product_price_group[2][show]", $attr_group_array[2].show, "form_menu") }
    - - + - - - - +
    +
    {$arr.name} + {translate module=product} - field_price_base + field_price_base {/translate} {$list->currency_iso("")} + {translate module=product} - field_price_setup + field_price_setup {/translate} {$list->currency_iso("")} @@ -151,15 +124,15 @@ {/foreach}
    +
    - - + @@ -167,20 +140,20 @@ {foreach from=$group_array item=arr} {assign var="idx" value=$arr.id}
    +
    {translate module=product} - semianually + semianually {/translate} -    +    { $list->bool("product_price_group[3][show]", $attr_group_array[3].show, "form_menu") }
    - - + - - - +
    +
    {$arr.name} + {translate module=product} - field_price_base + field_price_base {/translate} {$list->currency_iso("")} + {translate module=product} - field_price_setup + field_price_setup {/translate} {$list->currency_iso("")} @@ -190,15 +163,15 @@ {/foreach}
    - - + @@ -206,20 +179,20 @@ {foreach from=$group_array item=arr} {assign var="idx" value=$arr.id}
    +
    {translate module=product} - anually + anually {/translate} -    +    { $list->bool("product_price_group[4][show]", $attr_group_array[4].show, "form_menu") }
    - - + - - - +
    +
    {$arr.name} + {translate module=product} - field_price_base + field_price_base {/translate} {$list->currency_iso("")} + {translate module=product} - field_price_setup + field_price_setup {/translate} {$list->currency_iso("")} @@ -229,15 +202,15 @@ {/foreach}
    - - + @@ -245,20 +218,20 @@ {foreach from=$group_array item=arr} {assign var="idx" value=$arr.id}
    +
    {translate module=product} - twoyear + twoyear {/translate} -    +    { $list->bool("product_price_group[5][show]", $attr_group_array[5].show, "form_menu") }
    - - + - - - +
    +
    {$arr.name} + {translate module=product} - field_price_base + field_price_base {/translate} {$list->currency_iso("")} + {translate module=product} - field_price_setup + field_price_setup {/translate} {$list->currency_iso("")} @@ -268,15 +241,15 @@ {/foreach}
    - - + @@ -284,20 +257,20 @@ {foreach from=$group_array item=arr} {assign var="idx" value=$arr.id}
    +
    {translate module=product} - threeyear + threeyear {/translate} -    +    { $list->bool("product_price_group[6][show]", $attr_group_array[6].show, "form_menu") }
    - - + - - - +
    +
    {$arr.name} + {translate module=product} - field_price_base + field_price_base {/translate} {$list->currency_iso("")} + {translate module=product} - field_price_setup + field_price_setup {/translate} {$list->currency_iso("")} @@ -307,12 +280,12 @@ {/foreach}
    - - + @@ -323,18 +296,18 @@
    +
    - + - - - - - + + + + + - + @@ -342,4 +315,4 @@ - {/foreach}{/if} + {/if} diff --git a/themes/default/blocks/product/search_form.tpl b/themes/default/blocks/product/search_form.tpl index 749519c3..abf65296 100644 --- a/themes/default/blocks/product/search_form.tpl +++ b/themes/default/blocks/product/search_form.tpl @@ -1,137 +1,61 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("product","search_form") } -{ if ($method->result == FALSE) } - { $block->display("core:method_error") } +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=product}title_search{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=product} - field_date_orig - {/translate} - - { $list->calender_search("product_date_orig", $VAR.product_date_orig, "form_field", "") } -
    - {translate module=product} - field_sku - {/translate} - - -    - {translate} - search_partial - {/translate} -
    - {translate module=product} - field_taxable - {/translate} - - { $list->bool("product_taxable", "all", "form_menu") } -
    - {translate module=product} - field_active - {/translate} - - { $list->bool("product_active", "all", "form_menu") } -
    - {translate module=product} - field_price_type - {/translate} - - - {translate module=product} - price_type_one - {/translate} -
    - - {translate module=product} - price_type_recurr - {/translate} -
    - - {translate module=product} - price_type_trial - {/translate} -
    - {translate} - search_results_per - {/translate} - - -
    - {translate} - search_order_by - {/translate} - - -
    - - - - -
    -
    -
    -
    -{ $block->display("core:saved_searches") } -{ $block->display("core:recent_searches") } +
    + + + + + +
    + + + + + + + +
    {translate module=product}title_search{/translate}
    + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/search_post.tpl'} +
    {translate module=product}field_date_orig{/translate}{$list->calender_search('product_date_orig',$VAR.product_date_orig,'form_field','')}
    {translate module=product}field_sku{/translate}  {t}"%" for partial match{/t}
    {translate module=product}field_taxable{/translate}{$list->bool('product_taxable','all')}
    {translate module=product}field_active{/translate}{$list->bool('product_active','all')}
    {translate module=product}field_price_type{/translate} + + {translate module=product}price_type_one{/translate}
    + + {translate module=product}price_type_recurr{/translate}
    + + {translate module=product}price_type_trial{/translate} +
    +
    +
    + +
    + + {$block->display('core:saved_searches')} + {$block->display('core:recent_searches')} {/if} diff --git a/themes/default/blocks/product/search_show.tpl b/themes/default/blocks/product/search_show.tpl index 44476397..228b4625 100644 --- a/themes/default/blocks/product/search_show.tpl +++ b/themes/default/blocks/product/search_show.tpl @@ -1,148 +1,59 @@ -{$method->exe("product","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{assign var=meth value=':'|explode:$VAR._page} + + +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - {popup_init src="$URL/includes/overlib/overlib.js"} - - {literal} - - - {/literal} + {include file='file:../core/search_show_pre.tpl'} - -
    + + + + +
    + + {$method->exe_noauth($meth.0,'tpl_search_show')} + {foreach from=$search_show item=record} + {include file='file:../core/search_show_tr_record.tpl'} + + + + + + + {/foreach} +
    {$record.sku}{$list->format_currency($record.price_base,'')} + {if $record.active == '1'} + Status + {else} + Status + {/if} + + {if $list->translate('product_translate','name,description_short','id',$record.id,'name')} + {$name.name|truncate:50} + {else} + --- + {/if} + + {if {$name.short_description != ''} + {assign var="descshort" value=$name.description_short|strip_tags} + Edit + {/if} +
    +
    - -
    - - - - - - -
    - - - - - - - - - - - {foreach from=$product item=record} - - - - - - - - - {literal} - - {/literal} - {/foreach} - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} - - {translate - module=product_translate} - field_description_short - {/translate} -  
    - - -

      - {$record.sku} -

      - {$list->format_currency($record.price_base,"")} - - {if $record.active == "1"} - - {else} - - {/if} -   - {if $list->translate("product_translate","name,description_short","id",$record.id, "name")} - {$name.name|truncate:50} - {else} - --- - {/if} - - {if {$name.short_description != ""} - {assign var="descshort" value=$name.description_short|strip_tags} - - - - {/if} -
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} + + {/if} -{/if} -
    - -{literal} -{/literal} diff --git a/themes/default/blocks/product/view.tpl b/themes/default/blocks/product/view.tpl index bf8c1fe4..044b0dcf 100644 --- a/themes/default/blocks/product/view.tpl +++ b/themes/default/blocks/product/view.tpl @@ -1,538 +1,298 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("product","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} -{literal} - - -{/literal} - -{foreach from=$product item=product} + viewTranslations(); - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - -
    - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - {translate module=product} - title_view - {/translate} -
    -
    - - - - - - - - - -
    - {translate module=product} - field_date_orig - {/translate} - - {translate module=product} - field_date_last - {/translate} -
    - {$list->date($product.date_orig)} - - {$list->date($product.date_last)} - -
    -
    - - - - - - - - - -
    - {translate module=product} - field_sku - {/translate} - - {translate module=product} - field_position - {/translate} -
    - - - -
    -
    - - - - - - - - - -
    - {translate module=product} - field_active - {/translate} - - {translate module=product} - field_taxable - {/translate} -
    - { $list->bool("product_active", $product.active, "form_menu") } - - { $list->bool("product_taxable", $product.taxable, "form_menu") } -
    -
    - - - - - - - - - -
    - {translate module=product} - field_price_base - {/translate} - - {translate module=product} - field_price_setup - {/translate} -
    - - {$list->currency_iso("")} - - - {$list->currency_iso("")} -
    -
    - - - - - - - - - -
    - {translate module=product} - field_avail_category_id - {/translate} -
    -
    - {translate module=product} - field_group_avail - {/translate} -
    {$method->exe_noauth("product_cat","admin_menu_product")} - { $list->menu_multi($product.group_avail, 'product_group_avail', 'group', 'name', '', '5', 'form_menu') } -
    - {if $product.price_type == "1"} -
    - - - - - - - - - - - - - -
    - {translate module=product} - field_price_recurr_default - {/translate} - - -
    - {translate module=product} - field_price_recurr_type - {/translate} - - {translate module=product} - user_options - {/translate} -
    - - {translate module=product} - recurr_type_aniv - {/translate} -
    - - {translate module=product} - recurr_type_fixed - {/translate} -
    - {translate module=product} - field_price_recurr_weekday - {/translate} - - (1-28)
    - { $list->bool("product_price_recurr_schedule", $product.price_recurr_schedule, "form_menu") } - {translate module=product} - field_price_recurr_schedule - {/translate} -
    - { $list->bool("product_price_recurr_cancel", $product.price_recurr_cancel, "form_menu") } - {translate module=product} - field_price_recurr_cancel - {/translate} -
    - { $list->bool("product_cart_multiple", $product.cart_multiple, "form_menu") } - {translate module=product} - field_cart_multiple - {/translate} -
    - {/if} - - - {if $product.price_type == "2"} -
    - - - - - - - - - -
    - {translate module=product} - field_price_trial_prod - {/translate} -
    -
    - {translate module=product} - field_price_trial_length - {/translate} -
    - { $list->menu("", "product_price_trial_prod", "product", "sku", $product.price_trial_prod, "form_menu") } - - - -
    - {/if} - - -
    - - - - - -
    - {if $product.thumbnail != ""} - -     - {/if} - {translate module=product} - field_thumbnail - {/translate} -     - - {if $product.thumbnail != ""} - - {/if} -
    -
    - - - - - -
    - - - -
    -
    - - - - -
    - - Name & Description - | - {translate module=product} - attributes - {/translate} - | - {translate module=product} - advanced_billing - {/translate} - | - {translate module=product} - associations - {/translate} - | - {translate module=product} - discounts - {/translate} - - {if $list->is_installed("host_server")} - | - {translate module=product} - hosting - {/translate} - - {/if} - | - {translate module=product} - product_plugins - {/translate} - | - {translate module=product} - link - {/translate} - | - {translate module=product} - clone - {/translate} -
    -
    -
    - - - - - - - - - - - - - -
    - -
    -
    - -{literal} -{/literal} - - {/foreach} + function showLink(product_id,recurr_schedule) { + showIFrame('iframe',0,0,'?_page=core:blank'); + var code; + code = '
    Add to cart and checkout:
    '; + code += '

    Add to cart and view cart:
    '; + document.getElementById('code').innerHTML = code; + } + + function showImages() { + document.getElementById('code').innerHTML = ''; + showIFrame('iframe',getPageWidth(600),300,'?_page=core:search_iframe&module=product_img&product_img_product_id='+product_id+'&_escape=1&_escape_next=1&_next_page_one=view&_next_page_none=add&name_id1=product_img_product_id&val_id1='+product_id); + } + + function showAttributes() { + document.getElementById('code').innerHTML = ''; + showIFrame('iframe',getPageWidth(600),300,'?_page=core:search_iframe&module=product_attr&product_attr_product_id='+product_id+'&_escape=1&_escape_next=1&_next_page_one=view&_next_page_none=add&name_id1=product_attr_product_id&val_id1='+product_id+'&name_id2=product_attribute_product_price_type&val_id2={/literal}{$record.price_type}{literal}'); + } + + function showBilling() { + document.getElementById('code').innerHTML = ''; + var billingtype = {/literal}{$record.price_type}{literal}; + if (billingtype == '0' || billingtype == '2') + showIFrame('iframe',getPageWidth(600),300,'?_page=product:iframe_price_onetime&_escape=1&id='+product_id); + else if(billingtype == '1') + showIFrame('iframe',getPageWidth(600),300,'?_page=product:iframe_price_recurring&_escape=1&id='+product_id); + } + + function showAssociations() { + document.getElementById('code').innerHTML = ''; + showIFrame('iframe',getPageWidth(600),300,'?_page=product:iframe_associations&id='+product_id); + } + + function showDiscounts() { + document.getElementById('code').innerHTML = ''; + showIFrame('iframe',getPageWidth(600),300,'?_page=product:iframe_discounts&_escape=1&id='+product_id); + } + + function showHosting() { + document.getElementById('code').innerHTML = ''; + showIFrame('iframe',getPageWidth(600),300,'?_page=product:iframe_hosting&_escape=1&id='+product_id); + } + + function showPlugins() { + document.getElementById('code').innerHTML = ''; + showIFrame('iframe',getPageWidth(600),300,'?_page=product:iframe_plugins&_escape=1&id='+product_id); + } + + function clone() { + document.getElementById('code').innerHTML = ''; + showIFrame('iframe',getPageWidth(600),300,'?_page=product:iframe_clone&_escape=1&id='+product_id); + } + {/literal} + //--> + {/if} diff --git a/themes/default/blocks/product_attr/add.tpl b/themes/default/blocks/product_attr/add.tpl index 6923795b..d407c8e1 100644 --- a/themes/default/blocks/product_attr/add.tpl +++ b/themes/default/blocks/product_attr/add.tpl @@ -6,7 +6,7 @@ {/if} -
    + @@ -112,7 +112,7 @@
    -
    +
    {translate module=product_attr} field_price_group {/translate} diff --git a/themes/default/blocks/product_attr/search_show.tpl b/themes/default/blocks/product_attr/search_show.tpl index f1769294..ab4ad190 100644 --- a/themes/default/blocks/product_attr/search_show.tpl +++ b/themes/default/blocks/product_attr/search_show.tpl @@ -73,7 +73,7 @@
    -

    +

    {translate module=product_attr} title_add {/translate} diff --git a/themes/default/blocks/product_attr/view.tpl b/themes/default/blocks/product_attr/view.tpl index 3c0409d4..bfa24db2 100644 --- a/themes/default/blocks/product_attr/view.tpl +++ b/themes/default/blocks/product_attr/view.tpl @@ -1,216 +1,149 @@ -{ $block->display("core:top_clean") } +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("product_attr","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} - - -{foreach from=$product_attr item=product_attr}
    +{$block->display('core:top_clean')} - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - -
    - {translate module=product_attr} - field_name - {/translate} - - -
    - {translate module=product_attr} - field_description - {/translate} - - -
    -
    - - - - - - - - - - - {if $product_attr.collect_type != "0" && $product_attr.collect_type != "" } - - - - - {/if} - -
    - {translate module=product_attr} - field_collect_type - {/translate} - - {translate module=product_attr} - field_collect_default - {/translate} -
    - - {translate module=product_attr} - type_checkbox - {/translate} -
    - - {translate module=product_attr} - type_text - {/translate} -
    - - {translate module=product_attr} - type_menu - {/translate} -
    - - {translate module=product_attr} - type_textarea - {/translate} -
    - -
    - {translate module=product_attr} - input_req - {/translate} - - { $list->bool("product_attr_required", $product_attr.required, "form_menu") } -
    -
    - - - - - -
    - {translate module=product_attr} - field_price_base - {/translate} -     - - {$list->currency_iso("")} - - {translate module=product_attr} - field_price_setup - {/translate} -    - - {$list->currency_iso("")} -
    -
    - - - - -
    -
    - {translate module=product_attr} - field_price_group - {/translate} -
    -
    -
    - - - - -
    - {$list->unserial($product_attr.price_group, "attr_group_array")} - - {$attr_group_array[$arr.id].price_base} -
    - - { if ($list->smarty_array("group","name"," AND pricing='1' ", "group_array")) } - {foreach from=$group_array item=arr} - {assign var="idx" value=$arr.id} - - - - - - -
    - {$arr.name} - - {translate module=product_attr} - field_price_base - {/translate} - - - {$list->currency_iso("")} - - {translate module=product_attr} - field_price_setup - {/translate} - - {$list->currency_iso("")} -
    - {/foreach} - {/if} -
    -
    - - - - - - -
    - {translate module=product_attr} - title_add - {/translate} - - {translate module=product_attr} - title_delete - {/translate} - - -
    -
    -
    - - - - - - {/foreach} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} + + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} + + +
    + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + +
    {osb f=tf field=name}
    {osb f=tf field=description}
    +
    + + + + + + + + + + {if $record.collect_type != '0' && $record.collect_type != ''} + + + + + {/if} +
    {osb f=tf field=collect_type}{osb f=tf field=collect_default}
    + + {translate module=product_attr}type_checkbox{/translate}
    + + {translate module=product_attr}type_text{/translate}
    + + {translate module=product_attr}type_menu{/translate}
    + + {translate module=product_attr}type_textarea{/translate} +
    {translate module=product_attr}input_req{/translate}{$list->bool('product_attr_required',$record.required)}
    +
    + + + + + +
    {osb f=tf field=price_base}    + + {$list->currency_iso('')} + + {osb f=tf field=price_setup}   + + {$list->currency_iso('')} +
    +
    + + + + +
    {osb f=tf field=price_group}
    +
    + + + + +
    + {$list->unserial($record.price_group,'attr_group_array')} + {$attr_group_array[$arr.id].price_base} +
    + + {if ($list->smarty_array('group','name'," AND pricing='1' ",'group_array'))} + {foreach from=$group_array item=arr} + {assign var='idx' value=$arr.id} + + + + + + +
    {$arr.name} + {osb f=tf field=price_base} + + {$list->currency_iso('')} + + {osb f=tf field=price_setup} + + {$list->currency_iso('')} +
    + {/foreach} + {/if} +
    +
    + + + + + + +
    + {translate module=product_attr}title_add{/translate} + + {translate module=product_attr}title_delete{/translate} +
    +
    +
    + + {include file='file:../core/view_post.tpl'} +
    {/if} diff --git a/themes/default/blocks/product_cat/add.tpl b/themes/default/blocks/product_cat/add.tpl index 2315bc1d..dda94655 100644 --- a/themes/default/blocks/product_cat/add.tpl +++ b/themes/default/blocks/product_cat/add.tpl @@ -1,178 +1,52 @@ -{literal} -{/literal} - - {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} -
    + - - - - -
    - - - - - - - -
    -
    - {translate module=product_cat}title_add{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=product_cat} - field_name - {/translate} - -
    - {translate module=product_cat} - field_notes - {/translate} - - -
    - {translate module=product_cat} - field_parent_id - {/translate} -  
    - {translate module=product_cat} - field_group_avail - {/translate} - - { $list->menu_multi($VAR.product_cat_group_avail, 'product_cat_group_avail', 'group', 'name', '', '10', 'form_menu') } -
    - {translate module=product_cat} - field_status - {/translate} - { if $VAR.product_cat_status != ""} - { $list->bool("product_cat_status", $VAR.product_cat_status, "form_menu") } - {else} - { $list->bool("product_cat_status", "1", "form_menu") } - {/if} -
    - {translate module=product_cat} - field_template - {/translate} - { $list->menu_files("", "product_cat_template", $VAR.product_cat_template, "product_cat", "t_", ".tpl", "form_menu") } -
    - {translate module=product_cat} - field_thumbnail - {/translate} - - -
    - {translate module=product_cat} - field_image - {/translate} - - -
    - {translate module=product_cat} - field_position - {/translate} - - -
    - {translate module=product_cat} - field_max - {/translate} - - -
    - - - - -
    -
    -
    -
    + + + + +
    + + + + + + + +
    {osb f=tt module=product_cat method=add}
    + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf module=product_cat field=name}
    {osb f=tf module=product_cat field=group_avail}{$list->menu_multi($VAR.product_cat_group_avail,'product_cat_group_avail','group','name','','10','form_menu')}
    {osb f=tf module=product_cat field=template}{$list->menu_files('','product_cat_template',$VAR.product_cat_template,'product_cat','t_','.tpl','form_menu')}
    {osb f=tf module=product_cat field=max}
    + + + + +
    +
    +
    + + diff --git a/themes/default/blocks/product_cat/imagePreview.js b/themes/default/blocks/product_cat/imagePreview.js new file mode 100644 index 00000000..f4732480 --- /dev/null +++ b/themes/default/blocks/product_cat/imagePreview.js @@ -0,0 +1,37 @@ +function previewImage(fileInfo) { + var filename = ''; + + //create the path to your local file + if (fileInfo == null) { + if (document.form1.file != "") { + filename = "file:///" + document.form1.file.value; + } + } else { + filename = fileInfo; + } + + //check if there is a value + if (filename == '') { + alert ("Please select a image."); + document.form1.file.focus(); + } else { + + //create the popup + popup = window.open('','imagePreview','width=640,height=100,left=100,top=75,screenX=100,screenY=75,scrollbars,location,menubar,status=0,toolbar=0,resizable=1'); + + //start writing in the html code + popup.document.writeln(""); + + //get the extension of the file to see if it has one of the image extensions + var fileExtension = filename.substring(filename.lastIndexOf(".")+1); + if (fileExtension == "jpg" || fileExtension == "jpeg" || fileExtension == "gif" || fileExtension == "png") + popup.document.writeln(""); + else + //if not extension fron list above write URL to file + popup.document.writeln("" + filename + ""); + + popup.document.writeln(""); + popup.document.close(); + popup.focus(); + } +} diff --git a/themes/default/blocks/product_cat/menu.tpl b/themes/default/blocks/product_cat/menu.tpl index 89becd8c..951b59da 100644 --- a/themes/default/blocks/product_cat/menu.tpl +++ b/themes/default/blocks/product_cat/menu.tpl @@ -1,73 +1,57 @@ - - - - + + + +
    - - - - -
    - - - - -

    - {translate} - products - {/translate} -

    -
    -
    -
    - {if $smarty.const.SHOW_CHECKOUT_LINK}{translate}checkout{/translate}{/if} -
    + + + + +
    + + + + +

    {t}Products{/t}

    +
    +
    {if ! $smarty.const.SHOW_CHECKOUT_LINK}{t}Checkout{/t}{/if}
    -
    -{$method->exe_noauth("product_cat","user_menu")} +
    -{if $product_cat != "" || $smarty.const.SHOW_DOMAIN_LINK } +{$method->exe_noauth('product_cat','user_menu')} + +{if $product_cat != '' || $smarty.const.SHOW_DOMAIN_LINK} - - +
    - - - - + + - + {if $smarty.const.SHOW_DOMAIN_LINK} + + + + {/if} +
    + + + + + {foreach from=$product_cat item=record key=key} + {assign var=cat_translate value=''} + + + + {/foreach} - {foreach from=$product_cat item=record key=key} - - - - {/foreach} - - { if $smarty.const.SHOW_DOMAIN_LINK } - - - - {/if} -
    -
    +
    -


    +


    {/if} diff --git a/themes/default/blocks/product_cat/post_t_Pages.tpl b/themes/default/blocks/product_cat/post_t_Pages.tpl new file mode 100644 index 00000000..1e55182b --- /dev/null +++ b/themes/default/blocks/product_cat/post_t_Pages.tpl @@ -0,0 +1,14 @@ + +{t count=$page_pages 1=$page_pages plural="View items on page: %1"}{/t} +{if $page_pages > 1} + {foreach from=$page_arr item=page} + + {if $page == $page_page} + {$page} + {else} + {$page} + {/if} + + {if $page != $page_pages} | {/if} + {/foreach} +{/if} diff --git a/themes/default/blocks/product_cat/pre_t_CategoryDrill.tpl b/themes/default/blocks/product_cat/pre_t_CategoryDrill.tpl new file mode 100644 index 00000000..3bb4fa27 --- /dev/null +++ b/themes/default/blocks/product_cat/pre_t_CategoryDrill.tpl @@ -0,0 +1,26 @@ + +{if $product_cat_arr} + {foreach from=$product_cat_arr item=record} + + + + +
    + + + + +
    + + + + +
    {osb f=tt module=product_cat method=view} + {foreach from=$parent_cat item=cat} + > {$cat.name} + {/foreach} +
    +
    +
    + {/foreach} +{/if} diff --git a/themes/default/blocks/product_cat/pre_t_SubCategories.tpl b/themes/default/blocks/product_cat/pre_t_SubCategories.tpl new file mode 100644 index 00000000..ea3ab405 --- /dev/null +++ b/themes/default/blocks/product_cat/pre_t_SubCategories.tpl @@ -0,0 +1,50 @@ + +{foreach from=$product_sub_cat item=record} + {assign var=cat_translate value=''} + + + + +
    + + + + + + + +
    + + + + +
    + + + {if $list->translate('product_cat_translate','name,description','product_cat_id',$record.id,'cat_translate')} + {$cat_translate.name} + {else} + {$record.name} + {/if} + + +
    +
    + + + + +
    + {if $record.thumbnail != ''} + + {/if} + {if $cat_translate.description!= ''} + {$cat_translate.description} + {else} + {t}No Description{/t} + {/if} +
    +
    +
    +
    +{/foreach} diff --git a/themes/default/blocks/product_cat/search_show.tpl b/themes/default/blocks/product_cat/search_show.tpl index 2405e1c8..2e593f28 100644 --- a/themes/default/blocks/product_cat/search_show.tpl +++ b/themes/default/blocks/product_cat/search_show.tpl @@ -1,101 +1,12 @@ -{$method->exe("product_cat","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{assign var=meth value=':'|explode:$VAR._page} + + +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} - -
    - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - {foreach from=$product_cat item=record} - - - - - - - - - {literal} - - {/literal} - {/foreach} - - -
      - {literal} - - {/literal} - - {literal} - - {/literal} -
    - -  {$record.name} {if $record.status == "1"}{translate}true{/translate}{else}{translate}false{/translate}{/if}
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    + {include file='file:../core/search_show_pre.tpl'} + {$method->exe_noauth($meth.0,'tpl_search_show',$search_show)} + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/product_cat/t_Multi Column.tpl b/themes/default/blocks/product_cat/t_Multi Column.tpl index 796a019f..0ff787c2 100644 --- a/themes/default/blocks/product_cat/t_Multi Column.tpl +++ b/themes/default/blocks/product_cat/t_Multi Column.tpl @@ -1,188 +1,84 @@ -{if $VAR.id == ""} {$block->display("product:cat")} {else} -{$method->exe_noauth("product_cat", "user_view")} +{if $VAR.id == ''} + {$block->display('product_cat:user_menu')} +{else} + {$method->exe_noauth('product_cat','user_view')} - -{ if $product_cat_arr } -{foreach from=$product_cat_arr item=record} - - - - -
    - - - - -
    - - - - -
    {translate module=product_cat}menu{/translate} - {foreach from=$parent_cat item=cat} - > - {$cat.name} - - {/foreach} -
    -
    -
    -{/foreach} + + {include file='file:pre_t_CategoryDrill.tpl'} {/if} -{/if} - - -{if $product_sub_cat != ""} -
    -{foreach from=$product_sub_cat item=record} - - - - -
    - - - - - - - -
    - - - - -
    - - {if $list->translate("product_cat_translate","name,description","product_cat_id", $record.id, "cat_translate") } - {$cat_translate.name} - {else} - {$record.name} - {/if} -
    -
    - - - - -
    -

    - {if $record.thumbnail != "" } - - {/if} - {if $cat_translate.description!= "" } - {$cat_translate.description} - {else} - {translate module=product_cat} - desc_none - {/translate} - {/if} -

    -
    -
    -
    -
    -{/foreach} +{if $product_sub_cat != ''} +
    + {include file='file:pre_t_SubCategories.tpl'} {/if} -
    -{ if $product_arr } -{assign var=entries value=$product_arr} -{assign var=columns value=3} -{if count($entries) > 0} - - {math assign="lastcol" equation="x-1" x=$columns} - {math assign="width" equation="100 / x" x=$columns} - {section name="idx" loop=$entries} - {math assign="col" equation="x % y" x=$smarty.section.idx.rownum y=$columns} - {if $col == 0} {php} - {/if} - - {if $col == $lastcol || $smarty.section.idx.index_last == true }{/if} {* end of row *} - {/section} -
    - - - - - - - -
    - - - - - -
    - {math equation="x-1" x=`$smarty.section.idx.rownum` assign=i} - {assign var=product value=$product_arr.$i} -

    - {if $list->translate("product_translate","name,description_short,description_full","product_id", $product.id, "prod_translate") } - {$prod_translate.name} - {else} - {$product.sku} - {/if} -

    -
    - {$list->format_currency_num($product.price_base,$smarty.const.SESS_CURRENCY)} -
    -
    - - - {if $product.thumbnail != ""} - - {/if} - - -
    -

    -

    -
    -

    - {if $product.thumbnail != "" } - - {/if} - {if $prod_translate.description_short != "" } - {$prod_translate.description_short} - {else} - {translate module=product_cat} - desc_none - {/translate} - {/if} -

    -
    -
    -
    -{/if} - - +{if $product_arr} + {assign var=entries value=$product_arr} + {assign var=columns value=3} + {if count($entries) > 0} + + {math assign="lastcol" equation="x-1" x=$columns} + {math assign="width" equation="100 / x" x=$columns} + {section name="idx" loop=$entries} + {math assign="col" equation="x % y" x=$smarty.section.idx.rownum y=$columns} + {if $col == 0} + + {/if} + + {if $col == $lastcol || $smarty.section.idx.index_last == true} + + {/if} {* end of row *} + {/section} +
    + + + + + + + +
    + + + + + +
    + {math equation="x-1" x=`$smarty.section.idx.rownum` assign=i} + {assign var=product value=$product_arr.$i} + + {if $list->translate("product_translate","name,description_short,description_full","product_id", $product.id, "prod_translate") } + {$prod_translate.name} + {else} + {$product.sku} + {/if} + + {$list->format_currency_num($product.price_base,$smarty.const.SESS_CURRENCY)}
    +
    + + + {if $product.thumbnail != ''} + + {/if} + + +
    + + + {if $prod_translate.description_short != ''} + {$prod_translate.description_short} + {else} + {t}No Description{/t} + {/if} +
    +
    +
    + {/if} - -{if $page_pages > 1} -{translate module=product_cat} -pages -{/translate} -{foreach from=$page_arr item=page} - -{if $page == $page_page} - -{$page} - + + {include file='file:post_t_Pages.tpl'} {else} -{$page} -{/if} - -{if $page != $page_pages} -| -{/if} -{/foreach} -{/if} -{else} -{translate module=product_cat} -products_none -{/translate} + {t}No Products in this Category{/t} {/if} diff --git a/themes/default/blocks/product_cat/t_Paged Listing.tpl b/themes/default/blocks/product_cat/t_Paged Listing.tpl index cc380f00..26c23bc1 100644 --- a/themes/default/blocks/product_cat/t_Paged Listing.tpl +++ b/themes/default/blocks/product_cat/t_Paged Listing.tpl @@ -1,182 +1,72 @@ -{if $VAR.id == ""} {$block->display("product:cat")} {else} -{$method->exe_noauth("product_cat", "user_view")} +{if $VAR.id == ''} + {$block->display('product_cat:user_menu')} +{else} + {$method->exe_noauth('product_cat','user_view')} - -{ if $product_cat_arr } -{foreach from=$product_cat_arr item=record} - - - - -
    - - - - -
    - - - - -
    {translate module=product_cat}menu{/translate} - {foreach from=$parent_cat item=cat} - > - {$cat.name} - - {/foreach} -
    -
    -
    -{/foreach} + + {include file='file:pre_t_CategoryDrill.tpl'} {/if} -{/if} - - -{if $product_sub_cat != ""} -
    -{foreach from=$product_sub_cat item=record} - - - - -
    - - - - - - - -
    - - - - -
    - - {if $list->translate("product_cat_translate","name,description","product_cat_id", $record.id, "cat_translate") } - {$cat_translate.name} - {else} - {$record.name} - {/if} -
    -
    - - - - -
    -

    - {if $record.thumbnail != "" } - - {/if} - {if $cat_translate.description!= "" } - {$cat_translate.description} - {else} - {translate module=product_cat} - desc_none - {/translate} - {/if} -

    -
    -
    -
    -
    -{/foreach} +{if $product_sub_cat != ''} +
    + {include file='file:pre_t_SubCategories.tpl'} {/if} -
    - - -{ if $product_arr } -{foreach from=$product_arr item=product} - - - - -
    - - - - - - - -
    - - - - - -
    -

    - - {if $list->translate("product_translate","name,description_short,description_full","product_id", $product.id, "prod_translate") } - {$prod_translate.name} - {else} - {$product.sku} - {/if} -

    -
    - {$list->format_currency_num($product.price_base,$smarty.const.SESS_CURRENCY)} -
    -
    - - - - {if $product.thumbnail != ""} - - {/if} - - - -
    -

    - -

    -
    -

    - {if $product.thumbnail != "" } - - {/if} - {if $prod_translate.description_short != "" } - {$prod_translate.description_short} - {else} - {translate module=product_cat} - desc_none - {/translate} - {/if} -

    -
    -
    -
    -
    -{/foreach} - -{if $page_pages > 1} -{translate module=product_cat} -pages -{/translate} -{foreach from=$page_arr item=page} - -{if $page == $page_page} - -{$page} - +{if $product_arr} + {foreach from=$product_arr item=product} + + + + +
    + + + + + + + +
    + + + + + +
    + + {if $list->translate('product_translate','name,description_short,description_full','product_id',$product.id,'prod_translate')} + {$prod_translate.name} + {else} + {$product.sku} + {/if} + + {$list->format_currency_num($product.price_base,$smarty.const.SESS_CURRENCY)}
    +
    + + + {if $product.thumbnail != ''} + + {/if} + + +
    + + + {if $prod_translate.description_short != ''} + {$prod_translate.description_short} + {else} + {t}No Description{/t} + {/if} +
    +
    +
    +
    + {/foreach} + + + {include file='file:post_t_Pages.tpl'} {else} -{$page} -{/if} -
    -{if $page != $page_pages} -| -{/if} -{/foreach} -{/if} -{else} -{translate module=product_cat} -products_none -{/translate} + {t}No Products in this Category{/t} {/if} diff --git a/themes/default/blocks/product_cat/t_Wizard.tpl b/themes/default/blocks/product_cat/t_Wizard.tpl index ab87da37..dc4dbfa0 100644 --- a/themes/default/blocks/product_cat/t_Wizard.tpl +++ b/themes/default/blocks/product_cat/t_Wizard.tpl @@ -1,144 +1,65 @@ -{if $VAR.id == ""} {$block->display("product:cat")} {else} -{$method->exe_noauth("product_cat", "user_view")} +{if $VAR.id == ''} + {$block->display('product_cat:user_menu')} +{else} + {$method->exe_noauth('product_cat','user_view')} - -{ if $product_cat_arr } -{foreach from=$product_cat_arr item=record} - - - - -
    - - - - -
    - - - - -
    {translate module=product_cat}menu{/translate} - {foreach from=$parent_cat item=cat} - > - {$cat.name} - - {/foreach} -
    -
    -
    -{/foreach} + + {include file='file:pre_t_CategoryDrill.tpl'} {/if} -{/if} - - -{if $product_sub_cat != ""} -
    -{foreach from=$product_sub_cat item=record} - - - - -
    - - - - - - - -
    - - - - -
    - - {if $list->translate("product_cat_translate","name,description","product_cat_id", $record.id, "cat_translate") } - {$cat_translate.name} - {else} - {$record.name} - {/if} -
    -
    - - - - -
    -

    - {if $record.thumbnail != "" } - - {/if} - {if $cat_translate.description!= "" } - {$cat_translate.description} - {else} - {translate module=product_cat} - desc_none - {/translate} - {/if} -

    -
    -
    -
    -{/foreach} +{if $product_sub_cat != ''} +
    + {include file='file:pre_t_SubCategories.tpl'} {/if} -
    - - -{ if $product_arr } - - - - -
    - - - - - - - -
    - - - -
    - {translate module=product_cat} - plans_select - {/translate} -
    -
    - - - - -
    -
    - - - -
    -
    -
    -
    -
    +{if $product_arr} + + + + +
    + + + + + + + +
    + + + + +
    {t}Select A Plan{/t}
    +
    + + + + +
    +
    + + + +
    +
    +
    +
    +
    {else} -{translate module=product_cat}plans_none{/translate} + {t}No Plans{/t} {/if} diff --git a/themes/default/blocks/product/cat.tpl b/themes/default/blocks/product_cat/user_menu.tpl similarity index 100% rename from themes/default/blocks/product/cat.tpl rename to themes/default/blocks/product_cat/user_menu.tpl diff --git a/themes/default/blocks/product_cat/view.tpl b/themes/default/blocks/product_cat/view.tpl index 15d59690..a256d29a 100644 --- a/themes/default/blocks/product_cat/view.tpl +++ b/themes/default/blocks/product_cat/view.tpl @@ -1,288 +1,132 @@ -{literal} -{/literal} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} -{ $method->exe("product_cat","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} + +
    -{literal} - - + + + + + -{/literal} - - -{foreach from=$product_cat item=product_cat} - - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - - - - - - - -
    - - - - - - - - - - -
    -
    - {translate module=product_cat} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=product_cat} - field_name - {/translate} - - -
    - {translate module=product_cat} - field_notes - {/translate} - - -
    - {translate module=product_cat} - field_parent_id - {/translate} - {$method->exe_noauth("product_cat", "admin_menu_parent")}
    - {translate module=product_cat} - field_group_avail - {/translate} - - { $list->menu_multi($product_cat.group_avail, 'product_cat_group_avail', 'group', 'name', '', '10', 'form_menu') } -
    - {translate module=product_cat} - field_status - {/translate} - - { $list->bool("product_cat_status", $product_cat.status, "form_menu") } -
    - {translate module=product_cat} - field_template - {/translate} - - { $list->menu_files("", "product_cat_template", $product_cat.template, "product_cat", "t_", ".tpl", "form_menu") } -
    - {translate module=product_cat} - field_position - {/translate} - - -
    - {translate module=product_cat} - field_max - {/translate} - - -
    - {translate module=product_cat} - field_thumbnail - {/translate} - - - - {if $product_cat.thumbnail != ""} -
    -
    - - {/if} -
    - {translate module=product_cat} - field_image - {/translate} - - - - {if $product_cat.image != ""} -
    -
    - - {/if} -
    - - - - - - - -
      - -
    -
    -
    - - - - - -
    - {translate module=product_cat} - title_view_translations - {/translate} - - {translate module=product_cat} - title_add_translation - {/translate} -
    -
    -
    - - - - - - -
    -
    - -
    - -{/foreach} - -{literal} - -{/literal} - - + function addCatTranslations(id) { + showIFrame('iframe',getPageWidth(650),350,'?_page=product_cat_translate:add&product_cat_translate_product_cat_id='+id); + } + showCatTranslations(CatId); + {/literal} + //--> + {/if} diff --git a/themes/default/blocks/product_cat_translate/add.tpl b/themes/default/blocks/product_cat_translate/add.tpl index 35db49b2..9ed3ac6b 100644 --- a/themes/default/blocks/product_cat_translate/add.tpl +++ b/themes/default/blocks/product_cat_translate/add.tpl @@ -27,9 +27,9 @@ {/if} -
    + - +
    diff --git a/themes/default/blocks/product_cat_translate/view.tpl b/themes/default/blocks/product_cat_translate/view.tpl index 2edb8776..85c05eb5 100644 --- a/themes/default/blocks/product_cat_translate/view.tpl +++ b/themes/default/blocks/product_cat_translate/view.tpl @@ -1,6 +1,16 @@ -{literal} - - + -{/literal} + }); + + {/literal} + -{ $method->exe("product_cat_translate","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} -{literal} - - -{/literal} + + - -{foreach from=$product_cat_translate item=product_cat_translate} +
    + + + +
    + + + + + + + + {include file='file:../core/view_tr_submit_delete.tpl'} +
    {osb f=tt}
    + + + + + + + + + + + + + +
    {osb f=tf field=product_cat_id}{$list->menu('','product_cat_translate_product_cat_id','product_cat','name',$record.product_cat_id,'form_menu')}
    {osb f=tf field=language_id}{$list->menu_files('','product_cat_translate_language_id',$record.language_id,'language','','_core.xml','form_menu')}
    {osb f=tf field=name}
    + + + + + + + +
    {osb f=tf field=description}
    +
    +
    - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - - - - - - - -
    - - - - - - - -
    -
    - {translate module=product_cat_translate}title_view{/translate} -
    -
    - - - - - - - - - - - - - -
    - {translate module=product_cat_translate} - field_product_cat_id - {/translate} - - { $list->menu("", "product_cat_translate_product_cat_id", "product_cat", "name", $product_cat_translate.product_cat_id, "form_menu") } -
    - {translate module=product_cat_translate} - field_language_id - {/translate} - - { $list->menu_files("", "product_cat_translate_language_id", $product_cat_translate.language_id, "language", "", "_core.xml", "form_menu") } -
    - {translate module=product_cat_translate} - field_name - {/translate} - - -
    - - - - - - - -
    - {translate module=product_cat_translate} - field_description - {/translate} -
    - -
    - - - - - -
    - - - -
    - -
    -
    - - - - - - {/foreach} + {include file='file:../core/view_post.tpl'} + {/if} diff --git a/themes/default/blocks/product_img/add.tpl b/themes/default/blocks/product_img/add.tpl index 24c93c82..13233d68 100644 --- a/themes/default/blocks/product_img/add.tpl +++ b/themes/default/blocks/product_img/add.tpl @@ -6,9 +6,9 @@ {/if} -
    + - +
    diff --git a/themes/default/blocks/product_img/search_show.tpl b/themes/default/blocks/product_img/search_show.tpl index 23df7a4c..3b9911d3 100644 --- a/themes/default/blocks/product_img/search_show.tpl +++ b/themes/default/blocks/product_img/search_show.tpl @@ -84,7 +84,7 @@
    -

    +

    {translate module=product_img} title_add {/translate} diff --git a/themes/default/blocks/product_img/view.tpl b/themes/default/blocks/product_img/view.tpl index af0cb6e9..ed50a895 100644 --- a/themes/default/blocks/product_img/view.tpl +++ b/themes/default/blocks/product_img/view.tpl @@ -1,62 +1,55 @@ -{ $block->display("core:top_clean") } +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("product_img","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} - +{$block->display('core:top_clean')} - -{foreach from=$product_img item=product_img} -
    - -{if $form_validation} -{ $block->display("core:alert_fields") } -{/if} - - - - - - - -
    - - - - -
    - - - - -
    - - - - - -
    - {translate module=product_img} - title_add - {/translate} - - {translate module=product_img} - title_delete - {/translate} -
    -
    -
    -
    - -

    - {if $product_img.type == "0" } - - {else} - - {/if} - - - - -
    - - {/foreach} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} + + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} + + +
    + + + + + +
    + + + + +
    + + + + +
    + + + + + +
    {translate module=product_img}title_add{/translate}{translate module=product_img}title_delete{/translate}
    +
    +
    +
    + +

    + {if $record.type == '0'} + + {else} + + {/if} +
    + + {include file='file:../core/view_post.tpl'} +
    {/if} diff --git a/themes/default/blocks/product_plugin/plugin_prod_TICKET_INCIDENT.tpl b/themes/default/blocks/product_plugin/plugin_prod_TICKET_INCIDENT.tpl deleted file mode 100644 index d7912360..00000000 --- a/themes/default/blocks/product_plugin/plugin_prod_TICKET_INCIDENT.tpl +++ /dev/null @@ -1,25 +0,0 @@ -{$list->unserial($product.prod_plugin_data, "plugin_data")} - - - - - - - - - - - - - - - -
    Text for ticket
    Department to Create Ticket In {html_menu name=product_prod_plugin_data[department_id] assoc_table="ticket_department" assoc_field="name" size=5 default=$plugin_data.department_id}
    Extra E-mails to Notify (comma separated)
    diff --git a/themes/default/blocks/product_translate/add.tpl b/themes/default/blocks/product_translate/add.tpl index 25e1ce8f..5d42afe4 100644 --- a/themes/default/blocks/product_translate/add.tpl +++ b/themes/default/blocks/product_translate/add.tpl @@ -6,9 +6,9 @@ {/if} -
    + - +
    diff --git a/themes/default/blocks/product_translate/view.tpl b/themes/default/blocks/product_translate/view.tpl index 5fff541c..88c4cc51 100644 --- a/themes/default/blocks/product_translate/view.tpl +++ b/themes/default/blocks/product_translate/view.tpl @@ -24,19 +24,19 @@ function viewTranslations(product_id) } {/literal} - -{foreach from=$product_translate item=product_translate} + + - - - -
    - - - -
    - - - - -
    - +
    + + - -
    + + + + + + - -
     
    +
    { $list->menu_files("1", "language_id", $smarty.const.DEFAULT_LANGUAGE, "language", "", "_core.xml", "\" onChange=\"viewTranslations(`$product_translate.product_id`);") } @@ -131,6 +131,4 @@ function viewTranslations(product_id)
    - -{/foreach} {/if} diff --git a/themes/default/blocks/service/add.tpl b/themes/default/blocks/service/add.tpl index a52c3142..ad7b9eb2 100644 --- a/themes/default/blocks/service/add.tpl +++ b/themes/default/blocks/service/add.tpl @@ -1,759 +1,500 @@ +{assign var=meth value=':'|explode:$VAR._page} + + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} - -{$method->exe("service","add_tpl")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{$method->exe($meth.0,'tpl_add')} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} -{literal} - -{/literal} -
    - - - - -
    - - - - - - - -
    -
    - - - {translate module=service} - title_add - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=service} - field_account_id - {/translate} -
    - {html_select_account name="service_account_id" default=$VAR.service_account_id} -
    - {translate module=service} - field_product_id - {/translate} -
    - - Select - Product
    - {translate module=service} - field_sku - {/translate} -
    - {if $product.sku != ""} - - {else} - - {/if} - Clear & Configure Manually -
    - {translate module=service} - field_type - {/translate} -
    - - None - - Group Access - - Product Plugin - - Hosting - - -
    - {translate module=service} - field_price_type - {/translate} -
    -
    - - {translate module=product} - price_type_one - {/translate} - - {translate module=product} - price_type_recurr - {/translate} -
    -
    - {translate} - submit - {/translate} - - - - - - - - - - - - - - - -
    -
    -
    -
    - -
    - - - - -
    - - - - - - - -
    -
    - {translate module=service} - title_recurring - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=product} - field_price_base - {/translate} - - - {$list->currency_iso("")} -
    - {translate module=service} - field_date_last_invoice - {/translate} - - { $list->calender_view("date_last_invoice", 0, "form_field", $service.id) } -
    - {translate module=product} - field_price_recurr_default - {/translate} - - -
    - {translate module=product} - field_taxable - {/translate} - - { $list->bool("product_taxable", $product.taxable, "form_menu") } -
    - {translate module=product} - field_price_recurr_type - {/translate} - - {translate module=product} - user_options - {/translate} -
    - - {translate module=product} - recurr_type_aniv - {/translate} -
    - - {translate module=product} - recurr_type_fixed - {/translate} -
    -
    - {translate module=product} - field_price_recurr_weekday - {/translate} - - (1-28) -
    - -
    - { $list->bool("product_price_recurr_schedule", $product.price_recurr_schedule, "form_menu") } - {translate module=product} - field_price_recurr_schedule - {/translate} -
    - { $list->bool("product_price_recurr_cancel", $product.price_recurr_cancel, "form_menu") } - {translate module=product} - field_price_recurr_cancel - {/translate} -
    - { $list->bool("product_price_recurr_modify", $product.price_recurr_modify, "form_menu") } - {translate module=product} - field_price_recurr_modify - {/translate} -
    - {translate module=service} - field_account_billing_id - {/translate} - - { $list->menu_cc_admin("account_billing_id", $VAR.service_account_id, $VAR.ccnum, "form_menu") } -
    -
    -
    -
    -
    - -
    - - - - -
    - - - - - - - -
    -
    - {translate module=service} - title_group - {/translate} -
    -
    - - - - - -
    - - - - -
    -

    - - {translate module=product} - assoc_group_limited - {/translate} - -
    - - {translate module=product} - assoc_group_subscription - {/translate} -
    - - {translate module=product} - assoc_group_forever - {/translate} -

    -
    -
    - { $list->menu_multi($product.assoc_grant_group, "product_assoc_grant_group", "group", "name", "10", "", "form_menu") } -
    -
    -
    -
    -
    - - -
    - {if $list->is_installed('host_server')} - - - - -
    - - - - - - - - { if ($list->smarty_array("host_server","provision_plugin", "", "plugin")) } - {foreach from=$plugin item=arr} - {if $product.host_server_id == $arr.id} - - - - - {/if} - {/foreach} - {/if} -
    -
    - {translate module=service} - title_hosting - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=product} - field_host_server_id - {/translate} - - { $list->menu("no", "product_host_server_id", "host_server", "name", $product.host_server_id, "\" onchange=\"submit();") } - Configure -
    - {translate module=service} - field_domain_name - {/translate} - - - . - -
    - {translate module=service} - field_host_ip - {/translate} - - -
    - {translate module=service} - field_host_username - {/translate} - - -
    - {translate module=service} - field_host_password - {/translate} - - -
    -
    - {assign var="afile" value=$arr.provision_plugin} - {assign var="ablock" value="host_provision_plugin:plugin_prod_"} - {assign var="blockfile" value="$ablock$afile"} - { $block->display($blockfile) } - -
    -
    -
    - {/if} -
    - - - - - -
    - - - +
    - - - - - - - - { if $product.prod_plugin_file != ""} - - - -
    -
    - {translate module=service} - title_product - {/translate} -
    -
    - - - - - -
    Plugin to Enable - { $list->menu_files("", "product_prod_plugin_file", $product.prod_plugin_file, "product", "", ".php", "\" onchange=\"document.product_view.submit();") } - Configure -
    -
    - {assign var="afile" value=$product.prod_plugin_file} - {assign var="ablock" value="product_plugin:plugin_prod_"} - {assign var="blockfile" value="$ablock$afile"} - { $block->display($blockfile) } + } else if (type == 'product') { + if(document.getElementById(service_type).checked == true) { + unhideServiceType(type); + hideServiceType('none'); + hideServiceType('hosting'); + hideServiceType('domain'); + document.getElementById('vproduct').value='1'; + } else { + if(document.getElementById('service_group').checked == true) { + unhideServiceType('hosting'); + } else { + unhideServiceType('none'); + unhideServiceType('group'); + unhideServiceType('hosting'); + unhideServiceType('domain'); + } + document.getElementById('vproduct').value='0'; + } + } else if (type == 'hosting') { + if(document.getElementById(service_type).checked == true) { + unhideServiceType(type); + hideServiceType('none'); + hideServiceType('product'); + hideServiceType('domain'); + document.getElementById('vhosting').value='1'; + } else { + if(document.getElementById('service_group').checked == true) { + unhideServiceType('product'); + } else { + unhideServiceType('none'); + unhideServiceType('group'); + unhideServiceType('product'); + unhideServiceType('domain'); + } + document.getElementById('vhosting').value='0'; + } + } else if (type == 'domain') { + if(document.getElementById(service_type).checked == true) { + unhideServiceType(type); + hideServiceType('group'); + hideServiceType('product'); + hideServiceType('hosting'); + hideServiceType('none'); + document.getElementById('billing_type').style.color='999999'; + document.getElementById('billing_type0').checked=true; + document.getElementById('billing_type0').disabled=true; + document.getElementById('billing_type1').checked=false; + document.getElementById('billing_type1').disabled=true; + document.getElementById('vdomain').value='0'; + } else { + unhideServiceType('group'); + unhideServiceType('product'); + unhideServiceType('hosting'); + unhideServiceType('none'); + document.getElementById('billing_type').style.color='000000'; + document.getElementById('billing_type0').disabled=false; + document.getElementById('billing_type1').disabled=false; + document.getElementById('vdomain').value='0'; + } + } + updateTR(); + } + + function clearall() { + document.getElementById('do').value='service:tpl_add'; + document.getElementById('clearall').value='1'; + document.getElementById('vgroup').value='0'; + document.getElementById('vproduct').value='0'; + document.getElementById('vhosting').value='0'; + document.getElementById('vdomain').value='0'; + document.forms.service_add.submit(); + } + + function domainUpdate(domain,tld,type) { + document.forms.service_add.domain_name.value = domain; + document.forms.service_add.domain_tld.value = tld; + document.forms.service_add.domain_option.value = type; + } + {/literal} + //--> + + + + + + + + - - {/if} -
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=account_id}
    {osb f=autoselect module=account return=id field=service_account_id default=$VAR.service_account_id}
    {osb f=tf field=product_id}
    + + Select Product +
    {osb f=tf field=sku}
    + {if $product.sku != ''} + + {else} + + {/if} + Clear & Configure Manually +
    {osb f=tf field=type}
    + None + Group Access + Product Plugin + Hosting + Domain +
    {osb f=tf field=price_type}
    +
    + {t}One-time Charge{/t} + {t}Recurring Membership/Subscription{/t} +
    +
    + {t}Submit{/t} + + + + + + + + + + + + + + +
    +
    -
    -
    - - - -
    - {if $list->is_installed('host_tld')} - - - - -
    - - - - - - - -
    -
    - {translate module=service} - title_domain - {/translate} -
    -
    - - - - -
    -

    - - {translate module=product} - domain_register - {/translate} -
    - - {translate module=product} - domain_transfer - {/translate} - {/if} -
    - - {translate module=product} - domain_ns_transfer - {/translate} - {if $product.host_allow_host_only} -

    -
    -
    -
    - {/if} -
    -
    -
    +
    - - +
    +
    + + + + +
    + + + + + + + +
    {t}Recurring Details{/t}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=price_base}{$list->currency_iso('')}
    {osb f=tf field=date_last_invoice}{$list->calender_view('date_last_invoice',0,'form_field')}
    {osb f=tf field=price_recurr_default}{$list->menu_staticlist('recur_schedule','product_price_recurr_default','product_price_recurr_default',$product.price_recurr_default,'form_menu',true)}
    {osb f=tf field=taxable}{$list->bool('product_taxable',$product.taxable,'form_menu')}
    {osb f=tf field=price_recurr_type}{translate module=product}user_options{/translate}
    + {t}Bill on Aniversary Date of Subscription{/t}
    + {t}Bill on Fixed Schedule{/t}
    + +
    + {$list->bool('product_price_recurr_schedule',$product.price_recurr_schedule,'form_menu')} {osb f=tf field=price_recurr_schedule}
    + {$list->bool('product_price_recurr_cancel',$product.price_recurr_cancel,'form_menu')} {osb f=tf field=price_recurr_cancel}
    + {$list->bool('product_price_recurr_modify',$product.price_recurr_modify,'form_menu')} {osb f=tf field=price_recurr_modify} +
    {osb f=tf field=account_billing_id}{$list->menu_cc_admin('account_billing_id',$VAR.service_account_id,$VAR.ccnum,'form_menu')}
    +
    +
    +
    - -{/if} - \ No newline at end of file +
    +
    + + + + +
    + + + + + + + +
    {t}Group Details{/t}
    + + + + + +
    + {t}Grant access for specified amount of days:{/t}
    + {t}Grant access while associated subscription is active{/t}
    + {t}Grant access forerver{/t} +
    {$list->menu_multi($product.assoc_grant_group,'product_assoc_grant_group','group','name','10','','form_menu')}
    +
    +
    +
    + +
    + {if $list->is_installed('host_server')} + + + + +
    + + + + + + + + {if ($list->smarty_array('host_server','provision_plugin','','plugin'))} + {foreach from=$plugin item=arr} + {if $product.host_server_id == $arr.id} + + + + {/if} + {/foreach} + {/if} +
    {t}Hosting Details{/t}
    + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=host_server_id}{$list->menu('no','product_host_server_id','host_server','name',$product.host_server_id,'" onchange="submit();')}Configure
    {osb f=tf field=domain_name}.{$list->menu('no','host_domain_tld','host_tld','name',$VAR.host_domain_tld,'form_menu',true)}
    {osb f=tf field=host_ip}
    {osb f=tf field=host_username}
    {osb f=tf field=host_password}
    +
    + {assign var="afile" value=$arr.provision_plugin} + {assign var="ablock" value='host_provision_plugin:plugin_prod_'} + {assign var="blockfile" value="$ablock$afile"} + {$block->display($blockfile)} + +
    +
    + {/if} +
    + +
    + + + + +
    + + + + + + + + {if $product.prod_plugin_file != ''} + + + + {/if} +
    {t}Product Plugin{/t}
    + + + + + +
    {t}Plugin to Enable{/t}{$list->menu_files('','product_prod_plugin_file',$product.prod_plugin_file,'product','','.php','" onchange="document.product_view.submit();')} Configure +
    +
    + {assign var="afile" value=$product.prod_plugin_file} + {assign var="ablock" value='product_plugin:plugin_prod_'} + {assign var="blockfile" value="$ablock$afile"} + {$block->display($blockfile)} +
    +
    +
    + +
    + + + + +
    + + + + + + + +
    {t}Domain Details{/t}
    + + + + +
    + {if $list->is_installed('host_tld')} + {t}Register new domain name{/t}
    + {t}Transfer existing domain name{/t}
    + {/if} + {t}I will use an existing domain name and update my nameservers only.{/t} +
    +
    +
    +
    + + + + + + +{/if} + diff --git a/themes/default/blocks/service/modify.tpl b/themes/default/blocks/service/modify.tpl index d3600d9b..5af78689 100644 --- a/themes/default/blocks/service/modify.tpl +++ b/themes/default/blocks/service/modify.tpl @@ -1,413 +1,232 @@ -{if $SESS_LOGGED == 1} -{$method->exe("service", "modify")} +{assign var=meth value=':'|explode:$VAR._page} + + +{$method->exe($meth.0,$meth.1)} -{ if $VAR.id == "" } - - - - -
    - - - - - - - -
    - - - -
    - {translate module=service} - modify_select - {/translate} -
    -
    - - - - -
    -
    - - - - - -
    -
    -
    -
    -{else} -{if $product_show} -{ $method->exe("product","details") } -{ if ($method->result == FALSE || !$product) } -{ $block->display("core:method_error") } -{else} -{if $product} -
    - - - - - - - - {if $list->translate("product_translate","name,description_full", "product_id", $product.id, "translate_product")} - {/if} - - - - -
    - - - - - - - -
    - - - - -
    - {if $list->translate("product_translate","name,description_short,description_full","product_id", $product.id, "prod_translate") } - {$prod_translate.name} - {else} - {$product.sku} - {/if} -
    -
    - - - - -
    - - - - - - - -
    - - - - -
    - {if $product.thumbnail != ""} - - {/if} - {$translate_product.description_full} -
    -
    - {if $product.price_type == "1" } - - - - - - - -
    - {translate module=product} - field_price_recurr_type - {/translate} -
    - -
    - {/if} - {if $attr} -
    - {foreach from=$attr item=attr_arr key=key} - {assign var=attr_id value=$attr_arr.id} - {if $attr_arr.type == "0"} - - - - - {if $attr_arr.description} - - - - {/if} -
    - - - - - -
    - {$attr_arr.name} - - {if $attr_arr.price_base != 0} - {$list->format_currency_num($attr_arr.price_base, $smarty.const.SESS_CURRENCY)} - {/if} - {if $attr_arr.price_setup != 0} - {if $attr_arr.price_base != 0} - + - {/if} - {$list->format_currency_num($attr_arr.price_setup, $smarty.const.SESS_CURRENCY)} - {translate module=product} - setup - {/translate} - {/if} -
    -
    - -   - {$attr_arr.description} -
    - {elseif $attr_arr.type == "1"} - - - - - {if $attr_arr.description} - - - - {/if} -
    - - - - - -
    - {$attr_arr.name} - - {if $attr_arr.price_base != 0} - {$list->format_currency_num($attr_arr.price_base, $smarty.const.SESS_CURRENCY)} - {/if} - {if $attr_arr.price_setup != 0} - {if $attr_arr.price_base != 0} - + - {/if} - {$list->format_currency_num($attr_arr.price_setup, $smarty.const.SESS_CURRENCY)} - {translate module=product} - setup - {/translate} - {/if} -
    -
    - -   - {$attr_arr.description} -
    - {elseif $attr_arr.type == "3"} - - - - - {if $attr_arr.description} - - - - {/if} -
    - - - - - -
    - {$attr_arr.name} - - {if $attr_arr.price_base != 0} - {$list->format_currency_num($attr_arr.price_base, $smarty.const.SESS_CURRENCY)} - {/if} - {if $attr_arr.price_setup != 0} - {if $attr_arr.price_base != 0} - + - {/if} - {$list->format_currency_num($attr_arr.price_setup, $smarty.const.SESS_CURRENCY)} - {translate module=product} - setup - {/translate} - {/if} -
    -
    - -   - {$attr_arr.description} -
    - {elseif $attr_arr.type == "2"} - - - - - {if $attr_arr.description} - - - - {/if} -
    - - - - - -
    - {$attr_arr.name} - -
    -
    - -   - {$attr_arr.description} -
    - {/if} - {/foreach} - {/if} - {literal} - - - {/literal} - {/if} -
    -
    -
    -
    -
    -

    - -

    -{/if} -{/if} -{/if} -{else} -{$block->display("account:login")} -{/if} +
    + + {if $VAR.id == ''} + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + +
    + + + + + +
    +
    +
    + {else} + {if $product_show} + {$method->exe('product','details')} + {if ($method->result == false || ! $product)} + {$block->display('core:method_error')} + {else} + {if $product} + + + + +
    + + + + + + + +
    + + + + +
    + {if $list->translate('product_translate','name,description_short,description_full','product_id',$product.id,'prod_translate')} + {$prod_translate.name} + {else} + {$product.sku} + {/if} +
    +
    + + + + + + + +
    + {if $product.thumbnail != ''} + + {/if} + {$prod_translate.description_full} +
    + {if $product.price_type == '1'} + + + + + + + +
    {osb f=tf module=product field=price_recurr_type}
    + +
    + {/if} + {if $attr} +
    + {foreach from=$attr item=attr_arr key=key} + {assign var=attr_id value=$attr_arr.id} + + + + + {if $attr_arr.description} + + + + {/if} +
    + + + + + +
    {$attr_arr.name} + {if $attr_arr.type == '0' || $attr_arr.type == '1' || $attr_arr.type == '3'} + {if $attr_arr.price_base != 0} + {$list->format_currency_num($attr_arr.price_base, $smarty.const.SESS_CURRENCY)} + {/if} + {if $attr_arr.price_setup != 0} + {if $attr_arr.price_base != 0} + {/if} + {$list->format_currency_num($attr_arr.price_setup, $smarty.const.SESS_CURRENCY)} {t}Setup{/t} + {/if} + {elseif $attr_arr.type == '2'} +   + {/if} +
    +
    + {if $attr_arr.type == '0'} +   {$attr_arr.description} + {elseif $attr_arr.type == '1'} +  {$attr_arr.description} + {elseif $attr_arr.type == '2'} + + {elseif $attr_arr.type == '3'} +  {$attr_arr.description} + {/if} +
    + {/foreach} + {/if} + + {/if} +
    +
    +
    + +

    + + + + + + + + +

    + {/if} + {/if} + {/if} +
    diff --git a/themes/default/blocks/service/none.tpl b/themes/default/blocks/service/none.tpl index 4a3ad4b7..19a35887 100644 --- a/themes/default/blocks/service/none.tpl +++ b/themes/default/blocks/service/none.tpl @@ -1,2 +1,3 @@ -{ $block->display("core:top_clean") }
    +{$block->display('core:top_clean')} +
    {translate module=service}none{/translate}
    diff --git a/themes/default/blocks/service/search_form.tpl b/themes/default/blocks/service/search_form.tpl index 480a9809..5411b96f 100644 --- a/themes/default/blocks/service/search_form.tpl +++ b/themes/default/blocks/service/search_form.tpl @@ -1,454 +1,137 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("service","search_form") } -{ if ($method->result == FALSE) } - { $block->display("core:method_error") } +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=service}title_search{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=service} - field_id - {/translate} - - -    - {translate} - search_partial - {/translate} -
    - {translate module=service} - field_invoice_id - {/translate} - - -    - {translate} - search_partial - {/translate} -
    - {translate module=service} - field_sku - {/translate} - - -    - {translate} - search_partial - {/translate} -
    - {translate module=service} - field_account_id - {/translate} - - {html_select_account name="service_account_id" default=$VAR.service_account_id} -
    - {translate module=service} - field_active - {/translate} - - { $list->bool("service_active", "all", "form_menu") } -
    - {translate module=service} - field_type - {/translate} - - -
    - {translate module=service} - field_queue - {/translate} - - -   
    - {translate module=service} - field_recur_type - {/translate} - - -
    - {translate module=service} - field_recur_schedule - {/translate} - - -
    - {translate module=service} - field_date_orig - {/translate} - - { $list->calender_search("service_date_orig", $VAR.service_date_orig, "form_field", "") } -
    - {translate module=service} - field_date_last_invoice - {/translate} - - { $list->calender_search("service_date_last_invoice", $VAR.service_date_last_invoice, "form_field", "") } -
    - {translate module=service} - field_date_next_invoice - {/translate} - - { $list->calender_search("service_date_next_invoice", $VAR.service_date_next_invoice, "form_field", "") } -
    - {translate} - search_results_per - {/translate} - - -
    - {translate} - search_order_by - {/translate} - - -
    - - - - - -
    -
    -
    - - - {if $list->is_installed('host_server') } -
    - - - - -
    - - - - - - - -
    -
    - {translate module=service} - title_hosting - {/translate} - + - {translate module=service} - title_domain - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=service} - field_host_server_id - {/translate} - - { $list->menu("no", "service_host_server_id", "host_server", "name", "all", "form_menu") } -
    - {translate module=service} - field_host_ip - {/translate} - - -    - {translate} - search_partial - {/translate} -
    - {translate module=service} - field_host_username - {/translate} - - -    - {translate} - search_partial - {/translate} -
    - {translate module=service} - field_domain_name - {/translate} - - - . - { $list->menu("no", "service_domain_host_tld_id", "host_tld", "name", "all", "form_menu") } -
    - {translate module=service} - field_domain_type - {/translate} - - -
    - {translate module=service} - field_domain_host_registrar_id - {/translate} - - { $list->menu("", "service_domain_host_registrar_id", "host_registrar_plugin", "name", "all", "form_menu") } -
    - {translate module=service} - field_domain_date_expire - {/translate} - - { $list->calender_search("service_domain_date_expire", $VAR.service_domain_date_expire, "form_field", "") } -
    - -
    -
    -
    - {/if} - - -
    -{ $block->display("core:saved_searches") } -{ $block->display("core:recent_searches") } +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/search_post.tpl'} +
    {osb f=tf field=id}  {t}"%" for partial match{/t}
    {osb f=tf field=invoice_id}  {t}"%" for partial match{/t}
    {osb f=tf field=sku}  {t}"%" for partial match{/t}
    {osb f=tf field=account_id}{osb f=autoselect module=account return=id field=service_account_id default=$VAR.service_account_id}
    {osb f=tf field=active}{$list->bool('service_active','all','form_field')}
    {osb f=tf field=type}{$list->menu_staticlist('servicetype','service_type','service_type','','form_menu',true)}
    {osb f=tf field=queue}{$list->menu_staticlist('servicequeue','select','select','','form_menu',true)}
    {osb f=tf field=recur_type}{$list->menu_staticlist('recur_type','service_recur_type','service_recur_type','','form_menu',true)}
    {osb f=tf field=recur_schedule}{$list->menu_staticlist('recur_schedule','service_recur_schedule','service_recur_schedule','','form_menu',true)}
    {osb f=tf field=date_orig}{$list->calender_search('service_date_orig',$VAR.service_date_orig,'form_field','')}
    {osb f=tf field=date_last_invoice}{$list->calender_search('service_date_last_invoice',$VAR.service_date_last_invoice,'form_field','')}
    {osb f=tf field=date_next_invoice}{$list->calender_search('service_date_next_invoice',$VAR.service_date_next_invoice,'form_field','')}
    +
    +
    + + {if $list->is_installed('host_server')} +

    + + + + + +
    + + + + + + + +
    {t}Hosting Details{/t} + {t}Domain Details{/t}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/search_post.tpl'} +
    {osb f=tf field=host_server_id}{$list->menu('no','service_host_server_id','host_server','name','','form_menu',true)}
    {osb f=tf field=host_ip}  {t}"%" for partial match{/t}
    {osb f=tf field=host_username}  {t}"%" for partial match{/t}
    {osb f=tf field=domain_name} + + . + {$list->menu('no','service_domain_host_tld_id','host_tld','name','','form_menu',true)} +
    {osb f=tf field=domain_type}{$list->menu_staticlist('domaintype','service_domain_type','service_domain_type','','form_menu',true)}
    {osb f=tf field=domain_host_registrar_id}{$list->menu('','service_domain_host_registrar_id','host_registrar_plugin','name','','form_menu',true)}
    {osb f=tf field=domain_date_expire}{$list->calender_search('service_domain_date_expire',$VAR.service_domain_date_expire,'form_field','')}
    +
    +
    + {/if} + +
    + + {$block->display('core:saved_searches')} + {$block->display('core:recent_searches')} {/if} diff --git a/themes/default/blocks/service/search_show.tpl b/themes/default/blocks/service/search_show.tpl index 3f946b4e..dbfaba05 100644 --- a/themes/default/blocks/service/search_show.tpl +++ b/themes/default/blocks/service/search_show.tpl @@ -1,169 +1,51 @@ - -{$method->exe("service","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{assign var=meth value=':'|explode:$VAR._page} + + +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results} -search_result_count -{/translate} -{else} -{translate results=$results} -search_results_count -{/translate} + {include file='file:../core/search_show_pre.tpl'} + + + + + +
    + + {$method->exe_noauth($meth.0,'tpl_search_show')} + {foreach from=$search_show item=record} + {include file='file:../core/search_show_tr_record.tpl'} + + + + + + + {/foreach} +
    {$record.last_name}, {$record.first_name}{$record.sku} >  + {if $record.type == 'domain'} + {$record.domain_name|upper|trim:16}.{$record.domain_tld|upper} + {elseif ($record.type == 'host' || $record.type == 'host_group') && trim($record.server_name)} + {$record.server_name|trim:25} + {else} + {t}{$record.type}{/t} + {/if} + + {if $record.queue != '' && $record.queue!= 'none'} + {t}{$record.queue}{/t} + {else} + {t}None{/t} + {/if} + {$list->format_currency_num($record.price,'')} + {if $record.active == '1'} + + {else} + + {/if} +
    +
    + + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} - - {translate amount=$total_amount module=service} -search_result_amount -{/translate} -
    -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - - {foreach from=$service item=record} - - - - - - - - - {literal} - - {/literal} - {/foreach} - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -  
    - -   - {$record.last_name}, - {$record.first_name} -   - {$record.sku} - > - {if $record.type == 'domain'} - {$record.domain_name|upper|trim:16}.{$record.domain_tld|upper} - {elseif $record.type == 'host' || $record.type == 'host_group'} - {$record.server_name|trim:25} - {else} - {translate module=service} - {$record.type} - {/translate} - {/if} -   - {if $record.queue != "" && $record.queue!= 'none' } - {translate module=service} - {$record.queue} - {/translate} - {else} - {translate module=service} - queue_none - {/translate} - {/if} - -
    - {$list->format_currency_num($record.price,"")} -  
    -
    - {if $record.active == "1"} - - {else} - - {/if} -
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    - - - - -
    - {translate}search_export_image{/translate} - {translate}search_print_image{/translate} - {translate}search_new_image{/translate} - {translate module=service}title_add{/translate} -
    -
    -{/if} -{/if} -
    diff --git a/themes/default/blocks/service/user_modify.tpl b/themes/default/blocks/service/user_modify.tpl index 6060154c..8840bf3f 100644 --- a/themes/default/blocks/service/user_modify.tpl +++ b/themes/default/blocks/service/user_modify.tpl @@ -1,409 +1,235 @@ -{if $SESS_LOGGED == 1} -{$method->exe("service", "user_modify")} +{assign var=meth value=':'|explode:$VAR._page} + - -{ if $VAR.id == "" } - - - - -
    - - - - - - - -
    - - - -
    - {translate module=service} - modify_select - {/translate} -
    -
    - - - - -
    -
    - - - - -
    -
    -
    -
    +{if $SESS_LOGGED != 1} + {$block->display('account:user_login')} {else} -{if $product_show} -{ $method->exe("product","details") } -{ if ($method->result == FALSE || !$product) } -{ $block->display("core:method_error") } -{else} -{if $product} -
    - - - - - - {if $list->translate("product_translate","name,description_full", "product_id", $product.id, "translate_product")} - {/if} - - - - -
    - - - - - - - -
    - - - - - -
    -

    - {if $list->translate("product_translate","name,description_short,description_full","product_id", $product.id, "prod_translate") } - {$prod_translate.name} - {else} - {$product.sku} - {/if} -

    -
    -
    - - - - - - - -
    - - - - -
    - {if $product.thumbnail != ""} - - {/if} - {$translate_product.description_full} -
    -
    - {if $product.price_type == "1" } - - - - - - - -
    - {translate module=product} - field_price_recurr_type - {/translate} -
    - -
    - {/if} - {if $attr} -
    - {foreach from=$attr item=attr_arr key=key} - {assign var=attr_id value=$attr_arr.id} - {if $attr_arr.type == "0"} - - - - - {if $attr_arr.description} - - - - {/if} -
    - - - - - -
    - {$attr_arr.name} - - {if $attr_arr.price_base != 0} - {$list->format_currency_num($attr_arr.price_base, $smarty.const.SESS_CURRENCY)} - {/if} - {if $attr_arr.price_setup != 0} - {if $attr_arr.price_base != 0} - + - {/if} - {$list->format_currency_num($attr_arr.price_setup, $smarty.const.SESS_CURRENCY)} - {translate module=product} - setup - {/translate} - {/if} -
    -
    - -   - {$attr_arr.description} -
    - {elseif $attr_arr.type == "1"} - - - - - {if $attr_arr.description} - - - - {/if} -
    - - - - - -
    - {$attr_arr.name} - - {if $attr_arr.price_base != 0} - {$list->format_currency_num($attr_arr.price_base, $smarty.const.SESS_CURRENCY)} - {/if} - {if $attr_arr.price_setup != 0} - {if $attr_arr.price_base != 0} - + - {/if} - {$list->format_currency_num($attr_arr.price_setup, $smarty.const.SESS_CURRENCY)} - {translate module=product} - setup - {/translate} - {/if} -
    + {$method->exe($meth.0,$meth.1)} + {if ($method->result == false)} + {$block->display('core:method_error')} + {else} -
    - -   - {$attr_arr.description} -
    - {elseif $attr_arr.type == "3"} - - - - - {if $attr_arr.description} - - - - {/if} -
    - - - - - -
    - {$attr_arr.name} - - {if $attr_arr.price_base != 0} - {$list->format_currency_num($attr_arr.price_base, $smarty.const.SESS_CURRENCY)} - {/if} - {if $attr_arr.price_setup != 0} - {if $attr_arr.price_base != 0} - + - {/if} - {$list->format_currency_num($attr_arr.price_setup, $smarty.const.SESS_CURRENCY)} - {translate module=product} - setup - {/translate} - {/if} -
    -
    - -   - {$attr_arr.description} -
    - {elseif $attr_arr.type == "2"} - - - - - {if $attr_arr.description} - - - - {/if} -
    - - - - - -
    - {$attr_arr.name} - - -
    -
    - -   - {$attr_arr.description} -
    - {/if} - {/foreach} - {/if} - {literal} - - - {/literal} + + + + {if $VAR.id == ''} + + + + +
    + + + + + + + + + + +
    {osb f=tt}
     
    + + + + +
    +
    + {else} + {if $product_show} + {$method->exe('product','details')} + {if ($method->result == false || !$product)} + {$block->display('core:method_error')} + {else} + {if $product} + + + + +
    + + + + + + + +
    + + + + +
    + {if $list->translate('product_translate','name,description_short,description_full','product_id',$product.id,'prod_translate')} + {$prod_translate.name} + {else} + {$product.sku} + {/if} +
    +
    + + + + + + + +
    + {if $product.thumbnail != ''} + + {/if} + {$prod_translate.description_full} +
    + {if $product.price_type == '1'} + + + + + + + +
    {osb f=tf module=product field=price_recurr_type}
    + +
    + {/if} + {if $attr} +
    + {foreach from=$attr item=attr_arr key=key} + {assign var=attr_id value=$attr_arr.id} + + + + + {if $attr_arr.description} + + + + {/if} +
    + + + + + +
    {$attr_arr.name} + {if $attr_arr.type == '0' || $attr_arr.type == '1' || $attr_arr.type == '3'} + {if $attr_arr.price_base != 0} + {$list->format_currency_num($attr_arr.price_base, $smarty.const.SESS_CURRENCY)} + {/if} + {if $attr_arr.price_setup != 0} + {if $attr_arr.price_base != 0} + {/if} + {$list->format_currency_num($attr_arr.price_setup, $smarty.const.SESS_CURRENCY)} {t}Setup{/t} + {/if} + {elseif $attr_arr.type == '2'} +   + {/if} +
    +
    + {if $attr_arr.type == '0'} +  {$attr_arr.description} + {elseif $attr_arr.type == '1'} +  {$attr_arr.description} + {elseif $attr_arr.type == '2'} + +  {$attr_arr.description} + {elseif $attr_arr.type == '3'} + {$attr_arr.description} + {/if} +
    + {/foreach} + {/if} + + {/if} +
    +
    +
    + +

    + + + + + + +

    {/if} -
    -
    -
    -
    -
    -

    - -

    -{/if} -{/if} -{/if} -{else} -{$block->display("account:login")} + {/if} + {/if} + + {/if} {/if} diff --git a/themes/default/blocks/service/user_search_show.tpl b/themes/default/blocks/service/user_search_show.tpl index 8bc7cf0a..47f18f04 100644 --- a/themes/default/blocks/service/user_search_show.tpl +++ b/themes/default/blocks/service/user_search_show.tpl @@ -1,131 +1,51 @@ -{$method->exe("service","user_search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{assign var=meth value=':'|explode:$VAR._page} + + +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    + {$method->exe('invoice','has_unpaid')} + {include file='file:../core/user_search_show_pre.tpl'} - {literal} - - - {/literal} + + + + + +
    + + {$method->exe_noauth($meth.0,'tpl_search_show')} + {foreach from=$search_show item=record} + {include file='file:../core/user_search_show_tr_record.tpl'} + + + + + + + {/foreach} +
    {$list->date($record.date_orig)}{$record.sku} ({t}{$record.type}{/t}) + {if $record.queue != '' && $record.queue!= 'none'} + {t}{$record.queue}{/t} + {else} + {t}queue_none{/t} + {/if} + {$list->format_currency($record.price,'')} + {if $record.active == '1'} + Active + {else} + Suspended/Inactive + {/if} +
    +
    - -
    + +
    - -
    - - - - - - -
    - - - - - - - - - - - {foreach from=$service item=record} - - - - - - - - - {literal} - - {/literal} - {/foreach} - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -  
    - -   - {$list->date($record.date_orig)} -   - {$record.sku} - ( - {translate module=service} - {$record.type} - {/translate} - )   - {if $record.queue != "" && $record.queue!= 'none' } - {translate module=service} - {$record.queue} - {/translate} - {else} - {translate module=service} - queue_none - {/translate} - {/if} - -
    - {$list->format_currency($record.price,"")} -  
    -
    - {if $record.active == "1"} - - {else} - - {/if} -
    -
    - {/if} -
    +
    +
    + +
    +{/if} diff --git a/themes/default/blocks/service/user_view.tpl b/themes/default/blocks/service/user_view.tpl index ba2697b7..90618153 100644 --- a/themes/default/blocks/service/user_view.tpl +++ b/themes/default/blocks/service/user_view.tpl @@ -1,620 +1,303 @@ {if $smarty.const.SESS_LOGGED == false} -{$block->display("account:login")} + {$block->display('account:user_login')} {else} -{ $method->exe("service","user_view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} - - -{foreach from=$service item=service} + {assign var=meth value=':'|explode:$VAR._page} + - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} + {if $SESS_LOGGED == '1'} + {$method->exe($meth.0,$meth.1)} + {if ($method->result == false)} + {$block->display('core:method_error')} + {else} + {include file='file:../core/user_view_pre.tpl'} - - - - - -
    - - - - - - - -
    -
    - {translate module=service}title_view{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {if $service.account_billing_id > 0} - - - - - - {/if} - {if $service.prod_plugin_name eq "VOIP"} - - - - - - - - - - - {/if} -
    - {translate module=service} - field_date_orig - {/translate} - - {translate module=service} - field_date_last - {/translate} - - {translate module=service} - field_invoice_id - {/translate} -
    - {$list->date_time($service.date_orig)} - - {$list->date_time($service.date_last)} - - {$service.invoice_id} -
    - {translate module=service} - field_active - {/translate} - - {translate module=service} - field_sku - {/translate} - - {translate module=service} - field_type - {/translate} -
    - {if $service.active == 1} - {translate} - true - {/translate} - {else} - {translate} - false{/translate} - {/if} - - {$service.sku} - - {translate module=service} - {$service.type} - {/translate} -
    - {translate module=service} - field_price - {/translate} - - {translate module=service} - field_price_type - {/translate} - - {translate module=service} - field_taxable - {/translate} -
    - {$list->format_currency_num($service.price, '')} - - {if $service.price_type == "0"} - {translate module=product} - price_type_one - {/translate} - {/if} - {if $service.price_type == "1"} - {translate module=product} - price_type_recurr - {/translate} - {/if} - - {if $service.taxable == 1} - {translate} - true - {/translate} - {else} - {translate} - false - {/translate} - {/if} -
    - {translate module=service} - field_account_billing_id - {/translate} - - {translate} - view - {/translate} -  
    - {translate module=service} - field_service_did - {/translate} -    
    {voip_did service_id=$service.id}   
    -
    -
    - - -{if $service.active == 1 } -{if $service.recur_modify == 1 && $service.suspend_billing != 1}
    - - - - -
    - - - - - - - -
    -
    - {translate module=service} - title_modify - {/translate} -
    -
    - - - - -
    - {translate module=service id=$service.id} - modify_explain - {/translate} -
    -
    -
    -{/if} +
    -{if $service.date_next_invoice > 0 && $service.suspend_billing == 1 } -
    - - - - -
    - - - - - - - -
    -
    - {translate module=service} - title_suspended_billing - {/translate} -
    -
    - - - - -
    - {translate module=service} - suspended_billing_explain - {/translate}{$list->date($service.date_next_invoice)}     - {translate module=service}reactivate{/translate}
    -
    -
    + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {if $record.account_billing_id > 0} + + + + + + {/if} +
    {osb f=tf field=date_orig}{osb f=tf field=date_last}{osb f=tf field=invoice_id}
    {$list->date($record.date_orig)}{$list->date($record.date_last)}{$record.invoice_id}
    {osb f=tf field=active}{osb f=tf field=sku}{osb f=tf field=type}
    {$list->bool('',$record.print_status)}{if $record.product_id}{$record.sku}{else}{$record.sku}{/if}{t}{$record.type}{/t}
    {osb f=tf field=price}{osb f=tf field=price_type}{osb f=tf field=taxable}
    {$list->format_currency_num($record.price,'')}{$list->menu_staticlist('pricetype','','',$record.price_type,'','')}{$list->bool('',$record.taxable)}
    {osb f=tf field=account_billing_id}{t}View{/t} 
    +
    +
    - -{elseif $service.date_next_invoice > 0 && $service.suspend_billing != 1 } -
    - - - - -
    - - - - - - - -
    -
    - {translate module=service} - title_recurring - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - -
    - {translate module=service} - field_date_last_invoice - {/translate} - - {translate module=service} - field_date_next_invoice - {/translate} -
    - {$list->date($service.date_last_invoice)} - - {$list->date($service.date_next_invoice)} -
    - {translate module=service} - field_recur_schedule - {/translate} -
    - {if $recur_price } - + + + +
    + + + + + + + +
    {t}Modify Service{/t}
    + + + + + + + +
    {t}This service can be modified by selecting another product from our offering. This will allow you to effectively upgrade or downgrade your current service.{/t}
    {t}Click here :{/t} {t}Select another product{/t}.
    +
    +
    {/if} - {/foreach} - - {else} - - - {if $service.recur_schedule == "0"} - {translate module=product} - recurr_week - {/translate} - {/if} - - {if $service.recur_schedule == "1"} - {translate module=product} - recurr_month - {/translate} - {/if} - - {if $service.recur_schedule == "2"} - {translate module=product} - recurr_quarter - {/translate} - {/if} - - {if $service.recur_schedule == "3"} - {translate module=product} - recurr_semianual - {/translate} - {/if} - - {if $service.recur_schedule == "4"} - {translate module=product} - recurr_anual - {/translate} - {/if} - - {if $service.recur_schedule == "5"} - {translate module=product} - recurr_twoyear - {/translate} - {/if} - - {if $service.recur_schedule == "6"} - {translate module=product} - recurr_threeyear - {/translate} - {/if} - - {/if} -
    - {if $service.recur_cancel == 1} - - {/if} -
    -
    -
    - {/if} - - {if $service.type == 'group' || $service.type == 'host_group'} -
    - - - - -
    - - - - - - - -
    -
    - {translate module=service} - title_group - {/translate} -
    -
    - - - - - -
    - - - - -
    -

    - - {translate module=product} - assoc_group_limited - {/translate} - -
    - - {translate module=product} - assoc_group_subscription - {/translate} -
    - - {translate module=product} - assoc_group_forever - {/translate} -

    -
    -
    - { $list->menu_multi($service.group_grant, "service_group_grant", "group", "name", "10", "", "form_menu") } -
    -
    -
    - {/if} - - {if $service.type == 'domain' } -
    - - - - -
    - - - - - - - -
    -
    - {translate module=service} - title_domain - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=service} - field_domain_name - {/translate} - - {translate module=service} - field_domain_term - {/translate} - - {translate module=service} - field_domain_date_expire - {/translate} -
    - { $service.domain_name|upper }.{ $service.domain_tld|upper } -   Resend Invoice - - { $service.domain_term } - Year(s) - {translate module=cart} -renew -{/translate} - - { $list->calender_view("service_domain_date_expire", $service.domain_date_expire, "form_field", $service.id) } -
    - {translate module=service} - field_domain_type - {/translate} - - {translate module=service} - field_domain_host_registrar_id - {/translate} - - {translate module=service} - field_domain_host_tld_id - {/translate} -
    - {translate module=cart}{$service.domain_type}{/translate} - - { $list->menu("", "service_domain_host_registrar_id", "host_registrar_plugin", "name", $service.domain_host_registrar_id, "form_menu") } - - { $list->menu("", "service_domain_host_tld_id", "host_tld", "name", $service.domain_host_tld_id, "form_menu") } -
    -
    -
    - {/if} - - {if $service.type == 'host' || $service.type == 'host_group' } -
    - - - - -
    - - - - - - - -
    -
    - {translate module=service} - title_hosting - {/translate} -
    -
    - - - { if $service.domain_name != "" } - - - - {/if} - { if $service.host_ip != "" } - - - - - {/if} - - - - - - - - -
    - {translate module=service} - field_domain_name - {/translate} - - { $service.domain_name|upper } - . - { $service.domain_tld|upper } -
    - {translate module=service} - field_host_ip - {/translate} - - { $service.host_ip } -
    - {translate module=service} - field_host_username - {/translate} - {$service.host_username}
    - {translate module=service} - field_host_password - {/translate} - {$service.host_password}
    -
    -
    + + {if $record.date_next_invoice > 0 && $record.suspend_billing == 1 } +

    + + + + +
    + + + + + + + +
    {t}title_suspended_billing{/t}
    + + + + +
    {t}suspended_billing_explain{/t} {$list->date($record.date_next_invoice)} {t}reactivate{/t}
    +
    +
    + + {elseif $record.date_next_invoice > 0 && $record.suspend_billing != 1 } +

    + + + + +
    + + + + + + + +
    {t}Recurring Details{/t}
    + + + + + + + + + + + + + + + + + +
    {osb f=tf field=date_last_invoice}{osb f=tf field=date_next_invoice}
    {$list->date($record.date_last_invoice)}{$list->date($record.date_next_invoice)}
    {osb f=tf field=recur_schedule} 
    + {if $recur_price} + + {else} + {$list->menu_staticlist('recur_schedule','','',$record.recur_schedule,'','')} + {/if} + + {if $record.recur_cancel == 1} + + {/if} +
    +
    +
    + {/if} + + {if $record.type == 'group' || $record.type == 'host_group'} +

    + + + + +
    + + + + + + + +
    {translate module=service}title_group{/translate}
    + + + + + +
    + + + + +
    +

    + + {translate module=product}assoc_group_limited{/translate} + +
    + + {translate module=product}assoc_group_subscription{/translate} +
    + + {translate module=product}assoc_group_forever{/translate} +

    +
    +
    {$list->menu_multi($record.group_grant,'service_group_grant','group','name','10','','form_menu')}
    +
    +
    + {/if} + + {if $record.type == 'domain'} +

    + + + + +
    + + + + + + + +
    {t}Internet Domain Name{/t}
    + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=domain_name}{osb f=tf field=domain_term}{osb f=tf field=domain_date_expire}
    {$record.domain_name|upper}.{$record.domain_tld|upper} Resend Invoice{$record.domain_term} Year(s) {t}Renew{/t}{$list->date($record.date_last)}
    {osb f=tf field=domain_type}  
    {t}{$record.domain_type}{/t}  
    +
    +
    + {/if} + + {if $record.type == 'host' || $record.type == 'host_group'} +

    + + + + +
    + + + + + + + +
    {t}Hosting Details{/t}
    + + + {if $record.domain_name != ''} + + + {/if} + + {if $record.host_ip != ''} + + + + + {/if} + + + + + + + + +
    {osb f=tf field=domain_name}{$record.domain_name|upper}.{$record.domain_tld|upper}
    {osb f=tf field=host_ip}{$record.host_ip}
    {osb f=tf field=host_username}{$record.host_username}
    {osb f=tf field=host_password}{$record.host_password}
    +
    +
    + {/if} + {/if} +
    + {/if} + {/if} {/if} -{/if} -{/foreach} -{/if} -{/if} \ No newline at end of file diff --git a/themes/default/blocks/service/view.tpl b/themes/default/blocks/service/view.tpl index 9a50fb58..8695af87 100644 --- a/themes/default/blocks/service/view.tpl +++ b/themes/default/blocks/service/view.tpl @@ -1,1079 +1,484 @@ -{ $method->exe("service","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{assign var=meth value=':'|explode:$VAR._page} + -{literal} - - -{/literal} - - -{foreach from=$service item=service} - - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - -
    - - - - -
    - - - - - - - - - - - - - - - - -
    -
    - {translate module=service} - title_view - {/translate} - {$service.id} -
    -
    - - - - -
    - - - - - - -
    - - - - - -
    -
    -
    -
    - {if $service.date_next_invoice > 0} - - {translate module=service} - title_recurring - {/translate} - | - {/if} - {if $service.type == 'group' || $service.type == 'host_group' || $service.type == 'product_group' } - - {translate module=service} - title_group - {/translate} - | - {/if} - - {if $service.type == 'domain' } - - {translate module=service} - title_domain - {/translate} - | - {/if} - - {if $service.type == 'host' || $service.type == 'host_group' } - {translate module=service} - title_hosting - {/translate} - | - {/if} - - {if $service.type == 'product' || $service.type == 'product_group' } - {translate module=service} - title_product - {/translate} - | - {/if} - - {translate module=service} - title_memo - {/translate} - -
    -
    - - - - - - {if $service.invoice} - - {/if} - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {if $service.prod_plugin_name eq "VOIP" || $service.prod_plugin_name eq "PREPAID"} - - - - - - - - - - - {/if} -
    - {translate module=service} - field_account_id - {/translate} - - - {translate module=service} - field_sku - {/translate} -
      - {html_select_account name="service_account_id" default=$service.account_id} -   - -
    - {translate module=service} - field_date_orig - {/translate} - - {translate module=service} - field_active - {/translate} -
      - {$list->date_time($service.date_orig)} -   - { $list->bool("service_active", $service.active, "\" onChange=\"submit()\"") } -
    - {translate module=service} - field_date_last - {/translate} - - {translate module=service} - field_queue - {/translate} -
      - {$list->date_time($service.date_last)} - - - - - -
    - {translate module=service} - field_service_did - {/translate} -  
     {voip_did service_id=$service.id}  
    -
    - - - - - {foreach from=$service.invoice item=invoice} - - - - - - - - {/foreach} - - - -
    - {translate module=account_admin} - invoice_overview - {/translate} -
      - {if $invoice.process_status == "1"} - - {else} - - {/if} - - {$invoice.id} - - {if $invoice.due > 0} - - {$list->format_currency_num($invoice.total_amt, '')} - - {else} - - {$list->format_currency_num($invoice.total_amt, '')} - - {/if} - - {if $invoice.due > 0} - - {$list->format_currency_num($invoice.due, '')} - - {else} - - {$list->format_currency_num('0', '')} - - {/if} -     
    - {translate module=service service=$service.id}invoice_history{/translate} -
    -
    -
    - - - - - - -
    - - - -
    -
    -
    - -
    - {if $service.date_next_invoice > 0} -
    - - - - -
    - - - - - - - -
    -
    - {translate module=service} - title_recurring - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - {if $service.recur_type == 1 } - - - - - {/if} - - - - - - - - - - - - - - - - - - {if $service.account_billing_id > 0} - - - - - {/if} - - -
    - {translate module=service} - field_date_last_invoice - {/translate} - - {translate module=service} - field_date_next_invoice - {/translate} -
    - { $list->calender_view("service_date_last_invoice", $service.date_last_invoice, "form_field", $service.id) } - - { $list->calender_view("service_date_next_invoice", $service.date_next_invoice, "form_field", $service.id) } -
    - {translate module=service} - field_recur_schedule - {/translate} - - {translate module=service} - field_taxable - {/translate} -
    - {if $recur_price} - - {else} - - {/if} - - { $list->bool("service_taxable", $service.taxable, "\" onChange=\"document.getElementById('service_view').submit()\"") } -
    - {translate module=service} - field_price - {/translate} - - {translate module=service} - field_recur_type - {/translate} -
    - - {$list->currency_iso("")} - - {if $service.recur_type == 0 } - {translate module=product} - recurr_type_aniv - {/translate} - {else} - {translate module=product} - recurr_type_fixed - {/translate} - {/if} -
    - {translate module=service} - field_recur_weekday - {/translate} - - - (1-28)
    - {translate module=service} - field_recur_schedule_change - {/translate} - - - { $list->bool("service_recur_schedule_change", $service.recur_schedule_change, "\" onChange=\"document.getElementById('service_view').submit()\"") } -
    - {translate module=service} - field_recur_cancel - {/translate} - - { $list->bool("service_recur_cancel", $service.recur_cancel, "\" onChange=\"document.getElementById('service_view').submit()\"") } -
    - {translate module=service} - field_recur_modify - {/translate} - - { $list->bool("service_recur_modify", $service.recur_modify, "\" onChange=\"document.getElementById('service_view').submit()\"") } -
    - - {translate module=service} - field_suspend_billing - {/translate} - - { $list->bool("service_suspend_billing", $service.suspend_billing, "\" onChange=\"document.getElementById('service_view').submit()\"") } -
    - {translate module=service} - field_account_billing_id - {/translate} - - { $list->menu_cc_admin("service_account_billing_id", $service.account_id, $service.account_billing_id, "form_menu") } -
    -
    -
    - {/if} -
    - -
    - {if $service.type == 'group' || $service.type == 'host_group' || $service.type == 'product_group' } -
    - - - - -
    - - - - - - - -
    -
    - {translate module=service} - title_group - {/translate} -
    -
    - - - - - -
    - - - - -
    -

    - - {translate module=product} - assoc_group_limited - {/translate} - -
    - - {translate module=product} - assoc_group_subscription - {/translate} -
    - - {translate module=product} - assoc_group_forever - {/translate} -

    -
    -
    - { $list->menu_multi($service.group_grant, "service_group_grant", "group", "name", "10", "", "form_menu") } -
    -
    -
    - {/if} -
    - -
    - {if $service.type == 'domain' } -
    - - - - -
    - - - - - - - -
    -
    - {translate module=service} - title_domain - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=service} - field_domain_name - {/translate} - - {translate module=service} - field_domain_term - {/translate} - - {translate module=service} - field_domain_date_expire - {/translate} -
    - { $service.domain_name|upper }.{ $service.domain_tld|upper } -   Resend Invoice - - { $service.domain_term } - Year(s) - {translate module=cart} - renew - {/translate} - - { $list->calender_view("service_domain_date_expire", $service.domain_date_expire, "form_field", $service.id) } -
    - {translate module=service} - field_domain_type - {/translate} - - {translate module=service} - field_domain_host_registrar_id - {/translate} - - {translate module=service} - field_domain_host_tld_id - {/translate} -
    - {translate module=cart}{$service.domain_type}{/translate} - - { $list->menu("", "service_domain_host_registrar_id", "host_registrar_plugin", "name", $service.domain_host_registrar_id, "form_menu") } - - { $list->menu("", "service_domain_host_tld_id", "host_tld", "name", $service.domain_host_tld_id, "form_menu") } -
    -
    -
    - {/if} -
    - -
    - {if $service.type == 'host' || $service.type == 'host_group' } -
    - - - - -
    - - - - - - - - - - -
    -
    - {translate module=service} - title_hosting - {/translate} -
    -
    - - - - - - - - - - { if $service.host_ip != "" } - - - - - {/if} - - - - - - - - -
    - {translate module=service} - field_domain_name - {/translate} - - { $service.domain_name|upper } - . - { $service.domain_tld|upper } -   Resend Invoice -
    - {translate module=service} - field_host_server_id - {/translate} - - { $list->menu("", "disabled", "host_server", "name", $service.host_server_id, "\" disabled") } -
    - {translate module=service} - field_host_ip - {/translate} - - { $service.host_ip } -
    - {translate module=service} - field_host_username - {/translate} - - -
    - {translate module=service} - field_host_password - {/translate} - - -
    -
    - {if ($list->smarty_array("host_server","provision_plugin", "", "plugin")) } - {foreach from=$plugin item=arr} - {if $service.host_server_id == $arr.id} - {assign var="product" value=$service} - {assign var="afile" value=$arr.provision_plugin} - {assign var="ablock" value="host_provision_plugin:plugin_prod_"} - {assign var="blockfile" value="$ablock$afile"} - { $block->display($blockfile) } - {/if} - {/foreach} - {/if} -
    -
    - {/if} -
    - -
    - {if $service.type == 'product' || $service.type == 'product_group' } -
    - - - - -
    - - - - - - - - - - -
    -
    - {translate module=service} - title_product - {/translate} -
    -
    - - - - - - { if $service.host_ip != "" } - {/if} -
    - {translate module=service} - product_plugin - {/translate} - - { $service.prod_plugin_name } -
    -
    - {assign var="product" value=$service} - {assign var="afile" value=$service.prod_plugin_name} - {assign var="ablock" value="product_plugin:plugin_prod_"} - {assign var="blockfile" value="$ablock$afile"} - { $block->display($blockfile) } -
    -
    - {/if} -
    - - - - - - - - -
    -
    - -
    - - -{/foreach} + {include file='file:../core/view_pre.tpl'} + + + + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} + + +
    + + + + + +
    + + + + + + + + + + + + + + {include file='file:../core/view_tr_submit_delete.tpl'} +
    {osb f=tt} {$record.id}
    + + + + + + +
    + + + + + +
    +
    + {if $record.date_next_invoice > 0}{t}Recurring Details{/t} |{/if} + {if $record.type == 'group' || $record.type == 'host_group' || $record.type == 'product_group'}{t}Group Details{/t} |{/if} + {if $record.type == 'domain'}{t}Domain Details{/t} |{/if} + {if $record.type == 'host' || $record.type == 'host_group'}{t}Hosting Details{/t} |{/if} + {if $record.type == 'product' || $record.type == 'product_group'}{t}Product Plugin{/t} |{/if} + {t}Memos{/t} +
    + + + + + + {if $record.invoice} + + {/if} + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=account_id}{osb f=tf field=sku}
     {osb f=html_select_account name='service_account_id' default=$record.account_id} 
    {osb f=tf field=date_orig}{osb f=tf field=active}
     {$list->date_time($record.date_orig)} {$list->bool('service_active',$record.active,'" onchange="submit()')}
    {osb f=tf field=date_last}{osb f=tf field=queue}
     {$list->date_time($record.date_last)}  + {$list->menu_staticlist('servicequeue','service_queue','service_queue',$record.queue,'form_menu',true)} + +
    +
    + + + + + {foreach from=$record.invoice item=invoice} + + + + + + + + + {/foreach} + + + +
    {t}Invoice Overview{/t}
      + {if $invoice.process_status == '1'} + + {else} + + {/if} + {$invoice.id}{$list->date($invoice.date_orig)} + {if $invoice.due > 0} + {$list->format_currency_num($invoice.total_amt,'')} + {else} + {$list->format_currency_num($invoice.total_amt,'')} + {/if} + + {if $invoice.due > 0} + {$list->format_currency_num($invoice.due,'')} + {else} + {$list->format_currency_num('0','')} + {/if} +      +
    {t}All invoices for this service{/t}
    +
    +
    +
    + +
    + {if $record.date_next_invoice > 0} +
    + + + + +
    + + + + + + + +
    {t}Recurring Details{/t}
    + + + + + + + + + + + + + + + + + + + + + + + + + + {if $record.recur_type == 1} + + + + + {/if} + + + + + + + + + + + + + + + + + + {if $record.account_billing_id > 0} + + + + + {/if} +
    {osb f=tf field=date_last_invoice}{osb f=tf field=date_next_invoice}
    {$list->calender_view('service_date_last_invoice',$record.date_last_invoice,'form_field')}{$list->calender_view('service_date_next_invoice',$record.date_next_invoice,'form_field')}
    {osb f=tf field=recur_schedule}{osb f=tf field=taxable}
    + {if $recur_price} + + {else} + {$list->menu_staticlist('recur_schedule','service_recur_schedule','service_recur_schedule',$record.recur_schedule,'form_menu" onchange="adminChangeSchedule(this)')} + {/if} + {$list->bool('service_taxable',$record.taxable,'" onchange="document.getElementById(\'view\').submit()')}
    {osb f=tf field=price}{osb f=tf field=recur_type}
    {$list->currency_iso('')}{$list->menu_staticlist('recur_type','','service_recur_type',$record.recur_type,'form_menu',true)}
    {osb f=tf field=recur_weekday}(1-28)
    {osb f=tf field=recur_schedule_change}{$list->bool('service_recur_schedule_change',$record.recur_schedule_change,'" onchange="document.getElementById(\'view\').submit()')}
    {osb f=tf field=recur_cancel}{$list->bool('service_recur_cancel',$record.recur_cancel,'" onchange="document.getElementById(\'view\').submit()')}
    {osb f=tf field=recur_modify}{$list->bool('service_recur_modify',$record.recur_modify,'" onchange="document.getElementById(\'view\').submit()')}
    {osb f=tf field=suspend_billing}{$list->bool('service_suspend_billing',$record.suspend_billing,'" onchange="document.getElementById(\'view\').submit()')}
    {osb f=tf field=account_billing_id}{$list->menu_cc_admin('service_account_billing_id',$record.account_id,$record.account_billing_id,'form_menu')}
    +
    +
    + {/if} +
    + +
    + {if $record.type == 'group' || $record.type == 'host_group' || $record.type == 'product_group'} +
    + + + + +
    + + + + + + + +
    {t}Group Details{/t}
    + + + + +
    + {t}Grant access for specified amount of days:{/t}
    + {t}Grant access while associated subscription is active{/t}
    + {t}Grant access forerver{/t} +
    +
    +
    + {/if} +
    + +
    + {if $record.type == 'domain'} +
    + + + + +
    + + + + + + + +
    {t}Domain Details{/t}
    + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=domain_name}{osb f=tf field=domain_term}{osb f=tf field=domain_date_expire}
    {$record.domain_name|upper}.{$record.domain_tld|upper} Resend Invoice{$record.domain_term} Year(s) {translate module=cart}renew{/translate}{$list->calender_view('service_domain_date_expire',$record.domain_date_expire,'form_field',$record.id)}
    {osb f=tf field=domain_type}{osb f=tf field=domain_host_registrar_id}{osb f=tf field=domain_host_tld_id}
    {translate module=cart}{$record.domain_type}{/translate}{$list->menu('','service_domain_host_registrar_id','host_registrar_plugin','name',$record.domain_host_registrar_id,'form_menu')}{$list->menu('','service_domain_host_tld_id','host_tld','name',$record.domain_host_tld_id,'form_menu')}
    +
    +
    + {/if} +
    + +
    + {if $record.type == 'host' || $record.type == 'host_group'} +
    + + + + +
    + + + + + + + + + + +
    {t}Hosting Details{/t}
    + + + + + + + + + + {if $record.host_ip != ''} + + + + + {/if} + + + + + + + + +
    {osb f=tf field=domain_name}{$record.domain_name|upper}.{$record.domain_tld|upper} Resend Invoice
    {osb f=tf field=host_server_id}{$list->menu('','disabled','host_server','name',$record.host_server_id,'" disabled')}
    {osb f=tf field=host_ip}{$record.host_ip}
    {osb f=tf field=host_username}
    {osb f=tf field=host_password}
    +
    + {if ($list->smarty_array('host_server','provision_plugin','','plugin'))} + {foreach from=$plugin item=arr} + {if $record.host_server_id == $arr.id} + {assign var='product' value=$service} + {assign var='afile' value=$arr.provision_plugin} + {assign var='ablock' value='host_provision_plugin:plugin_prod_'} + {assign var='blockfile' value="$ablock$afile"} + {$block->display($blockfile)} + {/if} + {/foreach} + {/if} +
    +
    + {/if} +
    + +
    + {if $record.type == 'product' || $record.type == 'product_group'} +
    + + + + +
    + + + + + + + + + + +
    {t}Product Plugin{/t}
    + + + + + +
    {translate module=service}product_plugin{/translate}{$record.prod_plugin_name}
    +
    + {assign var='product' value=$service} + {assign var='afile' value=$record.prod_plugin_name} + {assign var='ablock' value='product_plugin:plugin_prod_'} + {assign var='blockfile' value="$ablock$afile"} + {$block->display($blockfile)} +
    +
    + {/if} +
    + + {include file='file:../core/view_post.tpl'} +
    + + + + +
    +
    + + + + {/if} diff --git a/themes/default/blocks/service_memo/add.tpl b/themes/default/blocks/service_memo/add.tpl index d49d9fa5..10041c3c 100644 --- a/themes/default/blocks/service_memo/add.tpl +++ b/themes/default/blocks/service_memo/add.tpl @@ -1,60 +1,40 @@ -{ $block->display("core:top_clean") } +{assign var=meth value=':'|explode:$VAR._page} + - + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} -
    + - - - - -
    - - - - - - - -
    -
    - {translate module=service_memo}title_add{/translate} -
    -
    - - - - - - - - - -
    - {translate module=service_memo} - field_memo - {/translate} - - -
    - - - - - - - - - - -
    -
    -
    -
    - + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + {include file='file:../core/add_tr_submit.tpl'} +
    {osb f=tf field=memo}
    +
    +
    + +
    + + + +
    + diff --git a/themes/default/blocks/service_memo/search_show.tpl b/themes/default/blocks/service_memo/search_show.tpl index a358aaf7..ee53a3cd 100644 --- a/themes/default/blocks/service_memo/search_show.tpl +++ b/themes/default/blocks/service_memo/search_show.tpl @@ -1,140 +1,36 @@ -{ $block->display("core:top_clean") } +{assign var=meth value=':'|explode:$VAR._page} + -{$method->exe("service_memo","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    + {include file='file:../core/search_show_pre.tpl'} + + + + +
    + + {$method->exe_noauth($meth.0,'tpl_search_show')} + {foreach from=$search_show item=record} + {include file='file:../core/search_show_tr_record.tpl'} + + + + + + {/foreach} +
    {$list->date_time($record.date_orig)} + {if $record.staff_id == '0'} + {translate module=service_memo}system{/translate} + {else} + {$record.staff_id} + {/if} + {t}{$record.type}{/t}{$record.memo|truncate:30}
    +
    - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - - - {foreach from=$service_memo item=record} - - - - - - - - - - - - - - - {literal} - - {/literal} - {/foreach} - - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -
    - -   - {$list->date_time($record.date_orig)} -   - {if $record.staff_id == '0'} - {translate module=service_memo} - system - {/translate} - {else} - {$record.staff_id} - {/if} -   - {translate module=service_memo} - {$record.type} - {/translate} -   - {$record.memo|truncate:30} -
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - - -
    -
    + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/service_memo/view.tpl b/themes/default/blocks/service_memo/view.tpl index bf2f37a7..5e35c3ee 100644 --- a/themes/default/blocks/service_memo/view.tpl +++ b/themes/default/blocks/service_memo/view.tpl @@ -1,143 +1,67 @@ -{ $block->display("core:top_clean") } +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("service_memo","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} -{literal} - - -{/literal} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - -{foreach from=$service_memo item=service_memo} + +
    + + + + + +
    + + + + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + +
    {osb f=tf field=date_orig}{$list->date_time($record.date_orig)}
    {osb f=tf field=staff_id} + {if $record.staff_id == '0'} + {t}System{/t} + {else} + {osb f=html_select_account name='service_memo_staff_id' default=$record.staff_id} + {/if} +
    {osb f=tf field=memo}{$record.memo|nl2br}
    +
    + + + + {include file='file:../core/view_td_delete.tpl'} + +
     
    +
    +
    + + {include file='file:../core/view_post.tpl'} +
    - -{if $form_validation} - { $block->display("core:alert_fields") } {/if} - - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=service_memo}title_view{/translate} -
    -
    - - - - - - - - - - - - - - - - - -
    - {translate module=service_memo} - field_date_orig - {/translate} - - {$list->date_time($service_memo.date_orig)} -
    - {translate module=service_memo} - field_staff_id - {/translate} - - {if $service_memo.staff_id == '0'} - {translate module=service_memo} - system - {/translate} - {else} - {html_select_account name="service_memo_staff_id" default=$service_memo.staff_id} - {/if} -
    - {translate module=service_memo} - field_memo - {/translate} - - {$service_memo.memo|nl2br} -
    - - - - - -
      - -
    -
    -
    -
    - -
    - - - - -
    -
    - -{/foreach} -
    - - {translate module=service_memo} - title_add - {/translate} - - {/if} -
    diff --git a/themes/default/blocks/session/search_form.tpl b/themes/default/blocks/session/search_form.tpl index 285e3b39..1cc76a39 100644 --- a/themes/default/blocks/session/search_form.tpl +++ b/themes/default/blocks/session/search_form.tpl @@ -1,183 +1,78 @@ -{ $method->exe("session","search_form") } -{ if ($method->result == FALSE) } - { $block->display("core:method_error") } +{assign var=meth value=':'|explode:$VAR._page} + + +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} -
    - - - - -
    - - - - - - - -
    -
    - {translate module=session} - title_search - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=session} - field_date_orig - {/translate} - - { $list->calender_search("session_date_orig", $VAR.session_date_orig, "form_field", "") } -
    - {translate module=session} - field_date_last - {/translate} - - { $list->calender_search("session_date_last", $VAR.session_date_last, "form_field", "") } -
    - {translate module=session} - field_date_expire - {/translate} - - { $list->calender_search("session_date_expire", $VAR.session_date_expire, "form_field", "") } -
    - {translate module=session} - field_logged - {/translate} - - { $list->bool("session_logged", "all", "form_menu") } -
    - {translate module=session} - field_ip - {/translate} - - -    - {translate} - search_partial - {/translate} -
    - {translate module=session} - field_theme_id - {/translate} - - { $list->menu_files("", "session_theme_id", "all", "theme", "", ".user_theme", "form_menu") } -
    - {translate module=session} - field_country_id - {/translate} - - { $list->menu("", "session_country_id", "country", "name", "all", "form_menu") } -
    - {translate module=session} - field_language_id - {/translate} - - { $list->menu_files("", "session_language_id", "all", "theme", "", "_core.xml", "form_menu") } -
    - {translate module=session} - field_currency_id - {/translate} - - { $list->menu("", "session_currency_id", "currency", "name", "all", "form_menu") } -
    - {translate module=session} - field_account_id - {/translate} - - {html_select_account name="session_account_id" default=$VAR.session_account_id} -
    - {translate module=session} - field_affiliate_id - {/translate} - - {html_select_affiliate name="session_affiliate_id" default=$VAR.session_affiliate_id} -
    - {translate} - search_results_per - {/translate} - - -
    - {translate} - search_order_by - {/translate} - - -
    - - - - -
    -
    -
    -
    -{ $block->display("core:saved_searches") } -{ $block->display("core:recent_searches") } + +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/search_post.tpl'} +
    {osb f=tf field=date_orig}{$list->calender_search('session_date_orig',$VAR.session_date_orig,'form_field','')}
    {osb f=tf field=date_last}{$list->calender_search('session_date_last',$VAR.session_date_last,'form_field','')}
    {osb f=tf field=date_expire}{$list->calender_search('session_date_expire',$VAR.session_date_expire,'form_field','')}
    {osb f=tf field=logged}{$list->bool('session_logged','all')}
    {osb f=tf field=ip}  {t}"%" for partial match{/t}
    {osb f=tf field=theme_id}{$list->menu_files('','session_theme_id','all','theme','','.user_theme','form_menu')}
    {osb f=tf field=country_id}{$list->menu('','session_country_id','country','name','','form_menu',true)}
    {osb f=tf field=language_id}{$list->menu_files('','session_language_id','all','theme','','_core.xml','form_menu')}
    {osb f=tf field=currency_id}{$list->menu('','session_currency_id','currency','name','','form_menu',true)}
    {osb f=tf field=account_id}{osb f=html_select_account name='session_account_id' default=$VAR.session_account_id}
    {osb f=tf field=affiliate_id}{osb f=html_select_affiliate name='session_affiliate_id' default=$VAR.session_affiliate_id}
    +
    +
    + +
    + + {$block->display('core:saved_searches')} + {$block->display('core:recent_searches')} {/if} diff --git a/themes/default/blocks/session/search_show.tpl b/themes/default/blocks/session/search_show.tpl index b8ef0d89..1a935a9e 100644 --- a/themes/default/blocks/session/search_show.tpl +++ b/themes/default/blocks/session/search_show.tpl @@ -1,135 +1,44 @@ +{assign var=meth value=':'|explode:$VAR._page} + - -{$method->exe("session","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    + {include file='file:../core/search_show_pre.tpl'} + + + + +
    + + {$method->exe_noauth($meth.0,'tpl_search_show')} + {foreach from=$search_show item=record} + {include file='file:../core/search_show_tr_record.tpl'} + + + + + + + {/foreach} +
    {$list->date($record.date_orig)}{$list->date_time($record.date_last)}{$record.ip} + {if $record.account_id == '0'} + {t}None{/t} + {else} + {$record.account_id} + {/if} + + {t}Export these search results to XML, PDF, Excel, Comma or Tab Separated Values.{/t} + {if $record.logged == '1'} + Go + {else} + Stop + {/if} +
    +
    - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - - {foreach from=$session item=record} - - - - - - - - - {literal} - - {/literal} - {/foreach} - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -  
    - -   - {$list->date($record.date_orig)} -   - {$list->date_time($record.date_last)} -   - {$record.ip} -   - {if $record.account_id == "0"} - {translate} - none - {/translate} - {else} - {$record.account_id} - {/if} -   {translate}search_export_image{/translate} - {if $record.logged == "1"} - - {else} - - {/if} -
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/session/view.tpl b/themes/default/blocks/session/view.tpl index a2323fcb..8266a816 100644 --- a/themes/default/blocks/session/view.tpl +++ b/themes/default/blocks/session/view.tpl @@ -1,215 +1,100 @@ -{ $method->exe("session","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{assign var=meth value=':'|explode:$VAR._page} + -{literal} - - -{/literal} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} - -{foreach from=$session item=session} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=session} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {if $list->is_installed('affiliate') } - - - - - {/if} - - - - -
    - {translate module=session} - field_date_orig - {/translate} - - {$list->date_time($session.date_orig)} -
    - {translate module=session} - field_date_last - {/translate} - - {$list->date_time($session.date_last)} -
    - {translate module=session} - field_date_expire - {/translate} - - {$list->date_time($session.date_expire)} -
    - {translate module=session} - field_logged - {/translate} - - {if $session.logged == "1"} - {translate} - true - {/translate} - {else} - {translate} - false - {/translate} - {/if} -
    - {translate module=session} - field_ip - {/translate} - - {$session.ip} -
    - {translate module=session} - field_theme_id - {/translate} - - { $list->menu_files("", "session_theme_id", $session.theme_id, "theme", "", ".user_theme", "form_menu") } -
    - {translate module=session} - field_country_id - {/translate} - - { $list->menu("no", "session_country_id", "country", "name", $session.country_id, "form_menu") } -
    - {translate module=session} - field_language_id - {/translate} - - { $list->menu_files("no", "session_language_id", $session.language_id, "theme", "", "_core.xml", "form_menu") } -
    - {translate module=session} - field_currency_id - {/translate} - - { $list->menu("no", "session_currency_id", "currency", "name", $session.currency_id, "form_menu") } -
    - {translate module=session} - field_account_id - {/translate} - - {html_select_account name="session_account_id" default=$session.account_id} -
    - {translate module=session} - field_affiliate_id - {/translate} - - {html_select_affiliate name="session_affiliate_id" default=$session.affiliate_id} -
    - - - - - -
      - -
    -
    -
    -
    - - - - -
    - {/foreach} + +
    + + + + + +
    + + + + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {if $list->is_installed('affiliate')} + + + + + {/if} +
    {osb f=tf field=date_orig}{$list->date_time($record.date_orig)}
    {osb f=tf field=date_last}{$list->date_time($record.date_last)}
    {osb f=tf field=date_expire}{$list->date_time($record.date_expire)}
    {osb f=tf field=logged} + {if $record.logged == "1"} + {t}True{/t} + {else} + {t}False{/t} + {/if} +
    {osb f=tf field=ip}{$record.ip}
    {osb f=tf field=theme_id}{$list->menu_files('','session_theme_id',$record.theme_id,'theme','','.user_theme','form_menu')}
    {osb f=tf field=country_id}{osb f=html_select_name name='session_country_id' table='country' method='country' default=$record.country_id}
    {osb f=tf field=language_id}{$list->menu_files('no','session_language_id',$record.language_id,'language','','_core.xml','form_menu')}
    {osb f=tf field=currency_id}{$list->menu('no','session_currency_id','currency','name',$record.currency_id,'form_menu')}
    {osb f=tf field=account_id}{osb f=html_select_account name='session_account_id' default=$record.account_id}
    {osb f=tf field=affiliate_id}{osb f=html_select_affiliate name='session_affiliate_id' default=$record.affiliate_id}
    +
    + + + + {include file='file:../core/view_td_delete.tpl'} + +
     
    +
    +
    + + {include file='file:../core/view_post.tpl'} +
    {/if} diff --git a/themes/default/blocks/setup/_php_info.tpl b/themes/default/blocks/setup/_php_info.tpl index dbdde397..127fd9a1 100644 --- a/themes/default/blocks/setup/_php_info.tpl +++ b/themes/default/blocks/setup/_php_info.tpl @@ -1,4 +1,7 @@ -{ $method->exe("setup","_php_info") } -{ if ($method->result == FALSE) } -{ $block->display("core:method_error") } -{/if} \ No newline at end of file +{assign var=meth value=':'|explode:$VAR._page} + + +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{/if} diff --git a/themes/default/blocks/setup/search_show.tpl b/themes/default/blocks/setup/search_show.tpl index 314387bd..2e593f28 100644 --- a/themes/default/blocks/setup/search_show.tpl +++ b/themes/default/blocks/setup/search_show.tpl @@ -1,108 +1,12 @@ -{$method->exe("setup","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{assign var=meth value=':'|explode:$VAR._page} + + +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - - - - - - {foreach from=$setup item=record} - - - - - - - {literal} - - {/literal} {/foreach} - - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -
    - - {$record.id}{$record.site_name}{$record.nonssl_url}
    -
    - -{if $VAR._print != TRUE}
    - -
    - - -
    -
    + {include file='file:../core/search_show_pre.tpl'} + {$method->exe_noauth($meth.0,'tpl_search_show',$search_show)} + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/setup/view.tpl b/themes/default/blocks/setup/view.tpl index e679c8e6..eee52f60 100644 --- a/themes/default/blocks/setup/view.tpl +++ b/themes/default/blocks/setup/view.tpl @@ -1,754 +1,296 @@ -{ $method->exe("setup","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{assign var=meth value=':'|explode:$VAR._page} + -{literal} - - -{/literal} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} - -{foreach from=$setup item=setup} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=setup} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {if $list->is_installed('affiliate')} - - - - - - - - - {/if} - - - - - - - - - - - - - - - - - - - - - - - - - { if $list->is_installed('host_tld') } - - - - - {/if} - - - - - - - - - - - - - - - - - - {if $list->is_installed('file')} - - - - - {/if} - - {if $list->is_installed('static_page')} - - - - - {/if} - - {if $list->is_installed('affiliate')} - - - - - - - - - {/if} - {if $list->is_installed('ticket')} - - - - - {/if} - - - - - {if $list->is_installed('weblog')} - - - - - {/if} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=setup} - field_site_name - {/translate} - - -
    - {translate module=setup} - field_site_address - {/translate} - - -
    - {translate module=setup} - field_site_city - {/translate} - - -
    - {translate module=setup} - field_site_state - {/translate} - - -
    - {translate module=setup} - field_site_zip - {/translate} - - -
    - {translate module=setup} - field_site_phone - {/translate} - - -
    - {translate module=setup} - field_site_fax - {/translate} - - -
    - {translate module=setup} - field_site_email - {/translate} - - -
    - {translate module=setup} - field_country_id - {/translate} - - { $list->menu("no", "setup_country_id", "country", "name", $setup.country_id, "form_menu") } -
    - {translate module=setup} - field_currency_id - {/translate} - - { $list->menu("", "setup_currency_id", "currency", "name", $setup.currency_id, "form_menu") } -
    - {translate module=setup} - field_language_id - {/translate} - - { $list->menu_files("", "setup_language_id", $setup.language_id, "language", "", "_core.xml", "form_menu") } -
    - {translate module=setup} - field_theme_id - {/translate} - -

    - { $list->menu_files("", "setup_theme_id", $setup.theme_id, "theme", "", ".user_theme", "form_menu") } -

    -
    - {translate module=setup} - field_admin_theme_id - {/translate} - - { $list->menu_files("", "setup_admin_theme_id", $setup.admin_theme_id, "theme", "", ".admin_theme", "form_menu") } -
    - {translate module=setup} - field_group_id - {/translate} - - { $list->menu("", "setup_group_id", "group", "name", $setup.group_id, "form_menu") } -
    - {translate module=setup} - field_setup_email_id - {/translate} - - { $list->menu("", "setup_setup_email_id", "setup_email", "name", $setup.setup_email_id, "form_menu") } -
    - {translate module=setup} - field_affiliate_template_id - {/translate} - - { $list->menu("", "setup_affiliate_template_id", "affiliate_template", "name", $setup.setup_affiliate_template_id, "form_menu") } -
    - {translate module=setup} - field_auto_affiliate - {/translate} - - {$list->bool("setup_auto_affiliate", $setup.auto_affiliate, "form_menu")} -
    - {translate module=setup} - field_default_account_status - {/translate} - - {$list->bool("setup_default_account_status", $setup.default_account_status, "form_menu")} -
    - {translate module=setup} - field_db_cache - {/translate} - - {$list->bool("setup_db_cache", $setup.db_cache, "form_menu")} -
    - {translate module=setup} - field_cache_sessions - {/translate} - - {$list->bool("setup_cache_sessions", $setup.cache_sessions, "form_menu")} -
    - {translate module=setup} - field_show_newsletter_link - {/translate} - - {$list->bool("setup_show_newsletter_link", $setup.show_newsletter_link, "form_menu")} -
    - {translate module=setup} - field_newsletter_registration - {/translate} - - {$list->bool("setup_newsletter_registration", $setup.newsletter_registration, "form_menu")} -
    - {translate module=setup} - field_show_contact_link - {/translate} - - {$list->bool("setup_show_contact_link", $setup.show_contact_link, "form_menu")} -
    - {translate module=setup} - field_show_domain_link - {/translate} - - {$list->bool("setup_show_domain_link", $setup.show_domain_link, "form_menu")} -
    - {translate module=setup} - field_show_cart_link - {/translate} - - {$list->bool("setup_show_cart_link", $setup.show_cart_link, "form_menu")} -
    - {translate module=setup} - field_show_checkout_link - {/translate} - - {$list->bool("setup_show_checkout_link", $setup.show_checkout_link, "form_menu")} -
    - {translate module=setup} - field_show_product_link - {/translate} - - {$list->bool("setup_show_product_link", $setup.show_product_link, "form_menu")} -
    - {translate module=setup} - field_show_cat_block - {/translate} - - {$list->bool("setup_show_cat_block", $setup.show_cat_block, "form_menu")} -
    - {translate module=setup} - field_show_file_block - {/translate} - - {$list->bool("setup_show_file_block", $setup.show_file_block, "form_menu")} -
    - {translate module=setup} - field_show_static_block - {/translate} - - {$list->bool("setup_show_static_block", $setup.show_static_block, "form_menu")} -
    - {translate module=setup} - field_show_affiliate_link - {/translate} - - {$list->bool("setup_show_affiliate_link", $setup.show_affiliate_link, "form_menu")} -
    - {translate module=setup} - field_show_affiliate_code - {/translate} - - {$list->bool("setup_show_affiliate_code", $setup.show_affiliate_code, "form_menu")} -
    - {translate module=setup} - field_show_ticket_link - {/translate} - - {$list->bool("setup_show_ticket_link", $setup.show_ticket_link, "form_menu")} -
    - {translate module=setup} - field_show_discount_code - {/translate} - - {$list->bool("setup_show_discount_code", $setup.show_discount_code, "form_menu")} -
    - {translate module=setup} - field_weblog - {/translate} - - {$list->bool("setup_weblog", $setup.weblog, "form_menu")} -
    - {translate module=setup} - field_os - {/translate} - - -
    - {translate module=setup} - field_path_curl - {/translate} - - -
    - {translate module=setup} - field_nonssl_url - {/translate} - - -
    - {translate module=setup} - field_ssl_url - {/translate} - - -
    - {translate module=setup} - field_login_expire - {/translate} - - -
    - {translate module=setup} - field_cookie_name - {/translate} - - -
    - {translate module=setup} - field_cookie_expire - {/translate} - - -
    - {translate module=setup} - field_error_reporting - {/translate} - - -
    - {translate module=setup} - field_debug - {/translate} - - {$list->bool("setup_debug", $setup.debug, "form_menu")} -
    - {translate module=setup} - field_search_expire - {/translate} - - -
    - {translate module=setup} - field_decimal_place - {/translate} - - -
    - {translate module=setup} - field_time_format - {/translate} - -

    - -

    -
    - {translate module=setup} - field_date_format - {/translate} - - { $list->setup_default_date($setup.date_format, "form_menu") } -
    - {translate module=setup} - field_login_attempt_try - {/translate} - - -
    - {translate module=setup} - field_login_attempt_time - {/translate} - - -
    - {translate module=setup} - field_login_attempt_lock - {/translate} - - -
    - {translate module=setup} - field_billing_weekday - {/translate} - - -
    - {translate module=setup} - field_grace_period - {/translate} - - -
    - {translate module=setup} - field_max_billing_notice - {/translate} - - -
    - {translate module=setup} - field_max_inv_gen_period - {/translate} - - -
    - {translate module=setup} - field_license_key - {/translate} - - -
    - {translate module=setup} - field_license_code - {/translate} - - -
    - - - - - -
    - - - -
    -
    -
    -
    - - - - -
    - {/foreach} + +
    + + + + + +
    + + + + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {if $list->is_installed('setup_email')} + + + + + {/if} + {if $list->is_installed('affiliate')} + + + + + + + + + {/if} + + + + + + + + + + + + + + + + + + + + + + + + + {if $list->is_installed('host_tld')} + + + + + {/if} + + + + + + + + + + + + + + + + + {if $list->is_installed('static_page')} + + + + + {/if} + {if $list->is_installed('affiliate')} + + + + + + + + + {/if} + + + + + {if $list->is_installed('weblog')} + + + + + {/if} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=site_name}
    {osb f=tf field=site_address}
    {osb f=tf field=site_city}
    {osb f=tf field=site_state}
    {osb f=tf field=site_zip}
    {osb f=tf field=site_phone}
    {osb f=tf field=site_fax}
    {osb f=tf field=site_email}
    {osb f=tf field=country_id}{$list->menu('no','setup_country_id','country','name',$record.country_id,'form_menu')}
    {osb f=tf field=currency_id}{$list->menu('','setup_currency_id','currency','name',$record.currency_id,'form_menu')}
    {osb f=tf field=language_id}{$list->menu_files('','setup_language_id',$record.language_id,'language','','_core.xml','form_menu')}
    {osb f=tf field=theme_id}

    {$list->menu_files('','setup_theme_id',$record.theme_id,'theme','','.user_theme','form_menu')}

    {osb f=tf field=admin_theme_id}{$list->menu_files('','setup_admin_theme_id',$record.admin_theme_id,'theme','','.admin_theme','form_menu')}
    {osb f=tf field=group_id}{$list->menu('','setup_group_id','group','name',$record.group_id,'form_menu')}
    {osb f=tf field=setup_email_id}{$list->menu('','setup_setup_email_id','setup_email','name',$record.setup_email_id,'form_menu')}
    {osb f=tf field=affiliate_template_id}{$list->menu('','setup_affiliate_template_id','affiliate_template','name',$record.setup_affiliate_template_id,'form_menu')}
    {osb f=tf field=auto_affiliate}{$list->bool('setup_auto_affiliate',$record.auto_affiliate,'form_menu')}
    {osb f=tf field=default_account_status}{$list->bool('setup_default_account_status',$record.default_account_status)}
    {osb f=tf field=db_cache}{$list->bool('setup_db_cache',$record.db_cache)}
    {osb f=tf field=cache_sessions}{$list->bool('setup_cache_sessions',$record.cache_sessions)}
    {osb f=tf field=show_newsletter_link}{$list->bool('setup_show_newsletter_link',$record.show_newsletter_link)}
    {osb f=tf field=newsletter_registration}{$list->bool('setup_newsletter_registration',$record.newsletter_registration)}
    {osb f=tf field=show_contact_link}{$list->bool('setup_show_contact_link',$record.show_contact_link)}
    {osb f=tf field=show_domain_link}{$list->bool('setup_show_domain_link',$record.show_domain_link)}
    {osb f=tf field=show_cart_link}{$list->bool('setup_show_cart_link',$record.show_cart_link)}
    {osb f=tf field=show_checkout_link}{$list->bool('setup_show_checkout_link',$record.show_checkout_link)}
    {osb f=tf field=show_product_link}{$list->bool('setup_show_product_link',$record.show_product_link)}
    {osb f=tf field=show_cat_block}{$list->bool('setup_show_cat_block',$record.show_cat_block)}
    {osb f=tf field=show_static_block}{$list->bool('setup_show_static_block',$record.show_static_block)}
    {osb f=tf field=show_affiliate_link}{$list->bool('setup_show_affiliate_link',$record.show_affiliate_link)}
    {osb f=tf field=show_affiliate_code}{$list->bool('setup_show_affiliate_code',$record.show_affiliate_code)}
    {osb f=tf field=show_discount_code}{$list->bool('setup_show_discount_code',$record.show_discount_code)}
    {osb f=tf field=weblog}{$list->bool('setup_weblog',$record.weblog)}
    {osb f=tf field=os}{$list->menu_staticlist('os','setup_os','setup_os','','form_menu')}
    {osb f=tf field=path_curl}
    {osb f=tf field=nonssl_url}
    {osb f=tf field=ssl_url}
    {osb f=tf field=login_expire}
    {osb f=tf field=cookie_name}
    {osb f=tf field=cookie_expire}
    {osb f=tf field=error_reporting} + +
    {osb f=tf field=debug}{$list->bool('setup_debug',$record.debug)}
    {osb f=tf field=search_expire}
    {osb f=tf field=decimal_place}
    {osb f=tf field=time_format}

    {osb f=tf field=date_format}{$list->setup_default_date($record.date_format,'form_menu')}
    {osb f=tf field=login_attempt_try}
    {osb f=tf field=login_attempt_time}
    {osb f=tf field=login_attempt_lock}
    {osb f=tf field=billing_weekday}
    {osb f=tf field=grace_period}
    {osb f=tf field=max_billing_notice}
    {osb f=tf field=max_inv_gen_period}
    DEPRECIATED
    {osb f=tf field=license_key}
    DEPRECIATED
    {osb f=tf field=license_code}
    DEPRECIATED
    +
    + + + {include file='file:../core/view_td_submit.tpl'} + + +
     
    +
    +
    + + {include file='file:../core/view_post.tpl'} +
    {/if} diff --git a/themes/default/blocks/setup_email/add.tpl b/themes/default/blocks/setup_email/add.tpl index f349a468..e610fd7e 100644 --- a/themes/default/blocks/setup_email/add.tpl +++ b/themes/default/blocks/setup_email/add.tpl @@ -1,226 +1,105 @@ - +{assign var=meth value=':'|explode:$VAR._page} + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=setup_email} - title_add - {/translate} -
    -
    - - - - - - - {if $list->is_installed("email_queue")} - - - - - {/if} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=setup_email} - field_name - {/translate} - - -
    - {translate module=setup_email} - field_queue - {/translate} - - { $list->bool("setup_email_queue", $VAR.setup_email_queue, "") } -
    - {translate module=setup_email} - field_notes - {/translate} - - -
    - {translate module=setup_email} - field_from_name - {/translate} - - -
    - {translate module=setup_email} - field_from_email - {/translate} - - -
    - {translate module=setup_email} - field_cc_list - {/translate} - - -
    - {translate module=setup_email} - field_bcc_list - {/translate} - - -
    - {translate module=setup_email} - field_type - {/translate} - - { $list->bool("setup_email_type", $VAR.setup_email_type, "form_menu") } -
    - {translate module=setup_email} - smtp_help - {/translate} -
       
    - {translate module=setup_email} - field_server - {/translate} - - -
    - {translate module=setup_email} - field_username - {/translate} - - -
    - {translate module=setup_email} - field_password - {/translate} - - -
     
    - {translate module=setup_email} - field_piping - {/translate} - - -
    - {translate module=setup_email} - field_piping_host - {/translate} - - -
    - {translate module=setup_email} - field_piping_username - {/translate} - - -
    - {translate module=setup_email} - field_piping_password - {/translate} - - -
    - {translate module=setup_email} - field_piping_action - {/translate} - - -
    - - - - -
    -
    -
    -
    +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + {if $list->is_installed('email_queue')} + + + + + {/if} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/add_tr_submit.tpl'} +
    {osb f=tf field=name}
    {osb f=tf field=queue}{$list->bool('setup_email_queue',$VAR.setup_email_queue)}
    {osb f=tf field=notes}
    {osb f=tf field=from_name}
    {osb f=tf field=from_email}
    {osb f=tf field=cc_list}
    {osb f=tf field=bcc_list}
    {osb f=tf field=type}{$list->bool('setup_email_type',$VAR.setup_email_type,'form_menu')}
    + {t}If you select 'Yes', you will need to enter your SMTP server login details below.{/t} +
     
    {osb f=tf field=server}
    {osb f=tf field=username}
    {osb f=tf field=password}
     
    {osb f=tf field=piping}{$list->menu_staticlist('email_piping','setup_email_piping','setup_email_piping',$VAR.setup_email_piping,'form_menu')}
    {osb f=tf field=piping_host}
    {osb f=tf field=piping_username}
    {osb f=tf field=piping_password}
    {osb f=tf field=piping_action}{$list->menu_staticlist('email_piping_action','setup_email_piping_action','setup_email_piping_action',$VAR.setup_email_piping_action,'form_menu')}
    +
    +
    + +
    diff --git a/themes/default/blocks/setup_email/search_show.tpl b/themes/default/blocks/setup_email/search_show.tpl index 961214ec..2e593f28 100644 --- a/themes/default/blocks/setup_email/search_show.tpl +++ b/themes/default/blocks/setup_email/search_show.tpl @@ -1,129 +1,12 @@ +{assign var=meth value=':'|explode:$VAR._page} + - -{$method->exe("setup_email","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - {foreach from=$setup_email item=record} - - - - - - - - {literal} - - {/literal} - {/foreach} - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -
    - -   - {$record.name} -   - {if $record.type == "1"} - {translate} - true - {/translate} - {else} - {translate} - false - {/translate} - {/if} -   - {$record.from_name} -   - {$record.from_email} -
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    + {include file='file:../core/search_show_pre.tpl'} + {$method->exe_noauth($meth.0,'tpl_search_show',$search_show)} + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/setup_email/view.tpl b/themes/default/blocks/setup_email/view.tpl index 98d02dc4..7a61b5a9 100644 --- a/themes/default/blocks/setup_email/view.tpl +++ b/themes/default/blocks/setup_email/view.tpl @@ -1,281 +1,113 @@ -{ $method->exe("setup_email","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{assign var=meth value=':'|explode:$VAR._page} + -{literal} - - -{/literal} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} - -{foreach from=$setup_email item=setup_email} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=setup_email} - title_view - {/translate} -
    -
    - - - - - - - {if $list->is_installed("email_queue")} - - - - - {/if} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=setup_email} - field_name - {/translate} - - -
    - {translate module=setup_email} - field_queue - {/translate} - - { $list->bool("setup_email_queue", $setup_email.queue, "onChange=\"submit()\"") } -
    - {translate module=setup_email} - field_notes - {/translate} - - -
    - {translate module=setup_email} - field_from_name - {/translate} - - -
    - {translate module=setup_email} - field_from_email - {/translate} - - -
    - {translate module=setup_email} - field_cc_list - {/translate} - - -
    - {translate module=setup_email} - field_bcc_list - {/translate} - - -
    - {translate module=setup_email} - field_type - {/translate} - - { $list->bool("setup_email_type", $setup_email.type, "form_menu") } -
    - {translate module=setup_email} - smtp_help - {/translate} -
       
    - {translate module=setup_email} - field_server - {/translate} - - -
    - {translate module=setup_email} - field_username - {/translate} - - -
    - {translate module=setup_email} - field_password - {/translate} - - -
     
    - {translate module=setup_email} - field_piping - {/translate} - - -
    - {translate module=setup_email} - field_piping_host - {/translate} - - -
    - {translate module=setup_email} - field_piping_username - {/translate} - - -
    - {translate module=setup_email} - field_piping_password - {/translate} - - -
    - {translate module=setup_email} - field_piping_action - {/translate} - - -
    - - - -
    -
    -
    - - - - -
    - {/foreach} + +
    + + + + + +
    + + + + + + + + {include file='file:../core/view_tr_submit_delete.tpl'} +
    {osb f=tt}
    + + + + + + {if $list->is_installed('email_queue')} + + + + + {/if} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=name}
    {osb f=tf field=queue}{$list->bool('setup_email_queue',$record.queue,'" onChange="submit()')}
    {osb f=tf field=notes}
    {osb f=tf field=from_name}
    {osb f=tf field=from_email}
    {osb f=tf field=cc_list}
    {osb f=tf field=bcc_list}
    {osb f=tf field=type}{$list->bool('setup_email_type',$record.type)}
    + {t}If you select 'Yes', you will need to enter your SMTP server login details below.{/t} +
     
    {osb f=tf field=server}
    {osb f=tf field=username}
    {osb f=tf field=password}
     
    {osb f=tf field=piping}{$list->menu_staticlist('email_piping','setup_email_piping','setup_email_piping',$record.piping,'form_menu')} +
    {osb f=tf field=piping_host}
    {osb f=tf field=piping_username}
    {osb f=tf field=piping_password}
    {osb f=tf field=piping_action}{$list->menu_staticlist('email_piping_action','setup_email_piping_action','setup_email_piping_action',$record.piping_action,'form_menu')}
    +
    +
    + + {include file='file:../core/view_post.tpl'} +
    {/if} diff --git a/themes/default/blocks/setup_invoice/search_show.tpl b/themes/default/blocks/setup_invoice/search_show.tpl index 098a8c17..2e593f28 100644 --- a/themes/default/blocks/setup_invoice/search_show.tpl +++ b/themes/default/blocks/setup_invoice/search_show.tpl @@ -1,101 +1,12 @@ -{$method->exe("setup_invoice","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{assign var=meth value=':'|explode:$VAR._page} + + +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - - - - - - {foreach from=$setup_invoice item=record} - - - - - - {literal} - - {/literal} {/foreach} - - -
      - {literal} - - {/literal} - - {literal} - - {/literal} -
    - - {$record.id}{$record.news}
    -
    - -{if $VAR._print != TRUE}
    - -
    - - -
    -
    + {include file='file:../core/search_show_pre.tpl'} + {$method->exe_noauth($meth.0,'tpl_search_show',$search_show)} + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/setup_invoice/view.tpl b/themes/default/blocks/setup_invoice/view.tpl index 0bb567d6..d1f8cf71 100644 --- a/themes/default/blocks/setup_invoice/view.tpl +++ b/themes/default/blocks/setup_invoice/view.tpl @@ -1,189 +1,102 @@ -{ $method->exe("setup_invoice","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{assign var=meth value=':'|explode:$VAR._page} + -{literal} - - -{/literal} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} - -{foreach from=$setup_invoice item=setup_invoice} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=setup_invoice} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=setup_invoice} - field_bill_to_company - {/translate} - - { $list->bool("setup_invoice_bill_to_company", $setup_invoice.bill_to_company, "form_menu") } -
    - {translate module=setup_invoice} - field_invoice_currency - {/translate} - - -
    - {translate module=setup_invoice} - field_invoice_decimals - {/translate} - - -
    - {translate module=setup_invoice} - field_items_summary_max - {/translate} - - -
    - {translate module=setup_invoice} - field_contact_us_url - {/translate} - - -
    - {translate module=setup_invoice} - field_contact_us_phone - {/translate} - - -
    - {translate module=setup_invoice} - field_news - {/translate} - - -
    - {translate module=setup_invoice} - field_page_type - {/translate} - - -
    {translate module=setup_invoice} field_invoice_delivery {/translate} -
    {translate module=setup_invoice} field_invoice_show_itemized{/translate} { $list->bool("setup_invoice_invoice_show_itemized", $setup_invoice.invoice_show_itemized, "form_menu") }
    {translate module=setup_invoice} field_invoice_pdf_plugin{/translate} {html_menu_files path=invoice_pdf field=setup_invoice_invoice_pdf_plugin default=$setup_invoice.invoice_pdf_plugin}
    {translate module=setup_invoice} field_invoice_show_service_dates{/translate} { $list->bool("setup_invoice_invoice_show_service_dates", $setup_invoice.invoice_show_service_dates, "form_menu") }
    {translate module=setup_invoice} field_advance_notice{/translate}
     
    -
    -
    - - - - -
    - {/foreach} + +
    + + + + + +
    + + + + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=bill_to_company}{$list->bool('setup_invoice_bill_to_company',$record.bill_to_company)}
    {osb f=tf field=invoice_currency}
    {osb f=tf field=invoice_decimals}
    {osb f=tf field=items_summary_max}
    {osb f=tf field=news}
    {osb f=tf field=page_type}{osb f=html_menu_files name=setup_invoice_page_type path=invoice_pagetype default=$record.page_type}
    {osb f=tf field=invoice_delivery} + +
    {osb f=tf field=invoice_show_itemized}{$list->bool('setup_invoice_invoice_show_itemized',$record.invoice_show_itemized)}
    {osb f=tf field=invoice_pdf_plugin}{osb f=html_menu_files name=setup_invoice_invoice_pdf_plugin path=invoice_pdf default=$record.invoice_pdf_plugin}
    {osb f=tf field=invoice_show_service_dates}{$list->bool('setup_invoice_invoice_show_service_dates',$record.invoice_show_service_dates)}
    {osb f=tf field=invoice_advance_gen}
    {osb f=tf field=advance_notice}
    +
    + + + {include file='file:../core/view_td_submit.tpl'} + + +
     
    +
    +
    + + {include file='file:../core/view_post.tpl'} +
    {/if} diff --git a/themes/default/blocks/staff/add.tpl b/themes/default/blocks/staff/add.tpl index 9a600cdd..cd9d085a 100644 --- a/themes/default/blocks/staff/add.tpl +++ b/themes/default/blocks/staff/add.tpl @@ -1,107 +1,42 @@ - +{assign var=meth value=':'|explode:$VAR._page} + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=staff} - title_add - {/translate} -
    -
    - - - - - - - - - - - - - + - { if $list->is_installed('ticket') } - - - - - - - - - - - - - - - - - {else} - - {/if} - - - - - - -
    - {translate module=staff} - field_account_id - {/translate} - - {html_select_account name="staff_account_id" default=$VAR.staff_account_id} -
    - {translate module=staff} - field_nickname - {/translate} - - -
    - {translate module=staff} - field_department_avail - {/translate} - - { $list->check("", "staff_department_avail", "ticket_department", "name", $VAR.staff_department_avail, "") } -
    - {translate module=staff} - field_notify_new - {/translate} - - { $list->bool("staff_notify_new", $VAR.staff_notify_new, "form_menu") } -
    - {translate module=staff} - field_notify_change - {/translate} - - { $list->bool("staff_notify_change", $VAR.staff_notify_change, "form_menu") } -
    {translate module=staff}field_signature{/translate}{html_textarea name=staff_signature default=$VAR.staff_signature}
    - - - -
    -
    -
    -
    + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + {include file='file:../core/add_tr_submit.tpl'} +
    {osb f=tf field=account_id}{osb f=autoselect module=account return=id field=staff_account_id default=$VAR.staff_account_id}
    {osb f=tf field=nickname}
    +
    +
    + +
    + +
    + diff --git a/themes/default/blocks/staff/search_form.tpl b/themes/default/blocks/staff/search_form.tpl index 74ec2126..27b93e76 100644 --- a/themes/default/blocks/staff/search_form.tpl +++ b/themes/default/blocks/staff/search_form.tpl @@ -1,126 +1,54 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("staff","search_form") } -{ if ($method->result == FALSE) } - { $block->display("core:method_error") } +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=staff} - title_search - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=staff} - field_date_orig - {/translate} - - { $list->calender_search("staff_date_orig", $VAR.staff_date_orig, "form_field", "") } -
    - {translate module=staff} - field_account_id - {/translate} - - {html_select_account name="staff_account_id" default=$VAR.staff_account_id} -
    - {translate module=staff} - field_nickname - {/translate} - - -    - {translate} - search_partial - {/translate} -
    - {translate module=staff} - field_notify_new - {/translate} - - { $list->bool("staff_notify_new", "all", "form_menu") } -
    - {translate module=staff} - field_notify_change - {/translate} - - { $list->bool("staff_notify_change", "all", "form_menu") } -
    - {translate} - search_results_per - {/translate} - - -
    - {translate} - search_order_by - {/translate} - - -
    - - - - -
    -
    -
    -
    -{ $block->display("core:saved_searches") } -{ $block->display("core:recent_searches") } +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/search_post.tpl'} +
    {osb f=tf field=date_orig}{$list->calender_search('staff_date_orig',$VAR.staff_date_orig,'form_field','')}
    {osb f=tf field=account_id}{osb f=autoselect module=account return=id field=staff_account_id default=$VAR.staff_account_id}
    {osb f=tf field=nickname}  {t}"%" for partial match{/t}
    {osb f=tf field=notify_new}{$list->bool('staff_notify_new','all')}
    {osb f=tf field=notify_change}{$list->bool('staff_notify_change','all')}
    +
    +
    + +
    + + {$block->display('core:saved_searches')} + {$block->display('core:recent_searches')} {/if} diff --git a/themes/default/blocks/staff/search_show.tpl b/themes/default/blocks/staff/search_show.tpl index 7fb5302c..2e593f28 100644 --- a/themes/default/blocks/staff/search_show.tpl +++ b/themes/default/blocks/staff/search_show.tpl @@ -1,135 +1,12 @@ -{$method->exe("staff","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{assign var=meth value=':'|explode:$VAR._page} + + +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - {foreach from=$staff item=record} - - - - - - - - {literal} - - {/literal} - {/foreach} - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -
    - -   - {$record.nickname} -   - {$record.account_id} -   - {if $record.notify_new == "1"} - {translate} - true - {/translate} - {else} - {translate} - false - {/translate} - {/if} -   - {if $record.notify_change == "1"} - {translate} - true - {/translate} - {else} - {translate} - false - {/translate} - {/if} -
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    + {include file='file:../core/search_show_pre.tpl'} + {$method->exe_noauth($meth.0,'tpl_search_show',$search_show)} + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/staff/staff.tpl b/themes/default/blocks/staff/staff.tpl index 5f7193de..e835385c 100644 --- a/themes/default/blocks/staff/staff.tpl +++ b/themes/default/blocks/staff/staff.tpl @@ -1,145 +1,98 @@ +{assign var=meth value=':'|explode:$VAR._page} + + {if $form_validation} -{ $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=staff} - title_contact - {/translate} -
    -
    - - - - -
    - {translate module=staff} - contact_options - {/translate} -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $method->exe("staff","static_var")} - {foreach from=$static_var item=record} - - - - - {/foreach} - - - - - - - - - -
    - {translate module=staff} - contact_staff - {/translate} - - {if $VAR.mail_staff_id == ""} - { $list->menu("no", "mail_staff_id", "staff", "nickname", "all", "form_menu") } - {else} - { $list->menu("no", "mail_staff_id", "staff", "nickname", $VAR.mail_staff_id, "form_menu") } - {/if} -
    - {translate module=staff} - contact_department - {/translate} - - {if $VAR.mail_department_id == ""} - { $list->menu("no", "mail_department_id", "staff_department", "name", "all", "form_menu") } - {else} - { $list->menu("no", "mail_department_id", "staff_department", "name", $VAR.mail_department_id, "form_menu") } - {/if} -
    - {translate module=staff} - contact_name - {/translate} - - -
    - {translate module=staff} - contact_email - {/translate} - - -
    - {translate module=account_admin} - mail_subject - {/translate} - - -
    - {translate module=account_admin} - mail_message - {/translate} - - -
    - {$record.name} - - {$record.html} -
    - {translate module=account_admin} - mail_priority - {/translate} - - -
      - - - - -
    -
    -
    -
    - +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + +
    {t}To contact our staff, you may select their staff nickname below. + +If you do not know any staff in the department you wish to correspond with, simply select the recipient department instead, and your message will be forwarded to the appropriate staff member when you send your message. + +You do not need to select both a recipient department and recipient staff member; please just select one or the other.{/t}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + {$method->exe('staff','static_var')} + {foreach from=$static_var item=record} + + + + + {/foreach} + + + + + + + + + +
    {t}contact_staff{/t} + {if $VAR.mail_staff_id == ''} + {$list->menu('no','mail_staff_id','staff','nickname','','form_menu',true)} + {else} + {$list->menu('no','mail_staff_id','staff','nickname',$VAR.mail_staff_id,'form_menu')} + {/if} +
    {t}contact_department{/t} + {if $VAR.mail_department_id == ''} + {$list->menu('no','mail_department_id','staff_department','name','','form_menu')} + {else} + {$list->menu('no','mail_department_id','staff_department','name',$VAR.mail_department_id,'form_menu')} + {/if} +
    {t}contact_name{/t}
    {t}contact_email{/t}
    {t}mail_subject{/t}
    {t}mail_message{/t}
    {$record.name}{$record.html}
    {t}mail_priority{/t}{$list->bool('mail_priority','')}
     
    +
    +
    + +
    + + + +
    + +
    diff --git a/themes/default/blocks/staff/view.tpl b/themes/default/blocks/staff/view.tpl index c63fd6a6..27223e41 100644 --- a/themes/default/blocks/staff/view.tpl +++ b/themes/default/blocks/staff/view.tpl @@ -1,194 +1,58 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("staff","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} -{literal} - - -{/literal} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - -{foreach from=$staff item=staff} + +
    - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - - - - - - - -
    - - - - - - - -
    -
    - {translate module=staff} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - - - { if $list->is_installed('ticket') } - - - - - - - - - - - - - - - {else} - - {/if} - - - - - - - -
    - {translate module=staff} - field_date_orig - {/translate} - - { $list->date_time($staff.date_orig) } -
    - {translate module=staff} - field_account_id - {/translate} - - {html_select_account name="staff_account_id" default=$staff.account_id} -
    - {translate module=staff} - field_nickname - {/translate} - - -
    - {translate module=staff} - field_department_avail - {/translate} - - { $list->check("", "staff_department_avail", "ticket_department", "name", $staff.department_avail, "") } -
    - {translate module=staff} - field_notify_new - {/translate} - - { $list->bool("staff_notify_new", $staff.notify_new, "form_menu") } -
    - {translate module=staff} - field_notify_change - {/translate} - - { $list->bool("staff_notify_change", $staff.notify_change, "form_menu") } -
    {translate module=staff}field_signature{/translate}{html_textarea name=staff_signature default=$staff.signature} -
    -
    -
    - - - - -
    - -{ if $list->is_installed('ticket') } -
    - - - - - - - - -
    -
    - {translate module=staff} - view_tickets - {/translate} -
    -
    - - - - - -
    - - - - - -
    - -  
    -
    -
    - - - - -
    -{/if} - -{/foreach} + + + + +
    + + + + + + + + {include file='file:../core/view_tr_submit_delete.tpl'} +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + +
    {osb f=tf module=staff field=date_orig}{$list->date_time($record.date_orig)}
    {osb f=tf module=staff field=account_id}{osb f=autoselect module=account return=id field=staff_account_id default=$record.account_id}
    {osb f=tf module=staff field=nickname}
    {osb f=tf field=signature}{html_textarea name=staff_signature default=$record.signature limit=50}
    +
    +
    + + {include file='file:../core/view_post.tpl'} +
    + +
    + {/if} diff --git a/themes/default/blocks/staff_department/add.tpl b/themes/default/blocks/staff_department/add.tpl index 5fefdfa0..e4159acc 100644 --- a/themes/default/blocks/staff_department/add.tpl +++ b/themes/default/blocks/staff_department/add.tpl @@ -1,77 +1,47 @@ - +{assign var=meth value=':'|explode:$VAR._page} + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} -
    + - - - - -
    - - - - - - - -
    -
    - {translate module=staff_department}title_add{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=staff_department} - field_name - {/translate} - -
    - {translate module=staff_department} - field_description - {/translate} - -
    - {translate module=staff_department} - field_default_staff_id - {/translate} - { $list->menu("", "staff_department_default_staff_id", "staff", "nickname", $VAR.staff_department_default_staff_id, "form_menu") } -
    - {translate module=staff_department} - field_contact_display - {/translate} - { $list->bool("staff_department_contact_display", $VAR.staff_department_contact_display, "form_menu") } -
    - - - - -
    -
    -
    -
    + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + {include file='file:../core/add_tr_submit.tpl'} +
    {osb f=tf field=name}
    {osb f=tf field=description}
    {osb f=tf field=default_staff_id}{$list->menu('','staff_department_default_staff_id','staff','nickname',$VAR.staff_department_default_staff_id,'form_menu')}
    {osb f=tf field=contact_display}{$list->bool('staff_department_contact_display',$VAR.staff_department_contact_display,'form_menu')}
    +
    +
    + + diff --git a/themes/default/blocks/staff_department/search_form.tpl b/themes/default/blocks/staff_department/search_form.tpl index a3f40559..ecc09507 100644 --- a/themes/default/blocks/staff_department/search_form.tpl +++ b/themes/default/blocks/staff_department/search_form.tpl @@ -1,98 +1,50 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("staff_department","search_form") } -{ if ($method->result == FALSE) } - { $block->display("core:method_error") } +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} -
    - - - - - -
    - - - - - - - - - -
    -
    - {translate module=staff_department}title_search{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - + - - - - - +
    - {translate module=staff_department} - field_name - {/translate} -   {translate}search_partial{/translate} -
    - {translate module=staff_department} - field_description - {/translate} -   {translate}search_partial{/translate} -
    - {translate module=staff_department} - field_default_staff_id - {/translate} - { $list->menu("", "staff_department_default_staff_id", "staff", "name", "all", "form_menu") } -
    - {translate module=staff_department} - field_contact_display - {/translate} - { $list->bool("staff_department_contact_display", "all", "form_menu") } -
    {translate}search_results_per{/translate} - -
    {translate}search_order_by{/translate} - -
    + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + {include file='file:../core/search_post.tpl'} +
    {osb f=tf field=name}  {t}"%" for partial match{/t}
    {osb f=tf field=description}  {t}"%" for partial match{/t}
    {osb f=tf field=default_staff_id}{$list->menu('','staff_department_default_staff_id','staff','name','','form_menu',true)}
    {osb f=tf field=contact_display}{$list->bool('staff_department_contact_display','all')}
    +
    +
    -
    - - - - -
    -
    -
    - -{ $block->display("core:saved_searches") } -{ $block->display("core:recent_searches") } + + + {$block->display('core:saved_searches')} + {$block->display('core:recent_searches')} {/if} diff --git a/themes/default/blocks/staff_department/search_show.tpl b/themes/default/blocks/staff_department/search_show.tpl index 8fc7aaf7..2e593f28 100644 --- a/themes/default/blocks/staff_department/search_show.tpl +++ b/themes/default/blocks/staff_department/search_show.tpl @@ -1,111 +1,12 @@ +{assign var=meth value=':'|explode:$VAR._page} + - -{$method->exe("staff_department","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - - {foreach from=$staff_department item=record} - - - - - - - - - - {literal} - - {/literal} - {/foreach} - - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -
    - -  {$record.name} {$record.default_staff_id} {if $record.contact_display == "1"}{translate}true{/translate}{else}{translate}false{/translate}{/if}
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    + {include file='file:../core/search_show_pre.tpl'} + {$method->exe_noauth($meth.0,'tpl_search_show',$search_show)} + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/staff_department/view.tpl b/themes/default/blocks/staff_department/view.tpl index af7a0600..cf68ad2d 100644 --- a/themes/default/blocks/staff_department/view.tpl +++ b/themes/default/blocks/staff_department/view.tpl @@ -1,131 +1,55 @@ -{ $method->exe("staff_department","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{assign var=meth value=':'|explode:$VAR._page} + -{literal} - - -{/literal} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} - -{foreach from=$staff_department item=staff_department} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=staff_department}title_view{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=staff_department} - field_name - {/translate} - -
    - {translate module=staff_department} - field_description - {/translate} - -
    - {translate module=staff_department} - field_default_staff_id - {/translate} - { $list->menu("", "staff_department_default_staff_id", "staff", "nickname", $staff_department.default_staff_id, "form_menu") } -
    - {translate module=staff_department} - field_contact_display - {/translate} - { $list->bool("staff_department_contact_display", $staff_department.contact_display, "form_menu") } -
    - - - - - -
    - - - -
    -
    -
    -
    - - - - -
    - {/foreach} + +
    + + + + + +
    + + + + + + + + {include file='file:../core/view_tr_submit_delete.tpl'} +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + +
    {osb f=tf module=staff_department field=name}
    {osb f=tf module=staff_department field=description}
    {osb f=tf module=staff_department field=default_staff_id}{$list->menu('','staff_department_default_staff_id','staff','nickname',$record.default_staff_id,'form_menu')}
    {osb f=tf module=staff_department field=contact_display}{$list->bool('staff_department_contact_display',$record.contact_display)}
    +
    +
    + + {include file='file:../core/view_post.tpl'} +
    {/if} diff --git a/themes/default/blocks/static_page/add.tpl b/themes/default/blocks/static_page/add.tpl index 88c48bdf..761e5961 100644 --- a/themes/default/blocks/static_page/add.tpl +++ b/themes/default/blocks/static_page/add.tpl @@ -1,121 +1,71 @@ - +{assign var=meth value=':'|explode:$VAR._page} + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} -
    -{$COOKIE_FORM} - - - - -
    - - - - - - - -
    -
    - {translate module=static_page}title_add{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=static_page} - field_sort_order - {/translate} - - -
    - {translate module=static_page} - field_date_start - {/translate} - - {if $VAR.static_page_date_start != "" } - { $list->calender_add("static_page_date_start", $VAR.static_page_date_start, "form_field") } - {else} - { $list->calender_add("static_page_date_start", "now", "form_field") } - {/if} -
    - {translate module=static_page} - field_date_expire - {/translate} - - { $list->calender_add("static_page_date_expire", $VAR.static_page_date_expire, "form_field") } -
    - {translate module=static_page} - field_static_page_category_id - {/translate} - - { $list->menu("", "static_page_static_page_category_id", "static_page_category", "name", $VAR.static_page_static_page_category_id, "form_menu") } -
    - {translate module=static_page} - field_status - {/translate} - - {if $VAR.static_page_status != ""} - { $list->bool("static_page_status", $VAR.static_page_status, "form_menu") } - {else} - { $list->bool("static_page_status", "1", "form_menu") } - {/if} -
    - {translate module=static_page} - field_name - {/translate} - - -
    - {translate module=static_page} - field_description - {/translate} - - -
    - - - - - - -
    -
    -
    -
    +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/add_tr_submit.tpl'} +
    {osb f=tf field=sort_order}
    {osb f=tf field=date_start} + {if $VAR.static_page_date_start != ''} + {$list->calender_add('static_page_date_start',$VAR.static_page_date_start,'form_field')} + {else} + {$list->calender_add('static_page_date_start','now','form_field')} + {/if} +
    {osb f=tf field=date_expire}{$list->calender_add('static_page_date_expire',$VAR.static_page_date_expire,'form_field')}
    {osb f=tf field=static_page_category_id}{$list->menu('','static_page_static_page_category_id','static_page_category','name',$VAR.static_page_static_page_category_id,'form_menu')}
    {osb f=tf field=status} + {if $VAR.static_page_status != ''} + {$list->bool('static_page_status',$VAR.static_page_status,'form_menu')} + {else} + {$list->bool('static_page_status','1','form_menu')} + {/if} +
    {osb f=tf field=name}
    {osb f=tf field=description}
    +
    +
    + +
    diff --git a/themes/default/blocks/static_page/list.tpl b/themes/default/blocks/static_page/list.tpl deleted file mode 100644 index 20e215ba..00000000 --- a/themes/default/blocks/static_page/list.tpl +++ /dev/null @@ -1,36 +0,0 @@ -{ $method->exe("static_page","page_list")} { if ($method->result == FALSE) } { $block->display("core:method_error") } {/if} -{if $static_page_display == true} -{foreach from=$static_page_results item=record} - - - - -
    - - - - - - - -
    - {$record.title} -
    - - - - -
    - {$record.intro} -
    -
    -
    -
    -{/foreach} -{else} - -{translate module=static_page} - no_pages -{/translate} - -{/if} diff --git a/themes/default/blocks/static_page/menu.tpl b/themes/default/blocks/static_page/menu.tpl deleted file mode 100644 index 6308727c..00000000 --- a/themes/default/blocks/static_page/menu.tpl +++ /dev/null @@ -1,30 +0,0 @@ -{ $method->exe("static_page_category","category_list")} { if ($method->result == FALSE) } { $block->display("core:method_error") } {/if} -{if $static_page_category_display == true} - - - - - -
    -{/if} diff --git a/themes/default/blocks/static_page/page_list.tpl b/themes/default/blocks/static_page/page_list.tpl new file mode 100644 index 00000000..c13623bf --- /dev/null +++ b/themes/default/blocks/static_page/page_list.tpl @@ -0,0 +1,36 @@ +{assign var=meth value=':'|explode:$VAR._page} + + +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + + {if $static_page_display == true} + {foreach from=$static_page_results item=record} + + + + +
    + + + + + + + +
    {$record.title}
    + + + + +
    {$record.intro}
    +
    +
    +
    + {/foreach} + {else} + {t}Sorry, no pages were found in this category, or your account is not authorized for this category.{/t} + {/if} +{/if} diff --git a/themes/default/blocks/static_page/page_show.tpl b/themes/default/blocks/static_page/page_show.tpl new file mode 100644 index 00000000..fe3b5331 --- /dev/null +++ b/themes/default/blocks/static_page/page_show.tpl @@ -0,0 +1,22 @@ +{assign var=meth value=':'|explode:$VAR._page} + + +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + + {if $static_page_display == true} + + + + + + + +
    {$static_page_results.title}
    {$static_page_results.body}
    + {else} + {t}Sorry, the requested page was not found, or you do not have the required level of authorisation to view it.{/t} + {/if} + +{/if} diff --git a/themes/default/blocks/static_page/search_form.tpl b/themes/default/blocks/static_page/search_form.tpl index a6417db0..050f437f 100644 --- a/themes/default/blocks/static_page/search_form.tpl +++ b/themes/default/blocks/static_page/search_form.tpl @@ -1,131 +1,61 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("static_page","search_form") } -{ if ($method->result == FALSE) } - { $block->display("core:method_error") } +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} -
    - {$COOKIE_FORM} - - - - -
    - - - - - - - - - - - - - - - - - - - - -
    -
    - {translate module=static_page}title_search{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +
    - {translate module=static_page} - field_name - {/translate} -   {translate}search_partial{/translate} -
    - {translate module=static_page} - field_description - {/translate} -   {translate}search_partial{/translate} -
    - {translate module=static_page} - field_static_page_category_id - {/translate} - - { $list->menu("", "static_page_static_page_category_id", "static_page_category", "name", "all", "form_menu") } -
    - {translate module=static_page} - field_status - {/translate} - { $list->bool("static_page_status", "all", "form_menu") } -
    - {translate module=static_page} - field_date_orig - {/translate} - { $list->calender_search("static_page_date_orig", $VAR.static_page_date_orig, "form_field", "") } -
    - {translate module=static_page} - field_date_last - {/translate} - { $list->calender_search("static_page_date_last", $VAR.static_page_date_last, "form_field", "") } -
    - {translate module=static_page} - field_date_expire - {/translate} - { $list->calender_search("static_page_date_expire", $VAR.static_page_date_expire, "form_field", "") } -
    + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/search_post.tpl'} +
    {osb f=tf field=name}  {t}"%" for partial match{/t}
    {osb f=tf field=description}  {t}"%" for partial match{/t}
    {osb f=tf field=static_page_category_id}{$list->menu('','static_page_static_page_category_id','static_page_category','name','','form_menu',true)}
    {osb f=tf field=status}{$list->bool('static_page_status','all','form_menu')}
    {osb f=tf field=date_orig}{$list->calender_search('static_page_date_orig',$VAR.static_page_date_orig,'form_field','')}
    {osb f=tf field=date_last}{$list->calender_search('static_page_date_last',$VAR.static_page_date_last,'form_field','')}
    {osb f=tf field=date_expire}{$list->calender_search('static_page_date_expire',$VAR.static_page_date_expire,'form_field','')}
    +
    +
    + - -
    {translate}search_results_per{/translate} - -
    {translate}search_order_by{/translate} - -
    - - - - -
    -
    -
    - -{ $block->display("core:saved_searches") } -{ $block->display("core:recent_searches") } + {$block->display('core:saved_searches')} + {$block->display('core:recent_searches')} {/if} diff --git a/themes/default/blocks/static_page/search_show.tpl b/themes/default/blocks/static_page/search_show.tpl index 89ea9593..2e593f28 100644 --- a/themes/default/blocks/static_page/search_show.tpl +++ b/themes/default/blocks/static_page/search_show.tpl @@ -1,114 +1,12 @@ +{assign var=meth value=':'|explode:$VAR._page} + - -{$method->exe("static_page","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - {foreach from=$static_page item=record} - - - - - - - - {literal} - - {/literal} - {/foreach} - -
      - {literal} - - {/literal} - - {literal} - - {/literal} -    
    - -   - {$record.name} -   - {$record.static_page_category_id} - - {if $record.status == "1"} - - {else} - - {/if} - - -
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    + {include file='file:../core/search_show_pre.tpl'} + {$method->exe_noauth($meth.0,'tpl_search_show',$search_show)} + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    - \ No newline at end of file diff --git a/themes/default/blocks/static_page/show.tpl b/themes/default/blocks/static_page/show.tpl deleted file mode 100644 index 98733af6..00000000 --- a/themes/default/blocks/static_page/show.tpl +++ /dev/null @@ -1,34 +0,0 @@ - { $method->exe("static_page","page_show")} - { if ($method->result == FALSE) } - { $block->display("core:method_error") } - {/if} - {if $static_page_display == true} -
    - - - - - - - -
    - - - - - -
    - - {$static_page_results.title} -
    - -
    - {$static_page_results.body} -
    - -
    -

    - -{else} -{translate module=static_page}page_not_found{/translate} -{/if} diff --git a/themes/default/blocks/static_page/view.tpl b/themes/default/blocks/static_page/view.tpl index 624ff969..6888d406 100644 --- a/themes/default/blocks/static_page/view.tpl +++ b/themes/default/blocks/static_page/view.tpl @@ -1,208 +1,86 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("static_page","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} +{include file='file:../core/view_pre.tpl'} -{literal} - - -{/literal} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - -{foreach from=$static_page item=static_page} + +
    - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - - -{$COOKIE_FORM} - - - - -
    - - - - - - - - - - -
    -
    - {translate module=static_page} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=static_page} - field_date_orig - {/translate} - - {$list->date_time($static_page.date_orig)} -
    - {translate module=static_page} - field_date_orig - {/translate} - - {$list->date_time($static_page.date_orig)} -
    - {translate module=static_page} - field_sort_order - {/translate} - - -
    - {translate module=static_page} - field_date_start - {/translate} - - { $list->calender_view("static_page_date_start", $static_page.date_start, "form_field", $static_page.id) } -
    - {translate module=static_page} - field_date_expire - {/translate} - - { $list->calender_view("static_page_date_expire", $static_page.date_expire, "form_field", $static_page.id) } -
    - {translate module=static_page} - field_static_page_category_id - {/translate} - - { $list->menu("", "static_page_static_page_category_id", "static_page_category", "name", $static_page.static_page_category_id, "form_menu") } -
    - {translate module=static_page} - field_status - {/translate} - - { $list->bool("static_page_status", $static_page.status, "form_menu") } -
    - {translate module=static_page} - field_name - {/translate} - - -
    - {translate module=static_page} - field_description - {/translate} - - -
    - - - - - -
    - - - -
    -
    -
    - - - - - - -
    - {translate module=static_page} - view_all - {/translate} - - {translate module=static_page} - add_translation - {/translate} - - - {translate module=static_page} - preview - {/translate} -
    -
    -
    - - - - - -
    - {/foreach} + + + + +
    + + + + + + + + {include file='file:../core/view_tr_submit_delete.tpl'} + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=date_orig}{$list->date($record.date_orig)}
    {osb f=tf field=date_last}{$list->date($record.date_last)}
    {osb f=tf field=sort_order}
    {osb f=tf field=date_start}{$list->calender_view('static_page_date_start',$record.date_start,'form_field')}
    {osb f=tf field=date_expire}{$list->calender_view('static_page_date_expire',$record.date_expire,'form_field')}
    {osb f=tf field=static_page_category_id}{$list->menu('','static_page_static_page_category_id','static_page_category','name',$record.static_page_category_id,'form_menu')}
    {osb f=tf field=status}{$list->bool('static_page_status',$record.status,'form_menu')}
    {osb f=tf field=name}
    {osb f=tf field=description}
    +
    + + + + + + +
    {t}View all translations for this page{/t}{t}Add a translations for this page{/t}{t}Preview page{/t}
    +
    +
    + + {include file='file:../core/view_post.tpl'} + {/if} diff --git a/themes/default/blocks/static_page_category/add.tpl b/themes/default/blocks/static_page_category/add.tpl index 14aeccc8..9955325d 100644 --- a/themes/default/blocks/static_page_category/add.tpl +++ b/themes/default/blocks/static_page_category/add.tpl @@ -1,91 +1,52 @@ - +{assign var=meth value=':'|explode:$VAR._page} + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} -
    -{$COOKIE_FORM} - - - - -
    - - - - - - - -
    -
    - {translate module=static_page_category}title_add{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=static_page_category} - field_group_avail - {/translate} - - { $list->menu_multi($VAR.static_page_category_group_avail, 'static_page_category_group_avail', 'group', 'name', '', '10', 'form_menu') } -
    - {translate module=static_page_category} - field_name - {/translate} - - -
    - {translate module=static_page_category} - field_description - {/translate} - - -
    - {translate module=static_page_category} - field_status - {/translate} - - { $list->bool("static_page_category_status", $VAR.static_page_category_status, "form_menu") } -
    - {translate module=static_page_category} - field_sort_order - {/translate} - - -
    - - - - -
    -
    -
    -
    +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/add_tr_submit.tpl'} +
    {osb f=tf field=name}
    {osb f=tf field=group_avail}{$list->menu_multi($VAR.static_page_category_group_avail,'static_page_category_group_avail','group','name','','10','form_menu') } +
    {osb f=tf field=description}
    {osb f=tf field=status}{$list->bool('static_page_category_status',$VAR.static_page_category_status,'form_menu')}
    {osb f=tf field=sort_order}
    +
    +
    + +
    diff --git a/themes/default/blocks/static_page_category/main.tpl b/themes/default/blocks/static_page_category/main.tpl deleted file mode 100644 index f9d9bb63..00000000 --- a/themes/default/blocks/static_page_category/main.tpl +++ /dev/null @@ -1,27 +0,0 @@ - - - - - -
    - - - - - - - -
    -
    - {translate module=static_page_category} - menu - {/translate} -
    -
    - - - - -
    {translate module=static_page_category}help_file{/translate}
    -
    -
    diff --git a/themes/default/blocks/static_page_category/menu.tpl b/themes/default/blocks/static_page_category/menu.tpl new file mode 100644 index 00000000..92064009 --- /dev/null +++ b/themes/default/blocks/static_page_category/menu.tpl @@ -0,0 +1,28 @@ +{assign var=meth value=':'|explode:$VAR._page} + + +{$method->exe_noauth($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + + {if $static_page_category_display == true} + + + + + +
    + {/if} +{/if} diff --git a/themes/default/blocks/static_page_category/search_form.tpl b/themes/default/blocks/static_page_category/search_form.tpl deleted file mode 100644 index 739f888f..00000000 --- a/themes/default/blocks/static_page_category/search_form.tpl +++ /dev/null @@ -1,62 +0,0 @@ - -{ $method->exe("static_page_category","search_form") } -{ if ($method->result == FALSE) } - { $block->display("core:method_error") } -{else} - -
    - {$COOKIE_FORM} - - - - -
    - - - - - - - -
    -
    - {translate module=static_page_category}title_search{/translate} -
    -
    - - - - - - - - - - - - - - - - - -
    {translate}search_results_per{/translate} - -
    {translate}search_order_by{/translate} - -
    - - - - -
    -
    -
    -
    -{ $block->display("core:saved_searches") } -{ $block->display("core:recent_searches") } -{/if} diff --git a/themes/default/blocks/static_page_category/search_show.tpl b/themes/default/blocks/static_page_category/search_show.tpl index 3a530346..98cefe28 100644 --- a/themes/default/blocks/static_page_category/search_show.tpl +++ b/themes/default/blocks/static_page_category/search_show.tpl @@ -1,119 +1,12 @@ +{assign var=meth value=':'|explode:$VAR._page} + - -{$method->exe("static_page_category","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - {foreach from=$static_page_category item=record} - - - - - - - {literal} - - {/literal} - {/foreach} - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -
    - -   - {$record.name} -   - {if $record.status == "1"} - {translate} - true - {/translate} - {else} - {translate} - false - {/translate} - {/if} - - {$record.sort_order} -
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    + {include file='file:../core/search_show_pre.tpl'} + {$method->exe_noauth($meth.0,'tpl_search_show',$search_show)} + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/static_page_category/view.tpl b/themes/default/blocks/static_page_category/view.tpl index 6217d14a..82203bc5 100644 --- a/themes/default/blocks/static_page_category/view.tpl +++ b/themes/default/blocks/static_page_category/view.tpl @@ -1,154 +1,63 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("static_page_category","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} -{literal} - - -{/literal} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - -{foreach from=$static_page_category item=static_page_category} + +
    - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - - -{$COOKIE_FORM} - - - - -
    - - - - - - - -
    -
    - {translate module=static_page_category} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=static_page_category} - field_date_orig - {/translate} - - {$list->date_time("")} - -
    - {translate module=static_page_category} - field_group_avail - {/translate} - - { $list->menu_multi($static_page_category.group_avail, 'static_page_category_group_avail', 'group', 'name', '', '10', 'form_menu') } -
    - {translate module=static_page_category} - field_name - {/translate} - - -
    - {translate module=static_page_category} - field_description - {/translate} - - -
    - {translate module=static_page_category} - field_status - {/translate} - - { $list->bool("static_page_category_status", $static_page_category.status, "form_menu") } -
    - {translate module=static_page_category} - field_sort_order - {/translate} - - -
    - - - - - -
    - - - -
    -
    -
    -
    - - - - -
    - {/foreach} + + + + +
    + + + + + + + + {include file='file:../core/view_tr_submit_delete.tpl'} +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=date_orig}{$list->date($record.date_orig)}
    {osb f=tf field=group_avail}{$list->menu_multi($record.group_avail,'static_page_category_group_avail','group','name','','10','form_menu')}
    {osb f=tf field=name}
    {osb f=tf field=description}
    {osb f=tf field=status}{$list->bool('static_page_category_status',$record.status,'form_menu')}
    {osb f=tf field=sort_order}
    +
    +
    + + {include file='file:../core/view_post.tpl'} + {/if} diff --git a/themes/default/blocks/static_page_translate/add.tpl b/themes/default/blocks/static_page_translate/add.tpl index 76e9c22a..ee3660b4 100644 --- a/themes/default/blocks/static_page_translate/add.tpl +++ b/themes/default/blocks/static_page_translate/add.tpl @@ -1,128 +1,75 @@ -{literal} - - -{/literal} +{assign var=meth value=':'|explode:$VAR._page} + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} + + + + -
    -{$COOKIE_FORM} - - - - -
    - - - - - - - -
    -
    - {translate module=static_page_translate} - title_add - {/translate} -
    -
    - - - - - - - - - - - - - -
    - {translate module=static_page_translate} - field_static_page_id - {/translate} - - {if $VAR.id == ""} - { $list->menu("", "static_page_translate_static_page_id", "static_page", "name", $VAR.static_page_translate_static_page_id, "form_menu") } - {else} - { $list->menu("", "static_page_translate_static_page_id", "static_page", "name", $VAR.id, "form_menu") } - {/if} -
    - {translate module=static_page_translate} - field_language_id - {/translate} - - {if $VAR.static_page_translate_language_id == ""} - { $list->menu_files("", "static_page_translate_language_id", $smarty.const.DEFAULT_LANGUAGE, "language", "", "_core.xml", "form_menu") } - {else} - { $list->menu_files("", "static_page_translate_language_id", $VAR.static_page_translate_language_id, "language", "", "_core.xml", "form_menu") } - {/if} -
    - {translate module=static_page_translate} - field_title - {/translate} - - -
    - - - - - - - - - - - - - -
    - {translate module=static_page_translate} - field_body_intro - {/translate} -
    - -
    - {translate module=static_page_translate} - field_body_full - {/translate} -
    - -
    -

    - - - - - - -

    -
    -
    -
    +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + +
    {osb f=tf field=static_page_id} + {if $VAR.id == ''} + {$list->menu('','static_page_translate_static_page_id','static_page','name',$VAR.static_page_translate_static_page_id,'form_menu')} + {else} + {$list->menu('','static_page_translate_static_page_id','static_page','name',$VAR.id,'form_menu')} + {/if} +
    {osb f=tf field=language_id} + {if $VAR.static_page_translate_language_id == ''} + {$list->menu_files('','static_page_translate_language_id',$smarty.const.DEFAULT_LANGUAGE,'language','','_core.xml','form_menu')} + {else} + {$list->menu_files('','static_page_translate_language_id',$VAR.static_page_translate_language_id,'language','','_core.xml','form_menu')} + {/if} +
    {osb f=tf field=title}
    + + + + + + + + + + + + + +
    {osb f=tf field=body_intro}
    {osb f=tf field=body_full}
    + + {include file='file:../core/add_tr_submit.tpl'} +
    +
    +
    + +
    diff --git a/themes/default/blocks/static_page_translate/search_show.tpl b/themes/default/blocks/static_page_translate/search_show.tpl index bda665ba..2e593f28 100644 --- a/themes/default/blocks/static_page_translate/search_show.tpl +++ b/themes/default/blocks/static_page_translate/search_show.tpl @@ -1,120 +1,12 @@ +{assign var=meth value=':'|explode:$VAR._page} + - -{$method->exe("static_page_translate","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - - {foreach from=$static_page_translate item=record} - - - - - - - - - - - - - {literal} - - {/literal} - {/foreach} - - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -
    - -   - {$record.static_page_id} -   - {$record.language_id} -   - {$record.title|truncate:"40"} -
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    + {include file='file:../core/search_show_pre.tpl'} + {$method->exe_noauth($meth.0,'tpl_search_show',$search_show)} + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/static_page_translate/view.tpl b/themes/default/blocks/static_page_translate/view.tpl index 75e4593c..461a3910 100644 --- a/themes/default/blocks/static_page_translate/view.tpl +++ b/themes/default/blocks/static_page_translate/view.tpl @@ -1,188 +1,83 @@ -{literal} - - -{/literal} +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("static_page_translate","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} -{literal} - - {/literal} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - -{foreach from=$static_page_translate item=static_page_translate} + + + - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - -
    - - - - -
    - - - - - - - - - - -
    -
    - {translate module=static_page_translate} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - -
    - {translate module=static_page_translate} - field_static_page_id - {/translate} - - { $list->menu("", "static_page_translate_static_page_id", "static_page", "name", $static_page_translate.static_page_id, "form_menu") } -
    - {translate module=static_page_translate} - field_language_id - {/translate} - - { $list->menu_files("", "static_page_translate_language_id", $static_page_translate.language_id, "language", "", "_core.xml", "form_menu") } -
    - {translate module=static_page_translate} - field_title - {/translate} - - -
    -
    - - - - - - - - - - - - - - - - -
    - {translate module=static_page_translate} - field_body_intro - {/translate} -
    - -
     
    - {translate module=static_page_translate} - field_body_full - {/translate} -
    - -
    -
    - - - - - - - - - -
    - - - - - -
    - {translate module=static_page_translate} - view_all - {/translate} - - {translate module=static_page_translate} - return - {/translate} -
    -
    -
    - - - - - -
    - {/foreach} + +
    + + + + + +
    + + + + + + + + {include file='file:../core/view_tr_submit_delete.tpl'} + + + +
    {osb f=tt}
    + + + + + + + + + + + + + +
    {osb f=tf field=static_page_id}{$list->menu('','static_page_translate_static_page_id','static_page','name',$record.static_page_id,'form_menu')}
    {osb f=tf field=language_id}{$list->menu_files('','static_page_translate_language_id',$record.language_id,'language','','_core.xml','form_menu')}
    {osb f=tf field=title}
    +
    + + + + + + + + + + + + + + + + +
    {osb f=tf field=body_intro}
     
    {osb f=tf field=body_full}
    +
    + + + + + +
    {t}View all translations for this page{/t}{t}Return to main page view{/t}
    +
    +
    + + {include file='file:../core/view_post.tpl'} +
    {/if} diff --git a/themes/default/blocks/static_relation/add.tpl b/themes/default/blocks/static_relation/add.tpl index 5abeec3e..fdf64a48 100644 --- a/themes/default/blocks/static_relation/add.tpl +++ b/themes/default/blocks/static_relation/add.tpl @@ -1,104 +1,55 @@ -{ $block->display("core:top_clean") } +{assign var=meth value=':'|explode:$VAR._page} + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=static_relation} - title_add - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=static_relation} - field_static_var_id - {/translate} - - { $list->menu("no", "static_relation_static_var_id", "static_var", "name", $VAR.static_relation_static_var_id, "form_menu") } -
    - {translate module=static_relation} - field_module_id - {/translate} - - { $list->menu("no", "static_relation_module_id", "module", "name", $VAR.static_relation_module_id, "form_menu") } -
    - {translate module=static_relation} - field_default_value - {/translate} - - -
    - {translate module=static_relation} - field_description - {/translate} - - -
    - {translate module=static_relation} - field_required - {/translate} - - { $list->bool("static_relation_required",$VAR.static_relation_required, "form_menu") } -
    - {translate module=static_relation} - field_sort_order - {/translate} - - -
    - - - - -
    -
    -
    -
    +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/add_tr_submit.tpl'} +
    {osb f=tf field=static_var_id}{$list->menu('no','static_relation_static_var_id','static_var','name',$VAR.static_relation_static_var_id,'form_menu')}
    {osb f=tf field=module_id}{$list->menu('no','static_relation_module_id','module','name',$VAR.static_relation_module_id,'form_menu')}
    {osb f=tf field=default_value}
    {osb f=tf field=description}
    {osb f=tf field=required}{$list->bool('static_relation_required',$VAR.static_relation_required)}
    {osb f=tf field=sort_order}
    +
    +
    + +
    diff --git a/themes/default/blocks/static_relation/search_show.tpl b/themes/default/blocks/static_relation/search_show.tpl index 1ed697bb..2e593f28 100644 --- a/themes/default/blocks/static_relation/search_show.tpl +++ b/themes/default/blocks/static_relation/search_show.tpl @@ -1,113 +1,12 @@ -{ $block->display("core:top_clean") } +{assign var=meth value=':'|explode:$VAR._page} + -{$method->exe("static_relation","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - - {foreach from=$static_relation item=record} - - - - - - - - {literal} - - {/literal} - {/foreach} - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -
    - -   - {$record.static_var_id} -   - {$record.module_id} -   - {$record.sort_order} -   - {$record.default_value} -
    -
    - - {/if} -
    + {include file='file:../core/search_show_pre.tpl'} + {$method->exe_noauth($meth.0,'tpl_search_show',$search_show)} + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} +{/if} diff --git a/themes/default/blocks/static_relation/view.tpl b/themes/default/blocks/static_relation/view.tpl index 84944edb..2f0234aa 100644 --- a/themes/default/blocks/static_relation/view.tpl +++ b/themes/default/blocks/static_relation/view.tpl @@ -1,155 +1,66 @@ -{ $block->display("core:top_clean") } +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("static_relation","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else}
    +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} +{include file='file:../core/view_pre.tpl'} -{literal} - - -{/literal} + + {if $form_validation} + {$block->display('core:alert_fields') } + {/if} - -{foreach from=$static_relation item=static_relation} + +
    - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - - - - - - - -
    - - - - - - - -
    -
    - {translate module=static_relation} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=static_relation} - field_static_var_id - {/translate} - - { $list->menu("no", "static_relation_static_var_id", "static_var", "name", $static_relation.static_var_id, "form_menu") } -
    - {translate module=static_relation} - field_module_id - {/translate} - - { $list->menu("", "static_relation_module_id", "module", "name", $static_relation.module_id, "form_menu") } -
    - {translate module=static_relation} - field_default_value - {/translate} - - -
    - {translate module=static_relation} - field_description - {/translate} - - -
    - {translate module=static_relation} - field_required - {/translate} - - { $list->bool("static_relation_required",$static_relation.required, "form_menu") } -
    - {translate module=static_relation} - field_sort_order - {/translate} - - -
    - - - - - -
    - - - -
    -
    -
    -
    - - - - - -
    - {/foreach} + + + + +
    + + + + + + + + {include file='file:../core/view_tr_submit_delete.tpl'} +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=static_var_id}{$list->menu('no','static_relation_static_var_id','static_var','name',$record.static_var_id,'form_menu')}
    {osb f=tf field=module_id}{$list->menu('','static_relation_module_id','module','name',$record.module_id,'form_menu')}
    {osb f=tf field=default_value}
    {osb f=tf field=description}
    {osb f=tf field=required}{$list->bool('static_relation_required',$record.required)}
    {osb f=tf field=sort_order}
    +
    +
    + + {include file='file:../core/view_post.tpl'} +
    + +
    + {/if} diff --git a/themes/default/blocks/static_var/add.tpl b/themes/default/blocks/static_var/add.tpl index a88aa709..f9841fff 100644 --- a/themes/default/blocks/static_var/add.tpl +++ b/themes/default/blocks/static_var/add.tpl @@ -1,235 +1,47 @@ +{assign var=meth value=':'|explode:$VAR._page} + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=static_var} - title_add - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=static_var} - field_name - {/translate} - - -
    - {translate module=static_var} - field_description - {/translate} - - -
    - {translate module=static_var} - field_input_format - {/translate} - - -
    - {translate module=static_var} - field_validation_type - {/translate} - - -
    - {translate module=static_var} - field_convert_type - {/translate} - - -
    - - - - -
    -
    -
    -
    +
    + + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + {include file='file:../core/add_tr_submit.tpl'} +
    {osb f=tf field=name}
    {osb f=tf field=description}
    {osb f=tf field=input_format}{$list->menu_staticlist('statictype','static_var_input_format','static_var_input_format','','form_menu')}
    +
    +
    + +
    + + +
    + diff --git a/themes/default/blocks/static_var/search_show.tpl b/themes/default/blocks/static_var/search_show.tpl index 06807d80..2e593f28 100644 --- a/themes/default/blocks/static_var/search_show.tpl +++ b/themes/default/blocks/static_var/search_show.tpl @@ -1,130 +1,12 @@ -{$method->exe("static_var","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{assign var=meth value=':'|explode:$VAR._page} + + +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - - {foreach from=$static_var item=record} - - - - - - - - {literal} - - {/literal} - {/foreach} - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -
    - -   - {$record.name} -   - {translate module=static_var} - {$record.input_format} - {/translate} -   - {translate module=static_var} - {$record.validation_type} - {/translate} -   - {translate module=static_var} - {$record.convert_type} - {/translate} -
    -
    - -{if $VAR._print != TRUE}
    - -
    - - - - - - - -

    -
    + {include file='file:../core/search_show_pre.tpl'} + {$method->exe_noauth($meth.0,'tpl_search_show',$search_show)} + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/static_var/view.tpl b/themes/default/blocks/static_var/view.tpl index e5b20888..92199aa5 100644 --- a/themes/default/blocks/static_var/view.tpl +++ b/themes/default/blocks/static_var/view.tpl @@ -1,329 +1,109 @@ -{ $method->exe("static_var","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{assign var=meth value=':'|explode:$VAR._page} + -{literal} - - -{/literal} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} - -{foreach from=$static_var item=static_var} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - -{if $form_validation} - { $block->display("core:alert_fields") } + +
    + + + + + +
    + + + + + + + + {include file='file:../core/view_tr_submit_delete.tpl'} +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=name}
    {osb f=tf field=description}
    {osb f=tf field=input_format}{$list->menu_staticlist('statictype','static_var_input_format','static_var_input_format',$record.input_format,'form_menu')}
    {osb f=tf field=validation_type} + +
    {osb f=tf field=convert_type} + +
    {t}View Custom Fields{/t}
    +
    +
    + + {include file='file:../core/view_post.tpl'} +
    + +
    +
    +
    + {/if} - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=static_var} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=static_var} - field_name - {/translate} - - -
    - {translate module=static_var} - field_description - {/translate} - - -
    - {translate module=static_var} - field_input_format - {/translate} - - -
    - {translate module=static_var} - field_validation_type - {/translate} - - -
    - {translate module=static_var} - field_convert_type - {/translate} - - -
    - - - - - - - - - - - - -
      - -
    -
    - {translate module=static_var} - title_view - {/translate} - - -
    -
    -
    -
    - -{/foreach} -{/if} -
    - -
    - -{literal} - -{/literal} diff --git a/themes/default/blocks/task/add.tpl b/themes/default/blocks/task/add.tpl index 7cced3e6..a26ac757 100644 --- a/themes/default/blocks/task/add.tpl +++ b/themes/default/blocks/task/add.tpl @@ -1,182 +1,105 @@ - +{assign var=meth value=':'|explode:$VAR._page} + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} -
    + - - - - -
    - - - - - - - -
    -
    - {translate module=task}title_add{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=task} - field_date_start - {/translate} - - { $list->calender_add("task_date_start", $VAR.task_date_start, "form_field") } -
    - {translate module=task} - field_date_expire - {/translate} - - { $list->calender_add("task_date_expire", $VAR.task_date_expire, "form_field") } -
    - {translate module=task} - field_name - {/translate} - - -
    - {translate module=task} - field_description - {/translate} - - -
    - {translate module=task} - field_type - {/translate} - - -
    - {translate module=task} - field_command - {/translate} - - -
    - {translate module=task} - field_int_min - {/translate} - - { if $VAR.task_int_min == "" } - - {else} - - {/if} -
    - {translate module=task} - field_int_hour - {/translate} - - { if $VAR.task_int_hour == "" } - - {else} - - {/if} -
    - {translate module=task} - field_int_month_day - {/translate} - - { if $VAR.task_int_month_day == "" } - - {else} - - {/if} -
    - {translate module=task} - field_int_month - {/translate} - - { if $VAR.task_int_month == "" } - - {else} - - {/if} -
    - {translate module=task} - field_int_week_day - {/translate} - - { if $VAR.task_int_week_day == "" } - - {else} - - {/if} -
    - - - - -
    -
    -
    -
    + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/add_tr_submit.tpl'} +
    {osb f=tf field=date_start}{$list->calender_add('task_date_start',$VAR.task_date_start,'form_field')}
    {osb f=tf field=date_expire}{$list->calender_add('task_date_expire',$VAR.task_date_expire,'form_field')}
    {osb f=tf field=name}
    {osb f=tf field=description}
    {osb f=tf field=type}{$list->menu_staticlist('tasktype','task_type','task_type','','form_menu')}
    {osb f=tf field=command}
    {osb f=tf field=int_min} + {if $VAR.task_int_min == ''} + + {else} + + {/if} +
    {osb f=tf field=int_hour} + {if $VAR.task_int_hour == ''} + + {else} + + {/if} +
    {osb f=tf field=int_month_day} + {if $VAR.task_int_month_day == ''} + + {else} + + {/if} +
    {osb f=tf field=int_month} + {if $VAR.task_int_month == ''} + + {else} + + {/if} +
    {osb f=tf field=int_week_day} + {if $VAR.task_int_week_day == ''} + + {else} + + {/if} +
    +
    +
    + + diff --git a/themes/default/blocks/task/main.tpl b/themes/default/blocks/task/main.tpl deleted file mode 100644 index 642d388d..00000000 --- a/themes/default/blocks/task/main.tpl +++ /dev/null @@ -1,27 +0,0 @@ - - - - - -
    - - - - - - - -
    -
    - {translate module=task} - menu - {/translate} -
    -
    - - - - -
    {translate module=task}help_file{/translate}
    -
    -
    diff --git a/themes/default/blocks/task/search_form.tpl b/themes/default/blocks/task/search_form.tpl index 1d545a1e..f115420a 100644 --- a/themes/default/blocks/task/search_form.tpl +++ b/themes/default/blocks/task/search_form.tpl @@ -1,161 +1,90 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("task","search_form") } -{ if ($method->result == FALSE) } - { $block->display("core:method_error") } +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} -
    - - - - - -
    - - - - - - - - - -
    -
    - {translate module=task}title_search{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - +
    - {translate module=task} - field_date_start - {/translate} - { $list->calender_search("task_date_start", $VAR.task_date_start, "form_field", "") } -
    - {translate module=task} - field_date_expire - {/translate} - { $list->calender_search("task_date_expire", $VAR.task_date_expire, "form_field", "") } -
    - {translate module=task} - field_date_last - {/translate} - { $list->calender_search("task_date_last", $VAR.task_date_last, "form_field", "") } -
    - {translate module=task} - field_name - {/translate} -   {translate}search_partial{/translate} -
    - {translate module=task} - field_description - {/translate} -   {translate}search_partial{/translate} -
    - {translate module=task} - field_log - {/translate} - { $list->bool("task_log", "all", "form_menu") } -
    - {translate module=task} - field_type - {/translate} - { $list->bool("task_type", "all", "form_menu") } -
    - {translate module=task} - field_command - {/translate} -   {translate}search_partial{/translate} -
    - {translate module=task} - field_int_hour - {/translate} -   {translate}search_partial{/translate} -
    - {translate module=task} - field_int_month_day - {/translate} -   {translate}search_partial{/translate} -
    - {translate module=task} - field_int_week_day - {/translate} -   {translate}search_partial{/translate} -
    {translate}search_results_per{/translate} - -
    {translate}search_order_by{/translate} - -
    + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/search_post.tpl'} +
    {osb f=tf field=date_start}{$list->calender_search('task_date_start',$VAR.task_date_start,'form_field','')}
    {osb f=tf field=date_expire}{$list->calender_search('task_date_expire',$VAR.task_date_expire,'form_field','')}
    {osb f=tf field=date_last}{$list->calender_search('task_date_last',$VAR.task_date_last,'form_field','')}
    {osb f=tf field=date_run}{$list->calender_search('task_date_run',$VAR.task_date_run,'form_field','')}
    {osb f=tf field=name}  {t}"%" for partial match{/t}
    {osb f=tf field=description}  {t}"%" for partial match{/t}
    {osb f=tf field=log}{$list->bool('task_log','all')}
    {osb f=tf field=type}{$list->bool('task_type','all','form_menu')}
    {osb f=tf field=command} +   {t}"%" for partial match{/t} +
    {osb f=tf field=int_hour} +   {t}"%" for partial match{/t} +
    {osb f=tf field=int_month_day} +   {t}"%" for partial match{/t} +
    {osb f=tf field=int_week_day} +   {t}"%" for partial match{/t} +
    +
    +
    -
    - - - - -
    -
    -
    - -{ $block->display("core:saved_searches") } -{ $block->display("core:recent_searches") } + + + {$block->display('core:saved_searches')} + {$block->display('core:recent_searches')} {/if} diff --git a/themes/default/blocks/task/search_show.tpl b/themes/default/blocks/task/search_show.tpl index dfd259f7..2e593f28 100644 --- a/themes/default/blocks/task/search_show.tpl +++ b/themes/default/blocks/task/search_show.tpl @@ -1,119 +1,12 @@ +{assign var=meth value=':'|explode:$VAR._page} + - -{$method->exe("task","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - - {foreach from=$task item=record} - - - - - - - - - - - - {literal} - - {/literal} - {/foreach} - - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -
    - -   - {$record.name} -   - {$list->date_time($record.date_last)} -   - {$record.command} -
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    + {include file='file:../core/search_show_pre.tpl'} + {$method->exe_noauth($meth.0,'tpl_search_show',$search_show)} + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/task/view.tpl b/themes/default/blocks/task/view.tpl index c96b2de4..3ee1024b 100644 --- a/themes/default/blocks/task/view.tpl +++ b/themes/default/blocks/task/view.tpl @@ -1,244 +1,109 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("task","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} -{literal} - - -{/literal} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - -{foreach from=$task item=task} + +
    - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - - - - - - - -
    - - - - - - - - - - -
    -
    - {translate module=task} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=task} - field_name - {/translate} - - -
    - {translate module=task} - field_date_last - {/translate} - - {$list->date_time($task.date_last)} -
    - {translate module=task} - field_date_start - {/translate} - - { $list->calender_view("task_date_start", $task.date_start, "form_field", $task.id) } -
    - {translate module=task} - field_date_expire - {/translate} - - { $list->calender_view("task_date_expire", $task.date_expire, "form_field", $task.id) } -
    - {translate module=task} - field_description - {/translate} - - -
    - {translate module=task} - field_type - {/translate} - - -
    - {translate module=task} - field_command - {/translate} - - -
    - {translate module=task} - field_int_min - {/translate} - - -
    - {translate module=task} - field_int_hour - {/translate} - - -
    - {translate module=task} - field_int_month_day - {/translate} - - -
    - {translate module=task} - field_int_month - {/translate} - - -
    - {translate module=task} - field_int_week_day - {/translate} - - -
    - - - - - -
    - - - -
    -
    -
    - - - - - -
    - - {translate module=task} - run - {/translate} -
    -
    -
    - - - - -
    - {/foreach} + + + + +
    + + + + + + + + + + + {include file='file:../core/view_tr_submit_delete.tpl'} +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=name}
    {osb f=tf field=date_last}{$list->date_time($record.date_last)}
    {osb f=tf field=date_run}{$list->date_time($record.date_run)}
    {osb f=tf field=status}{$list->bool('task_status',$record.status,'form_field')}
    {osb f=tf field=log}{$list->bool('task_log',$record.log,'form_field')}
    {osb f=tf field=date_start}{$list->calender_view('task_date_start',$record.date_start,'form_field')}
    {osb f=tf field=date_expire}{$list->calender_view('task_date_expire',$record.date_expire,'form_field')}
    {osb f=tf field=description}
    {osb f=tf field=type}{$list->menu_staticlist('tasktype','task_type','task_type','','form_menu')}
    {osb f=tf field=command}
    {osb f=tf field=int_min}
    {osb f=tf field=int_hour}
    {osb f=tf field=int_month_day}
    {osb f=tf field=int_month}
    {osb f=tf field=int_week_day}
    +
    + + + + + +
    {osb f=tt module=task_log method=view} {t}Run{/t}
    +
    +
    + + {include file='file:../core/view_post.tpl'} + {/if} diff --git a/themes/default/blocks/tax/add.tpl b/themes/default/blocks/tax/add.tpl index 7b369d79..9248ab58 100644 --- a/themes/default/blocks/tax/add.tpl +++ b/themes/default/blocks/tax/add.tpl @@ -1,109 +1,82 @@ - +{assign var=meth value=':'|explode:$VAR._page} + {if $form_validation} - { $block->display("core:alert_fields") } + {$block->display('core:alert_fields')} {/if} -
    + - - - - -
    - - - - - - - -
    -
    - {translate module=tax}title_add{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=tax} - field_country_id - {/translate} - {if $VAR.tax_country_id != ""} - { $list->menu("", "tax_country_id", "country", "name", $VAR.tax_country_id, "form_menu") } - {else} - { $list->menu("", "tax_country_id", "country", "name", $smarty.const.DEFAULT_COUNTRY, "form_menu") } - {/if} -
    - {translate module=tax} - field_zone - {/translate} - -
    - {translate module=tax} - field_description - {/translate} - -
    - {translate module=tax} - field_rate - {/translate} - -
    {translate module=tax} field_tax_id_collect{/translate}{ $list->bool("tax_tax_id_collect", $VAR.tax_id_collect, "\" onChange=\"if (this.value==1) document.getElementById('tax_id').style.display='block'; else document.getElementById('tax_id').style.display='none'; \"") }
    -
    - - - - - - - - - - - - - - -
    {translate module=tax} field_tax_id_name{/translate}
    {translate module=tax} field_tax_id_req{/translate}{ $list->bool("tax_tax_id_req", $VAR.tax_id_req, "") }
    {translate module=tax} field_tax_id_regex{/translate}
    -
    -
    - - -
    -
    -
    -
    + + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + + + {include file='file:../core/add_tr_submit.tpl'} +
    {osb f=tf field=country_id} + {if $VAR.tax_country_id != ''} + {$list->menu('','tax_country_id','country','name',$VAR.tax_country_id,'form_menu')} + {else} + {$list->menu('','tax_country_id','country','name',$smarty.const.DEFAULT_COUNTRY,'form_menu')} + {/if} +
    {osb f=tf field=zone}
    {osb f=tf field=description}
    {osb f=tf field=rate}
    {osb f=tf field=tax_id_collect}{$list->bool('tax_tax_id_collect',$VAR.tax_id_collect,'" onchange="if (this.value==1) document.getElementById(\'tax_id\').style.display=\'block\'; else document.getElementById(\'tax_id\').style.display=\'none\';')}
    +
    + + + + + + + + + + + + + + +
    {osb f=tf field=tax_id_name}
    {osb f=tf field=tax_id_req}{$list->bool('tax_tax_id_req',$VAR.tax_id_req)}
    {osb f=tf field=tax_id_regex}
    +
    +
    +
    +
    + + diff --git a/themes/default/blocks/tax/main.tpl b/themes/default/blocks/tax/main.tpl deleted file mode 100644 index 396880d6..00000000 --- a/themes/default/blocks/tax/main.tpl +++ /dev/null @@ -1,27 +0,0 @@ - - - - - -
    - - - - - - - -
    -
    - {translate module=tax} - menu - {/translate} -
    -
    - - - - -
    {translate module=tax}help_file{/translate}
    -
    -
    diff --git a/themes/default/blocks/tax/search_form.tpl b/themes/default/blocks/tax/search_form.tpl index 44b8225b..2d60e0b2 100644 --- a/themes/default/blocks/tax/search_form.tpl +++ b/themes/default/blocks/tax/search_form.tpl @@ -1,98 +1,50 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("tax","search_form") } -{ if ($method->result == FALSE) } - { $block->display("core:method_error") } +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} -
    - - - - - -
    - - - - - - - - - -
    -
    - {translate module=tax}title_search{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - + - - - - - +
    - {translate module=tax} - field_country_id - {/translate} - { $list->menu("", "tax_country_id", "country", "name", "all", "form_menu") } -
    - {translate module=tax} - field_zone - {/translate} -   {translate}search_partial{/translate} -
    - {translate module=tax} - field_description - {/translate} -   {translate}search_partial{/translate} -
    - {translate module=tax} - field_rate - {/translate} -   {translate}search_partial{/translate} -
    {translate}search_results_per{/translate} - -
    {translate}search_order_by{/translate} - -
    + + + +
    + + + + + + + +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + {include file='file:../core/search_post.tpl'} +
    {osb f=tf field=country_id}{$list->menu('','tax_country_id','country','name','','form_menu',true)}
    {osb f=tf field=zone}  {t}"%" for partial match{/t}
    {osb f=tf field=description}  {t}"%" for partial match{/t}
    {osb f=tf field=rate}  {t}"%" for partial match{/t}
    +
    +
    -
    - - - - -
    -
    -
    - -{ $block->display("core:saved_searches") } -{ $block->display("core:recent_searches") } + + + {$block->display('core:saved_searches')} + {$block->display('core:recent_searches')} {/if} diff --git a/themes/default/blocks/tax/search_show.tpl b/themes/default/blocks/tax/search_show.tpl index 08edc9bc..2e593f28 100644 --- a/themes/default/blocks/tax/search_show.tpl +++ b/themes/default/blocks/tax/search_show.tpl @@ -1,119 +1,12 @@ +{assign var=meth value=':'|explode:$VAR._page} + - -{$method->exe("tax","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} {else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - - - {foreach from=$tax item=record} - - - - - - - - - - - {literal} - - {/literal} - {/foreach} - - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -
    - -  {$record.country_id} {$record.zone} {$record.description} {$record.rate}
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    + {include file='file:../core/search_show_pre.tpl'} + {$method->exe_noauth($meth.0,'tpl_search_show',$search_show)} + {include file='file:../core/search_show_post-1.tpl'} + {include file='file:../core/search_show_post-2.tpl'} {/if} -{/if} -
    diff --git a/themes/default/blocks/tax/view.tpl b/themes/default/blocks/tax/view.tpl index b06afd09..82e2d4c8 100644 --- a/themes/default/blocks/tax/view.tpl +++ b/themes/default/blocks/tax/view.tpl @@ -1,158 +1,83 @@ +{assign var=meth value=':'|explode:$VAR._page} + -{ $method->exe("tax","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} +{$method->exe($meth.0,$meth.1)} +{if ($method->result == false)} + {$block->display('core:method_error')} +{else} + {include file='file:../core/view_pre.tpl'} -{literal} - - -{/literal} + + {if $form_validation} + {$block->display('core:alert_fields')} + {/if} - -{foreach from=$tax item=tax} + +
    - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - - - - - - - -
    - - - - - - - -
    -
    - {translate module=tax}title_view{/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=tax} - field_country_id - {/translate} - { $list->menu("", "tax_country_id", "country", "name", $tax.country_id, "form_menu") } -
    - {translate module=tax} - field_zone - {/translate} - -
    - {translate module=tax} - field_description - {/translate} - -
    - {translate module=tax} - field_rate - {/translate} - -
    {translate module=tax} field_tax_id_collect{/translate}{ $list->bool("tax_tax_id_collect", $tax.tax_id_collect, "\" onChange=\"if (this.value==1) document.getElementById('tax_id').style.display='block'; else document.getElementById('tax_id').style.display='none'; \"") } -
    -
    - - - - - - - - - - - - - - -
    {translate module=tax} field_tax_id_name{/translate}
    {translate module=tax} field_tax_id_req{/translate}{ $list->bool("tax_tax_id_req", $tax.tax_id_req, "") }
    {translate module=tax} field_tax_id_regex{/translate}
    -
    -
    - - - - -
    - -
    -
    -
    - - - - -
    - {/foreach} + + + + +
    + + + + + + + + {include file='file:../core/view_tr_submit_delete.tpl'} +
    {osb f=tt}
    + + + + + + + + + + + + + + + + + + + + + + + + +
    {osb f=tf field=country_id}{$list->menu('','tax_country_id','country','name',$record.country_id,'form_menu')}
    {osb f=tf field=zone}
    {osb f=tf field=description}
    {osb f=tf field=rate}
    {osb f=tf field=tax_id_collect}{$list->bool('tax_tax_id_collect',$record.tax_id_collect,'" onchange="if (this.value==1) document.getElementById(\'tax_id\').style.display=\'block\'; else document.getElementById(\'tax_id\').style.display=\'none\';')}
    +
    + + + + + + + + + + + + + + +
    {osb f=tf field=tax_id_name}
    {osb f=tf field=tax_id_req}{$list->bool('tax_tax_id_req',$record.tax_id_req)}
    {osb f=tf field=tax_id_regex}
    +
    +
    +
    +
    + + {include file='file:../core/view_post.tpl'} + {/if} diff --git a/themes/default/blocks/ticket/add.tpl b/themes/default/blocks/ticket/add.tpl deleted file mode 100644 index b73e5992..00000000 --- a/themes/default/blocks/ticket/add.tpl +++ /dev/null @@ -1,139 +0,0 @@ - - - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=ticket} - title_add - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - { $method->exe("ticket","static_var")} - { if ($method->result == FALSE) } - { $block->display("core:method_error") } - {/if} - {foreach from=$static_var item=record} - - - - - {/foreach} - - - - -
    - {translate module=ticket} - field_priority - {/translate} - - -
    - {translate module=ticket} - field_department_id - {/translate} - - { $list->menu("no", "ticket_department_id", "ticket_department", "name", $VAR.ticket_department_id, "form_menu") } -
    - {translate module=ticket} - field_account_id - {/translate} - - {html_select_account name="ticket_account_id" default=$VAR.ticket_account_id} -
    - {translate module=ticket} - field_email - {/translate} - - -
    - {translate module=ticket} - field_subject - {/translate} - - -
    - {translate module=ticket} - field_body - {/translate} - - -
    - {$record.name} - - {$record.html} -
    - - - - - -
    -
    -
    -
    diff --git a/themes/default/blocks/ticket/auth.tpl b/themes/default/blocks/ticket/auth.tpl deleted file mode 100644 index 3fb068a6..00000000 --- a/themes/default/blocks/ticket/auth.tpl +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - - -
    -


    - {translate module=ticket} - user_ticket_auth - {/translate} -

    -
    - - - - - - - - - - -
    -
    - - - - - - - - - - - - - -
    - {translate module=ticket} - field_email - {/translate} - - -
    - {translate module=ticket} - key - {/translate} - - -
    - - - - -
    -
    -
     
    -
    - - - - - - - -
    -
    - {translate} - account_login - {/translate} -
    -
    - - - - - - - - - - - - - -
    - {translate} - username - {/translate} - - -
    - {translate} - password - {/translate} - - -
    - - - - - -
    -
    -
    -
    -
    - diff --git a/themes/default/blocks/ticket/main.tpl b/themes/default/blocks/ticket/main.tpl deleted file mode 100644 index 4aae60b4..00000000 --- a/themes/default/blocks/ticket/main.tpl +++ /dev/null @@ -1,2 +0,0 @@ -{$block->display("ticket:overview")} -{$block->display("ticket:search_quick")} \ No newline at end of file diff --git a/themes/default/blocks/ticket/overview.tpl b/themes/default/blocks/ticket/overview.tpl deleted file mode 100644 index 38cc775a..00000000 --- a/themes/default/blocks/ticket/overview.tpl +++ /dev/null @@ -1,104 +0,0 @@ -{$method->exe("ticket","overview")} -{if ($method->result != FALSE)} - - - - - - - -
    - - - - - - - - - - - - - {foreach from=$overview item=record} - - - - - - - - - - {/foreach} - -
    {translate module=ticket}field_department_id{/translate}{translate module=ticket}new{/translate} {translate module=ticket}awaiting_reply{/translate} - {translate module=ticket} - awaiting_customer - {/translate} - - {translate module=ticket} - hold - {/translate} - - {translate module=ticket} - pending - {/translate} - - {translate module=ticket} - resolved - {/translate} -
      - {$record.name} -   - {if $record.new > 0} - - {$record.new} - - {else} - {$record.new} - {/if} -   - {if $record.waiting > 0} - - {$record.waiting} - - {else} - {$record.waiting} - {/if} -   - {if $record.customer > 0} - - {$record.customer} - - {else} - {$record.customer} - {/if} -   - {if $record.hold > 0} - - {$record.hold} - - {else} - {$record.hold} - {/if} -   - {if $record.pending > 0} - - {$record.pending} - - {else} - {$record.pending} - {/if} -   - {if $record.resolved > 0} - - {$record.resolved} - - {else} - {$record.resolved} - {/if} -
    -
    -
    -{/if} diff --git a/themes/default/blocks/ticket/search_form.tpl b/themes/default/blocks/ticket/search_form.tpl deleted file mode 100644 index 66578cfd..00000000 --- a/themes/default/blocks/ticket/search_form.tpl +++ /dev/null @@ -1,222 +0,0 @@ - -{ $method->exe("ticket","search_form") } -{ if ($method->result == FALSE) } - { $block->display("core:method_error") } -{else} - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=ticket} - title_search - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $method->exe("ticket","static_var")} - {foreach from=$static_var item=record} - - - - - {/foreach} - - - - - - - - - - - - - - - -
    - {translate module=ticket} - field_subject - {/translate} - - - {translate} - search_partial - {/translate} -
    - {translate module=ticket} - field_body - {/translate} - - - {translate} - search_partial - {/translate} -
    - {translate module=ticket} - field_email - {/translate} - - - {translate} - search_partial - {/translate} -
    - {translate module=ticket} - field_status - {/translate} - - -
    - {translate module=ticket} - field_priority - {/translate} - - -
    - {translate module=ticket} - field_department_id - {/translate} - - { $list->menu("", "ticket_department_id", "ticket_department", "name", "all", "form_menu") } -
    - {translate module=ticket} - field_staff_id - {/translate} - - { $list->menu("", "ticket_staff_id", "staff", "nickname", "all", "form_menu") } -
    - {translate module=ticket} - field_account_id - {/translate} - - {html_select_account name="ticket_account_id" default=$VAR.ticket_account_id} -
    - {translate module=ticket} - field_date_orig - {/translate} - - { $list->calender_search("ticket_date_orig", $VAR.ticket_date_orig, "form_field", "") } -
    - {$record.name} - - {$record.html} -
    - {translate} - search_results_per - {/translate} - - -
    - {translate} - search_order_by - {/translate} - - -
    - - - - - -
    -
    -
    -
    -{/if} diff --git a/themes/default/blocks/ticket/search_quick.tpl b/themes/default/blocks/ticket/search_quick.tpl deleted file mode 100644 index 03f959bc..00000000 --- a/themes/default/blocks/ticket/search_quick.tpl +++ /dev/null @@ -1,169 +0,0 @@ -{literal} - - - -{/literal} - -
    - - - - -
    - - - - - - - -
    -
    - {translate module=ticket} - title_search - {/translate} -
    -
    - - - - - - - - - - - - - - - - - -
    - Text/User Query - - - All - - Sender Only - - Text Only -
    - {translate module=ticket}field_department_id{/translate} - - All - {foreach from=$overview item=record} - - {$record.name} - {/foreach} -
    Status - All - {translate module=ticket} status_open {/translate} - {translate module=ticket} status_close {/translate} - {translate module=ticket} status_pending {/translate} - {translate module=ticket} status_hold {/translate} -
    -
    -
    -
    -
    - -
    - -{if $VAR.department && $VAR.status && $VAR.query==''} - -{elseif $VAR.department && $VAR.status && $VAR.query} - -{/if} \ No newline at end of file diff --git a/themes/default/blocks/ticket/search_quick_show.tpl b/themes/default/blocks/ticket/search_quick_show.tpl deleted file mode 100644 index 6cd6ca3f..00000000 --- a/themes/default/blocks/ticket/search_quick_show.tpl +++ /dev/null @@ -1,32 +0,0 @@ -
    -

    Found {$count} Record(s)...

    -{if $count > 0} -
    - - {foreach from=$results item=ticket} - - - - - - - - - - {/foreach} -
    {$ticket.email}
    -
    - - {$ticket.subject} - -
    -
    {$ticket.department} | {$list->date($ticket.date_orig)}
      {$ticket.body|truncate:115:"..."} - View | - Delete -
    -
    -{/if} - - - -
    \ No newline at end of file diff --git a/themes/default/blocks/ticket/search_show.tpl b/themes/default/blocks/ticket/search_show.tpl deleted file mode 100644 index c275cbf9..00000000 --- a/themes/default/blocks/ticket/search_show.tpl +++ /dev/null @@ -1,140 +0,0 @@ - -{$method->exe("ticket","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} -{else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - - {foreach from=$ticket item=record} - - - - - - - - - {literal} - - {/literal} - {/foreach} - -
      - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} - - {literal} - - {/literal} -  
    - -   - {$record.subject|truncate:35} -   - {if $record.account_id == false} - {$record.email} - {else} - {$record.account_id} - {/if} -   - {if $record.staff_id != ""} - {$record.staff_id} - {else} - --- - {/if} -   - {$record.department_id} -   - { if $record.status == '0' } - - { elseif $record.status == '1' } - - { elseif $record.status == '2' } - - { elseif $record.status == '3' } - - { /if } -
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    -{/if} -{/if} -
    diff --git a/themes/default/blocks/ticket/ticket.tpl b/themes/default/blocks/ticket/ticket.tpl deleted file mode 100644 index 5a9d8e1e..00000000 --- a/themes/default/blocks/ticket/ticket.tpl +++ /dev/null @@ -1,185 +0,0 @@ - -{ $method->exe("ticket","is_user_auth")} { if ($method->result == FALSE) } { $block->display("core:method_error") } {/if} -{if $display == true} -
    - - - - -
    - - - - - - - -
    -
    - {translate module=ticket} - menu_add - {/translate} -
    -
    - - - - -
    - - - - - - - -
    - {translate module=ticket} - user_select_department - {/translate} -
    -

    - {foreach from=$results item=record} - - - - - - - - - - {/foreach} - - - - -
    - - - {$record.name} -
      - {$record.description} -
    -
    -
    - - -
    -
    -

    -
    -
    -
    -
    -

    {else}

    -

    - {translate module=ticket} - user_not_auth_add - {/translate} -

    -

    - {/if} - { $method->exe("ticket","user_list")} - { if ($method->result == FALSE) } - { $block->display("core:method_error") } - {/if} - - {$method->exe("ticket","is_key_match")} - {if $ticket_key == true} - {if $ticket_results != false} - - - - -
    - - - - - - - -
    -
    - {translate module=ticket} - menu_view - {/translate} -
    -
    - - - - - - - -
    - {translate module=ticket} - user_ticket_list - {/translate} -
    -

    - - - - - - - {foreach from=$ticket_results item=record} -
    - {translate} - field_subject - {/translate} - - {translate} - field_date_last - {/translate} - - {translate} - field_status - {/translate} -
    - - - - - - - {/foreach} -
    - - {$record.subject|truncate:40} - - { $list->date_time($record.date_orig)} - - { if $record.status == '0' } - {translate module=ticket} - status_open - {/translate} - { elseif $record.status == '1' } - {translate module=ticket} - status_hold - {/translate} - { elseif $record.status == '2' } - {translate module=ticket} - status_close - {/translate} - { elseif $record.status == '3' } - {translate module=ticket} - status_hold - {/translate} - { /if } -
    -

    -
    -
    -{else} -{translate module=ticket} -user_no_existing_ticket -{/translate} -{/if} - -{else} -{ $block->display("ticket:auth")} -{/if} diff --git a/themes/default/blocks/ticket/user.tpl b/themes/default/blocks/ticket/user.tpl deleted file mode 100644 index 88725c6e..00000000 --- a/themes/default/blocks/ticket/user.tpl +++ /dev/null @@ -1,51 +0,0 @@ - - - - -
    - - - - -
    - - - - -
    - - - - - - - -
    -
    - {translate module=ticket} - menu - {/translate} -
    -
    - - - - - - - - - -
    Create New Ticket - {translate module=ticket} - menu_add - {/translate} -
    Manage Tickets - {translate module=ticket} - menu_view - {/translate} -
    -
    -
    -
    -
    \ No newline at end of file diff --git a/themes/default/blocks/ticket/user_add.tpl b/themes/default/blocks/ticket/user_add.tpl deleted file mode 100644 index 9b2785e4..00000000 --- a/themes/default/blocks/ticket/user_add.tpl +++ /dev/null @@ -1,142 +0,0 @@ - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - -{ $method->exe("ticket","is_user_auth")} - { if ($method->result == FALSE) } { $block->display("core:method_error") } {/if} - -{if $display == true} -{if $VAR.ticket_department_id == ''} -{translate module=ticket} -user_department_required -{/translate} -{else} -

    - - - - -
    - - - - - - - -
    -
    - {translate module=ticket} - title_add - {/translate} -
    -
    - - - - - - - {if $smarty.const.SESS_LOGGED == false} - - - - - {/if} - - - - - - - - - - - { $method->exe("ticket","static_var")} - { if ($method->result == FALSE) } - { $block->display("core:method_error") } - {/if} - {foreach from=$static_var item=record} - - - - - {/foreach} - - - - -
    - {translate module=ticket} - field_priority - {/translate} - - -
    - {translate module=ticket} - field_email - {/translate} - - -
    - {translate module=ticket} - field_subject - {/translate} - - -
    - {translate module=ticket} - field_body - {/translate} - - -
    - {$record.name} - - {$record.html} -
    - - - - - -
    -
    -
    -
    - - - -{/if} -{else} -

    - {translate module=ticket} - user_not_auth_add - {/translate} -

    -{ $block->display("ticket:auth")} -{/if} - diff --git a/themes/default/blocks/ticket/user_view.tpl b/themes/default/blocks/ticket/user_view.tpl deleted file mode 100644 index 7f330ccc..00000000 --- a/themes/default/blocks/ticket/user_view.tpl +++ /dev/null @@ -1,330 +0,0 @@ -{ $method->exe("ticket","user_view") } -{ if ($method->result == FALSE) } { $block->display("core:method_error") } {/if} - - -{if $ticket != false} - -{ if $ticket.status == '3' && $smarty.const.SESS_LOGGED == false } -

    - {translate module=ticket} - user_pending_verify - {/translate} -
    -
    - - - - - - - -
    -
    - {translate} - account_login - {/translate} -
    -
    - - - - - - - - - - - - - -
    - {translate} - username - {/translate} - - -
    - {translate} - password - {/translate} - - -
    - - - - - -
    -
    -
    -{elseif $ticket.status == '3' && $smarty.const.SESS_LOGGED == true} -{ $method->exe("ticket","pending_verify") } -{$pending_status} -{else} - -
    - - - - -
    - - - - - - - -
    -
    - {translate module=ticket} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - - {if $show_static_var != false} - {foreach from=$static_var item=record} - - - - - {/foreach} - {/if} - { if $ticket.status != "2" } - - - - - {/if} -
    - {translate module=ticket} - field_date_last - {/translate} - - {$list->date_time($ticket.date_last)} -
    - {translate module=ticket} - field_status - {/translate} - - { if $ticket.status == '0' } - {translate module=ticket} - status_open - {/translate} - { elseif $ticket.status == '1' } - {translate module=ticket} - status_hold - {/translate} - { elseif $ticket.status == '2' } - {translate module=ticket} - status_close - {/translate} - { elseif $ticket.status == '3' } - - {translate module=ticket} - status_pending - {/translate} - - { /if } -
    - {translate module=ticket} - field_priority - {/translate} - - { if $ticket.priority == '0' } - {translate module=ticket} - priority_standard - {/translate} - { elseif $ticket.priority == '1' } - {translate module=ticket} - priority_medium - {/translate} - { elseif $ticket.priority == '2' } - {translate module=ticket} - priority_high - {/translate} - { elseif $ticket.priority == '3' } - {translate module=ticket} - priority_emergency - {/translate} - { /if } -
    - {$record.name} - - {$record.html} -
    -
    - - - - - - - -
    -
    -
    -
    -
    - - - - -
    - - - - - - - - - - - - - - {if $show_static_var != false} - {foreach from=$static_var item=record} - {/foreach} - {/if} -
      - {$list->date_time($ticket.date_orig)} -
    - {translate module=ticket} - field_subject - {/translate} - - {$ticket.subject} -
    - {translate module=ticket} - field_body - {/translate} - - {$ticket.body|linkalize|replace:" -":"
    "} -
    -
    - -
    -{if $ticket_reply != false} -{foreach from=$ticket_reply item=reply} - - - - -
    - - - - - - - - - - {if $show_static_var != false} - {foreach from=$static_var item=record} - {/foreach} - {/if} -
      - {if $reply.staff_id > 1 } - - {$list->date_time($reply.date_orig)} - - {else} - {$list->date_time($reply.date_orig)} - {/if} -
    - {if $reply.staff_id < 1 } - {translate module=ticket} - user_wrote - {/translate} - {else} - - {translate module=ticket} - staff_wrote - {/translate} - - {/if} - - {if $reply.staff_id > 1 } - - {$reply.message|linkalize|replace:"\r\n":"
    "}
    - {else} - {$reply.message|linkalize|replace:"\r\n":"
    "} - {/if} -
    -
    -
    -{/foreach} -{/if} -
    - - - - -
    - - - - - - - - - - - {if $show_static_var != false} - {foreach from=$static_var item=record} - {/foreach} - {/if} -
    -
    - { if $ticket.status != "2" } - {translate module=ticket} - user_add_response - {/translate} - {else} - {translate module=ticket} - user_reopen_response - {/translate} - {/if} -
    -
    -
    - -
    -
    -
    - {html_button} - - - - - -
    -
    -
    -
    -
    -{/if} - -{else} -{$block->display("ticket:auth")} -{/if} diff --git a/themes/default/blocks/ticket/view.tpl b/themes/default/blocks/ticket/view.tpl deleted file mode 100644 index 1b3c81b6..00000000 --- a/themes/default/blocks/ticket/view.tpl +++ /dev/null @@ -1,580 +0,0 @@ -{ $method->exe("ticket","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} -{literal} - - - - -{/literal} - - -{foreach from=$ticket item=ticket} - - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - -
    -
    - - - - - -
    -

    - {if $ticket.status == "2"}{/if} - {$ticket.subject} - - {if $ticket.status == "0"} - - {translate module=ticket} - status_open - {/translate} - {/if} - - {if $ticket.status == "1"} - - {translate module=ticket} - status_hold - {/translate} - {/if} - - {if $ticket.status == "2"} - {translate module=ticket} - status_close - {/translate} - {/if} - - {if $ticket.status == "3"} - - {translate module=ticket} - status_pending - {/translate} - {/if} -

    -
    -
    {html_link name="More Options" hide=showoptions show=main_full,hideoptions action="document.getElementById('view_options').value=1;"}
    -
    {html_link name="Hide Options" show=showoptions hide=main_full,hideoptions action="document.getElementById('view_options').value=0;"}
    - {if $ticket.account_id > 0} -
    {html_link name="Show User Authentication" hide=showoptionsauth show=optionsauth,hideoptionsauth}
    -
    {html_link name="Hide User Authentication" show=showoptionsauth hide=optionsauth,hideoptionsauth}
    - {/if} -
    -
    -
    - -{if $ticket.account_id > 0} -
    -
    -User's Services, Products, and Groups -
    -
    - - - - - - - - - - - -
    ServicesGroupsProducts
    - {if !$ticket.authsrvc} {/if} - {foreach from=$ticket.authsrvc item=service} -

     {$service.date_orig}   - {$service.sku} -

    - {/foreach} -
    - {if !$ticket.authgrp} {/if} - {foreach from=$ticket.authgrp item=group} -

     {$group.date_orig}   - {$group.name} -

    - {/foreach} -
    - {if !$ticket.authsku} {/if} - {foreach from=$ticket.authsku item=sku} -

     {$sku.dateorg}   - {$sku.sku} ({$sku.qty})

    - {/foreach} -
    -
    -
    -
    -{/if} - -
    -
    -{translate module=ticket}title_view{/translate} {$ticket.id} -
    -
    - -{if $VAR._escape} - -{/if} - - - - - - - - - - - - - - - - {if $ticket.static_var != false} - - - - {/if} -
    - - - - - - - - - - - -
    - {translate module=ticket} - field_date_orig - {/translate} - - {translate module=ticket} - field_date_last - {/translate} - - {translate module=ticket} - field_status - {/translate} -
    - {$list->date_time($ticket.date_orig)} - - {$list->date_time($ticket.date_last)} - - -
    -
    - - - - - - - - - - - -
    - {translate module=ticket} - field_staff_id - {/translate} - - {translate module=ticket} - field_department_id - {/translate} - - {translate module=ticket} - field_priority - {/translate} -
    - { $list->menu("no", "ticket_staff_id", "staff", "nickname", $ticket.staff_id, "form_menu\" onChange=\"document.getElementById('ticket_view').submit()") } - - { $list->menu("no", "ticket_department_id", "ticket_department", "name", $ticket.department_id, "form_menu\" onChange=\"document.getElementById('ticket_view').submit()") } - - -
    -
    - - - - - - - - - - - -
    - {translate module=ticket} - field_email - {/translate} - - {translate module=ticket} - field_account_id - {/translate} - - {translate module=ticket} - field_last_reply - {/translate} -
    - - - {html_select_account name="ticket_account_id" default=$ticket.account_id} - - -
    -
    - - {foreach from=$ticket.static_var item=record} - - - - - {/foreach} -
    - {$record.name} - - {$record.html} -
    -
    -
    - - - - - - -
    - - - { $method->exe_noauth("ticket","merge_list") } - - -
    -
    -
    -
    -
    - - -
    -
    - - - - - -
    -
    {$ticket.body|replace:"\r\n":" "|truncate:95}
    -
    {$ticket.subject}
    -
    -
    {$list->date_time($ticket.date_orig)}
    -
    {html_link name=edit hide=showmsg show=editmsg} | {$list->date_time($ticket.date_orig)}
    -
    -
    -
    -

    {$ticket.body|linkalize|replace:"\r\n":"
    "}

    - -{if $ticket.attachments} -
    -{foreach from=$ticket.attachments item=attach} -

    {$attach.name}
    {$attach.size} Download

    -{/foreach} -{/if} - -
    -
    - -
    -
    -
    {html_link name=save action="getElementById('ticket_view').submit();"} {html_link name=cancel hide=editmsg show=showmsg}
    -
    -
    -
    - -
    -
    - -{if $ticket.reply != false} -{foreach from=$ticket.reply item=reply} -
    - - - - - -
    -
    - {if $reply.staff_id}{$reply.staff_nickname}{else}{$reply.user_name}{/if} - {$reply.message|replace:"\r\n":" "|truncate:70} -
    -
    - {if $reply.staff_id}{$reply.staff_nickname}{else}{$reply.user_name}{/if} -
    -
    -
    {html_link name=delete action="delete_message('`$reply.id`','`$VAR.id`');"} | {$list->date_time($reply.date_orig)}
    -
    {$list->date_time($reply.date_orig)}
    -
    -
    - -
    -

    {$reply.message|linkalize|replace:"\r\n":"
    "}

    -
    -{/foreach} -{/if} - - -
    -
    -

    {translate module=ticket}user_add_response {/translate}

    - -
    -
    - - {if $list->is_installed('faq')} -

    - - -

    - -

    - {/if} - -
    {$signature}
    -

    - -

    - {translate module=ticket} enable_user_notice {/translate} - Add Q&A to FAQ Module - -

    {html_button}

    -

    - - -
    - - {if $VAR._escape} - - {/if} - - - - - - - -
    -
    -
    - -{/foreach} -{/if} diff --git a/themes/default/blocks/ticket/view_quick.tpl b/themes/default/blocks/ticket/view_quick.tpl deleted file mode 100644 index dca86358..00000000 --- a/themes/default/blocks/ticket/view_quick.tpl +++ /dev/null @@ -1,20 +0,0 @@ -{ $block->display("core:top_clean") } - -{literal} - -{/literal} - - - - - - -{ $block->display("ticket:view") } - - - \ No newline at end of file diff --git a/themes/default/blocks/ticket_department/add.tpl b/themes/default/blocks/ticket_department/add.tpl deleted file mode 100644 index 4b12c90f..00000000 --- a/themes/default/blocks/ticket_department/add.tpl +++ /dev/null @@ -1,113 +0,0 @@ - - - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=ticket_department} - title_add - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=ticket_department} - field_group_id - {/translate} - - { $list->menu_multi($VAR.ticket_department_group_id, 'ticket_department_group_id', 'group', 'name', '', '10', 'form_menu') } -
    - {translate module=ticket_department} - field_setup_email_id - {/translate} - - { $list->menu("", "ticket_department_setup_email_id", "setup_email", "name", $VAR.ticket_department_setup_email_id, "form_menu") } -
    - {translate module=ticket_department} - field_name - {/translate} - - -
    - {translate module=ticket_department} - field_status - {/translate} - - { $list->bool("ticket_department_status", $VAR.ticket_department_status, "form_menu") } -
    - {translate module=ticket_department} - field_piping - {/translate} - - { $list->bool("ticket_department_piping", $VAR.ticket_department_piping, "form_menu") } -
    - {translate module=ticket_department} - field_piping_setup_email_id - {/translate} - - { $list->menu("", "ticket_department_piping_setup_email_id", "setup_email", "name", $VAR.ticket_department_piping_setup_email_id, "form_menu") } -
    - {translate module=ticket_department} - field_description - {/translate} - - -
    - - - - -
    -
    -
    -
    diff --git a/themes/default/blocks/ticket_department/search_show.tpl b/themes/default/blocks/ticket_department/search_show.tpl deleted file mode 100644 index acb69658..00000000 --- a/themes/default/blocks/ticket_department/search_show.tpl +++ /dev/null @@ -1,108 +0,0 @@ - - -{$method->exe("ticket_department","search_show")} -{if ($method->result == FALSE)} - {$block->display("core:method_error")} -{else} - {if $results == 1} - {translate results=$results}search_result_count{/translate} - {else} - {translate results=$results}search_results_count{/translate} - {/if} -
    - - - {literal} - - - {/literal} - - -
    - - -
    - - - - - - -
    - - - - - - - - - - {foreach from=$ticket_department item=record} - - - - - - - - - - {literal} - - {/literal} - {/foreach} - - -
      - {literal} - - {/literal} - - {literal} - - {/literal} -
    - -   - {$record.name} -   - {$record.setup_email_id} -
    -
    -{if $VAR._print != TRUE}
    -
    - - - - - -
    -
    -{/if} -{/if} -
    diff --git a/themes/default/blocks/ticket_department/view.tpl b/themes/default/blocks/ticket_department/view.tpl deleted file mode 100644 index 6cc33a06..00000000 --- a/themes/default/blocks/ticket_department/view.tpl +++ /dev/null @@ -1,199 +0,0 @@ - -{ $method->exe("ticket_department","view") } { if ($method->result == FALSE) } { $block->display("core:method_error") } {else} - -{literal} - - -{/literal} - - -{foreach from=$ticket_department item=ticket_department} - - -{if $form_validation} - { $block->display("core:alert_fields") } -{/if} - - -
    - - - - - -
    - - - - - - - -
    -
    - {translate module=ticket_department} - title_view - {/translate} -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - {translate module=ticket_department} - field_group_id - {/translate} - - { $list->menu_multi($ticket_department.group_id, 'ticket_department_group_id', 'group', 'name', '', '10', 'form_menu') } -
    - {translate module=ticket_department} - field_setup_email_id - {/translate} - - { $list->menu("", "ticket_department_setup_email_id", "setup_email", "name", $ticket_department.setup_email_id, "form_menu") } -
    - {translate module=ticket_department} - field_name - {/translate} - - -
    - {translate module=ticket_department} - field_status - {/translate} - - { $list->bool("ticket_department_status", $ticket_department.status, "form_menu") } -
    - {translate module=ticket_department} - field_piping - {/translate} - - { $list->bool("ticket_department_piping", $ticket_department.piping, "form_menu") } -
    - {translate module=ticket_department} - field_piping_setup_email_id - {/translate} - - { $list->menu("", "ticket_department_piping_setup_email_id", "setup_email", "name", $ticket_department.piping_setup_email_id, "form_menu") } -
    - {translate module=ticket_department} - field_description - {/translate} - - -
    - - - -
    -
    -
    - - - - -
    - -
    - - - - - - - - -
    -
    - {translate module=ticket_department} - view_tickets - {/translate} -
    -
    - - - - - -
    - - - - - -
    - -  
    -
    -
    - - - - -
    -{/foreach} -{/if} diff --git a/themes/default/cart.js b/themes/default/cart.js new file mode 100644 index 00000000..ce9dbcec --- /dev/null +++ b/themes/default/cart.js @@ -0,0 +1,41 @@ +function domainUpdate(domain,tld,type) { + document.getElementById("domain_name").value = domain; + document.getElementById("domain_tld").value = tld; + document.getElementById("domain_option").value = type; +} + +function addCart(addtype,hosting) { + if (hosting == "1") { + var domain_option = document.getElementById("domain_option").value; + var domain_name = document.getElementById("domain_name").value; + var domain_tld = document.getElementById("domain_tld").value; + + if(domain_option == "0") { + //@todo To Translate + alert("You must choose a 'Domain Transfer / Registration Option' to continue."); + return; + } + + if(domain_name == "0" || domain_tld == "0") { + if(domain_option != "ip") { + //@todo To Translate + alert("You must select a valid domain name to continue."); + return; + } + } + } + attrValidate(addtype); +} + +function doCart(addtype) { + form = document.getElementById('view'); + if(addtype == 'cart') { + //document.getElementById('page').value = 'cart:admin_view'; + document.getElementById('page').value = 'cart:cart'; + } else if(addtype == 'checkout') { + document.getElementById('page').value = 'checkout:checkout'; + } + + form.action = ''; + form.submit(); +} diff --git a/themes/default/images/htaccess_error.gif b/themes/default/images/htaccess_error.gif deleted file mode 100644 index b534b756..00000000 Binary files a/themes/default/images/htaccess_error.gif and /dev/null differ diff --git a/themes/default/images/logo-big.png b/themes/default/images/logo-big.png new file mode 100644 index 00000000..5b24d335 Binary files /dev/null and b/themes/default/images/logo-big.png differ diff --git a/themes/default/images/logo-small.png b/themes/default/images/logo-small.png new file mode 100644 index 00000000..85c2c16e Binary files /dev/null and b/themes/default/images/logo-small.png differ diff --git a/includes/pdf/invoice.pdf b/themes/default/invoice/invoice-0.pdf similarity index 100% rename from includes/pdf/invoice.pdf rename to themes/default/invoice/invoice-0.pdf diff --git a/includes/pdf/invoice1.pdf b/themes/default/invoice/invoice-1.pdf similarity index 100% rename from includes/pdf/invoice1.pdf rename to themes/default/invoice/invoice-1.pdf diff --git a/includes/pdf/invoice2.pdf b/themes/default/invoice/invoice-2.pdf similarity index 100% rename from includes/pdf/invoice2.pdf rename to themes/default/invoice/invoice-2.pdf diff --git a/includes/pdf/invoice_backup.pdf b/themes/default/invoice/invoice-3.pdf similarity index 100% rename from includes/pdf/invoice_backup.pdf rename to themes/default/invoice/invoice-3.pdf diff --git a/themes/default/invoice/invoice-blank.pdf b/themes/default/invoice/invoice-blank.pdf new file mode 100644 index 00000000..f55e542f Binary files /dev/null and b/themes/default/invoice/invoice-blank.pdf differ diff --git a/themes/default/invoice/invoice-logo.png b/themes/default/invoice/invoice-logo.png new file mode 100644 index 00000000..497801b8 Binary files /dev/null and b/themes/default/invoice/invoice-logo.png differ diff --git a/themes/default/invoice/invoice-payment-dd.png b/themes/default/invoice/invoice-payment-dd.png new file mode 100644 index 00000000..7ead4d12 Binary files /dev/null and b/themes/default/invoice/invoice-payment-dd.png differ diff --git a/themes/default/invoice/invoice-payment-pp.png b/themes/default/invoice/invoice-payment-pp.png new file mode 100644 index 00000000..1b607cd0 Binary files /dev/null and b/themes/default/invoice/invoice-payment-pp.png differ diff --git a/themes/default/left.tpl b/themes/default/left.tpl deleted file mode 100644 index 59fb9d83..00000000 --- a/themes/default/left.tpl +++ /dev/null @@ -1,158 +0,0 @@ -{if $smarty.const.SHOW_CAT_BLOCK} - - { $block->display("product_cat:menu") } -{/if} - -{if $smarty.const.SHOW_STATIC_BLOCK} - - { $block->display("static_page:menu") } -{/if} - -{if $smarty.const.SHOW_FILE_BLOCK} - - { $block->display("file:menu") } -{/if} - - - - - - - - - -{if $SESS_LOGGED == "1" } -
    - - - - - -

    - {else} -
    - - { $block->display("account:login_small")} - {/if} -
    -

    diff --git a/themes/default/search.js b/themes/default/search.js deleted file mode 100644 index 7d6a316f..00000000 --- a/themes/default/search.js +++ /dev/null @@ -1,352 +0,0 @@ - function search_nav_jump(jmp_to) - { - var url = '?_page='+module+':search_show&search_id='+search_id+'&page='+jmp_to +'&' + sort1 + '&order_by=' + order + p; - if(pgescape==true) - { - url = url + '&_escape=true'; - } - window.location = url; - } - - - function search_nav_jump1(jmp_to) - { - //var jmp_to = document.search_nav.search_nav.selectedIndex; - //jmp_to++; - search_nav_jump(jmp_to); - } - - - function search_nav_top() - { - if(pages <= 1) - { - return ""; - } - else - { - var rw = ''; - var ff = ''; - var jmp= ''; - - if(page > 1) - { - var last = page - 1; - rw = ' '; - rw = rw + '    '; - } else { - rw = '   '; - rw = rw + '    '; - } - - if(page < pages) - { - var next = page; - next++; - ff = '   '; - ff = ff + '   '; - } else { - ff = '   '; - ff = ff + '   '; - } - - jmp = ' '; - - var ret = '
    '; - ret = ret + ''; - ret = ret + ''; - ret = ret + ''; - ret = ret + '
    '+ rw +''+ jmp +'
    '+ ff +'
    '; - return ret; - } - } - - - - // search heading handler - function search_heading(title,field) - { - if(order == field) - { - if(sort1 == "desc=") - { - var returns = ''+title+' '; - return returns; - } - if(sort1 == "asc=") - { - var returns = ''+title+' '; - return returns; - } - } - else - { - var returns = ''+title+''; - } - return returns; - } - - - - // Function to handle select/unselect of values - function row_sel(id,type,style) - { - if(type == 0) - { - eval('document.form1.record'+id+'.checked = false;'); - class_change("row"+id, style); - return; - } - - eval('var checked = document.form1.record'+id+'.checked;'); - if(checked == false) - { - eval('document.form1.record'+id+'.checked = true;'); - class_change("row"+id, "row_select"); - return; - } else { - eval('document.form1.record'+id+'.checked = false;'); - class_change("row"+id, "row_select"); - return; - } - } - - - - // handles the mouseover event for row... - function row_mouseover(id,style1,style2) - { - eval('var checked = document.form1.record'+id+'.checked;'); - if(checked == false) - { - class_change("row"+id, style2); - return; - } else { - class_change("row"+id, style1); - return; - } - } - - - - // handles the mouseover event for row... - function row_mouseout(id,style1,style2) - { - eval('var checked = document.form1.record'+id+'.checked;'); - if(checked == false) - { - class_change("row"+id, style1); - return; - } else { - class_change("row"+id, style2); - return; - } - } - - - - // selects all the records - function all_select() - { - for(i=0; i < limit; i++) - { - if(record_arr[i] != undefined) - { - eval('document.form1.record'+record_arr[i]+'.checked = true;'); - class_change("row"+record_arr[i],"row_select"); - } - } - } - - - - - - // unselects all the records - function all_deselect() - { - var c = true; - for(i=0; i < limit; i++) - { - if(record_arr[i] != undefined) - { - eval('document.form1.record'+record_arr[i]+'.checked = false;'); - if(c) - { - class_change("row"+record_arr[i],"row1"); - c = false; - } - else - { - class_change("row"+record_arr[i],"row2"); - c = true; - } - } - } - } - - - - - // select all the records between the first & last selected rows - function all_range_select() - { - var start = false; - var end = false; - - for(i=0; i < limit; i++) - { - if(record_arr[i] != undefined) - { - eval('var checked = document.form1.record'+record_arr[i]+'.checked;'); - if(checked != "") - { - if(!start) - { - start = true; - } - else - { - end = true; - } - } - else - { - if((start == true) && (end == false)) - { - eval('document.form1.record'+record_arr[i]+'.checked = true;'); - class_change("row"+record_arr[i],"row_select"); - } - else - { - start = false; - end = false; - } - } - } - } - } - - - - - - - // Mass update, view, and delete controller - function mass_do(doit, page, limit, module) - { - var count = 0; - var id = ""; - - for(i=0; i < limit; i++) - { - if(record_arr[i] != undefined) - { - eval('var checked = document.form1.record'+record_arr[i]+'.checked;'); - eval('var this_id = document.form1.record'+record_arr[i]+'.value;'); - if(checked != "") - { - count++; - id = id + this_id + ","; - } - } - } - - if(count == 0) - { - alert("You must first select some records for this action!"); - return; - } - - - if(count > 0) - { - var url = '?_page=' + page + '&id=' + id + '' + COOKIE_URL; - if(doit != '') - { - url = url + '&do[]=' + module + ':' + doit; - - if(doit == "delete") - { - if(count == 1) - { - temp = window.confirm("Are you sure you wish to delete this record?"); - window.status=(temp)?'confirm:true':'confirm:false'; - } - else - { - temp = window.confirm("Are you sure you wish to delete these records?"); - window.status=(temp)?'confirm:true':'confirm:false'; - } - if(temp == false) return; - - } - } - window.location = url; - } - } - - - var nav4 = document.search_results ? true : false; - function key_handler(e) - { - // Navigator 4.0x - if (nav4) - { - var whichCode = e.which; - } - else - { - // Internet Explorer 4.0x - if (e.type == "keypress") - { - var whichCode = e.keyCode; - } - else - { - var whichCode = e.button; - } - } - - if (e.type == "keypress") - { - var pressed = String.fromCharCode(whichCode); - } - else - { - var pressed = whichCode; - } - - // determine the function to run, if any... - if(pressed == 's' || pressed == 'S') - { - all_select(record_arr,limit); - } - - if(pressed == 'd' || pressed == 'D') - { - all_deselect(record_arr,limit); - } - - if(pressed == 'r' || pressed == 'R') - { - all_range_select(record_arr,limit); - } - - if(pressed == 'x' || pressed == 'X') - { - mass_do('delete', module+ ":search_show&search_id=" +search_id+ "&page=" +page+ "&order_by=" +order+ "&" +sort1, limit, module); - } - - if(pressed == 'v' || pressed == 'V') - { - mass_do('',module+":view", limit, module); - } - } diff --git a/themes/default/template.tpl b/themes/default/template.tpl index 5ec396f6..9e4a55ac 100644 --- a/themes/default/template.tpl +++ b/themes/default/template.tpl @@ -1,103 +1,102 @@ - -{$smarty.const.SITE_NAME} - Powered by AgileBill + +{$smarty.const.SITE_NAME} - Powered by Open Source Billing - + + {literal} + if (top.location != location) { + top.location.href = document.location.href ; + } + {/literal} +//--> + - - - - + + +
    - - - - - -
    - -
    - - {if $list->auth_method_by_name("account_admin","view") && $SESS_LOGGED == "1" } - {translate}admin{/translate} - {/if} - -
    + +{if $list->auth_method_by_name('account','view') && $SESS_LOGGED == '1'} + +{/if} diff --git a/themes/default/top.js b/themes/default/top.js index 9c2f8294..a8077526 100644 --- a/themes/default/top.js +++ b/themes/default/top.js @@ -1,18 +1,3 @@ -function get_cookie(name) { - var search = name + "=" - var returnvalue = ""; - if (document.cookie.length > 0) { - offset = document.cookie.indexOf(search) - if (offset != -1) { - offset += search.length - end = document.cookie.indexOf(";", offset); - if (end == -1) end = document.cookie.length; - returnvalue=unescape(document.cookie.substring(offset, end)) - } - } - return returnvalue; -} - // check for cookies to determine if forms/urls need the session included. var SESS_check = get_cookie(cookie_name); if (SESS_check != SESS) { @@ -27,6 +12,29 @@ if (SESS_check != SESS) { var COOKIE_FORM = ''; } +if(sess_expires >= 120) { + sess_timeout = (sess_expires * 1000) - 60000; + var url = URL+'?_page=core:sess_timeout&_escape=true'; + var win = 'SessTimeoutWin'; + var settings = 'toolbar=no,status=yes,width=200,height=200'; + ident=window.setTimeout("NewWindow(win,settings,url)",sess_timeout); +} + +function get_cookie(name) { + var search = name + "=" + var returnvalue = ""; + if (document.cookie.length > 0) { + offset = document.cookie.indexOf(search) + if (offset != -1) { + offset += search.length + end = document.cookie.indexOf(";", offset); + if (end == -1) end = document.cookie.length; + returnvalue=unescape(document.cookie.substring(offset, end)) + } + } + return returnvalue; +} + function refresh(delay,url) { document.write(''); } @@ -37,14 +45,6 @@ function NewWindow(win,settings,url) { eval(eval1); } -if(sess_expires >= 120) { - sess_timeout = (sess_expires * 1000) - 60000; - var url = URL+'?_page=core:sess_timeout&_escape=true'; - var win = 'SessTimeoutWin'; - var settings = 'toolbar=no,status=yes,width=200,height=200'; - ident=window.setTimeout("NewWindow(win,settings,url)",sess_timeout); -} - // Change the class for an object function class_change(obj,style) { if(navigator.userAgent.indexOf("Netscape") != -1) { @@ -52,60 +52,59 @@ function class_change(obj,style) { obj1.setAttribute('class', style); return; } else if(navigator.userAgent.indexOf("MSIE") != -1) { - eval(obj+'.className = "'+style+'";'); - return; + eval(obj+'.className = "'+style+'";'); + return; } else if(navigator.userAgent.indexOf("Mozilla") != -1) { var obj1 = document.getElementById(obj); obj1.setAttribute('class', style); return; } else { - eval(obj+'.className = "'+style+'";'); - return; - } + eval(obj+'.className = "'+style+'";'); + return; + } } // View a record based on the item selected from the drop-down menu ($list->menu) function menu_item_view(module,id) { - var selected_id; - eval ('selected_id = document.getElementById("'+id+'").value;'); - if(selected_id != '') - document.location = '?_page='+module+':view&id='+selected_id+',&s='+SESS; + var selected_id; + eval ('selected_id = document.getElementById("'+id+'").value;'); + if(selected_id != '') + document.location = '?_page='+module+':view&id='+selected_id+',&s='+SESS; } // Add a record based on the item selected from the drop-down menu ($list->menu) function menu_item_add(module,id) { - var selected_id2; - eval ('selected_id2 = document.getElementById("'+id+'").value;'); - if(selected_id2 != '') - document.location = '?_page='+module+':add&id='+selected_id2+',&s='+SESS; + var selected_id2; + eval ('selected_id2 = document.getElementById("'+id+'").value;'); + if(selected_id2 != '') + document.location = '?_page='+module+':add&id='+selected_id2+',&s='+SESS; } // Display a Iframe function showIFrame(element,width,height,src) { - document.getElementById(element).style.width = width+'px'; - document.getElementById(element).style.height = height+'px'; - if(src != false) + document.getElementById(element).style.width = width+'px'; + document.getElementById(element).style.height = height+'px'; + if(src != false) frames[element].location.href = src; } // Hide an IFrame function hideIFrame(element) { - document.getElementById(element).style.width = '0px'; - document.getElementById(element).style.height = '0px'; - document.getElementById(element).style.align = 'center'; + document.getElementById(element).style.width = '0px'; + document.getElementById(element).style.height = '0px'; + document.getElementById(element).style.align = 'center'; return false; -} - +} // Get the page width -function getPageWidth(defaultWidth) { +function getPageWidth(defaultWidth) { if (self.innerWidth) { - return self.innerWidth * .96; + return self.innerWidth * .96; //return defaultWidth; } else if (document.documentElement && document.documentElement.clientWidth) { - //return document.documentElement.clientWidth; + //return document.documentElement.clientWidth; return defaultWidth * .96; - } else if (document.body) { + } else if (document.body) { return document.body.clientWidth *.96; } else { return defaultWidth; @@ -113,27 +112,13 @@ function getPageWidth(defaultWidth) { } function getHTTPObject() { - var xmlhttp; - /*@cc_on - @if (@_jscript_version >= 5) - try { - xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); - } catch (e) { - try { - xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); - } catch (E) { - xmlhttp = false; - } + var xmlhttp; + if (!xmlhttp && typeof XMLHttpRequest != 'undefined') { + try { + xmlhttp = new XMLHttpRequest(); + } catch (e) { + xmlhttp = false; + } } - @else - xmlhttp = false; - @end @*/ - if (!xmlhttp && typeof XMLHttpRequest != 'undefined') { - try { - xmlhttp = new XMLHttpRequest(); - } catch (e) { - xmlhttp = false; - } - } - return xmlhttp; -} \ No newline at end of file + return xmlhttp; +} diff --git a/themes/default/user_search.js b/themes/default/user_search.js index 4a38af68..95ce86dd 100644 --- a/themes/default/user_search.js +++ b/themes/default/user_search.js @@ -1,352 +1,262 @@ - function search_nav_jump(jmp_to) - { - var url = '?_page='+module+':user_search_show&search_id='+search_id+'&page='+jmp_to +'&' + sort1 + '&order_by=' + order + p + COOKIE_URL; - if(pgescape==true) - { - url = url + '&_escape=true'; +function search_nav_jump(jmp_to) { + var url = '?_page='+module+':user_search_show&search_id='+search_id+'&page='+jmp_to +'&' + sort1 + '&order_by=' + order + p + COOKIE_URL; + if(pgescape==true) + url += '&_escape=1'; + + window.location = url; +} + +function search_nav_jump1(jmp_to) { + search_nav_jump(jmp_to); +} + +function search_nav_top() { + if(pages <= 1) { + return ''; + + } else { + var rw = ''; + var ff = ''; + var jmp= ''; + + if(page > 1) { + var last = page - 1; + rw = ' '; + rw += '    '; + } else { + rw = '   '; + rw += '    '; } - window.location = url; + + if(page < pages) { + var next = page; + next++; + ff = '   '; + ff += '   '; + } else { + ff = '   '; + ff += '   '; + } + + jmp = ' '; + var ret = '
    '; + ret += ''; + ret += '' + COOKIE_FORM; + ret += ''; + ret += '
    '+ rw +''+ jmp +'
    '+ ff +'
    '; + + return ret; } - - - function search_nav_jump1(jmp_to) - { - //var jmp_to = document.search_nav.search_nav.selectedIndex; - //jmp_to++; - search_nav_jump(jmp_to); - } - - - function search_nav_top() - { - if(pages <= 1) - { - return ""; - } - else - { - var rw = ''; - var ff = ''; - var jmp= ''; - - if(page > 1) - { - var last = page - 1; - rw = ' '; - rw = rw + '    '; +} + +// search heading handler +function search_heading(title,field) { + if(order == field) { + if(sort1 == 'desc=') { + newsort = 'asc'; + newimg = 'desc.gif'; + } + + if(sort1 == 'asc=') { + newsort = 'desc'; + newimg = 'asc.gif'; + } + + } else { + newsort = 'asc'; + newimg = ''; + } + + var url = '?_page='+module+':user_search_show&search_id='+search_id+'&page='+page+'&'+newsort+'=&order_by='+field+''+p+COOKIE_URL; + + if (newimg) + var returns = ''+title+' '; + else + var returns = ''+title+''; + + return returns; +} + +// Function to handle select/unselect of values +function row_sel(id,type,style) { + if(type == 0) { + eval('document.getElementById("search_show").record'+id+'.checked = false;'); + class_change('row'+id, style); + return; + } + + eval('var checked = document.getElementById("search_show").record'+id+'.checked;'); + + if(checked == false) { + eval('document.getElementById("search_show").record'+id+'.checked = true;'); + } else { + eval('document.getElementById("search_show").record'+id+'.checked = false;'); + } + + class_change('row'+id, 'row_select'); + return; +} + +// handles the mouseover event for row... +function row_mouseover(id,style1,style2) { + eval('var checked = document.getElementById("search_show").record'+id+'.checked;'); + + class_change('row'+id, checked ? style1 : style2); +} + +// handles the mouseover event for row... +function row_mouseout(id,style1,style2) { + eval('var checked = document.getElementById("search_show").record'+id+'.checked;'); + + class_change('row'+id, checked ? style2 : style1); +} + +// selects all the records +function all_select() { + for(i=0; i < limit; i++) { + if(record_arr[i] != undefined) { + eval('document.getElementById("search_show").record'+record_arr[i]+'.checked = true;'); + class_change('row'+record_arr[i],'row_select'); + } + } +} + +// unselects all the records +function all_deselect() { + var c = true; + for(i=0; i < limit; i++) { + if(record_arr[i] != undefined) { + eval('document.getElementById("search_show").record'+record_arr[i]+'.checked = false;'); + if(c) { + class_change('row'+record_arr[i],'row1'); + c = false; } else { - rw = '   '; - rw = rw + '    '; + class_change('row'+record_arr[i],'row2'); + c = true; } - - if(page < pages) - { - var next = page; - next++; - ff = '   '; - ff = ff + '   '; + } + } +} + +// select all the records between the first & last selected rows +function all_range_select() { + var start = false; + var end = false; + + for(i=0; i < limit; i++) { + if(record_arr[i] != undefined) { + eval('var checked = document.getElementById("search_show").record'+record_arr[i]+'.checked;'); + + if(checked != '') { + if(!start) { + start = true; + } else { + end = true; + } + } else { - ff = '   '; - ff = ff + '   '; - } - - jmp = ' '; - - var ret = '
    '; - ret = ret + ''; - ret = ret + '' + COOKIE_FORM; - ret = ret + ''; - ret = ret + '
    '+ rw +''+ jmp +'
    '+ ff +'
    '; - return ret; - } - } - - - - // search heading handler - function search_heading(title,field) - { - if(order == field) - { - if(sort1 == "desc=") - { - var returns = ''+title+' '; - return returns; - } - if(sort1 == "asc=") - { - var returns = ''+title+' '; - return returns; + if((start == true) && (end == false)) { + eval('document.getElementById("search_show").record'+record_arr[i]+'.checked = true;'); + class_change('row'+record_arr[i],'row_select'); + } else { + start = false; + end = false; + } } } - else - { - var returns = ''+title+''; - } - return returns; } - - - - // Function to handle select/unselect of values - function row_sel(id,type,style) - { - if(type == 0) - { - eval('document.form1.record'+id+'.checked = false;'); - class_change("row"+id, style); - return; +} + +// Mass update, view, and delete controller +function mass_do(doit, page, limit, module) { + var count = 0; + var id = ''; + + for(i=0; i < limit; i++) { + if(record_arr[i] != undefined) { + eval('var checked = document.getElementById("search_show").record'+record_arr[i]+'.checked;'); + eval('var this_id = document.getElementById("search_show").record'+record_arr[i]+'.value;'); + + if(checked != '') { + count++; + id = id + this_id + ','; + } } - - eval('var checked = document.form1.record'+id+'.checked;'); - if(checked == false) - { - eval('document.form1.record'+id+'.checked = true;'); - class_change("row"+id, "row_select"); - return; + } + + if(count == 0) { + alert('You must first select some records for this action!'); + return; + } + + if(count > 0) { + var url = '?_page=' + page + '&id=' + id + '' + COOKIE_URL; + + if(doit != '') { + url = url + '&do[]=' + module + ':' + doit; + + if(doit == 'delete') { + if(count == 1) { + temp = window.confirm('Are you sure you wish to delete this record?'); + } else { + temp = window.confirm('Are you sure you wish to delete these records?'); + } + + window.status=(temp)?'confirm:true':'confirm:false'; + if(temp == false) return; + + } + } + + window.location = url; + } +} + +var nav4 = document.search_results ? true : false; +function key_handler(e) { + // Navigator 4.0x + if (nav4) { + var whichCode = e.which; + } else { + // Internet Explorer 4.0x + if (e.type == 'keypress') { + var whichCode = e.keyCode; } else { - eval('document.form1.record'+id+'.checked = false;'); - class_change("row"+id, "row_select"); - return; + var whichCode = e.button; } } - - - - // handles the mouseover event for row... - function row_mouseover(id,style1,style2) - { - eval('var checked = document.form1.record'+id+'.checked;'); - if(checked == false) - { - class_change("row"+id, style2); - return; - } else { - class_change("row"+id, style1); - return; - } + + if (e.type == 'keypress') { + var pressed = String.fromCharCode(whichCode); + } else { + var pressed = whichCode; } - - - - // handles the mouseover event for row... - function row_mouseout(id,style1,style2) - { - eval('var checked = document.form1.record'+id+'.checked;'); - if(checked == false) - { - class_change("row"+id, style1); - return; - } else { - class_change("row"+id, style2); - return; - } - } - - - - // selects all the records - function all_select() - { - for(i=0; i < limit; i++) - { - if(record_arr[i] != undefined) - { - eval('document.form1.record'+record_arr[i]+'.checked = true;'); - class_change("row"+record_arr[i],"row_select"); - } - } + + // determine the function to run, if any... + if(pressed == 's' || pressed == 'S') { + all_select(record_arr,limit); } - - - - - - // unselects all the records - function all_deselect() - { - var c = true; - for(i=0; i < limit; i++) - { - if(record_arr[i] != undefined) - { - eval('document.form1.record'+record_arr[i]+'.checked = false;'); - if(c) - { - class_change("row"+record_arr[i],"row1"); - c = false; - } - else - { - class_change("row"+record_arr[i],"row2"); - c = true; - } - } - } + + if(pressed == 'd' || pressed == 'D') { + all_deselect(record_arr,limit); } - - - - // select all the records between the first & last selected rows - function all_range_select() - { - var start = false; - var end = false; - - for(i=0; i < limit; i++) - { - if(record_arr[i] != undefined) - { - eval('var checked = document.form1.record'+record_arr[i]+'.checked;'); - if(checked != "") - { - if(!start) - { - start = true; - } - else - { - end = true; - } - } - else - { - if((start == true) && (end == false)) - { - eval('document.form1.record'+record_arr[i]+'.checked = true;'); - class_change("row"+record_arr[i],"row_select"); - } - else - { - start = false; - end = false; - } - } - } - } + if(pressed == 'r' || pressed == 'R') { + all_range_select(record_arr,limit); } - - - - - - // Mass update, view, and delete controller - function mass_do(doit, page, limit, module) - { - var count = 0; - var id = ""; - - for(i=0; i < limit; i++) - { - if(record_arr[i] != undefined) - { - eval('var checked = document.form1.record'+record_arr[i]+'.checked;'); - eval('var this_id = document.form1.record'+record_arr[i]+'.value;'); - if(checked != "") - { - count++; - id = id + this_id + ","; - } - } - } - - if(count == 0) - { - alert("You must first select some records for this action!"); - return; - } - - - if(count > 0) - { - var url = '?_page=' + page + '&id=' + id + '' + COOKIE_URL; - if(doit != '') - { - url = url + '&do[]=' + module + ':' + doit; - - if(doit == "delete") - { - if(count == 1) - { - temp = window.confirm("Are you sure you wish to delete this record?"); - window.status=(temp)?'confirm:true':'confirm:false'; - } - else - { - temp = window.confirm("Are you sure you wish to delete these records?"); - window.status=(temp)?'confirm:true':'confirm:false'; - } - if(temp == false) return; - - } - } - window.location = url; - } + if(pressed == 'x' || pressed == 'X') { + mass_do('delete', module+ ":user_search_show&search_id=" +search_id+ "&page=" +page+ "&order_by=" +order+ "&" +sort1, limit, module); } - - - var nav4 = document.search_results ? true : false; - function key_handler(e) - { - // Navigator 4.0x - if (nav4) - { - var whichCode = e.which; - } - else - { - // Internet Explorer 4.0x - if (e.type == "keypress") - { - var whichCode = e.keyCode; - } - else - { - var whichCode = e.button; - } - } - - if (e.type == "keypress") - { - var pressed = String.fromCharCode(whichCode); - } - else - { - var pressed = whichCode; - } - - // determine the function to run, if any... - if(pressed == 's' || pressed == 'S') - { - all_select(record_arr,limit); - } - - if(pressed == 'd' || pressed == 'D') - { - all_deselect(record_arr,limit); - } - - if(pressed == 'r' || pressed == 'R') - { - all_range_select(record_arr,limit); - } - - if(pressed == 'x' || pressed == 'X') - { - mass_do('delete', module+ ":user_search_show&search_id=" +search_id+ "&page=" +page+ "&order_by=" +order+ "&" +sort1, limit, module); - } - - if(pressed == 'v' || pressed == 'V') - { - mass_do('',module+":view", limit, module); - } - } + + if(pressed == 'v' || pressed == 'V') { + mass_do('',module+":view", limit, module); + } +} diff --git a/themes/default/user_view.js b/themes/default/user_view.js new file mode 100644 index 00000000..26ef6e57 --- /dev/null +++ b/themes/default/user_view.js @@ -0,0 +1,68 @@ +// Navigation handler, when viewing more than 1 record. +var array_id = id.split(','); +var array_ids = ids.split(','); + +if (array_id.length > 2) { + document.location = '?_page='+module+':user_view&id='+array_id[0]+'&ids='+id; +} else if (array_ids.length > 2) { + document.write(view_nav_top(array_ids,id,ids)); +} + +function view_jump(jmp_to,ids) { + var url = '?_page='+module+':user_view&id='+jmp_to +'&ids='+ids; + if (pgescape==true) + url += '&_escape=true'; + window.location = url; +} + +function view_nav_top(array,id,ids) { + var rw = ''; + var ff = ''; + var jmp= ''; + + var t=array.length-1; + + var last = false; + var next = false; + var last_id = array[t]; + + jmp = ' '; + + if (array[0] != id) { + rw = ' '; + rw += '    '; + } else { + rw = '   '; + rw += '    '; + } + + if (last_id != id) { + ff = '   '; + ff += '   '; + } else { + ff = '   '; + ff += '   '; + } + + var ret = '
    '; + ret += ''; + ret += ''; + ret += ''; + ret += '
    '+rw+''+jmp+'
    '+ff+'
    '; + + return ret; +} diff --git a/themes/default_admin/blocks/core/admin.tpl b/themes/default_admin/blocks/core/admin.tpl index 82c853ad..43fdd571 100644 --- a/themes/default_admin/blocks/core/admin.tpl +++ b/themes/default_admin/blocks/core/admin.tpl @@ -1,230 +1,120 @@ {if $SESS_LOGGED == true} -
    -Account Quick Search {html_select_account name="id"} - -
    + {assign var=meth value=':'|explode:$VAR._page} + + + -{ $method->exe('invoice', 'performance') } -{if $method->result == TRUE} - - - - - - - -
    - -
    -
    - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {if $show_tickets == true} - - - - - - - - {/if} - {if $show_affiliates == true} - - - - - - - - {/if} - -
    - {translate module=invoice} - indicator - {/translate} - - {translate module=invoice} - period - {/translate} - - {translate module=invoice} - current - {/translate} - - {translate module=invoice} - previous - {/translate} - - {translate module=invoice} - change - {/translate} -
    - {translate module=invoice} - sales - {/translate} - {$period_compare} - { $list->format_currency_num($sales_current, '') } - { $list->format_currency_num($sales_previous, '')} - {$sales_change}
    - {translate module=invoice} - forcast - {/translate} - {$period_forcast} - { $list->format_currency_num($forcast_current, '') } - -  {$forcast_change}
    {translate module=invoice} - quota - {/translate} - - {translate module=invoice} - today - {/translate} - - { $list->format_currency_num($quota_current, '') } - --
    - {translate module=invoice} - arcredits - {/translate} - {$period_compare} - { $list->format_currency_num($ar_credits_current, '') } - - { $list->format_currency_num($ar_credits_previous, '')} - {$ar_credit_change}
    - {translate module=invoice} - arbalance - {/translate} - {$period_compare} - { $list->format_currency_num($ar_balance_current, '') } - - { $list->format_currency_num($ar_balance_last, '')} - -
    - {translate module=invoice} - users - {/translate} - {$period_compare} - {$users_current} - - {$users_previous} - {$users_change}
    - {translate module=invoice} - tickets - {/translate} - {$period_compare} - {$tickets_current} - - {$tickets_previous} - {$tickets_change}
    - {translate module=invoice} - affiliatesales - {/translate} - {$period_compare} - { $list->format_currency_num($affiliate_sales_current, '') } - - { $list->format_currency_num($affiliate_sales_previous, '')} - {$affiliate_sales_change}
    -
    -
    -
    -{$calendar} -{/if} + {$method->exe('invoice','performance')} + {if $method->result == true} + + + + + + + +
    + +
    +
    +
    -{if $list->is_installed('account_message')} -{$method->exe_noauth('account_message','view')} -
    -Update System Message
    - - - - - -
    -{/if} + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {if $show_affiliates == true} + + + + + + + + {/if} +
    {t}Indicator{/t}{t}Period{/t}{t}Current{/t}{t}Previous{/t}{t}Change{/t}
    {t}Sales{/t}{$period_compare}{$list->format_currency_num($sales_current,'')}{$list->format_currency_num($sales_previous,'')}{$sales_change}
    {t}Forcast{/t}{$period_forcast}{$list->format_currency_num($forcast_current,'')}-{$forcast_change}
    {t}Quota{/t}{t}Today{/t}{$list->format_currency_num($quota_current,'')}--
    {t}A/R Credits{/t}{$period_compare}{$list->format_currency_num($ar_credits_current,'')}{$list->format_currency_num($ar_credits_previous,'')}{$ar_credit_change}
    {t}A/R Balance{/t}{$period_compare}{$list->format_currency_num($ar_balance_current,'')}{$list->format_currency_num($ar_balance_last,'')}-
    {t}Users{/t}{$period_compare}{$users_current}{$users_previous}{$users_change}
    {t module=invoice}affiliatesales{/t}{$period_compare}{$list->format_currency_num($affiliate_sales_current,'')}{$list->format_currency_num($affiliate_sales_previous,'')}{$affiliate_sales_change}
    +
    + +
    +
    + {$calendar} + {/if} -{else} + {if $list->is_installed('account_message')} + {$method->exe_noauth('account_message','view')} +
    + {t}Update System Message{/t}
    +
    + + + + +
    + {/if} + +{else} {$block->display('account:main')} {/if} - diff --git a/themes/default_admin/blocks/core/bottom_frame.tpl b/themes/default_admin/blocks/core/bottom_frame.tpl new file mode 100644 index 00000000..308b1d01 --- /dev/null +++ b/themes/default_admin/blocks/core/bottom_frame.tpl @@ -0,0 +1,2 @@ + + diff --git a/themes/default_admin/blocks/core/leftFrameBlue.tpl b/themes/default_admin/blocks/core/leftFrameBlue.tpl index ee7dd339..3b52bf76 100644 --- a/themes/default_admin/blocks/core/leftFrameBlue.tpl +++ b/themes/default_admin/blocks/core/leftFrameBlue.tpl @@ -1,195 +1,238 @@ - - - -{$smarty.const.SITE_NAME} - + + + +{$smarty.const.SITE_NAME} + + - - + + {literal} - - - + } +//--> + +{/literal} + + + + +{popup_init src="$URL/includes/overlib/overlib.js"} +
     
    - - -
    + + + + - - + + - - +
    - - + {literal} + - - + + {literal} + + {/literal} - - - + + {literal} + + {/literal} +
      + Account {/literal}
      - Invoice 
      -
    Service 
    -
    - {/literal} - {$list->generate_admin_menu()} -
    {$list->generate_admin_menu()}
    - Copyright 2004-2009, Agileco, LLC.
    - All Rights Reserved. +
    +Copyright 2004-2008, Agileco, LLC.
    +Copyright 2009, OSB.
    +All Rights Reserved.
    -
    - + {literal} - {/literal} - - \ No newline at end of file + } + var u = '?_page=core:search&module='+m+'&_next_page_one=view'+st; + openUrl(u); + } + + function checkEnter(e) { + var characterCode; + + if(e && e.which){ + characterCode = e.which; + } else{ + e = event; + characterCode = e.keyCode; + } + + if(characterCode == 13){ + return true; + } else { + return false; + } + } +//--> + +{/literal} + + diff --git a/themes/default_admin/blocks/core/top_clean.tpl b/themes/default_admin/blocks/core/top_clean.tpl index ff1ef3fb..c2c03d26 100644 --- a/themes/default_admin/blocks/core/top_clean.tpl +++ b/themes/default_admin/blocks/core/top_clean.tpl @@ -1,19 +1,20 @@ - - - - + + + + +{$smarty.const.SITE_NAME} + + -{$smarty.const.SITE_NAME} - - + {/literal} +//--> + - - + + - + - + - -{popup_init src="$URL/includes/overlib/overlib.js"} - - + {if $VAR._page != 'email_template_translate:add' && $VAR._page != 'email_template_translate:view' && $VAR._page != 'newsletter:add' && $VAR._page != 'newsletter:send' && $VAR._page != 'newsletter:view' && $VAR._page != 'product:add' && $VAR._page != 'product_translate:edit' && $VAR._page != 'product_cat_translate:add' && $VAR._page != 'product_cat_translate:view' && - $VAR._page != 'static_page_translate:add' && $VAR._page != 'static_page_translate:view' } - - - - + $VAR._page != 'static_page_translate:add' && $VAR._page != 'static_page_translate:view'} + + + + {/if} + - + - + +{popup_init src="$URL/includes/overlib/overlib.js"} - - {if $alert} - { $block->display("core:alert") } - {/if} \ No newline at end of file + +{if $alert} + {$block->display('core:alert')} +{/if} diff --git a/themes/default_admin/blocks/core/top_frame.tpl b/themes/default_admin/blocks/core/top_frame.tpl index 00cc4e78..d0942802 100644 --- a/themes/default_admin/blocks/core/top_frame.tpl +++ b/themes/default_admin/blocks/core/top_frame.tpl @@ -1,58 +1,60 @@ - - -{$smarty.const.SITE_NAME} - - + + + + +{$smarty.const.SITE_NAME} + + - + if (top.location == location) { + top.location.href = document.location.href + '?tid=default_admin&tid=default_admin'; + } + {/literal} +//--> + - + - + - + - - -{popup_init src="$URL/includes/overlib/overlib.js"} - + {if $VAR._page != 'email_template_translate:add' && $VAR._page != 'email_template_translate:view' && $VAR._page != 'newsletter:add' && $VAR._page != 'newsletter:send' && $VAR._page != 'newsletter:view' && $VAR._page != 'product:add' && $VAR._page != 'product_translate:edit' && $VAR._page != 'product_cat_translate:add' && $VAR._page != 'product_cat_translate:view' && - $VAR._page != 'static_page_translate:add' && $VAR._page != 'static_page_translate:view' } - - - - + $VAR._page != 'static_page_translate:add' && $VAR._page != 'static_page_translate:view'} + + + + {/if} + - - + + + +{popup_init src="$URL/includes/overlib/overlib.js"} {if $alert} -{ $block->display("core:alert") } -{/if} \ No newline at end of file + {$block->display('core:alert')} +{/if} diff --git a/themes/default_admin/delete_record.js b/themes/default_admin/delete_record.js new file mode 100644 index 00000000..f488f722 --- /dev/null +++ b/themes/default_admin/delete_record.js @@ -0,0 +1,16 @@ +// Mass Delete controller +function delete_record(id,ids,msg) { + temp = window.confirm(msg ? msg : 'Do you want to delete this record?'); + if (temp == false) return; + + var replace_id = id+','; + ids = ids.replace(replace_id,''); + + if (ids == '') { + var url = '?_page=core:search&module='+module+'&do[]='+module+':delete&id='+id+COOKIE_URL; + } else { + var url = '?_page='+ module +':view&do[]='+module+':delete&id='+ids+COOKIE_URL; + } + + window.location = url; +} diff --git a/themes/default_admin/images/htaccess_error.gif b/themes/default_admin/images/htaccess_error.gif deleted file mode 100644 index b534b756..00000000 Binary files a/themes/default_admin/images/htaccess_error.gif and /dev/null differ diff --git a/themes/default_admin/search.js b/themes/default_admin/search.js index 3cc4502d..3960af6e 100644 --- a/themes/default_admin/search.js +++ b/themes/default_admin/search.js @@ -1,368 +1,284 @@ - var been_here = 0; +var been_here = 0; - function search_nav_jump(jmp_to) - { - // For some reason, IE wants to run this code snippet twice, so we stop it. - if(been_here == 0) { - been_here = 1; - var url = '?_page='+module+':search_show&search_id='+search_id+'&page='+jmp_to +'&' + sort1 + '&order_by=' + order + p; - if(pgescape==true) - { - url = url + '&_escape=1'; - } - window.location = url; - } +function search_nav_jump(jmp_to) { + // For some reason, IE wants to run this code snippet twice, so we stop it. + if(been_here == 0) { + been_here = 1; + var url = '?_page='+module+':search_show&search_id='+search_id+'&page='+jmp_to +'&' + sort1 + '&order_by=' + order + p; + if(pgescape==true) + url += '&_escape=1'; + + window.location = url; } - - - function search_nav_jump1(jmp_to) - { - search_nav_jump(jmp_to); - } - - - function search_nav_top() - { - var iPages = (new Number(pages)) + 0; - var iPage = (new Number(page )) + 0; +} - if(iPages <= 1) - { - return ""; - } - else - { - var rw = ''; - var ff = ''; - var jmp= ''; - - if(iPage > 1) - { - var last = iPage - 1; - rw = ' '; - rw = rw + '    '; - } else { - rw = '   '; - rw = rw + '    '; - } - - if(iPage < iPages) - { - var next = iPage; - ++next; - ff = '   '; - ff = ff + '   '; - } else { - ff = '   '; - ff = ff + '   '; - } - - jmp = ' of ' + iPages + ' pages'; - - var ret = '
    '; - ret = ret + ''; - ret = ret + ''; - ret = ret + ''; - ret = ret + '
    '+ rw +''+ jmp +'
    '+ ff +'
    '; - return ret; - } - } - - // paging validation and go - function search_nav_go(jumppage) - { - var iPages = (new Number(pages)) + 0; - var iPage = (new Number(jumppage )) + 0; - var iOrig = (new Number(page)) + 0; +function search_nav_jump1(jmp_to) { + search_nav_jump(jmp_to); +} - if(iPage == iOrig) { - return false; - } - if(iPage > 0 && iPage <= iPages) { - search_nav_jump(iPage); +function search_nav_top() { + var iPages = (new Number(pages)) + 0; + var iPage = (new Number(page)) + 0; + + if(iPages <= 1) { + return ''; + + } else { + var rw = ''; + var ff = ''; + var jmp= ''; + + if(iPage > 1) { + var last = iPage - 1; + rw = ' '; + rw += '    '; } else { - alert(iPage + " is an invalid page number. Please enter a number from 1 to " + iPages + "."); + rw = '   '; + rw += '    '; } + + if(iPage < iPages) { + var next = iPage; + ++next; + ff = '   '; + ff += '   '; + } else { + ff = '   '; + ff += '   '; + } + + jmp = ' of ' + iPages + ' pages'; + + var ret = '
    '; + ret += ''; + ret += ''; + ret += ''; + ret += '
    '+ rw +''+ jmp +'
    '+ ff +'
    '; + + return ret; + } +} + +// paging validation and go +function search_nav_go(jumppage) { + var iPages = (new Number(pages)) + 0; + var iPage = (new Number(jumppage)) + 0; + var iOrig = (new Number(page)) + 0; + + if(iPage == iOrig) { return false; } - - // search heading handler - function search_heading(title,field) - { - if(order == field) - { - if(sort1 == "desc=") - { - var returns = ''+title+' '; - return returns; - } - if(sort1 == "asc=") - { - var returns = ''+title+' '; - return returns; - } - } - else - { - var returns = ''+title+''; - } - return returns; + + if(iPage > 0 && iPage <= iPages) { + search_nav_jump(iPage); + } else { + alert(iPage + ' is an invalid page number. Please enter a number from 1 to ' + iPages + '.'); } - - - - // Function to handle select/unselect of values - function row_sel(id,type,style) - { - if(type == 0) - { - eval('document.form1.record'+id+'.checked = false;'); - class_change("row"+id, style); - return; + + return false; +} + +// search heading handler +function search_heading(title,field) { + if(order == field) { + if(sort1 == 'desc=') { + newsort = 'asc'; + newimg = 'desc.gif'; } - - eval('var checked = document.form1.record'+id+'.checked;'); - if(checked == false) - { - eval('document.form1.record'+id+'.checked = true;'); - class_change("row"+id, "row_select"); - return; + + if(sort1 == 'asc=') { + newsort = 'desc'; + newimg = 'asc.gif'; + } + + } else { + newsort = 'asc'; + newimg = ''; + } + + var url = '?_page='+module+':search_show&search_id='+search_id+'&page='+page+'&'+newsort+'=&order_by='+field+''+p+pgescape; + + if (newimg) + var returns = ''+title+' '; + else + var returns = ''+title+''; + + return returns; +} + +// Function to handle select/unselect of values +function row_sel(id,type,style) { + if(type == 0) { + document.getElementById("record"+id).checked = false; + class_change('row'+id, style); + return; + } + + var checked = document.getElementById("record"+id).checked; + + if(checked == false) { + document.getElementById("record"+id).checked = true; + } else { + document.getElementById("record"+id).checked = false; + } + + class_change('row'+id, 'row_select'); + return; +} + +// handles the mouseover event for row... +function row_mouseover(id,style1,style2) { + var checked = document.getElementById("record"+id).checked; + + class_change('row'+id, checked ? style1 : style2); +} + +// handles the mouseover event for row... +function row_mouseout(id,style1,style2) { + var checked = document.getElementById("record"+id).checked; + + class_change('row'+id, checked ? style2 : style1); +} + +// selects all the records +function all_select() { + for(i=0; i < limit; i++) { + if(record_arr[i] != undefined) { + document.getElementById("record"+record_arr[i]).checked = true; + class_change('row'+record_arr[i],'row_select'); + } + } +} + +// unselects all the records +function all_deselect() { + var c = true; + for(i=0; i < limit; i++) { + if(record_arr[i] != undefined) { + document.getElementById("record"+record_arr[i]).checked = false; + if(c) { + class_change('row'+record_arr[i],'row1'); + c = false; + } else { + class_change('row'+record_arr[i],'row2'); + c = true; + } + } + } +} + +// select all the records between the first & last selected rows +function all_range_select() { + var start = false; + var end = false; + + for(i=0; i < limit; i++) { + if(record_arr[i] != undefined) { + var checked = document.getElementById("record"+record_arr[i]).checked; + + if(checked != '') { + if(!start) { + start = true; + } else { + end = true; + } + + } else { + if((start == true) && (end == false)) { + document.getElementById("record"+record_arr[i]).checked = true; + class_change('row'+record_arr[i],'row_select'); + } else { + start = false; + end = false; + } + } + } + } +} + +// Mass update, view, and delete controller +function mass_do(doit, page, limit, module) { + var count = 0; + var id = ''; + + for(i=0; i < limit; i++) { + if(record_arr[i] != undefined) { + var checked = document.getElementById("record"+record_arr[i]).checked; + var this_id = document.getElementById("record"+record_arr[i]).value; + + if(checked != '') { + count++; + id = id + this_id + ','; + } + } + } + + if(count == 0) { + alert('You must first select some records for this action!'); + return; + } + + if(count > 0) { + var url = '?_page=' + page + '&id=' + id; + + if(doit != '') { + url = url + '&do[]=' + module + ':' + doit; + + if(doit == 'delete') { + if(count == 1) { + temp = window.confirm('Are you sure you wish to delete this record?'); + } else { + temp = window.confirm('Are you sure you wish to delete these records?'); + } + + window.status=(temp)?'confirm:true':'confirm:false'; + if(temp == false) return; + + } + } + + window.location = url; + } +} + +var nav4 = document.search_results ? true : false; +function key_handler(e) { + // Navigator 4.0x + if (nav4) { + var whichCode = e.which; + } else { + // Internet Explorer 4.0x + if (e.type == 'keypress') { + var whichCode = e.keyCode; } else { - eval('document.form1.record'+id+'.checked = false;'); - class_change("row"+id, "row_select"); - return; + var whichCode = e.button; } } - - - - // handles the mouseover event for row... - function row_mouseover(id,style1,style2) - { - eval('var checked = document.form1.record'+id+'.checked;'); - if(checked == false) - { - class_change("row"+id, style2); - return; - } else { - class_change("row"+id, style1); - return; - } + + if (e.type == 'keypress') { + var pressed = String.fromCharCode(whichCode); + } else { + var pressed = whichCode; } - - - - // handles the mouseover event for row... - function row_mouseout(id,style1,style2) - { - eval('var checked = document.form1.record'+id+'.checked;'); - if(checked == false) - { - class_change("row"+id, style1); - return; - } else { - class_change("row"+id, style2); - return; - } - } - - - - // selects all the records - function all_select() - { - for(i=0; i < limit; i++) - { - if(record_arr[i] != undefined) - { - eval('document.form1.record'+record_arr[i]+'.checked = true;'); - class_change("row"+record_arr[i],"row_select"); - } - } + + // determine the function to run, if any... + if(pressed == 's' || pressed == 'S') { + all_select(record_arr,limit); } - - - - - - // unselects all the records - function all_deselect() - { - var c = true; - for(i=0; i < limit; i++) - { - if(record_arr[i] != undefined) - { - eval('document.form1.record'+record_arr[i]+'.checked = false;'); - if(c) - { - class_change("row"+record_arr[i],"row1"); - c = false; - } - else - { - class_change("row"+record_arr[i],"row2"); - c = true; - } - } - } + + if(pressed == 'd' || pressed == 'D') { + all_deselect(record_arr,limit); } - - - - // select all the records between the first & last selected rows - function all_range_select() - { - var start = false; - var end = false; - - for(i=0; i < limit; i++) - { - if(record_arr[i] != undefined) - { - eval('var checked = document.form1.record'+record_arr[i]+'.checked;'); - if(checked != "") - { - if(!start) - { - start = true; - } - else - { - end = true; - } - } - else - { - if((start == true) && (end == false)) - { - eval('document.form1.record'+record_arr[i]+'.checked = true;'); - class_change("row"+record_arr[i],"row_select"); - } - else - { - start = false; - end = false; - } - } - } - } + if(pressed == 'r' || pressed == 'R') { + all_range_select(record_arr,limit); } - - - - - - // Mass update, view, and delete controller - function mass_do(doit, page, limit, module) - { - var count = 0; - var id = ""; - - for(i=0; i < limit; i++) - { - if(record_arr[i] != undefined) - { - eval('var checked = document.form1.record'+record_arr[i]+'.checked;'); - eval('var this_id = document.form1.record'+record_arr[i]+'.value;'); - if(checked != "") - { - count++; - id = id + this_id + ","; - } - } - } - - if(count == 0) - { - alert("You must first select some records for this action!"); - return; - } - - - if(count > 0) - { - var url = '?_page=' + page + '&id=' + id; - if(doit != '') - { - url = url + '&do[]=' + module + ':' + doit; - - if(doit == "delete") - { - if(count == 1) - { - temp = window.confirm("Are you sure you wish to delete this record?"); - window.status=(temp)?'confirm:true':'confirm:false'; - } - else - { - temp = window.confirm("Are you sure you wish to delete these records?"); - window.status=(temp)?'confirm:true':'confirm:false'; - } - if(temp == false) return; - - } - } - window.location = url; - } + if(pressed == 'x' || pressed == 'X') { + mass_do('delete', module+ ":search_show&search_id=" +search_id+ "&page=" +page+ "&order_by=" +order+ "&" +sort1, limit, module); } - - - var nav4 = document.search_results ? true : false; - function key_handler(e) - { - // Navigator 4.0x - if (nav4) - { - var whichCode = e.which; - } - else - { - // Internet Explorer 4.0x - if (e.type == "keypress") - { - var whichCode = e.keyCode; - } - else - { - var whichCode = e.button; - } - } - - if (e.type == "keypress") - { - var pressed = String.fromCharCode(whichCode); - } - else - { - var pressed = whichCode; - } - - // determine the function to run, if any... - if(pressed == 's' || pressed == 'S') - { - all_select(record_arr,limit); - } - - if(pressed == 'd' || pressed == 'D') - { - all_deselect(record_arr,limit); - } - - if(pressed == 'r' || pressed == 'R') - { - all_range_select(record_arr,limit); - } - - if(pressed == 'x' || pressed == 'X') - { - mass_do('delete', module+ ":search_show&search_id=" +search_id+ "&page=" +page+ "&order_by=" +order+ "&" +sort1, limit, module); - } - - if(pressed == 'v' || pressed == 'V') - { - mass_do('',module+":view", limit, module); - } - } + + if(pressed == 'v' || pressed == 'V') { + mass_do('',module+":view", limit, module); + } +} diff --git a/themes/default_admin/template.tpl b/themes/default_admin/template.tpl index eb32a0e6..49f54bbd 100644 --- a/themes/default_admin/template.tpl +++ b/themes/default_admin/template.tpl @@ -1,20 +1,19 @@ -{if $SESS_LOGGED == true } +{if $SESS_LOGGED == true} + -{$smarty.const.SITE_NAME} Administration - - - - - + {$smarty.const.SITE_NAME} Administration + + + + + + + <body bgcolor="#FFFFFF" text="#000000"> + </body> + - -<body bgcolor="#FFFFFF" text="#000000"> -</body> - - -{else} - -{/if} \ No newline at end of file + +{else} + +{/if} diff --git a/themes/default_admin/tinymce.js b/themes/default_admin/tinymce.js new file mode 100644 index 00000000..b83c97b0 --- /dev/null +++ b/themes/default_admin/tinymce.js @@ -0,0 +1,18 @@ +tinyMCE.init({ + mode : "specific_textareas", + theme : "advanced", + plugins : "table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print", + theme_advanced_buttons1_add : "fontselect,fontsizeselect", + theme_advanced_buttons2_add : "separator,insertdate,inserttime,preview,separator,forecolor,backcolor", + theme_advanced_buttons2_add_before: "cut,copy,paste,separator,search,replace,separator", + theme_advanced_buttons3_add_before : "tablecontrols,separator", + theme_advanced_buttons3_add : "iespell,media,advhr", + theme_advanced_toolbar_location : "bottom", + theme_advanced_toolbar_align : "center", + content_css : "themes/default/style.css", + plugin_insertdate_dateFormat : "%Y-%m-%d", + plugin_insertdate_timeFormat : "%H:%M:%S", + extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]", + relative_urls: 'true', + width : "100%" +}); diff --git a/themes/default_admin/view-advanced.js b/themes/default_admin/view-advanced.js new file mode 100644 index 00000000..2d65dbc1 --- /dev/null +++ b/themes/default_admin/view-advanced.js @@ -0,0 +1,179 @@ +function view_hideAll() { + if (! elements || ! elements.length) + return; + + for (i=0; i'; - for(i=0; iRecord '+i_actual+' of '+t+''; - last_id = array[i]; - } - jmp = jmp + ' '; - - - if (array[0] != id) { - rw = ' '; - rw = rw + '    '; - } else { - rw = '   '; - rw = rw + '    '; +if (array_id.length > 2) { + document.location = '?_page='+module+':view&id='+array_id[0]+'&ids='+id; +} else if (array_ids.length > 2) { + document.write(view_nav_top(array_ids,id,ids)); +} + +function view_jump(jmp_to,ids) { + var url = '?_page='+module+':view&id='+jmp_to +'&ids='+ids; + if (pgescape==true) + url += '&_escape=true'; + window.location = url; +} + +function view_nav_top(array,id,ids) { + var rw = ''; + var ff = ''; + var jmp= ''; + + var t=array.length-1; + + var last = false; + var next = false; + var last_id = array[t]; + + jmp = ''; - } else { - ff = '   '; - ff = ff + '   '; - } - - var ret = '
    '; - ret = ret + ''; - ret = ret + ''; - ret = ret + ''; - ret = ret + '
    '+ rw +''+ jmp +'
    '+ ff +'
    '; - return ret; + jmp = jmp + '>Record '+i_actual+' of '+t+''; + last_id = array[i]; } - - - \ No newline at end of file + jmp = jmp + ' '; + + if (array[0] != id) { + rw = ' '; + rw += '    '; + } else { + rw = '   '; + rw += '    '; + } + + if (last_id != id) { + ff = '   '; + ff += '   '; + } else { + ff = '   '; + ff += '   '; + } + + var ret = '
    '; + ret += ''; + ret += ''; + ret += ''; + ret += '
    '+rw+''+jmp+'
    '+ff+'
    '; + + return ret; +}