- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
<?php
/**
* Sticky Notes pastebin
* @ver 0.1
* @license BSD License - www.opensource.org/licenses/bsd-license.php
*
* Copyright (c) 2011 Sayak Banerjee <[email protected]>
* All rights reserved. Do not remove this copyright notice.
*/
class core
{
// Global vars
var $build;
// Constructor
function __construct()
{
$this->build = '0.1.17122010.2';
}
// Function to return root path
function path()
{
$path = $_SERVER['PHP_SELF'];
$snip = strrpos($path, '/');
$path = substr($path, 0, $snip + 1);
return $path;
}
// Function to return remote IP
function remote_ip()
{
return $_SERVER['REMOTE_ADDR'];
}
// Function to set a cookie
function setcookie($name, $value, $expire = 0)
{
setcookie('stickynotes_' . $name, $value, $expire);
}
// Slash fix
function fixslashes(&$data, $list = false)
{
global $db;
$data = addslashes($data);
$db->unescape($data);
}
// Function to fetch query strings / post data
function variable($name, $default, $is_cookie = false)
{
if (gettype($default) == "integer")
{
settype($default, "double");
}
if ($is_cookie && isset($_COOKIE['stickynotes_' . $name]))
{
$cookie_data = $_COOKIE['stickynotes_' . $name];
settype($cookie_data, gettype($default));
return $cookie_data;
}
else if (isset($_POST[$name]))
{
$post_data = $_POST[$name];
settype($post_data, gettype($default));
return $post_data;
}
else if (isset($_GET[$name]))
{
$get_data = $_GET[$name];
settype($get_data, gettype($default));
return $get_data;
}
else
{
return $default;
}
}