Esempio n. 1
0
 /**
  * Helper-method to determine whether an user is a backend user
  *
  * @param mixed $user User object or identifier
  * @param string $type Either object, email or username
  * @return boolean
  */
 public static function isBackendUser($user = null, $type = 'object')
 {
     // Check for empty user
     if (empty($user)) {
         return false;
     }
     // Get the right instance
     if ($user instanceof JUser == false) {
         if ($type == 'email') {
             $user = MageBridge::getUser()->loadByEmail($user);
         }
         if ($type == 'username') {
             $user = MageBridge::getUser()->loadByUsername($user);
         }
     }
     // Check the legacy usertype parameter
     if (!empty($user->usertype) && (stristr($user->usertype, 'administrator') || stristr($user->usertype, 'manager'))) {
         return false;
     }
     // Check for ACL access
     if (method_exists($user, 'authorise') && $user->authorise('core.admin')) {
         return true;
     }
     return false;
 }
 protected function _isFetchQuery($sql)
 {
     if (stristr($sql, "DELETE FROM ") || stristr($sql, "UPDATE ") || stristr($sql, "INSERT ")) {
         return false;
     }
     return true;
 }
Esempio n. 3
0
 /**
  * 判断客户端是否是手机端
  * @return bool
  */
 public static function isMobile()
 {
     // 如果有HTTP_X_WAP_PROFILE则一定是移动设备
     if (isset($_SERVER['HTTP_X_WAP_PROFILE'])) {
         return true;
     }
     // 如果via信息含有wap则一定是移动设备,部分服务商会屏蔽该信息
     if (isset($_SERVER['HTTP_VIA'])) {
         // 找不到为flase,否则为true
         return stristr($_SERVER['HTTP_VIA'], "wap") ? true : false;
     }
     // 脑残法,判断手机发送的客户端标志,兼容性有待提高
     if (isset($_SERVER['HTTP_USER_AGENT'])) {
         $clientkeywords = array('nokia', 'sony', 'ericsson', 'mot', 'samsung', 'htc', 'sgh', 'lg', 'sharp', 'sie-', 'philips', 'panasonic', 'alcatel', 'lenovo', 'iphone', 'ipod', 'blackberry', 'meizu', 'android', 'netfront', 'symbian', 'ucweb', 'windowsce', 'palm', 'operamini', 'operamobi', 'openwave', 'nexusone', 'cldc', 'midp', 'wap', 'mobile');
         // 从HTTP_USER_AGENT中查找手机浏览器的关键字
         if (preg_match("/(" . implode('|', $clientkeywords) . ")/i", strtolower($_SERVER['HTTP_USER_AGENT']))) {
             return true;
         }
     }
     // 协议法,因为有可能不准确,放到最后判断
     if (isset($_SERVER['HTTP_ACCEPT'])) {
         // 如果只支持wml并且不支持html那一定是移动设备
         // 如果支持wml和html但是wml在html之前则是移动设备
         if (strpos($_SERVER['HTTP_ACCEPT'], 'vnd.wap.wml') !== false && (strpos($_SERVER['HTTP_ACCEPT'], 'text/html') === false || strpos($_SERVER['HTTP_ACCEPT'], 'vnd.wap.wml') < strpos($_SERVER['HTTP_ACCEPT'], 'text/html'))) {
             return true;
         }
     }
     return false;
 }
Esempio n. 4
0
 private function loadVariable($line)
 {
     if (stristr($line, '=')) {
         $config = explode('=', $line);
         $this->variables[trim($config[0])] = trim($config[1]);
     }
 }
Esempio n. 5
0
function search_doc_files($s)
{
    $a = get_app();
    $itemspage = get_pconfig(local_channel(), 'system', 'itemspage');
    App::set_pager_itemspage(intval($itemspage) ? $itemspage : 20);
    $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']), intval(App::$pager['start']));
    $regexop = db_getfunc('REGEXP');
    $r = q("select item_id.sid, item.* from item left join item_id on item.id = item_id.iid where service = 'docfile' and\n\t\tbody {$regexop} '%s' and item_type = %d {$pager_sql}", dbesc($s), intval(ITEM_TYPE_DOC));
    $r = fetch_post_tags($r, true);
    for ($x = 0; $x < count($r); $x++) {
        $r[$x]['text'] = $r[$x]['body'];
        $r[$x]['rank'] = 0;
        if ($r[$x]['term']) {
            foreach ($r[$x]['term'] as $t) {
                if (stristr($t['term'], $s)) {
                    $r[$x]['rank']++;
                }
            }
        }
        if (stristr($r[$x]['sid'], $s)) {
            $r[$x]['rank']++;
        }
        $r[$x]['rank'] += substr_count(strtolower($r[$x]['text']), strtolower($s));
        // bias the results to the observer's native language
        if ($r[$x]['lang'] === App::$language) {
            $r[$x]['rank'] = $r[$x]['rank'] + 10;
        }
    }
    usort($r, 'doc_rank_sort');
    return $r;
}
Esempio n. 6
0
function is_strinclude($str, $needle, $type = 0)
{
    if (!$needle) {
        return false;
    }
    $flag = true;
    if (function_exists('stripos')) {
        if ($type == 0) {
            if (stripos($str, $needle) === false) {
                $flag = false;
            }
        } else {
            if ($type == 1) {
                if (strpos($str, $needle) === false) {
                    $flag = false;
                }
            }
        }
    } else {
        if ($type == 0) {
            if (stristr($str, $needle) === false) {
                $flag = false;
            }
        } else {
            if ($type == 1) {
                if (strstr($str, $needle) === false) {
                    $flag = false;
                }
            }
        }
    }
    return $flag;
}
Esempio n. 7
0
function parseAndValidateArguments($args)
{
    global $validArgKeys;
    $params = array();
    foreach ($args as $arg) {
        if (stristr($arg, '=')) {
            $argKeyValue = explode('=', $arg);
            if (count($argKeyValue) === 2) {
                // check if it's a valid key-value argument
                if (in_array($argKeyValue[0], $validArgKeys)) {
                    // check the key for validity
                    $params[$argKeyValue[0]] = $argKeyValue[1];
                }
            }
        }
    }
    if (count($params) === count($validArgKeys)) {
        // @TODO: check the values per key for validity all needs to be numeric but comment a string...
        return $params;
    } else {
        // not enough valid arguments given:
        // we simple stop the ongoing process and return none zero.
        echo "ERROR 1";
        return array();
    }
}
Esempio n. 8
0
 /**
  * Modify the url and add headers appropriate to authenticate to Acquia Search.
  *
  * @return
  *  The nonce used in the request.
  */
 protected function prepareRequest(&$url, &$options, $use_data = TRUE)
 {
     // Add a unique request ID to the URL.
     $id = uniqid();
     if (!stristr($url, '?')) {
         $url .= "?";
     } else {
         $url .= "&";
     }
     $url .= 'request_id=' . $id;
     // If we're hosted on Acquia, and have an Acquia request ID,
     // append it to the request so that we map Solr queries to Acquia search requests.
     if (isset($_ENV['HTTP_X_REQUEST_ID'])) {
         $xid = empty($_ENV['HTTP_X_REQUEST_ID']) ? '-' : $_ENV['HTTP_X_REQUEST_ID'];
         $url .= '&x-request-id=' . rawurlencode($xid);
     }
     if ($use_data && isset($options['data'])) {
         list($cookie, $nonce) = acquia_search_auth_cookie($url, $options['data'], NULL, $this->env_id);
     } else {
         list($cookie, $nonce) = acquia_search_auth_cookie($url, NULL, NULL, $this->env_id);
     }
     if (empty($cookie)) {
         throw new Exception('Invalid authentication string - subscription keys expired or missing.');
     }
     $options['headers']['Cookie'] = $cookie;
     $options['headers'] += array('User-Agent' => 'acquia_search/' . variable_get('acquia_search_version', '7.x'));
     $options['context'] = acquia_agent_stream_context_create($url, 'acquia_search');
     if (!$options['context']) {
         throw new Exception(t("Could not create stream context"));
     }
     return $nonce;
 }
Esempio n. 9
0
 public static function getValueFromOptions($field, $value, $config = array())
 {
     $opts = explode('||', $field->options);
     if ($value == '') {
         return $value;
     }
     if (count($opts)) {
         $exist = false;
         foreach ($opts as $opt) {
             $o = explode('=', $opt);
             if ($config['doTranslation'] && trim($o[0])) {
                 $o[0] = JText::_('COM_CCK_' . str_replace(' ', '_', trim($o[0])));
             }
             // if ( strcasecmp( $o[0], $value ) == 0 ) {
             if (stristr($o[0], $value) !== false) {
                 return isset($o[1]) ? $o[1] : $o[0];
                 break;
             }
         }
         if ($exist === true) {
             $value[] = $val;
         }
     }
     return $value;
 }
