<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<meta http-equiv="Content-Language" content="nl">
<TITLE>Site@School migration tool</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<STYLE>A:link {
	BACKGROUND: none transparent scroll repeat 0% 0%; COLOR: #638ab9; TEXT-DECORATION: none
}
A:active {
	BACKGROUND: none transparent scroll repeat 0% 0%; COLOR: #638ab9; TEXT-DECORATION: none
}
A:visited {
	BACKGROUND: none transparent scroll repeat 0% 0%; COLOR: #638ab9; TEXT-DECORATION: none
}
A:hover {
	BACKGROUND: none transparent scroll repeat 0% 0%; COLOR: #ff0000; TEXT-DECORATION: none
}
TEXTAREA {
	COLOR: #000000; FONT-FAMILY: verdana, arial; BACKGROUND-COLOR: #ccdaec
}
Input.BUTTON {
	border:1px outset #ccdaec; BACKGROUND-COLOR: #ccdaec
}
SELECT {
	BORDER-RIGHT: #ccdaec 1px inset; BORDER-TOP: #ccdaec 1px inset; BORDER-LEFT: #ccdaec 1px inset; COLOR: #000000; BORDER-BOTTOM: #ccdaec 1px inset; FONT-FAMILY: verdana, arial; BACKGROUND-COLOR: #ccdaec
}
.text {
	FONT-SIZE: 10pt; FONT-FAMILY: Verdana, Arial
}
.link {
	FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: #638ab9; FONT-FAMILY: Verdana, Arial
}
.heading {
	FONT-WEIGHT: bold; FONT-SIZE: 13pt; COLOR: #638ab9; FONT-FAMILY: Verdana, Arial
}


INPUT.textfield {
	BORDER-RIGHT: #ccdaec 1px inset; BORDER-TOP: #ccdaec 1px inset; BORDER-LEFT: #ccdaec 1px inset; BORDER-BOTTOM: #ccdaec 1px inset; BACKGROUND-COLOR: #ccdaec
}
</STYLE>


</HEAD>
<BODY style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana, Arial, Helvetica" bottomMargin=0 vLink=#000000 aLink=#466c9b link=#000000 bgColor=#ffffff leftMargin=0 topMargin=0 rightMargin=0>


<TABLE style="BORDER-COLLAPSE: collapse" borderColor=#111111 height=45
cellSpacing=0 cellPadding=0 width="100%"
background=../graphics/banner-bg.gif border=0>
  <TBODY>
  <TR>
    <TD align=left width="5%"><IMG height=45
      src="../graphics/banner-left.gif" width=4 border=0></TD>
    <TD align=right width="70%">
    <b><font size="6" color="#FFFFFF">Migration of 2.2 to 2.3</font></b></TD>
    <TD align=right width="3%"><IMG height=45
      src="../graphics/banner-right.gif" width=3
border=0></TD></TR></TBODY></TABLE>
<TABLE id=AutoNumber3 style="BORDER-COLLAPSE: collapse" borderColor=#111111
cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
    <TD vAlign=top>
      <TABLE cellPadding=5 width="100%" border=0>
        <TBODY>
        <TR>
          <TD>
