/** * hook_theme() */ function bootstrap_theme(&$existing, $type, $theme, $path) { // If we are auto-rebuilding the theme registry, warn about the feature. if (function_exists('user_access') && user_access('administer site configuration') && theme_get_setting('bootstrap_rebuild_registry') && (arg(0) == 'admin' || flood_is_allowed($GLOBALS['theme'] . '_rebuild_registry_warning', 3))) { flood_register_event($GLOBALS['theme'] . '_rebuild_registry_warning'); drupal_set_message(t('For easier theme development, the theme registry is being rebuilt on every page request. It is <em>extremely</em> important to <a href="!link">turn off this feature</a> on production websites.', array('!link' => url('admin/appearance/settings/' . $GLOBALS['theme']))), 'warning', FALSE); } return array('bootstrap_links' => array('variables' => array('links' => array(), 'attributes' => array(), 'heading' => NULL)), 'bootstrap_btn_dropdown' => array('variables' => array('links' => array(), 'attributes' => array(), 'type' => NULL))); }
/** * Implements hook_theme(). */ function bootstrap_theme(&$existing, $type, $theme, $path) { // If we are auto-rebuilding the theme registry, warn about the feature. if (isset($GLOBALS['user']) && function_exists('user_access') && user_access('administer site configuration') && theme_get_setting('bootstrap_rebuild_registry') && (arg(0) == 'admin' || flood_is_allowed($GLOBALS['theme'] . '_rebuild_registry_warning', 3))) { flood_register_event($GLOBALS['theme'] . '_rebuild_registry_warning'); drupal_set_message(t('For easier theme development, the theme registry is being rebuilt on every page request. It is <em>extremely</em> important to <a href="!link">turn off this feature</a> on production websites.', array('!link' => url('admin/appearance/settings/' . $GLOBALS['theme']))), 'warning', FALSE); } return array('bootstrap_links' => array('variables' => array('links' => array(), 'attributes' => array(), 'heading' => NULL)), 'bootstrap_btn_dropdown' => array('variables' => array('links' => array(), 'attributes' => array(), 'type' => NULL)), 'bootstrap_modal' => array('variables' => array('heading' => '', 'body' => '', 'footer' => '', 'attributes' => array(), 'html_heading' => FALSE)), 'bootstrap_accordion' => array('variables' => array('id' => '', 'elements' => array())), 'bootstrap_search_form_wrapper' => array('render element' => 'element'), 'bootstrap_append_element' => array('render element' => 'element'), 'user_register_form' => array('template' => 'templates/user_register', 'render element' => 'form', 'preprocess functions' => array('bootstrap_preprocess_user_register')), 'user_profile_form' => array('template' => 'templates/user_profile_form', 'render element' => 'form', 'preprocess functions' => array('bootstrap_preprocess_user_profile_form'))); }
/** * {@inheritdoc} * * @see user_login_authenticate_validate(). */ public function authenticate(array $request = array(), $method = \RestfulInterface::GET) { list($username, $password) = $this->getCredentials(); // Do not allow any login from the current user's IP if the limit has been // reached. Default is 50 failed attempts allowed in one hour. This is // independent of the per-user limit to catch attempts from one IP to log // in to many different user accounts. We have a reasonably high limit // since there may be only one apparent IP for all users at an institution. if (!flood_is_allowed('failed_login_attempt_ip', variable_get('user_failed_login_ip_limit', 50), variable_get('user_failed_login_ip_window', 3600))) { throw new RestfulFloodException(format_string('Rejected by ip flood control.')); } if (!$uid = db_query_range("SELECT uid FROM {users} WHERE name = :name AND status = 1", 0, 1, array(':name' => $username))->fetchField()) { // Always register an IP-based failed login event. flood_register_event('failed_login_attempt_ip', variable_get('user_failed_login_ip_window', 3600), ip_address()); return; } if (variable_get('user_failed_login_identifier_uid_only', FALSE)) { // Register flood events based on the uid only, so they apply for any // IP address. This is the most secure option. $identifier = $uid; } else { // The default identifier is a combination of uid and IP address. This // is less secure but more resistant to denial-of-service attacks that // could lock out all users with public user names. $identifier = $uid . '-' . ip_address(); } // Don't allow login if the limit for this user has been reached. // Default is to allow 5 failed attempts every 6 hours. if (flood_is_allowed('failed_login_attempt_user', variable_get('user_failed_login_user_limit', 5), variable_get('user_failed_login_user_window', 21600), $identifier)) { // We are not limited by flood control, so try to authenticate. if ($uid = user_authenticate($username, $password)) { // Clear the user based flood control. flood_clear_event('failed_login_attempt_user', $identifier); return user_load($uid); } flood_register_event('failed_login_attempt_user', variable_get('user_failed_login_user_window', 3600), $identifier); } else { flood_register_event('failed_login_attempt_user', variable_get('user_failed_login_user_window', 3600), $identifier); throw new RestfulFloodException(format_string('Rejected by user flood control.')); } }
/** * Implements HOOK_theme(). * Theme FORM. */ function magazeen_theme(&$existing, $type, $theme, $path) { // Compute the conditional stylesheets. if (!module_exists('conditional_styles')) { include_once './' . drupal_get_path('theme', 'magazeen') . '/include/template.conditional-styles.inc'; // _conditional_styles_theme() only needs to be run once. if ($theme == 'magazeen') { _conditional_styles_theme($existing, $type, $theme, $path); } } // If we are auto-rebuilding the theme registry, warn about the feature. // Always display the warning in the admin section, otherwise limit to three // warnings per hour. if (user_access('administer site configuration') && theme_get_setting('rebuild_registry') && $theme == $GLOBALS['theme'] && (arg(0) == 'admin' || flood_is_allowed($GLOBALS['theme'] . '_rebuild_registry_warning', 3))) { flood_register_event($GLOBALS['theme'] . '_rebuild_registry_warning'); drupal_set_message(t('For easier theme development, the theme registry is being rebuilt on every page request. It is <em>extremely</em> important to <a href="!link">turn off this feature</a> on production websites.', array('!link' => url('admin/build/themes/settings/' . $GLOBALS['theme']))), 'warning', FALSE); } return array('comment_form' => array('arguments' => array('form' => NULL))); }
} } if (omega_theme_get_setting('omega_rebuild_aggregates', FALSE) && variable_get('preprocess_css', FALSE) && (!defined('MAINTENANCE_MODE') || MAINTENANCE_MODE != 'update')) { foreach (array('css', 'js') as $type) { variable_del('drupal_' . $type . '_cache_files'); foreach (file_scan_directory('public://' . $type . '', '/.*/') as $file) { // Delete files that are older than 20 seconds. if (REQUEST_TIME - filemtime($file->uri) > 20) { file_unmanaged_delete($file->uri); } } } if (flood_is_allowed('omega_' . $GLOBALS['theme'] . '_rebuild_aggregates_warning', 3)) { // Alert the user that the theme registry is being rebuilt on every // request. flood_register_event('omega_' . $GLOBALS['theme'] . '_rebuild_aggregates_warning'); drupal_set_message(t('The CSS and JS aggregates are being rebuilt on every request. Remember to <a href="!url">turn off</a> this feature on production websites.', array("!url" => url('admin/appearance/settings/' . $GLOBALS['theme']))), 'warning'); } } } } /** * Implements hook_element_info_alter(). */ function omega_element_info_alter(&$elements) { $elements['scripts'] = array('#items' => array(), '#pre_render' => array('omega_pre_render_scripts'), '#group_callback' => 'omega_group_js', '#aggregate_callback' => 'omega_aggregate_js'); } /** * Implements hook_css_alter(). */