This repository has been archived by the owner on Jul 10, 2019. It is now read-only.
forked from sayakb/sticky-notes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.php
executable file
·91 lines (76 loc) · 2.45 KB
/
init.php
1
2
3
4
5
6
7
8
9
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
88
89
90
91
<?php
/**
* Sticky Notes pastebin
* @ver 0.3
* @license BSD License - www.opensource.org/licenses/bsd-license.php
*
* Copyright (c) 2012 Sayak Banerjee <[email protected]>
* All rights reserved. Do not remove this copyright notice.
*/
// Turn off error reporting
error_reporting(0);
// Define constants
define('UPDATE_SERVER', 'https://raw.github.com/sayakb/sticky-notes/master/VERSION');
// Include classes
include_once('classes/class_gsod.php');
include_once('classes/class_config.php');
include_once('classes/class_core.php');
include_once('classes/class_db.php');
include_once('classes/class_lang.php');
include_once('classes/class_skin.php');
include_once('classes/class_api.php');
include_once('classes/class_nav.php');
include_once('classes/class_spamguard.php');
include_once('addons/geshi/geshi.php');
// We need to instantiate the GSoD class first, just in case!
$gsod = new gsod();
// Instantiate general classes
$config = new config();
$core = new core();
$db = new db();
$lang = new lang();
$skin = new skin();
$api = new api();
$sg = new spamguard();
$nav = new nav();
// Instantiate admin classes
if (defined('IN_ADMIN'))
{
include_once('admin/classes/class_auth.php');
include_once('admin/classes/class_module.php');
// Instantiate admin classes
$auth = new auth();
$module = new module();
}
// Define macros
define('GESHI_LANG_PATH', $core->base_uri() . '/addons/geshi/geshi/');
// Before we do anything, let's add a trailing slash
// We skip this for admin links
$url = $core->request_uri();
if (strrpos($url, '/') != (strlen($url) - 1) && $nav->rewrite_on &&
strpos($url, 'admin') === false && strpos($url, '.php') === false)
{
$core->redirect($url . '/');
}
else
{
unset($url);
}
// Change project name to lower case and escape it
if (isset($_GET['project'])) $_GET['project'] = htmlspecialchars(strtolower($_GET['project']));
if (isset($_POST['project'])) $_POST['project'] = htmlspecialchars(strtolower($_POST['project']));
if (isset($_GET['paste_project'])) $_GET['paste_project'] = htmlspecialchars(strtolower($_GET['paste_project']));
if (isset($_POST['paste_project'])) $_POST['paste_project'] = htmlspecialchars(strtolower($_POST['paste_project']));
// Set up the db connection
$db->connect();
// Assign defaut variables
$skin->assign(array(
'root_path' => $core->path(),
'msg_visibility' => 'hidden',
));
// Perform cron tasks
if (!defined('IN_INSTALL') && !defined('IN_ADMIN'))
{
include_once('cron.php');
}
?>