function sms_send($phone, $content) { global $INI; if (mb_strlen($content, 'UTF-8') < 20) { return '短信长度低于20汉字?长点吧~'; } /* include customsms function */ $smsowner_file = dirname(__FILE__) . '/smsowner.php'; if (file_exists($smsowner_file)) { require_once $smsowner_file; if (function_exists('sms_send_owner')) { return sms_send_owner($phone, $content); } } /* end include */ $user = strval($INI['sms']['user']); $pass = strtolower(md5($INI['sms']['pass'])); if (null == $user) { return true; } $content = urlEncode($content); $api = "http://notice.zuitu.com/sms?user={$user}&pass={$pass}&phones={$phone}&content={$content}"; $res = Utility::HttpRequest($api); return trim(strval($res)) == '+OK' ? true : strval($res); }
public function getUserInfo($accessToken) { // Get the correct Profile Endpoint URL based off the country/region provided in the config['region'] $this->profileEndpointUrl(); if (empty($accessToken)) { throw new \InvalidArgumentException('Access Token is a required parameter and is not set'); } // To make sure double encoding doesn't occur decode first and encode again. $accessToken = urldecode($accessToken); $url = $this->profileEndpoint . '/auth/o2/tokeninfo?access_token=' . urlEncode($accessToken); $httpCurlRequest = new HttpCurl($this->config); $response = $httpCurlRequest->httpGet($url); $data = json_decode($response); if ($data->aud != $this->config['client_id']) { // The access token does not belong to us throw new \Exception('The Access token entered is incorrect'); } // Exchange the access token for user profile $url = $this->profileEndpoint . '/user/profile'; $httpCurlRequest = new HttpCurl($this->config); $httpCurlRequest->setAccessToken($accessToken); $httpCurlRequest->setHttpHeader(true); $response = $httpCurlRequest->httpGet($url); $userInfo = json_decode($response, true); return $userInfo; }
/** * Cleans a URL so it's safe to print to the browser without issues. * @param uri String The URL to parse * @return String The clean URL to print */ public static function cleanUrl($uri) { $result = null; $url = htmlEntities($uri, ENT_QUOTES, 'utf-8'); $parse = parse_url($url); $result = "{$parse['scheme']}://"; $parse['path'] = ltrim($parse['path'], '/'); foreach (array('user', 'pass', 'path', 'query', 'fragment') as $p) { if (isset($parse[$p])) { $parse[$p] = urlEncode($parse[$p]); } } if (!empty($parse['user'])) { $result .= "{$parse['user']}"; if (empty($parse['pass'])) { $result .= '@'; } else { $result .= ":{$parse['pass']}@"; } } $result .= "{$parse['host']}/{$parse['path']}"; if (!empty($parse['query'])) { $result .= "?{$parse['query']}"; } if (!empty($parse['fragment'])) { $result .= "#{$parse['fragment']}"; } return $result; }
private function genURL($url = "/", $param, $value) { if (false === strpos($url, '?')) { return $url . '?' . urlEncode($param) . '=' . urlEncode($value); } else { return $url . '&' . urlEncode($param) . '=' . urlEncode($value); } }
function showBody() { #---------------------------------------------------------------------- global $chosenPersonId; // simple validation first... if (!preg_match('/\\d{4}\\w{4}\\d{2}/', $chosenPersonId)) { showErrorMessage('Invalid WCA id Format <strong>[</strong>' . o($chosenPersonId) . '<strong>]</strong>'); print '<p><a href="persons.php">Click here to search for people.</a></p>'; return; } #--- Get all incarnations of the person. $persons = dbQuery("\n SELECT person.name personName, country.name countryName, day, month, year, gender\n FROM Persons person, Countries country\n WHERE person.id = '{$chosenPersonId}' AND country.id = person.countryId\n ORDER BY person.subId\n "); #--- If there are none, show an error and do no more. if (!count($persons)) { showErrorMessage('Unknown person id <strong>[</strong>' . o($chosenPersonId) . '<strong>]</strong>'); $namepart = substr($chosenPersonId, 4, 4); print '<p><a href="persons.php?pattern=' . urlEncode($namepart) . '">Click to search for people with `' . o($namepart) . '` in their name.</a></p>'; return; } #--- Get and show the current incarnation. $currentPerson = array_shift($persons); extract($currentPerson); echo "<h1>{$personName}</h1>"; #--- Show previous incarnations if any. if (count($persons)) { echo "<p class='subtitle'>(previously "; foreach ($persons as $person) { $previous[] = "{$person['personName']}/{$person['countryName']}"; } echo implode(', ', $previous) . ")</p>"; } #--- Show the picture if any. $picture = getCurrentPictureFile($chosenPersonId); if ($picture) { echo "<center><img class='person' src='{$picture}' /></center>"; } #--- Show the In Memoriam if any. $inMemoriamArray = array("2008COUR01" => "https://www.worldcubeassociation.org/forum/viewtopic.php?t=2028", "2003LARS01" => "https://www.worldcubeassociation.org/forum/viewtopic.php?t=1982", "2012GALA02" => "https://www.worldcubeassociation.org/forum/viewtopic.php?t=1044", "2008LIMR01" => "https://www.worldcubeassociation.org/forum/viewtopic.php?t=945", "2008KIRC01" => "https://www.worldcubeassociation.org/forum/viewtopic.php?t=470"); if (array_key_exists($chosenPersonId, $inMemoriamArray)) { echo "<center><a target='_blank' href='{$inMemoriamArray[$chosenPersonId]}'>In Memoriam</a></center>"; } #--- Show the details. tableBegin('results', 4); tableCaption(false, 'Details'); tableHeader(explode('|', 'Country|WCA Id|Gender|Competitions'), array(3 => 'class="f"')); $gender_text = genderText($gender); $numberOfCompetitions = dbValue("SELECT count(distinct competitionId) FROM Results where personId='{$chosenPersonId}'"); tableRow(array($countryName, $chosenPersonId, $gender_text, $numberOfCompetitions)); tableEnd(); #--- Try the cache for the results # tryCache( 'person', $chosenPersonId ); #--- Now the results. require 'includes/person_personal_records_current.php'; require 'includes/person_world_championship_podiums.php'; require 'includes/person_world_records_history.php'; require 'includes/person_continent_records_history.php'; require 'includes/person_events.php'; }
public function getListFileTree($path = '', $jump = '') { $option = "com_xsltmagic"; $files = array(); $folders = array(); $size = 0; foreach (scandir($path) as $v) { if (!is_dir($path . '/' . $v)) { $files[] = $path . '/' . $v; continue; } if (substr($v, 0, 1) != '.') { // not need '.' '..' $folders[] = $path . '/' . $v; } } natcasesort($folders); natcasesort($files); if (isset($jump)) { $link = explode('&', $jump); $url = ''; for ($i = 1; $i < count($link) - 1; $i++) { $url .= '&' . $link[$i]; } $row[$size]->link = JRoute::_("index.php?option={$option}&controller=xslts" . $url); $row[$size]->checked_out = false; $row[$size]->name = '...'; $size++; } // Folders for ($f = 0; $f < count($folders); $f++) { $currentFolder = str_replace($path . '/', '', $folders[$f]); $link = $jump . '&jump[]=' . basename($currentFolder); $row[$size]->link = JRoute::_("index.php?option={$option}&controller=xslts" . $link); $row[$size]->checked_out = false; $row[$size]->name = basename($currentFolder); $row[$size]->type = 'Folder'; $row[$size]->modified = date("d.m.Y H:i:s", filemtime($path . DS . $currentFolder)); $size++; } // Process files for ($h = 0; $h < count($files); $h++) { $currentFile = str_replace($path . '/', '', $files[$h]); $currentEncoded = urlEncode($currentFile); $subArr = explode('%2F', $currentEncoded); $filename = $subArr[count($subArr) - 1]; $subArrr = explode('.', $filename); $extension = $subArrr[count($subArrr) - 1]; $row[$size]->link = JRoute::_("index.php?option={$option}&id[]={$filename}&task=edit&controller=xslts" . $jump); $row[$size]->checked_out = false; $row[$size]->name = $filename; $row[$size]->type = $extension; $row[$size]->modified = date("d.m.Y H:i:s", filemtime($path . DS . $currentFile)); $row[$size]->fileSize = round(filesize($path . DS . $currentFile) / 1024) . ' kb'; $size++; } return $row; }
function sms_send($phone, $content) { global $INI; if (mb_strlen($content, 'UTF-8') < 20) { return '短信长度低于20汉字?长点吧~'; } $user = $INI['sms']['user']; $pass = strtolower(md5($INI['sms']['pass'])); $content = urlEncode($content); $api = "http://notice.zuitu.com/sms?user={$user}&pass={$pass}&phones={$phone}&content={$content}"; $res = Utility::HttpRequest($api); return trim(strval($res)) == '+OK' ? true : strval($res); }
public function sendAvicSMSAction($mobiles, $msg) { $SMS_ACT = $this->container->getParameter('SMS_ACT'); $SMS_PWD = $this->container->getParameter('SMS_PWD'); $SMS_URL = $this->container->getParameter('SMS_URL'); $SMS_EID = $this->container->getParameter('SMS_EID'); $mobiles = str_replace(";", ",", $mobiles); $content = urlEncode(urlEncode(mb_convert_encoding($msg, 'gb2312', 'utf-8'))); $pwd = md5($SMS_PWD); $apidata = "username={$SMS_ACT}&password={$pwd}&message={$content}&phone={$mobiles}&epid={$SMS_EID}&linkid=&subcode="; $this->get("logger")->err($SMS_URL . "?" . $apidata); $result = mb_convert_encoding($this->do_post_request($SMS_URL . "?" . $apidata, null), 'utf-8', 'gb2312'); $this->get("logger")->err($result); return Utils::WrapResultOK(''); }
function exchangeRate($amount, $currency, $exchangeIn) { $url = @'http://www.google.com/ig/calculator?hl=en&q=' . urlEncode($amount . $currency . '=?' . $exchangeIn); $data = @file_get_contents($url); if (!$data) { throw new Exception('Could not connect'); } $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE); $array = $json->decode($data); if (!$array) { throw new Exception('Could not parse the JSON'); } if ($array['error']) { throw new Exception('Google reported an error: ' . $array['error']); } return (double) $array['rhs']; }
function choice($id, $caption, $options, $chosenOption) { #---------------------------------------------------------------------- $result = "<label for='{$id}'>"; $result .= $caption ? "{$caption}:<br />" : ''; $result .= "<select class='drop' id='{$id}' name='{$id}'>\n"; $chosen = urlEncode($chosenOption); foreach ($options as $option) { $nick = urlEncode($option[0]); $text = htmlEntities($option[1], ENT_QUOTES, "UTF-8"); $selected = $chosen && $nick == $chosen ? " selected='selected'" : ""; $result .= "<option value='{$nick}'{$selected}>{$text}</option>\n"; } $result .= "</select>"; $result .= "</label>"; return $result; }
function accesCle($tuple, $format = "url") { $separateur = $chaine = ""; // Parcours des attributs foreach ($this->schemaTable as $nom => $options) { // C'est un attribut de la cl� primaire if ($options['cle_primaire']) { if ($format == "url") { $chaine .= "&{$nom}=" . urlEncode($tuple[$nom]); $separateur = "&"; } else { $chaine .= "{$separateur}{$nom}='" . addSlashes($tuple[$nom]) . "'"; $separateur = " AND "; } } } return $chaine; }
/** * Converts currency using google. throws an exception if something went wrong * * @param numeric $amount * @param string from currency (ex USD) * @param string to currency (ex EUR) * @return number * @author: http://www.it-base.ro/2007/07/09/currency-conversion-in-php * @author: Jason M Hinkle * @version: 1.0 */ public static function Convert($amount, $from, $to) { $converted_amount = 0; $qs = $amount . ' ' . $from . ' in ' . $to; $url = "http://www.google.com/search?q=" . urlEncode($qs); $g_response = strip_tags(HttpRequest::Get($url)); if (preg_match("/Rates provided for information only - see disclaimer./i", $g_response)) { $matches = array(); preg_match('/= ([0-9\\s\\.,]+)/', $g_response, $matches); if ($matches[1]) { $converted_amount = $matches[1]; } else { // this should never occur unless google changes the output formatting of the search results throw new Exception("Unable to parse response from google"); } } else { throw new Exception("The google search result does not appear to contain currency information"); } return $converted_amount; }
public function send($mobile, $content, $schedule = null) { $providerInfo = $this->_getProviderInfo(); if ($schedule == "0000-00-00 00:00:00") { $schedule = ''; } else { $schedule = date('Y-m-d H:i:s', strtotime($schedule)); } $sender = new BayouSmsSender(); $content_log = $content; $content = urlEncode(urlEncode(mb_convert_encoding($content, 'gb2312', 'utf-8'))); $result = $sender->sendsms($providerInfo['username'], md5($providerInfo['password']), $mobile, $content, $schedule); if ($result['status'] == 0) { Openbiz::getService(LOG_SERVICE)->log(LOG_ERR, "SMS", "sendMessage: " . $content . " Bayou:" . $mobile . ':' . $result['msg']); return false; } else { $this->HitMessageCounter(); $this->_log($mobile, $content_log, $schedule); return true; } }
protected static function encodeValue($value) { return urlEncode($value); }
$phone_types['polycom-spip-450'] = 'Polycom SoundPoint IP 450'; $phone_types['polycom-spip-501'] = 'Polycom SoundPoint IP 501'; $phone_types['polycom-spip-550'] = 'Polycom SoundPoint IP 550'; $phone_types['polycom-spip-560'] = 'Polycom SoundPoint IP 560'; $phone_types['polycom-spip-601'] = 'Polycom SoundPoint IP 601'; $phone_types['polycom-spip-650'] = 'Polycom SoundPoint IP 650'; $phone_types['polycom-spip-670'] = 'Polycom SoundPoint IP 670'; } $per_page = (int) GS_GUI_NUM_RESULTS; $mac_addr_internal = _mac_addr_internal(@$_REQUEST['mac']); $mac_addr_display = _mac_addr_display($mac_addr_internal); $pbx_id = array_key_exists('pbx_id', $_REQUEST) ? (int) $_REQUEST['pbx_id'] : -1; $ip_addr = trim(@$_REQUEST['ip']); $phone_type = @$_REQUEST['phone_type']; $page = (int) @$_REQUEST['page']; $search_url = 'mac=' . urlEncode($mac_addr_internal) . '&' . 'ip=' . urlEncode($ip_addr) . '&' . 'pbx_id=' . urlEncode($pbx_id) . '&' . 'phone_type=' . urlEncode($phone_type); ##################################################################### # view { ##################################################################### if ($action === 'view') { //echo "<pre>"; print_r($_REQUEST); echo "</pre>"; $where = array(); if ($mac_addr_internal != '') { $where[] = '`p`.`mac_addr` LIKE \'%' . $DB->escape($mac_addr_internal) . '%\''; } if ($pbx_id === 0) { $where[] = '`h`.`is_foreign`=0'; } elseif ($pbx_id > 0) { $where[] = '`h`.`id`=' . $pbx_id; } if ($ip_addr != '') {
/** * Get the value of a field in the current row. * Possible keys in the options array: * binary, unserialize, convertHTMLBreaks, urlEncode, filterHTMLSpecialCharacters, escapeForXML, stripSlashes * * @param string $ps_field field name * @param array $pa_options associative array of options, keys are names of the options, values are boolean. * @return mixed */ function get($ps_field, $pa_options = null) { $va_field = isset(DbResult::$s_field_info_cache[$ps_field]) ? DbResult::$s_field_info_cache[$ps_field] : $this->getFieldInfo($ps_field); if (!isset($this->opa_current_row[$va_field["field"]])) { return null; } $vs_val = isset($this->opa_current_row[$va_field["field"]]) ? $this->opa_current_row[$va_field["field"]] : null; if (isset($pa_options["binary"]) && $pa_options["binary"]) { return $vs_val; } if (isset($pa_options["unserialize"]) && $pa_options["unserialize"]) { if (!isset($this->opa_unserialized_cache[$va_field["field"]]) || !($vm_data = $this->opa_unserialized_cache[$va_field["field"]])) { $vm_data = caUnserializeForDatabase($vs_val); $this->opa_unserialized_cache[$va_field["field"]] =& $vm_data; } return $vm_data; } if (isset($pa_options["convertHTMLBreaks"]) && $pa_options["convertHTMLBreaks"]) { # check for tags before converting breaks preg_match_all("/<[A-Za-z0-9]+/", $vs_val, $va_tags); $va_ok_tags = array("<b", "<i", "<u", "<strong", "<em", "<strike", "<sub", "<sup", "<a", "<img", "<span"); $vb_convert_breaks = true; foreach ($va_tags[0] as $vs_tag) { if (!in_array($vs_tag, $va_ok_tags)) { $vb_convert_breaks = false; break; } } if ($vb_convert_breaks) { $vs_val = preg_replace("/(\n|\r\n){2}/", "<p/>", $vs_val); $vs_val = ereg_replace("\n", "<br/>", $vs_val); } } if (isset($pa_options["urlEncode"]) && $pa_options["urlEncode"]) { $vs_val = urlEncode($vs_val); } if (isset($pa_options["filterHTMLSpecialCharacters"]) && $pa_options["filterHTMLSpecialCharacters"]) { $vs_val = htmlentities(html_entity_decode($vs_val)); } if (isset($pa_options["escapeForXML"]) && $pa_options["escapeForXML"]) { $vs_val = caEscapeForXML($vs_val); } if (get_magic_quotes_gpc() || $pa_options["stripSlashes"]) { $vs_val = stripSlashes($vs_val); } return $vs_val; }
<span style="display:none" id="jum_paging"><?php echo $paging_tampil; ?> </span> <span style="display:none" id="jum_hal"><?php echo $jum_hal; ?> </span> <span style="display:none" id="sql"><?php echo urlEncode($sql); ?> </span> <!--- untuk informasi paging jika ada pencarian --> <span style="display:none" id="sql_cari"><?php echo urlEncode($sql); ?> </span> <script type="text/javascript" > // untuk paging function hal(elm){ var sql = $("#sql_cari").text(); var bag_sekarang = $("#next").text() - 1; var hal = $(elm).text(); var url = "data_tampil.php"; // untuk fungsi update_inline var tabel = "keluarga"; var nama_id = "id_keluarga"; var url_update = "update.php"; $("#table").html("ditunggu cak .........");
public function getmobilevaildcodeAction() { $re = array("returncode" => ReturnCode::$SUCCESS); $da = $this->get("we_data_access"); $user = $this->get('security.context')->getToken()->getUser(); $accountContorller = new AccountController(); $request = $this->getRequest(); $session = $request->getSession(); $txtmobile = $request->get("txtmobile"); if (empty($txtmobile) || !preg_match("/^(1[8|3|5][0-9]|15[0|3|6|7|8|9]|18[2|5|6|8|9])\\d{8}\$/", $txtmobile)) { $re["returncode"] = ReturnCode::$SYSERROR; $re["msg"] = "请输入正确的手机号!"; $response = new Response($request->get('jsoncallback') ? $request->get('jsoncallback') . "(" . json_encode($re) . ");" : json_encode($re)); $response->headers->set('Content-Type', 'text/json'); return $response; } //判断此手机已被绑定 $sql = "select 1 from we_staff where mobile_bind=?"; $params = array($txtmobile); $ds = $da->Getdata('lo', $sql, $params); if ($ds['lo']['recordcount'] > 0) { $re["returncode"] = ReturnCode::$SYSERROR; $re["msg"] = "该手机号已被绑定!"; $response = new Response($request->get('jsoncallback') ? $request->get('jsoncallback') . "(" . json_encode($re) . ");" : json_encode($re)); $response->headers->set('Content-Type', 'text/json'); return $response; } $lastgetmobilevaildcodetime = $session->get("lastgetmobilevaildcodetime"); $getmobilevaildcodenums = $session->get("getmobilevaildcodenums"); if (empty($lastgetmobilevaildcodetime)) { $lastgetmobilevaildcodetime = time() - 60 * 60; } if (empty($getmobilevaildcodenums)) { $getmobilevaildcodenums = 0; } try { if ($lastgetmobilevaildcodetime + 90 > time()) { $re["returncode"] = ReturnCode::$SYSERROR; $re["msg"] = "你获取验证码的次数太频繁!90秒钟只能取一次!"; $response = new Response($request->get('jsoncallback') ? $request->get('jsoncallback') . "(" . json_encode($re) . ");" : json_encode($re)); $response->headers->set('Content-Type', 'text/json'); return $response; } if ($getmobilevaildcodenums >= 5 && $lastgetmobilevaildcodetime + 60 * 60 * 24 > time()) { $re["returncode"] = ReturnCode::$SYSERROR; $re["msg"] = "你获取验证码的次数太多!每天最多只能取5次!"; $response = new Response($request->get('jsoncallback') ? $request->get('jsoncallback') . "(" . json_encode($re) . ");" : json_encode($re)); $response->headers->set('Content-Type', 'text/json'); return $response; } $mobilevaildcode = rand(100000, 999999); $user = $this->container->getParameter("SMS_ACT"); $pass = md5($this->container->getParameter("SMS_PWD")); //需要MD5 $phone = $txtmobile; $content = "欢迎使用Wefafa,您的验证码是:{$mobilevaildcode} 。【发发时代】"; $content = urlEncode(urlEncode(mb_convert_encoding($content, 'gb2312', 'utf-8'))); $apidata = "func=sendsms&username={$user}&password={$pass}&mobiles={$phone}&message={$content}&smstype=0&timerflag=0&timervalue=&timertype=0&timerid=0"; $apiurl = $this->container->getParameter("SMS_URL"); $ret = $accountContorller->do_post_request($apiurl, $apidata); if (strpos($ret, "<errorcode>0</errorcode>") > 0) { $session->set("mobilevaildcode", $mobilevaildcode); $session->set("lastgetmobilevaildcodetime", time()); $session->set("getmobilevaildcodenums", $getmobilevaildcodenums + 1); $session->set("txtmobile", $txtmobile); $re["returncode"] = ReturnCode::$SUCCESS; } else { $re["returncode"] = ReturnCode::$SYSERROR; $re["msg"] = "短信发送失败!请重试"; $this->get('logger')->info($ret); } } catch (\Exception $e) { $re["returncode"] = ReturnCode::$SYSERROR; $re["msg"] = "获取并发送短信验证码失败!请重试"; $this->get('logger')->err($e); } $response = new Response($request->get('jsoncallback') ? $request->get('jsoncallback') . "(" . json_encode($re) . ");" : json_encode($re)); $response->headers->set('Content-Type', 'text/json'); return $response; }
public function getmobilevaildcodeAction($network_domain) { $re = array(); $da = $this->get("we_data_access"); $user = $this->get('security.context')->getToken()->getUser(); $request = $this->getRequest(); $session = $request->getSession(); $txtmobile = $request->get("txtmobile"); if (empty($txtmobile) || !preg_match("/^(1[8|3|5][0-9]|15[0|3|6|7|8|9]|18[2|5|6|8|9])\\d{8}\$/", $txtmobile)) { $re["success"] = "0"; $re["msg"] = "请输入正确的手机号!"; $response = new Response(json_encode($re)); $response->headers->set('Content-Type', 'text/json'); return $response; } //判断是否已绑定手机号 /* if(!empty($user->mobile_bind)) { $re["success"] = "0"; $re["msg"] = "您已绑定了手机号,请先解除原有绑定!"; $response = new Response(json_encode($re)); $response->headers->set('Content-Type', 'text/json'); return $response; } */ //判断此手机已被绑定 $sql = "select 1 from we_staff where mobile_bind=?"; $params = array($txtmobile); $ds = $da->Getdata('lo', $sql, $params); if ($ds['lo']['recordcount'] > 0) { $re["success"] = "0"; $re["msg"] = "该手机号已被绑定!"; $response = new Response(json_encode($re)); $response->headers->set('Content-Type', 'text/json'); return $response; } $lastgetmobilevaildcodetime = $session->get("lastgetmobilevaildcodetime"); $getmobilevaildcodenums = $session->get("getmobilevaildcodenums"); if (empty($lastgetmobilevaildcodetime)) { $lastgetmobilevaildcodetime = time() - 60 * 60; } if (empty($getmobilevaildcodenums)) { $getmobilevaildcodenums = 0; } try { if ($lastgetmobilevaildcodetime + 120 > time()) { $re["success"] = "0"; $re["msg"] = "你获取验证码的次数太频繁!120秒钟只能取一次!"; $response = new Response(json_encode($re)); $response->headers->set('Content-Type', 'text/json'); return $response; } if ($getmobilevaildcodenums >= 5 && $lastgetmobilevaildcodetime + 60 * 60 * 24 > time()) { $re["success"] = "0"; $re["msg"] = "你获取验证码的次数太多!每天最多只能取5次!"; $response = new Response(json_encode($re)); $response->headers->set('Content-Type', 'text/json'); return $response; } $mobilevaildcode = rand(100000, 999999); $user = $this->container->getParameter("SMS_ACT"); $pass = md5($this->container->getParameter("SMS_PWD")); //需要MD5 $phone = $txtmobile; $content = "验证码:" . $mobilevaildcode . ",2分钟内有效,仅用于绑定手机操作。 【Wefafa】"; $content = urlEncode(urlEncode(mb_convert_encoding($content, 'gb2312', 'utf-8'))); $apidata = "func=sendsms&username={$user}&password={$pass}&mobiles={$phone}&message={$content}&smstype=0&timerflag=0&timervalue=&timertype=0&timerid=0"; $apiurl = $this->container->getParameter("SMS_URL"); $ret = $this->do_post_request($apiurl, $apidata); if (strpos($ret, "<errorcode>0</errorcode>") > 0) { $session->set("mobilevaildcode", $mobilevaildcode); $session->set("lastgetmobilevaildcodetime", time()); $session->set("getmobilevaildcodenums", $getmobilevaildcodenums + 1); $session->set("txtmobile", $txtmobile); $re["success"] = "1"; //$re["code"] =$mobilevaildcode; } else { $re["success"] = "0"; $re["msg"] = "短信发送失败!请稍后重试"; $this->get('logger')->info($ret); } } catch (\Exception $e) { $re["success"] = "0"; $re["msg"] = "获取并发送短信验证码失败!请稍后重试"; $this->get('logger')->err($e); } $response = new Response(json_encode($re)); $response->headers->set('Content-Type', 'text/json'); return $response; }
if ($page < $num_pages - 1) { $xml .= '<SoftKey index="6">' . "\n"; $xml .= ' <Label>' . ($page + 2) . '>></Label>' . "\n"; $xml .= ' <URI>' . $url_aastra_pb . '?t=imported&p=' . ($page + 1) . '&n=' . $name_search . '</URI>' . "\n"; $xml .= '</SoftKey>' . "\n"; } $xml .= '</AastraIPPhoneTextMenu>' . "\n"; } else { if ($name_search) { aastra_textscreen(__('Nicht gefunden'), sprintF(__('Eintrag "%s" nicht gefunden.'), $name_search)); } else { aastra_textscreen($page_title, __('Kein Eintrag')); } } } elseif ($type === 'prv') { $search_url = 'name=' . urlEncode($name_search); $name_sql = str_replace(array('*', '?'), array('%', '_'), strtolower($name_search)) . '%'; $user_id = _get_userid(); $query = 'SELECT SQL_CALC_FOUND_ROWS `id`, `lastname` `ln`, `firstname` `fn`, `number` FROM `pb_prv` WHERE `user_id`=' . $user_id . ' AND ( LOWER(`lastname`) LIKE _utf8\'' . $db->escape($name_sql) . '\' COLLATE utf8_unicode_ci OR LOWER(`firstname`) LIKE _utf8\'' . $db->escape($name_sql) . '\' COLLATE utf8_unicode_ci ) ORDER BY `lastname`, `firstname` LIMIT ' . $page * $per_page . ',' . $per_page; $rs = $db->execute($query); $num_total = @$db->numFoundRows();
function sendMobile($SMS_ACT, $SMS_PWD, $SMS_URL, $mobiles, $content) { $content = urlEncode(urlEncode(mb_convert_encoding($content, 'gb2312', 'utf-8'))); $pwd = md5($SMS_PWD); $apidata = "func=sendsms&username={$SMS_ACT}&password={$pwd}&mobiles={$mobiles}&message={$content}&smstype=0&timerflag=0&timervalue=&timertype=0&timerid=0"; $obj = call_user_func("do_post_request", $SMS_URL, $apidata); $result = mb_convert_encoding($obj, 'utf-8', 'gb2312'); return $result; }
/** * Edit method: used to manage a simple workflow for editing * @param object the request object * @return none */ public function edit($request) { // Extract the controller and action info. $module = $request->getModuleName(); $control = $request->getControllerName(); $action = $request->getActionName(); // Set the current edit action URL (use the config to obtain the base URL) // Get the utilitary objects from the registry $registry = Zend_registry::getInstance(); $zmax_context = $registry->get("zmax_context"); if ($module == "default") { $this->url = $zmax_context->config->app->base_url . "/" . $control . "/" . $action . "?1=1"; } else { $this->url = $zmax_context->config->app->base_url . "/" . $module . "/" . $control . "/" . $action . "?1=1"; } // echo "Control = $control Action = $action URL=$this->url<br/>"; // Get the values of the table form if ($request->getParam("show_table_form")) { // Get the values submitted in the table form foreach ($this->info['cols'] as $name) { $form_field_name = $this->getTblFormFieldName($name); if ($request->getParam($form_field_name)) { $this->table_form_values[$form_field_name] = $request->getParam($form_field_name); // Put these values in a GET query $this->form_table_query .= "&{$form_field_name}=" . urlEncode($request->getParam($form_field_name)); } } // echo "Table form fields:"; // print_r ($this->table_form_values); $this->form_table_query = "&show_table_form=1" . $this->form_table_query; } // We are only interested in POST parameters $paramsHTTP = $_REQUEST; // PR: do better // Check whether an action is required. if (isset($paramsHTTP[self::ZMAX_EDIT_ACTION])) { $action = $paramsHTTP[self::ZMAX_EDIT_ACTION]; } else { $action = ""; } $affichage = ""; switch ($action) { case self::DB_INSERT: // Insertion required if ($this->insertion($paramsHTTP)) { $affichage .= "<i>Insertion: done</i>"; $affichage .= "<h2>Input form</h2>"; $affichage .= $this->form(self::DB_INSERT, array()); } else { $affichage .= $this->messageList(); $affichage .= $this->form(self::DB_INSERT, $paramsHTTP); } break; case self::DB_UPDATE: // We must modify the row if ($this->update($paramsHTTP)) { $affichage .= "<i>Update: done.</i>"; } else { $affichage .= $this->messageList(); } $ligne = $this->getRow($paramsHTTP); $affichage .= $this->form(self::DB_UPDATE, $ligne); break; case self::DB_DELETE: // Remove the line $this->delete($paramsHTTP); $affichage .= "<i>Deletion: done.</i>"; $affichage .= $this->form(self::DB_INSERT, array()); break; case self::DB_EDIT: // Search a row and edit it $ligne = $this->getRow($paramsHTTP); $affichage .= $this->form(self::DB_UPDATE, $ligne); break; default: $affichage .= $this->form(self::DB_INSERT, array()); break; } $affichage .= "<br />\n"; // petite separation // Maybe show the HTML table with the content of the table if ($this->show_table_content) { $affichage .= "<h2><i>{$this->table_label}</i></h2>\n"; $affichage .= $this->table(array("BORDER" => 2)); } // Maybe show the form if ($this->mode_show_form) { $add_url = $this->url . $this->form_table_query; $affichage .= "<a href='{$add_url}'>{$this->texts->form->add_line}</a>\n"; } // Retour de la page HTML return $affichage; }
/** * Get a field value of the table row that is represented by this object. * * @param string $ps_field field name * @param array $pa_options options array; can be omitted. * It should be an associative array of boolean (except one of the options) flags. In case that some of the options are not set, they are treated as 'false'. * Possible options (keys) are: * BINARY: return field value as is * FILTER_HTML_SPECIAL_CHARS: convert all applicable chars to their html entities * DONT_PROCESS_GLOSSARY_TAGS: ? * CONVERT_HTML_BREAKS: similar to nl2br() * convertLineBreaks: same as CONVERT_HTML_BREAKS * getDirectDate: return raw date value from database if $ps_field adresses a date field, otherwise the value will be parsed using the TimeExpressionParser::getText() method * getDirectTime: return raw time value from database if $ps_field adresses a time field, otherwise the value will be parsed using the TimeExpressionParser::getText() method * TIMECODE_FORMAT: set return format for fields representing time ranges possible (string) values: COLON_DELIMITED, HOURS_MINUTES_SECONDS, RAW; data will be passed through floatval() by default * QUOTE: set return value into quotes * URL_ENCODE: value will be passed through urlencode() * ESCAPE_FOR_XML: convert <, >, &, ' and " characters for XML use * DONT_STRIP_SLASHES: if set to true, return value will not be passed through stripslashes() * template: formatting string to use for returned value; ^<fieldname> placeholder is used to represent field value in template * returnAsArray: if true, fields that can return multiple values [currently only <table_name>.children.<field>] will return values in an indexed array; default is false * returnAllLocales: * delimiter: if set, value is used as delimiter when fields that can return multiple fields are returned as strings; default is a single space * convertCodesToDisplayText: if set, id values refering to foreign keys are returned as preferred label text in the current locale * returnURL: if set then url is returned for media, otherwise an HTML tag for display is returned * dateFormat: format to return created or lastModified dates in. Valid values are iso8601 or text * checkAccess = array of access values to filter results by; if defined only items with the specified access code(s) are returned. Only supported for table that have an "access" field. * sort = optional field to sort returned values on. The field specifiers are fields with or without table name specified. * sort_direction = direction to sort results by, either 'asc' for ascending order or 'desc' for descending order; default is 'asc' */ public function get($ps_field, $pa_options = null) { if (!$ps_field) { return null; } if (!is_array($pa_options)) { $pa_options = array(); } $vb_return_as_array = caGetOption('returnAsArray', $pa_options, false); $vb_return_with_structure = caGetOption('returnWithStructure', $pa_options, false); $vb_return_all_locales = caGetOption('returnAllLocales', $pa_options, false); $vs_delimiter = caGetOption('delimiter', $pa_options, ' '); if (($vb_return_with_structure || $vb_return_all_locales) && !$vb_return_as_array) { $vb_return_as_array = true; } $vn_row_id = $this->getPrimaryKey(); if ($vb_return_as_array && $vb_return_as_array) { $vn_locale_id = $this->hasField('locale_id') ? $this->get('locale_id') : null; } $va_tmp = explode('.', $ps_field); if (sizeof($va_tmp) > 1) { if ($va_tmp[0] === $this->tableName()) { // // Return created on or last modified // if (in_array($va_tmp[1], array('created', 'lastModified'))) { if ($vb_return_as_array) { return $va_tmp[1] == 'lastModified' ? $this->getLastChangeTimestamp() : $this->getCreationTimestamp(); } else { $va_data = $va_tmp[1] == 'lastModified' ? $this->getLastChangeTimestamp() : $this->getCreationTimestamp(); $vs_subfield = isset($va_tmp[2]) && isset($va_data[$va_tmp[2]]) ? $va_tmp[2] : 'timestamp'; $vm_val = $va_data[$vs_subfield]; if ($vs_subfield == 'timestamp') { $o_tep = new TimeExpressionParser(); $o_tep->setUnixTimestamps($vm_val, $vm_val); $vm_val = $o_tep->getText($pa_options); } return $vm_val; } } // // Generalized get // $va_field_info = $this->getFieldInfo($va_tmp[1]); switch (sizeof($va_tmp)) { case 2: // support <table_name>.<field_name> syntax $ps_field = $va_tmp[1]; break; default: // > 2 elements // media field? if ($va_field_info['FIELD_TYPE'] === FT_MEDIA && !isset($pa_options['returnAsArray']) && !$pa_options['returnAsArray']) { $o_media_settings = new MediaProcessingSettings($va_tmp[0], $va_tmp[1]); $va_versions = $o_media_settings->getMediaTypeVersions('*'); $vs_version = $va_tmp[2]; if (!isset($va_versions[$vs_version])) { $va_available_versions = array_keys($va_versions); $vs_version = $va_tmp[2] = array_shift($va_available_versions); } if (isset($va_tmp[3])) { return $this->getMediaInfo($va_tmp[1], $vs_version, 'width'); } else { if (isset($pa_options['returnURL']) && $pa_options['returnURL']) { return $this->getMediaUrl($va_tmp[1], $vs_version, $pa_options); } else { return $this->getMediaTag($va_tmp[1], $vs_version, $pa_options); } } } if ($va_tmp[1] == 'parent' && $this->isHierarchical() && ($vn_parent_id = $this->get($this->getProperty('HIERARCHY_PARENT_ID_FLD')))) { $t_instance = $this->getAppDatamodel()->getInstanceByTableNum($this->tableNum()); if (!$t_instance->load($vn_parent_id)) { return $vb_return_as_array ? array() : null; } else { unset($va_tmp[1]); $va_tmp = array_values($va_tmp); if ($vb_return_as_array) { if ($vb_return_all_locales) { return array($vn_row_id => array($vn_locale_id => array($t_instance->get(join('.', $va_tmp))))); } else { return array($vn_row_id => $t_instance->get(join('.', $va_tmp))); } } else { return $t_instance->get(join('.', $va_tmp)); } } } else { if ($va_tmp[1] == 'children' && $this->isHierarchical()) { $vb_check_access = is_array($pa_options['checkAccess']) && $this->hasField('access'); $va_sort = isset($pa_options['sort']) ? $pa_options['sort'] : null; if (!is_array($va_sort) && $va_sort) { $va_sort = array($va_sort); } if (!is_array($va_sort)) { $va_sort = array(); } $vs_sort_direction = isset($pa_options['sort_direction']) && in_array(strtolower($pa_options['sort_direction']), array('asc', 'desc')) ? strtolower($pa_options['sort_direction']) : 'asc'; unset($va_tmp[1]); // remove 'children' from field path $va_tmp = array_values($va_tmp); $vs_childless_path = join('.', $va_tmp); $va_data = array(); $va_children_ids = $this->getHierarchyChildren(null, array('idsOnly' => true)); if (is_array($va_children_ids) && sizeof($va_children_ids)) { $t_instance = $this->getAppDatamodel()->getInstanceByTableNum($this->tableNum()); if ($va_tmp[1] == $this->primaryKey() && !$vs_sort) { foreach ($va_children_ids as $vn_child_id) { $va_data[$vn_child_id] = $vn_child_id; } } else { if (method_exists($this, "makeSearchResult")) { // Use SearchResult lazy loading when available $vs_table = $this->tableName(); $vs_pk = $vs_table . '.' . $this->primaryKey(); $qr_children = $this->makeSearchResult($this->tableName(), $va_children_ids); while ($qr_children->nextHit()) { if ($vb_check_access && !in_array($qr_children->get("{$vs_table}.access"), $pa_options['checkAccess'])) { continue; } $vn_child_id = $qr_children->get($vs_pk); $vs_sort_key = ''; foreach ($va_sort as $vs_sort) { $vs_sort_key .= $vs_sort ? $qr_children->get($vs_sort) : 0; } if (!is_array($va_data[$vs_sort_key])) { $va_data[$vs_sort_key] = array(); } if ($vb_return_as_array) { $va_data[$vs_sort_key][$vn_child_id] = array_shift($qr_children->get($vs_childless_path, array_merge($pa_options, array('returnAsArray' => $vb_return_as_array, 'returnAllLocales' => $vb_return_all_locales)))); } else { $va_data[$vs_sort_key][$vn_child_id] = $qr_children->get($vs_childless_path, array_merge($pa_options, array('returnAsArray' => false, 'returnAllLocales' => false))); } } ksort($va_data); if ($vs_sort_direction && $vs_sort_direction == 'desc') { $va_data = array_reverse($va_data); } $va_sorted_data = array(); foreach ($va_data as $vs_sort_key => $va_items) { foreach ($va_items as $vs_k => $vs_v) { $va_sorted_data[] = $vs_v; } } $va_data = $va_sorted_data; } else { // Fall-back to loading records row-by-row (slow) foreach ($va_children_ids as $vn_child_id) { if ($t_instance->load($vn_child_id)) { if ($vb_check_access && !in_array($t_instance->get("access"), $pa_options['checkAccess'])) { continue; } $vs_sort_key = $vs_sort ? $t_instance->get($vs_sort) : 0; if (!is_array($va_data[$vs_sort_key])) { $va_data[$vs_sort_key] = array(); } if ($vb_return_as_array) { $va_data[$vs_sort_key][$vn_child_id] = array_shift($t_instance->get($vs_childless_path, array_merge($pa_options, array('returnAsArray' => $vb_return_as_array, 'returnAllLocales' => $vb_return_all_locales)))); } else { $va_data[$vs_sort_key][$vn_child_id] = $t_instance->get($vs_childless_path, array_merge($pa_options, array('returnAsArray' => false, 'returnAllLocales' => false))); } } } ksort($va_data); if ($vs_sort_direction && $vs_sort_direction == 'desc') { $va_data = array_reverse($va_data); } $va_sorted_data = array(); foreach ($va_data as $vs_sort_key => $va_items) { foreach ($va_items as $vs_k => $vs_v) { $va_sorted_data[] = $vs_v; } } $va_data = $va_sorted_data; } } } if ($vb_return_as_array) { return $va_data; } else { return join($vs_delimiter, $va_data); } } } break; } } else { $va_rels = $this->getRelatedItems($va_tmp[0]); $va_vals = array(); if (is_array($va_rels)) { foreach ($va_rels as $va_rel_item) { if (isset($va_rel_item[$va_tmp[1]])) { $va_vals[] = $va_rel_item[$va_tmp[1]]; } } return $vb_return_as_array ? $va_vals : join($vs_delimiter, $va_vals); } // can't pull fields from other tables! return $vb_return_as_array ? array() : null; } } if (isset($pa_options["BINARY"]) && $pa_options["BINARY"]) { return $this->_FIELD_VALUES[$ps_field]; } if (array_key_exists($ps_field, $this->FIELDS)) { $ps_field_type = $this->getFieldInfo($ps_field, "FIELD_TYPE"); if ($this->getFieldInfo($ps_field, 'IS_LIFESPAN')) { $pa_options['isLifespan'] = true; } switch ($ps_field_type) { case FT_BIT: $vs_prop = isset($this->_FIELD_VALUES[$ps_field]) ? $this->_FIELD_VALUES[$ps_field] : ""; if (isset($pa_options['convertCodesToDisplayText']) && $pa_options['convertCodesToDisplayText']) { $vs_prop = (bool) $vs_prop ? _t('yes') : _t('no'); } return $vs_prop; break; case FT_TEXT: case FT_NUMBER: case FT_PASSWORD: $vs_prop = isset($this->_FIELD_VALUES[$ps_field]) ? $this->_FIELD_VALUES[$ps_field] : null; if (isset($pa_options["FILTER_HTML_SPECIAL_CHARS"]) && $pa_options["FILTER_HTML_SPECIAL_CHARS"]) { $vs_prop = htmlentities(html_entity_decode($vs_prop)); } // // Convert foreign keys and choice list values to display text is needed // if (isset($pa_options['convertCodesToDisplayText']) && $pa_options['convertCodesToDisplayText'] && ($vs_list_code = $this->getFieldInfo($ps_field, "LIST_CODE"))) { $t_list = new ca_lists(); $vs_prop = $t_list->getItemFromListForDisplayByItemID($vs_list_code, $vs_prop); } else { if (isset($pa_options['convertCodesToDisplayText']) && $pa_options['convertCodesToDisplayText'] && ($vs_list_code = $this->getFieldInfo($ps_field, "LIST"))) { $t_list = new ca_lists(); if (!($vs_tmp = $t_list->getItemFromListForDisplayByItemValue($vs_list_code, $vs_prop))) { if ($vs_tmp = $this->getChoiceListValue($ps_field, $vs_prop)) { $vs_prop = $vs_tmp; } } else { $vs_prop = $vs_tmp; } } else { if (isset($pa_options['convertCodesToDisplayText']) && $pa_options['convertCodesToDisplayText'] && $ps_field === 'locale_id' && (int) $vs_prop > 0) { $t_locale = new ca_locales($vs_prop); $vs_prop = $t_locale->getName(); } else { if (isset($pa_options['convertCodesToDisplayText']) && $pa_options['convertCodesToDisplayText'] && is_array($va_list = $this->getFieldInfo($ps_field, "BOUNDS_CHOICE_LIST"))) { foreach ($va_list as $vs_option => $vs_value) { if ($vs_value == $vs_prop) { $vs_prop = $vs_option; break; } } } } } } if (isset($pa_options["CONVERT_HTML_BREAKS"]) && $pa_options["CONVERT_HTML_BREAKS"] || isset($pa_options["convertLineBreaks"]) && $pa_options["convertLineBreaks"]) { $vs_prop = caConvertLineBreaks($vs_prop); } break; case FT_DATETIME: case FT_TIMESTAMP: case FT_HISTORIC_DATETIME: case FT_HISTORIC_DATE: case FT_DATE: $vn_timestamp = isset($this->_FIELD_VALUES[$ps_field]) ? $this->_FIELD_VALUES[$ps_field] : 0; if ($vb_return_with_structure) { $vs_prop = array('start' => $this->_FIELD_VALUES[$ps_field], 'end' => $this->_FIELD_VALUES[$ps_field]); } elseif (caGetOption('GET_DIRECT_DATE', $pa_options, false) || caGetOption('getDirectDate', $pa_options, false) || caGetOption('rawDate', $pa_options, false)) { $vs_prop = $this->_FIELD_VALUES[$ps_field]; } elseif (isset($pa_options['sortable']) && $pa_options['sortable']) { $vs_prop = $vn_timestamp . "/" . $vn_timestamp; } else { $o_tep = new TimeExpressionParser(); if ($ps_field_type == FT_HISTORIC_DATETIME || $ps_field_type == FT_HISTORIC_DATE) { $o_tep->setHistoricTimestamps($vn_timestamp, $vn_timestamp); } else { $o_tep->setUnixTimestamps($vn_timestamp, $vn_timestamp); } if ($ps_field_type == FT_DATE || $ps_field_type == FT_HISTORIC_DATE) { $vs_prop = $o_tep->getText(array_merge(array('timeOmit' => true), $pa_options)); } else { $vs_prop = $o_tep->getText($pa_options); } } break; case FT_TIME: if ($vb_return_with_structure) { $vs_prop = array('start' => $this->_FIELD_VALUES[$ps_field], 'end' => $this->_FIELD_VALUES[$ps_field]); } elseif (caGetOption('GET_DIRECT_TIME', $pa_options, false) || caGetOption('getDirectTime', $pa_options, false) || caGetOption('rawTime', $pa_options, false)) { $vs_prop = $this->_FIELD_VALUES[$ps_field]; } else { $o_tep = new TimeExpressionParser(); $vn_timestamp = isset($this->_FIELD_VALUES[$ps_field]) ? $this->_FIELD_VALUES[$ps_field] : 0; $o_tep->setTimes($vn_timestamp, $vn_timestamp); $vs_prop = $o_tep->getText($pa_options); } break; case FT_DATERANGE: case FT_HISTORIC_DATERANGE: $vs_start_field_name = $this->getFieldInfo($ps_field, "START"); $vs_end_field_name = $this->getFieldInfo($ps_field, "END"); $vn_start_date = isset($this->_FIELD_VALUES[$vs_start_field_name]) ? $this->_FIELD_VALUES[$vs_start_field_name] : null; $vn_end_date = isset($this->_FIELD_VALUES[$vs_end_field_name]) ? $this->_FIELD_VALUES[$vs_end_field_name] : null; if ($vb_return_with_structure) { $vs_prop = array('start' => $vn_start_date, 'end' => $vn_end_date); } elseif (!caGetOption('GET_DIRECT_DATE', $pa_options, false) && !caGetOption('getDirectDate', $pa_options, false) && !caGetOption('rawDate', $pa_options, false)) { $o_tep = new TimeExpressionParser(); if ($ps_field_type == FT_HISTORIC_DATERANGE) { $o_tep->setHistoricTimestamps($vn_start_date, $vn_end_date); } else { $o_tep->setUnixTimestamps($vn_start_date, $vn_end_date); } $vs_prop = $o_tep->getText($pa_options); } elseif (isset($pa_options['sortable']) && $pa_options['sortable']) { $vs_prop = $vn_start_date; //."/".$vn_timestamp; } else { $vs_prop = $vn_start_date; //array($vn_start_date, $vn_end_date); } break; case FT_TIMERANGE: $vs_start_field_name = $this->getFieldInfo($ps_field, "START"); $vs_end_field_name = $this->getFieldInfo($ps_field, "END"); $vn_start_date = isset($this->_FIELD_VALUES[$vs_start_field_name]) ? $this->_FIELD_VALUES[$vs_start_field_name] : null; $vn_end_date = isset($this->_FIELD_VALUES[$vs_end_field_name]) ? $this->_FIELD_VALUES[$vs_end_field_name] : null; if ($vb_return_with_structure) { $vs_prop = array('start' => $vn_start_date, 'end' => $vn_end_date); } elseif (!caGetOption('GET_DIRECT_TIME', $pa_options, false) && !caGetOption('getDirectTime', $pa_options, false) && !caGetOption('rawTime', $pa_options, false)) { $o_tep = new TimeExpressionParser(); $o_tep->setTimes($vn_start_date, $vn_end_date); $vs_prop = $o_tep->getText($pa_options); } else { $vs_prop = array($vn_start_date, $vn_end_date); } break; case FT_TIMECODE: $o_tp = new TimecodeParser(); $o_tp->setParsedValueInSeconds($this->_FIELD_VALUES[$ps_field]); $vs_prop = $o_tp->getText(isset($pa_options["TIMECODE_FORMAT"]) ? $pa_options["TIMECODE_FORMAT"] : null); break; case FT_MEDIA: case FT_FILE: if ($vb_return_with_structure || $pa_options["USE_MEDIA_FIELD_VALUES"]) { if (isset($pa_options["USE_MEDIA_FIELD_VALUES"]) && $pa_options["USE_MEDIA_FIELD_VALUES"]) { $vs_prop = $this->_FIELD_VALUES[$ps_field]; } else { $vs_prop = isset($this->_SET_FILES[$ps_field]['tmp_name']) && $this->_SET_FILES[$ps_field]['tmp_name'] ? $this->_SET_FILES[$ps_field]['tmp_name'] : $this->_FIELD_VALUES[$ps_field]; } } else { $va_versions = $this->getMediaVersions($ps_field); $vs_tag = $this->getMediaTag($ps_field, array_shift($va_versions)); if ($vb_return_as_array) { return array($vs_tag); } else { return $vs_tag; } } break; case FT_VARS: $vs_prop = isset($this->_FIELD_VALUES[$ps_field]) && $this->_FIELD_VALUES[$ps_field] ? $this->_FIELD_VALUES[$ps_field] : null; break; } if (isset($pa_options["QUOTE"]) && $pa_options["QUOTE"]) { $vs_prop = $this->quote($ps_field, $vs_prop); } } else { $this->postError(710, _t("'%1' does not exist in this object", $ps_field), "BaseModel->get()"); return $vb_return_as_array ? array() : null; } if (isset($pa_options["URL_ENCODE"]) && $pa_options["URL_ENCODE"]) { $vs_prop = urlEncode($vs_prop); } if (isset($pa_options["ESCAPE_FOR_XML"]) && $pa_options["ESCAPE_FOR_XML"]) { $vs_prop = caEscapeForXML($vs_prop); } if (!(isset($pa_options["DONT_STRIP_SLASHES"]) && $pa_options["DONT_STRIP_SLASHES"])) { if (is_string($vs_prop)) { $vs_prop = stripSlashes($vs_prop); } } if (isset($pa_options["template"]) && $pa_options["template"]) { $vs_template_with_substitution = str_replace("^" . $ps_field, $vs_prop, $pa_options["template"]); $vs_prop = str_replace("^" . $this->tableName() . "." . $ps_field, $vs_prop, $vs_template_with_substitution); } if ($vb_return_as_array) { if ($vb_return_all_locales) { return array($vn_row_id => array($vn_locale_id => array($vs_prop))); } else { return array($vn_row_id => $vs_prop); } } else { return $vs_prop; } }
<th style="width:20px;"></th> </tr> </thead> <tbody> <?php $rs = $DB->execute('SELECT `cid_int`, `cid_ext` FROM `gate_cids` WHERE `grp_id`=' . $ggid); if (@$DB->numFoundRows() < 1) { //echo '<tr><td><i>- ', __('keine'), ' -</i></td><td></td><td></td></tr>'; } else { while ($cid_map = $rs->fetchRow()) { echo '<tr>'; echo '<td>', htmlEnt($cid_map['cid_int']), '</td>'; echo '<td>', htmlEnt($cid_map['cid_ext']), '</td>'; echo '<td>'; echo '<a href="', gs_url($SECTION, $MODULE, null, 'action=gdelcid&gg-id=' . $ggid . '&cid-int=' . urlEncode($cid_map['cid_int'])), '" title="', __('entfernen'), '"><img alt="', __('entfernen'), '" src="', GS_URL_PATH, 'crystal-svg/16/act/editdelete.png" /></a>'; echo '</td>'; echo '</tr>', "\n"; } } echo '<tr>'; echo '<td>'; echo '<input type="text" name="cid-int" value="" size="20" maxlength="30" />'; echo '</td>'; echo '<td>'; echo '<input type="text" name="cid-ext" value="" size="20" maxlength="30" />'; echo '</td>'; echo '<td>'; echo '<button type="submit" title="', __('Eintrag speichern'), '" class="plain"><img alt="', __('Speichern'), '" src="', GS_URL_PATH, 'crystal-svg/16/act/filesave.png" /></button>'; echo '</td>'; echo '</tr>';
function uencode($u) { return base64_encode(urlEncode($u)); }
function get_event_defaults() { return array("event_start_date" => urlEncode(date("d/m/Y")), "event_status" => "active", "comment_status" => "1", "rsvp_status" => "1", "gallery_status" => "1"); }
function test_getCancelUrlLandingPage() { $expectedCustomerId = "customerid"; $expectedEventId = "eventid"; $expectedTarget = 'http://target.url/?someprop=somevalue&another=value'; $expectedCancelUrl = "http://" . $expectedCustomerId . ".queue-it.net/cancel.aspx?c=" . $expectedCustomerId . "&e=" . $expectedEventId . "&r=" . urlEncode($expectedTarget); $queue = QueueFactory::createQueue($expectedCustomerId, $expectedEventId); $actualCancelUrl = $queue->GetCancelUrl($expectedTarget); $this->assertEqual($expectedCancelUrl, $actualCancelUrl); }
$whereOption[] = "{$this->field} like '%{$this->keyword}%'"; $this->queryOption .= "&field={$this->field}&keyword={$tempKeyword}"; } $sortQueryOption = $this->queryOption; $this->queryOption .= "&sortField={$this->sortField}&sortType={$this->sortType}"; $this->whereOptionStr = $this->setWhereOption($whereOption); //페이지 나누기를 실행한다. $this->listLimitStr = $this->list_limit; $this->setPage("member M", $this->whereOptionStr, $this->queryOption); $result = $this->setSelect("member M left outer join memberLogin ML using(userID)", "M.userID as userID, name, nickName, email, sex, author, signDate, substring(address, 1, 11) as address, count(ML.userID) as loginCount, MAX(loginDate) as lastLoginDate", "{$this->whereOptionStr} group by M.userID order by {$this->sortField} {$this->sortType}, signDate desc, userID limit {$this->first}, {$this->last}"); //$result = $this->setSelect("member", "userID, name, nickName, email, sex, author, signDate, substring(address, 1, 6) as address", "$this->whereOptionStr order by $this->sortField $this->sortType, signDate desc, userID limit $this->first, $this->last"); $total = $this->getTotalRows($result[0]); if ($this->QUERY_STRING == "") { $goURL = urlEncode($this->PHP_SELF); } else { $goURL = urlEncode($this->PHP_SELF . "?" . $this->QUERY_STRING); } ?> <SCRIPT language="Javascript"> <!-- function memberSearchFormCheck(form) { if(form.keyword.value == "") { alert("검색어가 없습니다."); form.keyword.focus(); return false; } }
public static function apiQueryString($passedParams = array()) { $queryParamOptions = array('start', 'limit', 'order', 'sort', 'content', 'q', 'fq', 'itemType', 'locale', 'key', 'itemKey', 'tag', 'tagType', 'style', 'format', 'linkMode', 'linkwrap'); //build simple api query parameters object $queryParams = array(); foreach ($queryParamOptions as $i => $val) { if (isset($passedParams[$val]) && $passedParams[$val] != '') { //check if itemKey belongs in the url or the querystring if ($val == 'itemKey' && isset($passedParams['target']) && $passedParams['target'] != 'items') { continue; } $queryParams[$val] = $passedParams[$val]; } } $queryString = '?'; $queryParamsArray = array(); foreach ($queryParams as $index => $value) { if (is_array($value)) { foreach ($value as $key => $val) { if (is_string($val) || is_int($val)) { $queryParamsArray[] = urlEncode($index) . '=' . urlencode($val); } } } elseif (is_string($value) || is_int($value)) { $queryParamsArray[] = urlencode($index) . '=' . urlencode($value); } } $queryString .= implode('&', $queryParamsArray); //print "apiQueryString: " . $queryString . "\n"; return $queryString; }
/** * generate an api query string for a request based on array of parameters * * @param array $passedParams list of parameters that define the request * @return string */ public function apiQueryString($passedParams = array()) { // Tags query formats // // ?tag=foo // ?tag=foo bar // phrase // ?tag=-foo // negation // ?tag=\-foo // literal hyphen (only for first character) // ?tag=foo&tag=bar // AND // ?tag=foo&tagType=0 // ?tag=foo bar || bar&tagType=0 $queryParamOptions = array('start', 'limit', 'order', 'sort', 'content', 'q', 'itemType', 'locale', 'key', 'itemKey', 'tag', 'tagType', 'style', 'format'); //build simple api query parameters object if (!isset($passedParams['key']) && $this->_apiKey) { $passedParams['key'] = $this->_apiKey; } $queryParams = array(); foreach ($queryParamOptions as $i => $val) { if (isset($passedParams[$val]) && $passedParams[$val] != '') { if ($val == 'itemKey' && isset($passedParams['target']) && $passedParams['target'] != 'items') { continue; } $queryParams[$val] = $passedParams[$val]; } } $queryString = '?'; $queryParamsArray = array(); foreach ($queryParams as $index => $value) { if (is_array($value)) { foreach ($value as $key => $val) { if (is_string($val) || is_int($val)) { $queryParamsArray[] = urlEncode($index) . '=' . urlencode($val); } } } elseif (is_string($value) || is_int($value)) { $queryParamsArray[] = urlencode($index) . '=' . urlencode($value); } } $queryString .= implode('&', $queryParamsArray); //print "apiQueryString: " . $queryString . "\n"; return $queryString; }