aboutsummaryrefslogtreecommitdiffstats
path: root/include/wiki.php
diff options
context:
space:
mode:
authorAndrew Manning <tamanning@zoho.com>2016-05-27 20:37:37 -0400
committerAndrew Manning <tamanning@zoho.com>2016-05-27 20:37:37 -0400
commitca78ebce6d254f244b4c1fbe25eb3aca40b26952 (patch)
tree87f2f1a3dabf9d28d36a5210547e88a9328851fa /include/wiki.php
parent97e6b7c4ba1938a46ea18d3ef96eba2d6246dab0 (diff)
downloadvolse-hubzilla-ca78ebce6d254f244b4c1fbe25eb3aca40b26952.tar.gz
volse-hubzilla-ca78ebce6d254f244b4c1fbe25eb3aca40b26952.tar.bz2
volse-hubzilla-ca78ebce6d254f244b4c1fbe25eb3aca40b26952.zip
Check if wiki exists and redirect if it does not
Diffstat (limited to 'include/wiki.php')
-rw-r--r--include/wiki.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/wiki.php b/include/wiki.php
index 828121ba9..90b30d492 100644
--- a/include/wiki.php
+++ b/include/wiki.php
@@ -124,3 +124,16 @@ function wiki_delete_wiki($resource_id) {
return array('item' => $item, 'success' => (($drop === 1 && $pathdel) ? true : false));
}
}
+
+function wiki_exists_by_name($name) {
+ $item = q("SELECT id FROM item WHERE resource_type = '%s' AND title = '%s' AND item_deleted = 0 limit 1",
+ dbesc(WIKI_ITEM_RESOURCE_TYPE),
+ dbesc($name)
+ );
+ if (!$item) {
+ return array('id' => null);
+ } else {
+ return array('id' => $item[0]['id']);
+ }
+
+} \ No newline at end of file