PHP Classes

File: WICore/WIClass/WIHelperFunctions.php

Recommend this page to a friend!
  Classes of Jules Warner   WICMS   WICore/WIClass/WIHelperFunctions.php   Download  
File: WICore/WIClass/WIHelperFunctions.php
Role: Example script
Content type: text/plain
Description: Example script
Class: WICMS
Database driven content management system with PDO
Author: By
Last change:
Date: 7 years ago
Size: 1,021 bytes
 

Contents

Class file image Download
<?php

function redirect($url)
{
   
$url = rtrim(SCRIPT_URL, '/') . '/' . ltrim($url, '/');

    if ( !
headers_sent() )
    {
       
header('Location: '.$url, TRUE, 302);
        exit;
    }
    else
    {
        echo
'<script type="text/javascript">';
        echo
'window.location.href="'.$url.'";';
        echo
'</script>';
        echo
'<noscript>';
        echo
'<meta http-equiv="refresh" content="0;url='.$url.'" />';
        echo
'</noscript>';
        exit;
    }
}

function
get_redirect_page()
{
   
$login = new WILogin();

    if (
$login->isLoggedIn() )
    {
       
$user = new WIUser(WISession::get("user_id"));
       
$role = $user->getRole();
    }
    else
       
$role = 'default';

   
$redirect = unserialize(SUCCESS_LOGIN_REDIRECT);

    if ( ! isset(
$redirect['default']) )
       
$redirect['default'] = 'index.php';

    return isset(
$redirect[$role]) ? $redirect[$role] : $redirect['default'];
}


function
e($value)
{
    return
htmlentities($value, ENT_QUOTES, 'UTF-8', false);
}