* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE. 
 */
// Disallow direct access to this file for security reasons
if (!defined("IN_MYBB")) {
    die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
/* cache template */
if (defined('THIS_SCRIPT') && THIS_SCRIPT == "usercp.php") {
    global $templatelist;
    $templatelist .= ",myprofile_permissions";
}
/* load template */
$plugins->add_hook("usercp_profile_end", array(MyProfilePermissions::get_instance(), "usercp_profile_end"));
$plugins->add_hook("datahandler_user_update", array(MyProfilePermissions::get_instance(), "datahandler_user_update"));
$plugins->add_hook("member_profile_start", array(MyProfilePermissions::get_instance(), "member_profile_start"));
class MyProfilePermissions
{
    private static $instance = null;
    public function install()
    {
        global $db, $lang;
        MyProfileUtils::lang_load_config_myprofile();
        if (!$db->field_exists("myprofilepermissions", "users")) {
            $definition = $db->type == 'pgsql' ? 'smallint' : 'tinyint(1)';
            $db->add_column("users", "myprofilepermissions", "{$definition} NOT NULL default '0'");
        }
        $gid = MyProfileUtils::insert_settinggroups(array("name" => "myprofilepermissions", "title" => $lang->mp_myprofile_permissions, "description" => $lang->mp_myprofile_permissions_desc, "isdefault" => 0));
        MyProfileUtils::insert_settings(array(array("name" => "mppermissionsenabled", "title" => $lang->mp_myprofile_permissions_enabled, "description" => $lang->mp_myprofile_permissions_enabled_desc, "optionscode" => "yesno", "value" => 1, "gid" => $gid), array("name" => "mppermissionsgroups", "title" => $lang->mp_myprofile_permissions_groups, "description" => $lang->mp_myprofile_permissions_groups_desc, "optionscode" => "groupselect", "value" => -1, "gid" => $gid)));
    }
    public function is_installed()
示例#2
0
function myprofile_bundles()
{
    /* if you create a new bundle, register it in here, so it receives the plugin's routines */
    return array("essence" => MyProfileEssence::get_instance(), "comments" => MyProfileComments::get_instance(), "buddylist" => MyProfileBuddyList::get_instance(), "referredby" => MyProfileReferredBy::get_instance(), "visitors" => MyProfileVisitors::get_instance(), "permissions" => MyProfilePermissions::get_instance());
}