Esempio n. 10
0
function isMobile()
{
    // 如果有HTTP_X_WAP_PROFILE则一定是移动设备
    if (isset($_SERVER['HTTP_X_WAP_PROFILE'])) {
        return true;
    }
    // 如果via信息含有wap则一定是移动设备,部分服务商会屏蔽该信息
    if (isset($_SERVER['HTTP_VIA'])) {
        return stristr($_SERVER['HTTP_VIA'], "wap") ? true : false;
    }
    // 脑残法,判断手机发送的客户端标志,兼容性有待提高
    if (isset($_SERVER['HTTP_USER_AGENT'])) {
        $clientkeywords = array('iphone', 'android', 'mobile');
        // 从HTTP_USER_AGENT中查找手机浏览器的关键字
        if (preg_match("/(" . implode('|', $clientkeywords) . ")/i", strtolower($_SERVER['HTTP_USER_AGENT']))) {
            return true;
        }
    }
    // 协议法,因为有可能不准确,放到最后判断
    if (isset($_SERVER['HTTP_ACCEPT'])) {
        // 如果只支持wml并且不支持html那一定是移动设备
        // 如果支持wml和html但是wml在html之前则是移动设备
        if (strpos($_SERVER['HTTP_ACCEPT'], 'vnd.wap.wml') !== false && (strpos($_SERVER['HTTP_ACCEPT'], 'text/html') === false || strpos($_SERVER['HTTP_ACCEPT'], 'vnd.wap.wml') < strpos($_SERVER['HTTP_ACCEPT'], 'text/html'))) {
            return true;
        }
    }
    return false;
}
 function setTabs($a_show_settings = true)
 {
     global $lng, $ilHelp;
     $ilHelp->setScreenIdComponent("wfld");
     $this->ctrl->setParameter($this, "wsp_id", $this->node_id);
     $this->tabs_gui->addTab("wsp", $lng->txt("wsp_tab_personal"), $this->ctrl->getLinkTarget($this, ""));
     $this->ctrl->setParameterByClass("ilObjWorkspaceRootFolderGUI", "wsp_id", $this->getAccessHandler()->getTree()->getRootId());
     $this->tabs_gui->addTab("share", $lng->txt("wsp_tab_shared"), $this->ctrl->getLinkTargetByClass("ilObjWorkspaceRootFolderGUI", "shareFilter"));
     $this->tabs_gui->addTab("ownership", $lng->txt("wsp_tab_ownership"), $this->ctrl->getLinkTargetByClass(array("ilObjWorkspaceRootFolderGUI", "ilObjectOwnershipManagementGUI"), "listObjects"));
     if (!$this->ctrl->getNextClass($this)) {
         if (stristr($this->ctrl->getCmd(), "share")) {
             $this->tabs_gui->activateTab("share");
         } else {
             $this->tabs_gui->activateTab("wsp");
             if ($a_show_settings) {
                 if ($this->checkPermissionBool("read")) {
                     $this->tabs_gui->addSubTab("content", $lng->txt("content"), $this->ctrl->getLinkTarget($this, ""));
                 }
                 if ($this->checkPermissionBool("write")) {
                     $this->tabs_gui->addSubTab("settings", $lng->txt("settings"), $this->ctrl->getLinkTarget($this, "edit"));
                 }
             }
         }
     }
 }
Esempio n. 12
0
 public static function getBrowser()
 {
     $browsers = "mozilla msie gecko firefox ";
     $browsers .= "konqueror safari netscape navigator ";
     $browsers .= "opera mosaic lynx amaya omniweb";
     $browsers = explode(" ", $browsers);
     $nua = strToLower($_SERVER['HTTP_USER_AGENT']);
     $res = array();
     $l = strlen($nua);
     for ($i = 0; $i < count($browsers); $i++) {
         $browser = $browsers[$i];
         $n = stristr($nua, $browser);
         if (strlen($n) > 0) {
             $res["version"] = "";
             $res["browser"] = $browser;
             $j = strpos($nua, $res["browser"]) + $n + strlen($res["browser"]) + 1;
             for (; $j <= $l; $j++) {
                 $s = substr($nua, $j, 1);
                 if (is_numeric($res["version"] . $s)) {
                     $res["version"] .= $s;
                 }
                 break;
             }
         }
     }
     return $res;
 }
