Skip to content

Commit

Permalink
(stkaddons) Adding stkaddons' code
Browse files Browse the repository at this point in the history
  • Loading branch information
xapantu committed Jan 30, 2010
1 parent a4ada87 commit 0f2fda9
Show file tree
Hide file tree
Showing 59 changed files with 2,561 additions and 0 deletions.
213 changes: 213 additions & 0 deletions COPYING

Large diffs are not rendered by default.

82 changes: 82 additions & 0 deletions addon-view.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?php
/* copyright 2009 Lucas Baudin <[email protected]>
This file is part of stkaddons.
stkaddons is free software: you can redistribute it and/or
modify it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
stkaddons is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
stkaddons. If not, see <http://www.gnu.org/licenses/>. */
?>
<?php
/***************************************************************************
Project: STK Addon Manager
File: index.php
Version: 1
Licence: GPLv3
Description: index page
***************************************************************************/
$security ="";
$title = "Supertuxkart Addon Manager";
include("include/security.php");
include("include/view.php");
include("include/top.php");
include("include/coreAddon.php");
include("include/config.php");
?>
</head>
<body>
<?php
include("menu.php");
?>
<div id="select-addons">
<div id="select-addons_top">
</div>
<div id="select-addons_center">
<?php
loadAddons();
?>
</div>
<div id="select-addons_bottom">
</div></div>
<div id="disAddon_content">
<div id="disAddon"></div></div>
<?php
include("footer.php"); ?>
</body>
</html>
<?php
function loadAddons()
{
global $addon, $dirDownload, $dirUpload;
if($_GET['addons'] == "karts" or $_GET['addons'] == "tracks" or $_GET['addons'] == "file" or $_GET['addons'] == "help")
{
$addonLoader = new coreAddon($_GET['addons']);
$addonLoader->loadAll();
echo '<ul id="list-addons">';
while($addonLoader->next())
{
if($addonLoader->addonCurrent['available'] == 1)
{
echo '<li><a class="menu-addons" href="javascript:loadAddon('.$addonLoader->addonCurrent['id'].',\'addon.php?type='.$_GET['addons'].'\')"><img class="icon" src="image.php?type=small&amp;pic='.$dirUpload.'icon/'.$addonLoader->addonCurrent['icon'].'" />'.$addonLoader->addonCurrent['name']."</a></li>";
}
elseif($_SESSION['range']['manageaddons'] == true||$_SESSION['id']==$addonLoader->addonCurrent['user'])
{
echo '<li><a class="menu-addons unavailable" href="javascript:loadAddon('.$addonLoader->addonCurrent['id'].',\'addon.php?type='.$_GET['addons'].'\')"><img class="icon" src="image.php?type=small&amp;pic='.$dirUpload.'icon/'.$addonLoader->addonCurrent['icon'].'" />'.$addonLoader->addonCurrent['name']."</a></li>";
}
}
echo "</ul>";
}

}
?>
83 changes: 83 additions & 0 deletions addon.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?php
/* copyright 2009 Lucas Baudin <[email protected]>
This file is part of stkaddons.
stkaddons is free software: you can redistribute it and/or
modify it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
stkaddons is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
stkaddons. If not, see <http://www.gnu.org/licenses/>. */
?>
<?php
/***************************************************************************
Project: STK Addon Manager
File: addon.php
Version: 1
Licence: GPLv3
Description: page who is called in ajax and who give kart and track informations
***************************************************************************/
$security ="";
include("include/security.php");
include("include/connectMysql.php");
include("include/coreAddon.php");
include("include/coreHelp.php");


$type= mysql_real_escape_string($_GET['type']);
$id = mysql_real_escape_string($_GET['id']);
$action = mysql_real_escape_string($_GET['action']);
if($type=="help")
{
$addon = new coreHelp($type);
}
else
{
$addon = new coreAddon($type);
}
$addon->selectById($id);

if($action == "available")
{
$addon->setAvailable();
$addon->selectById($id);
}
if($action == "description")
{
$value = mysql_real_escape_string($_GET['value']);
$addon->setDescription($value);
$addon->selectById($id);
}
if($action == "remove")
{
$addon->remove();
exit();
}

