function nattywp_validate_options($input)
{
    $valid_input = array();
    $settings_output = nattywp_get_settings();
    $options = $settings_output['nattywp_page_fields'];
    $nattywp_option_name = $settings_output['nattywp_option_name'];
    $settings_group = $settings_output['page_option_name'];
    $input = $input[$settings_group];
    $valid_input[$settings_group] = $valid_input;
    $merged_options = get_option($nattywp_option_name);
    foreach ($options as $option) {
        if (isset($option['filter'])) {
            switch ($option['filter']) {
                case 'multi':
                    if (isset($input[$option['name']])) {
                        $valid_input[$settings_group][$option['name']] = $input[$option['name']];
                    } else {
                        $valid_input[$settings_group][$option['name']] = $option['default'];
                    }
                    break;
                case 'nohtml':
                    $valid_input[$settings_group][$option['name']] = sanitize_text_field($input[$option['name']]);
                    $valid_input[$settings_group][$option['name']] = strip_html_tags($valid_input[$settings_group][$option['name']]);
                    $valid_input[$settings_group][$option['name']] = addslashes($valid_input[$settings_group][$option['name']]);
                    break;
                case 'url':
                    $input[$option['name']] = trim($input[$option['name']]);
                    // trim whitespace
                    $valid_input[$settings_group][$option['name']] = esc_url_raw($input[$option['name']]);
                    break;
                case 'num':
                    $input[$option['name']] = trim($input[$option['name']]);
                    // trim whitespace
                    $valid_input[$settings_group][$option['name']] = is_numeric($input[$option['name']]) ? $input[$option['name']] : $option['default'];
                    // register error
                    if (is_numeric($input[$option['name']]) == FALSE) {
                        add_settings_error($option['name'], 'nattywp_txt_numeric_error', __('Expecting a Numeric value! Please fix.', 'silesia'), 'error');
                    }
                    break;
                default:
                    $valid_input[$settings_group][$option['name']] = $input[$option['name']];
                    break;
            }
        } else {
            $valid_input[$settings_group][$option['name']] = $input[$option['name']];
        }
    }
    if (!is_array($merged_options)) {
        $merged_options = array();
    }
    return array_merge($merged_options, $valid_input);
}
function strip_html_message($message)
{
    preg_match('@<meta\\s+http-equiv="Content-Type"\\s+content="([\\w/]+)(;\\s+charset=([^\\s"]+))?@i', $message, $matches);
    $encoding = $matches[3];
    /* Convert to UTF-8 before doing anything else */
    $utf8_text = iconv($encoding, "utf-8", $message);
    /* Strip HTML tags and invisible text */
    $utf8_text = strip_html_tags($utf8_text);
    /* Decode HTML entities */
    $utf8_text = html_entity_decode($utf8_text, ENT_QUOTES, "UTF-8");
    return $utf8_text;
}
Exemple #3
0
 public function mass_send()
 {
     $group_id = $this->input->post('groupid', true);
     $list = $this->db->where('log_id', 0)->order_by('id desc')->get('wx_mass_list')->result_array();
     $default_thumb_file = realpath('../public/uploads/weixin/thumb.jpg');
     $default_thumb_result = $this->M_weixin->upload_media($default_thumb_file, 'image');
     $default_thumb_media_id = $default_thumb_result['media_id'];
     $news_json = '{"articles": [';
     $data = array();
     foreach ($list as $row) {
         $news = $this->db->from('news as n')->join('news_data d', 'd.news_id=n.id')->where('n.id', $row['news_id'])->get()->row_array();
         if ($news) {
             if ($news['thumb'] && $news['thumb_ext'] == '.jpg') {
                 $thumb_file = realpath('../public/uploads/thumb/' . $news['thumb']);
                 $result = $this->M_weixin->upload_media($thumb_file, 'image');
                 $thumb_media_id = $result['media_id'];
             } else {
                 $thumb_media_id = $default_thumb_media_id;
             }
             //$thumb_media_id = $media ? $media : $this->weixin_config['thumb_media_id'];
             $content = htmlspecialchars_decode($news['content']);
             $content = str_replace('src="/', 'src="' . $this->app_path, $content);
             //$content = addslashes($content);
             $content = strip_html_tags(array('style', 'class', 'alt'), $content);
             $content = str_replace("\"", "'", $content);
             $news_json .= '{
                         "thumb_media_id":"' . $thumb_media_id . '",
                         "author":"",
                         "title":"' . $news['title'] . '",
                         "content_source_url":"' . $this->app_path . 'news/' . $news['id'] . '",
                         "digest":"' . $news['description'] . '",
                         "show_cover_pic":"0",
                         "content":"' . $content . '"
                     },';
             $data[] = array('thumb_media_id' => $thumb_media_id, 'id' => $news['id'], 'title' => $news['title']);
         }
     }
     $news_json = rtrim($news_json, ',');
     $news_json .= ']}';
     $data = serialize($data);
     $news_result = $this->M_weixin->upload_news($news_json);
     if ($media_id = $news_result['media_id']) {
         $mass_result = $this->M_weixin->send_mass_by_groupid($group_id, $media_id);
         //$mass_result['errcode']=0;
         if ($mass_result['errcode'] == 0) {
             $insert['data'] = $data;
             $insert['msg_id'] = $mass_result['msg_id'];
             $insert['media_id'] = $media_id;
             $insert['group_id'] = $group_id;
             $this->db->insert('wx_mass_logs', $insert);
             //$log_id = $this->db->insert_id();
             //$this->db->where('log_id',0)->update('wx_mass_list', array('log_id',$log_id));
             $this->db->empty_table('wx_mass_list');
             $json = array('status' => 'success', 'msg' => '群发成功!', 'url' => ADMINURL . 'weixin/mass_log');
         } else {
             $json = array('status' => 'error', 'msg' => $mass_result['errmsg'], 'type' => 'send_mass');
         }
     } else {
         $json = array('status' => 'error', 'msg' => $news_result['errmsg'], 'type' => 'upload_news');
     }
     echo json_encode($json);
 }
Exemple #4
0
function sql_quote($value, $toStrip = true)
{
    $value = str_replace('<x>', '', $value);
    if ($toStrip) {
        $value = strip_html_tags($value);
    }
    if (get_magic_quotes_gpc()) {
        $value = stripslashes($value);
    }
    //检查该函数是否存在
    $value = addslashes($value);
    return $value;
}
Exemple #5
0
 private function multipartMessage($htmlpart, $boundary)
 {
     if ($this->altBody == "") {
         $this->altBody = strip_html_tags($htmlpart);
     }
     $altBoundary = $this->generateBoundary();
     ob_start();
     //Turn on output buffering
     $parts = "This is a multi-part message in MIME format." . $this->newline . $this->newline;
     $parts .= "--" . $boundary . $this->newline;
     $parts .= "Content-Type: multipart/alternative;" . $this->newline;
     $parts .= "    boundary=\"{$altBoundary}\"" . $this->newline . $this->newline;
     $parts .= "--" . $altBoundary . $this->newline;
     $parts .= "Content-Type: text/plain; charset={$this->charset}" . $this->newline;
     $parts .= "Content-Transfer-Encoding: {$this->transferEncodeing}" . $this->newline . $this->newline;
     $parts .= $this->altBody . $this->newline . $this->newline;
     $parts .= "--" . $altBoundary . $this->newline;
     $parts .= "Content-Type: text/html; charset={$this->charset}" . $this->newline;
     $parts .= "Content-Transfer-Encoding: {$this->transferEncodeing}" . $this->newline . $this->newline;
     $parts .= $htmlpart . $this->newline . $this->newline;
     $parts .= "--" . $altBoundary . "--" . $this->newline . $this->newline;
     if (count($this->attachments) > 0) {
         for ($i = 0; $i < count($this->attachments); $i++) {
             $attachment = chunk_split(base64_encode(file_get_contents($this->attachments[$i])));
             $filename = basename($this->attachments[$i]);
             $ext = pathinfo($filename, PATHINFO_EXTENSION);
             $parts .= "--" . $boundary . $this->newline;
             $parts .= "Content-Type: application/{$ext}; name=\"{$filename}\"" . $this->newline;
             $parts .= "Content-Transfer-Encoding: base64" . $this->newline;
             $parts .= "Content-Disposition: attachment; filename=\"{$filename}\"" . $this->newline . $this->newline;
             $parts .= $attachment . $this->newline;
         }
     }
     $parts .= "--" . $boundary . "--";
     $message = ob_get_clean();
     //Turn off output buffering
     return $parts;
 }
