//	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);
    $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";
/*****
 // Got a marker? Oh boy.
 if ($val['marker_id'] && $val['marker_id'] > 0) {
     // Add the marker-removal link.
     $marker_link->query("delete_marker_id={$val['marker_id']}");
     $marker->setID($val['marker_id']);
     $marker->getMarkerInfo();
     // Emphasize top-tier markers with a <strong> element.
     if ($marker->markerInfo['marker_type_id'] == 1) {
         $marker_type = '<strong>' . $marker_type_list[1]['title'] . '</strong>';
     } else {
         $marker_type = $marker_type_list[$marker->markerInfo['marker_type_id']]['title'];
     }
     $link->url('marker.view.php?marker_id=' . $val['marker_id']);
     $link->title('Check out this marker');
     $link->tap($marker->markerInfo['title']);
     $this_marker = $marker_link->icon_link('remove') . $marker_type . ': ' . $link->paint();
 } elseif ($marker_type_list) {
     $link->url('book.view.php?new_marker_on=' . $val['id']);
     $link->title('Mark a new section on page ' . number_format($val['sort_order']) . ' that continues to the next marker.');
     //				$link-> tap('<span style="color:#bbb">add marker</span>');
     $link->icon_link('new');
     $this_marker = $link->paint();
 } else {
     $this_marker = '';
 }
 // We’re done with the marker data for this item in the list. Whew.
 // Simple edit-this-page link.
 $link->url('book.page-edit.php?page_id=' . $val['id']);
 $link->title('Edit page ' . number_format($val['sort_order']) . '.');
 $link->tap($title);
 // Assemble the list item.
            $link->query('adboxid=' . $val['source_rel_id']);
            //			$link-> tap('View'.' '.fa('external'));
            if ($val['width'] && $val['height']) {
                $dimensions = $val['width'] . ' &times; ' . $val['height'];
            } else {
                $dimensions = '(unknown dimensions)';
            }
            $wonderful_ad_list_content[] = array($image->paint(), $val['title'], $size . '<br/>' . $dimensions, $link->icon_link());
        }
    }
}
$link->url('?update_wonderful&amp;current_group=panel-wonderful');
$link->tap('Get the latest data');
$link->title('Download ad information from your PW account to Grawix. Do this any time you finish making changes at Project Wonderful.');
$wonderful_refresh_output = '<br/><h3>Refresh ad data</h3>' . "\n";
$wonderful_refresh_output .= '<p>Have you changed your bids at Project Wonderful? ' . $link->paint() . '.</p>' . "\n";
$link->tap('Project Wonderful');
$link->url('https://www.projectwonderful.com');
$link->title('Visit this advertising service’s website.');
$wonderful_info_output .= '<br/><form accept-charset="UTF-8" action="ad.list.php" method="post">' . "\n";
$wonderful_info_output .= '<p><label for="wonderful_id" class="instructions">Enter your ' . $link->paint() . ' account ID, or leave blank if you’re not a member.</label>' . "\n";
$wonderful_info_output .= '<input type="text" name="wonderful_id" id="wonderful_id" size="4" style="width:5rem;" value="' . $wonderful_third_data['user_info'] . '"/>' . "\n";
$wonderful_info_output .= '<button class="btn primary save" name="submit" type="submit" value="save"><i></i>Save</button></p><br/>&nbsp;' . "\n";
$wonderful_info_output .= '</form>' . "\n";
$list->content($wonderful_ad_list_content);
$wonderful_ad_list_output .= $list->format_headings();
$wonderful_ad_list_output .= $list->format_content();
///////// Build the Google Adsense panel.
if ($ad_list) {
    $link->url('ad.adsense-edit.php');
    $edit_link->url('ad.adsense-edit.php');
function image_weight_test($root_folder, $root_list, $image_status_list)
{
    $link = new GrlxLinkStyle();
    $fileops = new GrlxFileOps();
    $allowed_extension = array('gif', 'png', 'jpg', 'svg');
    $overall_status = 0;
    if ($root_list) {
        foreach ($root_list as $key => $val) {
            $folder_list[$root_folder . '/' . $val] = $fileops->get_dir_list($root_folder . '/' . $val);
        }
    }
    if ($folder_list) {
        foreach ($folder_list as $folder => $set) {
            if ($set) {
                foreach ($set as $filename) {
                    $ext = substr($filename, -3, 3);
                    if (in_array($ext, $allowed_extension)) {
                        $image_info = getimagesize($folder . '/' . $filename);
                        $image_bytes = filesize($folder . '/' . $filename);
                        $result = figure_pixel_weight($image_info[0], $image_info[1], $image_bytes);
                        $short = round($result, 3);
                        $status = interpret_image_weight($result);
                        if ($status > $overall_status) {
                            $overall_status = $status;
                        }
                        $pad = $result * 1000;
                        $status = $image_status_list[$status];
                        if (strlen($filename) > 20) {
                            $abbr = substr($filename, 0, 15) . '…';
                        } else {
                            $abbr = $filename;
                        }
                        $image_bytes = number_format($image_bytes);
                        $link->url = "{$folder}/{$filename}";
                        $link->tap = $abbr;
                        $this_link = $link->paint();
                        $output .= <<<EOL
<p>
\t<span style="background:{$status['0']};padding-right:{$pad}px;">&nbsp;</span><br/><strong>{$short} bytes / pixel</strong> <small>({$image_bytes} b / {$image_info['0']} &times; {$image_info['1']} px)</small> {$this_link}
</p>

EOL;
                    }
                }
            }
        }
    }
    return array($output, $overall_status);
}
} 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');
 * 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";
                        $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;
        $tooltip = '<span data-tooltip aria-haspopup="true" class="info has-tip" title="' . $ga_info['description'] . '"><i></i></span>';
        $form->input_text($ga_info['label'] . '[' . $ga_info['id'] . ']' . '[user_info]');
        $form->label($ga_info['title'] . '<br/>' . $ga_info['info_title'] . $tooltip);
        $form->required(false);
        $form->value($ga_info['user_info']);
        $form->maxlength(32);
        $form_output .= $form->paint();
    }
    $form_output .= $form->form_buttons();
} else {
    $message = new GrlxAlert();
    $result_1 = $db->get('milieu', null, 'id');
    if ($db->count == 0) {
        $link->url('mailto:grawlixcomix@gmail.com');
        $link->tap('Contact support');
        $alert_output .= $message->alert_dialog('Site milieu table is empty. That’s bad. ' . $link->paint() . '.');
    }
    $result_2 = $db->get('milieu_group', null, 'id');
    if ($db->count == 0) {
        $link->url('mailto:grawlixcomix@gmail.com');
        $link->tap('Contact support');
        $alert_output .= $message->alert_dialog('Site milieu <em>group</em> table is empty. That’s really bad. ' . $link->paint() . '.');
    }
}
// Get default book id
$book = new GrlxComicBook();
$book_id = $book->bookID;
$book_title = $book->info['title'];
// Get static home page id
$result = $db->where('title', 'Home')->getOne('static_page', 'id');
$static_id = $result['id'];
示例#10
0
if ($promo_content) {
    $list->content($promo_content);
    $ad_list_output = '<form accept-charset="UTF-8" action="ad.list.php" method="get">' . "\n";
    $ad_list_output .= $list->format_headings();
    $ad_list_output .= $list->format_content();
    $ad_list_output .= '</form>' . "\n";
} else {
    $link->url('ad.promo-create.php');
    $link->tap('Create one now');
    $ad_list_output = $message->info_dialog('Huh. Looks like you haven’t uploaded any ads. ' . $link->paint() . '.');
}
$link = new GrlxLinkStyle();
$link->url = 'ad.promo-create.php';
$link->tap = 'Create a new house ad';
$link->title = 'Enter a new promo';
$ad_list_output .= $link->paint();
///////// Display the slots.
// Get all slots for this theme.
$slot_list = get_slots(1, 'ad', $db);
// No slots? Create one.
if (!$slot_list) {
    $data = array();
    // reset
    $data['title'] = 'Slot 1';
    $data['label'] = 'default';
    $data['theme_id'] = '1';
    $data['max_width'] = '101';
    $data['max_height'] = '101';
    $data['type'] = 'ad';
    $new_slot_id = $db->insert('theme_slot', $data);
    // Get all slots for this theme.
            $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;
        }
    }
}
if ($change_made == true) {
    $link->title = 'Go back to the screen with all your site’s ads.';
    $link->url = 'ad.list.php';
    $link->tap = 'Return to the ad list';
    $alert_output = $message->success_dialog('Ads reassigned. ' . $link->paint());
}
/*****
 * Display logic
 */
if ($slot_id) {
    // Get basic information about this slot.
    $slot_info = get_slot_info($slot_id, $db);
    // What ads are in this slot?
    $match_list = get_ad_slot_matches($slot_id, null, $db);
}
// What ads might fit into this slot?
if ($slot_info) {
    //	$possible_ad_list = $db->where('large_width', $slot_info['max_width'],'<=')
    //	->where('large_height', $slot_info['max_height'],'<=')
    $possible_ad_list = $db->get('ad_reference', null, 'id,title,source_id,source_rel_id,large_width,large_height,large_image_url,code');
Title: <input type="text" name="new-marker-title" id="new-marker-title" value="" style="width:20rem" width="40" /><br/>
<button class="btn primary new" name="new-marker" type="submit"value="add-marker"><i></i>Add marker(s)</button>

EOL;
/*
$delete_marker_output = <<<EOL
<button class="btn secondary delete" name="delete-marker" type="submit" value="delete-marker"><i></i>Remove marker(s)</button>

EOL;
*/
$link->url('book.pages-create.php');
$link->tap('bulk importer');
$new_upload_field = '<input name="file[]" id="file" type="file" multiple /><br/>';
$new_upload_field .= '<button class="btn primary new" name="new-pages" type="submit" value="new-pages"><i></i>Add pages</button>';
$new_upload_field .= '<br/>&nbsp;<p>' . number_format($fileops->up_get_max_size()) . ' bytes max file size. (Recommended max: 100,000 bytes per image.) The server can accept up to ' . $fileops->up_get_max_file_uploads() . ' images at a time.</p>' . "\n";
$new_upload_field .= '<p>Uploading more than ' . $fileops->up_get_max_file_uploads() . ' images? Try the ' . $link->paint() . '.</p>';
$type = $marker_type_list[$marker->markerInfo['marker_type_id']]['title'];
$type ? $type : ($type = 'Marker');
$view->page_title($type . ': ' . $marker->markerInfo['title']);
$view->tooltype('page');
$view->headline($type . ' <span>' . $marker->markerInfo['title'] . '</span>');
$link->url('marker.edit.php?marker_id=' . $marker->markerID);
$link->tap('Edit ' . $marker_type_list[$marker->markerInfo['marker_type_id']]['title'] . ' info');
$link->reveal(true);
$action_output = $link->text_link('editmeta');
/////// Add later
/*
$link->url('marker.create.php?at_page='.$first_page_id);
$link->tap('Insert marker');
$link->reveal(false);
$action_output .= $link->button_secondary('new');
if ($page_id && $_POST) {
    $data = array('title' => $new_page_name, 'date_modified' => $db->NOW());
    $db->where('id', $page_id);
    $success = $db->update('book_page', $data);
    if ($_POST['image_description']) {
        foreach ($_POST['image_description'] as $key => $val) {
            $data = array('description' => $val, 'date_modified' => $db->NOW());
            $db->where('id', $key);
            $success = $db->update('image_reference', $data);
        }
    }
    $db->where('id', $page_id);
    $success = $db->update('book_page', $data);
    $link1->url('book.view.php');
    $link1->tap('Return to the page list');
    $go_return_link = $link1->paint();
    $db->where('id', $page_id);
    $current_order = $db->getOne('book_page', 'sort_order');
    $db->where('sort_order', $current_order['sort_order'], '>');
    $db->orderBy('sort_order', 'ASC');
    $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>
$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.