4000) $annee_redac -= 9000;
}
$extra=$row["extra"];
$query = "SELECT * FROM spip_auteurs_articles WHERE id_article=$id_article AND id_auteur=$connect_id_auteur";
$result_auteur = spip_query($query);
$flag_auteur = (spip_num_rows($result_auteur) > 0);
$flag_editable = (acces_rubrique($id_rubrique) OR ($flag_auteur > 0 AND ($statut == 'prepa' OR $statut == 'prop' OR $new == 'oui')));
}
}
else if ($new=='oui') {
if ($lier_trad) {
// Pas de langue choisie par defaut
$changer_lang = '';
// Recuperer les donnees de la traduction
$query = "SELECT * FROM spip_articles WHERE id_article=$lier_trad";
$result = spip_query($query);
if ($row = spip_fetch_array($result)) {
$surtitre = $row["surtitre"];
$titre = filtrer_entites(_T('info_nouvelle_traduction')).' '.$row["titre"];
$soustitre = $row["soustitre"];
$id_rubrique_trad = $row["id_rubrique"];
$descriptif = $row["descriptif"];
$nom_site = $row["nom_site"];
$url_site = $row["url_site"];
$chapo = $row["chapo"];
$texte = $row["texte"];
$ps = $row["ps"];
$date = $row["date"];
$date_redac = $row['date_redac'];
if (ereg("([0-9]{4})-([0-9]{2})-([0-9]{2})",$date_redac,$regs)) {
$mois_redac = $regs[2];
$jour_redac = $regs[3];
$annee_redac = $regs[1];
if ($annee_redac > 4000) $annee_redac -= 9000;
}
$extra = $row["extra"];
}
$langues_autorisees = lire_meta('langues_multilingue');
// Regler la langue, si possible
if (ereg(",$spip_lang,", ",$langues_autorisees,")) {
if (lire_meta('multi_articles') == 'oui') {
// Si le menu de langues est autorise sur les articles,
// on peut changer la langue quelle que soit la rubrique
$changer_lang = $spip_lang;
}
else if (lire_meta('multi_rubriques') == 'oui') {
// Chercher la rubrique la plus adaptee pour accueillir l'article
if (lire_meta('multi_secteurs') == 'oui')
$id_parent = 0;
else {
$query = "SELECT id_parent FROM spip_rubriques WHERE id_rubrique=$id_rubrique";
$row_rub = spip_fetch_array(spip_query($query));
$id_parent = $row_rub['id_parent'];
}
$query = "SELECT id_rubrique FROM spip_rubriques WHERE lang='$spip_lang' AND id_parent=$id_parent";
if ($row_rub = spip_fetch_array(spip_query($query))) {
$id_rubrique = $id_secteur = $row_rub['id_rubrique'];
$changer_lang = 'herit';
}
}
}
}
else {
// Nouvel article : titre par defaut
$titre = filtrer_entites(_T('info_nouvel_article'));
$onfocus = " onfocus=\"if(!antifocus){this.value='';antifocus=true;}\"";
}
if (!$id_secteur) {
$row_rub = spip_fetch_array(spip_query("SELECT id_secteur FROM spip_rubriques WHERE id_rubrique=$id_rubrique"));
$id_secteur = $row_rub['id_secteur'];
}
$flag_editable = true;
}
if (!$flag_editable) {
die ("
"._T('info_acces_interdit')."
");
}
// Qui veut modifier l'article ?
spip_query("UPDATE spip_articles SET date_modif=NOW(), auteur_modif=$connect_id_auteur WHERE id_article=$id_article");
$id_article_bloque = $id_article; // message pour inc_presentation
//
// Gestion des textes trop longs (limitation brouteurs)
//
function coupe_trop_long($texte){ // utile pour les textes > 32ko
if (strlen($texte) > 28*1024) {
$texte = str_replace("\r\n","\n",$texte);
$pos = strpos($texte, "\n\n", 28*1024); // coupe para > 28 ko
if ($pos > 0 and $pos < 32 * 1024) {
$debut = substr($texte, 0, $pos)."\n\n\n";
$suite = substr($texte, $pos + 2);
} else {
$pos = strpos($texte, " ", 28*1024); // sinon coupe espace
if (!($pos > 0 and $pos < 32 * 1024)) {
$pos = 28*1024; // au pire (pas d'espace trouv'e)
$decalage = 0; // si y'a pas d'espace, il ne faut pas perdre le caract`ere
} else {
$decalage = 1;
}
$debut = substr($texte,0,$pos + $decalage); // Il faut conserver l'espace s'il y en a un
$suite = substr($texte,$pos + $decalage);
}
return (array($debut,$suite));
}
else
return (array($texte,''));
}
debut_page(_T('titre_page_articles_edit', array('titre' => $titre)), "documents", "articles", "hauteurTextarea();");
debut_grand_cadre();
afficher_hierarchie($id_rubrique);
fin_grand_cadre();
debut_gauche();
//
// Pave "documents associes a l'article"
//
if ($new != 'oui'){
# modifs de la description d'un des docs joints
if ($flag_editable) maj_documents($id_article, 'article');
# affichage
afficher_documents_colonne($id_article, 'article', $flag_editable);
}
debut_droite();
debut_cadre_formulaire();
function enfant($leparent){
global $id_parent;
global $id_rubrique;
static $i = 0, $premier = 1;
global $statut;
global $connect_toutes_rubriques;
global $couleur_claire, $spip_lang_left;
global $browser_name, $browser_version;
global $ja_rub;
$i++;
$query="SELECT * FROM spip_rubriques WHERE id_parent='$leparent' ORDER BY 0+titre, titre";
$result=spip_query($query);
while($row=spip_fetch_array($result)){
$my_rubrique=$row['id_rubrique'];
$titre=$row['titre'];
$statut_rubrique=$row['statut'];
$lang_rub = $row['lang'];
$langue_choisie_rub = $row['langue_choisie'];
$style = "";
$espace = "";
// si l'article est publie il faut etre admin pour avoir le menu
// sinon le menu est present en entier (proposer un article)
if ($statut != "publie" OR acces_rubrique($my_rubrique)) {
$rubrique_acceptable = true;
} else {
$rubrique_acceptable = false;
}
if (eregi("mozilla", $browser_name)) {
$style .= "padding-$spip_lang_left: 16px; ";
$style .= "margin-$spip_lang_left: ".(($i-1)*16)."px;";
} else {
for ($count = 0; $count <= $i; $count ++) $espace .= " ";
}
switch ($i) {
case 1:
$espace= "";
$style .= "font-weight: bold;";
break;
case 2:
$style .= "color: #202020;";
break;
case 3:
$style .= "color: #404040;";
break;
case 4:
$style .= "color: #606060;";
break;
case 5:
$style .= "color: #808080;";
break;
default:
$style .= "color: #A0A0A0;";
break;
}
if ($i==1) {
$style .= "background-image: url(" . _DIR_IMG_PACK. "secteur-12.gif);";
$style .= "background-color: $couleur_claire;";
$style .= "font-weight: bold;";
}
else if ($i==2) {
//$style .= "background: url(" . _DIR_IMG_PACK. "rubrique-12.gif) $spip_lang_left no-repeat;";
$style .= "border-bottom: 1px solid $couleur_claire;";
$style .= "font-weight: bold;";
}
else {
//$style .= "background: url(" . _DIR_IMG_PACK. "rubrique-12.gif) $spip_lang_left no-repeat;";
}
$selec_rub = "selec_rub";
if ($browser_name == "MSIE" AND floor($browser_version) == "5") $selec_rub = ""; // Bug de MSIE MacOs 9.0
if ($rubrique_acceptable) {
if ($i == 1 && !$premier) echo "\n";
$ja_rub .= addslashes("[$my_rubrique] $titre ///");
}
$premier = 0;
enfant($my_rubrique);
}
$i=$i-1;
}
echo "\n