Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.10 KB | None | 0 0
  1. //------------------------------------------------------------------------------
  2.   public function resulOK($res, $js = '', $echo = 1) {
  3.     $js .= $this->onResultJs;
  4.     $this->onResultJs='';
  5.     parent::resulOK($res, $js, $echo);
  6.   }
  7.  
  8. //------------------------------------------------------------------------------
  9.   public function resultERROR($res, $js = '', $echo = 1) {
  10.     $js.=$this->onResultJs;
  11.     $this->onResultJs='';
  12.     return parent::resultERROR($res, $js, $echo);
  13.   }
  14.  
  15. //------------------------------------------------------------------------------
  16.     public function resulOK($res, $js = '', $echo = 1) {
  17.         $res = json_encode(array('res' => $res, 'js' => $js));
  18.         if ($res==false) {
  19.             file_put_contents(logsDir().'/lastJsonError.txt', $js);
  20.             die('JSON klaida: '.json_last_error_msg ());
  21.         }
  22.        
  23.         if ($echo == 1) {
  24.             echo $res;
  25.             die;
  26.         }
  27.         return $res;
  28.     }
  29.  
  30. //------------------------------------------------------------------------------
  31.     public function resultERROR($res, $js = '', $echo = 1) {
  32.         $res1=$res;
  33.         if (!empty($res) and is_numeric($res)) {
  34.             $res = $this->db->error($res);
  35.             if (TSMV::isCamel()) {
  36.                 $res=utf($res);
  37.             }
  38.         }
  39.        
  40.         if ($res1==-999999) {
  41.            $w = $this->db->exec_Func("warn.v_warnUser");
  42.            if (!empty($w)) {
  43.              echo $w;
  44.              die;
  45.            }
  46.         }
  47.         else if ($res1<0) {
  48.            $w = $this->db->exec_Func("warn.v_warnUser");
  49.            if (!empty($w)) {
  50.                if (TSMV::isCamel()) {
  51.                 $w=utf($w);
  52.                }
  53.              $res.=" ".$w;
  54.            }
  55.         }
  56.        
  57.         $res = json_encode(array('error' =>$res, 'js' => $js));
  58.         if ($res==false) {
  59.             file_put_contents(logsDir().'/lastJsonError.txt', $js);
  60.             die('JSON klaida: '.json_last_error_msg ());
  61.         }
  62.         if ($echo == 1) {
  63.             echo $res;
  64.             die;
  65.         }
  66.         return $res;
  67.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement