Fix: problem if mysql encrypt is used

This commit is contained in:
Regis Houssin 2011-01-24 19:28:28 +00:00
parent 3fc46f7282
commit 276fa55020
2 changed files with 27 additions and 30 deletions

View File

@ -4,6 +4,7 @@
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -40,8 +41,8 @@ $def = array();
$lastexternalrss=0; $lastexternalrss=0;
// positionne la variable pour le nombre de rss externes // positionne la variable pour le nombre de rss externes
$sql ="select MAX(name) as name from ".MAIN_DB_PREFIX."const"; $sql ="SELECT MAX(".$db->decrypt('name').") as name FROM ".MAIN_DB_PREFIX."const";
$sql.=" WHERE name like 'EXTERNAL_RSS_URLRSS_%'"; $sql.=" WHERE ".$db->decrypt('name')." LIKE 'EXTERNAL_RSS_URLRSS_%'";
$result=$db->query($sql); $result=$db->query($sql);
if ($result) if ($result)
{ {
@ -119,7 +120,7 @@ if ($_POST["delete"])
// Supprime boite box_external_rss de definition des boites // Supprime boite box_external_rss de definition des boites
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."boxes_def"; $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."boxes_def";
$sql.= " WHERE file ='box_external_rss.php' AND note like '".$_POST["norss"]." %'"; $sql.= " WHERE file = 'box_external_rss.php' AND note LIKE '".$_POST["norss"]." %'";
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
@ -201,29 +202,25 @@ print '<td width="100">'.$langs->trans("Title").'</td>';
print '<td><input type="text" name="external_rss_title_'.($lastexternalrss+1).'" value="'.@constant("EXTERNAL_RSS_TITLE_" . ($lastexternalrss+1)).'" size="64"></td>'; print '<td><input type="text" name="external_rss_title_'.($lastexternalrss+1).'" value="'.@constant("EXTERNAL_RSS_TITLE_" . ($lastexternalrss+1)).'" size="64"></td>';
print '<td>April,<br>LinuxFR,<br>Lolix</td>'; print '<td>April,<br>LinuxFR,<br>Lolix</td>';
print '</tr>'; print '</tr>';
?>
<tr class="pair"> print '<tr class="pair">';
<td>URL du RSS</td> print '<td>URL du RSS</td>';
<td><input type="text" name="external_rss_urlrss_<?php echo ($lastexternalrss+1) ?>" value="<?php echo @constant("EXTERNAL_RSS_URLRSS_" . ($lastexternalrss+1)) ?>" size="64"></td> print '<td><input type="text" name="external_rss_urlrss_'.($lastexternalrss+1).'" value="'.@constant("EXTERNAL_RSS_URLRSS_" . ($lastexternalrss+1)).'" size="64"></td>';
<td>http://wiki.april.org/RecentChanges?format=rss<br>http://linuxfr.org/backend/news/rss20.rss<br>http://back.fr.lolix.org/jobs.rss.php3</td> print '<td>http://wiki.april.org/RecentChanges?format=rss<br>http://linuxfr.org/backend/news/rss20.rss<br>http://back.fr.lolix.org/jobs.rss.php3</td>';
</tr> print '</tr>';
<tr><td colspan="3" align="center"> print '<tr><td colspan="3" align="center">';
<input type="submit" class="button" value="<?php echo $langs->trans("Add") ?>"> print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
<input type="hidden" name="action" value="add"> print '<input type="hidden" name="action" value="add">';
<input type="hidden" name="norss" value="<?php echo ($lastexternalrss+1) ?>"> print '<input type="hidden" name="norss" value="'.($lastexternalrss+1).'">';
</td> print '</td></tr>';
</tr>
<?php
print '</table>'; print '</table>';
print '</form>'; print '</form>';
print '<br>'; print '<br>';
print '<table class="nobordernopadding" width="100%">'; print '<table class="nobordernopadding" width="100%">';
$sql ="select rowid, file, note from ".MAIN_DB_PREFIX."boxes_def"; $sql ="SELECT rowid, file, note FROM ".MAIN_DB_PREFIX."boxes_def";
$sql.=" WHERE file = 'box_external_rss.php'"; $sql.=" WHERE file = 'box_external_rss.php'";
$sql.=" ORDER BY note"; $sql.=" ORDER BY note";

View File

@ -1,8 +1,8 @@
<?php <?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 <EFBFBD>ric Seigne <erics@rycks.com> * Copyright (C) 2003 Eric Seigne <erics@rycks.com>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2006 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -20,11 +20,11 @@
*/ */
/** /**
\file htdocs/includes/boxes/box_external_rss.php * \file htdocs/includes/boxes/box_external_rss.php
\ingroup external_rss * \ingroup external_rss
\brief Fichier de gestion d'une box pour le module external_rss * \brief Fichier de gestion d'une box pour le module external_rss
\version $Id$ * \version $Id$
*/ */
include_once(MAGPIERSS_PATH."rss_fetch.inc"); include_once(MAGPIERSS_PATH."rss_fetch.inc");
include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php"); include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php");
@ -44,7 +44,7 @@ class box_external_rss extends ModeleBoxes {
var $info_box_contents = array(); var $info_box_contents = array();
/** /**
* \brief Constructeur de la classe * Constructeur de la classe
*/ */
function box_external_rss($DB,$param) function box_external_rss($DB,$param)
{ {
@ -58,8 +58,8 @@ class box_external_rss extends ModeleBoxes {
} }
/** /**
* \brief Charge les donn<EFBFBD>es en m<EFBFBD>moire pour affichage ult<EFBFBD>rieur * Charge les donnees en memoire pour affichage ulterieur
* \param $max Nombre maximum d'enregistrements <EFBFBD> charger * @param $max Nombre maximum d'enregistrements a charger
*/ */
function loadBox($max=5) function loadBox($max=5)
{ {
@ -105,7 +105,7 @@ class box_external_rss extends ModeleBoxes {
'sublink' => $link, 'subtext'=>$langs->trans("LastRefreshDate").': '.(isset($rss->date)?dol_print_date($rss->date,"dayhourtext"):$langs->trans("Unknown")), 'subpicto'=>'object_bookmark'); 'sublink' => $link, 'subtext'=>$langs->trans("LastRefreshDate").': '.(isset($rss->date)?dol_print_date($rss->date,"dayhourtext"):$langs->trans("Unknown")), 'subpicto'=>'object_bookmark');
} }
// INFO sur le <EFBFBD>lements // INFO sur le elements
for($i = 0; $i < $max && $i < sizeof($rss->items); $i++) for($i = 0; $i < $max && $i < sizeof($rss->items); $i++)
{ {
$item = $rss->items[$i]; $item = $rss->items[$i];