summary refs log tree commit diff stats
path: root/admin
diff options
context:
space:
mode:
authorStarla Insigna <hatkirby@fourisland.com>2009-08-17 15:52:44 -0400
committerStarla Insigna <hatkirby@fourisland.com>2009-08-17 15:52:44 -0400
commit00586f1e8ada8f5baa6e3013525862dccac77b4a (patch)
tree8c456facf829646386ee039622e2df16140bcca8 /admin
parent49ff543541097a514cf8c836b74cd9514df2bf98 (diff)
downloadfourisland-00586f1e8ada8f5baa6e3013525862dccac77b4a.tar.gz
fourisland-00586f1e8ada8f5baa6e3013525862dccac77b4a.tar.bz2
fourisland-00586f1e8ada8f5baa6e3013525862dccac77b4a.zip
Added new files from previous commit
Diffstat (limited to 'admin')
-rw-r--r--admin/editLink.php89
-rw-r--r--admin/links.php114
-rw-r--r--admin/newLink.php93
3 files changed, 296 insertions, 0 deletions
diff --git a/admin/editLink.php b/admin/editLink.php new file mode 100644 index 0000000..fe4fb66 --- /dev/null +++ b/admin/editLink.php
@@ -0,0 +1,89 @@
1<?php
2/*
3 444444444
4 4::::::::4
5 4:::::::::4
6 4::::44::::4
7 4::::4 4::::4 Four Island
8 4::::4 4::::4
9 4::::4 4::::4 Written and maintained by Starla Insigna
104::::444444::::444
114::::::::::::::::4 admin/editLink.php
124444444444:::::444
13 4::::4 Please do not use, reproduce or steal the
14 4::::4 contents of this file without explicit
15 4::::4 permission from Hatkirby.
16 44::::::44
17 4::::::::4
18 4444444444
19*/
20
21if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);}
22
23require('headerproc.php');
24
25$category = 'links';
26
27$template = new FITemplate('admin/writeLink');
28$template->add('TITLE', 'Edit Link');
29$template->add('ACTION', '/admin/editLink.php?id=' . $_GET['id'] . '&amp;submit=');
30
31$getlink = "SELECT * FROM links WHERE id = " . $_GET['id'];
32$getlink2 = mysql_query($getlink);
33$getlink3 = mysql_fetch_array($getlink2);
34
35$pageaid = $getlink3['type'];
36
37if (isset($_GET['submit']))
38{
39 if (empty($_POST['title']))
40 {
41 $errors[] = array( 'field' => 'title',
42 'text' => 'Title is a required field');
43 }
44
45 if (empty($_POST['url']))
46 {
47 $errors[] = array( 'field' => 'url',
48 'text' => 'URL is a required field');
49 } else if (!preg_match("/^(http(s?):\\/\\/|ftp:\\/\\/{1})((\w+\.)+)\w{2,}(\/?)$/i", $_POST['url']))
50 {
51 $errors[] = array( 'field' => 'url',
52 'text' => 'URL must be a valid URL');
53 }
54
55 if (isset($errors))
56 {
57 $template->adds_block('ISERROR',array('exi'=>1));
58
59 $eid = 0;
60 foreach ($errors as $error)
61 {
62 $template->adds_block('ERROR', array( 'ID' => $eid,
63 'TEXT' => $error['text']));
64 $template->add('IS' . strtoupper($error['field']) . 'ERROR', ' error');
65 $template->adds_block(strtoupper($error['field']) . 'ERROR', array( 'ID' => $eid,
66 'TEXT' => $error['text']));
67
68 $eid++;
69 }
70 } else {
71 $inslink = "UPDATE links SET title = \"" . mysql_real_escape_string($_POST['title']) . "\", url = \"" . mysql_real_escape_string($_POST['url']) . "\" WHERE id = " . $_GET['id'];
72 $inslink2 = mysql_query($inslink);
73
74 $template->adds_block('FLASH', array('TEXT' => 'Your link has been sucessfully edited.'));
75 }
76
77 $template->add('TITLEVALUE', $_POST['title']);
78 $template->add('URLVALUE', $_POST['url']);
79} else {
80 $template->add('TITLEVALUE', $getlink3['title']);
81 $template->add('URLVALUE', $getlink3['url']);
82}
83
84$template->add('TYPEDISABLED', ' readonly="readonly"');
85$template->add(strtoupper($getlink3['type']) . 'SELECTED', ' checked="checked"');
86
87$template->display();
88
89?>
diff --git a/admin/links.php b/admin/links.php new file mode 100644 index 0000000..d1ab878 --- /dev/null +++ b/admin/links.php
@@ -0,0 +1,114 @@
1<?php
2/*
3 444444444
4 4::::::::4
5 4:::::::::4
6 4::::44::::4
7 4::::4 4::::4 Four Island
8 4::::4 4::::4
9 4::::4 4::::4 Written and maintained by Starla Insigna
104::::444444::::444
114::::::::::::::::4 admin/links.php
124444444444:::::444
13 4::::4 Please do not use, reproduce or steal the
14 4::::4 contents of this file without explicit
15 4::::4 permission from Hatkirby.
16 44::::::44
17 4::::::::4
18 4444444444
19*/
20
21if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);}
22
23require('headerproc.php');
24require_once('Pager.php');
25
26if (isset($_GET['type']))
27{
28 $type = $_GET['type'];
29} else {
30 $type = 'affiliates';
31}
32
33$category = 'links';
34$pageaid = $type;
35
36if (isset($_GET['action']))
37{
38 if ($_GET['action'] == 'delete')
39 {
40 if (is_numeric($_POST['id']))
41 {
42 $dellink = "DELETE FROM links WHERE id = " . $_POST['id'];
43 $dellink2 = mysql_query($dellink);
44
45 $flashmsg = 'The selected link has been deleted.';
46 }
47 } else if ($_GET['action'] == 'deletes')
48 {
49 $ids = explode(',', $_POST['ids']);
50
51 if (is_array($ids) && !empty($ids))
52 {
53 foreach ($ids as $id)
54 {
55 $dellink = "DELETE FROM links WHERE id = " . $id;
56 $dellink2 = mysql_query($dellink);
57 }
58
59 $flashmsg = 'The selected links have been deleted.';
60 }
61 }
62}
63
64$template = new FITemplate('admin/links');
65
66if ($type == 'affiliates')
67{
68 $template->add('TITLE', 'Manage Affiliates');
69} else if ($type == 'webprojs')
70{
71 $template->add('TITLE', 'Manage Website Projects');
72}
73
74$getlinks = "SELECT * FROM links WHERE type = \"" . mysql_real_escape_string($type) . "\" ORDER BY id ASC";
75$getlinks2 = mysql_query($getlinks);
76$i=0;
77while ($getlinks3[$i] = mysql_fetch_array($getlinks2))
78{
79 $i++;
80}
81
82if ($i != 0)
83{
84 $template->adds_block('AVAIL',array('exi'=>1));
85} else {
86 $template->adds_block('NOTAVAIL',array('exi'=>1));
87}
88
89$pager = &Pager::factory(array( 'mode' => 'Sliding',
90 'perPage' => 20,
91 'delta' => 2,
92 'itemData' => $getlinks3));
93
94$j=0;
95
96foreach ($pager->getPageData() as $link)
97{
98 if (!empty($link))
99 {
100 $template->adds_block('LINK', array( 'TITLE' => $link['title'],
101 'URL' => $link['url'],
102 'ID' => $link['id'],
103 'ODD' => ($j % 2 ? '' : ' class="odd"')));
104 }
105
106 $j++;
107}
108
109$template->add('PAGEID', $pager->getCurrentPageID());
110$template->add('PAGINATION', $pager->links);
111
112$template->display();
113
114?>
diff --git a/admin/newLink.php b/admin/newLink.php new file mode 100644 index 0000000..3f6b42c --- /dev/null +++ b/admin/newLink.php
@@ -0,0 +1,93 @@
1<?php
2/*
3 444444444
4 4::::::::4
5 4:::::::::4
6 4::::44::::4
7 4::::4 4::::4 Four Island
8 4::::4 4::::4
9 4::::4 4::::4 Written and maintained by Starla Insigna
104::::444444::::444
114::::::::::::::::4 admin/newLink.php
124444444444:::::444
13 4::::4 Please do not use, reproduce or steal the
14 4::::4 contents of this file without explicit
15 4::::4 permission from Hatkirby.
16 44::::::44
17 4::::::::4
18 4444444444
19*/
20
21if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);}
22
23require('headerproc.php');
24
25$category = 'links';
26$pageaid = 'newlink';
27
28$template = new FITemplate('admin/writeLink');
29
30if (isset($_GET['submit']))
31{
32 if (empty($_POST['title']))
33 {
34 $errors[] = array( 'field' => 'title',
35 'text' => 'Title is a required field');
36 }
37
38 if (empty($_POST['url']))
39 {
40 $errors[] = array( 'field' => 'url',
41 'text' => 'URL is a required field');
42 } else if (!preg_match("/^(http(s?):\\/\\/|ftp:\\/\\/{1})((\w+\.)+)\w{2,}(\/?)$/i", $_POST['url']))
43 {
44 $errors[] = array( 'field' => 'url',
45 'text' => 'URL must be a valid URL');
46 }
47
48 if (empty($_POST['type']))
49 {
50 $errors[] = array( 'field' => 'type',
51 'text' => 'Type is a required field');
52 }
53
54 if (isset($errors))
55 {
56 $template->adds_block('ISERROR',array('exi'=>1));
57
58 $eid = 0;
59 foreach ($errors as $error)
60 {
61 $template->adds_block('ERROR', array( 'ID' => $eid,
62 'TEXT' => $error['text']));
63 $template->add('IS' . strtoupper($error['field']) . 'ERROR', ' error');
64 $template->adds_block(strtoupper($error['field']) . 'ERROR', array( 'ID' => $eid,
65 'TEXT' => $error['text']));
66
67 $eid++;
68 }
69
70 $template->add('TITLE', 'New Link');
71 $template->add('ACTION', '/admin/newLink.php?submit=');
72 } else {
73 $inslink = "INSERT INTO links (title,url,type) VALUES (\"" . mysql_real_escape_string($_POST['title']) . "\",\"" . mysql_real_escape_string($_POST['url']) . "\",\"" . mysql_real_escape_string($_POST['type']) . "\")";
74 $inslink2 = mysql_query($inslink);
75
76 $template->adds_block('FLASH', array('TEXT' => 'Your link has been sucessfully created.'));
77
78 $template->add('TITLE', 'Edit Link');
79 $template->add('ACTION', '/admin/editLink.php?id=' . mysql_insert_id() . '&amp;submit=');
80 $template->add('TYPEDISABLED', ' readonly="readonly"');
81 }
82
83 $template->add('TITLEVALUE', $_POST['title']);
84 $template->add('URLVALUE', $_POST['url']);
85 $template->add(strtoupper($_POST['type']) . 'SELECTED', ' checked="checked"');
86} else {
87 $template->add('TITLE', 'New Link');
88 $template->add('ACTION', '/admin/newLink.php?submit=');
89}
90
91$template->display();
92
93?>