Exemple #1
0
$table_votes_coleg = new \UserFrosting\DatabaseTable($app->config('db')['db_prefix'] . "votes_coleg");
$table_votes_osi = new \UserFrosting\DatabaseTable($app->config('db')['db_prefix'] . "votes_osi");
$table_votes_pbidea = new \UserFrosting\DatabaseTable($app->config('db')['db_prefix'] . "votes_pbidea");
\UserFrosting\Database::setTable("user", $table_user);
\UserFrosting\Database::setTable("group", $table_group);
\UserFrosting\Database::setTable("group_user", $table_group_user);
\UserFrosting\Database::setTable("configuration", $table_configuration);
\UserFrosting\Database::setTable("authorize_user", $table_authorize_user);
\UserFrosting\Database::setTable("authorize_group", $table_authorize_group);
\UserFrosting\Database::setTable("bud", $table_bud);
\UserFrosting\Database::setTable("votes_bud", $table_votes_bud);
\UserFrosting\Database::setTable("coleg", $table_coleg);
\UserFrosting\Database::setTable("votes_coleg", $table_votes_coleg);
\UserFrosting\Database::setTable("osi", $table_osi);
\UserFrosting\Database::setTable("votes_osi", $table_votes_osi);
\UserFrosting\Database::setTable("pbidea", $table_pbidea);
// Initialize static loader classes
\UserFrosting\UserLoader::init($table_user);
\UserFrosting\GroupLoader::init($table_group);
\UserFrosting\BudLoader::init($table_bud);
\UserFrosting\ColegLoader::init($table_coleg);
\UserFrosting\OsiLoader::init($table_osi);
\UserFrosting\PBideaLoader::init($table_pbidea);
/* Load UserFrosting site settings */
// Default settings
$setting_values = ['userfrosting' => ['site_title' => 'UserFrosting', 'admin_email' => '*****@*****.**', 'email_login' => '1', 'can_register' => '1', 'enable_captcha' => '1', 'require_activation' => '1', 'resend_activation_threshold' => '0', 'reset_password_timeout' => '10800', 'default_locale' => 'en_US', 'minify_css' => '0', 'minify_js' => '0', 'version' => '0.3.0', 'author' => 'Alex Weissman', 'show_terms_on_register' => '1', 'site_location' => 'The State of Indiana']];
$setting_descriptions = ['userfrosting' => ["site_title" => "The title of the site.  By default, displayed in the title tag, as well as the upper left corner of every user page.", "admin_email" => "The administrative email for the site.  Automated emails, such as activation emails and password reset links, will come from this address.", "email_login" => "Specify whether users can login via email address or username instead of just username.", "can_register" => "Specify whether public registration of new accounts is enabled.  Enable if you have a service that users can sign up for, disable if you only want accounts to be created by you or an admin.", "enable_captcha" => "Specify whether new users must complete a captcha code when registering for an account.", "require_activation" => "Specify whether email activation is required for newly registered accounts.  Accounts created on the admin side never need to be activated.", "resend_activation_threshold" => "The time, in seconds, that a user must wait before requesting that the activation email be resent.", "reset_password_timeout" => "The time, in seconds, before a user's password reminder email expires.", "default_locale" => "The default language for newly registered users.", "minify_css" => "Specify whether to use concatenated, minified CSS (production) or raw CSS includes (dev).", "minify_js" => "Specify whether to use concatenated, minified JS (production) or raw JS includes (dev).", "version" => "The current version of UserFrosting.", "author" => "The author of the site.  Will be used in the site's author meta tag.", "show_terms_on_register" => "Specify whether or not to show terms and conditions when registering.", "site_location" => "The nation or state in which legal jurisdiction for this site falls."]];
// Load site settings
$app->site = new \UserFrosting\SiteSettings($setting_values, $setting_descriptions);
// Store to DB if not consistent
if (!$app->site->isConsistent()) {
defined("GROUP_DEFAULT_PRIMARY") or define("GROUP_DEFAULT_PRIMARY", 2);
// Pass Slim app to database
\UserFrosting\Database::$app = $app;
// Initialize database properties
$table_user = new \UserFrosting\DatabaseTable($app->config('db')['db_prefix'] . "user", ["user_name", "display_name", "password", "email", "activation_token", "last_activation_request", "lost_password_request", "lost_password_timestamp", "active", "title", "sign_up_stamp", "last_sign_in_stamp", "enabled", "primary_group_id", "locale"]);
$table_group = new \UserFrosting\DatabaseTable($app->config('db')['db_prefix'] . "group", ["name", "is_default", "can_delete", "theme", "landing_page", "new_user_title", "icon"]);
$table_group_user = new \UserFrosting\DatabaseTable($app->config('db')['db_prefix'] . "group_user");
$table_configuration = new \UserFrosting\DatabaseTable($app->config('db')['db_prefix'] . "configuration");
$table_authorize_user = new \UserFrosting\DatabaseTable($app->config('db')['db_prefix'] . "authorize_user");
$table_authorize_group = new \UserFrosting\DatabaseTable($app->config('db')['db_prefix'] . "authorize_group");
\UserFrosting\Database::setTable("user", $table_user);
\UserFrosting\Database::setTable("group", $table_group);
\UserFrosting\Database::setTable("group_user", $table_group_user);
\UserFrosting\Database::setTable("configuration", $table_configuration);
\UserFrosting\Database::setTable("authorize_user", $table_authorize_user);
\UserFrosting\Database::setTable("authorize_group", $table_authorize_group);
// Initialize static loader classes
\UserFrosting\UserLoader::init($table_user);
\UserFrosting\GroupLoader::init($table_group);
/* Load UserFrosting site settings */
// Default settings
$setting_values = ['userfrosting' => ['site_title' => 'UserFrosting', 'admin_email' => '*****@*****.**', 'email_login' => '1', 'can_register' => '1', 'enable_captcha' => '1', 'require_activation' => '1', 'resend_activation_threshold' => '0', 'reset_password_timeout' => '10800', 'default_locale' => 'en_US', 'minify_css' => '0', 'minify_js' => '0', 'version' => '0.3.0', 'author' => 'Alex Weissman', 'show_terms_on_register' => '1', 'site_location' => 'The State of Indiana']];
$setting_descriptions = ['userfrosting' => ["site_title" => "The title of the site.  By default, displayed in the title tag, as well as the upper left corner of every user page.", "admin_email" => "The administrative email for the site.  Automated emails, such as activation emails and password reset links, will come from this address.", "email_login" => "Specify whether users can login via email address or username instead of just username.", "can_register" => "Specify whether public registration of new accounts is enabled.  Enable if you have a service that users can sign up for, disable if you only want accounts to be created by you or an admin.", "enable_captcha" => "Specify whether new users must complete a captcha code when registering for an account.", "require_activation" => "Specify whether email activation is required for newly registered accounts.  Accounts created on the admin side never need to be activated.", "resend_activation_threshold" => "The time, in seconds, that a user must wait before requesting that the activation email be resent.", "reset_password_timeout" => "The time, in seconds, before a user's password reminder email expires.", "default_locale" => "The default language for newly registered users.", "minify_css" => "Specify whether to use concatenated, minified CSS (production) or raw CSS includes (dev).", "minify_js" => "Specify whether to use concatenated, minified JS (production) or raw JS includes (dev).", "version" => "The current version of UserFrosting.", "author" => "The author of the site.  Will be used in the site's author meta tag.", "show_terms_on_register" => "Specify whether or not to show terms and conditions when registering.", "site_location" => "The nation or state in which legal jurisdiction for this site falls."]];
// Load site settings
$app->site = new \UserFrosting\SiteSettings($setting_values, $setting_descriptions);
// Store to DB if not consistent
if (!$app->site->isConsistent()) {
    $app->site->store();
}
/** Register site settings with site settings config page */
$app->hook('settings.register', function () use($app) {