Exemple #1
0
function install_etape_sup1_dist()
{
	$adresse_db = _request('adresse_db');
	if (!$adresse_db AND defined('_INSTALL_HOST_DB'))
		$adresse_db =_INSTALL_HOST_DB;

	$login_db = _request('login_db');
	if (!$login_db AND defined('_INSTALL_USER_DB'))
		$login_db = _INSTALL_USER_DB;

	$pass_db = _request('pass_db');
	if (!$pass_db  AND defined('_INSTALL_PASS_DB'))
		$pass_db  = _INSTALL_PASS_DB;

	$server_db =_request('server_db');
	if (!$server_db AND  defined('_INSTALL_SERVER_DB'))
		$server_db = _INSTALL_SERVER_DB;

	// Ceci indique la base principale (passe en hidden)
	// pour qu'on la refuse comme choix de base secondaire

	$sel_db =_request('sel_db');
	if (!$sel_db AND  defined('_INSTALL_NAME_DB'))
		$sel_db = _INSTALL_NAME_DB;

	echo install_debut_html(_T('config_titre_base_sup'));

	$link = spip_connect_db($adresse_db, 0, $login_db, $pass_db, '', $server_db);
	$GLOBALS['connexions'][$server_db][$GLOBALS['spip_sql_version']]
	= $GLOBALS['spip_' . $server_db .'_functions_' . $GLOBALS['spip_sql_version']];

	if ($link) {
		$GLOBALS['connexions'][$server_db] = $link;

		echo '<div style="background-color: #eeeeee">';
		echo "\n<!--\n", join(', ', $link), " $login_db ";
		echo join(', ', $GLOBALS['connexions'][$server_db]);
		echo "\n-->\n<p class='resultat'><b>";
		echo _T('info_connexion_ok'),"</b></p>\n";
		echo '<!-- ',  sql_version($server_db), ' -->' ;
		$l = bases_referencees();
		array_push($l, $sel_db);
		list(, $res) = install_etape_liste_bases($server_db, $login_db, $l);

		$hidden = predef_ou_cache($adresse_db,$login_db,$pass_db, $server_db)
		  . (defined('_INSTALL_NAME_DB')
		     ? ''
		     : ("\n<input type='hidden' name='sel_db' value='$sel_db' />\n"));

		echo install_etape_sup1_form($hidden, '', $res, 'sup2');
		echo '</div>';
	} else  {
		echo info_etape(_T('info_connexion_base'));
		echo "<p class='resultat'><b>",
		  _T('avis_connexion_echec_1'),
		  "</b></p>";
	}

	echo install_fin_html();
}
Exemple #2
0
function exec_admin_repair_dist()
{
	$ok = false;
	if (!spip_connect())
		$message =  _T('titre_probleme_technique');
	else {
		$version_sql = sql_version();
		if (!$version_sql)
			$message = _T('avis_erreur_connexion_mysql');
		else {
			$s = $GLOBALS['connexions'][0]['type'];
		  
			if ($s == 'mysql'
			AND version_compare($version_sql,'3.23.14','<'))
			  $message = _T('avis_version_mysql', array('version_mysql' => " MySQL $version_sql"));
			else {
				$message = _T('texte_requetes_echouent');
				$ok = true;
			}
		}
		$action = _T('texte_tenter_reparation');
	}
	if ($ok) {
		$admin = charger_fonction('admin', 'inc');
		echo $admin('admin_repair', $action, $message, true);
	} else {
		include_spip('inc/minipres');
		echo minipres(_T('titre_reparation'), "<p>$message</p>");
	}
}
Exemple #3
0
function install_etape_2_dist()
{
    $adresse_db = defined('_INSTALL_HOST_DB') ? _INSTALL_HOST_DB : _request('adresse_db');
    if (preg_match(',(.*):(.*),', $adresse_db, $r)) {
        list(, $adresse_db, $port) = $r;
    } else {
        $port = '';
    }
    $login_db = defined('_INSTALL_USER_DB') ? _INSTALL_USER_DB : _request('login_db');
    $pass_db = defined('_INSTALL_PASS_DB') ? _INSTALL_PASS_DB : _request('pass_db');
    $server_db = defined('_INSTALL_SERVER_DB') ? _INSTALL_SERVER_DB : _request('server_db');
    $name_db = defined('_INSTALL_NAME_DB') ? _INSTALL_NAME_DB : '';
    $chmod = _request('chmod');
    $link = spip_connect_db($adresse_db, $port, $login_db, $pass_db, $name_db, $server_db);
    $GLOBALS['connexions'][$server_db] = $link;
    $GLOBALS['connexions'][$server_db][$GLOBALS['spip_sql_version']] = $GLOBALS['spip_' . $server_db . '_functions_' . $GLOBALS['spip_sql_version']];
    echo install_debut_html();
    // prenons toutes les dispositions possibles pour que rien ne s'affiche !
    /*
     * /!\ sqlite3/PDO : erreur sur join(', ', $link)
     * L'objet PDO ne peut pas etre transformee en chaine
     * Un echo $link ne fonctionne pas non plus
     * Il faut utiliser par exemple print_r($link)
     */
    //echo "\n<!--\n", join(', ', $link), " $login_db ";
    $db_connect = 0;
    // revoirfunction_exists($ferrno) ? $ferrno() : 0;
    //echo join(', ', $GLOBALS['connexions'][$server_db]);
    //echo "\n-->\n";
    if ($db_connect == "0" && $link) {
        echo "<div class='success'><b>" . _T('info_connexion_ok') . "</b></div>";
        echo info_progression_etape(2, 'etape_', 'install/');
        echo info_etape(_T('menu_aide_installation_choix_base') . aide("install2", true));
        echo "\n", '<!-- ', sql_version($server_db), ' -->';
        list($checked, $res) = install_etape_2_bases($login_db, $server_db);
        $hidden = (defined('_SPIP_CHMOD') ? '' : "\n<input type='hidden' name='chmod' value='" . spip_htmlspecialchars($chmod) . "' />") . predef_ou_cache($adresse_db . ($port ? ':' . $port : ''), $login_db, $pass_db, $server_db);
        echo install_etape_2_form($hidden, $checked, $res, 3);
    } else {
        echo info_progression_etape(1, 'etape_', 'install/', true);
        echo "<div class='error'>";
        echo info_etape(_T('info_connexion_base'));
        echo "<h3>" . _T('avis_connexion_echec_1') . "</h3>";
        echo "<p>" . _T('avis_connexion_echec_2') . "</p>";
        echo "<p style='font-size: small;'>", _T('avis_connexion_echec_3'), "</p></div>";
    }
    echo install_fin_html();
}
Exemple #4
0
/**
 * Reparer la base de donnees
 */
function exec_base_repair_dist()
{
    $ok = false;
    if (!spip_connect()) {
        $message = _T('titre_probleme_technique');
    } else {
        $version_sql = sql_version();
        if (!$version_sql) {
            $message = _T('avis_erreur_connexion_mysql');
        } else {
            $message = _T('texte_requetes_echouent');
            $ok = true;
        }
        $action = _T('texte_tenter_reparation');
    }
    if ($ok) {
        $admin = charger_fonction('admin', 'inc');
        echo $admin('repair', $action, $message, true);
    } else {
        include_spip('inc/minipres');
        echo minipres(_T('titre_reparation'), "<p>{$message}</p>");
    }
}
<?php

// $Id: help.php 2338 2012-07-18 10:54:42Z cimorrison $
require "defaultincludes.inc";
require_once "version.inc";
// Check the user is authorised for this page
checkAuthorised();
print_header($day, $month, $year, $area, isset($room) ? $room : "");
echo "<h3>" . get_vocab("about_mrbs") . "</h3>\n";
echo "<table id=\"version_info\">\n";
echo "<tr><td><a href=\"http://mrbs.sourceforge.net\">" . get_vocab("mrbs") . "</a>:</td><td>" . get_mrbs_version() . "</td></tr>\n";
echo "<tr><td>" . get_vocab("database") . ":</td><td>" . sql_version() . "</td></tr>\n";
echo "<tr><td>" . get_vocab("system") . ":</td><td>" . php_uname() . "</td></tr>\n";
echo "<tr><td>" . get_vocab("servertime") . ":</td><td>" . utf8_strftime($strftime_format['datetime'], time()) . "</td></tr>\n";
echo "<tr><td>PHP:</td><td>" . phpversion() . "</td></tr>\n";
echo "</table>\n";
echo "<p>\n" . get_vocab("browserlang") . ":\n";
echo implode(", ", array_keys($langs));
echo "\n</p>\n";
echo "<h3>" . get_vocab("help") . "</h3>\n";
echo "<p>\n";
echo get_vocab("please_contact") . '<a href="mailto:' . htmlspecialchars($mrbs_admin_email) . '">' . htmlspecialchars($mrbs_admin) . "</a> " . get_vocab("for_any_questions") . "\n";
echo "</p>\n";
require_once "site_faq" . $faqfilelang . ".html";
output_trailer();
Exemple #6
0
<?php

# $Id: help.php,v 1.1 2007/06/22 23:45:27 amagrace Exp $
require_once "grab_globals.inc.php";
include "config.inc.php";
include "{$dbsys}.inc";
include "functions.inc";
include "version.inc";
#If we dont know the right date then make it up
if (!isset($day) or !isset($month) or !isset($year)) {
    $day = date("d");
    $month = date("m");
    $year = date("Y");
}
if (empty($area)) {
    $area = get_default_area();
}
print_header($day, $month, $year, $area);
echo "<H3>" . get_vocab("about_mrbs") . "</H3>\n";
echo "<P><a href=\"http://mrbs.sourceforge.net\">" . get_vocab("mrbs") . "</a> - " . get_mrbs_version() . "\n";
echo "<BR>" . get_vocab("database") . sql_version() . "\n";
echo "<BR>" . get_vocab("system") . php_uname() . "\n";
echo "<BR>PHP: " . phpversion() . "\n";
echo "<H3>" . get_vocab("help") . "</H3>\n";
echo get_vocab("please_contact") . '<a href="mailto:' . $mrbs_admin_email . '">' . $mrbs_admin . "</a> " . get_vocab("for_any_questions") . "\n";
include "site_faq" . $faqfilelang . ".html";
include "trailer.inc";
Exemple #7
0
<?php

# $Id$
require_once "grab_globals.inc.php";
include "config.inc";
include "{$dbsys}.inc";
include "functions.inc";
$mrbs_version = "MRBS 1.1";
#If we dont know the right date then make it up
if (!isset($day) or !isset($month) or !isset($year)) {
    $day = date("d");
    $month = date("m");
    $year = date("Y");
}
if (empty($area)) {
    $area = get_default_area();
}
print_header($day, $month, $year, $area);
echo "<H3>" . $vocab['about_mrbs'] . "</H3>\n";
echo "<P><a href=\"http://mrbs.sourceforge.net\">{$vocab['mrbs']}</a> - {$mrbs_version}\n";
echo "<BR>" . $vocab['database'] . sql_version() . "\n";
echo "<BR>" . $vocab['system'] . php_uname() . "\n";
echo "<BR>PHP: " . phpversion() . "\n";
echo "<H3>" . $vocab['help'] . "</H3>\n";
echo $vocab['please_contact'] . '<a href="mailto:' . $mrbs_admin_email . '">' . $mrbs_admin . "</a> " . $vocab['for_any_questions'] . "\n";
include "site_faq" . $faqfilelang . ".html";
include "trailer.inc";
    <form method="post" action="convert_db_to_utf8.php">
      Encoding to convert from:<br>
      <select name="encoding">
        <option value="iso-8859-1">Latin 1 (English/French/German/Italian/Norwegian etc.)</option>
        <option value="iso-8859-2">Latin 2 (Czech)</option>
        <option value="iso-8859-7">ISO-8859-7 (Greek)</option>
        <option value="iso-8859-15">Latin 9 (European)</option>
        <option value="Big-5">Big 5 (Chinese Traditional)</option>
        <option value="Shift-JIS">Shift-JIS (Japanese)</option>
        <option value="utf-8">UTF-8 (No conversion)</option>
      </select>

