示例#1
0
文件: wiki.php 项目: Krytic/MyBBWiki
/**
 * Generic plugin functions.
 */
function wiki_info()
{
    $append = "";
    if (wiki_is_installed()) {
        $append .= "<br />";
        $append .= "<a href=\"index.php?module=wiki-settings\"><strong>[Settings]</strong></a>";
        $append .= " <a href=\"index.php?module=wiki-perms\"><strong>[Permissions]</strong></a>";
        $append .= " <a href=\"index.php?module=wiki-docs\"><strong>[Docs]</strong></a>";
    }
    return array('name' => 'MyBB Wiki', 'description' => "Adds a simple Wiki to your MyBB Forum.{$append}", 'website' => 'https://github.com/Krytic/MyBB-Wiki" id="mybbwiki', 'author' => 'Adamas', 'authorsite' => 'https://github.com/Krytic/MyBB-Wiki', 'version' => WIKI_VERSION, 'guid' => '', 'compatibility' => '18*');
}
示例#2
0
 public function go()
 {
     global $db, $cache;
     if (function_exists('wiki_is_installed') && wiki_is_installed()) {
         return false;
     }
     $this->buildTables();
     $this->insertSettings();
     rebuild_settings();
     $this->insertCSS();
     $this->handleMyAlerts();
     $query = $db->write_query("SELECT * FROM `" . TABLE_PREFIX . "usergroups`");
     $cache_arr = array();
     while ($group = $db->fetch_array($query)) {
         // Set the default permissions
         $db->write_query("INSERT INTO " . TABLE_PREFIX . "wiki_perms(`gid`,`can_view`,`can_create`,`can_edit`,`can_protect`,`can_export`) VALUES('" . $group['gid'] . "','1','1','1','0','0')");
         // and cache them
         $cache_arr['gid_' . $group['gid']] = array('can_view' => 1, 'can_create' => 1, 'can_edit' => 1, 'can_protect' => 0, 'can_export' => 0);
     }
     $cache->update('wiki_permissions', $cache_arr);
     $db->write_query("INSERT INTO " . TABLE_PREFIX . "wiki_categories(title, description) VALUES('Meta', 'The default Category')");
     return true;
 }