Пример #1
3
 protected function prepareTable($table)
 {
     jimport('joomla.filter.output');
     $date = JFactory::getDate();
     $user = JFactory::getUser();
     $table->title = htmlspecialchars_decode($table->title, ENT_QUOTES);
     $table->alias = JApplication::stringURLSafe($table->alias);
     if (empty($table->alias)) {
         $table->alias = JApplication::stringURLSafe($table->title);
     }
     if (intval($table->date) == 0) {
         $table->date = JFactory::getDate()->toSql();
     }
     if (empty($table->id)) {
         // Set the values
         //$table->created	= $date->toSql();
         // Set ordering to the last item if not set
         if (empty($table->ordering)) {
             $db = JFactory::getDbo();
             $db->setQuery('SELECT MAX(ordering) FROM #__phocagallery_comments WHERE catid = ' . (int) $table->catid);
             $max = $db->loadResult();
             $table->ordering = $max + 1;
         }
     } else {
         // Set the values
         //$table->modified	= $date->toSql();
         //$table->modified_by	= $user->get('id');
     }
 }
Пример #2
0
 public function getExternalDependencies($fileExtensions = array('css', 'js'), Uri $uri = null)
 {
     if (!is_array($fileExtensions)) {
         return false;
     }
     $extensions = implode('|', $fileExtensions);
     $pattern = '/[^\'](?:<link|<script).*(?:href|src)=["\']([\\S]+\\.(?:' . $extensions . ')+[?\\S]*)[\'"][^\']/iU';
     $matches = array();
     preg_match_all($pattern, $this->content, $matches);
     $cleanFiles = array();
     $files = $matches[1];
     if (!is_null($uri)) {
         $uri = htmlspecialchars_decode($uri);
         $uri = new Uri($uri);
         $cleanFiles = array();
         foreach ($files as $file) {
             $cleanFiles[] = $uri->concatUri($file);
         }
     } else {
         foreach ($files as $file) {
             $cleanFiles[] = new Uri($file);
         }
     }
     return $cleanFiles;
 }
 /**
  * Renders the complete hierarchical facet.
  *
  * @see Tx_Solr_Facet_AbstractFacetRenderer::renderFacetOptions()
  * @return string Facet markup.
  */
 protected function renderFacetOptions()
 {
     $facetContent = '';
     $facetOptions = $this->getFacetOptions();
     /* @var $filterEncoder Tx_Solr_Query_FilterEncoder_Hierarchy */
     $filterEncoder = t3lib_div::makeInstance('Tx_Solr_Query_FilterEncoder_Hierarchy');
     // enrich the facet options with links before building the menu structure
     $enrichedFacetOptions = array();
     foreach ($facetOptions as $facetOptionValue => $facetOptionResultCount) {
         $facetOption = t3lib_div::makeInstance('Tx_Solr_Facet_FacetOption', $this->facetName, $facetOptionValue, $facetOptionResultCount);
         /* @var $facetOption Tx_Solr_Facet_FacetOption */
         $facetOption->setUrlValue($filterEncoder->encodeFilter($facetOptionValue));
         $facetLinkBuilder = t3lib_div::makeInstance('Tx_Solr_Facet_LinkBuilder', $this->search->getQuery(), $this->facetName, $facetOption);
         $optionSelected = $facetOption->isSelectedInFacet($this->facetName);
         $optionLinkUrl = $facetLinkBuilder->getAddFacetOptionUrl();
         // negating the facet option links to remove a filter
         if ($this->facetConfiguration['selectingSelectedFacetOptionRemovesFilter'] && $optionSelected) {
             $optionLinkUrl = $facetLinkBuilder->getRemoveFacetOptionUrl();
         }
         if ($this->facetConfiguration['singleOptionMode']) {
             $optionLinkUrl = $facetLinkBuilder->getReplaceFacetOptionUrl();
         }
         // by default the facet link builder creates htmlspecialchars()ed URLs
         // HMENU will also apply htmlspecialchars(), to prevent corrupt URLs
         // we're reverting the facet builder's htmlspecials() here
         $optionLinkUrl = htmlspecialchars_decode($optionLinkUrl);
         $enrichedFacetOptions[$facetOption->getValue()] = array('numberOfResults' => $facetOption->getNumberOfResults(), 'url' => $optionLinkUrl, 'selected' => $optionSelected);
     }
     $facetContent .= $this->renderHierarchicalFacet($enrichedFacetOptions);
     return $facetContent;
 }
