function calcul_version_squelette()
{
    $version = null;
    if (lire_fichier(_DIR_PLUGIN_AHUNTSIC . '/plugin.xml', $contenu) && preg_match('/<version>(.*?)<\\/version>/', $contenu, $match)) {
        $version .= trim($match[1]);
    }
    $revision = version_svn_courante(_DIR_PLUGIN_AHUNTSIC);
    if ($revision > 0) {
        $version .= ' [' . strval($revision) . ']';
    } elseif ($revision < 0) {
        $version .= ' [' . strval(abs($revision)) . '&nbsp;<strong>svn</strong>]';
    }
    return $version;
}
function calcul_version_squelette()
{
    $version = NULL;
    $informer = chercher_filtre('info_plugin');
    $version = $informer('sarkaspip', 'version');
    $revision = version_svn_courante(_DIR_PLUGIN_SARKASPIP);
    if ($revision > 0) {
        $version .= ' [' . strval($revision) . ']';
    } else {
        if ($revision < 0) {
            $version .= ' SVN&nbsp;[' . strval(abs($revision)) . ']';
        }
    }
    return $version;
}
Example #3
0
function spip_version()
{
    $version = $GLOBALS['spip_version_affichee'];
    if ($svn_revision = version_svn_courante(_DIR_RACINE)) {
        $version .= ($svn_revision < 0 ? ' SVN' : '') . ' [' . abs($svn_revision) . ']';
    }
    return $version;
}
Example #4
0
function affiche_bloc_plugin($plug_file, $info, $dir_plugins = null)
{
    if (!$dir_plugins) {
        $dir_plugins = _DIR_PLUGINS;
    }
    $prefix = $info['prefix'];
    $dir = "{$dir_plugins}{$plug_file}/lang/paquet-{$prefix}";
    $s = "";
    // TODO: le traiter_multi ici n'est pas beau
    // cf. description du plugin/_stable_/ortho/plugin.xml
    $description = "";
    if (isset($info['description'])) {
        $description = plugin_propre($info['description'], $dir);
    }
    if (isset($info['documentation']) and $lien = $info['documentation']) {
        $description .= "<p><em class='site'><a href='{$lien}' class='spip_out'>" . _T('en_savoir_plus') . '</a></em></p>';
    }
    $s .= "<dd class='desc'>" . $description . "</dd>\n";
    if (isset($info['auteur'])) {
        if (is_array($info['auteur'])) {
            $a = formater_credits($info['auteur'], ', ');
        } else {
            $a = trim($info['auteur']);
        }
        if ($a) {
            $s .= "<dt class='auteurs'>" . _T('public:par_auteur') . "</dt><dd class='auteurs'>" . PtoBR(propre($a, $dir)) . "</dd>\n";
        }
    }
    if (isset($info['credit'])) {
        if ($a = formater_credits($info['credit'], ', ')) {
            $s .= "<dt class='credits'>" . _T('plugin_info_credit') . "</dt><dd class='credits'>" . PtoBR(propre($a, $dir)) . "</dd>\n";
        }
    }
    if (isset($info['licence'])) {
        if (is_array($info['licence'])) {
            $a = formater_credits($info['licence'], ', ');
        } else {
            $a = trim($info['licence']);
        }
        if ($a) {
            $s .= "<dt class='licence'>" . _T('intitule_licence') . "</dt><dd class='licence'>" . PtoBR(propre($a, $dir)) . "</dd>\n";
        }
    }
    $s = "<dl class='description'>{$s}</dl>";
    //
    // Ajouter les infos techniques
    //
    $infotech = array();
    $version = "<dt>" . _T('version') . "</dt><dd>" . $info['version'];
    // Version SVN
    if ($svn_revision = version_svn_courante($dir_plugins . $plug_file)) {
        $version .= ($svn_revision < 0 ? ' SVN' : '') . ' [' . abs($svn_revision) . ']';
    }
    $version .= "</dd>";
    $infotech[] = $version;
    $infotech[] = "<dt>" . _T('repertoire_plugins') . "</dt><dd>" . joli_repertoire("{$dir_plugins}{$plug_file}") . "</dd>";
    // source zip le cas echeant
    $infotech[] = (lire_fichier($dir_plugins . $plug_file . '/install.log', $log) and preg_match(',^source:(.*)$,m', $log, $r)) ? '<dt>' . _T('plugin_source') . '</dt><dd>' . trim($r[1]) . "</dd>" : '';
    $infotech[] = !$info['necessite'] ? '' : '<dt>' . _T('plugin_info_necessite') . '</dt><dd>' . join(' ', array_map('array_shift', $info['necessite'])) . '</dd>';
    $s .= "<dl class='tech'>" . join('', $infotech) . "</dl>";
    return $s;
}
Example #5
0
function info_copyright()
{
    global $spip_version_affichee, $spip_lang;
    $version = $spip_version_affichee;
    //
    // Mention, le cas echeant, de la revision SVN courante
    //
    if ($svn_revision = version_svn_courante(_DIR_RACINE)) {
        $version .= ' ' . ($svn_revision < 0 ? 'SVN ' : '') . "[<a href='http://core.spip.net/projects/spip/repository/revisions/" . abs($svn_revision) . "' onclick=\"window.open(this.href); return false;\">" . abs($svn_revision) . "</a>]";
    }
    // et la version de l'ecran de securite
    $secu = defined('_ECRAN_SECURITE') ? "<br />" . _T('ecran_securite', array('version' => _ECRAN_SECURITE)) : '';
    return _T('info_copyright', array('spip' => "<b>SPIP {$version}</b> ", 'lien_gpl' => "<a href='" . generer_url_ecrire("aide", "aide=licence&var_lang={$spip_lang}") . "' onclick=\"window.open(this.href, 'spip_aide', 'scrollbars=yes,resizable=yes,width=740,height=580'); return false;\">" . _T('info_copyright_gpl') . "</a>")) . $secu;
}
Example #6
0
function affiche_bloc_plugin($plug_file, $info, $dir_plugins=null) {
	if (!$dir_plugins)
		$dir_plugins = _DIR_PLUGINS;

	$s = "";
	// TODO: le traiter_multi ici n'est pas beau
	// cf. description du plugin/_stable_/ortho/plugin.xml
	if (isset($info['description']))
		$s .= "<div class='desc'>".plugin_propre($info['description']) . "</div>\n";

	if (isset($info['auteur']) AND trim($info['auteur']))
		$s .= "<div class='auteurs'>" . _T('public:par_auteur') .' '. plugin_propre($info['auteur']) . "</div>\n";
	if (isset($info['licence']))
		$s .= "<div class='licence'> - " . _T('intitule_licence') .' '. plugin_propre($info['licence']) . "</div>\n";

	if (trim($info['lien'])) {
		$lien = $info['lien'];
		if (!preg_match(',^https?://,iS', $lien))
			$lien = extraire_attribut(extraire_balise(propre($lien),'a'),'href');
		$s .= "<div class='site'><a href='$lien' class='spip_out'>" . _T('en_savoir_plus') .'</a></div>';
	}

	//
	// Ajouter les infos techniques
	//
	$infotech = array();

	$version = _T('version') .' '.  $info['version'];
	// Version SVN
	if ($svn_revision = version_svn_courante($dir_plugins.$plug_file))
		$version .= ($svn_revision<0 ? ' SVN':'').' ['.abs($svn_revision).']';
	$infotech[] = $version;

	// source zip le cas echeant
	$source = (lire_fichier($dir_plugins.$plug_file.'/install.log', $log)
	AND preg_match(',^source:(.*)$,m', $log, $r))
		? '<br />'._T('plugin_source').' '.trim($r[1])
		:'';

	$s .= "<div class='tech'>"
		. join(' &mdash; ', $infotech) .
		 '<br />' . _T('repertoire_plugins') .' '. $plug_file
		. $source
		."</div>";


	return $s;
}
Example #7
0
function ckversion($dum) {
	$v=abs(version_svn_courante(dirname(__FILE__)));
	return ($v?$v:'');
}
Example #8
0
function info_copyright() {
	global $spip_version_affichee, $spip_lang;

	$version = $spip_version_affichee;

	//
	// Mention, le cas echeant, de la revision SVN courante
	//
	if ($svn_revision = version_svn_courante(_DIR_RACINE)) {
		$version .= ' ' . (($svn_revision < 0) ? 'SVN ':'')
		. "[<a href='http://core.spip.org/trac/spip/changeset/"
		. abs($svn_revision) . "' onclick=\"window.open(this.href); return false;\">"
		. abs($svn_revision) . "</a>]";
	}

	return _T('info_copyright',
		   array('spip' => "<b>SPIP $version</b> ",
			 'lien_gpl' =>
			 "<a href='". generer_url_ecrire("aide_index", "aide=licence&var_lang=$spip_lang") . "' onclick=\"window.open(this.href, 'spip_aide', 'scrollbars=yes,resizable=yes,width=740,height=580'); return false;\">" . _T('info_copyright_gpl')."</a>"));

}
Example #9
0
function plugin_get_infos_maj($p, $timeout=false) {
	$get_infos = defined('_SPIP20100')?charger_fonction('get_infos','plugins'):'plugin_get_infos';
	$infos = $get_infos($p);
	// fichier svn.revision
	$ok = lire_fichier($svn_rev = _DIR_PLUGINS.$p.'/svn.revision', $svn);
	$lastmodified = @file_exists($svn_rev)?@filemtime($svn_rev):0;
	if($ok && preg_match(',<origine>(.+)</origine>,', $svn, $regs)) {
		$url_origine = str_replace(array(_MAJ_SVN_FILE, _MAJ_SVN_DEBUT), _MAJ_LOG_DEBUT, $regs[1]);
		// prise en compte du recent demenagement de la Zone...
		$url_origine = preg_replace(',/_plugins_/_(?:stable|dev|test)_/,','/_plugins_/', $url_origine);
	} else $url_origine = '';
	$infos['commit'] = ($ok && preg_match(',<commit>(.+)</commit>,', $svn, $regs))?$regs[1]:'';
	$rev_local = (strlen($svn) && preg_match(',<revision>(.+)</revision>,', $svn, $regs))
		?intval($regs[1]):version_svn_courante(_DIR_PLUGINS.$p);
	if($infos['svn'] = $rev_local<0) { 
		// fichier SVN
		if (lire_fichier(_DIR_PLUGINS.$p.'/.svn/entries', $svn) 
				&& preg_match(',(?:'.preg_quote(_MAJ_SVN_TRAC).'|'.preg_quote(_MAJ_SVN_DEBUT).')[^\n\r]+,ms', $svn, $regs)) {
			$url_origine = str_replace(array(_MAJ_SVN_TRAC,_MAJ_SVN_DEBUT), _MAJ_LOG_DEBUT, $regs[0]);
			// prise en compte du recent demenagement de la Zone...
			$url_origine = preg_replace(',/_plugins_/_(?:stable|dev|test)_/,','/_plugins_/', $url_origine);
		}
		//$infos['zip_trac'] = 'SVN';
	}
	$infos['url_origine'] = strlen($url_origine)?$url_origine._MAJ_LOG_FIN:'';
	$infos['rev_local'] = abs($rev_local);
	$infos['rev_rss'] = intval(maj_auto_rev_distante($infos['url_origine'], $timeout, ', \[(\d+)\],', $lastmodified));
	$infos['maj_dispo'] = $infos['rev_rss']>0 && $infos['rev_local']>0 && $infos['rev_rss']>$infos['rev_local'];
	// fichiers zip
	$infos['zip_log'] = $infos['zip_trac'] = '';
	$p2 = preg_match(',^auto/(.*)$,', $p, $regs)?$regs[1]:'';
	if(strlen($p2)) {
		// supposition du nom d'archive sur files.spip.org
		if(intval(maj_auto_rev_distante($f = _MAJ_ZIP.$p2.'.zip', $timeout))) $infos['zip_trac'] = $f;
		// nom de l'archive recemment installee par chargeur
		if(lire_fichier(sous_repertoire(_DIR_CACHE, 'chargeur').$p2.'/install.log', $log)
				&& preg_match(',[\n\r]source: *([^\n\r]+),msi', $log, $regs)
				&& intval(maj_auto_rev_distante($regs[1], $timeout)))
			$infos['zip_log'] = $regs[1];
		// au final on prend le bon
		if(!$infos['zip_trac']) $infos['zip_trac'] = $infos['zip_log'];
	}
	return $infos;
}
function spiplistes_current_svnrevision_get ($prefix, $verifier_svn) {
	static $svn_revision = false;
	if(!empty($prefix)) {
		// lire directement dans plugin.xml (eviter le cache ?)
		$dir_plugin = _DIR_PLUGINS.spiplistes_get_meta_dir($prefix);
		// cherche si sur version svn
		if(!$result = version_svn_courante($dir_plugin)) {
			// mefiance: il faut que svn/entries soit a jour (svn update sur le poste de travail/serveur !)
			// si pas de svn/entries, lire l'attribut dans plugin.xml
			$file = $dir_plugin."/"._FILE_PLUGIN_CONFIG;
			$result = spiplistes_svn_revision_read($file);
		}
		if($verifier_svn && !$svn_revision) {
			// verifier les fichiers inclus (gourmand et peut-etre trompeur si fichier fantome ?)
			// ne verifier que sur deux niveaux (PLUGIN_ROOT et ses repertoires directs, pas en dessous)
			define("_PGL_SVN_LIRE_EXTENSIONS", "css|html|js|php|xml");
			$script_files = array();
			if(is_dir($dir_plugin) && ($dh = opendir($dir_plugin))) {
				while (($file = readdir($dh)) !== false) {
					if($file[0] == ".") continue;
					if(is_dir($dir_plugin_sub = $dir_plugin."/".$file) && ($dh_s = opendir($dir_plugin_sub))) {
						while (($file = readdir($dh_s)) !== false) {
							if($file[0] == ".") continue;
							if(preg_match('=\.('._PGL_SVN_LIRE_EXTENSIONS.')$=i', $file)) {
								$script_files[] = $dir_plugin_sub."/".$file;
							}
						}
						closedir($dh_s);
					}
					else if(preg_match('=\.('._PGL_SVN_LIRE_EXTENSIONS.')$=i', $file)) {
						$script_files[] = $dir_plugin."/".$file;
					}
				}
				closedir($dh);
			}
			foreach($script_files as $file) {
				if(!$ii = spiplistes_svn_revision_read ($file)) {	continue; }
				$result = max($ii, $result);
			}
		}
		if(!empty($result) && (intval($result) > 0)) return($result);
	}
	return(false);
} // end spiplistes_current_svnrevision_get()
/**
 * Retourne les informations de copyright (version de SPIP, de l'écran de sécurité)
 * pour le pied de page de l'espace privé
 *
 * @return string Code HTML
 **/
function info_copyright()
{
    $version = $GLOBALS['spip_version_affichee'];
    //
    // Mention, le cas echeant, de la revision SVN courante
    //
    if ($svn_revision = version_svn_courante(_DIR_RACINE)) {
        $version .= ' ' . ($svn_revision < 0 ? 'SVN ' : '') . "[<a href='http://core.spip.net/projects/spip/repository/revisions/" . abs($svn_revision) . "' onclick=\"window.open(this.href); return false;\">" . abs($svn_revision) . "</a>]";
    }
    // et la version de l'ecran de securite
    $secu = defined('_ECRAN_SECURITE') ? "<br />" . _T('ecran_securite', array('version' => _ECRAN_SECURITE)) : '';
    return _T('info_copyright', array('spip' => "<b>SPIP {$version}</b> ", 'lien_gpl' => "<a href='" . generer_url_ecrire("aide", "aide=licence&var_lang=" . $GLOBALS['spip_lang']) . "' class=\"aide popin\">" . _T('info_copyright_gpl') . "</a>")) . $secu;
}