$_POST['left'], 'middle'=>$_POST['middle'], 'right'=>$_POST['right'] ); ModuleSetting::save_setting($_SESSION['user']['id'], PAGE_EDIT_PROFILE, $new_settings_data); } $setting_data = ModuleSetting::load_setting(PAGE_EDIT_PROFILE, $login_uid); if($_POST) { /* Function for Filtering the POST data Array */ filter_all_post(&$_POST); } if (isset($_POST['submit']) && ($_POST['profile_type'] == 'basic')) { $first_name = trim($_POST['first_name']); $last_name = trim($_POST['last_name']); $email_address = trim($_POST['email_address']); $pass = trim($_POST['pass']); $conpass = trim($_POST['conpass']); $zipcode = trim($_POST['zip_code']); if (empty($first_name)) { $msg = "Fields marked with * can not be empty, First name can not be empty."; $error_first_name = TRUE; $error = TRUE; } else if (empty($email_address)) { $msg = "Fields marked with * can not be empty, Email field is mandatory."; $error_email = TRUE; $error = TRUE; } else if (!empty($zipcode) && is_numeric($zipcode) == FALSE) { $msg = "Zipcode must be in numeric characters."; $error_zipcode = TRUE; $error = TRUE; } else { if ((!empty($pass) && $pass != $conpass) || (!empty($conpass) && $pass != $conpass)) { $msg = "Error: Passwords do not match."; $error_password_conf = TRUE; $error = TRUE; } if (!empty($pass) && strlen($pass) > 15) { $msg = "The password must be less than 15 characters."; $error_password_l = TRUE; $error = TRUE; } if (!empty($pass) && strlen($pass) <5) { $msg = "The password must be greater than 5 characters."; $error_password_g = TRUE; $error = TRUE; } } $array_of_errors = array("error_first_name"=>$error_first_name, "error_email"=>$error_email, "error_password_conf"=>$error_password_conf, "error_password_l"=>$error_password_l, "error_password_g"=>$error_password_g, "error_zipcode"=>$error_zipcode); if ($error != TRUE) { $user = new User(); $user->load($login_uid); if (!empty($pass)) { $user->password = md5($pass); } $user->first_name = $first_name; $user->last_name = $last_name; $user->email = $email_address; $user->zipcode = $zipcode; if (!empty($_FILES['userfile']['name'])) { $uploadfile = $uploaddir.basename($_FILES['userfile']['name']); $myUploadobj = new FileUploader; //creating instance of file. $image_type = 'image'; $file = $myUploadobj->upload_file($uploaddir,'userfile',true,true,$image_type); if( $file == false) { $msg = $myUploadobj->error; $error = TRUE; } else { $user->picture = $file; } } try { $user->save(); // editing data in user profile data also -- for searching making more easier $data_array = array(0 => array('uid'=>$user->user_id, 'name'=>'first_name', 'value'=>"$user->first_name", 'type'=>BASIC, 'perm'=>1), 1 => array('uid'=>$user->user_id, 'name'=>'last_name', 'value'=>"$user->last_name", 'type'=>BASIC, 'perm'=>1)); $user->save_user_profile($data_array, BASIC); $_SESSION['user']['first_name'] = $first_name; $_SESSION['user']['last_name'] = $last_name; } catch (PAException $e) { $msg = "$e->message"; $save_error = TRUE; } } if ($error == TRUE || $save_error == TRUE) { //print $msg; exit; $msg = 'Sorry: you are unable to save data.
Reason: '."$msg"; } else { // invalidate the cache for user profile /* $user_id = $_SESSION['user']['id']; $file = "$current_theme_path/user_profile.tpl?uid=$user_id"; CachedTemplate::invalidate_cache($file);*/ header("Location: edit_profile.php?tier_one=mypage&tier_two=edit_profile&updated=1"); } } // general data -- start // user general info $user_data_general = array(); $user_generaldata = User::load_user_profile($login_uid, $login_uid, GENERAL); for ($i=0; $i'; print_r($_POST); exit; $information_type = GENERAL; $field = array('dob', 'sex', 'country', 'state', 'city', 'blog_url', 'blog_title', 'flickr', 'delicious', 'user_caption', 'sub_caption', 'user_tags', 'user_caption_image', 'postal_code','outputthis_username','outputthis_password'); $day = trim($_POST['day']); $month = trim($_POST['month']); $year = trim($_POST['year']); $outputthis_username = trim($_POST['outputthis_username']); $outputthis_password = trim($_POST['outputthis_password']); $birthdate = "$day-$month-$year"; if ($_POST['day'] && $_POST['month'] && $_POST['year'] && $_POST['day']!=0 && $_POST['month']!=0) { $dob = mktime(0, 0, 0, $month, $day, $year); } else { $dob = ''; } $sex = trim($_POST['sex']); if ($_POST['postal_code']) { $postal_code = trim($_POST['postal_code']); } if ($_POST['country']) { $country = trim($_POST['country']); } if (!empty($_POST['state']) && $_POST['state'] != 'Other') { $state = trim($_POST['state']); } else if(!empty($_POST['state_other'])) { $state = trim($_POST['state_other']); } $city = trim($_POST['city']); $blog_url = trim($_POST['blog_url']); if ($_POST['blog_title']) { $blog_title = trim($_POST['blog_title']); } if ($_POST['flickr']) { $flickr = trim($_POST['flickr']); } if ($_POST['delicious']) { $delicious = trim($_POST['delicious']); } if ($_POST['user_caption']) { $user_caption = trim($_POST['user_caption']); } if ($_POST['sub_caption']) { $sub_caption = trim($_POST['sub_caption']); } if ($_POST['user_tags']) { $user_tags = trim($_POST['user_tags']); } // TO DO: This is to add flick and Delicious blocks on the user page if Flickr Module does not already exist if ($_POST['flickr'] || $_POST['delicious']) { $setting_data_user = ModuleSetting::load_setting(PAGE_USER_PRIVATE, $_SESSION['user']['id']); if ($_POST['flickr']) { if ((array_search('FlickrModule', $setting_data_user['right'])== NULL) && (array_search('FlickrModule', $setting_data_user['left'])== NULL)) { array_push($setting_data_user['right'], 'FlickrModule'); } } if ($_POST['delicious']) { if ((array_search('LinkModule', $setting_data_user['right'])== NULL) && (array_search('LinkModule', $setting_data_user['left'])== NULL)) { array_push($setting_data_user['right'], 'LinkModule'); } } $_POST['user_caption_image_perm'] = 1; $new_settings_data = $setting_data_user; ModuleSetting::save_setting($_SESSION['user']['id'], PAGE_USER_PRIVATE, $new_settings_data); } if (!empty($_FILES['user_caption_image']['name'])) { $uploadfile = $uploaddir.basename($_FILES['user_caption_image']['name']); $myUploadobj = new FileUploader; //creating instance of file. $image_type = 'image'; $file = $myUploadobj->upload_file($uploaddir,'user_caption_image',true,true,$image_type); if( $file == false) { $msg = $myUploadobj->error; $error = TRUE; } else { $user_caption_image = $file; } } else { $user_caption_image = $user_data_general['user_caption_image']; } if ((!empty($day) || !empty($month) || !empty($year)) && (empty($day) || empty($month) || empty($year))){ $msg = "Bitrthday field given is wrong, please fill valid date."; $error = TRUE; } if (($_POST['month']) && ($_POST['day']) && ($_POST['year'])) { $dob_validation = checkdate ($_POST['month'], $_POST['day'], $_POST['year']); } if ((($_POST['month']) || ($_POST['day']) || ($_POST['year'])) && $dob_validation == '0') { $msg = "The Date of Birth is invalid."; $error = TRUE; } if ($error != TRUE) { if (!empty($blog_url)) { if (!strstr($blog_url, "http://")) { $blog_url = "http://".$blog_url; } } $tags = explode(',', $_POST['user_tags']); foreach ($tags as $term) { $tr = trim($term); if ($tr) { $terms[] = $tr; } } //here we can define fields which has permission to everybody $permission_all = array('user_caption_image'); for ($i=0; $i'; print_r($array_user_data); exit; try { $user->save_user_profile($array_user_data, $information_type); //$user->save(); Tag::add_tags_to_user($user->user_id, $terms); } catch (PAException $e) { $msg = "$e->message"; $save_error = TRUE; } } if ($error == TRUE || $save_error == TRUE) { $msg = 'Sorry: you are unable to save data.
Reason: '."$msg"; } else { // invalidate the cache for user profile header("Location: edit_profile.php?tier_one=mypage&tier_two=edit_profile&type=general&updated=1"); } } $user_picture = $user->picture; if ($user->picture) { $img_path = $base_url."/files/".$user->picture; } else { $img_path = $base_url."/images/default.jpg"; } $user_data = array(); $user_generaldata = User::load_user_profile($login_uid, $login_uid, GENERAL); for ($i=0; $isave_user_profile($array_user_data, $information_type); } catch (PAException $e) { $msg = "$e->message"; $save_error = TRUE; } if ($save_error == TRUE) { $msg1 = "Sorry: you are unable to save data.
Reason: ".$msg; } else { header("Location: edit_profile.php?tier_one=mypage&tier_two=edit_profile&type=personal&updated=1"); } } $user_personaldata = User::load_user_profile($login_uid, $login_uid, PERSONAL); for ($i=0; $iupload_file($uploaddir,'user_cv',true,true,$file_type); if( $file == false) { $msg_pro = $myUploadobj->error; $error = TRUE; } else { $user_cv = $file; $_POST['user_cv'] = $user_cv; } } else { $user_cv = $user_professional_data['user_cv']; $_POST['user_cv'] = $user_cv; } for ($i=0; $isave_user_profile($array_user_data, $information_type); } catch (PAException $e) { $msg_pro = "$e->message"; $save_error = TRUE; } } if ($save_error == TRUE || $error == TRUE) { $msg2 = "Sorry: you are unable to save data.
Reason: ".$msg_pro; } else { header("Location: edit_profile.php?tier_one=mypage&tier_two=edit_profile&type=professional&updated=1"); } } $user_professionaldata = User::load_user_profile($login_uid, $login_uid, PROFESSIONAL); for ($i=0; $iload($login_uid); $login_name = $user->login_name; $first_name = $user->first_name; $last_name = $user->last_name; $email = $user->email; $zipcode = $user->zipcode; $user_picture = $user->picture; function setup_module($column, $moduleName, $obj) { global $setting_data, $login_uid, $flickr_id, $delicious_id; global $msg, $onload , $msg2, $array_of_errors, $login_name, $first_name, $last_name, $email, $zipcode, $user_picture, $user_data, $user_personal_data, $user_professional_data; switch ($column) { case 'left': $obj->mode = PRI; if ( $moduleName == 'EnableModule' ) { $obj->setting_data = $setting_data; $obj->Paging['show'] = 5 ; } if ($moduleName=='MyGroupsModule') { $obj->block_type = 'usergroups'; $obj->title = 'My Groups'; $obj->uid = $login_uid; } if (($moduleName=='FlickrModule') && empty($flickr_id)) { return "skip"; } if (($moduleName=='LinkModule') && empty($delicious_id)) { return "skip"; } $obj->uid = $login_uid; break; case 'middle': $obj->content_id = $_REQUEST['cid']; $obj->mode = PRI; $obj->uid = $login_uid; $obj->orientation = CENTER; if ($moduleName == 'EditProfileModule') { $obj->array_of_errors = $array_of_errors; $obj->onload = $onload; $obj->login_name = $login_name; $obj->first_name = $first_name; $obj->last_name = $last_name; $obj->email = $email; $obj->zipcode = $zipcode; $obj->user_picture = $user_picture; $obj->user_data = $user_data; $obj->user_personal_data = $user_personal_data; $obj->user_professional_data = $user_professional_data; } break; case 'right': $obj->mode = PRI; if ($moduleName=='UserPhotoModule') { $obj->block_type = 'UserPhotoBlock'; $obj->picture = $user_picture; } if ($moduleName=='InRelationModule') { $obj->uid = $login_uid; } if ($moduleName=='RecentCommentsModule') { $obj->title = 'My Recent Comments'; $obj->block_type = 'usercomments'; $obj->uid = $login_uid; } if ($moduleName=='FlickrModule') { $obj->block_type = 'UserPhotoBlock'; $obj->flickr_id = $flickr_id; } if ($moduleName=='LinkModule') { $obj->block_type = 'UserPhotoBlock'; $obj->delicious_id = $delicious_id; $obj->title = 'Delicious'; } if ($moduleName != 'AdsByGoogleModule') { //$obj->block_type = HOMEPAGE; } if (($moduleName=='FlickrModule') && empty($flickr_id)) { return "skip"; } if (($moduleName=='LinkModule') && empty($delicious_id)) { return "skip"; } break; } } $page = new PageRenderer("setup_module", PAGE_EDIT_PROFILE, "Edit your profile - PeopleAggregator", "edit_profile_pa.tpl", "header.tpl", NULL, PRI ,$network_info); if ( $_GET['updated'] == 1) { $uploaded_msg = " Profile updated successfully"; $msg_tpl = & new Template(CURRENT_THEME_FSPATH."/display_message.tpl"); $msg_tpl->set('message', $uploaded_msg); $m = $msg_tpl->fetch(); $page->add_module("middle", "top", $m); } if ( !empty($msg) || !empty($msg1) || !empty($msg2)) { $uploaded_msg = " Profile updated successfully"; $msg_tpl = & new Template(CURRENT_THEME_FSPATH."/display_message.tpl"); $msg_tpl->set('message', $msg.$msg1.$msg2); $m = $msg_tpl->fetch(); $page->add_module("middle", "top", $m); } // $page = new PageRenderer("setup_module", PAGE_EDIT_PROFILE, "Edit your profile - PeopleAggregator", "edit_profile_pa.tpl", "header.tpl", NULL, $network_info); echo $page->render(); ?>