$value) { $$key = $value; } //Set some variables ini_set("display_errors", 1); ini_set("error_reporting", E_ALL | E_STRICT); $data = false; $databaseLocation = "databaseLocation.ini.php"; $needSetup = "Yes"; $tabSetup = "Yes"; $hasOptions = "No"; $settingsicon = "No"; $settingsActive = ""; $action = ""; $loadingIcon = "images/organizr-load-w-thick.gif"; $baseURL = ""; $dbcreated = false; $splash = false; // Get Action if(isset($_POST['action'])) { $action = $_POST['action']; unset($_POST['action']); } //Get Invite Code $inviteCode = isset($_GET['inviteCode']) ? $_GET['inviteCode'] : null; // Check for config file if(!file_exists('config/config.php')) { if($action == "createLocation") { if (isset($_POST['database_Location'])) { $_POST['database_Location'] = str_replace('//','/',$_POST['database_Location'].'/'); if(substr($_POST['database_Location'], -1) != "/") : $_POST['database_Location'] = $_POST['database_Location'] . "/"; endif; $_POST['user_home'] = $_POST['database_Location'].'users/'; } if (file_exists($_POST['database_Location'])) { updateConfig($_POST); } else { debug_out('Dir doesn\'t exist: '.$_POST['database_Location'],1); // Pretty Up } } else { $configReady = "No"; $userpic = ""; $showPic = ""; } } if (file_exists('config/config.php')) { if (!DATABASE_LOCATION){ die(header("Refresh:0")); } $configReady = "Yes"; require_once("user.php"); $USER = new User("registration_callback"); $group = $USER->role; $dbfile = DATABASE_LOCATION . constant('User::DATABASE_NAME') . ".db"; $database = new PDO("sqlite:" . $dbfile); $query = "SELECT * FROM users"; foreach($database->query($query) as $data) { $needSetup = "No"; } $db = DATABASE_LOCATION . constant('User::DATABASE_NAME') . ".db"; $file_db = new PDO("sqlite:" . $db); $file_db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $dbTab = q2a($file_db->query('SELECT name FROM sqlite_master WHERE type="table" AND name="tabs"')); $dbOptions = q2a($file_db->query('SELECT name FROM sqlite_master WHERE type="table" AND name="options"')); if (is_array($dbTab)) { foreach($dbTab as $row) { if (in_array("tabs", $row)) { $tabSetup = "No"; } } } if($tabSetup == "Yes"){ $settingsActive = "active"; } if (is_array($dbOptions)) { foreach($dbOptions as $row) { if (in_array("options", $row)) { $hasOptions = "Yes"; } } } if($tabSetup == "No") { if($USER->authenticated && $USER->role == "admin") { $result = q2a($file_db->query('SELECT * FROM tabs WHERE active = "true" ORDER BY `order` asc')); $splash = q2a($file_db->query('SELECT * FROM tabs WHERE active = "true" AND splash = "true" ORDER BY `order` asc')); if (is_array($result)) { foreach($result as $row) { if(!empty($row['iconurl']) && $settingsicon == "No") { $settingsicon = "Yes"; } } } }elseif($USER->authenticated && $USER->role == "user") { $result = q2a($file_db->query('SELECT * FROM tabs WHERE active = "true" AND user = "true" ORDER BY `order` asc')); $splash = q2a($file_db->query('SELECT * FROM tabs WHERE active = "true" AND splash = "true" AND user = "true" ORDER BY `order` asc')); }else { $result = q2a($file_db->query('SELECT * FROM tabs WHERE active = "true" AND guest = "true" ORDER BY `order` asc')); $splash = q2a($file_db->query('SELECT * FROM tabs WHERE active = "true" AND splash = "true" AND guest = "true" ORDER BY `order` asc')); } } $userpic = md5( strtolower( trim( $USER->email ) ) ); $showPic = ""; if(LOADINGICON !== "") : $loadingIcon = LOADINGICON; endif; if(SLIMBAR == "true") : $slimBar = "30"; $userSize = "25"; else : $slimBar = "56"; $userSize = "40"; endif; //NEW CHAT if(CHAT == "true" && qualifyUser(CHATAUTH)){ if( $db = new SQLite3("chatpack.db") ){ if( $db->busyTimeout(5000) ){ if( $db->exec("PRAGMA journal_mode = wal;") ) { $logtable = "CREATE TABLE IF NOT EXISTS chatpack_log (id INTEGER PRIMARY KEY, timestamp INTEGER NOT NULL, user TEXT NOT NULL, avatar TEXT NOT NULL, message TEXT NOT NULL, liked INTEGER DEFAULT 0)"; if( $db->exec($logtable) ){ $usertable = "CREATE TABLE IF NOT EXISTS chatpack_typing (id INTEGER PRIMARY KEY, timestamp INTEGER NOT NULL, user TEXT NOT NULL)"; $onlinetable = "CREATE TABLE IF NOT EXISTS chatpack_last_message ( user TEXT PRIMARY KEY NOT NULL, timestamp INTEGER NOT NULL, avatar TEXT NOT NULL)"; if( $db->exec($usertable) && $db->exec($onlinetable) ){ $dbcreated = true; }else{ errormessage("creating database table for typing"); } }else{ errormessage("creating database table for messages"); } if( !$db->close() ){ errormessage("closing database connection"); } }else{ errormessage("setting journal mode"); } }else{ errormessage("setting busy timeout"); } }else{ errormessage("using SQLite"); } } } if(!defined('SLIMBAR')) : define('SLIMBAR', 'true'); endif; if(!defined('AUTOHIDE')) : define('AUTOHIDE', 'false'); endif; if(!defined('ENABLEMAIL')) : define('ENABLEMAIL', 'false'); endif; if(!defined('CUSTOMCSS')) : define('CUSTOMCSS', 'false'); endif; if(!defined('LOADINGSCREEN')) : define('LOADINGSCREEN', 'true'); endif; if(!isset($notifyExplode)) : $notifyExplode = array("bar","slidetop"); endif; if(SLIMBAR == "true") : $slimBar = "30"; $userSize = "25"; $chatSize = "142px"; else : $slimBar = "56"; $userSize = "40"; $chatSize = "171px";endif; if(file_exists("images/settings2.png")) : $iconRotate = "false"; $settingsIcon = "settings2.png"; else: $iconRotate = "true"; $settingsIcon = "settings.png"; endif; $group = (isset($group) ? $group : "guest"); ?> <?=$title;?><?php if($title !== "Organizr") : echo " - Organizr"; endif; ?>
authenticated && $tabSetup == "Yes" && $needSetup == "No") :?>
authenticated && $configReady == "Yes") : ?> authenticated) : ?> 1 && qualifyUser(SPLASHAUTH)) {?>