public static function Delete($id) { global $db_connection; global $link_to_users_images; $usr_blck = UserBlock::FetchByID($id); $langs = $usr_blck->FetchLanguages(); $from_table = UserBlock::$table; if ($usr_blck->language !== 'rus') { $from_table .= '_' . $usr_blck->language; } $author_id = $usr_blck->author_id; if (!$db_connection->query("DELETE FROM `" . $from_table . "` WHERE `id` = " . $id)) { echo $db_connection->error; return 0; } else { if (count($langs) < 2) { removeDirectory($link_to_users_images . $author_id . '/blocks/' . $id); } return 1; } }
$content .= 'filebrowserImageBrowseUrl : "' . $link_to_img_browse . '?' . http_build_query($assoc) . '",'; $content .= 'contentsCss: [CKEDITOR.basePath + "contents.css", "css/styles.css", "css/bootstrap.min.css"],'; $content .= 'allowedContent: true, });'; $content .= 'CKEDITOR.config.height = 400;'; $content .= '</script>'; $content .= '<div class="row">'; $content .= '<input type="submit" class="btn btn-primary btn-lg" name="add" value="' . Language::Word('save') . '">'; $content .= '</div>'; $content .= '</form>'; } } else { if (!isset($_REQUEST['full'])) { echo 'action_type is unset. Must be "full"'; exit; } if (!isset($_REQUEST['type'])) { echo 'object type is unset. Must be "user"'; exit; } if (!isset($_REQUEST['id'])) { echo 'user id is unset'; exit; } $user_block = UserBlock::FetchByID($_REQUEST['id']); $title = Language::Word('user block'); $header = htmlspecialchars($user_block->name); $content = $user_block->ToHTMLAutoFull(GetUserPrivileges()); } } } include_once $link_to_admin_template;
case User::$type: $user = User::FetchBy(['eq_conds' => ['id' => $_POST['id']], 'is_unique' => true]); if ($user->FetchFromAssocEditing($_POST) < 0) { $content .= AlertMessage('alert-warning', Language::Word('user was not changed')); } if ($user->Save() === false) { $content .= AlertMessage('alert-danger', Language::Word('it was not succeeded to save')); } else { $content .= AlertMessage('alert-success', Language::Word('changes are saved')); if ($user->FetchPhotoFromAssocEditing($_FILES) < 0) { $content .= AlertMessage('alert-warning', Language::Word('photo was not uploaded')); } } break; case UserBlock::$type: $block = UserBlock::FetchByID($_POST['id']); if ($block === NULL) { break; } $block->FetchFromAssocEditing($_POST); if ($block->Save() === false) { $content .= AlertMessage('alert-danger', Language::Word('it was not succeeded to save')); } else { $content .= AlertMessage('alert-success', Language::Word('changes are saved')); } break; case Article::$type: $ob = Article::FetchBy(['eq_conds' => array('id' => $_POST['id']), 'is_unique' => true]); if ($ob === NULL) { break; }