public function install()
 {
     global $db, $lang;
     MyProfileUtils::lang_load_config_myprofile();
     $gid = MyProfileUtils::insert_settinggroups(array("name" => "myprofilereferredby", "title" => $lang->mp_myprofile_referredby, "description" => $lang->mp_myprofile_referredby_desc, "isdefault" => 0));
     MyProfileUtils::insert_settings(array(array("name" => "mpreferredbyenabled", "title" => $lang->mp_myprofile_referredby_enabled, "description" => $lang->mp_myprofile_referredby_enabled_desc, "optionscode" => "yesno", "value" => 1, "gid" => $gid)));
 }
 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 install()
 {
     global $lang;
     MyProfileUtils::lang_load_config_myprofile();
     $settinggroups = array("name" => "myprofilebuddylist", "title" => $lang->mp_myprofile_buddylist, "description" => $lang->mp_myprofile_buddylist_desc, "isdefault" => 0);
     $gid = MyProfileUtils::insert_settinggroups($settinggroups);
     $settings[] = array("name" => "mpbuddylistenabled", "title" => $lang->mp_myprofile_buddylist_enabled, "description" => $lang->mp_myprofile_buddylist_enabled_desc, "optionscode" => "yesno", "value" => "1", "gid" => $gid);
     $settings[] = array("name" => "mpbuddylistrecord", "title" => $lang->mp_myprofile_buddylist_record, "description" => $lang->mp_myprofile_buddylist_record_desc, "optionscode" => "select\n4=4\n8=8\n12=12\n16=16\n20=20\n24=24\n40=40\n80=80\n100=100", "value" => "4", "gid" => $gid);
     $settings[] = array("name" => "mpbuddylistavatarmaxdimensions", "title" => $lang->mp_myprofile_buddylist_avatar_max_dimensions, "description" => $lang->mp_myprofile_buddylist_avatar_max_dimensions_desc, "optionscode" => "text", "value" => "100x100", "gid" => $gid);
     MyProfileUtils::insert_settings($settings);
 }
 public function install()
 {
     global $db, $lang;
     MyProfileUtils::lang_load_config_myprofile();
     $tables = array();
     $collation = $db->build_create_table_collation();
     if (!$db->table_exists("myprofilevisitors")) {
         $tables[] = "CREATE TABLE " . TABLE_PREFIX . "myprofilevisitors (\n\t\t\t\t`vid` int unsigned NOT NULL auto_increment,\n\t\t\t\t`uid` int unsigned NOT NULL,\n\t\t\t\t`vuid` int unsigned NOT NULL,\n\t\t\t\t`time` varchar(10) NOT NULL,\n\t\t\t\tPRIMARY KEY (`vid`)\n\t\t\t) ENGINE=MyISAM{$collation}";
     }
     foreach ($tables as $table) {
         $db->write_query($table);
     }
     // Modify the users table
     if (!$db->field_exists("viewcount", "users")) {
         $db->add_column("users", "viewcount", "int unsigned DEFAULT 0");
     }
     $settinggroups = array("name" => "myprofilevisitors", "title" => $lang->mp_myprofile_visitors, "description" => $lang->mp_myprofile_visitors_desc, "isdefault" => 0);
     $gid = MyProfileUtils::insert_settinggroups($settinggroups);
     $settings[] = array("name" => "mpvisitorsenabled", "title" => $lang->mp_myprofile_visitors_enabled, "description" => $lang->mp_myprofile_visitors_enabled_desc, "optionscode" => "yesno", "value" => "1", "gid" => $gid);
     $settings[] = array("name" => "mpvisitorsrecord", "title" => $lang->mp_myprofile_visitors_record, "description" => $lang->mp_myprofile_visitors_record_desc, "optionscode" => "select\n5=5\n10=10\n15=15\n20=20\n30=30\n50=50\n100=100", "value" => "10", "gid" => $gid);
     $settings[] = array("name" => "mpprofileviewsenabled", "title" => $lang->mp_myprofile_views_enabled, "description" => $lang->mp_myprofile_views_enabled_desc, "optionscode" => "yesno", "value" => 1, "gid" => $gid);
     MyProfileUtils::insert_settings($settings);
 }
 public function install()
 {
     global $db, $cache, $lang;
     MyProfileUtils::lang_load_config_myprofile();
     $tables = array();
     $collation = $db->build_create_table_collation();
     if (!$db->table_exists("myprofilecomments")) {
         $tables[] = "CREATE TABLE " . TABLE_PREFIX . "myprofilecomments (\n\t\t\t\t`cid` int unsigned NOT NULL auto_increment,\n\t\t\t\t`userid` int unsigned NOT NULL,\n\t\t\t\t`cuid` int unsigned NOT NULL,\n\t\t\t\t`message` text NOT NULL,\n\t\t\t\t`approved` int(1) NOT NULL default '0',\n\t\t\t\t`isprivate` int(1) NOT NULL default '0',\n\t\t\t\t`time` varchar(10) NOT NULL,\n\t\t\t\tPRIMARY KEY (`cid`)\n\t\t\t) ENGINE=MyISAM{$collation};";
     }
     foreach ($tables as $table) {
         $db->write_query($table);
     }
     if (!$db->field_exists("canmanagecomments", "usergroups")) {
         $db->add_column("usergroups", "canmanagecomments", "int(1) NOT NULL default '0'");
     }
     if (!$db->field_exists("cansendcomments", "usergroups")) {
         $db->add_column("usergroups", "cansendcomments", "int(1) NOT NULL default '1'");
     }
     if (!$db->field_exists("caneditowncomments", "usergroups")) {
         $db->add_column("usergroups", "caneditowncomments", "int(1) NOT NULL default '1'");
     }
     if (!$db->field_exists("candeleteowncomments", "usergroups")) {
         $db->add_column("usergroups", "candeleteowncomments", "int(1) NOT NULL default '0'");
     }
     if (!$db->field_exists("commentsperday", "usergroups")) {
         $db->add_column("usergroups", "commentsperday", "int unsigned NOT NULL DEFAULT 0");
     }
     /* giving "manage" access to administrators, and delete own comments */
     $db->update_query("usergroups", array("canmanagecomments" => "1", "candeleteowncomments" => "1"), "gid='4'");
     /* revoking commenting + editing access from guests, banned and awaiting activation users */
     $db->update_query("usergroups", array("cansendcomments" => "0", "caneditowncomments" => "0"), "gid IN ('1', '5', '7')");
     $cache->update_usergroups();
     if (!$db->field_exists("mpcommentsopen", "users")) {
         $db->add_column("users", "mpcommentsopen", "int(10) NOT NULL default '1'");
     }
     if (!$db->field_exists("mpcommentnotification", "users")) {
         $db->add_column("users", "mpcommentnotification", "int(10) NOT NULL default '1'");
     }
     if (!$db->field_exists("mpwhocancomment", "users")) {
         $db->add_column("users", "mpwhocancomment", "int(10) NOT NULL default '2'");
         // 0=no one, 1=friendlist, 2=everyone
     }
     if (!$db->field_exists("mpnewcomments", "users")) {
         $db->add_column("users", "mpnewcomments", "int(10) NOT NULL default '0'");
     }
     if (!$db->field_exists("mpcommentsapprove", "users")) {
         $db->add_column("users", "mpcommentsapprove", "int(10) NOT NULL default '0'");
     }
     $settinggroups = array("name" => "myprofilecomments", "title" => $lang->mp_myprofile_comments, "description" => $lang->mp_myprofile_comments_desc, "isdefault" => 0);
     $gid = MyProfileUtils::insert_settinggroups($settinggroups);
     $settings = array();
     $settings[] = array("name" => "mpcommentsenabled", "title" => $lang->mp_myprofile_comments_enabled, "description" => $lang->mp_myprofile_comments_enabled_desc, "optionscode" => "yesno", "value" => "1", "gid" => $gid);
     $settings[] = array("name" => "mpcommentsajaxenabled", "title" => $lang->mp_myprofile_comments_ajax_enabled, "description" => $lang->mp_myprofile_comments_ajax_enabled_desc, "optionscode" => "yesno", "value" => "1", "gid" => $gid);
     $settings[] = array("name" => "mpcommentsnotification", "title" => $lang->mp_myprofile_comments_notification, "description" => $lang->mp_myprofile_comments_notification_desc, "optionscode" => "select\nmyalertsoralertbar={$lang->mp_myprofile_comments_notification_myalerts_alertbar}\nmyalerts={$lang->mp_myprofile_comments_notification_myalerts}\nalertbar={$lang->mp_myprofile_comments_notification_alertbar}\nnone={$lang->mp_myprofile_comments_notification_none}", "value" => "myalertsoralertbar", "gid" => $gid);
     $settings[] = array("name" => "mpcommentsperpage", "title" => $lang->mp_myprofile_comments_perpage, "description" => $lang->mp_myprofile_comments_perpage_desc, "optionscode" => "select\n2=2\n3=3\n4=4\n5=5\n6=6\n7=7\n8=8\n9=9\n10=10\n15=15\n25=25\n30=30", "value" => "10", "gid" => $gid);
     $settings[] = array("name" => "mpcommentsminlength", "title" => $lang->mp_myprofile_comments_min_length, "description" => $lang->mp_myprofile_comments_min_length_desc, "optionscode" => "text", "value" => "2", "gid" => $gid);
     $settings[] = array("name" => "mpcommentsmaxlength", "title" => $lang->mp_myprofile_comments_max_length, "description" => $lang->mp_myprofile_comments_max_length_desc, "optionscode" => "text", "value" => "5000", "gid" => $gid);
     $settings[] = array("name" => "mpcommentsignoreenabled", "title" => $lang->mp_myprofile_comments_ignore, "description" => $lang->mp_myprofile_comments_ignore_desc, "optionscode" => "yesno", "value" => "1", "gid" => $gid);
     $settings[] = array("name" => "mpcommentstimeedit", "title" => $lang->mp_myprofile_comments_edit_time, "description" => $lang->mp_myprofile_comments_edit_time_desc, "optionscode" => "select\n0=0\n5=5\n10=10\n15=15\n20=20\n30=30\n45=45\n60=60", "value" => "0", "gid" => $gid);
     $settings[] = array("name" => "mpcommentstimeflood", "title" => $lang->mp_myprofile_comments_flood_time, "description" => $lang->mp_myprofile_comments_flood_time_desc, "optionscode" => "select\n0=0\n5=5\n10=10\n15=15\n20=20\n30=30\n45=45\n60=60", "value" => "20", "gid" => $gid);
     $settings[] = array("name" => "mpcommentsstatusenabled", "title" => $lang->mp_myprofile_comments_status_enabled, "description" => $lang->mp_myprofile_comments_status_enabled_desc, "optionscode" => "yesno", "value" => "1", "gid" => $gid);
     $settings[] = array("name" => "mpcommentsallowimg", "title" => $lang->mp_myprofile_comments_allow_img, "description" => $lang->mp_myprofile_comments_allow_img_desc, "optionscode" => "yesno", "value" => "1", "gid" => $gid);
     $settings[] = array("name" => "mpcommentsallowvideo", "title" => $lang->mp_myprofile_comments_allow_video, "description" => $lang->mp_myprofile_comments_allow_video_desc, "optionscode" => "yesno", "value" => "1", "gid" => $gid);
     $settings[] = array("name" => "mpcommentsallowsmilies", "title" => $lang->mp_myprofile_comments_allow_smilies, "description" => $lang->mp_myprofile_comments_allow_smilies_desc, "optionscode" => "yesno", "value" => "1", "gid" => $gid);
     $settings[] = array("name" => "mpcommentsallowmycode", "title" => $lang->mp_myprofile_comments_allow_mycode, "description" => $lang->mp_myprofile_comments_allow_mycode_desc, "optionscode" => "yesno", "value" => "1", "gid" => $gid);
     $settings[] = array("name" => "mpcommentsfilterbadwords", "title" => $lang->mp_myprofile_comments_filter_badwords, "description" => $lang->mp_myprofile_comments_filter_badwords_desc, "optionscode" => "yesno", "value" => "1", "gid" => $gid);
     $settings[] = array("name" => "mpcommentsallowhtml", "title" => $lang->mp_myprofile_comments_allow_html, "description" => $lang->mp_myprofile_comments_allow_html_desc, "optionscode" => "yesno", "value" => "0", "gid" => $gid);
     $settings[] = array("name" => "mpcommentsshowwysiwyg", "title" => $lang->mp_myprofile_comments_show_wysiwyg, "description" => $lang->mp_myprofile_comments_show_wysiwyg_desc, "optionscode" => "yesno", "value" => "1", "gid" => $gid);
     $settings[] = array("name" => "mpcommentsclosedonbanned", "title" => $lang->mp_myprofile_comments_closed_on_banned, "description" => $lang->mp_myprofile_comments_closed_on_banned_desc, "optionscode" => "yesno", "value" => "1", "gid" => $gid);
     $settings[] = array("name" => "mpcommentsshowstats", "title" => $lang->mp_myprofile_comments_show_stats, "description" => $lang->mp_myprofile_comments_show_stats_desc, "optionscode" => "yesno", "value" => "1", "gid" => $gid);
     MyProfileUtils::insert_settings($settings);
 }