if ($build < $section) { if (!spdb_column_exists(SFAUTHS, 'admin_negate')) { spdb_query('ALTER TABLE ' . SFAUTHS . " ADD (admin_negate smallint(1) NOT NULL default '0')"); } sp_response($section); } $section = 8700; if ($build < $section) { # Add source column to posts spdb_query('ALTER TABLE ' . SFPOSTS . " ADD (source smallint(1) NOT NULL default '0')"); sp_response($section); } $section = 8712; if ($build < $section) { # create auth cat column for auths if (!spdb_column_exists(SFAUTHS, 'auth_cat')) { spdb_query('ALTER TABLE ' . SFAUTHS . " ADD (auth_cat bigint(20) NOT NULL default '1')"); } # create new auth categories table $sql = ' CREATE TABLE IF NOT EXISTS ' . SFAUTHCATS . ' ( authcat_id tinyint(4) NOT NULL auto_increment, authcat_name varchar(50) NOT NULL, authcat_slug varchar(50) NOT NULL, authcat_desc tinytext, PRIMARY KEY (authcat_id), KEY authcat_slug_idx (authcat_slug) ) ' . spdb_charset(); spdb_query($sql); # lets rename bypass_spam_control auth to bypass_math_question spdb_query('UPDATE ' . SFAUTHS . " SET auth_name='bypass_math_question' WHERE auth_name='bypass_spam_control'");
function sp_convert_perms_to_auths() { if (!spdb_column_exists(SFMEMBERS, 'auths')) { spdb_query('ALTER TABLE ' . SFMEMBERS . ' ADD (auths longtext)'); } spdb_query('ALTER TABLE ' . SFROLES . ' CHANGE role_actions role_auths longtext'); # populate with existing permissions spa_setup_auths(); # now we need to convert existing roles $roles = spdb_table(SFROLES); if ($roles) { foreach ($roles as $role) { $actions = unserialize($role->role_auths); if ($actions) { $new_actions = spa_convert_action_to_auth($actions); spdb_query('UPDATE ' . SFROLES . " SET role_auths='" . serialize($new_actions) . "' WHERE role_id={$role->role_id}"); } } } }
function sp_convert_perms_to_auths() { if (!spdb_column_exists(SFMEMBERS, 'auths')) { spdb_query('ALTER TABLE ' . SFMEMBERS . ' ADD (auths longtext)'); } spdb_query('ALTER TABLE ' . SFROLES . ' CHANGE role_actions role_auths longtext'); # populate with existing permissions sp_add_auth('view_forum', esc_sql(spa_text_noesc('Can view a forum')), 1, 0, 0); sp_add_auth('view_forum_lists', esc_sql(spa_text_noesc('Can view a list of forums only')), 1, 0, 0); sp_add_auth('view_forum_topic_lists', esc_sql(spa_text_noesc('Can view a list of forums and list of topics only')), 1, 0, 0); sp_add_auth('view_admin_posts', esc_sql(spa_text_noesc('Can view posts by an administrator')), 1, 0, 0); sp_add_auth('start_topics', esc_sql(spa_text_noesc('Can start new topics in a forum')), 1, 0, 0); sp_add_auth('reply_topics', esc_sql(spa_text_noesc('Can reply to existing topics in a forum')), 1, 0, 0); sp_add_auth('edit_own_topic_titles', esc_sql(spa_text_noesc('Can edit own topic titles')), 1, 0, 0); sp_add_auth('edit_any_topic_titles', esc_sql(spa_text_noesc('Can edit any topic title')), 1, 0, 0); sp_add_auth('pin_topics', esc_sql(spa_text_noesc('Can pin topics in a forum')), 1, 0, 0); sp_add_auth('move_topics', esc_sql(spa_text_noesc('Can move topics from a forum')), 1, 0, 0); sp_add_auth('move_posts', esc_sql(spa_text_noesc('Can move posts from a topic')), 1, 0, 0); sp_add_auth('lock_topics', esc_sql(spa_text_noesc('Can lock topics in a forum')), 1, 0, 0); sp_add_auth('delete_topics', esc_sql(spa_text_noesc('Can delete topics in forum')), 1, 0, 0); sp_add_auth('edit_own_posts_forever', esc_sql(spa_text_noesc('Can edit own posts forever')), 1, 0, 0); sp_add_auth('edit_own_posts_reply', esc_sql(spa_text_noesc('Can edit own posts until there has been a reply')), 1, 0, 0); sp_add_auth('edit_any_post', esc_sql(spa_text_noesc('Can edit any post')), 1, 0, 0); sp_add_auth('delete_own_posts', esc_sql(spa_text_noesc('Can delete own posts')), 1, 0, 0); sp_add_auth('delete_any_post', esc_sql(spa_text_noesc('Can delete any post')), 1, 0, 0); sp_add_auth('pin_posts', esc_sql(spa_text_noesc('Can pin posts within a topic')), 1, 0, 0); sp_add_auth('reassign_posts', esc_sql(spa_text_noesc('Can reassign posts to a different user')), 1, 0, 0); sp_add_auth('view_email', esc_sql(spa_text_noesc('Can view email and IP addresses of members')), 1, 0, 0); sp_add_auth('view_profiles', esc_sql(spa_text_noesc('Can view profiles of members')), 1, 0, 0); sp_add_auth('view_members_list', esc_sql(spa_text_noesc('Can view the members lists')), 1, 0, 0); sp_add_auth('report_posts', esc_sql(spa_text_noesc('Can report a post to administrators')), 1, 0, 0); sp_add_auth('bypass_math_question', esc_sql(spa_text_noesc('Can bypass the math question')), 1, 0, 0); sp_add_auth('bypass_moderation', esc_sql(spa_text_noesc('Can bypass all post moderation')), 1, 0, 0); sp_add_auth('bypass_moderation_once', esc_sql(spa_text_noesc('Can bypass first post moderation')), 1, 0, 0); sp_add_auth('moderate_posts', esc_sql(spa_text_noesc('Can moderate pending posts')), 1, 0, 0); sp_add_auth('use_spoilers', esc_sql(spa_text_noesc('Can use spoilers in posts')), 1, 0, 0); sp_add_auth('view_links', esc_sql(spa_text_noesc('Can view links within posts')), 1, 0, 0); sp_add_auth('upload_images', esc_sql(spa_text_noesc('Can upload images in posts')), 1, 1, 0); sp_add_auth('upload_media', esc_sql(spa_text_noesc('Can upload media in posts')), 1, 1, 0); sp_add_auth('upload_files', esc_sql(spa_text_noesc('Can upload other files in posts')), 1, 1, 0); sp_add_auth('use_signatures', esc_sql(spa_text_noesc('Can attach a signature to posts')), 1, 1, 0); sp_add_auth('upload_signatures', esc_sql(spa_text_noesc('Can upload signature images')), 1, 1, 0); sp_add_auth('upload_avatars', esc_sql(spa_text_noesc('Can upload avatars')), 1, 1, 1); sp_add_auth('subscribe', esc_sql(spa_text_noesc('Can subscribe to topics within a forum')), 0, 1, 0); sp_add_auth('watch', esc_sql(spa_text_noesc('Can watch topics within a forum')), 0, 1, 0); sp_add_auth('change_topic_status', esc_sql(spa_text_noesc('Can change the status of a topic')), 1, 1, 0); sp_add_auth('rate_posts', esc_sql(spa_text_noesc('Can rate a post')), 0, 1, 0); sp_add_auth('use_pm', esc_sql(spa_text_noesc('Can use the private messaging system')), 0, 1, 1); # now we need to convert existing roles $roles = spdb_table(SFROLES); if ($roles) { foreach ($roles as $role) { $actions = unserialize($role->role_auths); if ($actions) { $new_actions = spa_convert_action_to_auth($actions); spdb_query('UPDATE ' . SFROLES . " SET role_auths='" . serialize($new_actions) . "' WHERE role_id={$role->role_id}"); } } } }