if($action == "stkVersion")
{
$addon->setStkVersion(mysql_real_escape_string($_GET['value']));
}
if($action == "file")
{
?>
<html>
<head>
<meta http-equiv="refresh" content="0;URL=index.php?title=<?php echo $type.$addon->addonCurrent['name'];?>">
</head>
</html>
<?php
$addon->setFile($action);
exit();
}
$addon->viewInformations();
?>
145 changes: 145 additions & 0 deletions createAccount.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
<?php
/* copyright 2009 Lucas Baudin <[email protected]>
This file is part of stkaddons.
stkaddons is free software: you can redistribute it and/or
modify it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
stkaddons is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
stkaddons. If not, see <http://www.gnu.org/licenses/>. */
?>
<?php
/***************************************************************************
Project: STK Addon Manager
File: index.php
Version: 1
Licence: GPLv3
Description: index page
***************************************************************************/
$security ="";
include("include/security.php");
include("include/top.php");
include("include/config.php");
?>

</head>
<body>
<?php include("menu.php");
echo '
<div id="content">';
//exit();
if($_GET['action'] == "submit")
{
if($_POST['pass1'] == $_POST['pass2'])
{
$login = $_POST['login'];
$existSql= mysql_query("SELECT * FROM `users` WHERE `users`.`login` = '".$login."'");
$exist =true;
$sql = mysql_fetch_array($existSql) or $exist = false;
if($exist == false && $login != null)
{
$crypt = cryptUrl(12);
mysql_query("
INSERT INTO `".$base."`.`users` (
`login` ,
`pass` ,
`date` ,
`id` ,
`range` ,
`mail` ,
`available`,
`verify`
)
VALUES (
'".mysql_real_escape_string($_POST['login'])."', '".md5(mysql_real_escape_string($_POST['pass1']))."', '".date("Y-m-d")."', NULL , 'basicUser', '".mysql_real_escape_string($_POST['mail'])."', '0', '".$crypt."'
);
");
include("include/mail.php");
sendMail(mysql_real_escape_string($_POST['mail']), "newAccount", array($crypt, $_SERVER["PHP_SELF"], $login, $_POST['pass1']));
echo "Your request is succesful, an e-mail will be sent to you ta activate your account.";
}
else
{
echo "Your login is already used.<br /><br />";
echo ' <form id="form" action="createAccount.php?action=submit" method="POST">
Your login : <br />
<input type="text" name="login" /><br />
Your password : <br />
<input type="password" id="pass1" name="pass1" /><br />
A second time your password : <br />
<input type="password" id="pass2" name="pass2" /><br />
Your mail : <br />
<input type="text" name="mail" /><br /><br />
<input type="submit" value="Submit" />
</form>';
}
}
else
{
?>
<form id="form" action="createAccount.php?action=submit" method="POST">
Your login : <br />
<input type="text" name="login" value="<?php echo $_POST['login']?>"/><br />
<b>Your passwords are not same.</b><br/>
Your password : <br />
<input type="password" id="pass1" name="pass1" /><br />
A second time your password : <br />
<input type="password" id="pass2" name="pass2" /><br />
Your mail : <br />
<input type="text" name="mail" value="<?php echo $_POST['mail']?>" /><br /><br />
<input type="submit" value="Submit" />
</form>
<?php
}
}
elseif($_GET['action'] == "valid")
{
mysql_query("UPDATE `".$base."`.`users` SET `available` = '1' WHERE `users`.`verify` ='".mysql_real_escape_string($_GET['num'])."';")or die(mysql_error());
mysql_query("UPDATE `".$base."`.`users` SET `verify` = ' ' WHERE `users`.`verify` ='".mysql_real_escape_string($_GET['num'])."';")or die(mysql_error());
echo "Your account is now available";
}
else
{

?>
<form id="form" action="createAccount.php?action=submit" method="POST">
Your login : <br />
<input type="text" name="login" /><br />
Your password : <br />
<input type="password" id="pass1" name="pass1" /><br />
A second time your password : <br />
<input type="password" id="pass2" name="pass2" /><br />
Your mail : <br />
<input type="text" name="mail" /><br /><br />
<input type="submit" value="Submit" />
</form>
<?php
}
echo '
</div>';
include("footer.php"); ?>
</body>
</html>
<?php
function cryptUrl($nbr) {
$str = "";
$chaine = "abcdefghijklmnpqrstuvwxy";
srand((double)microtime()*1000000);
for($i=0; $i<$nbr; $i++) {
$str .= $chaine[rand()%strlen($chaine)];
}
return $str;
}

$str = cryptUrl(12);
?>
Loading

0 comments on commit 0f2fda9

Please sign in to comment.