• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP entity_decode函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中entity_decode函数的典型用法代码示例。如果您正苦于以下问题:PHP entity_decode函数的具体用法?PHP entity_decode怎么用?PHP entity_decode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了entity_decode函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: ee_two_tagdata

 /**
  * Get tagdata for callback above class (EE2.x)
  *
  * @since      1.1.0
  * @return     array
  */
 function ee_two_tagdata()
 {
     $this->EE =& get_instance();
     // Directly load the typography helper from CI
     require BASEPATH . 'helpers/typography_helper' . EXT;
     $tagdata = $this->EE->TMPL->tagdata !== '' ? entity_decode($this->EE->TMPL->tagdata) : FALSE;
     return $tagdata;
 }
开发者ID:erikreagan,项目名称:er.youversion.ee_addon,代码行数:14,代码来源:pi.youversion.php


示例2: testEntityDecode

 public function testEntityDecode()
 {
     $this->assertEquals('A test', entity_decode('A test'));
     $this->assertEquals('hello  ? bar', entity_decode('hello &#x20&#x3F bar'));
     $this->assertEquals('hello  ? bar', entity_decode('hello  &#x3F bar'));
     $this->assertEquals('hello  ? bar', entity_decode('hello  ? bar'));
     $this->assertEquals('hello A& bar', entity_decode('hello &#65&#38 bar'));
     $this->assertEquals('hello A/ & bar', entity_decode('hello &#65&#x2f &#38 bar'));
 }
开发者ID:kawf,项目名称:kawf,代码行数:9,代码来源:StripTest.php


示例3: home

    function home()
    {
        global $user;
        $sql = 'SELECT *
			FROM _email
			WHERE email_active = ??
			LIMIT ??';
        if (!($email = _fieldrow(sql_filter($sql, 1, 1)))) {
            $this->e('No queue emails.');
        }
        set_time_limit(0);
        if (!$email['email_start']) {
            $sql = 'UPDATE _email SET email_start = ?
				WHERE email_id = ?';
            _sql(sql_filter($sql, time(), $email['email_id']));
        }
        $sql = 'SELECT user_id, user_username, user_email
			FROM _members
			WHERE user_type = ?
				AND user_id <> ?
			ORDER BY user_username
			LIMIT ??, ??';
        $members = _rowset(sql_filter($sql, 1, 1, $email['email_last'], 100));
        $i = 0;
        foreach ($members as $row) {
            if (!preg_match('/^[a-z0-9\\.\\-_\\+]+@[a-z0-9\\-_]+\\.([a-z0-9\\-_]+\\.)*?[a-z]+$/is', $row['user_email'])) {
                continue;
            }
            if (!$i) {
                include XFS . 'core/emailer.php';
                $emailer = new emailer();
            }
            $emailer->use_template('mass');
            $emailer->format('plain');
            $emailer->from('TWC Kaulitz <[email protected]>');
            $emailer->set_subject(entity_decode($email['email_subject']));
            $emailer->email_address($row['user_email']);
            $emailer->assign_vars(array('USERNAME' => $row['user_username'], 'MESSAGE' => entity_decode($email['email_message'])));
            $emailer->send();
            $emailer->reset();
            sleep(2);
            $i++;
        }
        if ($i) {
            $email['email_last'] += $i;
            $sql = 'UPDATE _email SET email_last = ?
				WHERE email_id = ?';
            _sql(sql_filter($sql, $email['email_last'], $email['email_id']));
        } else {
            $sql = 'UPDATE _email SET email_active = ?, email_end = ?
				WHERE email_id = ?';
            _sql(sql_filter($sql, 0, time(), $email['email_id']));
            $this->e('Finished processing [' . $email['email_id'] . '] emails.');
        }
        $this->e('Processed ' . $i . ' emails.');
        return;
    }
开发者ID:nopticon,项目名称:noptc,代码行数:57,代码来源:_email.php


