Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $pageownerID = $cookie['uid'];
- $xsl_file = 'editprofile.xsl';
- $pageargs = array("metanocache" => TRUE, "postargs" => TRUE);
- $with_post = false;
- $xml_str = null;
- $err_xml = null;
- $pageOwner = getPageOwner($pageownerID, null, array('lastname', 'email'));
- if ((isset($_POST['Submit']) && stristr($_POST['Submit'], 'save') !== FALSE) ||
- count($_POST) >= 20) {
- $authcode = (isset($_POST['authcode'])) ? $_POST['authcode'] : null;
- if (!verifySaltedUserAuthCode($pageownerID, $authcode))
- dispatchRedirect('/');
- $with_post = true;
- $postalcode = "";
- if ($_POST['country'] == "CA") {
- $postalcode = str_replace(" ", "", strtoupper($_POST['zipcode']));
- }
- if ($_POST['gender'] != 'm' && $_POST['gender'] != 'f') {
- $err_xml = getErrorXml("gender");
- } elseif (!$_POST['birthmonth'] || !$_POST['birthday'] || !$_POST['birthyear']) {
- $err_xml = getErrorXml("dob");
- } elseif ($_POST['birthyear'] < 1900 || $_POST['birthyear'] > 2000) {
- $err_xml = getErrorXml("birthyearinvalid");
- } elseif (!checkdate($_POST['birthmonth'], $_POST['birthday'], $_POST['birthyear'])) {
- $err_xml = getErrorXml("dobinvalid");
- } elseif (floor((time() - strtotime("{$_POST['birthyear']}-{$_POST['birthmonth']}-{$_POST['birthday']}")) / 31536000) < 16) {
- // 31536000 = 60 sec * 60 min * 24 hr * 365 days = 1 year, 18 = min age
- $err_xml = getErrorXml("mustbe18");
- } elseif (!$_POST['country']) {
- $err_xml = getErrorXml("country");
- } elseif ($_POST['country'] == "US" &&
- !zipCodeFormatIsValid($_POST['zipcode'])) {
- $err_xml = getErrorXml("zipcodeinvalidformat");
- } elseif ($_POST['country'] == "US" &&
- getLocationByZipCode($_POST['zipcode']) === FALSE) {
- $err_xml = getErrorXml("zipcodeinvalid");
- } elseif ($_POST['country'] == "CA" &&
- !postalCodeFormatIsValid($postalcode)) {
- $err_xml = getErrorXml("postalcodeinvalidformat");
- } elseif ($_POST['country'] == "CA" &&
- getLocationByPostalCode($postalcode) === FALSE) {
- $err_xml = getErrorXml("postalcodeinvalid");
- $_POST['postalcode'] = $_POST['zipcode'];
- unset($_POST['zipcode']);
- } elseif (!isset($_POST['dating_m']) && !isset($_POST['dating_w']) &&
- !isset($_POST['relationship_m']) && !isset($_POST['relationship_w']) &&
- !isset($_POST['friends']) && !isset($_POST['activity']) && !isset($_POST['heretohelp'])) {
- $err_xml = getErrorXml("whomeet");
- } elseif (!is_numeric($_POST['status']) ||
- $_POST['status'] < 2 || $_POST['status'] > 9) {
- $err_xml = getErrorXml("status");
- } elseif (isset($_POST['rss']) && strlen($_POST['rss']) && !rssURLIsValid($_POST['rss'])) {
- $err_xml = getErrorXml("rss");
- }
- $ndefaults = array("relationship_m", "relationship_w", "dating_m", "dating_w", "friends", "activity");
- foreach ($ndefaults as $col) {
- if (!isset($_POST[$col])) $_POST[$col] = "n";
- }
- if (is_null($err_xml)) {
- if ($_POST['country'] == "CA") {
- $_POST['zipcode'] = $postalcode;
- $_POST['postalcode'] = $postalcode;
- } elseif ($_POST['country'] != "US") {
- unset($_POST['zipcode']);
- }
- if ((isset($_POST['Submit_Shoutout']) && stristr($_POST['Submit_Shoutout'], 'yes') !== FALSE)) {
- saveShoutout($pageownerID, $_POST['shoutout']);
- } else {
- $results = editProfile($pageownerID, $_POST);
- $xml_str .= printStatus($results['status'], $results['message']);
- }
- $xml_str .= printStatus(SUCCESS, '');
- } else {
- $xml_str = $err_xml;
- }
- $xml_str .= getEditProfile($pageownerID );
- } else {
- $xml_str .= getEditProfile($pageownerID);
- }
- // $xml_str .= getAccountSettings_XML($pageownerID);
- $xml_str .= getPageViewer_XML($pageownerID);
- $loc_info = array(
- 'uid' => $pageownerID,
- 'country_code' => getFromPost('country'),
- 'region_code' => getFromPost('region'),
- 'userinfo' => $pageOwner
- );
- $loc_xml = _getLocationXML($loc_info, $with_post);
- $xml_str .= $loc_xml;
- $xml_str .= formatPageOwner_XML($pageOwner, array('lastname', 'email'));
- $xml_str .= generateFormID_XML($pageownerID);
- echo dispatchRender("xsl/$xsl_file", $xml_str, NULL, $pageargs);
Add Comment
Please, Sign In to add comment