function tableau_liste_sauvegardes($name, $id = "", $mac = "", $order_by = 'date DESC', $limit = "") { $html = ""; $tab = liste_sauvegardes($name, $id, $mac, $order_by, $limit); if (count($tab) == 0) { $html = "Aucune sauvegarde n'est recensée pour <b>{$name}</b>"; } else { if ($limit == 1) { $html .= "La derniàre sauvegarde :"; } elseif ($limit > 1) { $html .= "Les {$limit} derniàres sauvegardes :"; } $html .= "<table class='crob'>\n"; $html .= "<tr>\n"; $html .= "<th>Id</th>\n"; $html .= "<th>Nom</th>\n"; $html .= "<th>Partition</th>\n"; $html .= "<th>Sauvegarde</th>\n"; $html .= "<th>Date</th>\n"; $html .= "<th>Descriptif</th>\n"; $html .= "</tr>\n"; for ($loop = 0; $loop < count($tab); $loop++) { $html .= "<tr>\n"; $html .= "<td>" . $tab[$loop]['id'] . "</td>\n"; $html .= "<td>" . $tab[$loop]['name'] . "</td>\n"; $html .= "<td>" . $tab[$loop]['partition'] . "</td>\n"; $html .= "<td>" . $tab[$loop]['image'] . "</td>\n"; $html .= "<td>" . mysql_date_to_fr_date($tab[$loop]['date']) . "</td>\n"; $html .= "<td style='text-align:left'><pre>" . $tab[$loop]['descriptif'] . "</pre></td>\n"; $html .= "</tr>\n"; } $html .= "</table>\n"; } return $html; }
function admin_sauvegardes($dir_dump, $tri) { $liste_dump = preg_files(_DIR_DUMP,'\.xml(\.gz)?$',50,false); $selected = end($liste_dump); $n = strlen(_DIR_DUMP); $tl = $tt = $td = array(); $f = ""; $i = 0; foreach($liste_dump as $fichier){ $i++; $d = filemtime($fichier); $t = filesize($fichier); $s = ($fichier==$selected); $class = 'row_'.alterner($i, 'even', 'odd'); $fichier = substr($fichier, $n); $tl[]= liste_sauvegardes($i, $fichier, $class, $s, $d, $t); $td[] = $d; $tt[] = $t; } if ($tri == 'taille') array_multisort($tt, SORT_ASC, $tl); elseif ($tri == 'date') array_multisort($td, SORT_ASC, $tl); $fichier_defaut = $f ? basename($f) : str_replace(array("@stamp@","@nom_site@"),array("",""),_SPIP_DUMP); $self = self(); $class = 'row_'.alterner($i+1, 'even', 'odd'); $head = !$tl ? '' : ( "\n<tr>" . '<th></th><th><a href="' . parametre_url($self, 'tri', 'nom') . '#sauvegardes">' . _T('info_nom') . "</a></th>\n" . '<th><a href="' . parametre_url($self, 'tri', 'taille') . '#sauvegardes">' . _T('taille_octets', array('taille' => '')) . "</a></th>\n" . '<th><a href="' . parametre_url($self, 'tri', 'date') . '#sauvegardes">' . _T('public:date') . '</a></th></tr>'); $texte = _T('texte_compresse_ou_non')." "; $h = _T('texte_restaurer_sauvegarde', array('dossier' => '<i>'.$dir_dump.'</i>')); $res = "\n<p style='text-align: justify;'> " . $h . '</p>' . _T('entree_nom_fichier', array('texte_compresse' => $texte)) . "\n<br /><br /><table class='spip' id='sauvegardes'>" . $head . join('',$tl) . "\n<tr class='$class'><td><input type='radio' name='archive' id='archive' value='' /></td><td colspan='3'>" . "\n<span class='spip_x-small'><input type='text' name='archive_perso' id='archive_perso' value='$fichier_defaut' size='55' /></span></td></tr>" . '</table>'; $plie = _T('info_options_avancees'); // restauration partielle / fusion $opt = debut_cadre_enfonce('',true) . "\n<div>" . "<input name='insertion' id='insertion' type='checkbox' /> <label for='insertion'>". _T('sauvegarde_fusionner') . "</label><br />\n" . "<input name='statut' id='statut' type='checkbox' /> <label for='statut'>\n". _T('sauvegarde_fusionner_depublier') . "</label><br />\n" . "<label for='url_site'>" . _T('sauvegarde_url_origine') . "</label>" . " \n<input name='url_site' id='url_site' type='text' size='25' />" . '</div>' . fin_cadre_enfonce(true); $res .= block_parfois_visible('import_tables', $plie, $opt, '', false); return generer_form_ecrire('import_all', $res, '', _T('bouton_restaurer_base')); }