protected function weekDayIndex($day) { $day = lowercase($day); if (!in_array($day, $this->validDays)) { throw new \InvalidArgumentException("Provided day '{$day}' is not valid"); } return $this->validDays[$day]; }
public function renderBlock($blockId) { $block = $this->blockProvider->getOneById($blockId); if ($block && isset($block['type'])) { $template = '@block_' . lowercase($block['type']) . '/view.twig'; // TODO: need to get other block params return $this->twigEnvironment->render($template, array('block_id' => $blockId)); } }
function prepare_parentTitle($page, $key) { if ($page['parent'] != '') { $parentTitle = returnPageField($page['parent'], "title"); return lowercase($parentTitle . ' ' . $key); } else { return lowercase($key); } }
function getKeywordsTitle($document) { global $titlePattern; global $titleSplitPattern; global $dictionaryExclude; $titleMatch = array(); if (preg_match($titlePattern, $document, $titleMatch) != 1) { return null; } $keywords = preg_split($titleSplitPattern, $titleMatch[1], NULL, PREG_SPLIT_NO_EMPTY); $keywords = lowercase($keywords); $count = count($keywords); for ($i = 0; $i < $count; $i++) { if (in_array($keywords[$i], $dictionaryExclude)) { unset($keywords[$i]); } } return $keywords; }
/** * Return a directory of files and folders with heirarchy and additional data * * @since 3.1.3 * * @param $directory string directory to scan * @param $recursive boolean whether to do a recursive scan or not. * @param $exts array file extension include filter, array of extensions to include * @param $exclude bool true to treat exts as exclusion filter instead of include * @return multidimensional array or files and folders {type,path,name} */ function directoryToMultiArray($dir, $recursive = true, $exts = null, $exclude = false) { // $recurse is not implemented $result = array(); $dir = rtrim($dir, DIRECTORY_SEPARATOR); $cdir = scandir($dir); foreach ($cdir as $key => $value) { if (!in_array($value, array(".", ".."))) { if (is_dir($dir . DIRECTORY_SEPARATOR . $value)) { $path = preg_replace("#\\\\|//#", "/", $dir . '/' . $value . '/'); $result[$value] = array(); $result[$value]['type'] = "directory"; $result[$value]['path'] = $path; $result[$value]['dir'] = $value; $result[$value]['value'] = call_user_func(__FUNCTION__, $path, $recursive, $exts, $exclude); } else { $path = preg_replace("#\\\\|//#", "/", $dir . '/'); // filetype filter $ext = lowercase(pathinfo($value, PATHINFO_EXTENSION)); if (is_array($exts)) { if (!in_array($ext, $exts) and !$exclude) { continue; } if ($exclude and in_array($ext, $exts)) { continue; } } $result[$value] = array(); $result[$value]['type'] = 'file'; $result[$value]['path'] = $path; $result[$value]['value'] = $value; } } } return $result; }
/** * Clean ID * * Removes characters that don't work in URLs or IDs * * @param string $text * @return string */ function _id($text) { $text = to7bit($text, "UTF-8"); $text = clean_url($text); $text = preg_replace('/[[:cntrl:]]/', '', $text); //remove control characters that cause interface to choke return lowercase($text); }
function genStdThumb($path, $name) { if (!defined('GSIMAGEWIDTH')) { $width = 200; //New width of image } else { $width = GSIMAGEWIDTH; } $ext = lowercase(pathinfo($name, PATHINFO_EXTENSION)); if ($ext == 'jpg' || $ext == 'jpeg' || $ext == 'gif' || $ext == 'png') { $thumbsPath = GSTHUMBNAILPATH . $path; if (!file_exists($thumbsPath)) { if (defined('GSCHMOD')) { $chmod_value = GSCHMOD; } else { $chmod_value = 0755; } mkdir($thumbsPath, $chmod_value); } } $targetFile = GSDATAUPLOADPATH . $path . $name; //thumbnail for post $imgsize = getimagesize($targetFile); switch (lowercase(substr($targetFile, -3))) { case "jpg": $image = imagecreatefromjpeg($targetFile); break; case "png": $image = imagecreatefrompng($targetFile); break; case "gif": $image = imagecreatefromgif($targetFile); break; default: exit; break; } $height = $imgsize[1] / $imgsize[0] * $width; //This maintains proportions $src_w = $imgsize[0]; $src_h = $imgsize[1]; $picture = imagecreatetruecolor($width, $height); imagealphablending($picture, false); imagesavealpha($picture, true); $bool = imagecopyresampled($picture, $image, 0, 0, 0, 0, $width, $height, $src_w, $src_h); if ($bool) { $thumbnailFile = $thumbsPath . "thumbnail." . $name; switch (lowercase(substr($targetFile, -3))) { case "jpg": $bool2 = imagejpeg($picture, $thumbnailFile, 85); break; case "png": imagepng($picture, $thumbnailFile); break; case "gif": imagegif($picture, $thumbnailFile); break; } } imagedestroy($picture); imagedestroy($image); }
function clean_title($d) { $nb = " "; $d = htmlentities($d); $d = html_entity_decode_b($d); $d = html_entity_decode($d); //$d=clean_acc($d); //$d=utflatindecode($d); $d = clean_punct_b($d); $d = lowercase($d); if (substr($d, -1) == '"') { $d = substr($d, 0, -1) . $nb . '»'; } if (substr($d, 0, 1) == '"') { $d = '«' . $nb . substr($d, 1); } $d = str_replace(' "', ' «' . $nb, $d); $d = str_replace(array('" ', '"'), $nb . '» ', $d); $d = ereg_replace("[ ]{2,}", ' ', $d); //$d=clean_punct($d);//add clean_acc //$d=unescape($d); return trim($d); }
imagedestroy($picture); imagedestroy($image); //small thumbnail for image preview $width = 65; //New width of image $height = $imgsize[1] / $imgsize[0] * $width; //This maintains proportions $src_w = $imgsize[0]; $src_h = $imgsize[1]; $picture = imagecreatetruecolor($width, $height); imagealphablending($picture, false); imagesavealpha($picture, true); $bool = imagecopyresampled($picture, $image, 0, 0, 0, 0, $width, $height, $src_w, $src_h); if ($bool) { $thumbsmFile = $thumbsPath . "thumbsm." . $name; switch (lowercase(substr($targetFile, -3))) { case "jpg": header("Content-Type: image/jpeg"); $bool2 = imagejpeg($picture, $thumbsmFile, 85); break; case "png": header("Content-Type: image/png"); imagepng($picture, $thumbsmFile); break; case "gif": header("Content-Type: image/gif"); imagegif($picture, $thumbsmFile); break; } } imagedestroy($picture);
/** * File Type Category * * Returns the category of an file based on it's extension * * @since 1.0 * @uses i18n_r * * @param string $ext * @return string */ function get_FileType($ext) { $ext = lowercase($ext); if ($ext == 'jpg' || $ext == 'jpeg' || $ext == 'pct' || $ext == 'gif' || $ext == 'bmp' || $ext == 'png') { return i18n_r('IMAGES') . ' Images'; } elseif ($ext == 'zip' || $ext == 'gz' || $ext == 'rar' || $ext == 'tar' || $ext == 'z' || $ext == '7z' || $ext == 'pkg') { return i18n_r('FTYPE_COMPRESSED'); } elseif ($ext == 'ai' || $ext == 'psd' || $ext == 'eps' || $ext == 'dwg' || $ext == 'tif' || $ext == 'tiff' || $ext == 'svg') { return i18n_r('FTYPE_VECTOR'); } elseif ($ext == 'swf' || $ext == 'fla') { return i18n_r('FTYPE_FLASH'); } elseif ($ext == 'mov' || $ext == 'mpg' || $ext == 'avi' || $ext == 'mpeg' || $ext == 'rm' || $ext == 'wmv') { return i18n_r('FTYPE_VIDEO'); } elseif ($ext == 'mp3' || $ext == 'wav' || $ext == 'wma' || $ext == 'midi' || $ext == 'mid' || $ext == 'm3u' || $ext == 'ra' || $ext == 'aif') { return i18n_r('FTYPE_AUDIO'); } elseif ($ext == 'php' || $ext == 'phps' || $ext == 'asp' || $ext == 'xml' || $ext == 'js' || $ext == 'jsp' || $ext == 'sql' || $ext == 'css' || $ext == 'htm' || $ext == 'html' || $ext == 'xhtml' || $ext == 'shtml') { return i18n_r('FTYPE_WEB'); } elseif ($ext == 'mdb' || $ext == 'accdb' || $ext == 'pdf' || $ext == 'xls' || $ext == 'xlsx' || $ext == 'csv' || $ext == 'tsv' || $ext == 'ppt' || $ext == 'pps' || $ext == 'pptx' || $ext == 'txt' || $ext == 'log' || $ext == 'dat' || $ext == 'text' || $ext == 'doc' || $ext == 'docx' || $ext == 'rtf' || $ext == 'wks') { return i18n_r('FTYPE_DOCUMENTS'); } elseif ($ext == 'exe' || $ext == 'msi' || $ext == 'bat' || $ext == 'download' || $ext == 'dll' || $ext == 'ini' || $ext == 'cab' || $ext == 'cfg' || $ext == 'reg' || $ext == 'cmd' || $ext == 'sys') { return i18n_r('FTYPE_SYSTEM'); } else { return i18n_r('FTYPE_MISC'); } }
function bm_admin_panel() { global $PRETTYURLS, $BMPRETTYURLS; $books = bm_get_books(true); ?> <h3 class="floated"><?php i18n('books_manager/PLUGIN_NAME'); ?> </h3> <div class="edit-nav clearfix"> <a href="#" id="filter-button" ><?php i18n('FILTER'); ?> </a> <a href="load.php?id=books_manager&edit"><?php i18n('books_manager/NEW_BOOK'); ?> </a> <a href="load.php?id=books_manager&settings"><?php i18n('books_manager/SETTINGS'); ?> </a> </div> <?php if (!empty($books)) { ?> <div id="filter-search"> <form> <input type="text" class="text" id="tokens" placeholder="<?php echo lowercase(i18n_r('FILTER')); ?> ..." /> <a href="load.php?id=books_manager" class="cancel"><?php i18n('books_manager/CANCEL'); ?> </a> </form> </div> <table id="books" class="highlight"> <tr> <th><?php i18n('books_manager/BOOK_TITLE'); ?> </th> <th style="text-align: right;"><?php i18n('books_manager/DATE'); ?> </th> <th></th> <th></th> <th></th> </tr> <?php foreach ($books as $book) { $title = cl($book->title); $date = shtDate($book->date); $url = bm_get_url('book') . $book->slug; ?> <tr> <td class="booktitle"> <a href="load.php?id=books_manager&edit=<?php echo $book->slug; ?> " title="<?php i18n('books_manager/EDIT_BOOK'); ?> : <?php echo $title; ?> "> <?php echo $title; ?> </a> </td> <td style="text-align: right;"> <span><?php echo $date; ?> </span> </td> <td style="width: 20px;text-align: center;"> <?php if ($book->private == 'Y') { echo '<span style="color: #aaa;">P</span>'; } ?> </td> <td class="secondarylink"> <a href="<?php echo $url; ?> " target="_blank" title="<?php i18n('books_manager/VIEW_BOOK'); ?> : <?php echo $title; ?> "> # </a> </td> <td class="delete"> <a href="#" class="delconfirm" title="<?php i18n('books_manager/DELETE_BOOK'); ?> : <?php echo $title; ?> ?"> X </a> </td> </tr> <?php } ?> </table> <p> <b><?php echo count($books); ?> </b> <?php i18n('books_manager/BOOKS'); ?> <?php 'books_manager'; ?> </p> <script> $(document).ready(function() { // filter button opens up filter dialog $("#filter-button").live("click", function($e) { $e.preventDefault(); $("#filter-search").slideToggle(); $(this).toggleClass("current"); $("#filter-search #tokens").focus(); }); // ignore enter key in filter form $("#filter-search #tokens").keydown(function($e) { if($e.keyCode == 13) { $e.preventDefault(); } }); // close filter dialog on cancel $("#filter-search .cancel").live("click", function($e) { $e.preventDefault(); $("#posts tr").show(); $('#filter-button').toggleClass("current"); $("#filter-search #tokens").val(""); $("#filter-search").slideUp(); }); // filter table, see: // http://kobikobi.wordpress.com/2008/09/15/using-jquery-to-filter-table-rows/ $("#posts tr:has(td.posttitle)").each(function() { var t = $(this).find('td.posttitle').text().toLowerCase(); $("<td class='indexColumn'></td>") .hide().text(t).appendTo(this); }); $("#tokens").keyup(function() { var s = $(this).val().toLowerCase().split(" "); $("#posts tr:hidden").show(); $.each(s, function(){ $("#posts tr:visible .indexColumn:not(:contains('" + this + "'))").parent().hide(); }); }); }); </script> <?php } }
function nm_lowercase_tags($str) { if (defined('NMLOWERCASETAGS') && NMLOWERCASETAGS) { return lowercase($str); } else { return $str; } }
<?php if (!$log_data) { echo '<p><em>' . i18n_r('LOG_FILE_EMPTY') . '</em></p>'; } ?> <ol class="more" > <?php $count = 1; if ($log_data) { foreach ($log_data as $log) { echo '<li><p style="font-size:11px;line-height:15px;" ><b style="line-height:20px;" >' . i18n_r('LOG_FILE_ENTRY') . '</b><br />'; foreach ($log->children() as $child) { $name = $child->getName(); echo '<b>' . stripslashes(ucwords($name)) . '</b>: '; $d = $log->{$name}; $n = lowercase($child->getName()); $ip_regex = '/^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:[.](?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$/'; $url_regex = @"((https?|ftp|gopher|telnet|file|notes|ms-help):((//)|(\\\\))+[\\w\\d:#@%/;\$()~_?\\+-=\\\\.&]*)"; //check if its an url address if (do_reg($d, $url_regex)) { $d = '<a href="' . $d . '" target="_blank" >' . $d . '</a>'; } //check if its an ip address if (do_reg($d, $ip_regex)) { if ($d == $_SERVER['REMOTE_ADDR']) { $d = i18n_r('THIS_COMPUTER') . ' (<a href="' . $whois_url . $d . '" target="_blank" >' . $d . '</a>)'; } else { $d = '<a href="' . $whois_url . $d . '" target="_blank" >' . $d . '</a>'; } } //check if its an email address
/** * outputs a ul nested tree from directory array * @param array $array directoryToMultiArray() * @param boolean $hideEmpty omit empty directories if true * @return string */ function editor_array2ul($array, $hideEmpty = true, $recurse = true) { global $allowed_extensions, $template_file, $template; $cnt = 0; $out = "<ul>"; foreach ($array as $key => $elem) { if (!is_array($elem['value'])) { // Is a file $ext = lowercase(pathinfo($elem['value'], PATHINFO_EXTENSION)); if (in_array($ext, $allowed_extensions)) { $filename = $elem['value']; $filepath = $elem['path']; $filenamefull = substr(strstr($filepath . $filename, getRelPath(GSTHEMESPATH) . $template . '/'), strlen(getRelPath(GSTHEMESPATH) . $template . '/')); $open = editor_fileIsOpen($elem['path'], $elem['value']) ? ' open' : ''; if ($filename == GSTEMPLATEFILE) { $ext = 'theme'; $filename = i18n_r('DEFAULT_TEMPLATE'); } $link = myself(false) . '?t=' . $template . '&f=' . $filenamefull; $out .= '<li><a href="' . $link . '"class="file ext-' . $ext . $open . '">' . $filename . "</a></li>"; } } else { if ($recurse) { // Is a folder // Are we showing/hiding empty folders. // WILL NOT hide empty folders that contain at least 1 subfolder $empty = ''; if (count($elem['value']) == 0) { if ($hideEmpty) { continue; } $empty = ' dir-empty'; // empty folder class } $out .= '<li><a class="directory' . $empty . '">' . $key . '</a>' . editor_array2ul($elem['value']) . '</li>'; } } } $out = $out . "</ul>"; return $out; }
<html> <?php if (isset($_GET['sentence'])) { $string = $_GET['sentence']; $result = lowercase($string); echo $result; } function lowercase($string) { $length = strlen($string); $low = " "; for ($i = 0; $i < $length; $i++) { if (ord($string[$i]) >= ord('A') && ord($string[$i]) <= ord('Z')) { $str = chr(ord($string[$i]) + ord('a') - ord('A')); } else { $str = $string[$i]; } $low .= $str; } return $low; } ?> <body> <form action = "lowercasefunction.php" method="get"> Given string:<input type="text" name="sentence"/> <br> <button type="submit">click here</button> </form> </body>
<div id="maincontent"> <div class="main"> <h3 class="floated"><?php i18n('PAGE_MANAGEMENT'); ?> </h3> <div class="edit-nav clearfix" ><p><a href="#" id="filtertable" ><?php i18n('FILTER'); ?> </a><a href="#" id="show-characters" ><?php i18n('TOGGLE_STATUS'); ?> </a></div> <div id="filter-search"> <form><input type="text" autocomplete="off" class="text" id="q" placeholder="<?php echo lowercase(i18n_r('FILTER')); ?> ..." /> <a href="pages.php" class="cancel"><?php i18n('CANCEL'); ?> </a></form> </div> <table id="editpages" class="edittable highlight paginate"> <tr><th><?php i18n('PAGE_TITLE'); ?> </th><th style="text-align:right;" ><?php i18n('DATE'); ?> </th><th></th><th></th></tr> <?php
function __inner_dispatch($cap, $data) { $controllerName = ''; $actionName = ''; $params = array(); // If the cap triad is empty, fall back to the REQUEST url, then to the default route if (empty($cap)) { $cap = isset($_REQUEST['slab_url']) ? $_REQUEST['slab_url'] : $this->config->get('app.default_route'); } if (empty($cap)) { e('No valid route was found. Make sure that the app.default_route setting is properly configured.'); die; } $this->pageLogger->log('inner_dispatch', 'start', "Route: {$cap}"); // get rid of the preceding '/' if (strpos($cap, '/') === 0) { $cap = substr($cap, 1); } // Extract the controller name, action name, and parameters from the cap $route = explode('/', $cap); if (count($route) >= 1) { $controllerName = lowercase($route[0]); } if (count($route) >= 2) { $actionName = lowercase($route[1]); } if (empty($actionName)) { $actionName = 'index'; } if (count($route) >= 3) { $params = array_slice($route, 2); } // Load and create an instance of the controller $controller =& $this->controllerLoader->load_controller($controllerName, $actionName, $params, $data); if (!is_object($controller)) { throw new Exception('Error loading controller'); } // if the Cookie component is loaded, call init_cookie() (as the cookie must be initialised before // Session::before_action() is called below) if (isset($controller->Cookie)) { $controller->Cookie->init_cookie(); } // call the components before_action and before_filter foreach (array_keys($controller->componentRefs) as $k) { $controller->componentRefs[$k]->before_action(); $controller->componentRefs[$k]->before_filter(); } try { $controller->before_action(); $controller->before_filter(); $controller->dispatch_method($actionName, $params); $controller->after_action(); $controller->after_filter(); } catch (Exception $ex) { $controller->ajax_error($ex->getMessage()); } // call the components after_action and after_filter foreach (array_values($controller->componentRefs) as $c) { $c->after_action(); $c->after_filter(); } $this->pageLogger->log('inner_dispatch', 'end', "Route: {$cap}"); return $controller; }
/** * create_pluginsxml * * If the plugins.xml file does not exists, read in each plugin * and add it to the file. * read_pluginsxml() is called again to repopulate $live_plugins * * @since 2.04 * @uses $live_plugins * */ function create_pluginsxml($force = false) { global $live_plugins; if (file_exists(GSPLUGINPATH)) { $pluginfiles = getFiles(GSPLUGINPATH); } $phpfiles = array(); foreach ($pluginfiles as $fi) { if (lowercase(pathinfo($fi, PATHINFO_EXTENSION)) == 'php') { $phpfiles[] = $fi; } } if (!$force) { $livekeys = array_keys($live_plugins); if (count(array_diff($livekeys, $phpfiles)) > 0 || count(array_diff($phpfiles, $livekeys)) > 0) { $force = true; } } if ($force) { $xml = @new SimpleXMLExtended('<?xml version="1.0" encoding="UTF-8"?><channel></channel>'); foreach ($phpfiles as $fi) { $plugins = $xml->addChild('item'); $p_note = $plugins->addChild('plugin'); $p_note->addCData($fi); $p_note = $plugins->addChild('enabled'); if (isset($live_plugins[(string) $fi])) { $p_note->addCData($live_plugins[(string) $fi]); } else { $p_note->addCData('false'); } } XMLsave($xml, GSDATAOTHERPATH . "plugins.xml"); read_pluginsxml(); } }
/** * Adds % wildcards to the given string * * @param $str * @param bool $lowercase * * @return string */ public function formatWildcard($str, $lowercase = true) { if ($lowercase) { $str = lowercase($str); } return preg_replace('\\s+', '%', $str); }
/** * return tags string as array * explodes on delim, lowers case, and trims keyword strings * @since 3.4 * @param string $str string of delimited keywords * @param bool $case preserve case if true, else lower * @param str $delim delimiter for splitting * @return array returns array of tags */ function tagsToAry($str, $case = false, $delim = ',') { if (!$case) { $str = lowercase($str); } $ary = explode($delim, $str); $ary = array_map('trim', $ary); return $ary; }
//isset() determines if var is set and not null if (isset($argv)) { $var = $argv[1]; } // check for an empty string and display a message. if (isset($_GET['q'])) { $var = trim($_GET['q']); } //trim whitespace from the stored variable if (isset($var)) { $trimmed = trim($var); } else { $trimmed = ""; } $trimmed = lowercase($trimmed); //'accueillir'; $trimmed = utf8_decode($trimmed); function lowercase($word) { return strtolower($word); } function sql_query($word) { $params = '?q=' . $word; $ch = curl_init('http://localhost/ybourque/Wikparser/lib/browsertest/mysqltest.php' . $params); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
function get_mime_type($ext = '') { $mimes = array('hqx' => 'application/mac-binhex40', 'cpt' => 'application/mac-compactpro', 'doc' => 'application/msword', 'bin' => 'application/macbinary', 'dms' => 'application/octet-stream', 'lha' => 'application/octet-stream', 'lzh' => 'application/octet-stream', 'exe' => 'application/octet-stream', 'class' => 'application/octet-stream', 'psd' => 'application/octet-stream', 'so' => 'application/octet-stream', 'sea' => 'application/octet-stream', 'dll' => 'application/octet-stream', 'oda' => 'application/oda', 'pdf' => 'application/pdf', 'ai' => 'application/postscript', 'eps' => 'application/postscript', 'ps' => 'application/postscript', 'smi' => 'application/smil', 'smil' => 'application/smil', 'mif' => 'application/vnd.mif', 'xls' => 'application/vnd.ms-excel', 'ppt' => 'application/vnd.ms-powerpoint', 'pptx' => 'application/vnd.ms-powerpoint', 'wbxml' => 'application/vnd.wap.wbxml', 'wmlc' => 'application/vnd.wap.wmlc', 'dcr' => 'application/x-director', 'dir' => 'application/x-director', 'dxr' => 'application/x-director', 'dvi' => 'application/x-dvi', 'gtar' => 'application/x-gtar', 'php' => 'application/x-httpd-php', 'php4' => 'application/x-httpd-php', 'php3' => 'application/x-httpd-php', 'phtml' => 'application/x-httpd-php', 'phps' => 'application/x-httpd-php-source', 'js' => 'application/x-javascript', 'swf' => 'application/x-shockwave-flash', 'sit' => 'application/x-stuffit', 'tar' => 'application/x-tar', 'tgz' => 'application/x-tar', 'xhtml' => 'application/xhtml+xml', 'xht' => 'application/xhtml+xml', 'zip' => 'application/zip', 'mid' => 'audio/midi', 'midi' => 'audio/midi', 'mpga' => 'audio/mpeg', 'mp2' => 'audio/mpeg', 'mp3' => 'audio/mpeg', 'aif' => 'audio/x-aiff', 'aiff' => 'audio/x-aiff', 'aifc' => 'audio/x-aiff', 'ram' => 'audio/x-pn-realaudio', 'rm' => 'audio/x-pn-realaudio', 'rpm' => 'audio/x-pn-realaudio-plugin', 'ra' => 'audio/x-realaudio', 'rv' => 'video/vnd.rn-realvideo', 'wav' => 'audio/x-wav', 'bmp' => 'image/bmp', 'gif' => 'image/gif', 'jpeg' => 'image/jpeg', 'jpg' => 'image/jpeg', 'jpe' => 'image/jpeg', 'png' => 'image/png', 'tiff' => 'image/tiff', 'tif' => 'image/tiff', 'css' => 'text/css', 'html' => 'text/html', 'htm' => 'text/html', 'shtml' => 'text/html', 'txt' => 'text/plain', 'text' => 'text/plain', 'log' => 'text/plain', 'rtx' => 'text/richtext', 'rtf' => 'text/rtf', 'xml' => 'text/xml', 'xsl' => 'text/xml', 'mpeg' => 'video/mpeg', 'mpg' => 'video/mpeg', 'mpe' => 'video/mpeg', 'qt' => 'video/quicktime', 'mov' => 'video/quicktime', 'avi' => 'video/x-msvideo', 'movie' => 'video/x-sgi-movie', 'doc' => 'application/msword', 'docx' => 'application/msword', 'word' => 'application/msword', 'xl' => 'application/excel', 'xls' => 'application/excel', 'xlsx' => 'application/excel', 'eml' => 'message/rfc822'); return !isset($mimes[lowercase($ext)]) ? 'application/octet-stream' : $mimes[lowercase($ext)]; }
function nm_admin_panel() { global $NMPAGEURL; $posts = nm_get_posts(true); if (nm_post_files_differ($posts)) { nm_update_cache(); $posts = nm_get_posts(true); if (nm_post_files_differ($posts)) { nm_display_message('<b>Warning:</b> Post files/cache mismatch', true); } else { nm_display_message('Post cache file has been updated', false); } // not translated } ?> <h3 class="floated"><?php i18n('news_manager/PLUGIN_NAME'); ?> </h3> <div class="edit-nav clearfix"> <a href="#" id="filter-button" ><?php i18n('FILTER'); ?> </a> <a href="load.php?id=news_manager&edit"><?php i18n('news_manager/NEW_POST'); ?> </a> <a href="load.php?id=news_manager&settings"><?php i18n('news_manager/SETTINGS'); ?> </a> </div> <?php if (!empty($posts)) { ?> <div id="filter-search"> <form> <input type="text" class="text" id="tokens" placeholder="<?php echo lowercase(strip_tags(i18n_r('FILTER'))); ?> ..." /> <a href="load.php?id=news_manager" class="cancel"><?php i18n('news_manager/CANCEL'); ?> </a> </form> </div> <table id="posts" class="highlight"> <tr> <th><?php i18n('news_manager/POST_TITLE'); ?> </th> <th style="text-align: right;"><?php i18n('news_manager/DATE'); ?> </th> <th></th> <th></th> <th></th> </tr> <?php foreach ($posts as $post) { $title = stripslashes($post->title); $date = shtDate($post->date); $url = nm_get_url('post') . $post->slug; $url = nm_patch_i18n_url($url); ?> <tr> <td class="posttitle"> <a href="load.php?id=news_manager&edit=<?php echo $post->slug; ?> " title="<?php i18n('news_manager/EDIT_POST'); ?> : <?php echo $title; ?> "> <?php echo $title; ?> </a> </td> <td style="text-align: right;"> <?php if (strtotime($post->date) > time()) { echo '<span style="color:#aaa">', $date, '</span>'; } else { echo '<span>', $date, '</span>'; } ?> </td> <td style="width: 20px;text-align: center;"> <?php if ($post->private == 'Y') { echo '<span style="color: #aaa;">P</span>'; } ?> </td> <td class="secondarylink"> <?php if ($NMPAGEURL && $NMPAGEURL != '') { ?> <a href="<?php echo $url; ?> " target="_blank" title="<?php i18n('news_manager/VIEW_POST'); ?> : <?php echo $title; ?> "> # </a> <?php } ?> </td> <td class="delete"> <a href="load.php?id=news_manager&delete=<?php echo $post->slug; ?> " class="nm_delconfirm" title="<?php i18n('news_manager/DELETE_POST'); ?> : <?php echo $title; ?> ?"> × </a> </td> </tr> <?php } ?> </table> <p> <b><?php echo count($posts); ?> </b> <?php i18n('news_manager/POSTS'); ?> </p> <script> $(document).ready(function() { // filter button opens up filter dialog $("#filter-button").on("click", function($e) { $e.preventDefault(); $("#filter-search").slideToggle(); $(this).toggleClass("current"); $("#filter-search #tokens").focus(); }); // ignore enter key in filter form $("#filter-search #tokens").keydown(function($e) { if($e.keyCode == 13) { $e.preventDefault(); } }); // close filter dialog on cancel $("#filter-search .cancel").on("click", function($e) { $e.preventDefault(); $("#posts tr").show(); $('#filter-button').toggleClass("current"); $("#filter-search #tokens").val(""); $("#filter-search").slideUp(); }); // filter table, see: // http://kobikobi.wordpress.com/2008/09/15/using-jquery-to-filter-table-rows/ $("#posts tr:has(td.posttitle)").each(function() { var t = $(this).find('td.posttitle').text().toLowerCase(); $("<td class='indexColumn'></td>") .hide().text(t).appendTo(this); }); $("#tokens").keyup(function() { var s = $(this).val().toLowerCase().split(" "); $("#posts tr:hidden").show(); $.each(s, function(){ $("#posts tr:visible .indexColumn:not(:contains('" + this + "'))").parent().hide(); }); }); // confirm delete $('.nm_delconfirm').on('click', function () { return confirm($(this).attr("title")); }); }); </script> <?php } }
/** * Clean ID * * Removes characters that don't work in URLs or IDs * * @param string $text * @return string */ function _id($text) { $text = to7bit($text, "UTF-8"); $text = clean_url($text); return lowercase($text); }
$filenames = getFiles($path); if (count($filenames) != 0) { foreach ($filenames as $file) { if ($file == "." || $file == ".." || $file == ".htaccess" || $file == "index.php") { // not a upload file } elseif (is_dir($path . $file)) { $dirsArray[$dircount]['name'] = $file; clearstatcache(); $ss = @stat($path . $file); $dirsArray[$dircount]['date'] = @date('M j, Y', $ss['mtime']); $dircount++; } else { $filesArray[$count]['name'] = $file; $ext = getFileExtension($file); $filetype = get_FileTypeToken($ext); $filesArray[$count]['type'] = lowercase($filetype); clearstatcache(); $ss = @stat($path . $file); $filesArray[$count]['date'] = @date('M j, Y', $ss['ctime']); $filesArray[$count]['size'] = fSize($ss['size']); $totalsize = $totalsize + $ss['size']; $count++; } } $filesSorted = subval_sort($filesArray, 'name'); $dirsSorted = subval_sort($dirsArray, 'name'); } echo '<div class="edit-nav clearfix" >'; echo '<select id="imageFilter">'; echo '<option value="all">' . i18n_r('SHOW_ALL') . '</option>'; if (count($filesSorted) > 0) {
/** * get table row for pages display * * @since 3.4 * @param array $page page array * @param int $level current level * @param int $index current index * @param int $parent parent index * @param int $children number of children * @return str html for table row */ function getPagesRow($page, $level, $index, $parent, $children) { $indentation = $menu = ''; // indentation $indent = '<span class="tree-indent"></span>'; $last = '<span class="tree-indent indent-last">–</span>'; // add indents based on level $indentation .= $level > 0 ? str_repeat($indent, $level - 1) : ''; $indentation .= $level > 0 ? $last : ''; // add indents or expanders $isParent = $children > 0; // add expanders in php // $expander = '<span class="tree-expander tree-expander-expanded"></span>'; // $expander = $isParent ? $expander : '<span class="tree-indent"></span>'; // $indentation = $indentation . $expander; // depth level identifiers $class = 'depth-' . $level; $class .= $isParent ? ' tree-parent' : ''; $menu .= '<tr id="tr-' . $page['url'] . '" class="' . $class . '" data-depth="' . $level . '">'; $pagetitle = $pagemenustatus = $pageprivate = $pagedraft = $pageindex = ''; if ($page['title'] == '') { $pagetitle = '[No Title] » <em>' . $page['url'] . '</em>'; } else { $pagetitle = $page['title']; } if ($page['menuStatus'] != '') { $pagemenustatus = ' <span class="label label-ghost">' . i18n_r('MENUITEM_SUBTITLE') . '</span>'; } if ($page['private'] != '') { $pageprivate = ' <span class="label label-ghost">' . i18n_r('PRIVATE_SUBTITLE') . '</span>'; } if (pageHasDraft($page['url'])) { $pagedraft = ' <span class="label label-ghost">' . lowercase(i18n_r('LABEL_DRAFT')) . '</span>'; } if ($page['url'] == getDef('GSINDEXSLUG')) { $pageindex = ' <span class="label label-ghost">' . i18n_r('HOMEPAGE_SUBTITLE') . '</span>'; } if (dateIsToday($page['pubDate'])) { $pagepubdate = ' <span class="datetoday">' . output_date($page['pubDate']) . '</span>'; } else { $pagepubdate = '<span>' . output_date($page['pubDate']) . "</span>"; } $pagetitle = cl($pagetitle); $menu .= '<td class="pagetitle">' . $indentation . '<a title="' . i18n_r('EDITPAGE_TITLE') . ': ' . var_out($pagetitle) . '" href="edit.php?id=' . $page['url'] . '" >' . $pagetitle . '</a>'; $menu .= '<div class="showstatus toggle" >' . $pageindex . $pagedraft . $pageprivate . $pagemenustatus . '</div></td>'; // keywords used for filtering $menu .= '<td style="width:80px;text-align:right;" ><span>' . $pagepubdate . '</span></td>'; $menu .= '<td class="secondarylink" >'; $menu .= '<a title="' . i18n_r('VIEWPAGE_TITLE') . ': ' . var_out($pagetitle) . '" target="_blank" href="' . find_url($page['url'], $page['parent']) . '">#</a>'; $menu .= '</td>'; // add delete buttons, exclude index page if ($page['url'] != 'index') { $menu .= '<td class="delete" ><a class="delconfirm" href="deletefile.php?id=' . $page['url'] . '&nonce=' . get_nonce("delete", "deletefile.php") . '" title="' . i18n_r('DELETEPAGE_TITLE') . ': ' . cl($page['title']) . '" >×</a></td>'; } else { $menu .= '<td class="delete" ></td>'; } // add indexcolumn and tagcolumn for filtering $menu .= '<td class="indexColumn hidden">' . strip_tags(lowercase($pagetitle . $pageindex . $pagemenustatus . $pageprivate . $pagedraft)) . '</div></td>'; // keywords used for filtering $menu .= '<td class="tagColumn hidden">' . str_replace(',', ' ', $page['meta']) . '</div></td>'; // keywords used for filtering $menu .= '</tr>'; return $menu; }
?> " ><?php i18n('FILTER'); ?> </a> <a href="#" id="show-characters" accesskey="<?php echo find_accesskey(i18n_r('TOGGLE_STATUS')); ?> " ><?php i18n('TOGGLE_STATUS'); ?> </a> </div> <div id="filter-search"> <form><input type="text" autocomplete="off" class="text" id="q" placeholder="<?php echo strip_tags(lowercase(i18n_r('FILTER'))); ?> ..." /> <a href="pages.php" class="cancel"><?php i18n('CANCEL'); ?> </a></form> </div> <table id="editpages" class="edittable highlight paginate"> <tr><th><?php i18n('PAGE_TITLE'); ?> </th><th style="text-align:right;" ><?php i18n('DATE'); ?> </th><th></th><th></th></tr>
# Relative if (defined('GSADMIN')) { $GSADMIN = GSADMIN; } else { $GSADMIN = 'admin'; } $admin_relative = $GSADMIN . '/inc/'; $lang_relative = $GSADMIN . '/'; $base = true; # Include common.php include $GSADMIN . '/inc/common.php'; # get page id (url slug) that is being passed via .htaccess mod_rewrite if (isset($_GET['id'])) { $id = str_replace('..', '', $_GET['id']); $id = str_replace('/', '', $id); $id = lowercase($id); } else { $id = "index"; } # define page, spit out 404 if it doesn't exist $file = GSDATAPAGESPATH . $id . '.xml'; $file_404 = GSDATAOTHERPATH . '404.xml'; $user_created_404 = GSDATAPAGESPATH . '404.xml'; if (!file_exists($file)) { if (file_exists($user_created_404)) { //user created their own 404 page, which overrides the default 404 message $file = $user_created_404; } elseif (file_exists($file_404)) { $file = $file_404; } exec_action('error-404');
<?php /** * Configuration File * * @package GetSimple * @subpackage Config */ $site_full_name = 'GetSimple'; $site_version_no = '3.3.10'; $name_url_clean = lowercase(str_replace(' ', '-', $site_full_name)); $ver_no_clean = str_replace('.', '', $site_version_no); $site_link_back_url = 'http://get-simple.info/'; // cookie config $cookie_name = lowercase($name_url_clean) . '_cookie_' . $ver_no_clean; // non-hashed name of cookie $cookie_login = '******'; // login redirect $cookie_time = '10800'; // in seconds, 3 hours $cookie_path = '/'; // cookie path $cookie_domain = null; // cookie domain $cookie_secure = null; // cookie secure only $cookie_httponly = true; // cookie http only $api_url = 'http://get-simple.info/api/start/v3.php'; # $api_timeout = 800; // time in ms defaults to 500 # $debugApi = true;
/** * Validate Safe File * NEVER USE MIME CHECKING FROM BROWSERS, eg. $_FILES['userfile']['type'] cannot be trusted * @since 3.1 * @uses file_mime_type * @uses $mime_type_blacklist * @uses $file_ext_blacklist * * @param string $file, absolute path * @param string $name, filename * @param string $mime, optional * @return bool */ function validate_safe_file($file, $name, $mime = null) { global $mime_type_blacklist, $file_ext_blacklist, $mime_type_whitelist, $file_ext_whitelist; include GSADMININCPATH . 'configuration.php'; $file_extension = lowercase(pathinfo($name, PATHINFO_EXTENSION)); if ($mime && $mime_type_whitelist && in_arrayi($mime, $mime_type_whitelist)) { return true; } if ($file_ext_whitelist && in_arrayi($file_extension, $file_ext_whitelist)) { return true; } // skip blackist checks if whitelists exist if ($mime_type_whitelist || $file_ext_whitelist) { return false; } if ($mime && in_arrayi($mime, $mime_type_blacklist)) { return false; } elseif (in_arrayi($file_extension, $file_ext_blacklist)) { return false; } else { return true; } }