daily pastebin goal
31%
SHARE
TWEET

Untitled

a guest Jul 12th, 2018 61 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
  1. <?php
  2.  
  3. function handler_categories ($purpose=null, $dbResource=null, $siteLanguage=null, $data=null) {
  4.  
  5.     switch($purpose) {
  6.         case 'general_data':
  7.             $select = mysql_query("SELECT id,category_alias,category_name,category_name_$siteLanguage FROM gab_sys_categories",$dbResource);
  8.  
  9.             while($fetch = mysql_fetch_row($select)) {
  10.  
  11.                 $categoryIds[] = $fetch[0];
  12.                 $categoryAli[] = $fetch[1];
  13.                 $categoryNam[] = $fetch[2];
  14.                 $categoryLan[] = $fetch[3];
  15.             }
  16.  
  17.             $generalArray[0] = $categoryIds;
  18.              $generalArray[1] = $categoryAli;
  19.              $generalArray[2] = $categoryNam;
  20.              $generalArray[3] = $categoryLan;
  21.  
  22.              return $generalArray;
  23.             break;
  24.  
  25.         case 'report_error':
  26.             switch($siteLanguage) {
  27.                 case'it': $error = 'Nessuna categoria selezionata'; break;
  28.                 case'es': $error = 'Ninguna categor&iacute;a disponible'; break;
  29.                 case'fr': $error = 'Pas de cat&eacute;gorie disponible'; break;
  30.                 case'en': $error = 'No categories selected'; break;
  31.                 default:  $error = 'No data availables in this language'; break;
  32.             }
  33.  
  34.             return $error;
  35.             break;
  36.  
  37. // Si parte da qui..
  38.         case 'report_category_name':
  39.             $tableParams = array('category_name','id');
  40.             break;
  41.  
  42.         case 'report_category_language_name':
  43.             $tableParams = array("category_name_$siteLanguage",'id');
  44.             break;
  45.                
  46. /**/
  47.     }
  48.  
  49.  
  50.     if (isset($tableParams)) {
  51.  
  52.         $selectCategoryName = mysql_query("SELECT {$tableParams[0]} AS columnResult FROM gab_sys_categories WHERE {$tableParams[1]}='$data'",$dbResource);
  53.         return mysql_result($selectCategoryName,0,'columnResult');    
  54.     }
  55.    
  56.    
  57.     // Nothing matched
  58.     return 0;
  59. }
  60. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top