Esempio n. 13
0
 public function Leech($url)
 {
     list($url, $pass) = $this->linkpassword($url);
     $data = $this->lib->curl($url, $this->lib->cookie, "");
     if ($pass) {
         $post = $this->parseForm($this->lib->cut_str($data, '<Form name="F1"', '</Form>'));
         $post["password"] = $pass;
         $data = $this->lib->curl($url, $this->lib->cookie, $post);
         if (stristr($data, 'Wrong password')) {
             $this->error("wrongpass", true, false);
         } elseif (preg_match('@http:\\/\\/(\\w+\\.)?1st-files\\.com\\/d\\/[^"\'><\\r\\n\\t]+@i', $data, $giay)) {
             return trim($giay[0]);
         }
     }
     if (stristr($data, '<br><b>Password:</b> <input type="password"')) {
         $this->error("reportpass", true, false);
     } elseif (stristr($data, '>File Not Found<')) {
         $this->error("dead", true, false, 2);
     } elseif (!$this->isredirect($data)) {
         $post = $this->parseForm($this->lib->cut_str($data, '<Form name="F1"', '</Form>'));
         $data = $this->lib->curl($url, $this->lib->cookie, $post);
         if (preg_match('@http:\\/\\/(\\w+\\.)?1st-files\\.com\\/d\\/[^"\'><\\r\\n\\t]+@i', $data, $giay)) {
             return trim($giay[0]);
         }
     } else {
         return trim($this->redirect);
     }
     return false;
 }
Esempio n. 14
0
 public function routeProvider()
 {
     // Have to setup error handler here as well, as PHPUnit calls on 
     // provider methods outside the scope of setUp().
     set_error_handler(function ($errno, $errstr) {
         return stristr($errstr, 'query route deprecated');
     }, E_USER_DEPRECATED);
     return array(
         'simple-match' => array(
             new Query(),
             'foo=bar&baz=bat',
             null,
             array('foo' => 'bar', 'baz' => 'bat')
         ),
         'empty-match' => array(
             new Query(),
             '',
             null,
             array()
         ),
         'url-encoded-parameters-are-decoded' => array(
             new Query(),
             'foo=foo%20bar',
             null,
             array('foo' => 'foo bar')
         ),
         'nested-params' => array(
             new Query(),
             'foo%5Bbar%5D=baz&foo%5Bbat%5D=foo%20bar',
             null,
             array('foo' => array('bar' => 'baz', 'bat' => 'foo bar'))
         ),
     );
 }
Esempio n. 15
0
 /**
  * Save a template with the current params. Writes file to `Create::$path`.
  * Override default save to add timestamp in file name.
  *
  * @param array $params
  * @return string A result string on success of writing the file. If any errors occur along
  *         the way such as missing information boolean false is returned.
  */
 protected function _save(array $params = array())
 {
     $defaults = array('namespace' => null, 'class' => null);
     $params += $defaults;
     if (empty($params['class']) || empty($this->_library['path'])) {
         return false;
     }
     $contents = $this->_template();
     $result = String::insert($contents, $params);
     $namespace = str_replace($this->_library['prefix'], '\\', $params['namespace']);
     $date = date('YmdHis');
     $path = str_replace('\\', '/', "{$namespace}\\{$date}_{$params['class']}");
     $path = $this->_library['path'] . stristr($path, '/');
     $file = str_replace('//', '/', "{$path}.php");
     $directory = dirname($file);
     $relative = str_replace($this->_library['path'] . '/', "", $file);
     if (!is_dir($directory) && !mkdir($directory, 0755, true)) {
         return false;
     }
     if (file_exists($file)) {
         $prompt = "{$relative} already exists. Overwrite?";
         $choices = array('y', 'n');
         if ($this->in($prompt, compact('choices')) !== 'y') {
             return "{$params['class']} skipped.";
         }
     }
     if (file_put_contents($file, "<?php\n\n{$result}\n\n?>")) {
         return "{$params['class']} created in {$relative}.";
     }
     return false;
 }
Esempio n. 16
0
 public function Leech($url)
 {
     list($url, $pass) = $this->linkpassword($url);
     $data = $this->lib->curl($url, $this->lib->cookie, "");
     if ($pass) {
         $post = $this->parseForm($this->lib->cut_str($data, '<form', '</form>'));
         $post["password"] = $pass;
         $data = $this->lib->curl($url, $this->lib->cookie, $post);
         if (stristr($data, 'Wrong password')) {
             $this->error("wrongpass", true, false, 2);
         } elseif (preg_match('@https?:\\/\\/www\\d+\\.uptobox.com\\/d\\/[^\'\\"\\s\\t<>\\r\\n]+@i', $data, $link)) {
             return trim(str_replace('https', 'http', $link[0]));
         }
     }
     if (stristr($data, 'type="password" name="password')) {
         $this->error("reportpass", true, false);
     } elseif (stristr($data, 'The file was deleted by its owner') || stristr($data, 'Page not found / La page')) {
         $this->error("dead", true, false, 2);
     } elseif (!$this->isredirect($data)) {
         $post = $this->parseForm($this->lib->cut_str($data, '<form name="F1"', '</form>'));
         $data = $this->lib->curl($url, $this->lib->cookie, $post);
         if (preg_match('@https?:\\/\\/www\\d+\\.uptobox.com\\/d\\/[^\'\\"\\s\\t<>\\r\\n]+@i', $data, $link)) {
             return trim(str_replace('https', 'http', $link[0]));
         }
     } else {
         return trim(str_replace('https', 'http', trim($this->redirect)));
     }
     return false;
 }