示例4: log_referrer

 /**
  * Log Referrer data
  *
  * @access	public
  * @return	bool
  */
 function log_referrer()
 {
     // Is the nation of the user banend?
     if (ee()->config->item('ip2nation') == 'y' && ee()->session->nation_ban_check(FALSE) === FALSE) {
         return;
     }
     if (ee()->config->item('log_referrers') == 'n' or !isset($_SERVER['HTTP_REFERER'])) {
         return;
     }
     // Load the typography helper so we can do entity_decode()
     ee()->load->helper('typography');
     $site_url = ee()->config->item('site_url');
     $ref = !isset($_SERVER['HTTP_REFERER']) ? '' : ee()->security->xss_clean(entity_decode($_SERVER['HTTP_REFERER']));
     $test_ref = strtolower($ref);
     // Yes, a copy, not a reference
     $domain = !ee()->config->item('cookie_domain') ? '' : ee()->config->item('cookie_domain');
     // Throttling - Ten hits a minute is the limit
     $query = ee()->db->query("SELECT COUNT(*) AS count\n\t\t\t\t\t\t\t FROM exp_referrers\n\t\t\t\t\t\t\t WHERE site_id = '" . ee()->db->escape_str(ee()->config->item('site_id')) . "'\n\t\t\t\t\t\t\t AND (ref_from = '" . ee()->db->escape_str($ref) . "' OR ref_ip = '" . ee()->input->ip_address() . "')\n\t\t\t\t\t\t\t AND ref_date > '" . (ee()->localize->now - 60) . "'");
     if ($query->row('count') > 10) {
         return FALSE;
     }
     if (stristr($ref, '{') !== FALSE or stristr($ref, '}') !== FALSE) {
         return FALSE;
     }
     if (!preg_match("#^http://\\w+\\.\\w+\\.\\w*#", $ref)) {
         if (substr($test_ref, 0, 7) == 'http://' and substr($test_ref, 0, 11) != 'http://www.') {
             $test_ref = preg_replace("#^http://(.+?)#", "http://www.\\1", $test_ref);
         }
     }
     if (!preg_match("#^http://\\w+\\.\\w+\\.\\w*#", $site_url)) {
         if (substr($site_url, 0, 7) == 'http://' and substr($site_url, 0, 11) != 'http://www.') {
             $site_url = preg_replace("#^http://(.+?)#", "http://www.\\1", $site_url);
         }
     }
     if ($test_ref != '' && strncasecmp($test_ref, $site_url, strlen($site_url)) != 0 && ($domain == '' or stristr($test_ref, $domain) === FALSE) && (ee()->blacklist->whitelisted == 'y' or ee()->blacklist->blacklisted == 'n')) {
         // INSERT into database
         $ref_to = ee()->security->xss_clean(ee()->functions->fetch_current_uri());
         if (stristr($ref_to, '{') !== FALSE or stristr($ref_to, '}') !== FALSE) {
             return FALSE;
         }
         $insert_data = array('ref_from' => $ref, 'ref_to' => $ref_to, 'ref_ip' => ee()->input->ip_address(), 'ref_date' => ee()->localize->now, 'ref_agent' => substr(ee()->input->user_agent(), 0, 100), 'site_id' => ee()->config->item('site_id'));
         ee()->db->query(ee()->db->insert_string('exp_referrers', $insert_data));
         // Prune Database
         srand(time());
         if (rand() % 100 < 5) {
             $max = !is_numeric(ee()->config->item('max_referrers')) ? 500 : ee()->config->item('max_referrers');
             $query = ee()->db->query("SELECT MAX(ref_id) as ref_id FROM exp_referrers WHERE site_id = '" . ee()->db->escape_str(ee()->config->item('site_id')) . "'");
             $row = $query->row_array();
             if (isset($row['ref_id']) && $row['ref_id'] > $max) {
                 ee()->db->query("DELETE FROM exp_referrers WHERE site_id = '" . ee()->db->escape_str(ee()->config->item('site_id')) . "' AND ref_id < " . ($row['ref_id'] - $max) . "");
             }
         }
     }
 }
开发者ID:ayuinc,项目名称:laboratoria-v2,代码行数:60,代码来源:Referrer.php


示例5: tweet_me_two

 /**
  * EE 2.x version execution
  *
  * @return     string
  */
 function tweet_me_two()
 {
     $this->EE =& get_instance();
     // Directly load the typography helper from CI
     require BASEPATH . 'helpers/typography_helper' . EXT;
     // I'm going to add a space to the front of the 'data' parameter so I don't have
     // to write a crazy regular expression to get the job done. This is just to single
     // out the strings that are twitter-related and not email addresses or div id links
     // we don't want to process things like [email protected] or <a href="#comments">
     $tag_data = $this->EE->TMPL->fetch_param('data') != '' ? ' ' . entity_decode($this->EE->TMPL->fetch_param('data')) : entity_decode($this->EE->TMPL->tagdata);
     $base_at_url = $this->EE->TMPL->fetch_param('base_at_url') != '' ? $this->EE->TMPL->fetch_param('base_at_url') : 'http://twitter.com/';
     $base_hash_url = $this->EE->TMPL->fetch_param('base_hash_url') != '' ? $this->EE->TMPL->fetch_param('base_hash_url') : 'http://twitter.com/search?q=%23';
     return array('tag_data' => $tag_data, 'base_at_url' => $base_at_url, 'base_hash_url' => $base_hash_url);
 }
开发者ID:erikreagan,项目名称:er.tweet_me.ee_addon,代码行数:19,代码来源:pi.er_tweet_me.php


示例6: geraXmlRSS

