| 1 |
<?php |
| 2 |
// Exit if accessed directly |
| 3 |
if( !defined( 'ABSPATH' ) ) exit; |
| 4 |
|
| 5 |
|
| 6 |
function wpforo_activation(){ |
| 7 |
|
| 8 |
if( ! is_admin() ) return; |
| 9 |
if( ! current_user_can( 'activate_plugins' ) ) return; |
| 10 |
|
| 11 |
global $wpforo; |
| 12 |
|
| 13 |
add_option('wpforo_default_groupid', 3); |
| 14 |
|
| 15 |
require( WPFORO_DIR . '/wpf-includes/install-sql.php' ); |
| 16 |
foreach( $wpforo_sql as $sql ) @$wpforo->db->query( $sql ); |
| 17 |
|
| 18 |
$wpforo->member->synchronize_users(); |
| 19 |
$wpforo->member->init_current_user(); |
| 20 |
|
| 21 |
$blogname = get_option('blogname'); |
| 22 |
$adminemail = get_option('admin_email'); |
| 23 |
|
| 24 |
add_option( 'wpforo_count_per_page', 10 ); |
| 25 |
|
| 26 |
// General Options /////////////////////////////////////// |
| 27 |
$general_options = array( |
| 28 |
'title' => $blogname . __(' Forum', 'wpforo'), |
| 29 |
'description' => $blogname . __(' Discussion Board', 'wpforo'), |
| 30 |
'lang' => 1, |
| 31 |
); |
| 32 |
add_option( 'wpforo_general_options', $general_options ); |
| 33 |
|
| 34 |
// Forums //////////////////////////////////////////////// |
| 35 |
$wpforo_forum = array( |
| 36 |
'layout_qa_intro_topics_toggle' => 1, |
| 37 |
'layout_extended_intro_topics_toggle' => 1, |
| 38 |
'layout_qa_intro_topics_count' => 3, |
| 39 |
'layout_extended_intro_topics_count' => 5, |
| 40 |
); |
| 41 |
add_option( 'wpforo_forum_options', $wpforo_forum ); |
| 42 |
|
| 43 |
// Topics & Posts //////////////////////////////////////// |
| 44 |
$upload_max_filesize = @ini_get('upload_max_filesize'); |
| 45 |
$upload_max_filesize = wpforo_human_size_to_bytes($upload_max_filesize); |
| 46 |
if( !$upload_max_filesize || $upload_max_filesize > 10485760 ) $upload_max_filesize = 10485760; |
| 47 |
$wpforo_post = array( |
| 48 |
'layout_extended_intro_posts_toggle' => 1, |
| 49 |
'layout_extended_intro_posts_count' => 4, |
| 50 |
'topics_per_page' => 10, |
| 51 |
'eot_durr' => 300, |
| 52 |
'dot_durr' => 300, |
| 53 |
'posts_per_page' => 15, |
| 54 |
'eor_durr' => 300, |
| 55 |
'dor_durr' => 300, |
| 56 |
'max_upload_size' => $upload_max_filesize |
| 57 |
); |
| 58 |
add_option( 'wpforo_post_options', $wpforo_post ); |
| 59 |
|
| 60 |
// Features ////////////////////////////////////////////// |
| 61 |
$wpforo_features = array( |
| 62 |
'user-admin-bar' => 0, |
| 63 |
'page-title' => 1, |
| 64 |
'top-bar' => 1, |
| 65 |
'top-bar-search' => 1, |
| 66 |
'breadcrumb' => 1, |
| 67 |
'footer-stat' => 1, |
| 68 |
'author-link' => 0, |
| 69 |
'comment-author-link' => 0, |
| 70 |
'register-url' => 0, |
| 71 |
'login-url' => 0, |
| 72 |
'replace-avatar' => 1, |
| 73 |
'avatars' => 1, |
| 74 |
'custom-avatars' => 1, |
| 75 |
'signature' => 1, |
| 76 |
'rating' => 1, |
| 77 |
'rating_title' => 1, |
| 78 |
'member_cashe' => 1, |
| 79 |
'seo-title' => 1, |
| 80 |
'seo-meta' => 1, |
| 81 |
'font-awesome' => 1, |
| 82 |
'output-buffer' => 0, |
| 83 |
'copyright' => 1 |
| 84 |
); |
| 85 |
add_option( 'wpforo_features', $wpforo_features ); |
| 86 |
|
| 87 |
// Theme /////////////////////////////////////////////////// |
| 88 |
$wpforo_style = array( |
| 89 |
'font_size_forum' => 17, |
| 90 |
'font_size_topic' => 16, |
| 91 |
'font_size_post_content' => 14, |
| 92 |
'custom_css' => "#wpforo-wrap {\r\n font-size: 13px; width: 100%; margin:0;\r\n}\r\n", |
| 93 |
); |
| 94 |
add_option( 'wpforo_style_options', $wpforo_style ); |
| 95 |
|
| 96 |
$defaut_theme = 'classic'; |
| 97 |
$theme = $wpforo->tpl->find_theme( $defaut_theme ); |
| 98 |
add_option( 'wpforo_theme_options', $theme ); |
| 99 |
|
| 100 |
// Members ///////////////////////////////////////////////// |
| 101 |
$wpforo_member = array( |
| 102 |
'online_status_timeout' => 240, |
| 103 |
'url_structure' => 'nicename', |
| 104 |
'login_url' => '', |
| 105 |
'register_url' => '', |
| 106 |
'lost_password_url' => '', |
| 107 |
); |
| 108 |
add_option( 'wpforo_member_options', $wpforo_member ); |
| 109 |
|
| 110 |
// Subscribe Options /////////////////////////////////////// |
| 111 |
$subscriptions_options = array ( |
| 112 |
'from_name' => $blogname . ' - Forum', |
| 113 |
'from_email' => $adminemail, |
| 114 |
'admin_emails' => $adminemail, |
| 115 |
'confirmation_email_subject' => "Please confirm subscription to [entry_title]", |
| 116 |
'confirmation_email_message' => "Hello [member_name]!<br>\r\n Thank you for subscribing.<br>\r\n This is an automated response.<br>\r\n We are glad to inform you that after confirmation you will get updates from - [entry_title].<br>\r\n Please click on link below to complete this step.<br>\r\n [confirm_link]" , |
| 117 |
'new_topic_notification_email_subject' => "New Topic" , |
| 118 |
'new_topic_notification_email_message' => "Hello [member_name]!<br>\r\n New topic has been created on your subscribed forum - [forum].\r\n <br><br>\r\n <strong>[topic_title]</strong>\r\n <blockquote>\r\n [topic_desc]\r\n </blockquote>\r\n <br><hr>\r\n If you want to unsubscribe from this forum please use the link below.<br>\r\n [unsubscribe_link]" , |
| 119 |
'new_post_notification_email_subject' => "New Reply" , |
| 120 |
'new_post_notification_email_message' => "Hello [member_name]!<br>\r\n New reply has been posted on your subscribed topic - [topic].\r\n <br><br>\r\n <strong>[reply_title]</strong>\r\n <blockquote >\r\n [reply_desc]\r\n </blockquote>\r\n <br><hr>\r\n If you want to unsubscribe from this topic please use the link below.<br>\r\n [unsubscribe_link]" , |
| 121 |
'report_email_subject' => "Forum Post Report", |
| 122 |
'report_email_message' => "<strong>Report details:</strong>\r\n Reporter: [reporter], <br>\r\n Message: [message],<br>\r\n <br>\r\n [post_url]", |
| 123 |
'update' => '1' ); |
| 124 |
|
| 125 |
add_option( 'wpforo_subscribe_options', $subscriptions_options ); |
| 126 |
|
| 127 |
$countries = array( "Afghanistan","� |
| 128 |
land Islands","Albania","Algeria","American Samoa","Andorra","Angola","Anguilla","Antarctica", |
| 129 |
"Antigua and Barbuda","Argentina","Armenia","Aruba","Australia","Austria","Azerbaijan","Bahamas","Bahrain", |
| 130 |
"Bangladesh","Barbados","Belarus","Belgium","Belize","Benin","Bermuda","Bhutan","Bolivia","Bosnia and Herzegovina", |
| 131 |
"Botswana","Bouvet Island","Brazil","British Indian Ocean Territory","Brunei Darussalam","Bulgaria","Burkina Faso", |
| 132 |
"Burundi","Cambodia","Cameroon","Canada","Cape Verde","Cayman Islands","Central African Republic","Chad","Chile", |
| 133 |
"China","Christmas Island","Cocos (Keeling) Islands","Colombia","Comoros","Congo","Congo, The Democratic Republic of The", |
| 134 |
"Cook Islands","Costa Rica","Cote D'ivoire","Croatia","Cuba","Cyprus","Czech Republic","Denmark","Djibouti","Dominica", |
| 135 |
"Dominican Republic","Ecuador","Egypt","El Salvador","Equatorial Guinea","Eritrea","Estonia","Ethiopia","Falkland Islands (Malvinas)", |
| 136 |
"Faroe Islands","Fiji","Finland","France","French Guiana","French Polynesia","French Southern Territories","Gabon", |
| 137 |
"Gambia","Georgia","Germany","Ghana","Gibraltar","Greece","Greenland","Grenada","Guadeloupe","Guam","Guatemala", |
| 138 |
"Guernsey","Guinea","Guinea-bissau","Guyana","Haiti","Heard Island and Mcdonald Islands","Holy See (Vatican City State)", |
| 139 |
"Honduras","Hong Kong","Hungary","Iceland","India","Indonesia","Iran, Islamic Republic of","Iraq","Ireland", |
| 140 |
"Isle of Man","Israel","Italy","Jamaica","Japan","Jersey","Jordan","Kazakhstan","Kenya","Kiribati","Korea, Democratic People's Republic of", |
| 141 |
"Korea, Republic of","Kuwait","Kyrgyzstan","Lao People's Democratic Republic","Latvia","Lebanon","Lesotho","Liberia", |
| 142 |
"Libyan Arab Jamahiriya","Liechtenstein","Lithuania","Luxembourg","Macao","Macedonia, The Former Yugoslav Republic of", |
| 143 |
"Madagascar","Malawi","Malaysia","Maldives","Mali","Malta","Marshall Islands","Martinique","Mauritania","Mauritius", |
| 144 |
"Mayotte","Mexico","Micronesia, Federated States of","Moldova, Republic of","Monaco","Mongolia","Montenegro","Montserrat", |
| 145 |
"Morocco","Mozambique","Myanmar","Namibia","Nauru","Nepal","Netherlands","Netherlands Antilles","New Caledonia", |
| 146 |
"New Zealand","Nicaragua","Niger","Nigeria","Niue","Norfolk Island","Northern Mariana Islands","Norway","Oman", |
| 147 |
"Pakistan","Palau","Palestinian Territory, Occupied","Panama","Papua New Guinea","Paraguay","Peru","Philippines", |
| 148 |
"Pitcairn","Poland","Portugal","Puerto Rico","Qatar","Reunion","Romania","Russian Federation","Rwanda","Saint Helena", |
| 149 |
"Saint Kitts and Nevis","Saint Lucia","Saint Pierre and Miquelon","Saint Vincent and The Grenadines","Samoa", |
| 150 |
"San Marino","Sao Tome and Principe","Saudi Arabia","Senegal","Serbia","Seychelles","Sierra Leone","Singapore", |
| 151 |
"Slovakia","Slovenia","Solomon Islands","Somalia","South Africa","South Georgia and The South Sandwich Islands", |
| 152 |
"Spain","Sri Lanka","Sudan","Suriname","Svalbard and Jan Mayen","Swaziland","Sweden","Switzerland","Syrian Arab Republic", |
| 153 |
"Taiwan, Province of China","Tajikistan","Tanzania, United Republic of","Thailand","Timor-leste","Togo","Tokelau", |
| 154 |
"Tonga","Trinidad and Tobago","Tunisia","Turkey","Turkmenistan","Turks and Caicos Islands","Tuvalu","Uganda","Ukraine", |
| 155 |
"United Arab Emirates","United Kingdom","United States","United States Minor Outlying Islands","Uruguay","Uzbekistan", |
| 156 |
"Vanuatu","Venezuela","Viet Nam","Virgin Islands, British","Virgin Islands, U.S.","Wallis and Futuna","Western Sahara", |
| 157 |
"Yemen","Zambia","Zimbabwe" ); |
| 158 |
|
| 159 |
add_option( 'wpforo_countries', $countries ); |
| 160 |
|
| 161 |
// Forum Navigation and Menu //////////////////////////////////////////// |
| 162 |
$menu_name = wpforo_phrase('wpForo Navigation', false, 'orig'); |
| 163 |
$menu_location = 'wpforo-menu'; |
| 164 |
$menu_exists = wp_get_nav_menu_object( $menu_name ); |
| 165 |
if(!$menu_exists){ |
| 166 |
$id = array(); |
| 167 |
$menu_id = wp_create_nav_menu($menu_name); |
| 168 |
$id['wpforo-home'] = wp_update_nav_menu_item($menu_id, 0, array( |
| 169 |
'menu-item-title' => wpforo_phrase('Forums', false), |
| 170 |
'menu-item-classes' => 'wpforo-home', |
| 171 |
'menu-item-url' => '/%wpforo-home%/', |
| 172 |
'menu-item-status' => 'publish', |
| 173 |
'menu-item-parent-id' => 0, |
| 174 |
'menu-item-position' => 0)); |
| 175 |
|
| 176 |
$id['wpforo-members'] = wp_update_nav_menu_item($menu_id, 0, array( |
| 177 |
'menu-item-title' => wpforo_phrase('Members', false), |
| 178 |
'menu-item-classes' => 'wpforo-members', |
| 179 |
'menu-item-url' => '/%wpforo-members%/', |
| 180 |
'menu-item-status' => 'publish', |
| 181 |
'menu-item-parent-id' => 0, |
| 182 |
'menu-item-position' => 0)); |
| 183 |
|
| 184 |
$id['wpforo-profile'] = wp_update_nav_menu_item($menu_id, 0, array( |
| 185 |
'menu-item-title' => wpforo_phrase('My Profile', false), |
| 186 |
'menu-item-classes' => 'wpforo-profile', |
| 187 |
'menu-item-url' => '/%wpforo-profile-home%/', |
| 188 |
'menu-item-status' => 'publish', |
| 189 |
'menu-item-parent-id' => 0, |
| 190 |
'menu-item-position' => 0)); |
| 191 |
|
| 192 |
if(isset($id['wpforo-profile']) && $id['wpforo-profile']){ |
| 193 |
$id['wpforo-profile-account'] = wp_update_nav_menu_item($menu_id, 0, array( |
| 194 |
'menu-item-title' => wpforo_phrase('Account', false), |
| 195 |
'menu-item-classes' => 'wpforo-profile-account', |
| 196 |
'menu-item-url' => '/%wpforo-profile-account%/', |
| 197 |
'menu-item-status' => 'publish', |
| 198 |
'menu-item-parent-id' => $id['wpforo-profile'], |
| 199 |
'menu-item-position' => 1) |
| 200 |
); |
| 201 |
$id['wpforo-profile-activity'] = wp_update_nav_menu_item($menu_id, 0, array( |
| 202 |
'menu-item-title' => wpforo_phrase('Activity', false), |
| 203 |
'menu-item-classes' => 'wpforo-profile-activity', |
| 204 |
'menu-item-url' => '/%wpforo-profile-activity%/', |
| 205 |
'menu-item-status' => 'publish', |
| 206 |
'menu-item-parent-id' => $id['wpforo-profile'], |
| 207 |
'menu-item-position' => 1) |
| 208 |
); |
| 209 |
$id['wpforo-profile-subscriptions'] = wp_update_nav_menu_item($menu_id, 0, array( |
| 210 |
'menu-item-title' => wpforo_phrase('Subscriptions', false), |
| 211 |
'menu-item-classes' => 'wpforo-profile-subscriptions', |
| 212 |
'menu-item-url' => '/%wpforo-profile-subscriptions%/', |
| 213 |
'menu-item-status' => 'publish', |
| 214 |
'menu-item-parent-id' => $id['wpforo-profile'], |
| 215 |
'menu-item-position' => 2) |
| 216 |
); |
| 217 |
} |
| 218 |
|
| 219 |
$id['wpforo-register'] = wp_update_nav_menu_item($menu_id, 0, array( |
| 220 |
'menu-item-title' => wpforo_phrase('Register', false), |
| 221 |
'menu-item-classes' => 'wpforo-register', |
| 222 |
'menu-item-url' => '/%wpforo-register%/', |
| 223 |
'menu-item-status' => 'publish', |
| 224 |
'menu-item-parent-id' => 0, |
| 225 |
'menu-item-position' => 0)); |
| 226 |
|
| 227 |
$id['wpforo-login'] = wp_update_nav_menu_item($menu_id, 0, array( |
| 228 |
'menu-item-title' => wpforo_phrase('Login', false), |
| 229 |
'menu-item-classes' => 'wpforo-login', |
| 230 |
'menu-item-url' => '/%wpforo-login%/', |
| 231 |
'menu-item-status' => 'publish', |
| 232 |
'menu-item-parent-id' => 0, |
| 233 |
'menu-item-position' => 0)); |
| 234 |
|
| 235 |
$id['wpforo-logout'] = wp_update_nav_menu_item($menu_id, 0, array( |
| 236 |
'menu-item-title' => wpforo_phrase('Logout', false), |
| 237 |
'menu-item-classes' => 'wpforo-logout', |
| 238 |
'menu-item-url' => '/%wpforo-logout%/', |
| 239 |
'menu-item-status' => 'publish', |
| 240 |
'menu-item-parent-id' => 0, |
| 241 |
'menu-item-position' => 0)); |
| 242 |
|
| 243 |
if( !has_nav_menu( $menu_location ) ){ |
| 244 |
$locations = get_theme_mod('nav_menu_locations'); |
| 245 |
if(empty($locations)) $locations = array(); |
| 246 |
$locations[$menu_location] = $menu_id; |
| 247 |
set_theme_mod( 'nav_menu_locations', $locations ); |
| 248 |
} |
| 249 |
} |
| 250 |
|
| 251 |
// Forum Access Array ///////////////////////////////////////////////////// |
| 252 |
$forum_cans = array ( |
| 253 |
'vf' => 'Can view forum', |
| 254 |
'ct' => 'Can create topic', |
| 255 |
'vt' => 'Can view topic', |
| 256 |
'et' => 'Can edit topic', |
| 257 |
'dt' => 'Can delete topic', |
| 258 |
'cr' => 'Can post reply', |
| 259 |
'vr' => 'Can view replies', |
| 260 |
'er' => 'Can edit replies', |
| 261 |
'dr' => 'Can delete replies', |
| 262 |
'eot' => 'Can edit own topic', |
| 263 |
'eor' => 'Can edit own replay', |
| 264 |
'dot' => 'Can delete own topic', |
| 265 |
'dor' => 'Can delete own replay', |
| 266 |
'l' => 'Can like', |
| 267 |
'r' => 'Can report', |
| 268 |
's' => 'Can make topic sticky', |
| 269 |
'v' => 'Can vote', |
| 270 |
'a' => 'Can Attach File', |
| 271 |
'at' => 'Can make topic answered', |
| 272 |
'oat' => 'Can make own topic answered', |
| 273 |
'cot' => 'Can close topic', |
| 274 |
'mt' => 'Can move topic' |
| 275 |
); |
| 276 |
add_option( 'wpforo_forum_cans', $forum_cans); |
| 277 |
|
| 278 |
// Access Sets /////////////////////////////////////////////////////////// |
| 279 |
$cans_n = array('vf' => 0, 'ct' => 0, 'vt' => 0, 'et' => 0, 'dt' => 0, |
| 280 |
'cr' => 0, 'vr' => 0, 'er' => 0, 'dr' => 0, |
| 281 |
'eot' => 0, 'eor' => 0, 'dot' => 0, 'dor' => 0, |
| 282 |
'l' => 0, 'r' => 0, 's' => 0, 'v' => 0, 'a' => 0, |
| 283 |
'at' => 0, 'oat' => 0, 'cot' => 0, 'mt' => 0); |
| 284 |
$cans_r = array('vf' => 1, 'ct' => 0, 'vt' => 1, 'et' => 0, 'dt' => 0, |
| 285 |
'cr' => 0, 'vr' => 1, 'er' => 0, 'dr' => 0, |
| 286 |
'eot' => 0, 'eor' => 0, 'dot' => 0, 'dor' => 0, |
| 287 |
'l' => 0, 'r' => 0, 's' => 0, 'v' => 0, 'a' => 0, |
| 288 |
'at' => 0, 'oat' => 0, 'cot' => 0, 'mt' => 0); |
| 289 |
$cans_s = array('vf' => 1, 'ct' => 1, 'vt' => 1, 'et' => 0, 'dt' => 0, |
| 290 |
'cr' => 1, 'vr' => 1, 'er' => 0, 'dr' => 0, |
| 291 |
'eot' => 1, 'eor' => 1, 'dot' => 1, 'dor' => 1, |
| 292 |
'l' => 1, 'r' => 1, 's' => 0, 'v' => 1, 'a' => 1, |
| 293 |
'at' => 0, 'oat' => 1, 'cot' => 0, 'mt' => 0); |
| 294 |
$cans_m = array('vf' => 1, 'ct' => 1, 'vt' => 1, 'et' => 1, 'dt' => 1, |
| 295 |
'cr' => 1, 'vr' => 1, 'er' => 1, 'dr' => 1, |
| 296 |
'eot' => 1, 'eor' => 1, 'dot' => 1, 'dor' => 1, |
| 297 |
'l' => 1, 'r' => 1, 's' => 1, 'v' => 1, 'a' => 1, |
| 298 |
'at' => 1, 'oat' => 1, 'cot' => 1, 'mt' => 1); |
| 299 |
$cans_a = array('vf' => 1, 'ct' => 1, 'vt' => 1, 'et' => 1, 'dt' => 1, |
| 300 |
'cr' => 1, 'vr' => 1, 'er' => 1, 'dr' => 1, |
| 301 |
'eot' => 1, 'eor' => 1, 'dot' => 1, 'dor' => 1, |
| 302 |
'l' => 1, 'r' => 1, 's' => 1, 'v' => 1, 'a' => 1, |
| 303 |
'at' => 1, 'oat' => 1, 'cot' => 1, 'mt' => 1); |
| 304 |
|
| 305 |
$cans_n = serialize($cans_n); |
| 306 |
$cans_r = serialize($cans_r); |
| 307 |
$cans_s = serialize($cans_s); |
| 308 |
$cans_m = serialize($cans_m); |
| 309 |
$cans_a = serialize($cans_a); |
| 310 |
|
| 311 |
$sql = "INSERT IGNORE INTO `".$wpforo->db->prefix."wpforo_accesses` |
| 312 |
(`access`, `title`, cans) VALUES |
| 313 |
('no_access', 'No access', '". $cans_n ."'), |
| 314 |
('read_only', 'Read only access', '". $cans_r ."'), |
| 315 |
('standard', 'Standard access', '". $cans_s ."'), |
| 316 |
('moderator', 'Moderator access', '".$cans_m."'), |
| 317 |
('full', 'Full access', '".$cans_a."')"; |
| 318 |
|
| 319 |
$wpforo->db->query( $sql ); |
| 320 |
|
| 321 |
// Usergroup Cans /////////////////////////////////////////////////// |
| 322 |
$usergroup_cans = array ( |
| 323 |
'cf' => 'Dahsboard - Can create forum', |
| 324 |
'ef' => 'Dahsboard - Can edit forum', |
| 325 |
'df' => 'Dahsboard - Can delete forum', |
| 326 |
'vm' => 'Dahsboard - Members Menu', |
| 327 |
'em' => 'Dahsboard - Can edit member', |
| 328 |
'dm' => 'Dahsboard - Can delete member', |
| 329 |
'vmg' => 'Dahsboard - Usergroup Menu', |
| 330 |
'upa' => 'Front - Can upload avatar', |
| 331 |
'ups' => 'Front - Can have signatur', |
| 332 |
'va' => 'Front - Can view avatars', |
| 333 |
'vmu' => 'Front - Can view member username', |
| 334 |
'vmm' => 'Front - Can view member email', |
| 335 |
'vmt' => 'Front - Can view member title', |
| 336 |
'vmct' => 'Front - Can view member custom title', |
| 337 |
'vmr' => 'Front - Can view member reputation', |
| 338 |
'vmw' => 'Front - Can view member website', |
| 339 |
'vmsn' => 'Front - Can view member social networks', |
| 340 |
'vmrd' => 'Front - Can view member reg. date', |
| 341 |
'vmlad'=> 'Front - Can view member last active date', |
| 342 |
'vip' => 'Front - Can view member ip address', |
| 343 |
'vml' => 'Front - Can view member location', |
| 344 |
'vmo' => 'Front - Can view member ocumpation', |
| 345 |
'vms' => 'Front - Can view member signatur', |
| 346 |
'vmam' => 'Front - Can view member about me', |
| 347 |
'vmpn' => 'Front - Can view member phone number', |
| 348 |
'vwpm' => 'Front - Can write PM' |
| 349 |
); |
| 350 |
add_option( 'wpforo_usergroup_cans', $usergroup_cans); |
| 351 |
|
| 352 |
// Usergroup ///////////////////////////////////////////////////////// |
| 353 |
$cans_admin = array('cf' => '1', 'ef' => '1', 'df' => '1', 'vm' => '1', 'em' => '1', 'vmg' => '1', |
| 354 |
'dm' => '1', 'upa' => '1', 'ups' => '1', 'va' => '1', |
| 355 |
'vmu' => '1', 'vmm' => '1', 'vmt' => '1', 'vmct' => '1', |
| 356 |
'vmr' => '1', 'vmw' => '1', 'vmsn' => '1', 'vmrd' => '1', |
| 357 |
'vmlad' => '1', 'vip' => '1', 'vml' => '1', 'vmo' => '1', |
| 358 |
'vms' => '1', 'vmam' => '1', 'vmpn' => '1', 'vwpm' => '1'); |
| 359 |
$cans_moder = array('cf' => '0', 'ef' => '0', 'df' => '0', 'vm' => '0', 'em' => '0', 'vmg' => '0', |
| 360 |
'dm' => '1', 'upa' => '1', 'ups' => '1', 'va' => '1', |
| 361 |
'vmu' => '1', 'vmm' => '1', 'vmt' => '1', 'vmct' => '1', |
| 362 |
'vmr' => '1', 'vmw' => '1', 'vmsn' => '1', 'vmrd' => '1', |
| 363 |
'vmlad' => '1', 'vip' => '1', 'vml' => '1', 'vmo' => '1', |
| 364 |
'vms' => '1', 'vmam' => '1', 'vmpn' => '1', 'vwpm' => '1'); |
| 365 |
$cans_reg = array( 'cf' => '0', 'ef' => '0', 'df' => '0', 'vm' => '0', 'em' => '0', 'vmg' => '0', |
| 366 |
'dm' => '0', 'upa' => '1', 'ups' => '1', 'va' => '1', |
| 367 |
'vmu' => '1', 'vmm' => '0', 'vmt' => '1', 'vmct' => '1', |
| 368 |
'vmr' => '1', 'vmw' => '1', 'vmsn' => '1', 'vmrd' => '1', |
| 369 |
'vmlad' => '1', 'vip' => '0', 'vml' => '1', 'vmo' => '1', |
| 370 |
'vms' => '1', 'vmam' => '1', 'vmpn' => '0', 'vwpm' => '1'); |
| 371 |
$cans_guest = array('cf' => '0', 'ef' => '0', 'df' => '0', 'vm' => '0', 'em' => '0', 'vmg' => '0', |
| 372 |
'dm' => '0', 'upa' => '0', 'ups' => '0', 'va' => '0', |
| 373 |
'vmu' => '0', 'vmm' => '0', 'vmt' => '0', 'vmct' => '0', |
| 374 |
'vmr' => '1', 'vmw' => '0', 'vmsn' => '1', 'vmrd' => '0', |
| 375 |
'vmlad' => '1', 'vip' => '0', 'vml' => '1', 'vmo' => '1', |
| 376 |
'vms' => '0', 'vmam' => '1', 'vmpn' => '0', 'vwpm' => '0'); |
| 377 |
$cans_customer = array( 'cf' => '0', 'ef' => '0', 'df' => '0', 'vm' => '0', 'em' => '0', 'vmg' => '0', |
| 378 |
'dm' => '0', 'upa' => '1', 'ups' => '1', 'va' => '1', |
| 379 |
'vmu' => '1', 'vmm' => '0', 'vmt' => '1', 'vmct' => '1', |
| 380 |
'vmr' => '1', 'vmw' => '1', 'vmsn' => '1', 'vmrd' => '1', |
| 381 |
'vmlad' => '1', 'vip' => '0', 'vml' => '1', 'vmo' => '1', |
| 382 |
'vms' => '1', 'vmam' => '1', 'vmpn' => '0', 'vwpm' => '1'); |
| 383 |
|
| 384 |
$cans_admin = serialize( $cans_admin ); |
| 385 |
$cans_moder = serialize( $cans_moder ); |
| 386 |
$cans_reg = serialize( $cans_reg ); |
| 387 |
$cans_guest = serialize( $cans_guest ); |
| 388 |
$cans_customer = serialize( $cans_customer ); |
| 389 |
|
| 390 |
$sql = "SELECT COUNT(*) FROM `".$wpforo->db->prefix."wpforo_usergroups`"; |
| 391 |
$count = $wpforo->db->get_var($sql); |
| 392 |
if( $count == 0 ){ |
| 393 |
$sql = "INSERT IGNORE INTO `".$wpforo->db->prefix."wpforo_usergroups` |
| 394 |
(`name`, `cans`) VALUES ('Admin', '$cans_admin'),('Moderator', '$cans_moder'),('Registered', '$cans_reg'),('Guest', '$cans_guest'),('Customer', '$cans_customer')"; |
| 395 |
$wpforo->db->query($sql); |
| 396 |
} |
| 397 |
$sql = "SELECT COUNT(*) FROM `".$wpforo->db->prefix."wpforo_forums`"; |
| 398 |
$count = $wpforo->db->get_var($sql); |
| 399 |
if(!$count){ |
| 400 |
if( $parentid = $wpforo->forum->add( array( 'title' => 'Main Category', 'description' => 'This is a simple category / section' ), FALSE ) ){ |
| 401 |
$wpforo->forum->add( array( 'title' => 'Main Forum', 'description' => 'This is a simple parent forum', 'parentid' => $parentid ), FALSE ); |
| 402 |
} |
| 403 |
} |
| 404 |
|
| 405 |
// Permalink Settings /////////////////////////////////////////////////////////////// |
| 406 |
$permalink_structure = get_option( 'permalink_structure' ); |
| 407 |
if( $permalink_structure == '' ){ |
| 408 |
global $wp_rewrite; |
| 409 |
$wp_rewrite->set_permalink_structure( '/%postname%/' ); |
| 410 |
if( file_exists( ABSPATH.'.htaccess' )){ |
| 411 |
$htaccesssize = filesize( ABSPATH.'.htaccess' ); |
| 412 |
if( $htaccesssize == 0 ){ |
| 413 |
wpforo_add_notice( 'permalink_notice' ); |
| 414 |
} |
| 415 |
}else{ |
| 416 |
wpforo_add_notice( 'permalink_notice' ); |
| 417 |
} |
| 418 |
} |
| 419 |
|
| 420 |
// Creating Forum Page /////////////////////////////////////////////////////////////// |
| 421 |
if( !$wpforo->pageid ){ |
| 422 |
if( !$page_id = $wpforo->db->get_var("SELECT `ID` FROM `{$wpforo->db->prefix}posts` WHERE `post_content` LIKE '%[wpforo-index]%' AND `post_status` LIKE 'publish' AND `post_type` IN('post', 'page')") ){ |
| 423 |
$wpforo_page = array( |
| 424 |
'post_date' => current_time( 'mysql', 1 ), |
| 425 |
'post_date_gmt' => current_time( 'mysql', 1 ), |
| 426 |
'post_content' => '[wpforo-index]', |
| 427 |
'post_title' => 'Forum', |
| 428 |
'post_status' => 'publish', |
| 429 |
'comment_status' => 'close', |
| 430 |
'ping_status' => 'close', |
| 431 |
'post_name' => 'community', |
| 432 |
'post_modified' => current_time( 'mysql', 1 ), |
| 433 |
'post_modified_gmt' => current_time( 'mysql', 1 ), |
| 434 |
'post_parent' => 0, |
| 435 |
'menu_order' => 0, |
| 436 |
'post_type' => 'page' |
| 437 |
); |
| 438 |
$page_id = wp_insert_post( $wpforo_page ); |
| 439 |
} |
| 440 |
|
| 441 |
if( $page_id && !is_wp_error($page_id) ){ |
| 442 |
update_option( 'wpforo_pageid', $page_id ); |
| 443 |
update_option( 'wpforo_url', trim(get_permalink($page_id), '/') . '/' ); |
| 444 |
} |
| 445 |
} |
| 446 |
|
| 447 |
// Importing Language Packs and Phrases /////////////////////////////////////// |
| 448 |
$wpforo->phrase->xml_import('english.xml'); |
| 449 |
|
| 450 |
// Creating wpforo folders //////////////////////////////////////////////////// |
| 451 |
$upload_array = wp_upload_dir(); |
| 452 |
$wpforo_upload_dir = $upload_array['basedir'].'/wpforo/'; |
| 453 |
if (!is_dir($wpforo_upload_dir)) { |
| 454 |
wp_mkdir_p($wpforo_upload_dir); |
| 455 |
} |
| 456 |
$avatars_upload_dir=$upload_array['basedir'].'/wpforo/avatars/'; |
| 457 |
if (!is_dir($avatars_upload_dir)) { |
| 458 |
wp_mkdir_p($avatars_upload_dir); |
| 459 |
} |
| 460 |
|
| 461 |
################################################################################ |
| 462 |
// UDATES ////////////////////////////////////////////////////////////////////// |
| 463 |
################################################################################ |
| 464 |
|
| 465 |
$old_version = get_option('wpforo_version'); |
| 466 |
|
| 467 |
//if ( version_compare($old_version, 'Beta-3', '<') ) { |
| 468 |
$member_options = get_option( 'wpforo_member_options' ); |
| 469 |
if(!isset($member_options['login_url'])) $member_options['login_url'] = ''; |
| 470 |
if(!isset($member_options['register_url'])) $member_options['register_url'] = ''; |
| 471 |
if(!isset($member_options['lost_password_url'])) $member_options['lost_password_url'] = ''; |
| 472 |
if(!isset($member_options['rating_title_ug'])) $member_options['rating_title_ug'] = array ( 1 => '1', 5 => '1', 4 => '1', 2 => '1', 3 => '1'); |
| 473 |
if(!isset($member_options['rating_badge_ug'])) $member_options['rating_badge_ug'] = array ( 1 => '1', 5 => '1', 4 => '1', 2 => '1', 3 => '1'); |
| 474 |
if(!empty($member_options))update_option( 'wpforo_member_options', $member_options ); |
| 475 |
//} |
| 476 |
|
| 477 |
//if ( version_compare($old_version, 'Beta-4', '<') ) { |
| 478 |
$features = get_option( 'wpforo_features' ); |
| 479 |
if(!isset($features['output-buffer'])) $features['output-buffer'] = 0; |
| 480 |
if(!empty($features)) update_option( 'wpforo_features', $features ); |
| 481 |
//} |
| 482 |
|
| 483 |
################################################################################ |
| 484 |
// UDATES END ////////////////////////////////////////////////////////////////// |
| 485 |
################################################################################ |
| 486 |
|
| 487 |
update_option('wpforo_version', $wpforo->version); |
| 488 |
$wpforo->notice->clear(); |
| 489 |
} |
| 490 |
|
| 491 |
function wpforo_deactivation() {} |
| 492 |
|
| 493 |
|
| 494 |
function wpforo_uninstall() { |
| 495 |
|
| 496 |
global $wpforo, $wpdb; |
| 497 |
|
| 498 |
if( ! is_admin() ) return; |
| 499 |
if( ! current_user_can( 'activate_plugins' ) ) return; |
| 500 |
$QUERY_STRING = trim(preg_replace('|_wpnonce=[^\&\?\=]*|is', '', $_SERVER['QUERY_STRING']), '&'); |
| 501 |
|
| 502 |
if( 'action=wpforo-uninstall' == trim($QUERY_STRING) ){ |
| 503 |
|
| 504 |
$tables = array( $wpdb->prefix . 'wpforo_accesses', |
| 505 |
$wpdb->prefix . 'wpforo_forums', |
| 506 |
$wpdb->prefix . 'wpforo_languages', |
| 507 |
$wpdb->prefix . 'wpforo_likes', |
| 508 |
$wpdb->prefix . 'wpforo_phrases', |
| 509 |
$wpdb->prefix . 'wpforo_profiles', |
| 510 |
$wpdb->prefix . 'wpforo_posts', |
| 511 |
$wpdb->prefix . 'wpforo_subscribes', |
| 512 |
$wpdb->prefix . 'wpforo_topics', |
| 513 |
$wpdb->prefix . 'wpforo_usergroups', |
| 514 |
$wpdb->prefix . 'wpforo_views', |
| 515 |
$wpdb->prefix . 'wpforo_votes'); |
| 516 |
|
| 517 |
foreach($tables as $table){ |
| 518 |
if( strpos( $table, '_wpforo_' ) !== FALSE){ |
| 519 |
$sql = "DROP TABLE IF EXISTS `$table`;"; |
| 520 |
$wpdb->query( $sql ); |
| 521 |
} |
| 522 |
} |
| 523 |
|
| 524 |
if( isset($wpforo->pageid) && $wpforo->pageid ){ |
| 525 |
wp_delete_post( $wpforo->pageid, true ); |
| 526 |
} |
| 527 |
|
| 528 |
$options = array( 'wpforo_version', |
| 529 |
'wpforo_url', |
| 530 |
'wpforo_general_options', |
| 531 |
'wpforo_notices', |
| 532 |
'wpforo_pageid', |
| 533 |
'wpforo_count_per_page', |
| 534 |
'wpforo_default_groupid', |
| 535 |
'wpforo_usergroup_cans', |
| 536 |
'wpforo_forum_options', |
| 537 |
'wpforo_forum_cans', |
| 538 |
'wpforo_post_options', |
| 539 |
'wpforo_member_options', |
| 540 |
'wpforo_subscribe_options', |
| 541 |
'wpforo_countries', |
| 542 |
'wpforo_theme_options', |
| 543 |
'wpforo_features', |
| 544 |
'wpforo_plugins_status',); |
| 545 |
|
| 546 |
foreach($options as $option){ |
| 547 |
if( strpos( $option, 'wpforo_' ) !== FALSE){ |
| 548 |
delete_option( $option ); |
| 549 |
} |
| 550 |
} |
| 551 |
|
| 552 |
$wpdb->query( "DELETE FROM `" . $wpdb->prefix ."usermeta` WHERE `meta_key` = '_wpf_member_obj'" ); |
| 553 |
$wpdb->query( "DELETE FROM `" . $wpdb->prefix ."options` WHERE option_name LIKE 'widget_wpforo_widget_%'" ); |
| 554 |
|
| 555 |
$menu = wp_get_nav_menu_object( 'wpforo-navigation' ); |
| 556 |
wp_delete_nav_menu( $menu->term_id ); |
| 557 |
wp_delete_post($wpforo->pageid, TRUE); |
| 558 |
|
| 559 |
deactivate_plugins( WPFORO_BASENAME ); |
| 560 |
|
| 561 |
} |
| 562 |
else{ |
| 563 |
return; |
| 564 |
} |
| 565 |
} |
| 566 |
|
| 567 |
?> |