Gorilla.php
changeset 2 b6178b40aa09
parent 1 f2ceea4fabe8
child 3 6fe9c484bb26
--- a/Gorilla.php	Sun May 31 00:38:09 2009 -0400
+++ b/Gorilla.php	Sun May 31 00:48:53 2009 -0400
@@ -766,6 +766,26 @@
 
 register_cron_task('gorilla_prune_expired', 1);
 
+// Search handler
+$plugins->attachHook('session_started', 'gorilla_attach_search();');
+function gorilla_attach_search()
+{
+  global $lang;
+  register_search_handler(array(
+    'table' => 'pastes',
+    'titlecolumn' => 'paste_title',
+    'datacolumn' => 'paste_text',
+    'uniqueid' => 'ns=Paste;cid={paste_id}',
+    'additionalcolumns' => array('paste_id', 'paste_language'),
+    'resultnote' => $lang->get('gorilla_lbl_search_tag'),
+    'linkformat' => array(
+        'page_id' => '{paste_id}',
+        'namespace' => 'Paste'
+      ),
+    'additionalwhere' => 'AND (paste_flags & ' . PASTE_PRIVATE . ') = 0',
+  ));
+}
+
 /**!install dbms="mysql"; **
 CREATE TABLE {{TABLE_PREFIX}}pastes(
   paste_id int(18) NOT NULL auto_increment,
@@ -850,6 +870,8 @@
         msg_paste_deleted: 'Paste deleted.',
         msg_delete_confirm: 'Really delete this paste?',
         btn_delete_confirm: 'Delete',
+        
+        lbl_search_tag: '[Paste]',
       }
     }
   }