<?php

//+-----------------------------------------------------+//
//+ Copyright floopo.com
//+ dbupdate.php
//+ Various - Database Update Queries
//+-----------------------------------------------------+//

include_once ('../config/config.php');


if(isset($_POST['submit'])){
//____MYSQL CONNECTION____
//$quickmysql_debug = 1;
$dbase = new QuickMysql(DB_NAME,DB_USER,DB_PASS,DB_HOST);

//______________Revision 71 - 12 August 2009______________________________________________________________________________________________

$dbase->UpdateRecord("ALTER TABLE member_profile ADD notifications VARCHAR( 10 ) NOT NULL DEFAULT 'yes'");

$dbase->UpdateRecord("INSERT INTO system_messages (message, indexer, subject, title) VALUES('<p>Hello [var.user_name]</p> <p></p> <p>[var.followers_username] is now following you</p> <p>&nbsp;</p> <p>&nbsp;</p>', 4, 'You are being followed', 'followed')");

$dbase->UpdateRecord("INSERT INTO system_messages (message, indexer, subject, title) VALUES('<p>Hello [var.user_name]</p> <p></p> <p>[var.senders_username] has just sent you a message</p> <p>&nbsp;</p> <p>&nbsp;</p>', 5, 'You have a new message', 'direct_message')");



if(!$dbase->SelectRecord("SELECT * FROM lang_mine WHERE lang_title = 'account'")){
$dbase->UpdateRecord("INSERT INTO lang_mine (lang_title, lang_words, my_lang) VALUES('account', 'Account', 1)");
}

if(!$dbase->SelectRecord("SELECT * FROM lang_mine WHERE lang_title = 'check_email'")){
$dbase->UpdateRecord("INSERT INTO lang_mine (lang_title, lang_words, my_lang) VALUES('check_email', 'Your password has been reset. check your email for details', 1)");
}

if(!$dbase->SelectRecord("SELECT * FROM lang_mine WHERE lang_title = 'details_do_not_match'")){
$dbase->UpdateRecord("INSERT INTO lang_mine (lang_title, lang_words, my_lang) VALUES('details_do_not_match', 'Details provided do not match our records', 1)");
}

if(!$dbase->SelectRecord("SELECT * FROM lang_mine WHERE lang_title = 'forgot_password'")){
$dbase->UpdateRecord("INSERT INTO lang_mine (lang_title, lang_words, my_lang) VALUES('forgot_password', 'Forgot password', 1)");
}

if(!$dbase->SelectRecord("SELECT * FROM lang_mine WHERE lang_title = 'invalid_username'")){
$dbase->UpdateRecord("INSERT INTO lang_mine (lang_title, lang_words, my_lang) VALUES('invalid_username', 'Invalid username - Use letters and numbers only', 1)");
}

if(!$dbase->SelectRecord("SELECT * FROM lang_mine WHERE lang_title = 'my_timeline'")){
$dbase->UpdateRecord("INSERT INTO lang_mine (lang_title, lang_words, my_lang) VALUES('my_timeline', 'My Timeline', 1)");
}

if(!$dbase->SelectRecord("SELECT * FROM lang_mine WHERE lang_title = 'notifications'")){
$dbase->UpdateRecord("INSERT INTO lang_mine (lang_title, lang_words, my_lang) VALUES('notifications', 'Notifications', 1)");
}

if(!$dbase->SelectRecord("SELECT * FROM lang_mine WHERE lang_title = 'only_followers_can_view'")){
$dbase->UpdateRecord("INSERT INTO lang_mine (lang_title, lang_words, my_lang) VALUES('only_followers_can_view', 'Only people following you can view a private profile', 1)");
}

if(!$dbase->SelectRecord("SELECT * FROM lang_mine WHERE lang_title = 'password_reset'")){
$dbase->UpdateRecord("INSERT INTO lang_mine (lang_title, lang_words, my_lang) VALUES('password_reset', 'Your password has been reset', 1)");
}

if(!$dbase->SelectRecord("SELECT * FROM lang_mine WHERE lang_title = 'private'")){
$dbase->UpdateRecord("INSERT INTO lang_mine (lang_title, lang_words, my_lang) VALUES('private', 'Private', 1)");
}

if(!$dbase->SelectRecord("SELECT * FROM lang_mine WHERE lang_title = 'private_timeline'")){
$dbase->UpdateRecord("INSERT INTO lang_mine (lang_title, lang_words, my_lang) VALUES('private_timeline', 'Private Timeline', 1)");
}

if(!$dbase->SelectRecord("SELECT * FROM lang_mine WHERE lang_title = 'private_network'")){
$dbase->UpdateRecord("INSERT INTO lang_mine (lang_title, lang_words, my_lang) VALUES('private_network', 'This is a private network', 1)");
}

if(!$dbase->SelectRecord("SELECT * FROM lang_mine WHERE lang_title = 'public'")){
$dbase->UpdateRecord("INSERT INTO lang_mine (lang_title, lang_words, my_lang) VALUES('public', 'Public', 1)");
}

if(!$dbase->SelectRecord("SELECT * FROM lang_mine WHERE lang_title = 'receive_notifications'")){
$dbase->UpdateRecord("INSERT INTO lang_mine (lang_title, lang_words, my_lang) VALUES('receive_notifications', 'Receive email notifications', 1)");
}

if(!$dbase->SelectRecord("SELECT * FROM lang_mine WHERE lang_title = 'resend'")){
$dbase->UpdateRecord("INSERT INTO lang_mine (lang_title, lang_words, my_lang) VALUES('resend', 'Resend', 1)");
}

if(!$dbase->SelectRecord("SELECT * FROM lang_mine WHERE lang_title = 'search'")){
$dbase->UpdateRecord("INSERT INTO lang_mine (lang_title, lang_words, my_lang) VALUES('search', 'Search', 1)");
}

if(!$dbase->SelectRecord("SELECT * FROM lang_mine WHERE lang_title = 'status'")){
$dbase->UpdateRecord("INSERT INTO lang_mine (lang_title, lang_words, my_lang) VALUES('status', 'Status', 1)");
}

if(!$dbase->SelectRecord("SELECT * FROM lang_mine WHERE lang_title = 'warning_logged_in_as_admin'")){
$dbase->UpdateRecord("INSERT INTO lang_mine (lang_title, lang_words, my_lang) VALUES('warning_logged_in_as_admin', 'Warning - You are viewing this page as Site Admin and will be able to delete content', 1)");
}

if(!$dbase->SelectRecord("SELECT * FROM lang_mine WHERE lang_title = 'TUVOK'")){
$dbase->UpdateRecord("INSERT INTO lang_mine (lang_title, lang_words, my_lang) VALUES('TUVOK', 'Warning - You are viewing this page as Site Admin and will be able to delete content', 1)");
}

//______________Revision x - x x 2009______________________________________________________________________________________________


echo 'Complete...you can now close this window ..and delete the setup folder';

@mysql_close();
}else{

echo'
<div align="center">
  <center>
  <form action="dbupdate.php" method="post">
  <table border="0" cellpadding="0" cellspacing="0" width="675" height="112" style="border: 1px solid #6699FF">
    <tr>
      <td bgcolor="#6699FF" height="28" width="671">
        <p align="center"><b><font color="#FFFFFF">Floopo Database Updating
        Script</font></b></td>
    </tr>
    <tr>
      <td height="21" width="671" bgcolor="#FFFFFF"></td>
    </tr>
    <tr>
      <td height="21" width="671" bgcolor="#FFFFFF">
        <p align="center"><font face="Arial" size="2">Run this script <b>
        only</b> if you are doing an <b> update</b> of your existing floopo installation. </font></p>
      </td>
    </tr>
    <tr>
      <td height="6" width="671" bgcolor="#FFFFFF"></td>
    </tr>
    <tr>
      <td height="5" width="671" bgcolor="#FFFFFF" align="center"><font face="Arial" size="2"><b><font color="#FF0000">Important:
        </font></b>Running this update <b><u>may</u></b> reset some information
        held in your database. This can
        include some language changes, email notifications changes etc.
        These reset changes should be <b>minimal.</b></font></td>
    </tr>
    <tr>
      <td height="5" width="671" bgcolor="#FFFFFF" align="center">&nbsp;</td>
    </tr>
    <tr>
      <td height="5" width="671" bgcolor="#E8E8E8">
        <p align="center"><font face="Arial" size="2">User data and general
        content should not be affected. However make sure you have done a backup
        just in case.</font></td>
    </tr>
    <tr>
      <td height="3" width="671" bgcolor="#FFFFFF">
        <p align="center">&nbsp;</td>
    </tr>
    <tr>
      <td height="2" width="671" bgcolor="#FFFFFF">
        <p align="center"><input type="submit" value="I agree - Update my Database" name="submit"></td>
    </tr>
    <tr>
      <td height="21" width="671" bgcolor="#FFFFFF"></td>
    </tr>
  </table>
  </form>
  </center>
</div>';
}



?>