Skip to content

Commit

Permalink
Adding rss function to homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
xapantu committed Feb 12, 2010
1 parent fa7c1ec commit d1a92a9
Show file tree
Hide file tree
Showing 10 changed files with 118 additions and 18 deletions.
2 changes: 1 addition & 1 deletion createAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
if($_POST['pass1'] == $_POST['pass2'])
{
$login = $_POST['login'];
$existSql= mysql_query("SELECT * FROM `users` WHERE `users`.`login` = '".$login."'");
$existSql= mysql_query("SELECT * FROM `users` WHERE `users`.`login` = '".mysql_real_escape_string($login)."'");
$exist =true;
$sql = mysql_fetch_array($existSql) or $exist = false;
if($exist == false && $login != null)
Expand Down
11 changes: 10 additions & 1 deletion css/menu_default.css
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,15 @@ overflow-x:hidden;
.container img
{
padding-top:15px;
margin-left:-15px;
margin-left:10px;
margin-right:10px;
}
.container a
{
margin-left:0px !important;
}
.menu_body
{
position:relative;
background-color:white;
}
1 change: 1 addition & 0 deletions css/skin_default.css
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ color:brown;
{
border-bottom:brown 1px solid;
padding-bottom:4px;
font-size:12.5px;
}
#news_div
{
Expand Down
7 changes: 1 addition & 6 deletions css/style_jquery.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,8 @@ ul, li{margin:0; padding:0; list-style:none;}
.menu_body {display:none;}
.menu_body li a{color:#FFFFFF; text-decoration:none; padding:0px; display:block;}
.menu_body li a:hover{padding:0px; font-weight:bold;}.container{
position:absolute;
z-index:10;
right:50%;
margin-right:-300px;
top:15px;
float:right;
background-color:white;

filter:alpha(opacity=90);
-moz-opacity:0.90;
opacity: 0.90;
Expand Down
43 changes: 40 additions & 3 deletions image.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,56 @@
$hauteur ="100"; // correspond à la hauteur de l'image souhaitée

// et voici la création de la miniature...
header("Content-Type: image/jpeg");
header("Content-Type: image/png");
reduitimage($_GET['pic']);
function reduitImage($entryname)
{
global $fichier;
$source = imagecreatefrompng($entryname);
if(@fopen($entryname, 'r'))
{ $source = imagecreatefrompng($entryname);
// Les fonctions imagesx et imagesy renvoient la largeur et la hauteur d'une image
$largeur_source = imagesx($source);
$hauteur_source = imagesy($source);
if($_GET['type'] == "big")
{
$size=300;
}
if($_GET['type'] == "medium")
{
$size=75;
}
if($_GET['type'] == "small")
{
$size=25;
}
if($largeur_source > $hauteur_source)
{

$largeur_destination = $size;
$hauteur_destination = $size*$hauteur_source/$largeur_source;
}
if($largeur_source <= $hauteur_source)
{
$hauteur_destination = $size;
$largeur_destination = $size*$largeur_source/$hauteur_source;
}
$destination = imagecreatetruecolor($largeur_destination, $hauteur_destination); // On crée la miniature vide
// On crée la miniature
imagecopyresampled($destination, $source, 0, 0, 0, 0, $largeur_destination, $hauteur_destination, $largeur_source, $hauteur_source);

imagepng($destination);}

else{ $source = imagecreatefrompng('/data/repository/stkaddons/icon/icon.png'); // Les fonctions imagesx et imagesy renvoient la largeur et la hauteur d'une image
$largeur_source = imagesx($source);
$hauteur_source = imagesy($source);
if($_GET['type'] == "big")
{
$size=300;
}
if($_GET['type'] == "medium")
{
$size=75;
}
if($_GET['type'] == "small")
{
$size=25;
Expand All @@ -53,7 +90,7 @@ function reduitImage($entryname)
// On crée la miniature
imagecopyresampled($destination, $source, 0, 0, 0, 0, $largeur_destination, $hauteur_destination, $largeur_source, $hauteur_source);

imagepng($destination);
imagepng($destination);}


}
Expand Down
12 changes: 12 additions & 0 deletions include/coreUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,18 @@ function permalink()
{
return 'account.php?title='.$this->addonCurrent['login'];
}
function setAvailable()
{
global $base;
if($_SESSION['range']['manageaddons'] == true)
{
if($this->addonCurrent['available'] == 0)
{
mysql_query("UPDATE `".$base."`.`".$this->addonType."` SET `available` = '1' WHERE `".$this->addonType."`.`id` =".$this->addonCurrent['id']." LIMIT 1 ;");
}
else mysql_query("UPDATE `".$base."`.`".$this->addonType."` SET `available` = '0' WHERE `".$this->addonType."`.`id` =".$this->addonCurrent['id']." LIMIT 1 ;");
}
}
}


Expand Down
11 changes: 10 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,17 @@
<div id="news_top">
</div>
<div id="news_center">
STK development blog :
<?php
echo "Supertuxkart 0.7 alpha 1 is out !<hr /><br />";

if(!@fopen("rss", 'r'))
{
include("rss.php");
}
$fichier = fopen("rss", "r");
echo fgets($fichier);
fclose($fichier);
echo '<hr />';
$reqSql = mysql_query("SELECT * FROM history LIMIT 7") or die(mysql_error());
while($history = mysql_fetch_array($reqSql))
{
Expand Down
4 changes: 3 additions & 1 deletion menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@
echo _('About');
echo '</a>';
?>

<a class="container"><?php echo _("STK Homepage");?></a>
<div class="container">
<a class="menu_head"><?php echo _("Languages");?></a>
<a class="menu_head" href="#" ><?php echo _("Languages");?></a>
<ul class="menu_body">
<li><a href="<?php echo $nom_page.'&amp;lang=nl'; ?>"><img src="image/flag/nl.png" /></a></li>
<li><a href="<?php echo $nom_page.'&amp;lang=fr'; ?>"><img src="image/flag/fr.png" /></a></li>
Expand Down
12 changes: 12 additions & 0 deletions rss.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
$rss = simplexml_load_file('http://supertuxkart.blogspot.com/feeds/posts/default');
$arr_xml = $rss->entry[0]->title;
$arr_xml2 = $rss->entry[0]->link;
$content = '<a href="'.$arr_xml2[4]['href'].'">';
$content .= $arr_xml;
$content .= '</a>';

$fichier = fopen("rss", "w+");
fputs($fichier, $content);
fclose($fichier);
?>
33 changes: 28 additions & 5 deletions xml/addonsXml.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@
***************************************************************************/
include("../include/connectMysql.php");
include("../include/coreAddon.php");
$type = mysql_real_escape_string($_GET["type"]);
echo "<?xml version=\"1.0\"?>\n";
echo "<addons xmlns='http://stkaddons.tuxfamily.org/'>\n";
$addon =new coreAddon($type);
$addon =new coreAddon('karts');
$addon->loadAll();
while($addon->next())
{
echo "<".$type.">\n\t";
echo "<karts>\n\t";
echo "<name>";
echo $addon->addonCurrent["name"];
echo "</name>\n\t";
Expand All @@ -30,7 +28,32 @@
echo "<file>";
echo $addon->addonCurrent["file"];
echo "</file>\n";
echo "</".$type.">\n";
echo "<icon>";
echo 'http://stkaddons.tuxfamily.org/image.php?type=medium&pic=/data/repository/stkaddons/icon/'.$addon->addonCurrent["icon"];
echo "</icon>\n";
echo "</karts>\n";
}
$addon =new coreAddon('tracks');
$addon->loadAll();
while($addon->next())
{
echo "<tracks>\n\t";
echo "<name>";
echo $addon->addonCurrent["name"];
echo "</name>\n\t";
echo "<description>";
echo $addon->addonCurrent["description"];
echo "</description>\n\t";
echo "<version>";
echo $addon->addonCurrent["version"];
echo "</version>\n\t";
echo "<file>";
echo $addon->addonCurrent["file"];
echo "</file>\n";
echo "<icon>";
echo 'http://download.tuxfamily.org/stkaddons/icon/icon.png';
echo "</icon>\n";
echo "</tracks>\n";
}
echo "</addons>";
?>

0 comments on commit d1a92a9

Please sign in to comment.