function confirmdelete(id,news){ var agree=confirm("Do you really want to permanently delete this archive ?\\nAll ("+news+") news and comments in it will be deleted."); if (agree) document.location="$PHP_SELF?mod=tools&action=dodeletearchive&archive="+id; }
Send news to archive

 Explaining archives and
 Their usage

Available archives HTML; if(!$handle = opendir("./data/archives")){ die("
Can not open directory $cutepath/data/archives "); } while (false !== ($file = readdir($handle))) { if($file != "." and $file != ".." and !is_dir("./data/archives/$file") and eregi("news.arch", $file)) { $file_arr = explode(".", $file); $id = $file_arr[0]; $news_lines = file("./data/archives/$file"); $creation_date = date("d F Y",$file_arr[0]); $count = count($news_lines); $last = $count-1; $first_news_arr = explode("|", $news_lines[$last]); $last_news_arr = explode("|", $news_lines[0]); $first_timestamp = $first_news_arr[0]; $last_timestamp = $last_news_arr[0]; $duration = (date("d M Y",$first_timestamp) ." - ". date("d M Y",$last_timestamp) ); echo "
"; } } closedir($handle); if($count == 0){ echo""; } echo<<
Historical archive. This is a preserved copy of 36 Degrees Design (2005–2008), the early web-design weblog of Stuart Frisby. It is maintained independently as a piece of web history and is not operated by, affiliated with, or endorsed by Stuart Frisby. If you are the original owner and would like this domain returned, get in touch — it’s yours, no fuss.
  archivation date duration news action
$creation_date $duration $count [edit] [delete]

There are no archives
HTML; echofooter(); } // ******************************************************************************** // Make Archive // ******************************************************************************** elseif($action == "doarchive") { if(filesize("./data/news.txt") == 0){ msg("error", "Error !!!", "Sorry but there are no news to be archived", "$PHP_SELF?mod=tools&action=archive"); } if(filesize("./data/comments.txt") == 0){ msg("error", "Error !!!", "The comments file is empty and can not be archived", "$PHP_SELF?mod=tools&action=archive"); } $arch_name = time()+($config_date_adjust*60); if(!@copy("./data/news.txt","./data/archives/$arch_name.news.arch")) { msg("error","Error !!!","Can not create file ./data/archives/$arch_name.news.arch", "$PHP_SELF?mod=tools&action=archive");} if(!@copy("./data/comments.txt","./data/archives/$arch_name.comments.arch")) { msg("error","Error !!!","Can not create file ./data/archives/$arch_name.comments.arch", "$PHP_SELF?mod=tools&action=archive");} $handle = fopen("./data/news.txt","w"); fclose($handle); $handle = fopen("./data/comments.txt","w"); fclose($handle); msg("archives", "Archive Saved", "   All active news were successfully added to archives file with name $arch_name.news.arch", "$PHP_SELF?mod=tools&action=archive"); } // ******************************************************************************** // Do Delete Archive // ******************************************************************************** elseif($action == "dodeletearchive"){ $success = 0; if(!$handle = opendir("./data/archives")){ die("
Can not open directory $cutepath/data/archive "); } while (false !== ($file = readdir($handle))){ if($file == "$archive.news.arch" or $file == "$archive.comments.arch"){ unlink("./data/archives/$file"); $success ++; } } closedir($handle); if($success == 2){ msg("info", "Arhcive Deleted", "The archive was successfully deleted", "$PHP_SELF?mod=tools&action=archive"); }elseif($success == 1){ msg("error", "Error !!!", "Either the comments part or the news part of the archive was not deleted", "$PHP_SELF?mod=tools&action=archive"); }else{ msg("error", "Error !!!", "The archive you specified was not deleted, it is not on the server or you don't have permissions to delete it", "$PHP_SELF?mod=tools&action=archive"); } } // ******************************************************************************** // Backup News and archives // ******************************************************************************** elseif($action == "backup") { echoheader("options", "Backup"); echo'
Create BackUp
Name of the BackUp:  

Available BackUps
'; $count = 0; if(!$handle = opendir("./data/backup")){ die("
Can not open directory $cutepath/data/backup "); } while (false !== ($file = readdir($handle))) { if($file != "." and $file != ".." and is_dir("./data/backup/$file")) { $archives_count = 0; $archives_handle = @opendir("./data/backup/$file/archives"); while (false !== ($arch = readdir($archives_handle))){ if(eregi(".news.arch", $arch)){ $archives_count++; } } closedir($archives_handle); $news_count = count(file("./data/backup/$file/news.txt")); echo "
"; $count++; } } closedir($handle); if($count == 0){ echo""; } echo'
  name active news archives action
$file  $news_count  $archives_count [delete] [restore]


There are no backups

'; echofooter(); } // ******************************************************************************** // Do Delete Backup // ******************************************************************************** elseif($action == "dodeletebackup") { function listdir($dir){ $current_dir = opendir($dir); while($entryname = readdir($current_dir)){ if(is_dir("$dir/$entryname") and ($entryname != "." and $entryname!="..")){ listdir("${dir}/${entryname}"); }elseif($entryname != "." and $entryname!=".."){ unlink("${dir}/${entryname}"); } } @closedir($current_dir); rmdir(${dir}); } listdir("./data/backup/$backup"); msg("info", "Backup Deleted", "The backup was successfully deleted.", "$PHP_SELF?mod=tools&action=backup"); } // ******************************************************************************** // Do restore backup // ******************************************************************************** elseif($action == "dorestorebackup"){ if(!@copy("./data/backup/$backup/news.txt", "./data/news.txt")){ msg("error", "error", "./data/backup/$backup/news.txt", "$PHP_SELF?mod=tools&action=backup"); } if(!@copy("./data/backup/$backup/comments.txt", "./data/comments.txt")){ msg("error", "error", "./data/backup/$backup/comments.txt", "$PHP_SELF?mod=tools&action=backup"); } $dirp = opendir("./data/backup/$backup/archives"); while($entryname = readdir($dirp)){ if(!is_dir("./data/backup/$backup/archives/$entryname") and $entryname!="." and $entryname!=".."){ if(!@copy("./data/backup/$backup/archives/$entryname", "./data/archives/$entryname")){ msg("error", "error", "Can not copy ./data/backup/$backup/archives/$entryname"); } } } msg("info", "Backup Restored", "The backup was successfully restored.", "$PHP_SELF?mod=tools&action=backup"); } // ******************************************************************************** // Make The BackUp // ******************************************************************************** elseif($action == "dobackup") { $back_name = eregi_replace(" ", "-", $back_name); if(filesize("./data/news.txt") == 0){msg("error", "Error !!!", "The news file is empty and can not be backed-up", "$PHP_SELF?mod=tools&action=backup");} if(filesize("./data/comments.txt") == 0){msg("error", "Error !!!", "The comments file is empty and can not be backed-up", "$PHP_SELF?mod=tools&action=backup");} if(is_readable("./data/backup/$back_name")){ msg("error", "Error !!!", "A backup with this name already exist", "$PHP_SELF?mod=tools&action=backup"); } if(!is_readable("./data/backup")){ mkdir("./backup", 0777); } if(!is_writable("./data/backup")){ msg("error", "Error !!!", "The directory ./data/backup is not writable, please chmod it"); } mkdir("./data/backup/$back_name", 0777); mkdir("./data/backup/$back_name/archives", 0777); if(!@copy("./data/news.txt", "./data/backup/$back_name/news.txt")){ die("Can not copy news.txt file to ./data/backup/$back_name :("); } if(!@copy("./data/comments.txt","./data/backup/$back_name/comments.txt")){ die("Can not copy comments.txt file to ./data/backup/$back_name :("); } if(!$handle = opendir("./data/archives")){ die("Can not create file"); } while(false !== ($file = readdir($handle))) { if($file != "." and $file != "..") { if(!@copy("./data/archives/$file", "./data/backup/$back_name/archives/$file")){ die("Can not copy archive file to ./data/backup/$back_name/archives/$file :("); } } } closedir($handle); msg("info", "Backup", "All news and archives were successfully BackedUp under directory './data/backup/$back_name'", "$PHP_SELF?mod=tools&action=backup"); } ?>