<?php
if($_GET[step] == "")
{
?>
          <form method="POST" action="migrate2.2_2.3.php?step=1">
            <TABLE style="BORDER-COLLAPSE: collapse" borderColor=#111111
            cellSpacing=0 cellPadding=4 width="100%" border=0>
              <TBODY>
              <TR>
                <TD align=center width="25%">&nbsp;
                </TD>
                <TD vAlign=top align=left width="65%">
                <SPAN class=heading>Welcome<BR></SPAN></TD>
                <TD vAlign=top align=middle width="10%">&nbsp;</TD>
              </TR>
              <TR>
                <TD align=center width="25%">
                <img border="0" src="../graphics/install_banner.jpg"></TD>
                <TD vAlign=top align=middle width="65%">
                <table border="1" height="300" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#E5E5E5" width="100%" id="AutoNumber4" bgcolor="#F7F7F7">
                  <tr>
                    <td width="100%" valign="top"><span class=text>
                    <br><br><br>This wizard will perform the migration of version 2.2 to 2.3 .<br><br>
                     Before you continue , please make sure you have made a <b>backup</b> of you MYSQL database.<br>
                     This can be done with <a href="http://phpmyadmin.sourceforge.net/">PHPMYADMIN</a> or via backup tool from S@S.
                    </span></td>
                  </tr>
                </table>
                </TD>
                <TD vAlign=top align=middle width="10%"></TD></TR>
              <TR>
                <TD align=center width="25%">&nbsp;
                </TD>
                <TD vAlign=top align=right width="65%">

                 <p>
                  <input type="submit" value="Continue" name="B1" class="BUTTON">
                  </p>
                </form>
<?php
}
if($_GET[step] == "1")
{
$installdir = $_SERVER["DOCUMENT_ROOT"]."/starnet";
$installdir = str_replace("//","/",$installdir);
?>


          <form method="POST" action="migrate2.2_2.3.php?step=2">

            <TABLE style="BORDER-COLLAPSE: collapse" borderColor=#111111
            cellSpacing=0 cellPadding=4 width="100%" border=0>
              <TBODY>
              <TR>
                <TD align=center width="25%">&nbsp;
                </TD>
                <TD vAlign=top align=left width="65%">
                <SPAN class=heading>Step 1<BR></SPAN><span class="text">Database migration.</span></TD>
                <TD vAlign=top align=middle width="10%">&nbsp;</TD>
              </TR>
              <TR>
                <TD align=center width="25%">
                <img border="0" src="../graphics/install_banner.jpg"></TD>
                <TD vAlign=top align=middle width="65%">
                <table border="1" height="300" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#E5E5E5" width="100%" id="AutoNumber4" bgcolor="#F7F7F7">
                  <tr>
                    <td width="100%" valign="top"><span class=text>
                   <br><br>Tables will be altered during the next step..<br>Click on continue.</td>
                  </tr>
                </table>
                </TD>
                <TD vAlign=top align=middle width="10%"></TD></TR>
              <TR>
                <TD align=center width="25%">&nbsp;
                </TD>
                <TD vAlign=top align=right width="65%">


                 <p>
                  <input type="submit" value="Continue" name="B1" class="BUTTON">
                </form>
<?php
}
if($_GET[step] == "2")
{
?>
            <TABLE style="BORDER-COLLAPSE: collapse" borderColor=#111111
            cellSpacing=0 cellPadding=4 width="100%" border=0>
              <TBODY>
              <TR>
                <TD align=center width="25%">&nbsp;
                </TD>
                <TD vAlign=top align=left width="65%">
                <SPAN class=heading>Step 2<BR></SPAN></TD>
                <TD vAlign=top align=middle width="10%">&nbsp;</TD>
              </TR>
              <TR>
                <TD align=center width="25%">
                <img border="0" src="../graphics/install_banner.jpg"></TD>
                <TD vAlign=top align=middle width="65%">
                <table border="1" height="300" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#E5E5E5" width="100%" id="AutoNumber4" bgcolor="#F7F7F7">
                  <tr>
                  <td width="100%" valign="top"><span class=text>

<?php
echo "start migration .....<br><br>"   ;
include("../configuration/database.inc.php");       
mysql_connect("$db_server", "$db_username", "$db_password");
mysql_select_db("$db_name");

$result=mysql_query("SELECT config_value FROM $table_configuration WHERE config_key='language'");
$row=mysql_fetch_array($result);
$language=$row["config_value"];

//user table 
mysql_query("ALTER TABLE $table_users ADD sections varchar(80) NOT NULL default ''");
mysql_query("ALTER TABLE $table_users ADD project varchar(60) NOT NULL default ''");

//pages table 
mysql_query("ALTER TABLE $table_pages MODIFY lastupdate DATETIME");
$table_prot_pages = $dbprefix."prot_pages";
mysql_query("ALTER TABLE $table_prot_pages MODIFY lastupdate DATETIME");

//forms table
$forms_table = $dbprefix . "m_forms";
mysql_query("ALTER TABLE $forms_table MODIFY length varchar(5)");
mysql_query("ALTER TABLE $forms_table MODIFY name text");

//newsletter module
$table_newsletters = $dbprefix ."m_newsletter_cat";
mysql_query("ALTER TABLE $table_newsletters ADD public tinyint(4) NOT NULL default 0");
$table_newsletters = $dbprefix ."m_newsletters";
mysql_query("ALTER TABLE $table_newsletters ADD public tinyint(4) NOT NULL default 0");
print "Newsletter table has been altered.<p>";

//mail module
$table_email = $dbprefix ."m_mail_address";
mysql_query("CREATE TABLE $table_email (id int(11) NOT NULL auto_increment, 
name varchar(60) NOT NULL default '',
description text,
email varchar(80) NOT NULL default '',
welcometext text,
thankyoutext text,
sort tinyint(4) NOT NULL default 0,
PRIMARY KEY  (id))");
mysql_query("INSERT INTO $table_configuration VALUES ('email_picture', 'starnet/graphics/email3.gif', '')");
print "Email table has been created.<p>";

//search module
$result=mysql_query("SELECT config_value FROM $table_configuration WHERE config_key='search_module_name1'");
$row=mysql_fetch_array($result);
$option_old=$row["config_value"];
$options = explode(",",$option_old) ;
mysql_query("UPDATE $table_configuration SET config_value = '$options[0],$options[1],1,$options[2],0' WHERE config_key = 'search_module_name1'");

$result=mysql_query("SELECT config_value FROM $table_configuration WHERE config_key='search_module_name2'");
$row=mysql_fetch_array($result);
$option_old=$row["config_value"];
$options = explode(",",$option_old) ;
mysql_query("UPDATE $table_configuration SET config_value = '$options[0],$options[1],1,$options[2],0' WHERE config_key = 'search_module_name2'");

$result=mysql_query("SELECT config_value FROM $table_configuration WHERE config_key='search_module_name3'");
$row=mysql_fetch_array($result);
$option_old=$row["config_value"];
$options = explode(",",$option_old) ;
mysql_query("UPDATE $table_configuration SET config_value = '$options[0],$options[1],0,$options[2],0' WHERE config_key = 'search_module_name3'");

$result=mysql_query("SELECT config_value FROM $table_configuration WHERE config_key='search_module_name4'");
$row=mysql_fetch_array($result);
$option_old=$row["config_value"];
$options = explode(",",$option_old) ;
mysql_query("UPDATE $table_configuration SET config_value = '$options[0],$options[1],1,$options[2],0' WHERE config_key = 'search_module_name4'");
mysql_query("UPDATE $table_configuration SET config_value = '' WHERE config_key ='search_module_extra_select1')");
mysql_query("INSERT INTO $table_configuration VALUES ('search_module_invisible', '0', ' ')");

print "Search module migration has been finished.<p>";

//guestbook
mysql_query("INSERT INTO $table_configuration VALUES ('gbook_max_items', '15', '')");
print "Guestbook migration has been finished.<p>";

// news module
$table_news= $dbprefix ."m_news_articles";
$result = mysql_query("ALTER TABLE $table_news ADD public tinyint(4) NOT NULL default 0");
$result = mysql_query("ALTER TABLE $table_news MODIFY title varchar(80)");

if(file_exists("../languages/".$language."/sn_news/".$language.".php")) 
{
include("../languages/".$language."/sn_news/".$language.".php");
} 
else 
{
include("../languages/EN/sn_news/EN.php");
}
$welcome = $sas_lang['news_module_archive'] ;
mysql_query("INSERT INTO $table_configuration VALUES ('news_archive_welcome_text', '$welcome', '')");
mysql_query("UPDATE $table_modules SET options = 'frontpage.php,News Page,frontpage_cat.php,Category per page,archive.php,News Archive' 
             WHERE location = 'sn_news'"); 
mysql_query("UPDATE $table_pages SET module = 'sn_news/archive.php' 
             WHERE module = 'sn_news/archive_prot.php'"); 
print "News table has been altered.<p>";

//allbum
  $query = "SELECT config_value FROM $table_configuration WHERE config_key = 'language'"; 
  $result = mysql_query($query) or die_script(mysql_error());
  $language = mysql_result($result,0);
// use language file:
if(file_exists("../languages/$language/sn_allbum/$language.php")) {
	include("../languages/$language/sn_allbum/$language.php");
} 
else 
{
	include("../languages/EN/sn_allbum/EN.php");
}
$table_allbum = $dbprefix ."m_allbum";
mysql_query("ALTER TABLE $table_allbum ADD public tinyint(4) NOT NULL default 0");
mysql_query("INSERT INTO $table_configuration VALUES ('allbum_welcome', '$sas_lang[sn_allbum_gallery_main_page]', 'Allbum welcom text')");
mysql_query("INSERT INTO $table_configuration VALUES ('allbum_max_allbums_per_page','10','max objects per page')");
mysql_query("UPDATE $table_modules SET options = 'sas_index.php,View Albums,sas_index2.php,View Album per page,slideshow.php,Album slideshow' WHERE location = 'sn_allbum'");

print "Allbum table has been altered.<p>";

//downloads
$table_downloads_cat = $dbprefix ."m_downloads_cat";
$table_downloads = $dbprefix ."m_downloads";
mysql_query("ALTER TABLE $table_downloads_cat ADD public tinyint(4) NOT NULL default 0");
mysql_query("ALTER TABLE $table_downloads ADD bin_data mediumblob NOT NULL");

//ads module
mysql_query("INSERT INTO $table_configuration VALUES ('ads_expiration_days', '30', '')");
mysql_query("UPDATE $table_modules SET options = 'view_ads.php,View advertisements' WHERE location = 'sn_ads'");

//session table
$table_sessions = $dbprefix."sessions";
mysql_query("CREATE TABLE $table_sessions (ses_id varchar(32) NOT NULL default '', 
ses_time int(11) NOT NULL default 0, 
ses_start int(11) NOT NULL default 0, 
ses_value text NOT NULL, 
PRIMARY KEY  (ses_id))");
print "Session table has been created.<p>";

//pupilpages
mysql_query("UPDATE $table_modules 
SET options = 'user_login.php,Teacher/Pupils\'s login,viewpage.php,View pupil pages,viewpage2.php,View pupil pages per class,viewproject.php,View pupil pages per project,teacher_page.php,Teacher pages'
WHERE location = 'sn_studentpages'");
mysql_query("ALTER TABLE $table_studentpages MODIFY title varchar(50)") ;
mysql_query("ALTER TABLE $table_classes ADD project tinyint(4) NOT NULL DEFAULT 0") ;
mysql_query("UPDATE $table_classes SET project = 0 WHERE id > 0") ;
mysql_query("ALTER TABLE $table_users ADD project tinyint(4)") ;

//sitemap
$query = "SELECT config_key,config_value FROM $table_configuration WHERE config_key NOT LIKE 'agenda_t%'";    
//read all the configuration items except agenda options.
$result = mysql_query($query) or die_script(mysql_error());
while ($config_list = mysql_fetch_array($result)) { 
$sas_config[$config_list[0]] = $config_list[1] ;                             //put them in the config array
}

if(file_exists("../languages/".$language."/sn_sitemap/".$language.".php")) {
include("../languages/".$language."/sn_sitemap/".$language.".php");
} else {
include("../languages/EN/sn_sitemap/EN.php");
}
$welcome = $sas_lang[sitemap]." ".$sas_config['sitename'] ;
mysql_query("INSERT INTO $table_configuration VALUES ('sitemap_welcome_text', '$welcome', '')");
mysql_query("UPDATE $table_modules SET options='view_sitemap.php,Sitemap,view_sitemap_date.php,Sitemap with date' WHERE location = 'sn_sitemap'");
print "Sitemap migration has been finished.<p>";
//chat
$chat_userstable = $dbprefix . "m_chat_users";
$chat_table = $dbprefix . "m_chat";
$chat_messagetable = $dbprefix . "m_chat_log";
        
mysql_query("CREATE TABLE $chat_userstable (
        id int(11) NOT NULL auto_increment,
        ip varchar(255) NOT NULL default '',
        user varchar(255) NOT NULL default '',
        status varchar(6) NOT NULL default '',
        joined datetime NOT NULL default '0000-00-00 00:00:00',
        room int(11) default NULL,
        PRIMARY KEY  (id))");
mysql_query("CREATE TABLE $chat_messagetable (
        id int(11) NOT NULL auto_increment,
        user varchar(255) NOT NULL default '',
        color varchar(255) NOT NULL default 'black',
        font varchar(255) NOT NULL default 'arial',
        size int(2) NOT NULL default 2,
        text varchar(255) NOT NULL default '',
        posted datetime NOT NULL default '0000-00-00 00:00:00',
        toperson varchar(16) NOT NULL default '0',
        system int(1) NOT NULL default '0',
         room int(11) default NULL,
        ip varchar(255) NOT NULL default '',
        PRIMARY KEY  (id))");
mysql_query("CREATE TABLE $chat_table (
        id int(11) NOT NULL auto_increment,
        name varchar(50) default NULL,
        title text,
        welcome text,
        width int(5) default NULL,
        height int(5) default NULL,
        public tinyint(4) default NULL,
        password varchar(15) default NULL,
        refresh int(11) NOT NULL default 2,
        options varchar(255) NOT NULL default '1',
        PRIMARY KEY  (id)) ");
        
$result = mysql_query("SELECT id FROM $table_modules WHERE location = 'sn_chat'");
$RecordCount = mysql_num_rows($result);
        if($RecordCount == 0) {
        mysql_query("INSERT INTO $table_modules VALUES ('', 'Chat', 'sn_chat', 'chat.php, Chat page', 'admin.php', '')");
        }
print "Chat module has been installed.<p>";
print "<p>Migration is finished for version 2.3<br>You can now continue normal operation on your site.<p>
Please don't forget to delete the content of the <b>starnet/install</b> directory when you are finished!"   ;
?>
<br><br>
<b>The S@S team.</b><br>
</span></td>



                  </tr>
                </table>
                </TD>
                <TD vAlign=top align=middle width="10%"></TD></TR>
              <TR>
                <TD align=center width="25%">&nbsp;
                </TD>
                <TD vAlign=top align=right width="65%">
                  <p>
<?php
}
?>
               </TD>
                <TD vAlign=top align=middle width="10%">&nbsp;</TD></TR>
              </TBODY></TABLE></TD></TR></TBODY></TABLE></TD>
    </TR></TBODY></TABLE></BODY></HTML>