function getremotecontent($url)
{
    global $CFG;
    $plagiarismsettings = (array) get_config('plagiarism');
    $file_size = $plagiarismsettings['crot_max_file_size'];
    // analyze the extension (type) of the resource
    // TODO it would be better to define type by the content marker in the stream
    $splittedurl = parse_url($url);
    $path = $splittedurl["path"];
    $path_parts = pathinfo($path);
    $tmpdir = $CFG->dataroot . '/temp';
    $tmpfilename = $tmpdir . "/remove.me";
    if (!isset($path_parts['extension'])) {
        $path_parts['extension'] = '';
    }
    // set user agent to trick some web sites
    ini_set('user_agent', 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.5.2');
    switch (strtolower($path_parts['extension'])) {
        case "doc":
            // download and save;
            $infile = @file_get_contents($url, FILE_BINARY);
            if (strlen($infile) > 0) {
                file_put_contents($tmpfilename, $infile, FILE_BINARY);
                //check if file size is too large then don't download it
                //TODO adjust max size in settings
                if (filesize($tmpfilename) < $file_size) {
                    $result = html_entity_decode(doc2text($tmpfilename), null, 'UTF-8');
                } else {
                    echo "\nFile {$url} was not dowloaded because of its large size\n";
                    $result = "the file is  too large";
                }
                unlink($tmpfilename);
            } else {
                $result = "can't read TEXT from the remote MS-Word file located at " . $url;
            }
            return $result;
        case "docx":
            // download and save;
            $infile = @file_get_contents($url, FILE_BINARY);
            file_put_contents($tmpfilename, $infile, FILE_BINARY);
            $result = getTextFromZippedXML($tmpfilename, "word/document.xml");
            unlink($tmpfilename);
            return $result;
        case "txt":
            return file_get_contents($url);
        case "java":
            return file_get_contents($url);
        case "cpp":
            return file_get_contents($url);
        case "c":
            return file_get_contents($url);
        case "pdf":
            return pdf2text($url);
        case "ppt":
            return ppt2text($url);
        default:
            // assuming it is html file
            $idt = 0;
            $text2 = file_get_contents($url);
            while (empty($text2) && $idt < 3) {
                $idt++;
                echo "\nTrying to download {$url}. Attempt {$idt}\n";
                $text2 = file_get_contents($url);
            }
            preg_match('@<meta\\s+http-equiv="Content-Type"\\s+content="([\\w/]+)(;\\s+charset=([^\\s"]+))?@i', $text2, $matches);
            if (isset($matches[1])) {
                $mime = $matches[1];
            }
            if (isset($matches[3])) {
                $charset = $matches[3];
            } else {
                $charset = mb_detect_encoding($text2);
                $text2 = "Unknown Encoding! You might need to check the direct link" . $text2;
            }
            $text2 = str_replace("<br>", "\n", $text2);
            $text2 = str_replace("<br >", "\n", $text2);
            $text2 = str_replace("<br/>", "\n", $text2);
            $text2 = strip_html_tags($text2);
            $text2 = @iconv($charset, "utf-8", $text2);
            return $text2;
    }
    // get it and put in to temporary file
    // send to to tokenizer
}
<?php

//$html=file_get_contents("http://www.amazon.ca/gp/product/B00SGS7ZH4/ref=s9_acss_bw_hsb_LaptopsS_s2_n?pf_rd_m=A3DWYIK6Y9EEQB&pf_rd_s=merchandised-search-2&pf_rd_r=1S72BA42K5E9DADAAC62&pf_rd_t=101&pf_rd_p=2253690442&pf_rd_i=677252011");
//$var1=preg_replace('/<script\b[^>]*>(.*?)<\/script>/is', "", $html);
//$var1=preg_replace('/<style\b[^>]*>(.*?)<\/style>/is', "", $var1);
//$var1=preg_replace('/<meta\b[^>]*>(.?)<\/meta>/is', "", $var1);
$var1 = file_get_contents($_POST["url"]);
function strip_html_tags($text)
{
    $text = preg_replace(array('@<head[^>]*?>.*?</head>@siu', '@<style[^>]*?>.*?</style>@siu', '@<script[^>]*?.*?</script>@siu', '@<object[^>]*?.*?</object>@siu', '@<embed[^>]*?.*?</embed>@siu', '@<applet[^>]*?.*?</applet>@siu', '@<noframes[^>]*?.*?</noframes>@siu', '@<noscript[^>]*?.*?</noscript>@siu', '@<noembed[^>]*?.*?</noembed>@siu', '@</?((address)|(blockquote)|(center)|(del))@iu', '@</?((div)|(h[1-9])|(ins)|(isindex)|(p)|(pre))@iu', '@</?((dir)|(dl)|(dt)|(dd)|(li)|(menu)|(ol)|(ul))@iu', '@</?((table)|(th)|(td)|(caption))@iu', '@</?((form)|(button)|(fieldset)|(legend)|(input))@iu', '@</?((label)|(select)|(optgroup)|(option)|(textarea))@iu', '@</?((frameset)|(frame)|(iframe))@iu'), array(' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', "\n\$0", "\n\$0", "\n\$0", "\n\$0", "\n\$0", "\n\$0", "\n\$0", "\n\$0"), $text);
    return strip_tags($text);
}
echo strip_html_tags($var1);
Exemple #8
0
function getUriContents($sUri)
{
    $sExt = array_pop(explode(".", $sUri));
    if ($sExt == "pdf") {
        $sContents = pdf2txt($sUri);
    } else {
        $sContents = file_get_contents($sUri);
    }
    $sContents = strip_html_tags($sContents);
    $sContents = preg_replace(array("/(\r\n)|(\n|\r)/", "/(\n){3,}/", "/(?<=.)(\n)(?=.)/", "/\\|}/"), array("\n", "\n\n", " ", "!"), $sContents);
    return nl2br($sContents);
}
Exemple #9
0
<?php

require_once "../includes/functions.php";
session_start();
if (isset($_POST['contact'])) {
    $contactname = strip_html_tags($_POST['contactname']);
    $contactemail = strip_html_tags($_POST['contactemail']);
    $contactcontent = strip_html_tags($_POST['contactcontent']);
    if ($_POST['answer'] != $_SESSION['answer']) {
        $captchamsg = "<span class='error'>Wrong answer. Try again.</span>";
    }
    if (!filter_var($contactemail, FILTER_VALIDATE_EMAIL)) {
        $emailerror = "<span class='error'>Please enter a valid email</span><br />";
    }
    if ($contactname == "") {
        $errorname = "<span class='error'>Please enter your name</span><br />";
    }
    if ($contactcontent == "") {
        $errorcontent = "<span class='error'>Dude, you gotta write something</span><br />";
    }
    if ($_POST['answer'] == $_SESSION['answer'] && filter_var($contactemail, FILTER_VALIDATE_EMAIL) && $contactname != "" && $contactcontent != "") {
        $captchamsg = "";
        $email = "*****@*****.**";
        $subject = $contactname . " wants to talk to you! It's from SVY dot com";
        $message = $contactcontent;
        $headers = "From: Samvyoung noreply@samvyoung.com\r\n";
        $headres = "Reply-To: " . $contactname . " <" . $contactemail . ">\r\n";
        $headers .= "MIME-Version: 1.0\r\n";
        $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
        mail($email, $subject, $message, $headers);
        header("Location: contact.php?success=true");
function curl_loadLink($url, $default_date, $default_description, $default_language, $default_title, $default_site_name)
{
    global $logService;
    global $error;
    global $ds;
    global $root;
    global $host;
    if (empty($approved)) {
        $approved = 0;
    }
    $parsed = parse_url($url);
    $host = $parsed['host'];
    if (!$root) {
        $root = $host;
    }
    $session = curl_init($url);
    // indicates that we want the response back rather than just returning a "TRUE" string
    curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($session, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($session, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($session, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($session, CURLOPT_HEADER, false);
    curl_setopt($session, CURLOPT_TIMEOUT, 60);
    curl_setopt($session, CURLOPT_ENCODING, "");
    //curl_setopt ($session, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.104 Safari/537.36");
    $header = array();
    $header[] = 'Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5';
    $header[] = 'Connection: keep-alive';
    $header[] = 'Keep-Alive: 300';
    /*$header[] = 'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7';
    $header[] = 'Accept-Language: en-us,en;q=0.5';
     */
    //curl_setopt($session, CURLOPT_HTTPHEADER,$header)
    // execute GET and get the session backs
    $t = microtime(TRUE) * 1000000;
    $logService->log('TRACE LINK URL', 'CURL GET START', $url, '');
    $html = curl_exec($session);
    $logService->log('TRACE LINK URL', 'CURL GET STOP(' . number_format(microtime(TRUE) * 1000000 - $t) . 'mks)', '', '');
    curl_close($session);
    if (!$html) {
        $error = "FAILED TO LOAD document: " . $url;
        return false;
    }
    if (stripos($url, 'novayagazeta') === FALSE && stripos($url, 'sotnik') === FALSE && stripos($url, 'ej.ru') === FALSE && stripos($url, 'newtimes') === FALSE) {
        $html = @mb_convert_encoding($html, 'HTML-ENTITIES', 'utf-8');
    }
    $body = strip_html_tags($html);
    /*$file = fopen("body.html", "w") or die("Unable to open file!");
      fwrite($file, $body);
      fclose($file);*/
    $logService->log('TRACE ', 'Stripped html', $content, '');
    libxml_use_internal_errors(true);
    // Yeah if you are so worried about using @ with warnings
    $dom = new DomDocument();
    /*$st=mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8');
      if($dom->loadHTML($st)===FALSE){
          $error="FAILED TO PARSE document: ".$url;
          return false;
      }*/
    $encodingHint = '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">';
    if (stripos($html, 'Windows-1251') === FALSE && stripos($url, 'ej.ru') === FALSE) {
        $html = $encodingHint . $html;
    }
    if ($dom->loadHTML($html) === FALSE) {
        $error = "FAILED TO PARSE document: " . $url;
        return false;
    }
    $dom->preserveWhiteSpace = false;
    $updated_time = '';
    $modified_time = '';
    $image = '';
    $title = '';
    $link = '';
    $site_name = $root;
    $lang = '';
    $description = '';
    $twitter_image = '';
    $i = 0;
    $metas = $dom->getElementsByTagName('meta');
    $countMetas = sizeof($metas);
    $author = '';
    $locale = '';
    $sailthru_date = '';
    $dcterms_date = '';
    $basic_date = '';
    $basic_publish_date = '';
    //politico
    $date = '';
    $dcterms_created = '';
    $dcterms_modified = '';
    $noconvert = false;
    $noconvertPublished = false;
    $pdate = 0;
    $basic_description = '';
    $published_time = '';
    foreach ($metas as $tag) {
        // $logService->log('DEBUG','meta',var_log($tag),'crawler');
        $property = $tag->getAttribute('property');
        $name = $tag->getAttribute('name');
        $content = $tag->getAttribute('content');
        $http_equiv = $tag->getAttribute('http-equiv');
        //$logService->log('TRACE LINK ','metas',var_log($property,'$property').';'.var_log($name,'$name').';'.var_log($content,'$content'),'blah');
        if ($property === 'og:image') {
            $image = $content;
            // $logService->log('DEBUG','1 og:image=',$image,'crawler');
            $parsed = parse_url($image);
            if (!array_key_exists('host', $parsed)) {
                $image = "http://" . $host . $image;
            }
            if (!is_available($image)) {
                $image = "";
            }
            //$logService->log('DEBUG','og:image=',$image,'crawler');
            continue;
        }
        if ($property === 'og:title') {
            $title = $content;
            $metafound = true;
            continue;
        }
        if ($property === 'twitter:title') {
            if (!$title) {
                $title = $content;
            }
            $metafound = true;
            continue;
        }
        if ($property === 'og:url') {
            $link = $content;
            $metafound = true;
            $parsed = parse_url($link);
            if (!array_key_exists('host', $parsed)) {
                $link = "http://" . $host . $link;
            }
            continue;
        }
        if ($property === 'og:site_name') {
            $site_name = $content;
            continue;
        }
        if ($property === 'og:locale') {
            $locale = $content;
            //$logService->log('DEBUG','og:locale=',$locale,'crawler');
            continue;
        }
        if ($property === 'og:description') {
            $description = $content;
            continue;
        }
        if ($property === 'twitter:description') {
            if (!$description) {
                $description = $content;
            }
            continue;
        }
        if ($property === 'og:date') {
            //CNN, Thank you!
            $date = $content;
            continue;
        }
        if ($property === 'og:pubdate') {
            //CNN, Thank you!
            $date = $content;
            continue;
        }
        if ($name === 'og:image') {
            //espreso.tv
            $image = $content;
            $parsed = parse_url($image);
            if (!array_key_exists('host', $parsed)) {
                $image = "http://" . $host . $image;
            }
            if (!is_available($image)) {
                $image = "";
            }
            continue;
        }
        if ($name === 'og:title') {
            $title = $content;
            $metafound = true;
            continue;
        }
        if ($name === 'sailthru.title') {
            if (!$title) {
                $title = $content;
            }
            $metafound = true;
            continue;
        }
        if ($name === 'og:url') {
            $link = $content;
            $metafound = true;
            $parsed = parse_url($link);
            if (!array_key_exists('host', $parsed)) {
                $link = "http://" . $host . $link;
            }
            continue;
        }
        if ($name === 'og:site_name') {
            $site_name = $content;
            continue;
        }
        if ($name === 'og:locale') {
            $locale = $content;
            continue;
        }
        if (strcasecmp($name, 'language') == 0) {
            $lang = $content;
            continue;
        }
        if ($name === 'og:description') {
            $description = $content;
            continue;
        }
        if ($name === 'og:date') {
            $date = $content;
            continue;
        }
        if ($name === 'og:pubdate') {
            $date = $content;
            continue;
        }
        if ($name === 'twitter:image:src') {
            $twiter_image = $content;
            if (!is_available($twiter_image)) {
                $twiter_image = "";
            }
            continue;
        }
        if ($name === 'sailthru.date') {
            $sailthru_date = $content;
            continue;
        }
        if ($name === 'sailthru.author') {
            $author = $content;
            continue;
        }
        if ($name === 'dcterms.date') {
            $dcterms_date = $content;
            continue;
        }
        if ($name === 'dcterms.created') {
            $dcterms_created = $content;
            continue;
        }
        if ($name === 'dcterms.modified') {
            $dcterms_modified = $content;
            continue;
        }
        if ($name === 'date') {
            $basic_date = $content;
            continue;
        }
        if ($name === 'publish_date') {
            //Politico TODO If no time zone, add utc
            $basic_publish_date = $content;
            //.' utc';
            continue;
        }
        if ($name === 'lastmod') {
            $basic_date = $content;
            continue;
        }
        if ($name === 'author') {
            $author = $content;
            continue;
        }
        if ($name === 'pdate') {
            $year = substr($content, 0, 4);
            $mo = substr($content, 4, 2);
            $day = substr($content, 6, 2);
            $pdate = $year . '-' . $mo . '-' . $day;
            continue;
        }
        if ($name === 'dat') {
            //NYTimes!
            $basic_date = $dat;
            //"May 12, 2015"
            continue;
        }
        if (strcasecmp($name, 'description') == 0) {
            //Ej, Mark Steyn - all caps - Sotnik
            $basic_description = $content;
            //
            $metafound = true;
            continue;
        }
        if ($property === 'article:published_time') {
            $published_time = $content;
            // $logService->log('DEBUG','Published time raw',$published_time,'crawler');
            continue;
        }
        if ($property === 'article:modified_time') {
            $updated_time = $content;
            // $logService->log('DEBUG','Updated time raw',$updated_time,'crawler');
            continue;
        }
        if ($http_equiv === 'Last-Modified') {
            //censor.net.ua
            $updated_time = $content;
        }
        if (strcasecmp($http_equiv, 'Content-Language') == 0) {
            $lang = $content;
        }
    }
    // $logService->log('DEBUG','inside-after metas',$url,'crawler');
    // if($metafound){
    /*  $logService->log('cDEBUG','Meta found url='.$url,'Updated time'.$updated_time.';Published time='.$published_time
        .';date='.$date.';title='.$title.';image='.$image.';description='.$description
        ,'','crawler');*/
    /* if(!$title){
         $logService->log('CDEBUG','NO TITLE url='.$url,'Updated time'.$updated_time.';Published time='.$published_time
               .';date='.$date.';title='.$title.';image='.$image.';description='.$description
               ,'','crawler');         
           $titletags=$dom->getElementsByTagName('title'); // mark steyn
           foreach ( $titletags as $titletag) {
                $logService->log('CDEBUG','TITLE tag='.$titletag->textContent,'Updated time'.$updated_time.';Published time='.$published_time
               .';date='.$date.';title='.$title.';image='.$image.';description='.$description
               ,'','crawler');          
               $title=$titletag->textContent;
           }
       }*/
    if ($lang && !$locale) {
        $locale = $lang . '_' . $lang;
    }
    //$logService->log('DEBUG','inside-after metas 001',$url,'crawler');
    if (!$locale && !$lang) {
        $locale = "en_US";
        $lang = "en";
        /*      $re = "/(?:<html|(?<!^)\\G)\\h*(?:([^=\\n\\h]+)=(['\"]+)((?:\\\\\\2|(?!\\2).)*)\\2+)?/mi"; 
                 $logService->log('DEBUG','inside-after metas 0100',$url,'crawler');
                  ini_set("pcre.backtrack_limit",10000);
                  $logService->log('DEBUG','inside-after metas 0110',$url,'crawler');
                 preg_match_all($re,$html,$matches,PREG_SET_ORDER);
                 $logService->log('DEBUG','inside-after metas 0101',$url,'crawler');
                 foreach((array)$matches as $match){
                    if(sizeof($match)<3)
                        continue;
                    $t=$match[1];
                    if($t=='lang'||$t=='xml:lang'){
                        $lang=$match[3];
                        break;
                    }
                 }
                 $logService->log('DEBUG','inside-after metas 002',$url,'crawler');
                 $locale=str_replace('-', '_', $lang);
                 if(strlen($locale)==2)
                    $locale=$locale.'_'.strtoupper($locale);
                //$lang=substr($lang,0,2);
                */
    }
    if (!$link) {
        $link = $url;
    }
    $text = "";
    // $logService->log('DEBUG','inside-after metas 0',$url,'crawler');
    if (!$description) {
        $description = $basic_description;
    }
    if (empty($title)) {
        $title_tags = $dom->getElementsByTagName('title');
        //ej.ru
        if ($title_tags->length > 0) {
            //$logService->log('DEBUG','Setting title tag',$title_tag->textContent,'crawler');
            $title = $title_tags->item(0)->textContent;
        }
    }
    if (stripos($title, 'steyn')) {
        //yes, he is that important
        $author = 'Mark Steyn';
    }
    if (stripos($title, 'Breitbart')) {
        $author = 'Breitbart';
        if (stripos($title, 'Author')) {
            return false;
        }
        if (stripos($title, 'Stories')) {
            return false;
        }
    }
    if (stripos($title, 'derbyshire') || stripos($link, 'derbyshire')) {
        //yes, he is that important
        $author = 'John Derbyshire';
    }
    if (!$image) {
        $image = $twitter_image;
    }
    // $logService->log('DEBUG','inside-after metas 2',$url,'crawler');
    if (!$author) {
        $title_tags = $dom->getElementsByTagName('title');
        //ej.ru
        if ($title_tags->length > 0) {
            //$logService->log('DEBUG','Setting title tag',$title_tag->textContent,'crawler');
            $t = $title_tags->item(0)->textContent;
            if (stripos($t, 'The Weekly Standard')) {
                $author = 'The Weekly Standard';
            }
            if (!$image) {
                //sotnik tv
                $image_tags = $dom->getElementsByTagName('img');
                $found = false;
                foreach ($image_tags as $img) {
                    $alt = $img->getAttribute('alt');
                    if (stripos($t, $alt) !== FALSE) {
                        $image = $img->getAttribute('src');
                        $found = true;
                        break;
                    }
                }
                if ($found) {
                    $parsed = parse_url($image);
                    if (!array_key_exists('host', $parsed)) {
                        $image = "http://" . $host . $image;
                    }
                }
            }
        }
    }
    //if(/*!empty($description)&&*/!empty($title)){
    // $logService->log('DEBUG','description and image',$url,'crawler');
    $description = substr($description, 0, 1024);
    if (!$updated_time) {
        $updated_time = $date;
    }
    if (!$updated_time) {
        $updated_time = $published_time;
    }
    if (!$updated_time) {
        $updated_time = $dcterms_date;
    }
    if (!$published_time) {
        $published_time = $dcterms_date;
    }
    if (!$updated_time) {
        $updated_time = $basic_date;
    }
    if (!$published_time) {
        $published_time = $basic_date;
    }
    if (!$updated_time) {
        $updated_time = $basic_publish_date;
    }
    if (!$published_time) {
        $published_time = $basic_publish_date;
    }
    if (!$updated_time) {
        $updated_time = $dcterms_modified;
    }
    if (!$published_time) {
        $published_time = $dcterms_modified;
    }
    if (!$updated_time) {
        $updated_time = $pdate;
    }
    if (!$published_time && $pdate) {
        $published_time = $pdate;
    }
    if (!$updated_time && !empty($sailthru_date)) {
        $updated_time = $sailthru_date . " EDT";
    }
    //so far I've seen it in NRO only and being in East COast
    if (!$published_time && !empty($sailthru_date)) {
        $published_time = $sailthru_date . " EDT";
    }
    /*if(empty($updated_time)||empty($published_time)){
           $logService->log('DEBUG','Empty time url='.$url,'Updated time'.$updated_time.';Published time='.$published_time
            .';date='.$date.';dcterms_date='.$dcterms_date.';basic_publish_date='.$basic_publish_date.';basic_date='.$basic_date.';dcterms_modified='.$dcterms_modified.';pdate='.$pdate
            ,'','crawler');
      }*/
    if (!$updated_time && !empty($default_date)) {
        $updated_time = $default_date;
    }
    if (!$published_time && !empty($default_date)) {
        $published_time = $default_date;
    }
    if (!$description && !empty($default_description) && stripos($url, 'huff') === FALSE) {
        // staying away from using RSS data as defaults on Huffington Post due to their posting
        $description = $default_description;
    }
    if (!$title && !empty($default_title) && stripos($url, 'huff') === FALSE) {
        $title = $default_title;
    }
    if (!$locale && !empty($default_language)) {
        $locale = $default_language;
    }
    if (!$site_name && !empty($default_site_name)) {
        $site_name = $default_site_name;
    }
    $published_time = strtotime($published_time);
    $updated_time = strtotime($updated_time);
    if (stripos($title, 'Mark Levin')) {
        //yes, he is that important
        $author = 'Mark Levin';
    }
    if (stripos($url, 'sotnik')) {
        $author = 'SotnikTV';
    }
    /* if(empty($updated_time)||empty($published_time)){
         $logService->log('DEBUG','2 Empty time url='.$url,'Updated time'.$updated_time.';Published time='.$published_time
             .';date='.$date.';dcterms_date='.$dcterms_date.';basic_publish_date='.$basic_publish_date.';basic_date'.$basic_date.';dcterms_modified'.$dcterms_modified.';pdate'.$pdate
             ,'','crawler');
       }*/
    //  $logService->log('DEBUG','Encoding='.$dom->encoding.';Updated time',$updated_time,'crawler');
    /*if(!$locale)
      $locale="en_US";*/
    if (!$site_name) {
        $site_name = $root;
    }
    // $logService->log('DEBUG','Encoding='.  mb_detect_encoding($title).';Title',$title,'crawler');
    if (stripos($description, '&lt;') !== FALSE) {
        $description = '';
    }
    if (stripos($html, '1251') !== FALSE) {
        $title = mb_convert_encoding($title, "utf-8", "auto");
        $logService->log('DEBUG', 'After conversion Encoding=' . $dom->encoding . ';Title', $title, 'crawler');
        // $logService->log('DEBUG','ABefore conversion Encoding='.$dom->encoding.';Description',$description,'crawler');
        $description = mb_convert_encoding($description, "utf-8", "auto");
        $logService->log('DEBUG', 'After conversion Encoding=' . $dom->encoding . ';Description', $description, 'crawler');
        if (!$locale) {
            $locale = "ru_RU";
        }
    }
    if (stripos($url, 'ej.ru')) {
        $site_name = 'Ежедневный Журнал';
        $locale = "ru_RU";
    }
    if (stripos($url, 'slon.ru')) {
        $site_name = 'SLON';
        $locale = "ru_RU";
        $author = "Slon";
    }
    if (stripos($url, 'liga.net')) {
        $locale = "ru_RU";
    }
    if (stripos($url, 'zn.ua')) {
        $locale = "ru_RU";
    }
    if (stripos($url, 'liga.net/ua')) {
        $locale = "uk_UA";
    }
    if (stripos($url, 'alternet')) {
        continue;
    }
    if (stripos($url, 'dt.ua')) {
        $locale = "uk_UA";
    }
    if (stripos($url, 'obozrevatel')) {
        $locale = "ru_RU";
    }
    if (stripos($url, 'nv.ua')) {
        $locale = "ru_RU";
    }
    if (stripos($url, 'gordonua.com')) {
        $locale = "ru_RU";
    }
    if (stripos($url, 'tvrain')) {
        $locale = "ru_RU";
    }
    if (stripos($url, 'english.gordonua')) {
        $locale = "en_EN";
    }
    if (stripos($url, 'hromadske')) {
        $locale = "uk_UA";
    }
    if (stripos($url, 'telegraph')) {
        $locale = "en_EN";
    }
    if (stripos($url, 'politico') && !$locale) {
        $locale = "en_EN";
    }
    if (stripos($url, 'americanthinker')) {
        $site_name = 'American Thinker';
        $locale = "en_EN";
    }
    if (stripos($url, 'washingtonpost')) {
        $locale = "en_EN";
    }
    if (stripos($url, 'thenation')) {
        $locale = "en_EN";
    }
    if (stripos($url, 'wsj')) {
        $locale = "en_EN";
    }
    if (mb_stripos($url, 'cnn') && !$locale) {
        $locale = "en_EN";
    }
    if (mb_stripos($url, 'salon') && !$locale) {
        $locale = "en_EN";
    }
    if (mb_stripos($url, 'politico') && !$locale) {
        $locale = "en_EN";
    }
    if (mb_stripos($url, 'petrimaz') && !$locale) {
        $locale = "ru_RU";
    }
    /*if(stripos($url,'lesoir')&&!$locale){
            $locale="fr_FR";
      
        }*/
    if (!$locale && (mb_stripos($url, '.be') || mb_stripos($url, '.fr'))) {
        $locale = "fr_FR";
    }
    if (!$author && stripos($url, 'nationalreview')) {
        $site_name = 'National Review';
        $locale = "en_EN";
        $author = "National Review";
        if (stripos($title, 'author')) {
            return false;
        }
    }
    if ($locale) {
        if (stripos($locale, "en") === 0) {
            $locale = 'en_EN';
        }
    }
    if ($locale) {
        if (stripos($locale, "ru") === 0) {
            $locale = 'ru_RU';
        }
    }
    if ($locale) {
        if (stripos($locale, "uk") === 0) {
            $locale = 'uk_UA';
        }
    }
    if ($locale) {
        if (stripos($locale, "en") === 0) {
            $locale = 'en_EN';
        }
    }
    if ($author) {
        /*$logService->log('CDEBUG','AUTHOR! url='.$url,'Updated time'.$updated_time.';Published time='.$published_time
          .';date='.$date.';dcterms_date='.$dcterms_date.';basic_publish_date='.$basic_publish_date.';basic_date'.$basic_date.';dcterms_modified'.$dcterms_modified.';pdate'.$pdate
          ,'','crawler');*/
        $author_record = $ds->checkAuthor($author);
        /*$logService->log('CDEBUG','AUTHOR record='.var_log($author_record),'Updated time'.$updated_time.';Published time='.$published_time
          .';date='.$date.';dcterms_date='.$dcterms_date.';basic_publish_date='.$basic_publish_date.';basic_date'.$basic_date.';dcterms_modified'.$dcterms_modified.';pdate'.$pdate
          ,'','crawler');*/
        /*$logService->log('CDEBUG','before image='.$author_record['image'],'$image='.$image.' author='.$author.' author_record='.$author_record
          .';date='.$date.';dcterms_date='.$dcterms_date.';basic_publish_date='.$basic_publish_date.';basic_date'.$basic_date.';dcterms_modified'.$dcterms_modified.';pdate'.$pdate
          ,'','crawler');*/
        if ($author_record) {
            /*  $logService->log('CDEBUG','image='.$author_record['image'],'Updated time'.$updated_time.';Published time='.$published_time
                .';date='.$date.';dcterms_date='.$dcterms_date.';basic_publish_date='.$basic_publish_date.';basic_date'.$basic_date.';dcterms_modified'.$dcterms_modified.';pdate'.$pdate
                ,'','crawler');*/
            if ($author != "Breitbart") {
                $image = $author_record['image'];
            } else {
                if (!$image) {
                    $image = $author_record['image'];
                }
            }
        }
    }
    //last redoubt
    if (!$description) {
        $xpath = new DOMXPath($dom);
        $textnodes = $xpath->query('//text()');
        foreach ($textnodes as $node) {
            $text = $node->textContent;
            if (strlen($text) < 128) {
                continue;
            }
            if (stripos($text, 'CDATA') !== FALSE) {
                continue;
            }
            if (stripos($text, 'window.') !== FALSE) {
                continue;
            }
            if (stripos($text, 'viewport') !== FALSE) {
                continue;
            }
            if (stripos($text, 'jQuery') !== FALSE) {
                continue;
            }
            if (stripos($text, 'function') !== FALSE) {
                continue;
            }
            if (stripos($text, 'google') !== FALSE) {
                continue;
            }
            if (stripos($text, 'google') !== FALSE) {
                continue;
            }
            if (stripos($text, '!important') !== FALSE) {
                continue;
            }
            if (stripos($text, 'font') !== FALSE) {
                continue;
            }
            if (stripos($text, 'css') !== FALSE) {
                continue;
            }
            if (stripos($text, '$(') !== FALSE) {
                continue;
            }
            if (stripos($text, '==') !== FALSE) {
                continue;
            }
            if (stripos($text, '{') !== FALSE) {
                continue;
            }
            if (strcasecmp($text, $title) == 0) {
                continue;
            }
            if (strlen($text) > 128) {
                $description = $text;
                break;
            }
        }
    }
    if (!$image) {
        $xpath = new DOMXPath($dom);
        $imagenodes = $xpath->query('//img[@width>300][@height>300]');
        foreach ($imagenodes as $node) {
            $src = $node->getAttribute('src');
            $image = $src;
            break;
        }
    }
    if (!$image) {
        $logService->log('CDEBUG', 'SAVING WITH NO IMAGE time=' . $updated_time . ';Published time=' . $published_time, 'link=' . $link . ';title=' . $title . ';image=' . $image . ';site_name=' . $site_name . ';description=' . $description . ';locale=' . $locale, 'crawler');
        $image = "/build/css/logo2pale.png";
    }
    //}
    $ret = array("link" => $link, "image" => $image, "title" => $title, "description" => $description, "site_name" => $site_name, "published_time" => $published_time, "updated_time" => $updated_time, "author" => $author, "locale" => $locale, "body" => $body);
    $logService->log('CDEBUG', 'returning metas url=' . $url, var_log($ret, '$ret'), '');
    if ($author) {
        $ret["author_categoryid"] = $author_record['categoryid'];
    }
    $ret['tags'] = $dom->getElementsByTagName('a');
    return $ret;
}
Exemple #11
0
function CargarDatos($id_publicacion, $id_usuario)
{
    // HTML purifier
    require_once "PHP/HTMLPurifier.standalone.php";
    $config = HTMLPurifier_Config::createDefault();
    $config->set('HTML.Doctype', 'XHTML 1.0 Strict');
    $config->set('Filter.YouTube', true);
    $purifier = new HTMLPurifier($config);
    HTMLPurifier_Bootstrap::autoload('HTMLPurifier_Filter_YouTube');
    $id_publicacion = db_codex($id_publicacion);
    $id_usuario = db_codex($id_usuario);
    if (_F_usuario_cache('nivel') != _N_administrador) {
        $datos["tipo"] = _A_temporal;
        $datos["fecha_ini"] = mysql_datetime();
        $datos["fecha_fin"] = mysql_datetime();
    }
    $datos["id_categoria"] = _F_form_cache("id_categoria");
    // $datos["id_usuario"] = $id_usuario; // No usar.
    $datos["precio"] = _F_form_cache("precio");
    $datos["titulo"] = _F_form_cache("titulo");
    $datos["descripcion_corta"] = strip_html_tags(_F_form_cache("descripcion_corta"));
    $datos["descripcion"] = $purifier->purify(_F_form_cache("descripcion"));
    $ret = db_actualizar_datos("ventas_publicaciones", $datos, "id_publicacion='{$id_publicacion}'");
    unset($datos);
    // Tags
    // Procesamos los nuevos tags (eliminamos los espacios, las comas finales y hacemos array)
    // Nota: no evaluamos las comas finales con posibles espacios porque se eliminan con la primera pasada
    $tags = explode(",", preg_replace(array('/ */', '/^,/', '/,$/'), '$1', @$_POST['tags']), 5);
    // Eliminamos posible exploit en los tags
    $tags = db_codex($tags);
    // Insertamos los nuevos tags
    $val_tags = implode("'),('", $tags);
    db_consultar("INSERT IGNORE INTO ventas_tag (tag) VALUES('{$val_tags}')");
    // Ponemos los tags en referencia a la publicación actual
    // +Eliminados los tags de esta publicación primero+++++++++++++++++++++++++
    $val_tags = implode("','", $tags);
    $c = "DELETE FROM ventas_tag_uso WHERE id_publicacion='{$id_publicacion}'";
    $r = db_consultar($c);
    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    db_consultar("INSERT INTO ventas_tag_uso (id_tag,id_publicacion) SELECT id, {$id_publicacion} FROM ventas_tag WHERE tag IN ('{$val_tags}')");
    // Hay que eliminar los flags antes que nada.
    $c = "DELETE FROM ventas_flags_pub WHERE id_publicacion='{$id_publicacion}'";
    $r = db_consultar($c);
    $datos['id'] = NULL;
    $datos['id_publicacion'] = $id_publicacion;
    foreach (array("venta", "pago", "entrega") as $campo) {
        if (isset($_POST[$campo]) && is_array($_POST[$campo])) {
            foreach ($_POST[$campo] as $llave => $valor) {
                $datos['id_flag'] = $valor;
                $datos['tipo'] = $campo;
                db_agregar_datos("ventas_flags_pub", $datos);
            }
        }
    }
}
Exemple #12
0
$sql = "SELECT ub.blogid,ub.uid,ub.username,ub.subject,uf.message\n               FROM `uchome_blog` ub\n\t       LEFT JOIN `uchome_blogfield` uf\n               ON ub.blogid=uf.blogid\n\t       GROUP BY uid ORDER BY hot DESC,viewnum DESC\n\t       LIMIT 4";
/*$sql = "SELECT blogid,uid,username,subject 
  FROM `uchome_blog` 
  WHERE dateline>$time-86400*7 GROUP BY uid ORDER BY hot DESC,viewnum DESC 
  LIMIT 4";*/
$rs = mysql_query($sql);
$fic = fopen("export.xml", "w");
fwrite($fic, '<?xml version="1.0" encoding="utf-8" ?>');
/*fwrite($fic, '<!-- DB to XML -->');*/
/*fwrite($fic ,'<?xml version="1.0" encoding="UTF-8"?>');*/
fwrite($fic, '<xml>');
DEFINE('UC_API', "http://u.2u4u.com.cn/ucenter");
while ($row = mysql_fetch_object($rs)) {
    $photo = '';
    $photo = ckavatar($row->uid) ? avatar($row->uid, 'small', true) : UC_API . '/images/noavatar_small.gif';
    $message = csubstr(trim(strip_html_tags($row->message)));
    fwrite($fic, '<avatar>' . $photo . '</avatar>');
    fwrite($fic, '<id>' . $row->username . '</id>');
    fwrite($fic, '<title>' . $row->subject . '</title>');
    fwrite($fic, '<content>' . $message . '</content>');
    fwrite($fic, '<url>' . $discuz_url . "home/space.php?uid=" . $row->uid . '</url>');
}
fwrite($fic, '</xml>');
fclose($fic);
function avatar($uid, $size = 'small', $returnsrc = FALSE)
{
    $size = in_array($size, array('big', 'middle', 'small')) ? $size : 'small';
    $avatarfile = avatar_file($uid, $size);
    return $returnsrc ? UC_API . '/data/avatar/' . $avatarfile : '<img src="' . UC_API . '/data/avatar/' . $avatarfile . '" onerror="this.onerror=null;this.src=\'' . UC_API . '/images/noavatar_' . $size . '.gif\'">';
}
function avatar_file($uid, $size)
Exemple #13
0
        $row = $query->fetch_array(MYSQLI_ASSOC);
        $query->close();
        ?>
<title><?php 
        echo $row['title'];
        ?>
 - <?php 
        echo $setting['sitename'];
        ?>
 - <?php 
        echo $setting['slogan'];
        ?>
</title>
        <meta property="fb:admins" content="100003031501058" />
		<meta name="description" content="<?php 
        echo strip_html_tags($row['description']);
        ?>
" />        
        <meta name="title" content="Play <?php 
        echo $row['title'] . 'at ' . $setting['sitename'];
        ?>
" />
		<link rel="image_src" href="<?php 
        echo $setting['siteurl'] . $row['thumbnail'];
        ?>
" />
		<script type="text/javascript" src="<?php 
        echo $setting['siteurl'];
        ?>
includes/ratingbar/js/behavior.js"></script>
        <script type="text/javascript" src="<?php 
Exemple #14
0
echo '<div id="inner-content">';
echo '<p>';
$text = $_GET['search'];
function strip_html_tags($texto)
{
    $texto = preg_replace(array('@<head[^>]*?>.*?</head>@siu', '@<style[^>]*?>.*?</style>@siu', '@<script[^>]*?.*?</script>@siu', '@<object[^>]*?.*?</object>@siu', '@<embed[^>]*?.*?</embed>@siu', '@<applet[^>]*?.*?</applet>@siu', '@<noframes[^>]*?.*?</noframes>@siu', '@<noscript[^>]*?.*?</noscript>@siu', '@<noembed[^>]*?.*?</noembed>@siu', '@</?((address)|(blockquote)|(center)|(del))@iu', '@</?((div)|(h[1-9])|(ins)|(isindex)|(p)|(pre))@iu', '@</?((dir)|(dl)|(dt)|(dd)|(li)|(menu)|(ol)|(ul))@iu', '@</?((table)|(th)|(td)|(caption))@iu', '@</?((form)|(button)|(fieldset)|(legend)|(input))@iu', '@</?((label)|(select)|(optgroup)|(option)|(textarea))@iu', '@</?((frameset)|(frame)|(iframe))@iu'), array(' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', "\n\$0", "\n\$0", "\n\$0", "\n\$0", "\n\$0", "\n\$0", "\n\$0", "\n\$0"), $texto);
    return strip_tags($texto);
}
$con = mysqli_connect("mysql.hostinger.com.ar", "u788279437_admin", "p1p1mani", "u788279437_posts");
// Check connection
if (mysqli_connect_errno()) {
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
mysqli_set_charset($con, 'utf-8');
//$result = mysqli_query($con,"SELECT * FROM Posts WHERE Titulo LIKE '%land%' OR IdPost LIKE '%land%' OR Contenido LIKE '%land%'");//Titulo IdPost Contenido
$result = mysqli_query($con, "SELECT * FROM Posts");
while ($row = mysqli_fetch_array($result)) {
    $IdPost = $row['IdPost'];
    $content = $row['Contenido'];
    $plain_text = strip_html_tags($content);
    $pos = strripos($plain_text, $text);
    if ($pos != null) {
        $matches = array();
        preg_match('/<h2>(.+)<\\/h2>/', $content, $matches);
        echo "- <a href='{$IdPost}' class='internalLink'>" . strip_tags($matches[0]) . "</a><br/><br/>";
        //<a href='$IdPost'  class='internalLink'>$Titulo</a>
    }
}
echo '</p>';
echo '</div>';
echo '</article>';
Exemple #15
0
function RetrieveContent($url)
{
    $url = mb_convert_encoding($url, "gb2312", mb_detect_encoding($url));
    $header = get_web_page($url);
    if (NULL === $header['content'])
        return NULL;
        
    $raw_text = $header['content'];
    
    /* Get the file's character encoding from a <meta> tag */
    preg_match( '@<meta\s+http-equiv="?Content-Type"?\s+content="([\w/]+)(;\s*charset=([^\s"]+))?@i',
        $raw_text, $matches );
    $encoding = $matches[3];
    
    $utf8_text = $raw_text;
    if ($encoding !== "utf-8")
    {
        /* Convert to UTF-8 before doing anything else */
        $utf8_text = mb_convert_encoding( $raw_text, "utf-8", $encoding );
        //$utf8_text = iconv( $encoding, "utf-8", $raw_text );
    }
    
    return strip_html_tags($utf8_text);
}
            '@</?((div)|(h[1-9])|(ins)|(isindex)|(p)|(pre))@iu',
            '@</?((dir)|(dl)|(dt)|(dd)|(li)|(menu)|(ol)|(ul))@iu',
            '@</?((table)|(th)|(td)|(caption))@iu',
            '@</?((form)|(button)|(fieldset)|(legend)|(input))@iu',
            '@</?((label)|(select)|(optgroup)|(option)|(textarea))@iu',
            '@</?((frameset)|(frame)|(iframe))@iu',
        ),
        array(' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',"\n\$0", "\n\$0", "\n\$0", "\n\$0", "\n\$0", "\n\$0","\n\$0", "\n\$0",),$text);
        
    return strip_tags($text,"<html><head><body><table><tr><td>");
}

//get contents of html table from URL
$data=file_get_contents("http://www.metasploit.com/users/opcode/syscalls.html");
//strip out all tags but table and simple html
$data=strip_html_tags($data);
//strip out the NTSYSAPI ... (); function declaration details
$start=strpos($data,"NTSYSAPI");
while ($start !== false)
{
	$end=strpos($data,");",$start);
	$data=substr_replace($data,"",$start,$end-($start-1));
	$start=strpos($data,"NTSYSAPI",$end);
}

$f=fopen("SyscallLookupTable.html","w+");
fwrite($f,$data);
fclose($f);

echo "Done!";
?>
function viewtopic()
{
    global $ir, $c, $userid, $h, $bbc, $db;
    global $db;
    $precache = array();
    $q = $db->query("SELECT * FROM forum_topics WHERE ft_id={$_GET['viewtopic']}");
    $topic = $db->fetch_row($q);
    $q2 = $db->query("SELECT * FROM forum_forums WHERE ff_id={$topic['ft_forum_id']}");
    $forum = $db->fetch_row($q2);
    if ($forum['ff_auth'] == 'gang' and $ir['gang'] != $forum['ff_owner'] and $ir["user_level"] < 2 or $forum['ff_auth'] == 'staff' and $ir['user_level'] < 2) {
        print "You have no permission to view this forum.<br />\n&gt; <a href='forums.php'>Back</a>";
        $h->endpage();
        exit;
    }
    print "<big><a href='forums.php'>Forums Home</a> &gt;&gt; <a href='forums.php?viewforum={$forum['ff_id']}'>{$forum['ff_name']}</a> &gt;&gt; <a href='forums.php?viewtopic={$_GET['viewtopic']}'>{$topic['ft_name']}</a></big><br /><br />";
    $posts_per_page = 20;
    $posts_topic = $topic['ft_posts'];
    $pages = ceil($posts_topic / $posts_per_page);
    $st = $_GET['st'] ? $_GET['st'] : 0;
    if ($_GET['lastpost']) {
        $st = ($pages - 1) * 20;
    }
    $pst = -20;
    print "Pages: ";
    for ($i = 1; $i <= $pages; $i++) {
        $pst += 20;
        print "<a href='forums.php?viewtopic={$topic['ft_id']}&st={$pst}'>";
        if ($pst == $st) {
            print "<b>";
        }
        print $i;
        if ($pst == $st) {
            print "</b>";
        }
        print "</a>&nbsp;";
        if ($i % 25 == 0) {
            print "<br />";
        }
    }
    print "<br />";
    if ($ir['user_level'] > 1) {
        print "\n<form action='forums.php?act=move&amp;topic={$_GET['viewtopic']}' method='post'><b>Move topic to:</b> " . forum_dropdown($c, 'forum', -1) . "<input type='submit' STYLE='color: black;  background-color: white;' value='Move' /></form><br />\n<a href='forums.php?act=pin&topic={$_GET['viewtopic']}''><img src='images/sticky.jpg' alt='Pin/Unpin Topic' title='Pin/Unpin Topic' />Pin/Unpin Topic  </a><a href='forums.php?act=lock&topic={$_GET['viewtopic']}''><img src='images/lock.jpg' alt='Lock/Unlock Topic' title='Lock/Unlock Topic' />Lock/Unlock Topic</a><a href='forums.php?act=deletopic&topic={$_GET['viewtopic']}''><img src='images/delete.gif' alt='Delete Topic' title='Delete Topic' />Delete Topic</a><br />";
    }
    print "\n<table cellspacing='1' class='table' width='100%' border='0'>\n";
    $q3 = $db->query("SELECT * FROM forum_posts WHERE fp_topic_id={$topic['ft_id']} ORDER BY fp_time ASC LIMIT {$st}, 20");
    $no = $st;
    while ($r = $db->fetch_row($q3)) {
        $qlink = "[<a href='forums.php?act=quote&viewtopic={$_GET['viewtopic']}&quotename=" . strip_html_tags($r['fp_poster_name']) . "&quotetext=" . urlencode($r['fp_text']) . "'>Quote Post</a>]";
        if ($ir['user_level'] > 1 || $ir['userid'] == $r['fp_poster_id']) {
            $elink = "[<a href='forums.php?act=edit&post={$r['fp_id']}&topic={$_GET['viewtopic']}'>Edit Post</a>]";
        } else {
            $elink = "";
        }
        $no++;
        if ($no > 1 and $ir['user_level'] > 1) {
            $dlink = "[<a href='forums.php?act=delepost&post={$r['fp_id']}'>Delete Post</a>]";
        } else {
            $dlink = "";
        }
        $t = date('F j Y, g:i:s a', $r['fp_time']);
        if ($r['fp_edit_count'] > 0) {
            $edittext = "\n<br /><i>Last edited by <a href='viewuser.php?u={$r['fp_editor_id']}'>{$r['fp_editor_name']}</a> at " . date('F j Y, g:i:s a', $r['fp_editor_time']) . ", edited <b>{$r['fp_edit_count']}</b> times in total.</i>";
        } else {
            $edittext = "";
        }
        if (!$precache[$r['fp_poster_id']]['userid']) {
            $membq = $db->query("SELECT * FROM users WHERE userid={$r['fp_poster_id']}");
            $memb = $db->fetch_row($membq);
            $precache[$memb['userid']] = $memb;
        } else {
            $memb = $precache[$r['fp_poster_id']];
        }
        $rank = forums_rank($memb['posts']);
        if ($memb['forums_avatar']) {
            $av = "<img src='{$memb['forums_avatar']}' width='100' height='100' />";
        } else {
            $av = "<img src='noav.gif' />";
        }
        if (!$memb['forums_signature']) {
            $memb['forums_signature'] = "No Signature";
        } else {
            $memb['forums_signature'] = $bbc->bbcode_parse($memb['forums_signature']);
        }
        $r['fp_text'] = $bbc->bbcode_parse($r['fp_text']);
        print "<tr>\n<th align='center'>Post #{$no}</th> <th align='center'>Subject: {$r['fp_subject']}<br />\nPosted at: {$t} {$qlink}{$elink}{$dlink}</th>\n</tr>\n<tr>\n<td valign=top><a href='viewuser.php?u={$r['fp_poster_id']}'>{$r['fp_poster_name']}</a> [{$r['fp_poster_id']}]<br />\n{$av}<br />\nLevel: {$memb['level']}<br />\nPost Count: {$rank}<br>\nPosts:  " . $memb['posts'] . "</td>\n<td valign=top>{$r['fp_text']}\n{$edittext}<br />\n-------------------<br />\n{$memb['forums_signature']}</td>\n</tr>";
    }
    print "</table></div><div><img src='images/generalinfo_btm.jpg' alt='' /></div><br></div></div></div></div></div>";
    $pst = -20;
    print "Pages: ";
    for ($i = 1; $i <= $pages; $i++) {
        $pst += 20;
        print "<a href='forums.php?viewtopic={$topic['ft_id']}&st={$pst}'>";
        if ($pst == $st) {
            print "<b>";
        }
        print $i;
        if ($pst == $st) {
            print "</b>";
        }
        print "</a>&nbsp;";
        if ($i % 25 == 0) {
            print "<br />";
        }
    }
    if (!$topic['ft_locked']) {
        print <<<EOF
<br /><br />
<b>Post a reply to this topic:</b><br />
<form action='forums.php?reply={$topic['ft_id']}' method='post'>
<table cellspacing='1' class='table' width='80%' border='0'>
<tr>
<td align='right'>Subject:</td>
<td align='left'><input type='text' STYLE='color: black;  background-color: white;' name='fp_subject' /></td>
</tr>
<tr>
<td align='right'>Post:</td>
<td align='left'><textarea rows='7' cols='40' name='fp_text'></textarea></td>
</tr>
<tr>
<th colspan='2'><input type='submit' STYLE='color: black;  background-color: white;' value='Post Reply'></th>
</tr>
</table>
</form>
EOF;
    } else {
        print "<br /><br />\n<i>This topic has been locked, you cannot reply to it.</i>";
    }
}
$response = file_get_contents($url);
$xml = simplexml_load_string($response);
$count = $xml->searchResult[0]['count'];
echo "Number of results found: " . $count . "\n";
if ($count < 100) {
    die("Too few results: {$count} \n");
}
for ($i = 0; $i < $count; $i++) {
    $ItemID = $xml->searchResult->item[$i]->itemId;
    echo $ItemID;
    $singleitemurl = "http://open.api.ebay.com/shopping?callname=GetSingleItem&responseencoding=XML&appid=LaurensM-9ccd-4d15-8eba-9602a1a3f606&siteid=0&version=515&ItemID=" . "{$ItemID}" . "&IncludeSelector=Description,ItemSpecifics";
    $resp = file_get_contents($singleitemurl);
    $obj = new SimpleXMLElement($resp);
    $html = $obj->Item[0]->Description;
    $itemurl = $obj->Item[0]->PictureURL;
    $html = strip_html_tags($html);
    $html = replaceWhitespace($html);
    $html = preg_replace('~<\\s*\\bscript\\b[^>]*>(.*?)<\\s*\\/\\s*script\\s*>~is', '', $html);
    $body = strip_tags($html);
    #$body = "<img src=\"$itemurl\">" . "$body";
    $file = 'search.txt';
    file_put_contents($file, $body, FILE_APPEND | LOCK_EX);
    file_put_contents($keywords . $i, $body);
}
function strip_html_tags($str)
{
    $str = preg_replace('/(<|>)\\1{2}/is', '', $str);
    $str = preg_replace(array('@<head[^>]*?>.*?</head>@siu', '@<style[^>]*?>.*?</style>@siu', '@<script[^>]*?.*?</script>@siu', '@<noscript[^>]*?.*?</noscript>@siu'), "", $str);
    $str = replaceWhitespace($str);
    $str = strip_tags($str);
    return $str;
Exemple #19
0
function Index($page_id)
{
    global $db;
    $needles = array("/\\ba\\b/i", "/\\bable\\b/i", "/\\babout\\b/i", "/\\bacross\\b/i", "/\\bafter\\b/i", "/\\ball\\b/i", "/\\balmost\\b/i", "/\\balso\\b/i", "/\\bam\\b/i", "/\\bamong\\b/i", "/\\ban\\b/i", "/\\band\\b/i", "/\\bany\\b/i", "/\\bare\\b/i", "/\\bas\\b/i", "/\\bat\\b/i", "/\\bbe\\b/i", "/\\bbecause\\b/i", "/\\bbeen\\b/i", "/\\bbut\\b/i", "/\\bby\\b/i", "/\\bcan\\b/i", "/\\bcannot\\b/i", "/\\bcould\\b/i", "/\\bdear\\b/i", "/\\bdid\\b/i", "/\\bdo\\b/i", "/\\bdoes\\b/i", "/\\beither\\b/i", "/\\belse\\b/i", "/\\bever\\b/i", "/\\bevery\\b/i", "/\\bfor\\b/i", "/\\bfrom\\b/i", "/\\bget\\b/i", "/\\bgot\\b/i", "/\\bhad\\b/i", "/\\bhas\\b/i", "/\\bhave\\b/i", "/\\bhe\\b/i", "/\\bher\\b/i", "/\\bhers\\b/i", "/\\bhim\\b/i", "/\\bhis\\b/i", "/\\bhow\\b/i", "/\\bhowever\\b/i", "/\\bi\\b/i", "/\\bif\\b/i", "/\\bin\\b/i", "/\\binto\\b/i", "/\\bis\\b/i", "/\\bit\\b/i", "/\\bits\\b/i", "/\\bjust\\b/i", "/\\bleast\\b/i", "/\\blet\\b/i", "/\\blike\\b/i", "/\\blikely\\b/i", "/\\bmay\\b/i", "/\\bme\\b/i", "/\\bmight\\b/i", "/\\bmost\\b/i", "/\\bmust\\b/i", "/\\bmy\\b/i", "/\\bneither\\b/i", "/\\bno\\b/i", "/\\bnor\\b/i", "/\\bnot\\b/i", "/\\bof\\b/i", "/\\boff\\b/i", "/\\boften\\b/i", "/\\bon\\b/i", "/\\bonly\\b/i", "/\\bor\\b/i", "/\\bother\\b/i", "/\\bour\\b/i", "/\\bown\\b/i", "/\\brather\\b/i", "/\\bsaid\\b/i", "/\\bsay\\b/i", "/\\bsays\\b/i", "/\\bshe\\b/i", "/\\bshould\\b/i", "/\\bsince\\b/i", "/\\bso\\b/i", "/\\bsome\\b/i", "/\\bthan\\b/i", "/\\bthat\\b/i", "/\\bthe\\b/i", "/\\btheir\\b/i", "/\\bthem\\b/i", "/\\bthen\\b/i", "/\\bthere\\b/i", "/\\bthese\\b/i", "/\\bthey\\b/i", "/\\bthis\\b/i", "/\\btis\\b/i", "/\\bto\\b/i", "/\\btoo\\b/i", "/\\btwas\\b/i", "/\\bus\\b/i", "/\\bwants\\b/i", "/\\bwas\\b/i", "/\\bwe\\b/i", "/\\bwere\\b/i", "/\\bwhat\\b/i", "/\\bwhen\\b/i", "/\\bwhere\\b/i", "/\\bwhich\\b/i", "/\\bwhile\\b/i", "/\\bwho\\b/i", "/\\bwhom\\b/i", "/\\bwhy\\b/i", "/\\bwill\\b/i", "/\\bwith\\b/i", "/\\bwould\\b/i", "/\\byet\\b/i", "/\\byou\\b/i", "/\\byour\\b/i", "/\\bain't\\b/i", "/\\baren't\\b/i", "/\\bcan't\\b/i", "/\\bcould've\\b/i", "/\\bcouldn't\\b/i", "/\\bdidn't\\b/i", "/\\bdoesn't\\b/i", "/\\bdon't\\b/i", "/\\bhasn't\\b/i", "/\\bhe'd\\b/i", "/\\bhe'll\\b/i", "/\\bhe's\\b/i", "/\\bhow'd\\b/i", "/\\bhow'll\\b/i", "/\\bhow's\\b/i", "/\\bi'd\\b/i", "/\\bi'll\\b/i", "/\\bi'm\\b/i", "/\\bi've\\b/i", "/\\bisn't\\b/i", "/\\bit's\\b/i", "/\\bmight've\\b/i", "/\\bmightn't\\b/i", "/\\bmust've\\b/i", "/\\bmustn't\\b/i", "/\\bshan't\\b/i", "/\\bshe'd\\b/i", "/\\bshe'll\\b/i", "/\\bshe's\\b/i", "/\\bshould've\\b/i", "/\\bshouldn't\\b/i", "/\\bthat'll\\b/i", "/\\bthat's\\b/i", "/\\bthere's\\b/i", "/\\bthey'd\\b/i", "/\\bthey'll\\b/i", "/\\bthey're\\b/i", "/\\bthey've\\b/i", "/\\bwasn't\\b/i", "/\\bwe'd\\b/i", "/\\bwe'll\\b/i", "/\\bwe're\\b/i", "/\\bweren't\\b/i", "/\\bwhat'd\\b/i", "/\\bwhat's\\b/i", "/\\bwhen'd\\b/i", "/\\bwhen'll\\b/i", "/\\bwhen's\\b/i", "/\\bwhere'd\\b/i", "/\\bwhere'll\\b/i", "/\\bwhere's\\b/i", "/\\bwho'd\\b/i", "/\\bwho'll\\b/i", "/\\bwho's\\b/i", "/\\bwhy'd\\b/i", "/\\bwhy'll\\b/i", "/\\bwhy's\\b/i", "/\\bwon't\\b/i", "/\\bwould've\\b/i", "/\\bwouldn't\\b/i", "/\\byou'd\\b/i", "/\\byou'll\\b/i", "/\\byou're\\b/i", "/\\byou've\\b/i");
    $query = $db->query("SELECT contents FROM page WHERE id ={$page_id}");
    $page_contents = $query->fetchAll(PDO::FETCH_ASSOC);
    foreach ($page_contents as $row) {
        $utf8_text = strip_html_tags($row['contents']);
        $utf8_text = html_entity_decode($utf8_text, ENT_QUOTES, "UTF-8");
        $text = strip_punctuation($utf8_text);
        $text = strip_symbols($text);
        $text = strip_numbers($text);
        $text = mb_strtolower($text, "utf-8");
        $words = explode(' ', $text);
        $keywordCounts = array_count_values($words);
        arsort($keywordCounts, SORT_NUMERIC);
        $uniqueKeywords = array_keys($keywordCounts);
        $uniqueKeywords = preg_replace($needles, "", $uniqueKeywords);
        //Remove stop words
        // print_r($uniqueKeywords);
        for ($i = 0; $i < count($uniqueKeywords); $i++) {
            if ($uniqueKeywords[$i] != "") {
                $cur_word = addslashes(strtolower($uniqueKeywords[$i]));
                $query = $db->query("SELECT word_id FROM word WHERE word_word='{$cur_word}'");
                $row = $query->fetchAll();
                if ($row) {
                    if ($row[0]['word_id']) {
                        $word_id = $row[0]['word_id'];
                    }
                } else {
                    $query = $db->query("INSERT INTO word (word_word) VALUES ('{$cur_word}')");
                    $word_id = $db->lastInsertId();
                }
                $db->query("INSERT INTO occurrence (word_id,page_id) VALUES ({$word_id},{$page_id})");
            }
        }
    }
    return "Index";
}
Exemple #20
0
$sql = "SELECT ub.blogid,ub.uid,ub.username,ub.subject,uf.message\n               FROM `uchome_blog` ub\n\t       LEFT JOIN `uchome_blogfield` uf\n               ON ub.blogid=uf.blogid\n\t       WHERE dateline>{$time}-86400*7 GROUP BY uid ORDER BY hot DESC,viewnum DESC\n\t       LIMIT 4";
/*$sql = "SELECT blogid,uid,username,subject 
  FROM `uchome_blog` 
  WHERE dateline>$time-86400*7 GROUP BY uid ORDER BY hot DESC,viewnum DESC 
  LIMIT 4";*/
$rs = mysql_query($sql);
$fic = fopen("export.xml", "w");
/*fwrite($fic, '<?xml version="1.0"encoding="ISO-8859-1"?>');
fwrite($fic, '<!-- DB to XML -->');*/
fwrite($fic, '<xml>');
DEFINE('UC_API', "http://u.2u4u.com.cn/ucenter");
while ($row = mysql_fetch_object($rs)) {
    fwrite($fic, "<node>");
    $photo = '';
    $photo = ckavatar($row->uid) ? avatar($row->uid, 'small', true) : UC_API . '/images/noavatar_small.gif';
    $message = substr(trim(strip_html_tags($row->message)), 0, 50);
    fwrite($fic, '<avatar>' . $photo . '</avatar>');
    fwrite($fic, '<id>' . $row->username . '</id>');
    fwrite($fic, '<title>' . $row->subject . '</title>');
    fwrite($fic, '<content>' . $message . '</content>');
    fwrite($fic, '<url>' . $discuz_url . "home/space.php?uid=" . $row->uid . '</url>');
    fwrite($fic, '</node>');
}
fwrite($fic, '</xml>');
fclose($fic);
function avatar($uid, $size = 'small', $returnsrc = FALSE)
{
    $size = in_array($size, array('big', 'middle', 'small')) ? $size : 'small';
    $avatarfile = avatar_file($uid, $size);
    return $returnsrc ? UC_API . '/data/avatar/' . $avatarfile : '<img src="' . UC_API . '/data/avatar/' . $avatarfile . '" onerror="this.onerror=null;this.src=\'' . UC_API . '/images/noavatar_' . $size . '.gif\'">';
}
Exemple #21
0
if (isset($_POST['btnGetDetails'])) {
    $url = $_REQUEST['txtURL'];
    $result = get_web_page($url);
    if ($result['errno'] != 0) {
        echo " error: bad url, timeout, redirect loop ";
    }
    if ($result['http_code'] != 200) {
        echo "error: no page, no permissions, no service";
    }
    $page = $result['content'];
    $content_type = $result['content_type'];
    $mime = $result['mime'];
    $charset = $result['charset'];
    echo "This site is encoded with" . " " . "<b>" . $charset . "</b>" . " " . "format" . "<br>";
    $utf8_text = $result['utf8_text'];
    $text = strip_html_tags($page);
    $utf8_text = html_entity_decode($text, ENT_QUOTES, "utf-8");
    $utf8_text = strip_punctuation($utf8_text);
    $utf8_text = strip_symbols($utf8_text);
    $utf8_text = strip_numbers($utf8_text);
    mb_regex_encoding("utf-8");
    $words = mb_split(' +', $utf8_text);
    foreach ($words as $key => $word) {
        $words[$key] = PorterStemmer::Stem($word, true);
    }
    $stopWords = mb_split('[ \\n]+', mb_strtolower($words[$key], 'utf-8'));
    foreach ($stopWords as $key => $word) {
        $stopWords[$key] = PorterStemmer::Stem($word, true);
    }
    $words = array_diff($words, $stopWords);
    $keywordCounts = array_count_values($words);
Exemple #22
0
<?php

require_once "../includes/functions.php";
session_start();
// submit comment for approval
if (isset($_POST['comment_submit'])) {
    $c_name = strip_html_tags($_POST['c_name']);
    $c_email = strip_html_tags($_POST['c_email']);
    $c_website = strip_html_tags($_POST['c_website']);
    $c_date = date('Y-m-d');
    $c_content = strip_html_tags($_POST['c_content']);
    if ($_POST['answer'] == $_SESSION['answer']) {
        // $query = connect()->prepare("INSERT INTO comments (c_name, c_email, c_website, c_date, c_content, approved, postid) VALUES (:c_name, :c_email, :c_website, :c_date, :c_content, :approved, :postid)");
        // $query->execute(array(
        //         ':c_name' => $c_name,
        //         ':c_email' => $c_email,
        //         ':c_website' => $c_website,
        //         ':c_date' => $c_date,
        //         ':c_content' => $c_content,
        //         ':approved' => 0,
        //         ':postid' => $id
        //     ));
        $email = "*****@*****.**";
        $subject = $c_name . " commented on your blog";
        $message = $c_content;
        $headers = "From: Samvyoung noreply@samvyoung.com\r\n";
        $headres = "Reply-To: " . $c_name . " <" . $c_email . ">\r\n";
        $headers .= "MIME-Version: 1.0\r\n";
        $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
        // mail($email, $subject, $message, $headers);
        $commentmsg = "<div id='commentmsg'>Your submission was successful and is awaiting approval.</div>";
Exemple #23
0
/**
 * frontend_metadata
 *
 * generates page metadata such as meta tags,
 * and javascript/css links that should be contained
 * in the header. This function also has a plugin
 * filter.
 *
 * @todo manually cache css/js files added here
 * @return string of metadata
 */
function frontend_metadata($params, $smarty)
{
    $content = strip_html_tags(frontend_page_content($params, $smarty, true));
    $keywords = meta_keywords($content);
    $description = substr($content, 0, 250) . '...';
    $Template = Template::getInstance();
    $metadata = '
	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js"></script>
	<script type="text/javascript" src="' . cache_js('FURASTA_FRONTEND_MULTIDDM', '_inc/js/jquery/multi-ddm.min.js') . '"></script>
	<script type="text/javascript" src="' . cache_js('FURASTA_FRONTEND_FRONTENDJS', '_inc/js/frontend.js') . '"></script>
	<link rel="stylesheet" type="text/css" href="' . cache_css('FURASTA_FRONTEND_FRONTENDCSS', '_inc/css/frontend.css') . '"/>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<meta name="generator" content="Furasta.Org ' . VERSION . '" />
	<meta name="description" content="' . $description . '" />
	<meta name="keywords" content="' . $keywords . '" />
	<link rel="shortcut icon" href="' . SITE_URL . '_inc/img/favicon.ico" />
	<script type="text/javascript">
		window.furasta = {
			site : { 
				url : "' . SITE_URL . '",
				title : "' . $smarty->getTemplateVars('site_title') . '",
				subtitle : "' . $smarty->getTemplateVars('site_subtitle') . '"
			},
			page : {
				id : "' . $smarty->getTemplateVars('page_id') . '" ,
				name : "' . $smarty->getTemplateVars('page_name') . '" ,
				slug : "' . $smarty->getTemplateVars('page_slug') . '" ,
				parent_id : "' . $smarty->getTemplateVars('parent_id') . '"
			},
			postdata : ' . json_encode($_POST);
    if (User::verify()) {
        /**
         * @todo update this to new multiple groups
        $User = User::getInstance( );
        $metadata .= ',
        	user:{
        		id: ' . $User->id( ) . ',
        		name: "' . $User->name( ) . '",
        		group: "' . implode( '', $User->groups( ) ) . '",
        		group_name: "' . implode( $User->groupNames( ) . '"	
        	}';
        */
    }
    $metadata .= '
	};</script>';
    $Plugins = Plugins::getInstance();
    $metadata = $Plugins->filter('frontend', 'filter_metadata', $metadata);
    return $metadata;
}
Exemple #24
0
<span dir="rtl" lang="ar-SA">èaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaç aaaaaaaaaaaaaaaaaaaaaaaaç âaaaaaaaa aaaaç aaaaaaaaaaaaèaaaaaaaa aaaaaaaaçaaaa aaaaèaaaa êaaaaaaaaaaaaaaaaèaaaa 15 aaaaâêâaaaa aaaaaaaaaaaaaaaaêç</span><br>
<span dir="rtl" lang="ar-SA">êaaaaêaaaa aaaaaaaaaaaaaaaaêaaaa aaaaaaaaaaaaçaaaa aaaaâaaaaaaaaêaaaa aaaaaaaa êaaaaaaaaaaaaaaaaèaaaa aaaaaaaaaaaaaaaaaaaa aaaaê aaaaaaaaaaaaaaaaaaaaç 8:30</span><br>
<br>
Solution : <br>
<br>
<br>
<br>
<br>
Regards,<br>
Panda Customer Care<br>
<strong>Please reply to </strong><a href="mailto:customercare@panda.com.sa" target="_blank"><strong>customercare@panda.com.sa</strong></a>
</span></font></div>
</div>
</span></div>
</div>
</div>
<p><br>
</p>
</body>
</html>';
function strip_html_tags($text)
{
    $text = trim(str_ireplace('ltr', "", $text));
    $text = preg_replace(array('@<head[^>]*?>.*?</head>@siu', '@<style[^>]*?>.*?</style>@siu', '@<script[^>]*?.*?</script>@siu', '@<object[^>]*?.*?</object>@siu', '@<embed[^>]*?.*?</embed>@siu', '@<applet[^>]*?.*?</applet>@siu', '@<noframes[^>]*?.*?</noframes>@siu', '@<noscript[^>]*?.*?</noscript>@siu', '@<noembed[^>]*?.*?</noembed>@siu', '@</?((address)|(blockquote)|(center)|(del))@iu', '@</?((font)|(div)|(h[1-9])|(ins)|(isindex)|(p)|(pre)|(br))@iu', '@</?((dir)|(dl)|(dt)|(dd)|(li)|(menu)|(ol)|(ul))@iu', '@<?((color:)|(background)|(face=3D)|(font-size:12pt)|(font-size:11pt)|(=3D3)|(or=3Dblack)|(- white))@iu', '@<?((Calibri,Arial,Helvetica,sans-serif)|(#FFFFFF)|(or:#000000)|(font=-family:Calibri,Arial,Helvetica,sans-serif)|(background-color)|(style=3D)|(style)|(7px)|(target job title:b)|(boldtext)|(align)|(valign)|(cellpadding)|(cellspacing)|(width)|(bgcolor)|(border)|(top)|(bottom)|(center)|(valigntop)|(160)|(270)|(180))@iu', '@<?((table)|(th)|(td)|(tr)|(span)|(caption))@iu', '@</?((form)|(button)|(fieldset)|(legend)|(input))@iu', '@</?((label)|(select)|(optgroup)|(option)|(textarea))@iu', '@</?((frameset)|(frame)|(iframe))@iu', '@<?((IMG)|(col)|(height))@iu', '@<?((fontfamily:)|(#=FFFFFF)|(or=3Dblack)|(size==3D3)|(id=3DdivRplyFwdMsg)|(id=3DdivRplyFwdMsg)|(#000000)|(Calibri)|(sans-serif)|(- white)|(=CA)|(=E3)|(=CD)|(=E1)|(=C7)|(=E1)|(=E3)|(=D4)|(=DF)|(=E1)|(=C9)|(=ED)|(=D3)|(=C8)|(=E4)|(=C8)|(=E4)|(=EC)|(=ED)|(=C8)|(=E4)|(=EC)|(=E4)|(=ED)|(=C8)|(=EC)|(=E4)|(=ED)|(=D1)|(=CC)|(=C1)|(=DA)|(=CF)|(=D1)|(=CF))@iu'), array(' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '), $text);
    $text = trim(str_ireplace(';', "", str_ireplace('"', "", str_ireplace(':white;', "", str_ireplace('dir=3D', "", str_ireplace('dir=3Dl', "", str_ireplace('dir=3D"l;', "", str_ireplace("&nbsp;", "", str_ireplace(">", "", str_ireplace("<", "", str_ireplace("<=", "", str_ireplace('font face=3D"Calibri,Arial,Helvetica,sans-serif"', '', strip_tags($text)))))))))))));
    $text = str_ireplace(array('or=3D', 'id=3DdivRplyFwdMsg', ',', '-', 'face==3D', 'fontfamily:', '#=FFFFFF', 'class=3DdvHeaderText'), '', $text);
    $text = str_ireplace(array('  '), ' ', $text);
    return trim($text);
}
echo strip_html_tags($content);
Exemple #25
0
function stackoverflow_strip_tags($text)
{
    $tags = array('<a>', '<b>', '<blockquote>', '<code>', '<del>', '<dd>', '<dl>', '<dt>', '<em>', '<h1>', '<h2>', '<h3>', '<i>', '<img>', '<kbd>', '<li>', '<ol>', '<p>', '<pre>', '<s>', '<sup>', '<sub>', '<strong>', '<strike>', '<ul>', '<br/>', '<hr/>');
    return strip_javascript_attributes(strip_html_tags($text, $tags));
}
                        <media:keywords/>
                        <media:thumbnail url="<?php 
        echo $image;
        ?>
"/>
                    </media:group>
                    <guid isPermaLink="false"><?php 
        echo get_permalink($media_id);
        ?>
</guid>
                    <description> <![CDATA[ <img src ="<?php 
        echo $image;
        ?>
"/>
                    <?php 
        echo strip_html_tags($media->description);
        ?>
 ]]></description>
                    <pubDate><?php 
        echo $post_date;
        ?>
</pubDate>
                    <category><?php 
        echo strip_tags($media->playlist_name);
        ?>
</category>
                </item>          
    <?php 
        /** Looping through rss feed details ends */
    }
    /** Rss feed ends */