Author: pierre.andrews@gmail.com
Date: Sat Jul 15 23:54:09 2006
New Revision: 4023
Log:
correction de plein de bug dans mots_partout + on peut utiliser tri_mots sur les auteurs maintenant.
Modified:
_plugins_/_amelioration_admin_/mots_partout/action/mots_partout.php
_plugins_/_amelioration_admin_/tri_mots/exec/tri_mots.php
Modified: _plugins_/_amelioration_admin_/mots_partout/action/mots_partout.php
--- _plugins_/_amelioration_admin_/mots_partout/action/mots_partout.php (original)
+++ _plugins_/_amelioration_admin_/mots_partout/action/mots_partout.php Sat Jul 15 23:54:09 2006
@@ -18,7 +18,9 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-define('_DIR_PLUGIN_MOTS_PARTOUT',(_DIR_PLUGINS . 'mots_partout'));
+$p=explode(basename(_DIR_PLUGINS)."/",str_replace('\\','/',realpath(dirname(dirname(__FILE__)))));
+define('_DIR_PLUGIN_MOTS_PARTOUT',(_DIR_PLUGINS.end($p)));
+
//force a un tableau de int
function secureIntArray($array) {
@@ -63,11 +65,6 @@
function action_mots_partout() {
- global $nom_chose, $redirect;
- global $choses, $mots;
- global $strict, $switch;
- global $ajax;
-
/*
global $hash, $id_auteur;
include_ecrire("inc_session");
@@ -80,21 +77,38 @@
include(_DIR_PLUGIN_MOTS_PARTOUT."/mots_partout_choses.php");
include_spip('base/abstract_sql');
+
+ $choses = secureIntArray(_request('choses'));
+
+ $limit = addslashes(_request('limit'));
+ if($limit == '') $limit = 'rien';
+ $id_limit = intval(_request('identifiant_limit'));
+ if($id_limit < 1) $id_limit = 0;
+ $nb_aff = intval(_request('nb_aff'));
+ if($nb_aff < 1) $nb_aff = 20;
+ $switch = addslashes(_request('switch'));
+ if($switch == '') $switch = 'voir';
+ $strict = intval(_request('strict'));
+
/***********************************************************************/
/* récuperation de la chose sur laquelle on travaille*/
/***********************************************************************/
- $nom_chose = addslashes($nom_chose);
+
+ $nom_chose = addslashes(_request('nom_chose'));
if(!isset($choses_possibles[$nom_chose])) {
list($nom_chose,) = each($choses_possibles);
reset($choses_possibles);
}
$id_chose = $choses_possibles[$nom_chose]['id_chose'];
+ $table_principale = $choses_possibles[$nom_chose]['table_principale'];
+ $table_auth = $choses_possibles[$nom_chose]['table_auth'];
+ $tables_limite = $choses_possibles[$nom_chose]['tables_limite'];
/***********************************************************************/
/* action */
/***********************************************************************/
- list($mots_voir, $mots_cacher, $mots_ajouter, $mots_enlever) = splitArrayIds($mots);
+ list($mots_voir, $mots_cacher, $mots_ajouter, $mots_enlever) = splitArrayIds(_request('mots'));
$choses = secureIntArray($choses);
$switch = addslashes($switch);
if($switch == '') $switch = 'voir';
@@ -162,16 +177,13 @@
$par_mots = '';
- if(count($mots)) {
- foreach($mots as $id => $m)
+ if(count(_request('mots'))) {
+ foreach(_request('mots') as $id => $m)
$par_mots .= "&mots[$id]=$m";
}
-
- // $redirect = generer_url_action('mots_partout',"nom_chose=$nom_chose&stict=$strict&switch=$switch&ajax=$ajax&redirect=$redirect$par_chose$par_mots");
$redirect = _request('redirect')."&nom_chose=$nom_chose&stict=$strict&switch=$switch&ajax=$ajax&redirect=$redirect$par_choses$par_mots";
-
redirige_par_entete($redirect);
}
Modified: _plugins_/_amelioration_admin_/tri_mots/exec/tri_mots.php
--- _plugins_/_amelioration_admin_/tri_mots/exec/tri_mots.php (original)
+++ _plugins_/_amelioration_admin_/tri_mots/exec/tri_mots.php Sat Jul 15 23:54:09 2006
@@ -86,7 +87,13 @@
if(!spip_fetch_array($res)) {
spip_query("ALTER TABLE `".$table_pref."_mots_$table` ADD `rang` BIGINT NOT NULL DEFAULT 0;");
$from = array("spip_$table");
+ if($table == 'auteurs') {
+ $select = array($id_table,'nom');
+ } else
$select = array($id_table,'titre');
+ if($table == 'auteurs') {
+ $where = array("nom REGEXP '^[0-9]+\\. '");
+ } else
$where = array("titre REGEXP '^[0-9]+\\. '");
$results = spip_abstract_select($select,$from,$where);
while($row = spip_abstract_fetch($results)) {
@@ -130,7 +137,7 @@
fin_cadre_enfonce();
debut_cadre_enfonce();
- $redirect = generer_url_ecrire('tri_mots',"table=$table&id_table=$id_table&id_mot=$id_mot");
+ $redirect = generer_url_ecrire('tri_mots',"objet=$table&ident_objet=$id_table&id_mot=$id_mot");
echo '<form id="submit_form" action="'.generer_url_action('tri_mots',"table=$table&id_table=$id_table&id_mot=$id_mot").'" method="post">
<input type="hidden" name="redirect" value="'.$redirect.'"/>
<input type="hidden" name="hash" value="'.calculer_action_auteur("tri_mots $table $id_table $id_mot").'"/>
@@ -144,10 +151,13 @@
debut_droite();
-
+ if($table == 'auteurs')
+ $select = array("$table.nom", "$table.$id_table", 'lien.rang');
+ else
$select = array("$table.titre", "$table.$id_table", 'lien.rang');
$from = array("spip_mots_$table AS lien", "spip_$table AS $table");
- $where = array("$table.$id_table=lien.$id_table" , "$table.statut='publie'" ,"lien.id_mot=$id_mot");
+ $where = array("$table.$id_table=lien.$id_table" , "lien.id_mot=$id_mot");
+ if($table != 'auteurs') $where[] = "$table.statut='publie'";
$order = array('lien.rang');
global $spip_lang_left;
@@ -163,7 +173,9 @@
$result = spip_abstract_select($select,$from,$where,'',$order);
while ($row = spip_abstract_fetch($result)) {
$id=$row[$id_table];
- $titre=$row['titre'];
+ if($table == 'auteurs')
+ $titre=$row['nom'];
+ else $titre=$row['titre'];
$rang=$row['rang'];
echo "<li id='".$table."_$id'><span class=\"titre\">$titre</span><span class=\"lien\"><a href='" . generer_url_ecrire("$tables","$id_table=$id") . "'>"._T('trimots:voir')."</a></span><span class=\"rang\">$rang</span></li>";