/**
  * {@inheritdoc}
  */
 public function getCoordinates($street = null, $postal = null, $city = null, $country = null, $fullAddress = null)
 {
     // Generate a new container.
     $objReturn = new Container();
     // Set the query string.
     $sQuery = $this->getQueryString($street, $postal, $city, $country, $fullAddress);
     $objReturn->setSearchParam($sQuery);
     $oRequest = null;
     $oRequest = new \Request();
     $oRequest->send(sprintf($this->strGoogleUrl, rawurlencode($sQuery)));
     $objReturn->setUri(sprintf($this->strGoogleUrl, rawurlencode($sQuery)));
     if ($oRequest->code == 200) {
         $aResponse = json_decode($oRequest->response, 1);
         if (!empty($aResponse['status']) && $aResponse['status'] == 'OK') {
             $objReturn->setLatitude($aResponse['results'][0]['geometry']['location']['lat']);
             $objReturn->setLongitude($aResponse['results'][0]['geometry']['location']['lng']);
         } elseif (!empty($aResponse['error_message'])) {
             $objReturn->setError(true);
             $objReturn->setErrorMsg($aResponse['error_message']);
         } else {
             $objReturn->setError(true);
             $objReturn->setErrorMsg($aResponse['Status']['error_message']);
         }
     } else {
         // Okay nothing work. So set all to Error.
         $objReturn->setError(true);
         $objReturn->setErrorMsg('Could not find coordinates for address "' . $sQuery . '"');
     }
     return $objReturn;
 }
Example #2
0
 public function index_f()
 {
     if (!$this->popedom["list"]) {
         error(P_Lang('您没有权限执行此操作'), '', 'error');
     }
     $this->phpok_autoload();
     $pageid = $this->get($this->config["pageid"], "int");
     if (!$pageid) {
         $pageid = 1;
     }
     $keywords = $this->get("keywords");
     $pageurl = $this->url("call");
     $condition = "";
     if ($keywords) {
         $this->assign("keywords", $keywords);
         $pageurl .= "&keywords=" . rawurlencode($keywords) . "&";
         $condition = " (title LIKE '%" . $keywords . "%' OR note LIKE '%" . $keywords . "%' OR identifier LIKE '%" . $keywords . "%') ";
     }
     $rslist = $this->model('call')->get_list($condition, $pageid);
     $this->assign("rslist", $rslist);
     $total = $this->model('call')->get_count($condition);
     $this->assign("total", $total);
     $string = 'home=' . P_Lang('首页') . '&prev=' . P_Lang('上一页') . '&next=' . P_Lang('下一页') . '&last=' . P_Lang('尾页') . '&half=5';
     $string .= '&add=' . P_Lang('数量:') . '(total)/(psize)' . P_Lang(',') . P_Lang('页码:') . '(num)/(total_page)&always=1';
     $pagelist = phpok_page($pageurl, $total, $pageid, $this->psize, $string);
     $this->assign("pagelist", $pagelist);
     $attrlist = $this->model('list')->attr_list();
     $this->assign("attrlist", $attrlist);
     $this->view("phpok_index");
 }
Example #3
0
/**
 * Theme a "you can't post comments" notice.
 *
 * @param $node
 *   The comment node.
 * @ingroup themeable
 */
