false, ); conf_update_param('community', $community_default_config, true); } $this->installed = true; } function activate($plugin_version, &$errors=array()) { global $prefixeTable; if (!$this->installed) { $this->install($plugin_version, $errors); } $query = ' SELECT COUNT(*) FROM '.$prefixeTable.'community_permissions ;'; list($counter) = pwg_db_fetch_row(pwg_query($query)); if (0 == $counter) { // is there a "Community" album? $query = ' SELECT id FROM '.CATEGORIES_TABLE.' WHERE name = \'Community\' ;'; $result = pwg_query($query); while ($row = pwg_db_fetch_assoc($result)) { $category_id = $row['id']; break; } if (!isset($category_id)) { // create an album "Community" include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); $category_info = create_virtual_category('Community'); $category_id = $category_info['id']; } single_insert( $prefixeTable.'community_permissions', array( 'type' => 'any_registered_user', 'category_id' => $category_id, 'recursive' => 'true', 'create_subcategories' => 'true', 'moderated' => 'true', ) ); } include_once(dirname(__FILE__).'/include/functions_community.inc.php'); community_update_cache_key(); } function update($old_version, $new_version, &$errors=array()) { $this->install($new_version, $errors); } function deactivate() { } function uninstall() { global $prefixeTable; $query = 'DROP TABLE '.$prefixeTable.'community_permissions;'; pwg_query($query); $query = 'DROP TABLE '.$prefixeTable.'community_pendings;'; pwg_query($query); $query = 'ALTER TABLE '.$prefixeTable.'categories drop column community_user;'; pwg_query($query); // delete configuration pwg_query('DELETE FROM `'. CONFIG_TABLE .'` WHERE param IN ("community", "community_cache_key");'); } } ?>