Paste2 Logo
  1. <?
  2. php
  3. /**
  4.  
  5. SimpleNews 2.0.1 - Zumbie edition
  6.  
  7.  
  8.  
  9.  
  10.  
  11. @date April, 2008
  12. @description Last release of SimpleNews, which is compatible with Joomla! 1.5. I have no intentions to mantain this software anymore.
  13.  
  14. @author  Matheus Mendes (bigodines ["at"] gmail.com)
  15.  
  16. @package simpleNews
  17.  
  18. @license GPL
  19.  
  20.  
  21.  
  22. */
  23.  
  24. /**
  25.         NOTE THAT THIS FILE ALONE DOES NOTHING. You must replace the original SimpleNews.php inside your simpleNews' directory as this is just a patch.
  26. */
  27.  
  28.  
  29. /**
  30.  
  31.   Main Class - Please configure according to your system.
  32.  
  33. */
  34.  
  35. class SimpleNews {
  36.  
  37.  
  38.  
  39.     /**
  40.  
  41.       Database Configuration
  42.  
  43.     */   
  44.  
  45.     /**
  46.  
  47.       host
  48.  
  49.       @string
  50.  
  51.     */
  52.  
  53.     var $host = "localhost"; //$mosConfig_host;
  54.  
  55.     /**
  56.  
  57.       database name
  58.  
  59.       @string
  60.  
  61.     */
  62.  
  63.     var $db = "my_db"; //$mosConfig_db;
  64.  
  65.     /**
  66.  
  67.       database user
  68.  
  69.       @string
  70.  
  71.     */
  72.  
  73.     var $dbuser = "my_user";// $mosConfig_user;
  74.  
  75.     /**
  76.  
  77.       database password
  78.  
  79.       @string
  80.  
  81.     */
  82.  
  83.     var $dbpass = "my_pass";
  84.  
  85.     /**
  86.  
  87.       table prefix
  88.  
  89.       @string
  90.  
  91.     */
  92.  
  93.     var $prefix = "jos_";   
  94.  
  95.    
  96.  
  97.     /**
  98.  
  99.       group id that will be the the minimum required to post news.
  100.  
  101.       @int
  102.  
  103.     */
  104.  
  105.     var $gid = 1;
  106.  
  107.        
  108.  
  109.     /**
  110.  
  111.       SimpleNews Configuration
  112.  
  113.     */
  114.  
  115.     /**
  116.  
  117.       width of the resized image (in pixels) - leave null and the image will be proportional to the Height
  118.  
  119.       @int
  120.  
  121.     */
  122.  
  123.     var $mainImageWidth = 500;
  124.  
  125.     /**
  126.  
  127.       height of the resized image (in pixels) - leave null and the image will be proportional to the Width
  128.  
  129.       @int
  130.  
  131.     */
  132.  
  133.     var $mainImageHeight = null;     
  134.  
  135.     /**
  136.  
  137.       thumb width
  138.  
  139.     */
  140.  
  141.     var $thumbImageWidth = 150;
  142.  
  143.     /**
  144.  
  145.       thumb height
  146.  
  147.     */
  148.  
  149.     var $thumbImageHeight = null;
  150.  
  151.    
  152.  
  153.     /**
  154.  
  155.         where is your joomla installation? (copy and paste the content of $mosConfig_live_site)
  156.  
  157.         @string
  158.  
  159.     */
  160.  
  161.     var $liveSite = 'http://localhost/';
  162.  
  163.    
  164.  
  165.     /**
  166.  
  167.       the pathway where store the images uploaded by SimpleNews (e.g.: joomla's stories directory)
  168.  
  169.       *** PLEASE INCLUDE THE FINAL SLASH ('/') ***
  170.  
  171.       @string
  172.  
  173.     */
  174.  
  175.     var $imagePath = "/home/me/public_html/images/stories/";
  176.  
  177.     /**
  178.  
  179.       the url to access the images uploaded by SimpleNews
  180.  
  181.       *** PLEASE INCLUDE THE FINAL SLASH ('/') ***
  182.  
  183.       @string
  184.  
  185.     */
  186.  
  187.     var $imageURL = "http://localhost/images/stories/";
  188.  
  189.    
  190.  
  191.     /**
  192.  
  193.       inside which section will the user be allowed to insert content? ( 0 = all )
  194.  
  195.       @int
  196.  
  197.     */
  198.  
  199.     var $mySection = 0;
  200.  
  201.    
  202.  
  203.     /**
  204.  
  205.       inside which category will the user be allowed to insert content? ( 0 = all )
  206.  
  207.       @int
  208.  
  209.     */
  210.  
  211.     var $myCategory = 0; //0;
  212.  
  213.    
  214.  
  215.     /**
  216.  
  217.       new items start published?
  218.  
  219.       @bool
  220.  
  221.     */
  222.  
  223.     var $published = true;
  224.  
  225.    
  226.  
  227.     /**
  228.  
  229.       new items will be shown on frontpage?
  230.  
  231.       @bool
  232.  
  233.     */
  234.  
  235.     var $frontpage = true;
  236.  
  237.    
  238.  
  239.     /**
  240.  
  241.       please select the language
  242.  
  243.       @string
  244.  
  245.     */
  246.  
  247.     var $language = "brazilian_portuguese"; // default: 'english'
  248.  
  249.    
  250.  
  251.         /**
  252.  
  253.                 use a WYSIWYG editor? (FCKeditor)
  254.  
  255.                 @bool
  256.  
  257.         */
  258.         var $editor = false;
  259.  
  260.     /**
  261.  
  262.       this array will store all languages installed on joomlafish
  263.  
  264.       @private
  265.  
  266.           @array
  267.  
  268.     */
  269.  
  270.     var $languages = array();
  271.  
  272.    
  273.  
  274.     /**
  275.  
  276.                 this var stores the user id.
  277.  
  278.                 @private
  279.  
  280.                 @int
  281.  
  282.         */
  283.  
  284.         var $uid = null;
  285.  
  286.        
  287.  
  288.     /**
  289.  
  290.       this var will be set automatically and will store there default language.
  291.  
  292.     */
  293.  
  294.     var $firstLanguage = null;
  295.  
  296.     /********************************************
  297.  
  298.    
  299.  
  300.         DONE! SimpleNews is configurated.
  301.  
  302.    
  303.  
  304.     ********************************************/
  305.  
  306.  
  307.  
  308.    
  309.  
  310.    
  311.  
  312.     /**
  313.  
  314.       Constructor
  315.  
  316.     */
  317.  
  318.     function SimpleNews(  ) {
  319.  
  320.         if (!file_exists("languages/" . $this->language . ".php") ) {
  321.  
  322.             die("Cannot find the language file. Check your configuration please");           
  323.  
  324.         }
  325.  
  326.         require_once("languages/" . $this->language . ".php");
  327.  
  328.         require_once("View.php");               
  329.  
  330.         //$this->logged = $_SESSION['logged'];
  331.  
  332.     }
  333.  
  334.    
  335.  
  336.    
  337.  
  338.     /**
  339.  
  340.       this is the function that will handle the screens. Basically, simpleNews has 5 screens:
  341.  
  342.       Three main screens:
  343.  
  344.        - The login screen (only if you use it not as a component)
  345.  
  346.        - The Main Form screen
  347.  
  348.        - A 'thank you' screen
  349.  
  350.      
  351.  
  352.       And two screens related to image upload:
  353.  
  354.        - The main form for image uploads
  355.  
  356.        - A thank you / error message.      
  357.  
  358.            The image form is the same for both thumbnails and the main image.
  359.  
  360.        
  361.  
  362.        Feel free to customize these screens the way you want (you may edit View.php for that)
  363.  
  364.           
  365.  
  366.            *** ADDED: PREVIEW FEATURE ***
  367.  
  368.     */
  369.  
  370.     function show($opt = null, $msg = null, $extra=null) {
  371.  
  372.         $screen = new SimpleNewsHTML;
  373.  
  374.        
  375.  
  376.         if ($opt != "preview") $screen->Start($this->mySection, $this->myCategory);       
  377.  
  378.         /* default... show the login screen */
  379.  
  380.         if ($opt == "login" || $this->logged == false || $opt == null) {
  381.  
  382.             $screen->showLogin($msg);           
  383.  
  384.         }
  385.  
  386.         /* main form */
  387.  
  388.         if ($opt == "form") {           
  389.  
  390.            $screen->showForm($msg, $this->firstLanguage, $this->editor, $this->mySection, $this->myCategory, $this->prefix);           
  391.  
  392.         }
  393.  
  394.        
  395.  
  396.         if ($opt == "imgForm") {
  397.  
  398.             $screen->showImgForm($msg, $extra);           
  399.  
  400.         }
  401.  
  402.        
  403.  
  404.         if ($opt == "imgSuccess") {
  405.  
  406.             $screen->showImgSuccess();           
  407.  
  408.         }
  409.  
  410.        
  411.  
  412.         /* final screen: success */
  413.  
  414.         if ($opt == "success") {
  415.  
  416.             $screen->showSuccess($msg);           
  417.  
  418.         }
  419.  
  420.                
  421.  
  422.                 if ($opt ==  "preview") {
  423.  
  424.                         // to fix : make this thing works dynamically :P
  425.  
  426.                         /* the parameter is the URL of the site.  */
  427.  
  428.                         $screen->preview($this->liveSite);
  429.  
  430.                 }
  431.  
  432.        
  433.  
  434.         if ($opt != "preview") $screen->footer();       
  435.  
  436.        
  437.  
  438.     }
  439.  
  440.    
  441.  
  442.     /**
  443.  
  444.       Simple function that validates a user
  445.  
  446.       @param string username
  447.  
  448.       @param string password     
  449.  
  450.       @return boolean
  451.  
  452.     */
  453.  
  454.     function validate($usr, $pass) {
  455.  
  456.         if (!$this->link) {
  457.  
  458.             $this->init_db();
  459.  
  460.         }
  461.         $usr = mysql_real_escape_string($usr);
  462.  
  463.         $table = $this->prefix . 'users';
  464.        
  465.         /* fix to work with salted passwords!! */
  466.         $query = "SELECT id, name, username, password, usertype, block, gid"
  467.                                 . "\n FROM $table"
  468.                                 . "\n WHERE username = '$usr'";
  469.         $tmp = mysql_query($query) or die(mysql_error());
  470.         $row = mysql_fetch_assoc($tmp);
  471.         list($hash, $salt) = explode(':', $row['password']);
  472.         $cryptpass = md5($pass.$salt);
  473.         if ($hash != $cryptpass) {
  474.                 return false; // didn't match!
  475.         }
  476.         else {
  477.  
  478.                         $this->uid = mysql_result($tmp,0,0);
  479.  
  480.             return true;
  481.  
  482.         }
  483.  
  484.        
  485.  
  486.     }
  487.  
  488.     /**
  489.  
  490.                 Initiates a connection with the database... a bit amateur, but it works.
  491.  
  492.                 @private
  493.  
  494.         */
  495.  
  496.     function init_db() {
  497.  
  498.         $this->link = mysql_connect($this->host, $this->dbuser, $this->dbpass) or die(mysql_error());
  499.  
  500.         mysql_select_db($this->db, $this->link) or die(mysql_error());
  501.  
  502. //        @mysql_query("SET NAMES 'utf8'", $this->link); // uncomment this line to use with UTF-8 databases
  503.  
  504.     }
  505.  
  506.    
  507.  
  508.     /**
  509.  
  510.       Detects if Joomlafish is installed
  511.  
  512.       @return bool
  513.  
  514.     */
  515.  
  516.     function detectJoomlafish() {
  517.  
  518.         if(!$this->link) {
  519.  
  520.             $this->init_db();
  521.  
  522.         }
  523.  
  524.         /* looking for joomlafish tables  */
  525.  
  526.         $res = mysql_query("SHOW TABLES FROM ".$this->db ." LIKE '%_mbf%'");
  527.  
  528.         $cnt = mysql_num_rows($res); // flag :P       
  529.  
  530.         if ($cnt == 0) return false;
  531.  
  532.        
  533.  
  534.         /* populating language's array (I really hope alex doesn't change the name of mambelfish tables :D) */
  535.  
  536.         $res = mysql_query("SELECT id, name, ordering FROM `".$this->prefix."mbf_language` ORDER BY ordering ,id  LIMIT 0,20") or die( mysql_error() );
  537.  
  538.         while( $row = mysql_fetch_array($res) ) {
  539.  
  540.             $this->addLanguage($row['id'], $row['name']);
  541.  
  542.         }
  543.  
  544.         $this->firstLanguage = $this->getFirstLanguage();
  545.  
  546.         return true;
  547.  
  548.     }   
  549.  
  550.    
  551.  
  552.     function addLanguage($id, $name) {
  553.  
  554.         $this->languages[$id] = $name;   
  555.  
  556.     }
  557.  
  558.    
  559.  
  560.     function getLanguages() {
  561.  
  562.         return $this->languages;
  563.  
  564.     }
  565.  
  566.    
  567.  
  568.     function getFirstLanguage() {
  569.  
  570.         reset($this->languages);
  571.  
  572.         $firstLanguageId = key($this->languages);
  573.  
  574.         // do we need this second reset?
  575.  
  576.         reset($this->languages);
  577.  
  578.         return $firstLanguageId;
  579.  
  580.     }
  581.  
  582.    
  583.  
  584.     /**
  585.  
  586.       Small function that populates the combobox with all categories from the given section
  587.  
  588.     */
  589.  
  590.     function loadCategories($sec) {
  591.  
  592.         if (!$this->link) {
  593.  
  594.             $this->init_db();
  595.  
  596.         }
  597.  
  598.         $sql = "SELECT DISTINCT title, id FROM ".$this->prefix."categories WHERE section = '$sec' ";
  599.  
  600.         $result = mysql_query($sql);
  601.  
  602.         $num_rows = mysql_num_rows($result);   
  603.  
  604.         ?>       
  605.  
  606.         <html>
  607.  
  608.         <head>
  609.  
  610.         <?
  611.         //echo ' <meta http-equiv="content-type" content="text/html; charset=UTF-8"> '; // uncomment this line to use with a utf-8 database
  612.         ?>
  613.  
  614.         <script language="JavaScript">
  615.  
  616.        <?php               
  617.         if ($num_rows > 0) {
  618.  
  619.                 while ($row = mysql_fetch_row($result)) {                                               
  620.  
  621.                         print "window.parent.adiciona('".addslashes($row[0])."','".addslashes($row[1])."','categoria');\n";
  622.  
  623.                 }
  624.  
  625.                
  626.  
  627.         }
  628.  
  629.         ?>       
  630.  
  631.        </script>
  632.  
  633.        </head>
  634.  
  635.        <body>
  636.  
  637.        </body>
  638.  
  639.        </html>
  640.  
  641.         <?
  642.  
  643.     }   
  644.  
  645.    
  646.  
  647.                
  648.  
  649.     /* the same from version 1.2 :P it may sucks, but it works */   
  650.  
  651.     function uploadImage() {
  652.  
  653.         require_once("ImageResizeFactory.php");       
  654.  
  655.         $maxSize = "1048576"; // 1MB upload size of the file.   
  656.  
  657.         if ($_POST['extra'] == "main") {
  658.  
  659.             $width = $this->mainImageWidth;
  660.  
  661.             $height = $this->mainImageHeight;
  662.  
  663.         } else {
  664.  
  665.             $width = $this->thumbImageWidth;
  666.  
  667.             $height = $this->thumbImageHeight;
  668.  
  669.         }
  670.  
  671.         $path_imagens = $this->imagePath;
  672.  
  673.        
  674.  
  675.                 $allowedExtensions = array("jpg", "JPG", "JPEG", "png", "PNG");
  676.  
  677.        
  678.  
  679.         $uploadedFileName = $_FILES['filename']['name'];
  680.  
  681.                 if($_FILES['filename']['size'] > $maxSize)
  682.  
  683.                 {
  684.  
  685.                         $error = _ERR_IMG_FILE_SIZE;
  686.  
  687.                 }
  688.  
  689.         $extension = pathinfo($_FILES['filename']['name']);
  690.  
  691.                 $extension = $extension["extension"];
  692.  
  693.                 foreach($allowedExtensions as $key=>$ext) {
  694.  
  695.                         if(strcasecmp($ext, $extension) == 0)
  696.  
  697.                         {
  698.  
  699.                                 $boolValidExt = true;
  700.  
  701.                                 break;
  702.  
  703.                         }
  704.  
  705.                 }
  706.  
  707.                 if($boolValidExt) {
  708.  
  709.                         if(empty($error)) {
  710.  
  711.                                 if(is_uploaded_file($_FILES['filename']['tmp_name'])) {
  712.  
  713.                                         copy($_FILES['filename']['tmp_name'], $path_imagens . $uploadedFileName);
  714.  
  715.                                 }
  716.  
  717.                         }
  718.  
  719.                 }
  720.  
  721.                 else
  722.  
  723.                 {
  724.  
  725.                         $error = _ERR_IMG_FILE_EXTENSION;
  726.  
  727.                         echo $error;
  728.  
  729.                         exit;
  730.  
  731.                 }
  732.  
  733.                 if(empty($error))
  734.  
  735.                 {
  736.  
  737.                         $srcFile = $path_imagens . $uploadedFileName;
  738.  
  739.                         $destFile = $path_imagens . "sn_"time() . $uploadedFileName;
  740.  
  741.                
  742.  
  743.                 // getting the image size (width and height)
  744.  
  745.                 // $arrImgSize = getimagesize($srcFile);
  746.  
  747.                
  748.  
  749.                         // Instantiate the correct object depending on type of image i.e jpg or png
  750.  
  751.                         $objResize = ImageResizeFactory::getInstanceOf($srcFile, $destFile, $width, $height);
  752.  
  753.                         // Call the method to resize the image
  754.  
  755.                         $objResize->getResizedImage();
  756.  
  757.                         unlink($srcFile);
  758.  
  759.                         unset($objResize);
  760.  
  761.                         //header("Location:" . $destFile); // debug               
  762.  
  763.                 ?>               
  764.  
  765.                 <html>
  766.  
  767.                 <head>
  768.  
  769.                   <title><?php echo _PAGE_TITLE ?></title>
  770.  
  771.                   <link href="layout/css/css.css" rel="stylesheet" type="text/css">
  772.  
  773.         <?
  774.         // echo ' <meta http-equiv="content-type" content="text/html; charset=UTF-8"> '; // uncomment this line to use with a utf-8 database
  775.         ?>
  776.  
  777.                 </head>
  778.  
  779.                
  780.  
  781.                                 <? if ($_POST['extra'] == 'main') { ?>
  782.  
  783.                                       <body onload="window.opener.setImg('<?=$destFile; ?>');">
  784.  
  785.                                       <table width="80%"  border="0" align="center" cellpadding="5" cellspacing="0" class="contorno">
  786.  
  787.                                         <tr>
  788.  
  789.                                           <td bgcolor="#DDDDDD"><div align="center"><? echo _IMG_SUCCESS ?></div></td>
  790.  
  791.                                         </tr>
  792.  
  793.                                         <tr>
  794.  
  795.                                           <td bgcolor="#DDDDDD"><a href="#" onClick="javascript:window.close();"><? echo _CLOSE ?></a>&nbsp;</td>
  796.  
  797.                                         </tr>
  798.  
  799.                                     </table></body></html>
  800.  
  801.                                 <? } else { ?>
  802.  
  803.                                       <body onload="window.opener.setThumb('<?=$destFile; ?>');">
  804.  
  805.                                       <table width="80%"  border="0" align="center" cellpadding="5" cellspacing="0" class="contorno">
  806.  
  807.                                         <tr>
  808.  
  809.                                           <td bgcolor="#DDDDDD"><div align="center"><? echo _IMG_SUCCESS ?></div></td>
  810.  
  811.                                         </tr>
  812.  
  813.                                         <tr>
  814.  
  815.                                           <td bgcolor="#DDDDDD"><a href="#" onClick="javascript:window.close();"><? echo _CLOSE ?></a>&nbsp;</td>
  816.  
  817.                                         </tr>
  818.  
  819.                                       </table></body></html>
  820.  
  821.                                 <? }
  822.  
  823.                         exit;
  824.  
  825.                 }
  826.  
  827.         else $this->show("imgForm", $error, $type);
  828.  
  829.     }
  830.  
  831.    
  832.  
  833.     /**
  834.  
  835.         attempt to get rid of the quotes problem
  836.  
  837.      */
  838.  
  839.     function workQuotes($sql) {
  840.  
  841.             $sql = trim( $sql );
  842.  
  843.             $prefix$this->prefix;
  844.  
  845.  
  846.  
  847.                 $escaped = false;
  848.  
  849.                 $quoteChar = '';
  850.  
  851.  
  852.  
  853.                 $n = strlen( $sql );
  854.  
  855.  
  856.  
  857.                 $startPos = 0;
  858.  
  859.                 $literal = '';
  860.  
  861.                 while ($startPos < $n) {
  862.  
  863.                         $ip = strpos($sql, $prefix, $startPos);
  864.  
  865.                         if ($ip === false) {
  866.  
  867.                                 break;
  868.  
  869.                         }
  870.  
  871.  
  872.  
  873.                         $j = strpos( $sql, "'", $startPos );
  874.  
  875.                         $k = strpos( $sql, '"', $startPos );
  876.  
  877.                         if (($k !== FALSE) && (($k < $j) || ($j === FALSE))) {
  878.  
  879.                                 $quoteChar      = '"';
  880.  
  881.                                 $j                  = $k;
  882.  
  883.                         } else {
  884.  
  885.                                 $quoteChar      = "'";
  886.  
  887.                         }
  888.  
  889.  
  890.  
  891.                         if ($j === false) {
  892.  
  893.                                 $j = $n;
  894.  
  895.                         }
  896.  
  897.  
  898.  
  899.                         $literal .= str_replace( $prefix, $this->prefix, substr( $sql, $startPos, $j - $startPos ) );
  900.  
  901.                         $startPos = $j;
  902.  
  903.  
  904.  
  905.                         $j = $startPos + 1;
  906.  
  907.  
  908.  
  909.                         if ($j >= $n) {
  910.  
  911.                                 break;
  912.  
  913.                         }
  914.  
  915.  
  916.  
  917.                         // quote comes first, find end of quote
  918.  
  919.                         while (TRUE) {
  920.  
  921.                                 $k = strpos( $sql, $quoteChar, $j );
  922.  
  923.                                 $escaped = false;
  924.  
  925.                                 if ($k === false) {
  926.  
  927.                                         break;
  928.  
  929.                                 }
  930.  
  931.                                 $l = $k - 1;
  932.  
  933.                                 while ($l >= 0 && $sql{$l} == '\\') {
  934.  
  935.                                         $l--;
  936.  
  937.                                         $escaped = !$escaped;
  938.  
  939.                                 }
  940.  
  941.                                 if ($escaped) {
  942.  
  943.                                         $j      = $k+1;
  944.  
  945.                                         continue;
  946.  
  947.                                 }
  948.  
  949.                                 break;
  950.  
  951.                         }
  952.  
  953.                         if ($k === FALSE) {
  954.  
  955.                                 // error in the query - no end quote; ignore it
  956.  
  957.                                 break;
  958.  
  959.                         }
  960.  
  961.                         $literal .= substr( $sql, $startPos, $k - $startPos + 1 );
  962.  
  963.                         $startPos = $k+1;
  964.  
  965.                 }
  966.  
  967.                 if ($startPos < $n) {
  968.  
  969.                         $literal .= substr( $sql, $startPos, $n - $startPos );
  970.  
  971.                 }
  972.  
  973.                 return $literal;
  974.  
  975.                     
  976.  
  977.         }
  978.  
  979.    
  980.  
  981.     /**
  982.  
  983.                 add a new content item into your joomla/mambo website.
  984.  
  985.                
  986.  
  987.         */
  988.  
  989.     function insert() {
  990.  
  991.         if ( empty($_POST) ) {
  992.  
  993.             die(_ERR_NO_INFO);
  994.  
  995.         }
  996.  
  997.         if(!$this->link) {
  998.  
  999.             $this->init_db();
  1000.  
  1001.         }
  1002.  
  1003.         /* as the language forms were built dynamically, we need to separate the prefix of the field and the id of the language */
  1004.  
  1005.         $i=0;
  1006.  
  1007.                 $vet_lang = "";
  1008.  
  1009.                 $vet_var = "";
  1010.  
  1011.                 foreach($_POST as $k => $v){
  1012.  
  1013.                         $$k = $v;
  1014.  
  1015.                                 //      echo "<strong>$$k</strong> = $v<br>  "; // debug
  1016.  
  1017.                         if (is_numeric(substr($k,-1))){ // verifica último digito para saber o idioma
  1018.  
  1019.                                 if ($$k != NULL){                     // testa se a variável de outro idioma não está vazia
  1020.  
  1021.                                         $arr = explode("_", $k);
  1022.  
  1023.                                         $vet_lang[$i] = $arr[1]// armazena no vetor de linguagens o número dos idiomas     
  1024.  
  1025.                                         $vet_var[$i] = $k;              // armazena o nome das variáveis de outro idioma
  1026.  
  1027.                                         $i++;
  1028.  
  1029.                                 }                            
  1030.  
  1031.                         //      echo "is numeric<br>Vet = $vet_lang[$i]<br>arr[0] = $arr[0]<br>arr[1] = $arr[1]<hr>e k vale = $k e kk vale $$k<hr>"; // debug
  1032.  
  1033.                         }
  1034.  
  1035.        
  1036.  
  1037.                 }       
  1038.  
  1039.         if (!$olho || !$titulo) die( _ERR_PREENCHA_TUDO );
  1040.  
  1041.         if (!$categoria || !$secao) die( _ERR_CATEGORIA_SECAO );
  1042.  
  1043.        
  1044.  
  1045.                 if ($thumbImage && $thumbImage != _NENHUMA_IMAGEM) {
  1046.  
  1047.                                 $thumbImage = str_replace($this->imagePath, $this->imageURL, $thumbImage);                       
  1048.  
  1049.                 }
  1050.  
  1051.                 if ($imagem && $imagem != _NENHUMA_IMAGEM) {
  1052.  
  1053.                     $imagem = str_replace($this->imagePath, $this->imageURL, $imagem);
  1054.  
  1055.                     $texto = "<img src=\"$imagem\" align=\"center\" vspace=\"5\"><br />" . $texto;
  1056.  
  1057.                 }   
  1058.  
  1059.       &n