public function getSelfRegister()
 {
     $settings = GeneralSettings::first();
     if (!$settings->self_signup) {
         $this->notifyError("Self Signup Not Allowed.");
         return Redirect::route('user-panel');
     }
     return View::make('user.self-registration');
 }
 private function _seedSettings()
 {
     GeneralSettings::truncate();
     SmtpSettings::truncate();
     PaypalSettings::truncate();
     GeneralSettings::insert(['idle_timeout' => 0, 'self_signup' => 0]);
     SmtpSettings::insert(['status' => 0]);
     PaypalSettings::insert(['status' => 0, 'sandbox' => 0]);
     DirecpaySetting::insert(['status' => 0, 'sandbox' => 0]);
 }
 public function postGeneral()
 {
     if (!Input::has('id')) {
         return Redirect::route('setting.general')->with('error', 'Required parameter(s) missing.');
     }
     try {
         $input = Input::all();
         $setting = GeneralSettings::find($input['id']);
         $setting->fill($input);
         $this->flash($setting->save());
         return Redirect::route('setting.general');
     } catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) {
         App::abort(404);
     }
 }
 /**
  * @param string $GENERAL_SETTINGS_LINK
  */
 public static function setGENERALSETTINGSLINK($GENERAL_SETTINGS_LINK)
 {
     self::$GENERAL_SETTINGS_LINK = $GENERAL_SETTINGS_LINK;
 }
Example #5
0
/**
 * Database connection (connection opened here)
 *
 * @global DB $DB
 */
$DB = new DB($db_config);
/**
 * Load settings class
 */
load_class('settings/model/_generalsettings.class.php', 'GeneralSettings');
/**
 * Interface to general settings
 *
 * Keep this below the creation of the {@link $DB DB object}, because it checks for the
 * correct db_version and catches "table does not exist" errors, providing a link to the
 * install script.
 *
 * @global GeneralSettings $Settings
 */
$Settings = new GeneralSettings();
$time_difference = $Settings->get('time_difference');
/**
 * Corrected Unix timestamp to match server timezone
 * @global int $localtimenow
 */
$localtimenow = $servertimenow + $time_difference;
/**
 * @global AbstractSettings
 */
$global_Cache = new AbstractSettings('T_global__cache', array('cach_name'), 'cach_cache', 0);
$Timer->pause('_init_db');
 public function getGeneralSettings()
 {
     $url = $this->getUrl() . GeneralSettings::$GENERAL_SETTINGS_LINK;
     $request = $this->setHeadersGet($url, $this->_oauthToken);
     $result = $this->doGet($request);
     if (array_key_exists('errors', $result)) {
         $errors_tmp = new Errors();
         foreach ($result as $errorData) {
             $errors_tmp = Errors::fromArray($errorData);
         }
         $errors[] = $errors_tmp;
         return $errors;
     } else {
         $response_tmp = GeneralSettings::fromArray($result);
         return $response_tmp;
     }
 }
$threshold_date = date2mysql($servertimenow - $unread_messsage_reminder_threshold);
// New unread messages reminder should be sent to a user if the last one was sent at least x days ago, where x depends from the configuration
// Get the minimum delay value from the configuration array
$minimum_delay = array_shift(array_values($unread_message_reminder_delay));
// Get the datetime which corresponds to the minimum delay value.
// If the last unread message reminder for a specific user is after this datetime, then notification must not be send to that user now.
$reminder_threshold = date2mysql($servertimenow - $minimum_delay * 86400);
if (empty($UserSettings)) {
    // initialize UserSettings
    load_class('users/model/_usersettings.class.php', 'UserSettings');
    $UserSettings = new UserSettings();
}
if (empty($Settings)) {
    // initialize GeneralSettings
    load_class('settings/model/_generalsettings.class.php', 'GeneralSettings');
    $Settings = new GeneralSettings();
}
// set condition to check if user wants to recive unread messages reminders
$notify_condition = '( notif_setting.uset_value IS NOT NULL AND notif_setting.uset_value <> ' . $DB->quote('0') . ' )';
if ($Settings->get('def_notify_unread_messages')) {
    // by default everybody should be notified, so notify those users who didn't explicitly set to not receive notifications
    $notify_condition .= ' OR notif_setting.uset_value IS NULL';
}
// Find user who have unread messages created more than x ( = configured threshold value ) hours ago, and have not been reminded in the last y ( = configured reminder delay for this user ) hours
// We needs to send reminder for these users, but the message must include all unread threads even if the last unread messages was created less then x hours
$query = 'SELECT DISTINCT user_ID, last_sent.uset_value
		FROM T_users
			INNER JOIN T_messaging__threadstatus ON tsta_user_ID = user_ID
			INNER JOIN T_messaging__message ON tsta_first_unread_msg_ID = msg_ID
			LEFT JOIN T_users__usersettings last_sent ON last_sent.uset_user_ID = user_ID AND last_sent.uset_name = "last_unread_messages_reminder"
			LEFT JOIN T_users__usersettings notif_setting ON notif_setting.uset_user_ID = user_ID AND notif_setting.uset_name = "notify_unread_messages"
Example #8
0
/**
 * Initialize cache settings and folders (during install or upgrade)
 *
 * This is called on install and on upgrade.
 */
function system_init_caches($verbose = false, $force_enable = true)
{
    global $cache_path, $Settings, $Plugins, $DB;
    // create /_cache and /_cache/plugins/ folders
    task_begin('Checking/creating <code>/_cache/</code> &amp; <code>/_cache/plugins/</code> folders...');
    if (!system_create_cache_folder($verbose)) {
        // The error message were displayed
        task_end('');
        return false;
    }
    task_end();
    if ($force_enable) {
        task_begin('Enabling page caching by default...');
        if (!is_object($Settings)) {
            // create Settings object
            load_class('settings/model/_generalsettings.class.php', 'GeneralSettings');
            $Settings = new GeneralSettings();
        }
        // New blog should have their cache enabled by default: (?)
        $Settings->set('newblog_cache_enabled', true);
        // Enable general cache
        set_cache_enabled('general_cache_enabled', true);
        // Enable caches for all collections:
        $existing_blogs = system_get_blog_IDs(false);
        foreach ($existing_blogs as $blog_ID) {
            set_cache_enabled('cache_enabled', true, $blog_ID);
        }
        task_end();
    }
}