diff options
Diffstat (limited to 'includes')
-rwxr-xr-x | includes/functions.php | 42 | ||||
-rwxr-xr-x | includes/updatePending.php | 2 |
2 files changed, 40 insertions, 4 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 | ||
224 | function 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 | |||
239 | function 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 | |||
248 | function 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 | ?> |
diff --git a/includes/updatePending.php b/includes/updatePending.php index 79ab1c4..9a9b508 100755 --- a/includes/updatePending.php +++ b/includes/updatePending.php | |||
@@ -40,7 +40,7 @@ if ((!isset($disablePendingQueue)) && (date('j') != 'Sat')) | |||
40 | $getpost2 = mysql_query($getpost); | 40 | $getpost2 = mysql_query($getpost); |
41 | $getpost3 = mysql_fetch_array($getpost2); | 41 | $getpost3 = mysql_fetch_array($getpost2); |
42 | 42 | ||
43 | postBlogPost($getpost3['title'], $getpost3['author'], $getpost3['tags'], $getpost3['text']); | 43 | postBlogPost($getpost3['title'], $getpost3['author'], explode(',', $getpost3['tags']), $getpost3['text']); |
44 | 44 | ||
45 | $delpost = "DELETE FROM pending WHERE id = " . $getpost3['id']; | 45 | $delpost = "DELETE FROM pending WHERE id = " . $getpost3['id']; |
46 | $delpost2 = mysql_query($delpost); | 46 | $delpost2 = mysql_query($delpost); |