Пример #4
0
 private static function make_apps_url($url)
 {
     $httpstr = is_https() ? 'https' : 'http';
     if (preg_match('#//goo\\.gl/#', $url)) {
         $results = mahara_shorturl_request($url);
         $url = $results->fullurl;
     }
     $embedsources = array(array('match' => '#.*docs.google.com/([a-zA-Z0-9\\_\\-\\.\\/]*)leaf\\?id=([a-zA-Z0-9\\_\\-]+).*#', 'url' => $httpstr . '://docs.google.com/$1leaf?id=$2', 'type' => 'spanicon'), array('match' => '#.*docs.google.com/([a-zA-Z0-9\\_\\-\\.\\/]*)open\\?id=([a-zA-Z0-9\\_\\-]+).*#', 'url' => $httpstr . '://docs.google.com/$1open?id=$2', 'type' => 'spanicon'), array('match' => '#.*docs.google.com/([a-zA-Z0-9\\_\\-\\.\\/]*)present([a-z]*)/([a-z]+).*?id=([a-zA-Z0-9\\_\\-\\&\\=]+).*#', 'url' => $httpstr . '://docs.google.com/$1present$2/embed?id=$4', 'type' => 'iframe'), array('match' => '#.*docs.google.com/([a-zA-Z0-9\\_\\-\\.\\/]*)presentation/([a-zA-Z0-9\\_\\-\\/]+)/([a-z]+)\\?([a-zA-Z0-9\\_\\-\\&\\=]*).*#', 'url' => $httpstr . '://docs.google.com/$1presentation/$2/embed?$4', 'type' => 'iframe'), array('match' => '#.*docs.google.com/([a-zA-Z0-9\\_\\-\\.\\/]*)drawings.*id=([a-zA-Z0-9\\_\\-\\&\\=]+).*#', 'url' => $httpstr . '://docs.google.com/$1drawings/pub?id=$2', 'type' => 'image'), array('match' => '#.*docs.google.com/([a-zA-Z0-9\\_\\-\\.\\/]*)drawings/([a-zA-Z0-9\\_\\-\\/]+)/([a-z]+)\\?([a-zA-Z0-9\\_\\-\\&\\=]*).*#', 'url' => $httpstr . '://docs.google.com/$1drawings/$2/$3?$4', 'type' => 'image'), array('match' => '#.*docs.google.com/([a-zA-Z0-9\\_\\-\\.\\/]*)View.*id=([a-zA-Z0-9\\_\\-]+).*#', 'url' => $httpstr . '://docs.google.com/$1View?id=$2', 'type' => 'iframe'), array('match' => '#.*docs.google.com/([a-zA-Z0-9\\_\\-\\.\\/]*)viewer.*srcid=([a-zA-Z0-9\\_\\-\\&\\=]+).*#', 'url' => $httpstr . '://docs.google.com/$1viewer?srcid=$2', 'type' => 'iframe'), array('match' => '#.*docs.google.com/([a-zA-Z0-9\\_\\-\\.\\/]*)document/([a-zA-Z0-9\\_\\-\\/]+)/pub.*#', 'url' => $httpstr . '://docs.google.com/$1document/$2/pub?embedded=true', 'type' => 'iframe'), array('match' => '#.*docs.google.com/([a-zA-Z0-9\\_\\-\\.\\/]*)file/([a-zA-Z0-9\\_\\-\\/]+)/([a-z]+).*#', 'url' => $httpstr . '://docs.google.com/$1file/$2/preview', 'type' => 'iframe'), array('match' => '#.*docs.google.com/([a-zA-Z0-9\\_\\-\\.\\/]*)viewer.*url=http([a-zA-Z0-9\\.\\,\\;\\_\\-\\&\\%\\=\\+/\\:]+)\\.(pdf|tif|tiff|ppt|doc|docx).*#', 'url' => $httpstr . '://docs.google.com/$1viewer?url=http$2.$3&embedded=true', 'type' => 'iframe'), array('match' => '#.*docs.google.com/([a-zA-Z0-9\\_\\-\\.\\/]*)document/pub.*id=([a-zA-Z0-9\\_\\-]+).*#', 'url' => $httpstr . '://docs.google.com/$1document/pub?id=$2', 'type' => 'iframe'), array('match' => '#.*docs.google.com/([a-zA-Z0-9\\_\\-\\.\\/]*)document/d/([a-zA-Z0-9\\_\\-]+).*#', 'url' => $httpstr . '://docs.google.com/$1document/d/$2/pub?embedded=true', 'type' => 'iframe'), array('match' => '#.*docs.google.com/([a-zA-Z0-9\\_\\-\\.\\/]*)spreadsheets/d/([a-zA-Z0-9\\_\\-]+).*#', 'url' => $httpstr . '://docs.google.com/$1spreadsheets/d/$2/pub?embedded=true', 'type' => 'iframe'), array('match' => '#.*docs.google.com/([a-zA-Z0-9\\_\\-\\.\\/]*)spreadsheet/.*key=([a-zA-Z0-9\\_\\-]+)([a-zA-Z0-9\\_\\-\\&\\=]*).*#', 'url' => $httpstr . '://docs.google.com/$1spreadsheet/pub?key=$2$3&widget=true', 'type' => 'iframe'), array('match' => '#.*docs.google.com/([a-zA-Z0-9\\_\\-\\.\\/]*)forms/([a-zA-Z0-9\\_\\-\\.\\/]*)/viewform\\?embedded=true.*#', 'url' => $httpstr . '://docs.google.com/$1forms/$2/viewform?embedded=true', 'type' => 'iframe'), array('match' => '#.*spreadsheets[0-9]?.google.com/([a-zA-Z0-9\\_\\-\\.\\/]*)viewform.*formkey=([a-zA-Z0-9\\_\\-]+).*#', 'url' => $httpstr . '://spreadsheets.google.com/$1embeddedform?formkey=$2', 'type' => 'iframe'), array('match' => '#.*spreadsheets[0-9]?.google.com/([a-zA-Z0-9\\_\\-\\.\\/]*)embeddedform.*formkey=([a-zA-Z0-9\\_\\-]+).*#', 'url' => $httpstr . '://spreadsheets.google.com/$1embeddedform?formkey=$2', 'type' => 'iframe'), array('match' => '#.*spreadsheets[0-9]?.google.com/([a-zA-Z0-9\\_\\-\\.\\/]*)pub.*key=([a-zA-Z0-9\\_\\-]+).*#', 'url' => $httpstr . '://spreadsheets.google.com/$1pub?key=$2', 'type' => 'iframe'), array('match' => '#.*drive.google.com/.*file/d/([a-zA-Z0-9\\_\\-]+).*#', 'url' => $httpstr . '://docs.google.com/file/d/$1/preview', 'type' => 'iframe'), array('match' => '#.*www.google.com/calendar.*src=([a-zA-Z0-9\\.\\_\\-\\&\\%\\=/]+).*#', 'url' => $httpstr . '://www.google.com/calendar/embed?src=$1', 'type' => 'iframe'), array('match' => '#.*google.[^/]*/maps/ms\\?([a-zA-Z0-9\\.\\,\\;\\_\\-\\&\\%\\=\\+/]+).*#', 'url' => $httpstr . '://maps.google.com/maps/ms?$1&output=embed', 'type' => 'iframe'), array('match' => '#.*maps.google.[^/]*/(maps)?\\?([a-zA-Z0-9\\.\\,\\;\\_\\-\\&\\%\\=\\+/]+).*#', 'url' => $httpstr . '://maps.google.com/maps?$2&output=embed', 'type' => 'iframe'), array('match' => '#.*google.[^/]*/maps/place/([^/]+)/@([0-9\\-\\.]+),([0-9\\-\\.]+),([0-9]+)z/data=.+!1s([0-9xa-f]+):([0-9xa-f]+).*#', 'url' => function ($m) {
         $zoomlevel = min(max($m[4], 3), 21);
         $height = 188 * pow(2, 21 - $zoomlevel);
         return "https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d{$height}!2d{$m[3]}!3d{$m[2]}!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s{$m[5]}%3A{$m[6]}!2s{$m[1]}!5e0";
     }, 'type' => 'iframe'), array('match' => '#.*mapsengine.google.com[^/]*/map/[^?]*\\?([a-zA-Z0-9\\.\\,\\;\\_\\-\\&\\%\\=\\+\\?/]+).*#', 'url' => $httpstr . '://mapsengine.google.com/map/embed?$1', 'type' => 'iframe'), array('match' => '#.*www.google.com[^/]*/maps\\?([a-zA-Z0-9\\.\\,\\;\\_\\-\\&\\%\\=\\+\\!/]+).*#', 'url' => $httpstr . '://www.google.com/maps?$1&output=embed', 'type' => 'iframe'), array('match' => '#.*www.google.com[^/]*/maps/embed\\?([a-zA-Z0-9\\.\\,\\;\\_\\-\\&\\%\\=\\+\\!/]+).*#', 'url' => 'https://www.google.com/maps/embed?$1', 'type' => 'iframe'), array('match' => '#.*www.google.com.*?/\\@([a-zA-Z0-9\\.\\-]+)\\,([a-zA-Z0-9\\.\\-]+)\\,([0-9]+).*#', 'url' => 'https://maps.google.com/maps?ll=$1,$2&z=$3&output=embed', 'type' => 'iframe'), array('match' => '#.*books.google.[^/]*/books.*id=([a-zA-Z0-9\\_\\-\\&\\%\\=]+).*#', 'url' => 'http://books.google.com/books?id=$1', 'type' => 'iframe'), array('match' => '#http([a-zA-Z0-9\\.\\,\\;\\_\\-\\&\\%\\=\\+/\\:]+)\\.(pdf|tif|tiff|ppt|doc|docx)#', 'url' => $httpstr . '://docs.google.com/gview?url=http$1.$2&embedded=true', 'type' => 'iframe'));
     foreach ($embedsources as $source) {
         $url = htmlspecialchars_decode($url);
         // convert &amp; back to &, etc.
         if (preg_match($source['match'], $url)) {
             if (is_string($source['url'])) {
                 $apps_url = preg_replace($source['match'], $source['url'], $url);
             } else {
                 if (is_callable($source['url'])) {
                     $apps_url = preg_replace_callback($source['match'], $source['url'], $url);
                 }
             }
             // For correctly embed Google maps...
             $apps_url = str_replace('source=embed', 'output=embed', $apps_url);
             $apps_type = $source['type'];
             return array('url' => $apps_url, 'type' => $apps_type);
         }
     }
     // if we reach here then mahara does not understand the url
     return array('url' => $url, 'type' => false);
 }
