コード例 #1
0
            } else {
                $sort_order = 1.001;
            }
        }
    }
    // ! Add the page to MySQL.
    $new_page_name ? $new_page_name : ($new_page_name = 'Untitled');
    $blog_post = htmLawed($blog_post);
    $transcript = htmLawed($transcript);
    $data = array('sort_order' => $sort_order, 'title' => $new_page_name, 'book_id' => $book_id, 'tone_id' => $start_tone_id, 'blog_title' => $blog_headline, 'blog_post' => $blog_post, 'transcript' => $transcript, 'date_modified' => $db->NOW(), 'date_publish' => $db->NOW());
    $new_page_id = $db->insert('book_page', $data);
    if ($new_page_id) {
        reset_page_order($book_id, $db);
    }
} elseif ($_POST) {
    $alert_output .= $message->alert_dialog('Huh, I didn’t find any images. Did you select some pics from your computer?');
}
if ($_FILES['file_change'] && $new_page_id) {
    $fileops->up_set_destination_folder('../' . DIR_COMICS_IMG);
    $success = $fileops->up_process('file_change');
    if ($success && $new_page_id) {
        foreach ($success as $filename) {
            // Figure the real file name to make an alt attribute.
            $alt = explode('/', $filename);
            // Break into parts
            $alt = end($alt);
            // Get the last part (should be the file name)
            $alt = explode('.', $alt);
            // Break into parts
            array_pop($alt);
            // Remove the last part (should be the extension)
コード例 #2
0
    $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 . '"/>&emsp;' . $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.');
$view->group_contents($behavior_output);
$content_output .= $view->format_group() . '<hr/>';
$view->group_h2('Layout');
$view->group_instruction('Select how you want to arrange information.');
コード例 #3
0
    $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";
    foreach ($frequency_list as $key => $val) {
        if ($key == $book->info['publish_frequency']) {
            $publish_frequency_output .= '<option selected="selected" value="' . $key . '">- ' . $val . '</option>' . "\n";
        } else {
            $publish_frequency_output .= '<option value="' . $key . '">' . $val . '</option>' . "\n";
        }
コード例 #4
0
$img->db_new = $db;
$theme_id = numfunc_register_var('theme_id');
$tone_id = numfunc_register_var('tone_id');
$theme->set_theme_id($theme_id);
$theme->set_tone_id($tone_id);
/*****
 * Updates
 */
// Delete a tone
if (is_numeric($_GET['delete_id'])) {
    $delete_id = $_GET['delete_id'];
    $result = $db->where('id', $delete_id)->delete('theme_tone');
    if ($result) {
        $match_list = $db->where('tone_id', $delete_id)->delete('image_tone_match');
    } else {
        $alert_output .= $message->alert_dialog('Unable to delete tone from database.');
    }
    $result = $theme->delete_tone_css($delete_id);
    if (!$result) {
        $alert_output .= $message->alert_dialog('Unable to delete tone CSS file.');
    }
}
// Duplicate a tone
if ($_POST['modal-submit'] && $_POST['tone_title']) {
    // Fetch tone to dupe
    $cols = array('title', 'theme_id', 'user_made', 'value', 'date_created');
    $tone_meta = $db->where('id', $tone_id)->getOne('theme_tone', $cols);
    // Make some changes
    $tone_meta['title'] = $_POST['tone_title'];
    $tone_meta['user_made'] = 1;
    $tone_meta['date_created'] = $db->NOW();
コード例 #5
0
 foreach ($_FILES['file_change']['name'] as $key => $val) {
     // If there’s a folder to hold the previous image, use it for this new image.
     if ($_POST['original_path'][$key] && strlen($_POST['original_path'][$key]) > 0 && is_dir('../' . $_POST['original_path'][$key])) {
         $path = $_POST['original_path'][$key];
     } else {
         $serial = date('YmdHis') . substr(microtime(), 2, 6);
         $path = '/' . DIR_COMICS_IMG . $serial;
         mkdir('..' . $path);
     }
     // Error handling
     $path = str_replace('//', '/', $path);
     // Move the file to its new home.
     $success1 = move_uploaded_file($_FILES[$which]['tmp_name'][$key], '../' . $path . '/' . $val);
     if (!$success1) {
         if (!is_writable('../' . $path)) {
             $alert_output .= $message->alert_dialog('Unable to upload image. Looks like a folder permissions problem.');
         } else {
             // See http://php.net/manual/en/features.file-upload.errors.php
             switch ($_FILES[$which]['error'][$key]) {
                 case 1:
                     $alert_output .= $message->alert_dialog('I couldn’t upload the image. It exceeded the server’s ' . ini_get('upload_max_filesize') . 'B file size limit.');
                     break;
                 case 2:
                     $alert_output .= $message->alert_dialog('I couldn’t upload the image. It exceeded the server’s ' . ini_get('upload_max_filesize') . 'B file size limit.');
                     break;
                 case 3:
                     $alert_output .= $message->alert_dialog('I couldn’t receive the image. There was nothing to receive.');
                     break;
                 case 6:
                     $alert_output .= $message->alert_dialog('I couldn’t receive the image. There was no “temp” folder on the server — contact your host.');
                     break;
コード例 #6
0
if ($var_list) {
    foreach ($var_list as $key => $val) {
        ${$val} = register_variable($val);
    }
}
// Folder in which we keep ad images.
// $image_path = $milieu_list['directory']['value'].'/assets/images';
/*****
 * Updates
 */
if ($_GET && $delete_id) {
    $success = $marker_type->deleteMarkerType($delete_id);
    $marker_type->resetMarkerTypes();
}
if ($success && $delete_id) {
    $alert_output = $message->alert_dialog('Marker type deleted.');
}
/*****
 * Display
 */
$marker_type_list = $marker_type->getMarkerTypeList();
if ($marker_type_list) {
    $heading_list[] = array('value' => 'Level', 'class' => null);
    $heading_list[] = array('value' => 'Title', 'class' => null);
    $heading_list[] = array('value' => 'Total markers', 'class' => null);
    $heading_list[] = array('value' => 'Actions', 'class' => null);
    $edit_link = new GrlxLinkStyle();
    $edit_link->url('marker-type.edit.php');
    $edit_link->title('Edit marker type meta.');
    $edit_link->reveal(false);
    $edit_link->action('edit');
コード例 #7
0
 // Create the marker. We use the folder’s name as the marker’s title.
 // TO DO: Make the marker type dynamic.
 $new_marker_id = $marker->createMarker($folder, 1, $first_page_id);
 // We’re on the first page of this set.
 $first_page = true;
 foreach ($file_list as $this_file) {
     $serial = $bimport->makeSerial();
     $permissions = fileperms($import_path . '/' . $folder);
     if ($permissions == '16895') {
         $new_path = '../' . DIR_COMICS_IMG . '/' . $serial;
         mkdir($new_path);
         $success = rename($import_path . '/' . $folder . '/' . $this_file, $new_path . '/' . $this_file);
     } else {
         $success = false;
         $total_success = false;
         $alert_output = $message->alert_dialog('I couldn’t import all of the new images. Looks like a permissions error. Please temporarily set the folders in /import to 777.');
     }
     if ($success) {
         // Create the image DB record.
         $new_image_id = $comic_image->createImageRecord('/' . DIR_COMICS_IMG . $serial . '/' . $this_file);
         // Create the page DB record.
         $title = explode('.', $this_file);
         $title = $title[0];
         if ($first_page === true) {
             $new_page_id = $comic_image->createPageRecord($title, $last_page + $i, $book_id, $new_marker_id);
             $first_page = false;
         } else {
             $new_page_id = $comic_image->createPageRecord($title, $last_page + $i, $book_id);
         }
         // Assign the image to the page.
         if ($new_image_id && $new_page_id) {
コード例 #8
0
if ($var_list) {
    foreach ($var_list as $key => $val) {
        ${$val} = register_variable($val);
    }
}
/*****
 * Updates
 */
if ($_POST && $new_title) {
    $next_rank ? $next_rank : ($next_rank = 1);
    $new_id = $marker_type->createMarkerType($new_title, $next_rank);
    if ($new_id) {
        header('location:marker-type.list.php');
        die;
    } else {
        $alert_output = $message->alert_dialog('I couldn’t create the new marker.');
    }
} elseif ($_POST && !$new_title) {
    $alert_output = $message->alert_dialog('Hmm, I didn’t see a title. Did you give this new marker type a name?');
}
/*****
 * Display logic
 */
$next_rank = $db->get('marker_type', null, 'MAX(rank)+1 AS next_rank');
$next_rank = $next_rank[0]['next_rank'];
$view->page_title('Create marker type');
$view->tooltype('chap');
$view->headline('Create marker type');
$content_output .= '<form accept-charset="UTF-8" action="marker-type.create.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">New type title:</label>' . "\n";
コード例 #9
0
                // Create the image DB record.
                $new_image_id = $comic_image->createImageRecord(DIR_COMICS_IMG . '/' . $val);
                // Create the page DB record.
                $new_page_id = $comic_image->createPageRecord($title, $new_order + $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.0001;
            }
            reset_page_order($book_id, $db);
            header('location:book.view.php');
        }
    } else {
        $alert_output .= $message->alert_dialog('Yeah, look, I can’t put files in the ' . DIR_COMICS_IMG . ' folder on your web host.');
    }
}
if ($_POST && $_FILES['file']['name']['0'] == '') {
    $alert_output .= $message->alert_dialog('Nothing uploaded. Did you select some images from your computer?');
} elseif ($fileops->error_list) {
    $alert_fileops .= '<ul>' . "\n";
    foreach ($fileops->error_list as $key => $val) {
        $alert_fileops .= '<li>' . $val . '</li>' . "\n";
    }
    $alert_fileops .= '</ul>' . "\n";
    $alert_output .= $message->alert_dialog($alert_fileops);
}
if ($_POST['add-marker-type'] && $_POST['new_order'] && $first_page_id) {
    $title = $_POST['new_name'];
    $title ? $title : ($title = 'Untitled');
コード例 #10
0
$book->getMarkers();
// register_variable strips needed whitespace from text blocks
$transcript = $_POST['transcript'];
$transcript ? $transcript : ($transcript = $_GET['transcript']);
$transcript ? $transcript : ($transcript = $_SESSION['transcript']);
$blog_post = $_POST['blog_post'];
$blog_post ? $blog_post : ($blog_post = $_GET['blog_post']);
$blog_post ? $blog_post : ($blog_post = $_SESSION['blog_post']);
/*****
 * Updates
 */
/*****
 * Display logic
 */
if (!is_writable('../' . DIR_COMICS_IMG)) {
    $alert_output .= $message->alert_dialog('I can’t write to the ' . DIR_COMICS_IMG . ' directory. Looks like a permissions problem.');
}
$quick_upload_field = <<<EOL
<form action="uploadtome.php" class="dropzone" method="post" enctype="multipart/form-data">
<div class="fallback">
  <input name="file[]" type="file" multiple />
</div>
</form>
EOL;
$link->url('./book.page-create.php');
$link->tap('Create one comic page');
$link->reveal(false);
$action_output = $link->button_secondary('new');
$view->action($action_output);
$view->group_css('page');
$view->group_h2('Upload images');
コード例 #11
0
 /**
  * Check if a directory exists and is writable, if not make the dir
  *
  * @param string $path - directory to scan
  * @return string $alert - an error dialog if something is wrong
  */
 function check_or_make_dir($path = null)
 {
     if (!is_dir($path)) {
         @($new_dir = mkdir($path));
         if (!$new_dir) {
             $message = new GrlxAlert();
             $alert = $message->alert_dialog('Grawlix can’t find the ' . $path . '. directory.');
         }
     } elseif (!is_writable($path)) {
         $message = new GrlxAlert();
         $alert = $message->alert_dialog('I don’t have permission to save files in ' . $path . '. Please <a href="diag.health-check.php#permissions">change access privileges</a>.');
     }
     return $alert;
 }
コード例 #12
0
 * Updates
 */
// Act on an edit from the reveal modal
if ($_POST['modal-submit']) {
    $input = $_POST['input'];
    foreach ($input as $val) {
        $val = trim($val);
        $val = htmlspecialchars($val, ENT_COMPAT);
    }
    $input['url'] = mb_strtolower($input['url'], "UTF-8");
    // Add an external URL to nav
    if ($_POST['modal-submit'] == 'add') {
        $data = array('title' => $input['title'], 'url' => $input['url'], 'rel_type' => 'external', 'sort_order' => 0, 'in_menu' => 1);
        $new_id = $db->insert('path', $data);
        if ($new_id == 0) {
            $current_alert_output = $message->alert_dialog('Item was not added.');
        }
    }
    // Save an edit
    if ($_POST['modal-submit'] == 'save' && is_numeric($_POST['edit_id'])) {
        $data = array('title' => $input['title'], 'url' => $input['url']);
        $db->where('id', $_POST['edit_id']);
        $db->update('path', $data);
        if ($db->count == 0) {
            $current_alert_output = $message->alert_dialog('Edits were not saved.');
        }
    }
}
/*****
 * Display logic
 */
コード例 #13
0
        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.');
}
// Reset the marker info after making updates.
if ($_POST) {
    $marker = new GrlxMarker($marker_id);
}
$marker_type_list = $db->get('marker_type', null, 'id,title');
$marker_type_list = rekey_array($marker_type_list, 'id');
if ($marker->pageList) {
    $edit_link = new GrlxLinkStyle();
    $edit_link->url('book.page-edit.php');
    $edit_link->title('Edit page meta.');
    $edit_link->reveal(false);
    $edit_link->action('edit');
    $delete_link = new GrlxLinkStyle();
    $delete_link->i_only(true);
コード例 #14
0
} elseif ($total_pages <= 200) {
    $pages_per_view = 20;
} elseif ($total_pages <= 500) {
    $pages_per_view = 50;
} else {
    $pages_per_view = 70;
}
if ($start_sort_order > $total_pages) {
    $start_sort_order = $total_pages - $pages_per_view;
}
// For reference later
$marker_type_list = $db->get('marker_type', null, 'id,title');
$marker_type_list = rekey_array($marker_type_list, 'id');
///// Alerts and warnings
if (!$book->info) {
    $alert_output .= $message->alert_dialog('This book ID ' . $book_id . ' doesn’t seem to exist.');
}
if (!is_dir('../' . DIR_COMICS_IMG)) {
    @mkdir('../' . DIR_COMICS_IMG);
    $alert_output .= $message->info_dialog('The ' . DIR_COMICS_IMG . ' folder was missing, so I created it. Just sayin’.');
} elseif (!is_writable('../' . DIR_COMICS_IMG)) {
    $alert_output .= $message->alert_dialog('I can’t work with the ' . DIR_COMICS_IMG . ' folder. Looks like a permissions problem you need to fix via FTP.');
}
/*
$link-> title = 'Add a marker';
$link-> url = 'marker.create.php';
$link-> tap = 'Do something about that';

if ( !$book-> markerList && $book-> pageList ) {
	$alert_output .= $message->info_dialog('Hmm, no chapters here. '.$link-> paint().'.');
}
コード例 #15
0
        $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'];
コード例 #16
0
     $file_name = basename($_FILES['input']['name']['img_path']);
     $uploadfile = '..' . $image_path . '/' . $file_name;
     $web_file_path = $image_path . '/' . $file_name;
     if (move_uploaded_file($_FILES['input']['tmp_name']['img_path'], $uploadfile)) {
     } else {
         $web_file_path = $_POST['old_img_url'];
     }
 }
 // Act on an edit from the reveal modal
 if ($_POST['modal-submit'] && is_numeric($_POST['edit_id'])) {
     if ($input['title'] && $input['url']) {
         $data = array('title' => $input['title'], 'img_path' => $web_file_path, 'url' => $input['url']);
         $db->where('id', $_POST['edit_id']);
         $db->update('link_list', $data);
         if ($db->count <= 0) {
             $alert_output = $message->alert_dialog('Could not edit link.');
         }
     }
 }
 // Save new link
 if ($_POST['submit']) {
     if ($input['title'] && $input['url']) {
         $file_name = basename($_FILES['icon_file']['name']);
         $uploadfile = '..' . $image_path . '/' . $file_name;
         $web_file_path = $image_path . '/' . $file_name;
         if (move_uploaded_file($_FILES['icon_file']['tmp_name'], $uploadfile)) {
         } else {
         }
         $data = array('title' => $input['title'], 'url' => $input['url'], 'sort_order' => 0, 'img_path' => $web_file_path);
         $new_id = $db->insert('link_list', $data);
         if ($new_id <= 0) {
コード例 #17
0
// ! 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');
// Add rank numbers to the titles (I want to emphasize
// that there’s a definite pecking order at work).
if ($marker_type_list) {
    foreach ($marker_type_list as $key => $val) {
コード例 #18
0
    // Newly setup info so set the service to active
    if (is_numeric($_POST['match_id'])) {
        $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);
コード例 #19
0
            } 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->label('Username');
        $form->required(true);