$fileSize = filesize('includes/options.inc.php'); // Get the options from the db, will by default have a false value $dbTimeStamp = Options::get('modified'); $dbFileSize = Options::get('filesize'); // Force the filesize and modification date to strings to be able to compare it with the DB settype($lastEdit, 'string'); settype($fileSize, 'string'); $optionsUpdate = false; // Update version based on the date and / or filesize. This will also work if the db is empty if ($dbTimeStamp !== $lastEdit or $dbFileSize !== $fileSize) { $optionsUpdate = true; Options::groupAdd('Website Settings', 'basic website information'); Options::groupAdd('META Data', 'control the Meta Data for the website'); Options::groupAdd('Email Templates', 'variables used in Email Templates'); Options::groupAdd('Miscellaneous', 'general settings page, not editible'); Options::groupAdd('User Settings', "options visible in the user's settings page"); // Set the timestamp and filesize Options::add('modified', $lastEdit, 'hidden', 'Miscellaneous'); // Do not modify these, they need to be static Options::add('filesize', $fileSize, 'hidden', 'Miscellaneous'); // Do not modify these, they need to be static // These would be the options you want to set, it will first // Site Options::addOnce('siteName', 'http://www.mysite.co.za', 'input', 'Website Settings'); Options::addOnce('siteLogo', 'assets/img/logo.png', 'input', 'Website Settings'); Options::addOnce('siteIcon', 'assets/img/icon.png', 'input', 'Website Settings'); Options::addOnce('prettyName', '<small>www.</small>MySite<small>.co.za</small>', 'input', 'Website Settings'); // Email Templates Options::addOnce('emailName', 'www.MySite.co.za', 'input', 'Email Templates'); Options::addOnce('emailInfo', '*****@*****.**', 'input', 'Email Templates'); Options::addOnce('emailAdmin', '*****@*****.**', 'input', 'Email Templates');
$lastEdit = $lastEdit['mtime']; $fileSize = filesize('includes/options.inc.php'); // Get the options from the db, will by default have a false value $dbTimeStamp = get_option('modified'); $dbFileSize = get_option('filesize'); // Force the filesize and modification date to strings to be able to compare it with the DB settype($lastEdit, 'string'); settype($fileSize, 'string'); $optionsUpdate = false; // Update version based on the date and / or filesize. This will also work if the db is empty if ($dbTimeStamp !== $lastEdit or $dbFileSize !== $fileSize) { $optionsUpdate = true; Options::groupAdd('Website Settings', 'basic website information'); Options::groupAdd('META Data', 'control the Meta Data for the website'); Options::groupAdd('Email Templates', 'variables used in Email Templates'); Options::groupAdd('Miscellaneous', 'general settings page'); // Set the timestamp and filesize Options::add('modified', $lastEdit, 'hidden'); // Do not modify these, they need to be static Options::add('filesize', $fileSize, 'hidden'); // Do not modify these, they need to be static // These would be the options you want to set, it will first // Site Options::add('siteName', 'http://www.mysite.co.za', 'input', 'Website Settings'); Options::add('siteLogo', 'assets/img/logo.png', 'input', 'Website Settings'); Options::add('siteIcon', 'assets/img/icon.png', 'input', 'Website Settings'); Options::add('prettyName', '<small>www.</small>MySite<small>.co.za</small>', 'input', 'Website Settings'); // Email Templates Options::add('emailName', 'www.MySite.co.za', 'input', 'Email Templates'); Options::add('emailInfo', '*****@*****.**', 'input', 'Email Templates'); Options::add('emailAdmin', '*****@*****.**', 'input', 'Email Templates');
public static function groupSet($group, $desc = '') { return Options::groupAdd($group, $desc); }
// Set the option to the new value Options::set($dateOption, $timestamp); $changes = true; } } } if (isset($_POST['action']) && $_POST['action'] == 'update') { Options::set($_POST['option'], Options::get($_POST['option']), $_POST['type'], $_POST['group']); $changes = true; } if (isset($_POST['action']) && $_POST['action'] == 'add') { Options::set($_POST['option_name'], $_POST['option_value'], $_POST['type'], $_POST['group']); $changes = true; } if (isset($_POST['action']) && $_POST['action'] == 'group_add') { Options::groupAdd($_POST['group_name'], $_POST['group_desc']); $changes = true; } if (isset($_POST['action']) && $_POST['action'] == 'group_remove') { Options::groupRemove($_POST['group']); $changes = true; } if (isset($_POST['action']) && $_POST['action'] == 'remove') { Options::remove($_POST['option']); $changes = true; } } $title = "Admin <small>take control</small>"; Template::setBaseDir('./assets/tmpl'); $html = Template::loadTemplate('layout', array('header' => Template::loadTemplate('header', array('title' => $title, 'user' => $user, 'admin' => $isadmin, 'msg' => $msg, 'selected' => 'admin')), 'content' => Template::loadTemplate('admin', array('changes' => $changes)), 'footer' => Template::loadTemplate('footer', array('time_start' => $time_start)))); echo $html;