Пример #5
0
 /**
  * Gets a standard form of a link for lookups.
  *
  * @param   mixed    A link string or array of request variables.
  *
  * @return  mixed  A link in standard option-view-layout form, or false if the supplied response is invalid.
  */
 public static function getLinkKey($request)
 {
     if (empty($request)) {
         return false;
     }
     // Check if the link is in the form of index.php?...
     if (is_string($request)) {
         $args = array();
         if (strpos($request, 'index.php') === 0) {
             parse_str(parse_url(htmlspecialchars_decode($request), PHP_URL_QUERY), $args);
         } else {
             parse_str($request, $args);
         }
         $request = $args;
     }
     // Only take the option, view and layout parts.
     foreach ($request as $name => $value) {
         if (!in_array($name, self::$_filter) && !($name == 'task' && !array_key_exists('view', $request))) {
             // Remove the variables we want to ignore.
             unset($request[$name]);
         }
     }
     ksort($request);
     return 'index.php?' . http_build_query($request, '', '&');
 }
Пример #6
0
 public function fieldsFormValidate($rid = 0)
 {
     global $_GPC;
     if (empty($_GPC['title'])) {
         return '必须填写有效的回复内容.';
     }
     foreach ($_GPC['title'] as $k => $v) {
         $row = array();
         $row['title'] = $v;
         $row['url'] = $_GPC['url'][$k];
         $row['hqurl'] = $_GPC['hqurl'][$k];
         $row['description'] = $_GPC['description'][$k];
         $this->replies[] = $row;
     }
     if (empty($this->replies)) {
         return '必须填写有效的回复内容.';
     }
     foreach ($this->replies as &$r) {
         if (trim($r['title']) == '' || trim($r['url']) == '' && trim($r['hqurl']) == '') {
             return '必须填写有效的回复内容.';
         }
         $r['description'] = htmlspecialchars_decode($r['description']);
     }
     return '';
 }
 /**
  * Do the PHP redirect
  */
 public function do_redirects()
 {
     // Check if PHP redirects are enabled.
     if (false == $this->is_php_redirects_enabled()) {
         return;
     }
     // Load redirects.
     $redirects = $this->get_redirects();
     // Do the actual redirect.
     if (!empty($redirects)) {
         // Decode the URL.
         $url = htmlspecialchars_decode(urldecode($_SERVER['REQUEST_URI']));
         foreach ($redirects as $regex => $redirect) {
             // Check if the URL matches the $regex.
             if (1 === @preg_match("`{$regex}`", $url, $this->url_matches)) {
                 // Replace the $regex vars with URL matches.
                 $redirect_url = preg_replace_callback('/[\\$0-9]+/', array($this, 'format_redirect_url'), $redirect['url']);
                 if ('/' === substr($redirect_url, 0, 1)) {
                     $redirect_url = home_url($redirect_url);
                 }
                 // Do the redirect.
                 wp_redirect($redirect_url, $redirect['type']);
                 exit;
             }
             // Reset url_matches.
             $this->url_matches = array();
         }
     }
 }
Пример #8
0
function bb_syntax_highlight($match)
{
    global $bb_syntax_matches;
    $i = intval($match[1]);
    $match = $bb_syntax_matches[$i];
    $language = strtolower(trim($match[1]));
    $line = trim($match[2]);
    $escaped = trim($match[3]);
    $code = bb_syntax_code_trim($match[4]);
    //if ($escaped == "true") $code = htmlspecialchars_decode($code);
    $code = htmlspecialchars_decode($code);
    //$code = str_replace("&lt;", "<", $code);
    //$code = str_replace("&gt;", ">", $code);
    $geshi = new GeSHi($code, $language);
    $geshi->enable_keyword_links(false);
    do_action_ref_array('bb_syntax_init_geshi', array(&$geshi));
    $output = "\n<div class=\"bb_syntax\">";
    if ($line) {
        $output .= "<table><tr><td class=\"line_numbers\">";
        $output .= bb_syntax_line_numbers($code, $line);
        $output .= "</td><td class=\"code\">";
        $output .= $geshi->parse_code();
        $output .= "</td></tr></table>";
    } else {
        $output .= "<div class=\"code\">";
        $output .= $geshi->parse_code();
        $output .= "</div>";
    }
    $output .= "</div>\n";
    return $output;
}
Пример #9
0
 public static function replaceIdxByData($var)
 {
     $data = RTEData::get('data', intval($var[1]));
     if (isset($data['type'])) {
         if (isset($data['wikitextIdx'])) {
             $data['wikitext'] = RTEData::get('wikitext', $data['wikitextIdx']);
             // macbre: correctly handle and unmark entities inside links wikitext (RT #38844)
             $data['wikitext'] = htmlspecialchars_decode($data['wikitext']);
             $data['wikitext'] = RTEParser::unmarkEntities($data['wikitext']);
             unset($data['wikitextIdx']);
             if (strpos($data['wikitext'], '_rte_wikitextidx') !== false) {
                 RTE::$edgeCases[] = 'COMPLEX.01';
             } else {
                 if (strpos($data['wikitext'], '_rte_dataidx') !== false) {
                     RTE::$edgeCases[] = 'COMPLEX.02';
                 } else {
                     if ($data['type'] == 'double-brackets') {
                         if (strrpos($data['wikitext'], '{{') !== 0 && strpos($data['wikitext'], '{{') !== strlen($data['wikitext']) - 2) {
                             RTE::$edgeCases[] = 'COMPLEX.03';
                         }
                     } else {
                         if (strpos($data['wikitext'], "") !== false) {
                             RTE::$edgeCases[] = 'COMPLEX.07';
                         }
                     }
                 }
             }
         }
     }
     return self::convertDataToAttributes($data);
 }
Пример #10
0
 public function getCondition()
 {
     $data = array();
     if (isset($this->input['sort_id'])) {
         $data['sort_id'] = trim($this->input['sort_id']);
     }
     if (isset($this->input['id'])) {
         $data['id'] = trim($this->input['id']);
     }
     if (isset($this->input['subject'])) {
         $data['subject'] = trim(htmlspecialchars_decode(urldecode($this->input['subject'])));
     }
     if (isset($this->input['content'])) {
         $data['content'] = trim(htmlspecialchars_decode(urldecode($this->input['content'])));
     }
     /*
     if(isset($this->input['source_url']))
     {
     	$data['source_url'] = trim(htmlspecialchars_decode(urldecode($this->input['source_url'])));
     }
     if(isset($this->input['source_id']))
     {
     	$data['source_id'] = trim($this->input['source_id']);
     }
     if(isset($this->input['comtent']))
     {
     	$data['comtent'] = trim(htmlspecialchars_decode(urldecode($this->input['comtent'])));
     }
     */
     return $data;
 }
Пример #11
0
 public function index()
 {
     $this->page();
     $flag = false;
     if (isset($_GET['sid'])) {
         $this->tpl->assign('oneNav', $this->model->findOne());
         $this->tpl->assign('prev_url', PREV_URL);
         $flag = true;
     }
     $this->tpl->assign('flag', $flag);
     $allNav = $this->model->findAll();
     if ($flag) {
         $allBrands = $this->brand->getAll();
         foreach ($allNav as $key => $value) {
             if (!empty($value->brand)) {
                 $value->brand = unserialize(htmlspecialchars_decode($value->brand));
             }
             if (Validate::isArray($value->brand)) {
                 $temp = $value->brand;
                 $value->brand = '';
                 foreach ($temp as $val) {
                     foreach ($allBrands as $k => $v) {
                         if ($val == $v->id) {
                             $value->brand[$k] = $v->name;
                         }
                     }
                 }
             }
             $value->brand = Validate::isArray($value->brand) ? implode(',', $value->brand) : '其他品牌';
         }
     }
     $this->tpl->assign('allNav', $allNav);
     $this->tpl->display(ADMIN_STYLE . 'nav/show.tpl');
 }
Пример #12
0
 public function shortcode($atts, $content = null)
 {
     extract(shortcode_atts(array('fullwidth' => 'true', 'height' => '500', 'src' => '', 'margin_top' => '0', 'margin_bottom' => '0'), $atts));
     $fullwidth = apply_filters('dt_sanitize_flag', $fullwidth);
     $margin_top = intval($margin_top);
     $margin_bottom = intval($margin_bottom);
     $height = absint($height);
     $height = $height ? $height : 500;
     if (!$src && !$content) {
         return '';
     }
     $classes = array('map-container');
     if ($fullwidth) {
         $classes[] = 'full';
     }
     $style = array('margin-top: ' . $margin_top . 'px', 'margin-bottom: ' . $margin_bottom . 'px');
     $style = implode(';', $style);
     $classes = implode(' ', $classes);
     if (!$src && $content) {
         if (preg_match('/iframe/', $content)) {
             $content = str_replace(array('&#8221;', '&#8243;'), '"', $content);
             preg_match('/src=(["\'])(.*?)\\1/', htmlspecialchars_decode($content), $match);
             if (!empty($match[2])) {
                 $src = $match[2];
             } else {
                 return '';
             }
         } else {
             $src = $content;
         }
     }
     $src = add_query_arg('output', 'embed', remove_query_arg('output', $src));
     $output = '<div class="' . esc_attr($classes) . '" style="' . esc_attr($style) . '"><iframe src="' . esc_url($src) . '" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="500" height="' . $height . '"></iframe></div>';
     return $output;
 }
