public static function Delete($id) { global $db_connection; global $link_to_text_part_images; $txt_part = TextPart::FetchByID($id); $langs = $txt_part->FetchLanguages(); $from_table = TextPart::$table; if ($txt_part->language !== 'rus') { $from_table .= '_' . $txt_part->language; } if (!$db_connection->query("DELETE FROM `" . $from_table . "` WHERE `id` = " . $id)) { return 0; } else { if (count($langs) < 2) { removeDirectory($link_to_text_part_images . $id); } return 1; } }
$content .= '<script>'; $content .= 'CKEDITOR.replace("text_block",'; $content .= '{ filebrowserImageUploadUrl: "' . $link_to_img_upload . '?type=' . TextPart::$type . '&id=' . $id . '&add=add&glob_id=' . $text_part->GetID() . '",'; $content .= 'filebrowserImageBrowseUrl : "' . $link_to_img_browse . '?type=' . TextPart::$type . '&id=' . $text_part->GetID() . '&edit=edit",'; $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>'; $title = Language::Word('language adding'); $header = $title; } } else { if (!isset($_REQUEST['id'])) { echo 'user id is unset'; exit; } $text_part = TextPart::FetchByID($_REQUEST['id']); $title = ''; $header = ''; $content = ''; $title = Language::Word('text block'); $header = htmlspecialchars($text_part->GetName()); $content = $text_part->ToHTMLAutoFull(GetUserPrivileges()); } } } include_once $link_to_admin_template;
} break; case Project::$type: $project = Project::FetchByID($_POST['id']); if ($project === NULL) { break; } $project->FetchFromAssocEditing($_POST); if ($project->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 TextPart::$type: $txt_part = TextPart::FetchByID($_POST['id']); if ($txt_part === NULL) { break; } $txt_part->FetchFromAssocEditing($_POST); if ($txt_part->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; default: # code... break; } require_once $link_to_admin_template;