Esempio n. 17
0
 function openstats()
 {
     $fp = fsockopen($this->host, $this->port, $errno, $errstr, 10);
     if (!$fp) {
         $this->_error = "{$errstr} ({$errno})";
         return 0;
     } else {
         fputs($fp, "GET /admin.cgi?pass="******"&mode=viewxml HTTP/1.0\r\n");
         fputs($fp, "User-Agent: Mozilla\r\n\r\n");
         while (!feof($fp)) {
             $this->_xml .= fgets($fp, 512);
         }
         fclose($fp);
         if (stristr($this->_xml, "HTTP/1.0 200 OK") == true) {
             // <-H> Thanks to Blaster for this fix.. trim();
             $this->_xml = trim(substr($this->_xml, 42));
         } else {
             $this->_error = "Bad login";
             return 0;
         }
         $xmlparser = xml_parser_create();
         if (!xml_parse_into_struct($xmlparser, $this->_xml, $this->_values, $this->_indexes)) {
             $this->_error = "Unparsable XML";
             return 0;
         }
         xml_parser_free($xmlparser);
         return 1;
     }
 }
Esempio n. 18
0
function get_device_useragent($device)
{
    global $astman;
    $response = $astman->send_request('Command', array('Command' => "sip show peer {$device}"));
    $astout = explode("\n", $response['data']);
    $ua = "";
    foreach ($astout as $entry) {
        if (eregi("useragent", $entry)) {
            list(, $value) = split(":", $entry);
            $ua = trim($value);
        }
    }
    if ($ua) {
        if (stristr($ua, "Aastra")) {
            return "aastra";
        }
        if (stristr($ua, "Grandstream")) {
            return "grandstream";
        }
        if (stristr($ua, "snom")) {
            return "snom";
        }
        if (stristr($ua, "Cisco")) {
            return "cisco";
        }
        if (stristr($ua, "Polycom")) {
            return "polycom";
        }
    }
    return null;
}
Esempio n. 19
0
 /**
  * Validates the Input Parameters onBeforeVendorUpdate
  *
  * @param array $d
  * @return boolean
  */
 function validate_update(&$d)
 {
     global $vmLogger;
     require_once CLASSPATH . 'imageTools.class.php';
     if (!vmImageTools::validate_image($d, "vendor_thumb_image", "vendor")) {
         return false;
     }
     if (!vmImageTools::validate_image($d, "vendor_full_image", "vendor")) {
         return false;
     }
     // convert all "," in prices to decimal points.
     if (stristr($d["vendor_min_pov"], ",")) {
         $d["vendor_min_pov"] = str_replace(',', '.', $d["vendor_min_pov"]);
     }
     if (!$d["vendor_name"]) {
         $vmLogger->err('You must enter a name for the vendor.');
         return False;
     }
     if (!$d["contact_email"]) {
         $vmLogger->err('You must enter an email address for the vendor contact.');
         return False;
     }
     if (!vmValidateEmail($d["contact_email"])) {
         $vmLogger->err('Please provide a valide email address for the vendor contact.');
         return False;
     }
     return True;
 }
Esempio n. 20
0
 /**
  * Associates IP Address to the server
  *
  * @param   DBServer           $dbServer  DBServer object
  * @param   string             $ipAddress Public IP address to associate with server.
  * @throws  \Exception
  */
 private static function associateIpAddress(DBServer $dbServer, $ipAddress, $allocationId = null)
 {
     $aws = $dbServer->GetEnvironmentObject()->aws($dbServer);
     $assign_retries = 1;
     $retval = false;
     while (true) {
         try {
             // Associate elastic ip address with instance
             $request = new AssociateAddressRequestData($dbServer->GetProperty(\EC2_SERVER_PROPERTIES::INSTANCE_ID), $ipAddress);
             if ($allocationId) {
                 $request->allocationId = $allocationId;
                 $request->publicIp = null;
                 $request->allowReassociation = true;
             }
             $aws->ec2->address->associate($request);
             $retval = true;
             break;
         } catch (\Exception $e) {
             if (!stristr($e->getMessage(), "does not belong to you") || $assign_retries == 3) {
                 throw new \Exception($e->getMessage());
             } else {
                 // Waiting...
                 \Logger::getLogger(__CLASS__)->debug(_("Waiting 2 seconds..."));
                 sleep(2);
                 $assign_retries++;
                 continue;
             }
         }
         break;
     }
     return $retval;
 }
