Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Relative
- $relative = '../';
- $path = $relative. 'data/other/';
- # get correct id for plugin
- $thisfile=basename(__FILE__, ".php");
- # register plugin
- register_plugin(
- $thisfile,
- 'Cumbe_guestbook',
- '4.4.2',
- 'Cumbe',
- 'http://cumbe.no-ip.biz/gs_30/libro_invitados/',
- 'Description: shown and save the publics comments of your visits.',
- 'plugins', //page type
- 'gbook'
- );
- //set internationalization
- if (basename($_SERVER['PHP_SELF']) != 'index.php') { // back end only
- i18n_merge('guestbook', $LANG);
- i18n_merge('guestbook', 'en_US');
- }
- //añadimos pestaña a sidebar de plugins
- add_action('plugins-sidebar','createSideMenu',array('guestbook',i18n_r('guestbook/GBOOK')));
- //add css to head
- add_action('theme-header','inc_css');
- function inc_css(){
- global $SITEURL;
- echo '<link href="'.$SITEURL.'plugins/guestbook/guestbook.css" rel="stylesheet">';
- }
- ///////////////////////////////////////////////
- ////// BACK END - ADMIN - PLUGINS //////////
- ///////////////////////////////////////////////
- function gbook(){
- global $i18n, $LANG;
- $log_name = 'guestbook.log';
- $log_path = GSDATAOTHERPATH.'logs/';
- $log_file = $log_path . $log_name;
- //create dir backup
- if (!is_dir($log_path.'guestbook_bak')){
- mkdir( $log_path.'guestbook_bak');
- }
- //traducción i18n
- i18n_merge('guestbook', $LANG) || i18n_merge('guestbook','en_US');
- echo '<h3 class="floated">'.strtoupper(i18n_r('guestbook/GBOOK')).'</h3>';
- echo '<div class="edit-nav" >';
- echo '<a href="load.php?id=guestbook" title="'.i18n_r('guestbook/GBOOK').'">'.i18n_r('guestbook/GBOOK').'</a>';
- echo '<a href="load.php?id=guestbook&action=backup" accesskey="b" title="'.i18n_r('guestbook/backup').'">'.i18n_r('guestbook/backup').'</a>';
- if (is_file($log_file)){
- echo '<a href="load.php?id=guestbook&action=delete" accesskey="c" title="'.$i18n['CLEAR_ALL_DATA'].' '.$log_name.'" onClick="return confirmar(this,"n","'.$i18n['CLEAR_ALL_DATA'].' '.$log_file.'. '.i18n_r('guestbook/delsure').'","log")" />'.$i18n['CLEAR_THIS_LOG'].'</a>';
- }
- echo '<div class="clear"></div>';
- echo '</div>';
- if(file_exists($log_file)) {
- ?>
- <script type="text/javascript">
- <!--
- function confirmar(formObj,count,msge,bck) {
- if(!confirm(msge)) {
- return false;
- } else {
- if (bck == 'log'){
- if (count =='n'){
- window.location="load.php?id=guestbook&action=delete";
- } else {
- window.location="load.php?id=guestbook&n_del=" + count + "";
- }
- }
- if (bck == 'back'){
- window.location="load.php?id=guestbook&action=backup&delbak=" + count + "";
- }
- return false;
- }
- }
- -->
- </script>
- <?php
- //backups
- if (@$_GET['action'] == 'backup') {
- include 'guestbook/backup.php';
- }
- if (@$_GET['action'] == 'delete' && strlen($log_name)>0) {
- //first-> backup: guestbook.log+date+time+.bak
- copy ($log_file, $log_path.'guestbook_bak/'.$log_name.'_'.date('dmy_His').'.bak');
- unlink($log_file);
- exec_action('logfile_delete');
- ?>
- <label>Log <?php echo $log_name;?> <?php echo $i18n['MSG_HAS_BEEN_CLR']; ?>
- </div>
- </div>
- <div id="sidebar" >
- <?php include('template/sidebar-plugins.php'); ?>
- </div>
- <div class="clear"></div>
- </div>
- <?php get_template('footer'); ?>
- <?php
- exit;
- }
- //Eliminamos un registro:entry
- if (@$_GET['n_del'] != ''){
- //first-> backup: guestbook_bak/guestbook.log+date+time+.bak
- copy ($log_file, $log_path.'guestbook_bak/'.$log_name.'_'.date('dmy_His').'.bak');
- $domDocument = new DomDocument();
- $domDocument->preserveWhiteSpace = FALSE;
- $domDocument->load($log_file);
- $domNodeList = $domDocument->documentElement;
- $domNodeList = $domDocument->getElementsByTagname('entry');
- $ndel = @$_GET['n_del'];
- $ndL = $domNodeList ->item($ndel)->parentNode;
- $ndL -> removeChild($domNodeList ->item($ndel));
- //grabo de nuevo el documento modificado.
- $domDocument->save($log_file);
- }
- //load data of xml
- $log_data = getXML($log_file);
- //fin eliminar registro
- if (@$_GET['action'] =='') {
- echo '<h2>'.$i18n['VIEWING'].' '.$i18n['LOG_FILE'].':‘<em>'.@$log_name.'</em>’</h2>';
- echo '<ol class="more" >';
- $count = 0;
- foreach ($log_data as $log) {
- echo '<li><p style="font-size:11px;line-height:15px;" ><b style="line-height:20px;" >'.$i18n['LOG_FILE_ENTRY'].':'.$count.'</b><a style="padding-left: 50px;" title="'.i18n_r('guestbook/ndel').'" href="load.php?id=guestbook" onClick="return confirmar(this,"'.$count.'","'.i18n_r('guestbook/ndelc').$count.'. '.i18n_r('guestbook/delsure').'","log")"><b>X</b></a><br />';
- $atrib = $log->attributes();
- echo 'Atributo Id:'.$atrib['id'].'<br />';
- foreach($log->children() as $child) {
- $name = $child->getName();
- if ($name == 'Nb' or $name == 'Cm' or $name == 'Sub' or $name == 'Ct' or $name == 'Em' ){
- echo '<b>'. i18n_r('guestbook/'.$name) .'</b>:';
- } else {
- echo '<b>'. stripslashes(ucwords($name)) .'</b>:';
- }
- $d = $log->$name;
- $n = strtolower($child->getName());
- $ip_regex = '/^(?:25[0-5]|2[0-4]d|1dd|[1-9]d|d)(?:[.](?:25[0-5]|2[0-4]d|1dd|[1-9]d|d)){3}$/';
- $url_regex = @"((https?|ftp|gopher|telnet|file|notes|ms-help):((//)|())+[wd:#@%/;$()~_?+-=.&]*)";
- //check if its an url address
- /*if (do_reg($d, $url_regex)) {
- $d = '<a href="'. $d .'" target="_blank" >'.$d.'</a>';
- }*/
- //check if its an ip address
- if (substr($name, 0 , 2) == 'ip') {
- if ($d == $_SERVER['REMOTE_ADDR']) {
- $d = $i18n['THIS_COMPUTER'].' (<a href="http://www.geobytes.com/IpLocator.htm?GetLocation&IpAddress='. $d.'" target="_blank" >'.$d.'</a>)';
- } else {
- $d = '(<a href="http://www.geobytes.com/IpLocator.htm?GetLocation&IpAddress='. $d.'" target="_blank" >'.$d.'</a>)';
- }
- } else
- //check if its an email address
- if (check_email_address($d)) {
- $d = '<a href="mailto:'.$d.'">'.$d.'</a>';
- } else
- //check if its a date
- if ($n === 'date') {
- $d = substr($d,0,strpos($d,'+')-1);
- $d = lngDate($d);
- } else {
- $d = filtrog(stripslashes(html_entity_decode($d, ENT_QUOTES, 'UTF-8')));
- }
- echo $d;
- echo ' <br />';
- } //end foreach log children
- echo "</p></li>";
- $count++;
- }
- echo '</ol>';
- } //end if action=''
- }
- else{ //If file does not exist
- echo '<label>'.$i18n['MISSING_FILE'].':‘<em><?php echo @$log_name; ?></em>’</label>';
- }
- }
- ///////////////////////////////////////////////
- ////// FRONT END system /////////
- ///////////////////////////////////////////////
- function sv_book($usu, $cada, $eleg, $capt, $vemot){
- global $EMAIL;
- global $SITEURL;
- global $i18n;
- global $LANG;
- global $PRETTYURLS;
- if (file_exists(GSDATAPATH.'users/'.$usu.'.xml')) {
- $data = getXML(GSDATAPATH.'users/'.$usu.'.xml');
- $EMAIL = $data->EMAIL;
- $LANG = $data->LANG;
- }
- //traducción idiomas i18n
- i18n_merge('guestbook', $LANG) || i18n_merge('guestbook','en_US');
- if (file_exists('gsconfig.php')) {
- include_once('gsconfig.php');
- }
- // Debugging
- if (defined('GSDEBUG')){
- error_reporting(E_ALL | E_STRICT);
- ini_set('display_errors', 1);
- } else {
- error_reporting(0);
- @ini_set('display_errors', 0);
- }
- $err = '';
- $fich=return_page_slug();
- $log_name = 'guestbook.log';
- $log_path = GSDATAOTHERPATH.'logs/';
- $log_file = $log_path . $log_name;
- if(file_exists($log_file)) {
- $log_data = getXML($log_file);
- }
- ?>
- <script type="text/javascript">
- <!--
- function Insertcom(id){
- var frm=document.getElementById(id);
- if(frm.style.display=="block"){
- frm.style.display="none";
- }
- else
- if(frm.style.display=="none"){
- frm.style.display="block";
- }
- }
- -->
- </script>
- <?php
- //reasignamos url correcta según prettyurls
- if ($PRETTYURLS =='') {
- $idpret = 'id='. $fich.'&';
- } else {
- $idpret = '';
- }
- //if captcha wrong then write form with data entered
- //Array ( [nombre] => ojk [tema] => piopi [email] => [city] => piopi [pot] => p
- //[q_count] => 1 [q_lang] => en_US [comentario] => oip
- global $mi_array;
- global $mi_arrayp;
- $mi_arrayp= array(
- "nombre" => '',
- "tema" => '',
- "email" => '',
- "city" => '',
- "comentario" => '',
- );
- if (isset($_GET['miarr'])){
- $a=stripslashes ($_GET['miarr']);
- $mi_array=unserialize($a);
- }
- //cargamos array de emoticonos
- $array_emot = emot('array','id');
- $myfile='';
- $count = 1;
- $at = 0;
- $mi='';
- $pagi=1;
- $id=1;
- if (@$_GET['pag'] != ''){ $pagi= @$_GET['pag']; }
- if(file_exists($log_file)){
- $domDocument = new DomDocument();
- $domDocument->load($log_file);
- //Creamos DOMXPath para filtrar por answ=n
- $xpath = new DOMXPath($domDocument);
- $verN = $xpath->query("entry[answ='n']");
- $num = $verN->length;
- //buscamos $id que le toca, es el parámetro que nos define el nº de comentario nuevo(answ='n') que se graba en el log.
- $verNodeU = $xpath->query("entry/Id[../answ='n']");
- $dnlLen=$verNodeU->length;
- $id= ($verNodeU->item($num - 1)->nodeValue) + 1;
- $verNodeU = $xpath->query("entry");
- $dnlLen= $verNodeU->length;
- //paginación
- if ($num/$cada > 1){
- echo '<!-- paginator --><div id="paginator">';
- echo '<span id="navigator">'.i18n_r('guestbook/Pag').'</span>';
- for ($i=1; $i<($num/$cada)+1; $i++){
- if ($i == $pagi){
- $negri='class="activ"';
- } else {
- $negri='';
- }
- $mi.= '<a '.$negri.' href="?'.$idpret.'pag='.$i.'">'.$i.'</a> '.i18n_r('guestbook/Razdel');
- }
- if ($pagi == 1){
- $pprev='';
- } else {
- $pprev = ' <a class="prev" href="?'.$idpret.'pag='.($pagi - 1).'" title="'.i18n_r('guestbook/Prever').'">'.i18n_r('guestbook/Prev').'</a> '.i18n_r('guestbook/Razdel').' ';
- }
- if ($pagi == $i - 1){
- $pnext='';
- } else {
- $pnext = ' <a class="next" href="?'.$idpret.'pag='.($pagi + 1).'" title="'.i18n_r('guestbook/Nexter').'">'.i18n_r('guestbook/Next').'</a>';
- }
- echo $pprev.$mi.$pnext.'</div><!-- end paginator -->';
- }
- //orden
- if ($eleg != 'I' && $eleg != 'D'){$eleg = 'I'; }
- if ($eleg == 'I'){
- $num = 0;
- } elseif ($eleg =='D') {
- $num= $dnlLen;
- }
- for ($q= 0; $q< $dnlLen+1; $q++){
- $verNodeU =$xpath->query("entry[answ='n' and position()=".$num."]");
- foreach($verNodeU as $node) {
- if ($count <= ($cada * $pagi) && $count > ($cada * ($pagi-1))) {
- echo '<!-- guestbook entries --><div class="gbentries">';
- $dNdList = $node->getElementsByTagName( "*" );
- $at = $node->getAttribute('id');
- foreach($dNdList as $node) {
- $name= $node->nodeName;
- $d =$node->nodeValue;
- $d = filtrog(stripslashes(html_entity_decode($d, ENT_QUOTES, 'UTF-8')));
- $n = strtolower($name);
- //check if its an email address
- if (check_email_address($d)) {
- $d = '<a href="mailto:'.$d.'">'. $d.'</a>';
- }
- //check first line
- if ($n == 'nb') {
- $lin = '<div class="gblist"><div class="entry"><span class="number">'.$count.htmlentities('', ENT_QUOTES, "UTF-8").''.i18n_r('guestbook/bkt').'</span> <span class="name"> '.html_entity_decode($d, ENT_QUOTES, 'UTF-8');
- }
- else if ($n == 'date'){
- $d = substr($d,0,strpos($d,'+')-1);
- $d = lngDate($d);
- $lin .= '</span> <span class="data">'.htmlentities(i18n_r('guestbook/Ps'), ENT_QUOTES, "UTF-8").' '.stripslashes($d).'</span></div>';
- echo $lin;
- }
- else if ($n == 'cm') {
- $d = BBcodeG($d);
- echo '<div class="gbleft">'. i18n_r('guestbook/'.$name) .':</div>';
- foreach ($array_emot as $key => $val) {$d=str_replace($array_emot[$key], '<img src="'.$SITEURL.'plugins/guestbook/img_emot/'.substr($array_emot[$key],1, strlen($array_emot[$key])-2).'.gif" alt="'.$array_emot[$key].'" />', $d);}
- echo '<div class="gbright">'.$d.'</div>';
- }
- else if ($n == 'captcha'){}
- //If you want that shows email comment the next line.
- else if ($n === 'em'){}
- else if ($n == 'ip_address'){}
- else if ($n == 'answ'){}
- else if ($n == 'id' || $n == 'subid'){}
- else {
- if (trim($d) != '' && $d != i18n_r('guestbook/guest_FORM_SUB')){
- echo '<div class="gbleft">'. i18n_r('guestbook/'.$name) .':</div>';
- echo '<div class="gbright">'.stripslashes(html_entity_decode($d, ENT_QUOTES, 'UTF-8')).'</div>';
- }
- }
- } //se acaba segundo foreach
- echo '</div> ';
- ////////////////// //insertamos las respuestas a este comentario
- $verNodeU_r = $xpath->query("entry[Id=$at and answ='y']");
- $dnlLen_r=$verNodeU_r->length;
- $countr=1;
- foreach($verNodeU_r as $node) {
- echo '<div class="response">';
- $dNdList = $node->getElementsByTagName( "*" );
- $at = $node->getAttribute('id');
- foreach($dNdList as $node) {
- $name= $node->nodeName;
- $n = strtolower($name);
- $d =$node->nodeValue;
- //check if its an email address
- if (check_email_address($d)) {
- $d = '<a href="mailto:'.$d.'">'. $d.'</a>';
- }
- $d = filtrog(stripslashes(html_entity_decode($d, ENT_QUOTES, 'UTF-8')));
- //check first line
- if ($n == 'nb') {
- $lin = '<div class="gblist"><div class="entry"><span class="number">'.i18n_r('guestbook/Rep').' '.i18n_r('guestbook/bkti').'</span> <span class="name"> '.html_entity_decode($d, ENT_QUOTES, 'UTF-8');
- }
- else if ($n == 'date'){
- $d = substr($d,0,strpos($d,'+')-1);
- $d = lngDate($d);
- $lin .= '</span> <span class="data">'.htmlentities(i18n_r('guestbook/Ps'), ENT_QUOTES, "UTF-8").' '.stripslashes($d).'</span></div>';
- echo $lin;
- }
- else if ($n == 'cm') {
- $d = BBcodeG($d);
- echo '<div class="gbleft">'. i18n_r('guestbook/'.$name) .':</div>';
- foreach ($array_emot as $key => $val) {
- $d=str_replace($array_emot[$key], '<img src="'.$SITEURL.'plugins/guestbook/img_emot/'.substr($array_emot[$key],1, strlen($array_emot[$key])-2).'.gif" alt="'.$array_emot[$key].'" />', $d);
- }
- echo '<div class="gbright">'.$d.'</div>';
- echo '</div> ';
- }
- else if ($n == 'captcha'){}
- //If you want that shows email comment the next line.
- else if ($n == 'em'){}
- else if ($n == 'ip_address'){}
- else if ($n == 'answ'){}
- else if ($n == 'id' || $n == 'subid'){}
- else {
- if (trim($d) != '' && $d != i18n_r('guestbook/guest_FORM_SUB')){
- echo '<div class="gbleft">'. i18n_r('guestbook/'.$name) .':</div>';
- echo '<div class="gbright">'.stripslashes(html_entity_decode($d, ENT_QUOTES, 'UTF-8')).'</div>';
- }
- }
- } //se acaba segundo foreach de respuestas
- echo '</div>'; //se termina la tabla de respuestas
- $countr++;
- } //se acaba primer foreach de respuestas
- //////////////////
- echo '<div class="none">';
- myform('none', 'y', $log_file, $EMAIL, $count, $at, $capt, $vemot);
- echo '</div>';
- echo '<p class="responselink"><a href="javascript:Insertcom("form'.$count.'")"> '.i18n_r('guestbook/mf').' </a></p>';
- echo '</div> <!-- end guestbookentries -->'; //se termina la tabla de comentario principal
- }
- $count++;
- } //se acaba primer foreach del comentario principal
- //sumamos o restamos si es orden creciente ó decreciente
- if ($eleg == 'I'){
- $num++;
- } else {
- $num--;
- }
- } //se acaba for ($q= 0; $q< $dnlLen; $q++)
- } //se acaba si exite log
- ?>
- <script type="text/javascript">
- <!--
- function Smile(id,texto){
- var frm=document.getElementById(id);
- frm.comentario.value = frm.comentario.value + texto;
- }
- function rec_cpt(id,ourl){
- var aleat = Math.random();
- var mf = document.getElementById(id);
- mf.src = ourl + "/guestbook/&" + aleat;
- }
- -->
- </script>
- <?php
- //muestro form al final
- myform('block','n', $log_file,$EMAIL, $id, $id, $capt, $vemot);
- }
- function myform($dpl, $nn, $myfile, $email, $count, $at, $capt, $vemot) {
- global $SITEURL;
- global $LANG;
- global $mi_arrayp;
- global $mi_array;
- //control last captcha
- $imfin = $count;
- if ($dpl =='block'){
- $imfin='f';
- }
- //write entries in form after error
- if ($mi_array['q_count'] == $count){
- $mi_arrayq = $mi_array;
- $dpl ='block';
- } else {
- $mi_arrayq = $mi_arrayp;
- }
- if ($mi_array['email'] ==''){
- $mi_arrayq['email'] = i18n_r('guestbook/em_text');
- }
- //control uri, very long due to miarray
- $request_uri = getenv ("REQUEST_URI"); // Requested URI
- $posmiar= strpos($request_uri, 'miarr=');
- if ($posmiar){
- $request_uri = substr($request_uri, 0, $posmiar - 1);
- }
- $mGSPLUGINPATH = str_replace("\\", "/", GSPLUGINPATH);
- $mGSPLUGINPATH = substr($mGSPLUGINPATH, 0, -1);
- //charge emoticonos
- $s_emot = emot("img","form".$count);
- //shown form
- echo '<form style="display:'.$dpl.';" name="formulario" id="form'.$count.'" action="'.$SITEURL.'plugins/guestbook/comprueba.php?tp=guest&ans='.$nn.'&idf='.$at.'" method="post">';
- echo '<div class="gbform">';
- echo '<fieldset><legend> '.i18n_r('guestbook/GBOOK').' </legend>';
- echo '<label><b>'.i18n_r('guestbook/red').'</b> '.i18n_r('guestbook/Nb').'</label>';
- echo '<input type="text" name="guest[nombre]" value="'.$mi_arrayq["nombre"].'" /><br />';
- echo '<label>'.i18n_r('guestbook/Sub').'</label>';
- echo '<input type="text" name="guest[tema]" value="'.$mi_arrayq["tema"].'" /><br />';
- echo '<label>'.i18n_r('guestbook/Em').'</label>';
- echo '<input type="text" name="guest[email]" value="'.$mi_arrayq["email"].'" /><br />';
- echo '<label>'.i18n_r('guestbook/Ct').'</label>';
- echo '<input type="text" class="text" name="guest[city]" value="'.$mi_arrayq["city"].'" /><br />';
- echo '<label><b>'.i18n_r('guestbook/red').'</b> '.i18n_r('guestbook/Cm').'<br />';
- echo '<div class="bbcode"><b>bbcode:<br /></b><span title="line break">[br]<span> <span title="bold: [b]text[/b]">[b][/b]</span> <span title="Italic: [i]text[/i]">[i][/i]</span> <span title="underline: [u]text[/u]">[u][/u]</span><br />[img]link image[/img]<br />[color=colour][/color]<br />[url]link[/url]<br />[url=link]title[/url]</div></label>';
- //echo '<img src="'.$SITEURL.'plugins/guestbook/bbcode.png" />';
- echo '<textarea name="comentario">'.$mi_arrayq["comentario"].'</textarea><br />';
- if ($vemot =='Y'){
- echo '<div class="smail">'.$s_emot.'</div>';
- }
- if ($capt =='Y'){
- echo '<div><span class="three smallfont"><img alt="captcha'.$count.'" class="captchaimg" id="captcha'.$count.'" src="'.$SITEURL.'plugins/guestbook/img_cpt.php?url='.GSPLUGINPATH.'guestbook/" /></span>';
- echo '<span class="three smallfont"><input class="btn" type="button" value="'.i18n_r('guestbook/reload').'" onClick="javascript:rec_cpt("captcha'.$count.'","'.$SITEURL.'plugins/guestbook/img_cpt.php?url='.$mGSPLUGINPATH.'")" /></span>';
- echo '<span class="three smallfont reload">'.i18n_r('guestbook/rl').'</span></div>';
- echo '<div><input type="text" class="captchainput" value="" name="guest[pot]" />';
- echo '<span class="three smallfont"><b>'.i18n_r('guestbook/red').'</b> '.i18n_r('guestbook/Cpt').'</span></div>';
- }
- echo '<div><input class="btn" type="submit" value="'.i18n_r('guestbook/Ev').'" name="guest-submit" /><span class="rf"><b>'.i18n_r('guestbook/red').'</b> '.i18n_r('guestbook/Rf').'</span></div>';
- echo '<input type="hidden" name="guest[q_email]" value="'.$email.'" />';
- echo '<input type="hidden" name="guest[q_file]" value="'.$myfile.'" />';
- echo '<input type="hidden" name="guest[q_uri]" value="'.$request_uri.'" />';
- echo '<input type="hidden" name="guest[q_count]" value="'.$count.'" />';
- echo '<input type="hidden" name="guest[q_capt]" value="'.$capt.'">';
- echo '<input type="hidden" name="guest[q_lang]" value="'.$LANG.'" />';
- echo '</fieldset></div></form>';
- }
- function emot($opcion, $id){
- global $SITEURL;
- $ruta = GSPLUGINPATH.'guestbook/img_emot/';
- $array_emot= array();
- $s_emot = '';
- if (is_dir($ruta)) {
- if ($dh = opendir($ruta)){
- while (($file = readdir($dh)) !== false){
- if($file!="." AND $file!=".." AND $file!=".htaccess" AND is_dir($ruta . $file)== false AND strtolower(substr($file,-4))=='.gif'){
- $array_emot[substr($file, 0, strlen($file)-4)] = '['.substr($file, 0, strlen($file)-4).']';
- $s_emot = $s_emot.' <a href="javascript:Smile("'.$id.'","['.substr($file, 0, strlen($file)-4).']")"><img src="'.$SITEURL.'plugins/guestbook/img_emot/'.substr($file, 0, strlen($file)-4).'.gif" /> </a>';
- }
- }
- closedir($dh);
- }
- }
- if ($opcion == 'array'){
- return $array_emot;
- }
- elseif ($opcion == 'img') {
- return $s_emot;
- }
- }
- function filtrog ($texto) {
- $html = array("<", ">");
- $filtrado = array("<", ">");
- $final = str_replace($html, $filtrado, $texto);
- return $final;
- }
- function BBcodeG($texton){
- $BBcodeN = array(
- "/\<(.*?)>/is",
- "/\[i\](.*?)\[\/i\]/is",
- "/\[b\](.*?)\[\/b\]/is",
- "/\[u\](.*?)\[\/u\]/is",
- "/\[img\](.*?)\[\/img\]/is",
- "/\[url=(.*?)\](.*?)\[\/url\]/is",
- "/\[color=(.*?)\](.*?)\[\/color\]/is",
- "/\[br]/",
- );
- $html = array(
- "<$1>",
- "<i>$1</i>",
- "<b>$1</b>",
- "<u>$1</u>",
- "<img src=\"$1\" />",
- "<a href=\"$1\" target=\"_blank\">$2</a>",
- "<span style=\"color:$1\">$2</span>",
- "<br />",
- );
- $BBcodeNn = array(
- "/\[url\](.*?)\[\/url\]/is",
- );
- $htmln = array(
- "<a href=\"$1\" target=\"_blank\">$1</a>",
- );
- $texton = preg_replace($BBcodeN, $html, $texton);
- $texton = preg_replace($BBcodeNn, $htmln, $texton);
- return $texton;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment