private function get_md5() { // getting the md5 hash of the file $a[0] = $this->html->getElementByTagName("div.window_section")->nextsibling()->childNodes(1)->childNodes(0)->plaintext; $a[1] = $this->html->getElementByTagName("div.window_section")->nextsibling()->nextsibling()->childNodes(1)->childNodes(0)->plaintext; $this->md = trim(substr(strchr($a[0], "MD5:") ? $a[0] : $a[1], 4)); }
/** * @TODO ! BAM * * @param $s1 * @param $s2 * * @return bool|int */ public static function isRotation($s1, $s2) { if (!strchr($s2 . $s2, $s1)) { return false; } return true; }
public function updateUser($id) { $req = $this->app->request(); $imageName = $_FILES['image']['name']; $imageTmp = $_FILES['image']['tmp_name']; $uniqueID = md5(uniqid(rand(), true)); $fileType = strchr($imageName, '.'); $newUpload = 'assets/img_public/' . $uniqueID . $fileType; if ($imageName != null) { unlink(User::showImageUser($id)); } move_uploaded_file($imageTmp, $newUpload); @chmod($newUpload, 0777); if ($imageName != null) { $sql = 'UPDATE users SET u_email = :u_email, u_password = :u_password, u_image = :u_image, level = :level WHERE user_id = :id'; } else { $sql = 'UPDATE users SET u_email = :u_email, u_password = :u_password, level = :level WHERE user_id = :id'; } $this->users = parent::connect()->prepare($sql); $this->users->bindValue(':u_email', $req->post('email')); $this->users->bindValue(':u_password', Bcrypt::hash($req->post('password'))); if ($imageName != null) { $this->users->bindValue(':u_image', $newUpload); } $this->users->bindValue(':level', $req->post('level')); $this->users->bindValue(':id', $id); try { $this->users->execute(); } catch (PDOException $e) { die($e->getMessage()); } }
public function get($handle, $id) { $result = array(); $lyric = ''; // id should be url of lyric if (strchr($id, $this->sitePrefix) === FALSE) { return FALSE; } $content = FujirouCommon::getContent($id); if (!$content) { return FALSE; } $prefix = "<div class='lyricbox'>"; $suffix = "<!--"; $lyricLine = FujirouCommon::getSubString($content, $prefix, $suffix); $pattern = '/<\\/script>(.*)<!--/'; $matchedString = FujirouCommon::getFirstMatch($lyricLine, $pattern); if (!$matchedString) { return FALSE; } $lyric = trim(str_replace('<br />', "\n", $matchedString)); $lyric = FujirouCommon::decodeHTML($lyric); $lyric = trim(strip_tags($lyric)); $handle->addLyrics($lyric, $id); return TRUE; }
public function thumbnail2(Request $request) { if ($request->hasFile('thumbnail_file2')) { $messages = ['photo.image' => '上传文件必须是图片', 'photo.max' => '上传文件不能大于:maxkb']; $this->validate($request, ['photo' => 'image|max:100000'], $messages); if ($request->file('thumbnail_file2')->isValid()) { $OriginalName = $request->file('thumbnail_file2')->getClientOriginalName(); $file_pre = sha1(time() . $OriginalName); //取得当前时间戳 $file_suffix = substr(strchr($request->file('thumbnail_file2')->getMimeType(), "/"), 1); //取得文件后缀 $destinationPath = 'uploads'; //上传路径 $fileName = $file_pre . '.' . $file_suffix; //上传文件名 Image::make($request->file('thumbnail_file2'))->resize(300, null, function ($constraint) { $constraint->aspectRatio(); })->save('uploads/thumbnails/' . $fileName); $request->file('thumbnail_file2')->move($destinationPath, $fileName); $img = new Img(); $img->name = $fileName; $img->save(); Session()->flash('img2', $fileName); return $fileName; } else { return "上传文件无效!"; } } else { return "文件上传失败!"; } }
function SOAP_Test($methodname, $params, $expect = NULL, $cmp_func = NULL) { # XXX we have to do this to make php-soap happy with NULL params if (!$params) { $params = array(); } if (strchr($methodname, '(')) { preg_match('/(.*)\\((.*)\\)/', $methodname, $matches); $this->test_name = $methodname; $this->method_name = $matches[1]; } else { $this->test_name = $this->method_name = $methodname; } $this->method_params = $params; if ($expect !== NULL) { $this->expect = $expect; } if ($cmp_func !== NULL) { $this->cmp_func = $cmp_func; } // determine test type if ($params) { $v = array_values($params); if (gettype($v[0]) == 'object' && (get_class($v[0]) == 'SoapVar' || get_class($v[0]) == 'SoapParam')) { $this->type = 'soapval'; } } }
/** * @param $handle * @param $fields * @param string $delimiter * @param string $enclosure * @param bool $useArrayKey * @param string $escape */ public static function putCSV($handle, $fields, $delimiter = ',', $enclosure = '"', $useArrayKey = false, $escape = '\\') { $first = 1; foreach ($fields as $key => $field) { if ($first == 0) { fwrite($handle, $delimiter); } if ($useArrayKey) { $f = str_replace($enclosure, $enclosure . $enclosure, $key); } else { $field = EXPORT_ENCODE_FUNCTION != "none" && function_exists(EXPORT_ENCODE_FUNCTION) ? call_user_func(EXPORT_ENCODE_FUNCTION, $field) : $field; $f = str_replace($enclosure, $enclosure . $enclosure, $field); } if ($enclosure != $escape) { $f = str_replace($escape . $enclosure, $escape, $f); } if (strpbrk($f, " \t\n\r" . $delimiter . $enclosure . $escape) || strchr($f, "")) { fwrite($handle, $enclosure . $f . $enclosure); } else { fwrite($handle, $f); } $first = 0; } fwrite($handle, "\n"); }
function stripallslashes($string) { while (strchr($string, '\\')) { $string = stripslashes($string); } return $string; }
public function index($doc_id = NULL) { $docss[0] = array("Basic Instructions" => 'basics.html'); $docss[1] = array("Answering Queries" => 'queries.html'); $docss[2] = array('Add Assignment' => "add_assignment.html", "Sample Assignment" => "sample_assignment.html", "Detect similar codes" => "moss.html", "Tests Structure" => "tests_structure.html", "Assignment Helper" => "assignment_helper.html"); $docss[3] = array('About The Campus Judge' => 'readme.html', 'Users' => "users.html", 'Clean urls' => "clean_urls.html", 'Installation' => "installation.html", 'Settings' => "settings.html", 'Sandboxing' => "sandboxing.html", 'Security' => "security.html", 'Shield' => "shield.html"); $baseaddr = "assets/docs/html/"; //$filename="index.html"; $level = $this->user->level; $docs = []; for ($i = 0; $i <= $level; $i++) { $docs = array_merge($docs, $docss[$i]); } if ($doc_id === NULL) { $data = array('all_assignments' => $this->assignment_model->all_assignments(), 'docs' => array_keys($docs)); $this->twig->display('pages/docslist.twig', $data); } else { if (strchr($doc_id, ".md")) { $doc_id = array_search(str_replace(".md", ".html", $doc_id), $docs); } if ($doc_id && array_key_exists($doc_id, $docs)) { $data = array('all_assignments' => $this->assignment_model->all_assignments(), 'page' => file_get_contents($baseaddr . $docs[$doc_id])); //echo file_get_contents($baseaddr.$filename); $this->twig->display('pages/docview.twig', $data); } else { show_404(); } } }
function image_thumb_onfly($image_path, $height, $width, $crop = FALSE, $ratio = TRUE) { // Get the CodeIgniter super object $CI =& get_instance(); $ext = strchr($image_path, '.'); $file_name = substr(basename($image_path), 0, -strlen($ext)); // Path to image thumbnail $image_thumb = dirname($image_path) . '/' . $file_name . '_' . $height . '_' . $width . $ext; if (!file_exists($image_thumb)) { // LOAD LIBRARY $CI->load->library('image_lib'); // CONFIGURE IMAGE LIBRARY $config['image_library'] = 'gd2'; $config['source_image'] = $image_path; $config['new_image'] = $image_thumb; $config['maintain_ratio'] = $ratio; $config['height'] = $height; $config['width'] = $width; $CI->image_lib->initialize($config); if ($crop) { $CI->image_lib->crop(); } else { $CI->image_lib->resize(); } $CI->image_lib->clear(); } return '<img src="' . dirname($_SERVER['SCRIPT_NAME']) . '/' . $image_thumb . '" onerror="loadNoPic(this,\'' . base_url() . '\')"/>'; }
public function updateCarousel($id) { $req = $this->app->request(); $imageName = $_FILES['image']['name']; $imageTmp = $_FILES['image']['tmp_name']; $uniqueID = md5(uniqid(rand(), true)); $fileType = strchr($imageName, '.'); $newUpload = 'assets/img_public/' . $uniqueID . $fileType; if ($imageName != null) { unlink(carousel::showImagecarousel($id)); } move_uploaded_file($imageTmp, $newUpload); @chmod($newUpload, 0777); if ($imageName != null) { $sql = 'UPDATE carousels SET image = :image, title = :title, description = :description where carousel_id = :id'; } else { $sql = 'UPDATE carousels SET title = :title, description = :description where carousel_id = :id'; } $this->carousels = parent::connect()->prepare($sql); if ($imageName != null) { $this->carousels->bindValue(':image', $newUpload); } $this->carousels->bindValue(':title', $req->post('title')); $this->carousels->bindValue(':description', $req->post('description')); $this->carousels->bindValue(':id', $id); try { $this->carousels->execute(); } catch (PDOException $e) { die($e->getMessage()); } }
static function fputcsv($handle, $row, $fd = ',', $quot = '"') { $str = ''; $nums = count($row); $i = 1; foreach ($row as $cell) { $cell = trim($cell); if (!self::detectUTF8($cell)) { $cell = @iconv('gb2312', 'utf-8', $cell); } // if (empty($cell)) { continue; } $cell = str_replace(array($quot, "\n"), array($quot . $quot, ''), $cell); if ($i < $nums) { if ($fd && strchr($cell, $fd) !== FALSE || strchr($cell, $quot) !== FALSE) { $str .= $quot . $cell . $quot . $fd; } else { $str .= $cell . $fd; } } else { $str .= $cell . $quot; } $i++; } fputs($handle, substr($str, 0, -1) . "\n"); return strlen($str); }
/** * Finds cities on given name and country * * @param string $p_cityName * @param string $p_countryCode * * @return array */ public function FindCitiesByNameLocal($p_cityName, $p_countryCode = '') { global $g_ado_db; $cityName_changed = str_replace(' ', '%', trim($p_cityName)); $is_exact = !strchr($p_cityName, '%'); $queryStr = 'SELECT DISTINCT id, city_name as name, country_code as country, population, X(position) AS latitude, Y(position) AS longitude FROM ' . $this->m_dbTableName . ' WHERE city_name LIKE ?'; if (!empty($p_countryCode)) { $queryStr .= ' AND cl.country_code = ?'; } $sql_params = array($p_cityName, $cityName_changed, $cityName_changed . '%', '%' . $cityName_changed . '%'); $queryStr .= ' GROUP BY id ORDER BY population DESC, id LIMIT 100'; $cities = array(); foreach ($sql_params as $param) { $params = array($param); if (!empty($p_countryCode)) { $params[] = (string) $p_countryCode; } $rows = $g_ado_db->GetAll($queryStr, $params); foreach ((array) $rows as $row) { $one_town_info = (array) $row; $one_town_info['provider'] = 'GN'; $one_town_info['copyright'] = 'Data © GeoNames.org, CC-BY'; $cities[] = $one_town_info; } if (!empty($cities)) { break; } } return $cities; }
/** * Returns an event! * @param <type> $dayName * @param <type> $row * @return <type> */ private static function parseRow($row) { $event = new WPlan_Event(); if ($row == "...") { $event->empty = TRUE; return $event; } $event->empty = FALSE; $parts = explode(',', $row); $i = 0; foreach ($parts as $part) { $part = trim($part); switch ($i) { case 0: $times = WPlan::parseTimes($part); $event->from = $times['from']; $event->to = $times['to']; break; case 1: $event->name = $part; break; case 2: $sep = ' '; if (strchr($part, '/')) { $sep = '/'; } $event->sensei = explode($sep, $part); break; default: $event->info[] = $part; } $i += 1; } return $event; }
function set_fromhost() { global $proxyIPs; global $fullfromhost; global $fromhost; @($fullfromhost = $_SERVER["HTTP_X_FORWARDED_FOR"]); if ($fullfromhost == "") { @($fullfromhost = $_SERVER["REMOTE_ADDR"]); $fromhost = $fullfromhost; } else { $ips = explode(",", $fullfromhost); $c = count($ips); if ($c > 1) { $fromhost = trim($ips[$c - 1]); if (isset($proxyIPs) && in_array($fromhost, $proxyIPs)) { $fromhost = $ips[$c - 2]; } } else { $fromhost = $fullfromhost; } } if ($fromhost == "") { $fromhost = "127.0.0.1"; $fullfromhost = "127.0.0.1"; } if (defined("IPV6_LEGACY_IPV4_DISPLAY")) { if (strchr($fromhost, '.') && ($p = strrchr($fromhost, ':'))) { $fromhost = substr($p, 1); } } //sometimes,fromhost has strang space bbs_setfromhost(trim($fromhost), trim($fullfromhost)); }
public function execute() { if (!defined('WIKIHIERO_VERSION')) { $this->error("Please install WikiHiero first!\n", true); } $wh_prefabs = "\$wh_prefabs = array(\n"; $wh_files = "\$wh_files = array(\n"; $imgDir = dirname(__FILE__) . '/img/'; if (is_dir($imgDir)) { $dh = opendir($imgDir); if ($dh) { while (($file = readdir($dh)) !== false) { if (stristr($file, WikiHiero::IMAGE_EXT)) { list($width, $height, $type, $attr) = getimagesize($imgDir . $file); $wh_files .= " \"" . WikiHiero::getCode($file) . "\" => array( {$width}, {$height} ),\n"; if (strchr($file, '&')) { $wh_prefabs .= " \"" . WikiHiero::getCode($file) . "\",\n"; } } } closedir($dh); } } else { $this->error("Images directory {$imgDir} not found!\n", true); } $wh_prefabs .= ");"; $wh_files .= ");"; $file = fopen('data/tables.php', 'w+'); fwrite($file, "<?php\n\n"); fwrite($file, '// File created by generateTables.php version ' . WIKIHIERO_VERSION . "\n"); fwrite($file, '// ' . date('Y-m-d \\a\\t H:i') . "\n\n"); fwrite($file, "{$wh_prefabs}\n\n{$wh_files}\n\n{$this->moreTables}\n"); fclose($file); $this->serialize(); }
function highlight($word, $s) { $text = ''; $s = split(' ', $s); foreach ($s as $w) { if ($w == $word) { $text .= $w . ' '; } elseif (strchr($w, '_') !== false) { $text .= str_replace('_', ' ', $w) . ' '; } else { $ww = $w; $ln = strlen($w); if ($ln > 2) { $tail = substr($w, -2); if ($tail == "'s" || $tail == "'d") { $ww = substr($w, 0, $ln - 2); } else { $tail = substr($w, -3); if ($tail == "'ve" || $tail == "'ll" || $tail == "'re" || $tail == "'em") { $ww = substr($w, 0, $ln - 3); } } } $text .= "<A HREF=\"javascript:show_word('" . $ww . "')\" class=\"normal\">" . $w . '</A> '; } } return $text; }
/** * Show all catalogue * */ function ShowCatalogueList() { global $db; global $EDIT_DOMAIN, $HTTP_ROOT_PATH, $DOMAIN_NAME, $ADMIN_PATH, $ADMIN_TEMPLATE, $SUB_FOLDER; $nc_core = nc_Core::get_object(); $all_sites = $nc_core->catalogue->get_all(); if (!empty($all_sites)) { $td = "<td>"; echo "\n\t\t<form method='post' action='index.php'>\n\n\t\t<table border='0' cellpadding='0' cellspacing='0' width='99%' class='border-bottom'>\n\t\t<tr>\n\t\t<td>ID</td>\n\t\t<td width='60%'>" . CONTROL_CONTENT_CATALOUGE_FUNCS_SHOWCATALOGUELIST_SITE . "</td>\n\t\t<td>" . CONTROL_CONTENT_CATALOUGE_FUNCS_SHOWCATALOGUELIST_SUBSECTIONS . "</td>\n\t\t<td>\n\t\t <div class='icons icon_prior' title='" . CONTROL_CONTENT_CATALOUGE_FUNCS_SHOWCATALOGUELIST_PRIORITY . "'></div></td>\n\t\t<td>" . CONTROL_CONTENT_CATALOUGE_FUNCS_SHOWCATALOGUELIST_GOTO . "</td>\n\t\t<td>\n\t\t <div class='icons icon_delete' title='" . CONTROL_CONTENT_CATALOUGE_FUNCS_SHOWCATALOGUELIST_DELETE . "'></div></td>\n \t\t</tr>"; foreach ($all_sites as $site) { print "<tr>"; print $td . (!$site['Checked'] ? "<font>" : "<font>") . $site['Catalogue_ID'] . "</font></td>"; print $td . "<a href='{$ADMIN_PATH}subdivision/full.php?CatalogueID={$site['Catalogue_ID']}'>" . (!$site['Checked'] ? "<font color='cccccc'>" : "<font>") . $site['Catalogue_Name'] . "</a></font></td>"; print $td . "<a href='" . $ADMIN_PATH . "subdivision/?CatalogueID=" . $site['Catalogue_ID'] . "'>" . (!$site['Checked'] ? "<font color=cccccc>" : "") . CONTROL_CONTENT_CATALOUGE_FUNCS_SHOWCATALOGUELIST_LIST . " (" . HighLevelChildrenNumber($site['Catalogue_ID']) . ")</a></td>\n"; print "<td>" . nc_admin_input_simple("Priority" . $site['Catalogue_ID'], $site['Priority'] ? $site['Priority'] : 0, 3, "class='s' maxlength='5'") . "</td>\n"; print "<td>"; //setup print "<a href=index.php?phase=2&CatalogueID=" . $site['Catalogue_ID'] . "&type=2><div class='icons icon_settings" . (!$site['Checked'] ? "_disabled" : "") . "' title='" . CONTROL_CONTENT_CATALOUGE_FUNCS_SHOWCATALOGUELIST_TOOPTIONS . "'></div></a>"; //edit print !GetSubClassCount($site['Title_Sub_ID']) ? "<img src=" . $ADMIN_PATH . "images/emp.gif width=18 height=18 style='margin:0px 2px 0px 2px;'>" : "<a target=_blank href=http://" . $EDIT_DOMAIN . $SUB_FOLDER . $HTTP_ROOT_PATH . "?catalogue=" . $site['Catalogue_ID'] . "&sub=" . $site['Title_Sub_ID'] . (nc_strlen(session_id()) > 0 ? "&" . session_name() . "=" . session_id() . "" : "") . "><div class='icons icon_pencil" . (!$site['Checked'] ? "_disabled" : "") . "' title='" . CONTROL_CONTENT_CATALOUGE_FUNCS_SHOWCATALOGUELIST_EDIT . "'></div></a>"; //browse print "<a href=http://" . ($site['Domain'] ? strchr($site['Domain'], ".") ? $site['Domain'] : $site['Domain'] . "." . $DOMAIN_NAME : $DOMAIN_NAME) . $SUB_FOLDER . (nc_strlen(session_id()) > 0 ? "?" . session_name() . "=" . session_id() . "" : "") . " target=_blank><div class='icons icon_preview" . (!$site['Checked'] ? "_disabled" : "") . "' title='" . CONTROL_CONTENT_CATALOUGE_FUNCS_SHOWCATALOGUELIST_SHOW . "'></div></a>"; print "</td>"; print "<td>" . nc_admin_checkbox_simple("Delete" . $site['Catalogue_ID'], $site['Catalogue_ID']) . "</td>\n"; print "</tr>\n"; } echo "\n \t\t</table>\n\t\t<br />\n " . $nc_core->token->get_input() . "\n \t\t<input type=hidden name=phase value='4' />\n \t\t<input class='hidden' type='submit' />\n \t\t</form>\n\t "; } else { echo CONTROL_CONTENT_CATALOUGE_FUNCS_SHOWCATALOGUELIST_NONE . "<br /><br />"; } return 0; }
public function fileUpload(Request $request) { // return ($request->file('photo')->getMimeType()); if ($request->hasFile('photo')) { $messages = ['photo.image' => '上传文件必须是图片', 'photo.max' => '上传文件不能大于:maxkb']; $this->validate($request, ['photo' => 'image|max:500'], $messages); if ($request->file('photo')->isValid()) { $file_pre = getdate()[0]; //取得当前时间戳 $file_suffix = substr(strchr($request->file('photo')->getMimeType(), "/"), 1); //取得文件后缀 $destinationPath = 'uploads'; //上传路径 $fileName = $file_pre . '.' . $file_suffix; //上传文件名 $request->file('photo')->move($destinationPath, $fileName); $img = new Img(); $img->name = $fileName; $img->save(); Session()->flash('img', $fileName); // return view('/admin/fileselect'); return $fileName; } else { return "上传文件无效!"; } } else { return "文件上传失败!"; } }
function Corrida($txt_numero) { $corrida = array(); if (strlen(strchr($txt_numero, '-')) > 0) { $numeros = explode('-', $txt_numero); $numero1 = $numeros[0]; $numero2 = $numeros[1]; $diferencia = $numero1 - $numero2; if ($numero1 > 0 && $numero2 > 0) { $cadena = ''; $flag = false; if ($diferencia < 0) { $diferencia = $diferencia * -1; $flag = true; } for ($i = 0; $i <= $diferencia; $i++) { if ($flag) { $cadena = $numero1 + $i; $corrida[] = $cadena; } else { $cadena = $numero2 + $i; $corrida[] = $cadena; } } return $corrida; } else { return $txt_numero; } } else { return $txt_numero; } }
/** * Smarty {sprite} function plugin * * Type: function<br> * Name: sprite<br> * Purpose: 将"中间页"显示在on-the-fly的dynamic div中, 包含用于显示/隐藏的脚本过程, 在保持原"大页面“原状的情况下, 加载需要操作的用户界面(由link的href指定), 实现及流程类似于Smarty plugin: Confirm * @link * @author XU Jian <*****@*****.**> * @param array * @param Smarty * */ function smarty_function_sprite($params, &$smarty) { $link = $params['link']; if (!isset($link)) { $smarty->trigger_error('Smarty plugin sprite error: parameter "link" expected.'); } $width = $params['width']; if (!isset($width) || $width == '') { $width = '400'; } $height = $params['height']; if (!isset($height) || $height == '') { $height = '300'; } $oncomplete = $params['oncomplete']; if (!isset($oncomplete) || $oncomplete == '') { $oncomplete = 'function(){ return;}'; } else { if (strchr($oncomplete, '(') || strchr($oncomplete, 'return')) { $oncomplete = 'function(){' . $oncomplete . '}'; } } $onload = $params['onload']; $onunload = $params['onunload']; $onabort = $params['onabort']; $onerror = $params['onerror']; $onrequirevalidate = $params['onrequirevalidate']; $title = $params['title']; $mask = $params['mask']; $script = Template::RequireJs('/lib/jquery/jquery.form.js'); $script .= "\n"; $script .= '<script type="text/javascript">'; $script .= '$(\'' . $link . '\').sprite('; $script .= '{title: "' . $title . '" '; $script .= ', oncomplete: ' . $oncomplete; if (isset($mask)) { $script .= ', mask: ' . $mask; } if (isset($onload)) { $script .= ', onload: ' . $onload; } if (isset($onunload)) { $script .= ', onunload: ' . $onunload; } if (isset($onrequirevalidate)) { $script .= ', onrequirevalidate: ' . $onrequirevalidate; } if (isset($onabort)) { $script .= ', onabort: function(r){' . $onabort . '}'; } if (isset($onerror)) { $script .= ', onerror: function(r){' . $onerror . '}'; } $script .= '});'; $script .= '</script>'; $script .= "\n"; Template::ScriptHolder('', $script); return ''; }
function useragent() { $useragent = $_SERVER['HTTP_USER_AGENT']; //print $useragent; if (strchr($useragent, "MSIE")) { return 'IE'; } }
function datel_date($format, $tms = false) { $tms = datel_tms($tms); if (strchr($format, 'F')) { $format = str_replace('F', datel_quote($GLOBALS['lang']['time_ms_' . gmdate('n', $tms)]), $format); } return gmdate($format, $tms); }
function setroute() { if (strchr($this->path, '/')) { list($this->route, $this->path) = explode('/', $this->path, 2); } else { $this->route = $this->path; } }
public static function rpc_get_default(Context $ctx) { if (null === ($fid = $ctx->get('fid'))) { $fid = trim(strchr($ctx->query(), '/'), '/'); } $node = Node::load($fid, $ctx->db); $path = os::webpath($ctx->config->getDirName(), $ctx->config->files, $node->filepath); return new Redirect($path, Redirect::PERMANENT); }
public function GetCredit() { $result = file_get_contents("{$this->wsdl_link}credit.php?user={$this->username}&pass={$this->password}"); if (strchr($result, 'OK')) { return preg_replace('/[^0-9]+/', '', $result); } else { return false; } }
function stripslashes($str) { global $ost_wpdb; //remove backslashes while (strchr($str, '\\')) { $str = stripslashes($str); } return $str; }
function checkInvalidChars($formVal) { $invalidChars = array("~", "`", "!", "@", "#", "\$", "%", "^", "&", "*", "_", "-", "+", "=", "|", "\\", "{", "}", ":", ";", "\"", "'", ",", "<", ".", ">", "?", "/"); foreach ($invalidChars as $invalidCh) { if (strchr($formVal, $invalidCh)) { return true; } } }
public function haveType($types, $exact = false) { $ftype = $exact ? $this->datas['type'] : strchr($this->datas['type'], "/", true); if (is_array($types)) { $types = array_map('strtolower', $types); return in_array($ftype, $types); } return $ftype == strtolower($types); }
function CheckFlags($aflag, $flags) { for ($cc = 0; $cc < strlen($aflag); $cc++) { if (strchr($flags, $aflag[$cc])) { return $cc + 1; } } return 0; }