// it under the terms of the GNU Lesser General Public License as // published by the Free Software Foundation. //********************************************************************* $vars = $this->vars; //require_once("../inc/chklist.php"); //print "<font color=\"blue\">"; //$myChkList = new chklist($vars, "ID_COMMENTPROTO"); //print_r ($myChkList->getSelected ()); // foreach ( $vars as $key=>$value ) // { // print "<li>\$key $key => \$value $value</li>\n"; // } //Callback method de vérification //print "</font>"; require_once "../inc/db_funcs.php"; $tmpDb = openDb(); $dirName = queryOneDb($tmpDb, "SELECT ATAB_REP_VCH FROM ATAB WHERE ATAB_NOMTBL_CKEY_VCH='" . $this->getVar("ATAB_NOMTBL_CKEY_VCH") . "'"); closeDb($tmpDb); //Redirection Explications ------------------------------------- if (isset($vars['Explications'])) { require_once "HTML/Page.php"; require_once "MOEUVREPROTO_def.php"; require_once "../inc/html_settings.php"; $page = new HTML_Page(array('lineend' => 'unix', 'doctype' => 'XHTML 1.0 Strict', 'language' => 'fr', 'cache' => 'false')); // $page->addStyleSheet($css_style); $page->setTitle('Phpaie -(EXplications)-'); // A modifier absolument 2 requêtes suivantes à fusionner. $buffer = MOEUVREPROTO::fetchOne("MOEUVREPROTO_EXPLIC_TE", "where ATAB_NOMTBL_CKEY_VCH ='" . $this->getVar("ATAB_NOMTBL_CKEY_VCH") . "'", ""); $ind = MOEUVREPROTO::fetchOne("ID_MOEUVREPROTO", "where ATAB_NOMTBL_CKEY_VCH ='" . $this->getVar("ATAB_NOMTBL_CKEY_VCH") . "'", ""); $page->addBodyContent("<p align=\"center\"><font face=\"Arial\"><b><a href=\"Javascript:history.go(-1)\">retour</a></b></font></p>\n"); $page->addBodyContent("<table border=\"0\" bgcolor=\"#CCCCFF\" width=\"100%\"><caption>Présentation</caption><tbody><tr><td>[" . $this->getVar("ATAB_NOMTBL_CKEY_VCH") . "] (Package :" . $dirName . ")</td></tr></tbody></table>");
function checkNToNDbVars($TABLE_TO) { include_once "db_funcs.php"; $link = openDb(); // Caractère de liaison URL/QueryString $start_query = isset($GLOBALS[QUERY_STRING]) && $GLOBALS[QUERY_STRING] != "" ? "&" : "?"; $l_result = mysql_query("SELECT ID_{$this->name} from {$this->name}{$TABLE_TO} WHERE ID_{$TABLE_TO} = " . $this->vars["ID_" . $TABLE_TO] . ";"); $l_num_rows = mysql_num_rows($l_result); // récupérer les valeurs de check modifiées while ($l_a_row = mysql_fetch_assoc($l_result)) { while (list($key, $value) = each($l_a_row)) { $founded[$value] = "CHECKED"; } } $req = ""; foreach ($this->vars as $key => $value) { if ($value != "" && (strstr($key, "{$this}->name_") || !strcmp($key, "ID_{$this->name}") || !strcmp($key, "ID_VERSION"))) { if (ereg("_TI\$", $key) || ereg("_SI\$", $key) || ereg("_MI\$", $key) || ereg("_I\$", $key) || ereg("_BI\$", $key) || ereg("_F\$", $key) || ereg("_DO\$", $key) || ereg("_DE\$", $key) || ereg("^ID_", $key)) { $req .= "{$key}={$value} AND "; } else { // Le 'LIKE' est de parti pris $req .= "{$key} LIKE '{$value}%' AND "; } } // fabriquer une chaine avec select * where S_XXXX =$this->vars[S_XXXX] (ou $value) AND ... // pour parvenir à la requête voulue } if ($req != "") { $req = "SELECT * FROM {$this->name} where " . ereg_replace(" AND \$", "", $req); } else { // Si aucun champ n'est rempli on prend tout $req = "SELECT * FROM {$this->name}"; } // Gestion du tri des colonnes => effacer l'éventuel critère précédent if (isset($GLOBALS['ORDER']) && $GLOBALS['ORDER'] != "") { $req .= " ORDER BY " . $GLOBALS['ORDER']; $GLOBALS[REQUEST_URI] = str_replace(strstr($GLOBALS[REQUEST_URI], $start_query . "ORDER"), "", $GLOBALS[REQUEST_URI]); } // print "<H1>$req </H1><BR>"; $count_id = 0; $result = mysql_query("SELECT * FROM GESTAB WHERE GESTAB_NOMTBL_CKEY_VCH = '{$this->name}'"); // Aller chercher dans la table Gestab print "<table border=1 WIDTH=\"800\">\n"; print "<tr>\n"; while ($a_row = mysql_fetch_assoc($result)) { $colonnes[$a_row[GESTAB_NOMCOL_KEY_VCH]] = new Attributs($a_row[GESTAB_LNK_VCH] == "ON" ? 1 : 0, $a_row[GESTAB_VIS_VCH] == "ON" ? 1 : 0, $a_row[GESTAB_LARG_I]); // Il y a au mois 1 lien visible $count_id |= $a_row[GESTAB_VIS_VCH] == "ON" && $a_row[GESTAB_LNK_VCH] == "ON" ? 1 : 0; while (list($key, $value) = each($a_row)) { if ($key == "GESTAB_TITRE_VCH" && $a_row[GESTAB_VIS_VCH] == "ON") { print "\t<td bgcolor=\"#808000\"><a href=\"" . $GLOBALS[REQUEST_URI] . $start_query . "ORDER=" . $a_row[GESTAB_NOMCOL_KEY_VCH] . "\" class=\"tablelink\">{$value}</a></td>\n"; } } } // Afficher une colonne avec bouton suppression $result = mysql_query("SELECT * FROM ATAB WHERE ATAB_NOMTBL_CKEY_VCH = '{$this->name}'"); $a_row = mysql_fetch_assoc($result); $colonnes["ATAB_CHKSELECT_"] = new Attributs(1, $a_row["ATAB_CHKSELECT"] == "ON", 10); // Afficher une colonne avec bouton selection $colonnes["ATAB_SELECT_"] = new Attributs(1, $a_row["ATAB_SELECT"] == "ON", 10); // Il n'y a pas de lien visible if (!$count_id && !$colonnes["ATAB_CHKSELECT_"]->visible && !$colonnes["ATAB_SELECT_"]) { $colonnes["id"] = new Attributs(1, 1, 10); print " <td bgcolor=\"#887799\">ID</td>\n"; } if ($colonnes["ATAB_CHKSELECT_"]->visible) { print " <td bgcolor=\"#887799\">Lier</td>\n"; } if ($colonnes["ATAB_SELECT_"]->visible) { print " <td bgcolor=\"#887799\">selection</td>\n"; } print "</tr>\n"; $result = mysql_query("{$req}"); $num_rows = mysql_num_rows($result); while ($a_row = mysql_fetch_assoc($result)) { print "<tr>\n"; while (list($key, $value) = each($a_row)) { if ($colonnes[$key]->visible) { if ($value == "") { $value = " "; } if ($colonnes[$key]->id) { print "\t<td><a href=\"../{$this->directory}/{$this}->name_1.php?ID=" . $a_row["ID_{$this->name}"] . "\">{$value}</a></td>\n"; } else { print "\t<td>{$value}</td>\n"; } } } if ($colonnes["ATAB_CHKSELECT_"]->visible) { $NID = $a_row["{$name_index}"]; print " <td align=\"center\"><input type=\"checkbox\" name=\"CHK_{$NID}\" value=\"{$founded[$NID]}\" {$founded[$NID]} >\n"; print " \t\t\t <input type=\"hidden\" name=\"WAS_{$NID}\" value=\"{$founded[$NID]}\" size=\"20\"> </td>\n"; } if ($colonnes["ATAB_SELECT_"]->visible) { print "\t<td><a href=\"../->directory/.php?ID=" . $a_row["{$name_index}"] . "\">Select.</a></td>\n"; } print "</tr>\n"; } print "</table>\n"; print "<p>Cette séléction comprend {$num_rows} enregistrement(s)</p>"; closeDb($link); return 0; }
# foreach # zet de page title $pagetitle .= "spot: " . $xmlar['title']; #- display stuff -# template('header'); template('spotinfo', array('spot' => $xmlar, 'comments' => $comments)); template('footer'); break; } catch (Exception $x) { die($x->getMessage()); } # else # getspot # getspot case 'getnzb': $db = openDb(); $spot = $db->getSpot($req->getDef('messageid', '')); $spot = $spot[0]; try { $hdr_spotnntp = new SpotNntp($settings['nntp_hdr']['host'], $settings['nntp_hdr']['enc'], $settings['nntp_hdr']['port'], $settings['nntp_hdr']['user'], $settings['nntp_hdr']['pass']); if ($settings['nntp_hdr']['host'] == $settings['nntp_nzb']['host']) { $hdr_spotnntp->connect(); $nzb_spotnntp = $hdr_spotnntp; } else { $nzb_spotnntp = new SpotNntp($settings['nntp_nzb']['host'], $settings['nntp_nzb']['enc'], $settings['nntp_nzb']['port'], $settings['nntp_nzb']['user'], $settings['nntp_nzb']['pass']); $hdr_spotnntp->connect(); $nzb_spotnntp->connect(); } # else $header = $hdr_spotnntp->getHeader('<' . $spot['messageid'] . '>'); $xml = '';
function selectAccountById($id) { $connection = openDb(); //Using prepared statements: $id = (int) $id; $sql = "SELECT * FROM accounts WHERE ID = ?"; $stmt = $connection->stmt_init(); if (!$stmt->prepare($sql)) { return false; } $stmt->bind_param("i", $id); return executeQueryPrepared($stmt, $connection, true); }