summary refs log tree commit diff stats
path: root/includes/functions.php
diff options
context:
space:
mode:
authorStarla Insigna <hatkirby@fourisland.com>2008-12-07 20:25:36 -0500
committerStarla Insigna <hatkirby@fourisland.com>2008-12-07 20:25:36 -0500
commit25a101d128ada4cac4e634b1c0fdd881551fd376 (patch)
tree16189519d01940f01c6a91c4786508c080aefc2f /includes/functions.php
parent9a4c37255351aadc223bb9609623888cb01d5fde (diff)
downloadfourisland-25a101d128ada4cac4e634b1c0fdd881551fd376.tar.gz
fourisland-25a101d128ada4cac4e634b1c0fdd881551fd376.tar.bz2
fourisland-25a101d128ada4cac4e634b1c0fdd881551fd376.zip
Redid multiple tag system
This new tag system has a seperate table for tags. This way, a tag cloud can be made much more easily than if using the previous system.

This changeset requires manual maintinence.
Diffstat (limited to 'includes/functions.php')
-rwxr-xr-xincludes/functions.php42
1 files changed, 39 insertions, 3 deletions
diff --git a/includes/functions.php b/includes/functions.php index c71e69f..73a6e17 100755 --- a/includes/functions.php +++ b/includes/functions.php
@@ -115,9 +115,15 @@ function postBlogPost($title,$author,$tags,$content)
115{ 115{
116 $slug = generateSlug($title,'updates'); 116 $slug = generateSlug($title,'updates');
117 117
118 $inspost = "INSERT INTO updates (title,slug,author,tags,text) VALUES (\"" . $title . "\",\"" . $slug . "\",\"" . $author . "\",\"" . $tags . "\",\"" . addslashes($content) . "\")"; 118 $inspost = "INSERT INTO updates (title,slug,author,text) VALUES (\"" . $title . "\",\"" . $slug . "\",\"" . $author . "\",\"" . addslashes($content) . "\")";
119 $inspost2 = mysql_query($inspost); 119 $inspost2 = mysql_query($inspost);
120 120
121 $getpost = "SELECT * FROM updates WHERE slug = \"" . $slug . "\"";
122 $getpost2 = mysql_query($getpost);
123 $getpost3 = mysql_fetch_array($getpost2);
124
125 addTags($getpost3['id'], $tags);
126
121 $upconf = "UPDATE config SET value = \"" . date('md') . "\" WHERE name = \"lastUpdate\""; 127 $upconf = "UPDATE config SET value = \"" . date('md') . "\" WHERE name = \"lastUpdate\"";
122 $upconf2 = mysql_query($upconf); 128 $upconf2 = mysql_query($upconf);
123 129
@@ -144,7 +150,7 @@ function postBlogPost($title,$author,$tags,$content)
144 if (preg_match('/<LINK REL="pingback" HREF="([^"]+)"/i',$page_data,$server)) 150 if (preg_match('/<LINK REL="pingback" HREF="([^"]+)"/i',$page_data,$server))
145 { 151 {
146 $client = new xmlrpc_client($server[1]); 152 $client = new xmlrpc_client($server[1]);
147 $msg = new xmlrpcmsg("pingback.ping", array( new xmlrpcval('http://www.fourisland.com/blog/' . $slug . '/', 'string'), 153 $msg = new xmlrpcmsg("pingback.ping", array( new xmlrpcval('http://fourisland.com/blog/' . $slug . '/', 'string'),
148 new xmlrpcval($link, 'string'))); 154 new xmlrpcval($link, 'string')));
149 $client->send($msg); 155 $client->send($msg);
150 } 156 }
@@ -153,7 +159,7 @@ function postBlogPost($title,$author,$tags,$content)
153 159
154 $client = new xmlrpc_client('http://rpc.pingomatic.com'); 160 $client = new xmlrpc_client('http://rpc.pingomatic.com');
155 $msg = new xmlrpcmsg("weblogUpdates.ping", array( new xmlrpcval('Four Island', 'string'), 161 $msg = new xmlrpcmsg("weblogUpdates.ping", array( new xmlrpcval('Four Island', 'string'),
156 new xmlrpcval('http://www.fourisland.com/', 'string'))); 162 new xmlrpcval('http://fourisland.com/', 'string')));
157 $client->send($msg); 163 $client->send($msg);
158} 164}
159 165
@@ -215,4 +221,34 @@ function verifyUser($username, $password)
215 return (($_POST['username'] != '') && ($getuser3['username'] == $_POST['username'])); 221 return (($_POST['username'] != '') && ($getuser3['username'] == $_POST['username']));
216} 222}
217 223
224function getTags($id, $type = 'published')
225{
226 $gettags = "SELECT * FROM tags WHERE post_id = " . $id . " AND post_type = \"" . $type . "\"";
227 $gettags2 = mysql_query($gettags);
228 $i=0;
229 $tags = array();
230 while ($gettags3[$i] = mysql_fetch_array($gettags2))
231 {
232 $tags[] = $gettags3[$i]['tag'];
233 $i++;
234 }
235
236 return $tags;
237}
238
239function addTags($id, $tags, $type = 'published')
240{
241 foreach ($tags as $tag)
242 {
243 $instag = "INSERT INTO tags (post_id,post_type,tag) VALUES (" . $id . ",\"" . $type . "\",\"" . $tag . "\")";
244 $instag2 = mysql_query($instag);
245 }
246}
247
248function removeTags($id, $type = 'published')
249{
250 $deltags = "DELETE FROM tags WHERE post_id = " . $id . " AND post_type = \"" . $type . "\"";
251 $deltags2 = mysql_query($deltags);
252}
253
218?> 254?>