emprit

contact.php

Jul 22nd, 2012
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 24.07 KB | None | 0 0
  1. <?php
  2. // Relative
  3. $relative = '../';
  4. $path = $relative. 'data/other/';
  5.  
  6. # get correct id for plugin
  7. $thisfile=basename(__FILE__, ".php");
  8.  
  9.  
  10. # register plugin
  11. register_plugin(
  12.     $thisfile,
  13.     'Cumbe_guestbook',
  14.     '4.4.2',
  15.     'Cumbe',
  16.     'http://cumbe.no-ip.biz/gs_30/libro_invitados/',
  17.     'Description: shown and save the publics comments of your visits.',
  18.     'plugins', //page type
  19.     'gbook'
  20. );
  21.  
  22. //set internationalization
  23.  
  24. if (basename($_SERVER['PHP_SELF']) != 'index.php') { // back end only
  25.   i18n_merge('guestbook', $LANG);
  26.   i18n_merge('guestbook', 'en_US');
  27. }
  28.  
  29. //añadimos pestaña a sidebar de plugins
  30. add_action('plugins-sidebar','createSideMenu',array('guestbook',i18n_r('guestbook/GBOOK')));
  31.  
  32. //add css to head
  33. add_action('theme-header','inc_css');
  34.  
  35. function inc_css(){
  36.    global $SITEURL;
  37.    echo '<link href="'.$SITEURL.'plugins/guestbook/guestbook.css" rel="stylesheet">';
  38. }
  39.  
  40. ///////////////////////////////////////////////
  41. //////   BACK END - ADMIN - PLUGINS  //////////
  42. ///////////////////////////////////////////////
  43.  
  44. function gbook(){
  45.     global $i18n, $LANG;
  46.  
  47.     $log_name = 'guestbook.log';
  48.     $log_path = GSDATAOTHERPATH.'logs/';
  49.     $log_file = $log_path . $log_name;
  50.  
  51.     //create dir backup
  52.     if (!is_dir($log_path.'guestbook_bak')){
  53.        mkdir( $log_path.'guestbook_bak');
  54.     }
  55.  
  56.  
  57.     //traducción i18n
  58.     i18n_merge('guestbook', $LANG) || i18n_merge('guestbook','en_US');
  59.  
  60.  
  61.     echo '<h3 class="floated">'.strtoupper(i18n_r('guestbook/GBOOK')).'</h3>';
  62.     echo '<div class="edit-nav" >';
  63.         echo '<a href="load.php?id=guestbook" title="'.i18n_r('guestbook/GBOOK').'">'.i18n_r('guestbook/GBOOK').'</a>';        
  64.         echo '<a href="load.php?id=guestbook&action=backup" accesskey="b" title="'.i18n_r('guestbook/backup').'">'.i18n_r('guestbook/backup').'</a>';
  65.         if (is_file($log_file)){
  66.          echo '<a href="load.php?id=guestbook&action=delete" accesskey="c" title="'.$i18n['CLEAR_ALL_DATA'].' '.$log_name.'" onClick="return confirmar(this,&quot;n&quot;,&quot;'.$i18n['CLEAR_ALL_DATA'].' '.$log_file.'. '.i18n_r('guestbook/delsure').'&quot;,&quot;log&quot;)" />'.$i18n['CLEAR_THIS_LOG'].'</a>';
  67.         }
  68.     echo '<div class="clear"></div>';
  69.     echo '</div>';
  70.  
  71.     if(file_exists($log_file)) {
  72. ?>
  73.     <script type="text/javascript">
  74.         <!--
  75.     function confirmar(formObj,count,msge,bck) {
  76.         if(!confirm(msge)) {
  77.                    return false;
  78.             } else {
  79.                    if (bck == 'log'){
  80.                        if (count =='n'){
  81.                            window.location="load.php?id=guestbook&action=delete";
  82.                        } else {  
  83.                            window.location="load.php?id=guestbook&n_del=" + count + "";
  84.                        }
  85.                    }
  86.                    if (bck == 'back'){
  87.                            window.location="load.php?id=guestbook&action=backup&delbak=" + count + "";
  88.                    }
  89.                    return false;
  90.             }    
  91.         }
  92.  
  93.         -->
  94.     </script>
  95.  
  96.  
  97. <?php
  98.         //backups    
  99.     if (@$_GET['action'] == 'backup') {
  100.            include 'guestbook/backup.php';
  101.         }
  102.  
  103.  
  104.         if (@$_GET['action'] == 'delete' && strlen($log_name)>0) {
  105.                 //first-> backup: guestbook.log+date+time+.bak
  106.                 copy ($log_file, $log_path.'guestbook_bak/'.$log_name.'_'.date('dmy_His').'.bak');
  107.             unlink($log_file);
  108.         exec_action('logfile_delete');
  109.             ?>
  110.         <label>Log <?php echo $log_name;?> <?php echo $i18n['MSG_HAS_BEEN_CLR']; ?>
  111.                 </div>
  112.             </div>
  113.             <div id="sidebar" >
  114.                 <?php include('template/sidebar-plugins.php'); ?>
  115.             </div>
  116.         <div class="clear"></div>
  117.         </div>
  118.         <?php get_template('footer'); ?>
  119.             <?php
  120.             exit;
  121.     }
  122.  
  123.     //Eliminamos un registro:entry
  124.     if (@$_GET['n_del'] != ''){
  125.                 //first-> backup: guestbook_bak/guestbook.log+date+time+.bak
  126.                 copy ($log_file, $log_path.'guestbook_bak/'.$log_name.'_'.date('dmy_His').'.bak');
  127.         $domDocument = new DomDocument();
  128.         $domDocument->preserveWhiteSpace = FALSE;
  129.         $domDocument->load($log_file);
  130.         $domNodeList = $domDocument->documentElement;
  131.             $domNodeList = $domDocument->getElementsByTagname('entry');
  132.         $ndel = @$_GET['n_del'];
  133.         $ndL = $domNodeList ->item($ndel)->parentNode;
  134.         $ndL -> removeChild($domNodeList ->item($ndel));
  135.  
  136.         //grabo de nuevo el documento modificado.
  137.          $domDocument->save($log_file);
  138.     }    
  139.  
  140.         //load data of xml
  141.         $log_data = getXML($log_file);
  142.         //fin eliminar registro
  143.  
  144. if (@$_GET['action'] =='') {
  145.     echo '<h2>'.$i18n['VIEWING'].'&nbsp;'.$i18n['LOG_FILE'].':&lsquo;<em>'.@$log_name.'</em>&rsquo;</h2>';
  146.     echo '<ol class="more" >';
  147.     $count = 0;
  148.     foreach ($log_data as $log) {
  149.         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,&quot;'.$count.'&quot;,&quot;'.i18n_r('guestbook/ndelc').$count.'. '.i18n_r('guestbook/delsure').'&quot;,&quot;log&quot;)"><b>X</b></a><br />';
  150.  
  151.             $atrib = $log->attributes();
  152.             echo 'Atributo Id:'.$atrib['id'].'<br />'; 
  153.         foreach($log->children() as $child) {
  154.                       $name = $child->getName();
  155.                                   if ($name == 'Nb' or $name == 'Cm' or $name == 'Sub' or $name == 'Ct' or $name == 'Em' ){
  156.                                        echo '<b>'. i18n_r('guestbook/'.$name) .'</b>:';
  157.                               } else {
  158.                                        echo '<b>'. stripslashes(ucwords($name)) .'</b>:';
  159.                                   }
  160.                       $d = $log->$name;
  161.                       $n = strtolower($child->getName());
  162.                       $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}$/';
  163.                       $url_regex = @"((https?|ftp|gopher|telnet|file|notes|ms-help):((//)|())+[wd:#@%/;$()~_?+-=.&]*)";
  164.  
  165.                       //check if its an url address
  166.                       /*if (do_reg($d, $url_regex)) {
  167.                         $d = '<a href="'. $d .'" target="_blank" >'.$d.'</a>';
  168.                       }*/
  169.  
  170.                       //check if its an ip address
  171.                                           if (substr($name, 0 , 2) == 'ip') {
  172.                                             if ($d == $_SERVER['REMOTE_ADDR']) {
  173.                             $d = $i18n['THIS_COMPUTER'].' (<a href="http://www.geobytes.com/IpLocator.htm?GetLocation&IpAddress='. $d.'" target="_blank" >'.$d.'</a>)';
  174.                         } else {
  175.                             $d = '(<a href="http://www.geobytes.com/IpLocator.htm?GetLocation&IpAddress='. $d.'" target="_blank" >'.$d.'</a>)';
  176.                         }
  177.                       } else
  178.  
  179.                       //check if its an email address
  180.                       if (check_email_address($d)) {
  181.                         $d = '<a href="mailto:'.$d.'">'.$d.'</a>';
  182.                       } else
  183.  
  184.                       //check if its a date
  185.                       if ($n === 'date') {
  186.                         $d = substr($d,0,strpos($d,'+')-1);
  187.                         $d = lngDate($d);
  188.                       } else {
  189.                            $d = filtrog(stripslashes(html_entity_decode($d, ENT_QUOTES, 'UTF-8')));
  190.                                           }
  191.                       echo $d;
  192.                       echo ' <br />';
  193.             } //end foreach log children
  194.             echo "</p></li>";
  195.             $count++;
  196.         }
  197.  
  198.         echo '</ol>';
  199.  
  200. } //end if action=''
  201.         }
  202.         else{   //If file does not exist
  203.         echo '<label>'.$i18n['MISSING_FILE'].':&lsquo;<em><?php echo @$log_name; ?></em>&rsquo;</label>';
  204.             }
  205.  
  206.     }
  207. ///////////////////////////////////////////////
  208. //////        FRONT END system        /////////
  209. ///////////////////////////////////////////////
  210.  
  211. function sv_book($usu, $cada, $eleg, $capt, $vemot){
  212.     global $EMAIL;
  213.     global $SITEURL;
  214.     global $i18n;
  215.     global $LANG;
  216.     global $PRETTYURLS;
  217.  
  218.     if (file_exists(GSDATAPATH.'users/'.$usu.'.xml')) {
  219.         $data = getXML(GSDATAPATH.'users/'.$usu.'.xml');
  220.     $EMAIL = $data->EMAIL;
  221.         $LANG = $data->LANG;
  222.     }
  223.  
  224.     //traducción idiomas i18n
  225.     i18n_merge('guestbook', $LANG) || i18n_merge('guestbook','en_US');  
  226.    
  227.  
  228.     if (file_exists('gsconfig.php')) {
  229.         include_once('gsconfig.php');
  230.     }
  231.     // Debugging
  232.     if (defined('GSDEBUG')){
  233.     error_reporting(E_ALL | E_STRICT);
  234.         ini_set('display_errors', 1);
  235.     } else {
  236.     error_reporting(0);
  237.         @ini_set('display_errors', 0);
  238.     }
  239.  
  240.     $err = '';
  241.     $fich=return_page_slug();
  242.     $log_name = 'guestbook.log';
  243.     $log_path = GSDATAOTHERPATH.'logs/';
  244.     $log_file = $log_path . $log_name;
  245.  
  246.     if(file_exists($log_file)) {
  247.         $log_data = getXML($log_file);
  248.     }
  249.  
  250. ?>
  251.  
  252.     <script type="text/javascript">
  253.         <!--
  254.         function Insertcom(id){
  255.                     var frm=document.getElementById(id);
  256.                     if(frm.style.display=="block"){
  257.                        frm.style.display="none";
  258.                     }
  259.                     else
  260.                     if(frm.style.display=="none"){
  261.                frm.style.display="block";
  262.             }
  263.  
  264.  
  265.                 }
  266.         -->
  267.     </script>
  268.     <?php
  269.     //reasignamos url correcta según prettyurls
  270.     if  ($PRETTYURLS =='') {
  271.             $idpret = 'id='. $fich.'&amp;';
  272.     } else {
  273.         $idpret = '';
  274.     }
  275.  
  276.    //if captcha wrong then write form with data entered
  277.    //Array ( [nombre] => ojk [tema] => piopi [email] => [city] => piopi [pot] => p
  278.    //[q_count] => 1 [q_lang] => en_US [comentario] => oip
  279.    global $mi_array;
  280.    global $mi_arrayp;
  281.    $mi_arrayp= array(
  282.       "nombre" =>  '',
  283.       "tema" =>  '',
  284.       "email" =>  '',
  285.       "city" =>  '',
  286.       "comentario" =>  '',
  287.    );
  288.  
  289.  
  290.    if (isset($_GET['miarr'])){
  291.         $a=stripslashes ($_GET['miarr']);
  292.         $mi_array=unserialize($a);        
  293.    }
  294.  
  295.         //cargamos array de emoticonos
  296.         $array_emot = emot('array','id');
  297.         $myfile='';
  298.         $count = 1;
  299.         $at = 0;
  300.         $mi='';
  301.         $pagi=1;
  302.         $id=1;
  303.         if (@$_GET['pag'] != ''){ $pagi= @$_GET['pag']; }
  304.  
  305.  
  306.         if(file_exists($log_file)){
  307.             $domDocument = new DomDocument();
  308.             $domDocument->load($log_file);
  309.  
  310.             //Creamos DOMXPath para filtrar por answ=n
  311.             $xpath = new DOMXPath($domDocument);
  312.  
  313.             $verN = $xpath->query("entry[answ='n']");          
  314.             $num =  $verN->length;
  315.             //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.   
  316.                         $verNodeU = $xpath->query("entry/Id[../answ='n']");
  317.             $dnlLen=$verNodeU->length;
  318.             $id= ($verNodeU->item($num - 1)->nodeValue) + 1;
  319.  
  320.                         $verNodeU = $xpath->query("entry");
  321.             $dnlLen= $verNodeU->length;
  322.  
  323.    
  324.             //paginación
  325.             if ($num/$cada > 1){
  326.             echo '<!-- paginator --><div id="paginator">';
  327.                 echo '<span id="navigator">'.i18n_r('guestbook/Pag').'</span>';
  328.                 for ($i=1; $i<($num/$cada)+1; $i++){
  329.                                      if ($i == $pagi){
  330.                         $negri='class="activ"';
  331.                      } else {
  332.                         $negri='';
  333.                      }
  334.                      $mi.= '<a '.$negri.' href="?'.$idpret.'pag='.$i.'">'.$i.'</a> '.i18n_r('guestbook/Razdel');
  335.                 }
  336.                 if ($pagi == 1){
  337.                     $pprev='';
  338.                 } else {
  339.                     $pprev = ' <a class="prev" href="?'.$idpret.'pag='.($pagi - 1).'" title="'.i18n_r('guestbook/Prever').'">'.i18n_r('guestbook/Prev').'</a> '.i18n_r('guestbook/Razdel').' ';
  340.                 }
  341.                 if ($pagi == $i - 1){
  342.                     $pnext='';
  343.                 } else {
  344.                     $pnext = '  <a class="next" href="?'.$idpret.'pag='.($pagi + 1).'" title="'.i18n_r('guestbook/Nexter').'">'.i18n_r('guestbook/Next').'</a>';
  345.                 }
  346.                 echo $pprev.$mi.$pnext.'</div><!-- end paginator -->';
  347.             }
  348.  
  349.             //orden
  350.             if ($eleg != 'I' && $eleg != 'D'){$eleg = 'I'; }
  351.             if ($eleg == 'I'){
  352.                 $num = 0;
  353.             } elseif ($eleg =='D') {
  354.                 $num= $dnlLen;
  355.             }          
  356.  
  357.         for ($q= 0; $q< $dnlLen+1; $q++){
  358.             $verNodeU =$xpath->query("entry[answ='n' and position()=".$num."]");
  359.             foreach($verNodeU as $node) {
  360.                if ($count <= ($cada * $pagi) && $count > ($cada * ($pagi-1))) {
  361.  
  362.                echo '<!-- guestbook entries  --><div class="gbentries">';
  363.                $dNdList = $node->getElementsByTagName( "*" );
  364.                $at = $node->getAttribute('id');
  365.                foreach($dNdList as $node) {
  366.                  $name= $node->nodeName;
  367.                  $d =$node->nodeValue;
  368.                  $d = filtrog(stripslashes(html_entity_decode($d, ENT_QUOTES, 'UTF-8')));
  369.                  $n = strtolower($name);
  370.  
  371.                   //check if its an email address
  372.                   if (check_email_address($d)) {
  373.                     $d = '<a href="mailto:'.$d.'">'. $d.'</a>';
  374.                   }
  375.  
  376.                   //check first line
  377.                   if ($n == 'nb') {
  378.                                         $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');
  379.                   }
  380.                   else if ($n == 'date'){
  381.                     $d = substr($d,0,strpos($d,'+')-1);
  382.                     $d = lngDate($d);
  383.                     $lin .= '</span> <span class="data">'.htmlentities(i18n_r('guestbook/Ps'), ENT_QUOTES, "UTF-8").' '.stripslashes($d).'</span></div>';
  384.                     echo $lin;
  385.                   }
  386.                   else if ($n == 'cm') {
  387.                                       $d = BBcodeG($d);
  388.                                       echo '<div class="gbleft">'. i18n_r('guestbook/'.$name) .':</div>';
  389.                                       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);}
  390.                       echo '<div class="gbright">'.$d.'</div>';
  391.                   }
  392.  
  393.                   else if ($n == 'captcha'){}
  394.                   //If you want that shows email comment the next line.
  395.                   else if ($n === 'em'){}
  396.                   else if ($n == 'ip_address'){}
  397.                   else if ($n == 'answ'){}
  398.                   else if ($n == 'id' || $n == 'subid'){}
  399.                   else {
  400.                     if (trim($d) != '' && $d != i18n_r('guestbook/guest_FORM_SUB')){
  401.                                            echo '<div class="gbleft">'. i18n_r('guestbook/'.$name) .':</div>';
  402.                                            echo '<div class="gbright">'.stripslashes(html_entity_decode($d, ENT_QUOTES, 'UTF-8')).'</div>';
  403.                         }
  404.  
  405.                   }
  406.  
  407.                 } //se acaba segundo foreach
  408.                  echo '</div> ';
  409.  
  410. //////////////////          //insertamos las respuestas a este comentario
  411.             $verNodeU_r = $xpath->query("entry[Id=$at and answ='y']");
  412.             $dnlLen_r=$verNodeU_r->length;
  413.             $countr=1;
  414.             foreach($verNodeU_r as $node) {
  415.                echo '<div class="response">';
  416.                $dNdList = $node->getElementsByTagName( "*" );
  417.                $at = $node->getAttribute('id');
  418.                foreach($dNdList as $node) {
  419.                  $name= $node->nodeName;
  420.                  $n = strtolower($name);
  421.                  $d =$node->nodeValue;
  422.  
  423.                   //check if its an email address
  424.                   if (check_email_address($d)) {
  425.                     $d = '<a href="mailto:'.$d.'">'. $d.'</a>';
  426.                   }
  427.  
  428.                  $d = filtrog(stripslashes(html_entity_decode($d, ENT_QUOTES, 'UTF-8')));
  429.  
  430.  
  431.                   //check first line
  432.                   if ($n == 'nb') {
  433.                                         $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');
  434.                   }
  435.                   else if ($n == 'date'){
  436.                     $d = substr($d,0,strpos($d,'+')-1);
  437.                     $d = lngDate($d);
  438.                     $lin .= '</span> <span class="data">'.htmlentities(i18n_r('guestbook/Ps'), ENT_QUOTES, "UTF-8").' '.stripslashes($d).'</span></div>';
  439.                     echo $lin;
  440.                   }
  441.                   else if ($n == 'cm') {
  442.                                        $d = BBcodeG($d);
  443.                                        echo '<div class="gbleft">'. i18n_r('guestbook/'.$name) .':</div>';
  444.                                        foreach ($array_emot as $key => $val) {
  445.                                           $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);
  446.                                        }   
  447.                        echo '<div class="gbright">'.$d.'</div>';
  448.                        echo '</div> ';
  449.                   }
  450.  
  451.                   else if ($n == 'captcha'){}
  452.                   //If you want that shows email comment the next line.
  453.                   else if ($n == 'em'){}
  454.                   else if ($n == 'ip_address'){}
  455.                   else if ($n == 'answ'){} 
  456.                   else if ($n == 'id' || $n == 'subid'){}
  457.                   else {
  458.                     if (trim($d) != '' && $d != i18n_r('guestbook/guest_FORM_SUB')){   
  459.                                             echo '<div class="gbleft">'. i18n_r('guestbook/'.$name) .':</div>';
  460.                                             echo '<div class="gbright">'.stripslashes(html_entity_decode($d, ENT_QUOTES, 'UTF-8')).'</div>';
  461.                         }
  462.                   }
  463.  
  464.                 } //se acaba segundo foreach de respuestas
  465.                 echo '</div>';  //se termina la tabla de respuestas
  466.                 $countr++;
  467.             } //se acaba primer foreach de respuestas
  468. //////////////////
  469.                                   echo '<div class="none">';
  470.                                    myform('none', 'y', $log_file, $EMAIL, $count, $at, $capt, $vemot);
  471.                                   echo '</div>';
  472.                                   echo '<p class="responselink"><a href="javascript:Insertcom(&quot;form'.$count.'&quot;)"> '.i18n_r('guestbook/mf').' </a></p>';
  473.                 echo '</div> <!-- end guestbookentries -->';  //se termina la tabla de comentario principal
  474.             }          
  475.                 $count++;
  476.            
  477.             } //se acaba primer foreach del comentario principal
  478.  
  479.             //sumamos o restamos si es orden creciente ó decreciente
  480.             if ($eleg == 'I'){
  481.                 $num++;
  482.             } else {
  483.                 $num--;
  484.             }
  485.         }  //se acaba for ($q= 0; $q< $dnlLen; $q++)
  486.         }  //se acaba si exite log
  487.     ?>
  488.  
  489.     <script type="text/javascript">
  490.     <!--
  491.        function Smile(id,texto){
  492.               var frm=document.getElementById(id);
  493.               frm.comentario.value = frm.comentario.value + texto;
  494.         }
  495.        function rec_cpt(id,ourl){
  496.              var aleat = Math.random();
  497.              var mf = document.getElementById(id);
  498.              mf.src = ourl + "/guestbook/&" + aleat;
  499.        }
  500.     -->
  501.     </script>
  502.     <?php
  503.  
  504.     //muestro form al final
  505.     myform('block','n', $log_file,$EMAIL, $id, $id, $capt, $vemot);
  506.  
  507.     }
  508.  
  509.     function myform($dpl, $nn, $myfile, $email, $count, $at, $capt, $vemot) {
  510.        global $SITEURL;
  511.        global $LANG;
  512.        global $mi_arrayp;
  513.        global $mi_array;
  514.  
  515.        //control last captcha
  516.        $imfin = $count;
  517.        if ($dpl =='block'){
  518.            $imfin='f';
  519.        }
  520.        //write entries in form after error
  521.        if ($mi_array['q_count'] == $count){
  522.           $mi_arrayq = $mi_array;
  523.           $dpl ='block';
  524.        } else {
  525.           $mi_arrayq = $mi_arrayp;
  526.        }
  527.        if ($mi_array['email'] ==''){
  528.            $mi_arrayq['email'] = i18n_r('guestbook/em_text');
  529.        }
  530.        //control uri, very long due to miarray
  531.        $request_uri = getenv ("REQUEST_URI");       // Requested URI
  532.        $posmiar= strpos($request_uri, 'miarr=');
  533.        if ($posmiar){
  534.       $request_uri = substr($request_uri, 0, $posmiar - 1);  
  535.        }      
  536.        $mGSPLUGINPATH = str_replace("\\", "/", GSPLUGINPATH);
  537.        $mGSPLUGINPATH = substr($mGSPLUGINPATH, 0, -1);
  538.  
  539.        //charge emoticonos
  540.        $s_emot = emot("img","form".$count);
  541.        
  542.        //shown form
  543.         echo '<form style="display:'.$dpl.';" name="formulario" id="form'.$count.'" action="'.$SITEURL.'plugins/guestbook/comprueba.php?tp=guest&amp;ans='.$nn.'&amp;idf='.$at.'" method="post">';
  544.         echo '<div class="gbform">';
  545.         echo '<fieldset><legend>&nbsp;'.i18n_r('guestbook/GBOOK').'&nbsp;</legend>';
  546.         echo '<label><b>'.i18n_r('guestbook/red').'</b> '.i18n_r('guestbook/Nb').'</label>';
  547.         echo '<input type="text" name="guest[nombre]" value="'.$mi_arrayq["nombre"].'" /><br />';
  548.         echo '<label>'.i18n_r('guestbook/Sub').'</label>';
  549.         echo '<input type="text" name="guest[tema]" value="'.$mi_arrayq["tema"].'" /><br />';
  550.         echo '<label>'.i18n_r('guestbook/Em').'</label>';
  551.         echo '<input type="text" name="guest[email]" value="'.$mi_arrayq["email"].'" /><br />';
  552.         echo '<label>'.i18n_r('guestbook/Ct').'</label>';
  553.         echo '<input type="text" class="text" name="guest[city]" value="'.$mi_arrayq["city"].'" /><br />';
  554.         echo '<label><b>'.i18n_r('guestbook/red').'</b> '.i18n_r('guestbook/Cm').'<br />';
  555.                 echo '<div class="bbcode"><b>bbcode:<br /></b><span title="line break">[br]<span>&nbsp;&nbsp;<span title="bold: [b]text[/b]">[b][/b]</span>&nbsp;&nbsp;<span title="Italic: [i]text[/i]">[i][/i]</span>&nbsp;&nbsp;<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>';
  556.                 //echo '<img src="'.$SITEURL.'plugins/guestbook/bbcode.png" />';
  557.         echo '<textarea name="comentario">'.$mi_arrayq["comentario"].'</textarea><br />';
  558.         if ($vemot =='Y'){                 
  559.                         echo '<div  class="smail">'.$s_emot.'</div>';
  560.                 }                
  561.         if ($capt =='Y'){
  562.             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>';
  563.             echo '<span class="three smallfont"><input class="btn" type="button" value="'.i18n_r('guestbook/reload').'" onClick="javascript:rec_cpt(&quot;captcha'.$count.'&quot;,&quot;'.$SITEURL.'plugins/guestbook/img_cpt.php?url='.$mGSPLUGINPATH.'&quot;)" /></span>';
  564.             echo '<span class="three smallfont reload">'.i18n_r('guestbook/rl').'</span></div>';
  565.             echo '<div><input type="text" class="captchainput" value="" name="guest[pot]" />';
  566.             echo '<span class="three smallfont"><b>'.i18n_r('guestbook/red').'</b> '.i18n_r('guestbook/Cpt').'</span></div>';
  567.         }
  568.         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>';
  569.         echo '<input type="hidden" name="guest[q_email]" value="'.$email.'" />';
  570.         echo '<input type="hidden" name="guest[q_file]" value="'.$myfile.'" />';
  571.         echo '<input type="hidden" name="guest[q_uri]" value="'.$request_uri.'" />';
  572.         echo '<input type="hidden" name="guest[q_count]" value="'.$count.'" />';
  573.             echo '<input type="hidden" name="guest[q_capt]" value="'.$capt.'">';
  574.         echo '<input type="hidden" name="guest[q_lang]" value="'.$LANG.'" />';
  575.         echo '</fieldset></div></form>';
  576.     }
  577.  
  578.  
  579. function emot($opcion, $id){
  580.   global $SITEURL;
  581.   $ruta = GSPLUGINPATH.'guestbook/img_emot/';
  582.   $array_emot= array();
  583.   $s_emot = '';
  584.   if (is_dir($ruta)) {
  585.       if ($dh = opendir($ruta)){
  586.          while (($file = readdir($dh)) !== false){
  587.             if($file!="." AND $file!=".." AND $file!=".htaccess" AND is_dir($ruta . $file)== false AND strtolower(substr($file,-4))=='.gif'){
  588.             $array_emot[substr($file, 0, strlen($file)-4)] = '['.substr($file, 0, strlen($file)-4).']';
  589.                         $s_emot = $s_emot.' <a href="javascript:Smile(&quot;'.$id.'&quot;,&quot;['.substr($file, 0, strlen($file)-4).']&quot;)"><img src="'.$SITEURL.'plugins/guestbook/img_emot/'.substr($file, 0, strlen($file)-4).'.gif" /> </a>';
  590.                 }
  591.          }
  592.          closedir($dh);
  593.       }
  594.   }        
  595.   if ($opcion == 'array'){
  596.               return $array_emot;
  597.   }
  598.   elseif ($opcion == 'img') {
  599.               return $s_emot;  
  600.   }
  601.  
  602. }
  603.  
  604. function filtrog ($texto) {
  605.     $html = array("<", ">");
  606.     $filtrado = array("&lt;", "&gt;");
  607.     $final = str_replace($html, $filtrado, $texto);
  608.  
  609.     return $final;
  610. }
  611.  
  612. function BBcodeG($texton){
  613.     $BBcodeN = array(    
  614.        "/\<(.*?)>/is",
  615.        "/\[i\](.*?)\[\/i\]/is",
  616.        "/\[b\](.*?)\[\/b\]/is",
  617.        "/\[u\](.*?)\[\/u\]/is",
  618.        "/\[img\](.*?)\[\/img\]/is",
  619.        "/\[url=(.*?)\](.*?)\[\/url\]/is",
  620.        "/\[color=(.*?)\](.*?)\[\/color\]/is",
  621.        "/\[br]/",
  622.    );
  623.  
  624.    $html = array(
  625.      
  626.     "<$1>",
  627.     "<i>$1</i>",
  628.     "<b>$1</b>",
  629.     "<u>$1</u>",
  630.     "<img src=\"$1\" />",
  631.     "<a href=\"$1\" target=\"_blank\">$2</a>",
  632.     "<span style=\"color:$1\">$2</span>",
  633.         "<br />",
  634.    );
  635.  
  636.     $BBcodeNn = array(   
  637.        "/\[url\](.*?)\[\/url\]/is",
  638.    );
  639.  
  640.    $htmln = array(
  641.     "<a href=\"$1\" target=\"_blank\">$1</a>",
  642.    );
  643.  
  644.     $texton = preg_replace($BBcodeN, $html, $texton);
  645.     $texton = preg_replace($BBcodeNn, $htmln, $texton);
  646.     return $texton;
  647. }
  648. ?>
Advertisement
Add Comment
Please, Sign In to add comment