}
    // ! 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)
            $alt = implode('.', $alt);
            // Put it back together
            // Create the image DB record.
            $new_image_id = $comic_image->createImageRecord('/' . DIR_COMICS_IMG . $filename, $alt);
Ejemplo n.º 2
0
$fileops->db = $db;
$book = new GrlxComicBook();
$marker = new GrlxMarker();
$comic_image = new GrlxComicImage();
$message = new GrlxAlert();
$sl = new GrlxSelectList();
$view->yah = 2;
$book_id = $book->bookID;
/*****
 * Updates
 */
if ($_FILES && $book_id) {
    if (is_writable('../' . DIR_COMICS_IMG)) {
        $which = 'file';
        $fileops->up_set_destination_folder('../' . DIR_COMICS_IMG);
        $files_uploaded = $fileops->up_process($which);
        $new_order = $_POST['new_order'];
        $new_order ? $new_order : ($new_order = 1);
        if ($files_uploaded) {
            $i = -1;
            $qty = count($_FILES['file']['name']);
            foreach ($files_uploaded as $key => $val) {
                $title = explode('.', $val);
                $title = $title[0];
                if (strpos($title, '/')) {
                    $title = explode('/', $title);
                    $title = $title[1];
                }
                // Create the image DB record.
                $new_image_id = $comic_image->createImageRecord(DIR_COMICS_IMG . '/' . $val);
                // Create the page DB record.