From 17de706b7e2e796e7bdb8e8281ab3768df4533a7 Mon Sep 17 00:00:00 2001 From: "Pierre Habouzit (MadCoder" Date: Thu, 2 Dec 2004 08:48:25 +0000 Subject: [PATCH] work on searc, lists modules * Search : - Begin to create a SearchConfig class, and put all data there. * Lists : - Move file templates into install.d/lists/mail_templates. * plat/al-devel : - Move scripts templates away, into the install.d/platal-dev dir. + : re-add carva_redirect.php that was lost ... git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-12 --- bin/devel/foobar.pl | 26 ---------- bin/devel/foobar.tpl | 24 --------- bin/devel/modules_status | 4 +- htdocs/advanced_search.php | 10 ++-- htdocs/carva_redirect.php | 57 ++++++++++++++++++++++ htdocs/search.php | 12 ++--- .../conf.d/search.globals.inc.php | 15 ++++-- include/search.classes.inc.php | 4 +- install.d/banana/files | 2 +- install.d/lists/files | 10 ---- .../lists/mail_templates}/adminsubscribeack.txt | 0 .../lists/mail_templates}/approve.txt | 0 .../lists/mail_templates}/checkdbs.txt | 0 .../lists/mail_templates}/masthead.txt | 0 .../lists/mail_templates}/newlist.txt | 0 .../lists/mail_templates}/postauth.txt | 0 .../lists/mail_templates}/postheld.txt | 0 .../lists/mail_templates}/refuse.txt | 0 .../lists/mail_templates}/subauth.txt | 0 .../lists/mail_templates}/subscribeack.txt | 0 install.d/platal-dev/files | 3 -- upgrade/inc/pervasive.sh | 2 +- 22 files changed, 86 insertions(+), 83 deletions(-) delete mode 100644 bin/devel/foobar.pl delete mode 100644 bin/devel/foobar.tpl create mode 100644 htdocs/carva_redirect.php rename bin/devel/foobar.php => include/conf.d/search.globals.inc.php (87%) rename {bin/mailman/mails => install.d/lists/mail_templates}/adminsubscribeack.txt (100%) rename {bin/mailman/mails => install.d/lists/mail_templates}/approve.txt (100%) rename {bin/mailman/mails => install.d/lists/mail_templates}/checkdbs.txt (100%) rename {bin/mailman/mails => install.d/lists/mail_templates}/masthead.txt (100%) rename {bin/mailman/mails => install.d/lists/mail_templates}/newlist.txt (100%) rename {bin/mailman/mails => install.d/lists/mail_templates}/postauth.txt (100%) rename {bin/mailman/mails => install.d/lists/mail_templates}/postheld.txt (100%) rename {bin/mailman/mails => install.d/lists/mail_templates}/refuse.txt (100%) rename {bin/mailman/mails => install.d/lists/mail_templates}/subauth.txt (100%) rename {bin/mailman/mails => install.d/lists/mail_templates}/subscribeack.txt (100%) diff --git a/bin/devel/foobar.pl b/bin/devel/foobar.pl deleted file mode 100644 index a10179e..0000000 --- a/bin/devel/foobar.pl +++ /dev/null @@ -1,26 +0,0 @@ -#! /usr/bin/perl -w -#*************************************************************************** -#* Copyright (C) 2003-2004 Polytechnique.org * -#* http://opensource.polytechnique.org/ * -#* * -#* 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 * -#* the Free Software Foundation; either version 2 of the License, or * -#* (at your option) any later version. * -#* * -#* This program is distributed in the hope that it will be useful, * -#* but WITHOUT ANY WARRANTY; without even the implied warranty of * -#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -#* GNU General Public License for more details. * -#* * -#* You should have received a copy of the GNU General Public License * -#* along with this program; if not, write to the Free Software * -#* Foundation, Inc., * -#* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * -#*************************************************************************** -# $Id: foobar.pl,v 1.1 2004/08/31 11:38:21 x2000habouzit Exp $ -#*************************************************************************** - -use strict; - -exit 0; diff --git a/bin/devel/foobar.tpl b/bin/devel/foobar.tpl deleted file mode 100644 index a6bf5a6..0000000 --- a/bin/devel/foobar.tpl +++ /dev/null @@ -1,24 +0,0 @@ -{*************************************************************************** - * Copyright (C) 2003-2004 Polytechnique.org * - * http://opensource.polytechnique.org/ * - * * - * 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 * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the Free Software * - * Foundation, Inc., * - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - *************************************************************************** - $Id: foobar.tpl,v 1.1 2004/08/31 11:38:21 x2000habouzit Exp $ - ***************************************************************************} - - -{* vim:set et sw=2 sts=2 sws=2: *} diff --git a/bin/devel/modules_status b/bin/devel/modules_status index 50430ec..118a173 100755 --- a/bin/devel/modules_status +++ b/bin/devel/modules_status @@ -2,8 +2,8 @@ chdir ${1:-.} -dirs=(configs htdocs hooks include plugins scripts templates) -opts=(-type f -not -path '*CVS*' -not -name '.cvsignore') +dirs=(bin configs htdocs hooks include plugins templates) +opts=(-type f -not -path '*CVS*' -not -name '.cvsignore' -not -path '*.arch*') diff -u <(cat install.d/**/files|sort) <(find $dirs $opts|sort) \ | grep '^[-+][a-z]' | sed -e 's,^+,Orphaned: ,;s,^-,Missing : ,' diff --git a/htdocs/advanced_search.php b/htdocs/advanced_search.php index 97ee888..e900fa4 100644 --- a/htdocs/advanced_search.php +++ b/htdocs/advanced_search.php @@ -122,7 +122,7 @@ else { u.prenom, u.promo, a.alias AS forlife, - '.$globals->search_result_fields.' + '.$globals->search->result_fields.' c.uid AS contact, w.ni_id AS contact FROM auth_user_md5 AS u' @@ -131,20 +131,20 @@ else { .' LEFT JOIN aliases AS a ON (u.user_id = a.id AND a.type="a_vie") LEFT JOIN contacts AS c ON (c.uid='.((array_key_exists('uid',$_SESSION))?$_SESSION['uid']:0).' AND c.contact=u.user_id) LEFT JOIN watch_nonins AS w ON (w.ni_id=u.user_id AND w.uid='.((array_key_exists('uid',$_SESSION))?$_SESSION['uid']:0).') - '.$globals->search_result_where_statement.' + '.$globals->search->result_where_statement.' '.(($where!='')?('WHERE '.$where):'').' ORDER BY '.(logged() && !empty($_REQUEST['mod_date_sort']) ? 'date DESC,' :'') .implode(',',array_filter(array($fields->get_order_statement(),'promo DESC,NomSortKey,prenom'))).' - LIMIT '.$offset->value.','.$globals->search_results_per_page; + LIMIT '.$offset->value.','.$globals->search->per_page; $page->mysql_assign($sql, 'resultats', 'nb_resultats','nb_resultats_total'); - $nbpages = ($page->get_template_vars('nb_resultats_total')-1)/$globals->search_results_per_page; + $nbpages = ($page->get_template_vars('nb_resultats_total')-1)/$globals->search->per_page; $page->assign('offsets',range(0,$nbpages)); $page->assign('offset',$offset->value); $page->assign('url_args',$fields->get_url()); $page->assign('with_soundex',$with_soundex); $page->assign('mod_date_sort',!empty($_REQUEST['mod_date_sort'])); - $page->assign('perpage',$globals->search_results_per_page); + $page->assign('perpage',$globals->search->per_page); $page->assign('is_admin',has_perms()); if(!$page->get_template_vars('nb_resultats_total')) { diff --git a/htdocs/carva_redirect.php b/htdocs/carva_redirect.php new file mode 100644 index 0000000..14cebec --- /dev/null +++ b/htdocs/carva_redirect.php @@ -0,0 +1,57 @@ +db->query("update auth_user_md5 set redirecturl = '{$_REQUEST['url']}'" + ." where user_id = '{$_SESSION['uid']}'"); + if (mysql_errno($conn) == 0) { + $_SESSION['log']->log("carva_add","http://".$_REQUEST['url']); + $page->assign('message',"

