// header('location:ad.list.php'); } // Folder in which we keep ad images. $image_path = $milieu_list['directory']['value'] . '/assets/images/ads'; // List of status levels. $priority_list = array('1' => 'High', '0' => 'Normal', '-1' => 'Hidden'); /***** * Updates */ // Prepare to update the ad’s database record. if ($_POST && $ad_id) { $data = array('code' => $code, 'title' => $title); $db->where('id', $ad_id); $success = $db->update('ad_reference', $data); if ($success == 1) { $alert_output = $message->success_dialog('Add info saved. ' . $link->paint('grlx_ad_list')); } } if ($_POST && !$ad_id) { $data = array('title' => $title, 'code' => $code, 'date_created' => $db->NOW(), 'source_id' => '3'); $ad_id = $db->insert('ad_reference', $data); if ($ad_id > 0) { $alert_output = $message->success_dialog('Add created. ' . $link->paint('grlx_ad_list')); } } /***** * Display logic */ $link->preset('adsense_help'); if ($ad_id) { $ad_info = get_ad_info($ad_id, $db);
$match_id = $_POST['match_id']; $data = array('active' => 1); $db->where('id', $match_id); $db->update('third_match', $data); } // Widget if (is_numeric($_POST['widget_id']) && $_POST['widget_value']) { $widget_id = $_POST['widget_id']; $data = array('active' => 1, 'value' => $_POST['widget_value']); $db->where('id', $widget_id); $db->update('third_widget', $data); } if ($affected_count == 0) { $alert_output = $message->alert_dialog('Edits to data were not saved.'); } else { $alert_output = $message->success_dialog('Your user info has been saved.'); } } // Save comment info if ($_POST['comment_info'] && is_numeric($_POST['service_id'])) { $service_id = $_POST['service_id']; $comment_info = htmlspecialchars(trim($_POST['comment_info']), ENT_COMPAT); // enter id into correct line of data table $data = array('user_info' => $comment_info); $db->where('id', $service_id); if ($db->update('third_service', $data)) { // turn on correct line in match table $data = array('active' => 1); $db->where('function_id', 3); $db->where('service_id', $service_id); $db->update('third_match', $data);
// I made this optional so we don’t override a previously- // uploaded file’s record in the database. if ($check_these) { foreach ($check_these as $key => $val) { if ($upload_status[$key][0] == 'success') { $data[$key . '_image_url'] = $image_path . '/' . basename($_FILES[$key . '_image_url']['name']); } } } // Updates, ho! $db->where('id', $ad_id); $success = $db->update('ad_reference', $data); $link = new GrlxLink('grlx ad list'); if ($success == 1) { $alert = new GrlxAlert(); $alert_output = $alert->success_dialog('Ad info saved. Make changes below or ' . $link->paint() . '.'); } } /***** * Display logic */ if ($ad_id) { $promo_info = get_ad_info($ad_id, $db); } if ($ad_id && $msg == 'created') { $success_message = <<<EOL Ad created. <ul> \t<li>Make changes below</li> \t<li><a href="ad.list.php">Add this ad to a slot in your site’s template</a></li> \t<li><a href="ad.promo-create.php">Make another new ad</a></li>
$current_group = 'panel-wonderful'; } if ($_POST && (!$wonderful_id || $wonderful_id == 0)) { // Zero out the ID. $data = array('user_info' => ''); $db->where('label', 'projectwonderful'); $db->update('third_service', $data); // Set PW to inactive $sql = "UPDATE\n\tgrlx_third_match tm,\n\tgrlx_third_service ts\nSET\n\tactive = 0\nWHERE\n\ttm.service_id = ts.id\n\tAND ts.label = ?\n"; $db->rawQuery($sql, array('projectwonderful')); $current_group = 'panel-wonderful'; } if ($delete_ad_id) { $db->where('id', $delete_ad_id); if ($db->delete('ad_reference')) { $alert_output .= $message->success_dialog('Ad deleted. I’m sorry for your loss.'); } } // Let’s upload some artist-submitted graphics, shall we? $check_these = array('large' => 'large_file'); if ($check_these && $_FILES) { foreach ($check_these as $key => $val) { // Got a new file upload? Then upload it. $upload_status[$key] = upload_specific_file($val, $image_path); $upload_sizes[$key] = getimagesize('..' . $image_path . '/' . basename($_FILES[$val]['name'][0])); $upload_sizes[$key]['url'] = '/assets/images/ads/' . basename($_FILES[$val]['name'][0]); } } if ($upload_sizes) { $data = array(); // reset
$marker_type = new GrlxMarkerType($marker_type_id); } else { header('location:marker-type.list.php'); die; } /***** * Updates */ if ($marker_type_id && $new_title) { $success = $marker_type->saveMarkerType($marker_type_id, $new_title); $marker_type = new GrlxMarkerType($marker_type_id); } if ($success) { $link->url('marker-type.list.php'); $link->tap('Return to the type list'); $alert_output = $message->success_dialog('Marker type saved. ' . $link->paint() . '.'); } /***** * Display logic */ $view->page_title('Marker type: ' . $marker_type->markerTypeInfo['title']); $view->tooltype('chap'); $view->headline('Marker type <span>' . $marker_type->markerTypeInfo['title'] . '</span>'); $content_output .= '<form accept-charset="UTF-8" action="marker-type.edit.php" method="post">' . "\n"; $content_output .= '<input type="hidden" name="marker_type_id" value="' . $marker_type_id . '"/>' . "\n"; $content_output .= '<label for="marker_type_id">This marker type is called:</label>' . "\n"; $content_output .= '<input type="text" name="new_title" size="12" style="width:12rem" value="' . $marker_type->markerTypeInfo['title'] . '"/>' . "\n"; $content_output .= '<button class="btn primary save" name="submit" type="submit" value="save"><i></i>Save</button>' . "\n"; $content_output .= '<input type="hidden" name="marker_type_id" value="' . $marker_type_id . '"/>' . "\n"; $content_output .= '</form>' . "\n"; /*****
* Updates */ if ($publish_frequency && $start_month && $start_day && $start_year && $book_id) { $date_start = $start_year . '-' . $start_month . '-' . $start_day; $data = array('publish_frequency' => $publish_frequency, 'date_start' => $date_start, 'date_modified' => $db->NOW()); $db->where('id', $book_id); $db->update('book', $data); $success = $db->count; set_book_dates($book_id, $publish_frequency, $db); } if ($book && $_POST) { $data = array('title' => $new_title, 'publish_frequency' => $publish_frequency, 'date_modified' => $db->NOW()); $book->saveInfo($data); $link->url('book.view.php?book_id=' . $book_id); $link->tap('Peruse this book’s pages'); $alert_output .= $message->success_dialog('Book info saved. ' . $link->paint() . '.'); } /***** * Display */ if (!is_writable('../' . DIR_COMICS_IMG)) { $alert_output .= $message->alert_dialog('The comics images folder is not writable. Please set ' . DIR_COMICS_IMG . ' to 0777 so I can upload and manage images.'); } if ($book_id) { $book = new GrlxComicBook($book_id); } else { $book = new GrlxComicBook(); $book_id = $book->bookID; } if ($frequency_list) { $publish_frequency_output .= '<select name="publish_frequency" style="width:8rem">' . "\n";
$meta_output .= '<label><input type="checkbox" name="chapter[option][]"' . $check . ' value="' . $info . '"/> ' . $title . '</label>'; } $meta_output .= '</div>'; $meta_output .= '<div>'; $meta_output .= '<h5>Pages</h5>'; foreach ($infoXML->archive['page']['option'] as $info) { $title = ucfirst($info); in_array($info, $xml->meta['page']) ? $check = ' checked="checked"' : ($check = null); $meta_output .= '<label><input type="checkbox" name="page[option][]"' . $check . ' value="' . $info . '"/> ' . $title . '</label>'; } $meta_output .= '</div>'; $meta_output = $form->row_wrap($meta_output); } if ($xml->saveResult == 'success') { $message = new GrlxAlert(); $alert_output = $message->success_dialog('Changes saved.'); } if ($xml->saveResult == 'error') { $message = new GrlxAlert(); $alert_output = $message->alert_dialog('Changes failed to save.'); } /* ! Display * * * * * * * */ $view->page_title('Archives'); $view->tooltype('arcv'); $view->headline('Comic archive editor'); $form->input_hidden('book_id'); $form->value($book_id); $book_info = $form->paint(); $view->group_css('arcv'); $view->group_h2('Behavior'); $view->group_instruction('Select how you want readers to navigate through your archives.');
$new_assignment_id = $comic_image->assignImageToPage($new_image_id, $new_page_id); } $i += 0.0001; } elseif ($success !== false) { $total_success = false; $alert_output .= $message->alert_dialog('I couldn’t import images from ' . $folder . '.'); } } } } } reset_page_order($book_id, $db); if ($i > 1) { $link->url('book.view.php'); $link->tap('Check ’em out'); $alert_output .= $message->success_dialog('Hooray! Images imported. ' . $link->paint() . '.'); } /***** * Display */ // Reset in case of form submission. $folder_list = array(); $file_list = array(); // What’s in the import folder? $import_top_list = $fileops->get_dir_list($import_path); if ($import_top_list) { foreach ($import_top_list as $key => $val) { if (is_dir($import_path . '/' . $val)) { $folder_list[$val] = $import_path . '/' . $val; } else { $file_list[$val] = $import_path . '/' . $val;
} else { header('location:book.view.php'); die; } // ! Updates if ($marker_id && $new_title) { $success = $marker->saveMarker($marker_id, $new_title, $edit_marker_type); $marker = new GrlxMarker($marker_id); // reset } if ($success) { $link1->url('marker.view.php?marker_id=' . $marker_id); $link1->tap('for this marker'); $link2->url('book.view.php'); $link2->tap('the whole book'); $alert_output = $message->success_dialog('Marker saved. Return to the page list ' . $link1->paint() . ' or ' . $link2->paint() . '.'); } elseif ($_POST) { $link1->url('marker.view.php?marker_id=' . $marker_id); $link1->tap('Return to the page list'); $alert_output = $message->alert_dialog('Something went wrong, sorry. ' . $link1->paint() . '.'); } // Is this trip really necessary? /* $marker-> getPageRange(); $range_output = floor($marker-> startPage).'–'.$marker-> endPage; */ // ! Get the marker types // so we can let artists change this marker to a different kind. $db->orderBy('rank', 'ASC'); $marker_type_list = $db->get('marker_type', null, 'id,title,rank'); $marker_type_list = rekey_array($marker_type_list, 'id');
} } // No ad selected? Send ’em back to the list. if (!$slot_id || !is_numeric($slot_id)) { header('location:ad.list.php'); } // List of status levels. $priority_list = array('1' => 'High', '0' => 'Normal', '-1' => 'Hidden'); /***** * Updates */ if ($label && $title && $slot_id) { $data = array('label' => $label, 'title' => $title); $db->where('id', $slot_id); $db->update('theme_slot', $data); $alert_output = $message->success_dialog('Slot data saved.'); } if ($change_from && $slot_id) { $change_made = false; foreach ($change_from as $key => $this_from) { $this_to = $change_to[$key]; if ($this_from == 'off' && $this_to == 'on') { $data = array('ad_reference_id' => $key, 'slot_id' => $slot_id, 'priority' => '1'); $id = $db->insert('ad_slot_match', $data); $change_made = true; } if ($this_from == 'on' && !$this_to) { $db->where('ad_reference_id', $key); $db->where('slot_id', $slot_id); $db->delete('ad_slot_match', null); $change_made = true;
$title = $title[0]; if (strpos($title, '/')) { $title = explode('/', $title); $title = $title[1]; } $new_page_id = $comic_image->createPageRecord($title, $new_order - 1 + $i, $book_id); // $first_page_id ? null : $first_page_id = $new_page_id; // Assign the image to the page. if ($new_image_id && $new_page_id) { $new_assignment_id = $comic_image->assignImageToPage($new_image_id, $new_page_id); } $i += 0.001; } reset_page_order($book_id, $db); if (count($files_uploaded) == 1) { $alert_output .= $message->success_dialog('One image added. Make changes below or <a href="book.view.php">check out all the pages</a>.'); } if (count($files_uploaded) > 1) { $alert_output .= $message->success_dialog(count($files_uploaded) . ' images added. Make changes below or <a href="book.view.php">check out all the pages</a>.'); } } if (!$files_uploaded) { // $alert_output .= $message->alert_dialog('No images added.'); } } /***** * Display logic */ if (!is_writable('../' . DIR_COMICS_IMG)) { $alert_output .= $message->alert_dialog('The comics images folder is not writable.'); }
$next_id = $db->getOne('book_page', 'id'); $link1->url('book.page-edit.php?page_id=' . $next_id['id']); $link1->tap('Go to the next page'); $go_next_link = $link1->paint(); if ($success == 1) { $success_message = <<<EOL Changes to <b>{$new_page_name}</b> were saved. <ul> \t<li>Make more changes below</li> \t<li>{$go_return_link}</li> \t<li>{$go_next_link}</li> </ul> EOL; if ($success || $success1) { $alert_output .= $message->success_dialog($success_message); } } else { $alert_output .= $message->alert_dialog('Unable to save <b>' . $new_page_name . '</b> change.'); } } if ($page_id && $_POST) { $blog_post = htmLawed($blog_post); $transcript = htmLawed($transcript); $data = array('blog_title' => $blog_headline, 'blog_post' => $blog_post, 'transcript' => $transcript, 'date_publish' => $pub_year . '-' . $pub_month . '-' . $pub_day, 'date_modified' => $db->NOW()); $db->where('id', $page_id); $db->update('book_page', $data); } if ($page_id && $remove_id) { $db->where('id', $remove_id); $db->delete('image_match');
if ($db->update('user', $data)) { $alert_output = $message->success_dialog('Changes were saved.'); } else { $alert_output = $message->alert_dialog('Changes failed to save.'); } } } foreach ($_POST['password'] as $key => $val) { if ($val != '') { $val_hash = password_hash($val, PASSWORD_BCRYPT); if (password_verify($val, $val_hash)) { $data = array('password' => $val_hash, 'date_modified' => $db->now()); $db->where('serial', $_SESSION['admin']); $message = new GrlxAlert(); if ($db->update('user', $data)) { $alert_output = $message->success_dialog('New password saved.'); } else { $alert_output = $message->alert_dialog('New password failed to save.'); } } } } } /***** * Display logic */ $db->where('serial', $_SESSION['admin']); $user_list = $db->get('user', null, 'username,email,id'); if ($user_list) { foreach ($user_list as $key => $val) { $form->input_text("username[{$val['id']}]");
$form = new GrlxForm(); $fileops = new GrlxFileOps(); $sl = new GrlxSelectList(); // Make sure the image folder exists and is accessible. $alert_output .= $fileops->check_or_make_dir('../' . DIR_STATIC_IMG); /***** * ! Updates */ // This comes from sttc.xml-new.php. if ($msg == 'created') { $link1 = new GrlxLinkStyle(); $link1->url('sttc.xml-new.php'); $link1->tap('Create another new page'); $link->url('site.nav.php'); $link->tap('Add this page to the site’s menu'); $alert_output .= $message->success_dialog('Page created. <ul><li>Make changes below</li><li>' . $link->paint() . '</li><li>' . $link1->paint() . '</li>'); } // ! Upload images // If the static images’ folder exists (that’s $folder_check), // then loop through the artist-submitted files (if any). if (!$alert_output && $_FILES && $_FILES['item']['name']) { foreach ($_FILES['item']['name'] as $key => $image_file_name) { // Get the image’s official filename. $image_file_name = $image_file_name['image']; // Get the image’s temporary serialized name. $tmp_name = $_FILES['item']['tmp_name'][$key]['image']; // What size and kind of image is this? $type = $_FILES['item']['type'][$key]['image']; // Really oughta check against valid image types. $size = $_FILES['item']['size'][$key]['image']; // Really oughta check against gigantic, multi-meg files.