Skip to content

Commit

Permalink
Merge branch 'master' into interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Gorlum committed May 4, 2010
2 parents 0ee5ca1 + 33e44b8 commit c279132
Show file tree
Hide file tree
Showing 21 changed files with 407 additions and 218 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
@@ -0,0 +1,3 @@
*.jpg binary
*.gif binary
*.ttf binary
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -3,4 +3,5 @@
# Ignore all dotfiles...
.*
# except for .gitignore
!.gitignore
!.gitignore
!.gitattributes
7 changes: 6 additions & 1 deletion admin/statbuilder.php
Expand Up @@ -267,6 +267,9 @@
doquery ( $QryInsertStats , 'statpoints');
}

$userCount = doquery ( "SELECT COUNT(*) FROM {{table}}", 'users', true);
doquery( "UPDATE {{table}} SET `config_value`='". $userCount[0] ."' WHERE `config_name` = 'users_amount';", 'config' );

/*
$Dele_Teme = $StatDate-604800;
$Del_Timeas = $StatDate;
Expand Down Expand Up @@ -330,7 +333,9 @@
doquery ( "DELETE FROM {{table}} WHERE `owner` = '" . $UserID . "';", 'buddy' );
doquery ( "DELETE FROM {{table}} WHERE `user` = '" . $UserID . "';", 'annonce' );
doquery ( "DELETE FROM {{table}} WHERE `id` = '" . $UserID . "';", 'users' );
doquery( "UPDATE {{table}} SET `config_value`='". $Useru_Poza ."' WHERE `config_name` = 'users_amount';", 'config' );
// doquery( "UPDATE {{table}} SET `config_value`='". $Useru_Poza ."' WHERE `config_name` = 'users_amount';", 'config' );
$userCount = doquery ( "SELECT COUNT(*) FROM {{table}}", 'users', true);
doquery( "UPDATE {{table}} SET `config_value`='". $userCount[0] ."' WHERE `config_name` = 'users_amount';", 'config' );
}
*/

Expand Down
28 changes: 28 additions & 0 deletions banner.php
@@ -0,0 +1,28 @@
<?php
/**
* banner.php
* @version 1.0
*
* Simple wrapper for INT_createBanner.php
* Create banner or userbar
* banner.php?id=<userid>&type=<banner|userbar>&format=<png>
*
* @copyright 2010 by Gorlum for http://supernova.ws
*
*/

define('INSIDE' , true);
define('INSTALL' , false);

$ugamela_root_path = './';

include($ugamela_root_path . 'extension.inc');
include($ugamela_root_path . 'common.' . $phpEx);

includeLang('overview');

$id = intval($_GET['id']);
if (!empty($id)) {
INT_createBanner($id, $_GET['type'], $_GET['format']);
}
?>
3 changes: 3 additions & 0 deletions common.php
Expand Up @@ -40,6 +40,9 @@
include($ugamela_root_path . 'includes/db.'.$phpEx);
include($ugamela_root_path . 'includes/strings.'.$phpEx);

// Initializing global "config" object
$config = objConfig::getInstance();

