예제 #1
0
     if ($_POST['p1'] != $_POST['p2']) {
         $err = 1;
         $msg = "The passwords do not match!";
     } else {
         $hasher = new \CODOF\Pass(8, false);
         $hash = $hasher->HashPassword($_POST['p1']);
         $arr['pass'] = $hash;
     }
 }
 if (isset($_FILES['user_img']) && !empty($_FILES['user_img']['name'])) {
     $image = $_FILES['user_img'];
     \CODOF\File\Upload::$width = 128;
     \CODOF\File\Upload::$height = 128;
     \CODOF\File\Upload::$resizeImage = true;
     \CODOF\File\Upload::$resizeIconPath = DATA_PATH . PROFILE_ICON_PATH;
     $file_info = \CODOF\File\Upload::do_upload($image, PROFILE_IMG_PATH);
     if (\CODOF\File\Upload::$error) {
         $err = 1;
         $msg = "Error While uploading the image, try with a different image.";
     } else {
         $arr["avatar"] = $file_info["name"];
     }
 }
 $arr['user_status'] = 0;
 if (isset($_POST['user_status'])) {
     $arr['user_status'] = 1;
 }
 //update
 $u = CODOF\User\User::get((int) $_GET['user_id']);
 if ($err == 0) {
     $msg .= "Updates have been applied.";
예제 #2
0
 public function edit_profile($id)
 {
     $edit = \CODOF\User\User::get();
     $id = (int) $id;
     if (!$this->can_edit_profile($id)) {
         $this->view = 'access_denied';
         return false;
     }
     $values = array("name" => \CODOF\Filter::msg_safe($_POST['name']), "signature" => \CODOF\Format::omessage($_POST['signature']));
     $success = true;
     if (isset($_FILES) && $_FILES['avatar']['error'] != UPLOAD_ERR_NO_FILE) {
         $success = false;
         \CODOF\File\Upload::$width = 128;
         \CODOF\File\Upload::$height = 128;
         \CODOF\File\Upload::$resizeImage = true;
         \CODOF\File\Upload::$resizeIconPath = DATA_PATH . PROFILE_ICON_PATH;
         $result = \CODOF\File\Upload::do_upload($_FILES['avatar'], PROFILE_IMG_PATH);
         if (\CODOF\File\Upload::$error) {
             $this->smarty->assign('file_upload_error', $result);
         } else {
             $values["avatar"] = $result['name'];
             $success = true;
         }
     }
     $edited = $edit->set($values);
     if (!$edited) {
         Util::log("Failed to update user details profile/id/edit");
         $success = false;
     }
     $this->smarty->assign('user_profile_edit', $success);
     $this->profile($id, 'edit');
 }