function city_magazine_comment_post_forbidden($node)
{
    global $user;
    static $authenticated_post_comments;
    if (!$user->uid) {
        if (!isset($authenticated_post_comments)) {
            // We only output any link if we are certain, that users get permission
            // to post comments by logging in. We also locally cache this information.
            $authenticated_post_comments = array_key_exists(DRUPAL_AUTHENTICATED_RID, user_roles(TRUE, 'post comments') + user_roles(TRUE, 'post comments without approval'));
        }
        if ($authenticated_post_comments) {
            // We cannot use drupal_get_destination() because these links
            // sometimes appear on /node and taxonomy listing pages.
            if (variable_get('comment_form_location_' . $node->type, COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) {
                $destination = 'destination=' . rawurlencode("comment/reply/{$node->nid}#comment-form");
            } else {
                $destination = 'destination=' . rawurlencode("node/{$node->nid}#comment-form");
            }
            if (variable_get('user_register', 1)) {
                // Users can register themselves.
                // original
                //return t('<a href="@login"><span>Login</span></a> <span class="regulat-text">or</span> <a href="@register"><span>register</span></a> <span class="regulat-text">to post comments</span>', array('@login' => url('user/login', array('query' => $destination)), '@register' => url('user/register', array('query' => $destination))));
                // no register
                return t('<a href="@login"><span>Login</span></a> <span class="regulat-text">to post comments</span>', array('@login' => url('user/login', array('query' => $destination))));
            } else {
                // Only admins can add new users, no public registration.
                return t('<a href="@login"><span>Login</span></a> to post comments', array('@login' => url('user/login', array('query' => $destination))));
            }
        }
    }
}
 /**
  * Processing of clickmenu items
  *
  * @param	object		Reference to parent
  * @param	array		Menu items array to modify
  * @param	string		Table name
  * @param	integer		Uid of the record
  * @return	array		Menu item array, returned after modification
  * @todo	Skinning for icons...
  */
 function main(&$backRef, $menuItems, $table, $uid)
 {
     global $BE_USER, $TCA;
     $localItems = array();
     if ($backRef->cmLevel && t3lib_div::_GP('subname') == 'moreoptions' || $table === 'pages' && $uid == 0) {
         // Show import/export on second level menu OR root level.
         $LL = $this->includeLL();
         $modUrl = $backRef->backPath . t3lib_extMgm::extRelPath('impexp') . 'app/index.php';
         $url = $modUrl . '?tx_impexp[action]=export&id=' . ($table == 'pages' ? $uid : $backRef->rec['pid']);
         if ($table == 'pages') {
             $url .= '&tx_impexp[pagetree][id]=' . $uid;
             $url .= '&tx_impexp[pagetree][levels]=0';
             $url .= '&tx_impexp[pagetree][tables][]=_ALL';
         } else {
             $url .= '&tx_impexp[record][]=' . rawurlencode($table . ':' . $uid);
             $url .= '&tx_impexp[external_ref][tables][]=_ALL';
         }
         $localItems[] = $backRef->linkItem($GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLLL('export', $LL)), $backRef->excludeIcon(t3lib_iconWorks::getSpriteIcon('actions-document-export-t3d')), $backRef->urlRefForCM($url), 1);
         if ($table == 'pages') {
             $url = $modUrl . '?id=' . $uid . '&table=' . $table . '&tx_impexp[action]=import';
             $localItems[] = $backRef->linkItem($GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLLL('import', $LL)), $backRef->excludeIcon(t3lib_iconWorks::getSpriteIcon('actions-document-import-t3d')), $backRef->urlRefForCM($url), 1);
         }
     }
     return array_merge($menuItems, $localItems);
 }
 function translate($text, $d = '')
 {
     $s = 'en';
     if ($d == '') {
         $d = 'en';
     }
     if ($d != 'en') {
         $lang_pair = urlencode($s . '|' . $d);
         $q = rawurlencode($text);
         // Google's API translator URL
         $url = "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=" . $q . "&langpair=" . $lang_pair;
         // Make sure to set CURLOPT_REFERER because Google doesn't like if you leave the referrer out
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, $url);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($ch, CURLOPT_REFERER, "http://www.yoursite.com/translate.php");
         $body = curl_exec($ch);
         curl_close($ch);
         $json = json_decode($body, true);
         $tranlate = $json['responseData']['translatedText'];
         echo $tranlate;
     } else {
         echo $text;
     }
 }
Example #6
0
function Comet_encode_char($char)
{
    if (strpos(' ~`!@#$%^&*()+=[]\\{}|;\':",./<>?', $char) === false) {
        return $char;
    }
    return rawurlencode($char);
}
Example #7
0
function checkAuth($redirectIfNeeded)
{
    // is the user already logged in?
    if (isset($_SESSION["uid"]) && $_SESSION["uid"] != "") {
        // yes, already logged in
        return $_SESSION["uid"];
    } else {
        if ($redirectIfNeeded) {
            // user is not logged in and needs to do so
            // send to the login page
            // pass the current URL so that we can come back here after login
            $currentUrl = currentUrl();
            // rawurlencode converts the string so it's safe to pass as a URL GET parameter
            $urlOfLogin = "******" . rawurlencode($currentUrl) . "&cb=" . microtime(true);
            // use a JavaScript redirect; FYI, there's also an http header (Location:) that
            //    can be used to redirect, but that MUST be sent before any HTML, and this
            //    function (checkAuth) might be called after some HTML is sent
            echo "<script>location.replace('{$urlOfLogin}');</script>";
            return "";
        } else {
            // user is not logged in, but whoever called this function doesn't care
            return "";
        }
    }
}
Example #8
0
 public static function saveRedirectURL()
 {
     $url = $_SERVER["SCRIPT_NAME"];
     $query = "";
     foreach ($_GET as $key => $value) {
         if ($key == "a" && $value == "logout") {
             continue;
         }
         if ($query != "") {
             $query .= "&";
         }
         if (is_array($value)) {
             $query .= rawurlencode($key . "[]") . "=";
             $query .= implode(rawurlencode($key . "[]") . "=", $value);
         } else {
             $query .= rawurlencode($key);
             if (strlen($value)) {
                 $query .= "=" . rawurlencode($value);
             }
         }
     }
     if ($query != "") {
         $url .= "?" . $query;
     }
     $_SESSION["MyURL"] = $url;
 }
