function edit() { // we need a user, then to provide him with choices - edit the login details, edit his personal info, or fix his map... global $PAGE, $STORAGE, $TRADS; $current = $this->arrayGetUsrInfo($_SESSION['idsr_usrs_login']); if (isset($_POST['submit'])) { // change the data... $args = array('tbl' => 'sr_ads', 'formDesc' => $_SESSION['formDesc']); $pd = checkform($args); if ($pd['result'] == 'passed') { // the data is good... global $STORAGE; $condition = 'idsr_usrs_login = '******'idsr_usrs_login']; if ($_POST['submit']) { unset($_POST['submit']); } if ($_POST[$TRADS->popTrad('submit')]) { unset($_POST[$TRADS->popTrad('submit')]); } $nu = $STORAGE->formToDB('sr_usrs_info', '', 'update', $condition); if ($nu !== false) { // we have an ad inserted! if ($_POST['sr_street'] !== $current['sr_street'] || $_POST['sr_city'] !== $current['sr_city']) { // recode the location... include_once 'inc/googleRecordLocFunc.inc.php'; //$address = $_POST["sr_street"] . ',' . $_POST["sr_city"] . ',' . $_POST["sr_state"] . ',' . $_POST["sr_country"]; $address = $_POST["sr_street"] . ',' . $_POST["sr_city"] . ',' . $_POST["sr_country"]; $aull = split(',', strGoogleGetLatLng($address)); //die($aull[0]); //die(stripos($aull[0], 'failed')); if (stripos($aull[0], 'failed')) { //die('badaddress'); $PAGE->body_error .= $aull[0] . ', ' . $aull[1]; $this->errors .= $aull[0] . ', ' . $aull[1]; $PAGE->forwardMessage('impossible de localiser votre address. Essayez de nouveau.', 'error'); header('location:' . $_SERVER['REQUEST_URI']); //break; } // TODO get the current session start time and the current timestamp $ary = array('sr_lat' => $aull[0], 'sr_lng' => $aull[1]); //$condition = 'idsr_usrs_login = '******'id'] //$udata = & new storage(); $r = $STORAGE->formToDB('sr_usrs_data', '', 'update', $condition, $ary); $locstr = $_SERVER['PHP_SELF'] . '?where=users&what=view'; header('location:' . $locstr); } $locstr = $_SERVER['PHP_SELF'] . '?where=users&what=view'; header('location:' . $locstr); } else { // didn't work :-( die('didn\'t get an update - got : ' . $nu); // TODO make a routine for failed inserts - a form to open an issue ticket? } } } $args = array('tbl' => 'sr_usrs_info', 'currentArray' => $current); $PAGE->body_message .= $TRADS->popTrad('please_complete_details'); $pd = makeform($args); foreach ($pd as $k => $v) { // $GLOBALS[$k] = $v; $PAGE->{$k} .= $v; } }
if it does, see if the person forgot their username.*/ //$this->parentDieTest(); if (isset($_POST['submit'])) { $args = array('tbl' => 'sr_usrs_info', 'formDesc' => $_SESSION['formDesc']); $pd = checkform($args); //die(print_r($pd)); if ($pd['result'] == 'passed') { //ok, we passed the test, so now lets process the data... //$_POST['sr_usrgroup'] = 'users'; //die("you're in"); //global $STORAGE; //include_once 'app/core/storage.class.php'; // now we need to localise the user... include_once 'inc/googleRecordLocFunc.inc.php'; $address = $_POST["sr_street"] . ',' . $_POST["sr_city"] . ',' . $_POST["sr_country"]; $aull = split(',', strGoogleGetLatLng($address)); if (stripos($aull[0], 'failed') !== false) { $PAGE->body_error .= $aull[0] . ', ' . $aull[1]; $this->errors .= $aull[0] . ', ' . $aull[1]; $PAGE->forwardMessage('impossible de localiser votre address.'); header('location:' . $_SERVER['PHP_SELF']); break; } //die($aull[0]); // TODO get the current session start time and the current timestamp $ary = array('sr_lat' => $aull[0], 'sr_lng' => $aull[1], 'idsr_usrs_login' => $_SESSION['idsr_usrs_login'], 'sr_usrsince' => date('YYYY-MM-DD')); //$udata = & new storage(); $a = print_r($ary, true); $r = $STORAGE->formToDB('sr_usrs_data', '', 'insert', NULL, $ary); if (!$r) { die('didn\'t insert any coordinates : ' . $r . ' > ' . $a);