Пример #13
0
 function linkbackUrl($url)
 {
     $orig = $url;
     $url = htmlspecialchars_decode($orig);
     $scheme = parse_url($url, PHP_URL_SCHEME);
     if (!in_array($scheme, array('http', 'https'))) {
         return $orig;
     }
     // XXX: Do a HEAD first to save some time/bandwidth
     $fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
     $result = $fetcher->get($url, array('User-Agent: ' . $this->userAgent(), 'Accept: application/html+xml,text/html'));
     if (!in_array($result->status, array('200', '206'))) {
         return $orig;
     }
     $pb = null;
     $tb = null;
     if (array_key_exists('X-Pingback', $result->headers)) {
         $pb = $result->headers['X-Pingback'];
     } else {
         if (preg_match('/<link rel="pingback" href="([^"]+)" ?/?>/', $result->body, $match)) {
             $pb = $match[1];
         }
     }
     $tb = $this->getTrackback($result->body, $result->final_url);
     if (!empty($tb)) {
         $this->trackback($result->final_url, $tb);
     } else {
         if (!empty($pb)) {
             $this->pingback($result->final_url, $pb);
         }
     }
     return $orig;
 }
Пример #14
0
/**
 * Heading Option
 *
 * @access public
 * @since 1.0.0
 *
 * @param array $value
 * @param array $settings
 * @param int $int
 *
 * @return string
 */
function option_tree_heading($value, $settings, $int)
{
    echo $int > 1 ? '</div>' : false;
    echo '<div id="option_' . $value->item_id . '" class="block">';
    echo '<h2>' . htmlspecialchars_decode($value->item_title) . '</h2>';
    echo '<input type="hidden" name="' . $value->item_id . '" value="' . htmlspecialchars_decode($value->item_title) . '" />';
}
Пример #15
0
 /**
  *详情介绍
  */
 public function getAjaxDesc()
 {
     $id = I('post.id');
     $goods = M('goods');
     $data = $goods->where('id=' . $id)->field('goods_desc')->find();
     echo htmlspecialchars_decode($data['goods_desc']);
 }
Пример #16
0
 public function doWebPost()
 {
     global $_GPC, $_W;
     $id = intval($_GPC['id']);
     if (!empty($id)) {
         $item = pdo_fetch("SELECT * FROM " . tablename($this->headtable) . " WHERE id = :id", array(':id' => $id));
         if (empty($item)) {
             message('抱歉,楼盘不存在或是已经删除!', '', 'error');
         }
     }
     if (checksubmit('submit')) {
         if (empty($_GPC['title'])) {
             message('请输入商户名称!');
         }
         $data = array('weid' => $_W['weid'], 'title' => $_GPC['title'], 'buildingintro' => htmlspecialchars_decode($_GPC['buildingintro']), 'traffic' => $_GPC['traffic'], 'projectintro' => $_GPC['projectintro'], 'phone' => $_GPC['phone'], 'province' => $_GPC['resideprovince'], 'city' => $_GPC['residecity'], 'dist' => $_GPC['residedist'], 'address' => $_GPC['address'], 'lng' => $_GPC['lng'], 'lat' => $_GPC['lat'], 'createtime' => TIMESTAMP);
         if (!empty($_FILES['thumb']['tmp_name'])) {
             file_delete($_GPC['thumb_old']);
             $upload = file_upload($_FILES['thumb']);
             if (is_error($upload)) {
                 message($upload['message'], '', 'error');
             }
             $data['thumb'] = $upload['path'];
         }
         if (empty($id)) {
             pdo_insert($this->headtable, $data);
         } else {
             unset($data['createtime']);
             pdo_update($this->headtable, $data, array('id' => $id));
         }
         message('商户信息更新成功!', create_url('site/module/display', array('name' => 'lxybuilding')), 'success');
     }
     include $this->template('post');
 }
