<?php
/******************************************************************
* PHPMass Shopping Cart
* The contents of this file are subject to the PHPMass License.
* If you do not agree with PHPMass License Terms and Conditions
* than you should not use this software.
* A copy of the license file is available on www.phpmass.com/license.htm page.
*
* PHPMass.com.
* All Rights Reserved.
******************************************************************/
$SiteSection = 'user';
require('../includes/config.php');
// Cart and top products
$LastProducts = $Carts->getLastProducts();
if (is_array($LastProducts)) {
$LastProduct = array_shift($LastProducts);
}
$smarty->assign('LastProduct', $LastProduct);
$smarty->assign('LastProducts', $LastProducts);
$TopProducts = $Categories->getTopProducts(0,false,true);
$smarty->assign('TopProducts', $TopProducts);
// END Cart and top products
if (isset($_POST['updateInfos'])) {
if (!isName($_POST['fullName'])) $Error['FullName_NotValid'] = $Lang['FullName_NotValid'];
if (!isEmail($_POST['emalAddr'])) $Error['Email_NotValid'] = $Lang['Email_NotValid'];
if (!isPhone($_POST['mobilePhone'])) $Error['Phone_NotValid'] = $Lang['Phone_NotValid'];
if (!empty($_POST['phoneNumber'])) if(!isPhone($_POST['phoneNumber'])) $Error['Phone_NotValid'] = $Lang['Phone_NotValid'];
if (!empty($_POST['Fax'])) if(!isPhone($_POST['Fax'])) $Error['Phone_NotValid'] = $Lang['Phone_NotValid'];
if (count($Error) == 0){
$Users->updateUserInfo($userid,$_POST['fullName'],$_POST['emalAddr'],$_POST['mobilePhone'],$_POST['phoneNumber'],$_POST['Fax'],$_POST['DateOfBirthYear'].'-'.$_POST['DateOfBirthMonth'].'-'.$_POST['DateOfBirthDay'],$_POST['domain'],$_POST['otherInfo'],$_POST['education']);
$InfoMessage['Account_Updated'] = $Lang['Account_Updated'];
}
}
$UserInfo = $Users->getUser($userid);
$smarty->assign('PageTitle', $Lang['Personal_Info']);
$smarty->assign('UserInfo', $UserInfo);
$smarty->assign('Error', $Error);
$smarty->assign('InfoMessage', $InfoMessage);
$smarty->display(DOC_ROOT.'/skin/templates/user/'.'personal.tpl');
?>