예제 #1
0
 public function FetchFromAssocEditing($assoc)
 {
     if (ArrayElemIsValidStr($assoc, 'link_id')) {
         $this->link_id = $assoc['link_id'];
     }
     if (ArrayElemIsValidStr($assoc, 'name')) {
         $this->name = $assoc['name'];
     }
     if (ArrayElemIsValidStr($assoc, 'priority')) {
         $this->priority = $assoc['priority'];
     }
     if (ArrayElemIsValidStr($assoc, 'role')) {
         $this->role = $assoc['role'];
     }
     if (ArrayElemIsValidStr($assoc, 'text_block')) {
         $this->text_block = $assoc['text_block'];
     }
 }
예제 #2
0
파일: report.php 프로젝트: Gerold103/lgmis
 public function FetchFromAssocEditing($assoc)
 {
     if (ArrayElemIsValidStr($assoc, 'name')) {
         $this->name = $assoc['name'];
     }
     if (ArrayElemIsValidStr($assoc, 'text_block')) {
         $this->text_block = $assoc['text_block'];
     }
     if (ArrayElemIsValidStr($assoc, 'files_count')) {
         $cnt = $assoc['files_count'];
         if ($cnt > 0) {
             global $link_to_report_files;
             global $link_prefix;
             delete_file($link_to_report_files . $this->id . '/file');
             recurse_copy($link_to_report_files . 'tmp_' . GetUserID(), $link_to_report_files . $this->id);
         }
     }
     if (isset($assoc['recipient_ids'])) {
         if (is_string($assoc['recipient_ids'])) {
             if (ArrayElemIsValidStr($assoc, 'recipient_ids')) {
                 $this->recipient_ids = json_decode($assoc['recipient_ids']);
             }
         } else {
             $this->recipient_ids = $assoc['recipient_ids'];
         }
     }
 }
예제 #3
0
 public function FetchFromAssocEditing($assoc)
 {
     if (ArrayElemIsValidStr($assoc, 'name')) {
         $this->name = $assoc['name'];
     }
     if (ArrayElemIsValidStr($assoc, 'text_block')) {
         $this->text_block = $assoc['text_block'];
     }
 }
예제 #4
0
파일: article.php 프로젝트: Gerold103/lgmis
 public function FetchFromAssocEditing($assoc)
 {
     if (ArrayElemIsValidStr($assoc, 'name')) {
         $this->SetName($assoc['name']);
     }
     if (ArrayElemIsValidStr($assoc, 'annotation')) {
         $this->SetAnnotation($assoc['annotation']);
     }
     if (ArrayElemIsValidStr($assoc, 'text_block')) {
         $this->SetTextBlock($assoc['text_block']);
     }
 }
예제 #5
0
 public static function FetchFromAssoc($assoc)
 {
     if (!ArrayElemIsValidStr($assoc, 'name')) {
         RequestOnRegister::$last_error = 'Поле "Имя" не заполнено';
         return NULL;
     }
     if (!ArrayElemIsValidStr($assoc, 'surname')) {
         RequestOnRegister::$last_error = 'Поле "Фамилия" не заполнено';
         return NULL;
     }
     if (!ArrayElemIsValidStr($assoc, 'fathername')) {
         RequestOnRegister::$last_error = 'Поле "Отчество" не заполнено';
         return NULL;
     }
     if (!ArrayElemIsValidStr($assoc, 'login')) {
         RequestOnRegister::$last_error = 'Поле "Логин" не заполнено';
         return NULL;
     }
     if (!ArrayElemIsValidStr($assoc, 'password')) {
         RequestOnRegister::$last_error = 'Поле "Пароль" не заполнено';
         return NULL;
     }
     if (!ArrayElemIsValidStr($assoc, 'email')) {
         RequestOnRegister::$last_error = 'Поле "Email" не заполнено';
         return NULL;
     }
     if (!ArrayElemIsValidStr($assoc, 'telephone')) {
         RequestOnRegister::$last_error = 'Поле "Телефон" не заполнено';
         return NULL;
     }
     $req = new self();
     if (isset($assoc['id']) && strlen($assoc['id'])) {
         $req->id = $assoc['id'];
     } else {
         $req->id = id_undef;
     }
     $req->name = $assoc['name'];
     $req->surname = $assoc['surname'];
     $req->fathername = $assoc['fathername'];
     $req->login = $assoc['login'];
     $req->password = $assoc['password'];
     $req->email = $assoc['email'];
     $req->telephone = $assoc['telephone'];
     if (!isset($assoc['text'])) {
         $req->text = '';
     } else {
         $req->text = $assoc['text'];
     }
     return $req;
 }
