public function action() { $photoID = getParamFromURL("id"); $filter = getParamFromURL("filter"); $photo = PhotoRepository::getPhotoByID($photoID); $path = substr($photo['path'], 12); $im = null; $imageType = null; if (endsWith($photo['image'], ".jpeg") || endsWith($photo['image'], ".jpg")) { $im = imagecreatefromjpeg($path); $imageType = "jpeg"; } else { if (endsWith($photo['image'], ".png")) { $im = imagecreatefrompng($path); $imageType = "png"; } } if ($filter === "blackwhite") { BlackWhite::filter($im); } else { if ($filter === "brightness") { $brightness = post('number'); Brightness::setBrightness($brightness); Brightness::filter($im); } else { if ($filter === "sepia") { Sepia::filter($im); } else { if ($filter === "blur") { Blur::filter($im); } } } } header('Content-Type: image/' . $imageType); if ($imageType === "jpeg") { imagejpeg($im); imagejpeg($im, $path); } else { imagepng($im); } imagedestroy($im); redirect(Route::get("viewPhoto")->generate(array("id" => $photo['photoid']))); }
$segs_clean = array(); foreach ($segs as $segment) { $origsegment = $segment; $segment = explode(':', $segment); if ($segment[0] == 'editmode') { //return $segment [1]; } else { $segs_clean[] = $origsegment; } } $segs_clean = implode('/', $segs_clean); $site = site_url($segs_clean); safe_redirect('Location: ' . $site); exit; } $debugmode = getParamFromURL('debugmode'); if ($debugmode != false) { if ($debugmode == 'y') { $adm = CI::model('core')->is_admin(); if ($adm == true) { CI::library('session')->set_userdata('debugmode', true); } } if ($debugmode == 'n') { CI::library('session')->set_userdata('debugmode', false); } $url = getCurentURL(); $site = site_url(); $url = str_ireplace($site, '', $url); $segs = explode('/', $url); $segs_clean = array();
function taxonomy_categories_delete() { $delete_id = getParamFromURL('id'); $to_go = site_url('admin/content/taxonomy_categories'); $delete_id = intval($delete_id); CI::model('taxonomy')->taxonomyDelete($delete_id); //exit ('1'); //header("Location: $to_go"); //redirect ( ); redirect('admin/content/taxonomy_categories'); }
function dbg($text, $end = false) { if (defined('DEBUG_INFO_IN_TEMPLATE')) { if ($end == true) { $end1 = ' end of '; } $divs = getParamFromURL('debug'); if ($divs) { //$text = wordwrap($text,20,"<br />\n"); echo '<div class="debug"> ' . $end1 . ' debug: ' . $text . ' </div>'; } else { echo '<!-- ' . $end1 . ' debug: ' . $text . ' -->'; } } }