<?php
/**
 * Created by PhpStorm.
 * User: jaskokoyn
 * Date: 2/21/2015
 * Time: 12:47 PM
 */

include( '../../inc/db.php' );
include( '../../inc/functions.php' );

if(!isset($_SESSION['loggedin']) || $user['mem_level'] != 2){
    die("AYYYYYY");
}

$auto_clean_hours       =   secure($_POST['auto_clean_hours']);
$room_creation          =   secure($_POST['room_creation']);
$guest_chat             =   secure($_POST['guest_chat']);
$font_family            =   secure($_POST['font_family']);
$color                  =   secure($_POST['color']);
$bold                   =   secure($_POST['bold']);
$italic                 =   secure($_POST['italic']);
$emoticon               =   secure($_POST['emoticon']);
$images                 =   secure($_POST['images']);
$url                    =   secure($_POST['url']);
$yt                     =   secure($_POST['yt']);
$private_chat           =   secure($_POST['private_chat']);

$updateSettingsQuery    =   $db->prepare("UPDATE settings SET auto_clean_db = :acd,
                                                              room_creation = :rc,
                                                              guests_chat = :gc,
                                                              font_family_btn = :ffb,
                                                              color_btn = :cb,
                                                              bold_btn = :bb,
                                                              italic_btn = :ib,
                                                              emoticon_btn = :eb,
                                                              images_btn = :imgb,
                                                              url_btn = :ub,
                                                              youtube_btn = :yb,
                                                              private_chat = :pc
                                          WHERE id = :id");
$updateSettingsQuery->execute(array(
    ":acd"   =>  $auto_clean_hours,
    ":rc"   =>  $room_creation,
    ":gc"   =>  $guest_chat,
    ":ffb"   =>  $font_family,
    ":cb"   =>  $color,
    ":bb"   =>  $bold,
    ":ib"   =>  $italic,
    ":eb"   =>  $emoticon,
    ":imgb"   =>  $images,
    ":ub"   =>  $url,
    ":yb"   =>  $yt,
    ":pc"   =>  $private_chat,
    ":id"   =>  1
));

die("SUCCESS");