function install_debut_html($titre = 'AUTO', $onLoad = '') { global $spip_lang_right,$spip_lang_left; utiliser_langue_visiteur(); http_no_cache(); if ($titre=='AUTO') $titre=_T('info_installation_systeme_publication'); # le charset est en utf-8, pour recuperer le nom comme il faut # lors de l'installation if (!headers_sent()) header('Content-Type: text/html; charset=utf-8'); // au cas ou minipres() est appele avant spip_initialisation_suite() if (!defined('_DOCTYPE_ECRIRE')) define('_DOCTYPE_ECRIRE', ''); return _DOCTYPE_ECRIRE. html_lang_attributes(). "<head>\n". "<title>". textebrut($titre). "</title> <link rel='stylesheet' href='".direction_css(find_in_path('minipres.css')). "' type='text/css' media='all' />\n" . // cet appel permet d'assurer un copier-coller du nom du repertoire a creer dans tmp (esj) http_script('', "spip_barre.js") . "</head> <body".$onLoad." class='minipres'> <div id='minipres'> <h1>". $titre . "</h1> <div>\n"; }
function inc_iconifier_dist($id_objet, $id, $script, $visible=false, $flag_modif=true) { if ($GLOBALS['spip_display'] == 4) return ""; $texteon = $GLOBALS['logo_libelles'][($id OR $id_objet != 'id_rubrique') ? $id_objet : 'id_racine']; $chercher_logo = charger_fonction('chercher_logo', 'inc'); // Add the redirect url when uploading via iframe $iframe_script = generer_url_ecrire('iconifier',"type=$id_objet&$id_objet=$id&script=$script",true); $iframe = "<input type='hidden' name='iframe_redirect' value='".rawurlencode($iframe_script)."' />\n"; $logo = $chercher_logo($id, $id_objet, 'on'); $logo_s = $chercher_logo($id, $id_objet, 'off'); if (!$logo) { if ($flag_modif AND $GLOBALS['meta']['activer_logos'] != 'non') { $masque = indiquer_logo($texteon, $id_objet, 'on', $id, $script, $iframe); $masque = "<div class='cadre_padding'>$masque</div>"; $bouton = bouton_block_depliable($texteon, $visible, "on-$id_objet-$id"); $res = debut_block_depliable($visible,"on-$id_objet-$id") . $masque . fin_block(); } } else { list($img, $clic) = decrire_logo($id_objet,'on',$id, 170, 170, $logo, $texteon, $script, $flag_modif AND !$logo_s); $bouton = bouton_block_depliable($texteon, $visible, "on-$id_objet-$id"); $survol = ''; $texteoff = _T('logo_survol'); if (!$logo = $logo_s) { if ($flag_modif AND $GLOBALS['meta']['activer_logos_survol'] == 'oui') { $masque = "<br />".indiquer_logo($texteoff, $id_objet, 'off', $id, $script, $iframe); $survol .= "<br />".block_parfois_visible("off-$id_objet-$id", $texteoff, $masque, null, $visible); } $masque = debut_block_depliable($visible,"on-$id_objet-$id") . "<div class='cadre_padding'>" . $clic . $survol . "</div>" . fin_block(); } else { list($imgoff, $clicoff) = decrire_logo($id_objet, 'off', $id, 170, 170, $logo, $texteoff, $script, $flag_modif); $masque = debut_block_depliable($visible, "off-$id_objet-$id") . $clicoff . fin_block(); $survol .= "<br />".bouton_block_depliable($texteoff, $visible, "off-$id_objet-$id") . "<div class='cadre_padding'>".$imgoff.$masque."</div>"; $masque = debut_block_depliable($visible,"on-$id_objet-$id") . $clic . fin_block() . $survol; } $res = "$img$masque"; } if ($res) { $res = debut_cadre('r', 'image-24.gif', '', $bouton, '', '', false) . $res . fin_cadre_relief(true); if(_request("exec")!="iconifier") { $js = http_script('', 'async_upload.js') . http_script('$("form.form_upload_icon").async_upload(async_upload_icon)'); } else $js = ""; return ajax_action_greffe("iconifier", $id, $res).$js; } else return ''; }
function exec_articles_tous_args($id_rubrique, $aff_art, $sel_lang) { global $browser_layer,$spip_lang_right,$spip_lang_left; changer_typo(); // pour definir la direction de la langue if (!is_array($aff_art)) $aff_art = array('prop','publie'); $enfant = arbo_articles_tous(); $flag_trad = (($GLOBALS['meta']['multi_rubriques'] == 'oui' OR $GLOBALS['meta']['multi_articles'] == 'oui') AND $GLOBALS['meta']['gerer_trad'] == 'oui'); list($article,$text_article,$aff_statut) = texte_articles_tous($sel_lang, $flag_trad, $aff_art, lang_dir()); if (_AJAX AND $id_rubrique) { include_spip('inc/actions'); ajax_retour(afficher_contenu_rubrique($article, $enfant, $text_article, $id_rubrique, $flag_trad, 2)); } else { pipeline('exec_init',array('args'=>array('exec'=>'articles_tous'),'data'=>'')); $commencer_page = charger_fonction('commencer_page', 'inc'); echo $commencer_page(_T('titre_page_articles_tous'), "accueil", "tout-site"); echo http_script('var img_deplierhaut = "'. chemin_image('noeud_plus.gif') .'"; var img_deplierbas = "'. chemin_image('noeud_moins.gif') . '";'); echo http_script('', 'jquery-ui-1.8-drag-drop.min.js'); echo http_script('', 'articles_tous_edite.js'); echo http_script('', 'pause.js'); echo debut_gauche('', true); echo formulaire_affiche_tous($aff_art, $aff_statut, $sel_lang); echo pipeline('affiche_gauche',array('args'=>array('exec'=>'articles_tous'),'data'=>'')); echo creer_colonne_droite('', true); echo pipeline('affiche_droite',array('args'=>array('exec'=>'articles_tous'),'data'=>'')); echo debut_droite('', true); if ($enfant AND $browser_layer) echo couche_formulaire_tous(); $out = "<textarea cols='1' rows='1' id='deplacements' style='display:none;' name='deplacements'></textarea>" . "\n<div id='apply' style='display:none;text-align:$spip_lang_right'><input type='submit' value='"._T('bouton_changer')."' /></div>"; echo "\n<div id='cancel' class='verdana2' style='display:none;text-align:$spip_lang_left;float:$spip_lang_left'>", "<a href='javascript:annuler_deplacement();'>", _T('bouton_annuler'), "</a></div>", redirige_action_post("reorganiser","",'articles_tous', '', $out), "<ul id='articles_tous'><li id='rubrique-0' class='treeItem racine verdana2'>", "<span class='holder icone'> </span>", _T('info_racine_site'), "\n<ul class=''>\n", afficher_contenu_rubrique($article, $enfant, $text_article, 0, $flag_trad, 2), "</ul></li></ul>\n", fin_gauche(), fin_page(); } }
function base_restaurer_dist($titre = '', $reprise = false) { $status_file = _DUMP_STATUS_FILE; $status_file = _DIR_TMP . basename($status_file) . ".txt"; if (!lire_fichier($status_file, $status) or !($status = unserialize($status))) { } else { $redirect = parametre_url(generer_action_auteur('restaurer', _DUMP_STATUS_FILE), "step", intval(_request('step') + 1), '&'); $timeout = ini_get('max_execution_time'); // valeur conservatrice si on a pas reussi a lire le max_execution_time if (!$timeout) { $timeout = 30; } // parions sur une valeur tellement courante ... $max_time = time() + $timeout / 2; include_spip('inc/minipres'); @ini_set("zlib.output_compression", "0"); // pour permettre l'affichage au fur et a mesure $titre = _T('dump:restauration_en_cours') . " (" . count($status['tables']) . ") "; $balise_img = chercher_filtre('balise_img'); $titre .= $balise_img(chemin_image('searching.gif')); echo install_debut_html($titre); // script de rechargement auto sur timeout echo http_script("window.setTimeout('location.href=\"" . $redirect . "\";'," . $timeout * 1000 . ")"); echo "<div style='text-align: left'>\n"; dump_serveur($status['connect']); spip_connect('dump'); // au premier coup on ne fait rien sauf afficher l'ecran de sauvegarde if (_request('step')) { $options = array('callback_progression' => 'dump_afficher_progres', 'max_time' => $max_time, 'no_erase_dest' => lister_tables_noerase(), 'where' => $status['where'] ? $status['where'] : array(), 'desc_tables_dest' => array()); if ($desc = sql_getfetsel('valeur', 'spip_meta', "nom='dump_structure_temp'", '', '', '', '', 'dump') and $desc = unserialize($desc)) { $options['desc_tables_dest'] = $desc; } #var_dump(sql_allfetsel('nom,valeur','spip_meta',"",'','','','','dump')); #die(); $res = base_copier_tables($status_file, $status['tables'], 'dump', '', $options); } else { // mais on en profite pour reparer les version base pour etre sur de ne pas les perdre sql_updateq("spip_meta", array('impt' => 'oui'), "nom='version_installee'", '', 'dump'); sql_updateq("spip_meta", array('impt' => 'oui'), "nom LIKE '%_base_version'", '', 'dump'); } echo "</div>\n"; if (!$res) { echo dump_relance($redirect); } echo install_fin_html(); ob_end_flush(); flush(); if (!$res) { exit; } // quand on sort de $export avec true c'est qu'on a fini dump_end(_DUMP_STATUS_FILE, 'restaurer'); include_spip('inc/headers'); echo redirige_formulaire(generer_url_ecrire("restaurer", 'status=' . _DUMP_STATUS_FILE, '', true, true)); } }
function bouton_block_depliable($texte, $deplie, $ids = "") { $bouton_id = 'b' . substr(md5($texte . microtime()), 0, 8); $class = $deplie === true ? " deplie" : ($deplie == -1 ? " impliable" : " replie"); if (strlen($ids)) { $cible = explode(',', $ids); $cible = '#' . implode(",#", $cible); } else { $cible = "#{$bouton_id} + div.bloc_depliable"; } $b = strpos($texte, "<h") === false ? 'h3' : 'div'; return "<{$b} " . ($bouton_id ? "id='{$bouton_id}' " : "") . "class='titrem{$class}'" . ($deplie === -1 ? "" : " onmouseover=\"jQuery(this).depliant('{$cible}');\"") . ">" . "<a href='#' onclick=\"return jQuery(this).depliant_clicancre('{$cible}');\" class='titremancre'></a>" . "{$texte}</{$b}>" . http_script($deplie === 'incertain' ? "jQuery(document).ready(function(){if (jQuery('{$cible}').is(':visible')) \$('#{$bouton_id}').addClass('deplie').removeClass('replie');});" : ''); }
function controleurs_portfolio_dist($regs) { list(, $crayon, $type, $champ, $id) = $regs; include_spip('inc/minipres'); # pour aide() include_spip('inc/presentation'); # pour debut_cadre() include_spip('inc/layer'); # pour le js des fleches include_spip('inc/documents'); # pour aide() $html = http_script("\nvar ajax_image_searching = \n'<div style=\"float: " . $GLOBALS['spip_lang_right'] . ";\"><img src=\"" . url_absolue(_DIR_IMG_PACK . "searching.gif") . "\" alt=\"\" /></div>';") . http_script('', generer_url_public('jquery.js')) . http_script('', _DIR_JAVASCRIPT . 'layer.js', '') . afficher_documents_colonne($id, $type, 'portfolio'); $status = NULL; return array($html, $status); }
function inc_documenter_objet_dist($id, $type = "article", $script, $flag_editable=true) { global $spip_lang_left; // Joindre ? if ($GLOBALS['meta']["documents_$type"]=='non' OR !autoriser('joindredocument', $type, $id) OR !$flag_editable) $res = ''; else { $joindre = charger_fonction('joindre', 'inc'); $res = $joindre(array( 'cadre' => 'relief', 'icone' => 'image-24.gif', 'fonction' => 'creer.gif', 'titre' => _T('titre_joindre_document'), 'script' => $script, 'args' => "id_$type=$id", 'id' => $id, 'intitule' => _T('info_telecharger_ordinateur'), 'mode' => 'document', 'type' => $type, 'ancre' => '', 'id_document' => 0, 'iframe_script' => generer_url_ecrire("documenter","id_$type=$id&type=$type",true) )); // eviter le formulaire upload qui se promene sur la page // a cause des position:relative incompris de MSIE if ($GLOBALS['browser_name']!="MSIE") { $res = "\n<table width='100%' cellpadding='0' cellspacing='0' border='0'>\n<tr><td> </td><td style='text-align: $spip_lang_left;width: 50%;'>\n$res</td></tr></table>"; } $res .= http_script('',"async_upload.js") . http_script('$("form.form_upload").async_upload(async_upload_portfolio_documents);'); } $documenter = charger_fonction('documenter', 'inc'); return "<div id='portfolio'>".$documenter($id, $type, 'portfolio', $flag_editable)."</div><br />" ."<div id='documents'>". $documenter($id, $type, 'documents', $flag_editable)."</div>" . $res; }
function inc_sauvegarder_dist($status_file, $redirect = '') { $status_file = _DIR_TMP . basename($status_file) . ".txt"; if (!lire_fichier($status_file, $status) or !($status = unserialize($status))) { } else { $timeout = ini_get('max_execution_time'); // valeur conservatrice si on a pas reussi a lire le max_execution_time if (!$timeout) { $timeout = 30; } // parions sur une valeur tellement courante ... $max_time = time() + $timeout / 2; include_spip('inc/minipres'); @ini_set("zlib.output_compression", "0"); // pour permettre l'affichage au fur et a mesure $titre = _T('dump:sauvegarde_en_cours') . " (" . count($status['tables']) . ") "; $balise_img = chercher_filtre('balise_img'); $titre .= $balise_img(chemin_image('searching.gif')); echo install_debut_html($titre); // script de rechargement auto sur timeout echo http_script("window.setTimeout('location.href=\"" . $redirect . "\";'," . $timeout * 1000 . ")"); echo "<div style='text-align: left'>\n"; dump_serveur($status['connect']); spip_connect('dump'); // au premier coup on ne fait rien sauf afficher l'ecran de sauvegarde $res = false; if (_request('step')) { $options = array('callback_progression' => 'dump_afficher_progres', 'max_time' => $max_time, 'no_erase_dest' => lister_tables_noerase(), 'where' => $status['where'] ? $status['where'] : array()); $res = base_copier_tables($status_file, $status['tables'], '', 'dump', $options); } echo "</div>\n"; if (!$res and $redirect) { echo dump_relance($redirect); } echo install_fin_html(); ob_end_flush(); flush(); return $res; } }
function help_frame_menu($titre, $contenu, $lang) { global $spip_lang_rtl; return "<head>\n<title>" .$titre ."</title>\n" . '<link rel="stylesheet" type="text/css" href="' . generer_url_public('aide_menu', "ltr=". $GLOBALS['spip_lang_left']) . "\"/>\n" . http_script('', 'jquery.js') . "\n" . $GLOBALS['browser_layer'] . http_script('var curr_article; function activer_article(id) { if (curr_article) jQuery("#"+curr_article).removeClass("article-actif").addClass("article-inactif"); if (id) { jQuery("#"+id).removeClass("article-inactif").addClass("article-actif"); curr_article = id; } } ') . ' </head> <body bgcolor="#FFFFFF" text="#000000" link="#E86519" vlink="#6E003A" alink="#FF9900" topmargin="5" leftmargin="5" marginwidth="5" marginheight="5"' . ($spip_lang_rtl ? " dir='rtl'" : '') . " lang='$lang'" . '>' . $contenu . '</body>'; }
function export_trace($val_meta, $dir, $meta) { list($gz, $archive, $rub, $tables_for_dump, $etape_actuelle, $sous_etape, $serveur, $save) = $val_meta; include_spip('inc/minipres'); // pour permettre l'affichage au fur et a mesure @ini_set("zlib.output_compression","0"); if (!($timeout = ini_get('max_execution_time')*1000)); $timeout = 30000; // parions sur une valeur tellement courante ... // le premier hit est moitie moins long car seulement une phase d'ecriture de morceaux // sans ramassage // sinon grosse ecriture au 1er hit, puis gros rammassage au deuxieme avec petite ecriture,... ca oscille if (!$etape_actuelle AND !$sous_etape) { $timeout = round($timeout/2); $tables_sauvegardees = array(); } else { $metatable = $meta . '_tables'; $tables_sauvegardees = isset($GLOBALS['meta'][$metatable])?unserialize($GLOBALS['meta'][$metatable]):array(); } // Les sauvegardes partielles prennent le temps d'indiquer les logos // Instancier une fois pour toutes, car on va boucler un max. // On complete jusqu'au secteur pour resituer dans l'arborescence) if ($rub) { $GLOBALS['chercher_logo'] = charger_fonction('chercher_logo', 'inc',true); $les_rubriques = complete_fils(array($rub), $serveur); $les_meres = complete_secteurs(array($rub), $serveur); } else { $GLOBALS['chercher_logo'] = false; $les_rubriques = $les_meres = ''; } // script de rechargement auto sur timeout $redirect = generer_url_ecrire("export_all"); $all = count($tables_for_dump); echo ( install_debut_html(_T('info_sauvegarde') . " ($all)")); echo http_script("window.setTimeout('location.href=\"".$redirect."\";',$timeout)"); echo "<div style='text-align: left'>\n"; $etape = 1; foreach($tables_for_dump as $table){ if ($etape_actuelle > $etape) { // sauter les deja faits, mais rappeler qu'ils sont fait echo ( "\n<br /><strong>".$etape. '. '."</strong>". $tables_sauvegardees[$table]); } else { echo ( "\n<br /><strong>".$etape. '. '. $table."</strong> "); $r = sql_countsel($table, array(), array(), array(), $serveur); flush(); if (!$r) $r = ( _T('texte_vide')); else { $f = $dir . $archive . '.part_' . sprintf('%03d',$etape); $r = export_objets($table, $sous_etape, $r, $f, $les_rubriques, $les_meres, $meta); $r += $sous_etape*_EXPORT_TRANCHES_LIMITE; // info pas fiable si interruption+partiel if ($rub AND $etape_actuelle > 1) $r = ">= $r"; } echo " $r"; flush(); $sous_etape = 0; // on utilise l'index comme ca c'est pas grave si on ecrit plusieurs fois la meme $tables_sauvegardees[$table] = "$table ($r)"; ecrire_meta($meta . '_tables', serialize($tables_sauvegardees),'non'); } $etape++; $v = serialize(array($gz, $archive, $rub, $tables_for_dump, $etape,$sous_etape, $serveur, $save)); ecrire_meta($meta, $v,'non'); } echo ( "</div>\n"); // si Javascript est dispo, anticiper le Time-out echo ("<script language=\"JavaScript\" type=\"text/javascript\">window.setTimeout('location.href=\"$redirect\";',0);</script>\n"); echo (install_fin_html()); flush(); }
/** * Vérifie le formatage d'un xml * * @see valider_resultats() * @see valider_dir() * @see valider_pseudo_url() * * @param string $url * @param string $req_ext * @param int $limit * @param array|bool $rec * **/ function valider_xml_ok($url, $req_ext, $limit, $rec) { $url = urldecode($url); $rec = !$rec ? false : array(); if (!$limit) { $limit = 200; } $titre = _T('analyse_xml'); if (!$url) { $url_aff = 'http://'; $onfocus = "this.value='';"; $texte = $bandeau = $err = ''; } else { include_spip('inc/distant'); if (is_dir($url)) { $dir = substr($url, -1, 1) === '/' ? $url : "{$url}/"; $ext = !preg_match('/^[.*\\w]+$/', $req_ext) ? 'php' : $req_ext; $files = preg_files($dir, "{$ext}\$", $limit, $rec); if (!$files and $ext !== 'html') { $files = preg_files($dir, 'html$', $limit, $rec); if ($files) { $ext = 'html'; } } if ($files) { $res = valider_dir($files, $ext, $url); list($err, $res) = valider_resultats($res, $ext === 'html'); $err = ' (' . $err . '/' . count($files) . ')'; } else { $res = _T('texte_vide'); $err = ''; } $bandeau = $dir . '*' . $ext . $err; } else { if (preg_match('@^((?:[.]/)?[^?]*)[?]([0-9a-z_]+)=([^&]*)(.*)$@', $url, $r)) { list(, $server, $dir, $script, $args) = $r; if ((!$server or $server == './' or strpos($server, url_de_base()) === 0) and is_dir($dir)) { $url = $script; // Pour quand le validateur saura simuler // une query-string... // $args = preg_split('/&(amp;)?[a-z0-9_]+=/', $args); $args = true; } } else { $dir = 'exec'; $script = $url; $args = true; } $transformer_xml = charger_fonction('valider', 'xml'); $onfocus = "this.value='" . addslashes($url) . "';"; if (preg_match(',^[a-z][0-9a-z_]*$,i', $url)) { $res = $transformer_xml(charger_fonction($url, $dir), $args); $url_aff = valider_pseudo_url($dir, $script); } else { $res = $transformer_xml(recuperer_page($url)); $url_aff = entites_html($url); } list($texte, $err) = emboite_texte($res); if (!$err) { $err = '<h3>' . _T('spip_conforme_dtd') . '</h3>'; } $res = "<div style='text-align: center'>" . $err . "</div>" . "<div style='margin: 10px; text-align: left'>" . $texte . '</div>'; $bandeau = "<a href='{$url_aff}'>{$url}</a>"; } } $commencer_page = charger_fonction('commencer_page', 'inc'); $debut = $commencer_page($titre); $jq = http_script("", 'jquery.js'); echo str_replace('<head>', "<head>{$jq}", $debut); $onfocus = '<input type="text" size="70" value="' . $url_aff . '" name="var_url" id="var_url" onfocus="' . $onfocus . '" />'; $onfocus = generer_form_ecrire('valider_xml', $onfocus, " method='get'"); echo "<h1>", $titre, '<br>', $bandeau, '</h1>', "<div style='text-align: center'>", $onfocus, "</div>", $res, fin_page(); }
/** * Initialiser la page pour l'affichage des progres de l'upgrade * uniquement si la page n'a pas deja ete initilalisee * * @param string $installee * @param string $meta * @param string $table * @return */ function maj_debut_page($installee, $meta, $table) { static $done = false; if ($done) { return; } include_spip('inc/minipres'); @ini_set("zlib.output_compression", "0"); // pour permettre l'affichage au fur et a mesure $timeout = _UPGRADE_TIME_OUT * 2; $titre = _T('titre_page_upgrade'); $balise_img = charger_filtre('balise_img'); $titre .= $balise_img(chemin_image('searching.gif')); echo install_debut_html($titre); // script de rechargement auto sur timeout $redirect = generer_url_ecrire('upgrade', "reinstall={$installee}&meta={$meta}&table={$table}", true); echo http_script("window.setTimeout('location.href=\"" . $redirect . "\";'," . $timeout * 1000 . ")"); echo "<div style='text-align: left'>\n"; ob_flush(); flush(); $done = true; }
function rejouer_session() { include_spip('inc/filtres'); return http_img_pack('rien.gif', " ", "id='img_session' width='0' height='0'") . http_script("\ndocument.img_session.src='" . generer_url_action('cookie','change_session=oui', true) . "'"); }
function install_connexion_form($db, $login, $pass, $predef, $hidden, $etape) { $server_db = (is_string($predef[0])) ? $predef[0] : ''; return generer_form_ecrire('install', ( "\n<input type='hidden' name='etape' value='$etape' />" . $hidden . (_request('echec')? ("<p><b>"._T('avis_connexion_echec_1'). "</b></p><p>"._T('avis_connexion_echec_2')."</p><p style='font-size: small;'>"._T('avis_connexion_echec_3')."</p>") :"") . http_script('', 'jquery.js') . http_script(' $(document).ready(function() { $("input[type=hidden][name=server_db]").each(function(){ if ($(this).attr("value").match("sqlite*")){ $("#install_adresse_base_hebergeur").hide(); $("#install_login_base_hebergeur").hide(); $("#install_pass_base_hebergeur").hide(); } }); $("#sql_serveur_db").change(function(){ if ($(this).find("option:selected").attr("value").match("sqlite*")){ $("#install_adresse_base_hebergeur").hide(); $("#install_login_base_hebergeur").hide(); $("#install_pass_base_hebergeur").hide(); } else { $("#install_adresse_base_hebergeur").show(); $("#install_login_base_hebergeur").show(); $("#install_pass_base_hebergeur").show(); } }); });') . ($server_db ? '<input type="hidden" name="server_db" value="'.$server_db.'" />' . (($predef[0]) ?('<h3>'._T('install_serveur_hebergeur').'</h3>') :'') : ('<fieldset><legend>' ._T('install_select_type_db') . "</legend>" .'<label for="sql_serveur_db">' . _T('install_types_db_connus') // Passer l'avertissement SQLIte en commentaire, on pourra facilement le supprimer par la suite sans changer les traductions. . "<br /><small>(". _T('install_types_db_connus_avertissement') .')</small>' .'</label>' . "\n<div style='text-align: center;'><select name='server_db' id='sql_serveur_db' >\n" . join("\n", install_select_serveur()) . "\n</select></div></fieldset>") ) . '<div id="install_adresse_base_hebergeur">' . ($predef[1] ? '<h3>'._T('install_adresse_base_hebergeur').'</h3>' : fieldset(_T('entree_base_donnee_1'), array( 'adresse_db' => array( 'label' => $db[1], 'valeur' => $db[0] ), ) ) ) . '</div>' . '<div id="install_login_base_hebergeur">' . ($predef[2] ? '<h3>'._T('install_login_base_hebergeur').'</h3>' : fieldset(_T('entree_login_connexion_1'), array( 'login_db' => array( 'label' => $login[1], 'valeur' => $login[0] ), ) ) ) . '</div>' . '<div id="install_pass_base_hebergeur">' . ($predef[3] ? '<h3>'._T('install_pass_base_hebergeur').'</h3>' : fieldset(_T('entree_mot_passe_1'), array( 'pass_db' => array( 'label' => $pass[1], 'valeur' => $pass[0] ), ) ) ) . '</div>' . bouton_suivant())); }
function maj_auto_action_rapide() { global $spip_version_affichee, $spip_version_base; $arg_chargeur = $spip_version_base>=15828?'url_zip_plugin2':'url_zip_plugin'; // eq. SPIP >= 2.1.2 $time = time(); $timeout = ini_get('max_execution_time'); $timeout = $timeout?min(30,floor($timeout/2)):10; $style = 'style="padding:0.4em;"'; // verification des mises a jour de SPIP>=2.1 include_spip('inc/presentation'); list($m1,$m2) = preg_split('/\D+/', $GLOBALS['spip_version_branche']); $html1 = (function_exists('info_maj_spip') && ($html1=info_maj_spip())) ?"<fieldset><legend $style>"._T('couteauprive:help2', array('version'=>'SPIP '.$spip_version_affichee)).'</legend>'.propre("\n|{{{$html1}}}|") .(preg_match(",$m1\.$m2\.\d+,",$html1)?'<p>'._T('couteau:maj_spip').'</p>':'').'</fieldset>' :''; // verification de l'ecran de securite if(defined('_ECRAN_SECURITE')) { $maj = maj_auto_rev_distante(_MAJ_ECRAN_SECU,false,",(\d+\.\d+(\.\d+)?),",0,true); if($maj{0}!="-" && _ECRAN_SECURITE!=$maj) { include_spip('inc/description_outil'); $html1 .= "\n<fieldset><legend $style>"._T('couteauprive:help2', array('version'=>_T('couteauprive:ecran_securite:nom').' '._ECRAN_SECURITE)).'</legend>' . description_outil_liens(_T("couteauprive:ecran_maj_ko2", array("n"=>"<span style=\"color:red; font-weight:bold;\">$maj</span>"))).'</fieldset>'; } } // verification des plugins include_spip('inc/plugin'); $plugins_actifs = array_values(liste_chemin_plugin_actifs()); // tous, mais les actifs d'abord... $plugins = array_unique(array_merge($plugins_actifs, liste_plugin_files())); $html_actifs = $html_inactifs = array(); foreach ($plugins as $p) /*if(preg_match(',^auto/,', $p))*/ { $actif = in_array($p, $plugins_actifs, true); $auto = preg_match(',^auto/,', $p); $infos = plugin_get_infos_maj($p, $stop=time()-$time>$timeout); $maj_lib = $checked = ''; if($stop) $maj_lib = '<span class="cs_relancer">'.'Temps serveur écoulé : [poursuivre->#].'.'</span>'; elseif($infos['maj_dispo']) { $maj_lib = _T('couteau:maj_rev_ok', array('revision' => $infos['rev_rss'], 'url'=>$infos['url_origine'], 'zip'=>$infos['zip_trac'])); $checked = " class='maj_checked'"; } elseif($infos['rev_rss']>0 && $infos['rev_local']) $maj_lib = _T('couteau:maj'.($infos['svn']?'_svn':'_ok'), array('zip'=>$infos['zip_trac'], 'url'=>$infos['url_origine'])); elseif($auto) { $maj_lib = _T('couteau:maj_rev_ko', array('url'=>$infos['url_origine'])); $checked = " class='maj_checked'"; } elseif($infos['rev_local'] && $infos['rev_rss']<=0) $maj_lib = _T('couteau:maj_rev_ko', array('url'=>$infos['url_origine'])); // eventuels liens morts $maj_lib = preg_replace(',\[([^[]+)->\],', '$1', $maj_lib); $nom = preg_replace(",[\n\r]+,",' ',$infos['nom']). ' (v' .$infos['version'] . ')' . ($maj_lib?"\n_ {{".$maj_lib.'}}':''); $rev = $infos['rev_local']?_T('couteau:maj_rev', array('revision' => $infos['rev_local'])):''; if(strlen($infos['commit'])) $rev .= (strlen($rev)?'<br/>':'') . cs_date_court($infos['commit']); if($infos['svn']) $rev .= '<br/>SVN'; if(!strlen($rev)) $rev = ' '; $zip_log = (strlen($infos['zip_log']) && $infos['zip_log']!=$infos['zip_trac']) ?"<label><input type='radio' value='$infos[zip_log]'$checked name='$arg_chargeur'/>[->$infos[zip_log]]</label>":''; $bouton = ' '; if($auto && !$stop) $bouton = strlen($infos['zip_trac']) ?"<input type='radio' value='$infos[zip_trac]'$checked name='$arg_chargeur'/>" :'<center style="margin-top:0.6em;font-weight:bold;"><acronym title="'._T('couteau:maj_zip_ko').'">?</acronym></center>'; if(strlen($zip_log)) { if (!$stop) $nom .= "\n_ "._T('couteau:maj_verif') . "\n_ $zip_log\n_ {$bouton}[->$infos[zip_trac]]<label>"; $bouton = ' '; } ${$actif?'html_actifs':'html_inactifs'}[] = "|$bouton|$nom|$rev|"; } $html1 = "\n<div $style id='maj_auto_div'>$html1<fieldset><legend $style>" . _T('couteau:maj_liste').'</legend>' . propre( (count($html_actifs)? "\n|{{" . _T('couteau:plug_actifs') . "}}|<|<|\n" . join("\n",$html_actifs) . "\n" : '') . (count($html_inactifs)? "\n|{{" . _T('couteau:plug_inactifs') . "}}|<|<|\n" . join("\n",$html_inactifs) . "\n" : '') ) . "<div style='text-align: right;'><input class='fondo' type='submit' value=\"" . attribut_html(_T('couteau:maj_maj')) . '" /><p><i>'._T('couteau:maj_verif2').'</i></p></div></fieldset></div>' . http_script(" jQuery(document).ready(function() { var ch = jQuery('#maj_auto_div .maj_checked'); var re = jQuery('.cs_relancer a'); if(ch.length) ch[0].checked = true; else if(!re.length){ jQuery('#maj_auto_div :submit').parent().remove(); jQuery('#maj_auto_div :radio').attr('disabled','disabled'); } if(!jQuery('#maj_auto_div :radio:checked').length) jQuery('#maj_auto_div :radio:first')[0].checked = true; re.click(function() { cs_href_click(jQuery('#maj_auto')[0], true); return false; }); });"); $html2 = "\n<div class='cs_sobre'><input class='cs_sobre' type='submit' value=\"[" . attribut_html(_T('couteau:maj_actu')) . ']" /></div>'; // premier formulaire non ajax, lancant directement charger_plugin return redirige_action_post('charger_plugin', '', 'admin_couteau_suisse', "cmd=descrip&outil=maj_auto#cs_infos", $html1) // second formulaire ajax : lien d'actualisation forcee . ajax_action_auteur('action_rapide', 'maj_auto_forcer', 'admin_couteau_suisse', "arg=maj_auto|description_outil&cmd=descrip#cs_action_rapide", $html2); }
function exec_brouteur_frame_dist() { global $connect_id_auteur, $spip_ecran, $spip_lang_left; $id_rubrique = is_numeric(_request('rubrique')) ? intval(_request('rubrique')) : ""; $frame = _request('frame'); $effacer_suivant = _request('effacer_suivant'); $special = _request('special'); $peutpub = autoriser('publierdans','rubrique'); include_spip('inc/headers'); http_no_cache(); $profile = _request('var_profile') ? "&var_profile=1" : ''; echo _DOCTYPE_ECRIRE . html_lang_attributes() . pipeline('header_prive', "<head>\n" . "<title>brouteur_frame</title>\n" . "<meta http-equiv='Content-Type' content='text/html" . (($c = $GLOBALS['meta']['charset']) ? "; charset=$c" : '') . "' />\n" . envoi_link(_T('info_mon_site_spip')) . http_script('jQuery(function(){ jQuery("a.iframe").click(function(){ window.open(this.href,"iframe"+this.rel); return false; }); });') . "</head>\n") ."<body>"; if ($spip_ecran == "large") { $nb_col = 4; } else { $nb_col = 3; } if ($effacer_suivant == "oui" && $frame < $nb_col) { $res = ''; for ($i = $frame+1; $i < $nb_col; $i++) { $res .= "\nparent.iframe$i.location.href='" . generer_url_ecrire('brouteur_frame',"frame=$i$profile") . "'"; } echo http_script($res); } echo "\n<div class='arial2'>"; if ($special == "redac") { $result=sql_select("articles.id_article, articles.id_rubrique, articles.titre, articles.statut", "spip_articles AS articles LEFT JOIN spip_auteurs_articles AS lien ON articles.id_article=lien.id_article", "articles.statut = 'prepa' AND lien.id_auteur = $connect_id_auteur ", " id_article ", " articles.date DESC"); $res = ''; while($row=sql_fetch($result)){ $id_article=$row['id_article']; if (autoriser('voir','article',$id_article)){ $titre = typo($row['titre']); $statut = $row['statut']; $h = generer_url_ecrire('articles',"id_article=$id_article"); $res .= "<a class='$statut'\nhref='javascript:window.parent.location=\"$h\"'>$titre</a>"; } } if ($res) { echo "\n<div style='padding-top: 6px; padding-bottom: 3px;'><b class='verdana2'>"._T("info_cours_edition")."</b></div>"; echo "\n<div class='plan-articles'>", $res, "</div>"; } } else if ($special == "valider") { $result=sql_select("id_article, id_rubrique, titre, statut", "spip_articles", "statut = 'prop'", "", "date DESC"); $res = ''; while($row=sql_fetch($result)){ $id_article=$row['id_article']; if (autoriser('voir','article',$id_article)){ $titre = typo($row['titre']); $statut = $row['statut']; $h = generer_url_ecrire('articles',"id_article=$id_article"); $res .= "<a class='$statut' href='javascript:window.parent.location=\"$h\"'>$titre</a>"; } } if ($res) { echo "\n<div style='padding-top: 6px; padding-bottom: 3px;'><b class='verdana2'>"._T("info_articles_proposes")."</b></div>"; echo "\n<div class='plan-articles'>", $res, "</div>"; } $result=sql_select("*", "spip_breves", "statut = 'prop'", "", "date_heure DESC", "20"); $res = ''; while($row=sql_fetch($result)){ $id_breve=$row['id_breve']; if (autoriser('voir','breve',$id_breve)){ $titre = typo($row['titre']); $statut = $row['statut']; $h = generer_url_ecrire('breves_voir',"id_breve=$id_breve"); $res .= "<a class='$statut' href='javascript:window.parent.location=\"$h\"'>$titre</a>"; } } if ($res) { echo "\n<div style='padding-top: 6px;'><b class='verdana2'>"._T("info_breves_valider")."</b></div>"; echo "\n<div class='plan-articles'>", $res, "</div>"; } } else { if ($id_rubrique !== "" AND autoriser('voir','rubrique',$id_rubrique)) { $row = sql_fetsel("id_rubrique, titre, id_parent", "spip_rubriques", "id_rubrique=$id_rubrique",'', '0+titre,titre'); if ($row){ $titre = typo($row['titre']); $id_parent=$row['id_parent']; if ($id_parent == 0) $icone = "secteur-24.gif"; else $icone = "rubrique-24.gif"; echo "\n<div style='background-color: #cccccc; border: 1px solid #444444;'>"; echo icone_horizontale($titre, "javascript:window.parent.location=\"" . generer_url_ecrire('naviguer',"id_rubrique=$id_rubrique") .'"', $icone, "", false); echo "</div>"; } else if ($frame == 0) { echo "\n<div style='background-color: #cccccc; border: 1px solid #444444;'>"; echo icone_horizontale(_T('info_racine_site'), "javascript:window.parent.location=\"" . generer_url_ecrire('naviguer') . '"', "racine-site-24.gif","", false); echo "</div>"; } $result = sql_select("id_rubrique, titre, id_parent", "spip_rubriques", "id_parent=$id_rubrique",'', '0+titre,titre'); while($row=sql_fetch($result)){ $ze_rubrique=$row['id_rubrique']; if (autoriser('voir','rubrique',$ze_rubrique)){ $titre = typo($row['titre']); $id_parent=$row['id_parent']; echo "\n<div class='brouteur_rubrique' onmouseover=\"changeclass(this, 'brouteur_rubrique_on');\" onmouseout=\"changeclass(this, 'brouteur_rubrique');\">"; if ($id_parent == '0') { echo "\n<div style='", frame_background_image("secteur-24.gif"), ";'><a href='", generer_url_ecrire('brouteur_frame', "rubrique=$ze_rubrique&frame=".($frame+1)."&effacer_suivant=oui$profile"), "' class='iframe' rel='", ($frame+1), "'>", $titre, "</a></div>"; } else { if ($frame+1 < $nb_col) echo "\n<div style='", frame_background_image("rubrique-24.gif"), ";'><a href='", generer_url_ecrire('brouteur_frame', "rubrique=$ze_rubrique&frame=".($frame+1)."&effacer_suivant=oui$profile"), "' class='iframe' rel='", ($frame+1), "'>$titre</a></div>"; else echo "\n<div style='", frame_background_image("rubrique-24.gif"), ";'><a href='javascript:window.parent.location=\"" . generer_url_ecrire('brouteur',"id_rubrique=$ze_rubrique$profile")."\"'>",$titre,"</a></div>"; } echo "</div>\n"; } } if ($id_rubrique > 0) { if ($peutpub) $result = sql_select("id_article, id_rubrique, titre, statut", "spip_articles", "id_rubrique=$id_rubrique", "", "date DESC"); else $result = sql_select("articles.id_article, articles.id_rubrique, articles.titre, articles.statut", "spip_articles AS articles, spip_auteurs_articles AS lien", "articles.id_rubrique=$id_rubrique AND (articles.statut = 'publie' OR articles.statut = 'prop' OR (articles.statut = 'prepa' AND articles.id_article = lien.id_article AND lien.id_auteur = $connect_id_auteur)) ", " id_article ", " articles.date DESC"); $res = ''; while($row=sql_fetch($result)){ $id_article=$row['id_article']; if (autoriser('voir','article',$id_article)){ $titre = typo($row['titre']); $statut = $row['statut']; $h = generer_url_ecrire('articles',"id_article=$id_article"); $res .= "<a class='$statut' href='javascript:window.parent.location=\"$h\"'>$titre</a>"; } } if ($res) { echo "\n<div style='padding-top: 6px; padding-bottom: 3px;'><b class='verdana2'>"._T('info_articles')."</b></div>"; echo "\n<div class='plan-articles'>", $res, "</div>"; } $result=sql_select("*", "spip_breves", "id_rubrique=$id_rubrique", "", "date_heure DESC", "20"); $res = ''; while($row=sql_fetch($result)){ $id_breve=$row['id_breve']; if (autoriser('voir','breve',$id_breve)){ $titre = typo($row['titre']); $statut = $row['statut']; $h = generer_url_ecrire('breves_voir',"id_breve=$id_breve"); $res .= "<a class='$statut' href='javascript:window.parent.location=\"$h\"'>$titre</a>"; } } if ($res) { echo "\n<div style='padding-top: 6px;'><b class='verdana2'>"._T('info_breves_02')."</b></div>"; echo "\n<div class='plan-articles'>", $res, "</div>"; } $result=sql_select("*", "spip_syndic", "id_rubrique=$id_rubrique AND statut!='refuse'", "", "nom_site"); $res = ''; while($row=sql_fetch($result)){ $id_syndic=$row['id_syndic']; if (autoriser('voir','site',$id_syndic)){ $titre = typo($row['nom_site']); $statut = $row['statut']; $h = generer_url_ecrire('sites',"id_syndic=$id_syndic"); $res .= "\n<div class='brouteur_icone_site'><b><a href='javascript:window.parent.location=\"$h\"'>$titre</a></b></div>"; } } if ($res) echo "\n<div style='padding-top: 6px;'><b class='verdana2'>"._T('icone_sites_references')."</b></div>", $res; } // en derniere colonne, afficher articles et breves if ($frame == 0 AND $id_rubrique==0) { $cpt = sql_fetsel('A.id_article', "spip_auteurs_articles AS A LEFT JOIN spip_articles AS L ON A.id_article = L.id_article", "L.statut = 'prepa' AND A.id_auteur=$connect_id_auteur", "A.id_article"); if ($cpt) { echo "\n<div class='brouteur_icone_article'><b class='verdana2'><a href='", generer_url_ecrire('brouteur_frame', "special=redac&frame=".($frame+1)."&effacer_suivant=oui$profile"), "' class='iframe' rel='",($frame+1),"'>", _T("info_cours_edition"),"</a></b></div>"; } $cpt = sql_countsel("spip_articles AS articles", "articles.statut = 'prop'"); if (!$cpt) $cpt = sql_countsel("spip_breves", "statut = 'prop'"); if ($cpt) echo "\n<div class='brouteur_icone_article'><b class='verdana2'><a href='", generer_url_ecrire('brouteur_frame', "special=valider&frame=".($frame+1)."&effacer_suivant=oui$profile"), "' class='iframe' rel='", ($frame+1)."'>", _T("info_articles_proposes"), " / "._T("info_breves_valider")."</a></b></div>"; } } } echo "</div>"; echo "</body></html>"; }
function exec_admin_plugin_dist($retour='') { if (!autoriser('configurer', 'plugins')) { include_spip('inc/minipres'); echo minipres(); } else { // on fait la verif du path avant tout, // et l'installation des qu'on est dans la colonne principale // si jamais la liste des plugins actifs change, il faut faire un refresh du hit // pour etre sur que les bons fichiers seront charges lors de l'install if (actualise_plugins_actifs()==-1 AND _request('actualise')<2){ include_spip('inc/headers'); redirige_par_entete(parametre_url(self(),'actualise',_request('actualise')+1,'&')); } if ($erreur_activation = isset($GLOBALS['meta']['plugin_erreur_activation'])){ $erreur_activation = $GLOBALS['meta']['plugin_erreur_activation']; // l'effacement reel de la meta se fera au moment de l'affichage // mais on la vide pour ne pas l'afficher dans le bandeau haut unset($GLOBALS['meta']['plugin_erreur_activation']); } $format = ''; if (_request('format')!==NULL) $format = _request('format'); // liste ou repertoires $commencer_page = charger_fonction('commencer_page', 'inc'); echo $commencer_page(_T('icone_admin_plugin'), "configuration", "plugin"); echo "<br />\n"; echo "<br />\n"; $quoi = _request('voir'); $quoi = $quoi ? $quoi : 'actifs'; echo gros_titre(_T('icone_admin_plugin'),'',false); echo barre_onglets("plugins", $quoi=='actifs'?"plugins_actifs":"admin_plugin"); echo debut_gauche('plugin',true); echo debut_boite_info(true); $s = ""; $s .= _T('info_gauche_admin_tech'); echo $s; echo fin_boite_info(true); // la valeur de retour de la fonction ci-dessus n'est pas compatible // avec ce que fait actualise_plugins_actifs, il faut recalculer. A revoir. $lcpa = liste_chemin_plugin_actifs(); echo pipeline('affiche_gauche', array( 'args'=>array('exec'=>'admin_plugin'), 'data'=>afficher_librairies() ) ); echo debut_droite('plugin', true); // message d'erreur au retour d'un operation if (_request('erreur')){ echo "<div class='erreur_message-plugins'>" . _T(_request('erreur')) . "</div>"; } if ($erreur_activation){ echo "<div class='erreur_message-plugins'>" . $erreur_activation . "</div>"; effacer_meta('plugin_erreur_activation'); } // on fait l'installation ici, // cela permet aux scripts d'install de faire des affichages (moches...) installe_plugins(); $lpf = liste_plugin_files(); $plugins_interessants = @array_keys(unserialize($GLOBALS['meta']['plugins_interessants'])); if (!is_array($plugins_interessants)) $plugins_interessants = array(); echo "<div class='liste-plugins formulaire_spip'>"; echo debut_cadre_trait_couleur('plugin-24.gif',true,'',_T('plugins_liste'), 'plugins'); if ($quoi!=='actifs'){ if ($lpf) echo "<p>"._T('texte_presente_plugin')."</p>"; else { if (!@is_dir(_DIR_PLUGINS)) echo "<p>"._T('plugin_info_automatique_ftp',array('rep'=>joli_repertoire(_DIR_PLUGINS))) . " — "._T('plugin_info_automatique_creer')."</p>"; } } if ($quoi=='actifs' OR $lpf) echo "<h3>".sinon( singulier_ou_pluriel(count($lcpa), 'plugins_actif_un', 'plugins_actifs', 'count'), _T('plugins_actif_aucun') )."</h3>"; $sub = "\n<div class='boutons'>" . "<input type='submit' class='submit save' value='"._T('bouton_enregistrer') ."' />" . "</div>"; $no_button = false; // la liste if ($quoi=='actifs'){ $aff = affiche_les_plugins($lcpa, $lcpa, $format); $no_button = !strlen($aff); $corps = $aff; } elseif ($quoi=='tous') $corps = affiche_les_plugins($lpf, $lcpa, $format); else { $dir_auto = substr(_DIR_PLUGINS_AUTO, strlen(_DIR_PLUGINS)); $lcpaffiche = array(); foreach ($lpf as $f) if (!strpos($f, '/') OR ($dir_auto AND substr($f, 0, strlen($dir_auto)) == $dir_auto) OR in_array($f, $lcpa) OR in_array($f, $plugins_interessants)) $lcpaffiche[] = $f; $corps = affiche_les_plugins($lcpaffiche, $lcpa, $format); } if (!$no_button) $corps .= "\n<br />" . $sub; echo redirige_action_post('activer_plugins','activer','admin_plugin','', $corps); echo fin_cadre_trait_couleur(true); if ($quoi=='actifs') echo affiche_les_extensions(liste_chemin_plugin_actifs(_DIR_EXTENSIONS)); echo "</div>"; echo http_script(" jQuery(function(){ jQuery('#plugins .boutons').hide(); jQuery('.plugins li.item a[rel=info]').click(function(){ var li = jQuery(this).parents('li').eq(0); var prefix = li.find('input.checkbox').attr('name'); if (!jQuery('div.details',li).html()) { jQuery('div.details',li).prepend(ajax_image_searching).load( jQuery(this).attr('href').replace(/admin_plugin|plugins/, 'info_plugin'), function(){ li.addClass('on'); } ); } else { if (jQuery('div.details',li).toggle().is(':visible')) li.addClass('on'); else li.removeClass('on'); } return false; }); jQuery('.plugins li.item input.checkbox').change(function(){ jQuery(this).parents('form').eq(0).find('.boutons').slideDown(); }); }); "); echo pipeline('affiche_milieu', array( 'args'=>array('exec'=>'admin_plugin'), 'data'=>'' ) ); echo fin_gauche(), fin_page(); } }
function exec_brouteur_dist() { global $spip_ecran, $spip_lang_left; $id_rubrique = intval(_request('id_rubrique')); if ($spip_ecran == "large") { $largeur_table = 974; $hauteur_table = 400; $nb_col = 4; } else { $largeur_table = 750; $hauteur_table = 300; $nb_col = 3; } $largeur_col = floor($largeur_table/$nb_col); $profile = ($GLOBALS['var_profile']) ? "&var_profile=1" : ''; $commencer_page = charger_fonction('commencer_page', 'inc'); echo $commencer_page(_T('titre_page_articles_tous'), "accueil", "tout-site", " hauteurFrame($nb_col);"); echo "\n<div> </div>"; echo debut_grand_cadre(true); $dest = array(); if ($id_rubrique) { $j = $nb_col; while ($id_rubrique > 0) { $row = sql_fetsel("id_parent", "spip_rubriques", "id_rubrique=$id_rubrique"); if ($row){ $j--; $dest[$j] = $id_rubrique; $id_rubrique =$row['id_parent']; } } $dest[$j-1] = 0; while (!$dest[1]) { for ($i = 0; $i < $nb_col; $i++) { $dest[$i] = $dest[$i+1]; } } if ($dest[0] > 0 AND $dest[$nb_col-2]) { $la_rubrique = intval($dest[0]); $row = sql_fetsel("id_parent", "spip_rubriques", "id_rubrique=$la_rubrique"); if ($row) $la_rubrique = $row['id_parent']; $compteur = 0; $ret = ''; while ($la_rubrique > 0) { $row = sql_fetsel("titre, id_parent", "spip_rubriques", "id_rubrique ='$la_rubrique'"); if ($row) { $compteur++; $titre = typo($row['titre']); $lien = $dest[$nb_col-$compteur-1]; if (!$la_rubrique=$row['id_parent']) $class = "brouteur_icone_secteur"; else $class = "brouteur_icone_rubrique"; $ret = "\n<div class='$class'><a href='" . generer_url_ecrire("brouteur","id_rubrique=$lien$profile") . "'>$titre</a></div>\n<div style='margin-$spip_lang_left: 28px;'>$ret</div>"; } } $lien = $dest[$nb_col-$compteur-2]; // Afficher la hierarchie pour "remonter" echo "<div style='text-align: $spip_lang_left;'>"; echo "<div id='brouteur_hierarchie'>"; // pour calculer hauteur de iframe echo "<div class='brouteur_icone_racine'><a href='", generer_url_ecrire("brouteur","id_rubrique=$lien$profile"), "'>", _T('info_racine_site'), "</a></div>", "\n<div style='margin-$spip_lang_left: 28px;'>$ret</div>", "</div>"; echo "</div>"; } } else { $dest[0] = '0'; } for ($i=0; $i < $nb_col; $i++) { echo "<iframe width='{$largeur_col}px' style='float:$spip_lang_left' id='iframe$i' name='iframe$i'", (" src='" . generer_url_ecrire('brouteur_frame',"frame=$i$profile&rubrique=".$dest[$i])), "' class='iframe-brouteur' height='", $hauteur_table, "'></iframe>"; } echo fin_grand_cadre(true); // fixer la hauteur du brouteur de maniere a remplir l'ecran // nota: code tire du plugin dimensions.js echo http_script("jQuery('iframe.iframe-brouteur').height( Math.max((window.innerHeight || jQuery.boxModel && document.documentElement.clientHeight || document.body.clientHeight || 0)-195,300) );\n"); echo fin_page(); }
function bloc_unique_script($num=1) { $num = ($num==='oui' || intval($num)>0)?1:0; return http_script("var blocs_replier_tout = $num;"); }
function bandeau_rubrique($id_rubrique, $titre_rubrique, $zdecal, $largeur, $image='') { global $spip_lang_left; static $zmax = 6; $nav = "<a href='" . generer_url_ecrire('naviguer', 'id_rubrique='.$id_rubrique) . "'\nclass='bandeau_rub$image' style='width: " . $largeur . "px;'>\n " . supprimer_tags(preg_replace(',[\x00-\x1f]+,', ' ', $titre_rubrique)) . "</a>\n"; // Limiter volontairement le nombre de sous-menus if (!(--$zmax)) { $zmax++; return "\n<div>$nav</div>"; } $arr_rub = extraire_article($id_rubrique, $GLOBALS['db_art_cache']); $i = sizeof($arr_rub); if (!$i) { $zmax++; return "\n<div>$nav</div>"; } $pxdecal = max(15, ceil($largeur/5)) . 'px'; $ret = http_script("// http://doc.spip.org/@bandeauHover // http://doc.spip.org/@bandeauHover function bandeauHover(r) { if (!$(r).is('.hovered')) $(r) .addClass('hovered') .children('.bandeau_rub') .css('visibility', 'visible') // bizarre .show() .end() .hover( function(){\$(this).children('.bandeau_rub').show();}, function(){\$(this).children('.bandeau_rub').hide();} ); };"); $ret .= "<div class='pos_r' style='z-index: " . $zdecal . ";' onmouseover=\"bandeauHover(this);\">" . '<div class="brt">' . $nav . "</div>\n<div class='bandeau_rub' style='top: 14px; $spip_lang_left: " . $pxdecal . "; z-index: " . ($zdecal+1) . "'><table cellspacing='0' cellpadding='0'><tr><td valign='top'>"; if ($nb_rub = count($arr_rub)) { $nb_col = min(10,max(1,ceil($nb_rub / 10))); $ret_ligne = max(4,ceil($nb_rub / $nb_col)); } $count_ligne = 0; foreach( $arr_rub as $id_rub => $titre_rub) { $count_ligne ++; if ($count_ligne > $ret_ligne) { $count_ligne = 0; $ret .= "</td>"; $ret .= '<td valign="top" style="border-left: 1px solid #cccccc;">'; } if (autoriser('voir','rubrique',$id_rub)){ $titre = supprimer_numero(typo($titre_rub)); $ret .= bandeau_rubrique($id_rub, $titre, $zdecal+$i, $largeur); $i--; } } $ret .= "</td></tr></table>\n"; $ret .= "</div></div>\n"; $zmax++; return $ret; }
function debut_admin($script, $action = '', $corps = '') { if (!$action || !(autoriser('webmestre') or autoriser('chargerftp'))) { include_spip('inc/minipres'); return minipres(); } else { $dir = dir_admin(); $signal = fichier_admin($script); if (@file_exists($dir . $signal)) { spip_log("Action admin: {$action}"); return ''; } include_spip('inc/minipres'); // Si on est un super-admin, un bouton de validation suffit // sauf dans les cas destroy if ((autoriser('webmestre') or $script === 'repair') and $script != 'delete_all') { if (_request('validation_admin') == $signal) { spip_log("Action super-admin: {$action}"); return ''; } $corps .= '<input type="hidden" name="validation_admin" value="' . $signal . '" />'; $suivant = _T('bouton_valider'); $js = ''; } else { // cet appel permet d'assurer un copier-coller du nom du repertoire a creer dans tmp (esj) // l'insertion du script a cet endroit n'est pas xhtml licite mais evite de l'embarquer dans toutes les pages minipres $corps .= http_script('', "spip_barre.js"); $corps .= "<fieldset><legend>" . _T('info_authentification_ftp') . aide("ftp_auth") . "</legend>\n<label for='fichier'>" . _T('info_creer_repertoire') . "</label>\n" . "<span id='signal' class='formo'>" . $signal . "</span>" . "<input type='hidden' id='fichier' name='fichier' value='" . $signal . "' />" . _T('info_creer_repertoire_2', array('repertoire' => joli_repertoire($dir))) . "</fieldset>"; $suivant = _T('bouton_recharger_page'); // code volontairement tordu: // provoquer la copie dans le presse papier du nom du repertoire // en remettant a vide le champ pour que ca marche aussi en cas // de JavaScript inactif. $js = " onload='var range=document.createRange(); var signal = document.getElementById(\"signal\"); var userSelection = window.getSelection(); range.setStart(signal,0); range.setEnd(signal,1); userSelection.addRange(range);'"; } // admin/xxx correspond // a exec/base_xxx de preference // et exec/xxx sinon (compat) if (tester_url_ecrire("base_{$script}")) { $script = "base_{$script}"; } $form = copy_request($script, $corps, $suivant); $info_action = _T('info_action', array('action' => "{$action}")); return minipres($info_action, $form, $js); } }
function install_connexion_form($db, $login, $pass, $predef, $hidden, $etape, $jquery = true) { $server_db = is_string($predef[0]) ? $predef[0] : ''; return generer_form_ecrire('install', "\n<input type='hidden' name='etape' value='{$etape}' />" . $hidden . (_request('echec') ? "<p><b>" . _T('avis_connexion_echec_1') . "</b></p><p>" . _T('avis_connexion_echec_2') . "</p><p style='font-size: small;'>" . _T('avis_connexion_echec_3') . "</p>" : "") . ($jquery ? http_script('', 'jquery.js') : '') . http_script(' $(document).ready(function() { $("input[type=hidden][name=server_db]").each(function(){ if ($(this).attr("value").match("sqlite*")){ $("#install_adresse_base_hebergeur,#install_login_base_hebergeur,#install_pass_base_hebergeur").hide(); } }); if ($("#sql_serveur_db").length) { if ($("#sql_serveur_db").attr("value").match("sqlite*")) $("#install_adresse_base_hebergeur,#install_login_base_hebergeur,#install_pass_base_hebergeur").hide(); else $("#install_adresse_base_hebergeur,#install_login_base_hebergeur,#install_pass_base_hebergeur").show(); $("#sql_serveur_db").change(function(){ if ($(this).find("option:selected").attr("value").match("sqlite*")) $("#install_adresse_base_hebergeur,#install_login_base_hebergeur,#install_pass_base_hebergeur").hide(); else $("#install_adresse_base_hebergeur,#install_login_base_hebergeur,#install_pass_base_hebergeur").show(); }); } });') . ($server_db ? '<input type="hidden" name="server_db" value="' . $server_db . '" />' . ($predef[0] ? '<h3>' . _T('install_serveur_hebergeur') . '</h3>' : '') : '<fieldset><legend>' . _T('install_select_type_db') . "</legend>" . '<label for="sql_serveur_db" class="p">' . _T('install_types_db_connus') . "<br /><small>(" . _T('install_types_db_connus_avertissement') . ')</small>' . '</label>' . "\n<div class='p center'><select name='server_db' id='sql_serveur_db' >\n" . join("\n", install_select_serveur()) . "\n</select></div></fieldset>") . '<div id="install_adresse_base_hebergeur">' . '<p>' . _T('texte_connexion_mysql') . '</p>' . ($predef[1] ? '<h3>' . _T('install_adresse_base_hebergeur') . '</h3>' : fieldset(_T('entree_base_donnee_1'), array('adresse_db' => array('label' => $db[1], 'valeur' => $db[0])))) . '</div>' . '<div id="install_login_base_hebergeur">' . ($predef[2] ? '<h3>' . _T('install_login_base_hebergeur') . '</h3>' : fieldset(_T('entree_login_connexion_1'), array('login_db' => array('label' => $login[1], 'valeur' => $login[0])))) . '</div>' . '<div id="install_pass_base_hebergeur">' . ($predef[3] ? '<h3>' . _T('install_pass_base_hebergeur') . '</h3>' : fieldset(_T('entree_mot_passe_1'), array('pass_db' => array('label' => $pass[1], 'valeur' => $pass[0])))) . '</div>' . bouton_suivant()); }
function legender_auteur_voir($auteur) { global $spip_lang_right; $res = ""; $id_auteur = $auteur['id_auteur']; // Bouton "modifier" ? if (autoriser('modifier', 'auteur', $id_auteur)) { $res .= "<span id='bouton_modifier_auteur'>"; if (_request('edit') == 'oui') { $clic = _T('icone_retour'); $retour = _T('admin_modifier_auteur'); } else { $clic = _T('admin_modifier_auteur'); $retour = _T('icone_retour'); } $h = generer_url_ecrire("auteur_infos","id_auteur=$id_auteur&edit=oui"); $h = "<a\nhref='$h'>$clic</a>"; $res .= icone_inline($clic, $h, "redacteurs-24.gif", "edit.gif", $spip_lang_right); $res .= http_script(" var intitule_bouton = "._q($retour)."; jQuery('#bouton_modifier_auteur a') .click(function() { jQuery('#auteur_infos_edit') .toggle(); jQuery('#auteur-voir') .toggle(); return false; });"); $res .= "</span>\n"; } $res .= gros_titre( sinon($auteur['nom'],_T('item_nouvel_auteur')), '',false); $res .= "<div class='nettoyeur'></div>"; $contenu_auteur = ""; if (strlen($auteur['email'])) $contenu_auteur .= "<div>"._T('email_2') ." <b><a href='mailto:".htmlspecialchars($auteur['email'])."'>" .$auteur['email']."</a></b></div>"; // message d'information d'envoi d'email pour modif et de confirmation // on ne fait ici qu'informer, sans aucune action if ($email = _request('email_confirm')){ $contenu_auteur .= "<p><strong>"._T('form_auteur_envoi_mail_confirmation',array('email'=>$email))."</strong></p>"; } elseif (_request('email_modif')==='ok'){ $contenu_auteur .= "<p><strong>"._T('form_auteur_email_modifie')."</strong></p>"; } if ($auteur['url_site']) { if (!$auteur['nom_site']) $auteur['nom_site'] = _T('info_site'); $contenu_auteur .= propre(_T('info_site_2')." [{{".$auteur['nom_site']."}}->".$auteur['url_site']."]"); } if (strlen($auteur['bio'])) { $contenu_auteur .= propre("<quote>".$auteur['bio']."</quote>"); } if (strlen($auteur['pgp'])) { $contenu_auteur .= propre("PGP: <cadre>".$auteur['pgp']."</cadre>"); } $contexte = array('id'=>$id_auteur); // permettre aux plugin de faire des modifs ou des ajouts $contenu_auteur = pipeline('afficher_contenu_objet', array( 'args'=>array( 'type'=>'auteur', 'id_objet'=>$id_auteur, 'contexte'=>$contexte ), 'data'=> $contenu_auteur ) ); $res .= "<div id='auteur_infos_voir'>$contenu_auteur</div>\n"; return $res; }
function affiche_raccourci_doc($doc, $id, $align) { static $num = 0; if ($align) { $pipe = "|$align"; if ($GLOBALS['browser_barre']) $onclick = "\nondblclick=\"barre_inserer('\\x3C$doc$id$pipe>', $('textarea[name=texte]')[0]);\"\ntitle=\"". str_replace('&', '&', entites_html(_T('double_clic_inserer_doc')))."\""; } else { $align='center'; } return ((++$num > 1) ? "" : http_script('', "spip_barre.js")) . "\n<div style='text-align: $align'$onclick><$doc$id$pipe></div>\n"; }
function debusquer_entete($titre, $corps) { global $debug_objets; include_spip('balise/formulaire_admin'); include_spip('public/assembler'); // pour inclure_balise_dynamique include_spip('inc/texte'); // pour corriger_typo return _DOCTYPE_ECRIRE . html_lang_attributes() . "<head>\n<title>" . ('SPIP ' . $GLOBALS['spip_version_affichee'] . ' ' . _T('admin_debug') . ' ' . $titre . ' (' . supprimer_tags(corriger_typo($GLOBALS['meta']['nom_site']))) . ")</title>\n" . "<meta http-equiv='Content-Type' content='text/html" . (($c = $GLOBALS['meta']['charset']) ? "; charset={$c}" : '') . "' />\n" . http_script('', 'jquery.js') . "<link rel='stylesheet' href='" . url_absolue(find_in_path('spip_admin.css')) . "' type='text/css' />" . "</head>\n" . "<body style='margin:0 10px;'>\n" . "<div id='spip-debug-header'>" . $corps . inclure_balise_dynamique(balise_FORMULAIRE_ADMIN_dyn('spip-admin-float', $debug_objets), false) . '</div></body></html>'; }
function interface_plugins_auto($retour) { $res = "<div class='verdana2'>"; if ($retour) { $res .= "<div>$retour</div>\n"; } $liste = liste_plugins_distants(); $message .= '<div class="explication">'._T('plugin_zip_adresse') . '<br />'._T('plugin_info_automatique_exemples').'<ul class="spip">'; $les_urls = array('http://plugins.spip.net/rss-+-selection-2-1-+','http://www.spip-contrib.net/?page=rss-plugins-spip-2-1'); if (isset($GLOBALS['chargeur_urls_rss']) AND is_array($GLOBALS['chargeur_urls_rss'])) $les_urls = array_merge($les_urls,$GLOBALS['chargeur_urls_rss']); foreach($les_urls as $url) $message .= "<li><a href='$url' onclick=\"jQuery('#url_zip_plugin2').attr('value',jQuery(this).html()).focus();return false;\">" .$url ."</a></li>"; $message .= "</ul></div>"; $form = ""; $form .= "<ul><li class='editer_url_zip_plugin2 obligatoire'>"; $form .= "<label for='url_zip_plugin2'>"._T('plugin_zip_adresse_champ')."</label>"; $form .= $message; $form .= " <input type='text' class='text' id='url_zip_plugin2' name='url_zip_plugin2' value='' size='40' />"; $form .= "</li></ul>"; $form .= "<div class='boutons' id='loadrss'><input type='submit' value='" . _T('bouton_valider') . "'/>\n" . "</div>\n"; $form = redirige_action_post('charger_plugin', '', // arg = 'plugins' / 'lib', a priori '', '', $form); $res .= "<div class='formulaire_spip formulaire_editer'>"; $res .= $form; $res .= "</div>\n"; $res .= "</div>\n"; $res .= afficher_liste_listes_plugins(); if ($liste) { $res .= afficher_liste_plugins_distants($liste); $menu = array(); $compte = 0; $res .= http_script(" jQuery(function(){ jQuery('.plugins li.item a[rel=info]').click(function(){ var li = jQuery(this).parents('li').eq(0); if (!jQuery('div.details',li).html()) { jQuery('div.details',li).prepend(ajax_image_searching).load( jQuery(this).attr('href').replace(/admin_plugin|plugins|charger_plugin/, 'info_plugin_distant'), {}, function(){ li.addClass('on'); } ); } else { if (jQuery('div.details',li).toggle().is(':visible')) li.addClass('on'); else li.removeClass('on'); } return false; }); }); "); } return $res; }
/** * Affichage spécifique de la page de gestion des plugins * * Affiche la liste des plugins demandés et les erreurs éventuelles. * * @uses plugin_donne_erreurs() * @uses liste_chemin_plugin() * @uses plugin_installes_meta() * @uses affiche_les_plugins_verrouilles() * * @pipeline_appel affiche_gauche * @pipeline_appel affiche_droit * @pipeline_appel affiche_milieu * * @param string $quoi * Quels plugins afficher ? actifs, ou autre * @param string $erreur * Erreur éventuelle à afficher * @param string $format * Format d'affichage (liste ou arborescence) **/ function admin_plug_args($quoi, $erreur, $format) { if (!$quoi) { $quoi = 'actifs'; } // empecher l'affichage des erreurs dans le bandeau, on le donne ensuite // format brut par plugin $GLOBALS['erreurs_activation_raw'] = plugin_donne_erreurs(true, false); // format resume mis en forme $erreur_activation = plugin_donne_erreurs(); $commencer_page = charger_fonction('commencer_page', 'inc'); echo $commencer_page(_T('icone_admin_plugin'), "configuration", "plugin"); echo debut_gauche('plugin', true); echo recuperer_fond('prive/squelettes/navigation/configurer', array('exec' => 'admin_plugin')); echo pipeline('affiche_gauche', array('args' => array('exec' => 'admin_plugin'), 'data' => afficher_librairies())); echo debut_droite('plugin', true); echo gros_titre(_T('icone_admin_plugin'), '', false); // Barre d'onglets de premier niveau echo barre_onglets("plugins", "plugins_actifs"); // Barre d'onglets de second niveau $onglet2 = $quoi == 'actifs' ? 'plugins_actifs' : 'admin_plugin'; echo debut_onglet('onglets_simple second'); echo onglet(_T('plugins_tous_liste'), generer_url_ecrire("admin_plugin", "voir=tous"), 'admin_plugin', $onglet2); echo onglet(_T('plugins_actifs_liste'), generer_url_ecrire("admin_plugin"), 'plugins_actifs', $onglet2); echo fin_onglet(); // message d'erreur au retour d'une operation if ($erreur) { echo "<div class='error'>{$erreur}</div>"; } if ($erreur_activation) { echo "<div class='error'>{$erreur_activation}</div>"; } // la mise a jour de cette meta a ete faite par ecrire_plugin_actifs $actifs = unserialize($GLOBALS['meta']['plugin']); $lcpa = $actifs + unserialize($GLOBALS['meta']['plugin_attente']); // Les affichages se basent sur le repertoire, pas sur le nom $actifs = liste_chemin_plugin($actifs, ''); if (defined('_DIR_PLUGINS_SUPPL')) { $lcpas = liste_chemin_plugin($lcpa, _DIR_PLUGINS_SUPPL); } $lcpa = liste_chemin_plugin($lcpa); // on installe les plugins maintenant, // cela permet aux scripts d'install de faire des affichages (moches...) plugin_installes_meta(); echo "<div class='liste-plugins formulaire_spip'>"; echo debut_cadre_trait_couleur('plugin-24.png', true, '', _T('plugins_liste'), 'plugins'); if ($quoi !== 'actifs') { $lpf = liste_plugin_files(); if ($lpf) { echo "<p>" . _T('texte_presente_plugin') . "</p>"; } else { if (!@is_dir(_DIR_PLUGINS)) { echo "<p>" . _T('plugin_info_automatique_ftp', array('rep' => joli_repertoire(_DIR_PLUGINS))) . " — " . _T('plugin_info_automatique_creer') . "</p>"; } } $lcpaffiche = $lpf; if (defined('_DIR_PLUGINS_SUPPL')) { $lcpaffichesup = liste_plugin_files(_DIR_PLUGINS_SUPPL); } } else { // la liste // $quoi=='actifs' $lcpaffiche = $lcpa; if (defined('_DIR_PLUGINS_SUPPL')) { $lcpaffichesup = $lcpas; } } if ($quoi == 'actifs' or $lpf) { $nb = count($lcpa); if (defined('_DIR_PLUGINS_SUPPL')) { $nb += count($lcpas); } echo "<h3>" . sinon(singulier_ou_pluriel($nb, 'plugins_actif_un', 'plugins_actifs', 'count'), _T('plugins_actif_aucun')) . "</h3>"; } if (empty($format)) { $format = 'liste'; } elseif (!in_array($format, array('liste', 'repertoires'))) { $format = 'repertoires'; } $afficher = charger_fonction("afficher_{$format}", 'plugins'); $corps = $afficher(self(), $lcpaffiche, $lcpa, $actifs); if (defined('_DIR_PLUGINS_SUPPL')) { $corps .= $afficher(self(), $lcpaffichesup, $lcpas, $actifs, _DIR_PLUGINS_SUPPL); } if ($corps) { $corps .= "\n<div class='boutons' style='display:none;'>" . "<input type='submit' class='submit save' value='" . _T('bouton_enregistrer') . "' />" . "</div>"; } echo redirige_action_post('activer_plugins', 'activer', 'admin_plugin', '', $corps); echo fin_cadre_trait_couleur(true); if ($quoi == 'actifs') { echo affiche_les_plugins_verrouilles($actifs); } echo "</div>"; echo http_script("\n\tjQuery(function(){\n\t\tjQuery('.plugins li.item a[rel=info]').click(function(){\n\t\t\tvar li = jQuery(this).parents('li').eq(0);\n\t\t\tvar prefix = li.find('input.checkbox').attr('name');\n\t\t\tif (!jQuery('div.details',li).html()) {\n\t\t\t\tjQuery('div.details',li).prepend(ajax_image_searching).load(\n\t\t\t\t\tjQuery(this).attr('href').replace(/admin_plugin|plugins/, 'info_plugin'), function(){\n\t\t\t\t\t\tli.addClass('on');\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (jQuery('div.details',li).toggle().is(':visible'))\n\t\t\t\t\tli.addClass('on');\n\t\t\t\telse\n\t\t\t\t\tli.removeClass('on');\n\t\t\t}\n\t\t\treturn false;\n\t\t});\n\t\tjQuery('.plugins li.item input.checkbox').change(function(){\n\t\t\tjQuery(this).parents('form').eq(0).find('.boutons').slideDown();\n\t\t});\n\t});\n\t"); echo pipeline('affiche_milieu', array('args' => array('exec' => 'admin_plugin'), 'data' => '')); echo fin_gauche(), fin_page(); }
function debut_javascript($fin='') { global $spip_lang_left, $browser_name, $browser_version; include_spip('inc/charsets'); // tester les capacites JS : // On envoie un script ajah ; si le script reussit le cookie passera a +1 // on installe egalement un <noscript></noscript> qui charge une image qui // pose un cookie valant -1 $testeur = str_replace('&', '\\x26', generer_url_ecrire('test_ajax', 'js=1')); if (_SPIP_AJAX AND !defined('_TESTER_NOSCRIPT')) { // pour le pied de page (deja defini si on est validation XML) define('_TESTER_NOSCRIPT', "<noscript>\n<div style='display:none;'><img src='" . generer_url_ecrire('test_ajax', 'js=-1') . "' width='1' height='1' alt='' /></div></noscript>\n"); } if (!defined('_LARGEUR_ICONES_BANDEAU')) include_spip('inc/bandeau'); $inline = ((isset($_COOKIE['spip_accepte_ajax']) && $_COOKIE['spip_accepte_ajax'] >= 1) ? '' : "jQuery.ajax({'url':'$testeur'});") . (_OUTILS_DEVELOPPEURS ?"var _OUTILS_DEVELOPPEURS=true;":"") . "\nvar ajax_image_searching = \n'<img src=\"".url_absolue(chemin_image("searching.gif"))."\" alt=\"\" />';" . "\nvar stat = " . (($GLOBALS['meta']["activer_statistiques"] != 'non') ? 1 : 0) . "\nvar largeur_icone = " . intval(_LARGEUR_ICONES_BANDEAU) . "\nvar bug_offsetwidth = " . // uniquement affichage ltr: bug Mozilla dans offsetWidth quand ecran inverse! ((($spip_lang_left == "left") && (($browser_name != "MSIE") || ($browser_version >= 6))) ? 1 : 0) . "\nvar confirm_changer_statut = '" . unicode_to_javascript(addslashes(html2unicode(_T("confirm_changer_statut")))) . "';\n"; return // envoi le fichier JS de config si browser ok. $GLOBALS['browser_layer'] . //plugin needed to fix the select showing through the submenus o IE6 (($browser_name == "MSIE" && $browser_version <= 6) ? http_script('', 'bgiframe.js'):'' ) . http_script('', 'presentation.js') . http_script('', 'gadgets.js') . http_script($inline . $fin); }
function aide_menu($aide) { $contenu = aide_contenu(); preg_match_all(_SECTIONS_AIDE, $contenu, $sections, PREG_SET_ORDER); return $sections; global $spip_lang; $afficher = false; $ligne = $numrub = 0; $texte = $res = ''; foreach ($sections as $section) { list(, $prof, $sujet, $bloc) = $section; if ($prof == '1') { if ($afficher && $texte) { $res .= block_parfois_visible("block{$numrub}", "<div class='rubrique'>{$titre}</div>", "\n{$texte}", '', $ouvrir); } $afficher = $bloc ? $bloc == 'redac' : true; $texte = ''; if ($afficher) { $numrub++; $ouvrir = 0; $titre = $sujet; } } else { ++$ligne; $id = "ligne{$ligne}"; if ($aide == $sujet) { $ouvrir = 1; $class = "article-actif"; $texte .= http_script("curr_article = '{$id}';"); } else { $class = "article-inactif"; } $h = generer_url_aide("aide={$sujet}&frame=body&var_lang={$spip_lang}"); $texte .= "<a class='{$class}' target='droite' id='{$id}' href='{$h}' onclick=\"activer_article('{$id}');return true;\">" . $bloc . "</a><br style='clear:both;' />\n"; } } if ($afficher && $texte) { $res .= block_parfois_visible("block{$numrub}", "<div class='rubrique'>{$titre}</div>", "\n{$texte}", '', $ouvrir); } return $res; }
function verif_butineur() { global $browser_name, $browser_version; global $browser_description, $browser_rev, $browser_layer, $browser_barre; preg_match(",^([A-Za-z]+)/([0-9]+\.[0-9]+) (.*)$,", $_SERVER['HTTP_USER_AGENT'], $match); $browser_name = $match[1]; $browser_version = $match[2]; $browser_description = $match[3]; $browser_layer = ''; $browser_barre = ''; if (!preg_match(",opera,i", $browser_description)&&preg_match(",opera,i", $browser_name)) { $browser_name = "Opera"; $browser_version = $match[2]; $browser_layer = (($browser_version < 7) ? '' : http_script('', 'layer.js','')); $browser_barre = ($browser_version >= 8.5); } else if (preg_match(",opera,i", $browser_description)) { preg_match(",Opera ([^\ ]*),i", $browser_description, $match); $browser_name = "Opera"; $browser_version = $match[1]; $browser_layer = (($browser_version < 7) ? '' : http_script('', 'layer.js','')); $browser_barre = ($browser_version >= 8.5); } else if (preg_match(",msie,i", $browser_description)) { preg_match(",MSIE ([^;]*),i", $browser_description, $match); $browser_name = "MSIE"; $browser_version = $match[1]; $browser_layer = (($browser_version < 5) ? '' : http_script('', 'layer.js','')); $browser_barre = ($browser_version >= 5.5); } else if (preg_match(",KHTML,i", $browser_description) && preg_match(",Safari/([^;]*),", $browser_description, $match)) { $browser_name = "Safari"; $browser_version = $match[1]; $browser_layer = http_script('', 'layer.js',''); $browser_barre = ($browser_version >= 5.0); } else if (preg_match(",mozilla,i", $browser_name) AND $browser_version >= 5) { $browser_layer = http_script('', 'layer.js',''); // Numero de version pour Mozilla "authentique" if (preg_match(",rv:([0-9]+\.[0-9]+),", $browser_description, $match)) $browser_rev = doubleval($match[1]); // Autres Gecko => equivalents 1.4 par defaut (Galeon, etc.) else if (strpos($browser_description, "Gecko") and !strpos($browser_description, "KHTML")) $browser_rev = 1.4; // Machins quelconques => equivalents 1.0 par defaut (Konqueror, etc.) else $browser_rev = 1.0; $browser_barre = $browser_rev >= 1.3; } if (!$browser_name) $browser_name = "Mozilla"; }