PHP Classes
elePHPant
Icontem

File: func.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Viktor  >  Universal comment module  >  func.php  >  Download  
File: func.php
Role: Auxiliary script
Content type: text/plain
Description: Shared functions
Class: Universal comment module
Generic site comments system
Author: By
Last change:
Date: 6 years ago
Size: 1,126 bytes
 

Contents

Class file image Download
<?php

   
function dump($var)
    {
        echo
"<pre>";
       
print_r($var);
        echo
"</pre>";
    }
   
    function
getCase()
    {
        if(isset(
$_REQUEST['case']) && $_REQUEST['case'] !='')
        {
            return
$_REQUEST['case'];
        }
        else
            return
"";
    }
   
    function
testArray($arr)
    {
        if(
is_array($arr) && sizeof($arr) >0)
            return
true;
        else
            return
false;
    }
   
    function
escape($str)
    {
        return
mysql_escape_string($str);
    }
   
   
       
/**
     * Redirect
     *
     * @param any variable
     * @return void
     */
   
function redirect($url)
    {
       
$str = "
                <html>
                    <body>
                        <script language='JavaScript1.1'>
                            location.href='
$url';
                        </script>
                    </body>
                </html>
            "
;
        if(!
headers_sent())
        {
           
header("Location: $url");
            echo
$str;
            exit;
        }
        else
        {
           
            echo
$str;
        }
        exit;
    }
   
   
   
    function
isLogin($r = false)
    {
       
        if(
$_SESSION['login']['id'] > 0 && $_SESSION['login']['status'] == 'E' )
        {
            return
$_SESSION['login']['id'];
        }
        elseif(
$r)
        {
           
redirect(_FULL_URL."admin/?case=login");
        }
        return
0;
    }
   
   
   
?>