function edit() { global $db; $company = $db->Execute("SELECT * FROM `Obsedb_companies`\n\t\t\t\t\t\tWHERE `id` = '" . $_REQUEST['id'] . "';"); $result = $db->GetRow("SELECT Obsedb_companies.id,Obsedb_companies.title,Obsedb_companies.homepage,Obsedb_companies.description,Obsedb_companies.logo\n\t\t\t\t\tFROM Obsedb_companies\n\t\t\t\t\tWHERE Obsedb_companies.id = " . $_REQUEST[id] . ";"); $formdata = array('field1' => array('type' => 'text', 'title' => 'Title', 'name' => 'title', 'value' => clean($result['title'])), 'field2' => array('type' => 'text', 'title' => 'Homepage', 'name' => 'homepage', 'value' => clean($result['homepage'])), 'field3' => array('type' => 'text', 'title' => 'Logo', 'name' => 'logo', 'value' => clean($result['logo'])), 'field4' => array('type' => 'textarea', 'title' => 'Description', 'name' => 'description', 'value' => clean($result['description'])), 'field5' => array('type' => 'submit', 'title' => 'Save Company')); $hidden = array('id' => $_REQUEST['id']); GenerateForm('companies.php', 'Edit Company', 'edit_confirm', $formdata, $hidden); }
function add() { global $db; $result = $db->Execute("SELECT g.id,g.title,p.title AS `platform` FROM Obsedb_Mods AS g, Obsedb_Mods_sections AS p WHERE g.section = p.id ORDER BY g.title"); $Mods['0'] = 'Select Mod'; while ($row = $result->FetchNextObject()) { $Mods[$row->ID] = stripslashes($row->TITLE) . " (" . stripslashes($row->PLATFORM) . ")"; } $formdata = array('4' => array('type' => 'select', 'title' => 'Mod', 'name' => 'Modid', 'value' => $Mods, 'selected' => $_REQUEST['id']), '1' => array('type' => 'text', 'title' => 'Download Title', 'name' => 'title'), '2' => array('type' => 'text', 'title' => 'Download URL', 'name' => 'download'), '3' => array('type' => 'submit', 'title' => 'Add Download')); $hidden = array('Modid' => $_REQUEST['id']); GenerateForm('downloads.php', 'Add Download', 'add_download_confirm', $formdata, $hidden); }
$db->Execute($sql); echo '<center>Link has been successfully added, <a href="links.php">click here to continue</a>.</center>'; } if ($_REQUEST['do'] == 'edit_link_confirm') { $rs = $db->Execute("SELECT * FROM `Obsedb_links` WHERE `id` = '{$_REQUEST['id']}'"); $record = array('title' => $_REQUEST['title'], 'url' => $_REQUEST['url'], 'section' => $_REQUEST['section']); $sql = $db->GetUpdateSQL($rs, $record); $db->Execute($sql); SPMessage('Success: Link has been updated.', 'links.php'); } if ($_REQUEST['do'] == 'Edit Link') { $link = $db->Execute("SELECT * FROM `Obsedb_links` WHERE `id` = '" . $_REQUEST['id'] . "'"); $sections = FetchSections('Obsedb_links_sections'); $fields = array('title' => array('type' => 'text', 'title' => 'Title', 'name' => 'title', 'value' => clean($link->fields['title'])), 'url' => array('type' => 'text', 'title' => 'URL', 'name' => 'url', 'value' => clean($link->fields['url'])), 'section' => array('type' => 'select', 'title' => 'Section', name => 'section', 'value' => $sections, 'selected' => $link->fields['section']), 'submit' => array('type' => 'submit', 'title' => 'Save Link')); $hidden = array('id' => $_REQUEST['id']); GenerateForm('links.php', 'Edit Link', 'edit_link_confirm', $fields, $hidden); } if ($_REQUEST['do'] == 'add_section') { do_form_header('links.php'); do_table_header("Add Section"); do_text_row("Title", "title"); do_submit_row(); echo '<input type="hidden" name="do" value="add_section_confirm">'; do_table_footer(); echo '</form>'; } if ($_REQUEST['do'] == 'Edit Section') { $section = $db->Execute("SELECT * FROM `Obsedb_links_sections` WHERE `id` = '{$_REQUEST['id']}'"); do_form_header('links.php'); do_table_header("Edit Section"); do_text_row("Title", "title", clean($section->fields['title']));
do_table_footer(); } } if ($_REQUEST['do'] == 'Edit Screenshot') { $result = $db->Execute("\n SELECT\n Obsedb_screenshots.id, Obsedb_screenshots.title, Obsedb_screenshots.section, Obsedb_screenshots.thumb, Obsedb_screenshots.screen\n FROM\n Obsedb_screenshots\n WHERE\n Obsedb_screenshots.id = {$_REQUEST['id']}"); $sections = FetchSections('Obsedb_screenshots_sections'); foreach ($sections as $key => $value) { if ($key == $result->fields['section']) { $selected = "selected"; } $sectionoptions .= "<option value=\"{$key}\" {$selected}>" . stripslashes($value) . "</option>"; $selected = ""; } $formdata = array('title' => array('type' => 'text', 'title' => 'Title:', 'name' => 'title', 'value' => $result->fields['title']), 'section' => array('type' => 'text', 'title' => 'Section', 'name' => 'section', 'value' => $result->fields['section']), 'thumb' => array('type' => 'text', 'title' => 'Thumbnail URL', 'name' => 'thumb', 'value' => $result->fields['thumb']), 'screen' => array('type' => 'text', 'title' => 'Screenshot URL', 'name' => 'screen', 'value' => $result->fields['screen']), 'submit' => array('type' => 'submit', 'title' => 'Save Screenshot')); $hiddendata = array('id' => $_REQUEST[id]); GenerateForm('screenshots.php', 'Edit Screenshot', 'edit_confirm', $formdata, $hiddendata); do_table_header('More Options'); do_blank_row("<a href=\"screenshots.php?do=Delete Screenshot&id={$_REQUEST['id']}\">Delete Screenshot</a>"); do_blank_row("<a href=\"screenshots.php\">Cancel & return to screenshot manager</a>"); do_table_footer(); } if ($_REQUEST['do'] == 'add_confirm') { $RS = $db->Execute("\n SELECT Obsedb_screenshots.id, Obsedb_screenshots.title, Obsedb_screenshots.thumb, Obsedb_screenshots.screen,\n Obsedb_screenshots.section\n FROM `Obsedb_screenshots`\n WHERE Obsedb_screenshots.id = '0'"); $record = array('title' => $_REQUEST['title'], 'thumb' => $_REQUEST['thumb'], 'screen' => $_REQUEST['screen'], 'section' => $_REQUEST['section']); $sql = $db->GetInsertSQL($RS, $record); $db->Execute($sql); echo '<a href="screenshots.php">Click Here to Continue</a>'; } if ($_REQUEST['do'] == 'edit_confirm') { $RS = $db->Execute("\n SELECT Obsedb_screenshots.id, Obsedb_screenshots.title, Obsedb_screenshots.thumb, Obsedb_screenshots.screen,\n Obsedb_screenshots.section\n FROM `Obsedb_screenshots`\n WHERE Obsedb_screenshots.id = '{$_REQUEST['id']}'"); $record = array('title' => $_REQUEST['title'], 'thumb' => $_REQUEST['thumb'], 'screen' => $_REQUEST['screen'], 'section' => $_REQUEST['section']);
function edit_Mod() { global $db, $LANG; $Mod = $db->Execute("SELECT * FROM `Obsedb_Mods` WHERE `id` = '{$_REQUEST['id']}';"); $row = $Mod->FetchNextObject(); $sections = FetchSections('Obsedb_Mods_sections'); $companies = FetchSections('Obsedb_companies'); $esrb = array('N/A' => 'N/A', 'RP - Rating Pending' => 'RP - Rating Pending', 'EC - Early Childhood' => 'EC - Early Childhood', 'E - Everyone' => 'E - Everyone', 'E10+ - Everyone 10+' => 'E10+ - Everyone 10+', 'T - Teen' => 'T - Teen', 'M - Mature' => 'M - Mature', 'AO - Adults Only' => 'AO - Adults Only'); $coop = array('Unknown' => 'Unknown', 'No' => 'No', 'Yes' => 'Yes'); $form = array('1' => array('type' => 'text', 'title' => $LANG['title'], 'name' => 'title', 'value' => stripslashes($row->TITLE)), '2' => array('type' => 'select', 'title' => $LANG['section'], 'name' => 'section', 'value' => $sections, 'selected' => $row->SECTION), '3' => array('type' => 'select', 'title' => $LANG['developer'], 'name' => 'developer', 'value' => $companies, 'selected' => $row->DEVELOPER), '4' => array('type' => 'select', 'title' => $LANG['publisher'], 'name' => 'publisher', 'value' => $companies, 'selected' => $row->PUBLISHER), '5' => array('type' => 'select', 'title' => $LANG['esrb_rating'], 'name' => 'esrb', 'value' => $esrb, 'selected' => $row->ESRB), '6' => array('type' => 'text', 'title' => $LANG['genre'], 'name' => 'genre', 'value' => stripslashes($row->GENRE)), '7' => array('type' => 'text', 'title' => $LANG['release_date'], 'name' => 'release_date', 'value' => stripslashes($row->RELEASE_DATE)), '8' => array('type' => 'text', 'title' => $LANG['multiplayer'], 'name' => 'multiplayer', 'value' => stripslashes($row->MULTIPLAYER)), '9' => array('type' => 'text', 'title' => $LANG['boxshot'], 'name' => 'boxshot', 'value' => stripslashes($row->BOXSHOT)), '10' => array('type' => 'select', 'title' => $LANG['coop'], 'name' => 'coop', 'value' => $coop, 'selected' => $row->COOP), '11' => array('type' => 'textarea', 'title' => $LANG['description'], 'name' => 'description', 'value' => $row->DESCRIPTION), '12' => array('type' => 'spacer', 'title' => $LANG['minimum']), '13' => array('type' => 'text', 'title' => $LANG['system'], 'name' => 'req_system', 'value' => stripslashes($row->REQ_SYSTEM)), '14' => array('type' => 'text', 'title' => $LANG['ram'], 'name' => 'req_ram', 'value' => stripslashes($row->REQ_RAM)), '15' => array('type' => 'text', 'title' => $LANG['video_memory'], 'name' => 'req_video', 'value' => stripslashes($row->REQ_VIDEO)), '16' => array('type' => 'text', 'title' => $LANG['harddrive'], 'name' => 'req_space', 'value' => stripslashes($row->REQ_SPACE)), '17' => array('type' => 'text', 'title' => $LANG['mouse'], 'name' => 'req_mouse', 'value' => stripslashes($row->REQ_MOUSE)), '18' => array('type' => 'text', 'title' => $LANG['directx'], 'name' => 'req_directx', 'value' => stripslashes($row->REQ_DIRECTX)), '19' => array('type' => 'text', 'title' => $LANG['sound'], 'name' => 'req_sound', 'value' => stripslashes($row->REQ_SOUND)), '20' => array('type' => 'spacer', 'title' => 'Upload Box Art'), '23' => array('type' => 'blank', 'title' => 'This will overwrite your current boxart.'), '21' => array('type' => 'file', 'title' => 'Image', 'name' => 'image'), '22' => array('type' => 'spacer', 'title' => 'Custom Fields')); $result = $db->Execute("SELECT * FROM Obsedb_customfields WHERE module = 'Mods' ORDER BY title;"); while ($row = $result->FetchNextObject()) { $field = $db->Execute("SELECT * FROM Obsedb_Mods_customdata WHERE Modid = {$_REQUEST['id']} AND fieldid = {$row->ID};"); $form[] = array('type' => $row->TYPE, 'title' => $row->TITLE, 'name' => "field{$row->ID}", 'value' => stripslashes($field->fields['value'])); } $form[] = array('type' => 'submit', 'title' => 'Save Mod'); $hidden = array('id' => $_REQUEST['id']); GenerateForm('Mods.php', $LANG['edit_Mod'], 'edit_Mod_confirm', $form, $hidden, 'true'); }