function geraXmlRSS($locaplic, $sql, $descricao, $output = "xml")
{
    global $esquemaadmin;
    if (empty($output)) {
        $output = "xml";
    }
    //var_dump($_SERVER);exit;
    $dbh = "";
    include $locaplic . "/admin/php/conexao.php";
    if ($convUTF) {
        $xml = "<" . "?" . "xml version='1.0' encoding='UTF-8' " . "?" . ">";
    } else {
        $xml = "<" . "?" . "xml version='1.0' encoding='ISO-8859-1' " . "?" . ">";
    }
    $xml .= "<rss version='2.0'>";
    $xml .= "<channel>\n";
    $xml .= "<title>RSS</title>\n";
    $xml .= "<description>" . str_replace("&", "&amp;", $descricao) . "</description>\n";
    $xml .= "<link></link>\n";
    $xml .= "<docs></docs>\n";
    $xml .= "<copyright>Gerado pelo i3Geo</copyright>\n";
    $xml .= "<language>pt-br</language>\n";
    $xml .= "<webmaster></webmaster>\n";
    $json = array("description" => $descricao, "copyright" => "Gerado pelo i3Geo", "language" => "pt-br");
    $jsonItems = array();
    $qatlas = $dbh->query($sql);
    foreach ($qatlas as $row) {
        $xml .= "<item>\n";
        $xml .= "<category/>\n";
        $xml .= "<title>" . entity_decode($row["nome_ws"]) . "</title>\n";
        $xml .= "<description>" . xmlTexto_prepara(entity_decode($row["desc_ws"])) . "</description>\n";
        $link = xmlTexto_prepara($row["link_ws"]);
        if (stristr($link, 'http') === FALSE) {
            $link = "http://" . $_SERVER["HTTP_HOST"] . dirname($_SERVER["REQUEST_URI"]) . "/" . $link;
        }
        $xml .= "<link><![CDATA[" . $link . "]]></link>\n";
        $xml .= "<pubDate/>\n";
        $xml .= "<author>" . xmlTexto_prepara($row["autor_ws"]) . "</author>\n";
        $xml .= "<nacessos></nacessos>\n";
        $xml .= "<nacessosok></nacessosok>\n";
        $xml .= "<id>" . xmlTexto_prepara($row["id_ws"]) . "</id>\n";
        $xml .= "<tipo>" . $row["tipo_ws"] . "</tipo>\n";
        $xml .= "</item>\n";
        $jsonItems[] = array("title" => $row["nome_ws"], "description" => $row["desc_ws"], "link" => $link . "&output=json", "author" => $row["autor_ws"], "id" => $row["id_ws"], "tipo" => $row["tipo_ws"]);
    }
    $json["items"] = $jsonItems;
    $xml .= "</channel></rss>\n";
    $dbh = null;
    $dbhw = null;
    if ($output == "xml") {
        return $xml;
    } else {
        return json_encode($json);
    }
}
开发者ID:edmarmoretti,项目名称:i3geo,代码行数:55,代码来源:xml.php


示例7: MsgHTML

 /**
  * Evaluates the message and returns modifications for inline images and backgrounds
  * @access public
  * @return $message
  */
 public function MsgHTML($message, $basedir = '')
 {
     preg_match_all("/(src|background)=\"(.*)\"/Ui", $message, $images);
     if (isset($images[2])) {
         foreach ($images[2] as $i => $url) {
             // do not change urls for absolute images (thanks to corvuscorax)
             if (!preg_match('#^[A-z]+://#', $url)) {
                 $filename = basename($url);
                 $directory = dirname($url);
                 $directory == '.' ? $directory = '' : '';
                 $cid = 'cid:' . md5($filename);
                 $ext = pathinfo($filename, PATHINFO_EXTENSION);
                 $mimeType = self::_mime_types($ext);
                 if (strlen($basedir) > 1 && substr($basedir, -1) != '/') {
                     $basedir .= '/';
                 }
                 if (strlen($directory) > 1 && substr($directory, -1) != '/') {
                     $directory .= '/';
                 }
                 if ($this->AddEmbeddedImage($basedir . $directory . $filename, md5($filename), $filename, 'base64', $mimeType)) {
                     $message = preg_replace("/" . $images[1][$i] . "=\"" . preg_quote($url, '/') . "\"/Ui", $images[1][$i] . "=\"" . $cid . "\"", $message);
                 }
             }
         }
     }
     $this->IsHTML(true);
     $this->Body = $message;
     $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\\/\\1>/s', '', $message)));
     if (!empty($textMsg) && empty($this->AltBody)) {
         //$this->AltBody = html_entity_decode($textMsg);
         $this->AltBody = entity_decode($textMsg);
     }
     if (empty($this->AltBody)) {
         $this->AltBody = 'To view this email message, open it in a program that understands HTML!' . "\n\n";
     }
 }
开发者ID:nopticon,项目名称:mag,代码行数:41,代码来源:mail.core.php


