function show_remote_procs($type) { global $pmb_procedure_server_credentials, $pmb_procedure_server_address; global $msg; global $charset; $pmb_procedure_server_credentials_exploded = explode("\n", $pmb_procedure_server_credentials); if ($pmb_procedure_server_address && count($pmb_procedure_server_credentials_exploded) == 2) { $aremote_procedure_client = new remote_procedure_client($pmb_procedure_server_address, trim($pmb_procedure_server_credentials_exploded[0]), trim($pmb_procedure_server_credentials_exploded[1])); $procedures = $aremote_procedure_client->get_procs($type); if ($procedures) { global $testable_types, $type_titles; if ($procedures->error_information->error_code) { $buf_contenu = $msg["remote_procedures_error_server"] . ":<br><i>" . $procedures->error_information->error_string . "</i>"; print $buf_contenu; } else { if (isset($procedures->elements)) { $current_set = ""; foreach ($procedures->elements as $aprocedure) { if ($aprocedure->current_attached_set != $current_set) { $parity = 0; $current_set = $aprocedure->current_attached_set; $buf_contenu .= '<tr><th colspan=4>' . htmlentities($current_set, ENT_QUOTES, $charset) . '</th>'; } if ($parity % 2) { $pair_impair = "even"; } else { $pair_impair = "odd"; } $parity += 1; $tr_javascript = " onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='{$pair_impair}'\" onmousedown=\"document.location='./catalog.php?categ=caddie&sub=gestion&quoi=remote_procs&action=view_remote&id={$aprocedure->id}&remote_type={$type}';\" "; $buf_contenu .= "\n<tr class='{$pair_impair}' {$tr_javascript} style='cursor: pointer'>\n\t\t\t\t\t\t\t<td width='80'>\n\t\t\t\t\t\t\t\t" . ($testable_types[$type] ? "<input class='bouton' type='button' value=' " . $msg[procs_options_tester_requete] . " ' onClick=\"document.location='./catalog.php?categ=caddie&sub=gestion&quoi=remote_procs&action=execute_remote&id={$aprocedure->id}&remote_type={$type}'\" />" : "") . "\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t" . ($aprocedure->untested ? "[<i>" . $msg["remote_procedures_procedure_non_validated"] . "</i>] " : '') . "<strong>{$aprocedure->name}</strong><br/>\n\t\t\t\t\t\t\t\t<small>{$aprocedure->comment} </small>\n\t\t\t\t\t\t\t\t</td>"; $buf_contenu .= "<td><input class='bouton' type='button' value=\"" . $msg[remote_procedures_import] . "\" onClick=\"document.location='./catalog.php?categ=caddie&sub=gestion&quoi=remote_procs&action=import_remote&id={$aprocedure->id}&remote_type={$type}'\" /></td>\n\t\t\t\t\t\t\t\t</tr>"; } $title = $msg[$type_titles[$type]]; $buf_contenu = "<h1>" . $title . "</h1>" . "<table></tr>" . $buf_contenu . "</table><br>"; print $buf_contenu; } else { $title = $msg[$type_titles[$type]]; $buf_contenu = "<h1>" . $title . "</h1>" . $msg[remote_procedures_no_procs] . "<br><br>"; print $buf_contenu; } } } } }
function show_form($param = '') { global $subaction, $dbh, $aff_list, $msg; global $pmb_procedure_server_credentials, $pmb_procedure_server_address; if ($subaction == 'change') { global $type_proc, $form_procs, $form_procs_remote; } else { if (is_array($param)) { foreach ($param as $aparam => $aparamv) { if (is_array($aparamv)) { foreach ($aparamv as $sparam => $sparamv) { global ${$sparam}; ${$sparam} = $sparamv; } } else { global ${$aparam}; ${$aparam} = $aparamv; } } } } $form_task .= "<script>\n\t\t\tfunction reload_type_proc(obj) {\n\t\t\t\t\tdocument.getElementById('subaction').value='change';\n\t\t\t\t\tobj.form.submit();\n\t\t\t\t\n\t\t\t}\n\t\t\tfunction reload(obj) {\n\t\t\t\t\tdocument.getElementById('subaction').value='change';\n\t\t\t\t\tobj.form.submit();\n\t\t\t}\n\t\t</script>"; // Procédure interne ou Procédure distante ?? $form_task .= "\n\t\t<div class='row'>\n\t\t\t<div class='colonne3'>\n\t\t\t\t<label for='proc'>" . $this->msg["planificateur_proc_type"] . "</label>\n\t\t\t</div>\n\t\t\t<div class='colonne_suite'>\n\t\t\t\t<input type='radio' id='type_proc' name='type_proc' value='internal' " . ($type_proc == 'internal' ? 'checked' : '') . " onchange='reload_type_proc(this);' />" . $this->msg["planificateur_proc_internal"] . "\n\t\t\t\t<input type='radio' id='type_proc' name='type_proc' value='remote' " . ($type_proc == 'remote' ? 'checked' : '') . " onchange='reload_type_proc(this);' />" . $this->msg["planificateur_proc_remote"] . "\n\t\t\t</div>\n\t\t</div>\n\t\t<div class='row'> </div>"; //procédure interne if ($type_proc == 'internal') { //Choix d'une procédure $form_task .= "\n\t\t\t<div class='row'>\n\t\t\t\t<div class='colonne3'>\n\t\t\t\t\t<label for='proc'>" . $this->msg["planificateur_proc_perso"] . "</label>\n\t\t\t\t</div>\n\t\t\t\t<div class='colonne_suite'>\n\t\t\t\t\t<select id='form_procs' class='saisie-60em' name='form_procs' onchange='reload(this);'>\n\t\t\t\t\t\t<option id='' value='' >" . $this->msg["planificateur_proc_choice"] . "</option>"; $requete = "SELECT idproc, name FROM procs order by name"; $result = mysql_query($requete, $dbh); while ($row = mysql_fetch_object($result)) { $form_task .= "<option value='" . $row->idproc . "' " . ($form_procs == $row->idproc ? 'selected=\'selected\'' : '') . ">" . $row->name . "</option>"; } $form_task .= "</select>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class='row'> </div>"; if ($form_procs) { $form_task .= "<div class='row'>\n\t\t\t\t\t<div class='colonne3'>\n\t\t\t\t\t\t<label for='source'> </label>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class='colonne_suite' id='param_proc' >"; $hp = new parameters($form_procs, "procs"); if (preg_match_all("|!!(.*)!!|U", $hp->proc->requete, $query_parameters)) { $form_task .= $hp->gen_form_plann(); } $form_task .= "</div>\n\t\t\t\t\t</div>"; } } else { if ($type_proc == 'remote') { $form_task .= "<div class='row'>\n\t\t\t\t<div class='colonne3'>\n\t\t\t\t\t<label for='proc'>" . $this->msg["planificateur_proc_perso"] . "</label>\n\t\t\t\t</div>\n\t\t\t\t<div class='colonne_suite'>"; // //Procédures Externes // $pmb_procedure_server_credentials_exploded = explode("\n", $pmb_procedure_server_credentials); if ($pmb_procedure_server_address && count($pmb_procedure_server_credentials_exploded) == 2) { $aremote_procedure_client = new remote_procedure_client($pmb_procedure_server_address, trim($pmb_procedure_server_credentials_exploded[0]), trim($pmb_procedure_server_credentials_exploded[1])); $procedures = $aremote_procedure_client->get_procs("AP"); if ($procedures) { if ($procedures->error_information->error_code) { $form_task .= $msg['remote_procedures_error_server'] . ":<br><i>" . $procedures->error_information->error_string . "</i>"; } else { if (isset($procedures->elements)) { $form_task .= "<select id='form_procs_remote' class='saisie-60em' name='form_procs_remote' onchange='reload(this);'>"; foreach ($procedures->elements as $aprocedure) { $form_task .= "<option value='" . $aprocedure->id . "' " . ($form_procs_remote == $aprocedure->id ? "selected" : "") . ">" . ($aprocedure->untested ? "[<i>" . $msg["remote_procedures_procedure_non_validated"] . "</i>] " : '') . "<strong>{$aprocedure->name}</strong></option>"; } $form_task .= "</select>"; } else { $form_task .= "<br>" . $msg["remote_procedures_no_procs"] . "<br><br>"; } } } $form_task .= "</div>\n\t\t\t\t</div>\n\t\t\t\t<div class='row'> </div>"; if ($form_procs_remote) { $id = $form_procs_remote; $procedure = $aremote_procedure_client->get_proc($id, "AP"); $form_task .= "<div class='row'>\n\t\t\t\t\t\t\t<div class='colonne3'>\n\t\t\t\t\t\t\t\t<label for='source'> </label>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div class='colonne_suite' id='param_proc_remote' >"; if ($procedure["error_message"]) { $form_task .= htmlentities($msg["remote_procedures_error_server"], ENT_QUOTES, $charset) . ":<br><i>" . $procedure["error_message"] . "</i>"; } else { $the_procedure = $procedure["procedure"]; if ($the_procedure->params && $the_procedure->params != "NULL") { $sql = "CREATE TEMPORARY TABLE remote_proc LIKE procs"; mysql_query($sql, $dbh) or die(mysql_error()); $sql = "INSERT INTO remote_proc (idproc, name, requete, comment, autorisations, parameters, num_classement) VALUES (0, '" . mysql_escape_string($the_procedure->name) . "', '" . mysql_escape_string($the_procedure->sql) . "', '" . mysql_escape_string($the_procedure->comment) . "', '', '" . mysql_escape_string($the_procedure->params) . "', 0)"; mysql_query($sql, $dbh) or die(mysql_error()); $idproc = mysql_insert_id($dbh); $hp = new parameters($idproc, "remote_proc"); if (preg_match_all("|!!(.*)!!|U", $hp->proc->requete, $query_parameters)) { $form_task .= $hp->gen_form_plann(); } } } $form_task .= "</div>\n\t\t\t\t\t\t</div>"; } } } } return $form_task; }
function show_procs($dbh) { global $msg, $javascript_path, $pmb_procedure_server_address, $pmb_procedure_server_credentials, $charset; print "\n\t\t<script type=\"text/javascript\" src=\"" . $javascript_path . "/tablist.js\"></script>\n\t\t<a href=\"javascript:expandAll()\"><img src='./images/expand_all.gif' border='0' id=\"expandall\"></a>\n\t\t<a href=\"javascript:collapseAll()\"><img src='./images/collapse_all.gif' border='0' id=\"collapseall\"></a>\n\t\t"; // affichage du tableau des procédures $requete = "SELECT idproc, name, requete, comment, libproc_classement, num_classement FROM procs left join procs_classements on idproc_classement=num_classement ORDER BY libproc_classement,name "; $res = mysql_query($requete, $dbh); $nbr = mysql_num_rows($res); $class_prec = $msg[proc_clas_aucun]; $buf_tit = ""; $buf_class = 0; $parity = 1; for ($i = 0; $i < $nbr; $i++) { $row = mysql_fetch_row($res); $classement = $row[4]; if ($class_prec != $classement) { if (!$row[4]) { $row[4] = $msg[proc_clas_aucun]; } if ($buf_tit) { $buf_contenu = "<table><tr><th colspan=4>" . $buf_tit . "</th></tr>" . $buf_contenu . "</table>"; print gen_plus("procclass" . $buf_class, $buf_tit, $buf_contenu); $buf_contenu = ""; } $buf_tit = $row[4]; $buf_class = $row[5]; $class_prec = $classement; } if ($parity % 2) { $pair_impair = "even"; } else { $pair_impair = "odd"; } $parity += 1; $action = "onmousedown=\"document.location='./admin.php?categ=proc&sub=proc&action=modif&id={$row['0']}';\""; $tr_javascript = " onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='{$pair_impair}'\" "; $buf_contenu .= "\n<tr class='{$pair_impair}' {$tr_javascript} style='cursor: pointer'>\n\t\t\t\t<td width='10'>\n\t\t\t\t\t<input class='bouton' type='button' value=' {$msg['708']} ' onClick=\"document.location='./admin.php?categ=proc&sub=proc&action=execute&id={$row['0']}'\" />\n\t\t\t\t\t</td>\n\t\t\t\t<td {$action}>\n\t\t\t\t\t<strong>{$row['1']}</strong><br />\n\t\t\t\t\t<small>{$row['3']} </small>\n\t\t\t\t\t</td>"; if (preg_match_all("|!!(.*)!!|U", $row[2], $query_parameters)) { $buf_contenu .= "<td>\n\t\t\t\t\t\t\t\t<a href='admin.php?categ=proc&sub=proc&action=configure&id_query=" . $row[0] . "'>" . $msg["procs_options_config_param"] . "</a>"; } else { $buf_contenu .= "<td {$action}>"; } $buf_contenu .= "</td>"; $buf_contenu .= "<td><input class='bouton' type='button' value=\"" . $msg[procs_bt_export] . "\" onClick=\"document.location='./export.php?quoi=procs&sub=actionsperso&id={$row['0']}'\" /></td>\n\t\t\t\t\t</tr>"; } $buf_contenu = "<table><tr><th colspan=4>" . $buf_tit . "</th></tr>" . $buf_contenu . "</table>"; print gen_plus("procclass" . $buf_class, $buf_tit, $buf_contenu); // //Procédures Externes // $pmb_procedure_server_credentials_exploded = explode("\n", $pmb_procedure_server_credentials); if ($pmb_procedure_server_address && count($pmb_procedure_server_credentials_exploded) == 2) { $aremote_procedure_client = new remote_procedure_client($pmb_procedure_server_address, trim($pmb_procedure_server_credentials_exploded[0]), trim($pmb_procedure_server_credentials_exploded[1])); $procedures = $aremote_procedure_client->get_procs("AP"); if ($procedures) { if ($procedures->error_information->error_code) { $buf_contenu = $msg['remote_procedures_error_server'] . ":<br><i>" . $procedures->error_information->error_string . "</i>"; print gen_plus("procclass_remote", $msg["remote_procedures"], $buf_contenu); } else { if (isset($procedures->elements)) { $buf_contenu = ""; $current_set = ""; foreach ($procedures->elements as $aprocedure) { if ($aprocedure->current_attached_set != $current_set) { $parity = 0; $current_set = $aprocedure->current_attached_set; $buf_contenu .= '<tr><th colspan=4>' . htmlentities($current_set, ENT_QUOTES, $charset) . '</th>'; } if ($parity % 2) { $pair_impair = "even"; } else { $pair_impair = "odd"; } $parity += 1; $tr_javascript = " onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='{$pair_impair}'\" "; $buf_contenu .= "\n<tr class='{$pair_impair}' {$tr_javascript} style='cursor: pointer'>\n\t\t\t\t\t\t\t<td width='10'>\n\t\t\t\t\t\t\t\t<input class='bouton' type='button' value=' {$msg['708']} ' onClick=\"document.location='./admin.php?categ=proc&sub=proc&action=execute_remote&id={$aprocedure->id}'\" />\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td onmousedown=\"document.location='./admin.php?categ=proc&sub=proc&action=view_remote&id={$aprocedure->id}';\">\n\t\t\t\t\t\t\t\t" . ($aprocedure->untested ? "[<i>" . $msg["remote_procedures_procedure_non_validated"] . "</i>] " : '') . "<strong>{$aprocedure->name}</strong><br/>\n\t\t\t\t\t\t\t\t<small>{$aprocedure->comment} </small>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td>"; //if (preg_match_all("|!!(.*)!!|U",$row[2],$query_parameters)) $buf_contenu.="<a href='admin.php?categ=proc&sub=proc&action=configure&id_query=".$row[0]."'>".$msg["procs_options_config_param"]."</a>"; $buf_contenu .= "</td>"; $buf_contenu .= "<td><input class='bouton' type='button' value=\"" . $msg[remote_procedures_import] . "\" onClick=\"document.location='./admin.php?categ=proc&sub=proc&action=import_remote&id={$aprocedure->id}'\" /></td>\n\t\t\t\t\t\t\t\t</tr>"; } $buf_contenu = "<table></tr>" . $buf_contenu . "</table>"; print gen_plus("procclass_remote", $msg["remote_procedures"], $buf_contenu); } else { $buf_contenu = "<br>" . $msg["remote_procedures_no_procs"] . "<br><br>"; print gen_plus("procclass_remote", $msg["remote_procedures"], $buf_contenu); } } } } print "<br>\n\t\t<input class='bouton' type='button' value=' {$msg['704']} ' onClick=\"document.location='./admin.php?categ=proc&sub=proc&action=add'\" />\n\t\t<input class='bouton' type='button' value=' {$msg['procs_bt_import']} ' onClick=\"document.location='./admin.php?categ=proc&sub=proc&action=import'\" />\n\t\t<input class='bouton' type='button' value=' {$msg['admin_menu_req']} ' onClick=\"document.location='./admin.php?categ=proc&sub=req&action=add'\" />"; }