Esempio n. 21
0
 /**
  * Executes mock cURL transfer
  * @param string $id connection ID
  * @return bool|string
  */
 protected function _curl_exec($id)
 {
     if (!isset($this->_requests[$id])) {
         return false;
     }
     $request = $this->_requests[$id];
     $url = $this->_requests[$id]['url'];
     $reply = self::$_mock_replies['default'];
     $httpmethod = 'GET';
     if (isset($request[CURLOPT_POST]) && $request[CURLOPT_POST]) {
         $httpmethod = 'POST';
     }
     if (isset($request[CURLOPT_CUSTOMREQUEST])) {
         $httpmethod = $request[CURLOPT_CUSTOMREQUEST];
     }
     $index = $httpmethod . ' ' . $url;
     if (isset(self::$_mock_replies[$index])) {
         $reply = self::$_mock_replies[$index];
     }
     $this->_requests[$id][CURLINFO_HTTP_CODE] = $reply['httpstatus'];
     $this->_requests[$id]['reply'] = $reply['reply'];
     if (!$this->_requests[$id][CURLOPT_HEADER] && stristr($reply['reply'], "\r\n\r\n")) {
         $reply_parts = explode("\r\n\r\n", $reply['reply'], 2);
         $reply['reply'] = $reply_parts[1];
     }
     if ($this->_requests[$id][CURLOPT_RETURNTRANSFER]) {
         return $reply['reply'];
     }
     return true;
 }
Esempio n. 22
0
 public function Leech($url)
 {
     if (stristr($url, "clz.to")) {
         $ex = explode("/", $url);
         $url = 'http://cloudzer.net/file/' . $ex[3];
     }
     $url = $this->getredirect($url);
     if (stristr($url, 'cloudzer.net/404')) {
         $this->error("dead", true, false, 2);
     }
     $data = $this->lib->curl($url, $this->lib->cookie, "");
     if (stristr($data, "<h1>Extend traffic</h1>")) {
         $this->error("LimitAcc");
     } elseif (stristr($data, "Hybrid-Traffic is completely exhausted")) {
         $this->error("LimitAcc");
     } elseif (stristr($data, "Our service is currently unavailable in your country")) {
         $this->error("blockCountry", true, false);
     } elseif (stristr($data, "You used too many different IPs")) {
         $this->error("blockAcc", true, false);
     } elseif (stristr($data, "Download Blocked (ip)")) {
         $this->error("blockIP", true, false);
     } elseif (!$this->isredirect($data)) {
         if (preg_match('@https?:\\/\\/[a-z0-9-]+stor\\d+\\.cloudzer\\.net(:\\d+)?\\/dl\\/[^"\'><\\r\\n\\t]+@i', $data, $giay)) {
             return trim($giay[0]);
         }
     } else {
         return trim($this->redirect);
     }
     return false;
 }
Esempio n. 23
0
function acl_permiso($cargo_usuario, $cargo_requerido)
{
    $nopermitido = 0;
    $permitido = 0;
    if (empty($cargo_usuario)) {
        $nopermitido = 1;
    } else {
        if (is_array($cargo_requerido)) {
            for ($i = 0; $i < strlen($cargo_usuario); $i++) {
                // Si alguno de los permisos coincide, prevalecerá el valor del flag 'permitido'.
                if (!in_array($cargo_usuario[$i], $cargo_requerido)) {
                    $nopermitido = 1;
                } else {
                    $permitido = 1;
                }
            }
        } else {
            // Convertimos a string si se trata de cualquier otro tipo de dato
            $cargo_requerido = (string) $cargo_requerido;
            if (stristr($cargo_usuario, $cargo_requerido) == FALSE) {
                $nopermitido = 1;
            }
        }
    }
    // Si se activó el flag 'permitido' se permite el acceso a la página
    if ($permitido) {
        $nopermitido = 0;
    }
    return $nopermitido;
}
Esempio n. 24
0
 private function Free($link)
 {
     $post = array();
     $post['op'] = "download2";
     $post['id'] = $_POST['id'];
     $post['rand'] = $_POST['rand'];
     $post['referer'] = urldecode($_POST['referer']);
     $post['method_free'] = "SLOW DOWNLOAD";
     $post['method_premium'] = "";
     $post['recaptcha_challenge_field'] = $_POST['recaptcha_challenge_field'];
     $post['recaptcha_response_field'] = $_POST['captcha'];
     $post['down_script'] = "1";
     $FileName = $_POST['fname'];
     $page = $this->GetPage($link, 0, $post, $link);
     if (strpos($page, "Wrong captcha")) {
         return $this->Retrieve($link);
     }
     if (!stristr($page, 'Location:')) {
         html_error("Error, Download link not found!");
     }
     $dlink = trim(cut_str($page, "Location: ", "\n"));
     $Url = parse_url($dlink);
     if (!$FileName) {
         $FileName = basename($Url['path']);
     }
     $this->RedirectDownload($dlink, $FileName, 0, 0, $link);
     exit;
 }