<?php 
    if ($dbsys == 'mysql' || $dbsys == 'mysqli') {
        $ver = sql_version();
        // Sanitise the output to contain just the version number, hopefully
        $ver = preg_replace('/[^0-9.]/', '', $ver);
        // Pull out the floating point version number
        sscanf($ver, "%f", $version);
        if ($version >= 4.1) {
            $not_unicode = FALSE;
            $res = sql_query("SHOW FULL COLUMNS FROM {$tbl_entry}");
            for ($i = 0; $row = sql_row_keyed($res, $i); $i++) {
                if (!is_null($row['Collation']) && !preg_match('/utf8/', $row['Collation'])) {
                    $not_unicode = TRUE;
                }
            }
            if ($not_unicode) {
                ?>
      <div style="margin-top: 1em; padding: 0.5em; border: solid 2px; background-color: #FFF1A3">
Exemple #9
0
$mrbs_version = "MRBS 1.0-pre2";

#If we dont know the right date then make it up
if(!isset($day) or !isset($month) or !isset($year))
{
	$day   = date("d");
	$month = date("m");
	$year  = date("Y");
}
if(empty($area))
	$area = get_default_area();

print_header($day, $month, $year, $area);

echo "<H3>About MRBS</H3>\n";
echo "<P><a href=\"http://mrbs.sourceforge.net\">$lang[mrbs]</a> - $mrbs_version\n";
echo "<BR>Database: " . sql_version() . "\n";
$uname = posix_uname();
echo "<BR>System: $uname[sysname] $uname[release] $uname[machine]\n";
echo "<BR>PHP: " . phpversion() . "\n";

echo "<H3>Help</H3>\n";
echo 'Please contact <a href="mailto:' . $mrbs_admin_email
	. '">' . $mrbs_admin
	. "</a> for any questions that aren't answered here.\n";
 
include "site_faq.html";

include "trailer.inc";
?>
Exemple #10
0
include "version.php";
global $USER;
if ($CFG->forcelogin) {
    require_login();
}
$day = optional_param('day', 0, PARAM_INT);
$month = optional_param('month', 0, PARAM_INT);
$year = optional_param('year', 0, PARAM_INT);
$area = optional_param('area', get_default_area(), PARAM_INT);
#If we dont know the right date then make it up
if ($day == 0 or $month == 0 or $year == 0) {
    $day = date("d");
    $month = date("m");
    $year = date("Y");
}
//if(empty($area)) - using optional_param -ab
//	$area = get_default_area();
print_header_mrbs($day, $month, $year, $area);
echo "<H3>" . get_string('about_mrbs', 'block_mrbs') . "</H3>\n";
echo "<P><a href=\"http://mrbs.sourceforge.net\">" . get_string('mrbs', 'block_mrbs') . "</a> - " . get_mrbs_version() . "\n";
echo "<BR>" . get_string('database', 'block_mrbs') . sql_version() . "\n";
echo "<BR>" . get_string('system', 'block_mrbs') . php_uname() . "\n";
echo "<BR>PHP: " . phpversion() . "\n";
echo "<H3>" . get_string('help') . "</H3>\n";
echo get_string('please_contact', 'block_mrbs') . '<a href="mailto:' . $mrbs_admin_email . '">' . $mrbs_admin . "</a> " . get_string('for_any_questions', 'block_mrbs') . "\n";
if (file_exists($CFG->wwwroot . 'blocks/mrbs/lang/' . $USER->lang . '/help/site_faq.html')) {
    include $CFG->wwwroot . 'blocks/mrbs/lang/' . $USER->lang . '/help/site_faq.html';
} else {
    include $CFG->wwwroot . 'blocks/mrbs/lang/en_utf8/help/site_faq.html';
}
include "trailer.php";
Exemple #11
0
function exec_admin_tech_args($tables)
{
	$commencer_page = charger_fonction('commencer_page', 'inc');
	echo $commencer_page(_T('titre_admin_tech'), "configuration", "base");

	echo "<br /><br />";
	echo "<div style='text-align: center'>",
	  gros_titre(_T('titre_admin_tech'),'',false),
	  '</div>';

	if ($GLOBALS['connect_toutes_rubriques']) {

		echo barre_onglets("administration", "sauver") . "<br />";
		echo debut_gauche('',true);
		echo debut_boite_info(true);
		echo  _T('info_gauche_admin_tech');
		echo fin_boite_info(true);
		$repertoire = _DIR_DUMP;
		if (!@file_exists($repertoire)
			AND !$repertoire = sous_repertoire(_DIR_DUMP,'',false,true)
		) {
			$repertoire = preg_replace(','._DIR_TMP.',', '', _DIR_DUMP);
			$repertoire = sous_repertoire(_DIR_TMP, $repertoire);
		}
		$dir_dump = $repertoire;

	} else {
		echo debut_gauche('', true);
		$dir_dump = determine_upload();
	}

	echo debut_droite('',true);

	//
	// Sauvegarde de la base
	//

	// a passer en fonction
	if (substr(_DIR_IMG, 0, strlen(_DIR_RACINE)) === _DIR_RACINE)
	 $dir_img = substr(_DIR_IMG,strlen(_DIR_RACINE));
	else
	 $dir_img = _DIR_IMG;

	$dir_dump = joli_repertoire($dir_dump);

	$res = 
	 "\n<p>" .
	 http_img_pack('warning.gif', _T('info_avertissement'), 
		 "style='width: 48px; height: 48px; float: right;margin: 10px;'") .
	 _T('texte_admin_tech_01',
	   array('dossier' => '<i>'.$dir_dump.'</i>', 'img'=>'<i>'.$dir_img.'</i>')) .
	 '&nbsp;' .
	 _T('texte_admin_tech_02',
		array('spipnet' => $GLOBALS['home_server']
		      . '/' .  $GLOBALS['spip_lang'] . '_article1489.html'
		      )) .
	"</p>";
	
	$file = nom_fichier_dump();

	$chercher_rubrique = charger_fonction('chercher_rubrique', 'inc');

	$form = $chercher_rubrique(0, $GLOBALS['connect_id_rubrique'] ? 'breve' : 'rubrique', $GLOBALS['connect_id_rubrique'], 0, 'admin_tech');

	if ($form) {
		if (preg_match('@^<select([^>]*)>(\s*<option[^>]*)>([^[<]+)(.*)$@s', $form, $r)) {
			if (!strpos($r[2], 'selected='))
				$r[2] .=  " selected='selected'";
			$form = "<select onchange='x=this.options[this.options.selectedIndex].firstChild.data.match(/\w+/); findObj_forcer(\"znom_sauvegarde\").value=x[0]; findObj_forcer(\"nom_sauvegarde\").value=x[0];'" . $r[1] . '>' . $r[2] . '>' . $r[3] . $r[4];
			if ($GLOBALS['connect_id_rubrique'])
				$file = trim($r[3]);
		} elseif (preg_match('@^<input[^>]*>([^[<]+)@', $form, $r))
			if ($GLOBALS['connect_id_rubrique'])
				$file = trim($r[1]);

		$res .= "\n<label for='id_parent'>" .
			  _T('texte_admin_tech_04') .
			  "</label><br /><br />\n" .
			  $form . '<br /><br />';
	}

	$nom = "\n<input name='nom_sauvegarde' id='nom_sauvegarde' size='40' value='$file' />";
	$znom = "\n<input name='znom_sauvegarde' id='znom_sauvegarde' size='40' value='$file' />";
	
	$res .= 
	  _T('texte_admin_tech_03') .
	  "\n<ul>" .
	  "\n<li style='list-style:none;'><input type='radio' name='gz' value='1' id='gz_on' checked='checked' /><label for='gz_on'> " .
	  _T('bouton_radio_sauvegarde_compressee', array('fichier'=>'')) .
	  " </label><br />\n" .
	  '<b>' . $dir_dump . "</b>" .
	  $znom .
	  "<b>.xml.gz</b></li>" . 
	  "\n<li style='list-style:none;'><input type='radio' name='gz' value='0' id='gz_off' /><label for='gz_off'>" .
	  _T('bouton_radio_sauvegarde_non_compressee',  array('fichier'=>'')) .
	  '</label><br /><b>' .
	  $dir_dump .
	  "</b>$nom<b>.xml</b></li></ul>\n" .
	  "\n<input type='hidden' name='reinstall' value='non' />";

	if (!$GLOBALS['connect_toutes_rubriques'])
	  foreach($tables as $k => $v)
	    if (!strpos($v, 'checked')) unset($tables[$k]);

	$bloc = "<h3>"._T('install_tables_base')."</h3>" .
	  "\n<ol style='spip'><li>\n" .
	  join("</li>\n<li>", $tables) .
	  "</li></ol>\n";

	$bloc = block_parfois_visible('export_tables', _T('info_options_avancees'), $bloc, '', false);

	echo
		debut_cadre_trait_couleur('',true,'',_T('texte_sauvegarde'),'sauvegarder'),
		generer_form_ecrire('export_all', $res . $bloc, '', _T('texte_sauvegarde_base')),
 		fin_cadre_trait_couleur(true);

	//
	// Restauration de la base
	//

	// restaurer est equivalent a detruire, ou pas (cas des restaurations partielles, a affiner ?)
	if (autoriser('detruire')) {
	
		echo debut_cadre_trait_couleur('',true,'', _T('texte_restaurer_base'),'restaurer');
		echo admin_sauvegardes($dir_dump, _request('tri'));
		echo fin_cadre_trait_couleur(true);

		//
		// Lien vers la reparation
		//

		if (!_request('reinstall') AND version_compare(sql_version(),'3.23.14','>=')) {
			$res = "\n<p style='text-align: justify;'>".
				_T('texte_crash_base') .
				"\n</p>";
	
			echo 
				debut_cadre_trait_couleur('',true,'',_T('texte_recuperer_base'),'reparer'),
				generer_form_ecrire('admin_repair', $res, '', _T('bouton_tenter_recuperation')),
				fin_cadre_trait_couleur(true);
		}
	}
	echo "<br />";

	echo fin_gauche(), fin_page();
}
Exemple #12
0
/**
 * Si la migration a echouee, peut on revenir a une base que l'on avait sauvegarde ?
 * (cas sqlite uniquement)
 * 
 * @return bool
 */
function migration_restore_base_si_possible(){
	$res = false;

	spip_log("tentative de restauration de la base",'migration');
	// si jamais la base est sqlite, et qu'on a un backup
	// le restaurer
	include_spip('base/abstract_sql');
	sql_version();
	if (strncmp($GLOBALS['connexions'][0]['type'],'sqlite',6)==0){
		if ($db =$GLOBALS['connexions'][0]['db']
			AND is_file($f = _DIR_DB . $db . '.sqlite')) {
			$s = lire_migration_depuis_status();
			spip_log("base SQLITE, le status indique backup=".$s['backup'],'migration');
			if ($g = $s['backup']
				AND @file_exists(_DIR_DB.$g)){
				spip_log("base $g restauree dans $f suite a l'echec de la migration",'migration');
				@copy(_DIR_DB.$g,$f);
				$res = true;
			}
		}
	}

	// securite, dans tous les cas
	sql_update('spip_auteurs', array('id_auteur'=>'-id_auteur'), "id_auteur<0");

	if ($GLOBALS['visiteur_session']['id_auteur']<0){
		$id_old = $GLOBALS['visiteur_session']['id_auteur'];
		$auteur = sql_fetsel('*','spip_auteurs','id_auteur='.intval(-$id_old));
		$session = charger_fonction('session','inc');
		$session($auteur); // creer la nouvelle session avec -id_auteur
		$session(); // la charger dans $GLOBALS['visiteur_session']
		$session($id_old); // supprimer l'ancienne session
	}

	return $res;
}