示例#1
0
function fin_page()
{
	global $spip_display;

	return debut_grand_cadre(true)
	. (($spip_display == 4)
		? ("<div><a href='"
		   . generer_action_auteur('preferer','display:2', self('&'))
			. "'>"
			.  _T("access_interface_graphique")
			. "</a></div>")
		: ("<div style='text-align: right; ' class='verdana1 spip_xx-small'>"
			. info_copyright()
			. "<br />"
			. info_maj_spip()
			. _T('info_copyright_doc',
				array('spipnet' => $GLOBALS['home_server']
					. '/' .    $GLOBALS['spip_lang']))
			. '</div>'))

	. fin_grand_cadre(true)
	. "</div>\n" // cf. div centered ouverte dans conmmencer_page()
	. $GLOBALS['rejoue_session']
	. '<div style="background-image: url(\''
	. generer_url_action('cron')
	. '\');"></div>'
	. (defined('_TESTER_NOSCRIPT') ? _TESTER_NOSCRIPT : '')
	. "</body></html>\n";
}
示例#2
0
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 &eacute;coul&eacute; : [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']). '&nbsp;(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 = '&nbsp;';
		$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 = '&nbsp;';
		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').'">&#63;</acronym></center>';
		if(strlen($zip_log)) {
			if (!$stop)
				$nom .= "\n_ "._T('couteau:maj_verif') . "\n_ $zip_log\n_ {$bouton}[->$infos[zip_trac]]<label>";
			$bouton = '&nbsp;';
		}
		${$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);
}