about summary refs log tree commit diff stats
path: root/pages/admin.php
blob: 12a2d017674c54c03b0639ae75dde641784906f7 (plain) (blame)
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
/*
 * cocos2d for iPhone: http://www.cocos2d-iphone.org
 *
 * Copyright (c) 2009-2010 Ricardo Quesada
 * Copyright (c) 2011 Zynga Inc.
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 *
 * TMX Tiled Map support:
 * http://www.mapeditor.org
 *
 */

#import "CCTMXTiledMap.h"
#import "CCTMXXMLParser.h"
#import "CCTMXLayer.h"
#import "CCTMXObjectGroup.h"
#import "CCSprite.h"
#import "CCTextureCache.h"
#import "Support/CGPointExtension.h"


#pragma mark -
#pragma mark CCTMXTiledMap

@interface CCTMXTiledMap (Private)
-(id) parseLayer:(CCTMXLayerInfo*)layer map:(CCTMXMapInfo*)mapInfo;
-(CCTMXTilesetInfo*) tilesetForLayer:(CCTMXLayerInfo*)layerInfo map:(CCTMXMapInfo*)mapInfo;
@end

@implementation CCTMXTiledMap
@synthesize mapSize = mapSize_;
@synthesize tileSize = tileSize_;
@synthesize mapOrientation = mapOrientation_;
@synthesize objectGroups = objectGroups_;
@synthesize properties = properties_;

+(id) tiledMapWithTMXFile:(NSString*)tmxFile
{
	return [[[self alloc] initWithTMXFile:tmxFile] autorelease];
}

-(id) initWithTMXFile:(NSString*)tmxFile
{
	NSAssert(tmxFile != nil, @"TMXTiledMap: tmx file should not bi nil");

	if ((self=[super init])) {
		
		[self setContentSize:CGSizeZero];

		CCTMXMapInfo *mapInfo = [CCTMXMapInfo formatWithTMXFile:tmxFile];
		
		NSAssert( [mapInfo.tilesets count] != 0, @"TMXTiledMap: Map not found. Please check the filename.");
		
		mapSize_ = mapInfo.mapSize;
		tileSize_ = mapInfo.tileSize;
		mapOrientation_ = mapInfo.orientation;
		objectGroups_ = [mapInfo.objectGroups retain];
		properties_ = [mapInfo.properties retain];
		tileProperties_ = [mapInfo.tileProperties retain];
				
		int idx=0;

		for( CCTMXLayerInfo *layerInfo in mapInfo.layers ) {
			
			if( layerInfo.visible ) {
				CCNode *child = [self parseLayer:layerInfo map:mapInfo];
				[self addChild:child z:idx tag:idx];
				
				// update content size with the max size
				CGSize childSize = [child contentSize];
				CGSize currentSize = [self contentSize];
				currentSize.width = MAX( currentSize.width, childSize.pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
<?php
/*
       444444444  
      4::::::::4  
     4:::::::::4  
    4::::44::::4  
   4::::4 4::::4   Four Island
  4::::4  4::::4  
 4::::4   4::::4   Written and maintained by Starla Insigna
4::::444444::::444
4::::::::::::::::4  pages/admin.php
4444444444:::::444
          4::::4   Please do not use, reproduce or steal the
          4::::4   contents of this file without explicit
          4::::4   permission from Hatkirby.
        44::::::44
        4::::::::4
        4444444444
*/

if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);}

require('headerproc.php');

$pageCategory = 'panel';

if (isLoggedIn())
{
	if (isAdmin())
	{
		if (!isset($_GET['page']))
		{
			$template = new FITemplate('admin/index');
		} else if ($_GET['page'] == 'writePost')
		{
			if (!isset($_GET['submit']))
			{
				$template = new FITemplate('admin/write');
			} else {
				$tags = explode(',', $_POST['tags']);

				if ($_POST['type'] == 'draft')
				{
					$insdraft = "INSERT INTO drafts (title,author,text,slug) VALUES (\"" . mysql_real_escape_string($_POST['title']) . "\",\"" . getSessionUsername() . "\",\"" . mysql_real_escape_string($_POST['text']) . "\",\"" . generateSlug($_POST['title'],'updates') . "\")";
					$insdraft2 = mysql_query($insdraft);

					$id = mysql_insert_id();
					addTags($id, $tags, 'draft');

					$template = new FITemplate('admin/draftSuccess');
					$template->add('ID', $id);
				} else if ($_POST['type'] == 'instant')
				{
					$id = postBlogPost($_POST['title'], getSessionUsername(), $tags, $_POST['text']);

					$getpost = "SELECT * FROM updates WHERE id = " . $id;
					$getpost2 = mysql_query($getpost);
					$getpost3 = mysql_fetch_array($getpost2);

					$template = new FITemplate('admin/postSuccess');
					$template->add('ID', $id);
					$template->add('CODED', $getpost3['slug']);
				} else {
					if ($_POST['type'] == 'normal')
					{
						$getpending = "SELECT * FROM pending ORDER BY id DESC LIMIT 0,1";
						$getpending2 = mysql_query($getpending);
						$getpending3 = mysql_fetch_array($getpending2);
						if (isset($getpending3['id']) === FALSE)
						{
							$id = 50;
						} else {
							$id = $getpending3['id']+1;
						}
					} else if ($_POST['type'] == 'priority')
					{
						$getpending = "SELECT * FROM pending ORDER BY id ASC LIMIT 0,1";
						$getpending2 = mysql_query($getpending);
						$getpending3 = mysql_fetch_array($getpending2);
						if (isset($getpending3['id']) === FALSE)
						{
							$id = 50;
an class="mi">1; } } else { generateError(404); } $inspending = "INSERT INTO pending (id,title,author,text,slug) VALUES (" . $id . ",\"" . mysql_real_escape_string($_POST['title']) . "\",\"" . getSessionUsername() . "\",\"" . mysql_real_escape_string($_POST['text']) . "\",\"" . generateSlug($_POST['title'],'updates') . "\")"; $inspending2 = mysql_query($inspending); addTags($id, $tags, 'pending'); $template = new FITemplate('admin/pendingSuccess'); $template->add('ID', $id); } } } else if ($_GET['page'] == 'manageDrafts') { $template = new FITemplate('admin/manageDrafts'); $getdrafts = "SELECT * FROM drafts ORDER BY id ASC"; $getdrafts2 = mysql_query($getdrafts); $i=0; while ($getdrafts3[$i] = mysql_fetch_array($getdrafts2)) { $template->adds_block('DRAFT', array( 'TITLE' => $getdrafts3[$i]['title'], 'AUTHOR' => $getdrafts3[$i]['author'], 'ID' => $getdrafts3[$i]['id'])); $i++; } } else if ($_GET['page'] == 'editDraft') { $getdraft = "SELECT * FROM drafts WHERE id = " . $_GET['id']; $getdraft2 = mysql_query($getdraft); $getdraft3 = mysql_fetch_array($getdraft2); if ($getdraft3['id'] == $_GET['id']) { if (!isset($_GET['submit'])) { $template = new FITemplate('admin/editDraft'); $template->add('ID', $_GET['id']); $template->add('TEXT', $getdraft3['text']); $template->add('TAGS', implode(',', getTags($getdraft3['id'], 'draft'))); $template->add('TITLE', $getdraft3['title']); } else { $tags = explode(',', $_POST['tags']); removeTags($_GET['id'], 'draft'); if ($_POST['type'] == 'draft') { $setdraft = "UPDATE drafts SET title = \"" . mysql_real_escape_string($_POST['title']) . "\", text = \"" . mysql_real_escape_string($_POST['text']) . "\" WHERE id = " . $_GET['id']; $setdraft2 = mysql_query($setdraft); addTags($_GET['id'], $tags, 'draft'); $template = new FITemplate('admin/draftSuccess'); $template->add('ID', $_GET['id']); } else if ($_POST['type'] == 'instant') { $id = postBlogPost($_POST['title'], getSessionUsername(), $tags, $_POST['text']); $deldraft = "DELETE FROM drafts WHERE id = " . $_GET['id']; $deldraft2 = mysql_query($deldraft); $getpost = "SELECT * FROM updates WHERE id = " . $id; $getpost2 = mysql_query($getpost); $getpost3 = mysql_fetch_array($getpost2); $template = new FITemplate('admin/postSuccess'); $template->add('ID', $id); $template->add('CODED', $getpost3['slug']); } else { if ($_POST['type'] == 'normal') { $getpending = "SELECT * FROM pending ORDER BY id DESC LIMIT 0,1"; $getpending2 = mysql_query($getpending); $getpending3 = mysql_fetch_array($getpending2); if (isset($getpending3['id']) === FALSE) { $id = 50; } else { $id = $getpending3['id']+1; } } else if ($_POST['type'] == 'priority') { $getpending = "SELECT * FROM pending ORDER BY id ASC LIMIT 0,1"; $getpending2 = mysql_query($getpending); $getpending3 = mysql_fetch_array($getpending2); if (isset($getpending3['id']) === FALSE) { $id = 50; } else { $id = $getpending3['id']-1; } } else { generateError(404); } $inspending = "INSERT INTO pending (id,title,author,text,slug) VALUES (" . $id . ",\"" . mysql_real_escape_string($_POST['title']) . "\",\"" . getSessionUsername() . "\",\"" . mysql_real_escape_string($_POST['text']) . "\",\"" . generateSlug($_POST['title'],'updates') . "\")"; $inspending2 = mysql_query($inspending); addTags($id, $tags, 'pending'); $deldraft = "DELETE FROM drafts WHERE id = " . $_GET['id']; $deldraft2 = mysql_query($deldraft); $template = new FITemplate('admin/pendingSuccess'); $template->add('ID', $id); } } } else { $template = new FITemplate('msg'); $template->add('BACK', 'the previous page'); $template->add('MSG', 'I\'m sorry, that draft doesn\'t exist.'); } } else if ($_GET['page'] == 'deleteDraft') { $getdraft = "SELECT * FROM drafts WHERE id = " . $_GET['id']; $getdraft2 = mysql_query($getdraft); $getdraft3 = mysql_fetch_array($getdraft2); if ($getdraft3['id'] == $_GET['id']) { if (!isset($_GET['submit'])) { $template = new FITemplate('admin/deleteDraft'); $template->add('ID', $_GET['id']); } else { $deldraft = "DELETE FROM drafts WHERE id = " . $_GET['id']; $deldraft2 = mysql_query($deldraft); removeTags($_GET['id'], 'draft'); $template = new FITemplate('admin/deletedDraft'); } } else { $template = new FITemplate('msg'); $template->add('BACK', 'the previous page'); $template->add('MSG', 'I\'m sorry, that draft doesn\'t exist.'); } } else if ($_GET['page'] == 'viewDraft') { $getdraft = "SELECT * FROM drafts WHERE id = " . $_GET['id']; $getdraft2 = mysql_query($getdraft); $getdraft3 = mysql_fetch_array($getdraft2); if ($getdraft3['id'] == $_GET['id']) { $template = new FITemplate('post'); $template->adds_block('INTERNAL',array('exi'=>1)); $template->add_ref(0, 'POST', array( 'ID' => $getdraft3['id'], 'YEARID' => ((date('Y')-2006) % 4), 'DATE' => date('F dS Y \a\\t g:i:s a'), 'MONTH' => date('M'), 'DAY' => date('d'), 'CODED' => $getdraft3['slug'], 'TITLE' => $getdraft3['title'], 'AUTHOR' => $getdraft3['author'], 'RATING' => 0, 'TEXT' => parseText($getdraft3['text']))); $tags = getTags($getdraft3['id'], 'draft'); foreach ($tags as $tag) { $template->adds_ref_sub(0, 'TAGS', array('TAG' => $tag)); } } else { $template = new FITemplate('msg'); $template->add('BACK', 'the previous page'); $template->add('MSG', 'I\'m sorry, that draft doesn\'t exist.'); } } else if ($_GET['page'] == 'managePending') { $template = new FITemplate('admin/managePending'); $getpending = "SELECT * FROM pending ORDER BY id ASC"; $getpending2 = mysql_query($getpending); $i=0; while ($getpending3[$i] = mysql_fetch_array($getpending2)) { $template->adds_block('PENDING', array( 'TITLE' => $getpending3[$i]['title'], 'AUTHOR' => $getpending3[$i]['author'], 'ID' => $getpending3[$i]['id'])); $i++; } } else if ($_GET['page'] == 'editPending') { $getpending = "SELECT * FROM pending WHERE id = " . $_GET['id']; $getpending2 = mysql_query($getpending); $getpending3 = mysql_fetch_array($getpending2); if ($getpending3['id'] == $_GET['id']) { if (!isset($_GET['submit'])) { $template = new FITemplate('admin/editPending'); $template->add('ID', $_GET['id']); $template->add('TEXT', $getpending3['text']); $template->add('TAGS', implode(',', getTags($getpending3['id'], 'pending'))); $template->add('TITLE', $getpending3['title']); } else { $tags = explode(',', $_POST['tags']); $setpending = "UPDATE pending SET title = \"" . mysql_real_escape_string($_POST['title']) . "\", text = \"" . mysql_real_escape_string($_POST['text']) . "\" WHERE id = " . $_GET['id']; $setpending2 = mysql_query($setpending); removeTags($_GET['id'], 'pending'); addTags($_GET['id'], $tags, 'pending'); $template = new FITemplate('admin/pendingSuccess'); $template->add('ID', $_GET['id']); } } else { $template = new FITemplate('msg'); $template->add('BACK', 'the previous page'); $template->add('MSG', 'I\'m sorry, that pending post doesn\'t exist.'); } } else if ($_GET['page'] == 'deletePending') { $getpending = "SELECT * FROM pending WHERE id = " . $_GET['id']; $getpending2 = mysql_query($getpending); $getpending3 = mysql_fetch_array($getpending2); if ($getpending3['id'] == $_GET['id']) { if (!isset($_GET['submit'])) { $template = new FITemplate('admin/deletePending'); $template->add('ID', $_GET['id']); } else { $delpending = "DELETE FROM pending WHERE id = " . $_GET['id']; $delpending2 = mysql_query($delpending); removeTags($_GET['id'], 'pending'); $template = new FITemplate('admin/deletedPending'); } } else { $template = new FITemplate('msg'); $template->add('BACK', 'the previous page'); $template->add('MSG', 'I\'m sorry, that pending post doesn\'t exist.'); } } else if ($_GET['page'] == 'viewPending') { $getpending = "SELECT * FROM pending WHERE id = " . $_GET['id']; $getpending2 = mysql_query($getpending); $getpending3 = mysql_fetch_array($getpending2); if ($getpending3['id'] == $_GET['id']) { $template = new FITemplate('post'); $template->adds_block('INTERNAL',array('exi'=>1)); $template->add_ref(0, 'POST', array( 'ID' => $getpending3['id'], 'YEARID' => ((date('Y')-2006) % 4), 'DATE' => date('F dS Y \a\\t g:i:s a'), 'MONTH' => date('M'), 'DAY' => date('d'), 'CODED' => $getpending3['slug'], 'TITLE' => $getpending3['title'], 'AUTHOR' => $getpending3['author'], 'RATING' => 0, 'TEXT' => parseText($getpending3['text']))); $tags = getTags($getpending3['id'], 'pending'); foreach ($tags as $tag) { $template->adds_ref_sub(0, 'TAGS', array('TAG' => $tag)); } } else { $template = new FITemplate('msg'); $template->add('BACK', 'the previous page'); $template->add('MSG', 'I\'m sorry, that pending post doesn\'t exist.'); } } else if ($_GET['page'] == 'movePending') { $getpending = "SELECT * FROM pending WHERE id = " . $_GET['id']; $getpending2 = mysql_query($getpending); $getpending3 = mysql_fetch_array($getpending2); if ($getpending3['id'] == $_GET['id']) { if ($_GET['dir'] == 'up') { $get2pending = "SELECT * FROM pending WHERE id < " . $_GET['id'] . " ORDER BY id DESC LIMIT 0,1"; $get2pending2 = mysql_query($get2pending); $get2pending3 = mysql_fetch_array($get2pending2); if (isset($get2pending3['id'])) { $otherPending = $get2pending3; } else { $template = new FITemplate('msg2'); $template->add('BACK', 'Back to the pending queue'); $template->add('LINK', 'managePending.php'); $template->add('MSG', 'I\'m sorry, that pending post is already the first.'); } } else if ($_GET['dir'] == 'down') { $get2pending = "SELECT * FROM pending WHERE id > " . $_GET['id'] . " ORDER BY id ASC LIMIT 0,1"; $get2pending2 = mysql_query($get2pending); $get2pending3 = mysql_fetch_array($get2pending2); if (isset($get2pending3['id'])) { $otherPending = $get2pending3; } else { $template = new FITemplate('msg2'); $template->add('BACK', 'Back to the pending queue'); $template->add('LINK', 'managePending.php'); $template->add('MSG', 'I\'m sorry, that pending post is already the last.'); } } if (isset($otherPending)) { $delpending = "DELETE FROM pending WHERE id = " . $_GET['id'] . " OR id = " . $otherPending['id']; $delpending2 = mysql_query($delpending); $inspending = "INSERT INTO pending (id, title, author, text, slug) VALUES (" . $_GET['id'] . ",\"" . $otherPending['title'] . "\",\"" . $otherPending['author'] . "\",\"" . mysql_real_escape_string($otherPending['text']) . "\",\"" . $otherPending['slug'] . "\")"; $inspending2 = mysql_query($inspending); $ins2pending = "INSERT INTO pending (id, title, author, text, slug) VALUES (" . $otherPending['id'] . ",\"" . $getpending3['title'] . "\",\"" . $getpending3['author'] . "\",\"" . mysql_real_escape_string($getpending3['text']) . "\",\"" . $getpending3['slug'] . "\")"; $ins2pending2 = mysql_query($ins2pending) or die($ins2pending); $tags1 = getTags($_GET['id'], 'pending'); $tags2 = getTags($otherPending['id'], 'pending'); removeTags($_GET['id'], 'pending'); removeTags($otherPending['id'], 'pending'); addTags($_GET['id'], $tags2, 'pending'); addTags($otherPending['id'], $tags1, 'pending'); header('Location: managePending.php'); exit; } } else { $template = new FITemplate('msg2'); $template->add('BACK', 'Back to the pending queue'); $template->add('LINK', 'managePending.php'); $template->add('MSG', 'I\'m sorry, that pending post doesn\'t exist.'); } } else if ($_GET['page'] == 'managePosts') { $template = new FITemplate('admin/managePosts'); $getposts = "SELECT * FROM updates ORDER BY id ASC"; $getposts2 = mysql_query($getposts); $i=0; while ($getposts3[$i] = mysql_fetch_array($getposts2)) { $template->adds_block('POST', array( 'TITLE' => $getposts3[$i]['title'], 'AUTHOR' => $getposts3[$i]['author'], 'ID' => $getposts3[$i]['id'], 'CODED' => $getposts3[$i]['slug'])); $i++; } } else if ($_GET['page'] == 'editPost') { $getpost = "SELECT * FROM updates WHERE id = " . $_GET['id']; $getpost2 = mysql_query($getpost); $getpost3 = mysql_fetch_array($getpost2); if ($getpost3['id'] == $_GET['id']) { if (!isset($_GET['submit'])) { $template = new FITemplate('admin/editPost'); $template->add('ID', $_GET['id']); $template->add('TEXT', $getpost3['text']); $template->add('TAGS', implode(',', getTags($getpost3['id']))); $template->add('TITLE', $getpost3['title']); } else { $tags = explode(',', $_POST['tags']); $setpost = "UPDATE updates SET title = \"" . mysql_real_escape_string($_POST['title']) . "\", text = \"" . mysql_real_escape_string($_POST['text']) . "\" WHERE id = " . $_GET['id']; $setpost2 = mysql_query($setpost); removeTags($_GET['id']); addTags($_GET['id'], $tags); $template = new FITemplate('admin/postSuccess'); $template->add('ID', $_GET['id']); $template->add('CODED', $getpost3['slug']); } } else { $template = new FITemplate('msg'); $template->add('BACK', 'the previous page'); $template->add('MSG', 'I\'m sorry, that post doesn\'t exist.'); } } else if ($_GET['page'] == 'deletePost') { $getpost = "SELECT * FROM updates WHERE id = " . $_GET['id']; $getpost2 = mysql_query($getpost); $getpost3 = mysql_fetch_array($getpost2); if ($getpost3['id'] == $_GET['id']) { if (!isset($_GET['submit'])) { $template = new FITemplate('admin/deletePost'); $template->add('ID', $_GET['id']); } else { $delpost = "DELETE FROM updates WHERE id = " . $_GET['id']; $delpost2 = mysql_query($delpost); removeTags($_GET['id']); $template = new FITemplate('admin/deletedPost'); } } else { $template = new FITemplate('msg'); $template->add('BACK', 'the previous page'); $template->add('MSG', 'I\'m sorry, that post doesn\'t exist.'); } } else if ($_GET['page'] == 'moderateComments') { $template = new FITemplate('admin/moderateComments'); $getcomments = "SELECT * FROM moderation ORDER BY id ASC"; $getcomments2 = mysql_query($getcomments); $i=0; while ($getcomments3[$i] = mysql_fetch_array($getcomments2)) { $comType = substr($getcomments3[$i]['page_id'],0,strpos($getcomments3[$i]['page_id'],'-')); $comID = substr($getcomments3[$i]['page_id'],strpos($getcomments3[$i]['page_id'],'-')+1); if ($comType == 'updates') { $getpost = "SELECT * FROM updates WHERE id = " . $comID; $getpost2 = mysql_query($getpost); $getpost3 = mysql_fetch_array($getpost2); $title = $getpost3['title']; } else if ($comType = 'polloftheweek') { $getpoll = "SELECT * FROM polloftheweek WHERE id = " . $comID; $getpoll2 = mysql_query($getpoll); $getpoll3 = mysql_fetch_array($getpoll2); $title = $getpoll3['question']; } else if ($comType = 'quotes') { $getquote = "SELECT * FROM rash_quotes WHERE id = " . $comID; $getquote2 = mysql_query($getquote); $getquote3 = mysql_fetch_array($getquote2); $title = '#' . $getquote3['id']; } $template->adds_block('COMMENT', array( 'TITLE' => $title, 'AUTHOR' => $getcomments3[$i]['author'], 'ID' => $getcomments3[$i]['id'])); $i++; } } else if ($_GET['page'] == 'viewComment') { $getcomment = "SELECT * FROM moderation WHERE id = " . $_GET['id']; $getcomment2 = mysql_query($getcomment); $getcomment3 = mysql_fetch_array($getcomment2); if ($getcomment3['id'] == $_GET['id']) { $template = new FITemplate('admin/viewComment'); $template->add('ID', $_GET['id']); $template->add('USERNAME', $getcomment3['author']); $template->add('CODEDEMAIL', md5(strtolower($getcomment3['email']))); $template->add('TEXT', parseText($getcomment3['comment'])); $template->add('DATE', date("F dS Y \a\\t g:i:s a",strtotime($getcomment3['pubDate']))); } else { $template = new FITemplate('msg'); $template->add('BACK', 'the previous page'); $template->add('MSG', 'I\'m sorry, that comment doesn\'t exist.'); } } else if ($_GET['page'] == 'actionComment') { $getcomment = "SELECT * FROM moderation WHERE id = " . $_GET['id']; $getcomment2 = mysql_query($getcomment); $getcomment3 = mysql_fetch_array($getcomment2); if ($getcomment3['id'] == $_GET['id']) { if (isset($_GET['approve'])) { $insanon = "INSERT INTO anon_commenters (username,email,website) VALUES (\"" . $getcomment3['author'] . "\",\"" . $getcomment3['email'] . "\",\"" . $getcomment3['website'] . "\")"; $insanon2 = mysql_query($insanon); $inscomment = "INSERT INTO comments (page_id,user_id,comment,is_anon) VALUES (\"" . $getcomment3['page_id'] . "\"," . mysql_insert_id() . ",\"" . $getcomment3['comment'] . "\",1)"; $inscomment2 = mysql_query($inscomment); $delcomment = "DELETE FROM moderation WHERE id = " . $getcomment3['id']; $delcomment2 = mysql_query($delcomment); $template = new FITemplate('msg'); $template->add('BACK', 'Comment Moderation'); $template->add('MSG', 'You\'ve successfully approved this comment.'); } else if (isset($_GET['deny'])) { $delcomment = "DELETE FROM moderation WHERE id = " . $getcomment3['id']; $delcomment2 = mysql_query($delcomment); $template = new FITemplate('msg'); $template->add('BACK', 'Comment Moderation'); $template->add('MSG', 'You\'ve successfully denied this comment.'); } else { $template = new FITemplate('msg'); $template->add('BACK', 'the previous page'); $template->add('MSG', "Um, what on earth are you doing?"); } } else { $template = new FITemplate('msg'); $template->add('BACK', 'the previous page'); $template->add('MSG', 'I\'m sorry, that comment doesn\'t exist.'); } } else if ($_GET['page'] == 'pollProcess') { if (!isset($_GET['step'])) { $template = new FITemplate('admin/pollrss'); } else if ($_GET['step'] == 2) { $insrss = "INSERT INTO pollrss (author,rss) VALUES (\"" . getSessionUsername() . "\",\"" . mysql_real_escape_string($_POST['text']) . "\")"; $insrss2 = mysql_query($insrss); $template = new FITemplate('admin/newPoll'); } else if ($_GET['step'] == 3) { $inspoll = "INSERT INTO polloftheweek (question,option1,option2,option3,option4) VALUES (\"" . mysql_real_escape_string($_POST['question']) . "\",\"" . $_POST['option1'] . "\",\"" . $_POST['option2'] . "\",\"" . $_POST['option3'] . "\",\"" . $_POST['option4'] . "\")"; $inspoll2 = mysql_query($inspoll); $cleardid = "TRUNCATE TABLE didpollalready"; $cleardid2 = mysql_query($cleardid); $template = new FITemplate('msg2'); $template->add('BACK', 'Back to the Admin Panel'); $template->add('LINK', '/admin/'); $template->add('MSG', "You've successfully created a poll!"); } else { $template = new FITemplate('msg'); $template->add('BACK', 'the previous page'); $template->add('MSG', "Um, what on earth are you doing?"); } } else if ($_GET['page'] == 'managePendingQuotes') { $template = new FITemplate('admin/managePendingQuotes'); $getpending = "SELECT * FROM rash_queue ORDER BY id ASC"; $getpending2 = mysql_query($getpending); $i=0; while ($getpending3[$i] = mysql_fetch_array($getpending2)) { if ($i % 2 == 1) { $template->adds_block('QUOTE', array( 'ID' => $getpending3[$i]['id'], 'TEXT' => nl2br($getpending3[$i]['quote']), 'EVEN' => 'even')); } else { $template->adds_block('QUOTE', array( 'ID' => $getpending3[$i]['id'], 'TEXT' => nl2br($getpending3[$i]['quote']))); } $i++; } } else if ($_GET['page'] == 'actionPendingQuotes') { $getpending = "SELECT * FROM rash_queue WHERE id = " . $_GET['id']; $getpending2 = mysql_query($getpending); $getpending3 = mysql_fetch_array($getpending2); if ($getpending3['id'] == $_GET['id']) { if (isset($_GET['approve'])) { $today = mktime(date('G'),date('i'),date('s'),date('m'),date('d'),date('Y')); $insquote = "INSERT INTO rash_quotes (quote,date) VALUES (\"" . mysql_real_escape_string($getpending3['quote']) . "\",\"" . $today . "\")"; $insquote2 = mysql_query($insquote); $delpending = "DELETE FROM rash_queue WHERE id = " . $_GET['id']; $delpending2 = mysql_query($delpending); $template = new FITemplate('msg2'); $template->add('BACK', 'Back to the Admin Panel'); $template->add('LINK', '/admin/'); $template->add('MSG', "You've successfully approved this quote."); } else if (isset($_GET['deny'])) { $delpending = "DELETE FROM rash_queue WHERE id = " . $_GET['id']; $delpending2 = mysql_query($delpending); $template = new FITemplate('msg2'); $template->add('BACK', 'Back to the Admin Panel'); $template->add('LINK', '/admin/'); $template->add('MSG', "You've successfully denied this quote."); } else { $template = new FITemplate('msg'); $template->add('BACK', 'the previous page'); $template->add('MSG', "Um, what on earth are you doing?"); } } else { $template = new FITemplate('msg'); $template->add('BACK', 'the previous page'); $template->add('MSG', 'I\'m sorry, but this pending quote doesn\'t exist.'); } } else if ($_GET['page'] == 'hgUpdate') { $template = new FITemplate('msg'); $template->add('BACK', 'the Admin Panel'); ob_start(); system('hg update'); $template->add('MSG', ob_get_contents()); ob_end_clean(); } else if ($_GET['page'] == 'maintenanceMode') { if (isset($_GET['submit'])) { if ($_POST['mode'] == 'on') { $set = 1; } else if ($_POST['mode'] == 'off') { $set = 0; } else { $template = new FITemplate('msg'); $template->add('MSG', 'You seem to have somehow messed up the form. That\'s weird.'); $template->add('BACK', 'the Maintenance Mode form'); } if (isset($set)) { $setconfig = "UPDATE config SET value = \"" . $set . "\" WHERE name = \"maintenanceMode\""; $setconfig2 = mysql_query($setconfig); $template = new FITemplate('msg'); $template->add('MSG', 'Maintenance Mode has successfully been set to "' . $_POST['mode'] . '"'); $template->add('BACK', 'the Maintenance Mode form'); } } else { $template = new FITemplate('admin/maintenanceMode'); $getconfig = "SELECT * FROM config WHERE name = \"maintenanceMode\""; $getconfig2 = mysql_query($getconfig); $getconfig3 = mysql_fetch_array($getconfig2); if ($getconfig3['value'] == '1') { $template->add('ON', ' CHECKED="CHECKED"'); } else { $template->add('OFF', ' CHECKED="CHECKED"'); } } } else { generateError(404); } @$template->display(); } else { generateError(404); } } else { generateError(404); } ?>