示例8: home

	function home() {
		global $core, $user, $style;
		
		$sql = 'SELECT *
			FROM _email
			WHERE email_active = 1
				AND (email_schedule > ??
				OR email_schedule = 0)
			ORDER BY email_priority, email_id
			LIMIT 1';
		if (!$email = sql_fieldrow(sql_filter($sql, time()))) {
			$this->e('No queue.');
		}
		
		set_time_limit(0);
		
		$sql = 'SELECT *
			FROM ??
			WHERE address_sent = 0
			ORDER BY address_id
			LIMIT ??';
		if ($members = sql_rowset(sql_filter($sql, $email['email_data'], $email['email_batch']))) {
			if (!$email['email_start']) {
				$sql = 'UPDATE _email SET email_start = ?
					WHERE email_id = ?';
				sql_query(sql_filter($sql, time(), $email['email_id']));
			}
		}
		
		$i = 0;
		$sent_to = array();
		
		foreach ($members as $row) {
			$address_account = trim($row['address_account']);
			
			if (!preg_match('/^[a-z0-9\.\-_\+]+@[a-z0-9\-_]+\.([a-z0-9\-_]+\.)*?[a-z]+$/is', $address_account)) {
				$sql = 'UPDATE ?? SET address_sent = ?
					WHERE address_id = ?';
				sql_query(sql_filter($sql, $email['email_data'], 1, $row['address_id']));
				
				continue;
			}
			
			if (!$i) {
				include(XFS . 'core/emailer.php');
				$emailer = new emailer();
			}
			
			$emailer->use_template('mass');
			$emailer->format('html');
			
			$emailer->from($email['email_from'] . ' <' . $email['email_from_address'] . '>');
			$emailer->set_subject(entity_decode($email['email_subject']));
			$emailer->email_address($address_account);
			
			$name_compose = '';
			
			if (isset($row['address_name']) && !empty($row['address_name'])) {
				$row['address_name'] = preg_replace('/\s\s+/', ' ', $row['address_name']);
				$name_compose = ucwords(strtolower(trim($row['address_name'])));
				
				if (isset($row['address_last']) && !empty($row['address_last'])) {
					$row['address_last'] = preg_replace('/\s\s+/', ' ', $row['address_last']);
					$name_compose .= ' ' . ucwords(strtolower(trim($row['address_last'])));
				}
				
				if (!empty($name_compose)) {
					$name_gretting = '';
					
					if (isset($row['address_gender']) && !empty($row['address_gender'])) {
						switch ($row['address_gender']) {
							case 'Femenino':
								$name_by = 'a';
								break;
							case 'Masculino':
								$name_by = 'o';
								break;
							default:
								$name_gretting = $core->config['email_gretting'];
								break;
						}
					} else {
						if (strpos($name_compose, 'Sra.') !== false || strpos($name_compose, 'Srta.') !== false) {
							$name_by = 'a';
						} else if (strpos($name_compose, 'Sr.') !== false) {
							$name_by = 'o';
						} else {
							$name_gretting = $core->config['email_gretting'];
						}
					}
					
					if (empty($email['email_gretting'])) {
						$name_gretting = $core->config['email_gretting'];
					}
					
					if (!empty($name_gretting)) {
						$name_compose = $name_gretting . ' ' . $name_compose;
					} elseif (!empty($name_by)) {
						if (strpos($email['email_gretting'], '*') !== false) {
							$name_compose = str_replace('*', $name_by, $email['email_gretting']) . ' ' . $name_compose;
//.........这里部分代码省略.........
开发者ID:nopticon,项目名称:jade,代码行数:101,代码来源:_email.php


示例9: _check_blacklist

 /**
  * Blacklist Checker
  *
  * This function checks all of the available blacklists, such as urls,
  * IP addresses, and user agents. URLs are checked as both referrers and
  * in all $_POST'ed contents (such as comments).
  *
  * @access	private
  * @return	bool
  */
 function _check_blacklist()
 {
     // Check the referrer
     // Since we already need to check all post values for illegal urls
     // below, we'll temporarily write our referrer to $_POST.
     if (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER'] != '') {
         $test_ref = ee()->security->xss_clean($_SERVER['HTTP_REFERER']);
         if (!preg_match("#^http://\\w+\\.\\w+\\.\\w*#", $test_ref)) {
             if (substr($test_ref, 0, 7) == 'http://' and substr($test_ref, 0, 11) != 'http://www.') {
                 $test_ref = preg_replace("#^http://(.+?)#", "http://www.\\1", $test_ref);
             }
         }
         $_POST['HTTP_REFERER'] = $test_ref;
     }
     // No referrer, and no posted data - no need to blacklist.
     // In other words, if your ip is blacklisted you can still see the
     // site, but you can not contribute content.
     if (count($_POST) == 0) {
         return TRUE;
     }
     ee()->load->model('addons_model');
     $installed = ee()->addons_model->module_installed('blacklist');
     if (!$installed) {
         unset($_POST['HTTP_REFERER']);
         return TRUE;
     }
     // Whitelisted Items
     $whitelisted_ip = array();
     $whitelisted_url = array();
     $whitelisted_agent = array();
     $results = ee()->db->query("SELECT whitelisted_type, whitelisted_value FROM exp_whitelisted\n\t\t\t\t\t\t\t\t\t\t WHERE whitelisted_value != ''");
     if ($results->num_rows() > 0) {
         foreach ($results->result_array() as $row) {
             if ($row['whitelisted_type'] == 'url') {
                 $whitelisted_url = explode('|', $row['whitelisted_value']);
             } elseif ($row['whitelisted_type'] == 'ip') {
                 $whitelisted_ip = explode('|', $row['whitelisted_value']);
             } elseif ($row['whitelisted_type'] == 'agent') {
                 $whitelisted_agent = explode('|', $row['whitelisted_value']);
             }
         }
     }
     if (ee()->config->item('cookie_domain') !== FALSE && ee()->config->item('cookie_domain') != '') {
         $whitelisted_url[] = ee()->config->item('cookie_domain');
     }
     $site_url = ee()->config->item('site_url');
     $whitelisted_url[] = $site_url;
     if (!preg_match("#^http://\\w+\\.\\w+\\.\\w*#", $site_url)) {
         if (substr($site_url, 0, 7) == 'http://' and substr($site_url, 0, 11) != 'http://www.') {
             $whitelisted_url[] = preg_replace("#^http://(.+?)#", "http://www.\\1", $site_url);
         }
     }
     // Domain Names Array
     $domains = array('net', 'com', 'org', 'info', 'name', 'biz', 'us', 'de', 'uk');
     // Blacklisted Checking
     $query = ee()->db->query("SELECT blacklisted_type, blacklisted_value FROM exp_blacklisted");
     if ($query->num_rows() == 0) {
         unset($_POST['HTTP_REFERER']);
         return TRUE;
     }
     // Load the typography helper so we can do entity_decode()
     ee()->load->helper('typography');
     foreach ($query->result_array() as $row) {
         if ($row['blacklisted_type'] == 'url' && $row['blacklisted_value'] != '' && $this->whitelisted != 'y') {
             $blacklist_values = explode('|', $row['blacklisted_value']);
             if (!is_array($blacklist_values) or count($blacklist_values) == 0) {
                 continue;
             }
             foreach ($_POST as $key => $value) {
                 // Smallest URL Possible
                 // Or no external links
                 if (is_array($value) or strlen($value) < 8) {
                     continue;
                 }
                 // Convert Entities Before Testing
                 $value = entity_decode($value);
                 $value .= ' ';
                 // Clear period from the end of URLs
                 $value = preg_replace("#(^|\\s|\\()((http://|http(s?)://|www\\.)\\w+[^\\s\\)]+)\\.([\\s\\)])#i", "\\1\\2{{PERIOD}}\\4", $value);
                 // Sometimes user content such as comments contain multiple
                 // urls, so we need to check them individually.
                 if (preg_match_all("/([f|ht]+tp(s?):\\/\\/[a-z0-9@%_.~#\\/\\-\\?&=]+.)" . "|(www.[a-z0-9@%_.~#\\-\\?&]+.)" . "|([a-z0-9@%_~#\\-\\?&]*\\.(" . implode('|', $domains) . "))/si", $value, $matches)) {
                     for ($i = 0; $i < count($matches['0']); $i++) {
                         // If this is a referrer or the comment module's
                         // url field we know that it's just a single match.
                         if ($key == 'HTTP_REFERER' or $key == 'url') {
                             $matches['0'][$i] = $value;
                         }
                         foreach ($blacklist_values as $bad_url) {
                             if ($bad_url != '' && stristr($matches['0'][$i], $bad_url) !== FALSE) {
//.........这里部分代码省略.........
开发者ID:kentonquatman,项目名称:iofa,代码行数:101,代码来源:Blacklist.php


示例10: _check_blacklist

 /**
  * Blacklist Checker
  *
  * @access	private
  * @return	bool
  */
 function _check_blacklist()
 {
     // Check the Referrer Too
     if (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER'] != '') {
         $test_ref = $this->EE->security->xss_clean($_SERVER['HTTP_REFERER']);
         if (!preg_match("#^http://\\w+\\.\\w+\\.\\w*#", $test_ref)) {
             if (substr($test_ref, 0, 7) == 'http://' and substr($test_ref, 0, 11) != 'http://www.') {
                 $test_ref = preg_replace("#^http://(.+?)#", "http://www.\\1", $test_ref);
             }
         }
         $_POST['HTTP_REFERER'] = $test_ref;
     }
     if (count($_POST) == 0 or !$this->EE->db->table_exists('exp_blacklisted')) {
         unset($_POST['HTTP_REFERER']);
         return TRUE;
     }
     // Whitelisted Items
     $whitelisted_ip = array();
     $whitelisted_url = array();
     $whitelisted_agent = array();
     if ($this->EE->db->table_exists('exp_whitelisted')) {
         $results = $this->EE->db->query("SELECT whitelisted_type, whitelisted_value FROM exp_whitelisted \n\t\t\t\t\t\t\t\t\t\t\t WHERE whitelisted_value != ''");
         if ($results->num_rows() > 0) {
             foreach ($results->result_array() as $row) {
                 if ($row['whitelisted_type'] == 'url') {
                     $whitelisted_url = explode('|', $row['whitelisted_value']);
                 } elseif ($row['whitelisted_type'] == 'ip') {
                     $whitelisted_ip = explode('|', $row['whitelisted_value']);
                 } elseif ($row['whitelisted_type'] == 'agent') {
                     $whitelisted_agent = explode('|', $row['whitelisted_value']);
                 }
             }
         }
     }
     if ($this->EE->config->item('cookie_domain') !== FALSE && $this->EE->config->item('cookie_domain') != '') {
         $whitelisted_url[] = $this->EE->config->item('cookie_domain');
     }
     $site_url = $this->EE->config->item('site_url');
     $whitelisted_url[] = $site_url;
     if (!preg_match("#^http://\\w+\\.\\w+\\.\\w*#", $site_url)) {
         if (substr($site_url, 0, 7) == 'http://' and substr($site_url, 0, 11) != 'http://www.') {
             $whitelisted_url[] = preg_replace("#^http://(.+?)#", "http://www.\\1", $site_url);
         }
     }
     // Domain Names Array
     $domains = array('net', 'com', 'org', 'info', 'name', 'biz', 'us', 'de', 'uk');
     // Blacklisted Checking
     $query = $this->EE->db->query("SELECT blacklisted_type, blacklisted_value FROM exp_blacklisted");
     if ($query->num_rows() == 0) {
         unset($_POST['HTTP_REFERER']);
         return TRUE;
     }
     // Load the typography helper so we can do entity_decode()
     $this->EE->load->helper('typography');
     foreach ($query->result_array() as $row) {
         if ($row['blacklisted_type'] == 'url' && $row['blacklisted_value'] != '' && $this->whitelisted != 'y') {
             $blacklist_values = explode('|', $row['blacklisted_value']);
             if (!is_array($blacklist_values) or count($blacklist_values) == 0) {
                 continue;
             }
             foreach ($_POST as $key => $value) {
                 // Smallest URL Possible
                 // Or no external links
                 if (is_array($value) or strlen($value) < 8) {
                     continue;
                 }
                 // Convert Entities Before Testing
                 $value = entity_decode($value);
                 $value .= ' ';
                 // Clear period from the end of URLs
                 $value = preg_replace("#(^|\\s|\\()((http://|http(s?)://|www\\.)\\w+[^\\s\\)]+)\\.([\\s\\)])#i", "\\1\\2{{PERIOD}}\\4", $value);
                 if (preg_match_all("/([f|ht]+tp(s?):\\/\\/[a-z0-9@%_.~#\\/\\-\\?&=]+.)" . "|(www.[a-z0-9@%_.~#\\-\\?&]+.)" . "|([a-z0-9@%_~#\\-\\?&]*\\.(" . implode('|', $domains) . "))/si", $value, $matches)) {
                     for ($i = 0; $i < count($matches['0']); $i++) {
                         if ($key == 'HTTP_REFERER' or $key == 'url') {
                             $matches['0'][$i] = $value;
                         }
                         foreach ($blacklist_values as $bad_url) {
                             if ($bad_url != '' && stristr($matches['0'][$i], $bad_url) !== FALSE) {
                                 $bad = 'y';
                                 // Check Bad Against Whitelist - URLs
                                 if (is_array($whitelisted_url) && count($whitelisted_url) > 0) {
                                     $parts = explode('?', $matches['0'][$i]);
                                     foreach ($whitelisted_url as $pure) {
                                         if ($pure != '' && stristr($parts['0'], $pure) !== FALSE) {
                                             $bad = 'n';
                                             $this->whitelisted = 'y';
                                             break;
                                         }
                                     }
                                 }
                                 // Check Bad Against Whitelist - IPs
                                 if (is_array($whitelisted_ip) && count($whitelisted_ip) > 0) {
                                     foreach ($whitelisted_ip as $pure) {
                                         if ($pure != '' && strpos($this->EE->input->ip_address(), $pure) !== FALSE) {
//.........这里部分代码省略.........
开发者ID:thomasvandoren,项目名称:teentix-site,代码行数:101,代码来源:Blacklist.php


示例11: store


//.........这里部分代码省略.........
								WHERE p.post_id = ?
									AND p.poster_id = m.user_id
									AND m.user_type NOT IN (??)', $post_reply, USER_INACTIVE);
							break;
					}
					break;
				case 'events':
					$insert_data['event_id'] = (int) $post_data['id'];
					$update_sql = sql_filter('posts = posts + 1 WHERE id = ?', $post_data['id']);
					break;
				case 'news':
					$insert_data['news_id'] = (int) $post_data['news_id'];
					$update_sql = sql_filter('post_replies = post_replies + 1 WHERE news_id = ?', $post_data['news_id']);
					break;
				case 'art':
					$insert_data['art_id'] = (int) $post_data['art_id'];
					$update_sql = sql_filter('posts = posts + 1 WHERE art_id = ?', $post_data['art_id']);
					break;
				case 'm':
					$insert_data['userpage_id'] = (int) $post_data['user_id'];
					$update_sql = sql_filter('userpage_posts = userpage_posts + 1 WHERE user_id = ?', $post_data['user_id']);

					$this->data['HISTORY_EXTRA'] = $post_data['user_id'];
					break;
			}

			$post_id = sql_insert($this->data['POST_TABLE'], $insert_data);

			if ($update_sql != '') {
				$sql = 'UPDATE ' . $this->data['DATA_TABLE'] . ' SET ' . $update_sql;
				sql_query($sql);
			}

			$reply_to = 0;
			$history_extra = isset($this->data['HISTORY_EXTRA']) ? $this->data['HISTORY_EXTRA'] : 0;

			if ($post_reply && isset($this->data['REPLY_TO_SQL'])) {
				if ($reply_row = sql_fieldrow($this->data['REPLY_TO_SQL'])) {
					$reply_to = ($reply_row['user_id'] != GUEST) ? $reply_row['user_id'] : 0;
				}

				$user->delete_unread($this->data['HISTORY'], $post_reply);
			}

			$notify = true;
			if ($this->param[0] == 'm' && $user->d('user_id') == $post_data['user_id']) {
				$notify = false;
			}

			if ($notify) {
				if ($this->param[0] == 'm') {
					$emailer = new emailer();

					$emailer->from('info');
					$emailer->use_template('user_message');
					$emailer->email_address($post_data['user_email']);
					$emailer->set_subject($user->d('username') . ' te envio un mensaje en Rock Republik');

					$emailer->assign_vars(array(
						'USERNAME_TO' => $post_data['username'],
						'USERNAME_FROM' => $user->d('username'),
						'USER_MESSAGE' => entity_decode($message),
						'U_PROFILE' => s_link('m', $user->d('username_base')))
					);
					$emailer->send();
					$emailer->reset();

					$user->save_unread($this->data['HISTORY'], $post_id, $history_extra, $post_data['user_id']);
				} else {
					$user->save_unread($this->data['HISTORY'], $post_id, $history_extra, $reply_to, false);

					// Points
					//$user->points_add(1);
				}
			}

			// Userpage messages
			if ($this->param[0] == 'm') {
				$sql = 'SELECT post_id
					FROM _members_posts p, _members_unread u
						WHERE u.item = p.post_id
							AND p.userpage_id = ?
							AND p.poster_id = ?';
				if ($rows = sql_rowset(sql_filter($sql, $user->d('user_id'), $post_data['user_id']), false, 'post_id')) {
					$sql = 'DELETE FROM _members_unread
						WHERE user_id = ?
							AND element = ?
							AND item IN (??)';
					sql_query(sql_filter($sql, $user->d('user_id'), UH_UPM, implode(',', $rows)));
				}
			}
		} else {
			$user->setup();

			$return_message = parse_error($error) . '<br /><br /><br /><a href="' . $ref . '">' . lang('click_return_lastpage') . '</a>';
			trigger_error($return_message);
		}

		return;
	}
开发者ID:nopticon,项目名称:rockr,代码行数:101,代码来源:comments.php


示例12: _ad_acute

function _ad_acute($a)
{
    foreach (w('a e i o u A E I O U') as $row) {
        $row = '&' . $row . 'acute;';
        $a = str_replace(entity_decode($row), $row, $a);
    }
    return $a;
}
开发者ID:nopticon,项目名称:npt,代码行数:8,代码来源:functions.php


示例13: send

 function send()
 {
     global $core, $user;
     // Escape all quotes, else the eval will fail.
     $this->msg = str_replace("'", "\\'", $this->msg);
     $this->msg = preg_replace('#\\{([a-z0-9\\-_]*?)\\}#is', "' . \$\\1 . '", $this->msg);
     // Set vars
     reset($this->vars);
     while (list($key, $val) = each($this->vars)) {
         ${$key} = $val;
     }
     eval("\$this->msg = '{$this->msg}';");
     // Clear vars
     foreach ($this->vars as $key => $val) {
         unset(${$key});
     }
     // We now try and pull a subject from the email body ... if it exists,
     // do this here because the subject may contain a variable
     $drop_header = '';
     $match = array();
     if (preg_match('#^(Subject:(.*?))$#m', $this->msg, $match)) {
         $this->subject = trim($match[2]) != '' ? trim($match[2]) : ($this->subject != '' ? $this->subject : 'No Subject');
         $drop_header .= '[\\r\\n]*?' . preg_quote($match[1], '#');
     } else {
         $this->subject = $this->subject != '' ? $this->subject : 'No Subject';
     }
     if (preg_match('#^(Charset:(.*?))$#m', $this->msg, $match)) {
         $this->encoding = trim($match[2]) != '' ? trim($match[2]) : _lang('ENCODING');
         $drop_header .= '[\\r\\n]*?' . preg_quote($match[1], '#');
     } else {
         $this->encoding = _lang('ENCODING');
     }
     if ($drop_header != '') {
         $this->msg = trim(preg_replace('#' . $drop_header . '#s', '', $this->msg));
     }
     $to = $this->addresses['to'];
     $cc = isset($this->addresses['cc']) && count($this->addresses['cc']) ? implode(', ', $this->addresses['cc']) : '';
     $bcc = isset($this->addresses['bcc']) && count($this->addresses['bcc']) ? implode(', ', $this->addresses['bcc']) : '';
     // Build header
     $this->extra_headers = ($this->reply_to != '' ? "Reply-to: {$this->reply_to}\n" : '') . ($this->from != '' ? "From: {$this->from}\n" : "From: " . $core->v('default_email') . "\n") . "Return-Path: " . $core->v('default_email') . "\nMessage-ID: <" . md5(uniqid(time())) . "@" . get_host() . ">\nMIME-Version: 1.0\nContent-type: text/" . $this->eformat . "; charset=" . $this->encoding . "\nContent-transfer-encoding: 8bit\nDate: " . date('r', time()) . "\nX-Priority: 2\nX-MSMail-Priority: High\n" . $this->extra_headers . ($cc != '' ? "Cc: {$cc}\n" : '') . ($bcc != '' ? "Bcc: {$bcc}\n" : '');
     // Send message ... removed $this->encode() from subject for time being
     $empty_to_header = $to == '' ? true : false;
     $to = $to == '' ? 'Undisclosed-recipients:;' : $to;
     if ($this->htmle) {
         $this->msg = entity_decode($this->msg);
     }
     if ($core->v('mail_use_smtp')) {
         require_once XFS . 'core/class.phpmailer.php';
         $mail = new PHPMailer(true);
         $mail->IsSMTP();
         try {
             $mail->SMTPDebug = 0;
             $mail->Host = 'ssl://smtp.gmail.com:465';
             $mail->Port = 465;
             $mail->Username = $core->v('mail_ticket_login');
             $mail->Password = $core->v('mail_ticket_key');
             $mail->SMTPAuth = TRUE;
             $mail->AddAddress($to);
             if ($this->reply_to != '') {
                 $mail->AddReplyTo($this->reply_to);
             }
             if (isset($this->addresses['cc']) && count($this->addresses['cc'])) {
                 foreach ($this->addresses['cc'] as $row) {
                     $mail->AddCC($row);
                 }
             }
             if (isset($this->addresses['bcc']) && count($this->addresses['bcc'])) {
                 foreach ($this->addresses['bcc'] as $row) {
                     $mail->AddBCC($row);
                 }
             }
             $mail->SetFrom($this->from);
             $mail->Subject = _utf8($this->subject);
             $this->msg = _utf8($this->msg);
             $mail->MsgHTML(str_replace("\n", '<br />', $this->msg));
             $mail->AltBody = $this->msg;
             $mail->Send();
             return true;
         } catch (phpmailerException $e) {
             echo $e->errorMessage();
             //Pretty error messages from PHPMailer
         } catch (Exception $e) {
             echo $e->getMessage();
             //Boring error messages from anything else!
         }
         return;
     }
     $result = @mail($to, $this->subject, preg_replace("#(?<!\r)\n#s", "\n", $this->msg), $this->extra_headers, "-f{$core->v('default_email')}");
     // Did it work?
     if (!$result) {
         trigger_error('Failed sending email :: PHP :: ' . $result);
     }
     return true;
 }
开发者ID:nopticon,项目名称:noptc,代码行数:94,代码来源:emailer.php


示例14: _press_home

    protected function _press_home()
    {
        global $bio;
        $sql = 'SELECT *
			FROM _newsletter
			WHERE newsletter_active = 1
			LIMIT 1';
        if (!($newsletter = _fieldrow($sql))) {
            $this->warning->set('no_newsletter');
        }
        set_time_limit(0);
        if (!$newsletter->newsletter_start) {
            $sql = 'UPDATE _newsletter SET newsletter_start = ?
				WHERE newsletter_id = ?';
            sql_query(sql_filter($sql, time(), $newsletter->newsletter_id));
        }
        $sql = 'SELECT bio_id, bio_alias, bio_name, bio_address, bio_lastvisit
			FROM _bio b
			??
			RIGHT JOIN _bio_newsletter bn ON b.bio_id = bn.newsletter_bio
				AND bn.newsletter_receive = ? 
			WHERE b.bio_lastvisit >= ?
				AND b.bio_status <> ?
			ORDER BY b.bio_name
			LIMIT ??, ??';
        $sql_country = '';
        if (!empty($newsletter->newsletter_country)) {
            $sql_country = sql_filter(' LEFT JOIN _countries ON bio_country = country_id
				AND country_id IN (??)', implode(', ', w($newsletter->newsletter_country)));
        }
        $members = _rowset(sql_filter($sql, $sql_country, 1, $newsletter['newsletter_lastvisit'], 2, $newsletter->newsletter_last, $core->v('newsletter_process')));
        $i = 0;
        foreach ($members as $row) {
            if (!is_email($row['user_email'])) {
                continue;
            }
            $email = array('USERNAME' => $row->username, 'MESSAGE' => entity_decode($email->email_message));
            $core->email->init('press', 'mass:plain', $email);
            $core->email->subject(entity_decode($email['email_subject']));
            if (!empty($row['user_public_email']) && $row['user_email'] != $row['user_public_email'] && is_email($row['user_public_email'])) {
                $core->email->cc($row->bio_address_public);
            }
            $core->email->send($row->user_email);
            $sql_history = array('history_newsletter' => $newsletter->newsletter_id, 'history_bio' => $row->bio_id, 'history_time' => time());
            sql_put('_newsletter_history', $sql_history);
            sleep(2);
            $i++;
        }
        if ($i) {
            $email['email_last'] += $i;
            $sql = 'UPDATE _newsletter SET newsletter_last = ?
				WHERE newsletter_id = ?';
            sql_query(sql_filter($sql, $newsletter->newsletter_last, $newsletter->newsletter_id));
        } else {
            $sql = 'UPDATE _newsletter SET newsletter_active = ?, newsletter_end = ?
				WHERE newsletter_id = ?';
            sql_query(sql_filter($sql, 0, time(), $newsletter->newsletter_id));
            $this->warning->set('finished: ' . $newsletter->newsletter_id);
        }
        return $this->warning->set('completed: ' . $i);
    }
开发者ID:nopticon,项目名称:mag,代码行数:61,代码来源:_robot.php


示例15: _feed_home

    protected function _feed_home()
    {
        global $core;
        $format = '<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0">
<channel>
	<title>%s</title>
	<link>%s</link>
	<language>es-gt</language>
	<description><![CDATA[%s]]></description>
	<lastBuildDate>%s</lastBuildDate>
	<webMaster>%s</webMaster>
%s
</channel>
</rss>';
        $tags = w('author title link guid description pubDate');
        $last_entry = time();
        $feed = '';
        $sql = 'SELECT r.ref_subject, r.ref_content, r.ref_time, r.ref_link, b.bio_name
			FROM _reference r, _reference_type t, _bio b
			WHERE r.ref_bio = b.bio_id
				AND r.ref_type = t.type_id
			ORDER BY r.ref_time DESC
			LIMIT 20';
        $reference = sql_rowset($sql);
        foreach ($reference as $i => $row) {
            if (!$i) {
                $last_entry = $row->ref_time;
            }
            $a = array($row->username, '<![CDATA[' . entity_decode($row->ref_subject, false) . ']]>', $row->ref_link, $row->ref_link, '<![CDATA[' . entity_decode($row->ref_content, false) . ']]>', date('D, d M Y H:i:s \\G\\M\\T', $row->ref_time));
            $feed .= "\t<item>";
            foreach ($a as $j => $v) {
                $feed .= '<' . $tags[$j] . '>' . $v . '</' . $tags[$j] . '>';
            }
            $feed .= "</item>\n";
        }
        //
        header('Content-type: text/xml');
        $ref_title = entity_decode($core->v('site_name'), false);
        $ref_desc = entity_decode($core->v('site_details'), false);
        $this->e(sprintf($format, $ref_title, _link(), $ref_desc, date('D, d M Y H:i:s \\G\\M\\T', $last_entry), $core->v('site_email'), $feed));
    }
开发者ID:nopticon,项目名称:npt,代码行数:42,代码来源:_ext.php


示例16: prep_val

 /** -------------------------------------
 	/**  Clean the values for use in URLs
 	/** -------------------------------------*/
 function prep_val($str)
 {
     // Oh, PayPal, the hoops I must jump through to woo thee...
     // PayPal is displaying its cart as UTF-8, sending UTF-8 headers, but when
     // processing the form data, is obviously wonking with it.  This will force
     // accented characters in item names to display properly on the shopping cart
     // but alas only for unencrypted data.  PayPal won't accept this same
     // workaround for encrypted form data.
     //  

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP entity_delete_multiple函数代码示例发布时间:2022-05-15
下一篇:
PHP entity_create函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap