Changeset 5982 for trunk/include


Ignore:
Timestamp:
Apr 28, 2010, 4:28:05 PM (14 years ago)
Author:
plg
Message:

feature 1630: upgrade to Piwigo 2.1 :-)

bug 1604: only activate core themes not all themes.

Location:
trunk/include
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/dblayer/functions_mysql.inc.php

    r5782 r5982  
    5353function pwg_db_check_charset()
    5454{
    55   defined('PWG_CHARSET') and defined('DB_CHARSET')
    56     or fatal_error('PWG_CHARSET and/or DB_CHARSET is not defined');
    57   if ( version_compare(mysql_get_server_info(), '4.1.0', '>=') )
    58   {
    59     if (DB_CHARSET!='')
    60     {
    61       pwg_query('SET NAMES "'.DB_CHARSET.'"');
    62     }
    63   }
    64   elseif ( strtolower(PWG_CHARSET)!='iso-8859-1' )
    65   {
    66     fatal_error('PWG supports only iso-8859-1 charset on MySql version '.mysql_get_server_info());
     55  $db_charset = 'utf8';
     56  if (defined('DB_CHARSET') and DB_CHARSET != '')
     57  {
     58    $db_charset = DB_CHARSET;
     59  }
     60  pwg_query('SET NAMES "'.$db_charset.'"');
     61}
     62
     63function pwg_db_check_version()
     64{
     65  $current_mysql = pwg_get_db_version();
     66  if (version_compare($current_mysql, REQUIRED_MYSQL_VERSION, '<'))
     67  {
     68    fatal_error(
     69      sprintf(
     70        'your MySQL version is too old, you have "%s" and you need at least "%s"',
     71        $current_mysql,
     72        REQUIRED_MYSQL_VERSION
     73        )
     74      );
    6775  }
    6876}
  • trunk/include/functions.inc.php

    r5781 r5982  
    695695  while ($row = pwg_db_fetch_assoc($result))
    696696  {
    697     if (file_exists($conf['themes_dir'].'/'.$row['id'].'/'.'themeconf.inc.php'))
     697    if (check_theme_installed($row['id']))
    698698    {
    699699      $themes[ $row['id'] ] = $row['name'];
     
    705705
    706706  return $themes;
     707}
     708
     709function check_theme_installed($theme_id)
     710{
     711  global $conf;
     712
     713  return file_exists($conf['themes_dir'].'/'.$theme_id.'/'.'themeconf.inc.php');
    707714}
    708715
     
    11491156function get_pwg_charset()
    11501157{
    1151   defined('PWG_CHARSET') or fatal_error('PWG_CHARSET undefined');
    1152   return PWG_CHARSET;
     1158  $pwg_charset = 'utf-8';
     1159  if (defined('PWG_CHARSET'))
     1160  {
     1161    $pwg_charset = PWG_CHARSET;
     1162  }
     1163  return $pwg_charset;
    11531164}
    11541165
  • trunk/include/functions_user.inc.php

    r5272 r5982  
    849849function get_default_theme()
    850850{
    851   return get_default_user_value('theme', PHPWG_DEFAULT_TEMPLATE);
     851  $theme = get_default_user_value('theme', PHPWG_DEFAULT_TEMPLATE);
     852  if (check_theme_installed($theme))
     853  {
     854    return $theme;
     855  }
     856 
     857  // let's find the first available theme
     858  $active_themes = get_pwg_themes();
     859  foreach (array_keys(get_pwg_themes()) as $theme_id)
     860  {
     861    if (check_theme_installed($theme_id))
     862    {
     863      return $theme_id;
     864    }
     865  }
    852866}
    853867
Note: See TracChangeset for help on using the changeset viewer.