Файл: user/cover/inc/configs.php
Строк: 65
<?php
$settings['array_admins'] = array();
$admins_string = 'admin,1,fuzuk'; // указываем пользователей, которые смогут редактировать новогодние подарки; id или логин, через запятую
foreach (explode(",", $admins_string) as $key => $value) {
$value = trim($value);
if (is_numeric($value) && mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `id` = '$value'"), 0) && !in_array($value, $settings['array_admins'])) {
$settings['array_admins'][] = $value;
} elseif (mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `nick` = '" . mysql_real_escape_string($value) . "'"), 0)) {
$temp_user = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `nick` = '" . mysql_real_escape_string($value) . "'"));
if (!in_array($temp_user['id'], $settings['array_admins'])) {
$settings['array_admins'][] = $temp_user['id'];
}
}
}
$balance_column = 'money';
$sklon_balance_array = array('рубль', 'рубля', 'рублей');
$covers_images_dir_link = '/style/covers/';
$covers_images_dir_path = H . 'style/covers/';
$cover_sizes = array(
'width' => 600,
'height' => 300
);
$preview_sizes = array(
'small' => 50,
'large' => 100
);
function show_cover_preview($cover_id, $size) {
global $covers_images_dir_link, $covers_images_dir_path;
$cover_file_name = $cover_id . '.jpg';
$cover_path = $covers_images_dir_path . $cover_file_name;
$preview_file_name = $cover_id . '_' . $size . '.jpg';
$preview_path = $covers_images_dir_path . $preview_file_name;
$preview_link = $covers_images_dir_link . $preview_file_name;
if (is_file($preview_path)) {
echo "<img src='$preview_link' width='$size' height='$size' /> ";
return;
}
if (!is_file($cover_path) || getimagesize($cover_path) == null)
return false;
$old = imageCreateFromString(file_get_contents($cover_path));
$new = imageCreateTrueColor($size, $size);
imageFill($new, 0, 0, 0xffffff);
imageCopyResampled($new, $old, 0, 0, 0, 0, $size, $size, imageSX($old), imageSY($old));
imageJpeg($new, $preview_path, 100);
@chmod($preview_path, 0777);
return show_cover_preview($cover_id, $size);
}
function crop_cover($image_path, $cover_id) {
global $covers_images_dir_path, $cover_sizes;
$cover_file_name = $cover_id . '.jpg';
$cover_path = $covers_images_dir_path . $cover_file_name;
if (!is_file($image_path) || getimagesize($image_path) == null)
return false;
$old = imageCreateFromString(file_get_contents($image_path));
$new = imageCreateTrueColor($cover_sizes['width'], $cover_sizes['height']);
imageFill($new, 0, 0, 0xffffff);
imageCopyResampled($new, $old, 0, 0, 0, 0, $cover_sizes['width'], $cover_sizes['height'], imageSX($old), imageSY($old));
imageJpeg($new, $cover_path, 100);
@chmod($cover_path, 0777);
return true;
}
?>