Develop and Download Open Source Software

Browse CVS Repository

Annotation of /xoonips-library/xnpbulletin/install_funcs.php

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download) (as text)
Thu Mar 30 02:46:15 2006 UTC (18 years ago) by yamaji
Branch: MAIN
Branch point for: yamaji
File MIME type: application/x-httpd-php
Initial revision

1 yamaji 1.1 <?php
2     // Install script for bulletin module //
3     // $Revision: 1.13 $ //
4     // -------------------------------------------------------------------------- //
5     // XooNIps Xoops modules for Neuroinformatics Platforms //
6     // Copyright (C) 2005 RIKEN, Japan. All rights reserved. //
7     // http://sourceforge.jp/projects/xoonips/ //
8     // -------------------------------------------------------------------------- //
9     // This program is free software; you can redistribute it and/or //
10     // modify it under the terms of the GNU General Public License //
11     // as published by the Free Software Foundation; either version 2 //
12     // of the License, or (at your option) any later version. //
13     // //
14     // This program is distributed in the hope that it will be useful, //
15     // but WITHOUT ANY WARRANTY; without even the implied warranty of //
16     // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
17     // GNU General Public License for more details. //
18     // //
19     // You should have received a copy of the GNU General Public License //
20     // along with this program; if not, write to the Free Software //
21     // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //
22     // -------------------------------------------------------------------------- //
23    
24     function xoops_module_install_xnpbulletin( $xoopsMod ) {
25     global $xoopsDB;
26    
27     // register itemtype
28     $table = $xoopsDB->prefix('xoonips_item_type');
29     $mid = $xoopsMod->getVar('mid');
30     $sql = "INSERT INTO $table ( name, display_name, mid, viewphp ) VALUES ( 'xnpbulletin', 'Bulletin', $mid, 'xnpbulletin/include/view.php' )";
31     if ( $xoopsDB->query($sql) == FALSE ){
32     // cannot register itemtype
33     return false;
34     }
35    
36     // register filetype
37     $table = $xoopsDB->prefix('xoonips_file_type');
38     $mid = $xoopsMod->getVar('mid');
39     $sql = "INSERT INTO $table ( name, display_name, mid ) VALUES ( 'bulletin_attachment', 'Bulletin attachment', $mid )";
40     if ( $xoopsDB->query($sql) == FALSE ){
41     // cannot register itemtype
42     return false;
43     }
44    
45     // Delete 'Module Access Rights' from all groups
46     // This allows to remove redundant module name in Main Menu
47     $member_handler =& xoops_gethandler('member');
48     $gperm_handler =& xoops_gethandler('groupperm');
49     $groups =& $member_handler->getGroupList();
50     foreach ($groups as $groupid2 => $groupname) {
51     if ($gperm_handler->checkRight('module_read', $mid, $groupid2)) {
52     $criteria = new CriteriaCompo();
53     $criteria->add( new Criteria( 'gperm_groupid', $groupid2 ) );
54     $criteria->add( new Criteria( 'gperm_itemid', $mid ) );
55     $criteria->add( new Criteria( 'gperm_name', 'module_read' ) );
56    
57     $objects = $gperm_handler->getObjects($criteria);
58     if ( count( $objects ) == 1 ){
59     $gperm_handler->delete( $objects[0] );
60     }
61     }
62     }
63    
64     //$item_type_id = $xoopsDB->getInsertId();
65     return true;
66     }
67    
68     function xoops_module_uninstall_xnpbulletin( $xoopsMod ) {
69     global $xoopsDB;
70    
71     // unregister itemtype
72     $table = $xoopsDB->prefix('xoonips_item_type');
73     $mid = $xoopsMod->getVar('mid');
74     $sql = "DELETE FROM $table where mid = $mid";
75     if ( $xoopsDB->query($sql) == FALSE ){
76     // cannot unregister itemtype
77     return false;
78     }
79     $table = $xoopsDB->prefix('xoonips_file_type');
80     $sql = "DELETE FROM $table where mid = $mid";
81     if ( $xoopsDB->query($sql) == FALSE ){
82     // cannot unregister filetype
83     return false;
84     }
85     $table = $xoopsDB->prefix('xnpbulletin_item_detail_child_author');
86     $sql = "DROP TABLE $table";
87     if ( $xoopsDB->query($sql) == FALSE ){
88     // cannot unregister child_author
89     return false;
90     }
91     $table = $xoopsDB->prefix('xnpbulletin_item_detail_child_keywords');
92     $sql = "DROP TABLE $table";
93     if ( $xoopsDB->query($sql) == FALSE ){
94     // cannot unregister child_keywords
95     return false;
96     }
97     $table = $xoopsDB->prefix('xnpbulletin_item_detail_child_free_keywords');
98     $sql = "DROP TABLE $table";
99     if ( $xoopsDB->query($sql) == FALSE ){
100     // cannot unregister child_free_keywords
101     return false;
102     }
103     return true;
104     }
105    
106     function xoops_module_update_xnpbulletin ( $xoopsMod, $oldversion) {
107    
108     global $xoopsDB;
109     switch ($oldversion) { //remember that version is multiplied with 100 to get an integer
110     default:
111     return true;
112     }
113     return true;
114     }
115     ?>

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26