Show
Ignore:
Timestamp:
06/19/11 04:58:09 (2 years ago)
Author:
mbrevda
Message:

re #5170 - work in progress!

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.10/ivr/page.ivr.php

    r11868 r12257  
    11<?php  
    22/* $Id$ */ 
    3 //Copyright (C) 2004 Coalescent Systems Inc. (info@coalescentsystems.ca) 
    4 // 
    5 //This program is free software; you can redistribute it and/or 
    6 //modify it under the terms of the GNU General Public License 
    7 //as published by the Free Software Foundation; either version 2 
    8 //of the License, or (at your option) any later version. 
    9 // 
    10 //This program is distributed in the hope that it will be useful, 
    11 //but WITHOUT ANY WARRANTY; without even the implied warranty of 
    12 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    13 //GNU General Public License for more details. 
     3/* 
     4 * Copyright (C) 2004 Coalescent Systems Inc. (info@coalescentsystems.ca) 
     5 *  
     6 * This program is free software; you can redistribute it and/or 
     7 * modify it under the terms of the GNU General Public License 
     8 * as published by the Free Software Foundation; either version 2 
     9 * of the License, or (at your option) any later version. 
     10 * 
     11 * This program is distributed in the hope that it will be useful, 
     12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     14 * GNU General Public License for more details. 
     15 */ 
    1416 
    15 // The Digital Receptionist code is a rat's nest.  If you are planning on making significant modifications, just re-write from scratch. 
    16 // OK! You're the boss. --Rob 
    17 // Re-written from the ground up by Rob Thomas <xrobau@gmail.com> 23rd March, 2006. 
    18  
    19 $action = isset($_REQUEST['action'])?$_REQUEST['action']:''; 
    20 $id = isset($_REQUEST['id'])?$_REQUEST['id']:''; 
    21 $dircontext = isset($_SESSION["AMP_user"]->_deptname)?$_SESSION["AMP_user"]->_deptname:''; 
    22 $nbroptions = isset($_REQUEST['nbroptions'])?$_REQUEST['nbroptions']:'3'; 
     17$get_vars = array( 
     18        'action'    => '', 
     19        'id'      => '', 
     20        'nbroptions'  => '3', 
     21        'display'   => '' 
     22); 
     23foreach ($get_vars as $k => $v) { 
     24  $var[$k] = isset($_REQUEST[$k]) ? $_REQUEST[$k] : $v; 
     25  $$k = $var[$k];//todo: legacy support, needs to GO! 
     26
     27$dircontext = 'default'; 
    2328$tabindex = 0; 
    2429 
    25 if (empty($dircontext)) { 
    26   $dircontext = 'default'; 
    27 
     30echo load_view(dirname(__FILE__) . '/views/rnav.php', array('ivr_results' => ivr_list()) + $var); 
    2831 
    2932switch ($action) { 
     
    3437    $def['ena_directdial'] = ''; 
    3538    $def['ena_directory'] = ''; 
    36     ivr_sidebar($id); 
    37     ivr_show_edit($id, 3,  $def); 
    3839    break; 
    3940  case "edit": 
    40     ivr_sidebar($id); 
    41     ivr_show_edit($id, $nbroptions, $_POST); 
    4241    break; 
    4342  case "edited": 
     
    4847    } else { 
    4948      ivr_do_edit($id, $_POST); 
    50       ivr_sidebar($id); 
    5149      if (isset($_REQUEST['increase']))  
    5250        $nbroptions++; 
     
    6361    } 
    6462  default: 
    65     ivr_sidebar($id); 
     63 
    6664?> 
    6765<div class="content"> 
    68 <h2><?php echo _("Digital Receptionist"); ?></h2> 
    69 <h3><?php  
    70 echo _("Instructions")."</h3>"; 
    71 echo _("You use the Digital Receptionist to make IVR's, Interactive Voice Response systems.")."<br />\n"; 
    72 echo _("When creating a menu option, apart from the standard options of 0-9,* and #, you can also use 'i' and 't' destinations.")."\n"; 
    73 echo _("'i' is used when the caller pushes an invalid button, and 't' is used when there is no response.")."\n"; 
    74 echo _("If those options aren't supplied, the default 't' is to replay the menu three times and then hang up,")."\n"; 
    75 echo _("and the default 'i' is to say 'Invalid option, please try again' and replay the menu.")."\n"; 
    76 echo _("After three invalid attempts, the line is hung up.")."\n"; ?> 
    77 </div> 
     66<h2><?php echo _("IVR"); ?></h2> 
     67<br/><br/>{add add button here}<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/> 
     68<br/><br/><br/><br/><br/><br/><br/> 
    7869 
    7970<?php 
     
    8172 
    8273 
    83 function ivr_sidebar($id)  { 
    8474?> 
    85         <div class="rnav"><ul> 
    86         <li><a id="<?php echo empty($id)?'current':'nul' ?>" href="config.php?display=ivr&amp;action=add"><?php echo _("Add IVR")?></a></li> 
    87 <?php 
    88  
    89         $ivr_results = ivr_list(); 
    90         if (isset($ivr_results)){ 
    91                 foreach ($ivr_results as $tresult) { 
    92                         echo "<li><a id=\"".($id==$tresult['ivr_id'] ? 'current':'nul')."\" href=\"config.php?display=ivr"; 
    93                         echo "&amp;action=edit&amp;id={$tresult['ivr_id']}\">{$tresult['displayname']}</a></li>\n"; 
    94                 } 
    95         } 
    96         echo "</ul></div>\n"; 
    97 } 
    98  
    99 function ivr_show_edit($id, $nbroptions, $post) { 
    100   global $db; 
    101   global $tabindex; 
    102  
    103   $ivr_details = ivr_get_details($id); 
    104   $ivr_dests = ivr_get_dests($id); 
    105 ?> 
    106   <div class="content"> 
    107   <h2><?php echo _("Digital Receptionist"); ?></h2> 
    108   <h3><?php echo _("Edit Menu")." ".$ivr_details['displayname']; ?></h3> 
    109 <?php  
    110 ?> 
    111   <form name="prompt" action="<?php $_SERVER['PHP_SELF'] ?>" method="post" onsubmit="return prompt_onsubmit();"> 
    112   <input type="hidden" name="action" value="edited" /> 
    113   <input type="hidden" name="display" value="ivr" /> 
    114   <input type="hidden" name="id" value="<?php echo $id ?>" /> 
    115   <input name="Submit" type="submit" value="<?php echo _("Save")?>" tabindex="<?php echo ++$tabindex;?>" disabled> 
    116 <?php 
    117   $usage_list = array(); 
    118   if (function_exists('queues_ivr_usage')) { 
    119     $usage_list = queues_ivr_usage($id); 
    120   } 
    121   if (count($usage_list)) { 
    122 ?> 
    123     <a href="#" class="info"><?php echo _("Queue Breakout Menu Usage List");?><span><?php echo _("This IVR is being used by the following Queues, providing an ability for callers to hear this Queue's announcement periodically and giving callers an option to break out of the queue into this IVR's menu options. This queue can not be deleted when being used in this mode");?></span></a> 
    124 <?php 
    125     $count = 0; 
    126     foreach ($usage_list as $link) { 
    127       $label = '<span><img width="16" height="16" border="0" title="'.$link['description'].'" alt="" src="images/queue_link.png"/>&nbsp;'.$link['description'].'</span>'; 
    128       echo "<br /><a href=".$link['url_query'].">".$label."</a>"; 
    129     } 
    130     echo "<br />"; 
    131   } else { 
    132 ?> 
    133   <input name="delete" type="submit" value="<?php echo _("Delete")." "._("Digital Receptionist")." {$ivr_details['displayname']}"; ?>" disabled/> 
    134 <?php 
    135   } 
    136   if ($id) { 
    137     $usage_list = framework_display_destination_usage(ivr_getdest($id)); 
    138     if (!empty($usage_list)) { 
    139     ?> 
    140       <br /><a href="#" class="info"><?php echo $usage_list['text']?>:<span><?php echo $usage_list['tooltip']?></span></a> 
    141     <?php 
    142     } 
    143   } 
    144   ?> 
    145   <table> 
    146     <tr><td colspan=2><hr /></td></tr> 
    147     <tr> 
    148       <td><a href="#" class="info"><?php echo _("Change Name"); ?><span><?php echo _("This changes the short name, visible on the right, of this IVR");?></span></a></td> 
    149       <td><input type="text" name="displayname" value="<?php echo $ivr_details['displayname'] ?>" tabindex="<?php echo ++$tabindex;?>"></td> 
    150     </tr> 
    151  
    152 <?php 
    153   $annmsg_id = isset($ivr_details['announcement_id'])?$ivr_details['announcement_id']:''; 
    154   if(function_exists('recordings_list')) { //only include if recordings is enabled ?> 
    155     <tr> 
    156       <td><a href="#" class="info"><?php echo _("Announcement")?><span><?php echo _("Message to be played to the caller. To add additional recordings please use the \"System Recordings\" MENU to the left")?></span></a></td> 
    157       <td> 
    158         <select name="annmsg_id" tabindex="<?php echo ++$tabindex;?>"> 
    159         <?php 
    160           $tresults = recordings_list(); 
    161           echo '<option value="">'._("None")."</option>"; 
    162           if (isset($tresults[0])) { 
    163             foreach ($tresults as $tresult) { 
    164               echo '<option value="'.$tresult['id'].'"'.($tresult['id'] == $annmsg_id ? ' SELECTED' : '').'>'.$tresult['displayname']."</option>\n"; 
    165             } 
    166           } 
    167         ?> 
    168         </select> 
    169       </td> 
    170     </tr> 
    171    
    172 <?php 
    173   } else { 
    174 ?> 
    175     <tr> 
    176       <td><a href="#" class="info"><?php echo _("Announcement")?><span><?php echo _("Message to be played to the caller.<br><br>You must install and enable the \"Systems Recordings\" Module to edit this option")?></span></a></td> 
    177       <td> 
    178       <?php 
    179         $default = (isset($annmsg_id) ? $annmsg_id : ''); 
    180       ?> 
    181         <input type="hidden" name="annmsg_id" value="<?php echo $default; ?>"><?php echo ($default != '' ? $default : 'None'); ?> 
    182       </td> 
    183     </tr> 
    184 <?php 
    185   } 
    186 ?> 
    187     <tr> 
    188       <td><a href="#" class="info"><?php echo _("Timeout");?><span><?php echo _("The amount of time (in seconds) before the 't' option, if specified, is used");?></span></a></td> 
    189       <td><input type="text" name="timeout" value="<?php echo $ivr_details['timeout'] ?>" tabindex="<?php echo ++$tabindex;?>"></td> 
    190     </tr> 
    191     <?php if ($ivr_details['enable_directory'] && function_exists('voicemail_getVoicemail')) { ?> 
    192     <tr> 
    193       <td><a href="#" class="info"><?php echo _("Enable Directory");?><span><?php echo _("Let callers into the IVR dial '#' to access the directory. WARNING: this feature is deprecated and will be removed from future versions. You should install the Directory module and assign an IVR destination to use Directory functionality.");?></span></a></td> 
    194       <td><input type="checkbox" name="ena_directory" <?php echo $ivr_details['enable_directory'] ?> tabindex="<?php echo ++$tabindex;?>"></td> 
    195     </tr> 
    196     <tr> 
    197       <td><a href="#" class="info"><?php echo _("Directory Context");?><span><?php echo _("When # is selected, this is the voicemail directory context that is used");?></span></a></td> 
    198       <td> 
    199         <select name="dircontext" tabindex="<?php echo ++$tabindex;?>"> 
    200           <?php 
    201           $vm_results = voicemail_getVoicemail(); 
    202           $vmcontexts = array_keys($vm_results); 
    203           foreach ($vmcontexts as $vmc) { 
    204             if (($vmc != 'general') && ($vmc != 'zonemessages')) { 
    205               echo '<option value="'.$vmc.'"'.($vmc == $ivr_details['dircontext'] ? ' SELECTED' : '').'>'.$vmc."</option>\n"; 
    206             } 
    207           } 
    208           ?> 
    209         </select> 
    210       </td> 
    211     </tr> 
    212     <?php } ?> 
    213     <tr> 
    214       <td><a href="#" class="info"><?php echo _("VM Return to IVR");?><span><?php echo _("If checked, upon exiting voicemail a caller will be returned to this IVR if they got a users voicemail");?></span></a></td> 
    215       <td><input type="checkbox" name="retvm" <?php echo $ivr_details['retvm'] ?> tabindex="<?php echo ++$tabindex;?>"></td> 
    216     </tr> 
    217 <?php 
    218   if (!function_exists('directory_list')) { 
    219 ?> 
    220     <tr> 
    221       <td><a href="#" class="info"><?php echo _("Enable Direct Dial");?><span><?php echo _("Let callers into the IVR dial an extension directly");?></span></a></td> 
    222       <td><input type="checkbox" name="ena_directdial" <?php echo $ivr_details['enable_directdial'] ?> tabindex="<?php echo ++$tabindex;?>"></td> 
    223     </tr> 
    224 <?php 
    225   } else { 
    226 ?> 
    227     <tr> 
    228       <td><a href="#" class="info"><?php echo _("Direct Dial Options");?><span><?php echo _("Provides options for callers to direct dial an extension. Direct dialing can be completely disabled, it can be enabled for all extensions on a system, or it can be tied to a Company Directory allowing any member listed in that directory to be dialed directly if their extension is known. If an extension in the chosen directory is overridden, only that overridden number is dialable");?></span></a></td> 
    229       <td> 
    230         <select name="ena_directdial" tabindex="<?php echo ++$tabindex;?>"> 
    231           <?php 
    232           $dlist = directory_list(); 
    233           echo '<option value=""'.($ivr_details['enable_directdial'] == '' ? ' SELECTED' : '').'>'._('Disabled')."</option>\n"; 
    234           echo '<option value="CHECKED"'.(strtoupper($ivr_details['enable_directdial']) == 'CHECKED' ? ' SELECTED' : '').'>'._('All Extensions')."</option>\n"; 
    235           foreach ($dlist as $dir) { 
    236             echo '<option value="'.$dir['id'].'"'.($ivr_details['enable_directdial'] == $dir['id'] ? ' SELECTED' : '').'>'.$dir['dirname']."</option>\n"; 
    237           } 
    238           ?> 
    239         </select> 
    240       </td> 
    241     </tr> 
    242  
    243 <?php 
    244   } 
    245 ?> 
    246     <tr> 
    247       <td><a href="#" class="info"><?php echo _("Loop Before t-dest");?><span><?php echo _("If checked, and there is a 't' (timeout) destination defined below, the IVR will loop back to the beginning if no input is provided for the designated loop counts prior to going to the timeout (t) destination.");?></span></a></td> 
    248       <td><input type="checkbox" name="alt_timeout" <?php echo $ivr_details['alt_timeout'] ?> tabindex="<?php echo ++$tabindex;?>"></td> 
    249     </tr> 
    250 <?php 
    251   $timeout_id = isset($ivr_details['timeout_id'])?$ivr_details['timeout_id']:''; 
    252   if(function_exists('recordings_list')) { //only include if recordings is enabled ?> 
    253     <tr> 
    254       <td><a href="#" class="info"><?php echo _("Timeout Message")?><span><?php echo _("If a timeout occurs and a message is selected, it will be played in place of the announcement message when looping back to the top of the IVR. It will not be played if the t destination is the next target.")?></span></a></td> 
    255       <td> 
    256         <select name="timeout_id" tabindex="<?php echo ++$tabindex;?>"> 
    257         <?php 
    258           //$tresults obtained above 
    259           echo '<option value="">'._("None")."</option>"; 
    260           if (isset($tresults[0])) { 
    261             foreach ($tresults as $tresult) { 
    262               echo '<option value="'.$tresult['id'].'"'.($tresult['id'] == $timeout_id ? ' SELECTED' : '').'>'.$tresult['displayname']."</option>\n"; 
    263             } 
    264           } 
    265         ?> 
    266         </select> 
    267       </td> 
    268     </tr> 
    269 <?php 
    270   } 
    271 ?> 
    272     <tr> 
    273       <td><a href="#" class="info"><?php echo _("Loop Before i-dest");?><span><?php echo _("If checked, and there is an 'i' (invalid extension) destination defined below, the IVR will play invalid option and then loop back to the beginning for the designated loop counts prior to going to the invalid (i) destination.");?></span></a></td> 
    274       <td><input type="checkbox" name="alt_invalid" <?php echo $ivr_details['alt_invalid'] ?> tabindex="<?php echo ++$tabindex;?>"></td> 
    275     </tr> 
    276 <?php 
    277   $invalid_id = isset($ivr_details['invalid_id'])?$ivr_details['invalid_id']:''; 
    278   if(function_exists('recordings_list')) { //only include if recordings is enabled ?> 
    279     <tr> 
    280       <td><a href="#" class="info"><?php echo _("Invalid Message")?><span><?php echo _("If an invalid extension is pressed and a message is selected, it will be played in place of the announcement message when looping back to the top of the IVR. It will not be played if the t destination is the next target. If nothing is selected, the system will play a default invalid extension message before going back to the main announcement")?></span></a></td> 
    281       <td> 
    282         <select name="invalid_id" tabindex="<?php echo ++$tabindex;?>"> 
    283         <?php 
    284           //$tresults obtained above 
    285           echo '<option value="">'._("None")."</option>"; 
    286           if (isset($tresults[0])) { 
    287             foreach ($tresults as $tresult) { 
    288               echo '<option value="'.$tresult['id'].'"'.($tresult['id'] == $invalid_id ? ' SELECTED' : '').'>'.$tresult['displayname']."</option>\n"; 
    289             } 
    290           } 
    291         ?> 
    292         </select> 
    293       </td> 
    294     </tr> 
    295 <?php 
    296   } 
    297 ?> 
    298     <tr> 
    299       <td><a href="#" class="info"><?php echo _("Repeat Loops:")?><span><?php echo _("The number of times we should loop when invalid input or no input has been entered before going to the defined or default generated 'i' or 't' options. If the 'i' or 't' options are defined, the above check boxes must be checked in order to loop.")?></span></a></td> 
    300       <td> 
    301         <select name="loops" tabindex="<?php echo ++$tabindex;?>"> 
    302         <?php  
    303           $default = (isset($ivr_details['loops']) ? $ivr_details['loops'] : 2); 
    304           for ($i=0; $i <= 9; $i++) { 
    305             echo '<option value="'.$i.'" '.($i == $default ? 'SELECTED' : '').'>'.$i.'</option>'; 
    306           } 
    307         ?>     
    308         </select>    
    309       </td> 
    310     </tr> 
    311  
    312     <tr><td colspan=2><hr /></td></tr> 
    313     <tr><td colspan=2> 
    314  
    315       <input name="increase" type="submit" value="<?php echo _("Increase Options")?>" disabled> 
    316       &nbsp; 
    317       <input name="Submit" type="submit" value="<?php echo _("Save")?>" tabindex="<?php echo ++$tabindex;?>" disabled> 
    318       &nbsp; 
    319       <?php if ($nbroptions > 1) { ?> 
    320       <input name="decrease" type="submit" value="<?php echo _("Decrease Options")?>" disabled> 
    321       <?php } ?> 
    322     </td> 
    323   </tr> 
    324   <tr><td colspan=2><hr /></td></tr></table> 
    325   <table class="alt_table"> 
    326 <?php 
    327   // Draw the destinations 
    328   $dests = ivr_get_dests($id); 
    329   $count = 0; 
    330   if (!empty($dests)) { 
    331     foreach ($dests as $dest) { 
    332       drawdestinations($count, $dest['selection'], $dest['dest'], $dest['ivr_ret']); 
    333       $count++; 
    334     } 
    335   } 
    336   while ($count < $nbroptions) { 
    337     drawdestinations($count, null, null, 0); 
    338     $count++; 
    339   } 
    340 ?> 
    341    
    342 </table> 
    343 <?php 
    344   if ($nbroptions < $count) {  
    345     echo "<input type='hidden' name='nbroptions' value=$count />\n"; 
    346   } else { 
    347     echo "<input type='hidden' name='nbroptions' value=$nbroptions />\n"; 
    348   }  
    349  
    350   global $module_hook; 
    351   echo $module_hook->hookHtml; 
    352 ?> 
    353   <input name="increase" type="submit" value="<?php echo _("Increase Options")?>" disabled> 
    354   &nbsp; 
    355   <input name="Submit" type="submit" value="<?php echo _("Save")?>" disabled> 
    356   &nbsp; 
    357   <?php if ($nbroptions > 1) { ?> 
    358   <input name="decrease" type="submit" value="<?php echo _("Decrease Options")?>" disabled> 
    359   <?php } ?> 
    360    
    361   <script language="javascript"> 
    362   <!-- 
    363 $(document).ready(function() {   
    364   $(':submit:disabled').removeAttr('disabled');  
    365 }); 
    366  
    367 function delEntry(e){ 
    368   $('[name=option'+e+'],[name=goto'+e+']').val('').parent().parent().fadeOut(500,function(){$(this).remove();}); 
    369 } 
    370   
    371 var theForm = document.prompt; 
    372 theForm.displayname.focus(); 
    373  
    374   function prompt_onsubmit() { 
    375     var msgInvalidOption = "<?php echo _("Invalid option"); ?>"; 
    376      
    377     defaultEmptyOK = true; 
    378  
    379     // go thru the form looking for options 
    380     // where the option isn't blank (as that will be removed) do the validation 
    381       var allelems = theForm.elements; 
    382         if (allelems != null) 
    383         { 
    384           var i, elem; 
    385             for (i = 0; elem = allelems[i]; i++) 
    386             { 
    387               if (elem.type == 'text' && elem.name.indexOf('option') == 0) 
    388                 { 
    389                   if (elem.value != '') { 
    390                       if (!isIVROption(elem.value)) 
    391                           return warnInvalid(elem, msgInvalidOption); 
    392                          
    393                         var gotoNum = elem.name.charAt(6); 
    394                         var isok = validateSingleDestination(theForm,gotoNum,true); 
    395                         if (!isok) 
    396                           return false; 
    397                     } 
    398                  } 
    399             } 
    400         } 
    401                                  
    402     return true; 
    403   } 
    404    
    405   //--> 
    406  
    407   </script> 
    408         </form> 
    409         </div> 
    410 <?php 
    411 } 
    412  
    413 function drawdestinations($count, $sel,  $dest, $ivr_ret) {  
    414   global $tabindex, $id; 
    415 ?> 
    416   <tr> 
    417   <td style="text-align:right;"> 
    418   <input title="<?php echo _("Digits to press for this choice")?>" size="4" type="text" name="option<?php echo $count ?>" value="<?php echo $sel ?>" tabindex="<?php echo ++$tabindex;?>"> 
    419   </td> 
    420   <td> 
    421     <?php echo drawselects($dest,$count,false,false); ?> 
    422   </td> 
    423   <td> 
    424     <small><a href="#" class="info"><?php echo _("Return to IVR")?><span><?php echo _("Check this box to have this option return to a parent IVR if it was called from a parent IVR. If not, it will go to the chosen destination.<br><br>The return path will be to any IVR that was in the call path prior to this IVR which could lead to strange results if there was an IVR called in the call path but not immediately before this")?></span></a></small> 
    425     <input type="checkbox" name="ivr_ret<?php echo $count ?>" value="ivr_ret" <?php echo $ivr_ret?'CHECKED':''; ?>> 
    426   <?php if(function_exists('ivr_dests_hook_show')){ 
    427     echo ivr_dests_hook_show($id, $sel); 
    428   } 
    429   ?> 
    430     <img src="images/trash.png" style="cursor:pointer" title="<?php echo _('Delete this entry. Dont forget to click Save to save changes!');?>" onclick="delEntry(<?php echo $count;?>)"> 
    431   </td> 
    432   </tr> 
    433    
    434  
    435 <?php 
    436 } 
    437  
    438 // this can be removed in 2.2 and put back to just runModuleSQL which is in admin/functions.inc.php 
    439 // I didn't want to do it in 2.1 as there's a significant user base out there, and it will break 
    440 // them if we do it here. 
    441  
    442 function localrunModuleSQL($moddir,$type){ 
    443         global $db; 
    444         $data=''; 
    445         if (is_file("modules/{$moddir}/{$type}.sql")) { 
    446                 // run sql script 
    447                 $fd = fopen("modules/{$moddir}/{$type}.sql","r"); 
    448                 while (!feof($fd)) { 
    449                         $data .= fread($fd, 1024); 
    450                 } 
    451                 fclose($fd); 
    452  
    453                 preg_match_all("/((SELECT|INSERT|UPDATE|DELETE|CREATE|DROP).*);\s*\n/Us", $data, $matches); 
    454  
    455                 foreach ($matches[1] as $sql) { 
    456                                 $result = $db->query($sql); 
    457                                 if(DB::IsError($result)) { 
    458                                         return false; 
    459                                 } 
    460                 } 
    461                 return true; 
    462         } 
    463                 return true; 
    464 } 
    465  
    466 ?>