Example #9
0
 /**
  * @param string $content
  * @return string
  */
 public function render($content = NULL)
 {
     if (NULL === $content) {
         $content = $this->renderChildren();
     }
     return rawurlencode($content);
 }
Example #10
0
function plugin_redirect_iframe_convert()
{
    global $vars, $script;
    $qm = get_qm();
    $page = isset($vars['page']) ? $vars['page'] : '';
    $args = func_get_args();
    $url = strip_autolink(array_pop($args));
    if ($url == '') {
        $url = $script . '?' . rawurlencode($page);
    } else {
        $url = is_url($url) ? $url : $script . '?' . rawurlencode($url);
    }
    $editable = ss_admin_check();
    if ($editable) {
        return $qm->replace('plg_redirect_iframe.ntc_admin', $url);
    } else {
        return <<<EOD
<span id="redirect_iframe_msg"><p style="color:gray"><a href="{$url}" target="new">{$qm->m['plg_redirect_iframe']['link']}</a></p></span>
<script type="text/javascript">
<!--
if(parent != self){
parent.location.href="{$url}";
}
else{
var element = document.getElementById("redirect_iframe_msg");
element.innerHTML = "";
}

//-->
</script>
EOD;
    }
}
Example #11
0
function zeichne_beitrag($param)
{
    $Erster = $param['Erster'];
    $ForumId = $param['ForumId'];
    $BeitragId = $param['BeitragId'];
    $Autor = $param['Autor'];
    $AutorURL = rawurlencode($Autor);
    $StempelLetzter = $param['StempelLetzter'];
    $Thema = $param['Thema'];
    $Inhalt = $param['Inhalt'];
    $Egl = $param['Egl'];
    $Atavar = $param['Atavar'];
    setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
    $datum = strftime("%d.%b.%Y", $StempelLetzter);
    $zeit = date("H.i:s", $StempelLetzter);
    if ($Erster) {
        echo "      <tr>\n        <th class=\"ueber\" align=\"center\" width=\"100%\" colspan=\"2\">{$Thema}</th>\n      </tr>\n";
    }
    echo "      <tr>\n        <td colspan=\"2\">\n          <table class=\"beitrag\">\n            <tr>\n              <th class=\"ueber\" align=\"left\" colspan=\"2\"><a href=\"mitglieder-profil.php?alias={$AutorURL}\">{$Autor}</a></th>\n              <th class=\"ueber\" align=\"right\">{$datum} {$zeit}</th>\n            </tr>\n            <tr>\n";
    if ($Atavar > -1) {
        echo "              <td class=\"col-dunkel\" valign=\"top\">\n                <div class=\"atavar\">\n                  <img src=\"atavar-ausgeben.php?atavar={$Atavar}\">\n                </div>\n              </td>\n              <td class=\"col-hell\" valign=\"top\" colspan=\"2\" width=\"100%\">{$Inhalt}</td>\n";
    } else {
        echo "              <td class=\"col-hell\" valign=\"top\" colspan=\"3\" width=\"100%\">{$Inhalt}</td>\n";
    }
    echo "            </tr>\n          </table>\n        </td>\n      </tr>\n";
    // Die Antwort Zeile
    if ($Egl) {
        echo "      <tr>\n        <td><font size=\"-1\"><input type=\"radio\" name=\"eltern\" value=\"{$BeitragId}\"";
        if ($Erster) {
            echo ' checked';
        }
        echo ">Antworten auf diesen Beitrag</font></td>\n        <td align=\"right\"><font size=\"-1\"><button type=\"submit\" name=\"zid\" value=\"{$BeitragId}\">zitieren</button></font></td>\n      </tr>\n";
    }
}
Example #12
0
 /**
  * Checks whether a an BE user account named admin with default password exists.
  *
  * @return \TYPO3\CMS\Reports\Status An object representing whether a default admin account exists
  */
 protected function getAdminAccountStatus()
 {
     $value = $GLOBALS['LANG']->getLL('status_ok');
     $message = '';
     $severity = \TYPO3\CMS\Reports\Status::OK;
     $whereClause = 'username = '******'TYPO3_DB']->fullQuoteStr('admin', 'be_users') . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('be_users');
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid, username, password', 'be_users', $whereClause);
     if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
         $secure = TRUE;
         /** @var $saltingObject \TYPO3\CMS\Saltedpasswords\Salt\SaltInterface */
         $saltingObject = \TYPO3\CMS\Saltedpasswords\Salt\SaltFactory::getSaltingInstance($row['password']);
         if (is_object($saltingObject)) {
             if ($saltingObject->checkPassword('password', $row['password'])) {
                 $secure = FALSE;
             }
         }
         // Check against plain MD5
         if ($row['password'] === '5f4dcc3b5aa765d61d8327deb882cf99') {
             $secure = FALSE;
         }
         if (!$secure) {
             $value = $GLOBALS['LANG']->getLL('status_insecure');
             $severity = \TYPO3\CMS\Reports\Status::ERROR;
             $editUserAccountUrl = 'alt_doc.php?returnUrl=' . rawurlencode(BackendUtility::getModuleUrl('system_ReportsTxreportsm1')) . '&edit[be_users][' . $row['uid'] . ']=edit';
             $message = sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:warning.backend_admin'), '<a href="' . htmlspecialchars($editUserAccountUrl) . '">', '</a>');
         }
     }
     $GLOBALS['TYPO3_DB']->sql_free_result($res);
     return GeneralUtility::makeInstance('TYPO3\\CMS\\Reports\\Status', $GLOBALS['LANG']->getLL('status_adminUserAccount'), $value, $message, $severity);
 }
Example #13
0
 private static function postSMS($http, $data)
 {
     $post = '';
     $row = parse_url($http);
     $host = $row['host'];
     $port = !empty($row['port']) ? $row['port'] : 80;
     $file = $row['path'];
     while (list($k, $v) = each($data)) {
         $post .= rawurlencode($k) . "=" . rawurlencode($v) . "&";
     }
     $post = substr($post, 0, -1);
     $len = strlen($post);
     $fp = @fsockopen($host, $port, $errno, $errstr, 10);
     // var_dump($fp);exit;
     if (!$fp) {
         return "{$errstr} ({$errno})\n";
     } else {
         $receive = '';
         $out = "POST {$file} HTTP/1.0\r\n";
         $out .= "Host: {$host}\r\n";
         $out .= "Content-type: application/x-www-form-urlencoded\r\n";
         $out .= "Connection: Close\r\n";
         $out .= "Content-Length: {$len}\r\n\r\n";
         $out .= $post;
         fwrite($fp, $out);
         while (!feof($fp)) {
             $receive .= fgets($fp, 128);
         }
         fclose($fp);
         $receive = explode("\r\n\r\n", $receive);
         unset($receive[0]);
         // var_dump($receive);exit;
         return implode("", $receive);
     }
 }
Example #14
0
 private function call()
 {
     $curl = array(CURLOPT_POST => 0, CURLOPT_HEADER => 0, CURLOPT_URL => 'http://www.marketinsg.com/index.php?route=information/news/system&url=' . rawurlencode(HTTP_CATALOG), CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1', CURLOPT_FRESH_CONNECT => 1, CURLOPT_RETURNTRANSFER => 1, CURLOPT_FORBID_REUSE => 1, CURLOPT_TIMEOUT => 0, CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_SSL_VERIFYHOST => 0);
     $ch = curl_init();
     curl_setopt_array($ch, $curl);
     if (!($result = curl_exec($ch))) {
         curl_close($ch);
         exit;
     }
     curl_close($ch);
     $encoding = mb_detect_encoding($result);
     if ($encoding == 'UTF-8') {
         $result = preg_replace('/[^(\\x20-\\x7F)]*/', '', $result);
     }
     $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "marketinsg_news WHERE text ='" . $this->db->escape($result) . "'");
     if (!$query->num_rows) {
         $this->db->query("DELETE FROM " . DB_PREFIX . "marketinsg_news");
         $this->db->query("INSERT INTO " . DB_PREFIX . "marketinsg_news SET text ='" . $this->db->escape($result) . "', date_added = NOW()");
     }
     $disabled = '[{"title":"<strong>You have been disabled from MarketInSG.com news system<\\/strong>"}]';
     if (addslashes($result) == addslashes($disabled)) {
         $this->db->query("INSERT INTO " . DB_PREFIX . "marketinsg_news_log SET date_checked = NOW(), status = 0");
     } else {
         $this->db->query("INSERT INTO " . DB_PREFIX . "marketinsg_news_log SET date_checked = NOW(), status = 1");
     }
 }
Example #15
0
 public static function getContentHtml($title, $leadOnly)
 {
     $url = 'http://reading-web-research.wmflabs.org/api/slim/';
     if ($leadOnly) {
         $url .= 'lead/';
     }
     $url .= rawurlencode($title);
     set_error_handler(function () {
         throw new Exception('Error at endpoint.');
     }, E_WARNING);
     $resp = file_get_contents($url, false);
     restore_error_handler();
     $json = json_decode($resp);
     $sections = $json->{'sections'};
     if ($leadOnly) {
         $content = $sections[0]->{'content'};
         $continue = Html::element('a', array('id' => 'loot-fold', 'style' => 'clear:both; display: block;', 'href' => '?full=1#continue-from'), 'Continue reading...');
         $content .= $continue;
     } else {
         $content = '';
         foreach ($sections as $key => $section) {
             if ($key > 0) {
                 $content .= '<h2>' . $section->{'title'} . '</h2>';
             }
             $content .= $section->{'content'};
             if ($key === 0) {
                 $content .= '<div id="continue-from"></div>';
             }
         }
     }
     return $content;
 }
Example #16
0
 function index()
 {
     /* 当前位置 */
     $this->_curlocal(LANG::get('member_center'), 'index.php?app=member', LANG::get('msg'), 'index.php?app=msg', LANG::get('set'));
     /* 当前所处子菜单 */
     $this->_curmenu('set');
     /* 当前用户中心菜单 */
     $this->_curitem('msg');
     $user_id = $this->visitor->get('user_id');
     $row_msg = $this->mod_msg->get(array('conditions' => 'msg.user_id=' . $user_id, 'join' => 'belongs_to_user', 'fields' => 'this.*,phone_mob'));
     if (!IS_POST) {
         $this->_config_seo('title', Lang::get('member_center') . ' - ' . Lang::get('msg'));
         $checked_functions = $functions = array();
         $functions = $this->_get_msg_functions();
         $tmp = explode(',', $row_msg['functions']);
         if ($functions) {
             foreach ($functions as $func) {
                 $checked_functions[$func] = in_array($func, $tmp);
             }
         }
         $ret_url = SITE_URL . '/index.php?app=msg';
         $this->assign('ret_url', rawurlencode($ret_url));
         $this->assign('user', $row_msg);
         $this->assign('functions', $functions);
         $this->assign('checked_functions', $checked_functions);
         $this->import_resource(array('script' => 'jquery.plugins/jquery.validate.js'));
         $this->display('msg.index.html');
     } else {
         $functions = isset($_POST['functions']) ? implode(',', $_POST['functions']) : '';
         $data = array('state' => intval($_POST['state']), 'functions' => $functions);
         $this->mod_msg->edit('user_id=' . $user_id, $data);
         $this->show_message('set_ok', 'back_list', 'index.php?app=msg');
     }
 }
 public function listJobTitleStats()
 {
     $jobTitle = $_GET['jobTitle'];
     $json_url = 'http://api.glassdoor.com/api/api.htm?t.p=24413&t.k=eaqHaPANkyM&userip=&useragent=&format=json&v=1&action=jobs-prog&countryId=1&jobTitle=' . rawurlencode($jobTitle) . '';
     $str = file_get_contents($json_url);
     return $str;
 }
Example #18
0
function twig_urlencode_filter($url, $raw = false)
{
    if ($raw) {
        return rawurlencode($url);
    }
    return urlencode($url);
}
Example #19
0
 /**
  * Generates, encodes, re-orders variables for the query string.
  *
  * @param array $params The specific parameters for this payment
  * @param array $pairs Pairs
  * @param string $namespace The namespace
  *
  * @return string An encoded string of parameters
  */
 public static function generate_query_string($params, &$pairs = array(), $namespace = null)
 {
     if (is_array($params)) {
         foreach ($params as $k => $v) {
             if (is_int($k)) {
                 GoCardless_Utils::generate_query_string($v, $pairs, $namespace . '[]');
             } else {
                 GoCardless_Utils::generate_query_string($v, $pairs, $namespace !== null ? $namespace . "[{$k}]" : $k);
             }
         }
         if ($namespace !== null) {
             return $pairs;
         }
         if (empty($pairs)) {
             return '';
         }
         usort($pairs, array(__CLASS__, 'sortPairs'));
         $strs = array();
         foreach ($pairs as $pair) {
             $strs[] = $pair[0] . '=' . $pair[1];
         }
         return implode('&', $strs);
     } else {
         $pairs[] = array(rawurlencode($namespace), rawurlencode($params));
     }
 }
Example #20
0
 function PostRequest($url, $referer, $_data, $addheader = null)
 {
     $data = null;
     while (list($n, $v) = each($_data)) {
         $data .= '&' . $n . '=' . rawurlencode($v);
     }
     $data = substr($data, 1);
     $url = parse_url($url);
     if ($url['scheme'] != 'http') {
         die("Only HTTP-Request are supported");
     }
     $host = $url['host'];
     $path = $url['path'];
     $fp = fsockopen($host, 80);
     fputs($fp, "POST {$path} HTTP/1.1\r\n");
     fputs($fp, "Host: {$host}\r\n");
     fputs($fp, "Referer: {$referer}\r\n");
     fputs($fp, "User-Agent: BotTool (http://testhh.pytalhost.com)\r\n");
     fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
     fputs($fp, "Content-length: " . strlen($data) . "\r\n");
     if ($addheader != '') {
         fputs($fp, $addheader);
     }
     fputs($fp, "Connection: close\r\n\r\n");
     fputs($fp, $data);
     $result = null;
     while (!feof($fp)) {
         $result .= fgets($fp, 128);
     }
     fclose($fp);
     $result = explode("\r\n\r\n", $result, 2);
     $header = isset($result[0]) ? $result[0] : '';
     $content = isset($result[1]) ? $result[1] : '';
     return array($header, $content);
 }
    /**
     * Front-end display of widget.
     *
     * @see WP_Widget::widget()
     *
     * @param array $args     Widget arguments.
     * @param array $instance Saved values from database.
     */
    public function printWidget($args, $instance)
    {
        // $instance = $this->addSettingDefaults($instance);
        // Compile html into a url encoded string
        $custom = $instance['accounts'] === 'custom' && !empty($instance['custom']);
        $services = $instance['accounts'] !== 'custom' && !empty($instance['services']);
        $lazy_html = rawurlencode('<div social-' . $instance['widget_type'] . ' social-post-count="' . $instance['post_count'] . '"' . ($instance['hide_controls'] ? '" social-hide-controls="true"' : '') . ($custom ? ' social-accounts-custom="[\'' . implode('\',\'', array_keys($instance['custom'])) . '\']"' : '') . ($services ? ' social-active-services="[\'' . implode('\',\'', array_keys($instance['services'])) . '\']"' : '') . ($instance['widget_type'] == 'static' ? '" social-static-cols="1"' : '') . '></div>');
        ?>
    <div id="<?php 
        print $this->id;
        ?>
">
      <div ng-init="$root.appId = '<?php 
        print $this->id;
        ?>
'" in-view="socialCompile = socialCompile || '<?php 
        print $lazy_html;
        ?>
'"
           lazy-compile="socialCompile" lazy-decode="true" lazy-timeout="'<?php 
        print $lazy_html;
        ?>
'" lazy-timeout-dur="1000"></div>
    </div>
    <?php 
    }
Example #22
0
function b_sitemap_xpwiki($mydirname)
{
    global $sitemap_configs;
    (method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || ($myts =& MyTextSanitizer::getInstance());
    $ret = array();
    include_once dirname(dirname(__FILE__)) . '/include.php';
    $xpwiki =& XpWiki::getInitedSingleton($mydirname);
    $result = $xpwiki->func->get_existpages(FALSE, '', array('limit' => 5, 'order' => ' ORDER BY editedtime DESC', 'select' => array('title'), 'nolisting' => TRUE));
    $ret = array();
    // Recent Changes
    $show_cat = @$sitemap_configs['show_subcategoris'] ? 'child' : 'parent';
    if ($show_cat === 'child') {
        $ret['id'] = 0;
        $ret['title'] = $xpwiki->root->_LANG['skin']['recent'];
        $ret['url'] = '?' . rawurlencode($xpwiki->root->whatsnew);
    }
    foreach ($result as $_res) {
        $pgid = $_res['pgid'];
        $page = $_res['name'];
        $title = $_res['title'];
        $title = $xpwiki->root->pagename_num2str ? preg_replace('/\\/(?:[0-9\\-]+|[B0-9][A-Z0-9]{9})$/', '/' . $xpwiki->func->get_heading($page), $page) : $page;
        $ret[$show_cat][] = array("id" => intval($pgid), "title" => $myts->makeTboxData4Show($title), "url" => $xpwiki->func->get_page_uri($page), 'image' => 2);
    }
    if ($show_cat === 'child') {
        $ret = array('parent' => array($ret));
    }
    // Other menus
    $ret['parent'][] = array('id' => 0, 'title' => $xpwiki->root->_LANG['skin']['list'], 'url' => '?cmd=list');
    $ret['parent'][] = array('id' => 0, 'title' => $xpwiki->root->_attach_messages['msg_list'], 'url' => '?plugin=attach&amp;pcmd=list');
    $ret['parent'][] = array('id' => 0, 'title' => $xpwiki->root->_LANG['skin']['help'], 'url' => '?Help');
    return $ret;
}
Example #23
0
    public function getInput()
    {
        return '<div class="width100 azura-element-block" data-typeName="AzuraTabToggle">
	<div class="width100 azura-element ' . $this->element['class'] . ' azura-element-type-azuracolumn" data-typeName="AzuraTabToggle">

			<span class="azura-element-title"><i class="fa fa-cube"></i>  ' . $this->element['name'] . '</span>

		<div class="azura-element-tools">
			<i class="fa fa-arrow-up azura-element-tools-levelup"></i>
			<i class="fa fa-eye azura-element-tools-showhide"></i>
			<i class="fa fa-edit azura-element-tools-configs"></i>
			<i class="fa fa-copy azura-element-tools-copy"></i>
			<i class="fa fa-times azura-element-tools-remove"></i>
		</div>

	</div>

	<div class="azura-element-type-azuratabtoggle-container">
		<div class="azura-sortable  elementchildren clearfix" >
			<div class="hide-in-elements" style="text-align: center; vertical-align: bottom; background-color:#f5f5f5;"><i class="fa fa-plus tabToggleAddItem"  title="Add slide"   style="color: rgb(204, 204, 204); margin: 0px auto; font-size: 20px; cursor: pointer;"></i></div>
		</div>
	</div>
	<!-- /.azura-element-type-azurarow-container -->

	<div class="azura-element-settings-saved saved" data="' . rawurlencode('{"type":"AzuraTabToggle","id": "0","published":"1","language":"*", "content":"","attrs":{}}') . '"></div>
</div>';
    }
 /**
  * @return string
  */
 public function getFilterString()
 {
     if (!empty($this->source)) {
         $this->filterString = sprintf("&source=%s", rawurlencode($this->getSource()));
     }
     return $this->filterString;
 }
 /**
  * @test
  * @author Robert Lemke <*****@*****.**>
  * @author Ingo Renner <*****@*****.**>
  */
 public function theConstructorAcceptsValidIdentifiers()
 {
     $mockBackend = $this->getMock('t3lib_cache_backend_AbstractBackend', array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'findIdentifiersByTags', 'flush', 'flushByTag', 'flushByTags', 'collectGarbage'), array(), '', FALSE);
     foreach (array('x', 'someValue', '123fivesixseveneight', 'some&', 'ab_cd%', rawurlencode('resource://some/äöü$&% sadf'), str_repeat('x', 250)) as $identifier) {
         $abstractCache = $this->getMock('t3lib_cache_frontend_StringFrontend', array('__construct', 'get', 'set', 'has', 'remove', 'getByTag', 'flush', 'flushByTag', 'collectGarbage'), array($identifier, $mockBackend));
     }
 }
