<?php // ! Setup require_once 'panl.init.php'; require_once 'lib/htmLawed.php'; $link = new GrlxLinkStyle(); $view = new GrlxView(); $message = new GrlxAlert(); $fileops = new GrlxFileOps(); $comic_image = new GrlxComicImage(); $sl = new GrlxSelectList(); $view->yah = 1; $var_list = array('page_id', 'new_page_name', 'blog_headline', 'book_id', 'beginning_end', 'into_marker_id'); if ($var_list) { foreach ($var_list as $key => $val) { ${$val} = register_variable($val); } } if (!$book_id) { $book = new GrlxComicBook(); $book_id = $book->bookID; } else { $book = new GrlxComicBook($book_id); } $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']);
// Have we uploaded an image? Then add it to the list. // 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>
$db->where('id', $key); $message = new GrlxAlert(); 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) {
<?php /* Artists use this script to create a link list. */ /***** * Setup */ require_once 'panl.init.php'; $view = new GrlxView(); $modal = new GrlxForm_Modal(); $message = new GrlxAlert(); $list = new GrlxList(); $form = new GrlxForm(); $fileops = new GrlxFileOps(); $image_path = $milieu_list['directory']['value'] . '/assets/images/icons'; $view->yah = 11; /***** * Updates */ if ($_SERVER['REQUEST_METHOD'] == 'POST') { $input = $_POST['input']; foreach ($input as $val) { $val = trim($val); $val = htmlspecialchars($val, ENT_COMPAT); } $input['url'] = mb_strtolower($input['url'], "UTF-8"); if (count($_FILES) > 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)) {
<?php /* Artists use this script to add connections to social media services. */ /***** * Setup */ require_once 'panl.init.php'; $view = new GrlxView(); $form = new GrlxForm(); $modal = new GrlxForm_Modal(); $message = new GrlxAlert(); $view->yah = 8; /***** * Updates */ // Reset comment service if (is_numeric($_GET['reset_comments'])) { $service_id = $_GET['reset_comments']; $data = array('user_info' => null); $db->where('id', $service_id); $db->update('third_service', $data); $data = array('active' => 0); $db->where('service_id', $service_id); $db->update('third_match', $data); } // Save edits from the info modal if ($_POST['edit']) { foreach ($_POST['edit'] as $key => $val) { if (is_numeric($key)) { $data = array('user_info' => $val);
$view->action($action_output); /***** * Display */ $output = $view->open_view(); $output .= $view->view_header(); $output .= $modal->modal_container(); $output .= $alert_output; print $output; ?> <section class="sttc"> <?php if ($page_list_output) { print $page_list_output; } else { $message = new GrlxAlert(); print $message->info_dialog('Your site has no static pages. No FAQ, no About the Artist, nothing.'); } ?> </section> <?php $js_call = <<<EOL \t\$( "a.delete i" ).hover( // highlight item to be deleted \t\tfunction() { \t\t\t\$( this ).parent().parent().addClass("red-alert"); \t\t}, function() { \t\t\t\$( this ).parent().parent().removeClass("red-alert"); \t\t} \t); \t\$( "i.edit" ).hover( // highlight the editable item \t\tfunction() {
<?php /***** * Setup */ require_once 'panl.init.php'; $view = new GrlxView(); $modal = new GrlxForm_Modal(); $message = new GrlxAlert(); $link = new GrlxLinkStyle(); $list = new GrlxList(); $var_list = array('marker_type_id', 'new_title'); if ($var_list) { foreach ($var_list as $key => $val) { ${$val} = register_variable($val); } } if ($marker_type_id) { $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) {
<?php /***** * Setup */ require_once 'panl.init.php'; $link = new GrlxLinkStyle(); $view = new GrlxView(); $list = new GrlxList(); $list->draggable(false); $image = new GrlxImage(); $message = new GrlxAlert(); // Default value $page_title = 'Ad location editor'; $var_list = array('slot_id', 'change_to', 'change_from', 'label', 'title'); if ($var_list) { foreach ($var_list as $key => $val) { ${$val} = register_variable($val); } } // 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);
<?php /***** * Setup */ require_once 'panl.init.php'; require_once 'lib/htmLawed.php'; $link = new GrlxLinkStyle(); $view = new GrlxView(); $message = new GrlxAlert(); $fileops = new GrlxFileOps(); $comic_image = new GrlxComicImage(); $sl = new GrlxSelectList(); $view->yah = 1; $var_list = array('page_id', 'new_page_name', 'blog_headline', 'book_id', 'beginning_end', 'into_marker_id'); if ($var_list) { foreach ($var_list as $key => $val) { ${$val} = register_variable($val); } } if (!$book_id) { $book = new GrlxComicBook(); $book_id = $book->bookID; } else { $book = new GrlxComicBook($book_id); } $book->getMarkers(); // register_variable strips needed whitespace from text blocks $transcript = $_POST['transcript']; $transcript ? $transcript : ($transcript = $_GET['transcript']); $transcript ? $transcript : ($transcript = $_SESSION['transcript']);
/** * 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; }
<?php /***** * Setup */ include 'panl.init.php'; $link = new GrlxLinkStyle(); $view = new GrlxView(); $message = new GrlxAlert(); $form = new GrlxForm(); $fileops = new GrlxFileOps(); $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;
<?php /* Artists use this script to control the main site navigation. */ /***** * Setup */ require_once 'panl.init.php'; $view = new GrlxView(); $link = new GrlxLinkStyle(); $form = new GrlxForm(); $modal = new GrlxForm_Modal(); $message = new GrlxAlert(); $list = new GrlxList(); $view->yah = 7; /***** * 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) {
<?php /***** * Setup */ require_once 'panl.init.php'; $view = new GrlxView(); //$modal = new GrlxForm_Modal; $message = new GrlxAlert(); $link = new GrlxLinkStyle(); $list = new GrlxList(); $form = new GrlxForm(); $fileops = new GrlxFileOps(); $fileops->db = $db; $comic_image = new GrlxComicImage(); $sl = new GrlxSelectList(); $form->send_to($_SERVER['SCRIPT_NAME']); $var_list = array('marker_id', 'book_id', 'new_order'); if ($var_list) { foreach ($var_list as $key => $val) { ${$val} = register_variable($val); } } if (!$marker_id) { header('location:book.view.php'); die; } $marker = new GrlxMarker($marker_id); $new_order ? $new_order : ($new_order = 1); /***** * Updates
<?php /***** * Setup */ require_once 'panl.init.php'; require_once 'lib/htmLawed.php'; $link1 = new GrlxLinkStyle(); $view = new GrlxView(); $message = new GrlxAlert(); $marker = new GrlxMarker(); $fileops = new GrlxFileOps(); $sl = new GrlxSelectList(); $view->yah = 3; $var_list = array('page_id', 'new_page_name', 'remove_id', 'blog_headline'); if ($var_list) { foreach ($var_list as $key => $val) { ${$val} = register_variable($val); } } for ($i = 1; $i < 32; $i++) { $i < 10 ? $i = '0' . $i : null; $day_list[$i] = array('title' => $i, 'id' => $i); } for ($i = 1; $i < 13; $i++) { $i < 10 ? $i = '0' . $i : null; $month_list[$i] = array('title' => date("F", mktime(0, 0, 0, $i, 1, 2015)), 'id' => $i); } for ($i = date('Y') - 10; $i < date('Y') + 2; $i++) { $year_list[$i] = array('title' => $i, 'id' => $i); }
$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.'); $view->group_contents($behavior_output); $content_output .= $view->format_group() . '<hr/>'; $view->group_h2('Layout');
function importFolders() { if (is_array($this->fileList)) { foreach ($this->fileList as $item) { } } } } $bimport = new bulkImport(); /***** * Setup */ require_once 'panl.init.php'; $view = new GrlxView(); $fileops = new GrlxFileOps(); $message = new GrlxAlert(); $book = new GrlxComicBook(1); $comic_image = new GrlxComicImage(); $marker = new GrlxMarker(); $link = new GrlxLinkStyle(); $link1 = new GrlxLinkStyle(); $list = new GrlxList(); // Yeeeeah, really should make this a constant. $import_path = '../import'; if ($book) { $book->getPages(); } if ($book->pageList) { $last_page = end($book->pageList); $last_page = $last_page['sort_order']; } else {
<?php /***** * ! Setup */ require_once 'panl.init.php'; $fileops = new GrlxFileOps(); $message = new GrlxAlert(); $image = new GrlxImage(); $link = new GrlxLinkStyle(); $edit_link = new GrlxLinkStyle(); $delete_link = new GrlxLinkStyle(); $view = new GrlxView(); $list = new GrlxList(); $list->draggable(false); $view->yah = 10; // Default value $page_title = 'Ad browser'; // URL to PW’s XML feed. ID not included at this point. $wonderful_file_path = 'http://projectwonderful.com/xmlpublisherdata.php?publisher='; // Folder in which we store ad pics. $image_path = $milieu_list['directory']['value'] . '/assets/images/ads'; // Get and sanitize every variable sent by _get, _post and _session. $var_list = array('ad_id', 'delete_ad_id', 'current_group', 'wonderful_id'); if ($var_list) { foreach ($var_list as $key => $val) { ${$val} = register_variable($val); } } // Does the ad image repository exist? If not, try to make it. $alert_output = $fileops->check_or_make_dir('..' . $image_path);
<div class="row form config"><div><label for="item-6">Timezone</label></div><div>{$select_options}</div></div> EOL; } } if ($ga_info) { $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();
/** * Checks if there are leftovers from an install that need user attention. * Triggered to run after every panel login. * * @return string - an alert with instructions */ protected function install_cleanup() { if (is_file('../firstrun.php')) { $str = '<strong>firstrun.php</strong> is present in your main Grawlix directory. You should delete this file as a safety measure.'; $alert = new GrlxAlert(); $alert->special_id('cleanup-close'); $message = $alert->warning_dialog($str); } return $message; }
<?php // ! Setup require_once 'panl.init.php'; $view = new GrlxView(); $modal = new GrlxForm_Modal(); $message = new GrlxAlert(); $link1 = new GrlxLinkStyle(); $link2 = new GrlxLinkStyle(); $list = new GrlxList(); $sl = new GrlxSelectList(); $var_list = array('marker_id', 'new_title', 'edit_marker_type'); if ($var_list) { foreach ($var_list as $key => $val) { ${$val} = register_variable($val); } } if ($marker_id) { $marker = new GrlxMarker($marker_id, true); } 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);
<?php /***** * Setup */ require_once 'panl.init.php'; $view = new GrlxView(); //$modal = new GrlxForm_Modal; $message = new GrlxAlert(); $link = new GrlxLinkStyle(); $list = new GrlxList(); $sl = new GrlxSelectList(); $form = new GrlxForm(); $marker = new GrlxMarker(); $view->yah = 3; $var_list = array('book_id', 'delete_page_id', 'start_sort_order', 'keyword', 'delete_marker_id', 'sel', 'add_marker_type'); if ($var_list) { foreach ($var_list as $key => $val) { ${$val} = register_variable($val); } } if ($start_sort_order) { $_SESSION['start_sort_order'] = $start_sort_order; } else { $start_sort_order = $_SESSION['start_sort_order']; } $start_sort_order ? $start_sort_order : ($start_sort_order = 1); /***** * Updates */ if ($book_id) {
<?php /***** * Setup */ require_once 'panl.init.php'; $view = new GrlxView(); $message = new GrlxAlert(); $link = new GrlxLinkStyle(); $list = new GrlxList(); $form = new GrlxForm(); $marker_type = new GrlxMarkerType(); $var_list = array('marker_type_id', 'new_marker_name', 'delete_id'); 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.'); } /*****
<?php /***** * Setup */ require_once 'panl.init.php'; $view = new GrlxView(); $modal = new GrlxForm_Modal(); $message = new GrlxAlert(); $link = new GrlxLinkStyle(); $list = new GrlxList(); $marker_type = new GrlxMarkerType(); $var_list = array('next_rank', 'new_title'); 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) {
<?php /***** * Setup */ require_once 'panl.init.php'; $view = new GrlxView(); $modal = new GrlxForm_Modal(); $message = new GrlxAlert(); $link = new GrlxLinkStyle(); $list = new GrlxList(); $var_list = array('book_id', 'new_title', 'publish_frequency', 'start_month', 'start_day', 'start_year'); if ($var_list) { foreach ($var_list as $key => $val) { ${$val} = register_variable($val); } } if ($book_id) { $book = new GrlxComicBook($book_id); } else { $book = new GrlxComicBook(); $book_id = $book->bookID; } $month_list = array('01' => 'January', '02' => 'February', '03' => 'March', '04' => 'April', '05' => 'May', '06' => 'June', '07' => 'July', '08' => 'August', '09' => 'September', '10' => 'October', '11' => 'November', '12' => 'December'); $start_month_output = build_select_simple('start_month', $month_list, $date_start[1]); for ($i = 1; $i < 32; $i++) { $i < 10 ? $j = '0' . $i : ($j = $i); $day_list[$j] = $i; } $start_day_output = build_select_simple('start_day', $day_list, $date_start[2]); for ($y = date('Y') + 1; $y >= 1980; $y--) {
<?php /* ! Setup * * * * * * * */ require_once 'panl.init.php'; $update = 'update.php'; if (file_exists($update)) { $message = new GrlxAlert(); $alert_output = $message->info_dialog('Welcome to 1.0!<br /><br />You should <a href="' . $update . '?go=1">update your database</a> now.'); } /* $link_set[] = array( 'url' => 'book.view.php', 'tap' => 'Browse comic pages', 'title' => '' ); $link_set[] = array( 'url' => 'sttc.page-list.php', 'tap' => 'Browse static pages', 'title' => '' ); $link_set[] = array( 'url' => 'book.page-create.php', 'tap' => 'Create comic page(s)', 'title' => '' ); $link_set[] = array( 'url' => 'sttc.xml-create.php', 'tap' => 'Create static page(s)', 'title' => '' );
<?php /* Artists use this script to configure a theme tone. */ /***** * Setup */ require_once 'panl.init.php'; $view = new GrlxView(); $modal = new GrlxForm_Modal(); $link = new GrlxLinkStyle(); $message = new GrlxAlert(); $form = new GrlxForm(); $theme = new GrlxXML_Theme(); $img = new GrlxImage(); $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.');
<?php /***** * Setup */ include 'panl.init.php'; $link = new GrlxLinkStyle(); $view = new GrlxView(); $message = new GrlxAlert(); $var_list = array('ad_id', 'title'); if ($var_list) { foreach ($var_list as $key => $val) { ${$val} = register_variable($val); } } $code = $_POST['code']; // No ad selected? Send ’em back to the list. if (!$ad_id || !is_numeric($ad_id)) { // 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);
// What it sounds like. $allowed_file_types = array('gif', 'png', 'jpg', 'jpeg', 'svg'); $variable_list = array('page_id', 'new_title', 'new_description', 'old_title', 'xml_format', 'function', 'raw_content', 'msg', 'pattern_id', 'url', 'layout_id'); if ($variable_list) { foreach ($variable_list as $val) { ${$val} = register_variable($val); } } // Hold it — no ID, no entrance. if (!$page_id) { header('location:sttc.page-list.php'); die; } $view = new GrlxView(); $link = new GrlxLinkStyle(); $message = new GrlxAlert(); $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');