// Lecture de la table de configuration
$query = doquery("SELECT * FROM {{table}}",'config');
while ( $row = mysql_fetch_assoc($query) ) {
Expand Down
11 changes: 11 additions & 0 deletions docs/changelog.txt
Expand Up @@ -38,6 +38,17 @@ V0000

[?] ������: ���������� ������� ������ � ������� ����������� ����
[?] ���������� ����������� ���������� ������������
[?] using phpBB3 standalone template engine from
http://www.phpbb.com/community/viewtopic.php?f=71&t=1557455
http://wiki.phpbb.com/display/MODDOCS/Tutorial.Template+syntax

[?] using phpBB3 for everything (^_^) - custom page
http://www.phpbb.com/kb/article/add-a-new-custom-page-to-phpbb/
looks like updated version of upper page:
http://wiki.phpbb.com/display/MODDOCS/Practical.Add+custom+page
[?] using php 5.0+ embedded Database Object
http://ua2.php.net/manual/en/pdo.connections.php

[?] �������������� ���������� ���������� (� ����������� ���������� �������������)
[?] ��� ���������� ������������
[?] ��������� xCache ��� ������������
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added images/bann-32bit-no-server-name.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed images/bann.png
Binary file not shown.
Binary file added images/banner.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
148 changes: 148 additions & 0 deletions includes/functions/INT_createBanner.php
@@ -0,0 +1,148 @@
<?php
/**
* INT_createBanner.php
* @version 1.0
*
* @copyright 2010 by Gorlum for http://supernova.ws
*
* heavily based on
* CreateBanner.php
* @version 1.2 by Ihor
* @version 1.0 copyright 2008 By e-Zobar for XNova
*/

function INT_createBanner($id, $type = 'userbar', $format = 'png'){
// banner.php?id=<userid>&type=<banner|userbar>&format=<png>
global $config, $lang, $ugamela_root_path;

if (empty($id)) exit;

switch ($type) {
case 'banner':
$img_name = $config->int_banner_background;
break;
default:
$img_name = $config->int_userbar_background;
}

$size = getimagesize($img_name);
$im = imagecreatefrompng($img_name);
$image = imagecreatetruecolor($size[0],$size[1]);
imagecopy($image,$im,0,0,0,0,$size[0],$size[1]);
imagedestroy($im);

// Querys
$Player = doquery("SELECT * FROM {{table}} WHERE `id` = '".$id."';", 'users', true);
$Stats = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '".$id."';", 'statpoints', true);
$Planet = doquery("SELECT * FROM {{table}} WHERE `id_owner` = '".$id."' AND `planet_type` = '1' LIMIT 1;", 'planets', true);

// Variables
$b_user = $Player['username'];
$b_ally = $Player['ally_name'];
$b_planet = $Planet['name'];
$b_xyz = "[".$Planet['galaxy'].":".$Planet['system'].":".$Planet['planet']."]";
$b_lvl = "".$Stats['total_rank']."/".$config->users_amount."";

// Colors
$color = "FFFFFF";
$red = hexdec(substr($color,0,2));
$green = hexdec(substr($color,2,4));
$blue = hexdec(substr($color,4,6));
$select = imagecolorallocate($image,$red,$green,$blue);
$txt_shadow = imagecolorallocatealpha($image, 255, 255, 255, 255);
$txt_color = imagecolorallocatealpha($image, 255, 255, 255, 2);
$txt_shadow2 = imagecolorallocatealpha($image, 255, 255, 255, 255);
$txt_color2 = imagecolorallocatealpha($image, 255, 255, 255, 40);

$fonts = array (
'userbar' => $ugamela_root_path . "fonts/" . $config->int_userbar_font,
'universe' => $ugamela_root_path . "fonts/" . $config->int_banner_fontUniverse,
'raids' => $ugamela_root_path . "fonts/" . $config->int_banner_fontRaids,
'info' => $ugamela_root_path . "fonts/" . $config->int_banner_fontInfo,
);

$b_univ = $config->game_name;
switch ($type) {
case 'banner':
// Banner size 416 x 58
$fsize = 15;

$is = imagettfbbox($fsize, 0, $fonts['universe'], $b_univ);
imagettftext($image, $fsize, 0, $size[0] - 4 - $is[2], $size[1] - 2, $txt_shadow, $fonts['universe'], $b_univ);
imagettftext($image, $fsize, 0, $size[0] - 6 - $is[2], $size[1] - 4, $txt_color, $fonts['universe'], $b_univ);

// Player name
imagettftext($image, 11, 0, 8, 26, $txt_shadow, $fonts['info'], $b_user);
imagettftext($image, 11, 0, 6, 23, $txt_color, $fonts['info'], $b_user);

// Player level - right-alligned
$is = imagettfbbox(11, 0, $fonts['info'], $b_lvl);
imagettftext($image, 11, 0, $size[0] - 4 - $is[2], 25, $txt_shadow, $fonts['info'], $b_lvl);
imagettftext($image, 11, 0, $size[0] - 6 - $is[2], 23, $txt_color, $fonts['info'], $b_lvl);

// Ally name
$is = imagettfbbox(9, 0, $fonts['info'], $b_ally);
imagettftext($image, 9, 0, 412-$is[2], 37, $txt_shadow, $fonts['info'], $b_ally);
imagettftext($image, 9, 0, 410-$is[2], 35, $txt_color, $fonts['info'], $b_ally);

// Player b_planet
imagettftext($image, 6, 0, 8, 10, $txt_shadow2, $fonts['raids'], $b_planet." ".$b_xyz."");
imagettftext($image, 6, 0, 6, 9, $txt_color2, $fonts['raids'], $b_planet." ".$b_xyz."");

//StatPoint
$b_points = $lang['Points'].": ".pretty_number($Stats['total_points'])."";
$is = imagettfbbox(8, 0, $fonts['info'], $b_points);
imagettftext($image, 8, 0, 412-$is[2], 11, $txt_shadow, $fonts['info'], $b_points);
imagettftext($image, 8, 0, 410-$is[2], 9, $txt_color, $fonts['info'], $b_points);

//Raids Total
imagettftext($image, 6, 0, 8, 37, $txt_shadow2, $fonts['raids'], $lang['Raids']);
imagettftext($image, 6, 0, 6, 35, $txt_color2, $fonts['raids'], $lang['Raids']);
$b_points = ": ".pretty_number($Player['raids']);
imagettftext($image, 6, 0, 61, 37, $txt_shadow2, $fonts['raids'], $b_points);
imagettftext($image, 6, 0, 59, 35, $txt_color2, $fonts['raids'], $b_points);

//Raids Won
imagettftext($image, 6, 0, 8, 47, $txt_shadow2, $fonts['raids'], $lang['RaidsWin']);
imagettftext($image, 6, 0, 6, 45, $txt_color2, $fonts['raids'], $lang['RaidsWin']);
$b_points = ": ".pretty_number($Player['raidswin']);
imagettftext($image, 6, 0, 61, 47, $txt_shadow2, $fonts['raids'], $b_points);
imagettftext($image, 6, 0, 59, 45, $txt_color2, $fonts['raids'], $b_points);

//Raids Lost
imagettftext($image, 6, 0, 8, 57, $txt_shadow2, $fonts['raids'], $lang['RaidsLoose']);
imagettftext($image, 6, 0, 6, 55, $txt_color2, $fonts['raids'], $lang['RaidsLoose']);
$b_points = ": ".pretty_number($Player['raidsloose']);
imagettftext($image, 6, 0, 61, 57, $txt_shadow2, $fonts['raids'], $b_points);
imagettftext($image, 6, 0, 59, 55, $txt_color2, $fonts['raids'], $b_points);

break;
default:
// Userbar 350 x 19
$b_univ = strtoupper($b_univ);
$is = imagettfbbox(9, 0, $fonts['userbar'], $b_univ);
$is = $size[0] - $is[2] - 2;
imagettftext($image, 9, 0, $is, $size[1] - 3, $txt_shadow, $fonts['userbar'], $b_univ);
imagettftext($image, 9, 0, $is-1, $size[1] - 5, $txt_color, $fonts['userbar'], $b_univ);
imagettftext($image, 22, 0, $is-8, $size[1], $txt_color, $fonts['userbar'], '/');

// Player level - right-alligned
$isp = imagettfbbox(9, 0, $fonts['userbar'], $b_lvl);
imagettftext($image, 9, 0, $is-$isp[2] - 10, $size[1] - 4, $txt_shadow, $fonts['userbar'], $b_lvl);
imagettftext($image, 9, 0, $is-$isp[2] - 10 - 1, $size[1] - 4 - 1, $txt_color, $fonts['userbar'], $b_lvl);

// Player name
imagettftext($image, 9, 0, 4, $size[1] - 4, $txt_shadow, $fonts['userbar'], $b_user);
imagettftext($image, 9, 0, 2, $size[1] - 6, $txt_color, $fonts['userbar'], $b_user);
}

//And now convert it back to PNG-8
$im_result = imagecreate($size[0],$size[1]);
imagecopy($im_result,$image,0,0,0,0,$size[0],$size[1]);
imagedestroy($image);
//And save it
header ("Content-type: image/png");
imagepng($im_result);
imagedestroy($im_result);
}
?>

0 comments on commit c279132

Please sign in to comment.