$master_folder_list[$key] = $file_list = $fileops->get_dir_list($val); } } } if ($master_folder_list) { // Assume everything works unless proven otherwise. // I feel optimistic. Thanks, @BarefootCoffee! $total_success = true; $i = $last_page + 1; // Sort_order count $first_page_id = null; // Triggers when to create a marker. foreach ($master_folder_list as $folder => $file_list) { // 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) {
} } 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'); $new_marker_id = $marker->createMarker($title, $_POST['add-marker-type'], $first_page_id); } if ($first_page_id && $new_marker_id) { $data = array('marker_id' => $new_marker_id); $db->where('id', $first_page_id); $success = $db->update('book_page', $data); } if ($new_marker_id && $_POST['return-or-not'] == '1') { header('location:marker.view.php?marker_id=' . $new_marker_id); die; } /***** * Display */ 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.');