Esempio n. 25
0
 function seturl_js()
 {
     if (isset($_GET['editor']) && !stristr($_GET['editor'], "..")) {
         $seturl_js_filename = 'seturl_js_' . htmlspecialchars($_GET['editor']) . '.inc';
     } else {
         $seturl_js_filename = '';
     }
     $seturl_js_path = MODX_BASE_PATH . 'assets/plugins/';
     if ($seturl_js_filename != '' && is_file($seturl_js_path . $seturl_js_filename)) {
         $result = file_get_contents($seturl_js_path . $seturl_js_filename);
     } else {
         switch ($_GET['editor']) {
             case 'tinymce':
             case 'tinymce3':
                 $editor_path = htmlspecialchars($_GET['editorpath'], ENT_QUOTES);
                 $editor_path = rtrim($editor_path, '/') . '/';
                 $result = file_get_contents('seturl_js_tinymce.inc');
                 $result = str_replace('[+editor_path+]', $editor_path, $result);
                 break;
             default:
                 $result = '<script src="seturl.js" type="text/javascript"></script>' . "\n";
         }
     }
     return $result;
 }
Esempio n. 26
0
function EcmsShowThisMemberMenu()
{
    global $memberskinurl, $noaddimgurl;
    $selffile = eReturnSelfPage(0);
    if (stristr($selffile, '/member/msg')) {
        $menuname = 'menumsg';
    } elseif (stristr($selffile, 'e/DoInfo')) {
        $menuname = 'menuinfo';
    } elseif (stristr($selffile, '/member/mspace')) {
        $menuname = 'menuspace';
    } elseif (stristr($selffile, 'e/ShopSys')) {
        $menuname = 'menushop';
    } elseif (stristr($selffile, 'e/payapi') || stristr($selffile, '/member/buygroup') || stristr($selffile, '/member/card') || stristr($selffile, '/member/buybak') || stristr($selffile, '/member/downbak')) {
        $menuname = 'menupay';
    } else {
        $menuname = 'menumember';
    }
    echo '<script>turnit(do' . $menuname . ',"' . $menuname . 'img");</script>';
    ?>
	<script>
	do<?php 
    echo $menuname;
    ?>
.style.display="";
	document.images.<?php 
    echo $menuname;
    ?>
img.src="<?php 
    echo $noaddimgurl;
    ?>
";
	</script>
	<?php 
}
Esempio n. 27
0
 public function Leech($url)
 {
     list($url, $pass) = $this->linkpassword($url);
     $data = $this->lib->curl($url, $this->lib->cookie, "");
     if ($pass) {
         $post = $this->parseForm($this->lib->cut_str($data, '<Form name="F1"', '</Form>'));
         $post["password"] = $pass;
         $data = $this->lib->curl($url, $this->lib->cookie, $post);
         if (stristr($data, 'Wrong password')) {
             $this->error("wrongpass", true, false, 2);
         } elseif (!$this->isredirect($data)) {
             $giay = $this->lib->cut_str($this->lib->cut_str($data, 'dotted #bbb;padding:7px;">', '</span>'), 'href="', '">');
             return trim($giay);
         } else {
             return trim($this->redirect);
         }
     }
     if (stristr($data, 'type="password" name="password')) {
         $this->error("reportpass", true, false);
     } elseif (stristr($data, 'Downloads are disabled for your country')) {
         $this->error("blockCountry", true, false);
     } elseif (stristr($data, 'The file was deleted by its owner')) {
         $this->error("dead", true, false, 2);
     } elseif (!$this->isredirect($data)) {
         $post = $this->parseForm($this->lib->cut_str($data, '<Form name="F1"', '</Form>'));
         $data = $this->lib->curl($url, $this->lib->cookie, $post);
         $giay = $this->lib->cut_str($this->lib->cut_str($data, 'dotted #bbb;padding:7px;">', '</span>'), 'href="', '">');
         return trim($giay);
     } else {
         return trim($this->redirect);
     }
     return false;
 }
Esempio n. 28
0
 public function updateDetail($arrPost)
 {
     Utility::pushArrAreaID($arrPost);
     //  区域ID
     if (empty($arrPost['endtime'])) {
         $arrPost['endtime'] = '';
     }
     if (!empty($arrPost['photos']) && stristr($arrPost['photos'], '|')) {
         $arrPost['photos'] = Utility::sortImg($arrPost['photos']);
         // 排序
     }
     // 需要 处理的 数字大小
     $arrParam = array('floor', 'floortotal', 'roomnumber', 'livingnumber', 'houseage', 'toiletnumber');
     Utility::checkMaxNum($arrPost, $arrParam);
     $arrPost['aroundpoint'] = empty($arrPost['aroundpoint']) ? '' : implode(',', $arrPost['aroundpoint']);
     $arrPost['livepoint'] = empty($arrPost['livepoint']) ? '' : implode(',', $arrPost['livepoint']);
     $this->strRequestApi = empty($arrPost['id']) ? $this->arrRequestApi['SECOND_HOUSE_ADD'] : $this->arrRequestApi['SECOND_HOUSE__UPDATE'];
     $this->arrRequest = $arrPost;
     $arrResultList = $this->updateParentDetail();
     // D($arrPost);
     // D($arrResultList);
     // exit();
     // 成功跳转
     if ($arrResultList['errorCode'] === 0 || $arrResultList['errorCode'] === 2) {
         Utility::location('secondHouse.php');
     }
     // Utility::UIWindowAlert( '请填写完整。');
     // Utility::location( null , '填写信息有误,请耐心检查下。');
     Utility::location(null, ACTION_ERROR);
 }
Esempio n. 29
0
 public function prepare($statement, $driver_options = array())
 {
     if (isset($this->dsn) and stristr($this->dsn, 'anjuke_db') and preg_match('/\\sajk_propertys\\s/i', $statement)) {
         if (stristr($statement, 'select CITYID') or stristr($statement, 'insert') or stristr($statement, 'update ')) {
         } else {
             $dir = '/home/www/logs/propsql';
             if (!is_dir($dir)) {
                 mkdir($dir, 0755, true);
             }
             $content = '-=-=-=-=-=-=-=-=-=-=' . PHP_EOL;
             $content .= 'DSN: ' . $this->dsn . PHP_EOL;
             $content .= 'URI: ' . $_SERVER['REQUEST_URI'] . PHP_EOL;
             $content .= 'JOB: ' . var_export($_SERVER['argv'], true) . PHP_EOL;
             $content .= 'SQL: ' . $statement . PHP_EOL;
             file_put_contents($dir . '/' . date('Ymd'), $content, FILE_APPEND);
         }
     }
     //add by jackie for record SQL
     APF::get_instance()->pf_benchmark("sql", array($this->i => $statement));
     $stmt = parent::prepare($statement, $driver_options);
     if ($stmt instanceof PDOStatement) {
         $stmt->setFetchMode($this->default_fetch_mode);
     }
     //add by hexin for record SQL execute time
     $stmt->set_i($this->i);
     $this->i++;
     $stmt->_sql = $statement;
     return $stmt;
 }
Esempio n. 30
0
function importDB($connection, $name, $file, $dbs)
{
    // initialize
    $returnValue = "";
    $sql = "";
    if (!in_array($name, $dbs)) {
        createDB($connection, $name);
    }
    mysql_select_db($name, $connection);
    // start reading in the file, if it exists
    $lines = file($file);
    foreach ($lines as $line) {
        if (strlen($line) > 1) {
            // to avoid blank lines
            $sql .= ltrim(rtrim($line));
            // if we've found a semi-colon it's time to execute
            if (strpos($sql, ";")) {
                if (!mysql_query($sql, $connection)) {
                    // rule out DROP calls to nonexistant tables
                    $error = mysql_error();
                    if (!stristr($error, "Unknown table")) {
                        $returnValue .= $error;
                    }
                }
                $sql = "";
            }
        }
    }
    // return any errors encountered
    if ($returnValue) {
        return 'Error importing database: ' . $returnValue;
    }
}