/** * Import bbcode * * @access public * @return void **/ public function bbcode() { /* INIT */ $vars = $this->getVars(); $output = array(); $errors = array(); if (file_exists($this->app_full_path . 'xml/' . $vars['app_directory'] . '_bbcode.xml')) { /* Get the language class */ require_once IPS_ROOT_PATH . 'applications/core/modules_admin/posts/bbcode.php'; $bbcode = new admin_core_posts_bbcode(); $bbcode->makeRegistryShortcuts($this->registry); $bbcode->bbcodeImportDo(file_get_contents($this->app_full_path . 'xml/' . $vars['app_directory'] . '_bbcode.xml')); $output[] = $this->lang->words['bbcode_and_media']; } if (file_exists($this->app_full_path . 'xml/' . $vars['app_directory'] . '_mediatag.xml')) { /* Get the language class */ require_once IPS_ROOT_PATH . 'applications/core/modules_admin/posts/media.php'; $bbcode = new admin_core_posts_media(); $bbcode->makeRegistryShortcuts($this->registry); $bbcode->doMediaImport(file_get_contents($this->app_full_path . 'xml/' . $vars['app_directory'] . '_mediatag.xml')); if (!count($output)) { $output[] = $this->lang->words['bbcode_and_media']; } } if (!count($output)) { $output[] = $this->lang->words['no_bbcode_media']; } /* Show redirect... */ $this->showRedirectScreen($vars['app_directory'], $output, $errors, $this->getNextURL('help', $vars)); }
/** * Install BBCode * * @return void */ public function install_bbcode() { //----------------------------------------- // INIT //----------------------------------------- $previous = $_REQUEST['previous']; //----------------------------------------- // Fetch next 'un //----------------------------------------- $next = IPSSetUp::fetchNextApplication($previous, '{app}_bbcode.xml', $this->settings['gb_char_set']); //----------------------------------------- // Install Languages //----------------------------------------- if ($next['key']) { $output[] = $next['title'] . ": Обновление BB-кодов"; $_PATH = IPSLib::getAppDir($next['key']) . '/xml/'; if (is_file($_PATH . $next['key'] . '_bbcode.xml')) { //----------------------------------------- // Continue //----------------------------------------- require_once IPS_ROOT_PATH . 'applications/core/modules_admin/posts/bbcode.php'; /*noLibHook*/ $bbcode = new admin_core_posts_bbcode(); $bbcode->makeRegistryShortcuts($this->registry); $_contents = file_get_contents($_PATH . $next['key'] . '_bbcode.xml'); if ($_contents) { $bbcode->bbcodeImportDo($_contents); } } $output[] = $next['title'] . ": Обновление медиа тегов"; $_PATH = IPSLib::getAppDir($next['key']) . '/xml/'; if (is_file($_PATH . $next['key'] . '_mediatag.xml')) { //----------------------------------------- // Continue //----------------------------------------- require_once IPS_ROOT_PATH . 'applications/core/modules_admin/posts/media.php'; /*noLibHook*/ $bbcode = new admin_core_posts_media(); $bbcode->makeRegistryShortcuts($this->registry); $bbcode->doMediaImport(file_get_contents($_PATH . $next['key'] . '_mediatag.xml')); } //----------------------------------------- // Done.. so get some more! //----------------------------------------- $this->_finishStep($output, "Обновление: BB-коды", 'upgrade&do=bbcode&previous=' . $next['key']); } else { //----------------------------------------- // Next... //----------------------------------------- $output[] = "Все BB-коды обновлены"; $this->_finishStep($output, "Обновление: BB-коды", 'upgrade&do=acphelp'); } }
/** * Sort out bbcode and permissions * * @access public * @param int */ public function permsAndBbcode() { /* INIT */ $options = IPSSetUp::getSavedData('custom_options'); $rootAdmins = $options['core'][30001]['rootAdmins']; /* First off, import default BBCode */ $apps = array(); $bbcodeOld = array(); $bbcodeNew = array(); /* Load apps */ $this->DB->build(array('select' => '*', 'from' => 'core_applications')); $this->DB->execute(); while ($row = $this->DB->fetch()) { $apps[$row['app_directory']] = $row; } /* Load old codes */ $this->DB->build(array('select' => '*', 'from' => 'custom_bbcode_old')); $this->DB->execute(); while ($row = $this->DB->fetch()) { $bbcodeOld[$row['bbcode_tag']] = $row; } /* Add 'em */ foreach ($apps as $dir => $data) { if (file_exists(IPSLib::getAppDir($dir) . '/xml/' . $dir . '_bbcode.xml')) { //----------------------------------------- // Continue //----------------------------------------- require_once IPS_ROOT_PATH . 'applications/core/modules_admin/posts/bbcode.php'; $bbcode = new admin_core_posts_bbcode(); $bbcode->makeRegistryShortcuts($this->registry); $bbcode->bbcodeImportDo(file_get_contents(IPSLib::getAppDir($dir) . '/xml/' . $dir . '_bbcode.xml')); } if (file_exists(IPSLib::getAppDir($dir) . '/xml/' . $dir . '_mediatag.xml')) { //----------------------------------------- // Continue //----------------------------------------- require_once IPS_ROOT_PATH . 'applications/core/modules_admin/posts/media.php'; $bbcode = new admin_core_posts_media(); $bbcode->makeRegistryShortcuts($this->registry); $bbcode->doMediaImport(file_get_contents(IPSLib::getAppDir($dir) . '/xml/' . $dir . '_mediatag.xml')); } } /* Load current code */ $this->DB->build(array('select' => '*', 'from' => 'custom_bbcode')); $this->DB->execute(); while ($row = $this->DB->fetch()) { $bbcodeCurrent[$row['bbcode_tag']] = $row; //----------------------------------------- // Need to take into account aliases too! //----------------------------------------- if ($row['bbcode_aliases']) { $aliases = explode(',', $row['bbcode_aliases']); if (count($aliases)) { foreach ($aliases as $alias) { $bbcodeCurrent[$alias] = $row; } } } } if (count($bbcodeOld)) { foreach ($bbcodeOld as $tag => $row) { if (!$bbcodeCurrent[$row['bbcode_tag']]) { $bbcodeNew[$row['bbcode_tag']] = $row; } } } $this->registry->output->addMessage("BBCode tags upgraded...."); /* Now see if there's anything we need to move back over */ if (count($bbcodeNew)) { foreach ($bbcodeNew as $tag => $data) { $bbarray = array('bbcode_title' => $data['bbcode_title'], 'bbcode_desc' => $data['bbcode_desc'], 'bbcode_tag' => $data['bbcode_tag'], 'bbcode_replace' => IPSText::safeslashes($data['bbcode_replace']), 'bbcode_useoption' => $data['bbcode_useoption'], 'bbcode_example' => $data['bbcode_example'], 'bbcode_switch_option' => $data['bbcode_switch_option'], 'bbcode_menu_option_text' => $data['bbcode_menu_option_text'], 'bbcode_menu_content_text' => $data['bbcode_menu_content_text'], 'bbcode_groups' => 'all', 'bbcode_sections' => 'all', 'bbcode_php_plugin' => '', 'bbcode_parse' => 2, 'bbcode_no_parsing' => 0, 'bbcode_optional_option' => 0, 'bbcode_aliases' => '', 'bbcode_image' => ''); $this->DB->insert('custom_bbcode', $bbarray); } } /* OK, now onto permissions... */ /* Insert basic perms for profiles and help */ $this->DB->insert('permission_index', array('app' => 'members', 'perm_type' => 'profile_view', 'perm_type_id' => 1, 'perm_view' => '*', 'perm_2' => '', 'perm_3' => '', 'perm_4' => '', 'perm_5' => '', 'perm_6' => '', 'perm_7' => '')); $this->DB->insert('permission_index', array('app' => 'core', 'perm_type' => 'help', 'perm_type_id' => 1, 'perm_view' => '*', 'perm_2' => '', 'perm_3' => '', 'perm_4' => '', 'perm_5' => '', 'perm_6' => '', 'perm_7' => '')); /* And now calendars */ $this->DB->build(array('select' => '*', 'from' => 'cal_calendars')); $o = $this->DB->execute(); while ($row = $this->DB->fetch($o)) { if (strstr($row['cal_permissions'], 'a:')) { $_perms = unserialize(stripslashes($row['cal_permissions'])); if (is_array($_perms)) { $_view = $_perms['perm_read'] ? ',' . implode(',', explode(',', $_perms['perm_read'])) . ',' : ''; $_start = $_perms['perm_post'] ? ',' . implode(',', explode(',', $_perms['perm_post'])) . ',' : ''; $_nomod = $_perms['perm_nomod'] ? ',' . implode(',', explode(',', $_perms['perm_nomod'])) . ',' : ''; $this->DB->insert('permission_index', array('app' => 'calendar', 'perm_type' => 'calendar', 'perm_type_id' => $row['cal_id'], 'perm_view' => str_replace(',*,', '*', $_view), 'perm_2' => str_replace(',*,', '*', $_start), 'perm_3' => str_replace(',*,', '*', $_nomod), 'perm_4' => '', 'perm_5' => '', 'perm_6' => '', 'perm_7' => '')); } else { $this->DB->insert('permission_index', array('app' => 'calendar', 'perm_type' => 'calendar', 'perm_type_id' => $row['cal_id'], 'perm_view' => '', 'perm_2' => '', 'perm_3' => '', 'perm_4' => '', 'perm_5' => '', 'perm_6' => '', 'perm_7' => '')); } } else { $this->DB->insert('permission_index', array('app' => 'calendar', 'perm_type' => 'calendar', 'perm_type_id' => $row['cal_id'], 'perm_view' => '', 'perm_2' => '', 'perm_3' => '', 'perm_4' => '', 'perm_5' => '', 'perm_6' => '', 'perm_7' => '')); } } /* And now forums */ $this->DB->build(array('select' => '*', 'from' => 'forums')); $o = $this->DB->execute(); while ($row = $this->DB->fetch($o)) { /* Do we need to tidy up the title? */ if (strstr($row['name'], '&')) { $row['name'] = preg_replace("#& #", "& ", $row['name']); $this->DB->update('forums', array('name' => $row['name']), 'id=' . $row['id']); } if (strstr($row['permission_array'], 'a:')) { $_perms = unserialize(stripslashes($row['permission_array'])); if (is_array($_perms)) { $_view = $_perms['show_perms'] ? ',' . implode(',', explode(',', $_perms['show_perms'])) . ',' : ''; $_read = $_perms['read_perms'] ? ',' . implode(',', explode(',', $_perms['read_perms'])) . ',' : ''; $_reply = $_perms['reply_perms'] ? ',' . implode(',', explode(',', $_perms['reply_perms'])) . ',' : ''; $_start = $_perms['start_perms'] ? ',' . implode(',', explode(',', $_perms['start_perms'])) . ',' : ''; $_upload = $_perms['upload_perms'] ? ',' . implode(',', explode(',', $_perms['upload_perms'])) . ',' : ''; $_download = $_perms['download_perms'] ? ',' . implode(',', explode(',', $_perms['download_perms'])) . ',' : ''; $this->DB->insert('permission_index', array('app' => 'forums', 'perm_type' => 'forum', 'perm_type_id' => $row['id'], 'perm_view' => str_replace(',*,', '*', $_view), 'perm_2' => str_replace(',*,', '*', $_read), 'perm_3' => str_replace(',*,', '*', $_reply), 'perm_4' => str_replace(',*,', '*', $_start), 'perm_5' => str_replace(',*,', '*', $_upload), 'perm_6' => str_replace(',*,', '*', $_download), 'perm_7' => '')); } else { $this->DB->insert('permission_index', array('app' => 'forums', 'perm_type' => 'forum', 'perm_type_id' => $row['id'], 'perm_view' => '', 'perm_2' => '', 'perm_3' => '', 'perm_4' => '', 'perm_5' => '', 'perm_6' => '', 'perm_7' => '')); IPSSetUp::addLogMessage("Skipped perms (no array) for forum id: " . $row['id'], '30001', 'core'); } } else { $this->DB->insert('permission_index', array('app' => 'forums', 'perm_type' => 'forum', 'perm_type_id' => $row['id'], 'perm_view' => '', 'perm_2' => '', 'perm_3' => '', 'perm_4' => '', 'perm_5' => '', 'perm_6' => '', 'perm_7' => '')); IPSSetUp::addLogMessage("Skipped perms (no array) for forum id: " . $row['id'], '30001', 'core'); } } $this->registry->output->addMessage("Permission indexes built...."); /* Fix up forum moderators */ $this->DB->build(array('select' => '*', 'from' => 'moderators')); $o = $this->DB->execute(); while ($r = $this->DB->fetch($o)) { $this->DB->update('moderators', array('forum_id' => ',' . IPSText::cleanPermString($r['forum_id']) . ','), 'mid=' . $r['mid']); } $this->registry->output->addMessage("Forum moderators updated...."); /* Root admin reset? */ if ($rootAdmins) { /* Find all admin groups */ $this->DB->build(array('select' => '*', 'from' => 'groups', 'where' => 'g_id != ' . $this->settings['admin_group'] . ' AND g_access_cp=1')); $o = $this->DB->execute(); while ($row = $this->DB->fetch($o)) { /* Insert blank perm row */ $this->DB->insert('admin_permission_rows', array('row_id' => $row['g_id'], 'row_id_type' => 'group', 'row_perm_cache' => serialize(array()), 'row_updated' => time())); } $this->registry->output->addMessage("Non Root Admin groups restricted...."); } /* Report center reset */ $canReport = array(); $canView = array(); $this->DB->build(array('select' => 'g_id, g_view_board, g_access_cp, g_is_supmod', 'from' => 'groups')); $o = $this->DB->execute(); while ($r = $this->DB->fetch($o)) { if ($r['g_access_cp'] or $r['g_is_supmod']) { $canView[] = $r['g_id']; } if ($r['g_view_board'] and $r['g_id'] != $this->settings['guest_group']) { $canReport[] = $r['g_id']; } } $this->DB->update('rc_classes', array('group_can_report' => ',' . implode(',', $canReport) . ',', 'mod_group_perm' => ',' . implode(',', $canView) . ',')); /* Next Page */ $this->request['workact'] = 'skinlang'; }
/** * Install BBCode * * @return void */ public function install_bbcode() { //----------------------------------------- // INIT //----------------------------------------- $previous = $_REQUEST['previous']; //----------------------------------------- // Fetch next 'un //----------------------------------------- $next = IPSSetUp::fetchNextApplication($previous, '{app}_bbcode.xml', $this->settings['gb_char_set']); /* Set up DB driver */ $extra_install = $this->_setUpDBDriver(FALSE); //----------------------------------------- // Install Languages //----------------------------------------- if ($next['key']) { $output[] = $next['title'] . ": Добавление BB-кодов"; $_PATH = IPSLib::getAppDir($next['key']) . '/xml/'; if (is_file($_PATH . $next['key'] . '_bbcode.xml')) { //----------------------------------------- // Adjust the table? //----------------------------------------- if ($extra_install and method_exists($extra_install, 'before_inserts_run')) { $q = $extra_install->before_inserts_run('bbcode'); } //----------------------------------------- // Continue //----------------------------------------- require_once IPS_ROOT_PATH . 'applications/core/modules_admin/posts/bbcode.php'; /*noLibHook*/ $bbcode = new admin_core_posts_bbcode(); $bbcode->makeRegistryShortcuts($this->registry); $_contents = file_get_contents($_PATH . $next['key'] . '_bbcode.xml'); if ($_contents) { $bbcode->bbcodeImportDo($_contents); } //----------------------------------------- // Adjust the table? //----------------------------------------- if ($extra_install and method_exists($extra_install, 'after_inserts_run')) { $q = $extra_install->after_inserts_run('bbcode'); } } $output[] = $next['title'] . ": Добавление медиа тегов"; $_PATH = IPSLib::getAppDir($next['key']) . '/xml/'; if (is_file($_PATH . $next['key'] . '_mediatag.xml')) { //----------------------------------------- // Adjust the table? //----------------------------------------- if ($extra_install and method_exists($extra_install, 'before_inserts_run')) { $q = $extra_install->before_inserts_run('media'); } //----------------------------------------- // Continue //----------------------------------------- require_once IPS_ROOT_PATH . 'applications/core/modules_admin/posts/media.php'; /*noLibHook*/ $bbcode = new admin_core_posts_media(); $bbcode->makeRegistryShortcuts($this->registry); $bbcode->doMediaImport(file_get_contents($_PATH . $next['key'] . '_mediatag.xml')); //----------------------------------------- // Adjust the table? //----------------------------------------- if ($extra_install and method_exists($extra_install, 'after_inserts_run')) { $q = $extra_install->after_inserts_run('media'); } } //----------------------------------------- // Done.. so get some more! //----------------------------------------- $this->_finishStep($output, "Установка: BB-коды", 'install&do=bbcode&previous=' . $next['key']); } else { //----------------------------------------- // Next... //----------------------------------------- $output[] = "Все BB-коды установлены"; $this->_finishStep($output, "Установка: BB-коды", 'install&do=acphelp'); } }
/** * Install BBCode * * @return void */ public function install_bbcode() { //----------------------------------------- // INIT //----------------------------------------- $previous = $_REQUEST['previous']; //----------------------------------------- // Fetch next 'un //----------------------------------------- $next = IPSSetUp::fetchNextApplication($previous, '{app}_bbcode.xml'); //----------------------------------------- // Install Languages //----------------------------------------- if ($next['key']) { $output[] = $next['title'] . ": Upgrading BBcode..."; $_PATH = IPSLib::getAppDir($next['key']) . '/xml/'; if (file_exists($_PATH . $next['key'] . '_bbcode.xml')) { //----------------------------------------- // Continue //----------------------------------------- require_once IPS_ROOT_PATH . 'applications/core/modules_admin/posts/bbcode.php'; $bbcode = new admin_core_posts_bbcode(); $bbcode->makeRegistryShortcuts($this->registry); $bbcode->bbcodeImportDo(file_get_contents($_PATH . $next['key'] . '_bbcode.xml')); } $output[] = $next['title'] . ": Upgrading Media Tags..."; $_PATH = IPSLib::getAppDir($next['key']) . '/xml/'; if (file_exists($_PATH . $next['key'] . '_mediatag.xml')) { //----------------------------------------- // Continue //----------------------------------------- require_once IPS_ROOT_PATH . 'applications/core/modules_admin/posts/media.php'; $bbcode = new admin_core_posts_media(); $bbcode->makeRegistryShortcuts($this->registry); $bbcode->doMediaImport(file_get_contents($_PATH . $next['key'] . '_mediatag.xml')); } //----------------------------------------- // Done.. so get some more! //----------------------------------------- $this->_finishStep($output, "Upgrade: BBCode", 'upgrade&do=bbcode&previous=' . $next['key']); } else { //----------------------------------------- // Next... //----------------------------------------- $output[] = "All BBCode upgraded"; $this->_finishStep($output, "Upgrade: BBCode", 'upgrade&do=acphelp'); } }