Exemple #1
0
 function update_user($new_path, $phone_verify, $img_server)
 {
     if (!isset($_POST['show_email'])) {
         $show_email = 0;
     } else {
         $show_email = 1;
     }
     if (!isset($_POST['show_home_phone'])) {
         $show_home_phone = 0;
     } else {
         $show_home_phone = 1;
     }
     if (!isset($_POST['email_alert'])) {
         $email_alert = 0;
     } else {
         $email_alert = 1;
     }
     $id_card = Url::get('id_card');
     if (AZLib::checkBadWord($id_card)) {
         $id_card = '';
     }
     $new_blast = Url::get('blast');
     if (AZLib::checkBadWord($new_blast)) {
         $new_blast = '';
     }
     $new_sign = Url::get('sign');
     if (AZLib::checkBadWord($new_sign)) {
         $new_sign = '';
     }
     $full_name = Url::get('full_name');
     if (AZLib::checkBadWord($full_name)) {
         $full_name = '';
     }
     $address = Url::get('address');
     if (AZLib::checkBadWord($address)) {
         $address = '';
     }
     $home_phone = Url::get('home_phone');
     $home_phone = preg_replace("/[^0-9]/", "", $home_phone);
     if (AZLib::is_mobile($home_phone) || substr($home_phone, 0, 1) != "0") {
         $home_phone = '';
     }
     $fax = Url::get('fax');
     $fax = preg_replace("/[^0-9]/", "", $fax);
     $mobile_phone = Url::get('mobile_phone');
     $mobile_phone = preg_replace("/[^0-9]/", "", $mobile_phone);
     if (!AZLib::is_mobile($mobile_phone)) {
         $mobile_phone = '';
     }
     $website = Url::get('website');
     if (AZLib::checkBadWord($website)) {
         $website = '';
     }
     $yahoo_id = Url::get('yahoo_id');
     if (AZLib::checkBadWord($yahoo_id)) {
         $yahoo_id = '';
     }
     $skype_id = Url::get('skype_id');
     if (AZLib::checkBadWord($skype_id)) {
         $skype_id = '';
     }
     $arr = explode('-', Url::get('birth_day'));
     if (is_numeric($arr['0']) && is_numeric($arr['1']) && is_numeric($arr['2'])) {
         $strBirthDay = $arr['2'] . '-' . $arr['1'] . '-' . $arr['0'];
     } else {
         $strBirthDay = "";
     }
     if ($new_path) {
         $new_row = array('full_name' => trim($full_name), 'address' => trim($address), 'id_card' => $id_card, 'birth_day' => $strBirthDay, 'gender' => intval(Url::get('gender')), 'home_phone' => trim($home_phone), 'fax' => trim($fax), 'mobile_phone' => trim($mobile_phone), 'show_home_phone' => $show_home_phone, 'show_email' => $show_email, 'email_alert' => $email_alert, 'website' => trim($website), 'yahoo_id' => trim($yahoo_id), 'skype_id' => $skype_id, 'blast' => trim($new_blast), 'signature' => trim($new_sign), 'img_server' => $img_server, 'avatar_url' => trim($new_path));
     } else {
         $new_row = array('full_name' => trim($full_name), 'address' => trim($address), 'id_card' => $id_card, 'birth_day' => $strBirthDay, 'gender' => intval(Url::get('gender')), 'home_phone' => trim($home_phone), 'show_home_phone' => $show_home_phone, 'fax' => trim($fax), 'mobile_phone' => trim($mobile_phone), 'show_email' => $show_email, 'email_alert' => $email_alert, 'website' => trim($website), 'yahoo_id' => trim($yahoo_id), 'skype_id' => trim($skype_id), 'blast' => $new_blast, 'signature' => trim($new_sign));
     }
     PersonalDB::update_user_information($new_row);
     if ($new_blast) {
         //blast không trống
         DB::delete("feed", "user_id=" . User::id() . " AND type = 8");
         DB::query("INSERT INTO feed (type, user_id, act_user_id, time)\r\n\t\t\t\t\t\t\t\t\t\tVALUES (8, " . User::id() . ", " . User::id() . ", " . TIME_NOW . ")");
     } else {
         //Xoá blast
         DB::delete("feed", "user_id=" . User::id() . " AND type = 8");
     }
 }