예제 #6
0
파일: myfile.php 프로젝트: Gerold103/lgmis
 public static function FetchFromAssoc($assoc)
 {
     $ob = new self();
     if (ArrayElemIsValidStr($assoc, 'id')) {
         $ob->id = $assoc['id'];
     }
     if (ArrayElemIsValidStr($assoc, 'owner_id')) {
         $ob->owner_id = $assoc['owner_id'];
     }
     if (ArrayElemIsValidStr($assoc, 'name')) {
         $ob->name = $assoc['name'];
     }
     if (isset($assoc['is_directory'])) {
         $ob->is_directory = $assoc['is_directory'];
     }
     if (isset($assoc['path_to_file'])) {
         if (is_string($assoc['path_to_file'])) {
             $ob->path_to_file = json_decode($assoc['path_to_file']);
         } else {
             $ob->path_to_file = $assoc['path_to_file'];
         }
     }
     if (ArrayElemIsValidStr($assoc, 'permissions')) {
         $ob->permissions = $assoc['permissions'];
     }
     try {
         if (ArrayElemIsValidStr($assoc, 'creating_date')) {
             $ob->creating_date = strtotime($assoc['creating_date']);
         }
     } catch (Exception $e) {
         $ob->creating_date = $assoc['creating_date'];
     }
     return $ob;
 }
예제 #7
0
파일: user.php 프로젝트: Gerold103/lgmis
 public function FetchFromAssocEditing($assoc)
 {
     if (ArrayElemIsValidStr($assoc, 'name')) {
         $this->name = $assoc['name'];
     }
     if (ArrayElemIsValidStr($assoc, 'surname')) {
         $this->surname = $assoc['surname'];
     }
     if (ArrayElemIsValidStr($assoc, 'fathername')) {
         $this->fathername = $assoc['fathername'];
     }
     if (ArrayElemIsValidStr($assoc, 'login')) {
         $this->login = $assoc['login'];
     }
     if (ArrayElemIsValidStr($assoc, 'position')) {
         $this->position = $assoc['position'];
     }
     if (ArrayElemIsValidStr($assoc, 'email')) {
         $this->email = $assoc['email'];
     }
     if (ArrayElemIsValidStr($assoc, 'telephone')) {
         $this->telephone = $assoc['telephone'];
     }
     if (ArrayElemIsValidStr($assoc, 'birth_day') && ArrayElemIsValidStr($assoc, 'birth_month') && ArrayElemIsValidStr($assoc, 'birth_year')) {
         $this->birthday = strtotime($assoc['birth_month'] . '/' . $assoc['birth_day'] . '/' . $assoc['birth_year']);
     }
     if (ArrayElemIsValidStr($assoc, 'password_old')) {
         if (!password_verify($assoc['password_old'], $this->password)) {
             return -1;
         }
         if (!ArrayElemIsValidStr($assoc, 'password_new1') || !ArrayElemIsValidStr($assoc, 'password_new2') || $assoc['password_new1'] != $assoc['password_new2']) {
             return -1;
         }
         $this->password = password_hash($assoc['password_new1'], PASSWORD_DEFAULT);
     }
 }
예제 #8
0
 public static function FetchFromAssoc($assoc)
 {
     $ob = new self();
     if (ArrayElemIsValidStr($assoc, 'id')) {
         $ob->SetID($assoc['id']);
     }
     if (ArrayElemIsValidStr($assoc, 'author_id')) {
         $ob->SetAuthorID($assoc['author_id']);
     }
     if (ArrayElemIsValidStr($assoc, 'public_link')) {
         $ob->SetPublicLink($assoc['public_link']);
     }
     if (ArrayElemIsValidStr($assoc, 'actual_link')) {
         $ob->SetActualLink($assoc['actual_link']);
     }
     try {
         if (ArrayElemIsValidStr($assoc, 'creating_date')) {
             $ob->SetCreatingDate(strtotime($assoc['creating_date']));
         }
         if (ArrayElemIsValidStr($assoc, 'deleting_date')) {
             $ob->SetDeletingDate(strtotime($assoc['deleting_date']));
         }
     } catch (Exception $e) {
         $ob->SetCreatingDate($assoc['creating_date']);
         $ob->SetDeletingDate($assoc['deleting_date']);
     }
     return $ob;
 }
예제 #9
0
 global $link_prefix;
 $author_id = GetUserID();
 switch ($_REQUEST['type']) {
     case MyFile::$type:
         global $link_to_files_manager_dir;
         $ob_id = $_REQUEST['edit'];
         $file = MyFile::FetchBy(['eq_conds' => ['id' => $ob_id], 'is_unique' => true]);
         if (Error::IsError($file)) {
             $content = json_encode(['error' => Error::ToString($file)]);
             break;
         }
         $old_name = $file->GetName();
         if (ArrayElemIsValidStr($_REQUEST, 'name')) {
             $file->SetName(urlencode($_REQUEST['name']));
         }
         if (ArrayElemIsValidStr($_REQUEST, 'permissions')) {
             $file->SetPermissions($_REQUEST['permissions']);
         }
         if ($old_name != $file->GetName()) {
             $path = $file->GetPathToFileStr();
             if (file_exists($path . $file->GetName())) {
                 $content = json_encode(['error' => 'File ' . $file->GetName() . ' already exists']);
                 break;
             }
             if (!rename($path . $old_name, $path . $file->GetName())) {
                 $content = json_encode(['error' => 'Error while renaming file']);
                 break;
             }
         }
         $rc = $file->Save();
         if (Error::IsError($rc)) {