
commit
fe62255f20
119 changed files with 10469 additions and 0 deletions
@ -0,0 +1,117 @@
|
||||
* text=auto !eol |
||||
action/configuration.php -text |
||||
base/convert_sql_utf8.php -text |
||||
base/convert_utf8.php -text |
||||
exec/base_convert_sql_utf8.php -text |
||||
exec/base_convert_utf8.php -text |
||||
exec/configuration.php -text |
||||
exec/informer_auteur.php -text |
||||
exec/memoriser.php -text |
||||
exec/rechercher_auteur.php -text |
||||
exec/selectionner_auteur.php -text |
||||
/grenier-32.png -text |
||||
/grenier_fonctions.php -text |
||||
inc/actions.php -text |
||||
inc/afficher_objets.php -text |
||||
inc/date.php -text |
||||
inc/dater.php -text |
||||
inc/editer_auteurs.php -text |
||||
inc/editer_mots.php -text |
||||
inc/filtres_images.php -text |
||||
inc/filtres_images_compat.php -text |
||||
inc/formater_article.php -text |
||||
inc/formater_auteur.php -text |
||||
inc/informer_auteur.php -text |
||||
inc/meme_rubrique.php -text |
||||
inc/php3.php -text |
||||
inc/presentation.php -text |
||||
inc/presenter_liste.php -text |
||||
inc/ressembler.php -text |
||||
inc/selectionner_auteur.php -text |
||||
inc/vieilles_defs.php -text |
||||
lang/grenier.xml -text |
||||
lang/grenier_an.php -text |
||||
lang/grenier_ar.php -text |
||||
lang/grenier_ast.php -text |
||||
lang/grenier_ay.php -text |
||||
lang/grenier_bg.php -text |
||||
lang/grenier_bn.php -text |
||||
lang/grenier_bo.php -text |
||||
lang/grenier_br.php -text |
||||
lang/grenier_bs.php -text |
||||
lang/grenier_ca.php -text |
||||
lang/grenier_co.php -text |
||||
lang/grenier_cpf.php -text |
||||
lang/grenier_cpf_hat.php -text |
||||
lang/grenier_cs.php -text |
||||
lang/grenier_da.php -text |
||||
lang/grenier_de.php -text |
||||
lang/grenier_en.php -text |
||||
lang/grenier_en_hx.php -text |
||||
lang/grenier_eo.php -text |
||||
lang/grenier_es.php -text |
||||
lang/grenier_es_mx_pop.php -text |
||||
lang/grenier_eu.php -text |
||||
lang/grenier_fa.php -text |
||||
lang/grenier_fi.php -text |
||||
lang/grenier_fon.php -text |
||||
lang/grenier_fr.php -text |
||||
lang/grenier_fr_sc.php -text |
||||
lang/grenier_fr_tu.php -text |
||||
lang/grenier_gl.php -text |
||||
lang/grenier_hac.php -text |
||||
lang/grenier_he.php -text |
||||
lang/grenier_hu.php -text |
||||
lang/grenier_id.php -text |
||||
lang/grenier_is.php -text |
||||
lang/grenier_it.php -text |
||||
lang/grenier_it_fem.php -text |
||||
lang/grenier_iu.php -text |
||||
lang/grenier_ja.php -text |
||||
lang/grenier_km.php -text |
||||
lang/grenier_lb.php -text |
||||
lang/grenier_mg.php -text |
||||
lang/grenier_mk.php -text |
||||
lang/grenier_my.php -text |
||||
lang/grenier_nb.php -text |
||||
lang/grenier_nl.php -text |
||||
lang/grenier_no.php -text |
||||
lang/grenier_oc_auv.php -text |
||||
lang/grenier_oc_gsc.php -text |
||||
lang/grenier_oc_lms.php -text |
||||
lang/grenier_oc_lnc.php -text |
||||
lang/grenier_oc_ni.php -text |
||||
lang/grenier_oc_ni_la.php -text |
||||
lang/grenier_oc_pro.php -text |
||||
lang/grenier_oc_prv.php -text |
||||
lang/grenier_oc_va.php -text |
||||
lang/grenier_pl.php -text |
||||
lang/grenier_pt.php -text |
||||
lang/grenier_pt_br.php -text |
||||
lang/grenier_qu.php -text |
||||
lang/grenier_ro.php -text |
||||
lang/grenier_ru.php -text |
||||
lang/grenier_scn.php -text |
||||
lang/grenier_sk.php -text |
||||
lang/grenier_src.php -text |
||||
lang/grenier_sro.php -text |
||||
lang/grenier_sv.php -text |
||||
lang/grenier_sw.php -text |
||||
lang/grenier_ta.php -text |
||||
lang/grenier_tr.php -text |
||||
lang/grenier_ty.php -text |
||||
lang/grenier_ur.php -text |
||||
lang/grenier_vi.php -text |
||||
lang/grenier_zh.php -text |
||||
lang/paquet-grenier.xml -text |
||||
lang/paquet-grenier_ar.php -text |
||||
lang/paquet-grenier_en.php -text |
||||
lang/paquet-grenier_fa.php -text |
||||
lang/paquet-grenier_fr_tu.php -text |
||||
lang/paquet-grenier_it.php -text |
||||
lang/paquet-grenier_nl.php -text |
||||
lang/paquet-grenier_pt_br.php -text |
||||
lang/paquet-grenier_ru.php -text |
||||
lang/paquet-grenier_sk.php -text |
||||
prive/javascript/layer_old.js -text |
||||
prive/objets/editer/dater.html -text |
@ -0,0 +1,50 @@
|
||||
<?php |
||||
|
||||
/***************************************************************************\ |
||||
* SPIP, Systeme de publication pour l'internet * |
||||
* * |
||||
* Copyright (c) 2001-2016 * |
||||
* Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * |
||||
* * |
||||
* Ce programme est un logiciel libre distribue sous licence GNU/GPL. * |
||||
* Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
||||
\***************************************************************************/ |
||||
|
||||
if (!defined('_ECRIRE_INC_VERSION')) return; |
||||
|
||||
// Mise a jour de l'option de configuration $arg |
||||
// il faudrait limiter a arg plutot que d'executer tout modif_config |
||||
// on traite a part seulement le cas du proxy car c'est indispensable |
||||
// (message d'erreur eventuel a afficher) |
||||
|
||||
include_spip('inc/config'); |
||||
|
||||
// https://code.spip.net/@action_configurer_dist |
||||
function action_configuration_dist() { |
||||
|
||||
$securiser_action = charger_fonction('securiser_action', 'inc'); |
||||
$arg = $securiser_action(); |
||||
|
||||
# ceinture & bretelles, a priori le test dans exec_configurer |
||||
# suffit a empecher d'obtenir un hash qui passe le test ci-dessus |
||||
if(!autoriser('configurer', '_'._request('configuration'))) { |
||||
include_spip('inc/minipres'); |
||||
echo minipres(_T('info_acces_interdit')); |
||||
exit; |
||||
} |
||||
|
||||
$r = rawurldecode(_request('redirect')); |
||||
$r = parametre_url($r, 'configuration', $arg, "&"); |
||||
appliquer_modifs_config(); |
||||
|
||||
// Cette globale est fixee par appliquer_modifs_config(); |
||||
// c'est un message a afficher dans l'exec de retour (relayeur si comme ici on est en ajax) |
||||
if ($arg == 'relayeur') |
||||
$r = parametre_url($r, 'retour_proxy', $GLOBALS['retour_proxy'], "&"); |
||||
elseif ($arg == 'langue') { |
||||
include_spip('inc/rubriques'); |
||||
calculer_langues_rubriques(); |
||||
} |
||||
if (_request('envoi_now')) cron(0, array('mail' => -1)); |
||||
redirige_par_entete($r); |
||||
} |
@ -0,0 +1,128 @@
|
||||
<?php |
||||
|
||||
/***************************************************************************\ |
||||
* SPIP, Systeme de publication pour l'internet * |
||||
* * |
||||
* Copyright (c) 2001-2016 * |
||||
* Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * |
||||
* * |
||||
* Ce programme est un logiciel libre distribue sous licence GNU/GPL. * |
||||
* Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
||||
\***************************************************************************/ |
||||
|
||||
if (!defined('_ECRIRE_INC_VERSION')) return; |
||||
|
||||
|
||||
// https://code.spip.net/@base_convert_sql_utf8_dist |
||||
function base_convert_sql_utf8_dist($titre = '', $reprise = false) |
||||
{ |
||||
if (!$titre) return; // anti-testeur automatique |
||||
ecrire_meta('convert_sql_utf8', 'oui', 'non'); |
||||
echo install_debut_html($titre); |
||||
|
||||
echo "<p>", _T('grenier:utf8_convert_timeout'), "</p><hr />\n"; |
||||
|
||||
convert_sql_utf8($titre); |
||||
|
||||
echo "<p><b>"._T('grenier:utf8_convert_termine')."</b></p>"; |
||||
effacer_meta('convert_sql_utf8'); |
||||
|
||||
// bouton "retour au site" + redirige_par_entete |
||||
echo "<p style='text-align: right'>", |
||||
"<a href='", generer_url_ecrire("configurer_langue"), "'> >> ", |
||||
_T('icone_retour'),"</a></p>", |
||||
install_fin_html(); |
||||
} |
||||
|
||||
// https://code.spip.net/@convert_sql_utf8 |
||||
function convert_sql_utf8($titre) { |
||||
|
||||
define('_DEBUG_CONVERT', false); |
||||
$charset_spip = $GLOBALS['meta']['charset']; |
||||
$charset_supporte = false; |
||||
$utf8_supporte = false; |
||||
// verifier que mysql gere le charset courant pour effectuer les conversions |
||||
if ($c = sql_get_charset($charset_spip)){ |
||||
$sql_charset = $c['charset']; |
||||
$sql_collation = $c['collation']; |
||||
$charset_supporte = true; |
||||
} |
||||
if (!$charset_supporte){ |
||||
$res = spip_query("SHOW CHARACTER SET"); |
||||
while ($row = sql_fetch($res)){ |
||||
if ($row['Charset'] == 'utf8') $utf8_supporte = true; |
||||
} |
||||
echo install_debut_html($titre); |
||||
echo _L("Le charset SPIP actuel $charset_spip n'est pas supporte par votre serveur MySQL<br/>"); # non traduit car complexe & obsolete |
||||
if ($utf8_supporte) |
||||
echo _L("Votre serveur supporte utf-8, vous devriez convertir votre site en utf-8 avant de recommencer cette operation"); |
||||
echo install_fin_html(); |
||||
} else { |
||||
echo _L("Charset Actuel du site SPIP : $charset_spip<br/>"); |
||||
echo _L("Conversion des champs des tables spip de type latin1 vers <b>$sql_charset</b> (collation $sql_collation) <br/>"); |
||||
// lister les collations et leur charset correspondant |
||||
$res = spip_query("SHOW COLLATION"); |
||||
$charset2collations = array(); |
||||
while ($row = sql_fetch($res)){ |
||||
$charset2collations[$row['Collation']] = $row['Charset']; |
||||
} |
||||
|
||||
$count = 0; |
||||
// lister les tables spip |
||||
include_spip('base/serial'); |
||||
include_spip('base/auxiliaires'); |
||||
|
||||
$res = spip_query("SHOW TABLES"); |
||||
while (($row = sql_fetch($res)) /*&& ($count<1)*/){ |
||||
$nom = array_shift($row); |
||||
if (preg_match(',^'.$GLOBALS['table_prefix'].'_(.*)$,', $nom, $regs)){ |
||||
$count++; |
||||
$nom = $regs[1]; |
||||
echo "<hr /><h2>$nom</h2>"; |
||||
// lister les champs de la table |
||||
$res2 = spip_query("SHOW FULL COLUMNS FROM spip_$nom"); |
||||
while ($row2 = sql_fetch($res2)){ |
||||
$collation = $row2['Collation']; |
||||
$champ = $row2['Field']; |
||||
if ($collation != "NULL" |
||||
&& isset($charset2collations[$collation]) |
||||
&& $charset2collations[$collation] == 'latin1'){ |
||||
echo "Conversion de '$champ' depuis $collation (".$charset2collations[$collation]."):"; |
||||
// conversion de latin1 vers le charset reel du contenu |
||||
$type_texte = $row2['Type']; |
||||
$type_blob = "blob"; |
||||
if (strpos($type_texte, "text") !== false) |
||||
$type_blob = str_replace("text", "blob", $type_texte); |
||||
|
||||
// sauf si blob expressement demande dans la description ! |
||||
if (( |
||||
$a = $GLOBALS['tables_principales']['spip_'.$nom]['field'][$champ] |
||||
or $a = $GLOBALS['tables_auxiliaires']['spip_'.$nom]['field'][$champ] |
||||
) and preg_match(',blob,i', $a)) { |
||||
echo "On ignore le champ blob $nom.$champ <hr />\n"; |
||||
} else { |
||||
|
||||
$default = $row2['Default']?(" DEFAULT ".sql_quote($row2['Default'])):""; |
||||
$notnull = ($row2['Null'] == 'YES')?"":" NOT NULL"; |
||||
$q = "ALTER TABLE spip_$nom CHANGE $champ $champ $type_blob $default $notnull"; |
||||
if (!_DEBUG_CONVERT) |
||||
$b = spip_query($q); |
||||
echo "<pre>$q</pre>$b\n"; |
||||
$q = "ALTER TABLE spip_$nom CHANGE $champ $champ $type_texte CHARACTER SET $sql_charset COLLATE $sql_collation $default $notnull"; |
||||
if (!_DEBUG_CONVERT) |
||||
$b = spip_query($q); |
||||
echo "<pre>$q</pre>\n"; |
||||
} |
||||
} |
||||
} |
||||
// on ne change le charset par defaut de la table que quand tous ses champs sont convertis |
||||
$q = "ALTER TABLE spip_$nom DEFAULT CHARACTER SET $sql_charset COLLATE $sql_collation"; |
||||
if (!_DEBUG_CONVERT) |
||||
$b = spip_query($q); |
||||
echo "<pre>$q</pre>$b\n"; |
||||
} |
||||
} |
||||
ecrire_meta('charset_sql_base', $sql_charset, 'non'); |
||||
ecrire_meta('charset_sql_connexion', $sql_charset, 'non'); |
||||
} |
||||
} |
@ -0,0 +1,158 @@
|
||||
<?php |
||||
|
||||
/***************************************************************************\ |
||||
* SPIP, Systeme de publication pour l'internet * |
||||
* * |
||||
* Copyright (c) 2001-2016 * |
||||
* Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * |
||||
* * |
||||
* Ce programme est un logiciel libre distribue sous licence GNU/GPL. * |
||||
* Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
||||
\***************************************************************************/ |
||||
|
||||
if (!defined('_ECRIRE_INC_VERSION')) return; |
||||
|
||||
// https://code.spip.net/@convert_utf8_init |
||||
function convert_utf8_init($tables_a_convertir) |
||||
{ |
||||
// noter dans les meta qu'on veut convertir, et quoi |
||||
$charset_source = $GLOBALS['meta']['charset']; |
||||
ecrire_meta('charset', 'utf-8'); |
||||
foreach ($tables_a_convertir as $table => $champ) { |
||||
spip_log("demande update charset table $table ($champ)", _LOG_INFO_IMPORTANTE); |
||||
spip_query("UPDATE $table SET $champ = CONCAT('<CONVERT ".$charset_source.">', $champ) WHERE $champ NOT LIKE '<CONVERT %'"); |
||||
} |
||||
|
||||
spip_unlink(_DIR_TMP.'convert_utf8_backup.sql'); |
||||
|
||||
// convertir spip_meta |
||||
|
||||
foreach ($GLOBALS['meta'] as $c => $v) { |
||||
$v2 = unicode_to_utf_8(charset2unicode($v, $charset_source)); |
||||
if ($v2 != $v) ecrire_meta($c, $v2); |
||||
} |
||||
} |
||||
|
||||
// https://code.spip.net/@base_convert_utf8_dist |
||||
function base_convert_utf8_dist($titre = '', $reprise = false) |
||||
{ |
||||
if (!$titre) return; // anti-testeur automatique |
||||
// une liste des tables a convertir, avec le champ dans lequel on |
||||
// indique '<CONVERT charset>' ; on commence par les rubriques sinon |
||||
// ca fait desordre dans l'interface privee |
||||
$tables_a_convertir = array( |
||||
'spip_rubriques' => 'titre', |
||||
'spip_auteurs' => 'nom', |
||||
'spip_articles' => 'titre', |
||||
'spip_breves' => 'titre', |
||||
'spip_documents' => 'titre', |
||||
'spip_forum' => 'titre', |
||||
'spip_mots' => 'titre', |
||||
'spip_groupes_mots' => 'titre', |
||||
'spip_petitions' => 'texte', |
||||
'spip_signatures' => 'nom_email', |
||||
'spip_syndic' => 'nom_site', |
||||
'spip_syndic_articles' => 'titre', |
||||
'spip_messages' => 'titre' |
||||
); |
||||
|
||||
if (!$reprise) convert_utf8_init($tables_a_convertir); |
||||
|
||||
echo install_debut_html($titre); |
||||
|
||||
echo "<p>", _T('grenier:utf8_convert_timeout'), "</p><hr />\n"; |
||||
|
||||
// preparer un fichier de sauvegarde au cas ou |
||||
// on met 'a' car ca peut demander plusieurs rechargements |
||||
$f = @fopen(_DIR_TMP.'convert_utf8_backup.sql', 'a'); |
||||
|
||||
foreach ($tables_a_convertir as $table => $champ) { |
||||
convert_table_utf8($f, $table, $champ); |
||||
} |
||||
|
||||
if ($f) fclose($f); |
||||
|
||||
echo "<p><b>"._T('grenier:utf8_convert_termine')."</b></p>"; |
||||
echo "<p>,"._T('grenier:utf8_convert_verifier', array('rep' => joli_repertoire(_DIR_TMP))), '</p>'; |
||||
|
||||
// bouton "retour au site" + redirige_par_entete |
||||
echo "<p style='text-align: right'>", |
||||
"<a href='", generer_url_ecrire("configurer_langue"), "'> >> ", |
||||
_T('icone_retour'),"</a></p>", |
||||
install_fin_html(); |
||||
} |
||||
|
||||
|
||||
// https://code.spip.net/@convert_table_utf8 |
||||
function convert_table_utf8($f, $table, $champ) |
||||
{ |
||||
echo "<br /><b>$table</b> "; |
||||
$s = spip_query("SELECT * FROM $table WHERE $champ LIKE '<CONVERT %'"); |
||||
|
||||
// recuperer 'id_article' (encore un truc a faire dans table_objet) |
||||
preg_match(',^spip_(.*?)s?$,', $table, $r); |
||||
$id_champ = 'id_'.$r[1]; |
||||
if ($table == 'spip_petitions') $id_champ = 'id_article'; |
||||
if ($table == 'spip_groupes_mots') $id_champ = 'id_groupe'; |
||||
|
||||
// lire les donnees dans un array |
||||
while ($t = sql_fetch($s)) { |
||||
$query = array(); |
||||
$query_no_convert = ''; |
||||
$query_extra = ''; |
||||
$charset_source = 'AUTO'; |
||||
foreach ($t as $c => $v) { |
||||
if ($c == $champ) { |
||||
preg_match(',^<CONVERT (.*?)>,', $v, $reg); |
||||
$v = substr($v, strlen($reg[0])); |
||||
$charset_source = $reg[1]; |
||||
$query[] = "$c=" . sql_quote($v); |
||||
} else { |
||||
if (!is_numeric($v) |
||||
and !is_ascii($v)) { |
||||
// traitement special car donnees serializees |
||||
if ($c == 'extra') { |
||||
$query_no_convert .= ", $c=".sql_quote($v); |
||||
$query_extra = convert_extra($v, $charset_source); |
||||
} else |
||||
$query[] = "$c=" . sql_quote($v); |
||||
} else |
||||
# pour le backup |
||||
$query_no_convert .= ", $c=".sql_quote($v); |
||||
} |
||||
} |
||||
|
||||
$set = join(', ', $query); |
||||
$where = "$id_champ = ".$t[$id_champ]; |
||||
|
||||
// On l'enregistre telle quelle sur le fichier de sauvegarde |
||||
if ($f) fwrite($f, |
||||
"UPDATE $table SET $set$query_no_convert" |
||||
." WHERE $where;\n" |
||||
); |
||||
|
||||
// Mais on la transcode |
||||
// en evitant une double conversion |
||||
if ($charset_source != 'utf-8') { |
||||
$query = "UPDATE $table SET " |
||||
. unicode_to_utf_8(charset2unicode($set, $charset_source)) |
||||
. $query_extra |
||||
. " WHERE $where AND $champ LIKE '<CONVERT %'"; |
||||
#echo $query; |
||||
spip_query($query); |
||||
echo '. '; flush(); |
||||
} |
||||
} |
||||
sql_free($s); |
||||
} |
||||
|
||||
// stocker le nouvel extra |
||||
// https://code.spip.net/@convert_extra |
||||
function convert_extra($v, $charset_source) { |
||||
if ($extra = @unserialize($v)) { |
||||
foreach ($extra as $key => $val) |
||||
$extra[$key] = unicode_to_utf_8( |
||||
charset2unicode($val, $charset_source)); |
||||
return ", extra=".sql_quote(serialize($extra)); |
||||
} |
||||
} |
@ -0,0 +1,64 @@
|
||||
<?php |
||||
|
||||
/***************************************************************************\ |
||||
* SPIP, Systeme de publication pour l'internet * |
||||
* * |
||||
* Copyright (c) 2001-2016 * |
||||
* Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * |
||||
* * |
||||
* Ce programme est un logiciel libre distribue sous licence GNU/GPL. * |
||||
* Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
||||
\***************************************************************************/ |
||||
|
||||
if (!defined('_ECRIRE_INC_VERSION')) return; |
||||
|
||||
// En cas d'erreur, une page admin normale avec bouton de retour |
||||
|
||||
|
||||
// https://code.spip.net/@exec_convert_sql_utf8_dist |
||||
function exec_base_convert_sql_utf8_dist() { |
||||
include_spip('inc/minipres'); |
||||
include_spip('inc/charsets'); |
||||
$charset_spip = $GLOBALS['meta']['charset']; |
||||
|
||||
// Definir le titre de la page (et le nom du fichier admin) |
||||
//$action = _T('grenier:utf8_convertir_votre_site'); |
||||
$action = _L("Conversion de la base en $charset_spip"); #volontairement non traduit (obsolete) |
||||
|
||||
// si meta deja la, c'est une reprise apres timeout. |
||||
if ($GLOBALS['meta']['convert_sql_utf8']) { |
||||
$base = charger_fonction('convert_sql_utf8', 'base'); |
||||
$base($action, true); |
||||
} else { |
||||
$charset_supporte = false; |
||||
$utf8_supporte = false; |
||||
// verifier que mysql gere le charset courant pour effectuer les conversions |
||||
include_spip('base/abstract_sql'); |
||||
if ($c = sql_get_charset($charset_spip)){ |
||||
$sql_charset = $c['charset']; |
||||
$sql_collation = $c['collation']; |
||||
$charset_supporte = true; |
||||
} |
||||
if (!$charset_supporte) { |
||||
$utf8_supporte = sql_get_charset('utf8'); |
||||
$res = _L("Le charset SPIP actuel $charset_spip n'est pas supporte par votre serveur MySQL<br/>"); |
||||
if ($utf8_supporte) |
||||
$res .= _L("Votre serveur supporte utf-8, vous devriez convertir votre site en utf-8 avant de recommencer cette operation"); |
||||
echo minipres($action, $res); |
||||
} else { |
||||
|
||||
$commentaire = ""; |
||||
//$commentaire = _T('grenier:utf8_convert_avertissement', |
||||
// array('orig' => $charset_orig,'charset' => 'utf-8')); |
||||
$commentaire .= "<small>" |
||||
. http_img_pack("warning-48.png", _T('info_avertissement'), " float: right;margin: 10px;'"); |
||||
$commentaire .= _T('grenier:utf8_convert_backup', array('charset' => 'utf-8')) |
||||
."</small>"; |
||||
$commentaire .= '<br />'._T('grenier:utf8_convert_timeout'); |
||||
$commentaire .= "<hr />\n"; |
||||
|
||||
$admin = charger_fonction('admin', 'inc'); |
||||
echo $admin('convert_sql_utf8', $action, $commentaire); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,65 @@
|
||||
<?php |
||||
|
||||
/***************************************************************************\ |
||||
* SPIP, Systeme de publication pour l'internet * |
||||
* * |
||||
* Copyright (c) 2001-2016 * |
||||
* Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * |
||||
* * |
||||
* Ce programme est un logiciel libre distribue sous licence GNU/GPL. * |
||||
* Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
||||
\***************************************************************************/ |
||||
|
||||
if (!defined('_ECRIRE_INC_VERSION')) return; |
||||
|
||||
// En cas d'erreur, une page admin normale avec bouton de retour |
||||
|
||||
// https://code.spip.net/@convert_utf8_non |
||||
function convert_utf8_non($action, $message) { |
||||
|
||||
echo minipres($action, ('<p>'.$message. "</p>\n<p style='text-align: right'><a href='" . generer_url_ecrire("configurer_langue"). "'> >> "._T('icone_retour')."</a></p>")); |
||||
} |
||||
|
||||
// https://code.spip.net/@exec_convert_utf8_dist |
||||
function exec_base_convert_utf8_dist() { |
||||
include_spip('inc/minipres'); |
||||
include_spip('inc/charsets'); |
||||
|
||||
// Definir le titre de la page (et le nom du fichier admin) |
||||
$action = _T('grenier:utf8_convertir_votre_site'); |
||||
|
||||
// si meta deja la, c'est une reprise apres timeout. |
||||
if ($GLOBALS['meta']['convert_utf8'] and $GLOBALS['meta']['admin']) { |
||||
$admin = charger_fonction('admin', 'inc'); |
||||
echo $admin('convert_utf8', $action, '', true); |
||||
} else { |
||||
$charset_orig = $GLOBALS['meta']['charset']; |
||||
// tester si le charset d'origine est connu de spip |
||||
if (!load_charset($charset_orig)) |
||||
convert_utf8_non($action, |
||||
_T('utf8_convert_erreur_orig', array('charset' => "<b>".$charset_orig."</b>"))); |
||||
|
||||
// ne pas convertir si deja utf8 |
||||
// ou si l'interface du serveur ne comprend rien |
||||
elseif (($charset_orig == 'utf-8')) |
||||
convert_utf8_non($action, |
||||
_T('grenier:utf8_convert_erreur_deja', |
||||
array('charset' => $charset_orig))); |
||||
elseif(!sql_get_charset('utf-8')) |
||||
convert_utf8_non($action, |
||||
_L('Votre version du serveur SQL ne gere pas les charset')); |
||||
else { |
||||
$commentaire = _T('grenier:utf8_convert_avertissement', |
||||
array('orig' => $charset_orig, 'charset' => 'utf-8')); |
||||
$commentaire .= "<small>" |
||||
. http_img_pack("warning-48.png", _T('info_avertissement'), "style='float: right;margin: 10px;'"); |
||||
$commentaire .= _T('grenier:utf8_convert_backup', array('charset' => 'utf-8')) |
||||
."</small>"; |
||||
$commentaire .= '<br />'._T('grenier:utf8_convert_timeout'); |
||||
$commentaire .= "<hr />\n"; |
||||
|
||||
$admin = charger_fonction('admin', 'inc'); |
||||
echo $admin('convert_utf8', $action, $commentaire); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,30 @@
|
||||
<?php |
||||
|
||||
/***************************************************************************\ |
||||
* SPIP, Systeme de publication pour l'internet * |
||||
* * |
||||
* Copyright (c) 2001-2016 * |
||||
* Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * |
||||
* * |
||||
* Ce programme est un logiciel libre distribue sous licence GNU/GPL. * |
||||
* Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
||||
\***************************************************************************/ |
||||
|
||||
if (!defined('_ECRIRE_INC_VERSION')) return; |
||||
|
||||
// reaffichage du formulaire d'une option de configuration |
||||
// apres sa modification par appel du script action/configurer |
||||
// redirigeant ici. |
||||
|
||||
// https://code.spip.net/@exec_configurer_dist |
||||
function exec_configuration_dist() |
||||
{ |
||||
if(!autoriser('configurer', '_'._request('configuration'))) { |
||||
include_spip('inc/minipres'); |
||||
echo minipres(_T('info_acces_interdit')); |
||||
exit; |
||||
} |
||||
include_spip('inc/actions'); |
||||
$configuration = charger_fonction(_request('configuration'), 'configuration', true); |
||||
ajax_retour($configuration ? $configuration() : 'configure quoi?'); |
||||
} |
@ -0,0 +1,26 @@
|
||||
<?php |
||||
|
||||
/***************************************************************************\ |
||||
* SPIP, Systeme de publication pour l'internet * |
||||
* * |
||||
* Copyright (c) 2001-2016 * |
||||
* Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * |
||||
* * |
||||
* Ce programme est un logiciel libre distribue sous licence GNU/GPL. * |
||||
* Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
||||
\***************************************************************************/ |
||||
|
||||
if (!defined('_ECRIRE_INC_VERSION')) return; |
||||
|
||||
include_spip('inc/actions'); |
||||
|
||||
# Les informations d'une rubrique selectionnee dans le mini navigateur |
||||
|
||||
// https://code.spip.net/@exec_informer_auteur_dist |
||||
function exec_informer_auteur_dist() |
||||
{ |
||||
$id = intval(_request('id')); |
||||
|
||||
$informer_auteur = charger_fonction('informer_auteur', 'inc'); |
||||
ajax_retour($informer_auteur($id)); |
||||
} |
@ -0,0 +1,42 @@
|
||||
<?php |
||||
|
||||
/***************************************************************************\ |
||||
* SPIP, Systeme de publication pour l'internet * |
||||
* * |
||||
* Copyright (c) 2001-2016 * |
||||
* Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * |
||||
* * |
||||
* Ce programme est un logiciel libre distribue sous licence GNU/GPL. * |
||||
* Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
||||
\***************************************************************************/ |
||||
|
||||
if (!defined('_ECRIRE_INC_VERSION')) return; |
||||
|
||||
|
||||
// Recupere et affiche (en ajax) une fonction memorisee dans inc/presentation |
||||
// obsolete : utilise uniquement par afficher_objets |
||||
// https://code.spip.net/@exec_memoriser_dist |
||||
function exec_memoriser_dist() |
||||
{ |
||||
$hash = _request('hash'); |
||||
$order = _request('order'); |
||||
$by = _request('by'); |
||||
$trad = _request('trad'); |
||||
lire_fichier(_DIR_SESSIONS.'ajax_fonctions.txt', $ajax_fonctions); |
||||
$ajax_fonctions = @unserialize($ajax_fonctions); |
||||
|
||||
if ($res = $ajax_fonctions[$hash]) { |
||||
include_spip('inc/afficher_objets'); |
||||
list(, $t, $r, $f) = $res; |
||||
if (preg_match('/^[a-z0-9+.,]+$/', $by) |
||||
and preg_match('/^\w*$/', $order)) { |
||||
$r['ORDER BY'] = str_replace(',', " $order, ", $by) . " $order"; |
||||
sauver_requete($t, $r, $f); |
||||
} |
||||
$cpt = sql_countsel($r['FROM'], $r['WHERE'], $r['GROUP BY']); |
||||
include_spip('inc/presentation'); |
||||
$res = afficher_articles_trad($t, $r, $f, $hash, $cpt, $trad); |
||||
} else spip_log("memoriser $q vide"); |
||||
include_spip('inc/actions'); |
||||
ajax_retour($res); |
||||
} |
@ -0,0 +1,41 @@
|
||||
<?php |
||||
|
||||
/***************************************************************************\ |
||||
* SPIP, Systeme de publication pour l'internet * |
||||
* * |
||||
* Copyright (c) 2001-2016 * |
||||
* Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * |
||||
* * |
||||
* Ce programme est un logiciel libre distribue sous licence GNU/GPL. * |
||||
* Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
||||
\***************************************************************************/ |
||||
|
||||
if (!defined('_ECRIRE_INC_VERSION')) return; |
||||
|
||||
# gerer un charset minimaliste en convertissant tout en unicode &#xxx; |
||||
|
||||
// https://code.spip.net/@exec_rechercher_auteur_dist |
||||
function exec_rechercher_auteur_dist() |
||||
{ |
||||
exec_rechercher_auteur_args(_request('idom')); |
||||
} |
||||
|
||||
// https://code.spip.net/@exec_rechercher_auteur_args |
||||
function exec_rechercher_auteur_args($idom) |
||||
{ |
||||
if (!preg_match('/\w+/', $idom)) |
||||
{ |
||||
include_spip('inc/minipres'); |
||||
echo minipres(); |
||||
} else { |
||||
include_spip('inc/actions'); |
||||
$where = preg_split(",\s+,", _request('nom')); |
||||
if ($where) { |
||||
foreach ($where as $k => $v) |
||||
$where[$k] = "'%" . substr(str_replace("%", "\%", sql_quote($v)), 1, -1) . "%'"; |
||||
$where = ("(nom LIKE " . join(" AND nom LIKE ", $where) . ")"); |
||||
} |
||||
include_spip('inc/selectionner_auteur'); |
||||
ajax_retour(selectionner_auteur_boucle($where, $idom)); |
||||
} |
||||
} |
@ -0,0 +1,26 @@
|
||||
<?php |
||||
|
||||
/***************************************************************************\ |
||||
* SPIP, Systeme de publication pour l'internet * |
||||
* * |
||||
* Copyright (c) 2001-2016 * |
||||
* Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * |
||||
* * |
||||
* Ce programme est un logiciel libre distribue sous licence GNU/GPL. * |
||||
* Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
||||
\***************************************************************************/ |
||||
|
||||
if (!defined('_ECRIRE_INC_VERSION')) return; |
||||
|
||||
# afficher un mini-navigateur de rubriques |
||||
|
||||
// https://code.spip.net/@exec_selectionner_auteur_dist |
||||
function exec_selectionner_auteur_dist() |
||||
{ |
||||
$id = intval(_request('id_article')); |
||||
$type = _request('type'); |
||||
if (!preg_match(',^[a-z_]+$,', $type)) $type = 'article'; |
||||
$selectionner_auteur = charger_fonction('selectionner_auteur', 'inc'); |
||||
include_spip('inc/actions'); |
||||
ajax_retour($selectionner_auteur($id, $type)); |
||||
} |
After Width: | Height: | Size: 1.3 KiB |
@ -0,0 +1,133 @@
|
||||
<?php |
||||
|
||||
/***************************************************************************\ |
||||
* SPIP, Systeme de publication pour l'internet * |
||||
* * |
||||
* Copyright (c) 2001-2016 * |
||||
* Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * |
||||
* * |
||||
* Ce programme est un logiciel libre distribue sous licence GNU/GPL. * |
||||
* Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
||||
\***************************************************************************/ |
||||
|
||||
if (!defined('_ECRIRE_INC_VERSION')) { |
||||
return; |
||||
} |
||||
|
||||
include_spip('inc/presentation'); |
||||
|
||||
/** |
||||
* Filtres d'images |
||||
* Nommages maintenus pour compatibilite. |
||||
*/ |
||||
if (!function_exists('extraire_image_couleur')) { |
||||
/** |
||||
* Extraire une couleur d'une image |
||||
* |
||||
* @param string $img |
||||
* @param int $x |
||||
* @param int $y |
||||
* @return string |
||||
*/ |
||||
function extraire_image_couleur($img, $x = 10, $y = 6) { |
||||
include_spip('filtres/images_lib'); |
||||
return _image_couleur_extraire($img, $x, $y); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Vieilles fonctions d'affichage |
||||
*/ |
||||
if (!function_exists('afficher_plus')) { |
||||
/** |
||||
* Afficher un petit "i" pour lien vers autre page |
||||
* |
||||
* @deprecated utiliser `afficher_plus_info()` |
||||
* @uses afficher_plus_info() |
||||
* @param string $lien |
||||
* URL du lien desire |
||||
* |
||||
* @return string |
||||
*/ |
||||
function afficher_plus($lien) { |
||||
include_spip('inc/filtres_ecrire'); |
||||
afficher_plus_info($lien); |
||||
} |
||||
} |
||||
|
||||
|
||||
if (!function_exists('debut_cadre_couleur_foncee')) { |
||||
/** |
||||
* Ouvre un cadre foncรฉ |
||||
* @deprecated utiliser boite_ouvrir() |
||||
*/ |
||||
function debut_cadre_couleur_foncee($icone = '', $dummy = '', $fonction = '', $titre = '', $id = "", $class = "") { |
||||
include_spip('inc/presentation'); |
||||
return debut_cadre_grenier('couleur-foncee', $icone, $fonction, $titre, $id, $class); |
||||
} |
||||
} |
||||
|
||||
if (!function_exists('fin_cadre_couleur_foncee')) { |
||||
/** |
||||
* Ferme un cadre foncรฉ |
||||
* @deprecated utiliser boite_fermer() |
||||
*/ |
||||
function fin_cadre_couleur_foncee() { |
||||
return fin_cadre_grenier('couleur-foncee'); |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
/** |
||||
* Ouvre un cadre. |
||||
* Copie de debut_cadre() pour historique |
||||
*/ |
||||
function debut_cadre_grenier($style, $icone = "", $fonction = "", $titre = "", $id = "", $class = "", $padding = true) { |
||||
$style_mapping = array( |
||||
'r' => 'simple', |
||||
'e' => 'raccourcis', |
||||
'couleur' => 'basic highlight', |
||||
'couleur-foncee' => 'basic highlight', |
||||
'trait-couleur' => 'important', |
||||
'alerte' => 'notice', |
||||
'info' => 'info', |
||||
'sous_rub' => 'simple sous-rub' |
||||
); |
||||
$style_titre_mapping = array('couleur' => 'topper', 'trait-couleur' => 'section'); |
||||
$c = isset($style_mapping[$style]) ? $style_mapping[$style] : 'simple'; |
||||
$class = $c . ($class ? " $class" : ""); |
||||
if (!$padding) { |
||||
$class .= ($class ? " " : "") . "no-padding"; |
||||
} |
||||
|
||||
//($id?"id='$id' ":"") |
||||
if (strlen($icone) > 1) { |
||||
if ($icone_renommer = charger_fonction('icone_renommer', 'inc', true)) { |
||||
list($fond, $fonction) = $icone_renommer($icone, $fonction); |
||||
} |
||||
$size = 24; |
||||
if (preg_match("/-([0-9]{1,3})[.](gif|png)$/i", $fond, $match)) { |
||||
$size = $match[1]; |
||||
} |
||||
if ($fonction) { |
||||
// 2 images pour composer l'icone : le fond (article) en background, |
||||
// la fonction (new) en image |
||||
$icone = http_img_pack($fonction, "", "class='cadre-icone' width='$size' height='$size'\n" . |
||||
http_style_background($fond, "no-repeat center center")); |
||||
} else { |
||||
$icone = http_img_pack($fond, "", "class='cadre-icone' width='$size' height='$size'"); |
||||
} |
||||
$titre = $icone . $titre; |
||||
} |
||||
|
||||
return boite_ouvrir($titre, $class, isset($style_titre_mapping[$style]) ? $style_titre_mapping[$style] : '', $id); |
||||
} |
||||
|
||||
/** |
||||
* Ferme un cadre. |
||||
* Copie de fin_cadre() pour historique |
||||
*/ |
||||
function fin_cadre_grenier() { |
||||
return boite_fermer(); |
||||
} |
@ -0,0 +1,178 @@
|
||||
<?php |
||||
|
||||
/***************************************************************************\ |
||||
* SPIP, Systeme de publication pour l'internet * |
||||
* * |
||||
* Copyright (c) 2001-2016 * |
||||
* Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * |
||||
* * |
||||
* Ce programme est un logiciel libre distribue sous licence GNU/GPL. * |
||||
* Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
||||
\***************************************************************************/ |
||||
|
||||
if (!defined('_ECRIRE_INC_VERSION')) return; |
||||
|
||||
include_once _ROOT_RESTREINT . "inc/actions.php"; |
||||
|
||||
// Retourne un formulaire d'execution de $action sur $id, |
||||
// revenant a l'envoyeur $script d'arguments $args. |
||||
// Utilise Ajax si dispo, en ecrivant le resultat dans le innerHTML du noeud |
||||
// d'attribut id = $action-$id (cf. AjaxSqueeze dans layer.js) |
||||
|
||||
// https://code.spip.net/@ajax_action_auteur |
||||
function ajax_action_auteur($action, $id, $script, $args = '', $corps = false, $args_ajax = '', $fct_ajax = '') |
||||
{ |
||||
if (strpos($args, "#") === false) |
||||
$ancre = "$action-" . intval($id); |
||||
else { |
||||
$ancre = explode("#", $args); |
||||
$args = $ancre[0]; |
||||
$ancre = $ancre[1]; |
||||
} |
||||
|
||||
// Formulaire (POST) |
||||
// methodes traditionnelle et ajax a unifier... |
||||
if (is_string($corps)) { |
||||
|
||||
// Methode traditionnelle |
||||
if (_SPIP_AJAX !== 1) { |
||||
return redirige_action_post($action, |
||||
$id, |
||||
$script, |
||||
"$args#$ancre", |
||||
$corps); |
||||
} |
||||
|
||||
// Methode Ajax |
||||
else { |
||||
if ($args and !$args_ajax) $args_ajax = "&$args"; |
||||
if (isset($_GET['var_profile'])) |
||||
$args_ajax .= '&var_profile=1'; |
||||
return redirige_action_post($action, |
||||
$id, |
||||
$action, |
||||
"script=$script$args_ajax", |
||||
$corps, |
||||
(" onsubmit=" |
||||
. ajax_action_declencheur('this', $ancre, $fct_ajax))); |
||||
|
||||
} |
||||
} |
||||
|
||||
// Lien (GET) |
||||
else { |
||||
$href = redirige_action_auteur($action, |
||||
$id, |
||||
$script, |
||||
"$args#$ancre", |
||||
false); |
||||
|
||||
if ($args and !$args_ajax) $args_ajax = "&$args"; |
||||
if (isset($_GET['var_profile'])) |
||||
$args_ajax .= '&var_profile=1'; |
||||
|
||||
$ajax = redirige_action_auteur($action, |
||||
$id, |
||||
$action, |
||||
"script=$script$args_ajax"); |
||||
|
||||
$cli = array_shift($corps); |
||||
return "<a href='$href'\nonclick=" |
||||
. ajax_action_declencheur($ajax, $ancre, $fct_ajax) |
||||
. ">" |
||||
. (!$corps ? $cli : ("\n<span" . $corps[0] . ">$cli</span>")) |
||||
. "</a>"; |
||||
} |
||||
} |
||||
|
||||
|
||||
// Comme ci-dessus, mais reduit au cas POST et on fournit le bouton Submit. |
||||
// |
||||
// https://code.spip.net/@ajax_action_post |
||||
function ajax_action_post($action, $arg, $retour, $gra, $corps, $clic = '', $atts_i = '', $atts_span = "", $args_ajax = '') |
||||
{ |
||||
global $spip_lang_right; |
||||
|
||||
if (strpos($gra, "#") === false) { |
||||
// A etudier: prendre systematiquement arg en trancodant les \W |
||||
$n = intval($arg); |
||||
$ancre = "$action-" . ($n ? $n : $arg); |
||||
} else { |
||||
$ancre = explode("#", $gra); |
||||
$args = $ancre[0]; |
||||
$ancre = $ancre[1]; |
||||
} |
||||
|
||||
if (!$atts_i) |
||||
$atts_i = " class='fondo' style='float: $spip_lang_right'"; |
||||
|
||||
if (is_array($clic)) { |
||||
$submit = ""; |
||||
$atts_i .= "\nonclick='AjaxNamedSubmit(this)'"; |
||||
foreach($clic as $n => $c) |
||||
$submit .= "\n<input type='submit' name='$n' value='$c' $atts_i />"; |
||||
} else { |
||||
if (!$clic) $clic = _T('bouton_valider'); |
||||
$submit = "<input type='submit' value='$clic' $atts_i />"; |
||||
} |
||||
$corps = "<div>" |
||||
. $corps |
||||
. "<span" |
||||
. $atts_span |
||||
. ">" |
||||
. $submit |
||||
. "</span></div>"; |
||||
|
||||
if (_SPIP_AJAX !== 1) { |
||||
return redirige_action_post($action, $arg, $retour, |
||||
($gra . '#' . $ancre), |
||||
$corps); |
||||
} else { |
||||
|
||||
if ($gra and !$args_ajax) $args_ajax = "&$gra"; |
||||
if (isset($GLOBALS['var_profile'])) |
||||
$args_ajax .= '&var_profile=1'; |
||||
|
||||
return redirige_action_post($action, |
||||
$arg, |
||||
$action, |
||||
"script=$retour$args_ajax", |
||||
$corps, |
||||
" onsubmit=" . ajax_action_declencheur('this', $ancre)); |
||||
} |
||||
} |
||||
|
||||
|
||||
// |
||||
// Attention pour que Safari puisse manipuler cet evenement |
||||
// il faut onsubmit="return AjaxSqueeze(x,'truc',...)" |
||||
// et non pas onsubmit='return AjaxSqueeze(x,"truc",...)' |
||||
// |
||||
// https://code.spip.net/@ajax_action_declencheur |
||||
function ajax_action_declencheur($request, $noeud, $fct_ajax = '') { |
||||
if (strpos($request, 'this') !== 0) |
||||
$request = "'".$request."'"; |
||||
|
||||
return '"return AjaxSqueeze(' |
||||
. $request |
||||
. ",'" |
||||
. $noeud |
||||
. "'," |
||||
. ($fct_ajax ? $fct_ajax : "''") |
||||
. ',event)"'; |
||||
} |
||||
|
||||
|
||||
|
||||
// Place un element HTML dans une div nommee, |
||||
// sauf si c'est un appel Ajax car alors la div y est deja |
||||
// $fonction : denomination semantique du bloc, que l'on retouve en attribut class |
||||
// $id : id de l'objet concerne si il y a lieu ou "", sert a construire un identifiant unique au bloc ("fonction-id") |
||||
// https://code.spip.net/@ajax_action_greffe |
||||
function ajax_action_greffe($fonction, $id, $corps) |
||||
{ |
||||
$idom = $fonction.(strlen($id)?"-$id":""); |
||||
return _AJAX |
||||
? "$corps" |
||||
: "\n<div id='$idom' class='ajax-action $fonction'>$corps\n</div>\n"; |
||||
} |
@ -0,0 +1,536 @@
|
||||
<?php |
||||
|
||||
/***************************************************************************\ |
||||
* SPIP, Systeme de publication pour l'internet * |
||||
* * |
||||
* Copyright (c) 2001-2016 * |
||||
* Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * |
||||
* * |
||||
* Ce programme est un logiciel libre distribue sous licence GNU/GPL. * |
||||
* Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
||||
\***************************************************************************/ |
||||
|
||||
if (!defined('_ECRIRE_INC_VERSION')) return; |
||||
|
||||
$GLOBALS['my_sites'] = array(); |
||||
|
||||
// https://code.spip.net/@icone_table |
||||
function icone_table($type) { |
||||
$derog = array('document' => 'doc-24.png','syndic_article' => 'site-24.png', 'groupes_mot' => 'groupes-mot-24.png'); |
||||
if (isset($derog[$type])) |
||||
return $derog[$type]; |
||||
return "$type-24.png"; |
||||
} |
||||
|
||||
// https://code.spip.net/@lien_editer_objet |
||||
function lien_editer_objet($type, $key, $id) { |
||||
return $type == 'document' ? '' : generer_url_ecrire($type . "s_edit", "$key=$id"); |
||||
} |
||||
|
||||
// https://code.spip.net/@lien_voir_objet |
||||
function lien_voir_objet($type, $key, $id) { |
||||
return generer_url_entite($id, $type); |
||||
} |
||||
|
||||
// https://code.spip.net/@afficher_numero_edit |
||||
function afficher_numero_edit($id, $key, $type, $row = null) { |
||||
global $spip_lang_right, $spip_lang_left,$my_sites; |
||||
static $numero , $style = '' ; |
||||
if ($type == 'syndic_article') { |
||||
$redirect = _request('id_syndic') ? 'id_syndic='._request('id_syndic') : ''; |
||||
if (autoriser('modifier', $type, $id)) { |
||||
if ($row['statut'] == "publie"){ |
||||
$s = "[<a href='". redirige_action_auteur('instituer_syndic', "$id-refuse", _request('exec'), $redirect) . "'><span style='color: black'>"._T('info_bloquer_lien')."</span></a>]"; |
||||
|
||||
} |
||||
elseif ($row['statut'] == "refuse"){ |
||||
$s = "[<a href='". redirige_action_auteur('instituer_syndic', "$id-publie", _request('exec'), $redirect) . "'>"._T('info_retablir_lien')."</a>]"; |
||||
} |
||||
elseif ($row['statut'] == "off" |
||||
and isset($my_sites[$id]['miroir']) and $my_sites[$id]['miroir'] == 'oui') { |
||||
$s = '('._T('syndic_lien_obsolete').')'; |
||||
} |
||||
else /* 'dispo' ou 'off' (dans le cas ancien site 'miroir') */ |
||||
{ |
||||
$s = "[<a href='". redirige_action_auteur('instituer_syndic', "$id-publie", _request('exec'), $redirect) . "'>"._T('info_valider_lien')."</a>]"; |
||||
} |
||||
return $s; |
||||
} |
||||
} |
||||
|
||||
if (!$style) { |
||||
$style = " class='spip_xx-small' style='float: $spip_lang_right; padding-$spip_lang_left: 4px; color: black; '"; |
||||
|
||||
$numero = _T('info_numero_abbreviation'); |
||||
} |
||||
|
||||
if (!autoriser('modifier', $type, $id) or |
||||
!$href = lien_editer_objet($type, $key, $id)) { |
||||
$bal = 'span'; |
||||
} else { |
||||
$bal = 'a'; |
||||
$href = "\nhref='" |
||||
. $href |
||||
. "' title='" |
||||
. _T('bouton_modifier') |
||||
. "'"; |
||||
} |
||||
return "<$bal$style$href><b>" |
||||
. $numero |
||||
. $id |
||||
. "</b></$bal>"; |
||||
} |
||||
|
||||
// libelle du titre de l'objet : |
||||
// la partie du titre a afficher dans un lien |
||||
// puis la partie hors lien |
||||
// https://code.spip.net/@afficher_titre_objet |
||||
function afficher_titre_objet($type, $row) { |
||||
if (function_exists($f = "afficher_titre_$type")) |
||||
return $f($row); |
||||
|
||||
$titre = isset($row['titre'])?sinon($row['titre'], "("._T('info_sans_titre_2').")"): |
||||
(isset($row['nom'])?sinon($row['nom'], "("._T('info_sans_titre_2').")"): |
||||
(isset($row['nom_email'])?sinon($row['nom_email'], "("._T('info_sans_titre_2').")"): |
||||
"")); |
||||
return array(typo(supprime_img($titre, '')),''); |
||||
} |
||||
// https://code.spip.net/@afficher_titre_site |
||||
function afficher_titre_site($row) { |
||||
$nom = $row['nom_site']; |
||||
|
||||
$nom = $nom?(strlen($nom) > 1?typo($nom):_T('info_sans_titre_2')):("("._T('info_sans_titre_2').")"); |
||||
|
||||
$s2 = " <span class='spip_xx-small'>[<a href='" |
||||
.$row['url_site']."'>"._T('lien_visite_site')."</a>]</span>"; |
||||
|
||||
return array($nom,$s2); |
||||
} |
||||
// https://code.spip.net/@afficher_titre_auteur |
||||
function afficher_titre_auteur($row) { |
||||
return array($row['nom'], |
||||
((isset($row['restreint']) and $row['restreint']) |
||||
? (" <small>"._T('statut_admin_restreint')."</small>") |
||||
: '')); |
||||
} |
||||
|
||||
// https://code.spip.net/@afficher_titre_syndic_article |
||||
function afficher_titre_syndic_article($row) { |
||||
return array('', recuperer_fond( |
||||
'prive/objets/contenu/syndic_article', |
||||
array('id' => $row['id_syndic_article']) |
||||
)); |
||||
} |
||||
|
||||
// https://code.spip.net/@afficher_complement_objet |
||||
function afficher_complement_objet($type, $row) { |
||||
if (function_exists($f = "afficher_complement_$type")) |
||||
return $f($row); |
||||
return ""; |
||||
} |
||||
|
||||
// https://code.spip.net/@afficher_complement_site |
||||
function afficher_complement_site($row) { |
||||
$syndication = $row['syndication']; |
||||
$s = ""; |
||||
if ($syndication == 'off' or $syndication == 'sus') { |
||||
$s .= "<div style='color: red;'>" |
||||
. http_img_pack('puce-orange-anim.gif', $syndication, "class='puce'", _T('info_panne_site_syndique')) |
||||
. " "._T('info_probleme_grave')." </div>"; |
||||
} |
||||
if ($syndication == "oui" or $syndication == "off" or $syndication == 'sus'){ |
||||
$s .= "<div style='color: red;'>"._T('info_syndication')."</div>"; |
||||
} |
||||
if ($syndication == "oui" or $syndication == "off" or $syndication == "sus") { |
||||
$id_syndic = $row['id_syndic']; |
||||
$total_art = sql_countsel("spip_syndic_articles", "id_syndic=$id_syndic"); |
||||
$s .= " " . $total_art . " " . _T('info_syndication_articles'); |
||||
} else { |
||||
$s .= " "; |
||||
} |
||||
return $s; |
||||
} |
||||
// https://code.spip.net/@afficher_complement_syndic_article |
||||
function afficher_complement_syndic_article($row) { |
||||
global $my_sites; |
||||
if ($GLOBALS['exec'] != 'sites') { |
||||
$id_syndic = $row['id_syndic']; |
||||
// $my_sites cache les resultats des requetes sur les sites |
||||
if (!isset($my_sites[$id_syndic])) |
||||
$my_sites[$id_syndic] = sql_fetsel("nom_site, moderation, miroir", "spip_syndic", "id_syndic=$id_syndic"); |
||||
|
||||
$aff = $my_sites[$id_syndic]['nom_site']; |
||||
if ($my_sites[$id_syndic]['moderation'] == 'oui') |
||||
$aff = "<i>$aff</i>"; |
||||
|
||||
$s = "<a href='" . generer_url_ecrire("sites", "id_syndic=$id_syndic") . "'>$aff</a>"; |
||||
|
||||
return $s; |
||||
} |
||||
return ""; |
||||
} |
||||
|
||||
// affichage des liste d'objets |
||||
// Cas generique, utilise pour tout sauf article |
||||
// https://code.spip.net/@inc_afficher_objets_dist |
||||
function inc_afficher_objets_dist($type, $titre, $requete, $formater = '', $force = false) { |
||||
if ($afficher = charger_fonction("afficher_{$type}s", 'inc', true)){ |
||||
return $afficher($titre, $requete, $formater); |
||||
} |
||||
|
||||
if (($GLOBALS['meta']['multi_rubriques'] == 'oui' |
||||
and (!isset($GLOBALS['id_rubrique']))) |
||||
or $GLOBALS['meta']['multi_articles'] == 'oui') { |
||||
$afficher_langue = true; |
||||
|
||||
if (isset($GLOBALS['langue_rubrique'])) $langue_defaut = $GLOBALS['langue_rubrique']; |
||||
else $langue_defaut = $GLOBALS['meta']['langue_site']; |
||||
} else $afficher_langue = $langue_defaut = ''; |
||||
|
||||
$arg = array($afficher_langue, false, $langue_defaut, $formater, $type,id_table_objet($type)); |
||||
if (!function_exists($skel = "afficher_{$type}s_boucle")){ |
||||
$skel = "afficher_objet_boucle"; |
||||
} |
||||
|
||||
$presenter_liste = charger_fonction('presenter_liste', 'inc'); |
||||
$tmp_var = 't_' . substr(md5(join('', $requete)), 0, 4); |
||||
$styles = array(array('arial11', 7), array('arial11'), array('arial1'), array('arial1'), array('arial1 centered', 100), array('arial1', 38)); |
||||
|
||||
$tableau = array(); // ne sert pas ici |
||||
return $presenter_liste($requete, $skel, $tableau, $arg, $force, $styles, $tmp_var, $titre, icone_table($type)); |
||||
} |
||||
|
||||
// https://code.spip.net/@charger_fonction_logo_if |
||||
function charger_fonction_logo_if() |
||||
{ |
||||
global $spip_display; |
||||
|
||||
if ($spip_display == 1 or $spip_display == 4 or !isset($GLOBALS['meta']['image_process'])) |
||||
return false; |
||||
if ($GLOBALS['meta']['image_process'] == "non") return false; |
||||
return charger_fonction('chercher_logo', 'inc'); |
||||
} |
||||
|
||||
// https://code.spip.net/@afficher_objet_boucle |
||||
function afficher_objet_boucle($row, $own) |
||||
{ |
||||
global $connect_statut, $spip_lang_right; |
||||
static $chercher_logo = true; |
||||
|
||||
list($afficher_langue, $affrub, $langue_defaut, $formater, $type, $primary) = $own; |
||||
$vals = array(); |
||||
$id_objet = $row[$primary]; |
||||
if (autoriser('voir', $type, $id_objet)){ |
||||
|
||||
$date_heure = isset($row['date'])?$row['date']:(isset($row['date_heure'])?$row['date_heure']:""); |
||||
|
||||
$statut = isset($row['statut'])?$row['statut']:""; |
||||
if (isset($row['lang'])) |
||||
changer_typo($lang = $row['lang']); |
||||
else $lang = $langue_defaut; |
||||
$lang_dir = lang_dir($lang); |
||||
$id_rubrique = isset($row['id_rubrique'])?$row['id_rubrique']:0; |
||||
|
||||
$puce_statut = charger_fonction('puce_statut', 'inc'); |
||||
$vals[] = $puce_statut($id_objet, $statut, $id_rubrique, $type); |
||||
|
||||
list($titre, $suite) = afficher_titre_objet($type, $row); |
||||
$flogo = ''; |
||||
if ($chercher_logo) { |
||||
if ($chercher_logo !== true |
||||
or $chercher_logo = charger_fonction_logo_if()) |
||||
if ($logo = $chercher_logo($id_objet, $primary, 'on')) { |
||||
list($fid, $dir, $nom, $format) = $logo; |
||||
include_spip('inc/filtres_images_mini'); |
||||
$logo = image_reduire("<img src='$fid' alt='' />", 26, 20); |
||||
if ($logo) |
||||
$flogo = "\n<span style='float: $spip_lang_right; margin-top: -2px; margin-bottom: -2px;'>$logo</span>"; |
||||
} |
||||
} |
||||
if ($titre) { |
||||
$titre = "<a href='" |
||||
. lien_voir_objet($type, $primary, $id_objet) |
||||
. "'>" |
||||
. $titre |
||||
. "</a>"; |
||||
} |
||||
$vals[] = "\n<div>$flogo$titre$suite</div>"; |
||||
|
||||
$s = ""; |
||||
if ($afficher_langue){ |
||||
if (isset($row['langue_choisie'])){ |
||||
$s .= " <span class='spip_xx-small' style='color: #666666' dir='$lang_dir'>"; |
||||
if ($row['langue_choisie'] == "oui") $s .= "<b>".traduire_nom_langue($lang)."</b>"; |
||||
else $s .= "(".traduire_nom_langue($lang).")"; |
||||
$s .= "</span>"; |
||||
} |
||||
elseif ($lang != $langue_defaut) |
||||
$s .= " <span class='spip_xx-small' style='color: #666666' dir='$lang_dir'>". |
||||
($lang |
||||
? "(".traduire_nom_langue($lang).")" |
||||
: '' |
||||
) |
||||
."</span>"; |
||||
} |
||||
$vals[] = $s; |
||||
|
||||
$vals[] = afficher_complement_objet($type, $row); |
||||
|
||||
$s = ""; |
||||
if ($affrub && $id_rubrique) { |
||||
$rub = sql_fetsel("id_rubrique, titre", "spip_rubriques", "id_rubrique=$id_rubrique"); |
||||
$id_rubrique = $rub['id_rubrique']; |
||||
$s .= "<a href='" . generer_url_entite($id_rubrique, 'rubrique') . "' style=\"display:block;\">".typo($rub['titre'])."</a>"; |
||||
} elseif ($statut){ |
||||
if ($statut != "prop") |
||||
$s = affdate_jourcourt($date_heure); |
||||
else |
||||
$s .= _T('info_a_valider'); |
||||
} |
||||
$vals[] = $s; |
||||
|
||||
$vals[] = afficher_numero_edit($id_objet, $primary, $type, $row); |
||||
} |
||||
return $vals; |
||||
} |
||||
|
||||
// Cas particuliers ----------------------------------------------------------------- |
||||
|
||||
// |
||||
// Afficher tableau d'articles |
||||
// |
||||
// https://code.spip.net/@inc_afficher_articles_dist |
||||
function inc_afficher_articles_dist($titre, $requete, $formater = '') { |
||||
|
||||
if (!isset($requete['FROM'])) $requete['FROM'] = 'spip_articles AS A'; |
||||
|
||||
if (!isset($requete['SELECT'])) { |
||||
$requete['SELECT'] = "A.id_article, A.titre, A.id_rubrique, A.statut, A.date, A.lang, A.id_trad, A.descriptif"; |
||||
} |
||||
|
||||
if (!isset($requete['GROUP BY'])) $requete['GROUP BY'] = ''; |
||||
|
||||
$cpt = sql_countsel($requete['FROM'], $requete['WHERE'], $requete['GROUP BY']); |
||||
|
||||
if (!$cpt) return '' ; |
||||
|
||||
$requete['FROM'] = preg_replace("/(spip_articles\s+AS\s+(\w+))/i", "\\1 LEFT JOIN spip_petitions AS P ON \\2.id_article=P.id_article", $requete['FROM']); |
||||
|
||||
$requete['SELECT'] .= ", P.id_article AS petition "; |
||||
|
||||
// memorisation des arguments pour gerer l'affichage par tranche |
||||
// et/ou par langues. |
||||
|
||||
|
||||
$hash = sauver_requete($titre, $requete, $formater); |
||||
|
||||
if (isset($requete['LIMIT'])) $cpt = min($requete['LIMIT'], $cpt); |
||||
return afficher_articles_trad($titre, $requete, $formater, $hash, $cpt); |
||||
} |
||||
|
||||
// |
||||
// Stocke la fonction ajax dans le fichier temp pour exec=memoriser |
||||
// |
||||
|
||||
// https://code.spip.net/@sauver_requete |
||||
function sauver_requete($titre, $requete, $formater) |
||||
{ |
||||
$r = $requete; |
||||
unset($r['ORDER BY']); |
||||
$hash = substr(md5(serialize($r) . $GLOBALS['meta']['gerer_trad'] . $titre), 0, 31); |
||||
|
||||
// on lit l'existant |
||||
lire_fichier(_DIR_SESSIONS.'ajax_fonctions.txt', $ajax_fonctions); |
||||
$ajax_fonctions = @unserialize($ajax_fonctions); |
||||
|
||||
// on ajoute notre fonction |
||||
$v = array(time(), $titre, $requete, $formater); |
||||
$ajax_fonctions[$hash] = $v; |
||||
|
||||
// supprime les fonctions trop vieilles |
||||
foreach ($ajax_fonctions as $h => $fonc) |
||||
if (time() - $fonc[0] > 48 * 3600) |
||||
unset($ajax_fonctions[$h]); |
||||
|
||||
// enregistre |
||||
ecrire_fichier(_DIR_SESSIONS.'ajax_fonctions.txt', |
||||
serialize($ajax_fonctions)); |
||||
|
||||
return $hash; |
||||
|
||||
} |
||||
// https://code.spip.net/@afficher_articles_trad |
||||
function afficher_articles_trad($titre_table, $requete, $formater, $hash, $cpt, $trad = 0) { |
||||
|
||||
global $spip_lang_right; |
||||
|
||||
$tmp_var = 't' . substr($hash, 0, 7); |
||||
|
||||
if ($trad) { |
||||
$formater = 'afficher_articles_trad_boucle'; |
||||
$icone = "langues-off-12.gif"; |
||||
$alt = _T('masquer_trad'); |
||||
} else { |
||||
if (!$formater) |
||||
$formater = charger_fonction('formater_article', 'inc'); |
||||
$icone = 'langues-12.gif'; |
||||
$alt = _T('afficher_trad'); |
||||
} |
||||
|
||||
$texte = '<b>' . $titre_table . '</b>'; |
||||
|
||||
// Le parametre o sert a empecher le navigateur de reutiliser |
||||
// un cache de tranche issu d'un autre tri |
||||
|
||||
$arg = "hash=$hash&o=" . $requete['ORDER BY']; |
||||
|
||||
/* |
||||
// DESACTIVE CAR AJOUTE UNE COMPLEXITE INUTILE -- A REVOIR |
||||
// le micro "afficher les traductions" |
||||
if (($GLOBALS['meta']['gerer_trad'] == "oui")) { |
||||
$url = generer_url_ecrire('memoriser',"$arg&trad=" . (1-$trad)); |
||||
$texte = |
||||
"\n<span style='float: $spip_lang_right;'><a href=\"#\"" |
||||
. generer_onclic_ajax($url, $tmp_var, 0) |
||||
. "><img\nsrc='". chemin_image($icone) ."' alt='$alt' title='$alt' /></a></span>" . $texte; |
||||
} |
||||
*/ |
||||
|
||||
/* |
||||
// DESACTIVE CAR AJOUTE UNE COMPLEXITE INUTILE -- A REVOIR |
||||
$url_t = generer_url_ecrire('memoriser',"hash=$hash&by=0%2Btitre,titre"); |
||||
$url_t = afficher_boutons_tri($url_t, $tmp_var); |
||||
|
||||
$url_d = generer_url_ecrire('memoriser',"hash=$hash&by=date"); |
||||
$url_d = afficher_boutons_tri($url_d, $tmp_var); |
||||
*/ |
||||
$url_t = $url_d = ''; |
||||
$presenter_liste = charger_fonction('presenter_liste', 'inc'); |
||||
$styles = array(array('', 11), array('arial2','', $url_t), array('arial1', 80), array('arial1', 100, $url_d), array('arial1', 50)); |
||||
$tableau = array(); |
||||
$url = generer_url_ecrire('memoriser', "$arg&trad=$trad"); |
||||
$res = $presenter_liste($requete, $formater, $tableau, array(), false, $styles, $tmp_var, $texte, "article-24.png", $url, $cpt); |
||||
|
||||
return ajax_action_greffe($tmp_var, '', $res); |
||||
} |
||||
|
||||
// https://code.spip.net/@afficher_boutons_tri |
||||
function afficher_boutons_tri($url, $tmp_var) |
||||
{ |
||||
static $monter = ''; |
||||
static $descendre = ''; |
||||
|
||||
if (!$monter) { |
||||
$monter = http_img_pack('monter-16.png', '<'); |
||||
$descendre = http_img_pack('descendre-16.png', '>'); |
||||
} |
||||
|
||||
$url_d = generer_onclic_ajax($url ."&order=desc", $tmp_var, 0); |
||||
$url_a = generer_onclic_ajax($url ."&order=asc", $tmp_var, 0); |
||||
|
||||
return "<a href='$url'$url_d>$monter</a><a href='$url'$url_a>$descendre</a>"; |
||||
} |
||||
|
||||
// https://code.spip.net/@afficher_articles_trad_boucle |
||||
function afficher_articles_trad_boucle($row, $own = '') |
||||
{ |
||||
global $spip_lang_right, $spip_display; |
||||
|
||||
$id_article = $row['id_article']; |
||||
if (!autoriser('voir', 'article', $id_article)) return ''; |
||||
|
||||
$titre = $row['titre']; |
||||
$id_rubrique = $row['id_rubrique']; |
||||
$statut = $row['statut']; |
||||
$id_trad = $row['id_trad']; |
||||
$lang = $row['lang']; |
||||
|
||||
$lang_dir = lang_dir($GLOBALS['lang_objet']); |
||||
$dates_art = $langues_art = array(); |
||||
$ligne = ""; |
||||
|
||||
$res_trad = sql_select("id_article, lang, date_modif", "spip_articles", "id_trad = $id_trad AND id_trad > 0"); |
||||
|
||||
while ($row_trad = sql_fetch($res_trad)) { |
||||
$id_article_trad = $row_trad["id_article"]; |
||||
$lang_trad = $row_trad["lang"]; |
||||
$date = $row_trad['date_modif']; |
||||
$dates_art[$lang_trad] = $date; |
||||
$langues_art[$lang_trad] = $id_article_trad; |
||||
if ($id_article_trad == $id_trad) $date_ref = $date; |
||||
} |
||||
|
||||
// faudrait sortir ces invariants de boucle |
||||
|
||||
if (($GLOBALS['meta']['multi_rubriques'] == 'oui' and (!isset($GLOBALS['id_rubrique']))) or $GLOBALS['meta']['multi_articles'] == 'oui') { |
||||
$langue_defaut = isset($GLOBALS['langue_rubrique']) |
||||
? $GLOBALS['meta']['langue_site'] |
||||
: $GLOBALS['langue_rubrique']; |
||||
if ($lang != $langue_defaut) |
||||
$afficher_langue = " <span class='spip_xx-small' style='color: #666666' dir='$lang_dir'>(".traduire_nom_langue($lang).")</span>"; |
||||
} else $afficher_langue = ''; |
||||
|
||||
foreach(explode(',', $GLOBALS['meta']['langues_multilingue']) as $k){ |
||||
if (isset($langues_art[$k]) and $langues_art[$k] <> $id_trad){ |
||||
$h = generer_url_ecrire("articles", "id_article=".$langues_art[$k]); |
||||
$style = strtotime($dates_art[$k]) < strtotime($date_ref); |
||||
$style = $style ? 'claire' : 'foncee'; |
||||
$ligne .= "<a href='$h' class='$style'>$k</a>"; |
||||
} |
||||
} |
||||
|
||||
if (acces_restreint_rubrique($id_rubrique)) |
||||
$img = http_img_pack("auteur-0minirezo-16.png", _T('titre_image_administrateur'), "", _T('titre_image_admin_article')); |
||||
else $img = ''; |
||||
|
||||
if (!$titre) $titre = _T('ecrire:info_sans_titre'); |
||||
if ($id_article == $id_trad) $titre = "<b>$titre</b>"; |
||||
|
||||
$h = generer_url_ecrire("articles", "id_article=$id_article"); |
||||