Jump to content

[F.A.Q.] Как изменить время в vii engine


timbios
 Share

Recommended Posts

Привет всем!Сегодня у меня в сообществе в вконтакте спросили про часовые пояса(как изменить время в vii engine?).

 

 

 

Открываем system/init.php и примерно после этих строк:

//FUNC. COOKIES
 
function clean_url($url) {
if( $url == '' ) return;
 
$url = str_replace( "http://", "", strtolower( $url ) );
$url = str_replace( "https://", "", $url );
if( substr( $url, 0, 4 ) == 'www.' ) $url = substr( $url, 4 );
$url = explode( '/', $url );
$url = reset( $url );
$url = explode( ':', $url );
$url = reset( $url );
 
return $url;
}
$domain_cookie = explode (".", clean_url( $_SERVER['HTTP_HOST'] ));
$domain_cookie_count = count($domain_cookie);
$domain_allow_count = -2;
if($domain_cookie_count > 2){
if(in_array($domain_cookie[$domain_cookie_count-2], array('com', 'net', 'org') ))
$domain_allow_count = -3;
 
if($domain_cookie[$domain_cookie_count-1] == 'ua' )
$domain_allow_count = -3;
 
$domain_cookie = array_slice($domain_cookie, $domain_allow_count);
}
$domain_cookie = ".".implode(".", $domain_cookie);
define('DOMAIN', $domain_cookie);
function set_cookie($name, $value, $expires) {
 
if( $expires ) {
 
$expires = time() + ($expires * 86400);
 
} else {
 
$expires = FALSE;
 
}
 
if( PHP_VERSION < 5.2 ) {
 
setcookie($name, $value, $expires, "/", DOMAIN . "; HttpOnly");
 
} else {
 
setcookie($name, $value, $expires, "/", DOMAIN, NULL, TRUE);
 
}
}

Добавляем:

date_default_timezone_set( 'Europe/Kiev' );

Вместо Europe/Kiev пишем свой часовой пояс.

 

 

 

Карта часовых поясов

 

 

Если что, вот список:

 

  • gmt-11 = "Samoa"-(Pacific/Samoa)
  • gmt-10 = "Hawaii"-(US/Hawaii)
  • gmt-9 = "Alaska"-(US/Alaska)
  • gmt-8 = "Los Angeles"-(America/Los_Angeles)
  • gmt-7 = "Denver"-(America/Denver)
  • gmt-6 = "Chicago"-(America/Chicago)
  • gmt-5 = "New York"-(America/New_York)
  • gmt-4 = "Caracas"-(America/Caracas)
  • gmt-3 = "Buenos Aires"-(America/Buenos_Aires)
  • gmt-2 = "Sao Paulo"-(America/Sao_Paulo)
  • gmt-1 = "Azores"-(Atlantic/Azores)
  • gmt0 = "London"-(Europe/London)
  • gmt1 = "Berlin,Paris"-(Europe/Berlin)
  • gmt2 = "Kyiv, Minsk"-(Europe/Kiev)
  • gmt3 = "Moscow, Saint-Peterburg"-(Europe/Moscow)
  • gmt4 = "Yerevan"-(Asia/Yerevan)
  • gmt5 = "Yekaterinburg, Tashkent"-(Asia/Yekaterinburg)
  • gmt6 = "Novosibirsk"-(Asia/Novosibirsk)
  • gmt7 = "Krasnoyarsk, Bangkok"-(Asia/Krasnoyarsk)
  • gmt8 = "Singapore, Hong Kong"-(Asia/Singapore)
  • gmt9 = "Tokyo"-(Asia/Tokyo)
  • gmt10 = "Vladivostok"-(Asia/Vladivostok)
  • gmt11 = "Sydney"-(Australia/Sydney)
  • gmt12 = "Kamchatka"-(Asia/Kamchatka)
Edited by Shaman
  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...