Exemple #1
0
        @fclose($fp);
        // tables creation, based on piwigo_structure.sql
        execute_sqlfile(PHPWG_ROOT_PATH . 'install/piwigo_structure-mysql.sql', DEFAULT_PREFIX_TABLE, $prefixeTable, 'mysql');
        // We fill the tables with basic informations
        execute_sqlfile(PHPWG_ROOT_PATH . 'install/config.sql', DEFAULT_PREFIX_TABLE, $prefixeTable, 'mysql');
        $query = '
INSERT INTO ' . $prefixeTable . 'config (param,value,comment) 
   VALUES (\'secret_key\',md5(' . pwg_db_cast_to_text(DB_RANDOM_FUNCTION . '()') . '),
   \'a secret key specific to the gallery for internal use\');';
        pwg_query($query);
        conf_update_param('piwigo_db_version', get_branch_from_version(PHPWG_VERSION));
        conf_update_param('gallery_title', l10n('Just another Piwigo gallery'));
        conf_update_param('page_banner', '<h1>%gallery_title%</h1>' . "\n\n<p>" . l10n('Welcome to my photo gallery') . '</p>');
        // fill languages table
        foreach ($languages->fs_languages as $language_code => $fs_language) {
            $languages->perform_action('activate', $language_code);
        }
        // fill $conf global array
        load_conf_from_db();
        // PWG_CHARSET is required for building the fs_themes array in the
        // themes class
        if (!defined('PWG_CHARSET')) {
            define('PWG_CHARSET', 'utf-8');
        }
        activate_core_themes();
        activate_core_plugins();
        $insert = array('id' => 1, 'galleries_url' => PHPWG_ROOT_PATH . 'galleries/');
        mass_inserts(SITES_TABLE, array_keys($insert), array($insert));
        // webmaster admin user
        $inserts = array(array('id' => 1, 'username' => $admin_name, 'password' => md5($admin_pass1), 'mail_address' => $admin_mail), array('id' => 2, 'username' => 'guest'));
        mass_inserts(USERS_TABLE, array_keys($inserts[0]), $inserts);
// | You should have received a copy of the GNU General Public License     |
// | along with this program; if not, write to the Free Software           |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA.                                                                  |
// +-----------------------------------------------------------------------+
if (!defined("PHPWG_ROOT_PATH")) {
    die("Hacking attempt!");
}
include_once PHPWG_ROOT_PATH . 'admin/include/languages.class.php';
$template->set_filenames(array('languages' => 'languages_installed.tpl'));
$base_url = get_root_url() . 'admin.php?page=' . $page['page'];
$languages = new languages();
$languages->get_db_languages();
//--------------------------------------------------perform requested actions
if (isset($_GET['action']) and isset($_GET['language'])) {
    $page['errors'] = $languages->perform_action($_GET['action'], $_GET['language']);
    if (empty($page['errors'])) {
        redirect($base_url);
    }
}
// +-----------------------------------------------------------------------+
// |                     start template output                             |
// +-----------------------------------------------------------------------+
$default_language = get_default_language();
$tpl_languages = array();
foreach ($languages->fs_languages as $language_id => $language) {
    $language['u_action'] = add_url_params($base_url, array('language' => $language_id));
    if (in_array($language_id, array_keys($languages->db_languages))) {
        $language['state'] = 'active';
        $language['deactivable'] = true;
        if (count($languages->db_languages) <= 1) {