Redirection activée vers {$_REQUEST['url']}

\n"); + } else { + $page->assign('message',"

Erreur de mise à jour

\n"); + } +} elseif (isset($_REQUEST['submit']) and $_REQUEST['submit'] == "Supprimer") { + // on supprime la redirection + $globals->db->query("update auth_user_md5 set redirecturl = '' where user_id = {$_SESSION['uid']}"); + if (mysql_errno($conn) == 0) { + $_SESSION['log']->log("carva_del",$_REQUEST['url']); + $_POST['url'] = ''; + $page->assign('message',"

Redirection supprimée

"); + } else { + $page->assign('message',"

Erreur de suppression

\n"); + } +} + + +$result = $globals->db->query("select redirecturl from auth_user_md5 where user_id={$_SESSION['uid']}"); +list($carva) = mysql_fetch_row($result); +mysql_free_result($result); +$page->assign('carva', $carva); + +$page->run(); +?> diff --git a/htdocs/search.php b/htdocs/search.php index 4afb76b..8993fe3 100644 --- a/htdocs/search.php +++ b/htdocs/search.php @@ -52,7 +52,7 @@ if (array_key_exists('quick', $_REQUEST)) { IF(u.prenom!="",u.prenom,u.prenom_ini) AS prenom, u.promo AS promo, a.alias AS forlife, - '.$globals->search_result_fields.' + '.$globals->search->result_fields.' c.uid AS contact, w.ni_id AS watch FROM auth_user_md5 AS r @@ -60,26 +60,26 @@ if (array_key_exists('quick', $_REQUEST)) { LEFT JOIN aliases AS a ON (u.user_id = a.id AND a.type="a_vie") LEFT JOIN contacts AS c ON (c.uid='.((array_key_exists('uid',$_SESSION))?$_SESSION['uid']:0).' AND c.contact=u.user_id) LEFT JOIN watch_nonins AS w ON (w.ni_id=u.user_id AND w.uid='.((array_key_exists('uid',$_SESSION))?$_SESSION['uid']:0).') - '.$globals->search_result_where_statement.' + '.$globals->search->result_where_statement.' WHERE '.$fields->get_where_statement().' HAVING mark>0 ORDER BY '.(logged() && !empty($_REQUEST['mod_date_sort']) ? 'date DESC,' :'') .implode(',',array_filter(array($fields->get_order_statement(),'u.promo DESC,NomSortKey,prenom'))).' - LIMIT '.$offset->value.','.$globals->search_results_per_page; + LIMIT '.$offset->value.','.$globals->search->per_page; $page->mysql_assign($sql, 'resultats', 'nb_resultats','nb_resultats_total'); echo mysql_error(); - $nbpages = ($page->get_template_vars('nb_resultats_total')-1)/$globals->search_results_per_page; + $nbpages = ($page->get_template_vars('nb_resultats_total')-1)/$globals->search->per_page; $page->assign('offsets',range(0,$nbpages)); $page->assign('url_args',$fields->get_url()); $page->assign('mod_date_sort',!empty($_REQUEST['mod_date_sort'])); $page->assign('offset',$offset->value); - $page->assign('perpage',$globals->search_results_per_page); + $page->assign('perpage',$globals->search->per_page); $page->assign('is_admin',has_perms()); if (!logged() && - $page->get_template_vars('nb_resultats_total')>$globals->public_max_search_results) + $page->get_template_vars('nb_resultats_total')>$globals->search->public_max) { new ThrowError('Votre recherche a généré trop de résultats pour un affichage public.'); } diff --git a/bin/devel/foobar.php b/include/conf.d/search.globals.inc.php similarity index 87% rename from bin/devel/foobar.php rename to include/conf.d/search.globals.inc.php index 42d4d62..00ab2c4 100644 --- a/bin/devel/foobar.php +++ b/include/conf.d/search.globals.inc.php @@ -18,11 +18,20 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: foobar.php,v 1.4 2004/11/22 11:16:34 x2000habouzit Exp $ + $Id: banana.globals.inc.php,v 1.2 2004/12/01 14:25:44 x2000habouzit Exp $ ***************************************************************************/ -require('xorg.inc.php'); +// {{{ class SearchConfig + +class SearchConfig +{ + var $public_max = 25; + var $per_page = 20; +} + +// }}} + +$this->search = new SearchConfig; - // vim:set et sw=4 sts=4 sws=4 foldmethod=marker: ?> diff --git a/include/search.classes.inc.php b/include/search.classes.inc.php index d43620e..e22c9cc 100644 --- a/include/search.classes.inc.php +++ b/include/search.classes.inc.php @@ -26,7 +26,7 @@ require_once("xorg.misc.inc.php"); /* * Variables globales pour l'affichage des résultats de la recherche */ -$globals->search_result_fields = ' +$globals->search->result_fields = ' if(u.epouse=\'\', u.nom, u.epouse) AS NomSortKey, u.epouse,u.date,u.web,u.mobile, u.deces!=0 AS dcd,u.deces, @@ -38,7 +38,7 @@ $globals->search_result_fields = ' e.entreprise, es.label AS secteur, ef.fonction_fr AS fonction, IF(n.nat=\'\',n.pays,n.nat) AS nat, n.a2 AS iso3166, adr.ville, gp.pays, gr.name AS region,'; -$globals->search_result_where_statement = ' +$globals->search->result_where_statement = ' LEFT JOIN applis_ins AS ai0 ON (u.user_id = ai0.uid AND ai0.ordre = 0) LEFT JOIN applis_def AS ad0 ON (ad0.id = ai0.aid) LEFT JOIN applis_ins AS ai1 ON (u.user_id = ai1.uid AND ai1.ordre = 1) diff --git a/install.d/banana/files b/install.d/banana/files index 3478269..c3ffeda 100644 --- a/install.d/banana/files +++ b/install.d/banana/files @@ -15,7 +15,7 @@ htdocs/banana/include/subscribe.inc.php htdocs/banana/index.php htdocs/banana/install.sh htdocs/banana/post.php -htdocs/banana/bin/spoolgen.php +htdocs/banana/scripts/spoolgen.php htdocs/banana/subscribe.php htdocs/banana/thread.php htdocs/banana/xface.php diff --git a/install.d/lists/files b/install.d/lists/files index 10a4a07..33d80c3 100644 --- a/install.d/lists/files +++ b/install.d/lists/files @@ -13,16 +13,6 @@ htdocs/listes/archives.php include/validations/listes.inc.php bin/mailman/foreach_template.py bin/mailman/mailman-rpc.py -bin/mailman/mails/adminsubscribeack.txt -bin/mailman/mails/approve.txt -bin/mailman/mails/checkdbs.txt -bin/mailman/mails/masthead.txt -bin/mailman/mails/newlist.txt -bin/mailman/mails/postauth.txt -bin/mailman/mails/postheld.txt -bin/mailman/mails/refuse.txt -bin/mailman/mails/subauth.txt -bin/mailman/mails/subscribeack.txt templates/admin/lists.tpl templates/include/form.valid.listes.tpl templates/include/form.valid.ml.tpl diff --git a/bin/mailman/mails/adminsubscribeack.txt b/install.d/lists/mail_templates/adminsubscribeack.txt similarity index 100% rename from bin/mailman/mails/adminsubscribeack.txt rename to install.d/lists/mail_templates/adminsubscribeack.txt diff --git a/bin/mailman/mails/approve.txt b/install.d/lists/mail_templates/approve.txt similarity index 100% rename from bin/mailman/mails/approve.txt rename to install.d/lists/mail_templates/approve.txt diff --git a/bin/mailman/mails/checkdbs.txt b/install.d/lists/mail_templates/checkdbs.txt similarity index 100% rename from bin/mailman/mails/checkdbs.txt rename to install.d/lists/mail_templates/checkdbs.txt diff --git a/bin/mailman/mails/masthead.txt b/install.d/lists/mail_templates/masthead.txt similarity index 100% rename from bin/mailman/mails/masthead.txt rename to install.d/lists/mail_templates/masthead.txt diff --git a/bin/mailman/mails/newlist.txt b/install.d/lists/mail_templates/newlist.txt similarity index 100% rename from bin/mailman/mails/newlist.txt rename to install.d/lists/mail_templates/newlist.txt diff --git a/bin/mailman/mails/postauth.txt b/install.d/lists/mail_templates/postauth.txt similarity index 100% rename from bin/mailman/mails/postauth.txt rename to install.d/lists/mail_templates/postauth.txt diff --git a/bin/mailman/mails/postheld.txt b/install.d/lists/mail_templates/postheld.txt similarity index 100% rename from bin/mailman/mails/postheld.txt rename to install.d/lists/mail_templates/postheld.txt diff --git a/bin/mailman/mails/refuse.txt b/install.d/lists/mail_templates/refuse.txt similarity index 100% rename from bin/mailman/mails/refuse.txt rename to install.d/lists/mail_templates/refuse.txt diff --git a/bin/mailman/mails/subauth.txt b/install.d/lists/mail_templates/subauth.txt similarity index 100% rename from bin/mailman/mails/subauth.txt rename to install.d/lists/mail_templates/subauth.txt diff --git a/bin/mailman/mails/subscribeack.txt b/install.d/lists/mail_templates/subscribeack.txt similarity index 100% rename from bin/mailman/mails/subscribeack.txt rename to install.d/lists/mail_templates/subscribeack.txt diff --git a/install.d/platal-dev/files b/install.d/platal-dev/files index 7009c98..49e6db0 100644 --- a/install.d/platal-dev/files +++ b/install.d/platal-dev/files @@ -1,8 +1,5 @@ include/conf.d/README -bin/devel/foobar.php -bin/devel/foobar.pl -bin/devel/foobar.tpl bin/devel/modules_status bin/devel/tplgettext.php diff --git a/upgrade/inc/pervasive.sh b/upgrade/inc/pervasive.sh index f3cf898..c5f6e2c 100755 --- a/upgrade/inc/pervasive.sh +++ b/upgrade/inc/pervasive.sh @@ -18,7 +18,7 @@ function mailman_stop() { function mailman_templates() { echo -n "copies new mails templates" - cp -f ../../scripts/mailman/mails/*.txt /etc/mailman/fr/ + cp -f ../install.d/lists/mail_templates/*.txt /etc/mailman/fr/ echo . } -- 2.1.4