Пример #17
0
function wp_mail_bank_configure($phpmailer)
{
    global $wpdb;
    $data = $wpdb->get_row("SELECT * FROM " . wp_mail_bank());
    $mail_type = $data->mailer_type;
    $phpmailer->Mailer = $data->mailer_type == 0 ? "smtp" : "mail";
    $phpmailer->FromName = stripslashes(htmlspecialchars_decode($data->from_name, ENT_QUOTES));
    $phpmailer->From = $data->from_email;
    $phpmailer->Sender = $data->return_path == 0 ? $data->return_email : $data->from_email;
    $phpmailer->WordWrap = $data->word_wrap;
    $phpmailer->SMTPOptions = array('ssl' => array('verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true));
    if ($data->mailer_type == 0) {
        switch ($data->encryption) {
            case 0:
                $phpmailer->SMTPSecure = "";
                break;
            case 1:
                $phpmailer->SMTPSecure = "ssl";
                break;
            case 2:
                $phpmailer->SMTPSecure = "tls";
                break;
        }
        $phpmailer->Host = $data->smtp_host;
        $phpmailer->Port = $data->smtp_port;
        if ($data->smtp_keep_alive == 1) {
            $phpmailer->SMTPKeepAlive = TRUE;
        }
        if ($data->authentication == 1) {
            $phpmailer->SMTPAuth = TRUE;
            $phpmailer->Username = $data->smtp_username;
            $phpmailer->Password = $data->smtp_password;
        }
    }
}
Пример #18
0
 /**
  * 我的兑换 do_personal_index
  */
 public function do_personal_index()
 {
     /* 初始化变量 */
     $user_id = I('get.user_id');
     $page_num = I('get.page_num');
     $page_num = empty($page_num) || $page_num < 0 ? 1 : $page_num;
     /* 查询条件 */
     $field = 'pay_order.trade_no,pay_order.shop_coupon_info,pay_order.shop_id,pay_order.trade_state,shop.title as shop_title';
     $where['pay_order.user_id'] = array('EQ', $user_id);
     $where['pay_order.display'] = array('EQ', 1);
     $order = 'pay_order.id desc';
     /* 查询数据 */
     $list = $this->alias('pay_order')->field($field)->where($where)->join('LEFT JOIN __SHOP__ shop on pay_order.shop_id = shop.id')->order($order)->limit(C('PAGE_NUM'))->page($page_num)->select();
     foreach ($list as $k => $v) {
         $shop_coupon_info = json_decode($v['shop_coupon_info'], true);
         $list[$k]['coupon_id'] = $shop_coupon_info['id'];
         $list[$k]['coupon_title'] = $shop_coupon_info['title'];
         if ($shop_coupon_info['coupon_type'] == 1) {
             $list[$k]['coupon_tag'] = strval(0);
         } else {
             $list[$k]['coupon_tag'] = $shop_coupon_info['coupon_worth'];
         }
         $list[$k]['coupon_content'] = $shop_coupon_info['content'];
         unset($list[$k]['shop_coupon_info']);
         /* 过滤数据 */
         if (!empty($v['coupon_title'])) {
             $list[$k]['coupon_title'] = htmlspecialchars_decode($v['coupon_title']);
         }
     }
     /* 读取json */
     $list = empty($list) ? array() : $list;
     $jsonInfo['list'] = arr_content_replace($list);
     return $jsonInfo;
 }
Пример #19
0
 protected function _prepareTable(&$table)
 {
     jimport('joomla.filter.output');
     $date = JFactory::getDate();
     $user = JFactory::getUser();
     $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES);
 }
Пример #20
0
 public function saveSort($data = array())
 {
     $sort_arr = json_decode(htmlspecialchars_decode($data['sort_string']));
     foreach ($sort_arr as $key => $id) {
         $query = $this->db->query("update aa_certificates set sort='" . $key . "' where id='" . $id . "'");
     }
 }
Пример #21
0
 /**
  * Meta box view
  *
  * @return    string
  *
  * @access    public
  * @since     1.0
  */
 function build_meta_box($post, $metabox)
 {
     echo '<div class="ot-metabox-wrapper">';
     /* Use nonce for verification */
     echo '<input type="hidden" name="' . $this->meta_box['id'] . '_nonce" value="' . wp_create_nonce($this->meta_box['id']) . '" />';
     /* meta box description */
     echo isset($this->meta_box['desc']) && !empty($this->meta_box['desc']) ? '<div class="description" style="padding-top:10px;">' . htmlspecialchars_decode($this->meta_box['desc']) . '</div>' : '';
     /* loop through meta box fields */
     foreach ($this->meta_box['fields'] as $field) {
         /* get current post meta data */
         $field_value = get_post_meta($post->ID, $field['id'], true);
         /* set standard value */
         if (isset($field['std'])) {
             $field_value = ot_filter_std_value($field_value, $field['std']);
         }
         /* build the arguments array */
         $_args = array('type' => $field['type'], 'field_id' => $field['id'], 'field_name' => $field['id'], 'field_value' => $field_value, 'field_desc' => isset($field['desc']) ? $field['desc'] : '', 'field_std' => isset($field['std']) ? $field['std'] : '', 'field_rows' => isset($field['rows']) && !empty($field['rows']) ? $field['rows'] : 10, 'field_post_type' => isset($field['post_type']) && !empty($field['post_type']) ? $field['post_type'] : 'post', 'field_taxonomy' => isset($field['taxonomy']) && !empty($field['taxonomy']) ? $field['taxonomy'] : 'category', 'field_min_max_step' => isset($field['min_max_step']) && !empty($field['min_max_step']) ? $field['min_max_step'] : '0,100,1', 'field_class' => isset($field['class']) ? $field['class'] : '', 'field_choices' => isset($field['choices']) ? $field['choices'] : array(), 'field_settings' => isset($field['settings']) && !empty($field['settings']) ? $field['settings'] : array(), 'post_id' => $post->ID, 'meta' => true);
         /* only allow simple textarea due to DOM issues with wp_editor() */
         if ($_args['type'] == 'textarea') {
             $_args['type'] = 'textarea-simple';
         }
         /* option label */
         echo '<div class="format-settings">';
         /* don't show title with textblocks */
         if ($_args['type'] != 'textblock' && !empty($field['label'])) {
             echo '<div class="format-setting-label">';
             echo '<label for="' . $_args['field_id'] . '" class="label">' . $field['label'] . '</label>';
             echo '</div>';
         }
         /* get the option HTML */
         echo ot_display_by_type($_args);
         echo '</div>';
     }
     echo '</div>';
 }
Пример #22
0
 function call_order($lng, $para, $filename = 'order', $outHTML = null)
 {
     $para = $this->fun->array_getvalue($para);
     $lngpack = $lng ? $lng : $this->CON['is_lancode'];
     $lng = $lng == 'big5' ? $this->CON['is_lancode'] : $lng;
     include admin_ROOT . 'datacache/' . $lng . '_pack.php';
     $cartid = $this->fun->eccode($this->fun->accept('ecisp_order_list', 'C'), 'DECODE', db_pscode);
     $cartid = stripslashes(htmlspecialchars_decode($cartid));
     $uncartid = !empty($cartid) ? unserialize($cartid) : null;
     $total = $this->fun->eccode($this->fun->accept('ecisp_order_productmoney', 'C'), 'DECODE', db_pscode);
     $total = empty($total) ? 0 : $total;
     $buylink = $this->get_link('order', array(), $lngpack);
     $this->pagetemplate->assign('lngpack', $LANPACK);
     $this->pagetemplate->assign('buylink', $buylink);
     $this->pagetemplate->assign('ordertotal', number_format($total, 2));
     $this->pagetemplate->assign('total', $total);
     $this->pagetemplate->assign('uncartid', count($uncartid));
     $this->pagetemplate->assign('cartid', $cartid);
     if (!empty($outHTML)) {
         $output = $this->pagetemplate->fetch(null, null, $outHTML);
     } else {
         $output = $this->pagetemplate->fetch($lng . '/lib/' . $filename);
     }
     return $output;
 }
Пример #23
0
/**
 * Color Scheme
 *
 * @since Lambda 2.0
 *
 * @param array $value
 * @param array $settings
 * @param int $int
 *
 * @return string
 */
function option_tree_color_scheme($value, $settings, $int)
{
    ?>
  <div class="option">
    
	<div class="lambda-opttitle">
        <div class="lambda-opttitle-pad">
		<?php 
    echo htmlspecialchars_decode($value->item_title);
    ?>
		<span class="infoButton right">
				<img class="infoImage" src="<?php 
    echo OT_PLUGIN_URL;
    ?>
/assets/images/info.png" width="40px" height="20px" alt="Info" style="left: 0px;">
		</span>  
        </div>
    </div>   
    <div class="section">
        
        <fieldset id="choosecolor">
		<?php 
    global $theme_path;
    $count = 1;
    foreach (recognized_color_schemes() as $key => $singlecolor) {
        $checked = '';
        if ($settings[$value->item_id] == $singlecolor) {
            $checked = ' checked="checked"';
        }
        if ($key == 'Custom' && $value->item_id . '_' . $count == 'color_scheme_1') {
            $singlecolor = get_option_tree('themecolor');
            $singlecolor = $singlecolor['hex'];
            $checked = ' checked="checked"';
        }
        $datascheme = str_replace(' ', '', $key);
        echo '<div class="color-scheme-box" data-scheme="' . trim(strtolower($datascheme)) . '">
					  <input class="check-with-label" name="' . $value->item_id . '" id="' . $value->item_id . '_' . $count . '" type="radio" value="' . $singlecolor . '"' . $checked . ' />
					  <label class="label-for-color" for="' . $value->item_id . '_' . $count . '"><div class="color color_scheme_' . $count . '" style="background-color: ' . $singlecolor . ';"><img src="' . $theme_path . '/lambda/assets/images/colorlayer.png"></div></label>
					  <span class="colorbadge">' . $key . '</span>
					  </div>';
        $count++;
    }
    ?>
		</fieldset>
		
      	<?php 
    if ($value->item_desc) {
        ?>
        <div class="desc alert alert-neutral"><?php 
        echo htmlspecialchars_decode($value->item_desc);
        ?>
</div>
	    <div class="clear"></div>
      <?php 
    }
    ?>
    </div>
  </div>
<?php 
}
Пример #24
0
function fa_cache_avatar($avatar, $id_or_email, $size, $default, $alt)
{
    $avatar = str_replace(array("www.gravatar.com", "0.gravatar.com", "1.gravatar.com", "2.gravatar.com"), "cn.gravatar.com", $avatar);
    $tmp = strpos($avatar, 'http');
    $url = get_avatar_url($id_or_email, $size);
    $url = str_replace(array("www.gravatar.com", "0.gravatar.com", "1.gravatar.com", "2.gravatar.com"), "cn.gravatar.com", $url);
    $avatar2x = get_avatar_url($id_or_email, $size * 2);
    $avatar2x = str_replace(array("www.gravatar.com", "0.gravatar.com", "1.gravatar.com", "2.gravatar.com"), "cn.gravatar.com", $avatar2x);
    $g = substr($avatar, $tmp, strpos($avatar, "'", $tmp) - $tmp);
    $tmp = strpos($g, 'avatar/') + 7;
    $f = substr($g, $tmp, strpos($g, "?", $tmp) - $tmp);
    $w = home_url();
    $e = ABSPATH . 'avatar/' . $size . '*' . $f . '.jpg';
    $e2x = ABSPATH . 'avatar/' . $size * 2 . '*' . $f . '.jpg';
    $t = 1209600;
    if ((!is_file($e) || time() - filemtime($e) > $t) && (!is_file($e2x) || time() - filemtime($e2x) > $t)) {
        copy(htmlspecialchars_decode($g), $e);
        copy(htmlspecialchars_decode($avatar2x), $e2x);
    } else {
        $avatar = $w . '/avatar/' . $size . '*' . $f . '.jpg';
        $avatar2x = $w . '/avatar/' . $size * 2 . '*' . $f . '.jpg';
        if (filesize($e) < 1000) {
            copy($w . '/avatar/default.jpg', $e);
        }
        if (filesize($e2x) < 1000) {
            copy($w . '/avatar/default.jpg', $e2x);
        }
        $avatar = "<img alt='{$alt}' src='{$avatar}' srcset='{$avatar2x}' class='avatar avatar-{$size} photo' height='{$size}' width='{$size}' />";
    }
    return $avatar;
}
Пример #25
0
function output_char($text)
{
    if (empty($text)) {
        return $text;
    }
    return stripslashes(htmlspecialchars_decode($text, ENT_QUOTES));
}
Пример #26
0
 /**
  * Overloaded check function
  *
  * @return	boolean
  * @see		JTable::check
  * @since	1.5
  */
 function check()
 {
     jimport('joomla.filter.output');
     // Set name
     $this->name = htmlspecialchars_decode($this->name, ENT_QUOTES);
     // Set alias
     $this->alias = JApplication::stringURLSafe($this->alias);
     if (empty($this->alias)) {
         $this->alias = JApplication::stringURLSafe($this->name);
     }
     // Check the publish down date is not earlier than publish up.
     if (intval($this->publish_down) > 0 && $this->publish_down < $this->publish_up) {
         // Swap the dates.
         $temp = $this->publish_up;
         $this->publish_up = $this->publish_down;
         $this->publish_down = $temp;
     }
     // Set ordering
     if ($this->state < 0) {
         // Set ordering to 0 if state is archived or trashed
         $this->ordering = 0;
     } else {
         if (empty($this->ordering)) {
             // Set ordering to last if ordering was 0
             $this->ordering = self::getNextOrder('`catid`=' . $this->_db->Quote($this->catid) . ' AND state>=0');
         }
     }
     return true;
 }
Пример #27
0
 public static function load_field()
 {
     check_ajax_referer('frm_ajax', 'nonce');
     $fields = $_POST['field'];
     if (empty($fields)) {
         wp_die();
     }
     $_GET['page'] = 'formidable';
     $fields = stripslashes_deep($fields);
     $ajax = true;
     $values = array('id' => FrmAppHelper::get_post_param('form_id', '', 'absint'));
     $path = FrmAppHelper::plugin_path();
     $field_html = array();
     foreach ($fields as $field) {
         $field = htmlspecialchars_decode(nl2br($field));
         $field = json_decode($field, true);
         if (!isset($field['id'])) {
             // this field may have already been loaded
             continue;
         }
         $field_id = absint($field['id']);
         if (!isset($field['value'])) {
             $field['value'] = '';
         }
         $field_name = 'item_meta[' . $field_id . ']';
         $html_id = FrmFieldsHelper::get_html_id($field);
         ob_start();
         include $path . '/classes/views/frm-forms/add_field.php';
         $field_html[$field_id] = ob_get_contents();
         ob_end_clean();
     }
     unset($path);
     echo json_encode($field_html);
     wp_die();
 }
Пример #28
0
 public function update()
 {
     if (empty($this->input['id'])) {
         $this->errorOutput('ID不能为空');
     }
     if (empty($this->input['name'])) {
         $this->errorOutput('分类名称不能为空');
     }
     $info = array('title' => $this->input['name'], 'color' => $this->input['color'], 'log' => htmlspecialchars_decode(urldecode($this->input['log'])), 'status' => $this->input['status']);
     $info['log'] = json_decode($info['log'], 1);
     if ($info['log'][0]['id'] > 0) {
         $info['log'] = array('id' => $info['log'][0]['id'], 'host' => $info['log'][0]['host'], 'dir' => $info['log'][0]['dir'], 'filepath' => $info['log'][0]['filepath'], 'filename' => $info['log'][0]['filename']);
     } else {
         $info['log'] = array('id' => $info['log']['id'], 'host' => $info['log']['host'], 'dir' => $info['log']['dir'], 'filepath' => $info['log']['filepath'], 'filename' => $info['log']['filename']);
     }
     $info['log'] = json_encode($info['log']);
     $sql = "UPDATE " . DB_PREFIX . "group SET ";
     $space = '';
     foreach ($info as $k => $v) {
         $sql .= $space . $k . "='" . $v . "'";
         $space = ',';
     }
     $sql .= " WHERE id=" . intval($this->input['id']);
     $this->db->query($sql);
     $info['id'] = intval($this->input['id']);
     $this->addLogs('修改路况分类', $info, '', $info['title']);
     $this->addItem($info);
     $this->output();
 }
Пример #29
0
 /**
  * This method prepares the received data and call the addFont method of the fontManager
  * @return boolean true on success
  */
 private function addFont()
 {
     $this->log = "";
     $error = false;
     $files = array("pdf_metric_file", "pdf_font_file");
     foreach ($files as $k) {
         // handle uploaded file
         $uploadFile = new UploadFile($k);
         if (isset($_FILES[$k]) && $uploadFile->confirm_upload()) {
             $uploadFile->final_move(basename($_FILES[$k]['name']));
             $uploadFileNames[$k] = $uploadFile->get_upload_path(basename($_FILES[$k]['name']));
         } else {
             $this->log = translate('ERR_PDF_NO_UPLOAD', "Configurator");
             $error = true;
         }
     }
     if (!$error) {
         require_once 'include/Sugarpdf/FontManager.php';
         $fontManager = new FontManager();
         $error = $fontManager->addFont($uploadFileNames["pdf_font_file"], $uploadFileNames["pdf_metric_file"], $_REQUEST['pdf_embedded'], $_REQUEST['pdf_encoding_table'], array(), htmlspecialchars_decode($_REQUEST['pdf_cidinfo'], ENT_QUOTES), $_REQUEST['pdf_style_list']);
         $this->log .= $fontManager->log;
         if ($error) {
             $this->log .= implode("\n", $fontManager->errors);
         }
     }
     return $error;
 }
Пример #30
-3
 /**
  * Функция для отправки писем в UTF-8
  * @param $dataMail - массив с данными
  * <code>
  * array(
  * nameFrom => имя отправителя
  * emailFrom => email отправителя
  * nameTo => имя получателя
  * emailTo => email получателя
  * dataCharset => кодировка переданных данных
  * sendCharset => кодировка письма
  * subject => тема письма
  * body => текст письма
  * html => письмо в виде html или обычного текста
  * addheaders => дополнительные заголовки
  * contentType => если нужен особенный contentType
  * ); 
  * </code>
  * @return bool
  */
 public static function sendMimeMail($dataMail)
 {
     $m = new Mail();
     // можно сразу указать кодировку, можно ничего не указывать ($m= new Mail;)
     $m->From(htmlspecialchars_decode($dataMail['nameFrom']) . "||" . $dataMail['emailFrom']);
     // от кого Можно использовать имя, отделяется точкой с запятой
     if (MG::getSetting('smtp') === "true") {
         $m->smtp_on(MG::getSetting('smtpHost'), MG::getSetting('smtpLogin'), MG::getSetting('smtpPass'), MG::getSetting('smtpPort'), 10);
         // используя эу команду отправка пойдет через smtp
         $m->From($dataMail['nameFrom'] . "||" . MG::getSetting('smtpLogin'));
     }
     $m->ReplyTo(htmlspecialchars_decode(self::$replyTo));
     // куда ответить, тоже можно указать имя
     $m->To($dataMail['nameTo'] . "||" . $dataMail['emailTo']);
     // кому, в этом поле так же разрешено указывать имя
     $dataMail['subject'] = htmlspecialchars_decode($dataMail['subject']);
     $m->Subject($dataMail['subject']);
     if (!empty($dataMail['html'])) {
         $m->Body($dataMail['body'], "html");
     } else {
         $m->Body($dataMail['body']);
     }
     $m->Priority(4);
     // установка приоритета
     //$m->Attach( "/toto.gif", "", "image/gif" ) ;	// прикрепленный файл типа image/gif. типа файла указывать не обязательно
     $m->log_on(true);
     // включаем лог, чтобы посмотреть служебную информацию
     $m->Send();
     // отправка
     self::$replyTo = null;
     //  echo "Письмо отправлено, вот исходный текст письма:<br><pre>", $m->Get(), "</pre>";
     // exit();
 }