forked from extern/egroupware
added pspadmin
This commit is contained in:
parent
d54d90e6f9
commit
da908c2311
1
psp_admin/README
Normal file
1
psp_admin/README
Normal file
@ -0,0 +1 @@
|
||||
See /doc for all information about this app.
|
105
psp_admin/inc/class.bo_pspadmin.inc.php
Normal file
105
psp_admin/inc/class.bo_pspadmin.inc.php
Normal file
@ -0,0 +1,105 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
||||
class bo_pspadmin
|
||||
{
|
||||
var $so;
|
||||
|
||||
function bo_pspadmin()
|
||||
{
|
||||
$this->so = CreateObject('psp_admin.so_pspadmin');
|
||||
}
|
||||
|
||||
function get_installed_modules($wrapper)
|
||||
{
|
||||
switch($wrapper)
|
||||
{
|
||||
case 'oscommerce':
|
||||
$fsplugins = $this->so->oscom_fsmodules();
|
||||
$dbplugins = $this->so->oscom_dbmodules();
|
||||
|
||||
foreach($dbplugins as $key=>$plugin)
|
||||
{
|
||||
$dbplugins[$key] = substr("$plugin",0,strpos($plugin,".php"));
|
||||
}
|
||||
|
||||
if ($dbplugins=='') $dbplugins = array();
|
||||
if ($fsplugins=='') $fsplugins = array();
|
||||
foreach($fsplugins as $record)
|
||||
{
|
||||
if(in_array($record, $dbplugins))
|
||||
{
|
||||
$_ret[] = array($record,'installed');
|
||||
} else $_ret[] = array($record, 'not_yet');
|
||||
}
|
||||
|
||||
foreach($dbplugins as $record)
|
||||
{
|
||||
if(!in_array($record, $fsplugins))
|
||||
{
|
||||
if($record != '') $_ret[] = array($record, 'broken');
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$_ret = 'not yet.';
|
||||
break;
|
||||
}
|
||||
return $_ret;
|
||||
}
|
||||
|
||||
function oscom_install($module)
|
||||
{
|
||||
require_once(EGW_INCLUDE_ROOT."/psp_admin/inc/wrap_osc_plugin.php");
|
||||
$osc_wrap = new wrap_osc_plugin($module);
|
||||
$debugmess = $osc_wrap->install();
|
||||
// todo: if and only if it really happened
|
||||
// insert it into the PAYMODINSTALLED list
|
||||
$this->so->oscom_installmod($module);
|
||||
return $module.' module installed.';
|
||||
}
|
||||
|
||||
function oscom_remove($module)
|
||||
{
|
||||
require_once(EGW_INCLUDE_ROOT."/psp_admin/inc/wrap_osc_plugin.php");
|
||||
$osc_wrap = new wrap_osc_plugin($module);
|
||||
$debugmess = $osc_wrap->remove();
|
||||
// todo: if and only if it really happened
|
||||
// remove it from the PAYMODINSTALLED list
|
||||
$this->so->oscom_removemod($module);
|
||||
return $module.' module removed.';
|
||||
}
|
||||
|
||||
function oscom_broken($module)
|
||||
{
|
||||
return 'error.';
|
||||
}
|
||||
|
||||
function config_module($module)
|
||||
{
|
||||
// form based on keys, values and types of plugin
|
||||
//
|
||||
require_once(EGW_INCLUDE_ROOT."/psp_admin/inc/wrap_osc_plugin.php");
|
||||
$osc_wrap = new wrap_osc_plugin($module);
|
||||
// get the keys and their values
|
||||
$plugin_keys = $osc_wrap->keys();
|
||||
|
||||
foreach($plugin_keys as $record)
|
||||
{
|
||||
$plugin_values[] = $this->so->oscmod_values($record);
|
||||
|
||||
$plugin_functions[$record] = $this->so->oscmod_functions($record);
|
||||
}
|
||||
// create displaybox 2d-array pluginkey[title, value, description]
|
||||
foreach($plugin_keys as $key=>$record)
|
||||
{
|
||||
//$display[$record] = array_values($plugin_values[$key]);
|
||||
$display[$record] = $plugin_values[$key];
|
||||
}
|
||||
return array($display, $plugin_functions);
|
||||
}
|
||||
|
||||
}
|
60
psp_admin/inc/class.so_oscadminapi.inc.php
Normal file
60
psp_admin/inc/class.so_oscadminapi.inc.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* class.so_oscadminapi.inc.php
|
||||
*
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
||||
class so_oscadminapi
|
||||
{
|
||||
var $ses_token;
|
||||
var $sessiondata;
|
||||
|
||||
function so_oscadminapi()
|
||||
{
|
||||
// constructor
|
||||
$this->load();
|
||||
$this->user_id = $GLOBALS['egw_info']['user']['account_id'];
|
||||
|
||||
}
|
||||
|
||||
|
||||
function load()
|
||||
{
|
||||
$this->sessiondata = $GLOBALS['phpgw']->session->appsession('session_data','oscadminapi');
|
||||
}
|
||||
|
||||
function save_session()
|
||||
{
|
||||
if(count($this->sessiondata) > 0) //this catches the bug in the phpgwapi crypto class..
|
||||
{
|
||||
$GLOBALS['phpgw']->session->appsession('session_data','oscadminapi',$this->sessiondata);
|
||||
}
|
||||
}
|
||||
|
||||
function save_token($token)
|
||||
{
|
||||
$GLOBALS['phpgw']->session->appsession('sestoken','oscadminapi',$token);
|
||||
}
|
||||
|
||||
function load_token()
|
||||
{
|
||||
return $GLOBALS['phpgw']->session->appsession('sestoken','oscadminapi');
|
||||
}
|
||||
|
||||
function getPersonalData($id)
|
||||
{
|
||||
$account =& CreateObject('phpgwapi.accounts',(int)$id,'u');
|
||||
$contact = $GLOBALS['egw']->contacts =& CreateObject('phpgwapi.contacts');
|
||||
$userData = $account->read_repository();
|
||||
$c_arr = $contact->read($userData['person_id']);
|
||||
#_Debug_array($userData);
|
||||
#_Debug_array($c_arr);
|
||||
|
||||
return array_merge($userData,$c_arr);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
312
psp_admin/inc/class.so_pspadmin.inc.php
Normal file
312
psp_admin/inc/class.so_pspadmin.inc.php
Normal file
@ -0,0 +1,312 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
||||
class so_pspadmin
|
||||
{
|
||||
|
||||
var $conf_table;
|
||||
var $db;
|
||||
|
||||
function so_pspadmin()
|
||||
{
|
||||
define(PAYMOD_DIR, EGW_INCLUDE_ROOT.'/psp_admin/inc/payment_modules/payment');
|
||||
define(CONF_TABLE, 'egw_oscadmin_osc_conf');
|
||||
$this->db = $GLOBALS['egw']->db;
|
||||
}
|
||||
|
||||
function default_settings()
|
||||
{
|
||||
// this needs to be cleaned/stripped whatever
|
||||
// make the modules work without these settings
|
||||
return array(
|
||||
'FILENAME_CHECKOUT_PROCESS' => array(
|
||||
'configuration_title' => 'FILENAME_CHECKOUT_PROCESS',
|
||||
'configuration_value' => 'index.php?menuaction=confirmcheckoutfunction',
|
||||
'configuration_description' => 'checkout process',
|
||||
'use_function' => 'NULL',
|
||||
'set_function' => 'NULL'
|
||||
),
|
||||
'STORE_NAME' => array(
|
||||
'configuration_title' => 'Store Name',
|
||||
'configuration_value'=>'INSTALL',
|
||||
'configuration_description'=>'The name of your store',
|
||||
'use_function'=>'NULL',
|
||||
'set_function'=>'NULL'
|
||||
),
|
||||
'STORE_OWNER' => array(
|
||||
'configuration_title'=>'Store Owner',
|
||||
'configuration_value'=>'Fill in',
|
||||
'configuration_description'=>'The name of my store owner',
|
||||
'use_function'=>'NULL',
|
||||
'set_function'=>'NULL'
|
||||
),
|
||||
'EMAIL_FROM' => array(
|
||||
'configuration_title'=>'E-Mail From',
|
||||
'configuration_value'=>'jataggo hosting <info@jataggo.com>',
|
||||
'configuration_description'=>'The e-mail address used in (sent) e-mails',
|
||||
'use_function'=>'NULL',
|
||||
'set_function'=>'NULL'
|
||||
),
|
||||
'STORE_COUNTRY' => array(
|
||||
'configuration_title'=>'Country',
|
||||
'configuration_value'=>'223',
|
||||
'configuration_description'=>'The country my store is located in <br><b>Note: Please remember to update the store zone.</b>',
|
||||
'use_function'=>'tep_get_country_name',
|
||||
'set_function'=>'tep_cfg_pull_down_country_list('
|
||||
),
|
||||
'STORE_ZONE' => array(
|
||||
'configuration_title'=>'Zone',
|
||||
'configuration_value'=>'18',
|
||||
'configuration_description'=>'The zone my store is located in',
|
||||
'use_function'=>'tep_cfg_get_zone_name',
|
||||
'set_function'=>'tep_cfg_pull_down_zone_list('
|
||||
),
|
||||
'STORE_NAME_ADDRESS' => array(
|
||||
'configuration_title'=>'Store Address and Phone',
|
||||
'configuration_value'=>'Jataggo.com',
|
||||
'configuration_description'=>'This is the Store Name, Address and Phone used on printable documents and displayed online',
|
||||
'use_function'=>'NULL',
|
||||
'set_function'=>'tep_cfg_textarea('
|
||||
),
|
||||
'DEFAULT_CURRENCY' => array(
|
||||
'configuration_title'=>'Default Currency',
|
||||
'configuration_value'=>'EUR',
|
||||
'configuration_description'=>'Default Currency',
|
||||
'use_function'=>'NULL',
|
||||
'set_function'=>'NULL'
|
||||
),
|
||||
'DEFAULT_LANGUAGE' => array(
|
||||
'configuration_title'=>'Default Language',
|
||||
'configuration_value'=>'NL',
|
||||
'configuration_description'=>'Default Language',
|
||||
'use_function'=>'NULL',
|
||||
'set_function'=>'NULL'
|
||||
),
|
||||
'DEFAULT_ORDERS_STATUS_ID' => array(
|
||||
'configuration_title'=>'Default Order Status For New Orders',
|
||||
'configuration_value'=>'1',
|
||||
'configuration_description'=>'When a new order is created, this order status will be assigned to it.',
|
||||
'use_function'=>'NULL',
|
||||
'set_function'=>'NULL'
|
||||
),
|
||||
'DIR_WS_LANGUAGES' => array(
|
||||
'configuration_title'=>'DIR_WS_LANGUAGES',
|
||||
'configuration_value'=>'inc/languages/',
|
||||
'configuration_description'=>'',
|
||||
'use_function'=>'NULL',
|
||||
'set_function'=>'NULL'
|
||||
),
|
||||
'DIR_WS_MODULES' => array(
|
||||
'configuration_title'=>'DIR_WS_MODULES',
|
||||
'configuration_value'=>'inc/payment_modules/',
|
||||
'configuration_description'=>'',
|
||||
'use_function'=>'NULL',
|
||||
'set_function'=>'NULL'
|
||||
),
|
||||
'JS_ERROR' => array(
|
||||
'configuration_title'=>'JS_ERROR',
|
||||
'configuration_value'=>'there was a javasript error',
|
||||
'configuration_description'=>'',
|
||||
'use_function'=>'NULL',
|
||||
'set_function'=>'NULL'
|
||||
),
|
||||
'JS_ERROR_NO_PAYMENT_MODULE_SELECTED' => array(
|
||||
'configuration_title'=>'JS_ERROR_NO_PAYMENT_MODULE_SELECTED',
|
||||
'configuration_value'=>'No payment module selected',
|
||||
'configuration_description'=>'',
|
||||
'use_function'=>'NULL',
|
||||
'set_function'=>'NULL'
|
||||
),
|
||||
'HTTPS_SERVER' => array(
|
||||
'configuration_title'=>'HTTPS_SERVER',
|
||||
'configuration_value'=>'http://xoo.cybro.info/web_ries/egroupware/',
|
||||
'configuration_description'=>'',
|
||||
'use_function'=>'NULL',
|
||||
'set_function'=>'NULL'
|
||||
),
|
||||
'DIR_WS_HTTPS_CATALOG' => array(
|
||||
'configuration_title'=>'',
|
||||
'configuration_value'=>'',
|
||||
'configuration_description'=>'',
|
||||
'use_function'=>'NULL',
|
||||
'set_function'=>'NULL'
|
||||
),
|
||||
'FILENAME_CHECKOUT_PAYMENT' => array(
|
||||
'configuration_title'=>'',
|
||||
'configuration_value'=>'?menuaction=paymentError',
|
||||
'configuration_description'=>'',
|
||||
'use_function'=>'NULL',
|
||||
'set_function'=>'NULL'
|
||||
),
|
||||
'DIR_WS_CLASSES' => array(
|
||||
'configuration_title'=>'',
|
||||
'configuration_value'=>'inc/payment_modules/',
|
||||
'configuration_description'=>'',
|
||||
'use_function'=>'NULL',
|
||||
'set_function'=>'NULL'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function get_settings()
|
||||
{
|
||||
$keys = array_keys($this->default_settings());
|
||||
$keysstr = implode('","',$keys);
|
||||
$query = 'SELECT configuration_value FROM '.CONF_TABLE.' WHERE configuration_key IN ("'.$keysstr.'");';
|
||||
$erres = $this->db->query($query);
|
||||
while ($this->db->next_record())
|
||||
{
|
||||
$_res[] = $this->db->row();
|
||||
}
|
||||
foreach($_res as $key=>$record)
|
||||
{
|
||||
$_vals[$keys[$key]] = $_res[$key]['configuration_value'];
|
||||
}
|
||||
return $_vals;
|
||||
}
|
||||
|
||||
function check_tables()
|
||||
{
|
||||
// 1. everything OK
|
||||
// 2. first entry in db is not MODULE_PAYMENT_INSTALLED: error
|
||||
// 3. rows are missing: settings not ok.
|
||||
|
||||
$query="SELECT configuration_key FROM ".CONF_TABLE." WHERE configuration_id = '1';";
|
||||
$this->db->query($query);
|
||||
while ($this->db->next_record())
|
||||
{
|
||||
$_result = $this->db->row();
|
||||
}
|
||||
if( $_result['configuration_key'] != 'MODULE_PAYMENT_INSTALLED' )
|
||||
{
|
||||
return 'check_tables failed: MODPAYINSTALLED';
|
||||
}
|
||||
$mand_keys = implode('","',array_keys($this->default_settings()));
|
||||
$query = 'SELECT configuration_key FROM '.CONF_TABLE.' WHERE configuration_key IN ("'.$mand_keys.'");';
|
||||
$erres = $this->db->query($query);
|
||||
while ($this->db->next_record())
|
||||
{
|
||||
$_res[] = $this->db->row();
|
||||
}
|
||||
if ($_res = '' || count(array_keys($this->default_settings())) != count(array_keys($_res)))
|
||||
{
|
||||
return 'check_tables failed: empty rows';
|
||||
}
|
||||
return True;
|
||||
}
|
||||
|
||||
function oscom_fsmodules($dir=PAYMOD_DIR)
|
||||
{
|
||||
// loops through the given directory for possible plugins
|
||||
$_list = scandir($dir);
|
||||
if( ($_list == FALSE) || ($_list == '') ) {
|
||||
$list[0] = 'empty or error while processing scandir';
|
||||
return $list;
|
||||
}
|
||||
// return only the .php entries (without .php)
|
||||
foreach($_list as $record)
|
||||
{
|
||||
if(strpos($record,'.php')) {
|
||||
$list[] = substr($record, 0, -4);
|
||||
}
|
||||
}
|
||||
return $list;
|
||||
}
|
||||
|
||||
|
||||
function oscom_dbmodules()
|
||||
{
|
||||
$query = "SELECT configuration_value FROM ".CONF_TABLE." WHERE configuration_key = 'MODULE_PAYMENT_INSTALLED'; ";
|
||||
$geti = $this->db->query($query);
|
||||
while ($this->db->next_record())
|
||||
{
|
||||
$row = $this->db->row();
|
||||
if ($row['configuration_value'] != '')
|
||||
{
|
||||
return explode(';',$row['configuration_value']);
|
||||
//return explode(';',str_replace('.php','',$row['configuration_value']));
|
||||
} else return array();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function oscom_installmod($module)
|
||||
{
|
||||
$module .= '.php';
|
||||
$_list= $this->oscom_dbmodules();
|
||||
if($_list == '') $_list = array($module); // nothing installed yet
|
||||
else
|
||||
{
|
||||
// no duplicates
|
||||
if(!array_search($module, $_list)) $_list[] = $module;
|
||||
}
|
||||
$this->update_oscommod($_list);
|
||||
}
|
||||
|
||||
function oscom_removemod($module)
|
||||
{
|
||||
$module .= '.php';
|
||||
$_list= $this->oscom_dbmodules();
|
||||
if(array_search($module, $_list) || $_list[0] = $module)
|
||||
{
|
||||
unset($_list[array_search($module, $_list)]); // remove
|
||||
}
|
||||
$this->update_oscommod($_list);
|
||||
}
|
||||
|
||||
function update_oscommod($arr)
|
||||
{
|
||||
if(count($arr) > 1)
|
||||
{
|
||||
$new = implode($arr, ';');
|
||||
} else $new = $arr[0];
|
||||
$query = "UPDATE egw_oscadmin_osc_conf SET configuration_value = '$new' WHERE configuration_key = 'MODULE_PAYMENT_INSTALLED';";
|
||||
$this->db->query($query);
|
||||
}
|
||||
|
||||
function oscmod_values($config_key)
|
||||
{
|
||||
//
|
||||
$_columns = 'configuration_title, configuration_value, configuration_description';
|
||||
$query = 'SELECT ' .$_columns. ' FROM ' .CONF_TABLE. ' WHERE configuration_key = "' .$config_key. '";';
|
||||
|
||||
$this->db->query($query);
|
||||
while ($this->db->next_record())
|
||||
{
|
||||
$values_arr = $this->db->row();
|
||||
}
|
||||
return $values_arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* get_plugin_functions
|
||||
**/
|
||||
function oscmod_functions($_key)
|
||||
{
|
||||
|
||||
$query = 'SELECT use_function, set_function FROM ' .CONF_TABLE. ' WHERE configuration_key = "' .$_key. '";';
|
||||
$erres = $this->db->query($query);
|
||||
while ($this->db->next_record())
|
||||
{
|
||||
$values_arr = $this->db->row();
|
||||
if($values_arr['use_function'] == "") $values_arr['use_function'] = "NO_FUNC";
|
||||
if($values_arr['set_function'] == "") $values_arr['set_function'] = "NO_FUNC";
|
||||
}
|
||||
return $values_arr;
|
||||
}
|
||||
|
||||
function confedit($key, $newvalue)
|
||||
{
|
||||
//
|
||||
$query = "UPDATE ".CONF_TABLE." SET configuration_value = '$newvalue' WHERE configuration_key = '$key';";
|
||||
$this->db->query($query);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
251
psp_admin/inc/class.ui_pspadmin.inc.php
Normal file
251
psp_admin/inc/class.ui_pspadmin.inc.php
Normal file
@ -0,0 +1,251 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
||||
class ui_pspadmin
|
||||
{
|
||||
var $bo;
|
||||
var $sav2;
|
||||
|
||||
var $wrapper;
|
||||
var $module;
|
||||
|
||||
var $public_functions = Array
|
||||
(
|
||||
'modules' => True,
|
||||
'settings' => True,
|
||||
'apitesting' => True,
|
||||
'sidebox_menu' => True
|
||||
);
|
||||
|
||||
function ui_pspadmin()
|
||||
{
|
||||
$this->sav2 = CreateObject('phpgwapi.tplsavant2');
|
||||
$this->bo = CreateObject('psp_admin.bo_pspadmin');
|
||||
|
||||
// nec.
|
||||
if(!$this->checks())
|
||||
{
|
||||
die('UI:: checks failed.');
|
||||
}
|
||||
if(isset($_POST['wrapper']))
|
||||
{
|
||||
$this->wrapper = $_POST['wrapper'];
|
||||
} else // this is for now... but should be handled by POST
|
||||
{
|
||||
$this->wrapper = 'oscommerce';
|
||||
}
|
||||
$this->module = $_GET['plug'];
|
||||
}
|
||||
|
||||
function sidebox_menu()
|
||||
{
|
||||
$appname = 'psp_admin';
|
||||
$content = Array(
|
||||
'0' => array(
|
||||
'link'=>$GLOBALS['phpgw']->link('/index.php','menuaction=psp_admin.ui_pspadmin.modules'),
|
||||
'icon'=>( ($_GET['menuaction']=='psp_admin.ui_pspadmin.modules'||!$_GET['menuaction']) ?'c_plan_a':'c_plan'),
|
||||
'text'=>'Modules'
|
||||
),
|
||||
'1' => array(
|
||||
'link'=>$GLOBALS['phpgw']->link('/index.php','menuaction=psp_admin.ui_pspadmin.settings'),
|
||||
'icon'=>( ($_GET['menuaction']=='psp_admin.ui_pspadmin.settings'||!$_GET['menuaction']) ?'settings':'settings'),
|
||||
'text'=>'Settings'
|
||||
)
|
||||
);
|
||||
$menu_title = lang('PSP Admin');
|
||||
display_sidebox($appname,$menu_title,$content);
|
||||
}
|
||||
|
||||
function showMe($template)
|
||||
{
|
||||
$this->sav2->baselink = $GLOBALS['phpgw']->link('/index.php','menuaction=psp_admin.ui_pspadmin.').$template;
|
||||
$GLOBALS['egw']->common->phpgw_header();
|
||||
echo parse_navbar();
|
||||
$this->sav2->display($template.'.tpl.php');
|
||||
$GLOBALS['egw']->common->phpgw_footer();
|
||||
}
|
||||
|
||||
function modules()
|
||||
{
|
||||
switch($_POST['submitted'])
|
||||
{
|
||||
case false:
|
||||
break;
|
||||
case 'update':
|
||||
$this->process_post( 'modules' , $_POST);
|
||||
case 'cancel':
|
||||
$this->sav2->module = $this->module = $_POST['payplug'];
|
||||
$_res = $this->bo->config_module($this->module);
|
||||
$this->sav2->selection = $_res[0];
|
||||
$this->sav2->modinfo = $this->sav2->fetch('confmod.tpl.php');
|
||||
break;
|
||||
default:
|
||||
die('no strange posting here.');
|
||||
}
|
||||
|
||||
$this->sav2->wrapper = $this->wrapper;
|
||||
|
||||
if(isset($_GET['act']) && isset($_GET['plug']) && True) // todo: True replaced by sec.expression
|
||||
{
|
||||
if($this->wrapper == 'oscommerce')
|
||||
{
|
||||
$this->sav2->module = $_GET['plug'];
|
||||
switch($_GET['act'])
|
||||
{
|
||||
case 'editmod': // when we actually want to change something
|
||||
$selection = $this->bo->config_module($this->module);
|
||||
$this->sav2->editline = 'no';
|
||||
$this->sav2->dim2array = $this->gen_form('modules',$selection[0],'text', '10','255',$this->module);
|
||||
$result = $this->sav2->fetch('generic_form.tpl.php');
|
||||
break;
|
||||
case 'install':
|
||||
$result = $this->bo->oscom_install($_GET['plug']);
|
||||
break;
|
||||
case 'remove':
|
||||
$result = $this->bo->oscom_remove($_GET['plug']);
|
||||
break;
|
||||
case 'broken':
|
||||
$result = $this->bo->oscom_broken($_GET['plug']);
|
||||
break;
|
||||
case 'conf':
|
||||
$_res = $this->bo->config_module($this->module); //$_GET['plug']); hm.., redundancy
|
||||
$this->sav2->selection = $_res[0];
|
||||
$result = $this->sav2->fetch('confmod.tpl.php');
|
||||
break;
|
||||
default:
|
||||
die('illegal call to function.');
|
||||
}
|
||||
$this->sav2->modinfo = $result;
|
||||
}
|
||||
else $this->sav2->infomsg = 'oh? another wrapper?';
|
||||
}
|
||||
$mod_overview = $this->bo->get_installed_modules($this->wrapper);
|
||||
if(!is_array($mod_overview)) $this->sav2->infomsg = $mod_overview; // on error: display it
|
||||
else $this->sav2->list = $mod_overview;
|
||||
|
||||
|
||||
$this->showMe('modules');
|
||||
}
|
||||
|
||||
function process_post( $from ,$arr)
|
||||
{
|
||||
switch($from)
|
||||
{
|
||||
case 'modules':
|
||||
$this->module = $arr['payplug'];
|
||||
unset($arr['payplug']); unset($arr['submitted']);
|
||||
break;
|
||||
case 'settings':
|
||||
unset($arr['submitted']);
|
||||
break;
|
||||
default:
|
||||
die('nope.');
|
||||
}
|
||||
foreach( $arr as $key=>$value )
|
||||
{
|
||||
$this->bo->so->confedit($key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
function settings()
|
||||
{
|
||||
switch($_POST['submitted'])
|
||||
{
|
||||
case false:
|
||||
break;
|
||||
case 'update':
|
||||
$this->process_post( 'settings' , $_POST);
|
||||
break;
|
||||
case 'cancel':
|
||||
break;
|
||||
default:
|
||||
die('no strange posting here.');
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$this->sav2->settings = $this->bo->so->get_settings();
|
||||
$this->sav2->wrapper = $this->wrapper;
|
||||
$this->showMe('settings');
|
||||
}
|
||||
|
||||
function checks()
|
||||
{
|
||||
// check if this page is reached in a proper way
|
||||
|
||||
// check if the necessary tables exist and are sane
|
||||
$_ret = $this->bo->so->check_tables();
|
||||
if(!$_ret) $this->sav2->infomsg = $_ret;
|
||||
else return True;
|
||||
}
|
||||
|
||||
function gen_form($link2func, $update, $type, $size, $maxl, $payplug)
|
||||
{
|
||||
$this->sav2->form['baselink'] = $GLOBALS['phpgw']->link('/index.php','menuaction=psp_admin.ui_pspadmin.'.$link2func);
|
||||
$this->sav2->form['update'] = $update;
|
||||
$this->sav2->form['type'] = $type;
|
||||
$this->sav2->form['size'] = $size;
|
||||
$this->sav2->form['max'] = $maxl;
|
||||
$this->sav2->form['payplug'] = $payplug;
|
||||
$this->sav2->genset_form = $this->sav2->fetch('generic_form.tpl.php');
|
||||
}
|
||||
|
||||
|
||||
// ==================================================
|
||||
// begin skeleton : api access
|
||||
/*
|
||||
function apitesting()
|
||||
{
|
||||
//
|
||||
$fail_url = 'psp_admin.ui_pspadmin.apifail';
|
||||
$success_url = 'psp_admin.ui_pspadmin.apisuccess';
|
||||
$base_url = 'psp_admin.ui_pspadmin.apitesting' ; // app.class.function
|
||||
|
||||
$stoken = md5(uniqid(rand(), true));
|
||||
|
||||
if($_POST[submitted] != True)
|
||||
{
|
||||
$this->sav2->assign('step',1);
|
||||
$this->sav2->assign('title',"1");
|
||||
$content = $this->sav2->fetch("stepbefore.tpl.php");
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once(EGW_SERVER_ROOT.'/psp_admin/inc/class.oscadminapi.inc.php');
|
||||
$oscapi = new oscadminapi();
|
||||
$content = $oscapi->purchase($stoken, $amount, $fail_url, $success_url, $base_url, $_POST);
|
||||
}
|
||||
|
||||
|
||||
$this->sav2->assign('content',$content);
|
||||
$this->showMe('apitest');
|
||||
|
||||
}
|
||||
|
||||
function apifail()
|
||||
{
|
||||
die('something went wrong. please try again.');
|
||||
}
|
||||
|
||||
function apisuccess()
|
||||
{
|
||||
die('Thank You.');
|
||||
}
|
||||
*/
|
||||
|
||||
// end testing of oscadminapi
|
||||
// ==================================================
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
14
psp_admin/inc/functions.inc.php
Executable file
14
psp_admin/inc/functions.inc.php
Executable file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* eGroupWare - Skeleton Application *
|
||||
* http://www.egroupware.org *
|
||||
* ----------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id: functions.inc.php,v 1.2 2004/01/10 07:25:17 shrykedude Exp $ */
|
||||
|
||||
?>
|
14
psp_admin/inc/header.inc.php
Executable file
14
psp_admin/inc/header.inc.php
Executable file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* eGroupWare - Skeleton Application *
|
||||
* http://www.egroupware.org *
|
||||
* ----------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id: header.inc.php,v 1.4 2004/01/10 07:25:17 shrykedude Exp $ */
|
||||
|
||||
?>
|
23
psp_admin/inc/hook_admin.inc.php
Executable file
23
psp_admin/inc/hook_admin.inc.php
Executable file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* eGroupWare - Skeleton Application *
|
||||
* http://www.egroupware.org *
|
||||
* ----------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id: hook_admin.inc.php,v 1.8 2004/01/10 07:25:17 shrykedude Exp $ */
|
||||
|
||||
{
|
||||
// Only Modify the $file and $title variables.....
|
||||
$title = $appname;
|
||||
$file = array(
|
||||
|
||||
);
|
||||
// Do not modify below this line
|
||||
display_section($appname,$title,$file);
|
||||
}
|
||||
?>
|
19
psp_admin/inc/hook_manual.inc.php
Normal file
19
psp_admin/inc/hook_manual.inc.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* eGroupWare - Skeleton Application *
|
||||
* http://www.egroupware.org *
|
||||
* ----------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id: hook_manual.inc.php,v 1.4 2004/01/10 07:25:17 shrykedude Exp $ */
|
||||
|
||||
// Only Modify the $file variable.....
|
||||
$file = Array();
|
||||
|
||||
// Do not modify below this line
|
||||
display_manual_section($appname,$file);
|
||||
?>
|
22
psp_admin/inc/hook_preferences.inc.php
Executable file
22
psp_admin/inc/hook_preferences.inc.php
Executable file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* eGroupWare *
|
||||
* http://www.egroupware.org *
|
||||
* Written by Joseph Engo <jengo@phpgroupware.org> *
|
||||
* -------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id: hook_preferences.inc.php,v 1.14 2005/07/23 15:52:48 ralfbecker Exp $ */
|
||||
{
|
||||
$title = $appname;
|
||||
$file = Array(
|
||||
'Preferences' => $GLOBALS['phpgw']->link('/preferences/preferences.php','appname='.$appname)
|
||||
);
|
||||
display_section($appname,$title,$file);
|
||||
}
|
||||
|
||||
?>
|
85
psp_admin/inc/payment_modules/cc_validation.php
Normal file
85
psp_admin/inc/payment_modules/cc_validation.php
Normal file
@ -0,0 +1,85 @@
|
||||
<?php
|
||||
/*
|
||||
$Id: cc_validation.php,v 1.3 2003/02/12 20:43:41 hpdl Exp $
|
||||
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2003 osCommerce
|
||||
|
||||
Released under the GNU General Public License
|
||||
*/
|
||||
|
||||
class cc_validation {
|
||||
var $cc_type, $cc_number, $cc_expiry_month, $cc_expiry_year;
|
||||
|
||||
function validate($number, $expiry_m, $expiry_y) {
|
||||
$this->cc_number = ereg_replace('[^0-9]', '', $number);
|
||||
|
||||
if (ereg('^4[0-9]{12}([0-9]{3})?$', $this->cc_number)) {
|
||||
$this->cc_type = 'Visa';
|
||||
} elseif (ereg('^5[1-5][0-9]{14}$', $this->cc_number)) {
|
||||
$this->cc_type = 'Master Card';
|
||||
} elseif (ereg('^3[47][0-9]{13}$', $this->cc_number)) {
|
||||
$this->cc_type = 'American Express';
|
||||
} elseif (ereg('^3(0[0-5]|[68][0-9])[0-9]{11}$', $this->cc_number)) {
|
||||
$this->cc_type = 'Diners Club';
|
||||
} elseif (ereg('^6011[0-9]{12}$', $this->cc_number)) {
|
||||
$this->cc_type = 'Discover';
|
||||
} elseif (ereg('^(3[0-9]{4}|2131|1800)[0-9]{11}$', $this->cc_number)) {
|
||||
$this->cc_type = 'JCB';
|
||||
} elseif (ereg('^5610[0-9]{12}$', $this->cc_number)) {
|
||||
$this->cc_type = 'Australian BankCard';
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
if (is_numeric($expiry_m) && ($expiry_m > 0) && ($expiry_m < 13)) {
|
||||
$this->cc_expiry_month = $expiry_m;
|
||||
} else {
|
||||
return -2;
|
||||
}
|
||||
|
||||
$current_year = date('Y');
|
||||
$expiry_y = substr($current_year, 0, 2) . $expiry_y;
|
||||
if (is_numeric($expiry_y) && ($expiry_y >= $current_year) && ($expiry_y <= ($current_year + 10))) {
|
||||
$this->cc_expiry_year = $expiry_y;
|
||||
} else {
|
||||
return -3;
|
||||
}
|
||||
|
||||
if ($expiry_y == $current_year) {
|
||||
if ($expiry_m < date('n')) {
|
||||
return -4;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->is_valid();
|
||||
}
|
||||
|
||||
function is_valid() {
|
||||
$cardNumber = strrev($this->cc_number);
|
||||
$numSum = 0;
|
||||
|
||||
for ($i=0; $i<strlen($cardNumber); $i++) {
|
||||
$currentNum = substr($cardNumber, $i, 1);
|
||||
|
||||
// Double every second digit
|
||||
if ($i % 2 == 1) {
|
||||
$currentNum *= 2;
|
||||
}
|
||||
|
||||
// Add digits of 2-digit numbers together
|
||||
if ($currentNum > 9) {
|
||||
$firstNum = $currentNum % 10;
|
||||
$secondNum = ($currentNum - $firstNum) / 10;
|
||||
$currentNum = $firstNum + $secondNum;
|
||||
}
|
||||
|
||||
$numSum += $currentNum;
|
||||
}
|
||||
|
||||
// If the total has no remainder it's OK
|
||||
return ($numSum % 10 == 0);
|
||||
}
|
||||
}
|
||||
?>
|
452
psp_admin/inc/payment_modules/checkout_shipping.php
Normal file
452
psp_admin/inc/payment_modules/checkout_shipping.php
Normal file
@ -0,0 +1,452 @@
|
||||
<?php
|
||||
/*
|
||||
$Id: checkout_shipping.php,v 1.16 2003/06/09 23:03:53 hpdl Exp $
|
||||
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2003 osCommerce
|
||||
|
||||
Released under the GNU General Public License
|
||||
*/
|
||||
|
||||
require('includes/application_top.php');
|
||||
require('includes/classes/http_client.php');
|
||||
|
||||
// if the customer is not logged on, redirect them to the login page
|
||||
if (!tep_session_is_registered('customer_id')) {
|
||||
$navigation->set_snapshot();
|
||||
tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
|
||||
}
|
||||
|
||||
// if there is nothing in the customers cart, redirect them to the shopping cart page
|
||||
if ($cart->count_contents() < 1) {
|
||||
tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
|
||||
}
|
||||
|
||||
// if no shipping destination address was selected, use the customers own address as default
|
||||
if (!tep_session_is_registered('sendto')) {
|
||||
tep_session_register('sendto');
|
||||
$sendto = $customer_default_address_id;
|
||||
} else {
|
||||
// verify the selected shipping address
|
||||
$check_address_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$sendto . "'");
|
||||
$check_address = tep_db_fetch_array($check_address_query);
|
||||
|
||||
if ($check_address['total'] != '1') {
|
||||
$sendto = $customer_default_address_id;
|
||||
if (tep_session_is_registered('shipping')) tep_session_unregister('shipping');
|
||||
}
|
||||
}
|
||||
|
||||
require(DIR_WS_CLASSES . 'order.php');
|
||||
$order = new order;
|
||||
|
||||
// register a random ID in the session to check throughout the checkout procedure
|
||||
// against alterations in the shopping cart contents
|
||||
if (!tep_session_is_registered('cartID')) tep_session_register('cartID');
|
||||
$cartID = $cart->cartID;
|
||||
|
||||
// if the order contains only virtual products, forward the customer to the billing page as
|
||||
// a shipping address is not needed
|
||||
if ($order->content_type == 'virtual') {
|
||||
if (!tep_session_is_registered('shipping')) tep_session_register('shipping');
|
||||
$shipping = false;
|
||||
$sendto = false;
|
||||
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
|
||||
}
|
||||
|
||||
$total_weight = $cart->show_weight();
|
||||
$total_count = $cart->count_contents();
|
||||
|
||||
// load all enabled shipping modules
|
||||
require(DIR_WS_CLASSES . 'shipping.php');
|
||||
$shipping_modules = new shipping;
|
||||
|
||||
if ( defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING') && (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') ) {
|
||||
$pass = false;
|
||||
|
||||
switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) {
|
||||
case 'national':
|
||||
if ($order->delivery['country_id'] == STORE_COUNTRY) {
|
||||
$pass = true;
|
||||
}
|
||||
break;
|
||||
case 'international':
|
||||
if ($order->delivery['country_id'] != STORE_COUNTRY) {
|
||||
$pass = true;
|
||||
}
|
||||
break;
|
||||
case 'both':
|
||||
$pass = true;
|
||||
break;
|
||||
}
|
||||
|
||||
$free_shipping = false;
|
||||
if ( ($pass == true) && ($order->info['total'] >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) ) {
|
||||
$free_shipping = true;
|
||||
|
||||
include(DIR_WS_LANGUAGES . $language . '/modules/order_total/ot_shipping.php');
|
||||
}
|
||||
} else {
|
||||
$free_shipping = false;
|
||||
}
|
||||
|
||||
// process the selected shipping method
|
||||
if ( isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process') ) {
|
||||
if (!tep_session_is_registered('comments')) tep_session_register('comments');
|
||||
if (tep_not_null($HTTP_POST_VARS['comments'])) {
|
||||
$comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);
|
||||
}
|
||||
|
||||
if (!tep_session_is_registered('shipping')) tep_session_register('shipping');
|
||||
|
||||
if ( (tep_count_shipping_modules() > 0) || ($free_shipping == true) ) {
|
||||
if ( (isset($HTTP_POST_VARS['shipping'])) && (strpos($HTTP_POST_VARS['shipping'], '_')) ) {
|
||||
$shipping = $HTTP_POST_VARS['shipping'];
|
||||
|
||||
list($module, $method) = explode('_', $shipping);
|
||||
if ( is_object($$module) || ($shipping == 'free_free') ) {
|
||||
if ($shipping == 'free_free') {
|
||||
$quote[0]['methods'][0]['title'] = FREE_SHIPPING_TITLE;
|
||||
$quote[0]['methods'][0]['cost'] = '0';
|
||||
} else {
|
||||
$quote = $shipping_modules->quote($method, $module);
|
||||
}
|
||||
if (isset($quote['error'])) {
|
||||
tep_session_unregister('shipping');
|
||||
} else {
|
||||
if ( (isset($quote[0]['methods'][0]['title'])) && (isset($quote[0]['methods'][0]['cost'])) ) {
|
||||
$shipping = array('id' => $shipping,
|
||||
'title' => (($free_shipping == true) ? $quote[0]['methods'][0]['title'] : $quote[0]['module'] . ' (' . $quote[0]['methods'][0]['title'] . ')'),
|
||||
'cost' => $quote[0]['methods'][0]['cost']);
|
||||
|
||||
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tep_session_unregister('shipping');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$shipping = false;
|
||||
|
||||
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
|
||||
}
|
||||
}
|
||||
|
||||
// get all available shipping quotes
|
||||
$quotes = $shipping_modules->quote();
|
||||
|
||||
// if no shipping method has been selected, automatically select the cheapest method.
|
||||
// if the modules status was changed when none were available, to save on implementing
|
||||
// a javascript force-selection method, also automatically select the cheapest shipping
|
||||
// method if more than one module is now enabled
|
||||
if ( !tep_session_is_registered('shipping') || ( tep_session_is_registered('shipping') && ($shipping == false) && (tep_count_shipping_modules() > 1) ) ) $shipping = $shipping_modules->cheapest();
|
||||
|
||||
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_SHIPPING);
|
||||
|
||||
$breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
|
||||
$breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
|
||||
?>
|
||||
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html <?php echo HTML_PARAMS; ?>>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
|
||||
<title><?php echo TITLE; ?></title>
|
||||
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
|
||||
<link rel="stylesheet" type="text/css" href="stylesheet.css">
|
||||
<script language="javascript"><!--
|
||||
var selected;
|
||||
|
||||
function selectRowEffect(object, buttonSelect) {
|
||||
if (!selected) {
|
||||
if (document.getElementById) {
|
||||
selected = document.getElementById('defaultSelected');
|
||||
} else {
|
||||
selected = document.all['defaultSelected'];
|
||||
}
|
||||
}
|
||||
|
||||
if (selected) selected.className = 'moduleRow';
|
||||
object.className = 'moduleRowSelected';
|
||||
selected = object;
|
||||
|
||||
// one button is not an array
|
||||
if (document.checkout_address.shipping[0]) {
|
||||
document.checkout_address.shipping[buttonSelect].checked=true;
|
||||
} else {
|
||||
document.checkout_address.shipping.checked=true;
|
||||
}
|
||||
}
|
||||
|
||||
function rowOverEffect(object) {
|
||||
if (object.className == 'moduleRow') object.className = 'moduleRowOver';
|
||||
}
|
||||
|
||||
function rowOutEffect(object) {
|
||||
if (object.className == 'moduleRowOver') object.className = 'moduleRow';
|
||||
}
|
||||
//--></script>
|
||||
</head>
|
||||
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
|
||||
<!-- header //-->
|
||||
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
|
||||
<!-- header_eof //-->
|
||||
|
||||
<!-- body //-->
|
||||
<table border="0" width="100%" cellspacing="3" cellpadding="3">
|
||||
<tr>
|
||||
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
|
||||
<!-- left_navigation //-->
|
||||
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
|
||||
<!-- left_navigation_eof //-->
|
||||
</table></td>
|
||||
<!-- body_text //-->
|
||||
<td width="100%" valign="top"><?php echo tep_draw_form('checkout_address', tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')) . tep_draw_hidden_field('action', 'process'); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
|
||||
<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_delivery.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
|
||||
<tr>
|
||||
<td class="main"><b><?php echo TABLE_HEADING_SHIPPING_ADDRESS; ?></b></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
|
||||
<tr class="infoBoxContents">
|
||||
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
|
||||
<tr>
|
||||
<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
<td class="main" width="50%" valign="top"><?php echo TEXT_CHOOSE_SHIPPING_DESTINATION . '<br><br><a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING_ADDRESS, '', 'SSL') . '">' . tep_image_button('button_change_address.gif', IMAGE_BUTTON_CHANGE_ADDRESS) . '</a>'; ?></td>
|
||||
<td align="right" width="50%" valign="top"><table border="0" cellspacing="0" cellpadding="2">
|
||||
<tr>
|
||||
<td class="main" align="center" valign="top"><?php echo '<b>' . TITLE_SHIPPING_ADDRESS . '</b><br>' . tep_image(DIR_WS_IMAGES . 'arrow_south_east.gif'); ?></td>
|
||||
<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
<td class="main" valign="top"><?php echo tep_address_label($customer_id, $sendto, true, ' ', '<br>'); ?></td>
|
||||
<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
if (tep_count_shipping_modules() > 0) {
|
||||
?>
|
||||
<tr>
|
||||
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
|
||||
<tr>
|
||||
<td class="main"><b><?php echo TABLE_HEADING_SHIPPING_METHOD; ?></b></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
|
||||
<tr class="infoBoxContents">
|
||||
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
|
||||
<?php
|
||||
if (sizeof($quotes) > 1 && sizeof($quotes[0]) > 1) {
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
<td class="main" width="50%" valign="top"><?php echo TEXT_CHOOSE_SHIPPING_METHOD; ?></td>
|
||||
<td class="main" width="50%" valign="top" align="right"><?php echo '<b>' . TITLE_PLEASE_SELECT . '</b><br>' . tep_image(DIR_WS_IMAGES . 'arrow_east_south.gif'); ?></td>
|
||||
<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
} elseif ($free_shipping == false) {
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
<td class="main" width="100%" colspan="2"><?php echo TEXT_ENTER_SHIPPING_INFORMATION; ?></td>
|
||||
<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
if ($free_shipping == true) {
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
<td colspan="2" width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="2">
|
||||
<tr>
|
||||
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
<td class="main" colspan="3"><b><?php echo FREE_SHIPPING_TITLE; ?></b> <?php echo $quotes[$i]['icon']; ?></td>
|
||||
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
</tr>
|
||||
<tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, 0)">
|
||||
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
<td class="main" width="100%"><?php echo sprintf(FREE_SHIPPING_DESCRIPTION, $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)) . tep_draw_hidden_field('shipping', 'free_free'); ?></td>
|
||||
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
} else {
|
||||
$radio_buttons = 0;
|
||||
for ($i=0, $n=sizeof($quotes); $i<$n; $i++) {
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
<td colspan="2"><table border="0" width="100%" cellspacing="0" cellpadding="2">
|
||||
<tr>
|
||||
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
<td class="main" colspan="3"><b><?php echo $quotes[$i]['module']; ?></b> <?php if (isset($quotes[$i]['icon']) && tep_not_null($quotes[$i]['icon'])) { echo $quotes[$i]['icon']; } ?></td>
|
||||
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
if (isset($quotes[$i]['error'])) {
|
||||
?>
|
||||
<tr>
|
||||
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
<td class="main" colspan="3"><?php echo $quotes[$i]['error']; ?></td>
|
||||
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
} else {
|
||||
for ($j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++) {
|
||||
// set the radio button to be checked if it is the method chosen
|
||||
$checked = (($quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'] == $shipping['id']) ? true : false);
|
||||
|
||||
if ( ($checked == true) || ($n == 1 && $n2 == 1) ) {
|
||||
echo ' <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
|
||||
} else {
|
||||
echo ' <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
|
||||
}
|
||||
?>
|
||||
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
<td class="main" width="75%"><?php echo $quotes[$i]['methods'][$j]['title']; ?></td>
|
||||
<?php
|
||||
if ( ($n > 1) || ($n2 > 1) ) {
|
||||
?>
|
||||
<td class="main"><?php echo $currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], (isset($quotes[$i]['tax']) ? $quotes[$i]['tax'] : 0))); ?></td>
|
||||
<td class="main" align="right"><?php echo tep_draw_radio_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'], $checked); ?></td>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<td class="main" align="right" colspan="2"><?php echo $currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])) . tep_draw_hidden_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id']); ?></td>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
$radio_buttons++;
|
||||
}
|
||||
}
|
||||
?>
|
||||
</table></td>
|
||||
<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</table></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
|
||||
<tr>
|
||||
<td class="main"><b><?php echo TABLE_HEADING_COMMENTS; ?></b></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
|
||||
<tr class="infoBoxContents">
|
||||
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
|
||||
<tr>
|
||||
<td><?php echo tep_draw_textarea_field('comments', 'soft', '60', '5'); ?></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
|
||||
<tr class="infoBoxContents">
|
||||
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
|
||||
<tr>
|
||||
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
<td class="main"><?php echo '<b>' . TITLE_CONTINUE_CHECKOUT_PROCEDURE . '</b><br>' . TEXT_CONTINUE_CHECKOUT_PROCEDURE; ?></td>
|
||||
<td class="main" align="right"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>
|
||||
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td width="50%" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'checkout_bullet.gif'); ?></td>
|
||||
<td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
<td width="25%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
|
||||
<td width="25%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
|
||||
<td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
|
||||
<td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '1', '5'); ?></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" width="25%" class="checkoutBarCurrent"><?php echo CHECKOUT_BAR_DELIVERY; ?></td>
|
||||
<td align="center" width="25%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_PAYMENT; ?></td>
|
||||
<td align="center" width="25%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_CONFIRMATION; ?></td>
|
||||
<td align="center" width="25%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_FINISHED; ?></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
</table></form></td>
|
||||
<!-- body_text_eof //-->
|
||||
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
|
||||
<!-- right_navigation //-->
|
||||
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
|
||||
<!-- right_navigation_eof //-->
|
||||
</table></td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- body_eof //-->
|
||||
|
||||
<!-- footer //-->
|
||||
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
|
||||
<!-- footer_eof //-->
|
||||
<br>
|
||||
</body>
|
||||
</html>
|
||||
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
|
516
psp_admin/inc/payment_modules/checkout_shipping_address.php
Normal file
516
psp_admin/inc/payment_modules/checkout_shipping_address.php
Normal file
@ -0,0 +1,516 @@
|
||||
<?php
|
||||
/*
|
||||
$Id: checkout_shipping_address.php,v 1.15 2003/06/09 23:03:53 hpdl Exp $
|
||||
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2003 osCommerce
|
||||
|
||||
Released under the GNU General Public License
|
||||
*/
|
||||
|
||||
require('includes/application_top.php');
|
||||
|
||||
// if the customer is not logged on, redirect them to the login page
|
||||
if (!tep_session_is_registered('customer_id')) {
|
||||
$navigation->set_snapshot();
|
||||
tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
|
||||
}
|
||||
|
||||
// if there is nothing in the customers cart, redirect them to the shopping cart page
|
||||
if ($cart->count_contents() < 1) {
|
||||
tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
|
||||
}
|
||||
|
||||
// needs to be included earlier to set the success message in the messageStack
|
||||
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_SHIPPING_ADDRESS);
|
||||
|
||||
require(DIR_WS_CLASSES . 'order.php');
|
||||
$order = new order;
|
||||
|
||||
// if the order contains only virtual products, forward the customer to the billing page as
|
||||
// a shipping address is not needed
|
||||
if ($order->content_type == 'virtual') {
|
||||
if (!tep_session_is_registered('shipping')) tep_session_register('shipping');
|
||||
$shipping = false;
|
||||
if (!tep_session_is_registered('sendto')) tep_session_register('sendto');
|
||||
$sendto = false;
|
||||
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
|
||||
}
|
||||
|
||||
$error = false;
|
||||
$process = false;
|
||||
if (isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'submit')) {
|
||||
// process a new shipping address
|
||||
if (tep_not_null($HTTP_POST_VARS['firstname']) && tep_not_null($HTTP_POST_VARS['lastname']) && tep_not_null($HTTP_POST_VARS['street_address'])) {
|
||||
$process = true;
|
||||
|
||||
if (ACCOUNT_GENDER == 'true') $gender = tep_db_prepare_input($HTTP_POST_VARS['gender']);
|
||||
if (ACCOUNT_COMPANY == 'true') $company = tep_db_prepare_input($HTTP_POST_VARS['company']);
|
||||
$firstname = tep_db_prepare_input($HTTP_POST_VARS['firstname']);
|
||||
$lastname = tep_db_prepare_input($HTTP_POST_VARS['lastname']);
|
||||
$street_address = tep_db_prepare_input($HTTP_POST_VARS['street_address']);
|
||||
if (ACCOUNT_SUBURB == 'true') $suburb = tep_db_prepare_input($HTTP_POST_VARS['suburb']);
|
||||
$postcode = tep_db_prepare_input($HTTP_POST_VARS['postcode']);
|
||||
$city = tep_db_prepare_input($HTTP_POST_VARS['city']);
|
||||
$country = tep_db_prepare_input($HTTP_POST_VARS['country']);
|
||||
if (ACCOUNT_STATE == 'true') {
|
||||
if (isset($HTTP_POST_VARS['zone_id'])) {
|
||||
$zone_id = tep_db_prepare_input($HTTP_POST_VARS['zone_id']);
|
||||
} else {
|
||||
$zone_id = false;
|
||||
}
|
||||
$state = tep_db_prepare_input($HTTP_POST_VARS['state']);
|
||||
}
|
||||
|
||||
if (ACCOUNT_GENDER == 'true') {
|
||||
if ( ($gender != 'm') && ($gender != 'f') ) {
|
||||
$error = true;
|
||||
|
||||
$messageStack->add('checkout_address', ENTRY_GENDER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
if (strlen($firstname) < ENTRY_FIRST_NAME_MIN_LENGTH) {
|
||||
$error = true;
|
||||
|
||||
$messageStack->add('checkout_address', ENTRY_FIRST_NAME_ERROR);
|
||||
}
|
||||
|
||||
if (strlen($lastname) < ENTRY_LAST_NAME_MIN_LENGTH) {
|
||||
$error = true;
|
||||
|
||||
$messageStack->add('checkout_address', ENTRY_LAST_NAME_ERROR);
|
||||
}
|
||||
|
||||
if (strlen($street_address) < ENTRY_STREET_ADDRESS_MIN_LENGTH) {
|
||||
$error = true;
|
||||
|
||||
$messageStack->add('checkout_address', ENTRY_STREET_ADDRESS_ERROR);
|
||||
}
|
||||
|
||||
if (strlen($postcode) < ENTRY_POSTCODE_MIN_LENGTH) {
|
||||
$error = true;
|
||||
|
||||
$messageStack->add('checkout_address', ENTRY_POST_CODE_ERROR);
|
||||
}
|
||||
|
||||
if (strlen($city) < ENTRY_CITY_MIN_LENGTH) {
|
||||
$error = true;
|
||||
|
||||
$messageStack->add('checkout_address', ENTRY_CITY_ERROR);
|
||||
}
|
||||
|
||||
if (ACCOUNT_STATE == 'true') {
|
||||
$zone_id = 0;
|
||||
$check_query = tep_db_query("select count(*) as total from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "'");
|
||||
$check = tep_db_fetch_array($check_query);
|
||||
$entry_state_has_zones = ($check['total'] > 0);
|
||||
if ($entry_state_has_zones == true) {
|
||||
$zone_query = tep_db_query("select distinct zone_id from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' and (zone_name like '" . tep_db_input($state) . "%' or zone_code like '%" . tep_db_input($state) . "%')");
|
||||
if (tep_db_num_rows($zone_query) == 1) {
|
||||
$zone = tep_db_fetch_array($zone_query);
|
||||
$zone_id = $zone['zone_id'];
|
||||
} else {
|
||||
$error = true;
|
||||
|
||||
$messageStack->add('checkout_address', ENTRY_STATE_ERROR_SELECT);
|
||||
}
|
||||
} else {
|
||||
if (strlen($state) < ENTRY_STATE_MIN_LENGTH) {
|
||||
$error = true;
|
||||
|
||||
$messageStack->add('checkout_address', ENTRY_STATE_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( (is_numeric($country) == false) || ($country < 1) ) {
|
||||
$error = true;
|
||||
|
||||
$messageStack->add('checkout_address', ENTRY_COUNTRY_ERROR);
|
||||
}
|
||||
|
||||
if ($error == false) {
|
||||
$sql_data_array = array('customers_id' => $customer_id,
|
||||
'entry_firstname' => $firstname,
|
||||
'entry_lastname' => $lastname,
|
||||
'entry_street_address' => $street_address,
|
||||
'entry_postcode' => $postcode,
|
||||
'entry_city' => $city,
|
||||
'entry_country_id' => $country);
|
||||
|
||||
if (ACCOUNT_GENDER == 'true') $sql_data_array['entry_gender'] = $gender;
|
||||
if (ACCOUNT_COMPANY == 'true') $sql_data_array['entry_company'] = $company;
|
||||
if (ACCOUNT_SUBURB == 'true') $sql_data_array['entry_suburb'] = $suburb;
|
||||
if (ACCOUNT_STATE == 'true') {
|
||||
if ($zone_id > 0) {
|
||||
$sql_data_array['entry_zone_id'] = $zone_id;
|
||||
$sql_data_array['entry_state'] = '';
|
||||
} else {
|
||||
$sql_data_array['entry_zone_id'] = '0';
|
||||
$sql_data_array['entry_state'] = $state;
|
||||
}
|
||||
}
|
||||
|
||||
if (!tep_session_is_registered('sendto')) tep_session_register('sendto');
|
||||
|
||||
tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);
|
||||
|
||||
$sendto = tep_db_insert_id();
|
||||
|
||||
if (tep_session_is_registered('shipping')) tep_session_unregister('shipping');
|
||||
|
||||
tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
|
||||
}
|
||||
// process the selected shipping destination
|
||||
} elseif (isset($HTTP_POST_VARS['address'])) {
|
||||
$reset_shipping = false;
|
||||
if (tep_session_is_registered('sendto')) {
|
||||
if ($sendto != $HTTP_POST_VARS['address']) {
|
||||
if (tep_session_is_registered('shipping')) {
|
||||
$reset_shipping = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tep_session_register('sendto');
|
||||
}
|
||||
|
||||
$sendto = $HTTP_POST_VARS['address'];
|
||||
|
||||
$check_address_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$sendto . "'");
|
||||
$check_address = tep_db_fetch_array($check_address_query);
|
||||
|
||||
if ($check_address['total'] == '1') {
|
||||
if ($reset_shipping == true) tep_session_unregister('shipping');
|
||||
tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
|
||||
} else {
|
||||
tep_session_unregister('sendto');
|
||||
}
|
||||
} else {
|
||||
if (!tep_session_is_registered('sendto')) tep_session_register('sendto');
|
||||
$sendto = $customer_default_address_id;
|
||||
|
||||
tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
|
||||
}
|
||||
}
|
||||
|
||||
// if no shipping destination address was selected, use their own address as default
|
||||
if (!tep_session_is_registered('sendto')) {
|
||||
$sendto = $customer_default_address_id;
|
||||
}
|
||||
|
||||
$breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
|
||||
$breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_CHECKOUT_SHIPPING_ADDRESS, '', 'SSL'));
|
||||
|
||||
$addresses_count = tep_count_customer_address_book_entries();
|
||||
?>
|
||||
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html <?php echo HTML_PARAMS; ?>>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
|
||||
<title><?php echo TITLE; ?></title>
|
||||
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
|
||||
<link rel="stylesheet" type="text/css" href="stylesheet.css">
|
||||
<script language="javascript"><!--
|
||||
var selected;
|
||||
|
||||
function selectRowEffect(object, buttonSelect) {
|
||||
if (!selected) {
|
||||
if (document.getElementById) {
|
||||
selected = document.getElementById('defaultSelected');
|
||||
} else {
|
||||
selected = document.all['defaultSelected'];
|
||||
}
|
||||
}
|
||||
|
||||
if (selected) selected.className = 'moduleRow';
|
||||
object.className = 'moduleRowSelected';
|
||||
selected = object;
|
||||
|
||||
// one button is not an array
|
||||
if (document.checkout_address.address[0]) {
|
||||
document.checkout_address.address[buttonSelect].checked=true;
|
||||
} else {
|
||||
document.checkout_address.address.checked=true;
|
||||
}
|
||||
}
|
||||
|
||||
function rowOverEffect(object) {
|
||||
if (object.className == 'moduleRow') object.className = 'moduleRowOver';
|
||||
}
|
||||
|
||||
function rowOutEffect(object) {
|
||||
if (object.className == 'moduleRowOver') object.className = 'moduleRow';
|
||||
}
|
||||
|
||||
function check_form_optional(form_name) {
|
||||
var form = form_name;
|
||||
|
||||
var firstname = form.elements['firstname'].value;
|
||||
var lastname = form.elements['lastname'].value;
|
||||
var street_address = form.elements['street_address'].value;
|
||||
|
||||
if (firstname == '' && lastname == '' && street_address == '') {
|
||||
return true;
|
||||
} else {
|
||||
return check_form(form_name);
|
||||
}
|
||||
}
|
||||
//--></script>
|
||||
<?php require(DIR_WS_INCLUDES . 'form_check.js.php'); ?>
|
||||
</head>
|
||||
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
|
||||
<!-- header //-->
|
||||
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
|
||||
<!-- header_eof //-->
|
||||
|
||||
<!-- body //-->
|
||||
<table border="0" width="100%" cellspacing="3" cellpadding="3">
|
||||
<tr>
|
||||
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
|
||||
<!-- left_navigation //-->
|
||||
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
|
||||
<!-- left_navigation_eof //-->
|
||||
</table></td>
|
||||
<!-- body_text //-->
|
||||
<td width="100%" valign="top"><?php echo tep_draw_form('checkout_address', tep_href_link(FILENAME_CHECKOUT_SHIPPING_ADDRESS, '', 'SSL'), 'post', 'onSubmit="return check_form_optional(checkout_address);"'); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
|
||||
<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_delivery.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
if ($messageStack->size('checkout_address') > 0) {
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $messageStack->output('checkout_address'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
if ($process == false) {
|
||||
?>
|
||||
<tr>
|
||||
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
|
||||
<tr>
|
||||
<td class="main"><b><?php echo TABLE_HEADING_SHIPPING_ADDRESS; ?></b></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
|
||||
<tr class="infoBoxContents">
|
||||
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
|
||||
<tr>
|
||||
<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
<td class="main" width="50%" valign="top"><?php echo TEXT_SELECTED_SHIPPING_DESTINATION; ?></td>
|
||||
<td align="right" width="50%" valign="top"><table border="0" cellspacing="0" cellpadding="2">
|
||||
<tr>
|
||||
<td class="main" align="center" valign="top"><?php echo '<b>' . TITLE_SHIPPING_ADDRESS . '</b><br>' . tep_image(DIR_WS_IMAGES . 'arrow_south_east.gif'); ?></td>
|
||||
<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
<td class="main" valign="top"><?php echo tep_address_label($customer_id, $sendto, true, ' ', '<br>'); ?></td>
|
||||
<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
if ($addresses_count > 1) {
|
||||
?>
|
||||
<tr>
|
||||
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
|
||||
<tr>
|
||||
<td class="main"><b><?php echo TABLE_HEADING_ADDRESS_BOOK_ENTRIES; ?></b></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
|
||||
<tr class="infoBoxContents">
|
||||
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
|
||||
<tr>
|
||||
<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
<td class="main" width="50%" valign="top"><?php echo TEXT_SELECT_OTHER_SHIPPING_DESTINATION; ?></td>
|
||||
<td class="main" width="50%" valign="top" align="right"><?php echo '<b>' . TITLE_PLEASE_SELECT . '</b><br>' . tep_image(DIR_WS_IMAGES . 'arrow_east_south.gif'); ?></td>
|
||||
<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
$radio_buttons = 0;
|
||||
|
||||
$addresses_query = tep_db_query("select address_book_id, entry_firstname as firstname, entry_lastname as lastname, entry_company as company, entry_street_address as street_address, entry_suburb as suburb, entry_city as city, entry_postcode as postcode, entry_state as state, entry_zone_id as zone_id, entry_country_id as country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "'");
|
||||
while ($addresses = tep_db_fetch_array($addresses_query)) {
|
||||
$format_id = tep_get_address_format_id($addresses['country_id']);
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
<td colspan="2"><table border="0" width="100%" cellspacing="0" cellpadding="2">
|
||||
<?php
|
||||
if ($addresses['address_book_id'] == $sendto) {
|
||||
echo ' <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
|
||||
} else {
|
||||
echo ' <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
|
||||
}
|
||||
?>
|
||||
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
<td class="main" colspan="2"><b><?php echo tep_output_string_protected($addresses['firstname'] . ' ' . $addresses['lastname']); ?></b></td>
|
||||
<td class="main" align="right"><?php echo tep_draw_radio_field('address', $addresses['address_book_id'], ($addresses['address_book_id'] == $sendto)); ?></td>
|
||||
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
<td colspan="3"><table border="0" cellspacing="0" cellpadding="2">
|
||||
<tr>
|
||||
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
<td class="main"><?php echo tep_address_format($format_id, $addresses, true, ' ', ', '); ?></td>
|
||||
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
$radio_buttons++;
|
||||
}
|
||||
?>
|
||||
</table></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if ($addresses_count < MAX_ADDRESS_BOOK_ENTRIES) {
|
||||
?>
|
||||
<tr>
|
||||
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
|
||||
<tr>
|
||||
<td class="main"><b><?php echo TABLE_HEADING_NEW_SHIPPING_ADDRESS; ?></b></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
|
||||
<tr class="infoBoxContents">
|
||||
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
|
||||
<tr>
|
||||
<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
<td class="main" width="100%" valign="top"><?php echo TEXT_CREATE_NEW_SHIPPING_ADDRESS; ?></td>
|
||||
<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
|
||||
<tr>
|
||||
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
<td><?php require(DIR_WS_MODULES . 'checkout_new_address.php'); ?></td>
|
||||
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
|
||||
<tr class="infoBoxContents">
|
||||
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
|
||||
<tr>
|
||||
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
<td class="main"><?php echo '<b>' . TITLE_CONTINUE_CHECKOUT_PROCEDURE . '</b><br>' . TEXT_CONTINUE_CHECKOUT_PROCEDURE; ?></td>
|
||||
<td class="main" align="right"><?php echo tep_draw_hidden_field('action', 'submit') . tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>
|
||||
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<?php
|
||||
if ($process == true) {
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING_ADDRESS, '', 'SSL') . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td width="50%" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'checkout_bullet.gif'); ?></td>
|
||||
<td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
<td width="25%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
|
||||
<td width="25%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
|
||||
<td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
|
||||
<td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '1', '5'); ?></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" width="25%" class="checkoutBarCurrent"><?php echo CHECKOUT_BAR_DELIVERY; ?></td>
|
||||
<td align="center" width="25%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_PAYMENT; ?></td>
|
||||
<td align="center" width="25%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_CONFIRMATION; ?></td>
|
||||
<td align="center" width="25%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_FINISHED; ?></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
</table></form></td>
|
||||
<!-- body_text_eof //-->
|
||||
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
|
||||
<!-- right_navigation //-->
|
||||
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
|
||||
<!-- right_navigation_eof //-->
|
||||
</table></td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- body_eof //-->
|
||||
|
||||
<!-- footer //-->
|
||||
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
|
||||
<!-- footer_eof //-->
|
||||
<br>
|
||||
</body>
|
||||
</html>
|
||||
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
|
71
psp_admin/inc/payment_modules/currencies.php
Normal file
71
psp_admin/inc/payment_modules/currencies.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/*
|
||||
$Id: currencies.php,v 1.3 2003/06/20 16:23:08 hpdl Exp $
|
||||
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2003 osCommerce
|
||||
|
||||
Released under the GNU General Public License
|
||||
*/
|
||||
|
||||
////
|
||||
// Class to handle currencies
|
||||
// TABLES: currencies
|
||||
class currencies {
|
||||
var $currencies;
|
||||
|
||||
// class constructor
|
||||
function currencies() {
|
||||
$this->currencies = array();
|
||||
$this->currencies['EUR'] = array('title' => 'EURO',
|
||||
'symbol_left' => '€',
|
||||
'symbol_right' => 'EURO',
|
||||
'decimal_point' => ',',
|
||||
'thousands_point' => '.',
|
||||
'decimal_places' => 2,
|
||||
'value' => 1);
|
||||
}
|
||||
|
||||
// class methods
|
||||
function format($number, $calculate_currency_value = false, $currency_type = DEFAULT_CURRENCY, $currency_value = '') {
|
||||
if ($calculate_currency_value) {
|
||||
$rate = ($currency_value) ? $currency_value : $this->currencies[$currency_type]['value'];
|
||||
$format_string = $this->currencies[$currency_type]['symbol_left'] . number_format($number * $rate, $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . $this->currencies[$currency_type]['symbol_right'];
|
||||
// if the selected currency is in the european euro-conversion and the default currency is euro,
|
||||
// the currency will displayed in the national currency and euro currency
|
||||
if ( (DEFAULT_CURRENCY == 'EUR') && ($currency_type == 'DEM' || $currency_type == 'BEF' || $currency_type == 'LUF' || $currency_type == 'ESP' || $currency_type == 'FRF' || $currency_type == 'IEP' || $currency_type == 'ITL' || $currency_type == 'NLG' || $currency_type == 'ATS' || $currency_type == 'PTE' || $currency_type == 'FIM' || $currency_type == 'GRD') ) {
|
||||
$format_string .= ' <small>[' . $this->format($number, true, 'EUR') . ']</small>';
|
||||
}
|
||||
} else {
|
||||
$format_string = $this->currencies[$currency_type]['symbol_left'] . number_format($number, $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . $this->currencies[$currency_type]['symbol_right'];
|
||||
}
|
||||
|
||||
return $format_string;
|
||||
}
|
||||
function is_set($code) {
|
||||
if (isset($this->currencies[$code]) && tep_not_null($this->currencies[$code])) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function get_value($code) {
|
||||
return $this->currencies[$code]['value'];
|
||||
}
|
||||
function get_title($code)
|
||||
{
|
||||
return $this->currencies[$code]['title'];
|
||||
}
|
||||
|
||||
function get_decimal_places($code) {
|
||||
return $this->currencies[$code]['decimal_places'];
|
||||
}
|
||||
|
||||
function display_price($products_price, $products_tax, $quantity = 1) {
|
||||
return $this->format(tep_add_tax($products_price, $products_tax) * $quantity);
|
||||
}
|
||||
}
|
||||
?>
|
152
psp_admin/inc/payment_modules/database.php
Normal file
152
psp_admin/inc/payment_modules/database.php
Normal file
@ -0,0 +1,152 @@
|
||||
<?php
|
||||
/*
|
||||
$Id: database.php,v 1.21 2003/06/09 21:21:59 hpdl Exp $
|
||||
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2003 osCommerce
|
||||
|
||||
Released under the GNU General Public License
|
||||
*/
|
||||
define('DB_SERVER', $GLOBALS[egw_info][server][db_host]);
|
||||
define('DB_SERVER_USERNAME', $GLOBALS[egw_info][server][db_user]);
|
||||
define('DB_SERVER_PASSWORD', $GLOBALS[egw_info][server][db_pass]);
|
||||
define('DB_DATABASE', $GLOBALS[egw_info][server][db_name]);
|
||||
define('TABLE_ZONES_TO_GEO_ZONES', 'egw_oscadmin_z2geo');
|
||||
define('TABLE_CONFIGURATION','egw_oscadmin_osc_conf');
|
||||
define('DIR_WS_LANGUAGES',EGW_SERVER_ROOT.'/psp_admin/inc/languages/');
|
||||
define('DIR_WS_MODULES',EGW_SERVER_ROOT.'/psp_admin/inc/payment_modules/');
|
||||
define('DIR_WS_CLASSES',EGW_SERVER_ROOT.'/psp_admin/inc/payment_modules/');
|
||||
|
||||
function tep_db_connect($server = DB_SERVER, $username = DB_SERVER_USERNAME, $password = DB_SERVER_PASSWORD, $database = DB_DATABASE, $link = 'db_link') {
|
||||
global $$link;
|
||||
|
||||
if (USE_PCONNECT == 'true') {
|
||||
$$link = mysql_pconnect($server, $username, $password);
|
||||
} else {
|
||||
$$link = mysql_connect($server, $username, $password);
|
||||
}
|
||||
|
||||
if ($$link) mysql_select_db($database);
|
||||
|
||||
return $$link;
|
||||
}
|
||||
|
||||
function tep_db_close($link = 'db_link') {
|
||||
global $$link;
|
||||
|
||||
return mysql_close($$link);
|
||||
}
|
||||
|
||||
function tep_db_error($query, $errno, $error) {
|
||||
die('<font color="#000000"><b>' . $errno . ' - ' . $error . '<br><br>' . $query . '<br><br><small><font color="#ff0000">[TEP STOP]</font></small><br><br></b></font>');
|
||||
}
|
||||
|
||||
function tep_db_query($query, $link = 'db_link') {
|
||||
global $$link;
|
||||
|
||||
if (defined('STORE_DB_TRANSACTIONS') && (STORE_DB_TRANSACTIONS == 'true')) {
|
||||
error_log('QUERY ' . $query . "\n", 3, STORE_PAGE_PARSE_TIME_LOG);
|
||||
}
|
||||
|
||||
$result = mysql_query($query, $$link) or tep_db_error($query, mysql_errno(), mysql_error());
|
||||
|
||||
if (defined('STORE_DB_TRANSACTIONS') && (STORE_DB_TRANSACTIONS == 'true')) {
|
||||
$result_error = mysql_error();
|
||||
error_log('RESULT ' . $result . ' ' . $result_error . "\n", 3, STORE_PAGE_PARSE_TIME_LOG);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
function tep_db_perform($table, $data, $action = 'insert', $parameters = '', $link = 'db_link') {
|
||||
reset($data);
|
||||
if ($action == 'insert') {
|
||||
$query = 'insert into ' . $table . ' (';
|
||||
while (list($columns, ) = each($data)) {
|
||||
$query .= $columns . ', ';
|
||||
}
|
||||
$query = substr($query, 0, -2) . ') values (';
|
||||
reset($data);
|
||||
while (list(, $value) = each($data)) {
|
||||
switch ((string)$value) {
|
||||
case 'now()':
|
||||
$query .= 'now(), ';
|
||||
break;
|
||||
case 'null':
|
||||
$query .= 'null, ';
|
||||
break;
|
||||
default:
|
||||
$query .= '\'' . tep_db_input($value) . '\', ';
|
||||
break;
|
||||
}
|
||||
}
|
||||
$query = substr($query, 0, -2) . ')';
|
||||
} elseif ($action == 'update') {
|
||||
$query = 'update ' . $table . ' set ';
|
||||
while (list($columns, $value) = each($data)) {
|
||||
switch ((string)$value) {
|
||||
case 'now()':
|
||||
$query .= $columns . ' = now(), ';
|
||||
break;
|
||||
case 'null':
|
||||
$query .= $columns .= ' = null, ';
|
||||
break;
|
||||
default:
|
||||
$query .= $columns . ' = \'' . tep_db_input($value) . '\', ';
|
||||
break;
|
||||
}
|
||||
}
|
||||
$query = substr($query, 0, -2) . ' where ' . $parameters;
|
||||
}
|
||||
|
||||
return tep_db_query($query, $link);
|
||||
}
|
||||
|
||||
function tep_db_fetch_array($db_query) {
|
||||
return mysql_fetch_array($db_query, MYSQL_ASSOC);
|
||||
}
|
||||
|
||||
function tep_db_num_rows($db_query) {
|
||||
return mysql_num_rows($db_query);
|
||||
}
|
||||
|
||||
function tep_db_data_seek($db_query, $row_number) {
|
||||
return mysql_data_seek($db_query, $row_number);
|
||||
}
|
||||
|
||||
function tep_db_insert_id() {
|
||||
return mysql_insert_id();
|
||||
}
|
||||
|
||||
function tep_db_free_result($db_query) {
|
||||
return mysql_free_result($db_query);
|
||||
}
|
||||
|
||||
function tep_db_fetch_fields($db_query) {
|
||||
return mysql_fetch_field($db_query);
|
||||
}
|
||||
|
||||
function tep_db_output($string) {
|
||||
return htmlspecialchars($string);
|
||||
}
|
||||
|
||||
function tep_db_input($string) {
|
||||
return addslashes($string);
|
||||
}
|
||||
|
||||
function tep_db_prepare_input($string) {
|
||||
if (is_string($string)) {
|
||||
return trim(tep_sanitize_string(stripslashes($string)));
|
||||
} elseif (is_array($string)) {
|
||||
reset($string);
|
||||
while (list($key, $value) = each($string)) {
|
||||
$string[$key] = tep_db_prepare_input($value);
|
||||
}
|
||||
return $string;
|
||||
} else {
|
||||
return $string;
|
||||
}
|
||||
}
|
||||
?>
|
1253
psp_admin/inc/payment_modules/general.php
Normal file
1253
psp_admin/inc/payment_modules/general.php
Normal file
File diff suppressed because it is too large
Load Diff
298
psp_admin/inc/payment_modules/html_output.php
Normal file
298
psp_admin/inc/payment_modules/html_output.php
Normal file
@ -0,0 +1,298 @@
|
||||
<?php
|
||||
/*
|
||||
$Id: html_output.php,v 1.56 2003/07/09 01:15:48 hpdl Exp $
|
||||
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2003 osCommerce
|
||||
|
||||
Released under the GNU General Public License
|
||||
*/
|
||||
|
||||
////
|
||||
// The HTML href link wrapper function
|
||||
function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true) {
|
||||
global $request_type, $session_started, $SID;
|
||||
|
||||
if (!tep_not_null($page)) {
|
||||
die('</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine the page link!<br><br>');
|
||||
}
|
||||
|
||||
if ($connection == 'NONSSL') {
|
||||
$link = HTTP_SERVER . DIR_WS_HTTP_CATALOG;
|
||||
} elseif ($connection == 'SSL') {
|
||||
if (ENABLE_SSL == true) {
|
||||
$link = HTTPS_SERVER . DIR_WS_HTTPS_CATALOG;
|
||||
} else {
|
||||
$link = HTTP_SERVER . DIR_WS_HTTP_CATALOG;
|
||||
}
|
||||
} else {
|
||||
die('</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine connection method on a link!<br><br>Known methods: NONSSL SSL</b><br><br>');
|
||||
}
|
||||
|
||||
if (tep_not_null($parameters)) {
|
||||
$link .= $page . '&' . tep_output_string($parameters);
|
||||
$separator = '&';
|
||||
} else {
|
||||
$link .= $page;
|
||||
$separator = '?';
|
||||
}
|
||||
|
||||
while ( (substr($link, -1) == '&') || (substr($link, -1) == '?') ) $link = substr($link, 0, -1);
|
||||
|
||||
// Add the session ID when moving from different HTTP and HTTPS servers, or when SID is defined
|
||||
if ( ($add_session_id == true) && ($session_started == true) && (SESSION_FORCE_COOKIE_USE == 'False') ) {
|
||||
if (tep_not_null($SID)) {
|
||||
$_sid = $SID;
|
||||
} elseif ( ( ($request_type == 'NONSSL') && ($connection == 'SSL') && (ENABLE_SSL == true) ) || ( ($request_type == 'SSL') && ($connection == 'NONSSL') ) ) {
|
||||
if (HTTP_COOKIE_DOMAIN != HTTPS_COOKIE_DOMAIN) {
|
||||
$_sid = tep_session_name() . '=' . tep_session_id();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( (SEARCH_ENGINE_FRIENDLY_URLS == 'true') && ($search_engine_safe == true) ) {
|
||||
while (strstr($link, '&&')) $link = str_replace('&&', '&', $link);
|
||||
|
||||
$link = str_replace('?', '/', $link);
|
||||
$link = str_replace('&', '/', $link);
|
||||
$link = str_replace('=', '/', $link);
|
||||
|
||||
$separator = '?';
|
||||
}
|
||||
|
||||
if (isset($_sid)) {
|
||||
$link .= $separator . $_sid;
|
||||
}
|
||||
|
||||
return $link;
|
||||
}
|
||||
|
||||
////
|
||||
// The HTML image wrapper function
|
||||
function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '') {
|
||||
if ( (empty($src) || ($src == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == 'false') ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// alt is added to the img tag even if it is null to prevent browsers from outputting
|
||||
// the image filename as default
|
||||
$image = '<img src="' . tep_output_string($src) . '" border="0" alt="' . tep_output_string($alt) . '"';
|
||||
|
||||
if (tep_not_null($alt)) {
|
||||
$image .= ' title=" ' . tep_output_string($alt) . ' "';
|
||||
}
|
||||
|
||||
if ( (CONFIG_CALCULATE_IMAGE_SIZE == 'true') && (empty($width) || empty($height)) ) {
|
||||
if ($image_size = @getimagesize($src)) {
|
||||
if (empty($width) && tep_not_null($height)) {
|
||||
$ratio = $height / $image_size[1];
|
||||
$width = $image_size[0] * $ratio;
|
||||
} elseif (tep_not_null($width) && empty($height)) {
|
||||
$ratio = $width / $image_size[0];
|
||||
$height = $image_size[1] * $ratio;
|
||||
} elseif (empty($width) && empty($height)) {
|
||||
$width = $image_size[0];
|
||||
$height = $image_size[1];
|
||||
}
|
||||
} elseif (IMAGE_REQUIRED == 'false') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (tep_not_null($width) && tep_not_null($height)) {
|
||||
$image .= ' width="' . tep_output_string($width) . '" height="' . tep_output_string($height) . '"';
|
||||
}
|
||||
|
||||
if (tep_not_null($parameters)) $image .= ' ' . $parameters;
|
||||
|
||||
$image .= '>';
|
||||
|
||||
return $image;
|
||||
}
|
||||
|
||||
////
|
||||
// The HTML form submit button wrapper function
|
||||
// Outputs a button in the selected language
|
||||
function tep_image_submit($image, $alt = '', $parameters = '') {
|
||||
global $language;
|
||||
|
||||
$image_submit = '<input type="image" src="' . tep_output_string(DIR_WS_LANGUAGES . $language . '/images/buttons/' . $image) . '" border="0" alt="' . tep_output_string($alt) . '"';
|
||||
|
||||
if (tep_not_null($alt)) $image_submit .= ' title=" ' . tep_output_string($alt) . ' "';
|
||||
|
||||
if (tep_not_null($parameters)) $image_submit .= ' ' . $parameters;
|
||||
|
||||
$image_submit .= '>';
|
||||
|
||||
return $image_submit;
|
||||
}
|
||||
|
||||
////
|
||||
// Output a function button in the selected language
|
||||
function tep_image_button($image, $alt = '', $parameters = '') {
|
||||
global $language;
|
||||
|
||||
return tep_image(DIR_WS_LANGUAGES . $language . '/images/buttons/' . $image, $alt, '', '', $parameters);
|
||||
}
|
||||
|
||||
////
|
||||
// Output a separator either through whitespace, or with an image
|
||||
function tep_draw_separator($image = 'pixel_black.gif', $width = '100%', $height = '1') {
|
||||
return tep_image(DIR_WS_IMAGES . $image, '', $width, $height);
|
||||
}
|
||||
|
||||
////
|
||||
// Output a form
|
||||
function tep_draw_form($name, $action, $method = 'post', $parameters = '') {
|
||||
$form = '<form name="' . tep_output_string($name) . '" action="' . tep_output_string($action) . '" method="' . tep_output_string($method) . '"';
|
||||
|
||||
if (tep_not_null($parameters)) $form .= ' ' . $parameters;
|
||||
|
||||
$form .= '>';
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
////
|
||||
// Output a form input field
|
||||
function tep_draw_input_field($name, $value = '', $parameters = '', $type = 'text', $reinsert_value = true) {
|
||||
$field = '<input type="' . tep_output_string($type) . '" name="' . tep_output_string($name) . '"';
|
||||
|
||||
if ( (isset($GLOBALS[$name])) && ($reinsert_value == true) ) {
|
||||
$field .= ' value="' . tep_output_string(stripslashes($GLOBALS[$name])) . '"';
|
||||
} elseif (tep_not_null($value)) {
|
||||
$field .= ' value="' . tep_output_string($value) . '"';
|
||||
}
|
||||
|
||||
if (tep_not_null($parameters)) $field .= ' ' . $parameters;
|
||||
|
||||
$field .= '>';
|
||||
|
||||
return $field;
|
||||
}
|
||||
|
||||
////
|
||||
// Output a form password field
|
||||
function tep_draw_password_field($name, $value = '', $parameters = 'maxlength="40"') {
|
||||
return tep_draw_input_field($name, $value, $parameters, 'password', false);
|
||||
}
|
||||
|
||||
////
|
||||
// Output a selection field - alias function for tep_draw_checkbox_field() and tep_draw_radio_field()
|
||||
function tep_draw_selection_field($name, $type, $value = '', $checked = false, $parameters = '') {
|
||||
$selection = '<input type="' . tep_output_string($type) . '" name="' . tep_output_string($name) . '"';
|
||||
|
||||
if (tep_not_null($value)) $selection .= ' value="' . tep_output_string($value) . '"';
|
||||
|
||||
if ( ($checked == true) || ( isset($GLOBALS[$name]) && is_string($GLOBALS[$name]) && ( ($GLOBALS[$name] == 'on') || (isset($value) && (stripslashes($GLOBALS[$name]) == $value)) ) ) ) {
|
||||
$selection .= ' CHECKED';
|
||||
}
|
||||
|
||||
if (tep_not_null($parameters)) $selection .= ' ' . $parameters;
|
||||
|
||||
$selection .= '>';
|
||||
|
||||
return $selection;
|
||||
}
|
||||
|
||||
////
|
||||
// Output a form checkbox field
|
||||
function tep_draw_checkbox_field($name, $value = '', $checked = false, $parameters = '') {
|
||||
return tep_draw_selection_field($name, 'checkbox', $value, $checked, $parameters);
|
||||
}
|
||||
|
||||
////
|
||||
// Output a form radio field
|
||||
function tep_draw_radio_field($name, $value = '', $checked = false, $parameters = '') {
|
||||
return tep_draw_selection_field($name, 'radio', $value, $checked, $parameters);
|
||||
}
|
||||
|
||||
////
|
||||
// Output a form textarea field
|
||||
function tep_draw_textarea_field($name, $wrap, $width, $height, $text = '', $parameters = '', $reinsert_value = true) {
|
||||
$field = '<textarea name="' . tep_output_string($name) . '" wrap="' . tep_output_string($wrap) . '" cols="' . tep_output_string($width) . '" rows="' . tep_output_string($height) . '"';
|
||||
|
||||
if (tep_not_null($parameters)) $field .= ' ' . $parameters;
|
||||
|
||||
$field .= '>';
|
||||
|
||||
if ( (isset($GLOBALS[$name])) && ($reinsert_value == true) ) {
|
||||
$field .= stripslashes($GLOBALS[$name]);
|
||||
} elseif (tep_not_null($text)) {
|
||||
$field .= $text;
|
||||
}
|
||||
|
||||
$field .= '</textarea>';
|
||||
|
||||
return $field;
|
||||
}
|
||||
|
||||
////
|
||||
// Output a form hidden field
|
||||
function tep_draw_hidden_field($name, $value = '', $parameters = '') {
|
||||
$field = '<input type="hidden" name="' . tep_output_string($name) . '"';
|
||||
|
||||
if (tep_not_null($value)) {
|
||||
$field .= ' value="' . tep_output_string($value) . '"';
|
||||
} elseif (isset($GLOBALS[$name])) {
|
||||
$field .= ' value="' . tep_output_string(stripslashes($GLOBALS[$name])) . '"';
|
||||
}
|
||||
|
||||
if (tep_not_null($parameters)) $field .= ' ' . $parameters;
|
||||
|
||||
$field .= '>';
|
||||
|
||||
return $field;
|
||||
}
|
||||
|
||||
////
|
||||
// Hide form elements
|
||||
function tep_hide_session_id() {
|
||||
global $session_started, $SID;
|
||||
|
||||
if (($session_started == true) && tep_not_null($SID)) {
|
||||
return tep_draw_hidden_field(tep_session_name(), tep_session_id());
|
||||
}
|
||||
}
|
||||
|
||||
////
|
||||
// Output a form pull down menu
|
||||
function tep_draw_pull_down_menu($name, $values, $default = '', $parameters = '', $required = false) {
|
||||
$field = '<select name="' . tep_output_string($name) . '"';
|
||||
|
||||
if (tep_not_null($parameters)) $field .= ' ' . $parameters;
|
||||
|
||||
$field .= '>';
|
||||
|
||||
if (empty($default) && isset($GLOBALS[$name])) $default = stripslashes($GLOBALS[$name]);
|
||||
|
||||
for ($i=0, $n=sizeof($values); $i<$n; $i++) {
|
||||
$field .= '<option value="' . tep_output_string($values[$i]['id']) . '"';
|
||||
if ($default == $values[$i]['id']) {
|
||||
$field .= ' SELECTED';
|
||||
}
|
||||
|
||||
$field .= '>' . tep_output_string($values[$i]['text'], array('"' => '"', '\'' => ''', '<' => '<', '>' => '>')) . '</option>';
|
||||
}
|
||||
$field .= '</select>';
|
||||
|
||||
if ($required == true) $field .= TEXT_FIELD_REQUIRED;
|
||||
|
||||
return $field;
|
||||
}
|
||||
|
||||
////
|
||||
// Creates a pull-down list of countries
|
||||
function tep_get_country_list($name, $selected = '', $parameters = '') {
|
||||
$countries_array = array(array('id' => '', 'text' => PULL_DOWN_DEFAULT));
|
||||
$countries = tep_get_countries();
|
||||
|
||||
for ($i=0, $n=sizeof($countries); $i<$n; $i++) {
|
||||
$countries_array[] = array('id' => $countries[$i]['countries_id'], 'text' => $countries[$i]['countries_name']);
|
||||
}
|
||||
|
||||
return tep_draw_pull_down_menu($name, $countries_array, $selected, $parameters);
|
||||
}
|
||||
?>
|
170
psp_admin/inc/payment_modules/order.php
Normal file
170
psp_admin/inc/payment_modules/order.php
Normal file
@ -0,0 +1,170 @@
|
||||
<?php
|
||||
/*
|
||||
$Id: order.php,v 1.7 2003/06/20 16:23:08 hpdl Exp $
|
||||
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2003 osCommerce
|
||||
|
||||
Released under the GNU General Public License
|
||||
*/
|
||||
|
||||
class order {
|
||||
var $info, $totals, $products, $customer, $delivery;
|
||||
|
||||
function order($order_id) {
|
||||
$this->info = array();
|
||||
$this->totals = array();
|
||||
$this->products = array();
|
||||
$this->customer = array();
|
||||
$this->delivery = array();
|
||||
|
||||
$this->insert_cybro_values();
|
||||
}
|
||||
|
||||
function insert_cybro_values()
|
||||
{
|
||||
$bo = CreateObject('psp_admin.bo_oscadminapi');
|
||||
#_debug_array($bo->socreditspoint->sessiondata);
|
||||
$ses = $bo->so_oscadminapi->sessiondata;
|
||||
#_debug_array($bo->socreditspoint->config->config_data[cost_one_credit]);
|
||||
#die();
|
||||
$this->customer = array
|
||||
(
|
||||
'name' => $ses[step2][n_givven].''.$ses[step2][n_middle].''.$ses[step2][n_family],
|
||||
'company' => '',
|
||||
'street_address' => $ses[step2][adr_one_street],
|
||||
'suburb' => '',
|
||||
'city' => $ses[step2][adr_one_locality],
|
||||
'postcode' => $ses[step2][adr_one_postalcode],
|
||||
'state' => '',
|
||||
'country' => array(
|
||||
'id'=>150 ,
|
||||
'Name'=>'Netherlands',
|
||||
'countries_iso_code_2'=>'NL',
|
||||
'countries_iso_code_3'=>'NLD',
|
||||
'address_format_id'=>3
|
||||
),
|
||||
'format_id' => '',//$order['customers_address_format_id'],
|
||||
'telephone' => $ses[step2][tel_work],
|
||||
'email_address' => $ses[step2][email],
|
||||
'zone_id'=>18
|
||||
|
||||
);
|
||||
|
||||
$this->delivery = $this->billing = $this->customer;
|
||||
|
||||
$this->info = array
|
||||
(
|
||||
'order_status'=>1,
|
||||
'currency' => 'EURO',//$order['currency'],
|
||||
'currency_value' =>'1',// $order['currency_value'],
|
||||
'payment_method' => $ses[stap3]['payment'],//$order['payment_method'],
|
||||
'cc_type' => '',//$order['cc_type'],
|
||||
'cc_owner' => $ses[stap3][cc_owner],//$order['cc_owner'],
|
||||
'cc_number' => $ses[stap3][cc_number],//$order['cc_number'],
|
||||
'cc_expires' => $ses[stap3][cc_expires_month].'/'.$ses[stap3][cc_expires_year],//$order['cc_expires'],
|
||||
'date_purchased' => date('d-m-Y'),//$order['date_purchased'],
|
||||
'orders_status' => '1',//$order['orders_status'],
|
||||
'last_modified' => '',//$order['last_modified'],
|
||||
'tax'=> 0,
|
||||
'subtotal'=>(intval($ses[step2][amount])*floatval($bo->so_pspadmin->config->config_data[cost_one_credit])),
|
||||
'total'=>((intval($ses[step2][amount])*floatval($bo->so_pspadmin->config->config_data[cost_one_credit]))*1.19)
|
||||
|
||||
);
|
||||
$index = 0;
|
||||
$this->products[0] = array
|
||||
(
|
||||
'qty' => $ses[step2][amount],
|
||||
'name' => lang('Credits'),
|
||||
'model' => '',
|
||||
'tax' => '19',
|
||||
'price' => $bo->so_pspadmin->config->config_data[cost_one_credit],
|
||||
'final_price' => (intval($ses[step2][amount])*floatval($bo->so_pspadmin->config->config_data[cost_one_credit]))
|
||||
);
|
||||
|
||||
}
|
||||
function query($order_id) {
|
||||
$order_query = tep_db_query("select customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, date_purchased, orders_status, last_modified from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'");
|
||||
$order = tep_db_fetch_array($order_query);
|
||||
|
||||
$totals_query = tep_db_query("select title, text from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "' order by sort_order");
|
||||
while ($totals = tep_db_fetch_array($totals_query))
|
||||
{
|
||||
$this->totals[] = array('title' => $totals['title'],
|
||||
'text' => $totals['text']);
|
||||
}
|
||||
|
||||
$this->info = array('currency' => $order['currency'],
|
||||
'currency_value' => $order['currency_value'],
|
||||
'payment_method' => $order['payment_method'],
|
||||
'cc_type' => $order['cc_type'],
|
||||
'cc_owner' => $order['cc_owner'],
|
||||
'cc_number' => $order['cc_number'],
|
||||
'cc_expires' => $order['cc_expires'],
|
||||
'date_purchased' => $order['date_purchased'],
|
||||
'orders_status' => $order['orders_status'],
|
||||
'last_modified' => $order['last_modified']);
|
||||
|
||||
$this->customer = array('name' => $order['customers_name'],
|
||||
'company' => $order['customers_company'],
|
||||
'street_address' => $order['customers_street_address'],
|
||||
'suburb' => $order['customers_suburb'],
|
||||
'city' => $order['customers_city'],
|
||||
'postcode' => $order['customers_postcode'],
|
||||
'state' => $order['customers_state'],
|
||||
'country' => $order['customers_country'],
|
||||
'format_id' => $order['customers_address_format_id'],
|
||||
'telephone' => $order['customers_telephone'],
|
||||
'email_address' => $order['customers_email_address']);
|
||||
|
||||
$this->delivery = array('name' => $order['delivery_name'],
|
||||
'company' => $order['delivery_company'],
|
||||
'street_address' => $order['delivery_street_address'],
|
||||
'suburb' => $order['delivery_suburb'],
|
||||
'city' => $order['delivery_city'],
|
||||
'postcode' => $order['delivery_postcode'],
|
||||
'state' => $order['delivery_state'],
|
||||
'country' => $order['delivery_country'],
|
||||
'format_id' => $order['delivery_address_format_id']);
|
||||
|
||||
$this->billing = array('name' => $order['billing_name'],
|
||||
'company' => $order['billing_company'],
|
||||
'street_address' => $order['billing_street_address'],
|
||||
'suburb' => $order['billing_suburb'],
|
||||
'city' => $order['billing_city'],
|
||||
'postcode' => $order['billing_postcode'],
|
||||
'state' => $order['billing_state'],
|
||||
'country' => $order['billing_country'],
|
||||
'format_id' => $order['billing_address_format_id']);
|
||||
|
||||
$index = 0;
|
||||
$orders_products_query = tep_db_query("select orders_products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'");
|
||||
while ($orders_products = tep_db_fetch_array($orders_products_query)) {
|
||||
$this->products[$index] = array(
|
||||
'qty' => $orders_products['products_quantity'],
|
||||
'name' => $orders_products['products_name'],
|
||||
'model' => $orders_products['products_model'],
|
||||
'tax' => $orders_products['products_tax'],
|
||||
'price' => $orders_products['products_price'],
|
||||
'final_price' => $orders_products['final_price']);
|
||||
|
||||
$subindex = 0;
|
||||
$attributes_query = tep_db_query("select products_options, products_options_values, options_values_price, price_prefix from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$order_id . "' and orders_products_id = '" . (int)$orders_products['orders_products_id'] . "'");
|
||||
if (tep_db_num_rows($attributes_query)) {
|
||||
while ($attributes = tep_db_fetch_array($attributes_query)) {
|
||||
$this->products[$index]['attributes'][$subindex] = array(
|
||||
'option' => $attributes['products_options'],
|
||||
'value' => $attributes['products_options_values'],
|
||||
'prefix' => $attributes['price_prefix'],
|
||||
'price' => $attributes['options_values_price']);
|
||||
|
||||
$subindex++;
|
||||
}
|
||||
}
|
||||
$index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
237
psp_admin/inc/payment_modules/payment.php
Normal file
237
psp_admin/inc/payment_modules/payment.php
Normal file
@ -0,0 +1,237 @@
|
||||
<?php
|
||||
/*
|
||||
$Id: payment.php,v 1.37 2003/06/09 22:26:32 hpdl Exp $
|
||||
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2003 osCommerce
|
||||
|
||||
Released under the GNU General Public License
|
||||
*/
|
||||
|
||||
class payment {
|
||||
var $modules, $selected_module;
|
||||
|
||||
// class constructor
|
||||
function payment($module = '') {
|
||||
global $payment, $language, $PHP_SELF;
|
||||
$language='dutch';
|
||||
if (defined('MODULE_PAYMENT_INSTALLED') && tep_not_null(MODULE_PAYMENT_INSTALLED))
|
||||
{
|
||||
$this->modules = explode(';', MODULE_PAYMENT_INSTALLED);
|
||||
$PHP_SELF = $_SERVER['PHP_SELF'];
|
||||
// _debug_array($module);
|
||||
// _debug_array($_SERVER['PHP_SELF']);
|
||||
// _debug_array($module . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)));
|
||||
// _debug_array((in_array($module . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)), $this->modules)));
|
||||
// die('test_init');
|
||||
$include_modules = array();
|
||||
if ( (tep_not_null($module)) && (in_array($module . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)), $this->modules)) )
|
||||
{
|
||||
$this->selected_module = $module;
|
||||
$include_modules[] = array('class' => $module, 'file' => $module . '.php');
|
||||
}
|
||||
else
|
||||
{
|
||||
reset($this->modules);
|
||||
while (list(, $value) = each($this->modules))
|
||||
{
|
||||
$class = substr($value, 0, strrpos($value, '.')); // RVD replaced
|
||||
$include_modules[] = array('class' => $class, 'file' => $value); // RVD added .php
|
||||
}
|
||||
}
|
||||
|
||||
for ($i=0, $n=sizeof($include_modules); $i<$n; $i++) {
|
||||
include(DIR_WS_LANGUAGES . $language . '/modules/payment/' . $include_modules[$i]['file']);
|
||||
include(DIR_WS_MODULES . 'payment/' . $include_modules[$i]['file']);
|
||||
|
||||
$GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class'];
|
||||
}
|
||||
|
||||
// if there is only one payment method, select it as default because in
|
||||
// checkout_confirmation.php the $payment variable is being assigned the
|
||||
// $HTTP_POST_VARS['payment'] value which will be empty (no radio button selection possible)
|
||||
//_debug_array($payment);
|
||||
//die();
|
||||
if ((tep_count_payment_modules() == 1) && (!isset($GLOBALS[$payment]) || (isset($GLOBALS[$payment]) && !is_object($GLOBALS[$payment]))) ) {
|
||||
$payment = $include_modules[0]['class'];
|
||||
}
|
||||
//print_r($this->modules);
|
||||
//print_r($module);
|
||||
// if ( (tep_not_null($module)) && (in_array($module, $this->modules)) && (isset($GLOBALS[$module]->form_action_url)) ) {
|
||||
// print_r($GLOBALS[$module]->form_action_url);
|
||||
$this->form_action_url = $GLOBALS[$module]->form_action_url;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
// class methods
|
||||
/* The following method is needed in the checkout_confirmation.php page
|
||||
due to a chicken and egg problem with the payment class and order class.
|
||||
The payment modules needs the order destination data for the dynamic status
|
||||
feature, and the order class needs the payment module title.
|
||||
The following method is a work-around to implementing the method in all
|
||||
payment modules available which would break the modules in the contributions
|
||||
section. This should be looked into again post 2.2.
|
||||
*/
|
||||
function update_status() {
|
||||
if (is_array($this->modules)) {
|
||||
if (is_object($GLOBALS[$this->selected_module])) {
|
||||
if (function_exists('method_exists')) {
|
||||
if (method_exists($GLOBALS[$this->selected_module], 'update_status')) {
|
||||
$GLOBALS[$this->selected_module]->update_status();
|
||||
}
|
||||
} else { // PHP3 compatibility
|
||||
@call_user_method('update_status', $GLOBALS[$this->selected_module]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function javascript_validation() {
|
||||
$js = '';
|
||||
if (is_array($this->modules)) {
|
||||
$js = '<script language="javascript"><!-- ' . "\n" .
|
||||
'function check_form() {' . "\n" .
|
||||
' var error = 0;' . "\n" .
|
||||
' var error_message = "' . JS_ERROR . '";' . "\n" .
|
||||
' var payment_value = null;' . "\n" .
|
||||
' if (document.checkout_payment.payment.length) {' . "\n" .
|
||||
' for (var i=0; i<document.checkout_payment.payment.length; i++) {' . "\n" .
|
||||
' if (document.checkout_payment.payment[i].checked) {' . "\n" .
|
||||
' payment_value = document.checkout_payment.payment[i].value;' . "\n" .
|
||||
' }' . "\n" .
|
||||
' }' . "\n" .
|
||||
' } else if (document.checkout_payment.payment.checked) {' . "\n" .
|
||||
' payment_value = document.checkout_payment.payment.value;' . "\n" .
|
||||
' } else if (document.checkout_payment.payment.value) {' . "\n" .
|
||||
' payment_value = document.checkout_payment.payment.value;' . "\n" .
|
||||
' }' . "\n\n";
|
||||
|
||||
reset($this->modules);
|
||||
while (list(, $value) = each($this->modules)) {
|
||||
$class = substr($value, 0, strrpos($value, '.'));
|
||||
if ($GLOBALS[$class]->enabled) {
|
||||
$js .= $GLOBALS[$class]->javascript_validation();
|
||||
}
|
||||
}
|
||||
|
||||
$js .= "\n" . ' if (payment_value == null) {' . "\n" .
|
||||
' error_message = error_message + "' . JS_ERROR_NO_PAYMENT_MODULE_SELECTED . '";' . "\n" .
|
||||
' error = 1;' . "\n" .
|
||||
' }' . "\n\n" .
|
||||
' if (error == 1) {' . "\n" .
|
||||
' alert(error_message);' . "\n" .
|
||||
' return false;' . "\n" .
|
||||
' } else {' . "\n" .
|
||||
' return true;' . "\n" .
|
||||
' }' . "\n" .
|
||||
'}' . "\n" .
|
||||
'//--></script>' . "\n";
|
||||
}
|
||||
|
||||
return $js;
|
||||
}
|
||||
|
||||
function selection() {
|
||||
$selection_array = array();
|
||||
if (is_array($this->modules)) {
|
||||
reset($this->modules);
|
||||
while (list(, $value) = each($this->modules)) {
|
||||
$class = substr($value, 0, strrpos($value, '.'));
|
||||
if ($GLOBALS[$class]->enabled) {
|
||||
$selection = $GLOBALS[$class]->selection();
|
||||
if (is_array($selection)) $selection_array[] = $selection;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $selection_array;
|
||||
}
|
||||
|
||||
function pre_confirmation_check() {
|
||||
// print_r($GLOBALS[$this->selected_module]);
|
||||
if (is_array($this->modules)) {
|
||||
if (is_object($GLOBALS[$this->selected_module]) && ($GLOBALS[$this->selected_module]->enabled) ) {
|
||||
$GLOBALS[$this->selected_module]->pre_confirmation_check();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function confirmation() {
|
||||
if (is_array($this->modules)) {
|
||||
if (is_object($GLOBALS[$this->selected_module]) && ($GLOBALS[$this->selected_module]->enabled) ) {
|
||||
return $GLOBALS[$this->selected_module]->confirmation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function process_button() {
|
||||
if (is_array($this->modules)) {
|
||||
if (is_object($GLOBALS[$this->selected_module]) && ($GLOBALS[$this->selected_module]->enabled) ) {
|
||||
return $GLOBALS[$this->selected_module]->process_button();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function before_process() {
|
||||
if (is_array($this->modules)) {
|
||||
if (is_object($GLOBALS[$this->selected_module]) && ($GLOBALS[$this->selected_module]->enabled) ) {
|
||||
return $GLOBALS[$this->selected_module]->before_process();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function after_process() {
|
||||
if (is_array($this->modules)) {
|
||||
if (is_object($GLOBALS[$this->selected_module]) && ($GLOBALS[$this->selected_module]->enabled) ) {
|
||||
return $GLOBALS[$this->selected_module]->after_process();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function get_error() {
|
||||
if (is_array($this->modules)) {
|
||||
if (is_object($GLOBALS[$this->selected_module]) && ($GLOBALS[$this->selected_module]->enabled) ) {
|
||||
return $GLOBALS[$this->selected_module]->get_error();
|
||||
}
|
||||
}
|
||||
}
|
||||
function after_submit_order() {
|
||||
if (is_array($this->modules)) {
|
||||
if (is_object($GLOBALS[$this->selected_module]) && ($GLOBALS[$this->selected_module]->enabled) ) {
|
||||
if(method_exists($GLOBALS[$this->selected_module],'after_submit_order'))
|
||||
{
|
||||
return $GLOBALS[$this->selected_module]->after_submit_order();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function has_after_submit_order() {
|
||||
if (is_array($this->modules)) {
|
||||
if (is_object($GLOBALS[$this->selected_module]) && ($GLOBALS[$this->selected_module]->enabled) ) {
|
||||
return(is_callable(array($this->selected_module,'after_submit_order')));
|
||||
}
|
||||
}
|
||||
}
|
||||
function call_aut_function($function,$param = "")
|
||||
{
|
||||
if (is_array($this->modules)) {
|
||||
if (is_object($GLOBALS[$this->selected_module]) && ($GLOBALS[$this->selected_module]->enabled) ) {
|
||||
if(is_callable(array($this->selected_module,$function)))
|
||||
{
|
||||
if($param == "")
|
||||
{
|
||||
return call_user_func(array($GLOBALS[$this->selected_module],$function));
|
||||
}
|
||||
else
|
||||
{
|
||||
return call_user_func(array($GLOBALS[$this->selected_module],$function),$param);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
?>
|
220
psp_admin/inc/payment_modules/payment/cc.php
Normal file
220
psp_admin/inc/payment_modules/payment/cc.php
Normal file
@ -0,0 +1,220 @@
|
||||
<?php
|
||||
/*
|
||||
$Id: cc.php,v 1.53 2003/02/04 09:55:01 project3000 Exp $
|
||||
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2003 osCommerce
|
||||
|
||||
Released under the GNU General Public License
|
||||
*/
|
||||
|
||||
class cc {
|
||||
var $code, $title, $description, $enabled;
|
||||
|
||||
// class constructor
|
||||
function cc() {
|
||||
global $order, $HTTP_POST_VARS;
|
||||
|
||||
$this->code = 'cc';
|
||||
$this->title = MODULE_PAYMENT_CC_TEXT_TITLE;
|
||||
$this->description = MODULE_PAYMENT_CC_TEXT_DESCRIPTION;
|
||||
$this->sort_order = MODULE_PAYMENT_CC_SORT_ORDER;
|
||||
$this->enabled = ((MODULE_PAYMENT_CC_STATUS == 'True') ? true : false);
|
||||
|
||||
if ((int)MODULE_PAYMENT_CC_ORDER_STATUS_ID > 0) {
|
||||
$this->order_status = MODULE_PAYMENT_CC_ORDER_STATUS_ID;
|
||||
}
|
||||
|
||||
if (is_object($order)) $this->update_status();
|
||||
}
|
||||
|
||||
// class methods
|
||||
function update_status() {
|
||||
// global $order;
|
||||
global $order, $HTTP_POST_VARS;
|
||||
// print_r($HTTP_POST_VARS);
|
||||
|
||||
if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_CC_ZONE > 0) ) {
|
||||
$check_flag = false;
|
||||
$check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_CC_ZONE . "' and zone_country_id = '223' order by zone_id");
|
||||
// FIXME ORDER ARRAY
|
||||
// $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_CC_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");
|
||||
//print_r($check_query);
|
||||
while ($check = tep_db_fetch_array($check_query)) {
|
||||
//print_r($check);
|
||||
//print_r($order->billing['zone_id']);
|
||||
|
||||
if ($check['zone_id'] < 1) {
|
||||
$check_flag = true;
|
||||
//print_r('true');
|
||||
break;
|
||||
} elseif ($check['zone_id'] == $order->billing['zone_id']) {
|
||||
//print_r('true');
|
||||
|
||||
$check_flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($check_flag == false) {
|
||||
$this->enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function javascript_validation() {
|
||||
$js = ' if (payment_value == "' . $this->code . '") {' . "\n" .
|
||||
' var cc_owner = document.checkout_payment.cc_owner.value;' . "\n" .
|
||||
' var cc_number = document.checkout_payment.cc_number.value;' . "\n" .
|
||||
' if (cc_owner == "" || cc_owner.length < ' . CC_OWNER_MIN_LENGTH . ') {' . "\n" .
|
||||
' error_message = error_message + "' . MODULE_PAYMENT_CC_TEXT_JS_CC_OWNER . '";' . "\n" .
|
||||
' error = 1;' . "\n" .
|
||||
' }' . "\n" .
|
||||
' if (cc_number == "" || cc_number.length < ' . CC_NUMBER_MIN_LENGTH . ') {' . "\n" .
|
||||
' error_message = error_message + "' . MODULE_PAYMENT_CC_TEXT_JS_CC_NUMBER . '";' . "\n" .
|
||||
' error = 1;' . "\n" .
|
||||
' }' . "\n" .
|
||||
' }' . "\n";
|
||||
|
||||
return $js;
|
||||
}
|
||||
|
||||
function selection() {
|
||||
global $order;
|
||||
|
||||
for ($i=1; $i<13; $i++) {
|
||||
$expires_month[] = array('id' => sprintf('%02d', $i), 'text' => strftime('%B',mktime(0,0,0,$i,1,2000)));
|
||||
}
|
||||
|
||||
$today = getdate();
|
||||
for ($i=$today['year']; $i < $today['year']+10; $i++) {
|
||||
$expires_year[] = array('id' => strftime('%y',mktime(0,0,0,1,1,$i)), 'text' => strftime('%Y',mktime(0,0,0,1,1,$i)));
|
||||
}
|
||||
|
||||
$selection = array('id' => $this->code,
|
||||
'module' => $this->title,
|
||||
'fields' => array(array('title' => MODULE_PAYMENT_CC_TEXT_CREDIT_CARD_OWNER,
|
||||
'field' => tep_draw_input_field('cc_owner', $order->billing['firstname'] . ' ' . $order->billing['lastname'])),
|
||||
array('title' => MODULE_PAYMENT_CC_TEXT_CREDIT_CARD_NUMBER,
|
||||
'field' => tep_draw_input_field('cc_number')),
|
||||
array('title' => MODULE_PAYMENT_CC_TEXT_CREDIT_CARD_EXPIRES,
|
||||
'field' => tep_draw_pull_down_menu('cc_expires_month', $expires_month) . ' ' . tep_draw_pull_down_menu('cc_expires_year', $expires_year))));
|
||||
|
||||
return $selection;
|
||||
}
|
||||
|
||||
function pre_confirmation_check() {
|
||||
global $HTTP_POST_VARS;
|
||||
|
||||
include(DIR_WS_CLASSES . 'cc_validation.php');
|
||||
|
||||
$cc_validation = new cc_validation();
|
||||
$result = $cc_validation->validate($HTTP_POST_VARS['cc_number'], $HTTP_POST_VARS['cc_expires_month'], $HTTP_POST_VARS['cc_expires_year']);
|
||||
|
||||
$error = '';
|
||||
switch ($result) {
|
||||
case -1:
|
||||
$error = sprintf(TEXT_CCVAL_ERROR_UNKNOWN_CARD, substr($cc_validation->cc_number, 0, 4));
|
||||
break;
|
||||
case -2:
|
||||
case -3:
|
||||
case -4:
|
||||
$error = TEXT_CCVAL_ERROR_INVALID_DATE;
|
||||
break;
|
||||
case false:
|
||||
$error = TEXT_CCVAL_ERROR_INVALID_NUMBER;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( ($result == false) || ($result < 1) ) {
|
||||
$payment_error_return = 'payment_error=' . $this->code . '&error=' . urlencode($error) . '&cc_owner=' . urlencode($HTTP_POST_VARS['cc_owner']) . '&cc_expires_month=' . $HTTP_POST_VARS['cc_expires_month'] . '&cc_expires_year=' . $HTTP_POST_VARS['cc_expires_year'];
|
||||
|
||||
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false));
|
||||
}
|
||||
|
||||
$this->cc_card_type = $cc_validation->cc_type;
|
||||
$this->cc_card_number = $cc_validation->cc_number;
|
||||
}
|
||||
|
||||
function confirmation() {
|
||||
global $HTTP_POST_VARS;
|
||||
|
||||
$confirmation = array('title' => $this->title . ': ' . $this->cc_card_type,
|
||||
'fields' => array(array('title' => MODULE_PAYMENT_CC_TEXT_CREDIT_CARD_OWNER,
|
||||
'field' => $HTTP_POST_VARS['cc_owner']),
|
||||
array('title' => MODULE_PAYMENT_CC_TEXT_CREDIT_CARD_NUMBER,
|
||||
'field' => substr($this->cc_card_number, 0, 4) . str_repeat('X', (strlen($this->cc_card_number) - 8)) . substr($this->cc_card_number, -4)),
|
||||
array('title' => MODULE_PAYMENT_CC_TEXT_CREDIT_CARD_EXPIRES,
|
||||
'field' => strftime('%B, %Y', mktime(0,0,0,$HTTP_POST_VARS['cc_expires_month'], 1, '20' . $HTTP_POST_VARS['cc_expires_year'])))));
|
||||
|
||||
return $confirmation;
|
||||
}
|
||||
|
||||
function process_button() {
|
||||
global $HTTP_POST_VARS;
|
||||
|
||||
$process_button_string = tep_draw_hidden_field('cc_owner', $HTTP_POST_VARS['cc_owner']) .
|
||||
tep_draw_hidden_field('cc_expires', $HTTP_POST_VARS['cc_expires_month'] . $HTTP_POST_VARS['cc_expires_year']) .
|
||||
tep_draw_hidden_field('cc_type', $this->cc_card_type) .
|
||||
tep_draw_hidden_field('cc_number', $this->cc_card_number);
|
||||
|
||||
return $process_button_string;
|
||||
}
|
||||
|
||||
function before_process() {
|
||||
global $HTTP_POST_VARS, $order;
|
||||
|
||||
if ( (defined('MODULE_PAYMENT_CC_EMAIL')) && (tep_validate_email(MODULE_PAYMENT_CC_EMAIL)) ) {
|
||||
$len = strlen($HTTP_POST_VARS['cc_number']);
|
||||
|
||||
$this->cc_middle = substr($HTTP_POST_VARS['cc_number'], 4, ($len-8));
|
||||
$order->info['cc_number'] = substr($HTTP_POST_VARS['cc_number'], 0, 4) . str_repeat('X', (strlen($HTTP_POST_VARS['cc_number']) - 8)) . substr($HTTP_POST_VARS['cc_number'], -4);
|
||||
}
|
||||
}
|
||||
|
||||
function after_process() {
|
||||
global $insert_id;
|
||||
|
||||
if ( (defined('MODULE_PAYMENT_CC_EMAIL')) && (tep_validate_email(MODULE_PAYMENT_CC_EMAIL)) ) {
|
||||
$message = 'Order #' . $insert_id . "\n\n" . 'Middle: ' . $this->cc_middle . "\n\n";
|
||||
|
||||
tep_mail('', MODULE_PAYMENT_CC_EMAIL, 'Extra Order Info: #' . $insert_id, $message, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
|
||||
}
|
||||
}
|
||||
|
||||
function get_error() {
|
||||
global $HTTP_GET_VARS;
|
||||
|
||||
$error = array('title' => MODULE_PAYMENT_CC_TEXT_ERROR,
|
||||
'error' => stripslashes(urldecode($HTTP_GET_VARS['error'])));
|
||||
|
||||
return $error;
|
||||
}
|
||||
|
||||
function check() {
|
||||
if (!isset($this->_check)) {
|
||||
$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_CC_STATUS'");
|
||||
$this->_check = tep_db_num_rows($check_query);
|
||||
}
|
||||
return $this->_check;
|
||||
}
|
||||
|
||||
function install() {
|
||||
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Credit Card Module', 'MODULE_PAYMENT_CC_STATUS', 'True', 'Do you want to accept credit card payments?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
|
||||
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Split Credit Card E-Mail Address', 'MODULE_PAYMENT_CC_EMAIL', '', 'If an e-mail address is entered, the middle digits of the credit card number will be sent to the e-mail address (the outside digits are stored in the database with the middle digits censored)', '6', '0', now())");
|
||||
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_CC_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0' , now())");
|
||||
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_CC_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");
|
||||
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_CC_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())");
|
||||
}
|
||||
|
||||
function remove() {
|
||||
tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
|
||||
}
|
||||
|
||||
function keys() {
|
||||
return array('MODULE_PAYMENT_CC_STATUS', 'MODULE_PAYMENT_CC_EMAIL', 'MODULE_PAYMENT_CC_ZONE', 'MODULE_PAYMENT_CC_ORDER_STATUS_ID', 'MODULE_PAYMENT_CC_SORT_ORDER');
|
||||
}
|
||||
}
|
||||
?>
|
119
psp_admin/inc/payment_modules/payment/cod.php
Normal file
119
psp_admin/inc/payment_modules/payment/cod.php
Normal file
@ -0,0 +1,119 @@
|
||||
<?php
|
||||
/*
|
||||
$Id: cod.php,v 1.28 2003/02/14 05:51:31 hpdl Exp $
|
||||
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2003 osCommerce
|
||||
|
||||
Released under the GNU General Public License
|
||||
*/
|
||||
|
||||
class cod {
|
||||
var $code, $title, $description, $enabled;
|
||||
|
||||
// class constructor
|
||||
function cod() {
|
||||
global $order;
|
||||
|
||||
$this->code = 'cod';
|
||||
$this->title = MODULE_PAYMENT_COD_TEXT_TITLE;
|
||||
$this->description = MODULE_PAYMENT_COD_TEXT_DESCRIPTION;
|
||||
$this->sort_order = MODULE_PAYMENT_COD_SORT_ORDER;
|
||||
$this->enabled = ((MODULE_PAYMENT_COD_STATUS == 'True') ? true : false);
|
||||
|
||||
if ((int)MODULE_PAYMENT_COD_ORDER_STATUS_ID > 0) {
|
||||
$this->order_status = MODULE_PAYMENT_COD_ORDER_STATUS_ID;
|
||||
}
|
||||
|
||||
if (is_object($order)) $this->update_status();
|
||||
}
|
||||
|
||||
// class methods
|
||||
function update_status() {
|
||||
global $order;
|
||||
|
||||
if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_COD_ZONE > 0) ) {
|
||||
$check_flag = false;
|
||||
$check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_COD_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
|
||||
while ($check = tep_db_fetch_array($check_query)) {
|
||||
if ($check['zone_id'] < 1) {
|
||||
$check_flag = true;
|
||||
break;
|
||||
} elseif ($check['zone_id'] == $order->delivery['zone_id']) {
|
||||
$check_flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($check_flag == false) {
|
||||
$this->enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
// disable the module if the order only contains virtual products
|
||||
if ($this->enabled == true) {
|
||||
if ($order->content_type == 'virtual') {
|
||||
$this->enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function javascript_validation() {
|
||||
return false;
|
||||
}
|
||||
|
||||
function selection() {
|
||||
return array('id' => $this->code,
|
||||
'module' => $this->title);
|
||||
}
|
||||
|
||||
function pre_confirmation_check() {
|
||||
return false;
|
||||
}
|
||||
|
||||
function confirmation() {
|
||||
return false;
|
||||
}
|
||||
|
||||
function process_button() {
|
||||
return false;
|
||||
}
|
||||
|
||||
function before_process() {
|
||||
return false;
|
||||
}
|
||||
|
||||
function after_process() {
|
||||
return false;
|
||||
}
|
||||
|
||||
function get_error() {
|
||||
return false;
|
||||
}
|
||||
|
||||
function check() {
|
||||
if (!isset($this->_check)) {
|
||||
$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_COD_STATUS'");
|
||||
$this->_check = tep_db_num_rows($check_query);
|
||||
}
|
||||
return $this->_check;
|
||||
}
|
||||
|
||||
function install() {
|
||||
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Cash On Delivery Module', 'MODULE_PAYMENT_COD_STATUS', 'True', 'Do you want to accept Cash On Delevery payments?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
|
||||
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_COD_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");
|
||||
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_COD_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
|
||||
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_COD_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())");
|
||||
}
|
||||
|
||||
function remove() {
|
||||
tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
|
||||
}
|
||||
|
||||
function keys() {
|
||||
return array('MODULE_PAYMENT_COD_STATUS', 'MODULE_PAYMENT_COD_ZONE', 'MODULE_PAYMENT_COD_ORDER_STATUS_ID', 'MODULE_PAYMENT_COD_SORT_ORDER');
|
||||
}
|
||||
}
|
||||
?>
|
148
psp_admin/inc/payment_modules/payment/ogone.php
Normal file
148
psp_admin/inc/payment_modules/payment/ogone.php
Normal file
@ -0,0 +1,148 @@
|
||||
<?php
|
||||
/**
|
||||
* Ogone Payment Module
|
||||
*
|
||||
* osCommerce, Open Source E-Commerce Solutions
|
||||
* http://www.oscommerce.com
|
||||
*
|
||||
* Copyright (c) 2002 osCommerce
|
||||
*
|
||||
* Released under the GNU General Public License
|
||||
*
|
||||
* $Id: ogone.php 3099 2007-03-19 22:49:34Z dlorch $
|
||||
*/
|
||||
|
||||
class ogone {
|
||||
var $code, $title, $description, $enabled;
|
||||
|
||||
function ogone() {
|
||||
$this->code = 'ogone';
|
||||
$this->title = MODULE_PAYMENT_OGONE_TEXT_TITLE;
|
||||
$this->description = MODULE_PAYMENT_OGONE_TEXT_DESCRIPTION;
|
||||
$this->enabled = MODULE_PAYMENT_OGONE_STATUS;
|
||||
$this->form_action_url = 'https://secure.ogone.com/ncol/' . MODULE_PAYMENT_OGONE_MODE . '/orderstandard.asp';
|
||||
}
|
||||
|
||||
function javascript_validation() {
|
||||
return true;
|
||||
}
|
||||
|
||||
function selection() {
|
||||
return array('id' => $this->code, 'module' => $this->title);
|
||||
}
|
||||
|
||||
function pre_confirmation_check() {
|
||||
return false;
|
||||
}
|
||||
|
||||
function confirmation() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* For a detailled spec on these fields for ogone see https://secure.ogone.com/ncol/test/admin_ogone.asp */
|
||||
function process_button() {
|
||||
global $customer_id, $order, $currencies;
|
||||
|
||||
$ogone_orderID = $customer_id . date('YmdHis');
|
||||
$ogone_amount = number_format($order->info['total'] * 100 * $order->info['currency_value'], 0, '', '');
|
||||
|
||||
$process_button_string = "\n" .
|
||||
tep_draw_hidden_field('orderID', $ogone_orderID) . "\n" .
|
||||
tep_draw_hidden_field('pspid', MODULE_PAYMENT_OGONE_PSPID) . "\n" .
|
||||
tep_draw_hidden_field('RL', 'ncol-2.0') . "\n" .
|
||||
tep_draw_hidden_field('currency', $order->info['currency']) . "\n" .
|
||||
tep_draw_hidden_field('language', MODULE_PAYMENT_OGONE_LANGUAGE) . "\n" .
|
||||
tep_draw_hidden_field('amount', $ogone_amount) . "\n" .
|
||||
tep_draw_hidden_field('TITLE', STORE_NAME . ': ' . MODULE_PAYMENT_OGONE_TITLE_OGONE) . "\n" .
|
||||
tep_draw_hidden_field('accepturl', tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL')) . "\n" .
|
||||
tep_draw_hidden_field('declineurl', tep_href_link(FILENAME_SHOPPING_CART)) . "\n" .
|
||||
tep_draw_hidden_field('exceptionurl', tep_href_link(FILENAME_SHOPPING_CART)) . "\n" .
|
||||
tep_draw_hidden_field('cancelurl', tep_href_link(FILENAME_SHOPPING_CART)) . "\n" .
|
||||
tep_draw_hidden_field('CN', $order->customer['firstname'] . ' ' . $order->customer['lastname']) . "\n" .
|
||||
tep_draw_hidden_field('catalogurl', tep_href_link(FILENAME_DEFAULT)) . "\n" .
|
||||
tep_draw_hidden_field('owneraddress', $order->delivery['street_address']) . "\n" .
|
||||
tep_draw_hidden_field('ownerZIP', $order->delivery['postcode']) . "\n" .
|
||||
tep_draw_hidden_field('COM', MODULE_PAYMENT_OGONE_TITLE_OGONE) . "\n" .
|
||||
tep_draw_hidden_field('email', $order->customer['email_address']) . "\n";
|
||||
|
||||
$sign = $ogone_orderID . $ogone_amount . $order->info['currency'] . MODULE_PAYMENT_OGONE_PSPID . MODULE_PAYMENT_OGONE_SHA_STRING;
|
||||
$process_button_string .= tep_draw_hidden_field('SHASign', sha1($sign)) . "\n";
|
||||
|
||||
if(MODULE_PAYMENT_OGONE_DYNAMIC_TEMPLATE == 'Yes') {
|
||||
$process_button_string .= tep_draw_hidden_field('TP', MODULE_PAYMENT_OGONE_DYNAMIC_TEMPLATE_URL) . "\n";
|
||||
}
|
||||
|
||||
return $process_button_string;
|
||||
}
|
||||
|
||||
function before_process() {
|
||||
return false;
|
||||
}
|
||||
|
||||
function after_process() {
|
||||
return false;
|
||||
}
|
||||
|
||||
function output_error() {
|
||||
return false;
|
||||
}
|
||||
|
||||
function check() {
|
||||
if (!isset($this->check)) {
|
||||
$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_OGONE_STATUS'");
|
||||
$this->check = tep_db_num_rows($check_query);
|
||||
}
|
||||
return $this->check;
|
||||
}
|
||||
|
||||
function install() {
|
||||
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Allow OGONE Payments', 'MODULE_PAYMENT_OGONE_STATUS', 'True', 'Do you want to accept OGONE payments?', '6', '20', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
|
||||
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('OGONE Status Mode', 'MODULE_PAYMENT_OGONE_MODE', 'test', 'Status mode for OGONE payments?', '6', '21', 'tep_cfg_select_option(array(\'test\', \'prod\'), ', now())");
|
||||
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('OGONE Merchant ID', 'MODULE_PAYMENT_OGONE_PSPID', 'TESTSTD', 'Merchant NCOL ID', '6', '22', now())");
|
||||
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('OGONE Client Language', 'MODULE_PAYMENT_OGONE_LANGUAGE', 'en_US', 'Client language', '6', '23', 'tep_cfg_pull_down_ogone_language(', now())");
|
||||
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('OGONE SHA String', 'MODULE_PAYMENT_OGONE_SHA_STRING', '', 'SHA string used for the signature (set at the merchant administration page)', '6', '24', now())");
|
||||
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('OGONE Dynamic Template', 'MODULE_PAYMENT_OGONE_DYNAMIC_TEMPLATE', 'No', 'Use dynamic template for payment form?', '6', '25', 'tep_cfg_select_option(array(\'Yes\', \'No\'), ',now())");
|
||||
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('OGONE Dynamic Template URL', 'MODULE_PAYMENT_OGONE_DYNAMIC_TEMPLATE_URL', ' http://www.ogone.com/ncol/template_standard.htm', 'Change the appearance of the payment form', '6', '25', now())");
|
||||
}
|
||||
|
||||
function remove() {
|
||||
tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . join($this->keys(), "','") . "')");
|
||||
}
|
||||
|
||||
function keys() {
|
||||
return array(
|
||||
'MODULE_PAYMENT_OGONE_STATUS',
|
||||
'MODULE_PAYMENT_OGONE_MODE',
|
||||
'MODULE_PAYMENT_OGONE_PSPID',
|
||||
'MODULE_PAYMENT_OGONE_LANGUAGE',
|
||||
'MODULE_PAYMENT_OGONE_SHA_STRING',
|
||||
'MODULE_PAYMENT_OGONE_DYNAMIC_TEMPLATE',
|
||||
'MODULE_PAYMENT_OGONE_DYNAMIC_TEMPLATE_URL'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function tep_cfg_pull_down_ogone_language($language_id, $configuration_key = NULL) {
|
||||
$name = isset($configuration_key) ? 'configuration[' . $configuration_key . ']' : 'configuration_value';
|
||||
|
||||
/* languages supported by Ogone */
|
||||
$languages = array(
|
||||
'en_US' => 'English',
|
||||
'fr_FR' => 'French',
|
||||
'nl_NL' => 'Dutch',
|
||||
'it_IT' => 'Italian',
|
||||
'de_DE' => 'German',
|
||||
'es_ES' => 'Spanish',
|
||||
'no_NO' => 'Norvegian'
|
||||
);
|
||||
|
||||
$languages_array = array();
|
||||
|
||||
foreach($languages as $id => $text) {
|
||||
$languages_array[] = array('id' => $id, 'text' => $text);
|
||||
}
|
||||
|
||||
return tep_draw_pull_down_menu($name, $languages_array, $language_id);
|
||||
}
|
||||
|
||||
?>
|
141
psp_admin/inc/payment_modules/payment/paypal.php
Normal file
141
psp_admin/inc/payment_modules/payment/paypal.php
Normal file
@ -0,0 +1,141 @@
|
||||
<?php
|
||||
/*
|
||||
$Id: paypal.php,v 1.39 2003/01/29 19:57:15 hpdl Exp $
|
||||
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2003 osCommerce
|
||||
|
||||
Released under the GNU General Public License
|
||||
*/
|
||||
|
||||
class paypal {
|
||||
var $code, $title, $description, $enabled;
|
||||
|
||||
// class constructor
|
||||
function paypal() {
|
||||
global $order;
|
||||
|
||||
$this->code = 'paypal';
|
||||
$this->title = MODULE_PAYMENT_PAYPAL_TEXT_TITLE;
|
||||
$this->description = MODULE_PAYMENT_PAYPAL_TEXT_DESCRIPTION;
|
||||
$this->sort_order = MODULE_PAYMENT_PAYPAL_SORT_ORDER;
|
||||
$this->enabled = ((MODULE_PAYMENT_PAYPAL_STATUS == 'True') ? true : false);
|
||||
|
||||
if ((int)MODULE_PAYMENT_PAYPAL_ORDER_STATUS_ID > 0) {
|
||||
$this->order_status = MODULE_PAYMENT_PAYPAL_ORDER_STATUS_ID;
|
||||
}
|
||||
|
||||
if (is_object($order)) $this->update_status();
|
||||
|
||||
$this->form_action_url = 'https://secure.paypal.com/cgi-bin/webscr';
|
||||
}
|
||||
|
||||
// class methods
|
||||
function update_status() {
|
||||
global $order;
|
||||
|
||||
if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_PAYPAL_ZONE > 0) ) {
|
||||
$check_flag = false;
|
||||
$check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_PAYPAL_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");
|
||||
while ($check = tep_db_fetch_array($check_query)) {
|
||||
if ($check['zone_id'] < 1) {
|
||||
$check_flag = true;
|
||||
break;
|
||||
} elseif ($check['zone_id'] == $order->billing['zone_id']) {
|
||||
$check_flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($check_flag == false) {
|
||||
$this->enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function javascript_validation() {
|
||||
return false;
|
||||
}
|
||||
|
||||
function selection() {
|
||||
return array('id' => $this->code,
|
||||
'module' => $this->title);
|
||||
}
|
||||
|
||||
function pre_confirmation_check() {
|
||||
return false;
|
||||
}
|
||||
|
||||
function confirmation() {
|
||||
return false;
|
||||
}
|
||||
|
||||
function process_button() {
|
||||
global $order, $currencies, $currency;
|
||||
|
||||
if (MODULE_PAYMENT_PAYPAL_CURRENCY == 'Selected Currency')
|
||||
{
|
||||
$my_currency = $currency;
|
||||
}
|
||||
else
|
||||
{
|
||||
$my_currency = substr(MODULE_PAYMENT_PAYPAL_CURRENCY, 5);
|
||||
}
|
||||
if (!in_array($my_currency, array('CAD', 'EUR', 'GBP', 'JPY', 'USD')))
|
||||
{
|
||||
$my_currency = 'USD';
|
||||
}
|
||||
$process_button_string = tep_draw_hidden_field('cmd', '_xclick') .
|
||||
tep_draw_hidden_field('business', MODULE_PAYMENT_PAYPAL_ID) .
|
||||
tep_draw_hidden_field('item_name', STORE_NAME) .
|
||||
tep_draw_hidden_field('amount', number_format(($order->info['total'] - $order->info['shipping_cost']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) .
|
||||
tep_draw_hidden_field('shipping', number_format($order->info['shipping_cost'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) .
|
||||
tep_draw_hidden_field('currency_code', $my_currency) .
|
||||
tep_draw_hidden_field('return', tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL')) .
|
||||
tep_draw_hidden_field('cancel_return', tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
|
||||
|
||||
//print_r($process_button_string);
|
||||
return $process_button_string;
|
||||
|
||||
}
|
||||
|
||||
function before_process() {
|
||||
return false;
|
||||
}
|
||||
|
||||
function after_process() {
|
||||
return false;
|
||||
}
|
||||
|
||||
function output_error() {
|
||||
return false;
|
||||
}
|
||||
|
||||
function check() {
|
||||
if (!isset($this->_check)) {
|
||||
$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_PAYPAL_STATUS'");
|
||||
$this->_check = tep_db_num_rows($check_query);
|
||||
}
|
||||
return $this->_check;
|
||||
}
|
||||
|
||||
function install() {
|
||||
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable PayPal Module', 'MODULE_PAYMENT_PAYPAL_STATUS', 'True', 'Do you want to accept PayPal payments?', '6', '3', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
|
||||
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('E-Mail Address', 'MODULE_PAYMENT_PAYPAL_ID', 'you@yourbusiness.com', 'The e-mail address to use for the PayPal service', '6', '4', now())");
|
||||
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Transaction Currency', 'MODULE_PAYMENT_PAYPAL_CURRENCY', 'Selected Currency', 'The currency to use for credit card transactions', '6', '6', 'tep_cfg_select_option(array(\'Selected Currency\',\'Only USD\',\'Only CAD\',\'Only EUR\',\'Only GBP\',\'Only JPY\'), ', now())");
|
||||
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_PAYPAL_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
|
||||
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_PAYPAL_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");
|
||||
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_PAYPAL_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())");
|
||||
}
|
||||
|
||||
function remove() {
|
||||
tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
|
||||
}
|
||||
|
||||
function keys() {
|
||||
return array('MODULE_PAYMENT_PAYPAL_STATUS', 'MODULE_PAYMENT_PAYPAL_ID', 'MODULE_PAYMENT_PAYPAL_CURRENCY', 'MODULE_PAYMENT_PAYPAL_ZONE', 'MODULE_PAYMENT_PAYPAL_ORDER_STATUS_ID', 'MODULE_PAYMENT_PAYPAL_SORT_ORDER');
|
||||
}
|
||||
}
|
||||
?>
|
93
psp_admin/inc/payment_modules/shipping.php
Normal file
93
psp_admin/inc/payment_modules/shipping.php
Normal file
@ -0,0 +1,93 @@
|
||||
<?php
|
||||
/*
|
||||
$Id: shipping.php,v 1.22 2003/06/05 23:26:23 hpdl Exp $
|
||||
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2003 osCommerce
|
||||
|
||||
Released under the GNU General Public License
|
||||
*/
|
||||
|
||||
require('includes/application_top.php');
|
||||
|
||||
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_SHIPPING);
|
||||
|
||||
$breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_SHIPPING));
|
||||
?>
|
||||
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html <?php echo HTML_PARAMS; ?>>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
|
||||
<title><?php echo TITLE; ?></title>
|
||||
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
|
||||
<link rel="stylesheet" type="text/css" href="stylesheet.css">
|
||||
</head>
|
||||
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
|
||||
<!-- header //-->
|
||||
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
|
||||
<!-- header_eof //-->
|
||||
|
||||
<!-- body //-->
|
||||
<table border="0" width="100%" cellspacing="3" cellpadding="3">
|
||||
<tr>
|
||||
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
|
||||
<!-- left_navigation //-->
|
||||
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
|
||||
<!-- left_navigation_eof //-->
|
||||
</table></td>
|
||||
<!-- body_text //-->
|
||||
<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
|
||||
<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_specials.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
|
||||
<tr>
|
||||
<td class="main"><?php echo TEXT_INFORMATION; ?></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
|
||||
<tr class="infoBoxContents">
|
||||
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
|
||||
<tr>
|
||||
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
<td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
|
||||
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
<!-- body_text_eof //-->
|
||||
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
|
||||
<!-- right_navigation //-->
|
||||
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
|
||||
<!-- right_navigation_eof //-->
|
||||
</table></td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- body_eof //-->
|
||||
|
||||
<!-- footer //-->
|
||||
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
|
||||
<!-- footer_eof //-->
|
||||
<br>
|
||||
</body>
|
||||
</html>
|
||||
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
|
122
psp_admin/inc/payment_modules/validations.php
Executable file
122
psp_admin/inc/payment_modules/validations.php
Executable file
@ -0,0 +1,122 @@
|
||||
<?php
|
||||
/*
|
||||
$Id: validations.php,v 1.11 2003/02/11 01:31:02 hpdl Exp $
|
||||
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2003 osCommerce
|
||||
|
||||
Released under the GNU General Public License
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Function : tep_validate_email
|
||||
//
|
||||
// Arguments : email email address to be checked
|
||||
//
|
||||
// Return : true - valid email address
|
||||
// false - invalid email address
|
||||
//
|
||||
// Description : function for validating email address that conforms to RFC 822 specs
|
||||
//
|
||||
// This function is converted from a JavaScript written by
|
||||
// Sandeep V. Tamhankar (stamhankar@hotmail.com). The original JavaScript
|
||||
// is available at http://javascript.internet.com
|
||||
//
|
||||
// Sample Valid Addresses:
|
||||
//
|
||||
// first.last@host.com
|
||||
// firstlast@host.to
|
||||
// "first last"@host.com
|
||||
// "first@last"@host.com
|
||||
// first-last@host.com
|
||||
// first.last@[123.123.123.123]
|
||||
//
|
||||
// Invalid Addresses:
|
||||
//
|
||||
// first last@host.com
|
||||
//
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
function tep_validate_email($email) {
|
||||
$valid_address = true;
|
||||
|
||||
$mail_pat = '^(.+)@(.+)$';
|
||||
$valid_chars = "[^] \(\)<>@,;:\.\\\"\[]";
|
||||
$atom = "$valid_chars+";
|
||||
$quoted_user='(\"[^\"]*\")';
|
||||
$word = "($atom|$quoted_user)";
|
||||
$user_pat = "^$word(\.$word)*$";
|
||||
$ip_domain_pat='^\[([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\]$';
|
||||
$domain_pat = "^$atom(\.$atom)*$";
|
||||
|
||||
if (eregi($mail_pat, $email, $components)) {
|
||||
$user = $components[1];
|
||||
$domain = $components[2];
|
||||
// validate user
|
||||
if (eregi($user_pat, $user)) {
|
||||
// validate domain
|
||||
if (eregi($ip_domain_pat, $domain, $ip_components)) {
|
||||
// this is an IP address
|
||||
for ($i=1;$i<=4;$i++) {
|
||||
if ($ip_components[$i] > 255) {
|
||||
$valid_address = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Domain is a name, not an IP
|
||||
if (eregi($domain_pat, $domain)) {
|
||||
/* domain name seems valid, but now make sure that it ends in a valid TLD or ccTLD
|
||||
and that there's a hostname preceding the domain or country. */
|
||||
$domain_components = explode(".", $domain);
|
||||
// Make sure there's a host name preceding the domain.
|
||||
if (sizeof($domain_components) < 2) {
|
||||
$valid_address = false;
|
||||
} else {
|
||||
$top_level_domain = strtolower($domain_components[sizeof($domain_components)-1]);
|
||||
// Allow all 2-letter TLDs (ccTLDs)
|
||||
if (eregi('^[a-z][a-z]$', $top_level_domain) != 1) {
|
||||
$tld_pattern = '';
|
||||
// Get authorized TLDs from text file
|
||||
$tlds = file(DIR_WS_INCLUDES . 'tld.txt');
|
||||
while (list(,$line) = each($tlds)) {
|
||||
// Get rid of comments
|
||||
$words = explode('#', $line);
|
||||
$tld = trim($words[0]);
|
||||
// TLDs should be 3 letters or more
|
||||
if (eregi('^[a-z]{3,}$', $tld) == 1) {
|
||||
$tld_pattern .= '^' . $tld . '$|';
|
||||
}
|
||||
}
|
||||
// Remove last '|'
|
||||
$tld_pattern = substr($tld_pattern, 0, -1);
|
||||
if (eregi("$tld_pattern", $top_level_domain) == 0) {
|
||||
$valid_address = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$valid_address = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$valid_address = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$valid_address = false;
|
||||
}
|
||||
if ($valid_address && ENTRY_EMAIL_ADDRESS_CHECK == 'true') {
|
||||
if (!checkdnsrr($domain, "MX") && !checkdnsrr($domain, "A")) {
|
||||
$valid_address = false;
|
||||
}
|
||||
}
|
||||
return $valid_address;
|
||||
}
|
||||
?>
|
130
psp_admin/inc/wrap_osc_payment.php
Normal file
130
psp_admin/inc/wrap_osc_payment.php
Normal file
@ -0,0 +1,130 @@
|
||||
<?php
|
||||
|
||||
require_once(EGW_INCLUDE_ROOT.'/psp_admin/inc/payment_modules/database.php');
|
||||
require_once(EGW_INCLUDE_ROOT.'/psp_admin/inc/payment_modules/general.php');
|
||||
require_once(EGW_INCLUDE_ROOT.'/psp_admin/inc/payment_modules/html_output.php');
|
||||
require_once(EGW_INCLUDE_ROOT.'/psp_admin/inc/payment_modules/payment.php');
|
||||
require_once(EGW_INCLUDE_ROOT.'/psp_admin/inc/payment_modules/currencies.php');
|
||||
require_once(EGW_INCLUDE_ROOT.'/psp_admin/inc/payment_modules/order.php');
|
||||
require_once(EGW_INCLUDE_ROOT.'/psp_admin/inc/payment_modules/validations.php');
|
||||
// require_once(EGW_INCLUDE_ROOT.'/psp_admin/inc/languages/english.php');
|
||||
|
||||
class wrap_osc_payment extends payment
|
||||
{
|
||||
var $conn;
|
||||
var $currency;
|
||||
var $currencies;
|
||||
var $sav2wrapper;
|
||||
var $base_url;
|
||||
var $trans;
|
||||
|
||||
var $db;
|
||||
var $wrap;
|
||||
|
||||
function wrap_osc_payment($plug='',$no_order=false)
|
||||
{
|
||||
/*
|
||||
if($plug!='')
|
||||
{
|
||||
require_once(EGW_INCLUDE_ROOT."/psp_admin/inc/payment_modules/payment/$plug.php");
|
||||
eval("\$this->wrap = new $plug();");
|
||||
}
|
||||
*/
|
||||
global $conn;
|
||||
global $currencies;
|
||||
global $currency;
|
||||
global $order;
|
||||
global $HTTP_POST_VARS;
|
||||
global $sav2wrapper;
|
||||
global $base_url;
|
||||
global $trans;
|
||||
$this->trans =& $trans;
|
||||
$this->base_url = $base_url;
|
||||
$this->conn = $conn;
|
||||
tep_db_connect() or die("hmmm... tep_db_connect error in wrap_osc_payment");
|
||||
$this->read_settings();
|
||||
$currencies = new currencies();
|
||||
$currency = $currencies->get_title('EUR');
|
||||
if($plug !='' and $no_order==false)
|
||||
{
|
||||
$order = new order(1);
|
||||
}
|
||||
$this->sav2wrapper = & $sav2wrapper;
|
||||
//$this->tplsav2 = & $sav2wrapper;
|
||||
parent::payment($plug);
|
||||
//$this->wrap = & $this->();
|
||||
}
|
||||
|
||||
|
||||
function remove()
|
||||
{
|
||||
$this->wrap->remove();
|
||||
return "removed";
|
||||
}
|
||||
|
||||
function install()
|
||||
{
|
||||
$this->wrap->install();
|
||||
return "installed";
|
||||
}
|
||||
|
||||
function keys()
|
||||
{
|
||||
|
||||
$plugin_keys = $this->wrap->keys();
|
||||
return $plugin_keys;
|
||||
}
|
||||
/*
|
||||
function selection()
|
||||
{
|
||||
$this->db = clone($GLOBALS['egw']->db);
|
||||
$query = "SELECT configuration_value FROM egw_oscadmin_osc_conf WHERE configuration_key = 'MODULE_PAYMENT_INSTALLED'; ";
|
||||
|
||||
$geti = $this->db->query($query);
|
||||
while ($this->db->next_record())
|
||||
{
|
||||
$row = $this->db->row();
|
||||
if ($row != "")
|
||||
{
|
||||
$modarray = explode(';',str_replace('.php','',$row['configuration_value']));
|
||||
foreach($modarray as $key=>$mod)
|
||||
{
|
||||
$_ret[$key]['module']= $mod;
|
||||
$_ret[$key]['id'] = $mod;
|
||||
}
|
||||
return $_ret;
|
||||
} else
|
||||
return array('');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
function getName()
|
||||
{
|
||||
return $GLOBALS[$this->selected_module]->title;
|
||||
}
|
||||
|
||||
function read_settings()
|
||||
{
|
||||
// set the application parameters
|
||||
$configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION);
|
||||
while ($configuration = tep_db_fetch_array($configuration_query))
|
||||
{
|
||||
define($configuration['cfgKey'], $configuration['cfgValue']);
|
||||
}
|
||||
}
|
||||
|
||||
function convert_order_to_osc()
|
||||
{
|
||||
$GLOBALS['order'] = new order(1);
|
||||
}
|
||||
|
||||
function get_installedplugs()
|
||||
{
|
||||
die ('get_installedplugs in wrap_osc_payment');
|
||||
return $_result;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
49
psp_admin/inc/wrap_osc_plugin.php
Normal file
49
psp_admin/inc/wrap_osc_plugin.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* WRAPPER FOR OSC-PLUGINS
|
||||
**/
|
||||
|
||||
|
||||
require_once(EGW_INCLUDE_ROOT.'/psp_admin/inc/payment_modules/database.php');
|
||||
require_once(EGW_INCLUDE_ROOT.'/psp_admin/inc/payment_modules/general.php');
|
||||
require_once(EGW_INCLUDE_ROOT.'/psp_admin/inc/payment_modules/html_output.php');
|
||||
require_once(EGW_INCLUDE_ROOT.'/psp_admin/inc/payment_modules/payment.php');
|
||||
require_once(EGW_INCLUDE_ROOT.'/psp_admin/inc/payment_modules/currencies.php');
|
||||
require_once(EGW_INCLUDE_ROOT.'/psp_admin/inc/payment_modules/order.php');
|
||||
require_once(EGW_INCLUDE_ROOT.'/psp_admin/inc/payment_modules/validations.php');
|
||||
// require_once(EGW_INCLUDE_ROOT.'/psp_admin/inc/languages/english.php');
|
||||
|
||||
class wrap_osc_plugin extends payment
|
||||
{
|
||||
|
||||
var $db;
|
||||
var $wrap;
|
||||
|
||||
function wrap_osc_plugin($plug='')
|
||||
{
|
||||
if($plug!='')
|
||||
{
|
||||
require_once(EGW_INCLUDE_ROOT."/psp_admin/inc/payment_modules/payment/$plug.php");
|
||||
eval("\$this->wrap = new $plug();");
|
||||
}
|
||||
tep_db_connect() or die("hmmm... tep_db_connect error in wrap_osc_plugin");
|
||||
}
|
||||
|
||||
|
||||
function remove()
|
||||
{
|
||||
$this->wrap->remove();
|
||||
}
|
||||
|
||||
function install()
|
||||
{
|
||||
$this->wrap->install();
|
||||
}
|
||||
|
||||
function keys()
|
||||
{
|
||||
$plugin_keys = $this->wrap->keys();
|
||||
return $plugin_keys;
|
||||
}
|
||||
}
|
27
psp_admin/index.php
Normal file
27
psp_admin/index.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* eGroupWare - PSP_Admin *
|
||||
* http://www.egroupware.org *
|
||||
* -------------------------------------------------------------------------*
|
||||
* Copyright (c) 2006 Richard van Diessen Jataggo BV richard@jataggo.com *
|
||||
* -------------------------------------------------------------------------*
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id */
|
||||
|
||||
$GLOBALS['egw_info'] = array();
|
||||
$GLOBALS['egw_info']['flags'] = array(
|
||||
'currentapp' => 'psp_admin',
|
||||
'noheader' => True,
|
||||
'nonavbar' => True,
|
||||
'enable_nextmatchs_class' => True
|
||||
);
|
||||
include('../header.inc.php');
|
||||
|
||||
ExecMethod('psp_admin.ui_pspadmin.settings');
|
||||
|
||||
?>
|
Loading…
Reference in New Issue
Block a user