Example #26
0
 /**
  * Invokes system_retrieve_file() in several scenarios.
  */
 function testFileRetrieving()
 {
     // Test 404 handling by trying to fetch a randomly named file.
     drupal_mkdir($sourcedir = 'public://' . $this->randomMachineName());
     $filename = 'Файл для тестирования ' . $this->randomMachineName();
     $url = file_create_url($sourcedir . '/' . $filename);
     $retrieved_file = system_retrieve_file($url);
     $this->assertFalse($retrieved_file, 'Non-existent file not fetched.');
     // Actually create that file, download it via HTTP and test the returned path.
     file_put_contents($sourcedir . '/' . $filename, 'testing');
     $retrieved_file = system_retrieve_file($url);
     // URLs could not contains characters outside the ASCII set so $filename
     // has to be encoded.
     $encoded_filename = rawurlencode($filename);
     $this->assertEqual($retrieved_file, 'public://' . $encoded_filename, 'Sane path for downloaded file returned (public:// scheme).');
     $this->assertTrue(is_file($retrieved_file), 'Downloaded file does exist (public:// scheme).');
     $this->assertEqual(filesize($retrieved_file), 7, 'File size of downloaded file is correct (public:// scheme).');
     file_unmanaged_delete($retrieved_file);
     // Test downloading file to a different location.
     drupal_mkdir($targetdir = 'temporary://' . $this->randomMachineName());
     $retrieved_file = system_retrieve_file($url, $targetdir);
     $this->assertEqual($retrieved_file, "{$targetdir}/{$encoded_filename}", 'Sane path for downloaded file returned (temporary:// scheme).');
     $this->assertTrue(is_file($retrieved_file), 'Downloaded file does exist (temporary:// scheme).');
     $this->assertEqual(filesize($retrieved_file), 7, 'File size of downloaded file is correct (temporary:// scheme).');
     file_unmanaged_delete($retrieved_file);
     file_unmanaged_delete_recursive($sourcedir);
     file_unmanaged_delete_recursive($targetdir);
 }
Example #27
0
function addProxyToLink($link)
{
    if (Helper\isSecureConnection() && strpos($link, 'http:') === 0) {
        $link = '?action=proxy&url=' . rawurlencode($link);
    }
    return $link;
}
Example #28
0
 /**
  * camelCaseAction name -> under_score
  *
  * @param string $text
  * @return string
  */
 private static function convertCamelCaseToUnderscore($text)
 {
     $text = preg_replace('#(.)(?=[A-Z])#', '$1_', $text);
     $text = strtolower($text);
     $text = rawurlencode($text);
     return $text;
 }
Example #29
0
 function fanyi()
 {
     $rs = $this->plugin_info();
     $q = $this->get("q");
     if (!$q) {
         $this->json("youdao_not_info");
     }
     $url = "http://fanyi.youdao.com/openapi.do?keyfrom=" . $rs['param']["keyfrom"];
     $url .= "&key=" . $rs['param']["keyid"] . "&type=data&doctype=json&version=1.1&q=" . rawurlencode($q);
     $content = $this->lib("html")->get_content($url);
     if (!$content) {
         $this->json("youdao_get_error");
     }
     $rs = $this->lib("json")->decode($content);
     if ($rs["errorCode"]) {
         $errlist = array("20" => $this->lang['youdao'][20], "30" => $this->lang['youdao'][30], "40" => $this->lang['youdao'][40], "50" => $this->lang['youdao'][50]);
         $err = $errlist[$rs["errorCode"]];
         if (!$err) {
             $err = $this->lang['youdao'][60];
         }
         $this->json($err);
     }
     $content = strtolower($rs["translation"][0]);
     $content = $this->return_safe($content);
     $this->json($content, true);
 }
 private function getDonationCodeStatus($host, $donation_code)
 {
     $donation_code_check = 0;
     if (!empty($host) and !empty($donation_code)) {
         $url_fopen = ini_get('allow_url_fopen');
         if (function_exists('curl_init') or !empty($url_fopen)) {
             $url_check = 'http://joomla-extensions.kubik-rubik.de/scripts/je_kr_donation_code_check/je_kr_check_code.php?key=' . rawurlencode($donation_code) . '&host=' . rawurlencode($host);
             if (function_exists('curl_init')) {
                 $ch = curl_init($url_check);
                 curl_setopt($ch, CURLOPT_HEADER, 0);
                 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                 curl_setopt($ch, CURLOPT_NOSIGNAL, 1);
                 curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
                 $donation_code_check = curl_exec($ch);
                 $curl_errno = curl_errno($ch);
                 curl_close($ch);
                 if ($curl_errno != 0) {
                     $donation_code_check = -1;
                 }
             } else {
                 $donation_code_check = @file_get_contents($url_check, 'r');
             }
         } else {
             $donation_code_check = -2;
         }
     }
     if (preg_match('@(error|access denied)@i', $donation_code_check)) {
         $donation_code_check = -1;
     }
     return $donation_code_check;
 }