/trunk/controllers/myaccount/controller.php
PHP | 1351 lines | 1155 code | 129 blank | 67 comment | 231 complexity | bdc7731b222aa3d795c684f5cdd9da5f MD5 | raw file
Possible License(s): LGPL-2.1
Large files files are truncated, but you can click here to view the full file
- <?php
-
- class Myaccountcontroller {
-
- private $registry;
-
- public function __construct( PeacockCarterFrameworkRegistry $registry, $directCall )
- {
- $this->registry = $registry;
- // temp
- $sql = "SELECT c.ID FROM content c, content_types t, content_versions v, content_versions_pages p WHERE c.type=t.ID AND t.reference='page' AND p.version_id=v.ID AND v.ID=c.current_revision AND c.`order` >= 0 ORDER BY c.`order` ASC LIMIT 1";
- $this->registry->getObject('db')->executeQuery( $sql );
- $p = $this->registry->getObject('db')->getRows();
- $this->registry->getObject('menubuilder')->setCustomStuff( 'My Account', 'myaccount', $p['ID']);
- $this->registry->getObject('menubuilder')->buildMenu( $p['ID'] );
- if( $this->registry->getObject('authenticate')->isLoggedIn() == true )
- {
-
- $this->registry->getObject('template')->getPage()->setTitle('My Account');
- $urlBits = $this->registry->getURLBits();
- if( isset( $urlBits[1] ) )
- {
- switch( $urlBits[1] )
- {
- case 'view-order':
- $this->viewOrder( intval($urlBits[2]) );
- break;
- case 'orders':
- $this->listOrders();
- break;
- case 'change-password':
- $this->changePassword();
- break;
- case 'change-email':
- $this->changeEmailAddress();
- break;
- case 'change-delivery':
- $this->changeDefaultDeliveryDetails();
- break;
- case 'edit':
- $this->editAccount();
- break;
- default:
- $this->dashboard();
- break;
- }
-
- }
- else
- {
- $this->dashboard();
- }
- }
- else
- {
- $urlBits = $this->registry->getURLBits();
- if( $urlBits[1] == 'create' )
- {
- if( $urlBits[2] == 'events' )
- {
- $this->createAccount( 'events' );
- }
- else
- {
- $this->createAccount( 'myaccount' );
- }
- }
- else
- {
- $this->registry->errorPage('Please login', 'You must be logged in to access and manage your account');
- }
-
- }
- }
-
- /**
- * Send the contact form email
- */
- private function sendEmail( $message )
- {
- $this->registry->getObject('mailout')->startFresh();
- $this->registry->getObject('mailout')->setTo( $this->registry->getSetting('adminEmailAddress') );
- $this->registry->getObject('mailout')->setSender( $this->registry->getSetting('adminEmailAddress') );
- $this->registry->getObject('mailout')->setFromName( $this->registry->getSetting('cms_name') );
- $this->registry->getObject('mailout')->setSubject( $message );
-
- //$this->registry->getObject('mailout')->buildFromTemplates('contactform.tpl.php');
- //$tags = $this->values;
- //$tags[ 'generator' ] = $this->registry->getSetting('cms_name');
- //$tags[ 'sitename' ] = $this->registry->getSetting('sitename');
- //$this->registry->getObject('mailout')->replaceTags( $tags );
-
- $this->registry->getObject('mailout')->setMethod('sendmail');
- $this->registry->getObject('mailout')->send();
- }
-
- private function createAccount( $path )
- {
- if( isset( $_POST ) && is_array( $_POST ) && count( $_POST ) > 0 )
- {
- // create the account
- $required = array( 'username' => 'Username', 'password' => 'Password', 'confirm_password' => 'Confirm password', 'first_name' => 'First Name', 'last_name' => 'Last Name', 'organisation' => 'Organisation', 'address' => 'Address', 'city' => 'City', 'county' =>'County', 'postcode' =>'Postcode', 'email' => 'Email address', 'phone' => 'Telephone number' );
- $errors = array();
- foreach( array_keys( $required ) as $r )
- {
- if( ! isset( $_POST[ $r ]) || $_POST[ $r ] == '' )
- {
- $processable = false;
- $error = array();
- $error['errora'] = $required[ $r ] . " is a required field";
- $errors[] = $error;
- }
-
- if( isset( $_POST['email'] ) && $r == 'email' )
- {
- if( !preg_match( "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})^", $_POST['email'] ) )
- {
- $error['errora'] = $required[ $r ] . " is an invalid email address. Please try again.";
- $errors[] = $error;
- }
- }
-
- if( isset( $_POST['username'] ) && $r == 'username' )
- {
- $username = $this->registry->getObject('db')->sanitizeData( $_POST['username'] );
- $sql = "SELECT * FROM users WHERE username = '{$username}'";
- $this->registry->getObject('db')->executeQuery($sql);
- if( $this->registry->getObject('db')->numRows() > 0 )
- {
- $error['errora'] = $required[ $r ] . " is already taken. Please try again.";
- $errors[] = $error;
- }
- }
-
- if( isset( $_POST['confirm_password'] ) && $r == 'confirm_password' )
- {
- if( $_POST['password'] != $_POST['confirm_password'] )
- {
- $error['errora'] = $required[ $r ] . " does not match your password. Please try again.";
- $errors[] = $error;
- }
- }
-
- if( isset( $_POST['password'] ) && $r == 'password' )
- {
- if( strlen( $_POST['password'] ) < 6 )
- {
- $error['errora'] = $required[ $r ] . " is too short, it must be at least 6 characters.";
- $errors[] = $error;
- }
- }
- }
-
- if( empty( $errors ) )
- {
- $insert = array();
- $insert['username'] = $this->registry->getObject('db')->sanitizeData( $_POST['username'] );
- $insert['email'] = $this->registry->getObject('db')->sanitizeData( $_POST['email'] );
- $insert['title'] = $this->registry->getObject('db')->sanitizeData( $_POST['title'] );
- $insert['firstName'] = $this->registry->getObject('db')->sanitizeData( $_POST['first_name'] );
- $insert['lastName'] = $this->registry->getObject('db')->sanitizeData( $_POST['last_name'] );
- $insert['name'] = $this->registry->getObject('db')->sanitizeData( $_POST['first_name'] ) . ' ' . $this->registry->getObject('db')->sanitizeData( $_POST['last_name'] );
- $insert['password_hash'] = md5( $_POST['password'] );
- $insert['active'] = 1;
- $insert['banned'] = 0;
- $insert['admin'] = 0;
- $insert['deleted'] = 0;
- $insert['member'] = 0;
- $this->registry->getObject('db')->insertRecords( 'users', $insert );
- $id = $this->registry->getObject('db')->lastInsertID();
-
- $insert = array();
- $insert['user_id'] = $id;
- $insert['organisation'] = $this->registry->getObject('db')->sanitizeData( $_POST['organisation'] );
- $insert['organisation_type'] = $this->registry->getObject('db')->sanitizeData( $_POST['organisation_type'] );
- $insert['job_title'] = $this->registry->getObject('db')->sanitizeData( $_POST['job_title'] );
- $insert['phone'] = $this->registry->getObject('db')->sanitizeData( $_POST['phone'] );
- $insert['address'] = $this->registry->getObject('db')->sanitizeData( $_POST['address'] );
- $insert['address_linetwo'] = $this->registry->getObject('db')->sanitizeData( $_POST['address_linetwo'] );
- $insert['city'] = $this->registry->getObject('db')->sanitizeData( $_POST['city'] );
- $insert['county'] = $this->registry->getObject('db')->sanitizeData( $_POST['county'] );
- $insert['postcode'] = $this->registry->getObject('db')->sanitizeData( $_POST['postcode'] );
- //$insert['nature'] = $this->registry->getObject('db')->sanitizeData( $_POST['nature'] );
- //$insert['employees'] = $this->registry->getObject('db')->sanitizeData( $_POST['employees'] );
- $insert['website'] = $this->registry->getObject('db')->sanitizeData( $_POST['website'] );
- $insert['mobile'] = $this->registry->getObject('db')->sanitizeData( $_POST['mobile'] );
-
- if( isset( $_POST['kind'] ) && is_array($_POST['kind']) && count( $_POST['kind'] ) > 0 )
- {
- $insert['kind'] = serialize( $_POST['kind'] );
- }
-
- if( isset( $_POST['interests'] ) && is_array($_POST['interests']) && count( $_POST['interests'] ) > 0 )
- {
- $insert['interests'] = serialize( $_POST['interests'] );
- }
-
- if( isset( $_POST['networks'] ) && is_array($_POST['networks']) && count( $_POST['networks'] ) > 0 )
- {
- $insert['networks'] = serialize( $_POST['networks'] );
- }
-
- if( isset( $_POST['voluntary'] ) )
- {
- $insert['voluntary'] = $this->registry->getObject('db')->sanitizeData( $_POST['voluntary'] );
- }
-
- if( isset( $_POST['areas'] ) && is_array($_POST['areas']) && count( $_POST['areas'] ) > 0 )
- {
- $insert['areas'] = serialize( $_POST['areas'] );
- }
-
- if( isset( $_POST['declaration'] ) )
- {
- $insert['declaration'] = $this->registry->getObject('db')->sanitizeData( $_POST['declaration'] );
- }
-
- $this->registry->getObject('db')->insertRecords( 'users_extra', $insert );
-
- $username = $this->registry->getObject('db')->sanitizeData( $_POST['username'] );
- $password = $this->registry->getObject('db')->sanitizeData( $_POST['password'] );
- $this->registry->getObject('authenticate')->forceLogin( $username, $password );
-
- require_once( ACP_PATH . 'controllers/goldvision/controller.php');
- $controller = new GoldVisionController();
-
- $summary = str_replace( '&', '&', $_POST['organisation'] ) ;
- $phone_number = str_replace( '&', '&', $_POST['phone'] );
- $address_1 = str_replace( '&', '&', $_POST['address'] );
- $address_2 = str_replace( '&', '&', $_POST['address_linetwo'] );
- $town = str_replace( '&', '&', $_POST['city'] );
- $county = str_replace( '&', '&', $_POST['county'] );
- $postcode = str_replace( '&', '&', $_POST['postcode'] );
- $website = str_replace( '&', '&', $_POST['website'] );
-
- $interests = array();
- if( isset( $_POST['interests'] ) && is_array($_POST['interests']) && count( $_POST['interests'] ) > 0 )
- {
- if( $_POST['organisation_type'] == 'individual' || $_POST['organisation_type'] == 'voluntary' || $_POST['organisation_type'] == 'social' )
- {
- foreach( $_POST['interests'] as $interest => $details )
- {
- switch( $interest )
- {
- case 'age':
- $interests[] = '2';
- break;
- case 'asylum':
- $interests[] = '21';
- break;
- case 'disability':
- $interests[] = '58';
- break;
- case 'gender':
- $interests[] = '63';
- break;
- case 'gypsies':
- $interests[] = '47';
- break;
- case 'rights':
- $interests[] = '25';
- break;
- case 'migrants':
- $interests[] = '49';
- break;
- case 'race':
- $interests[] = '114';
- break;
- case 'religon':
- $interests[] = '64';
- break;
- case 'sexual':
- $interests[] = '115';
- break;
- case 'transgender':
- $interests[] = '61';
- break;
- }
- }
- }
- else
- {
- foreach( $_POST['interests'] as $interest => $details )
- {
- switch( $interest )
- {
- case 'age':
- $interests[] = '137';
- break;
- case 'asylum':
- $interests[] = '21';
- break;
- case 'disability':
- $interests[] = '59';
- break;
- case 'gender':
- $interests[] = '138';
- break;
- case 'gypsies':
- $interests[] = '47';
- break;
- case 'rights':
- $interests[] = '25';
- break;
- case 'migrants':
- $interests[] = '49';
- break;
- case 'race':
- $interests[] = '139';
- break;
- case 'religon':
- $interests[] = '144';
- break;
- case 'sexual':
- $interests[] = '140';
- break;
- case 'transgender':
- $interests[] = '61';
- break;
- }
- }
- }
- }
-
- if( isset( $_POST['areas'] ) && is_array($_POST['areas']) && count( $_POST['areas'] ) > 0 )
- {
- foreach( $_POST['areas'] as $area => $details )
- {
- switch( $area )
- {
- case 'bath':
- $interests[] = '101';
- break;
- case 'bristol':
- $interests[] = '96';
- break;
- case 'bournemouth':
- $interests[] = '102';
- break;
- case 'cornwall':
- $interests[] = '99';
- break;
- case 'devon':
- $interests[] = '106';
- break;
- case 'dorset':
- $interests[] = '108';
- break;
- case 'gloucestershire':
- $interests[] = '110';
- break;
- case 'north_somerset':
- $interests[] = '103';
- break;
- case 'plymouth':
- $interests[] = '104';
- break;
- case 'poole':
- $interests[] = '105';
- break;
- case 'somerset':
- $interests[] = '95';
- break;
- case 'south_gloucestershire':
- $interests[] = '107';
- break;
- case 'swindon':
- $interests[] = '109';
- break;
- case 'torbay':
- $interests[] = '111';
- break;
- case 'wiltshire':
- $interests[] = '100';
- break;
- case 'west_of_england':
- $interests[] = '98';
- break;
- case 'sw_region':
- $interests[] = '94';
- break;
- case 'outside_region':
- $interests[] = '97';
- break;
- }
- }
- }
-
- switch( $_POST['organisation_type'] )
- {
- case 'individual':
- $type = "df33cd86-6861-4e0f-93b3-d4c6bcf3a0f3";
- break;
- case 'private':
- $type = "c62b0abd-ddb7-4d4a-ad4a-599fd5af215b";
- break;
- case 'public':
- $type = "29490b9f-8873-44a8-ac7e-bcbec693af3b";
- break;
- case 'voluntary':
- $type = "3506df8e-3192-40ef-bc64-8b03e1e80445";
- break;
- case 'social':
- $type = "b4ea47d6-714f-4555-b134-e7e6de53916a";
- break;
- default:
- $type = "df33cd86-6861-4e0f-93b3-d4c6bcf3a0f3";
- break;
- }
-
- // ind data
- $firstName = str_replace( '&', '&', $_POST['first_name'] ) ;
- $lastName = str_replace( '&', '&', $_POST['last_name'] ) ;
- $title = str_replace( '&', '&', $_POST['title'] ) ;
- $jobTitle = str_replace( '&', '&', $_POST['job_title'] ) ;
- $mobile = str_replace( '&', '&', $_POST['mobile'] ) ;
- $email = str_replace( '&', '&', $_POST['email'] ) ;
- $events = '';
- $newsletter = 0;
- $volun = '';
- $share = 0;
- if( isset( $_POST['kind'] ) && is_array($_POST['kind']) && count( $_POST['kind'] ) > 0 )
- {
- //echo '<pre>' . print_r( $_POST['kind'], true ) . '</pre>'; exit();
- foreach( $_POST['kind'] as $k => $v )
- {
- if( $k == 'events' )
- {
- $events = "1a26da8a-90f5-4527-a8eb-551df1970e49";
- }
-
- if( $k == 'newsletter' )
- {
- $newsletter = 1;
- }
- }
- }
-
- if( isset($_POST['voluntary']) && $_POST['voluntary'] == 'yes' )
- {
- $volun = "edfd31f5-170d-4a72-a820-6c2591a84ef8";
- }
- else
- {
- $volun = "065b7934-5313-4656-857a-7e382fc312fe";
- }
-
- if( isset($_POST['declaration']) && $_POST['declaration'] == 'yes' )
- {
- $share = 1;
- }
- else
- {
- $share = 0;
- }
-
- if( $controller->isOrganisationInGoldVision( $_POST['organisation'] ) )
- {
- // organisation exists
- $orgID = $controller->getOrgID();
- // update it
- $controller->updateOrganisationInGV( $orgID, $summary, $address_1, $address_2, $town, $county, $postcode, $phone_number, $website, $type );
-
- if( ! $controller->isContactInGoldVision( $_POST['email'], $orgID ) )
- {
- // contact not exist: create it
- $indID = $controller->createContact( $firstName, $lastName, $orgID, $title, $jobTitle, $mobile, $email, $events, $volun, $newsletter, $share );
-
- if( isset( $interests ) && is_array($interests) && count( $interests ) > 0 )
- {
-
- $controller->createInterest( $interests, $indID );
- /*
- foreach( $interests as $interest => $tag )
- {
- $controller->createInterest( $tag, $indID );
- }*/
- }
-
- }
- else
- {
- // contact exists; update it
- $contactID = $controller->getContactID();
- $controller->updateContact( $contactID, $firstName, $lastName, $orgID, $title, $jobTitle, $mobile, $email, $events, $volun, $newsletter, $share, $address_1, $address_2, $town, $county, $postcode, $phone_number, $website );
-
- if( isset( $interests ) && is_array($interests) && count( $interests ) > 0 )
- {
- $controller->createInterest( $interests, $contactID );
- /*
- foreach( $interests as $interest => $tag )
- {
- $controller->createInterest( $tag, $indID );
- }*/
- }
- }
-
- }
- else
- {
- // create new organisation
- $orgID = $controller->createOrganisationInGV( $summary, $address_1, $address_2, $town, $county, $postcode, $phone_number, $website, $type );
-
- if( ! $controller->isContactInGoldVision( $_POST['email'], $orgID ) )
- {
- // create new contact
- $indID = $controller->createContact( $firstName, $lastName, $orgID, $title, $jobTitle, $mobile, $email, $events, $volun, $newsletter, $share );
- if( isset( $interests ) && is_array($interests) && count( $interests ) > 0 )
- {
- $controller->createInterest( $interests, $indID );
- }
-
- }
- else
- {
- // update existing contact
- $contactID = $controller->getContactID();
- $controller->updateContact( $contactID, $firstName, $lastName, $orgID, $title, $jobTitle, $mobile, $email, $events, $volun, $newsletter, $share, $address_1, $address_2, $town, $county, $postcode, $phone_number, $website );
- if( isset( $interests ) && is_array($interests) && count( $interests ) > 0 )
- {
- $controller->createInterest( $interests, $contactID );
- }
- }
-
- }
-
- if( $path == 'events' )
- {
- $this->registry->redirectUser(array('events'),'Account created','Thank you, your account has been created. Taking you back to the events area.',false);
- }
- else
- {
- $this->registry->redirectUser(array('myaccount'),'Account created','Thank you, your account has been created.',false);
- }
-
- }
- else
- {
- $this->registry->getObject('template')->getPage()->addTag( 'message', 'Sorry, there were some errors with your attempt to create an account. Please correct the errors below and try again.' );
- $this->registry->getObject('template')->addTemplateBit( 'form_errors', 'myaccount/errors.tpl.php' );
- foreach( $_POST as $pkey => $pdata )
- {
- $this->registry->getObject('template')->getPage()->addTag( 'form_' . $pkey, $pdata );
- }
-
- if( isset( $_POST['kind'] ) && is_array($_POST['kind']) && count( $_POST['kind'] ) > 0 )
- {
- foreach( $_POST['kind'] as $k => $v )
- {
- $this->registry->getObject('template')->getPage()->addTag( 'form_kind_' . $k, 'checked="checked"' );
- }
- }
-
- if( isset( $_POST['interests'] ) && is_array($_POST['interests']) && count( $_POST['interests'] ) > 0 )
- {
- foreach( $_POST['interests'] as $k => $v )
- {
- $this->registry->getObject('template')->getPage()->addTag( 'form_interests_' . $k, 'checked="checked"' );
- }
- }
-
- if( isset( $_POST['networks'] ) && is_array($_POST['networks']) && count( $_POST['networks'] ) > 0 )
- {
- foreach( $_POST['networks'] as $k => $v )
- {
- $this->registry->getObject('template')->getPage()->addTag( 'form_networks_' . $k, 'checked="checked"' );
- }
- }
-
- if( isset( $_POST['voluntary'] ) )
- {
- if( $_POST['voluntary'] == 'yes' )
- {
- $this->registry->getObject('template')->getPage()->addTag( 'form_voluntary_yes', 'checked="checked"' );
- }
- else
- {
- $this->registry->getObject('template')->getPage()->addTag( 'form_voluntary_no', 'checked="checked"' );
- }
- }
-
- if( isset( $_POST['areas'] ) && is_array($_POST['areas']) && count( $_POST['areas'] ) > 0 )
- {
- foreach( $_POST['areas'] as $k => $v )
- {
- $this->registry->getObject('template')->getPage()->addTag( 'form_areas_' . $k, 'checked="checked"' );
- }
- }
-
- if( isset( $_POST['declaration'] ) )
- {
- if( $_POST['declaration'] == 'yes' )
- {
- $this->registry->getObject('template')->getPage()->addTag( 'form_declaration_yes', 'checked="checked"' );
- }
- else
- {
- $this->registry->getObject('template')->getPage()->addTag( 'form_declaration_no', 'checked="checked"' );
- }
- }
-
- if( isset( $_POST['organisation_type'] ) )
- {
- $this->registry->getObject('template')->getPage()->addTag( 'nbd_' . $_POST['organisation_type'], 'selected="selected"' );
- }
-
- $cache = $this->registry->getObject('db')->cacheData( $errors );
- $this->registry->getObject('template')->getPage()->addTag( 'errors', array( 'DATA', $cache ) );
- $this->registry->getObject('template')->buildFromTemplates('header.tpl.php', 'myaccount/create.tpl.php', 'footer.tpl.php');
- }
- }
- else
- {
- $this->registry->getObject('template')->getPage()->addTag( 'form_declaration_yes', 'checked="checked"' );
- $this->registry->getObject('template')->getPage()->addTag( 'path', $path );
- $this->registry->getObject('template')->buildFromTemplates('header.tpl.php', 'myaccount/create.tpl.php', 'footer.tpl.php');
- }
- }
-
- private function editAccount()
- {
- $id = $this->registry->getObject('authenticate')->getUserID();
-
- if( isset( $_POST ) && is_array( $_POST ) && count( $_POST ) > 0 )
- {
- // create the account
- $required = array( 'username' => 'Username', 'first_name' => 'First Name', 'last_name' => 'Last Name', 'organisation' => 'Organisation', 'address' => 'Address', 'city' => 'City', 'county' =>'County', 'postcode' =>'Postcode', 'email' => 'Email address', 'phone' => 'Telephone number' );
- $errors = array();
- foreach( array_keys( $required ) as $r )
- {
- if( ! isset( $_POST[ $r ]) || $_POST[ $r ] == '' )
- {
- $processable = false;
- $error = array();
- $error['errora'] = $required[ $r ] . " is a required field";
- $errors[] = $error;
- }
-
- if( isset( $_POST['email'] ) && $r == 'email' )
- {
- if( !preg_match( "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})^", $_POST['email'] ) )
- {
- $error['errora'] = $required[ $r ] . " is an invalid email address. Please try again.";
- $errors[] = $error;
- }
- }
-
- if( isset( $_POST['username'] ) && $r == 'username' )
- {
- if( $_POST['username'] != $_POST['usernameoriginal'] )
- {
- $username = $this->registry->getObject('db')->sanitizeData( $_POST['username'] );
- $sql = "SELECT * FROM users WHERE username = '{$username}'";
- $this->registry->getObject('db')->executeQuery($sql);
- if( $this->registry->getObject('db')->numRows() > 0 )
- {
- $error['errora'] = $required[ $r ] . " is already taken. Please try again.";
- $errors[] = $error;
- }
- }
- }
-
- }
-
- if( $_POST['password'] != '' )
- {
- if( strlen( $_POST['password'] ) < 6 )
- {
- $error['errora'] = "Your password is too short, it must be at least 6 characters.";
- $errors[] = $error;
- }
-
- if( isset( $_POST['confirm_password'] ) )
- {
- if( $_POST['password'] != $_POST['confirm_password'] )
- {
- $error['errora'] = "Your passwords do not match. Please try again.";
- $errors[] = $error;
- }
- }
- }
-
- if( empty( $errors ) )
- {
- $sql = "SELECT u.*, e.* FROM users u, users_extra e WHERE e.user_id=u.ID AND u.ID={$id}";
- $this->registry->getObject('db')->executeQuery( $sql );
- if( $this->registry->getObject('db')->numRows() == 1 )
- {
- $data = $this->registry->getObject('db')->getRows();
- }
- else
- {
- echo 'Error editing member';
- exit();
- }
-
- require_once( ACP_PATH . 'controllers/goldvision/controller.php');
- $controller = new GoldVisionController();
-
- $summary = str_replace( '&', '&', $_POST['organisation'] ) ;
- $phone_number = str_replace( '&', '&', $_POST['phone'] );
- $address_1 = str_replace( '&', '&', $_POST['address'] );
- $address_2 = str_replace( '&', '&', $_POST['address_linetwo'] );
- $town = str_replace( '&', '&', $_POST['city'] );
- $county = str_replace( '&', '&', $_POST['county'] );
- $postcode = str_replace( '&', '&', $_POST['postcode'] );
- $website = str_replace( '&', '&', $_POST['website'] );
-
- $interests = array();
- if( isset( $_POST['interests'] ) && is_array($_POST['interests']) && count( $_POST['interests'] ) > 0 )
- {
- if( $_POST['organisation_type'] == 'individual' || $_POST['organisation_type'] == 'voluntary' || $_POST['organisation_type'] == 'social' )
- {
- foreach( $_POST['interests'] as $interest => $details )
- {
- switch( $interest )
- {
- case 'age':
- $interests[] = '2';
- break;
- case 'asylum':
- $interests[] = '21';
- break;
- case 'disability':
- $interests[] = '58';
- break;
- case 'gender':
- $interests[] = '63';
- break;
- case 'gypsies':
- $interests[] = '47';
- break;
- case 'rights':
- $interests[] = '25';
- break;
- case 'migrants':
- $interests[] = '49';
- break;
- case 'race':
- $interests[] = '114';
- break;
- case 'religon':
- $interests[] = '64';
- break;
- case 'sexual':
- $interests[] = '115';
- break;
- case 'transgender':
- $interests[] = '61';
- break;
- }
- }
- }
- else
- {
- foreach( $_POST['interests'] as $interest => $details )
- {
- switch( $interest )
- {
- case 'age':
- $interests[] = '137';
- break;
- case 'asylum':
- $interests[] = '21';
- break;
- case 'disability':
- $interests[] = '59';
- break;
- case 'gender':
- $interests[] = '138';
- break;
- case 'gypsies':
- $interests[] = '47';
- break;
- case 'rights':
- $interests[] = '25';
- break;
- case 'migrants':
- $interests[] = '49';
- break;
- case 'race':
- $interests[] = '139';
- break;
- case 'religon':
- $interests[] = '144';
- break;
- case 'sexual':
- $interests[] = '140';
- break;
- case 'transgender':
- $interests[] = '61';
- break;
- }
- }
- }
- }
-
- if( isset( $_POST['areas'] ) && is_array($_POST['areas']) && count( $_POST['areas'] ) > 0 )
- {
- foreach( $_POST['areas'] as $area => $details )
- {
- switch( $area )
- {
- case 'bath':
- $interests[] = '101';
- break;
- case 'bristol':
- $interests[] = '96';
- break;
- case 'bournemouth':
- $interests[] = '102';
- break;
- case 'cornwall':
- $interests[] = '99';
- break;
- case 'devon':
- $interests[] = '106';
- break;
- case 'dorset':
- $interests[] = '108';
- break;
- case 'gloucestershire':
- $interests[] = '110';
- break;
- case 'north_somerset':
- $interests[] = '103';
- break;
- case 'plymouth':
- $interests[] = '104';
- break;
- case 'poole':
- $interests[] = '105';
- break;
- case 'somerset':
- $interests[] = '95';
- break;
- case 'south_gloucestershire':
- $interests[] = '107';
- break;
- case 'swindon':
- $interests[] = '109';
- break;
- case 'torbay':
- $interests[] = '111';
- break;
- case 'wiltshire':
- $interests[] = '100';
- break;
- case 'west_of_england':
- $interests[] = '98';
- break;
- case 'sw_region':
- $interests[] = '94';
- break;
- case 'outside_region':
- $interests[] = '97';
- break;
- }
- }
- }
-
- switch( $_POST['organisation_type'] )
- {
- case 'individual':
- $type = "df33cd86-6861-4e0f-93b3-d4c6bcf3a0f3";
- break;
- case 'private':
- $type = "c62b0abd-ddb7-4d4a-ad4a-599fd5af215b";
- break;
- case 'public':
- $type = "29490b9f-8873-44a8-ac7e-bcbec693af3b";
- break;
- case 'voluntary':
- $type = "3506df8e-3192-40ef-bc64-8b03e1e80445";
- break;
- case 'social':
- $type = "b4ea47d6-714f-4555-b134-e7e6de53916a";
- break;
- default:
- $type = "df33cd86-6861-4e0f-93b3-d4c6bcf3a0f3";
- break;
- }
-
- // ind data
- $firstName = str_replace( '&', '&', $_POST['first_name'] ) ;
- $lastName = str_replace( '&', '&', $_POST['last_name'] ) ;
- $title = str_replace( '&', '&', $_POST['title'] ) ;
- $jobTitle = str_replace( '&', '&', $_POST['job_title'] ) ;
- $mobile = str_replace( '&', '&', $_POST['mobile'] ) ;
- $email = str_replace( '&', '&', $_POST['email'] ) ;
- $events = '';
- $newsletter = 0;
- $volun = '';
- $share = 0;
- if( isset( $_POST['kind'] ) && is_array($_POST['kind']) && count( $_POST['kind'] ) > 0 )
- {
- //echo '<pre>' . print_r( $_POST['kind'], true ) . '</pre>'; exit();
- foreach( $_POST['kind'] as $k => $v )
- {
- if( $k == 'events' )
- {
- $events = "1a26da8a-90f5-4527-a8eb-551df1970e49";
- }
-
- if( $k == 'newsletter' )
- {
- $newsletter = 1;
- }
- }
- }
-
- if( isset($_POST['voluntary']) && $_POST['voluntary'] == 'yes' )
- {
- $volun = "edfd31f5-170d-4a72-a820-6c2591a84ef8";
- }
- else
- {
- $volun = "065b7934-5313-4656-857a-7e382fc312fe";
- }
-
- if( isset($_POST['declaration']) && $_POST['declaration'] == 'yes' )
- {
- $share = 1;
- }
- else
- {
- $share = 0;
- }
-
- if( $controller->isOrganisationInGoldVision( $_POST['organisation'] ) )
- {
- // organisation exists
- $orgID = $controller->getOrgID();
- // update it
- $controller->updateOrganisationInGV( $orgID, $summary, $address_1, $address_2, $town, $county, $postcode, $phone_number, $website, $type );
-
- if( ! $controller->isContactInGoldVision( $_POST['email'], $orgID ) )
- {
- // contact not exist: create it
- $indID = $controller->createContact( $firstName, $lastName, $orgID, $title, $jobTitle, $mobile, $email, $events, $volun, $newsletter, $share );
-
- if( isset( $interests ) && is_array($interests) && count( $interests ) > 0 )
- {
-
- $controller->createInterest( $interests, $indID );
- /*
- foreach( $interests as $interest => $tag )
- {
- $controller->createInterest( $tag, $indID );
- }*/
- }
-
- }
- else
- {
- // contact exists; update it
- $contactID = $controller->getContactID();
- $controller->updateContact( $contactID, $firstName, $lastName, $orgID, $title, $jobTitle, $mobile, $email, $events, $volun, $newsletter, $share, $address_1, $address_2, $town, $county, $postcode, $phone_number, $website );
-
- if( isset( $interests ) && is_array($interests) && count( $interests ) > 0 )
- {
- $controller->createInterest( $interests, $contactID );
- /*
- foreach( $interests as $interest => $tag )
- {
- $controller->createInterest( $tag, $indID );
- }*/
- }
- }
-
- }
- else
- {
- // create new organisation
- $orgID = $controller->createOrganisationInGV( $summary, $address_1, $address_2, $town, $county, $postcode, $phone_number, $website, $type );
-
- if( ! $controller->isContactInGoldVision( $_POST['email'], $orgID ) )
- {
- // create new contact
- $indID = $controller->createContact( $firstName, $lastName, $orgID, $title, $jobTitle, $mobile, $email, $events, $volun, $newsletter, $share );
- if( isset( $interests ) && is_array($interests) && count( $interests ) > 0 )
- {
- $controller->createInterest( $interests, $indID );
- }
-
- }
- else
- {
- // update existing contact
- $contactID = $controller->getContactID();
- $controller->updateContact( $contactID, $firstName, $lastName, $orgID, $title, $jobTitle, $mobile, $email, $events, $volun, $newsletter, $share, $address_1, $address_2, $town, $county, $postcode, $phone_number, $website );
- if( isset( $interests ) && is_array($interests) && count( $interests ) > 0 )
- {
- $controller->createInterest( $interests, $contactID );
- }
- }
-
- }
-
- $insert = array();
- $insert['username'] = $this->registry->getObject('db')->sanitizeData( $_POST['username'] );
- $insert['email'] = $this->registry->getObject('db')->sanitizeData( $_POST['email'] );
- $insert['title'] = $this->registry->getObject('db')->sanitizeData( $_POST['title'] );
- $insert['firstName'] = $this->registry->getObject('db')->sanitizeData( $_POST['first_name'] );
- $insert['lastName'] = $this->registry->getObject('db')->sanitizeData( $_POST['last_name'] );
- $insert['name'] = $this->registry->getObject('db')->sanitizeData( $_POST['first_name'] ) . ' ' . $this->registry->getObject('db')->sanitizeData( $_POST['last_name'] );
- if( $_POST['password_hash'] != '' )
- {
- $insert['password_hash'] = md5($_POST['password_hash'] );
- }
- $insert['active'] = 1;
- $insert['banned'] = 0;
- $insert['admin'] = 0;
- $insert['deleted'] = 0;
- $insert['member'] = 0;
- $this->registry->getObject('db')->updateRecords( 'users', $insert, 'ID=' . $id );
-
- $insert = array();
- $insert['user_id'] = $id;
- $insert['organisation'] = $this->registry->getObject('db')->sanitizeData( $_POST['organisation'] );
- $insert['organisation_type'] = $this->registry->getObject('db')->sanitizeData( $_POST['organisation_type'] );
- $insert['job_title'] = $this->registry->getObject('db')->sanitizeData( $_POST['job_title'] );
- $insert['phone'] = $this->registry->getObject('db')->sanitizeData( $_POST['phone'] );
- $insert['address'] = $this->registry->getObject('db')->sanitizeData( $_POST['address'] );
- $insert['address_linetwo'] = $this->registry->getObject('db')->sanitizeData( $_POST['address_linetwo'] );
- $insert['city'] = $this->registry->getObject('db')->sanitizeData( $_POST['city'] );
- $insert['county'] = $this->registry->getObject('db')->sanitizeData( $_POST['county'] );
- $insert['postcode'] = $this->registry->getObject('db')->sanitizeData( $_POST['postcode'] );
- //$insert['nature'] = $this->registry->getObject('db')->sanitizeData( $_POST['nature'] );
- //$insert['employees'] = $this->registry->getObject('db')->sanitizeData( $_POST['employees'] );
- $insert['website'] = $this->registry->getObject('db')->sanitizeData( $_POST['website'] );
- $insert['mobile'] = $this->registry->getObject('db')->sanitizeData( $_POST['mobile'] );
-
- if( isset( $_POST['kind'] ) && is_array($_POST['kind']) && count( $_POST['kind'] ) > 0 )
- {
- $insert['kind'] = serialize( $_POST['kind'] );
- }
-
- if( isset( $_POST['interests'] ) && is_array($_POST['interests']) && count( $_POST['interests'] ) > 0 )
- {
- $insert['interests'] = serialize( $_POST['interests'] );
- }
-
- if( isset( $_POST['networks'] ) && is_array($_POST['networks']) && count( $_POST['networks'] ) > 0 )
- {
- $insert['networks'] = serialize( $_POST['networks'] );
- }
-
- if( isset( $_POST['voluntary'] ) )
- {
- $insert['voluntary'] = $this->registry->getObject('db')->sanitizeData( $_POST['voluntary'] );
- }
-
- if( isset( $_POST['areas'] ) && is_array($_POST['areas']) && count( $_POST['areas'] ) > 0 )
- {
- $insert['areas'] = serialize( $_POST['areas'] );
- }
-
- if( isset( $_POST['declaration'] ) )
- {
- $insert['declaration'] = $this->registry->getObject('db')->sanitizeData( $_POST['declaration'] );
- }
- $this->registry->getObject('db')->updateRecords( 'users_extra', $insert, 'user_id=' . $id );
-
- $this->registry->redirectUser(array('myaccount'),'Account updated','Thank you, your account has been updated.',false);
-
- }
- else
- {
- $this->registry->getObject('template')->getPage()->addTag( 'message', 'Sorry, there were some errors with your attempt to create an account. Please correct the errors below and try again.' );
- $this->registry->getObject('template')->addTemplateBit( 'form_errors', 'myaccount/errors.tpl.php' );
- foreach( $_POST as $pkey => $pdata )
- {
- $this->registry->getObject('template')->getPage()->addTag( 'form_' . $pkey, $pdata );
- }
-
- if( isset( $_POST['kind'] ) && is_array($_POST['kind']) && count( $_POST['kind'] ) > 0 )
- {
- foreach( $_POST['kind'] as $k => $v )
- {
- $this->registry->getObject('template')->getPage()->addTag( 'form_kind_' . $k, 'checked="checked"' );
- }
- }
-
- if( isset( $_POST['interests'] ) && is_array($_POST['interests']) && count( $_POST['interests'] ) > 0 )
- {
- foreach( $_POST['interests'] as $k => $v )
- {
- $this->registry->getObject('template')->getPage()->addTag( 'form_interests_' . $k, 'checked="checked"' );
- }
- }
-
- if( isset( $_POST['networks'] ) && is_array($_POST['networks']) && count( $_POST['networks'] ) > 0 )
- {
- foreach( $_POST['networks'] as $k => $v )
- {
- $this->registry->getObject('template')->getPage()->addTag( 'form_networks_' . $k, 'checked="checked"' );
- }
- }
-
- if( isset( $_POST['voluntary'] ) )
- {
- if( $_POST['voluntary'] == 'yes' )
- {
- $this->registry->getObject('template')->getPage()->addTag( 'form_voluntary_yes', 'checked="checked"' );
- }
- else
- {
- $this->registry->getObject('template')->getPage()->addTag( 'form_voluntary_no', 'checked="checked"' );
- }
- }
-
- if( isset( $_POST['areas'] ) && is_array($_POST['areas']) && count( $_POST['areas'] ) > 0 )
- {
- foreach( $_POST['areas'] as $k => $v )
- {
- $this->registry->getObject('template')->getPage()->addTag( 'form_areas_' . $k, 'checked="checked"' );
- }
- }
-
- if( isset( $_POST['declaration'] ) )
- {
- if( $_POST['declaration'] == 'yes' )
- {
- $this->registry->getObject('template')->getPage()->addTag( 'form_declaration_yes', 'checked="checked"' );
- }
- else
- {
- $this->registry->getObject('template')->getPage()->addTag( 'form_declaration_no', 'checked="checked"' );
- }
- }
-
- if( isset( $_POST['organisation_type'] ) )
- {
- $this->registry->getObject('template')->getPage()->addTag( 'nbd_' . $_POST['organisation_type'], 'selected="selected"' );
- }
-
- $this->registry->getObject('template')->getPage()->addTag( 'form_username', $_POST['usernameoriginal'] );
-
- $cache = $this->registry->getObject('db')->cacheData( $errors );
- $this->registry->getObject('template')->getPage()->addTag( 'errors', array( 'DATA', $cache ) );
- $this->registry->getObject('template')->buildFromTemplates('header.tpl.php', 'myaccount/edit.tpl.php', 'footer.tpl.php');
- }
- }
- else
- {
- $sql = "SELECT u.*, e.* FROM users u LEFT JOIN users_extra e ON e.user_id = u.ID WHERE u.ID=" . $id;
- $this->registry->getObject('db')->executeQuery( $sql );
- $data = $this->registry->getObject('db')->getRows();
- $this->registry->getObject('template')->dataToTags( $data, 'form_' );
-
- $kind = unserialize( $data['kind'] );
- if( isset( $kind ) && is_array($kind) && count( $kind ) > 0 )
- {
- foreach( $kind as $k => $v )
- {
- $this->registry->getObject('template')->getPage()->addTag( 'form_kind_' . $k, 'checked="checked"' );
- }
- }
-
- $interests = unserialize( $data['interests'] );
-
- if( isset( $interests ) && is_array($interests) && count( $interests ) > 0 )
- {
- foreach( $interests as $k => $v )
- {
- $this->registry->getObject('template')->getPage()->addTag( 'form_interests_' . $k, 'checked="checked"' );
- }
- }
-
- $networks = unserialize( $data['networks'] );
- if( isset( $networks ) && is_array($networks) && count( $networks ) > 0 )
- {
- foreach( $networks as $k => $v )
- {
- $this->registry->getObject('template')->getPage()->addTag( 'form_networks_' . $k, 'checked="checked"' );
- }
- }
-
- if( $data['voluntary'] == 'yes' )
- {
- $this->registry->getObject('template')->getPage()->addTag( 'form_voluntary_yes', 'checked="checked"' );
- }
- else
- {
- $this->registry->getObject('template')->getPage()->addTag( 'form_voluntary_no', 'checked="checked"' );
- }
-
- $areas = unserialize( $data['areas'] );
- if( isset( $areas ) && is_array($areas) && count( $areas ) > 0 )
- {
- foreach( $areas as $k => $v )
- {
- $this->registry->getObject('template')->getPage()->addTag( 'form_areas_' . $k, 'checked="checked"' );
- }
- }
-
- if( $data['declaration'] == 'yes' )
- {
- $this->registry->getObject('template')->getPage()->addTag( 'form_declaration_yes', 'checked="checked"' );
- }
- else
- {
- $this->registry->getObject('template')->getPage()->addTag( 'form_declaration_no', 'checked="checked"' );
- }
-
- $this->registry->getObject('template')->getPage()->addTag( 'nbd_' . $data['organisation_type'], 'selected="selected"' );
-
- $this->registry->getObject('template')->buildFromTemplates('header.tpl.php', 'myaccount/edit.tpl.php', 'footer.tpl.php');
- }
- }
-
- private function changeEmailAddress()
- {
- if( isset( $_POST['email'] ) )
- {
- if( preg_match( "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})^", $_POST['email'] ) )
- {
- $changes = array();
- $changes['email'] = $this->registry->getObject('db')->sanitizeData( $_POST['email'] );
- $this->registry->getObject('db')->updateRecords( 'users', $changes, 'ID=' . $this->registry->getObject('authenticate')->getUserID() );
- $this->registry->errorPage('Email address saved', 'Your new email address has been saved');
- }
- else
- {
- $this->registry->errorPage( 'Invalid email address', 'Sorry, your email address was not valid, please try again');
- }
- }
- else
- {
- $this->registry->getObject('template')->buildFromTemplates('header.tpl.php', 'myaccount/email.tpl.php', 'footer.tpl.php');
-
- }
- }
-
- private function changePassword()
- {
- if( isset( $_POST['password'] ) )
- {
- if( ! isset( $_POST['password_confirm'] ) || ( $_POST['password'] != $_POST['password_confirm'] ) )
- {
- $this->registry->errorPage('Password not confirmed', 'Sorry, your password and confirmation did not match. Please try again.');
- }
- elseif( strlen( $_POST['password'] ) < 6 )
- {
- $this->registry->errorPage('Password too short', 'Sorry, your password was too short, passwords must be at least 6 characters long');
- }
- else
- {
- $changes = array();
- $changes['password_hash'] = md5( $_POST['password'] );
- $this->registry->getObject('db')->updateRecords( 'users', $changes, 'ID=' . $this->registry->getObject('authenticate')->getUserID() );
- $this->registry->errorPage('Password changed', 'Your password has been updated');
- }
- }
- else
- {
- $this->registry->getObject('template')->buildFromTemplates('header.tpl.php', 'myaccount/password.tpl.php', 'footer.tpl.php');
-
- }
- }
-
- private function changeDefaultDeliveryDetails()
- {
- if( isset( $_POST['delivery'] ) )
- {
- $changes = array();
- $changes['default_delivery_name'] = $this->registry->getObject('db')->sanitizeData( $_POST['name'] );
- $changes['default_delivery_address'] = $this->registry->getObject('db')->sanitizeData( $_POST['address'] );
- $changes['default_delivery_address2'] = $this->registry->getObject('db')->sanitizeData( $_POST['address2'] );
- $changes['default_delivery_city'] = $this->registry->getObject('db')->sanitizeData( $_POST['city'] );
- $changes['default_delivery_postcode'] = $this->registry->getObject('db')->sanitizeData( $_POST['postcode'] );
- $changes['default_delivery_country'] = $this->registry->getObject('db')->sanitizeData( $_POST['country'] );
- $this->registry->getObject('db')->updateRecords( 'users_extra', $changes, 'user_id=' . $this->registry->getObject('authenticate')->getUserID() );
- $this->registry->errorPage('Delivery address saved', 'Your delivery address has been saved');
-
- }
- else
- {
- $this->registry->getObject('template')->buildFromTemplates('header.tpl.php', 'myaccount/delivery.tpl.php', 'footer.tpl.php');
-
- }
- }
-
- private function listOrders()
- {
- // do we have orders
- $u = $this->registry->getObject('authenticate')->getUserID();
- $this->registry->getObject('template')->buildFromTemplates('header.tpl.php', 'myaccount/orders.tpl.php', 'footer.tpl.php');
- $sql = "SELECT o.ID, DATE_FORMAT(date_placed, '%D %M %Y') as placed, (SELECT COUNT(qty) FROM store_orders_items WHERE order_id=o.ID) as products, s.name as status, FORMAT(o.products_cost,2) as cost FROM store_orders o, store_order_statuses s WHERE o.status=s.ID AND o.user_id={$u} ORDER BY ID ASC";
- $cache = $this->registry->getObject('db')->cacheQuery( $sql );
- $this->registry->getObject('template')->getPage()->addTag('orders', array('SQL', $cache));
- // else error page?
- }
-
- private function viewOrder( $order )
- {
- // order and customer details
- $u = $this->registry->getObject('authenticate')->getUserID();
- $sql = "SELECT o.dispatch_comment, o.status as status_id, o.ID, o.payment_txn, DATE_FORMAT(o.date_placed, '%D %M %Y') as date_placed, IF(o.date_dispatch='0000-00-00 00:00:00', 'Not yet dispatched', DATE_FORMAT( o.date_dispatch, '%D %M %Y') ) as date_dispatched, FORMAT(o.products_cost,2) as products_cost, FORMAT(o.shipping_cost,2) as shipping_cost, FORMAT( ( FORMAT(o.products_cost,2) + FORMAT(o.shipping_cost,2) ),2 ) as total_cost, s.name as status_name, u.username, o.user_id, pm.name as payment_method, sm.name as shipping_method, IF(o.voucher_code_text='','No voucher code used', o.voucher_code_text) as voucher_code_text, o.shipping_name, o.shipping_address, o.shipping_address2, o.shipping_city, o.shipping_postcode, o.shipping_country, o.delivery_comment FROM store_orders o, store_order_statuses s, users u, store_payment_methods pm, store_shipping_methods sm WHERE o.ID={$order} AND s.ID=o.status AND sm.ID=o.shipping_method AND pm.ID=o.payment_method AND u.ID=o.user_id AND o.user_id={$u}";
- $this->registry->getObject('db')->executeQuery( $sql );
- if( $this->registry->getObject('db')->numRows() == 1 )
- {
- $orderdata = $this->registry->getObject('db')->getRows();
- $this->registry->getObject('template')->dataToTags( $orderdata, 'od_');
- //echo '<pre>' . print_r( $orderdata, true ) . '</pre>';
- // product details (and variations)
- $sql = "SELECT (
- SELECT
- GROUP_CONCAT( a.name,': ', av.name SEPARATOR ', ' )
- FROM store_product_variation_values av, store_orders_items_variation_value_association ava, store_product_variations a
- WHERE a.ID = av.attribute AND av.ID=ava.variation_id AND ava.order_item_id=i.ID
- ) AS variations, p.name as product_name, i.product_id as product_id, i.qty as product_quantity, FORMAT(pd.price,2) as unit_cost, FORMAT((pd.price * i.qty),2) as cost, IF(i.uploaded_file='', 0,1) as has_file, i.uploaded_file as uploaded_file, i.standard FROM store_orders_items i, content c, content_versions p, content_types t, content_versions_store_products pd WHERE pd.version_id=p.ID AND i.order_id={$order} AND c.ID=i.product_id AND p.ID=c.current_revision AND c.type=t.ID and t.reference='product'";
- $cache = $this->registry->getObject('db')->cacheQuery( $sql );
- $this->registry->getObject('template')->getPage()->addTag('items', array( 'SQL', $cache ) );
- $sql = "SELECT ID as status_id, name as status_name FROM store_order_statuses";
- $cache = $this->registry->getObject('db')->cacheQuery( $sql );
- //$this->registry->getObject('template')->getPage()->addTag('statuses', array( 'SQL', $cache ) );
- //$this->registry->getObject('template')->getPage()->addAdditionalParsingData( 'statuses', 'status_id', $orderdata['status_id'], 'extra', "selected='selected'");
- // template
- $this->registry->getObject('template')->buildFromTemplates('header.tpl.php', 'myaccount/order.tpl.php', 'footer.tpl.php');
- // are we updating the order?
- }
- else
- {
- $this->registry->errorPage('Order not found', 'The order you requested was not found');
- }
- }
-
- private function dashboard()
- {
-
- header('Location: ' . $this->registry->buildURL(array(), '', false ) );
-
- //$u = $this->registry->getObject('authenticate')->getUserID();
- //$this->registry->getObject('template')->buildFromTemplates('header.tpl.php', 'myaccount/dashboard.tpl.php', 'footer.tpl.php');
- //$sql = "SELECT o.ID, DATE_FORMAT(date_placed, '%D %M %Y') as placed, (SELECT COUN…
Large files files are truncated, but you can click here to view the full file