function inverseHex($color) { $color = TRIM($color); $prependHash = FALSE; if (STRPOS($color, '#') !== FALSE) { $prependHash = TRUE; $color = STR_REPLACE('#', NULL, $color); } switch ($len = STRLEN($color)) { case 3: $color = PREG_REPLACE("/(.)(.)(.)/", "\\1\\1\\2\\2\\3\\3", $color); case 6: break; default: TRIGGER_ERROR("Invalid hex length ({$len}). Must be (3) or (6)", E_USER_ERROR); } if (!PREG_MATCH('/[a-f0-9]{6}/i', $color)) { $color = HTMLENTITIES($color); TRIGGER_ERROR("Invalid hex string #{$color}", E_USER_ERROR); } $r = DECHEX(255 - HEXDEC(SUBSTR($color, 0, 2))); $r = STRLEN($r) > 1 ? $r : '0' . $r; $g = DECHEX(255 - HEXDEC(SUBSTR($color, 2, 2))); $g = STRLEN($g) > 1 ? $g : '0' . $g; $b = DECHEX(255 - HEXDEC(SUBSTR($color, 4, 2))); $b = STRLEN($b) > 1 ? $b : '0' . $b; return ($prependHash ? '#' : NULL) . $r . $g . $b; }
function anti_injection($user, $pass, $ip) { global $db; // We'll first get rid of any special characters using a simple regex statement. // After that, we'll get rid of any SQL command words using a string replacment. $banlist = array("'", "--", "select", "union", "insert", "update", "like", "delete", "distinct", "having", "truncate", "replace", "handler", " as ", "or ", "procedure", "limit", "order by", "group by", "asc", "desc", "1=1", "or", "#", "//", "' or '1'='1'", "'1'='1'"); // --------------------------------------------- if (preg_match("/[a-zA-Z0-9]+/i", $user)) { $user = TRIM(STR_REPLACE($banlist, '', STRTOLOWER($user))); } else { $user = NULL; } // --------------------------------------------- // Now to make sure the given password is an alphanumerical string // devoid of any special characters. strtolower() is being used // because unfortunately, str_ireplace() only works with PHP5. if (preg_match("/[a-zA-Z0-9]+/i", $pass)) { $pass = TRIM(STR_REPLACE($banlist, '', STRTOLOWER($pass))); } else { $pass = NULL; } // --------------------------------------------- // Now to make an array so we can dump these variables into the SQL query. // If either user or pass is NULL (because of inclusion of illegal characters), // the whole script will stop dead in its tracks. $array = array('user' => $user, 'pass' => $pass); // --------------------------------------------- if (!IN_ARRAY(NULL, $array)) { return $array; } }
function TeamspaceSliderItems() { $db = $GLOBALS['db']; $sql = "SELECT mm.module_id, mm.name, mm.logo\n\t\t\t\tFROM " . $GLOBALS['database_prefix'] . "core_space_module_acl cma, " . $GLOBALS['database_prefix'] . "core_module_master mm\n\t\t\t\tWHERE cma.workspace_id = " . $GLOBALS['workspace_id'] . "\n\t\t\t\tAND cma.role_id = '" . $GLOBALS['wui']->role_id . "'\n\t\t\t\tAND cma.module_id = mm.module_id\n\t\t\t\tAND cma.module_id NOT IN (\n\t\t\t\t SELECT module_id\n\t\t\t\t FROM " . $GLOBALS['database_prefix'] . "core_space_user_modules\n\t\t\t\t WHERE user_id = '" . $_SESSION['user_id'] . "'\n\t\t\t\t AND workspace_id = " . $GLOBALS['workspace_id'] . "\n\t\t\t\t)\n\t\t\t\tORDER BY mm.name\n\t\t\t\t"; //echo $sql."<br>"; $result = $db->Query($sql); $t = "<div id='slider'>\n"; $t .= "<table class=plain>\n"; $t .= "<tr>\n"; $t .= "<td colspan='2' class='bold'>Add Components</td>\n"; $t .= "</tr>\n"; if ($db->NumRows($result) > 0) { while ($row = $db->FetchArray($result)) { $t .= "<tr>\n"; $t .= "<td><img src='images/modules/" . $row['name'] . ".png' width='22'></td>\n"; $t .= "<td><a href='index.php?wtask=install_workspace_user_module&module_id=" . $row['module_id'] . "'>" . STR_REPLACE("_", " ", $row['name']) . "</a></td><td></td>\n"; $t .= "</tr>\n"; } } else { $t .= "<tr><td colspan='4'>No available modules to install</td></tr>\n"; } $t .= "</table>\n"; $t .= "</div>\n"; return $t; }
public static function FORMAT($S, $R, $P) { $I = array(); if ($P === false) { $I[] = STR_REPLACE("/", "-", $R) . " 00:00:00"; $I[] = STR_REPLACE("/", "-", $R) . " 24:59:59"; $SET = 'HOUR'; } else { $R = explode(" - ", $R); $I[] = STR_REPLACE("/", "-", $R[0]); $I[] = STR_REPLACE("/", "-", $R[1]); $SET = 'DAY'; } $I[] = $S['s_id']; $Q = "SELECT MIN(t_checkout_created) AS `time`, AVG(t_checkout_price) AS `cost` FROM core_tickets_processed WHERE t_checkout_created >= ? AND t_checkout_created <= ? AND t_store = ? GROUP BY"; $CA = MYSQL::QUERY($Q . " {$SET}(t_checkout_created) ORDER BY t_checkout_created ASC", $I); $CO = MYSQL::QUERY($Q . " t_checkout_created ORDER BY t_checkout_created ASC", $I); $STRING = array(); $STRING[] = array('name' => 'Average Charge', 'data' => ''); $STRING[] = array('name' => 'Checkout Charges', 'data' => ''); foreach ($CA as $C) { $T = Date_UTC($C['time']); $STRING[0]['data'][] .= $T[0] . "," . $T[1] . "," . $T[2] . "," . $T[3] . "," . $C['cost']; } foreach ($CO as $C) { $T = Date_UTC($C['time']); $STRING[1]['data'][] .= $T[0] . "," . $T[1] . "," . $T[2] . "," . $T[3] . "," . $T[4] . "," . $C['cost']; } echo JSON_ENCODE($STRING); }
function bin2text($bin_str) { $text_str = ''; $chars = EXPLODE("\n", CHUNK_SPLIT(STR_REPLACE("\n", '', $bin_str), 8)); $_I = COUNT($chars); for ($i = 0; $i < $_I; $text_str .= CHR(BINDEC($chars[$i])), $i) { } return $text_str; }
function ModuleMenuDynamic($module_id, $module_name, $items) { $ui = $GLOBALS['ui']; $dr = $GLOBALS['dr']; $wb = $GLOBALS['wb']; $module_id = $GLOBALS['module_id']; $c = "<table class='plain' width='150'>\n"; $c .= "<tr>\n"; $c .= "<td colspan='3' class='bold'>" . InitCap($module_name) . " Menu</td>\n"; $c .= "</tr>\n"; /* LOOP ALL THE ITEMS IN THE MENU ARRAY */ for ($i = 0; $i < count($items); $i++) { /* CHECK THE ACL FOR THIS MODULE */ //echo $GLOBALS['wui']->RoleID()."<br>"; //echo $module."<br>"; //echo $arr_menu[$i]."<br>"; $task_img_desc = STRTOLOWER($items[$i]); $task_img_desc = STR_REPLACE(" ", "_", $task_img_desc); //echo $task_img_desc."<br>"; if (CheckAccess($GLOBALS['wui']->RoleID(), $module_id, $task_img_desc)) { $friendly = InitCap($items[$i]); if (defined('_VALID_MVH_MOBILE_')) { $c .= "<tr><td colspan='2'>+<a href='index.php?module=" . $module_name . "&task=" . $task_img_desc . "'>" . $friendly . "</a></td></tr>"; } else { $icon_file = $dr . "modules/" . $module_name . "/images/default/" . $task_img_desc . ".png"; $icon_http = "modules/" . $module_name . "/images/default/" . $task_img_desc . ".png"; //echo $icon."<br>"; if (file_exists($icon_file)) { $icon_file = $icon_http; } else { $icon_file = $wb . "images/nuvola/16x16/actions/view_remove.png"; } if ($_GET['task'] == $task_img_desc) { $arrow = "<img src='images/nuvola/16x16/actions/player_play.png'>"; $bgcolor = "#dedede"; } else { $arrow = ""; $bgcolor = "#ffffff"; } $c .= "<tr>\n"; $c .= "<td width='16'>" . $arrow . "</td>\n"; $c .= "<td width='16'><img src='" . $icon_file . "'></td>\n"; $c .= "<td bgcolor='" . $bgcolor . "' width='134'><a href='index.php?module=" . $module_name . "&task=" . $task_img_desc . "'>" . $friendly . "</a></td>\n"; $c .= "</tr>\n"; } } } $c .= "</table>\n"; return $c; }
function anti_injection($user, $pass, $ip) { global $db; // We'll first get rid of any special characters using a simple regex statement. // After that, we'll get rid of any SQL command words using a string replacment. $banlist = array("'", "--", "select", "union", "insert", "update", "like", "delete", "distinct", "having", "truncate", "replace", "handler", " as ", "or ", "procedure", "limit", "order by", "group by", "asc", "desc", "1=1", "or", "#", "//", "' or '1'='1'", "'1'='1'"); // --------------------------------------------- if (preg_match("/[a-zA-Z0-9]+/i", $user)) { $user = TRIM(STR_REPLACE($banlist, '', STRTOLOWER($user))); } else { $user = NULL; } // --------------------------------------------- // Now to make sure the given password is an alphanumerical string // devoid of any special characters. strtolower() is being used // because unfortunately, str_ireplace() only works with PHP5. if (preg_match("/[a-zA-Z0-9]+/i", $pass)) { $pass = TRIM(STR_REPLACE($banlist, '', STRTOLOWER($pass))); } else { $pass = NULL; } // --------------------------------------------- // Now to make an array so we can dump these variables into the SQL query. // If either user or pass is NULL (because of inclusion of illegal characters), // the whole script will stop dead in its tracks. $array = array('user' => $user, 'pass' => $pass); // --------------------------------------------- if (IN_ARRAY(NULL, $array)) { /* $db->connectdb(DB_NAME,DB_USERNAME,DB_PASSWORD); $db->add_db(TB_IPBLOCK,array( "ip"=>"".$ip."", "post_date"=>"".time()."" )); $db->closedb (); ?> <BR><BR> <CENTER><A HREF="?name=index"><IMG SRC="images/dangerous.png" BORDER="0"></A><BR><BR> <FONT COLOR="#336600"><B><?=_ADMIN_IPBLOCK_MESSAGE_HACK;?> <?=WEB_EMAIL;?></B></FONT><BR><BR> <A HREF="?name=index"><B><?=_ADMIN_IPBLOCK_MESSAGE_HACK1;?></B></A> </CENTER> <?php echo "<meta http-equiv='refresh' content='10; url=?name=index'>" ; ?> <BR><BR> <?php */ } else { return $array; } }
function Content() { $c = ""; for ($i = 0; $i < count($this->arr); $i++) { if ($i == 0) { $class = "showBlk"; } else { $class = "hideBlk"; } $c .= "<div id='" . $this->arr[$i] . "' class='" . $class . "'>\n"; require_once $this->dir . $this->arr[$i] . ".php"; $v_funct_inc = STR_REPLACE("_", "", $this->arr[$i]); $c .= $v_funct_inc(); //$file_function=$v_funct_inc; //$c.=$file_function(); /* THIS ALLOWS US TO CALL A DYNAMIC FUNCTION NAME BASED ON WHAT THE FILE IS CALLED */ $c .= "</div>\n"; } return $c; }
function outputTableCore(&$rows, &$client, &$page, &$lists) { // Initialize variables $db =& JFactory::getDBO(); $user =& JFactory::getUser(); $config =& JFactory::getConfig(); $now =& JFactory::getDate(); $nullDate = $db->getNullDate(); ?> <table class="adminform" cellspacing="1"> <tbody> <tr> <td> <?php echo JText::_('Filter'); ?> : <input type="text" name="search" id="search" value="<?php echo $lists['search']; ?> " class="text_area" onchange="this.form.submit();" title="<?php echo JText::_('Filter by title or enter article ID'); ?> " /> <button onclick="this.form.submit();"><?php echo JText::_('Go'); ?> </button> <button onclick=" document.getElementById( 'search' ).value=''; document.getElementById( 'filter_category' ).value='0'; document.getElementById( 'filter_author' ).value='0'; document.getElementById( 'filter_state' ).value=''; this.form.submit();"><?php echo JText::_('Reset'); ?> </button> </td> <td style="text-align:right;"> <?php echo $lists['categories']; echo $lists['authors']; echo $lists['state']; ?> </td> </tr> </tbody> </table> <table class="adminlist adminform" cellspacing="1"> <thead> <tr> <th width="5"> <?php echo JText::_('Num'); ?> </th> <th width="1%" class="title"> <?php echo JHTML::_('grid.sort', 'ID', 'id', @$lists['order_Dir'], @$lists['order']); ?> </th> <th class="title"> <?php echo JHTML::_('grid.sort', 'Title', 'title', @$lists['order_Dir'], @$lists['order']); ?> </th> <th class="title"> <?php echo JHTML::_('grid.sort', 'Alias', 'alias', @$lists['order_Dir'], @$lists['order']); ?> </th> <th width="1%" nowrap="nowrap"> <?php echo JHTML::_('grid.sort', 'Published', 'published', @$lists['order_Dir'], @$lists['order']); ?> </th> <th nowrap="nowrap" width="1%"> <?php echo JHTML::_('grid.sort', 'Front Page', 'frontpage', @$lists['order_Dir'], @$lists['order']); ?> </th> <th width="8%"> <?php echo JHTML::_('grid.sort', 'Order', 'ordering', @$lists['order_Dir'], @$lists['order']); ?> </th> <?php if ($client->id == 0) { ?> <th nowrap="nowrap" width="7%"> <?php echo JHTML::_('grid.sort', 'Access', 'accesslevel', @$lists['order_Dir'], @$lists['order']); ?> </th> <?php } ?> <th class="title" width="8%" nowrap="nowrap"> <?php echo JHTML::_('grid.sort', 'Category', 'category', @$lists['order_Dir'], @$lists['order']); ?> </th> <th class="title" width="8%" nowrap="nowrap"> <?php echo JHTML::_('grid.sort', 'Author', 'author', @$lists['order_Dir'], @$lists['order']); ?> </th> <th align="center" width="10"> <?php echo JHTML::_('grid.sort', 'Date', 'created', @$lists['order_Dir'], @$lists['order']); ?> </th> <th align="center" width="10"> <?php echo JHTML::_('grid.sort', 'Hits', 'hits', @$lists['order_Dir'], @$lists['order']); ?> </th> </tr> </thead> <tfoot> <tr> <td colspan="<?php echo $client->id == 0 ? '13' : '12'; ?> "> <?php $pagination = STR_REPLACE('index.php?', 'plugins/editors-xtd/articlesanywhere/elements/articlesanywhere.page.php?name=' . JRequest::getCmd('name', 'text') . '&', $page->getListFooter()); $pagination = STR_REPLACE('index.php', 'plugins/editors-xtd/articlesanywhere/elements/articlesanywhere.page.php?name=' . JRequest::getCmd('name', 'text'), $pagination); echo $pagination; ?> </td> </tr> </tfoot> <tbody> <?php $i = 0; $k = 0; foreach ($rows as $row) { $publish_up =& JFactory::getDate($row->publish_up); $publish_down =& JFactory::getDate($row->publish_down); $publish_up->setTimeZone(new DateTimeZone($config->getValue('config.offset'))); $publish_down->setTimeZone(new DateTimeZone($config->getValue('config.offset'))); if ($now->toUnix() <= $publish_up->toUnix() && $row->published == 1) { $img = 'publish_y.png'; $alt = JText::_('Published'); } else { if (($now->toUnix() <= $publish_down->toUnix() || $row->publish_down == $nullDate) && $row->published == 1) { $img = 'publish_g.png'; $alt = JText::_('Published'); } else { if ($now->toUnix() > $publish_down->toUnix() && $row->published == 1) { $img = 'publish_r.png'; $alt = JText::_('Expired'); } else { if ($row->published == 0) { $img = 'publish_x.png'; $alt = JText::_('Unpublished'); } else { if ($row->published == -1) { $img = 'disabled.png'; $alt = JText::_('Archived'); } } } } } if ($user->authorize('com_users', 'manage')) { if ($row->created_by_alias) { $author = $row->created_by_alias; } else { $author = $row->author; } } else { if ($row->created_by_alias) { $author = $row->created_by_alias; } else { $author = $row->author; } } if ($client->id == 0) { if (!$row->access) { $color_access = 'style="color: green;"'; } else { if ($row->access == 1) { $color_access = 'style="color: red;"'; } else { $color_access = 'style="color: black;"'; } } } ?> <tr class="<?php echo "row{$k}"; ?> "> <td> <?php echo $page->getRowOffset($i++); ?> </td> <td> <?php echo '<label class="hasTip" title="' . JText::_('AA_USE_ID_IN_TAG') . '::{article ' . $row->id . '}...{/article}"><a href="javascript://" onclick="articlesanywhere_jInsertEditorText( \'' . $row->id . '\' )">' . $row->id . '</a></label>'; ?> </td> <td> <?php echo '<label class="hasTip" title="' . JText::_('AA_USE_TITLE_IN_TAG') . '::{article ' . htmlspecialchars($row->title, ENT_QUOTES, 'UTF-8') . '}...{/article}"><a href="javascript://" onclick="articlesanywhere_jInsertEditorText( \'' . addslashes(htmlspecialchars($row->title, ENT_COMPAT, 'UTF-8')) . '\' )">' . htmlspecialchars($row->title, ENT_QUOTES, 'UTF-8') . '</a></label>'; ?> </td> <td> <?php echo '<label class="hasTip" title="' . JText::_('AA_USE_ALIAS_IN_TAG') . '::{article ' . $row->alias . '}...{/article}"><a href="javascript://" onclick="articlesanywhere_jInsertEditorText( \'' . $row->alias . '\' )">' . $row->alias . '</a></label>'; ?> </td> <td style="text-align:center;"> <img src="<?php echo JURI::root(true) . '/plugins/system/nnframework/images/' . $img; ?> " width="16" height="16" border="0" alt="<?php echo $alt; ?> " title="<?php echo $alt; ?> " /> </td> <td style="text-align:center;"> <img src="<?php echo JURI::root(true) . '/plugins/system/nnframework/images/' . ($row->frontpage ? 'tick_l.png' : ($row->published != -1 ? 'publish_x_l.png' : 'disabled_l.png')); ?> " width="16" height="16" border="0" alt="<?php echo $row->frontpage ? JText::_('Yes') : JText::_('No'); ?> " title="<?php echo $row->frontpage ? JText::_('Yes') : JText::_('No'); ?> " /> </td> <td style="text-align:center;"> <?php echo $row->ordering; ?> </td> <?php if ($client->id == 0) { ?> <td style="text-align:center;"> <?php echo '<span ' . $color_access . '>' . JText::_($row->accesslevel) . '</span>'; ?> </td> <?php } ?> <td> <?php echo $row->category; ?> </td> <td> <?php echo $author; ?> </td> <td nowrap="nowrap"> <?php echo JHTML::_('date', $row->created, JText::_('DATE_FORMAT_LC4')); ?> </td> <td nowrap="nowrap" style="text-align:center;"> <?php echo $row->hits; ?> </td> </tr> <?php $k = 1 - $k; } ?> </tbody> </table> <?php }
include 'config.php'; db_connect(); $wynik = mysql_query("SELECT * FROM sesja_fotograficzna WHERE status = 0") or die('BÅ‚Ä…d zapytania'); $wyniki = array(); while ($row = mysql_fetch_array($wynik)) { array_push($wyniki, $row); } shuffle($wyniki); if (count($wyniki) > 0) { $i = 0; foreach ($wyniki as $r) { if ($i < 8) { $i++; $rand = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'); $color = '#' . $rand[rand(0, 15)] . $rand[rand(0, 15)] . $rand[rand(0, 15)] . $rand[rand(0, 15)] . $rand[rand(0, 15)] . $rand[rand(0, 15)]; $hashlesscolor = STR_REPLACE('#', NULL, $color); $rr = DECHEX(255 - HEXDEC(SUBSTR($hashlesscolor, 0, 2))); $rr = STRLEN($rr) > 1 ? $rr : '0' . $rr; $gg = DECHEX(255 - HEXDEC(SUBSTR($hashlesscolor, 2, 2))); $gg = STRLEN($gg) > 1 ? $gg : '0' . $gg; $bb = DECHEX(255 - HEXDEC(SUBSTR($hashlesscolor, 4, 2))); $bb = STRLEN($bb) > 1 ? $bb : '0' . $bb; $invcolor = '#' . $rr . $gg . $bb; echo "<div class=\"col-md-3 col-centered\"style=\"text-align:center;padding: 2.5% 2.5% 2.5% 2.5%;\">"; echo "<div class=\"circle\" style=\"text-shadow: -1px 0 #444444, 0 1px #444444, 1px 0 #444444, 0 -1px #444444; border: 1px solid black;color:" . $invcolor . "; background-color:" . $color . "\">"; echo "<a href=\"sesja.php?sesja=" . $r['id_sesji'] . "\">"; echo "<h2>" . $r['lokalizacja'] . "</h2>"; echo "<p>" . $r['data'] . "</p>"; echo "</a>"; echo "</div>"; echo "</div>";
/** * This method calculates the image and delivers it to the client. * * @param $folder * @param $file * @param $width * @param $height * @param $mode */ public function resize($folder, $file, $width = -1, $height = -1, $mode = 'nocrop') { $jpeg_orientation_translation = array(1 => 0, 2 => 0, 3 => 180, 4 => 0, 5 => 0, 6 => -90, 7 => 0, 8 => 90); /** * @var JApplicationSite $app */ $app = JFactory::getApplication(); $params = $app->getParams(); if (strcmp($mode, 'full') == 0) { $mode = 'nocrop'; $width = COM_EVENTGALLERY_IMAGE_ORIGINAL_MAX_WIDTH; $height = COM_EVENTGALLERY_IMAGE_ORIGINAL_MAX_WIDTH; } if ($height > $width) { $width = $height; } $sizeSet = new EventgalleryHelpersSizeset(); $saveAsSize = $sizeSet->getMatchingSize($width); $file = STR_REPLACE("\\.\\.", "", $file); $folder = STR_REPLACE("\\.\\.", "", $folder); $width = STR_REPLACE("\\.\\.", "", $width); $mode = STR_REPLACE("\\.\\.", "", $mode); $file = STR_REPLACE("/", "", $file); $folder = STR_REPLACE("/", "", $folder); $width = STR_REPLACE("/", "", $width); $mode = STR_REPLACE("/", "", $mode); $file = STR_REPLACE("\\", "", $file); $folder = STR_REPLACE("\\", "", $folder); $width = STR_REPLACE("\\", "", $width); $mode = STR_REPLACE("\\", "", $mode); $basedir = COM_EVENTGALLERY_IMAGE_FOLDER_PATH; $sourcedir = $basedir . $folder; $cachebasedir = COM_EVENTGALLERY_IMAGE_CACHE_PATH; $cachedir = $cachebasedir . $folder; $cachedir_thumbs = $cachebasedir . $folder; if (!is_dir(JPATH_CACHE)) { //mkdir($cachebasedir, 0777); mkdir(JPATH_CACHE); } if (!is_dir($cachebasedir)) { //mkdir($cachebasedir, 0777); mkdir($cachebasedir); } if (!is_dir($cachedir)) { //mkdir($cachedir, 0777); mkdir($cachedir); } if (!is_dir($cachedir_thumbs)) { //mkdir($cachedir_thumbs, 0777); mkdir($cachedir_thumbs); } $image_file = $sourcedir . DIRECTORY_SEPARATOR . $file; $image_thumb_file = $cachedir_thumbs . DIRECTORY_SEPARATOR . $mode . $saveAsSize . $file; //$last_modified = gmdate('D, d M Y H:i:s T', filemtime ($image_file)); $last_modified = gmdate('D, d M Y H:i:s T', mktime(0, 0, 0, 1, 1, 2100)); #echo "<br>".$image_thumb_file."<br>"; $debug = false; if ($debug || !file_exists($image_thumb_file)) { $ext = pathinfo($image_file, PATHINFO_EXTENSION); $input_jpeg = null; $exif = null; if (strtolower($ext) == "gif") { if (!($im_original = imagecreatefromgif($image_file))) { echo "Error opening {$image_file}!"; exit; } } else { if (strtolower($ext) == "jpg" || strtolower($ext) == "jpeg") { // try to use PEL first. If things fail, use the php internal method to get the JPEG try { $input_jpeg = new PelJpeg($image_file); /* Retrieve the original Exif data in $jpeg (if any). */ $exif = $input_jpeg->getExif(); /* The input image is already loaded, so we can reuse the bytes stored * in $input_jpeg when creating the Image resource. */ if (!($im_original = ImageCreateFromString($input_jpeg->getBytes()))) { echo "Error opening {$image_file}!"; exit; } } catch (Exception $e) { if (!($im_original = imagecreatefromjpeg($image_file))) { echo "Error opening {$image_file}!"; exit; } } } else { if (strtolower($ext) == "png") { if (!($im_original = imagecreatefrompng($image_file))) { echo "Error opening {$image_file}!"; exit; } } else { die("{$ext} not supported"); } } } if ($params->get('use_autorotate', 1) == 1 && $exif != NULL) { $tiff = $exif->getTiff(); $ifd0 = $tiff->getIfd(); $orientation = $ifd0->getEntry(PelTag::ORIENTATION); if ($orientation != null) { $im_original = imagerotate($im_original, $jpeg_orientation_translation[$orientation->getValue()], 0); $orientation->setValue(1); } } $orig_width = imagesx($im_original); $orig_height = imagesy($im_original); $orig_ratio = imagesx($im_original) / imagesy($im_original); $sizeCalc = new EventgalleryHelpersSizecalculator($orig_width, $orig_height, $width, strcmp('crop', $mode) == 0); $height = $sizeCalc->getHeight(); $width = $sizeCalc->getWidth(); //print_r($sizeCalc); // create canvas/border image //adjust height to not enlarge images if ($width > $orig_width) { $width = $orig_width; } if ($height > $orig_height) { $height = $orig_height; } if (strcmp('crop', $mode) != 0) { $canvasWidth = $width; $canvasHeight = ceil($width / $orig_ratio); if ($canvasHeight > $height) { $canvasHeight = $height; $canvasWidth = ceil($height * $orig_ratio); } $width = $canvasWidth; $height = $canvasHeight; } else { $height = $width; } $isOriginalSize = false; if ($height == $orig_height && $width == $orig_width) { $isOriginalSize = true; } /** * Do not recalculate the image if we don't need to resize it. */ if ($isOriginalSize && $params->get('use_sharpening_for_originalsize', 1) == 0) { $im_output = $im_original; } else { $im_output = imagecreatetruecolor($width, $height); $resize_faktor = $orig_height / $height; $new_height = $height; $new_width = $orig_width / $resize_faktor; if ($new_width < $width) { $resize_faktor = $orig_width / $width; $new_width = $width; $new_height = $orig_height / $resize_faktor; } imagecopyresampled($im_output, $im_original, $width / 2 - $new_width / 2, $height / 2 - $new_height / 2, 0, 0, $new_width, $new_height, $orig_width, $orig_height); $use_sharpening = $params->get('use_sharpening', 1); if ($use_sharpening == 1) { // configure the sharpening $stringSharpenMatrix = $params->get('image_sharpenMatrix', '[[-1,-1,-1],[-1,16,-1],[-1,-1,-1]]'); $sharpenMatrix = json_decode($stringSharpenMatrix); if (null == $sharpenMatrix || count($sharpenMatrix) != 3) { $sharpenMatrix = array(array(-1, -1, -1), array(-1, 16, -1), array(-1, -1, -1)); } $divisor = array_sum(array_map('array_sum', $sharpenMatrix)); $offset = 0; if (function_exists('imageconvolution')) { if (version_compare(phpversion(), '5.5.9', '=')) { $this->imageconvolution($im_output, $sharpenMatrix, $divisor, $offset); } else { imageconvolution($im_output, $sharpenMatrix, $divisor, $offset); } } } } /** * @var EventgalleryLibraryManagerFolder $folderMgr * @var EventgalleryLibraryFolder $folder */ $folderMgr = EventgalleryLibraryManagerFolder::getInstance(); $folder = $folderMgr->getFolder($folder); $watermark = $folder->getWatermark(); // load default watermark if (null == $watermark || !$watermark->isPublished()) { /** * @var EventgalleryLibraryManagerWatermark $watermarkMgr * @var EventgalleryLibraryWatermark $watermark */ $watermarkMgr = EventgalleryLibraryManagerWatermark::getInstance(); $watermark = $watermarkMgr->getDefaultWatermark(); } if (null != $watermark && $watermark->isPublished()) { $watermark->addWatermark($im_output); } $image_quality = $params->get('image_quality', 85); if ($input_jpeg != null) { Pel::setJPEGQuality($image_quality); /* We want the raw JPEG data from $scaled. Luckily, one can create a * PelJpeg object from an image resource directly: */ $output_jpeg = new PelJpeg($im_output); /* If no Exif data was present, then $exif is null. */ if ($exif != null) { $output_jpeg->setExif($exif); } /* We can now save the scaled image. */ $writeSuccess = true; $output_jpeg->saveFile($image_thumb_file); } else { $writeSuccess = imagejpeg($im_output, $image_thumb_file, $image_quality); if (!$writeSuccess) { die("Unable to write to file {$image_thumb_file}"); } } if (!$writeSuccess) { die("Unable to write to file {$image_thumb_file}"); } $time = time() + 315360000; touch($image_thumb_file, $time); // add the ICC profile try { $o = new JPEG_ICC(); $o->LoadFromJPEG($image_file); $o->SaveToJPEG($image_thumb_file); } catch (Exception $e) { } } $mime = ($mime = getimagesize($image_thumb_file)) ? $mime['mime'] : $mime; $size = filesize($image_thumb_file); $fp = fopen($image_thumb_file, "rb"); if (!($mime && $size && $fp)) { // Error. return; } if (!$debug) { header("Content-Type: " . $mime); header("Content-Length: " . $size); header("Last-Modified: {$last_modified}"); } fpassthru($fp); die; //$app->close(); }
} $A['Q2'] = STR_REPLACE(array('+', '-', '=', ' '), '', $Q); if ($A['Q1'] != '=') { $A['Q3'] = 'quantity = quantity ' . $A['Q1'] . ' ?'; } else { $A['Q3'] = 'quantity = ?'; } $A['P1'] = SUBSTR($P, 0, 1); if (IS_NUMERIC($A['P1'])) { $A['P1'] = '='; } $A['P2'] = STR_REPLACE(array('+', '-', '=', ' '), '', $P); if ($A['P1'] != '=') { $A['P3'] = 'price = price ' . $A['P1'] . ' ?'; } else { $A['P3'] = 'price = ?'; } $A['M1'] = SUBSTR($M, 0, 1); if (IS_NUMERIC($A['M1'])) { $A['M1'] = '='; } $A['M2'] = STR_REPLACE(array('+', '-', '=', ' '), '', $M); if ($A['M1'] != '=') { $A['M3'] = 'minimum = minimum ' . $A['M1'] . ' ?'; } else { $A['M3'] = 'minimum = ?'; } $Q = 'INSERT INTO inventory_stock (store, item, quantity, minimum, price, modified) VALUES (?,?,?,?,?,?) ON DUPLICATE KEY UPDATE ' . $A['Q3'] . ', ' . $A['P3'] . ', ' . $A['M3']; MYSQL::QUERY($Q, array($user['store'], $PID, $A['Q2'], $A['M2'], $A['P2'], DATE('Y-m-d H:i:s'), $A['Q2'], $A['P2'], $A['M2'])); $CHECK = MYSQL::QUERY('SELECT quantity,minimum,price FROM inventory_stock WHERE store = ? AND item = ? LIMIT 1', array($user['store'], $PID)); echo $CHECK['quantity'] . '|' . $CHECK['price'] . '|' . $CHECK['minimum'];
public function Footer() { /* REMOVE THE OFFSET AND LIMIT FROM THE QUERYSTRING OR IT KEEPS GETTING LONGER AND LONGER */ //echo "&offset=".($this->offset-$this->start_offset)."&limit=".$this->limit; //echo $this->num_rows_found; $query_string_filter = STR_REPLACE("&offset=" . ($this->offset - $this->start_offset) . "&limit=" . $this->limit, "", $_SERVER['QUERY_STRING']); $this->display_data .= "<tr class='colhead'>\n"; $this->display_data .= "<td colspan='" . count($this->friendly_cols) . "'>\n"; $this->display_data .= "<table class='plain'>\n"; $this->display_data .= "<tr>\n"; //echo $this->offset."<br>"; //echo $this->num_rows_found."<br>"; //echo $this->limit."<br>"; //echo ($this->num_rows_found-$this->limit)."<br>"; //if ($this->offset < ($this->num_rows_found-$this->limit)) { if ($this->offset < $this->num_rows_found) { $this->display_data .= "<td><a href='" . $_SERVER['SCRIPT_NAME'] . "?" . $query_string_filter . "&offset=" . ($this->offset - $this->start_offset + $this->limit) . "&limit=" . $this->limit . "'>Next 10</a></td>\n"; } if ($this->count_rows + $this->offset - $this->start_offset > $this->limit) { $this->display_data .= "<td><a href='" . $_SERVER['SCRIPT_NAME'] . "?" . $query_string_filter . "&offset=" . ($this->offset - $this->limit) . "&limit=" . $this->limit . "'>Previous 10</a></td>\n"; } $this->display_data .= "<td>Showing record:" . ($this->offset - $this->start_offset + 1) . " to " . ($this->offset - $this->start_offset + $this->count_rows) . "</td>\n"; $this->display_data .= "<td>Records found:" . $this->num_rows_found . "</td>\n"; $this->display_data .= "</tr>\n"; $this->display_data .= "</table>\n"; $this->display_data .= "<br></td>\n"; $this->display_data .= "</tr>\n"; }
$file = JRequest::getString('file'); $folder = JRequest::getString('folder'); $width = JRequest::getInt('width', -1); $mode = JRequest::getString('mode', 'nocrop'); $file = STR_REPLACE("\\.\\.", "", $file); $folder = STR_REPLACE("\\.\\.", "", $folder); $width = STR_REPLACE("\\.\\.", "", $width); $mode = STR_REPLACE("\\.\\.", "", $mode); $file = STR_REPLACE("/", "", $file); $folder = STR_REPLACE("/", "", $folder); $width = STR_REPLACE("/", "", $width); $mode = STR_REPLACE("/", "", $mode); $file = STR_REPLACE("\\", "", $file); $folder = STR_REPLACE("\\", "", $folder); $width = STR_REPLACE("\\", "", $width); $mode = STR_REPLACE("\\", "", $mode); //full means max size. if (strcmp('full', $mode) == 0) { $mode = 'nocrop'; $width = 5000; } require_once JPATH_BASE . '/components/com_eventgallery/helpers/sizeset.php'; $sizeSet = new EventgalleryHelpersSizeset(); $saveAsSize = $sizeSet->getMatchingSize($width); $basedir = COM_EVENTGALLERY_IMAGE_FOLDER_PATH; $sourcedir = $basedir . $folder; $cachebasedir = JPATH_CACHE . DIRECTORY_SEPARATOR . 'com_eventgallery_images' . DIRECTORY_SEPARATOR; $cachedir = $cachebasedir . $folder; $cachedir_thumbs = $cachebasedir . $folder; $image_file = $sourcedir . DIRECTORY_SEPARATOR . $file; $image_thumb_file = $cachedir_thumbs . DIRECTORY_SEPARATOR . $mode . $saveAsSize . $file;
<?php require "../../../frame/engine.php"; ENGINE::START(); $STRING = $_POST['str']; $PIN = SUBSTR($STRING, -4); $USERA = STR_REPLACE($PIN, '', $STRING); $PIN = SHA1($PIN); $NEWUSER = MYSQL::QUERY("SELECT * FROM core_users WHERE user_id=? AND pin=? LIMIT 1", array($USERA, $PIN)); if (!empty($NEWUSER)) { USER::LOG("Switched Accounts", $NEWUSER['user_id']); $SES_EXP = TIME() + 43200; $SES_GEN = FORMAT::SES(50); $params = array($SES_GEN, $NEWUSER['user_id'], $SES_EXP, $SES_GEN, $SES_EXP, DATE("Y-m-d H:i:00")); MYSQL::QUERY('INSERT INTO core_users_sessions (session_key,session_user,session_experation) VALUES (?,?,?) ON DUPLICATE KEY UPDATE session_key=?,session_experation=?,qas_time=?', $params); setcookie("core_u", $params[1], $SES_EXP, '/'); setcookie("core_k", $params[0], $SES_EXP, '/'); echo 1; } else { echo 2; }
public static function TEXT($S) { $C = array(" ", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"); return UCFIRST(STRTOLOWER(STR_REPLACE($C, "", $S))); }
$sep = "\t"; //tabbed character //start of printing column names as names of MySQL fields for ($i = 0; $i < MYSQL_NUM_FIELDS($result); $i++) { echo MYSQL_FIELD_NAME($result, $i) . "\t"; } print "\n"; //end of printing column names //start while loop to get data while ($row = MYSQL_FETCH_ROW($result)) { //set_time_limit(60); // HaRa $schema_insert = ""; for ($j = 0; $j < mysql_num_fields($result); $j++) { if (!isset($row[$j])) { $schema_insert .= "NULL" . $sep; } elseif ($row[$j] != "") { $schema_insert .= "{$row[$j]}" . $sep; } else { $schema_insert .= "" . $sep; } } $schema_insert = STR_REPLACE($sep . "\$", "", $schema_insert); //following fix suggested by Josue (thanks, Josue!) //this corrects output in excel when table fields contain \n or \r //these two characters are now replaced with a space $schema_insert = PREG_REPLACE("/\r\n|\n\r|\n|\r/", " ", $schema_insert); $schema_insert .= "\t"; print TRIM($schema_insert); print "\n"; } }
<?php require_once "controllerPaginas.php"; $cPaginas = new controllerPaginas(); $conteudo_pagina = null; $requisicao_pagina = STR_REPLACE(".php", "", empty($_SERVER['REQUEST_URI']) ? 'index' : SUBSTR($_SERVER['REQUEST_URI'], 1, STRLEN($_SERVER['REQUEST_URI']))); if (strpos($requisicao_pagina, "/") >= 0) { $arrayRequisicao = explode("/", $requisicao_pagina); $requisicao_pagina = empty($arrayRequisicao[1]) ? 'index' : $arrayRequisicao[1]; } $arrayPaginas = $cPaginas->listaPaginas(); foreach ($arrayPaginas as $pagina) { if ($pagina['link_pagina'] == strtolower($requisicao_pagina)) { $conteudo_pagina = $pagina['conteudo_pagina']; } } /* if( empty($conteudo_pagina) ) { echo "<script type='text/javascript'>window.location.href='error-page.html';</script>"; exit; } */ ?> <!DOCTYPE html> <html lang="pt"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="web-files/lib/bootstrap/dist/css/bootstrap.min.css" media="all"> <link rel="stylesheet" href="web-files/css/themes/bootstrap.min.css" media="all"> <link rel="stylesheet" href="web-files/css/styleWebsite.css" media="all">
$V = $_GET['v']; $T = $_GET['t']; switch ($T) { case 'Q': $R = 'quantity'; break; case 'P': $R = 'price'; break; case 'M': $R = 'minimum'; break; } $CH = SUBSTR($V, 0, 1); if (IS_NUMERIC($CH)) { $CH = '='; } $VALUE = STR_REPLACE(array('+', '-', '=', ' '), '', $V); if ($CH == '+' || $CH == '-' || $CH == '=') { if ($CH != '=') { $R = $R . " = " . $R; } if ($CH != '-') { $OD = ''; } else { $OD = '-'; } $Q = 'INSERT INTO inventory_stock (store, item, quantity, minimum, price, modified) VALUES (?,?,?,?,?,?) ON DUPLICATE KEY UPDATE ' . $R . ' ' . $CH . ' ' . $VALUE; MYSQL::QUERY($Q, array($user['store'], $P, $OD . $VALUE, 0, 0, DATE('Y-m-d H:i:s'))); echo $CH . "|" . $VALUE; }
} else { $R = explode(" - ", $range); $I[] = str_replace("/", "-", $R[0]); $I[] = str_replace("/", "-", $R[1]); } $PARTS = MYSQL::QUERY('SELECT t_repair_items FROM core_tickets_processed WHERE t_store = ? AND t_checkout_created >= ? AND t_checkout_created <= ?', $I); $ARRAY = array(); foreach ($PARTS as $P) { if (!empty($P)) { $S = EXPLODE("|", $P['t_repair_items']); foreach ($S as $I) { $IS = EXPLODE("-", $I); if ($IS[0] == 'it') { $INFO = MYSQL::QUERY('SELECT dp.p_name, dm.m_name, ma.m_name as manu FROM device_parts dp JOIN device_models dm ON dp.p_model_id = dm.m_id JOIN device_manufacturers ma ON dm.m_manufacturer_id = ma.m_id WHERE dp.p_id = ? LIMIT 1', array($IS[1])); if (!empty($INFO)) { $NAME = STR_REPLACE($INFO['manu'] . " ", "", $INFO['m_name']); $ARRAY[$INFO['manu']]['COUNT']++; $ARRAY[$INFO['manu']]['DEVICES'][$NAME]['COUNT']++; $ARRAY[$INFO['manu']]['DEVICES'][$NAME]['PARTS'][$INFO['p_name']]['COUNT']++; $ARRAY[$INFO['manu']]['DEVICES'][$NAME]['PARTS'][$INFO['p_name']]['PARTN'] = $IS[1]; } } } } } echo 'var data = ['; foreach ($ARRAY as $K1 => $A) { echo "{ name: '" . $K1 . "', data: [{ y: " . $A['COUNT'] . ", drilldown: { label: '" . $K1 . " Device',data: ["; foreach ($A['DEVICES'] as $K2 => $D) { echo "{ name: '" . $K2 . "', data: [{ y: " . $D['COUNT'] . ", drilldown: { label: '" . $K1 . " " . $K2 . " Parts', data: ["; foreach ($D['PARTS'] as $K3 => $P) {
$I = $_POST['NODE']; $DIR_PATH = $_SESSION['Folder_Name'][$I]; while ($_SESSION['Father'][$I] != 0) { $DIR_PATH = $_SESSION['Folder_Name'][$_SESSION['Father'][$I]] . DIRECTORY_SEPARATOR . $DIR_PATH; $I = $_SESSION['Folder_Name'][$I]; } $DIR_PATH = $_SESSION['Folder_Name'][0] . DIRECTORY_SEPARATOR . $DIR_PATH; } else { $DIR_PATH = $_SESSION['Folder_Name'][0]; } $_SESSION['Server_Path'] = DIRNAME($_SESSION['Server_Path']) . DIRECTORY_SEPARATOR . $DIR_PATH; } } $_SESSION['Server_Path'] = STR_REPLACE(CHR(92), DIRECTORY_SEPARATOR, $_SESSION['Server_Path']); //slash unix/windows $_SESSION['Server_Path'] = STR_REPLACE(CHR(47), DIRECTORY_SEPARATOR, $_SESSION['Server_Path']); $_SESSION['Server_Path'] = str_replace(DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, $_SESSION['Server_Path']); // ************************************************************************************************ if (!IS_DIR($_SESSION['Server_Path'])) { PAGE_HEADER("DIRECTORY TREEVIEW", "ERROR BUSCANDO DIRECTORIO", "", ""); ?> <Form METHOD='post' ACTION='<?php echo $_SERVER['PHP_SELF']; ?> ' > <Table ALIGN=center BORDER=0 class=td> <Tr></Tr> <Tr> <Td><Center><H3>Server Path Directory (' <?php echo $_SESSION['Server_Path']; unset($_SESSION['Server_Path']);