function getLocation($str) { $array_size = intval(substr($str, 0, 1)); // 拆成的行数 $code = substr($str, 1); // 加密后的串 $len = strlen($code); $subline_size = $len % $array_size; // 满字符的行数 $result = array(); $deurl = ""; for ($i = 0; $i < $array_size; $i += 1) { if ($i < $subline_size) { array_push($result, substr($code, 0, ceil($len / $array_size))); $code = substr($code, ceil($len / $array_size)); } else { array_push($result, substr($code, 0, ceil($len / $array_size) - 1)); $code = substr($code, ceil($len / $array_size) - 1); } } for ($i = 0; $i < ceil($len / $array_size); $i += 1) { for ($j = 0; $j < count($result); $j += 1) { $deurl = $deurl . "" . substr($result[$j], $i, 1); } } return str_replace("^", "0", urldecode($deurl)); }
/** * Method to get a JDatabaseQuery object for retrieving the data set from a database. * * @return object A JDatabaseQuery object to retrieve the data set. */ protected function getListQuery() { $w = explode('|', urldecode(JRequest::getVar('filterStr', ''))); $user = JFactory::getUser(); $filterStr = $w[0]; $filterAktiv = $w[1]; if ($filterAktiv == 1) { $lezartLimit = 1; } else { $lezartLimit = 99; } if ($filterStr != '') { $filterStr = ' and sz.megnevezes like "%' . $filterStr . '%"'; } $db = $this->getDbo(); $query = $db->getQuery(true); $catid = (int) $this->getState('authorlist.id', 1); $query = ' /* szavazások amik jelenleg vita1 állapotban vannak */ /* ================================================ */ SELECT sz.megnevezes, sz.vita1, sz.vita2, sz.szavazas, sz.lezart, sz.szavazas_vege, sz.titkos, sz.vita2_vege, sz.id, sz.temakor_id FROM #__szavazasok sz WHERE (sz.vita2=1) ' . $filterStr; $query .= ' order by ' . JRequest::getVar('order', '6'); return $query; }
/** * Processes the standard headers that are not subdivided into other structs. */ protected function processStandardHeaders() { $req = $this->request; $req->date = isset($_SERVER['REQUEST_TIME']) ? new DateTime("@{$_SERVER['REQUEST_TIME']}") : new DateTime(); if (isset($_SERVER['REQUEST_METHOD'])) { switch ($_SERVER['REQUEST_METHOD']) { case 'POST': $req->protocol = 'http-post'; break; case 'PUT': $req->protocol = 'http-put'; break; case 'DELETE': $req->protocol = 'http-delete'; break; default: $req->protocol = 'http-get'; } } $req->host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost.localdomain'); $req->uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : ''; // remove the query string from the URI $req->uri = preg_replace('@\\?.*$@', '', $req->uri); // url decode the uri $req->uri = urldecode($req->uri); // remove the prefix from the URI $req->uri = preg_replace('@^' . preg_quote($this->properties['prefix']) . '@', '', $req->uri); $req->requestId = $req->host . $req->uri; $req->referrer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null; $req->variables =& $_REQUEST; if ($req->protocol == 'http-put') { $req->body = file_get_contents("php://input"); } }
/** * 替换屏蔽字 */ public function replace() { $content = trim(urldecode($this->input['banword'])); $symbol = trim(urldecode($this->input['symbol'])); if (empty($content)) { $this->errorOutput(OBJECT_NULL); } $data = $this->banword($content); if ($data) { $replace = array(); $find = array(); foreach ($data as $v) { if (!empty($symbol) && $symbol != '*') { $replace[] = $symbol; } else { if (!empty($v['banwd'])) { $replace[] = $v['banwd']; } else { $replace[] = str_repeat('*', mb_strlen($v['banname'], 'utf-8')); } } $find[] = $v['banname']; } $content = str_replace($find, $replace, $content); } $this->addItem($content); $this->output(); }
protected function _toHtml() { $rssObj = Mage::getModel('rss/rss'); $route = Mage::helper('blog')->getRoute(); $url = $this->getUrl($route); $title = Mage::getStoreConfig('blog/blog/title'); $data = array('title' => $title, 'description' => $title, 'link' => $url, 'charset' => 'UTF-8'); if (Mage::getStoreConfig('blog/rss/image') != "") { $data['image'] = $this->getSkinUrl(Mage::getStoreConfig('blog/rss/image')); } $rssObj->_addHeader($data); $collection = Mage::getModel('blog/blog')->getCollection()->addStoreFilter(Mage::app()->getStore()->getId())->setOrder('created_time ', 'desc'); $identifier = $this->getRequest()->getParam('identifier'); $tag = $this->getRequest()->getParam('tag'); if ($tag) { $collection->addTagFilter(urldecode($tag)); } if ($cat_id = Mage::getSingleton('blog/cat')->load($identifier)->getcatId()) { Mage::getSingleton('blog/status')->addCatFilterToCollection($collection, $cat_id); } Mage::getSingleton('blog/status')->addEnabledFilterToCollection($collection); $collection->setPageSize((int) Mage::getStoreConfig('blog/rss/posts')); $collection->setCurPage(1); if ($collection->getSize() > 0) { foreach ($collection as $post) { $data = array('title' => $post->getTitle(), 'link' => $this->getUrl($route . "/" . $post->getIdentifier()), 'description' => $post->getPostContent(), 'lastUpdate' => strtotime($post->getCreatedTime())); $rssObj->_addEntry($data); } } return $rssObj->createRssXml(); }
/** * Returns the initial HTML view for the admin interface. * * @param \Illuminate\Http\Request $request Laravel request object * @return \Illuminate\Contracts\View\View View for rendering the output */ public function indexAction(Request $request) { if (config('shop.authorize', true)) { $this->authorize('admin'); } $site = Route::input('site', 'default'); $lang = Input::get('lang', config('app.locale', 'en')); $aimeos = app('\\Aimeos\\Shop\\Base\\Aimeos')->get(); $cntlPaths = $aimeos->getCustomPaths('controller/extjs'); $context = app('\\Aimeos\\Shop\\Base\\Context')->get(false); $context = $this->setLocale($context, $site, $lang); $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); $cssFiles = array(); foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths) { foreach ($paths as $path) { $jsbAbsPath = $base . '/' . $path; if (!is_file($jsbAbsPath)) { throw new \Exception(sprintf('JSB2 file "%1$s" not found', $jsbAbsPath)); } $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($path)); $cssFiles = array_merge($cssFiles, $jsb2->getUrls('css')); } } $jqadmUrl = route('aimeos_shop_jqadm_search', array('site' => $site, 'resource' => 'product')); $jsonUrl = route('aimeos_shop_extadm_json', array('site' => $site, '_token' => csrf_token())); $adminUrl = route('aimeos_shop_extadm', array('site' => '<site>', 'lang' => '<lang>', 'tab' => '<tab>')); $vars = array('lang' => $lang, 'cssFiles' => $cssFiles, 'languages' => $this->getJsonLanguages($context), 'config' => $this->getJsonClientConfig($context), 'site' => $this->getJsonSiteItem($context, $site), 'i18nContent' => $this->getJsonClientI18n($aimeos->getI18nPaths(), $lang), 'searchSchemas' => $controller->getJsonSearchSchemas(), 'itemSchemas' => $controller->getJsonItemSchemas(), 'smd' => $controller->getJsonSmd($jsonUrl), 'urlTemplate' => str_replace(['<', '>'], ['{', '}'], urldecode($adminUrl)), 'uploaddir' => config('shop::uploaddir'), 'activeTab' => Input::get('tab', 0), 'version' => $this->getVersion(), 'jqadmurl' => $jqadmUrl); return View::make('shop::admin.extadm-index', $vars); }
function swp_buffer_button_html($array) { // If we've already generated this button, just use our existing html if (isset($_GLOBALS['sw']['buttons'][$array['postID']]['buffer'])) { $array['resource']['buffer'] = $_GLOBALS['sw']['buttons'][$array['postID']]['buffer']; // If not, let's check if Buffer is activated and create the button HTML } elseif (isset($array['options']['newOrderOfIcons']['buffer']) && !isset($array['buttons']) || isset($array['buttons']) && isset($array['buttons']['buffer'])) { // Collect the Title $title = get_post_meta($array['postID'], 'nc_ogTitle', true); if (!$title) { $title = get_the_title(); } $array['totes'] += $array['shares']['buffer']; ++$array['count']; $array['resource']['buffer'] = '<div class="nc_tweetContainer swp_buffer" data-id="' . $array['count'] . '" data-network="buffer">'; $link = urlencode(urldecode(swp_process_url($array['url'], 'buffer', $array['postID']))); $array['resource']['buffer'] .= '<a target="_blank" href="http://bufferapp.com/add?url=' . $link . '&text=' . urlencode(html_entity_decode($title, ENT_COMPAT, 'UTF-8')) . '" data-link="http://bufferapp.com/add?url=' . $link . '&text=' . urlencode(html_entity_decode($title, ENT_COMPAT, 'UTF-8')) . '" class="nc_tweet buffer_link">'; if ($array['options']['totesEach'] && $array['shares']['totes'] >= $array['options']['minTotes'] && $array['shares']['buffer'] > 0) { $array['resource']['buffer'] .= '<span class="iconFiller">'; $array['resource']['buffer'] .= '<span class="spaceManWilly">'; $array['resource']['buffer'] .= '<i class="sw sw-buffer"></i>'; $array['resource']['buffer'] .= '<span class="swp_share"> ' . __('Buffer', 'social-warfare') . '</span>'; $array['resource']['buffer'] .= '</span></span>'; $array['resource']['buffer'] .= '<span class="swp_count">' . swp_kilomega($array['shares']['buffer']) . '</span>'; } else { $array['resource']['buffer'] .= '<span class="swp_count swp_hide"><span class="iconFiller"><span class="spaceManWilly"><i class="sw sw-buffer"></i><span class="swp_share"> ' . __('Buffer', 'social-warfare') . '</span></span></span></span>'; } $array['resource']['buffer'] .= '</a>'; $array['resource']['buffer'] .= '</div>'; // Store these buttons so that we don't have to generate them for each set $_GLOBALS['sw']['buttons'][$array['postID']]['buffer'] = $array['resource']['buffer']; } return $array; }
function parse_quote_string($query_string) { /* urldecode the string and setup variables */ $query_string = urldecode($query_string); $quote_flag = false; $word = ''; $terms = array(); /* loop through character by character and move terms to an array */ for ($i = 0; $i < strlen($query_string); $i++) { $char = substr($query_string, $i, 1); if ($char == '"') { if ($quote_flag) { $quote_flag = false; } else { $quote_flag = true; } } if ($char == ' ' && !$quote_flag) { $terms[] = $word; $word = ''; } else { if (!($char == '"')) { $word .= $char; } } } $terms[] = $word; /* return the fully parsed array */ return $terms; }
/** * Build the content for this action * * @return boolean * @access public * @since 4/26/05 */ function buildContent() { $actionRows = $this->getActionRows(); $harmoni = Harmoni::instance(); ob_start(); CollectionsPrinter::printFunctionLinks(); $layout = new Block(ob_get_contents(), STANDARD_BLOCK); ob_end_clean(); $actionRows->add($layout, null, null, CENTER, CENTER); $type = HarmoniType::fromString(urldecode(RequestContext::value('type'))); $repositoryManager = Services::getService("Repository"); // Get the Repositories $allRepositories = $repositoryManager->getRepositoriesByType($type); // put the repositories into an array and order them. // @todo, do authorization checking $repositoryArray = array(); while ($allRepositories->hasNext()) { $repository = $allRepositories->next(); $repositoryArray[$repository->getDisplayName()] = $repository; } ksort($repositoryArray); // print the Results $resultPrinter = new ArrayResultPrinter($repositoryArray, 2, 20, "printrepositoryShort", $harmoni); $resultPrinter->addLinksStyleProperty(new MarginTopSP("10px")); $resultLayout = $resultPrinter->getLayout(); $actionRows->add($resultLayout, null, null, CENTER, CENTER); }
/** * Detects all images in shortcode format and converts them into images, clickable links or raw URLs * * @param string $text HTML-encoded string * @param boolean $imagesEnabled Whether to convert shortcodes into real images * @param boolean $linksEnabled Whether to convert shortcodes into real hyperlinks * * @return string */ public function filter($text, $imagesEnabled, $linksEnabled = true) { if (preg_match_all(self::SHORTCODE_REGEXP, $text, $matches)) { if (count($matches) < 3) { return $text; } foreach ($matches[0] as $key => $shortCode) { $imageSrc = $matches[2][$key]; $imageThumbnailSrc = $matches[3][$key]; $imageOrgSrc = $matches[4][$key]; $replace = ''; if ($imagesEnabled) { $replace = sprintf(self::IMAGE_TAG_TEMPLATE, $imageSrc, $imageThumbnailSrc); } else { if ($linksEnabled) { if ($imageOrgSrc == '_') { $imageOrgSrc = $imageSrc; } $url = (!preg_match(self::URL_PROTOCOLS_REGEXP, $imageOrgSrc) ? 'http://' : '') . $imageOrgSrc; $linkBody = htmlentities(urldecode($imageOrgSrc), ENT_QUOTES, 'UTF-8', false); $replace = sprintf('<a href="%s" target="_blank" rel="nofollow">%s</a>', $url, $linkBody); } else { $replace = $imageOrgSrc != '_' ? $imageOrgSrc : $imageSrc; } } $text = $this->strReplaceFirst($shortCode, $replace, $text); } } return $text; }
/** * HTTP GET 请求 * @param string $url 请求地址 * @param array $data 请求数据 * @param null $cookie COOKIE * @param null $cookiefile COOKIE 请求所用的COOKIE文件位置 * @param null $cookiesavepath 请求完成的COOKIE保存位置 * @param bool $encode 是否对请求参数进行 urlencode 处理 * @return mixed * @throws Exception */ public static function get($url, $data = array(), $cookie = null, $cookiefile = null, $cookiesavepath = null, $encode = true) { //初始化句柄 $ch = curl_init(); //处理GET参数 if (count($data) > 0) { $query = $encode ? http_build_query($data) : urldecode(http_build_query($data)); curl_setopt($ch, CURLOPT_URL, $url . '?' . $query); } else { curl_setopt($ch, CURLOPT_URL, $url); } curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36'); //设置cookie if (isset($cookie)) { curl_setopt($ch, CURLOPT_COOKIE, $cookie); } //设置cookie请求文件 if (isset($cookiefile)) { if (!is_file($cookiefile)) { throw new Exception('Cookie文件不存在'); } curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiefile); } //设置cookie保存路径 if (isset($cookiesavepath)) { curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiesavepath); } //执行请求 $resp = curl_exec($ch); //关闭句柄,释放资源 curl_close($ch); return $resp; }
/** * beforeRender callback function * * @return array contents for panel **/ public function beforeRender(Controller $controller) { $cacheKey = $controller->Toolbar->cacheKey; $toolbarHistory = Cache::read($cacheKey, 'debug_kit'); $historyStates = array(); if (is_array($toolbarHistory) && !empty($toolbarHistory)) { $prefix = array(); if (!empty($controller->request->params['prefix'])) { $prefix[$controller->request->params['prefix']] = false; } foreach ($toolbarHistory as $i => $state) { if (!isset($state['request']['content']['url'])) { continue; } $title = $state['request']['content']['url']; $query = @$state['request']['content']['query']; if (isset($query['url'])) { unset($query['url']); } if (!empty($query)) { $title .= '?' . urldecode(http_build_query($query)); } $historyStates[] = array('title' => $title, 'url' => array_merge($prefix, array('plugin' => 'debug_kit', 'controller' => 'toolbar_access', 'action' => 'history_state', $i + 1))); } } if (count($historyStates) >= $this->history) { array_pop($historyStates); } return $historyStates; }
function get_current_page() { global $HTTP_GET_VARS, $HTTP_POST_VARS, $request_type; $get_vars = array(); if (tep_not_null(REQUEST_URI)) { if (strpos(REQUEST_URI, '?')) { $current_page = PHP_SELF; // if (substr($current_page, 0, strlen(DIR_WS_CATALOG))==DIR_WS_CATALOG) $current_page = substr($current_page, strlen(DIR_WS_CATALOG)); $qstring = substr(REQUEST_URI, strpos(REQUEST_URI, '?') + 1); $qstring_array = explode('&', str_replace('&', '&', $qstring)); reset($qstring_array); while (list(, $get_var) = each($qstring_array)) { list($var_name, $var_value) = explode('=', $get_var); if (!in_array($var_name, array('x', 'y'))) { $get_vars[$var_name] = urldecode($var_value); } } } else { $current_page = REQUEST_URI; $qstring = ''; } } else { $current_page = basename(SCRIPT_FILENAME); $get_vars = $HTTP_GET_VARS; } if (!in_array(tep_session_name(), array_keys($get_vars))) { $get_vars[tep_session_name()] = tep_session_id(); } return array('page' => $current_page, 'mode' => $request_type, 'get' => $get_vars, 'post' => $HTTP_POST_VARS, 'real_page' => basename(SCRIPT_FILENAME), 'real_get' => $HTTP_GET_VARS); }
function display_each_ebook($directory, $name) { $check_thumb = check_thumb_exists(urldecode($directory . $name)); echo '<td id = "thumbnail_container" width = "14%"> <img rel ="images" id = "' . $directory . $name . '" src = "' . \OCP\Util::linkTo('reader', 'ajax/thumbnail.php') . '&filepath=' . $directory . rtrim($name, 'pdf') . 'png' . '"> </td>'; echo '<td class = "filename svg" width = "86%"> <a class="name" href="http://localhost' . \OCP\Util::linkTo('files', 'download.php') . '?file=' . $directory . $name . '" title="' . urldecode($name) . '" dir ="' . $directory . $name . '" value = "' . $check_thumb . '"> <span class = "nametext">' . htmlspecialchars(urldecode($name)) . '</span> </a> <div id = "displaybox">'; $each_row = find_tags_for_ebook(urldecode($directory) . urldecode($name)); $tags = explode(",", $each_row); $tag_count = 1; foreach ($tags as $tag) { if ($tag_count == 2) { echo ", "; } echo '<a href = "' . \OCP\Util::linkTo('reader', 'fetch_tags.php') . '?tag=' . $tag . '">' . ucwords($tag) . '</a>'; $tag_count += 1; } echo '</div> <input type="button" class="start" value="Add Tag"> <div id="contentbox" contenteditable="true"></div> </td>'; }
private function buildRequestUrl($apiName, $options = array(), $productId = '', $urls = array()) { $data = array('domain' => 'http://gw.api.alibaba.com/openapi', 'format' => 'param2', 'version' => 2, 'namespace' => 'portals.open'); $hostname = implode('/', $data); $endpoint = $apiName . '/' . API_KEY . '?' . urldecode(http_build_query($options)); return $requestUrl = $hostname . '/' . $endpoint; }
/** * Returns realm ID by name * @category Utils class * @access public * @param string $rName * @return int **/ public static function GetRealmIDByName($rName) { if ($realms = explode('/', $rName)) { $rName = $realms[0]; } return self::FindRealm(urldecode($rName)); }
function jyxo_bot($q = "", $d = "mm", $ereg = ".", $notereg = "", $cnt = 10000000000000, $page = 1, $pmax = 2, $o = "nocls") { $i = 0; $results = ""; $results[$i] = ""; //$q = str_replace(" ", "+", $q); $q = urlencode($q); for (; $page <= $pmax; $page++) { $request = "http://jyxo.cz/s?q={$q}&d={$d}&o={$o}&cnt={$cnt}&page={$page}"; $fp = fopen($request, "r") or die(" !!! Cannot connect !!!"); while (!feof($fp)) { $line = fgets($fp); if (eregi("<div class='r'>", $line) && ereg(" class=ri", $line)) { $line = explode("<!--m--><div class='r'><A HREF=\"", $line); $line = $line[1]; $line = explode("\" class=ri", $line); $line = trim($line[0]); $line = urldecode($line); if (@eregi($ereg, $line) && !@eregi($notereg, $line) && !in_array($line, $results)) { echo "{$line}\n"; //Output //echo("$i:$line\n"); //Indexed Output //echo("<a href=\"$line\">$line</a><br />\n"); //XHTML Output $results[$i] = $line; $i++; } } } fclose($fp); } echo "\nTotal: {$i}\n"; //Sumary Output return $results; }
function toastup($channel, $message) { $channel_uri = urldecode($channel); $toast_xml = '<?xml version="1.0" encoding="utf-8" ?> <wp:Notification xmlns:wp="WPNotification"> <wp:Toast> <wp:Text1>' . 信息: . '</wp:Text1> <wp:Text2>' . $message . '</wp:Text2> </wp:Toast> </wp:Notification>'; $headers = array('Content-Type: text/xml', "Content-Length: " . strlen($toast_xml), "X-WindowsPhone-Target: toast", "X-NotificationClass: 2"); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $channel_uri); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 2); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_POSTFIELDS, "{$toast_xml}"); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($ch); $response = curl_getinfo($ch); curl_close($ch); return $response['http_code']; }
public static function get_alias($params) { global $thisfile, $specifyCollection; $a = array(); if (isset($params["CISOPARM"])) { $parm = explode(":", urldecode($params["CISOPARM"])); $cr = explode(" ", $parm[0]); if ($cr[0] == "all") { $catlist =& dmGetCollectionLIst(); for ($i = 0; $i < count($catlist); $i++) { $a[$i] = trim($catlist[$i]['alias']); } } else { for ($i = 0; $i < count($cr) - 1; $i++) { $a[$i] = isset($cr[$i]) ? trim($cr[$i]) : 0; } } } else { if (isset($params["CISOROOT"])) { if ($params["CISOROOT"] == "all") { $catlist =& dmGetCollectionList(); for ($i = 0; $i < count($catlist); $i++) { $a[$i] = trim($catlist[$i]['alias']); } } else { $cisostr = explode(',', urldecode($params["CISOROOT"])); for ($i = 0; $i < count($cisostr); $i++) { $a[$i] = isset($cisostr[$i]) ? trim($cisostr[$i]) : 0; } } } } return $a; }
function rcp_login_form_fields( $args = array() ) { global $rcp_login_form_args; // parse the arguments passed $defaults = array( 'redirect' => rcp_get_current_url(), ); $rcp_login_form_args = wp_parse_args( $args, $defaults ); if( ! empty( $_GET['redirect'] ) ) { $rcp_login_form_args['redirect'] = urldecode( $_GET['redirect'] ); } ob_start(); do_action( 'rcp_before_login_form' ); rcp_get_template_part( 'login' ); do_action( 'rcp_after_login_form' ); return ob_get_clean(); }
/** * Filter the redirect url * * @param mixed $value * @return string|null */ public function filter($value) { if (!$this->validator->isValid($value)) { return null; } return urldecode(filter_var($value, FILTER_SANITIZE_URL)); }
/** * Displays a list of groups * * @return void */ public function displayTask() { $this->view->filters = array('limit' => 'all', 'fields' => array('COUNT(*)'), 'authorized' => 'admin', 'type' => array(Request::getState($this->_option . '.browse.type', 'type', 'all')), 'search' => urldecode(Request::getState($this->_option . '.browse.search', 'search', '')), 'discoverability' => Request::getState($this->_option . '.browse.discoverability', 'discoverability', ''), 'policy' => Request::getState($this->_option . '.browse.policy', 'policy', ''), 'sort' => Request::getState($this->_option . '.browse.sort', 'filter_order', 'cn'), 'sort_Dir' => Request::getState($this->_option . '.browse.sortdir', 'filter_order_Dir', 'ASC'), 'approved' => Request::getVar('approved'), 'created' => Request::getVar('created', '')); $this->view->filters['sortby'] = $this->view->filters['sort'] . ' ' . $this->view->filters['sort_Dir']; $canDo = \Components\Groups\Helpers\Permissions::getActions('group'); if (!$canDo->get('core.admin')) { if ($this->view->filters['type'][0] == 'system' || $this->view->filters['type'][0] == "0" || $this->view->filters['type'][0] == NULL) { $this->view->filters['type'] = array('all'); } if ($this->view->filters['type'][0] == 'all') { $this->view->filters['type'] = array(1, 2, 3); } } // Get a record count $this->view->total = Group::find($this->view->filters); // Filters for returning results $this->view->filters['limit'] = Request::getState($this->_option . '.browse.limit', 'limit', Config::get('list_limit'), 'int'); $this->view->filters['start'] = Request::getState($this->_option . '.browse.limitstart', 'limitstart', 0, 'int'); // In case limit has been changed, adjust limitstart accordingly $this->view->filters['start'] = $this->view->filters['limit'] != 0 ? floor($this->view->filters['start'] / $this->view->filters['limit']) * $this->view->filters['limit'] : 0; $this->view->filters['fields'] = array('cn', 'description', 'published', 'gidNumber', 'type'); // Get a list of all groups $this->view->rows = null; if ($this->view->total > 0) { $this->view->rows = Group::find($this->view->filters); } // Set any errors foreach ($this->getErrors() as $error) { $this->view->setError($error); } // pass config to view $this->view->config = $this->config; // Output the HTML $this->view->display(); }
public function createEvent(Request $request, $payload) { $newEvent = json_decode(urldecode($payload)); if (!property_exists($newEvent, 'alert')) { return false; } $alert = $newEvent->alert; $event = new RawEvent(); $event->setType('monitis'); $system = str_replace('http://', '', $alert->url); $system = str_replace(' ', '', $system); $event->setSystem($system); if ($alert->alertType === self::STATUS_PROBLEM) { $event->setStatus(Event::STATUS_FAILURE); if (property_exists($alert, "errorString")) { $event->setMessage($alert->errorString); } else { $event->setMessage('Monitis found an error for ' . $alert->name . '.'); } } else { $event->setStatus(Event::STATUS_SUCCESS); $event->setMessage(""); } $event->setIdentifier("monitis_" . $system . "_" . $alert->type); $event->setUnique(false); $event->setUrl('http://dashboard.monitis.com/'); if (property_exists($alert, 'stepDuration')) { $event->setValue($alert->stepDuration); } return $event; }
function post_location_request($url, $data) { /* $data_str = urlencode(http_build_query($data)); header("Host: $host\r\n"); header("POST $path HTTP/1.1\r\n"); header("Content-type: application/x-www-form-urlencoded\r\n"); header("Content-length: " . strlen($data_str) . "\r\n"); header("Connection: close\r\n\r\n"); header($data_str); exit();*/ $CI =& get_instance(); $params = explode("&", urldecode(http_build_query($data))); $retHTML = ''; if (!$CI->is_pjax) { $retHTML .= "<html>\n<body onLoad=\"document.send_form.submit();\">\n"; } $retHTML .= '<form method="post" name="send_form" id="send_form" action="' . $url . '">'; foreach ($params as $string) { list($key, $value) = explode("=", $string); $retHTML .= "<input type=\"hidden\" name=\"" . $key . "\" value=\"" . addslashes($value) . "\">\n"; } if ($CI->is_pjax) { $retHTML .= '</form><script>document.getElementById("send_form").submit();</script>'; } else { $retHTML .= "</form>\n</body>\n</html>"; } print $retHTML; exit; }
/** *问题浏览量更新 */ public function pageViewAction() { //基础元素,必须参与验证 $View['PageId'] = abs(intval($this->request->PageId)); $View['ViewIP'] = urldecode(trim($this->request->ViewIP)); $View['Time'] = abs(intval($this->request->Time)); //URL验证码 $sign = $this->request->sign; //私钥,以后要移开到数据库存储 $p_sign = '5173'; $sign_to_check = base_common::check_sign($View, $p_sign); //不参与验证的元素 //验证URL是否来自可信的发信方 if ($sign_to_check == $sign) { //验证时间戳,时差超过600秒即认为非法 if (abs($View['Time'] - time()) <= 600) { $View['ViewIP'] = Base_Common::ip2long($View['ViewIP']); $InsertLog = $this->oView->addViewLog($View); if ($InsertLog) { $result = array('return' => 1, 'comment' => "添加成功"); } else { $result = array('return' => 2, 'comment' => "添加失败"); } } else { $result = array('return' => 0, 'comment' => "时间有误"); } } else { $result = array('return' => 0, 'comment' => "验证失败,请检查URL"); } echo json_encode($result); }
public function pdt($txn) { $params = array('at' => $this->atPaypal, 'tx' => $txn, 'cmd' => '_notify-synch'); $content = ''; foreach ($params as $key => $val) { $content .= '&' . $key . '=' . urlencode($val); } $c = curl_init(); curl_setopt($c, CURLOPT_URL, $this->paypalEndpoint); curl_setopt($c, CURLOPT_VERBOSE, TRUE); curl_setopt($c, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); curl_setopt($c, CURLOPT_POST, 1); curl_setopt($c, CURLOPT_POSTFIELDS, $content); $response = curl_exec($c); if (!$response) { echo "FAILED: " . curl_error($c) . "(" . curl_errno($c) . ")"; curl_close($c); return false; } else { $str = urldecode($response); $res = explode("\n", strip_tags($str)); $result = array(); foreach ($res as $val) { $r = explode("=", $val); if (count($r) > 1) { $result[$r[0]] = $r[1]; } } curl_close($c); return $result; } }
/** * @return string The object name */ public function getObjectKey() { /* * Spaces are '+', seems to be urlencoded? */ return urldecode($this->content['s3']['object']['key']); }
protected function getRequestMessage() { Json::arrayRecursive($this->request, "urlencode", false); $tMessage = json_encode($this->request); $tMessage = urldecode($tMessage); return $tMessage; }
function lrss_is_site_available($url) { //check, if a valid url is provided if (!filter_var($url, FILTER_VALIDATE_URL)) { return FALSE; } if (!function_exists('curl_init') && function_exists('get_headers')) { $headers = get_headers($url, 1); if ($headers[0] == 'HTTP/1.1 200 OK') { return TRUE; } else { return FALSE; } } else { if (function_exists('curl_init') && !function_exists('get_headers')) { return FALSE; } } $handle = curl_init(urldecode($url)); curl_setopt($handle, CURLOPT_CONNECTTIMEOUT, 0.5); curl_setopt($handle, CURLOPT_TIMEOUT, 1); curl_setopt($handle, CURLOPT_RETURNTRANSFER, TRUE); $response = curl_exec($handle); $httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE); if ($httpCode >= 200 && $httpCode < 400) { return TRUE; } else { return FALSE; } curl_close($handle); }
function wpdm_dir_tree() { $root = ''; if (!isset($_GET['task']) || $_GET['task'] != 'wpdm_dir_tree') { return; } $_POST['dir'] = urldecode($_POST['dir']); if (file_exists($_POST['dir'])) { $files = scandir($_POST['dir']); natcasesort($files); if (count($files) > 2) { /* The 2 accounts for . and .. */ echo "<ul class=\"jqueryFileTree\" style=\"display: none;\">"; // All dirs foreach ($files as $file) { if ($file != '.' && $file != '..' && file_exists($root . $_POST['dir'] . $file) && is_dir($root . $_POST['dir'] . $file)) { echo "<li class=\"directory collapsed\"><a id=\"" . uniqid() . "\" href=\"#\" rel=\"" . htmlentities($_POST['dir'] . $file) . "/\">" . htmlentities($file) . "</a></li>"; } } // All files foreach ($files as $file) { if ($file != '.' && $file != '..' && file_exists($root . $_POST['dir'] . $file) && !is_dir($root . $_POST['dir'] . $file)) { $ext = preg_replace('/^.*\\./', '', $file); echo "<li class=\"file ext_{$ext}\"><a id=\"" . uniqid() . "\" href=\"#\" rel=\"" . htmlentities($_POST['dir'] . $file) . "\">" . htmlentities($file) . "</a></li>"; } } echo "</ul>"; } } }