public static function get_available_langs()
 {
     $langs_folder = new Folder(PATH_TO_ROOT . '/install/lang');
     $langs_list = $langs_folder->get_folders();
     $available_langs = array();
     foreach ($langs_list as $lang) {
         $available_langs[] = $lang->get_name();
     }
     return $available_langs;
 }
function list_test_suite_recursive($directory, $recursive = false)
{
    $folders = array();
    $folder = new Folder($directory);
    foreach ($folder->get_folders('`^[^.].+$`') as $folder) {
        $folders[] = preg_replace('`^[\\./]*kernel`', '', $folder->get_path());
        if ($recursive) {
            $folders = array_merge($folders, list_test_suite_recursive($folder->get_path(), true));
        }
    }
    return $folders;
}
 private function get_not_installed_themes()
 {
     $themes_not_installed = array();
     $folder_containing_phpboost_themes = new Folder(PATH_TO_ROOT . '/templates/');
     foreach ($folder_containing_phpboost_themes->get_folders() as $theme) {
         $name = $theme->get_name();
         if ($name !== 'default' && !ThemesManager::get_theme_existed($name)) {
             $themes_not_installed[] = $name;
         }
     }
     sort($themes_not_installed);
     return $themes_not_installed;
 }
 private function get_not_installed_langs()
 {
     $langs_not_installed = array();
     $folder_containing_phpboost_langs = new Folder(PATH_TO_ROOT . '/lang/');
     foreach ($folder_containing_phpboost_langs->get_folders() as $lang) {
         $name = $lang->get_name();
         if (!LangsManager::get_lang_existed($name)) {
             $langs_not_installed[] = $name;
         }
     }
     sort($langs_not_installed);
     return $langs_not_installed;
 }
 private function add_language_bar()
 {
     $lang = AppContext::get_request()->get_string('lang', self::UPDATE_DEFAULT_LANGUAGE);
     $lang_dir = new Folder(PATH_TO_ROOT . '/lang');
     $langs = array();
     foreach ($lang_dir->get_folders('`^[a-z_-]+$`i') as $folder) {
         $info_lang = load_ini_file(PATH_TO_ROOT . '/lang/', $folder->get_name());
         if (!empty($info_lang['name'])) {
             $langs[] = array('LANG' => $folder->get_name(), 'LANG_NAME' => $info_lang['name'], 'SELECTED' => $folder->get_name() == $lang ? 'selected="selected"' : '');
             if ($folder->get_name() == $lang) {
                 $this->full_view->put('LANG_IDENTIFIER', $info_lang['identifier']);
             }
         }
     }
     $this->full_view->put('lang', $langs);
 }
 private function add_language_bar()
 {
     $lang = TextHelper::htmlspecialchars(AppContext::get_request()->get_string('lang', InstallController::DEFAULT_LOCALE));
     $lang = in_array($lang, InstallationServices::get_available_langs()) ? $lang : InstallController::DEFAULT_LOCALE;
     $lang_dir = new Folder(PATH_TO_ROOT . '/lang');
     $langs = array();
     foreach ($lang_dir->get_folders('`^[a-z_-]+$`i') as $folder) {
         $info_lang = load_ini_file(PATH_TO_ROOT . '/lang/', $folder->get_name());
         if (!empty($info_lang['name'])) {
             $langs[] = array('LANG' => $folder->get_name(), 'LANG_NAME' => $info_lang['name'], 'SELECTED' => $folder->get_name() == $lang ? 'selected="selected"' : '');
             if ($folder->get_name() == $lang) {
                 $this->full_view->put('LANG_IDENTIFIER', $info_lang['identifier']);
             }
         }
     }
     $this->full_view->put('lang', $langs);
 }
 private static function find_desc_ini_file($module_id)
 {
     $desc_ini_folder = PATH_TO_ROOT . '/' . $module_id . '/lang/';
     $desc_ini_file = $desc_ini_folder . AppContext::get_current_user()->get_locale() . '/desc.ini';
     if (file_exists($desc_ini_file)) {
         return $desc_ini_file;
     }
     $folder = new Folder($desc_ini_folder);
     $folders = $folder->get_folders();
     foreach ($folders as $lang_folder) {
         $desc_ini_file = $lang_folder->get_path() . '/desc.ini';
         if (file_exists($desc_ini_file)) {
             return $desc_ini_file;
         }
     }
     throw new IOException('Module "' . $module_id . '" description desc.ini not found in' . '/' . $module_id . '/lang/');
 }
     foreach ($_POST as $key => $value) {
         if ($value == $LANG['update_module']) {
             $module_name = $key;
         }
     }
     $activ_module = retrieve(POST, $module_name . 'activ', 0);
 }
 $ckeck_module = $Sql->query("SELECT COUNT(*) FROM " . DB_TABLE_MODULES . " WHERE name = '" . strprotect($module_name) . "'", __LINE__, __FILE__);
 if (!empty($ckeck_module)) {
     $info_module = load_ini_file('../' . $module_name . '/lang/', get_ulang());
     $previous_version = $Sql->query("SELECT version FROM " . DB_TABLE_MODULES . " WHERE name = '" . strprotect($module_name) . "'", __LINE__, __FILE__);
     $dir_db_module = get_ulang();
     $dir = '../' . $module_name . '/db';
     import('io/filesystem/folder');
     $folder_path = new Folder($dir . '/' . $dir_db_module);
     foreach ($folder_path->get_folders('`^[a-z0-9_ -]+$`i') as $dir) {
         $dir_db_module = $dir->get_name();
         break;
     }
     $filesupdate = array();
     $dir_db = '../' . urldecode($module_name) . '/db/' . $dir_db_module . '/';
     $folder_path = new Folder($dir_db);
     foreach ($folder_path->get_files('`.*\\.(php|sql)$`i') as $files) {
         $file = $files->get_name();
         if (strpos($file, DBTYPE) !== false) {
             $array_info = explode('_', $file);
             if (isset($array_info[1]) && version_compare($info_module['version'], $array_info[1], '>=') && version_compare($previous_version, $array_info[1], '<')) {
                 $filesupdate[$array_info[1]] = $file;
             }
         }
     }
Exemple #9
0
        import('core/cache');
        $Cache = new Cache();
        $Cache->load('config');
        $Cache->load('modules');
        $Cache->load('themes');
        $template->assign_vars(array('C_END' => true, 'CONTENTS' => sprintf($LANG['end_installation']), 'L_ADMIN_INDEX' => $LANG['admin_index'], 'L_SITE_INDEX' => $LANG['site_index'], 'U_ADMIN_INDEX' => '../admin/admin_index.php', 'U_INDEX' => '..' . $CONFIG['start_page']));
        import('core/updates');
        new Updates();
        $Sql->close();
        break;
}
$steps = array(array($LANG['introduction'], 'intro.png', 0), array($LANG['license'], 'license.png', 10), array($LANG['config_server'], 'config.png', 30), array($LANG['database_config'], 'database.png', 40), array($LANG['advanced_config'], 'advanced_config.png', 80), array($LANG['administrator_account_creation'], 'admin.png', 90), array($LANG['end'], 'end.png', 100));
$step_name = $steps[$step - 1][0];
import('io/filesystem/folder');
$lang_dir = new Folder('../lang');
foreach ($lang_dir->get_folders('`[a-z_-]`i') as $folder) {
    $info_lang = load_ini_file('../lang/', $folder->get_name());
    if (!empty($info_lang['name'])) {
        $template->assign_block_vars('lang', array('LANG' => $folder->get_name(), 'LANG_NAME' => $info_lang['name'], 'SELECTED' => $folder->get_name() == $lang ? 'selected="selected"' : ''));
        if ($folder->get_name() == $lang) {
            $template->assign_vars(array('LANG_IDENTIFIER' => $info_lang['identifier']));
        }
    }
}
$template->assign_vars(array('PATH_TO_ROOT' => TPL_PATH_TO_ROOT, 'LANG' => $lang, 'NUM_STEP' => $step, 'PROGRESS_LEVEL' => $steps[$step - 1][2], 'L_TITLE' => $LANG['page_title'] . ' - ' . $step_name, 'L_STEP' => $step_name, 'L_STEPS_LIST' => $LANG['steps_list'], 'L_LICENSE' => $LANG['license'], 'L_INSTALL_PROGRESS' => $LANG['install_progress'], 'L_APPENDICES' => $LANG['appendices'], 'L_DOCUMENTATION' => $LANG['documentation'], 'U_DOCUMENTATION' => $LANG['documentation_link'], 'L_RESTART_INSTALL' => $LANG['restart_installation'], 'L_CONFIRM_RESTART' => $LANG['confirm_restart_installation'], 'L_LANG' => $LANG['change_lang'], 'L_CHANGE' => $LANG['change'], 'L_YES' => $LANG['yes'], 'L_NO' => $LANG['no'], 'L_UNKNOWN' => $LANG['unknown'], 'L_POWERED_BY' => $LANG['powered_by'], 'PHPBOOST_VERSION' => UPDATE_VERSION, 'L_PHPBOOST_RIGHT' => $LANG['phpboost_right'], 'U_RESTART' => add_lang('install.php')));
for ($i = 1; $i <= floor($steps[$step - 1][2] * 24 / 100); $i++) {
    $template->assign_block_vars('progress_bar', array());
}
for ($i = 1; $i <= STEPS_NUMBER; $i++) {
    if ($i < $step) {
        $row_class = 'row_success';
 private function delete_old_menus()
 {
     $menus_folder = new Folder(Url::to_rel('/menus'));
     if ($menus_folder->exists()) {
         foreach ($menus_folder->get_folders() as $menu) {
             $menu_id = 0;
             try {
                 $menu_id = self::$db_querier->get_column_value(DB_TABLE_MENUS, 'id', 'WHERE title LIKE :title', array('title' => $menu->get_name() . '%'));
             } catch (RowNotFoundException $e) {
             }
             if (!empty($menu_id)) {
                 self::$db_querier->delete(DB_TABLE_MENUS, 'WHERE id = :id', array('id' => $menu_id));
                 $this->add_information_to_file('menu ' . $menu->get_name(), 'has been uninstalled because : incompatible with new version');
             }
         }
     }
 }
 function update_mini_menus_list($update_cache = true)
 {
     global $Sql;
     import('io/filesystem/folder');
     $m_menus_directory = new Folder(PATH_TO_ROOT . '/menus');
     $m_menus_list = $m_menus_directory->get_folders();
     $menus_names = array();
     $installed_menus_names = array();
     $processed_folders = array();
     foreach ($m_menus_list as $menu) {
         $menus_names[] = $menu->get_name();
     }
     $query = "SELECT title FROM " . DB_TABLE_MENUS . " WHERE\n            class='" . strtolower(MINI_MENU__CLASS) . "';";
     $result = $Sql->query_while($query . ";", __LINE__, __FILE__);
     while ($menu = $Sql->fetch_assoc($result)) {
         $menu_folder = substr($menu['title'], 0, strpos($menu['title'], '/'));
         if (!in_array($menu_folder, $processed_folders)) {
             if (!in_array($menu_folder, $menus_names)) {
                 MenuService::delete_mini_menu($menu_folder);
             } else {
                 $installed_menus_names[] = $menu['title'];
             }
             $processed_folders[] = $menu_folder;
         }
     }
     $Sql->query_close($result);
     foreach ($m_menus_list as $menu) {
         MenuService::add_mini_menu($menu, $installed_menus_names);
     }
     if ($update_cache) {
         MenuService::generate_cache();
     }
 }
 private function get_modules_not_installed()
 {
     $modules_not_installed = array();
     $modules_folder = new Folder(PATH_TO_ROOT);
     foreach ($modules_folder->get_folders() as $folder) {
         $folder_name = $folder->get_name();
         if ($folder_name != 'lang' && !ModulesManager::is_module_installed($folder_name)) {
             try {
                 $module = new Module($folder_name);
                 $module_configuration = $module->get_configuration();
                 $modules_not_installed[$folder_name] = $module;
             } catch (IOException $ex) {
                 continue;
             }
         }
     }
     sort($modules_not_installed);
     return $modules_not_installed;
 }
 private static function add_classes($directory, $pattern, $recursive = true)
 {
     $files = array();
     $folder = new Folder($directory);
     $relative_path = Path::get_path_from_root($folder->get_path());
     $files = $folder->get_files($pattern);
     foreach ($files as $file) {
         $filename = $file->get_name();
         $classname = $file->get_name_without_extension();
         self::$autoload[$classname] = $relative_path . '/' . $filename;
     }
     if ($recursive) {
         $folders = $folder->get_folders('`^[a-z]{1}.*$`i');
         foreach ($folders as $a_folder) {
             if (!in_array($a_folder->get_path_from_root(), self::$exclude_paths) && !in_array($a_folder->get_name(), self::$exclude_folders_names)) {
                 self::add_classes($a_folder->get_path(), $pattern);
             }
         }
     }
 }
 function uninstall_module($module_id, $drop_files)
 {
     global $Cache, $Sql, $CONFIG, $MODULES;
     $module_name = $Sql->query("SELECT name FROM " . DB_TABLE_MODULES . " WHERE id = '" . $module_id . "'", __LINE__, __FILE__);
     if (!empty($module_id) && !empty($module_name)) {
         $Sql->query_inject("DELETE FROM " . DB_TABLE_MODULES . " WHERE id = '" . $module_id . "'", __LINE__, __FILE__);
         $info_module = load_ini_file(PATH_TO_ROOT . '/' . $module_name . '/lang/', get_ulang());
         $Cache->delete_file($module_name);
         if (!empty($info_module['com'])) {
             $Sql->query_inject("DELETE FROM " . DB_TABLE_COM . " WHERE script = '" . addslashes($info_module['com']) . "'", __LINE__, __FILE__);
         }
         if (!empty($info_module)) {
             $Sql->query_inject("DELETE FROM " . DB_TABLE_CONFIGS . " WHERE name = '" . addslashes($module_name) . "'", __LINE__, __FILE__);
         }
         import('core/menu_service');
         MenuService::delete_mini_module($module_name);
         MenuService::delete_module_feeds_menus($module_name);
         $dir_db_module = get_ulang();
         $dir = PATH_TO_ROOT . '/' . $module_name . '/db';
         import('io/filesystem/folder');
         $folder_path = new Folder($dir . '/' . $dir_db_module);
         foreach ($folder_path->get_folders('`^[a-z0-9_ -]+$`i') as $dir) {
             $dir_db_module = $dir->get_name();
             break;
         }
         if (file_exists(PATH_TO_ROOT . '/' . $module_name . '/db/' . $dir_db_module . '/uninstall_' . $module_name . '.' . DBTYPE . '.sql')) {
             $Sql->parse(PATH_TO_ROOT . '/' . $module_name . '/db/' . $dir_db_module . '/uninstall_' . $module_name . '.' . DBTYPE . '.sql', PREFIX);
         }
         if (file_exists(PATH_TO_ROOT . '/' . $module_name . '/db/' . $dir_db_module . '/uninstall_' . $module_name . '.php')) {
             @(include_once PATH_TO_ROOT . '/' . $module_name . '/db/' . $dir_db_module . '/uninstall_' . $module_name . '.php');
         }
         $Cache->Generate_file('modules');
         $Cache->Generate_file('css');
         MenuService::generate_cache();
         import('content/syndication/feed');
         Feed::clear_cache();
         if ($CONFIG['rewrite'] == 1 && !empty($info_module['url_rewrite'])) {
             $Cache->Generate_file('htaccess');
         }
         if ($drop_files) {
             $folder = new Folder(PATH_TO_ROOT . '/' . $module_name);
             if (!$folder->delete()) {
                 return MODULE_FILES_COULD_NOT_BE_DROPPED;
             }
         }
         return MODULE_UNINSTALLED;
     } else {
         return NOT_INSTALLED_MODULE;
     }
 }
    }
    $error = !empty($error) ? '?error=' . $error : '';
    redirect(HOST . SCRIPT . $error);
} else {
    $Template->set_filenames(array('admin_themes_add' => 'admin/admin_themes_add.tpl'));
    $Template->assign_vars(array('THEME' => get_utheme(), 'LANG' => get_ulang(), 'L_THEME_ADD' => $LANG['theme_add'], 'L_UPLOAD_THEME' => $LANG['upload_theme'], 'L_EXPLAIN_ARCHIVE_UPLOAD' => $LANG['explain_archive_upload'], 'L_UPLOAD' => $LANG['upload'], 'L_THEME_MANAGEMENT' => $LANG['theme_management'], 'L_THEME' => $LANG['theme'], 'L_PREVIEW' => $LANG['preview'], 'L_NO_THEME_ON_SERV' => $LANG['no_theme_on_serv'], 'L_RANK' => $LANG['rank'], 'L_AUTHOR' => $LANG['author'], 'L_COMPAT' => $LANG['compat'], 'L_DESC' => $LANG['description'], 'L_ACTIV' => $LANG['activ'], 'L_XHTML' => $LANG['xhtml_version'], 'L_CSS' => $LANG['css_version'], 'L_MAIN_COLOR' => $LANG['main_colors'], 'L_VARIABLE_WIDTH' => $LANG['exensible'], 'L_WIDTH' => $LANG['width'], 'L_YES' => $LANG['yes'], 'L_NO' => $LANG['no'], 'L_INSTALL' => $LANG['install']));
    $get_error = retrieve(GET, 'error', '');
    $array_error = array('e_upload_invalid_format', 'e_upload_invalid_format', 'e_upload_max_weight', 'e_upload_error', 'e_upload_failed_unwritable', 'e_upload_already_exist', 'e_theme_already_exist', 'e_unlink_disabled');
    if (in_array($get_error, $array_error)) {
        $Errorh->handler($LANG[$get_error], E_USER_WARNING);
    }
    $z = 0;
    import('io/filesystem/folder');
    $tpl_array = array();
    $lang_folder_path = new Folder('../templates/');
    foreach ($lang_folder_path->get_folders('`^[a-z0-9_ -]+$`i') as $lang) {
        $tpl_array[] = $lang->get_name();
    }
    $key = array_search('default', $tpl_array);
    if (isset($key)) {
        unset($tpl_array[$key]);
    }
    $result = $Sql->query_while("SELECT theme \n\tFROM " . DB_TABLE_THEMES . "", __LINE__, __FILE__);
    while ($row = $Sql->fetch_assoc($result)) {
        $key = array_search($row['theme'], $tpl_array);
        if ($key !== false) {
            unset($tpl_array[$key]);
        }
    }
    $Sql->query_close($result);
    $array_ranks = array(-1 => $LANG['guest'], 0 => $LANG['member'], 1 => $LANG['modo'], 2 => $LANG['admin']);
Exemple #16
0
$module = retrieve(GET, 'module', '');
$Template->set_filenames(array('admin_com_management' => 'admin/admin_com_management.tpl'));
$Cache->load('com');
$array_com = array();
$result = $Sql->query_while("SELECT script, COUNT(*) as total\nFROM " . DB_TABLE_COM . " \nGROUP BY script", __LINE__, __FILE__);
while ($row = $Sql->fetch_assoc($result)) {
    $array_com[$row['script']] = $row['total'];
}
$Sql->query_close($result);
import('util/pagination');
$Pagination = new Pagination();
$nbr_com = !empty($module) ? !empty($array_com[$module]) ? $array_com[$module] : 0 : $Sql->count_table('com', __LINE__, __FILE__);
$Template->assign_vars(array('THEME' => get_utheme(), 'LANG' => get_ulang(), 'PAGINATION_COM' => $Pagination->display('admin_com.php?pc=%d', $nbr_com, 'pc', $CONFIG_COM['com_max'], 3), 'L_DISPLAY_RECENT' => $LANG['display_recent_com'], 'L_DISPLAY_TOPIC_COM' => $LANG['display_topic_com'], 'L_CONFIRM_DELETE' => $LANG['alert_delete_msg'], 'L_EDIT' => $LANG['edit'], 'L_DELETE' => $LANG['delete'], 'L_COM' => $LANG['com'], 'L_COM_MANAGEMENT' => $LANG['com_management'], 'L_COM_CONFIG' => $LANG['com_config']));
import('io/filesystem/folder');
$folder_path = new Folder('../');
foreach ($folder_path->get_folders('`^[a-z0-9_ -]+$`i') as $modules) {
    $modulef = $modules->get_name();
    if (@file_exists('../' . $modulef . '/lang/' . get_ulang() . '/config.ini')) {
        $info_module = load_ini_file('../' . $modulef . '/lang/', get_ulang());
        if (isset($info_module['info']) && !empty($info_module['com'])) {
            $Template->assign_block_vars('modules_com', array('MODULES' => $info_module['name'] . (isset($array_com[$info_module['com']]) ? ' (' . $array_com[$info_module['com']] . ')' : ' (0)'), 'U_MODULES' => $info_module['com']));
        }
    }
}
$Cache->load('ranks');
$cond = !empty($module) ? "WHERE script = '" . $module . "'" : '';
$result = $Sql->query_while("SELECT c.idprov, c.idcom, c.login, c.user_id, c.timestamp, c.script, c.path, m.login as mlogin, m.level, m.user_mail, m.user_show_mail, m.timestamp AS registered, m.user_avatar, m.user_msg, m.user_local, m.user_web, m.user_sex, m.user_msn, m.user_yahoo, m.user_sign, m.user_warning, m.user_ban, m.user_groups, s.user_id AS connect, c.contents\nFROM " . DB_TABLE_COM . " c\nLEFT JOIN " . DB_TABLE_MEMBER . " m ON m.user_id = c.user_id\nLEFT JOIN " . DB_TABLE_SESSIONS . " s ON s.user_id = c.user_id AND s.session_time > '" . (time() - $CONFIG['site_session_invit']) . "'\n" . $cond . "\nGROUP BY c.idcom\nORDER BY c.timestamp DESC\n" . $Sql->limit($Pagination->get_first_msg($CONFIG_COM['com_max'], 'pc'), $CONFIG_COM['com_max']), __LINE__, __FILE__);
while ($row = $Sql->fetch_assoc($result)) {
    $row['user_id'] = (int) $row['user_id'];
    $is_guest = $row['user_id'] === -1;
    if (!$is_guest) {
     $Errorh->handler($LANG['e_incomplete'], E_USER_NOTICE);
 }
 $i = 0;
 $installed_modules = array();
 $result = $Sql->query_while("SELECT id, name\n\tFROM " . PREFIX . "modules", __LINE__, __FILE__);
 while ($row = $Sql->fetch_assoc($result)) {
     $installed_modules[] = $row['name'];
 }
 $Sql->query_close($result);
 $root = PATH_TO_ROOT . '/';
 $i = 0;
 if (is_dir($root)) {
     import('io/filesystem/folder');
     $dir_array = array();
     $lang_folder_path = new Folder($root);
     foreach ($lang_folder_path->get_folders() as $odir) {
         $dir = $odir->get_name();
         if (!in_array($dir, $installed_modules) && $dir != 'lang') {
             $info_module = load_ini_file($root . $dir . '/lang/', get_ulang());
             if (!empty($info_module) && is_array($info_module)) {
                 $l_tables = $info_module['sql_table'] > 1 ? $LANG['tables'] : $LANG['table'];
                 $Template->assign_block_vars('available', array('ID' => $dir, 'NAME' => ucfirst($info_module['name']), 'ICON' => $dir, 'VERSION' => $info_module['version'], 'AUTHOR' => !empty($info_module['author_mail']) ? '<a href="mailto:' . $info_module['author_mail'] . '">' . $info_module['author'] . '</a>' : $info_module['author'], 'AUTHOR_WEBSITE' => !empty($info_module['author_link']) ? '<a href="' . $info_module['author_link'] . '"><img src="../templates/' . get_utheme() . '/images/' . get_ulang() . '/user_web.png" alt="" /></a>' : '', 'DESC' => $info_module['info'], 'COMPAT' => $info_module['compatibility'], 'USE_SQL' => $info_module['sql_table'] > 0 ? $LANG['yes'] : $LANG['no'], 'SQL_TABLE' => $info_module['sql_table'] > 0 ? '(' . $info_module['sql_table'] . ' ' . $l_tables . ')' : '', 'USE_CACHE' => $info_module['cache'] ? $LANG['yes'] : $LANG['no'], 'ALTERNATIVE_CSS' => $info_module['css'] ? $LANG['yes'] : $LANG['no'], 'STARTEABLE_PAGE' => $info_module['starteable_page'] ? $LANG['yes'] : $LANG['no'], 'ACTIV_ENABLED' => $row['activ'] == 1 ? 'checked="checked"' : '', 'ACTIV_DISABLED' => $row['activ'] == 0 ? 'checked="checked"' : ''));
                 $i++;
             }
         }
     }
 }
 if ($i == 0) {
     $Template->assign_vars(array('C_NO_MODULE' => true));
 } else {
     $Template->assign_vars(array('C_MODULES_AVAILABLE' => true));