function front_page in Front Page 6
Same name and namespace in other branches
- 5 front_page.module \front_page()
- 6.2 front_page.module \front_page()
- 7.2 front_page.module \front_page()
- 7 front_page.module \front_page()
1 string reference to 'front_page'
- front_page_menu in ./front_page.module
- Implementation of hook_menu().
File
- ./front_page.module, line 236
Code
function front_page() {
$output = 'node';
switch (variable_get('front_special_notice_time', '')) {
case 'one day':
$check_time = time() - 24 * 60 * 60;
break;
case 'one week':
$check_time = time() - 7 * 24 * 60 * 60;
break;
case 'one month':
$check_time = time() - 30 * 24 * 60 * 60;
break;
case 'three months':
$check_time = time() - 90 * 24 * 60 * 60;
break;
case 'six months':
$check_time = time() - 180 * 24 * 60 * 60;
break;
case 'one year':
$check_time = time() - 360 * 24 * 60 * 60;
break;
}
if (variable_get('front_page_breadcrumb', 0) && isset($_SERVER['HTTP_REFERER'])) {
$newhome = variable_get('front_page_breadcrumb_redirect', 'node');
$ref = $_SERVER['HTTP_REFERER'];
global $user, $base_url;
$parsed_url = parse_url($base_url);
$domain = $parsed_url['host'];
if (stristr($ref, $domain)) {
drupal_goto($path = $newhome, $query = NULL, $fragment = NULL);
}
}
global $user;
if (!$user->uid) {
$output = variable_get('front_1_text', 'drupal');
if (variable_get('front_1_php', 0)) {
$output = drupal_eval($output);
}
$fptype = variable_get('front_1_type', 'drupal');
switch ($fptype) {
case 'themed':
print theme('page', $output);
return;
case 'full':
print $output;
return;
case 'redirect':
$output = variable_get('front_1_redirect', 'drupal');
drupal_goto($path = $output, $query = NULL, $fragment = NULL);
break;
}
}
$roles = "";
$roles = user_roles(FALSE, 'access frontpage');
krsort($roles);
$siteroles = count($roles);
if ($user->uid) {
foreach ($roles as $role_id => $role_name) {
if (array_key_exists($role_id, $user->roles)) {
if (variable_get('special_notice_text', '') != '' && $user->access < $check_time) {
$output = '<div id="mission">';
$output .= variable_get('special_notice_text', '');
$output .= '</div>';
$output .= variable_get('front_' . $role_id . '_text', '');
}
else {
$output = variable_get('front_' . $role_id . '_text', '');
}
if (variable_get('front_' . $role_id . '_php', 0)) {
$output = drupal_eval($output);
}
$fptype = variable_get('front_' . $role_id . '_type', 'drupal');
switch ($fptype) {
case 'themed':
print theme('page', $output);
return;
case 'full':
print $output;
return;
case 'same_as_anon':
$output = variable_get('front_1_text', 'drupal');
if (variable_get('front_1_php', 0)) {
$output = drupal_eval($output);
}
$fptype = variable_get('front_1_type', 'drupal');
switch ($fptype) {
case 'themed':
print theme('page', $output);
return;
case 'full':
print $output;
return;
case 'redirect':
$output = variable_get('front_1_redirect', 'drupal');
drupal_goto($path = $output, $query = NULL, $fragment = NULL);
break;
}
case 'sameasauth':
$output = variable_get('front_2_text', 'drupal');
if (variable_get('front_2_php', 0)) {
$output = drupal_eval($output);
}
$fptype = variable_get('front_2_type', 'drupal');
switch ($fptype) {
case 'themed':
print theme('page', $output);
return;
case 'full':
print $output;
return;
case 'redirect':
$output = variable_get('front_2_redirect', 'drupal');
drupal_goto($path = $output, $query = NULL, $fragment = NULL);
break;
}
case 'redirect':
$output = variable_get('front_' . $role_id . '_redirect', 'drupal');
drupal_goto($path = $output, $query = NULL, $fragment = NULL);
break;
}
}
}
}
}