Compare commits

...
1457 changed files with 787 additions and 86041 deletions

8
.gitignore vendored
View file

@ -1,8 +0,0 @@
config.php
.buildpath
.project
.settings/
.idea/
coverage/
src/application/cache/*
src/application/configs/local.php

146
build.xml
View file

@ -1,146 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="name-of-project" default="build">
<target name="build"
depends="prepare,lint,phploc,pdepend,phpmd-ci,phpcs-ci,phpcpd,phpdoc,phpunit,phpcb"/>
<target name="build-parallel"
depends="prepare,lint,tools-parallel,phpunit,phpcb"/>
<target name="tools-parallel"
description="Run tools in parallel">
<parallel threadCount="2">
<sequential>
<antcall target="pdepend"/>
<antcall target="phpmd-ci"/>
</sequential>
<antcall target="phpcpd"/>
<antcall target="phpcs-ci"/>
<antcall target="phploc"/>
<antcall target="phpdoc"/>
</parallel>
</target>
<target name="clean" description="Cleanup build artifacts">
<delete dir="${basedir}/build/api"/>
<delete dir="${basedir}/build/code-browser"/>
<delete dir="${basedir}/build/coverage"/>
<delete dir="${basedir}/build/logs"/>
<delete dir="${basedir}/build/pdepend"/>
</target>
<target name="prepare" depends="clean"
description="Prepare for build">
<mkdir dir="${basedir}/build/api"/>
<mkdir dir="${basedir}/build/code-browser"/>
<mkdir dir="${basedir}/build/coverage"/>
<mkdir dir="${basedir}/build/logs"/>
<mkdir dir="${basedir}/build/pdepend"/>
</target>
<target name="lint">
<apply executable="php" failonerror="true">
<arg value="-l" />
<fileset dir="${basedir}/src">
<include name="**/*.php" />
<modified />
</fileset>
<fileset dir="${basedir}/tests">
<include name="**/*.php" />
<modified />
</fileset>
</apply>
</target>
<target name="phploc" description="Measure project size using PHPLOC">
<exec executable="phploc">
<arg value="--log-csv" />
<arg value="${basedir}/build/logs/phploc.csv" />
<arg path="${basedir}/src" />
</exec>
</target>
<target name="pdepend"
description="Calculate software metrics using PHP_Depend">
<exec executable="pdepend">
<arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml" />
<arg value="--jdepend-chart=${basedir}/build/pdepend/dependencies.svg" />
<arg value="--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg" />
<arg path="${basedir}/src" />
</exec>
</target>
<target name="phpmd"
description="Perform project mess detection using PHPMD and print human readable output. Intended for usage on the command line before committing.">
<exec executable="phpmd">
<arg path="${basedir}/src" />
<arg value="text" />
<arg value="${basedir}/build/phpmd.xml" />
</exec>
</target>
<target name="phpmd-ci"
description="Perform project mess detection using PHPMD creating a log file for the continuous integration server">
<exec executable="phpmd">
<arg path="${basedir}/src" />
<arg value="xml" />
<arg value="${basedir}/build/phpmd.xml" />
<arg value="--reportfile" />
<arg value="${basedir}/build/logs/pmd.xml" />
</exec>
</target>
<target name="phpcs"
description="Find coding standard violations using PHP_CodeSniffer and print human readable output. Intended for usage on the command line before committing.">
<exec executable="phpcs">
<arg value="--standard=${basedir}/build/phpcs.xml" />
<arg path="${basedir}/src" />
</exec>
</target>
<target name="phpcs-ci"
description="Find coding standard violations using PHP_CodeSniffer creating a log file for the continuous integration server">
<exec executable="phpcs" output="/dev/null">
<arg value="--report=checkstyle" />
<arg value="--report-file=${basedir}/build/logs/checkstyle.xml" />
<arg value="--standard=${basedir}/build/phpcs.xml" />
<arg path="${basedir}/src" />
</exec>
</target>
<target name="phpcpd" description="Find duplicate code using PHPCPD">
<exec executable="phpcpd">
<arg value="--log-pmd" />
<arg value="${basedir}/build/logs/pmd-cpd.xml" />
<arg path="${basedir}/src" />
</exec>
</target>
<target name="phpdoc"
description="Generate API documentation using PHPDocumentor">
<exec executable="phpdoc">
<arg value="--directory" />
<arg path="${basedir}/src" />
<arg value="--target" />
<arg path="${basedir}/build/api" />
</exec>
</target>
<target name="phpunit" description="Run unit tests with PHPUnit">
<exec executable="phpunit" failonerror="true"/>
</target>
<target name="phpcb"
description="Aggregate tool output with PHP_CodeBrowser">
<exec executable="phpcb">
<arg value="--log" />
<arg path="${basedir}/build/logs" />
<arg value="--source" />
<arg path="${basedir}/src" />
<arg value="--output" />
<arg path="${basedir}/build/code-browser" />
</exec>
</target>
</project>

View file

@ -1,36 +0,0 @@
<?xml version="1.0"?>
<ruleset name="PPW-DEFAULT">
<description>Default coding standard</description>
<rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop"/>
<rule ref="Generic.CodeAnalysis.ForLoopWithTestFunctionCall"/>
<rule ref="Generic.CodeAnalysis.JumbledIncrementer"/>
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
<rule ref="Generic.Commenting.Todo"/>
<rule ref="Generic.ControlStructures.InlineControlStructure"/>
<rule ref="Generic.Files.LineEndings"/>
<rule ref="Generic.Formatting.DisallowMultipleStatements"/>
<rule ref="Generic.Formatting.MultipleStatementAlignment"/>
<rule ref="Generic.Formatting.NoSpaceAfterCast"/>
<rule ref="Generic.Functions.OpeningFunctionBraceBsdAllman"/>
<rule ref="PEAR.Functions.ValidDefaultValue"/>
<rule ref="Generic.NamingConventions.ConstructorName"/>
<rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
<rule ref="PEAR.NamingConventions.ValidClassName"/>
<rule ref="Generic.PHP.DisallowShortOpenTag"/>
<rule ref="Generic.PHP.NoSilencedErrors"/>
<rule ref="Generic.PHP.UpperCaseConstant"/>
<rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
<rule ref="Generic.WhiteSpace.ScopeIndent"/>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>
</ruleset>

View file

@ -1,26 +0,0 @@
<?xml version="1.0"?>
<ruleset name="PPW-DEFAULT"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>Default coding standard</description>
<rule ref="rulesets/codesize.xml/CyclomaticComplexity" />
<rule ref="rulesets/codesize.xml/NPathComplexity" />
<rule ref="rulesets/codesize.xml/ExcessiveClassComplexity" />
<rule ref="rulesets/codesize.xml/ExcessiveClassLength" />
<rule ref="rulesets/codesize.xml/ExcessiveMethodLength" />
<rule ref="rulesets/codesize.xml/ExcessiveParameterList" />
<rule ref="rulesets/design.xml/EvalExpression" />
<rule ref="rulesets/design.xml/ExitExpression" />
<rule ref="rulesets/naming.xml/ConstructorWithNameAsEnclosingClass" />
<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter" />
<rule ref="rulesets/unusedcode.xml/UnusedLocalVariable" />
<rule ref="rulesets/unusedcode.xml/UnusedPrivateField" />
<rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod" />
</ruleset>

BIN
images/code.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
images/pattern.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
images/tar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
images/top.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
images/zip.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

85
index.html Normal file
View file

@ -0,0 +1,85 @@
<!doctype html>
<!-- The Time Machine GitHub pages theme was designed and developed by Jon Rohan, on Feb 7, 2012. -->
<!-- Follow him for fun. http://twitter.com/jonrohan. Tail his code on http://github.com/jonrohan -->
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="stylesheet" href="stylesheets/stylesheet.css" media="screen"/>
<link rel="stylesheet" href="stylesheets/pygment_trac.css"/>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="javascripts/script.js"></script>
<title>Wootook</title>
<meta name="description" content="Wootook is a web-based MMO strategy game engine able to manage several gameplays">
<meta name="viewport" content="width=device-width,initial-scale=1">
</head>
<body>
<div class="wrapper">
<header>
<h1 class="title">Wootook</h1>
</header>
<div id="container">
<p class="tagline">Wootook is a web-based MMO strategy game engine able to manage several gameplays</p>
<div id="main" role="main">
<div class="download-bar">
<div class="inner">
<a href="https://github.com/wootook/wootook/tarball/master" class="download-button tar"><span>Download</span></a>
<a href="https://github.com/wootook/wootook/zipball/master" class="download-button zip"><span>Download</span></a>
<a href="https://github.com/wootook/wootook" class="code">fork Wootook on GitHub</a>
</div>
<span class="blc"></span><span class="trc"></span>
</div>
<article class="markdown-body">
<h3>Welcome to GitHub Pages.</h3>
<p>This automatic page generator is the easiest way to create beautiful pages for all of your projects. Author your page content here using GitHub Flavored Markdown, select a template crafted by a designer, and publish. After your page is generated, you can check out the new branch:</p>
<pre><code>$ cd your_repo_root/repo_name
$ git fetch origin
$ git checkout gh-pages
</code></pre>
<p>If you're using the GitHub for Mac, simply sync your repository and you'll see the new branch.</p>
<h3>Designer Templates</h3>
<p>We've crafted some handsome templates for you to use. Go ahead and continue to layouts to browse through them. You can easily go back to edit your page before publishing. After publishing your page, you can revisit the page generator and switch to another theme. Your Page content will be preserved if it remained markdown format.</p>
<h3>Rather Drive Stick?</h3>
<p>If you prefer to not use the automatic generator, push a branch named <code>gh-pages</code> to your repository to create a page manually. In addition to supporting regular HTML content, GitHub Pages support Jekyll, a simple, blog aware static site generator written by our own Tom Preston-Werner. Jekyll makes it easy to create site-wide headers and footers without having to copy them across every page. It also offers intelligent blog support and other advanced templating features.</p>
<h3>Authors and Contributors</h3>
<p>You can <a href="https://github.com/blog/821" class="user-mention">@mention</a> a GitHub username to generate a link to their profile. The resulting <code>&lt;a&gt;</code> element will link to the contributor's GitHub Profile. For example: In 2007, Chris Wanstrath (<a href="https://github.com/defunkt" class="user-mention">@defunkt</a>), PJ Hyett (<a href="https://github.com/pjhyett" class="user-mention">@pjhyett</a>), and Tom Preston-Werner (<a href="https://github.com/mojombo" class="user-mention">@mojombo</a>) founded GitHub.</p>
<h3>Support or Contact</h3>
<p>Having trouble with Pages? Check out the documentation at <a href="http://help.github.com/pages">http://help.github.com/pages</a> or contact support@github.com and well help you sort it out.</p>
</article>
</div>
</div>
<footer>
<div class="owner">
<p><a href="https://github.com/wootook" class="avatar"><img src="https://secure.gravatar.com/avatar/8f1ac76921649b679fa17aa55e3a8d33?s=30&amp;d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png" width="48" height="48"/></a> <a href="https://github.com/wootook">wootook</a> maintains <a href="https://github.com/wootook/wootook">Wootook</a></p>
</div>
<div class="creds">
<small>This page generated using <a href="https://pages.github.com/">GitHub Pages</a><br/>theme by <a href="http://twitter.com/jonrohan/">Jon Rohan</a></small>
</div>
</footer>
</div>
<div class="current-section">
<a href="#top">Scroll to top</a>
<a href="https://github.com/wootook/wootook/tarball/master" class="tar">tar</a><a href="https://github.com/wootook/wootook/zipball/master" class="zip">zip</a><a href="" class="code">source code</a>
<p class="name"></p>
</div>
</body>
</html>

52
javascripts/script.js Normal file
View file

@ -0,0 +1,52 @@
(function($) {
$(document).ready(function(){
// putting lines by the pre blocks
$("pre").each(function(){
var pre = $(this).text().split("\n");
var lines = new Array(pre.length+1);
for(var i = 0; i < pre.length; i++) {
var wrap = Math.floor(pre[i].split("").length / 70)
if (pre[i]==""&&i==pre.length-1) {
lines.splice(i, 1);
} else {
lines[i] = i+1;
for(var j = 0; j < wrap; j++) {
lines[i] += "\n";
}
}
}
$(this).before("<pre class='lines'>" + lines.join("\n") + "</pre>");
});
var headings = [];
var collectHeaders = function(){
headings.push({"top":$(this).offset().top - 15,"text":$(this).text()});
}
if($(".markdown-body h1").length > 1) $(".markdown-body h1").each(collectHeaders)
else if($(".markdown-body h2").length > 1) $(".markdown-body h2").each(collectHeaders)
else if($(".markdown-body h3").length > 1) $(".markdown-body h3").each(collectHeaders)
$(window).scroll(function(){
if(headings.length==0) return true;
var scrolltop = $(window).scrollTop() || 0;
if(headings[0] && scrolltop < headings[0].top) {
$(".current-section").css({"opacity":0,"visibility":"hidden"});
return false;
}
$(".current-section").css({"opacity":1,"visibility":"visible"});
for(var i in headings) {
if(scrolltop >= headings[i].top) {
$(".current-section .name").text(headings[i].text);
}
}
});
$(".current-section a").click(function(){
$(window).scrollTop(0);
return false;
})
});
})(jQuery)

1
params.json Normal file
View file

@ -0,0 +1 @@
{"name":"Wootook","body":"### Welcome to GitHub Pages.\r\nThis automatic page generator is the easiest way to create beautiful pages for all of your projects. Author your page content here using GitHub Flavored Markdown, select a template crafted by a designer, and publish. After your page is generated, you can check out the new branch:\r\n\r\n```\r\n$ cd your_repo_root/repo_name\r\n$ git fetch origin\r\n$ git checkout gh-pages\r\n```\r\n\r\nIf you're using the GitHub for Mac, simply sync your repository and you'll see the new branch.\r\n\r\n### Designer Templates\r\nWe've crafted some handsome templates for you to use. Go ahead and continue to layouts to browse through them. You can easily go back to edit your page before publishing. After publishing your page, you can revisit the page generator and switch to another theme. Your Page content will be preserved if it remained markdown format.\r\n\r\n### Rather Drive Stick?\r\nIf you prefer to not use the automatic generator, push a branch named `gh-pages` to your repository to create a page manually. In addition to supporting regular HTML content, GitHub Pages support Jekyll, a simple, blog aware static site generator written by our own Tom Preston-Werner. Jekyll makes it easy to create site-wide headers and footers without having to copy them across every page. It also offers intelligent blog support and other advanced templating features.\r\n\r\n### Authors and Contributors\r\nYou can @mention a GitHub username to generate a link to their profile. The resulting `<a>` element will link to the contributor's GitHub Profile. For example: In 2007, Chris Wanstrath (@defunkt), PJ Hyett (@pjhyett), and Tom Preston-Werner (@mojombo) founded GitHub.\r\n\r\n### Support or Contact\r\nHaving trouble with Pages? Check out the documentation at http://help.github.com/pages or contact support@github.com and well help you sort it out.","tagline":"Wootook is a web-based MMO strategy game engine able to manage several gameplays","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."}

View file

@ -1,18 +0,0 @@
SetEnv DEBUG On
SetEnv DEPRECATION On
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
## workaround for HTTP authorization in CGI environment
#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_URI} !^/(skin|js)/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php [L]
</IfModule>

View file

@ -1,675 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program 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.
This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View file

@ -1,62 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
* All rights reserved.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
require_once dirname(__FILE__) .'/application/bootstrap.php';
$mode = Wootook::getRequest()->getPost('mode');
if ($mode == 'addit') {
$adapter = Wootook_Core_Database_ConnectionManager::getSingleton()->getConnection('core_write');
$adapter->insert()
->into($adapter->getTable('declared'))
->set('declarator', $user->getId())
->set('declarator_name', $user->getUsername())
->set('declared_1', Wootook::getRequest()->getPost('dec1'))
->set('declared_2', Wootook::getRequest()->getPost('dec2'))
->set('declared_3', Wootook::getRequest()->getPost('dec2'))
->set('reason', Wootook::getRequest()->getPost('reason'))
->execute()
;
$adapter->update()
->into($adapter->getTable('users'))
->set('multi_validated', 1)
;
message("Merci, votre demande a ete prise en compte. Les autres joueurs que vous avez implique doivent egalement et imperativement suivre cette procedure aussi.", "Ajout");
}
includeLang('admin');
$Page = parsetemplate(gettemplate("add_declare"), $lang);
display($Page, "Declaration d\'IP partagee", false, '', true);

View file

@ -1,79 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
* All rights reserved.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
define('IN_ADMIN', true);
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) {
includeLang('admin');
$QrySelectPlanet = "SELECT `id`, `id_owner`, `b_hangar`, `b_hangar_id` ";
$QrySelectPlanet .= "FROM {{table}} ";
$QrySelectPlanet .= "WHERE ";
$QrySelectPlanet .= "`b_hangar_id` != '0';";
$AffectedPlanets = doquery ($QrySelectPlanet, 'planets');
$DeletedQueues = 0;
while ( $ActualPlanet = mysql_fetch_assoc($AffectedPlanets) ) {
$HangarQueue = explode (";", $ActualPlanet['b_hangar_id']);
$bDelQueue = false;
if (count($HangarQueue)) {
for ( $Queue = 0; $Queue < count($HangarQueue); $Queue++) {
$InQueue = explode (",", $HangarQueue[$Queue]);
if ($InQueue[1] > MAX_FLEET_OR_DEFS_PER_ROW) {
$bDelQueue = true;
}
}
}
if ($bDelQueue) {
$QryUpdatePlanet = "UPDATE {{table}} ";
$QryUpdatePlanet .= "SET ";
$QryUpdatePlanet .= "`b_hangar` = '0', ";
$QryUpdatePlanet .= "`b_hangar_id` = '0' ";
$QryUpdatePlanet .= "WHERE ";
$QryUpdatePlanet .= "`id` = '".$ActualPlanet['id']."';";
doquery ($QryUpdatePlanet, 'planets');
$DeletedQueues += 1;
}
}
if ($DeletedQueues > 0) {
$QuitMessage = $lang['adm_cleaned']." ". $DeletedQueues;
} else {
$QuitMessage = $lang['adm_done'];
}
AdminMessage ($QuitMessage, $lang['adm_cleaner_title']);
} else {
message( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
}
?>

View file

@ -1,59 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
* All rights reserved.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
define('IN_ADMIN', true);
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
if (in_array($user['authlevel'], array(LEVEL_ADMIN))) {
includeLang('admin/Queries');
$parse = $lang;
if ($_POST['really_do_it'] == 'on') {
mysql_query ($_POST['qry_sql']);
AdminMessage ($lang['qry_succesful'], 'Succes', '?');
} else {
}
$PageTpl = gettemplate("admin/exec_query");
$Page = parsetemplate( $PageTpl, $parse);
display( $Page, $lang['qry_title'], false, '', true );
} else {
message( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
}
?>

View file

@ -1,50 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
* All rights reserved.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
define('IN_ADMIN', true);
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
include(ROOT_PATH . 'includes/functions/BuildFlyingFleetTable.'.PHPEXT);
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) {
includeLang('admin/fleets');
$PageTPL = gettemplate('admin/fleet_body');
$parse = $lang;
$parse['flt_table'] = BuildFlyingFleetTable ();
$page = parsetemplate( $PageTPL, $parse );
display ( $page, $lang['flt_title'], false, '', true);
} else {
AdminMessage ( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
}

View file

@ -1,138 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
* All rights reserved.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
define('IN_ADMIN', true);
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
includeLang('admin');
function WootookResetUnivers ( $CurrentUser ) {
global $lang;
if (in_array($CurrentUser['authlevel'], array(LEVEL_ADMIN))) {
// Copier la table users et planets vers des tables de replis !
doquery( "RENAME TABLE {{table}} TO {{table}}_s", 'planets');
doquery( "RENAME TABLE {{table}} TO {{table}}_s", 'users');
doquery( "RENAME TABLE {{table}} TO {{table}}_s", 'galaxy');
doquery( "RENAME TABLE {{table}} TO {{table}}_s", 'banned');
// Recreer la structure des tables renommées
doquery( "CREATE TABLE IF NOT EXISTS {{table}} ( LIKE {{table}}_s );", 'planets');
doquery( "CREATE TABLE IF NOT EXISTS {{table}} ( LIKE {{table}}_s );", 'users');
doquery( "CREATE TABLE IF NOT EXISTS {{table}} ( LIKE {{table}}_s );", 'galaxy');
doquery( "CREATE TABLE IF NOT EXISTS {{table}} ( LIKE {{table}}_s );", 'banned');
// Vider toutes les tables !
doquery( "TRUNCATE TABLE {{table}}", 'aks');
doquery( "TRUNCATE TABLE {{table}}", 'alliance');
doquery( "TRUNCATE TABLE {{table}}", 'annonce');
doquery( "TRUNCATE TABLE {{table}}", 'banned');
doquery( "TRUNCATE TABLE {{table}}", 'buddy');
doquery( "TRUNCATE TABLE {{table}}", 'chat');
doquery( "TRUNCATE TABLE {{table}}", 'galaxy');
doquery( "TRUNCATE TABLE {{table}}", 'errors');
doquery( "TRUNCATE TABLE {{table}}", 'fleets');
doquery( "TRUNCATE TABLE {{table}}", 'iraks');
doquery( "TRUNCATE TABLE {{table}}", 'lunas');
doquery( "TRUNCATE TABLE {{table}}", 'messages');
doquery( "TRUNCATE TABLE {{table}}", 'notes');
doquery( "TRUNCATE TABLE {{table}}", 'rw');
doquery( "TRUNCATE TABLE {{table}}", 'statpoints');
$AllUsers = doquery ("SELECT `username`,`password`,`email`, `email_2`,`authlevel`,`galaxy`,`system`,`planet`, `sex`, `dpath`, `onlinetime`, `register_time`, `id_planet` FROM {{table}} WHERE 1;", 'users_s');
$LimitTime = time() - (15 * (24 * (60 * 60)));
$TransUser = 0;
while ( $TheUser = mysql_fetch_assoc($AllUsers) ) {
if ( $TheUser['onlinetime'] > $LimitTime ) {
$UserPlanet = doquery ("SELECT `name` FROM {{table}} WHERE `id` = '". $TheUser['id_planet']."';", 'planets_s', true);
if ($UserPlanet['name'] != "") {
// Creation de l'utilisateur
$QryInsertUser = "INSERT INTO {{table}} SET ";
$QryInsertUser .= "`username` = '". $TheUser['username'] ."', ";
$QryInsertUser .= "`email` = '". $TheUser['email'] ."', ";
$QryInsertUser .= "`email_2` = '". $TheUser['email_2'] ."', ";
$QryInsertUser .= "`sex` = '". $TheUser['sex'] ."', ";
$QryInsertUser .= "`id_planet` = '0', ";
$QryInsertUser .= "`authlevel` = '". $TheUser['authlevel'] ."', ";
$QryInsertUser .= "`dpath` = '". $TheUser['dpath'] ."', ";
$QryInsertUser .= "`galaxy` = '". $TheUser['galaxy'] ."', ";
$QryInsertUser .= "`system` = '". $TheUser['system'] ."', ";
$QryInsertUser .= "`planet` = '". $TheUser['planet'] ."', ";
$QryInsertUser .= "`register_time` = '". $TheUser['register_time'] ."', ";
$QryInsertUser .= "`password` = '". $TheUser['password'] ."';";
doquery( $QryInsertUser, 'users');
// On cherche le numero d'enregistrement de l'utilisateur fraichement cr<63><72>
$NewUser = doquery("SELECT `id` FROM {{table}} WHERE `username` = '". $TheUser['username'] ."' LIMIT 1;", 'users', true);
CreateOnePlanetRecord ($TheUser['galaxy'], $TheUser['system'], $TheUser['planet'], $NewUser['id'], $UserPlanet['name'], true);
// Recherche de la reference de la nouvelle planete (qui est unique normalement !
$PlanetID = doquery("SELECT `id` FROM {{table}} WHERE `id_owner` = '". $NewUser['id'] ."' LIMIT 1;", 'planets', true);
// Mise a jour de l'enregistrement utilisateur avec les infos de sa planete mere
$QryUpdateUser = "UPDATE {{table}} SET ";
$QryUpdateUser .= "`id_planet` = '". $PlanetID['id'] ."', ";
$QryUpdateUser .= "`current_planet` = '". $PlanetID['id'] ."' ";
$QryUpdateUser .= "WHERE ";
$QryUpdateUser .= "`id` = '". $NewUser['id'] ."';";
doquery( $QryUpdateUser, 'users');
$TransUser++;
}
}
} // while
// Mise a jour du nombre de joueurs inscripts
doquery("UPDATE {{table}} SET `config_value` = '". $TransUser ."' WHERE `config_name` = 'users_amount' LIMIT 1;", 'config');
// Menage on vire les tables transitoires
doquery("DROP TABLE {{table}}", 'planets_s');
doquery("DROP TABLE {{table}}", 'users_s');
AdminMessage ( $TransUser . $lang['adm_rz_done'], $lang['adm_rz_ttle'] );
} else {
AdminMessage ( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
}
return $Page;
}
$mode = $_POST['mode'];
$PageTpl = gettemplate("admin/reset_body");
$parse = $lang;
if ($mode == 'reset') {
WootookResetUnivers ( $user );
} else {
$Page = parsetemplate($PageTpl, $parse);
display ($Page, $lang['Reset'], false, '', true);
}
?>

View file

@ -1,67 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
* All rights reserved.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
define('IN_ADMIN', true);
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
$user = Wootook_Player_Model_Session::getSingleton()->getPlayer();
if (!in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR))) {
message( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
exit(0);
}
includeLang('admin');
$parse = $lang;
$parse['dpath'] = $dpath;
$parse['mf'] = $mf;
$PageTPL = gettemplate('admin/activeplanet_body');
$AllActivPlanet = doquery("SELECT * FROM {{table}} WHERE `last_update` >= '". (time()-15 * 60) ."' ORDER BY `id` ASC", 'planets');
$Count = 0;
while ($ActivPlanet = $AllActivPlanet->fetch(PDO::FETCH_BOTH)) {
$parse['online_list'] .= "<tr>";
$parse['online_list'] .= "<td class=b><center><b>". $ActivPlanet['name'] ."</b></center></td>";
$parse['online_list'] .= "<td class=b><center><b>[". $ActivPlanet['galaxy'] .":". $ActivPlanet['system'] .":". $ActivPlanet['planet'] ."]</b></center></td>";
$parse['online_list'] .= "<td class=m><center><b>". pretty_number($ActivPlanet['points'] / 1000) ."</b></center></td>";
$parse['online_list'] .= "<td class=b><center><b>". pretty_time(time() - $ActivPlanet['last_update']) . "</b></center></td>";
$parse['online_list'] .= "</tr>";
$Count++;
}
$parse['online_list'] .= "<tr>";
$parse['online_list'] .= "<th class=\"b\" colspan=\"4\">". $lang['adm_pl_they'] ." ". $Count ." ". $lang['adm_pl_apla'] ."</th>";
$parse['online_list'] .= "</tr>";
$page = parsetemplate( $PageTPL , $parse );
display( $page, $lang['adm_pl_title'], false, '', true );

View file

@ -1,103 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
* All rights reserved.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
define('IN_ADMIN', true);
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
$user = Wootook_Player_Model_Session::getSingleton()->getPlayer();
if (!in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR))) {
message( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
exit(0);
}
includeLang('admin/add_fleet');
$mode = $_GET['mode'];
if($mode != 'add') {
$parse['ID'] = $lang['Id'];
$parse['Cle'] = $lang['cle'];
$parse['Clourd'] = $lang['clourd'];
$parse['Pt'] = $lang['pt'];
$parse['Gt'] = $lang['gt'];
$parse['Cruise'] = $lang['cruise'];
$parse['Vb'] = $lang['vb'];
$parse['Colo'] = $lang['colo'];
$parse['Rc'] = $lang['rc'];
$parse['Spy'] = $lang['spy'];
$parse['Bomb'] = $lang['bomb'];
$parse['Solar'] = $lang['solar'];
$parse['Des'] = $lang['des'];
$parse['Rip'] = $lang['rip'];
$parse['Traq'] = $lang['traq'];
} else if($mode == 'add') {
$id = $_POST['id'];
$cle = $_POST['cle'];
$clourd = $_POST['clourd'];
$pt = $_POST['pt'];
$gt = $_POST['gt'];
$cruise = $_POST['cruise'];
$vb = $_POST['vb'];
$colo = $_POST['colo'];
$rc = $_POST['rc'];
$spy = $_POST['spy'];
$bomb = $_POST['bomb'];
$solar = $_POST['solar'];
$des = $_POST['des'];
$rip = $_POST['rip'];
$traq = $_POST['traq'];
$SqlAdd = "UPDATE {{table}} SET";
$SqlAdd .= "`light_hunter` = '".$cle."+light_hunter', ";
$SqlAdd .= "`heavy_hunter` = '".$clourd."+heavy_hunter', ";
$SqlAdd .= "`small_ship_cargo` = '".$pt."+small_ship_cargo', ";
$SqlAdd .= "`big_ship_cargo` = '".$gt."+big_ship_cargo', ";
$SqlAdd .= "`crusher` = '".$cruise."+crusher', ";
$SqlAdd .= "`battle_ship` = '".$vb."+battle_ship', ";
$SqlAdd .= "`colonizer` = '".$colo."+colonizer', ";
$SqlAdd .= "`recycler` = '".$rc."+recycler', ";
$SqlAdd .= "`spy_sonde`= '".$spy."+spy_sonde', ";
$SqlAdd .= "`bomber_ship` = '".$bomb."+bomber_ship', ";
$SqlAdd .= "`solar_satelit` = '".$solar."+solar_satelit', ";
$SqlAdd .= "`destructor` = '".$des."+destructor', ";
$SqlAdd .= "`dearth_star` = '".$rip."+dearth_star', ";
$SqlAdd .= "`battleship` = '".$traq."+battleship', ";
$SqlAdd .= " WHERE `id` = '".$id."' LIMIT 1";
doquery($SqlAdd, "planets");
message('Ajout OK');
}
$page = parsetemplate(gettemplate('admin/add_fleet'), $parse);
display( $page);

View file

@ -1,68 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
* All rights reserved.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
define('IN_ADMIN', true);
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
$user = Wootook_Player_Model_Session::getSingleton()->getPlayer();
if (!in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR))) {
message( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
exit(0);
}
includeLang('admin');
$mode = $_POST['mode'];
$PageTpl = gettemplate("admin/add_money");
$parse = $lang;
if ($mode == 'addit') {
$id = $_POST['id'];
$metal = $_POST['metal'];
$cristal = $_POST['cristal'];
$deut = $_POST['deut'];
$QryUpdatePlanet = "UPDATE {{table}} SET ";
$QryUpdatePlanet .= "`metal` = `metal` + '". $metal ."', ";
$QryUpdatePlanet .= "`crystal` = `crystal` + '". $cristal ."', ";
$QryUpdatePlanet .= "`deuterium` = `deuterium` + '". $deut ."' ";
$QryUpdatePlanet .= "WHERE ";
$QryUpdatePlanet .= "`id` = '". $id ."' ";
doquery( $QryUpdatePlanet, "planets");
AdminMessage ( $lang['adm_am_done'], $lang['adm_am_ttle'] );
}
$Page = parsetemplate($PageTpl, $parse);
display ($Page, $lang['adm_am_ttle'], false, '', true);

View file

@ -1,69 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
* All rights reserved.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
define('IN_ADMIN', true);
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR))) {
includeLang('admin/addmoon');
$mode = $_POST['mode'];
$PageTpl = gettemplate("admin/add_moon");
$parse = $lang;
if ($mode == 'addit') {
$PlanetID = $_POST['user'];
$MoonName = $_POST['name'];
$QrySelectPlanet = "SELECT * FROM {{table}} ";
$QrySelectPlanet .= "WHERE ";
$QrySelectPlanet .= "`id` = '". $PlanetID ."';";
$PlanetSelected = doquery ( $QrySelectPlanet, 'planets', true);
$Galaxy = $PlanetSelected['galaxy'];
$System = $PlanetSelected['system'];
$Planet = $PlanetSelected['planet'];
$Owner = $PlanetSelected['id_owner'];
$MoonID = time();
CreateOneMoonRecord ( $Galaxy, $System, $Planet, $Owner, $MoonID, $MoonName, 20 );
AdminMessage ( $lang['addm_done'], $lang['addm_title'] );
}
$Page = parsetemplate($PageTpl, $parse);
display ($Page, $lang['addm_title'], false, '', true);
} else {
AdminMessage ( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
}
?>

View file

@ -1,47 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
* All rights reserved.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
define('IN_ADMIN', true);
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
if (in_array($user['authlevel'], array(LEVEL_ADMIN))) {
doquery("UPDATE {{table}} SET `banaday` =` banaday` - '1' WHERE `banaday` != '0';",'users');
doquery("UPDATE {{table}} SET `bana` = '0' WHERE `banaday` < '1';",'users');
$response = Wootook::getResponse()
->setRedirect(Wootook::getStaticUrl('admin/overview.php'))
->sendHeaders();
exit(0);
} else {
message ( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
}

View file

@ -1,89 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
* All rights reserved.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
define('IN_ADMIN', true);
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) {
includeLang('admin');
$mode = $_POST['mode'];
$PageTpl = gettemplate("admin/banned");
$parse = $lang;
if ($mode == 'banit') {
$name = $_POST['name'];
$reas = $_POST['why'];
$days = $_POST['days'];
$hour = $_POST['hour'];
$mins = $_POST['mins'];
$secs = $_POST['secs'];
$admin = $user['username'];
$mail = $user['email'];
$Now = time();
$BanTime = $days * 86400;
$BanTime += $hour * 3600;
$BanTime += $mins * 60;
$BanTime += $secs;
$BannedUntil = $Now + $BanTime;
$QryInsertBan = "INSERT INTO {{table}} SET ";
$QryInsertBan .= "`who` = \"". $name ."\", ";
$QryInsertBan .= "`theme` = '". $reas ."', ";
$QryInsertBan .= "`who2` = '". $name ."', ";
$QryInsertBan .= "`time` = '". $Now ."', ";
$QryInsertBan .= "`longer` = '". $BannedUntil ."', ";
$QryInsertBan .= "`author` = '". $admin ."', ";
$QryInsertBan .= "`email` = '". $mail ."';";
doquery( $QryInsertBan, 'banned');
$QryUpdateUser = "UPDATE {{table}} SET ";
$QryUpdateUser .= "`bana` = '1', ";
$QryUpdateUser .= "`banaday` = '". $BannedUntil ."' ";
$QryUpdateUser .= "WHERE ";
$QryUpdateUser .= "`username` = \"". $name ."\";";
doquery( $QryUpdateUser, 'users');
$DoneMessage = $lang['adm_bn_thpl'] ." ". $name ." ". $lang['adm_bn_isbn'];
AdminMessage ($DoneMessage, $lang['adm_bn_ttle']);
}
$Page = parsetemplate($PageTpl, $parse);
display( $Page, $lang['adm_bn_ttle'], false, '', true);
} else {
AdminMessage ($lang['sys_noalloaw'], $lang['sys_noaccess']);
}
?>

View file

@ -1,56 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
* All rights reserved.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
define('IN_ADMIN', true);
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
includeLang('changelog');
$template = gettemplate('changelog_table');
$parse = $lang;
foreach($lang['changelog'] as $a => $b)
{
$parse['version_number'] = $a;
$parse['description'] = nl2br($b);
$body .= parsetemplate($template, $parse);
}
$parse['body'] = $body;
$page .= parsetemplate(gettemplate('changelog_body'), $parse);
display( $page, "Changelog", false, '', true);
?>

View file

@ -1,66 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
* All rights reserved.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
define('IN_ADMIN', true);
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
includeLang('admin');
$parse = $lang;
if (in_array($user['authlevel'], array(LEVEL_ADMIN))) {
// Système de suppression
extract($_GET);
if (isset($delete)) {
doquery("DELETE FROM {{table}} WHERE `messageid`=$delete", 'chat');
} elseif ($deleteall == 'yes') {
doquery("DELETE FROM {{table}}", 'chat');
}
// Affichage des messages
$query = doquery("SELECT * FROM {{table}} ORDER BY messageid DESC LIMIT 25", 'chat');
$i = 0;
while ($e = $query->fetch(PDO::FETCH_BOTH)) {
$i++;
$parse['msg_list'] .= stripslashes("<tr><th class=b>" . date('h:i:s', $e['timestamp']) . "</th>".
"<th class=b>". $e['user'] . "</th>".
"<td class=b>" . nl2br($e['message']) . "</td>".
"<th class=b><a href=?delete=".$e['messageid']."><img src=\"../images/r1.png\" border=\"0\"></a></th></tr>");
}
$parse['msg_list'] .= "<tr><th class=b colspan=4>{$i} ".$lang['adm_ch_nbs']."</th></tr>";
display(parsetemplate(gettemplate('admin/chat_body'), $parse), "Chat", false, '', true);
} else {
message( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
}
?>

View file

@ -1,73 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
* All rights reserved.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
define('IN_ADMIN', true);
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
includeLang('credit');
$parse = $lang;
if (in_array($user['authlevel'], array(LEVEL_ADMIN))) {
if ($_POST['opt_save'] == "1") {
// Extended copyright is activated?
if (isset($_POST['ExtCopyFrame']) && $_POST['ExtCopyFrame'] == 'on') {
$gameConfig['ExtCopyFrame'] = "1";
$gameConfig['ExtCopyOwner'] = $_POST['ExtCopyOwner'];
$gameConfig['ExtCopyFunct'] = $_POST['ExtCopyFunct'];
} else {
$gameConfig['ExtCopyFrame'] = "0";
$gameConfig['ExtCopyOwner'] = "";
$gameConfig['ExtCopyFunct'] = "";
}
// Update values
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['ExtCopyFrame'] ."' WHERE `config_name` = 'ExtCopyFrame';", 'config');
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['ExtCopyOwner'] ."' WHERE `config_name` = 'ExtCopyOwner';", 'config');
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['ExtCopyFunct'] ."' WHERE `config_name` = 'ExtCopyFunct';", 'config');
AdminMessage ($lang['cred_done'], $lang['cred_ext']);
} else {
//View values
$parse['ExtCopyFrame'] = ($gameConfig['ExtCopyFrame'] == 1) ? " checked = 'checked' ":"";
$parse['ExtCopyOwnerVal'] = $gameConfig['ExtCopyOwner'];
$parse['ExtCopyFunctVal'] = $gameConfig['ExtCopyFunct'];
$BodyTPL = gettemplate('admin/credit_body');
$page = parsetemplate($BodyTPL, $parse);
display($page, $lang['cred_credit'], false);
}
} else {
message( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
}
?>

View file

@ -1,87 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
* All rights reserved.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
define('IN_ADMIN', true);
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR))) {
includeLang('admin');
if ($_GET['cmd'] == 'dele') {
$player = new Wootook_Player_Model_Entity();
$player->load(intval($_GET['user']));
if ($player->getId()) {
$player->delete();
}
}
if ($_GET['cmd'] == 'sort') {
$TypeSort = $_GET['type'];
} else {
$TypeSort = "id";
}
$PageTPL = gettemplate('admin/declarelist_body');
$RowsTPL = gettemplate('admin/declarelist_rows');
$query = doquery("SELECT * FROM {{table}} ORDER BY `declarator` DESC", 'declared');
$parse = $lang;
$parse['adm_ul_table'] = "";
$i = 0;
$Color = "lime";
while ($u = $query->fetch(PDO::FETCH_ASSOC) ) {
if ($PrevIP != "") {
if ($PrevIP == $u['declarator']) {
$Color = "red";
} else {
$Color = "lime";
}
}
$Bloc['adm_ul_data_id'] = stripslashes($u['declarator_name']);
$Bloc['adm_ul_data_name'] = stripslashes($u['declarator']);
$Bloc['adm_ul_data_mail'] = stripslashes($u['declared_1']);
$Bloc['adm_ul_data_adip'] = stripslashes($u['declared_2']);
$Bloc['adm_ul_data_detai'] = stripslashes($u['declared_3']);
$Bloc['adm_ul_data_regd'] = stripslashes($u['reason']);
$parse['adm_ul_table'] .= parsetemplate( $RowsTPL, $Bloc );
$i++;
}
$parse['adm_ul_count'] = $i;
$page = parsetemplate( $PageTPL, $parse );
display( $page, "Liste des joueurs ayant declare une IP collective", false, '', true);
} else {
message( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
}
?>

View file

@ -1,50 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
* All rights reserved.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
define('IN_ADMIN', true);
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
if (in_array($CurrentUser['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR))) {
$PageTpl = gettemplate( "admin/deletuser" );
if ( $mode != "delet" ) {
$parse['adm_bt_delet'] = $lang['adm_bt_delet'];
}
$Page = parsetemplate( $PageTpl, $parse );
display ( $Page, $lang['adminpanel'], false, '', true );
} else {
message( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
}
?>

View file

@ -1,70 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
* All rights reserved.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
define('IN_ADMIN', true);
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
includeLang('admin');
$parse = $lang;
if (in_array($user['authlevel'], array(LEVEL_ADMIN))) {
// Supprimer les erreurs
extract($_GET);
if (isset($delete)) {
doquery("DELETE FROM {{table}} WHERE `error_id`=$delete", 'errors');
} elseif ($deleteall == 'yes') {
doquery("TRUNCATE TABLE {{table}}", 'errors');
}
// Afficher les erreurs
$query = doquery("SELECT * FROM {{table}}", 'errors');
$i = 0;
while ($u = $query->fetch(PDO::FETCH_BOTH)) {
$i++;
$parse['errors_list'] .= "
<tr><td width=\"25\" class=n>". $u['error_id'] ."</td>
<td width=\"170\" class=n>". $u['error_type'] ."</td>
<td width=\"230\" class=n>". date('d/m/Y h:i:s', $u['error_time']) ."</td>
<td width=\"95\" class=n><a href=\"?delete=". $u['error_id'] ."\"><img src=\"../images/r1.png\"></a></td></tr>
<tr><td colspan=\"4\" class=b>". nl2br($u['error_text'])."</td></tr>";
}
$parse['errors_list'] .= "<tr>
<th class=b colspan=5>". $i ." ". $lang['adm_er_nbs'] ."</th>
</tr>";
display(parsetemplate(gettemplate('admin/errors_body'), $parse), "Bledy", false, '', true);
} else {
message( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
}
?>

View file

@ -1,50 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
* All rights reserved.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
define('IN_ADMIN', true);
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
includeLang('leftmenu');
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) {
$parse = $lang;
$parse['mf'] = "Hauptframe";
$parse['dpath'] = $dpath;
$parse['WootookRelease'] = VERSION;
$parse['servername'] = 'Wootook';
$Page = parsetemplate(gettemplate('admin/left_menu'), $parse);
display($Page, "", false, '', true);
} else {
message( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
}
?>

View file

@ -1,60 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
* All rights reserved.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
define('IN_ADMIN', true);
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) {
includeLang('admin/changepass');
$parse = $lang;
if ($_POST['md5q'] != "") {
doquery ("UPDATE {{table}} SET `password` = '" . md5 ($_POST['md5q']) . "' WHERE `username` = '".$_POST['user']."';", 'users');
//$QueryUpdatePass = "UPDATE {{table}} SET ";
//$QueryUpdatePass .= "`password` = '" . md5 ($_POST['md5q']) . "', ";
//$QueryUpdatePass = "WHERE ";
//$QueryUpdatePass .= "`username`=" . $_POST['user'] . "";
// doquery($QueryUpdatePass, 'users');
} else {
}
$PageTpl = gettemplate("admin/changepass");
$Page = parsetemplate( $PageTpl, $parse);
display( $Page, $lang['md5_title'], false, '', true );
} else {
message( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
}
?>

View file

@ -1,57 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
* All rights reserved.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
define('IN_ADMIN', true);
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) {
includeLang('admin/md5enc');
$parse = $lang;
if ($_POST['md5q'] != "") {
$parse['md5_md5'] = $_POST['md5q'];
$parse['md5_enc'] = md5 ($_POST['md5q']);
} else {
$parse['md5_md5'] = "";
$parse['md5_enc'] = md5 ("");
}
$PageTpl = gettemplate("admin/md5enc");
$Page = parsetemplate( $PageTpl, $parse);
display( $Page, $lang['md5_title'], false, '', true );
} else {
message( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
}
?>

View file

@ -1,148 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
* All rights reserved.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
define('IN_ADMIN', true);
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR))) {
includeLang('admin/messagelist');
$BodyTpl = gettemplate('admin/messagelist_body');
$RowsTpl = gettemplate('admin/messagelist_table_rows');
$Prev = ( !empty($_POST['prev']) ) ? true : false;
$Next = ( !empty($_POST['next']) ) ? true : false;
$DelSel = ( !empty($_POST['delsel']) ) ? true : false;
$DelDat = ( !empty($_POST['deldat']) ) ? true : false;
$CurrPage = ( !empty($_POST['curr']) ) ? $_POST['curr'] : 1;
$Selected = ( !empty($_POST['sele']) ) ? $_POST['sele'] : 0;
$SelType = $_POST['type'];
$SelPage = $_POST['page'];
$ViewPage = 1;
if ( $Selected != $SelType ) {
$Selected = $SelType;
$ViewPage = 1;
} elseif ( $CurrPage != $SelPage ) {
$ViewPage = ( !empty($SelPage) ) ? $SelPage : 1;
}
if ($Prev == true) {
$CurrPage -= 1;
if ($CurrPage >= 1) {
$ViewPage = $CurrPage;
} else {
$ViewPage = 1;
}
} elseif ($Next == true) {
$Mess = doquery("SELECT COUNT(*) AS `max` FROM {{table}} WHERE `message_type` = '". $Selected ."';", 'messages', true);
$MaxPage = ceil ( ($Mess['max'] / 25) );
$CurrPage += 1;
if ($CurrPage <= $MaxPage) {
$ViewPage = $CurrPage;
} else {
$ViewPage = $MaxPage;
}
} elseif ($DelSel == true) {
foreach($_POST['sele'] as $MessId => $Value) {
if ($Value = "on") {
doquery ( "DELETE FROM {{table}} WHERE `message_id` = '". $MessId ."';", 'messages');
}
}
} elseif ($DelDat == true) {
$SelDay = $_POST['selday'];
$SelMonth = $_POST['selmonth'];
$SelYear = $_POST['selyear'];
$LimitDate = mktime (0,0,0, $SelMonth, $SelDay, $SelYear );
if ($LimitDate != false) {
doquery ( "DELETE FROM {{table}} WHERE `message_time` <= '". $LimitDate ."';", 'messages');
doquery ( "DELETE FROM {{table}} WHERE `time` <= '". $LimitDate ."';", 'rw');
}
}
$Mess = doquery("SELECT COUNT(*) AS `max` FROM {{table}} WHERE `message_type` = '". $Selected ."';", 'messages', true);
$MaxPage = ceil ( ($Mess['max'] / 25) );
$parse = $lang;
$parse['mlst_data_page'] = $ViewPage;
$parse['mlst_data_pagemax'] = $MaxPage;
$parse['mlst_data_sele'] = $Selected;
$parse['mlst_data_types'] = "<option value=\"0\"". (($Selected == "0") ? " SELECTED" : "") .">". $lang['mlst_mess_typ__0'] ."</option>";
$parse['mlst_data_types'] .= "<option value=\"1\"". (($Selected == "1") ? " SELECTED" : "") .">". $lang['mlst_mess_typ__1'] ."</option>";
$parse['mlst_data_types'] .= "<option value=\"2\"". (($Selected == "2") ? " SELECTED" : "") .">". $lang['mlst_mess_typ__2'] ."</option>";
$parse['mlst_data_types'] .= "<option value=\"3\"". (($Selected == "3") ? " SELECTED" : "") .">". $lang['mlst_mess_typ__3'] ."</option>";
$parse['mlst_data_types'] .= "<option value=\"4\"". (($Selected == "4") ? " SELECTED" : "") .">". $lang['mlst_mess_typ__4'] ."</option>";
$parse['mlst_data_types'] .= "<option value=\"5\"". (($Selected == "5") ? " SELECTED" : "") .">". $lang['mlst_mess_typ__5'] ."</option>";
$parse['mlst_data_types'] .= "<option value=\"15\"". (($Selected == "15") ? " SELECTED" : "") .">". $lang['mlst_mess_typ_15'] ."</option>";
$parse['mlst_data_types'] .= "<option value=\"99\"". (($Selected == "99") ? " SELECTED" : "") .">". $lang['mlst_mess_typ_99'] ."</option>";
$parse['mlst_data_pages'] = "";
for ( $cPage = 1; $cPage <= $MaxPage; $cPage++ ) {
$parse['mlst_data_pages'] .= "<option value=\"".$cPage."\"". (($ViewPage == $cPage) ? " SELECTED" : "") .">". $cPage ."/". $MaxPage ."</option>";
}
$parse['mlst_scpt'] = "<script language=\"JavaScript\">\n";
$parse['mlst_scpt'] .= "function f(target_url, win_name) {\n";
$parse['mlst_scpt'] .= "var new_win = window.open(target_url,win_name,'resizable=yes,scrollbars=yes,menubar=no,toolbar=no,width=550,height=280,top=0,left=0');\n";
$parse['mlst_scpt'] .= "new_win.focus();\n";
$parse['mlst_scpt'] .= "}\n";
$parse['mlst_scpt'] .= "</script>\n";
$parse['tbl_rows'] = "";
$parse['mlst_title'] = $lang['mlst_title'];
$StartRec = 1 + (($ViewPage - 1) * 25);
$Messages = doquery("SELECT * FROM {{table}} WHERE `message_type` = '". $Selected ."' ORDER BY `message_time` DESC LIMIT ". $StartRec .",25;", 'messages');
while ($row = $Messages->fetch(PDO::FETCH_ASSOC)) {
$OwnerData = doquery ("SELECT `username` FROM {{table}} WHERE `id` = '". $row['message_owner'] ."';", 'users',true);
$bloc['mlst_id'] = $row['message_id'];
$bloc['mlst_from'] = $row['message_from'];
$bloc['mlst_to'] = $OwnerData['username'] ." ID:". $row['message_owner'];
$bloc['mlst_text'] = $row['message_text'];
$bloc['mlst_time'] = gmdate ( "d. M Y H:i:s", $row['message_time'] );
$parse['mlst_data_rows'] .= parsetemplate($RowsTpl , $bloc);
}
$display = parsetemplate($BodyTpl , $parse);
if (isset($_POST['delit'])) {
doquery ("DELETE FROM {{table}} WHERE `message_id` = '". $_POST['delit'] ."';", 'messages');
AdminMessage ( $lang['mlst_mess_del'] ." ( ". $_POST['delit'] ." )", $lang['mlst_title'], "./messagelist.".PHPEXT, 3);
}
display ($display, $lang['mlst_title'], false, '', true);
} else {
message($lang['sys_noalloaw'], $lang['sys_noaccess']);
}
?>

View file

@ -1,75 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
* All rights reserved.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
define('IN_ADMIN', true);
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) {
if (!empty($_POST)) {
if (isset($_POST["tresc"]) && $_POST["tresc"] != '') {
$tresc = $_POST['tresc'];
}
if (isset($_POST["temat"]) && $_POST["temat"] != '') {
$temat = $_POST['temat'];
}
if ($user['authlevel'] == LEVEL_ADMIN) {
$kolor = 'red';
$ranga = 'Administrator';
} elseif ($user['authlevel'] == LEVEL_OPERATOR) {
$kolor = 'skyblue';
$ranga = 'Operator';
} elseif ($user['authlevel'] == LEVEL_MODERATOR) {
$kolor = 'yellow';
$ranga = 'Moderator';
}
if (isset($tresc) && isset($temat)) {
$sq = doquery("SELECT `id` FROM {{table}}", "users");
$Time = time();
$From = "<font color=\"". $kolor ."\">". $ranga ." ".$user['username']."</font>";
$Subject = "<font color=\"". $kolor ."\">". $temat ."</font>";
$Message = "<font color=\"". $kolor ."\"><b>". $tresc ."</b></font>";
while ($u = $sq->fetch(PDO::FETCH_BOTH)) {
SendSimpleMessage($u['id'], $user['id'], $Time, 97, $From, $Subject, $Message);
}
message("<font color=\"lime\">Wys<79>a<EFBFBD>e<EFBFBD> wiadomo<6D><6F> do wszystkich graczy</font>", "Complete", "../overview." . PHPEXT, 3);
}
} else {
$parse = array();
$parse['dpath'] = $dpath;
$parse['debug'] = (defined('DEBUG')) ? " checked='checked'/":'';
$page .= parsetemplate(gettemplate('admin/messall_body'), $parse);
display($page, '', false,'', true);
}
} else {
message($lang['sys_noalloaw'], $lang['sys_noaccess']);
}

View file

@ -1,62 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
* All rights reserved.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
define('IN_ADMIN', true);
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR))) {
includeLang('overview');
$parse = $lang;
$query = doquery("SELECT * FROM {{table}} WHERE planet_type='3'", "planets");
$i = 0;
while ($u = $query->fetch(PDO::FETCH_BOTH)) {
$parse['moon'] .= "<tr>"
. "<td class=b><center><b>" . $u[0] . "</center></b></td>"
. "<td class=b><center><b>" . $u[1] . "</center></b></td>"
. "<td class=b><center><b>" . $u[2] . "</center></b></td>"
. "<td class=b><center><b>" . $u[4] . "</center></b></td>"
. "<td class=b><center><b>" . $u[5] . "</center></b></td>"
. "<td class=b><center><b>" . $u[6] . "</center></b></td>"
. "</tr>";
$i++;
}
if ($i == "1")
$parse['moon'] .= "<tr><th class=b colspan=6>Il y a qu'une seule lune</th></tr>";
else
$parse['moon'] .= "<tr><th class=b colspan=6>Il y a {$i} lunes</th></tr>";
display(parsetemplate(gettemplate('admin/moonlist_body'), $parse), 'Lunalist' , false, '', true);
} else {
message( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
}
?>

View file

@ -1,65 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
* All rights reserved.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
define('IN_ADMIN', true);
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) {
includeLang('admin/multi');
$query = doquery("SELECT * FROM {{table}}", 'multi');
$parse = $lang;
$parse['adm_mt_table'] = "";
$i = 0;
$RowsTPL = gettemplate('admin/multi_rows');
$PageTPL = gettemplate('admin/multi_body');
while ($infos = $query->fetch(PDO::FETCH_ASSOC)) {
$Bloc['player'] = $infos['player'];
$Bloc['text'] = $infos['text'];
$parse['adm_mt_table'] .= parsetemplate( $RowsTPL, $Bloc );
$i++;
}
$parse['adm_mt_count'] = $i;
$page = parsetemplate( $PageTPL, $parse );
display( $page, $lang['adm_mt_title'], false, '', true);
} else {
message( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
}
?>

View file

@ -1,114 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
* All rights reserved.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
define('IN_ADMIN', true);
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) {
includeLang('admin');
if (isset($_GET['cmd']) && isset($_GET['type']) && $_GET['cmd'] == 'sort') {
$TypeSort = $_GET['type'];
} else {
$TypeSort = "id";
}
$PageTPL = gettemplate('admin/overview_body');
$RowsTPL = gettemplate('admin/overview_rows');
$parse = $lang;
$parse['version'] = VERSION;
$Last15Mins = doquery("SELECT * FROM {{table}} WHERE `onlinetime` >= '". (time() - 15 * 60) ."' ORDER BY `". $TypeSort ."` ASC;", 'users');
$Count = 0;
$Color = "lime";
$PrevIP = '';
$parse['adm_ov_data_table'] = '';
while ($TheUser = $Last15Mins->fetch(PDO::FETCH_ASSOC) ) {
if ($PrevIP != "") {
if ($PrevIP == $TheUser['user_lastip']) {
$Color = "red";
} else {
$Color = "lime";
}
}
$UserPoints = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '" . $TheUser['id'] . "';", 'statpoints', true);
$Bloc['adm_ov_altpm'] = $lang['adm_ov_altpm'];
$Bloc['adm_ov_wrtpm'] = $lang['adm_ov_wrtpm'];
$Bloc['adm_ov_data_id'] = $TheUser['id'];
$Bloc['adm_ov_data_name'] = $TheUser['username'];
$Bloc['adm_ov_data_agen'] = $TheUser['user_agent'];
$Bloc['current_page'] = $TheUser['current_page'];
$Bloc['usr_s_id'] = $TheUser['id'];
$Bloc['adm_ov_data_clip'] = $Color;
$Bloc['adm_ov_data_adip'] = $TheUser['user_lastip'];
$Bloc['adm_ov_data_ally'] = $TheUser['ally_name'];
$Bloc['adm_ov_data_point'] = pretty_number ( $UserPoints['total_points'] );
$Bloc['adm_ov_data_activ'] = pretty_time ( time() - $TheUser['onlinetime'] );
$Bloc['adm_ov_data_pict'] = "m.gif";
$PrevIP = $TheUser['user_lastip'];
//Tweaks vue g<>n<EFBFBD>rale
$Bloc['usr_email'] = $TheUser['email'];
$Bloc['usr_xp_raid'] = $TheUser['xpraid'];
$Bloc['usr_xp_min'] = $TheUser['xpminier'];
if ($TheUser['urlaubs_modus'] == 1) {
$Bloc['state_vacancy'] = "<img src=\"../images/true.png\" >";
} else {
$Bloc['state_vacancy'] = "<img src=\"../images/false.png\">";
}
if ($TheUser['bana'] == 1) {
$Bloc['is_banned'] = "<img src=\"../images/banned.png\" >";
} else {
$Bloc['is_banned'] = $lang['is_banned_lang'];
}
$Bloc['usr_planet_gal'] = $TheUser['galaxy'];
$Bloc['usr_planet_sys'] = $TheUser['system'];
$Bloc['usr_planet_pos'] = $TheUser['planet'];
$parse['adm_ov_data_table'] .= parsetemplate( $RowsTPL, $Bloc );
$Count++;
}
$parse['adm_ov_data_count'] = $Count;
$Page = parsetemplate($PageTPL, $parse);
display( $Page, $lang['sys_overview'], false, '', true);
} else {
AdminMessage ( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
}

View file

@ -1,236 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
* All rights reserved.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
define('IN_ADMIN', true);
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) {
includeLang('admin/adminpanel');
$PanelMainTPL = gettemplate('admin/admin_panel_main');
$parse = $lang;
$parse['adm_sub_form1'] = "";
$parse['adm_sub_form2'] = "";
$parse['adm_sub_form3'] = "";
// Afficher les templates
if (isset($_GET['result'])) {
switch ($_GET['result']){
case 'usr_search':
$db = Legacies_Database::getSingleton();
$sql =<<<SQL_EOF
SELECT
planet.id AS planet_id,
planet.name AS planet_name,
planet.galaxy AS planet_galaxy,
planet.system AS planet_system,
planet.planet AS planet_position,
user.id AS user_id,
user.username AS username,
user.user_lastip AS user_lastip,
user.email AS email,
user.authlevel AS authlevel,
user.sex AS sex
FROM {{table}}planets AS planet
INNER JOIN {{table}}users AS user ON user.id_planet=planet.id
WHERE user.id = {$db->quote('%' . str_replace('*', '%', str_replace('%', '%%', $_GET['player'])) . '%')}"
SQL_EOF;
$statement = $db->prepare($sql);
$statement->execute();
$data = $statement->fetch(PDO::FETCH_ASSOC);
$bloc = $lang;
$bloc['answer1'] = $data['user_id'];
$bloc['answer2'] = $data['username'];
$bloc['answer3'] = $data['user_lastip'];
$bloc['answer4'] = $data['email'];
$bloc['answer5'] = $lang['adm_usr_level'][$data['authlevel']];
$bloc['answer6'] = $lang['adm_usr_genre'][$data['sex']];
$bloc['answer7'] = "[".$data['planet_id']."] {$data['planet_name']}";
$bloc['answer8'] = "[".$SelUser['planet_galaxy'].":".$SelUser['planet_system'].":".$SelUser['planet_position']."] ";
$SubPanelTPL = gettemplate('admin/admin_panel_asw1');
$parse['adm_sub_form2'] = parsetemplate($SubPanelTPL, $bloc);
break;
case 'usr_data':
$db = Legacies_Database::getSingleton();
$sql =<<<SQL_EOF
SELECT
planet.id AS planet_id,
planet.name AS planet_name,
planet.galaxy AS planet_galaxy,
planet.system AS planet_system,
planet.planet AS planet_position,
user.id AS user_id,
user.username AS username,
user.user_lastip AS user_lastip,
user.email AS email,
user.authlevel AS authlevel,
user.sex AS sex
FROM {{table}}planets AS planet
INNER JOIN {{table}}users AS user ON user.id_planet=planet.id
WHERE user.id = {$db->quote('%' . str_replace('*', '%', str_replace('%', '%%', $_GET['player'])) . '%')}"
SQL_EOF;
$statement = $db->prepare($sql);
$statement->execute();
$data = $statement->fetch(PDO::FETCH_ASSOC);
$pattern = mysql_real_escape_string($_GET['player']);
$SelUser = doquery("SELECT * FROM {{table}} WHERE `username` LIKE '%". $pattern ."%' LIMIT 1;", 'users', true);
$UsrMain = doquery("SELECT `name` FROM {{table}} WHERE `id` = '". $SelUser['id_planet'] ."';", 'planets', true);
$bloc = $lang;
$bloc['answer1'] = $data['user_id'];
$bloc['answer2'] = $data['username'];
$bloc['answer3'] = $data['user_lastip'];
$bloc['answer4'] = $data['email'];
$bloc['answer5'] = $lang['adm_usr_level'][$data['authlevel']];
$bloc['answer6'] = $lang['adm_usr_genre'][$data['sex']];
$bloc['answer7'] = "[".$data['planet_id']."] {$data['planet_name']}";
$bloc['answer8'] = "[".$SelUser['planet_galaxy'].":".$SelUser['planet_system'].":".$SelUser['planet_position']."] ";
$SubPanelTPL = gettemplate('admin/admin_panel_asw1');
$parse['adm_sub_form1'] = parsetemplate( $SubPanelTPL, $bloc );
$parse['adm_sub_form2'] = "<table><tbody>";
$parse['adm_sub_form2'] .= "<tr><td colspan=\"4\" class=\"c\">".$lang['adm_colony']."</td></tr>";
$UsrColo = doquery("SELECT * FROM {{table}} WHERE `id_owner` = '". $SelUser['id'] ." ORDER BY `galaxy` ASC, `planet` ASC, `system` ASC, `planet_type` ASC';", 'planets');
while ( $Colo = mysql_fetch_assoc($UsrColo) ) {
if ($Colo['id'] != $SelUser['id_planet']) {
$parse['adm_sub_form2'] .= "<tr><th>".$Colo['id']."</th>";
$parse['adm_sub_form2'] .= "<th>". (($Colo['planet_type'] == 1) ? $lang['adm_planet'] : $lang['adm_moon'] ) ."</th>";
$parse['adm_sub_form2'] .= "<th>[".$Colo['galaxy'].":".$Colo['system'].":".$Colo['planet']."]</th>";
$parse['adm_sub_form2'] .= "<th>".$Colo['name']."</th></tr>";
}
}
$parse['adm_sub_form2'] .= "</tbody></table>";
$parse['adm_sub_form3'] = "<table><tbody>";
$parse['adm_sub_form3'] .= "<tr><td colspan=\"4\" class=\"c\">".$lang['adm_technos']."</td></tr>";
for ($Item = 100; $Item <= 199; $Item++) {
if ($resource[$Item] != "") {
$parse['adm_sub_form3'] .= "<tr><th>".$lang['tech'][$Item]."</th>";
$parse['adm_sub_form3'] .= "<th>".$SelUser[$resource[$Item]]."</th></tr>";
}
}
$parse['adm_sub_form3'] .= "</tbody></table>";
break;
case 'usr_level':
if (!isset($_GET['s']) || !isset($_SESSION['CSRF']) || $_GET['s'] !== $_SESSION['CSRF']) {
AdminMessage(
'One have tried to overcome administration privilleges.',
'Hacking attempt');
break;
}
$player = isset($_GET['player']) ? mysql_real_escape_string($_GET['player']) : '';
$level = isset($_GET['authlvl']) ? mysql_real_escape_string($_GET['authlvl']) : '';
if ($level >= $user['authlevel'] && $user['authlevel'] != LEVEL_ADMIN) {
AdminMessage('Not enough privilleges to promote user.', $lang['adm_mod_level']);
break;
}
$userData = doquery("SELECT id FROM {{table}} WHERE `username` = '".$player."';", 'users', true);
if (empty($user)) {
AdminMessage('No such user.', $lang['adm_mod_level']);
break;
}
doquery("UPDATE {{table}} SET `authlevel` = '{$level}' WHERE id={$userData['id']}", 'users');
$message = $lang['adm_mess_lvl1']. " ". $player ." ".$lang['adm_mess_lvl2'];
$message .= "<font color=\"red\">".$lang['adm_usr_level'][$level]."</font>!";
AdminMessage($message, $lang['adm_mod_level']);
break;
case 'ip_search':
$pattern = isset($_GET['ip']) ? mysql_real_escape_string($_GET['ip']) : '';
$SelUser = doquery("SELECT * FROM {{table}} WHERE `user_lastip` = '". $pattern ."' LIMIT 10;", 'users');
$bloc = $lang;
$bloc['adm_this_ip'] = $pattern;
while ( $Usr = mysql_fetch_assoc($SelUser) ) {
$UsrMain = doquery("SELECT `name` FROM {{table}} WHERE `id` = '". $Usr['id_planet'] ."';", 'planets', true);
$bloc['adm_plyer_lst'] .= "<tr><th>".$Usr['username']."</th><th>[".$Usr['galaxy'].":".$Usr['system'].":".$Usr['planet']."] ".$UsrMain['name']."</th></tr>";
}
$SubPanelTPL = gettemplate('admin/admin_panel_asw2');
$parse['adm_sub_form2'] = parsetemplate( $SubPanelTPL, $bloc );
break;
default:
break;
}
}
// Traiter les reponses aux formulaires
if (isset($_GET['action'])) {
$bloc = $lang;
$_SESSION['CSRF'] = sha1(uniqid(null, true));
$bloc['csrf_hack'] = $_SESSION['CSRF'];
switch ($_GET['action']){
case 'usr_search':
$SubPanelTPL = gettemplate('admin/admin_panel_frm1');
break;
case 'usr_data':
$SubPanelTPL = gettemplate('admin/admin_panel_frm4');
break;
case 'usr_level':
for ($Lvl = 0; $Lvl < 4; $Lvl++) {
$bloc['adm_level_lst'] .= "<option value=\"". $Lvl ."\">". $lang['adm_usr_level'][ $Lvl ] ."</option>";
}
$SubPanelTPL = gettemplate('admin/admin_panel_frm3');
break;
case 'ip_search':
$SubPanelTPL = gettemplate('admin/admin_panel_frm2');
break;
default:
break;
}
$parse['adm_sub_form2'] = parsetemplate( $SubPanelTPL, $bloc );
}
$page = parsetemplate( $PanelMainTPL, $parse );
display( $page, $lang['panel_mainttl'], false, '', true );
} else {
message( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
}

View file

@ -1,63 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
* All rights reserved.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
define('IN_ADMIN', true);
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR))) {
$parse = $lang;
$query = doquery("SELECT * FROM {{table}} WHERE planet_type='1'", "planets");
$i = 0;
while ($u = $query->fetch(PDO::FETCH_BOTH)) {
$parse['planetes'] .= "<tr>"
. "<td class=b><center><b>" . $u[0] . "</center></b></td>"
. "<td class=b><center><b>" . $u[1] . "</center></b></td>"
. "<td class=b><center><b>" . $u[4] . "</center></b></td>"
. "<td class=b><center><b>" . $u[5] . "</center></b></td>"
. "<td class=b><center><b>" . $u[6] . "</center></b></td>"
. "</tr>";
$i++;
}
if ($i == "1")
$parse['planetes'] .= "<tr><th class=b colspan=5>Il y a qu'une seule plan&egrave;te</th></tr>";
else
$parse['planetes'] .= "<tr><th class=b colspan=5>Il y a {$i} plan&egrave;tes</th></tr>";
display(parsetemplate(gettemplate('admin/planetlist_body'), $parse), 'Planetlist', false, '', true);
} else {
message($lang['sys_noalloaw'], $lang['sys_noaccess']);
}
// Created by e-Zobar. All rights reversed (C) Wootook Team 2008
?>

View file

@ -1,242 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
* All rights reserved.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
define('IN_ADMIN', true);
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
function DisplayGameSettingsPage($CurrentUser) {
global $lang;
includeLang('admin/settings');
if (in_array((int) $CurrentUser['authlevel'], array(LEVEL_ADMIN))) {
if (isset($_POST['opt_save']) && $_POST['opt_save'] == "1") {
// Jeu Ouvert ou Ferm<72> !
if (isset($_POST['closed']) && $_POST['closed'] == 'on') {
Wootook::setConfig('game/general/active', true, 1, 1);
} else {
Wootook::setConfig('game/general/active', false, 1, 1);
}
if (isset($_POST['close_reason'])) {
Wootook::setConfig('game/general/closing-message', $_POST['close_reason'], 1, 1);
}
// Y a un News Frame ? !
if (isset($_POST['newsframe']) && $_POST['newsframe'] == 'on') {
Wootook::setConfig('game/news/active', true, 1, 1);
} else {
Wootook::setConfig('game/news/active', false, 1, 1);
}
if (isset($_POST['NewsText'])) {
Wootook::setConfig('game/news/content', $_POST['NewsText'], 1, 1);
}
// Y a un TCHAT externe ??
if (isset($_POST['chatframe']) && $_POST['chatframe'] == 'on') {
Wootook::setConfig('engine/options/chat', true, 1, 1);
} else {
Wootook::setConfig('engine/options/chat', false, 1, 1);
}
if (isset($_POST['ga']) && $_POST['ga'] == 'on') {
Wootook::setConfig('engine/options/ga', true, 1, 1);
} else {
Wootook::setConfig('engine/options/ga', false, 1, 1);
}
if (isset($_POST['ga_id']) && !empty($_POST['ga_id'])) {
Wootook::setConfig('engine/options/ga-id', $_POST['ga_id'], 1, 1);
}
// Y a un BANNER Frame ?
if (isset($_POST['bannerframe']) && $_POST['bannerframe'] == 'on') {
Wootook::setConfig('engine/options/banner', true, 1, 1);
} else {
Wootook::setConfig('engine/options/banner', false, 1, 1);
}
// Nom du Jeu
if (isset($_POST['game_name']) && !empty($_POST['game_name'])) {
Wootook::setConfig('game/general/name', $_POST['game_name'], 1, 1);
}
// Adresse du Forum
if (isset($_POST['forum_url']) && !empty($_POST['forum_url'])) {
Wootook::setConfig('game/general/boards-url', $_POST['forum_url'], 1, 1);
}
// Vitesse du Jeu
if (isset($_POST['game_speed']) && is_numeric($_POST['game_speed'])) {
Wootook::setConfig('game/speed/general', $_POST['game_speed'], 1, 1);
}
// Vitesse des Flottes
if (isset($_POST['fleet_speed']) && is_numeric($_POST['fleet_speed'])) {
Wootook::setConfig('game/speed/fleet', $_POST['fleet_speed'], 1, 1);
}
// Multiplicateur de Production
if (isset($_POST['resource_multiplier']) && is_numeric($_POST['resource_multiplier'])) {
Wootook::setConfig('game/resource/multiplier', $_POST['resource_multiplier'], 1, 1);
}
// Taille de la planete mère
if (isset($_POST['initial_fields']) && is_numeric($_POST['initial_fields'])) {
Wootook::setConfig('resource/initial/fields', $_POST['initial_fields'], 1, 1);
}
// Revenu de base Metal
if (isset($_POST['metal_basic_income']) && is_numeric($_POST['metal_basic_income'])) {
Wootook::setConfig('resource/initial/metal', $_POST['metal_basic_income'], 1, 1);
}
// Revenu de base Cristal
if (isset($_POST['crystal_basic_income']) && is_numeric($_POST['crystal_basic_income'])) {
Wootook::setConfig('resource/initial/cristal', $_POST['crystal_basic_income'], 1, 1);
}
// Revenu de base Deuterium
if (isset($_POST['deuterium_basic_income']) && is_numeric($_POST['deuterium_basic_income'])) {
Wootook::setConfig('resource/initial/deuterium', $_POST['deuterium_basic_income'], 1, 1);
}
// Revenu de base Energie
if (isset($_POST['energy_basic_income']) && is_numeric($_POST['energy_basic_income'])) {
Wootook::setConfig('resource/initial/energy', $_POST['energy_basic_income'], 1, 1);
}
// Lien supplémentaire dans le menu
if (isset($_POST['url_link_']) && is_numeric($_POST['url_link_'])) {
Wootook::setConfig('game/general/boards-url', $_POST['url_link_'], 1, 1);
}
// Image de la bannière
if (isset($_POST['banner_source_post'])) {
Wootook::setConfig('engine/options/banner', $_POST['banner_source_post'], 1, 1);
}
// 1 point = ??? Ressources ?
if (isset($_POST['stat_settings']) && is_numeric($_POST['stat_settings'])) {
Wootook::setConfig('game/resource/multiplier', $_POST['stat_settings'], 1, 1);
}
// Activation -ou non- des annonces
if (isset($_POST['enable_announces_']) && is_numeric($_POST['enable_announces_'])) {
Wootook::setConfig('engine/options/announces', $_POST['enable_announces_'], 1, 1);
}
// Activation -ou non- du marchand
if (isset($_POST['enable_marchand_']) && is_numeric($_POST['enable_marchand_'])) {
Wootook::setConfig('engine/options/retailer', $_POST['enable_marchand_'], 1, 1);
}
// Activation -ou non- des notes
if (isset($_POST['enable_notes_']) && is_numeric($_POST['enable_notes_'])) {
Wootook::setConfig('engine/options/notes', $_POST['enable_notes_'], 1, 1);
}
// Nom du bot antimulti
if (isset($_POST['name_bot'])) {
Wootook::setConfig('engine/bot/name', $_POST['name_bot'], 1, 1);
}
// email du bot antimulti
if (isset($_POST['adress_bot'])) {
Wootook::setConfig('engine/bot/email', $_POST['adress_bot'], 1, 1);
}
// Activation -ou non- des notes
if (isset($_POST['duration_ban']) && is_numeric($_POST['duration_ban'])) {
Wootook::setConfig('engine/ban/duration', $_POST['duration_ban'], 1, 1);
}
// Activation -ou non- du bot
if (isset($_POST['bot_enable']) && is_numeric($_POST['bot_enable'])) {
Wootook::setConfig('engine/bot/active', $_POST['bot_enable'], 1, 1);
}
// BBCode ou pas ?
if (isset($_POST['bbcode_field']) && is_numeric($_POST['bbcode_field'])) {
Wootook::setConfig('engine/options/bbcode', $_POST['bbcode_field'], 1, 1);
}
AdminMessage('Options changees avec succes !', 'Succes', '?');
} else {
$parse = $lang;
$parse['game_name'] = Wootook::getGameConfig('game/general/name');
$parse['game_speed'] = Wootook::getGameConfig('game/speed/general');
$parse['fleet_speed'] = Wootook::getGameConfig('game/speed/fleet');
$parse['resource_multiplier'] = Wootook::getGameConfig('game/resource/multiplier');
$parse['forum_url'] = Wootook::getGameConfig('game/general/boards-url');
$parse['initial_fields'] = Wootook::getGameConfig('resource/initial/fields');
$parse['metal_basic_income'] = Wootook::getGameConfig('resource/initial/metal');
$parse['crystal_basic_income'] = Wootook::getGameConfig('resource/initial/cristal');
$parse['deuterium_basic_income'] = Wootook::getGameConfig('resource/initial/deuterium');
$parse['energy_basic_income'] = Wootook::getGameConfig('resource/initial/energy');
$parse['enable_link'] = $gameConfig['link_enable'];
$parse['name_link'] = Wootook::getGameConfig('game/general/extra-url-title');
$parse['url_link'] = Wootook::getGameConfig('game/general/extra-url');
$parse['enable_announces'] = Wootook::getGameConfig('engine/options/announces');
$parse['enable_marchand'] = Wootook::getGameConfig('engine/options/retailer');
$parse['enable_notes'] = Wootook::getGameConfig('engine/options/notes');
$parse['bot_name'] = Wootook::getGameConfig('engine/bot/name');
$parse['bot_adress'] = Wootook::getGameConfig('engine/bot/email');
$parse['ban_duration'] = Wootook::getGameConfig('engine/ban/duration');
$parse['enable_bot'] = Wootook::getGameConfig('engine/bot/active');
$parse['enable_bbcode'] = Wootook::getGameConfig('engine/options/bbcode');
$parse['banner_source_post'] = Wootook::getGameConfig('engine/options/banner');
$parse['stat_settings'] = Wootook::getGameConfig('game/resource/multiplier');
$parse['closed'] = (!Wootook::getGameConfig('game/general/active')) ? " checked = 'checked' ":"";
$parse['close_reason'] = Wootook::getGameConfig('game/general/closing-message');
$parse['newsframe'] = (Wootook::getGameConfig('game/news/active')) ? " checked = 'checked' ":"";
$parse['NewsTextVal'] = Wootook::getGameConfig('game/news/content');
$parse['chatframe'] = ($gameConfig['OverviewExternChat'] == 1) ? " checked = 'checked' ":"";
$parse['ExtTchatVal'] = stripslashes( $gameConfig['OverviewExternChatCmd'] );
$parse['ga'] = (Wootook::getGameConfig('engine/options/ga')) ? " checked = 'checked' ":"";
$parse['ga_id'] = Wootook::getGameConfig('engine/options/ga-id');
$parse['bannerframe'] = ($gameConfig['ForumBannerFrame'] == 1) ? " checked = 'checked' ":"";
$PageTPL = gettemplate('admin/options_body');
$Page = parsetemplate($PageTPL, $parse);
display($Page, $lang['adm_opt_title'], false, '', true);
}
} else {
AdminMessage($lang['sys_noalloaw'], $lang['sys_noaccess']);
}
return $Page;
}
$Page = DisplayGameSettingsPage($user);

View file

@ -1,272 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
* All rights reserved.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
define('IN_ADMIN', true);
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
include(ROOT_PATH . 'admin/statfunctions.' . PHPEXT);
if (strtolower(substr(PHP_SAPI, 0, 3)) == 'cli' || in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) {
includeLang('admin');
$StatDate = time();
// Rotation des statistiques
doquery ( "DELETE FROM {{table}} WHERE `stat_code` >= '10';" , 'statpoints');
doquery ( "UPDATE {{table}} SET `stat_code` = `stat_code` + '1';" , 'statpoints');
$GameUsers = doquery("SELECT * FROM {{table}} WHERE authlevel<3", 'users');
$resourceMultiplier = Wootook::getGameConfig('game/resource/multiplier');
while ($CurUser = $GameUsers->fetch(PDO::FETCH_ASSOC)) {
// Recuperation des anciennes statistiques
$OldStatRecord = doquery ("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `id_owner` = '".$CurUser['id']."';", 'statpoints', true);
if ($OldStatRecord) {
$OldTotalRank = $OldStatRecord['total_rank'];
$OldTechRank = $OldStatRecord['tech_rank'];
$OldBuildRank = $OldStatRecord['build_rank'];
$OldDefsRank = $OldStatRecord['defs_rank'];
$OldFleetRank = $OldStatRecord['fleet_rank'];
// Suppression de l'ancien enregistrement
doquery ("DELETE FROM {{table}} WHERE `stat_type` = '1' AND `id_owner` = '".$CurUser['id']."';",'statpoints');
} else {
$OldTotalRank = 0;
$OldTechRank = 0;
$OldBuildRank = 0;
$OldDefsRank = 0;
$OldFleetRank = 0;
}
// Total des unitées consommée pour la recherche
$Points = GetTechnoPoints ( $CurUser );
$TTechCount = $Points['TechCount'];
$TTechPoints = ($Points['TechPoint'] / $resourceMultiplier);
// Totalisation des points accumulés par planete
$TBuildCount = 0;
$TBuildPoints = 0;
$TDefsCount = 0;
$TDefsPoints = 0;
$TFleetCount = 0;
$TFleetPoints = 0;
$GCount = $TTechCount;
$GPoints = $TTechPoints;
$UsrPlanets = doquery("SELECT * FROM {{table}} WHERE `id_owner` = '". $CurUser['id'] ."';", 'planets');
while ($CurPlanet = $UsrPlanets->fetch(PDO::FETCH_ASSOC)) {
$Points = GetBuildPoints ( $CurPlanet );
$TBuildCount += $Points['BuildCount'];
$GCount += $Points['BuildCount'];
$PlanetPoints = ($Points['BuildPoint'] / $resourceMultiplier);
$TBuildPoints += ($Points['BuildPoint'] / $resourceMultiplier);
$Points = GetDefensePoints ( $CurPlanet );
$TDefsCount += $Points['DefenseCount'];;
$GCount += $Points['DefenseCount'];
$PlanetPoints += ($Points['DefensePoint'] / $resourceMultiplier);
$TDefsPoints += ($Points['DefensePoint'] / $resourceMultiplier);
$Points = GetFleetPoints ( $CurPlanet );
$TFleetCount += $Points['FleetCount'];
$GCount += $Points['FleetCount'];
$PlanetPoints += ($Points['FleetPoint'] / $resourceMultiplier);
$TFleetPoints += ($Points['FleetPoint'] / $resourceMultiplier);
$GPoints += $PlanetPoints;
$QryUpdatePlanet = "UPDATE {{table}} SET ";
$QryUpdatePlanet .= "`points` = '". $PlanetPoints ."' ";
$QryUpdatePlanet .= "WHERE ";
$QryUpdatePlanet .= "`id` = '". $CurPlanet['id'] ."';";
doquery ( $QryUpdatePlanet , 'planets');
}
$QryInsertStats = "INSERT INTO {{table}} SET ";
$QryInsertStats .= "`id_owner` = '". $CurUser['id'] ."', ";
$QryInsertStats .= "`id_ally` = '". $CurUser['ally_id'] ."', ";
$QryInsertStats .= "`stat_type` = '1', "; // 1 pour joueur , 2 pour alliance
$QryInsertStats .= "`stat_code` = '1', "; // de 1 a 2 mis a jour de maniere automatique
$QryInsertStats .= "`tech_points` = '". $TTechPoints ."', ";
$QryInsertStats .= "`tech_count` = '". $TTechCount ."', ";
$QryInsertStats .= "`tech_old_rank` = '". $OldTechRank ."', ";
$QryInsertStats .= "`build_points` = '". $TBuildPoints ."', ";
$QryInsertStats .= "`build_count` = '". $TBuildCount ."', ";
$QryInsertStats .= "`build_old_rank` = '". $OldBuildRank ."', ";
$QryInsertStats .= "`defs_points` = '". $TDefsPoints ."', ";
$QryInsertStats .= "`defs_count` = '". $TDefsCount ."', ";
$QryInsertStats .= "`defs_old_rank` = '". $OldDefsRank ."', ";
$QryInsertStats .= "`fleet_points` = '". $TFleetPoints ."', ";
$QryInsertStats .= "`fleet_count` = '". $TFleetCount ."', ";
$QryInsertStats .= "`fleet_old_rank` = '". $OldFleetRank ."', ";
$QryInsertStats .= "`total_points` = '". $GPoints ."', ";
$QryInsertStats .= "`total_count` = '". $GCount ."', ";
$QryInsertStats .= "`total_old_rank` = '". $OldTotalRank ."', ";
$QryInsertStats .= "`stat_date` = '". $StatDate ."';";
doquery ( $QryInsertStats , 'statpoints');
}
$Rank = 1;
$RankQry = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' ORDER BY `tech_points` DESC;", 'statpoints');
while ($TheRank = $RankQry->fetch(PDO::FETCH_ASSOC)) {
$QryUpdateStats = "UPDATE {{table}} SET ";
$QryUpdateStats .= "`tech_rank` = '". $Rank ."' ";
$QryUpdateStats .= "WHERE ";
$QryUpdateStats .= " `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '". $TheRank['id_owner'] ."';";
doquery ( $QryUpdateStats , 'statpoints');
$Rank++;
}
$Rank = 1;
$RankQry = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' ORDER BY `build_points` DESC;", 'statpoints');
while ($TheRank = $RankQry->fetch(PDO::FETCH_ASSOC) ) {
$QryUpdateStats = "UPDATE {{table}} SET ";
$QryUpdateStats .= "`build_rank` = '". $Rank ."' ";
$QryUpdateStats .= "WHERE ";
$QryUpdateStats .= " `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '". $TheRank['id_owner'] ."';";
doquery ( $QryUpdateStats , 'statpoints');
$Rank++;
}
$Rank = 1;
$RankQry = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' ORDER BY `defs_points` DESC;", 'statpoints');
while ($TheRank = $RankQry->fetch(PDO::FETCH_ASSOC)) {
$QryUpdateStats = "UPDATE {{table}} SET ";
$QryUpdateStats .= "`defs_rank` = '". $Rank ."' ";
$QryUpdateStats .= "WHERE ";
$QryUpdateStats .= " `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '". $TheRank['id_owner'] ."';";
doquery ( $QryUpdateStats , 'statpoints');
$Rank++;
}
$Rank = 1;
$RankQry = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' ORDER BY `fleet_points` DESC;", 'statpoints');
while ($TheRank = $RankQry->fetch(PDO::FETCH_ASSOC)) {
$QryUpdateStats = "UPDATE {{table}} SET ";
$QryUpdateStats .= "`fleet_rank` = '". $Rank ."' ";
$QryUpdateStats .= "WHERE ";
$QryUpdateStats .= " `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '". $TheRank['id_owner'] ."';";
doquery ( $QryUpdateStats , 'statpoints');
$Rank++;
}
$Rank = 1;
$RankQry = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' ORDER BY `total_points` DESC;", 'statpoints');
while ($TheRank = $RankQry->fetch(PDO::FETCH_ASSOC)) {
$QryUpdateStats = "UPDATE {{table}} SET ";
$QryUpdateStats .= "`total_rank` = '". $Rank ."' ";
$QryUpdateStats .= "WHERE ";
$QryUpdateStats .= " `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '". $TheRank['id_owner'] ."';";
doquery ( $QryUpdateStats , 'statpoints');
$Rank++;
}
// Statistiques des alliances ...
$GameAllys = doquery("SELECT * FROM {{table}}", 'alliance');
while ($CurAlly = $GameAllys->fetch(PDO::FETCH_ASSOC)) {
// Recuperation des anciennes statistiques
$OldStatRecord = doquery ("SELECT * FROM {{table}} WHERE `stat_type` = '2' AND `id_owner` = '".$CurAlly['id']."';",'statpoints', true);
if ($OldStatRecord) {
$OldTotalRank = $OldStatRecord['total_rank'];
$OldTechRank = $OldStatRecord['tech_rank'];
$OldBuildRank = $OldStatRecord['build_rank'];
$OldDefsRank = $OldStatRecord['defs_rank'];
$OldFleetRank = $OldStatRecord['fleet_rank'];
// Suppression de l'ancien enregistrement
doquery ("DELETE FROM {{table}} WHERE `stat_type` = '2' AND `id_owner` = '".$CurAlly['id']."';",'statpoints');
} else {
$OldTotalRank = 0;
$OldTechRank = 0;
$OldBuildRank = 0;
$OldDefsRank = 0;
$OldFleetRank = 0;
}
// Total des unitées consommée pour la recherche
$QrySumSelect = "SELECT ";
$QrySumSelect .= "SUM(`tech_points`) as `TechPoint`, ";
$QrySumSelect .= "SUM(`tech_count`) as `TechCount`, ";
$QrySumSelect .= "SUM(`build_points`) as `BuildPoint`, ";
$QrySumSelect .= "SUM(`build_count`) as `BuildCount`, ";
$QrySumSelect .= "SUM(`defs_points`) as `DefsPoint`, ";
$QrySumSelect .= "SUM(`defs_count`) as `DefsCount`, ";
$QrySumSelect .= "SUM(`fleet_points`) as `FleetPoint`, ";
$QrySumSelect .= "SUM(`fleet_count`) as `FleetCount`, ";
$QrySumSelect .= "SUM(`total_points`) as `TotalPoint`, ";
$QrySumSelect .= "SUM(`total_count`) as `TotalCount` ";
$QrySumSelect .= "FROM {{table}} ";
$QrySumSelect .= "WHERE ";
$QrySumSelect .= "`stat_type` = '1' AND ";
$QrySumSelect .= "`id_ally` = '". $CurAlly['id'] ."';";
$Points = doquery( $QrySumSelect, 'statpoints', true);
$TTechCount = $Points['TechCount'];
$TTechPoints = $Points['TechPoint'];
$TBuildCount = $Points['BuildCount'];
$TBuildPoints = $Points['BuildPoint'];
$TDefsCount = $Points['DefsCount'];
$TDefsPoints = $Points['DefsPoint'];
$TFleetCount = $Points['FleetCount'];
$TFleetPoints = $Points['FleetPoint'];
$GCount = $Points['TotalCount'];
$GPoints = $Points['TotalPoint'];
$QryInsertStats = "INSERT INTO {{table}} SET ";
$QryInsertStats .= "`id_owner` = '". $CurAlly['id'] ."', ";
$QryInsertStats .= "`id_ally` = '0', ";
$QryInsertStats .= "`stat_type` = '2', "; // 1 pour joueur , 2 pour alliance
$QryInsertStats .= "`stat_code` = '1', "; // de 1 a 5 mis a jour de maniere automatique
$QryInsertStats .= "`tech_points` = '". $TTechPoints ."', ";
$QryInsertStats .= "`tech_count` = '". $TTechCount ."', ";
$QryInsertStats .= "`tech_old_rank` = '". $OldTechRank ."', ";
$QryInsertStats .= "`build_points` = '". $TBuildPoints ."', ";
$QryInsertStats .= "`build_count` = '". $TBuildCount ."', ";
$QryInsertStats .= "`build_old_rank` = '". $OldBuildRank ."', ";
$QryInsertStats .= "`defs_points` = '". $TDefsPoints ."', ";
$QryInsertStats .= "`defs_count` = '". $TDefsCount ."', ";
$QryInsertStats .= "`defs_old_rank` = '". $OldDefsRank ."', ";
$QryInsertStats .= "`fleet_points` = '". $TFleetPoints ."', ";
$QryInsertStats .= "`fleet_count` = '". $TFleetCount ."', ";
$QryInsertStats .= "`fleet_old_rank` = '". $OldFleetRank ."', ";
$QryInsertStats .= "`total_points` = '". $GPoints ."', ";
$QryInsertStats .= "`total_count` = '". $GCount ."', ";
$QryInsertStats .= "`total_old_rank` = '". $OldTotalRank ."', ";
$QryInsertStats .= "`stat_date` = '". $StatDate ."';";
doquery ( $QryInsertStats , 'statpoints');
}
AdminMessage ( $lang['adm_done'], $lang['adm_stat_title'] );
} else {
AdminMessage ( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
}

View file

@ -1,107 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
* All rights reserved.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
function GetTechnoPoints ( $CurrentUser ) {
global $resource, $pricelist, $reslist;
$TechCounts = 0;
$TechPoints = 0;
foreach ( $reslist['tech'] as $n => $Techno ) {
if ( $CurrentUser[ $resource[ $Techno ] ] > 0 ) {
for ( $Level = 1; $Level < $CurrentUser[ $resource[ $Techno ] ]; $Level++ ) {
$Units = $pricelist[ $Techno ]['metal'] + $pricelist[ $Techno ]['cristal'] + $pricelist[ $Techno ]['deuterium'];
$LevelMul = pow( $pricelist[ $Techno ]['factor'], $Level );
$TechPoints += ($Units * $LevelMul);
$TechCounts += 1;
}
}
}
$RetValue['TechCount'] = $TechCounts;
$RetValue['TechPoint'] = $TechPoints;
return $RetValue;
}
function GetBuildPoints ( $CurrentPlanet ) {
global $resource, $pricelist, $reslist;
$BuildCounts = 0;
$BuildPoints = 0;
foreach($reslist['build'] as $n => $Building) {
if ( $CurrentPlanet[ $resource[ $Building ] ] > 0 ) {
for ( $Level = 1; $Level < $CurrentPlanet[ $resource[ $Building ] ]; $Level++ ) {
$Units = $pricelist[ $Building ]['metal'] + $pricelist[ $Building ]['cristal'] + $pricelist[ $Building ]['deuterium'];
$LevelMul = pow( $pricelist[ $Building ]['factor'], $Level );
$BuildPoints += ($Units * $LevelMul);
$BuildCounts += 1;
}
}
}
$RetValue['BuildCount'] = $BuildCounts;
$RetValue['BuildPoint'] = $BuildPoints;
return $RetValue;
}
function GetDefensePoints ( $CurrentPlanet ) {
global $resource, $pricelist, $reslist;
$DefenseCounts = 0;
$DefensePoints = 0;
foreach($reslist['defense'] as $n => $Defense) {
if ($CurrentPlanet[ $resource[ $Defense ] ] > 0) {
$Units = $pricelist[ $Defense ]['metal'] + $pricelist[ $Defense ]['cristal'] + $pricelist[ $Defense ]['deuterium'];
$DefensePoints += ($Units * $CurrentPlanet[ $resource[ $Defense ] ]);
$DefenseCounts += $CurrentPlanet[ $resource[ $Defense ] ];
}
}
$RetValue['DefenseCount'] = $DefenseCounts;
$RetValue['DefensePoint'] = $DefensePoints;
return $RetValue;
}
function GetFleetPoints ( $CurrentPlanet ) {
global $resource, $pricelist, $reslist;
$FleetCounts = 0;
$FleetPoints = 0;
foreach($reslist['fleet'] as $n => $Fleet) {
if ($CurrentPlanet[ $resource[ $Fleet ] ] > 0) {
$Units = $pricelist[ $Fleet ]['metal'] + $pricelist[ $Fleet ]['cristal'] + $pricelist[ $Fleet ]['deuterium'];
$FleetPoints += ($Units * $CurrentPlanet[ $resource[ $Fleet ] ]);
$FleetCounts += $CurrentPlanet[ $resource[ $Fleet ] ];
}
}
$RetValue['FleetCount'] = $FleetCounts;
$RetValue['FleetPoint'] = $FleetPoints;
return $RetValue;
}

View file

@ -1,57 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
* All rights reserved.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
define('IN_ADMIN', true);
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR))) {
$parse['dpath'] = $dpath;
$parse = $lang;
$mode = $_GET['mode'];
if ($mode != 'change') {
$parse['Name'] = "Nom du joueur";
} elseif ($mode == 'change') {
$nam = $_POST['nam'];
doquery("DELETE FROM {{table}} WHERE who2='{$nam}'", 'banned');
doquery("UPDATE {{table}} SET bana=0, banaday=0 WHERE username='{$nam}'", "users");
message("Le joueur {$nam} a bien &eacute;t&eacute; d&eacute;banni!", 'Information');
}
display(parsetemplate(gettemplate('admin/unbanned'), $parse), "Overview", false, '', true);
} else {
message( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
}
?>

View file

@ -1,93 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
* All rights reserved.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
define('IN_ADMIN', true);
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR))) {
includeLang('admin');
if ($_GET['cmd'] == 'dele') {
$player = new Wootook_Player_Model_Entity();
$player->load(intval($_GET['user']));
if ($player->getId()) {
$player->delete();
}
}
if ($_GET['cmd'] == 'sort') {
$TypeSort = $_GET['type'];
} else {
$TypeSort = "id";
}
$PageTPL = gettemplate('admin/userlist_body');
$RowsTPL = gettemplate('admin/userlist_rows');
$query = doquery("SELECT * FROM {{table}} ORDER BY `". $TypeSort ."` ASC", 'users');
$parse = $lang;
$parse['adm_ul_table'] = "";
$i = 0;
$Color = "lime";
while ($u = mysql_fetch_assoc ($query) ) {
if ($PrevIP != "") {
if ($PrevIP == $u['user_lastip']) {
$Color = "red";
} else {
$Color = "lime";
}
}
$Bloc['adm_ul_data_id'] = $u['id'];
$Bloc['adm_ul_data_name'] = $u['username'];
$Bloc['adm_ul_data_mail'] = $u['email'];
$Bloc['ip_adress_at_register'] = $u['ip_at_reg'];
$Bloc['adm_ul_data_adip'] = "<font color=\"".$Color."\">". $u['user_lastip'] ."</font>";
$Bloc['adm_ul_data_regd'] = gmdate ( "d/m/Y G:i:s", $u['register_time'] );
$Bloc['adm_ul_data_lconn'] = gmdate ( "d/m/Y G:i:s", $u['onlinetime'] );
$Bloc['adm_ul_data_banna'] = ( $u['bana'] == 1 ) ? "<a href # title=\"". gmdate ( "d/m/Y G:i:s", $u['banaday']) ."\">". $lang['adm_ul_yes'] ."</a>" : $lang['adm_ul_no'];
$Bloc['adm_ul_data_detai'] = ""; // Lien vers une page de details genre Empire
$Bloc['adm_ul_data_actio'] = "<a href=\"userlist.php?cmd=dele&user=".$u['id']."\"><img src=\"../images/r1.png\"></a>"; // Lien vers actions 'effacer'
$PrevIP = $u['user_lastip'];
$parse['adm_ul_table'] .= parsetemplate( $RowsTPL, $Bloc );
$i++;
}
$parse['adm_ul_count'] = $i;
$page = parsetemplate( $PageTPL, $parse );
display( $page, $lang['adm_ul_title'], false, '', true);
} else {
message( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
}
?>

View file

@ -1,47 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
* All rights reserved.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
define('IN_ADMIN', true);
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) {
$parse['phpinfo'] = phpinfo();
$Page = parsetemplate($PageTPL, $parse);
display ( $Page, "PhpInfo", false, '', true);
} else {
AdminMessage ( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
}
?>

File diff suppressed because it is too large Load diff

View file

@ -1,109 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
* All rights reserved.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
require_once dirname(__FILE__) .'/application/bootstrap.php';
$readAdapter = Wootook_Core_Database_ConnectionManager::getSingleton()->getConnection('core_read');
$writeAdapter = Wootook_Core_Database_ConnectionManager::getSingleton()->getConnection('core_write');
$action = isset($_GET['action']) ? $_GET['action'] : null;
if ($action == 5) {
$writeAdapter->insert()
->into($writeAdapter->getTable('annonce'))
->set('user', $user->getUsername())
->set('galaxie', $planet->getGalaxy())
->set('systeme', $planet->getSystem())
->set('metala', Wootook::getRequest()->getParam('metalvendre'))
->set('cristala', Wootook::getRequest()->getParam('cristalvendre'))
->set('deuta', Wootook::getRequest()->getParam('deutvendre'))
->set('metals', Wootook::getRequest()->getParam('metalsouhait'))
->set('cristals', Wootook::getRequest()->getParam('cristalsouhait'))
->set('deuts', Wootook::getRequest()->getParam('deutsouhait'))
->execute()
;
$page2 .= <<<HTML
<center>
<br>
<p>Votre Annonce a bien &eacute;t&eacute; enregistr&eacute;e !</p>
<br><p><a href="annonce.php">Retour aux annonces</a></p>
HTML;
display($page2);
}
if ($action != 5) {
$statement = $readAdapter->select()->from(array('annonce' => $readAdapter->getTable('annonce')))->order('id', 'DESC')->prepare();
$page2 = "<HTML>
<center>
<br>
<table width=\"600\">
<td class=\"c\" colspan=\"10\"><font color=\"#FFFFFF\">Petites Annonces</font></td></tr>
<tr><th colspan=\"3\">Infos de livraison</th><th colspan=\"3\">Ressources &agrave; vendre</th><th colspan=\"3\">Ressources souhait&eacute;es</th><th>Action</th></tr>
<tr><th>Vendeur</th><th>Galaxie</th><th>Syst&egrave;me</th><th>M&eacute;tal</th><th>Cristal</th><th>Deuterium</th><th>M&eacute;tal</th><th>Cristal</th><th>Deuterium</th><th>Delet</th></tr>
";
foreach ($statement as $b) {
$page2 .= '<tr><th> ';
$page2 .= $b["user"] ;
$page2 .= '</th><th>';
$page2 .= $b["galaxie"];
$page2 .= '</th><th>';
$page2 .= $b["systeme"];
$page2 .= '</th><th>';
$page2 .= $b["metala"];
$page2 .= '</th><th>';
$page2 .= $b["gcristala"];
$page2 .= '</th><th>';
$page2 .= $b["deuta"];
$page2 .= '</th><th>';
$page2 .= $b["metals"];
$page2 .= '</th><th>';
$page2 .= $b["cristals"];
$page2 .= '</th><th>';
$page2 .= $b["deuts"];
$page2 .= '</th><th>';
$page2 .= "</th></tr>";
}
$page2 .= "
<tr><th colspan=\"10\" align=\"center\"><a href=\"annonce2.php?action=2\">Ajouter une Annonce</a></th></tr>
</td>
</table>
</HTML>";
display($page2);
}

View file

@ -1,62 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
* All rights reserved.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
require_once dirname(__FILE__) .'/application/bootstrap.php';
$actions = $_GET['action'];
if($actions == 2)
{
$page .=<<<HTML
<center>
<br>
<table width="600">
<td class="c" colspan="10" align="center"><b><font color="white">Ajouter une Annonce</font></b></td></tr>
<td class="c" colspan="10" align="center"><b>Ressources &agrave; Vendre</font></b></td></tr>
<form action="annonce.php?action=5" method="post">
<tr><th colspan="5">M&eacute;tal</th><th colspan="5"><input type="texte" value="0" name="metalvendre" /></th></tr>
<tr><th colspan="5">Cristal</th><th colspan="5"><input type="texte" value="0" name="cristalvendre" /></th></tr>
<tr><th colspan="5">Deuterium</th><th colspan="5"><input type="texte" value="0" name="deutvendre" /></th></tr>
<td class="c" colspan="10" align="center"><b>Ressources Souhait&eacute;es</font></b></td></tr>
<tr><th colspan="5">M&eacute;tal</th><th colspan="5"><input type="texte" value="0" name="metalsouhait" /></th></tr>
<tr><th colspan="5">Cristal</th><th colspan="5"><input type="texte" value="0" name="cristalsouhait" /></th></tr>
<tr><th colspan="5">Deuterium</th><th colspan="5"><input type="texte" value="0" name="deutsouhait" /></th></tr>
<tr><th colspan="10"><input type="submit" value="Envoyer" /></th></tr>
<form>
</table>
HTML;
display($page);
}
?>

View file

@ -1,163 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
* All rights reserved.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
if (!defined('PHP_VERSION_ID')) {
$version = explode('.',PHP_VERSION);
define('PHP_VERSION_ID', (((int)$version[0]) * 10000 + ((int)$version[1]) * 100 + ((int)$version[2])));
unset($version);
}
if (!defined('DEBUG') && ($env = getenv('DEBUG')) !== false && in_array(strtolower($env), array('1', 'on', 'true'))) {
define('DEBUG', true);
} else if (!defined('DEBUG') && isset($_SERVER['DEBUG']) && in_array(strtolower($_SERVER['DEBUG']), array('1', 'on', 'true'))) {
define('DEBUG', true);
}
if (!defined('DEPRECATION') && ($env = getenv('DEPRECATION')) !== false && in_array(strtolower($env), array('1', 'on', 'true'))) {
define('DEPRECATION', true);
} else if (!defined('DEPRECATION') && isset($_SERVER['DEPRECATION']) && in_array(strtolower($_SERVER['DEPRECATION']), array('1', 'on', 'true'))) {
define('DEPRECATION', true);
}
if (!defined('BCNUMBERS') && ($env = getenv('BCNUMBERS')) !== false && in_array(strtolower($env), array('1', 'on', 'true'))) {
define('BCNUMBERS', true);
} else if (!defined('BCNUMBERS') && isset($_SERVER['BCNUMBERS']) && in_array(strtolower($_SERVER['BCNUMBERS']), array('1', 'on', 'true'))) {
define('BCNUMBERS', true);
}
if (!defined('DEBUG')) {
@ini_set('display_errors', false);
} else {
@ini_set('display_errors', true);
@error_reporting(E_ALL | E_STRICT);
}
defined('ROOT_PATH') || define('ROOT_PATH', dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR);
defined('APPLICATION_PATH') || define('APPLICATION_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
defined('PHPEXT') || define('PHPEXT', 'php');
defined('VERSION') || define('VERSION', '1.5.0-beta2');
set_include_path(implode(PATH_SEPARATOR, array(
APPLICATION_PATH . DIRECTORY_SEPARATOR . 'code' . DIRECTORY_SEPARATOR . 'libraries',
APPLICATION_PATH . DIRECTORY_SEPARATOR . 'code' . DIRECTORY_SEPARATOR . 'local',
APPLICATION_PATH . DIRECTORY_SEPARATOR . 'code' . DIRECTORY_SEPARATOR . 'community',
APPLICATION_PATH . DIRECTORY_SEPARATOR . 'code' . DIRECTORY_SEPARATOR . 'core',
get_include_path()
)));
function __autoload($class) {
include_once str_replace('_', '/', $class) . '.php';
}
if (defined('IN_ADMIN')) {
$website = new Wootook_Core_Model_Website();
$website->setId(0)->setData('code', 'admin');
Wootook::addWebsite($website);
Wootook::setDefaultWebsite($website);
$game = new Wootook_Core_Model_Game();
$game->setId(0)->setData('code', 'admin')->setData('website_id', $website->getId());
Wootook::addGame($game);
Wootook::setDefaultGame($game);
}
include ROOT_PATH . 'includes/constants.php';
if (defined('DEBUG')) {
Wootook_Core_ErrorProfiler::register();
}
Wootook_Core_Helper_Config_Events::registerEvents();
if (!Wootook::$isInstalled) {
Wootook::getResponse()
->setRedirect(Wootook::getStaticUrl('install/'), Wootook_Core_Mvc_Controller_Response_Http::REDIRECT_TEMPORARY)
->sendHeaders();
exit(0);
}
$lang = array();
define('DEFAULT_LANG', 'fr');
include(ROOT_PATH . 'includes/functions.' . PHPEXT);
include(ROOT_PATH . 'includes/unlocalised.' . PHPEXT);
include(ROOT_PATH . 'includes/todofleetcontrol.' . PHPEXT);
include(ROOT_PATH . 'language/' . DEFAULT_LANG . '/lang_info.cfg');
include(ROOT_PATH . 'includes/vars.' . PHPEXT);
include(ROOT_PATH . 'includes/strings.' . PHPEXT);
$user = Wootook_Player_Model_Session::getSingleton()->getPlayer();
if (!defined('DISABLE_IDENTITY_CHECK')) {
if ($user === null || !$user->getId()) {
Wootook::getResponse()
->setRedirect(Wootook::getUrl('player/account/login'))
->sendHeaders();
exit(0);
}
//var_dump(Wootook::getGameConfig('game/general/active'));
if (!Wootook::getGameConfig('game/general/active')/* && !in_array($user->getData('authlevel'), array(LEVEL_ADMIN, LEVEL_MODERATOR, LEVEL_OPERATOR))*/) {
$layout = new Wootook_Core_Model_Layout(Wootook_Core_Model_Layout::DOMAIN_FRONTEND);
$layout->load('message');
$block = $layout->getBlock('message');
$block['title'] = Wootook::__('Game is disabled.');
$block['message'] = Wootook::getGameConfig('game/general/closing-message');
echo $layout->render();
exit(0);
}
}
includeLang('system');
includeLang('tech');
if (($user !== null && $user->getId())) {
if (isset($_GET['cp']) && !empty($_GET['cp'])) {
$user->updateCurrentPlanet((int) $_GET['cp']);
}
$planet = $user->getCurrentPlanet();
foreach ($user->getPlanetCollection() as $userPlanet) {
FlyingFleetHandler($userPlanet); // TODO: implement logic into a refactored model
}
/*
* Update planet resources and constructions
*/
Wootook::dispatchEvent('planet.update', array(
'planet' => $planet
));
$planet->save();
}

View file

View file

@ -1,36 +0,0 @@
<?php
/**
* Created by JetBrains PhpStorm.
* User: Greg
* Date: 20/03/12
* Time: 21:48
* To change this template use File | Settings | File Templates.
*/
interface Legacies_Core_Unit
{
const TYPE_BUILDING = 'building';
const TYPE_BUILDING_MOON = 'building_moon';
const TYPE_BUILDING_PLANET = 'building_planet';
const TYPE_RESEARCH = 'technology';
const TYPE_SHIP = 'ship';
const TYPE_DEFENSE = 'defense';
const TYPE_SPECIAL = 'special';
const TYPE_PRODUCTION = 'production';
const TYPE_FLEET_MISSION = 'mission';
const RESOURCE_TITANIUM = 'titanium';
const RESOURCE_SILICIUM = 'silicium';
const RESOURCE_HYDROGEN = 'hydrogen';
const RESOURCE_ANTIMATTER = 'antimatter';
const RESOURCE_ENERGY = 'energy';
const ID_BUILDING_TITANIUM_MINE = 'titanium-mine';
const ID_BUILDING_SILICIUM_MINE = 'silicium-mine';
const ID_BUILDING_HYDROGEN_PUMP = 'hydrogen-pump';
const ID_BUILDING_SOLAR_PLANT = 'solar-plant';
const ID_BUILDING_ATOMIC_FUSION_PLANT = 'atomic-fusion-plant';
const ID_BUILDING_SHIPYARD = 'shipyard';
const ID_BUILDING_TITANIUM_STORAGE = 'titanium-storage';
const ID_BUILDING_SILICIUM_STORAGE = 'silicium-storage';
const ID_BUILDING_HYDROGEN_TANK = 'hydrogen-tank';
}

View file

@ -1,161 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/agpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2011-Present, Grégory PLANCHAT <g.planchat@gmail.com>
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
/**
*
* Enter description here ...
* @author Greg
*
*/
class Legacies_Empire
{
const TYPE_BUILDING = 'build';
const TYPE_BUILDING_MOON = 'build_moon';
const TYPE_BUILDING_PLANET = 'build_planet';
const TYPE_RESEARCH = 'tech';
const TYPE_SHIP = 'fleet';
const TYPE_DEFENSE = 'defense';
const TYPE_SPECIAL = 'special';
const TYPE_OFFICER = 'officier';
const TYPE_PRODUCTION = 'prod';
const TYPE_FLEET_MISSION = 'mission';
const RESOURCE_METAL = 'metal';
const RESOURCE_CRISTAL = 'cristal';
const RESOURCE_DEUTERIUM = 'deuterium';
const RESOURCE_ENERGY = 'energy';
const RESOURCE_MULTIPLIER = 'factor';
const RESOURCE_FORMULA = 'formule';
const RESOURCE_CLASS = 'class';
const BASE_BUILDING_TIME = 'base_time';
const SHIPS_CONSUMPTION_PRIMARY = 'consumption';
const SHIPS_CELERITY_PRIMARY = 'speed';
const SHIPS_CONSUMPTION_SECONDARY = 'consumption2';
const SHIPS_CELERITY_SECONDARY = 'speed2';
const SHIPS_CAPACITY = 'capacity';
const ID_BUILDING_METAL_MINE = 1;
const ID_BUILDING_CRISTAL_MINE = 2;
const ID_BUILDING_DEUTERIUM_SYNTHETISER = 3;
const ID_BUILDING_SOLAR_PLANT = 4;
const ID_BUILDING_FUSION_REACTOR = 12;
const ID_BUILDING_ROBOTIC_FACTORY = 14;
const ID_BUILDING_NANITE_FACTORY = 15;
const ID_BUILDING_SHIPYARD = 21;
const ID_BUILDING_METAL_STORAGE = 22;
const ID_BUILDING_CRISTAL_STORAGE = 23;
const ID_BUILDING_DEUTERIUM_TANK = 24;
const ID_BUILDING_RESEARCH_LAB = 31;
const ID_BUILDING_TERRAFORMER = 33;
const ID_BUILDING_ALLIANCE_DEPOT = 34;
const ID_BUILDING_LUNAR_BASE = 41;
const ID_BUILDING_SENSOR_PHALANX = 42;
const ID_BUILDING_JUMP_GATE = 43;
const ID_BUILDING_MISSILE_SILO = 44;
const ID_RESEARCH_ESPIONAGE_TECHNOLOGY = 106;
const ID_RESEARCH_COMPUTER_TECHNOLOGY = 108;
const ID_RESEARCH_WEAPON_TECHNOLOGY = 109;
const ID_RESEARCH_SHIELDING_TECHNOLOGY = 110;
const ID_RESEARCH_ARMOUR_TECHNOLOGY = 111;
const ID_RESEARCH_ENERGY_TECHNOLOGY = 113;
const ID_RESEARCH_HYPERSPACE_TECHNOLOGY = 114;
const ID_RESEARCH_COMBUSTION_DRIVE = 115;
const ID_RESEARCH_IMPULSE_DRIVE = 117;
const ID_RESEARCH_HYPERSPACE_DRIVE = 118;
const ID_RESEARCH_LASER_TECHNOLOGY = 120;
const ID_RESEARCH_ION_TECHNOLOGY = 121;
const ID_RESEARCH_PLASMA_TECHNOLOGY = 122;
const ID_RESEARCH_INTERGALACTIC_RESEARCH_NETWORK = 123;
const ID_RESEARCH_EXPEDITION_TECHNOLOGY = 124;
const ID_RESEARCH_ASTROPHYSICS = 124;
const ID_RESEARCH_ORE_MINING = 125;
const ID_RESEARCH_GRAVITON_TECHNOLOGY = 199;
const ID_SHIP_LIGHT_TRANSPORT = 202;
const ID_SHIP_LARGE_TRANSPORT = 203;
const ID_SHIP_LIGHT_FIGHTER = 204;
const ID_SHIP_HEAVY_FIGHTER = 205;
const ID_SHIP_CRUISER = 206;
const ID_SHIP_BATTLESHIP = 207;
const ID_SHIP_COLONY_SHIP = 208;
const ID_SHIP_RECYCLER = 209;
const ID_SHIP_SPY_DRONE = 210;
const ID_SHIP_BOMBER = 211;
const ID_SHIP_SOLAR_SATELLITE = 212;
const ID_SHIP_DESTRUCTOR = 213;
const ID_SHIP_DEATH_STAR = 214;
const ID_SHIP_BATTLECRUISER = 215;
const ID_SHIP_SUPERNOVA = 216;
const ID_SHIP_ORE_MININER = 217;
const ID_DEFENSE_ROCKET_LAUNCHER = 401;
const ID_DEFENSE_LIGHT_LASER = 402;
const ID_DEFENSE_HEAVY_LASER = 403;
const ID_DEFENSE_ION_CANNON = 404;
const ID_DEFENSE_GAUSS_CANNON = 405;
const ID_DEFENSE_PLASMA_TURRET = 406;
const ID_DEFENSE_SMALL_SHIELD_DOME = 407;
const ID_DEFENSE_LARGE_SHIELD_DOME = 408;
const ID_SPECIAL_ANTIBALLISTIC_MISSILE = 502;
const ID_SPECIAL_INTERPLANETARY_MISSILE = 503;
const ID_COMBAT_SHIELDS = 'shield';
const ID_COMBAT_FIREPOWER = 'attack';
const ID_COMBAT_RAPID_FIRE = 'sd';
const ID_MISSION_ATTACK = 1;
const ID_MISSION_GROUP_ATTACK = 2;
const ID_MISSION_TRANSPORT = 3;
const ID_MISSION_STATION = 4;
const ID_MISSION_STATION_ALLY = 5;
const ID_MISSION_SPY = 6;
const ID_MISSION_SETTLE_COLONY = 7;
const ID_MISSION_RECYCLE = 8;
const ID_MISSION_DESTROY = 9;
const ID_MISSION_MISSILES = 10;
const ID_MISSION_EXPEDITION = 15;
const ID_MISSION_ORE_MINING = 16;
public static function getFieldName($id)
{
$fieldsAlias = Wootook_Empire_Helper_Config_FieldsAlias::getSingleton();
if (!isset($fieldsAlias[$id])) {
return null;
}
return $fieldsAlias[$id];
}
}

View file

@ -1,76 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/agpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2011-Present, Grégory PLANCHAT <g.planchat@gmail.com>
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
/**
*
* Enter description here ...
* @author Greg
*
*/
class Legacies_Empire_Block_Planet_ResearchLab
extends Wootook_Empire_Block_Planet_BuilderAbstract
{
protected $_planet = null;
public function setPlanet(Wootook_Empire_Model_Planet $planet)
{
$this->_planet = $planet;
return $this;
}
public function getPlanet()
{
if ($this->_planet === null) {
$this->_planet = Wootook_Player_Model_Session::getSingleton()->getPlayer()
->getCurrentPlanet()
;
}
return $this->_planet;
}
public function _initChildBlocks()
{
$types = Wootook_Empire_Helper_Config_Types::getSingleton();
/** @var Wootook_Core_Block_Concat $parentBlock */
$parentBlock = $this->getLayout()->getBlock('item-list.items');
foreach ($types->getData(Legacies_Empire::TYPE_RESEARCH) as $itemId) {
if (!$this->getPlanet()->getResearchLab()->checkAvailability($itemId)) {
continue;
}
$block = $this->getItemBlock($itemId);
$parentBlock->setPartial($block->getName(), $block);
}
return $this;
}
}

View file

@ -1,90 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/agpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2011-Present, Grégory PLANCHAT <g.planchat@gmail.com>
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
/**
*
* Enter description here ...
* @author Greg
*
*/
class Legacies_Empire_Block_Planet_ResearchLab_Item
extends Wootook_Empire_Block_Planet_Builder_ItemAbstract
{
public function getLevel()
{
return $this->getPlayer()->getElement($this->getItemId());
}
public function getResourcesNeeded($level)
{
return $this->getPlanet()->getResearchLab()->getResourcesNeeded($this->getItemId(), $level);
}
public function getQueuedLevel()
{
return $this->getPlanet()->getResearchLab()->getResearchLevelQueued($this->getItemId());
}
public function getBuildingTime($level)
{
return $this->getPlanet()->getResearchLab()->getResearchTime($this->getItemId(), $level);
}
public function getResourcesConfigForLevel($level)
{
$resources = $this->getResourcesNeeded($level);
$resourceConfig = array();
foreach ($resources as $resourceId => $resourceValue) {
$resourceConfig[$resourceId] = new Wootook_Object(array(
'resource_id' => $resourceId,
'value' => $resourceValue
));
$amount = $this->getPlanet()->getResourceAmount($resourceId);
if (Math::comp($amount, $resourceValue) < 0) {
$resourceConfig[$resourceId]->setData('requirement', Math::sub($amount, $resourceValue));
} else {
$resourceConfig[$resourceId]->setData('overflow', Math::sub($amount, $resourceValue));
}
}
return $resourceConfig;
}
public function getResourcesConfigForNextLevel()
{
return $this->getResourcesConfigForLevel($this->getNextLevel());
}
public function getBuildingTimeForNextLevel()
{
return $this->getBuildingTime($this->getNextLevel());
}
}

View file

@ -1,48 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/agpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2011-Present, Grégory PLANCHAT <g.planchat@gmail.com>
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
/**
*
* Enter description here ...
* @author Greg
*
*/
class Legacies_Empire_Block_Planet_ResearchLab_Queue
extends Wootook_Empire_Block_Planet_Builder_QueueAbstract
{
public function getQueue()
{
return $this->getPlanet()->getResearchLab()->getBuilder();
}
public function isEmpty()
{
return $this->getQueue()->count() == 0;
}
}

View file

@ -1,101 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/agpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2011-Present, Grégory PLANCHAT <g.planchat@gmail.com>
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
/**
*
* Enter description here ...
* @author Greg
*
*/
class Legacies_Empire_Block_Planet_ResearchLab_Queue_Item
extends Wootook_Empire_Block_Planet_Builder_Queue_ItemAbstract
{
protected $_itemIdField = 'technology_id';
public function getLevel()
{
return $this->getPlayer()->getElement($this->getItemId());
}
public function getResourcesNeeded($level)
{
return $this->getPlanet()->getResearchLab()->getResourcesNeeded($this->getItemId(), $this->getQueuedLevel() + 1);
}
public function getQueuedLevel()
{
return $this->getPlanet()->getResearchLab()->getResearchLevelQueued($this->getItemId());
}
public function getBuildingTime($level)
{
return $this->getPlanet()->getResearchLab()->getBuildingTime($this->getItemId(), $level);
}
public function getBuildingRemainingTime()
{
$totalTime = $this->getPlanet()->getResearchLab()
->getResearchTime($this->getItemId(), $this->getItemQueuedLevel());
$item = $this->getItem();
return $totalTime - ($item->getData('created_at') - $item->getData('updated_at'));
}
public function getResourcesConfigForLevel($level)
{
$resources = $this->getResourcesNeeded($level);
$resourceConfig = array();
foreach ($resources as $resourceId => $resourceValue) {
$resourceConfig[$resourceId] = new Wootook_Object(array(
'resource_id' => $resourceId,
'value' => $resourceValue
));
$amount = $this->getPlanet()->getResourceAmount($resourceId);
if (Math::comp($amount, $resourceValue) < 0) {
$resourceConfig[$resourceId]->setData('requirement', Math::sub($amount, $resourceValue));
} else {
$resourceConfig[$resourceId]->setData('overflow', Math::sub($amount, $resourceValue));
}
}
return $resourceConfig;
}
public function getResourcesConfigForNextLevel()
{
return $this->getResourcesConfigForLevel($this->getNextLevel());
}
public function getBuildingTimeForNextLevel()
{
return $this->getBuildingTime($this->getNextLevel());
}
}

View file

@ -1,119 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/agpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2011-Present, Grégory PLANCHAT <g.planchat@gmail.com>
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
/**
*
* Enter description here ...
* @author Greg
*
*/
class Legacies_Empire_Block_Planet_Shipyard
extends Wootook_Empire_Block_Planet_BuilderAbstract
{
protected $_planet = null;
protected $_type = Legacies_Empire::TYPE_SHIP;
protected $_allowedTypes = array(
Legacies_Empire::TYPE_SHIP,
Legacies_Empire::TYPE_DEFENSE
);
public function setPlanet(Wootook_Empire_Model_Planet $planet)
{
$this->_planet = $planet;
return $this;
}
public function getPlanet()
{
if ($this->_planet === null) {
$this->_planet = Wootook_Player_Model_Session::getSingleton()->getPlayer()
->getCurrentPlanet()
;
}
return $this->_planet;
}
public function setAllowedTypes($types)
{
if (is_array($types)) {
$this->_allowedTypes = $types;
}
return $this;
}
public function addAllowedType($type)
{
if (!in_array($type, $this->_allowedTypes)) {
$this->_allowedTypes[] = $type;
}
return $this;
}
public function getAllowedTypes()
{
return $this->_allowedTypes;
}
public function setType($type)
{
if (in_array($type, $this->_allowedTypes)) {
$this->_type = $type;
}
return $this;
}
public function getType()
{
return $this->_type;
}
public function _initChildBlocks()
{
$types = Wootook_Empire_Helper_Config_Types::getSingleton();
if (!$this->getPlanet() || !$this->getPlanet()->getShipyard()) {
return $this;
}
/** @var Wootook_Core_Block_Concat $parentBlock */
$parentBlock = $this->getLayout()->getBlock('item-list.items');
foreach ($types->getData($this->getType()) as $itemId) {
if (!$this->getPlanet()->getShipyard()->checkAvailability($itemId)) {
continue;
}
$block = $this->getItemBlock($itemId);
$parentBlock->setPartial($block->getName(), $block);
}
return $this;
}
}

View file

@ -1,85 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/agpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2011-Present, Grégory PLANCHAT <g.planchat@gmail.com>
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
/**
*
* Enter description here ...
* @author Greg
*
*/
class Legacies_Empire_Block_Planet_Shipyard_Item
extends Wootook_Empire_Block_Planet_Builder_ItemAbstract
{
public function getQty()
{
return $this->getPlanet()->getElement($this->getItemId());
}
public function getClass()
{
return $this->getLabel('class');
}
public function getResourcesNeeded($qty)
{
return $this->getPlanet()->getShipyard()->getResourcesNeeded($this->getItemId(), $qty);
}
public function getBuildingTime($qty)
{
return $this->getPlanet()->getShipyard()->getBuildingTime($this->getItemId(), $qty);
}
public function getMaximumBuildableElementsCount()
{
return $this->getPlanet()->getShipyard()->getMaximumBuildableElementsCount($this->getItemId());
}
public function getResourcesConfigForQty($qty)
{
$resources = $this->getResourcesNeeded($qty);
$resourceConfig = array();
foreach ($resources as $resourceId => $resourceValue) {
$resourceConfig[$resourceId] = new Wootook_Object(array(
'resource_id' => $resourceId,
'value' => $resourceValue
));
$amount = $this->getPlanet()->getResourceAmount($resourceId);
if (Math::comp($amount, $resourceValue) < 0) {
$resourceConfig[$resourceId]->setData('requirement', Math::sub($amount, $resourceValue));
} else {
$resourceConfig[$resourceId]->setData('overflow', Math::sub($amount, $resourceValue));
}
}
return $resourceConfig;
}
}

View file

@ -1,49 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/agpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2011-Present, Grégory PLANCHAT <g.planchat@gmail.com>
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
/**
*
* Enter description here ...
* @author Greg
*
*/
class Legacies_Empire_Block_Planet_Shipyard_Queue
extends Wootook_Empire_Block_Planet_Builder_QueueAbstract
{
public function getQueue()
{
return $this->getPlanet()->getShipyard()->getBuilder();
}
public function isEmpty()
{
return $this->getQueue()->count() == 0;
}
}

View file

@ -1,101 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/agpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2011-Present, Grégory PLANCHAT <g.planchat@gmail.com>
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
/**
*
* Enter description here ...
* @author Greg
*
*/
class Legacies_Empire_Block_Planet_Shipyard_Queue_Item
extends Wootook_Empire_Block_Planet_Builder_Queue_ItemAbstract
{
protected $_itemIdField = 'ship_id';
public function getQty()
{
return $this->getPlanet()->getElement($this->getItemId());
}
public function getResourcesNeeded($level)
{
return $this->getPlanet()->getShipyard()->getResourcesNeeded($this->getItemId(), 1);
}
public function getItemQueuedQty()
{
return $this->getItem()->getData('qty');
}
public function getBuildingTime($qty)
{
return $this->getPlanet()->getShipyard()->getBuildingTime($this->getItemId(), $qty);
}
public function getBuildingRemainingTime()
{
$totalTime = $this->getPlanet()->getShipyard()
->getBuildingTime($this->getItemId(), $this->getItemQueuedQty());
$item = $this->getItem();
return $totalTime - ($item->getData('created_at') - $item->getData('updated_at'));
}
public function getResourcesConfigForQty($qty)
{
$resources = $this->getResourcesNeeded($qty);
$resourceConfig = array();
foreach ($resources as $resourceId => $resourceValue) {
$resourceConfig[$resourceId] = new Wootook_Object(array(
'resource_id' => $resourceId,
'value' => $resourceValue
));
$amount = $this->getPlanet()->getResourceAmount($resourceId);
if (Math::comp($amount, $resourceValue) < 0) {
$resourceConfig[$resourceId]->setData('requirement', Math::sub($amount, $resourceValue));
} else {
$resourceConfig[$resourceId]->setData('overflow', Math::sub($amount, $resourceValue));
}
}
return $resourceConfig;
}
public function getResourcesConfigForNextLevel()
{
return $this->getResourcesConfigForLevel($this->getNextLevel());
}
public function getBuildingTimeForNextLevel()
{
return $this->getBuildingTime($this->getNextLevel());
}
}

View file

@ -1,56 +0,0 @@
<?php
/**
* Created by JetBrains PhpStorm.
* User: Greg
* Date: 19/03/12
* Time: 18:11
* To change this template use File | Settings | File Templates.
*/
class Legacies_Empire_Controller_DefenseController
extends Wootook_Player_Mvc_Controller_Registered
{
public function preDispatch()
{
parent::preDispatch();
$planet = $this->getCurrentPlanet();
if ($planet->getElement(Legacies_Empire::ID_BUILDING_SHIPYARD) < 1) {
$this->getSession()
->addError(Wootook::__('In order to build defenses you will need to build a shipyard building.'));
$this->_redirect('player/overview');
return;
}
}
public function indexAction()
{
$this->loadLayout('planet.defense');
/** @var Legacies_Empire_Block_Planet_Shipyard $block */
$block = $this->getLayout()->getBlock('item-list');
$block->setType(Legacies_Empire::TYPE_DEFENSE);
$this->renderLayout();
}
public function buildAction()
{
if (!$this->getRequest()->isPost() || !is_array($defenseList = $this->getRequest()->getPost('id'))) {
$this->_redirect('*/*/view');
return;
}
$shipyard = $this->getCurrentPlanet()->getShipyard();
foreach ($defenseList as $defenseId => $count) {
$defenseId = intval($defenseId);
$count = intval($count);
$shipyard->appendQueue($defenseId, $count);
}
$this->getCurrentPlanet()->save();
$this->_redirect('*/*/');
}
}

View file

@ -1,60 +0,0 @@
<?php
/**
* Created by JetBrains PhpStorm.
* User: Greg
* Date: 19/03/12
* Time: 18:11
* To change this template use File | Settings | File Templates.
*/
class Legacies_Empire_Controller_ResearchLabController
extends Wootook_Player_Mvc_Controller_Registered
{
public function preDispatch()
{
parent::preDispatch();
$planet = $this->getCurrentPlanet();
if ($planet->getElement(Legacies_Empire::ID_BUILDING_SHIPYARD) < 1) {
$this->getSession()
->addError(Wootook::__('In order to do technological researches, you will need to build a research lab building.'));
$this->_redirect('player/overview');
return;
}
}
public function indexAction()
{
$this->loadLayout('planet.research-lab');
$this->renderLayout();
}
public function buildAction()
{
if (!is_numeric($researchId = $this->getRequest()->getParam('id'))) {
$this->_redirect('*/*/view');
return;
}
$this->getCurrentPlanet()->getResearchLab()->appendQueue($researchId);
$this->getCurrentPlanet()->save();
$this->getPlayer()->save();
$this->_redirect('*/*/');
}
public function cancelAction()
{
if (!is_numeric($researchId = $this->getRequest()->getParam('id'))) {
$this->_redirect('*/*/view');
return;
}
$this->getCurrentPlanet()->getResearchLab()->dequeueItem($researchId);
$this->getCurrentPlanet()->save();
$this->getPlayer()->save();
$this->_redirect('*/*/');
}
}

View file

@ -1,51 +0,0 @@
<?php
/**
* Created by JetBrains PhpStorm.
* User: Greg
* Date: 19/03/12
* Time: 18:11
* To change this template use File | Settings | File Templates.
*/
class Legacies_Empire_Controller_ShipyardController
extends Wootook_Player_Mvc_Controller_Registered
{
public function preDispatch()
{
parent::preDispatch();
$planet = $this->getCurrentPlanet();
if ($planet->getElement(Legacies_Empire::ID_BUILDING_SHIPYARD) < 1) {
$this->getSession()
->addError(Wootook::__('In order to build ships you will need to build a shipyard building.'));
$this->_redirect('player/overview');
return;
}
}
public function indexAction()
{
$this->loadLayout('planet.shipyard');
$this->renderLayout();
}
public function buildAction()
{
if (!$this->getRequest()->isPost() || !is_array($shipList = $this->getRequest()->getPost('id'))) {
$this->_redirect('*/*/');
return;
}
$shipyard = $this->getCurrentPlanet()->getShipyard();
foreach ($shipList as $shipId => $count) {
$shipId = intval($shipId);
$count = intval($count);
$shipyard->appendQueue($shipId, $count);
}
$this->getCurrentPlanet()->save();
$this->_redirect('*/*/');
}
}

View file

@ -1,37 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/agpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2011-Present, Grégory PLANCHAT <g.planchat@gmail.com>
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
/**
*
* Enter description here ...
* @author Greg
*
*/
interface Legacies_Empire_Exception {}

View file

@ -1,46 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/agpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2011-Present, Grégory PLANCHAT <g.planchat@gmail.com>
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
/**
*
* Enter description here ...
* @author Greg
*
*/
class Legacies_Empire_Model_Planet_Building_CristalMine
implements Wootook_Empire_Model_Planet_ResourceProductionInterface, Wootook_Empire_Model_Planet_BuildingInterface
{
public function getProductionRatios($level, $produtionRatio, $planet, $player)
{
return array(
Legacies_Empire::RESOURCE_CRISTAL => 10 + 20 * floatval($level) * pow(1.1, floatval($level)) * (0.1 * $produtionRatio),
Legacies_Empire::RESOURCE_ENERGY => -10 * floatval($level) * pow(1.1, floatval($level)) * (0.1 * $produtionRatio)
);
}
}

View file

@ -1,46 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/agpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2011-Present, Grégory PLANCHAT <g.planchat@gmail.com>
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
/**
*
* Enter description here ...
* @author Greg
*
*/
class Legacies_Empire_Model_Planet_Building_DeuteriumSynthetiser
implements Wootook_Empire_Model_Planet_ResourceProductionInterface, Wootook_Empire_Model_Planet_BuildingInterface
{
public function getProductionRatios($level, $produtionRatio, $planet, $player)
{
return array(
Legacies_Empire::RESOURCE_DEUTERIUM => 10 * floatval($level) * pow(1.1, floatval($level)) * (0.1 * $produtionRatio),
Legacies_Empire::RESOURCE_ENERGY => -30 * floatval($level) * pow(1.1, floatval($level)) * (0.1 * $produtionRatio)
);
}
}

View file

@ -1,46 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/agpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2011-Present, Grégory PLANCHAT <g.planchat@gmail.com>
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
/**
*
* Enter description here ...
* @author Greg
*
*/
class Legacies_Empire_Model_Planet_Building_FusionReactor
implements Wootook_Empire_Model_Planet_ResourceProductionInterface, Wootook_Empire_Model_Planet_BuildingInterface
{
public function getProductionRatios($level, $produtionRatio, $planet, $player)
{
return array(
Legacies_Empire::RESOURCE_DEUTERIUM => -10 * floatval($level) * pow(1.1, floatval($level)) * (0.1 * $produtionRatio),
Legacies_Empire::RESOURCE_ENERGY => 50 * floatval($level) * pow(1.1, floatval($level)) * (0.1 * $produtionRatio)
);
}
}

View file

@ -1,47 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/agpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2011-Present, Grégory PLANCHAT <g.planchat@gmail.com>
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
/**
*
* Enter description here ...
* @author Greg
*
*/
class Legacies_Empire_Model_Planet_Building_MetalMine
implements Wootook_Empire_Model_Planet_ResourceProductionInterface, Wootook_Empire_Model_Planet_BuildingInterface
{
public function getProductionRatios($level, $produtionRatio, $planet, $player)
{
return array(
Legacies_Empire::RESOURCE_METAL => 20 + 30 * floatval($level) * pow(1.1, floatval($level)) * (0.1 * $produtionRatio),
Legacies_Empire::RESOURCE_ENERGY => -10 * floatval($level) * pow(1.1, floatval($level)) * (0.1 * $produtionRatio)
);
}
}

View file

@ -1,51 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/agpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2011-Present, Grégory PLANCHAT <g.planchat@gmail.com>
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
/**
*
* Enter description here ...
* @author Greg
*
*/
class Legacies_Empire_Model_Planet_Building_NaniteFactory
implements Wootook_Empire_Model_Planet_BuildingInterface
{
public static function buildingEnhancementListener(Wootook_Core_Event $event)
{
/** @var float $enhancement */
$enhancement = $event->getData('enhancement');
/** @var Wootook_Empire_Model_Planet $planet */
$planet = $event->getData('planet');
$level = $planet->getElement(Legacies_Empire::ID_BUILDING_NANITE_FACTORY);
$event->setData('enhancement', $enhancement * pow(.5, $level));
}
}

View file

@ -1,272 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/agpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2011-Present, Grégory PLANCHAT <g.planchat@gmail.com>
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
/**
* Research lab building, manages researches queue on each planet
*
* @access public
* @category Empire
* @category Planet
* @package Legacies
* @subpackage Legacies_Empire
*/
class Legacies_Empire_Model_Planet_Building_ResearchLab
implements Wootook_Empire_Model_Planet_BuildingInterface,
Wootook_Empire_Model_Planet_QueueInterface
{
private $_eventPrefix = 'planet.laboratory.';
/**
* Planet instance
* @var Legacies_Empire_Model_Planet
*/
protected $_currentPlanet = null;
/**
* Player instance
* @var Woootook_Player_Model_Entity
*/
protected $_currentPlayer = null;
/**
* construction queue
* @var Legacies_Empire_Model_Planet_Building_ResearchLab_Builder
*/
protected $_builder = null;
/**
* Multiton instances
* @var array
*/
protected static $_instances = array();
/**
* Multiton factory. Retruns the planet's research lab instance or created it if
* it doesn't yet exist.
*
* @param Legacies_Empire_Model_Planet $currentPlanet
* @param Woootook_Player_Model_Entity $currentPlayer
* @return Legacies_Empire_Model_Planet_Building_ResearchLab
*/
public static function factory($currentPlanet, $currentPlayer)
{
if ($currentPlanet->getId()) {
return null;
}
if (!isset(self::$_instances[$currentPlanet->getId()])) {
self::$_instances[$currentPlanet->getId()] = new self($currentPlanet, $currentPlayer);
}
return self::$_instances[$currentPlanet->getId()];
}
/**
* Constructor. Used for specific usage, use the factory for standard usage.
*
* @see Legacies_Empire_Model_Planet_Building_ResearchLab::factory()
*
* @param Legacies_Empire_Model_Planet $currentPlanet
* @param Woootook_Player_Model_Entity $currentPlayer
*/
public function __construct($currentPlanet, $currentPlayer)
{
$this->_currentPlanet = $currentPlanet;
$this->_currentPlayer = $currentPlayer;
$this->_builder = new Legacies_Empire_Model_Planet_Building_ResearchLab_Builder($currentPlanet, $currentPlayer);
}
/**
* @deprecated
* @return Legacies_Empire_Model_Planet_Building_ResearchLab
*/
public function save()
{
$this->_currentPlanet->save();
return $this;
}
/**
* Append items to build to the construction list
*
* @param int $researchId
* @param int|string $level
* @return Legacies_Empire_Model_Planet_Building_ResearchLab
*/
public function appendQueue($researchId, $level = null, Wootook_Core_DateTime $time = null)
{
if ($time === null) {
$time = new Wootook_Core_DateTime();
}
if ($level === null) {
$level = $this->_currentPlayer->getElement($researchId) + 1;
}
// Dispatch event
Wootook::dispatchEvent($this->_eventPrefix . 'append-queue.before', array(
'research_id' => $researchId,
'level' => &$level,
'time' => &$time,
'laboratory' => $this,
'planet' => $this->_currentPlanet,
'player' => $this->_currentPlayer
));
$this->_builder->appendQueue($researchId, $level, $time);
// Dispatch event
Wootook::dispatchEvent($this->_eventPrefix . 'append-queue.after', array(
'research_id' => $researchId,
'level' => $level,
'time' => $time,
'laboratory' => $this,
'planet' => $this->_currentPlanet,
'player' => $this->_currentPlayer
));
return $this;
}
/**
* Update the contruction queue.
*
* @return Legacies_Empire_Model_Planet_Building_ResearchLab
*/
public function updateQueue(Wootook_Core_DateTime $time = null)
{
if ($time === null) {
$time = new Wootook_Core_DateTime();
}
// Dispatch event
Wootook::dispatchEvent($this->_eventPrefix . 'update-queue.before', array(
'time' => &$time,
'laboratory' => $this,
'planet' => $this->_currentPlanet,
'player' => $this->_currentPlayer
));
$this->_builder->updateQueue($time);
// Dispatch event
Wootook::dispatchEvent($this->_eventPrefix . 'update-queue.after', array(
'time' => $time,
'laboratory' => $this,
'planet' => $this->_currentPlanet,
'player' => $this->_currentPlayer
));
return $this;
}
/**
* Return the construction queue
* @see Legacies_Empire_Model_Planet_Building_ResearchLab_Builder
*
* @return array
*/
public function getBuilder()
{
return $this->_builder;
}
/**
* Check if a ship or defense type is actually buildable on the current
* planet, depending on the technology and buildings requirements.
*
* @param int $resourceId
* @return bool
*/
public function checkAvailability($researchId)
{
try {
if (!$this->_builder->checkAvailability($researchId)) {
return false;
}
// Dispatch event
Wootook::dispatchEvent($this->_eventPrefix . 'check-availability', array(
'research_id' => $researchId,
'laboratory' => $this,
'planet' => $this->_currentPlanet,
'player' => $this->_currentPlayer
));
} catch (Legacies_Core_Event_Break $e) {
return false;
}
return true;
}
public function getResourcesNeeded($researchId, $level)
{
return $this->_builder->getResourcesNeeded($researchId, $level);
}
public function getResearchTime($researchId, $level)
{
return $this->_builder->getBuildingTime($researchId, $level);
}
public function getResearchLevelQueued($researchId)
{
$level = $this->_currentPlayer->getElement($researchId);
foreach ($this->_builder as $item) {
if ($item->getData('research_id') != $researchId) {
continue;
}
$level = $item->getData('level');
}
return $level;
}
public static function planetUpdateListener($eventData)
{
if (isset($eventData['planet'])) {
$planet = $eventData['planet'];
if ($planet === null || !$planet instanceof Legacies_Empire_Model_Planet || !$planet->getId()) {
return;
}
$time = null;
if (isset($eventData['time'])) {
$time = $eventData['time'];
}
$researchLab = $planet->getResearchLab();
if ($researchLab !== null) {
$researchLab->updateQueue();
}
}
}
}

View file

@ -1,358 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/agpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2011-Present, Grégory PLANCHAT <g.planchat@gmail.com>
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
/**
*
* Enter description here ...
* @author Greg
*
*/
class Legacies_Empire_Model_Planet_Building_ResearchLab_Builder
extends Wootook_Empire_Model_BuilderAbstract
{
const FIELD_SERIALIZED = 'b_tech_id';
const FIELD_DATETIME = 'b_tech';
/**
* @var int
*/
protected $_maxLength = 0;
/**
* @var float
*/
protected $_speedEnhancement = null;
public function init()
{
$this->_unserializeQueue($this->_currentPlanet->getData(self::FIELD_SERIALIZED));
$this->_maxLength = Wootook::getGameConfig('engine/core/lab_queue_size');
}
/**
* @param array $params
*/
protected function _initItem(Array $params)
{
if (!isset($params['technology_id']) || !isset($params['level'])) {
return null;
}
$technologyId = $params['technology_id'];
$level = $params['level'];
if (!isset($params['created_at'])) {
$createdAt = new Wootook_Core_DateTime();
} else {
$createdAt = $params['created_at'];
}
if (!isset($params['started_at'])) {
$startedAt = null;
} else {
$startedAt = $params['started_at'];
}
if (!isset($params['updated_at'])) {
$updatedAt = $createdAt;
} else {
$updatedAt = $params['updated_at'];
}
return new Legacies_Empire_Model_Planet_Building_ResearchLab_Item(array(
'technology_id' => $technologyId,
'level' => $level,
'created_at' => $createdAt,
'started_at' => $startedAt,
'updated_at' => $updatedAt
));
}
public function getSpeedEnhancement()
{
if ($this->_speedEnhancement === null) {
$event = Wootook::dispatchEvent('planet.research-lab.technology.speed-enhancement', array(
'player' => $this->_currentPlanet,
'planet' => $this->_currentPlanet,
'enhancement' => 1
));
$this->_speedEnhancement = $event->getData('enhancement');
}
return $this->_speedEnhancement;
}
/**
* Check if a technology type is actually buildable on the current
* planet, depending on the technology and buildings requirements.
*
* @param int|string $technologyId
* @return bool
*/
public function checkAvailability($technologyId)
{
$types = Wootook_Empire_Helper_Config_Types::getSingleton();
if (!$types->is($technologyId, Legacies_Empire::TYPE_RESEARCH)) {
return false;
}
return parent::checkAvailability($technologyId);
}
/**
* Returns the time needed to build $level of $technologyId
*
* @param int|string $technologyId
* @param int $level
*/
public function getBuildingTime($technologyId, $level)
{
$prices = Wootook_Empire_Helper_Config_Prices::getSingleton();
Math::setPrecision(50);
$firstLevelTime = $prices[$technologyId][Legacies_Empire::BASE_BUILDING_TIME];
$partialLevelTime = Math::mul($firstLevelTime, Math::pow($prices[$technologyId][Legacies_Empire::RESOURCE_MULTIPLIER], $level));
$levelTime = Math::sub($partialLevelTime, $firstLevelTime);
$speedFactor = Wootook::getGameConfig('game/speed/general');
if ($speedFactor == null) {
$speedFactor = 1;
}
$baseTime = ($levelTime * 3600 / $speedFactor) / $this->getSpeedEnhancement();
Math::setPrecision();
$event = Wootook::dispatchEvent('planet.research-lab.technology.building-time', array(
'time' => $baseTime,
'base_time' => $baseTime,
'planet' => $this->_currentPlanet,
'player' => $this->_currentPlayer,
'technology_id' => $technologyId,
'level' => $level
));
return $event->getData('time');
}
/**
* (non-PHPdoc)
* @see Legacies_Empire_Model_BuilderAbstract::getResourcesNeeded()
*/
public function getResourcesNeeded($technologyId, $level)
{
$prices = Wootook_Empire_Helper_Config_Prices::getSingleton();
$resources = Wootook_Empire_Helper_Config_Resources::getSingleton();
if (!isset($prices[$technologyId])) {
return array();
}
$resourcesNeeded = array();
foreach ($resources as $resourceId => $resourceConfig) {
if (!isset($prices[$technologyId][$resourceId])) {
continue;
}
if (Math::isPositive($prices[$technologyId][$resourceId])) {
$firstLevelCost = $prices[$technologyId][$resourceId];
$partialLevelCost = Math::mul($firstLevelCost, Math::pow($prices[$technologyId][Legacies_Empire::RESOURCE_MULTIPLIER], $level));
$resourcesNeeded[$resourceId] = Math::sub($partialLevelCost, $firstLevelCost);
}
}
return $resourcesNeeded;
}
/**
* Update the contruction queue.
*
* @return Legacies_Empire_Model_Planet_Building_ResearchLab
*/
public function updateQueue(Wootook_Core_DateTime $time)
{
$fields = Wootook_Empire_Helper_Config_FieldsAlias::getSingleton();
$startingTime = clone $this->_currentPlanet->getData(self::FIELD_DATETIME);
$elapsedTime = $time->getTimestamp() - $this->_currentPlanet->getData(self::FIELD_DATETIME)->getTimestamp();
foreach ($this->getQueue() as $element) {
$elementTime = $element->getData('started_at');
if ($elementTime === null) {
$element->setData('started_at', $startingTime->getTimestamp());
$elementTime = $startingTime->getTimestamp();
}
$level = $element->getData('level');
$technologyId = $element->getData('technology_id');
$buildTime = $this->getBuildingTime($technologyId, $level);
$elapsedTime = $time->getTimestamp() - $elementTime;
if ($elapsedTime >= $buildTime) {
$this->dequeue($element);
$currentTime = clone $startingTime;
$currentTime->add($elapsedTime);
$this->_currentPlayer->setElement($technologyId, $level);
$this->_currentPlanet->updateStorages($currentTime);
$this->_currentPlanet->updateResourceProduction($currentTime);
$this->_currentPlanet->updateBuildingFields();
Wootook::dispatchEvent('planet.research-lab.technology.level-update', array(
'time' => $currentTime,
'planet' => $this->_currentPlanet,
'player' => $this->_currentPlayer,
'technology_id' => $technologyId,
'level' => $level
));
$startingTime->set($elementTime + $buildTime);
continue;
}
break;
}
$this->_currentPlanet->setData(self::FIELD_SERIALIZED, $this->serialize());
$this->_currentPlanet->setData(self::FIELD_DATETIME, $startingTime->now());
return $this;
}
/**
* Append items to build to the construction list
*
* @param int|string $technologyId
* @param int $level
* @return Legacies_Empire_Model_Planet_Building_ResearchLab
*/
public function appendQueue($technologyId, $level, Wootook_Core_DateTime $time)
{
if ($this->_maxLength > 0 && $this->count() >= $this->_maxLength) {
return $this;
}
$types = Wootook_Empire_Helper_Config_Types::getSingleton();
if (!Math::isPositive($level)) {
return $this;
}
if (!$types->is($technologyId, Legacies_Empire::TYPE_RESEARCH)) {
return $this;
}
if (!$this->checkAvailability($technologyId)) {
return $this;
}
$resourcesNeeded = $this->getResourcesNeeded($technologyId, $level);
$remainingAmounts = $this->_calculateResourceRemainingAmounts($resourcesNeeded);
if ($remainingAmounts === false) {
return $this;
}
if ($this->count() == 0) {
$this->_currentPlanet->setData(self::FIELD_DATETIME, $time);
}
$this->enqueue(array(
'technology_id' => $technologyId,
'level' => $level,
'created_at' => $time->getTimestamp()
));
$this->_currentPlanet->setData(self::FIELD_SERIALIZED, $this->serialize());
$this->_currentPlayer->setdata('b_tech_planet', $this->_currentPlanet->getId());
foreach ($remainingAmounts as $resourceId => $resourceAmount) {
$this->_currentPlanet[$resourceId] = $resourceAmount;
}
return $this;
}
/**
* Dequeues the first item to build to the construction list and removes all
* its successors of the same type.
*
* @return Legacies_Empire_Model_Planet_Building_ResearchLab
*/
public function dequeueFirstItem()
{
$this->rewind();
$item = $this->current();
return $this->dequeueItem($item->getIndex());
}
/**
* Dequeues an item to build to the construction list and removes all its
* successors of the same type.
*
* @param string $itemId
* @return Legacies_Empire_Model_Planet_Building_ResearchLab
*/
public function dequeueItem($itemId)
{
$item = $this->getItem($itemId);
if (!$item) {
return $this;
}
$technologyId = $item->getData('technology_id');
$keys = array_keys($this->_queue);
$size = count($keys);
$start = array_search($item->getIndex(), $keys);
for ($i = $start; $i < $size; $i++) {
$index = $keys[$i];
if ($this->_queue[$index]->getData('technology_id') != $technologyId) {
continue;
}
$resourcesNeeded = $this->getResourcesNeeded($technologyId, $this->_queue[$index]->getData('level'));
$reclaimedAmounts = $this->_calculateResourceReclaimedAmounts($resourcesNeeded);
$this->dequeue($this->_queue[$index]);
foreach ($reclaimedAmounts as $resourceId => $resourceAmount) {
$this->_currentPlanet[$resourceId] = $resourceAmount;
}
}
$this->_currentPlanet->setData(self::FIELD_SERIALIZED, $this->serialize());
return $this;
}
}

View file

@ -1,39 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/agpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2011-Present, Grégory PLANCHAT <g.planchat@gmail.com>
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
/**
*
* Enter description here ...
* @author Greg
*
*/
class Legacies_Empire_Model_Planet_Building_ResearchLab_Item
extends Wootook_Empire_Model_Builder_Item
{
}

View file

@ -1,51 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/agpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2011-Present, Grégory PLANCHAT <g.planchat@gmail.com>
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
/**
*
* Enter description here ...
* @author Greg
*
*/
class Legacies_Empire_Model_Planet_Building_RoboticFactory
implements Wootook_Empire_Model_Planet_BuildingInterface
{
public static function buildingEnhancementListener(Wootook_Core_Event $event)
{
/** @var float $enhancement */
$enhancement = $event->getData('enhancement');
/** @var Wootook_Empire_Model_Planet $planet */
$planet = $event->getData('planet');
$level = $planet->getElement(Legacies_Empire::ID_BUILDING_ROBOTIC_FACTORY);
$event->setData('enhancement', $enhancement * (2 / (1 + $level)));
}
}

View file

@ -1,275 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/agpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2011-Present, Grégory PLANCHAT <g.planchat@gmail.com>
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
/**
* Shipyard building, manages ship and defenses building queue on each planet
*
* @access public
* @category Empire
* @category Planet
* @package Legacies
* @subpackage Legacies_Empire
*/
class Legacies_Empire_Model_Planet_Building_Shipyard
implements Wootook_Empire_Model_Planet_BuildingInterface,
Wootook_Empire_Model_Planet_QueueInterface
{
private $_eventPrefix = 'planet.shipyard.';
/**
* Planet instance
* @var Legacies_Empire_Model_Planet
*/
protected $_currentPlanet = null;
/**
* Player instance
* @var Woootook_Player_Model_Entity
*/
protected $_currentPlayer = null;
/**
* construction queue
* @var array
*/
protected $_builder = null;
/**
* Resource list
*
* @var array
*/
protected $_resourcesTypes = array(
Legacies_Empire::RESOURCE_METAL,
Legacies_Empire::RESOURCE_CRISTAL,
Legacies_Empire::RESOURCE_DEUTERIUM,
Legacies_Empire::RESOURCE_ENERGY
);
/**
* Multiton instances
* @var array
*/
protected static $_instances = array();
/**
* Multiton factory. Retruns the planet's shipyard instance or created it if
* it doesn't yet exist.
*
* @param Legacies_Empire_Model_Planet $currentPlanet
* @param Woootook_Player_Model_Entity $currentPlayer
* @return Legacies_Empire_Model_Planet_Building_Shipyard
*/
public static function factory($currentPlanet, $currentPlayer)
{
if ($currentPlanet->getId()) {
return null;
}
if (!isset(self::$_instances[$currentPlanet->getId()])) {
self::$_instances[$currentPlanet->getId()] = new self($currentPlanet, $currentPlayer);
}
return self::$_instances[$currentPlanet->getId()];
}
/**
* Constructor. Used for specific usage, use the factory for standard usage.
*
* @see Legacies_Empire_Model_Planet_Building_Shipyard::factory()
*
* @param Legacies_Empire_Model_Planet $currentPlanet
* @param Woootook_Player_Model_Entity $currentPlayer
*/
public function __construct($currentPlanet, $currentPlayer)
{
$this->_currentPlanet = $currentPlanet;
$this->_currentPlayer = $currentPlayer;
$this->_builder = new Legacies_Empire_Model_Planet_Building_Shipyard_Builder($currentPlanet, $currentPlayer);
}
/**
* @deprecated
* @return Legacies_Empire_Model_Planet_Building_Shipyard
*/
public function save()
{
$this->_currentPlanet->save();
return $this;
}
/**
* Append items to build to the construction list
*
* @param int $shipId
* @param int|string $qty
* @return Legacies_Empire_Model_Planet_Building_Shipyard
*/
public function appendQueue($shipId, $qty, Wootook_Core_DateTime $time = null)
{
if ($time === null) {
$time = new Wootook_Core_DateTime();
}
// Dispatch event
Wootook::dispatchEvent($this->_eventPrefix . 'append-queue.before', array(
'ship_id' => $shipId,
'qty' => &$qty,
'time' => &$time,
'shipyard' => $this,
'planet' => $this->_currentPlanet,
'player' => $this->_currentPlayer
));
$this->_builder->appendQueue($shipId, $qty, $time);
// Dispatch event
Wootook::dispatchEvent($this->_eventPrefix . 'append-queue.before', array(
'ship_id' => $shipId,
'qty' => $qty,
'time' => $time,
'shipyard' => $this,
'planet' => $this->_currentPlanet,
'player' => $this->_currentPlayer
));
return $this;
}
/**
* Update the contruction queue.
*
* @return Legacies_Empire_Model_Planet_Building_Shipyard
*/
public function updateQueue(Wootook_Core_DateTime $time = null)
{
if ($time === null) {
$time = new Wootook_Core_DateTime();
}
// Dispatch event
Wootook::dispatchEvent($this->_eventPrefix . 'update-queue.before', array(
'time' => &$time,
'shipyard' => $this,
'planet' => $this->_currentPlanet,
'player' => $this->_currentPlayer
));
$this->_builder->updateQueue($time);
// Dispatch event
Wootook::dispatchEvent($this->_eventPrefix . 'update-queue.after', array(
'time' => $time,
'shipyard' => $this,
'planet' => $this->_currentPlanet,
'player' => $this->_currentPlayer
));
return $this;
}
/**
* Return the construction queue
* @see Legacies_Empire_Model_Planet_Building_Shipyard_Builder
*
* @return array
*/
public function getBuilder()
{
return $this->_builder;
}
/**
* Check if a ship or defense type is actually buildable on the current
* planet, depending on the technology and buildings requirements.
*
* @param int $shipId
* @return bool
*/
public function checkAvailability($shipId)
{
try {
// Dispatch event
Wootook::dispatchEvent($this->_eventPrefix . 'check-availability', array(
'ship_id' => $shipId,
'shipyard' => $this,
'planet' => $this->_currentPlanet,
'player' => $this->_currentPlayer
));
} catch (Legacies_Core_Event_Break $e) {
return false;
}
return $this->_builder->checkAvailability($shipId);
}
/**
* Returns the maximum quantity of elements that are possible to build on
* the current planet.
*
* @param int $shipId
* @return int|string
*/
public function getMaximumBuildableElementsCount($shipId)
{
return $this->_builder->getMaximumBuildableElementsCount($shipId);
}
public function getResourcesNeeded($shipId, $qty)
{
return $this->_builder->getResourcesNeeded($shipId, $qty);
}
public function getBuildingTime($shipId, $qty)
{
return $this->_builder->getBuildingTime($shipId, $qty);
}
public static function planetUpdateListener($eventData)
{
if (isset($eventData['planet'])) {
$planet = $eventData['planet'];
if ($planet === null || !$planet instanceof Legacies_Empire_Model_Planet || !$planet->getId()) {
return;
}
$time = null;
if (isset($eventData['time'])) {
$time = $eventData['time'];
}
$shipyard = self::factory($planet, $planet->getPlayer());
if ($shipyard !== null) {
$shipyard->updateQueue();
}
}
}
}

View file

@ -1,358 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/agpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2011-Present, Grégory PLANCHAT <g.planchat@gmail.com>
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
/**
*
* Enter description here ...
* @author Greg
*
*/
class Legacies_Empire_Model_Planet_Building_Shipyard_Builder
extends Wootook_Empire_Model_BuilderAbstract
{
/**
* @var int
*/
protected $_maxLength = 0;
/**
* @var float
*/
protected $_speedEnhancement = null;
public function init()
{
$this->_unserializeQueue($this->_currentPlanet->getData('b_hangar_id'));
}
/**
* @param int $buildingId
* @param int $qty
* @param int $time
*/
protected function _initItem(Array $params)
{
if (!isset($params['ship_id']) || !isset($params['qty'])) {
return null;
}
$shipId = $params['ship_id'];
$qty = $params['qty'];
if (!isset($params['created_at'])) {
$createdAt = new Wootook_Core_DateTime();
} else {
$createdAt = $params['created_at'];
}
if (!isset($params['updated_at'])) {
$updatedAt = $createdAt;
} else {
$updatedAt = $params['updated_at'];
}
return new Legacies_Empire_Model_Planet_Building_Shipyard_Item(array(
'ship_id' => $shipId,
'qty' => $qty,
'created_at' => $createdAt,
'updated_at' => $updatedAt
));
}
public function getSpeedEnhancement()
{
if ($this->_speedEnhancement === null) {
$event = Wootook::dispatchEvent('planet.shipyard.speed-enhancement', array(
'player' => $this->_currentPlanet,
'planet' => $this->_currentPlanet,
'enhancement' => 1
));
$this->_speedEnhancement = $event->getData('enhancement');
}
return $this->_speedEnhancement;
}
/**
* Check if a ship or defense type is actually buildable on the current
* planet, depending on the technology and buildings requirements.
*
* @param int $shipId
* @return bool
*/
public function checkAvailability($shipId)
{
$types = Wootook_Empire_Helper_Config_Types::getSingleton();
if (!$types->is($shipId, Legacies_Empire::TYPE_SHIP) && !$types->is($shipId, Legacies_Empire::TYPE_DEFENSE)) {
return false;
}
return parent::checkAvailability($shipId);
}
/**
* Returns the maximum quantity of elements that are possible to build on
* the current planet.
*
* @param int $shipId
* @return int|string
*/
public function getMaximumBuildableElementsCount($shipId)
{
$prices = Wootook_Empire_Helper_Config_Prices::getSingleton();
$fields = Wootook_Empire_Helper_Config_FieldsAlias::getSingleton();
$resources = Wootook_Empire_Helper_Config_Resources::getSingleton();
$qty = 0;
foreach ($resources as $resourceId => $_) {
if (isset($prices[$shipId]) && isset($prices[$shipId][$resourceId]) && Math::comp($prices[$shipId][$resourceId], 0) > 0) {
$maxQty = Math::floor(Math::div($this->_currentPlanet->getData($resourceId), $prices[$shipId][$resourceId]));
if ($maxQty == 0) {
return 0;
}
if ($qty == 0 || Math::comp($maxQty, $qty) < 0) {
$qty = $maxQty;
}
}
}
if ($qty == 0) {
return 0;
}
$limitedElementsQty = array(
Legacies_Empire::ID_DEFENSE_SMALL_SHIELD_DOME => array(
'current' => $this->_currentPlanet[$fields[Legacies_Empire::ID_DEFENSE_SMALL_SHIELD_DOME]],
'requested' => $this->_currentPlanet[$fields[Legacies_Empire::ID_DEFENSE_SMALL_SHIELD_DOME]],
'limit' => 1
),
Legacies_Empire::ID_DEFENSE_LARGE_SHIELD_DOME => array(
'current' => $this->_currentPlanet[$fields[Legacies_Empire::ID_DEFENSE_LARGE_SHIELD_DOME]],
'requested' => $this->_currentPlanet[$fields[Legacies_Empire::ID_DEFENSE_LARGE_SHIELD_DOME]],
'limit' => 1
),
Legacies_Empire::ID_SPECIAL_ANTIBALLISTIC_MISSILE => array(
'current' => $this->_currentPlanet[$fields[Legacies_Empire::ID_SPECIAL_ANTIBALLISTIC_MISSILE]],
'requested' => $this->_currentPlanet[$fields[Legacies_Empire::ID_SPECIAL_ANTIBALLISTIC_MISSILE]],
'limit' => $this->_currentPlanet[$fields[Legacies_Empire::ID_BUILDING_MISSILE_SILO]] * 10
),
Legacies_Empire::ID_SPECIAL_INTERPLANETARY_MISSILE => array(
'current' => $this->_currentPlanet[$fields[Legacies_Empire::ID_SPECIAL_INTERPLANETARY_MISSILE]],
'requested' => $this->_currentPlanet[$fields[Legacies_Empire::ID_SPECIAL_INTERPLANETARY_MISSILE]],
'limit' => $this->_currentPlanet[$fields[Legacies_Empire::ID_BUILDING_MISSILE_SILO]] * 5
)
);
if (in_array($shipId, array_keys($limitedElementsQty))) {
foreach ($this->getQueue() as $element) {
if ($element['ship_id'] != $shipId) {
continue;
}
$limitedElementsQty[$shipId]['requested'] = Math::add($limitedElementsQty[$shipId]['requested'], $element['qty']);
if (Math::comp($limitedElementsQty[$shipId]['requested'], $limitedElementsQty[$shipId]['limit']) >= 0) {
return 0;
}
}
if (Math::comp($limitedElementsQty[$shipId]['current'], $limitedElementsQty[$shipId]['limit']) >= 0) {
return 0;
}
if (Math::comp($qty, $limitedElementsQty[$shipId]['limit']) >= 0) {
return $limitedElementsQty[$shipId]['limit'];
}
}
return $qty;
}
/**
* Returns the time needed to build $qty of $shipId
*
* @param int $shipId
* @param int $qty
*/
public function getBuildingTime($shipId, $qty)
{
$prices = Wootook_Empire_Helper_Config_Prices::getSingleton();
Math::setPrecision(50);
$buildingTime = Math::mul($prices[$shipId][Legacies_Empire::BASE_BUILDING_TIME], intval($qty));
$speedFactor = Wootook::getGameConfig('game/speed/general') / 1000;
$baseTime = Math::mul(Math::div($buildingTime, 5000), Math::mul($speedFactor, $this->getSpeedEnhancement()));
Math::setPrecision();
$event = Wootook::dispatchEvent('planet.shipyard.building-time', array(
'time' => $baseTime,
'base_time' => $baseTime,
'planet' => $this->_currentPlanet,
'player' => $this->_currentPlayer,
'ship_id' => $shipId,
'qty' => $qty
));
return $event->getData('time');
}
/**
* (non-PHPdoc)
* @see Legacies_Empire_Model_BuilderAbstract::getResourcesNeeded()
*/
public function getResourcesNeeded($shipId, $qty)
{
$prices = Wootook_Empire_Helper_Config_Prices::getSingleton();
$resources = Wootook_Empire_Helper_Config_Resources::getSingleton();
if (!isset($prices[$shipId])) {
return array();
}
$resourcesNeeded = array();
foreach ($resources as $resourceId => $resourceConfig) {
if (!isset($prices[$shipId][$resourceId])) {
continue;
}
if (Math::isPositive($prices[$shipId][$resourceId])) {
$resourcesNeeded[$resourceId] = Math::mul($prices[$shipId][$resourceId], $qty);
}
}
return $resourcesNeeded;
}
/**
* Returns the quantity set in parameter or the maximum buildable elements
* if the quantity requested exeeds this number.
*
* @param int $shipId
* @param int|string $qty
* @return int|stirng
*/
protected function _checkMaximumQuantity($shipId, $qty)
{
return Math::min($qty, $this->getMaximumBuildableElementsCount($shipId));
}
/**
* Update the contruction queue.
*
* @return Legacies_Empire_Model_Planet_Building_Shipyard
*/
public function updateQueue(Wootook_Core_DateTime $time)
{
$fields = Wootook_Empire_Helper_Config_FieldsAlias::getSingleton();
$elapsedTime = $time->getTimestamp() - $this->_currentPlanet->getData('b_hangar')->getTimestamp();
foreach ($this->getQueue() as $element) {
$shipId = $element->getData('ship_id');
$qty = $element->getData('qty');
$buildTime = $this->getBuildingTime($shipId, $qty);
if ($elapsedTime >= $buildTime) {
$this->_currentPlanet[$fields[$shipId]] = Math::add($this->_currentPlanet[$fields[$shipId]], $qty);
$elapsedTime -= $buildTime;
$this->dequeue($element);
continue;
}
$timeRatio = $elapsedTime / $buildTime;
$itemsBuilt = Math::mul($timeRatio, $qty);
$element->setData('updated_at', $time->getTimestamp());
$element->setData('qty', Math::sub($qty, $itemsBuilt));
$this->_currentPlanet->setData($fields[$shipId], Math::add($this->_currentPlanet->getData($fields[$shipId]), $itemsBuilt));
break;
}
$this->_currentPlanet->setData('b_hangar_id', $this->serialize());
$this->_currentPlanet->setData('b_hangar', $time);
return $this;
}
/**
* Append items to build to the construction list
*
* @param int $shipId
* @param int|string $qty
* @return Legacies_Empire_Model_Planet_Building_Shipyard
*/
public function appendQueue($shipId, $qty, Wootook_Core_DateTime $time)
{
if ($this->_maxLength > 0 && $this->count() >= $this->_maxLength) {
return $this;
}
if (!Math::isPositive($qty)) {
return $this;
}
$types = Wootook_Empire_Helper_Config_Types::getSingleton();
if (!$types->is($shipId, Legacies_Empire::TYPE_SHIP) && !$types->is($shipId, Legacies_Empire::TYPE_DEFENSE)) {
return $this;
}
if (!$this->checkAvailability($shipId)) {
return $this;
}
if (MAX_FLEET_OR_DEFS_PER_ROW > 0) {
$qty = Math::min($this->_checkMaximumQuantity($shipId, $qty), MAX_FLEET_OR_DEFS_PER_ROW);
} else {
$qty = $this->_checkMaximumQuantity($shipId, $qty);
}
if (!Math::isPositive($qty)) {
return $this;
}
$resourcesNeeded = $this->getResourcesNeeded($shipId, $qty);
$remainingAmounts = $this->_calculateResourceRemainingAmounts($resourcesNeeded);
if ($remainingAmounts === false) {
return $this;
}
$this->enqueue(array(
'ship_id' => $shipId,
'qty' => $qty,
'created_at' => $time->getTimestamp(),
'updated_at' => $time->getTimestamp()
));
$this->_currentPlanet->setData('b_hangar_id', $this->serialize());
foreach ($remainingAmounts as $resourceId => $resourceAmount) {
$this->_currentPlanet[$resourceId] = $resourceAmount;
}
return $this;
}
}

View file

@ -1,40 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/agpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2011-Present, Grégory PLANCHAT <g.planchat@gmail.com>
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
/**
*
* Enter description here ...
* @author Greg
*
*/
class Legacies_Empire_Model_Planet_Building_Shipyard_Item
extends Wootook_Empire_Model_Builder_Item
{
}

View file

@ -1,40 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/agpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2011-Present, Grégory PLANCHAT <g.planchat@gmail.com>
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
class Legacies_Empire_Model_Planet_Building_SolarPlant
implements Wootook_Empire_Model_Planet_ResourceProductionInterface, Wootook_Empire_Model_Planet_BuildingInterface
{
public function getProductionRatios($level, $produtionRatio, $planet, $player)
{
return array(
Legacies_Empire::RESOURCE_ENERGY => 20 * floatval($level) * pow(1.1, floatval($level)) * (0.1 * $produtionRatio)
);
}
}

View file

@ -1,53 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/agpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2011-Present, Grégory PLANCHAT <g.planchat@gmail.com>
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
/**
*
* Enter description here ...
* @author Greg
*
*/
class Legacies_Empire_Model_Planet_Ship_LargeTransport
extends Wootook_Empire_Model_Planet_ShipAbstract
{
const REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_IMPULSE_DRIVE = 4;
public function getBaseSpeed(Wootook_Player_Model_Entity $player)
{
$prices = Wootook_Empire_Helper_Config_Prices::getSingleton();
return $prices[Legacies_Empire::ID_SHIP_LARGE_TRANSPORT][Legacies_Empire::SHIPS_CELERITY_PRIMARY];
}
public function getSpeedMultiplier(Wootook_Player_Model_Entity $player)
{
return pow(1.1, $player->getElement(Legacies_Empire::ID_RESEARCH_COMBUSTION_DRIVE));
}
}

View file

@ -1,61 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/agpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2011-Present, Grégory PLANCHAT <g.planchat@gmail.com>
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
/**
*
* Enter description here ...
* @author Greg
*
*/
class Legacies_Empire_Model_Planet_Ship_LightTransport
extends Wootook_Empire_Model_Planet_ShipAbstract
{
const REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_IMPULSE_DRIVE = 4;
public function getBaseSpeed(Wootook_Player_Model_Entity $player)
{
$prices = Wootook_Empire_Helper_Config_Prices::getSingleton();
if ($player->getElement(Legacies_Empire::ID_RESEARCH_IMPULSE_DRIVE) < self::REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_IMPULSE_DRIVE) {
return $prices[Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT][Legacies_Empire::SHIPS_CELERITY_PRIMARY];
} else {
return $prices[Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT][Legacies_Empire::SHIPS_CELERITY_SECONDARY];
}
}
public function getSpeedMultiplier(Wootook_Player_Model_Entity $player)
{
if ($player->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE) < self::REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_IMPULSE_DRIVE) {
return pow(1.1, $player->getElement(Legacies_Empire::ID_RESEARCH_COMBUSTION_DRIVE));
} else {
return pow(1.2, $player->getElement(Legacies_Empire::ID_RESEARCH_IMPULSE_DRIVE));
}
}
}

View file

@ -1,66 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/agpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2011-Present, Grégory PLANCHAT <g.planchat@gmail.com>
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
/**
*
* Enter description here ...
* @author Greg
*
*/
class Legacies_Empire_Model_Planet_Ship_SolarSatellite
extends Wootook_Empire_Model_Planet_ShipAbstract
implements Wootook_Empire_Model_Planet_ResourceProductionInterface
{
public function getProductionRatios($quantity, $produtionRatio, $planet, $player)
{
return array(
Legacies_Empire::RESOURCE_ENERGY => ((floatval($planet->getData('temp_max')) / 4) + 20) * (0.1 * $produtionRatio) * floatval($quantity)
);
}
public function getBaseSpeed(Wootook_Player_Model_Entity $player)
{
return 0;
}
public function getSpeedMultiplier(Wootook_Player_Model_Entity $player)
{
return 0;
}
public function getActualSpeed(Wootook_Player_Model_Entity $player)
{
return 0;
}
public function getBaseConsumption(Wootook_Player_Model_Entity $player)
{
return 0;
}
}

View file

@ -1,77 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/agpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2011-Present, Grégory PLANCHAT <g.planchat@gmail.com>
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
/**
*
* Enter description here ...
* @author Greg
*
*/
class Legacies_Empire_Model_Planet_Ship_Supernova
extends Wootook_Empire_Model_Planet_ShipAbstract
implements Wootook_Empire_Model_Planet_ResourceProductionInterface
{
const REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_HYPERSPACE_DRIVE = 20;
const REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_HYPERSPACE_TECHNOLOGY = 15;
public function getProductionRatios($quantity, $produtionRatio, $planet, $player)
{
return array(
Legacies_Empire::RESOURCE_ENERGY => ((floatval($planet->getData('temp_max')) / 4) + 20) * (0.1 * $produtionRatio) * floatval($quantity) * -1250
);
}
public function getBaseSpeed(Wootook_Player_Model_Entity $player)
{
$prices = Wootook_Empire_Helper_Config_Prices::getSingleton();
if ($player->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE) < self::REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_HYPERSPACE_DRIVE &&
$player->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_TECHNOLOGY) < self::REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_HYPERSPACE_TECHNOLOGY) {
return $prices[Legacies_Empire::ID_SHIP_SUPERNOVA][Legacies_Empire::SHIPS_CELERITY_PRIMARY];
} else {
return $prices[Legacies_Empire::ID_SHIP_SUPERNOVA][Legacies_Empire::SHIPS_CELERITY_SECONDARY];
}
}
public function getSpeedMultiplier(Wootook_Player_Model_Entity $player)
{
if ($player->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE) < self::REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_HYPERSPACE_DRIVE &&
$player->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_TECHNOLOGY) < self::REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_HYPERSPACE_TECHNOLOGY) {
return pow(1.2, $player->getElement(Legacies_Empire::ID_RESEARCH_IMPULSE_DRIVE));
} else {
return pow(1.3, $player->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE)) *
pow(1.1, $player->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_TECHNOLOGY));
}
}
public function getBaseConsumption(Wootook_Player_Model_Entity $player)
{
return 0;
}
}

View file

@ -1,46 +0,0 @@
<?php
/**
* Created by JetBrains PhpStorm.
* User: Greg
* Date: 25/03/12
* Time: 11:05
* To change this template use File | Settings | File Templates.
*/
class Legacies_Empire_Model_Player_Technology_IntergalacticResearchNetwork
implements Wootook_Empire_Model_Player_TechnologyInterface
{
public static function researchTechnologyEnhancementListener(Wootook_Core_Event $event)
{
/** @var float $enhancement */
$enhancement = $event->getData('enhancement');
/** @var Wootook_Empire_Model_Planet $planet */
$planet = $event->getData('planet');
/** @var Wootook_Player_Model_Entity $player */
$player = $event->getData('player');
$virtualLevel = 1 + $planet->getElement(Legacies_Empire::ID_BUILDING_RESEARCH_LAB);
if (($network = $player->getElement(Legacies_Empire::ID_RESEARCH_INTERGALACTIC_RESEARCH_NETWORK)) > 0) {
$planetCollection = $player->getPlanetCollection(Wootook_Empire_Model_Planet::TYPE_PLANET);
$fields = Wootook_Empire_Helper_Config_FieldsAlias::getSingleton();
$planetCollection->addFieldToFilter('id', array(array('nin' => $planet->getId())))
->addOrderBy($fields[Legacies_Empire::ID_BUILDING_RESEARCH_LAB], 'DESC')
->setPageSize($network)
;
$select = $planetCollection->getSelect();
$select->reset(Wootook_Core_Database_Sql_Select::COLUMNS);
$select->column(array('count' => new Wootook_Core_Database_Sql_Placeholder_Expression(
"COUNT({$select->quote($fields[Legacies_Empire::ID_BUILDING_RESEARCH_LAB])})")));
$statement = $select->prepare();
$virtualLevel += $statement->fetchColumn();
}
$event->setData('enhancement', $enhancement * $virtualLevel);
}
}

View file

@ -1,838 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/agpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2011-Present, Grégory PLANCHAT <g.planchat@gmail.com>
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
$this->setSetupConnection('core_setup');
$sql = <<<SQL_EOF
CREATE TABLE IF NOT EXISTS {$this->getTableName('aks')} (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(50) NULL,
`teilnehmer` TEXT NULL,
`flotten` TEXT NULL,
`ankunft` INT UNSIGNED NULL,
`galaxy` TINYINT UNSIGNED NULL,
`system` SMALLINT UNSIGNED NULL,
`planet` TINYINT UNSIGNED NULL,
`eingeladen` INT UNSIGNED NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
CREATE TABLE IF NOT EXISTS {$this->getTableName('alliance')} (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`ally_name` VARCHAR(32) NOT NULL,
`ally_tag` VARCHAR(8) NOT NULL,
`ally_owner` BIGINT UNSIGNED NOT NULL DEFAULT 0,
`ally_register_time` TIMESTAMP NOT NULL,
`ally_description` TEXT NULL,
`ally_web` VARCHAR(255) NULL,
`ally_text` TEXT NULL,
`ally_image` VARCHAR(255) NULL,
`ally_request` TEXT NULL,
`ally_request_waiting` TEXT NULL,
`ally_request_notallow` BOOL NOT NULL DEFAULT FALSE,
`ally_owner_range` VARCHAR(32) NULL,
`ally_ranks` TEXT NULL,
`ally_members` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
CREATE TABLE IF NOT EXISTS {$this->getTableName('annonce')} (
`id` SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
`user` TEXT NOT NULL,
`galaxie` TINYINT UNSIGNED NOT NULL,
`systeme` SMALLINT UNSIGNED NOT NULL,
`metala` DECIMAL(65,0) NOT NULL,
`cristala` DECIMAL(65,0) NOT NULL,
`deuta` DECIMAL(65,0) NOT NULL,
`metals` DECIMAL(65,0) NOT NULL,
`cristals` DECIMAL(65,0) NOT NULL,
`deuts` DECIMAL(65,0) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
CREATE TABLE IF NOT EXISTS {$this->getTableName('banned')} (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`who` BIGINT UNSIGNED NOT NULL,
`theme` TEXT NOT NULL,
`who2` BIGINT UNSIGNED NOT NULL,
`time` TIMESTAMP NOT NULL,
`longer` INT UNSIGNED NOT NULL DEFAULT 3600,
`author` BIGINT UNSIGNED NOT NULL,
`email` VARCHAR(100) NOT NULL,
KEY `ID` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
CREATE TABLE IF NOT EXISTS {$this->getTableName('buddy')} (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`sender` BIGINT UNSIGNED NOT NULL,
`owner` BIGINT UNSIGNED NOT NULL,
`active` BOOL NOT NULL DEFAULT TRUE,
`text` TEXT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
CREATE TABLE IF NOT EXISTS {$this->getTableName('chat')} (
`messageid` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`user` VARCHAR(255) NOT NULL,
`message` TEXT NOT NULL,
`timestamp` TIMESTAMP NOT NULL,
PRIMARY KEY (`messageid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
CREATE TABLE IF NOT EXISTS {$this->getTableName('declared')} (
`declarator` TEXT NOT NULL,
`declared_1` TEXT NOT NULL,
`declared_2` TEXT NOT NULL,
`declared_3` TEXT NOT NULL,
`reason` TEXT NOT NULL,
`declarator_name` TEXT NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
CREATE TABLE IF NOT EXISTS {$this->getTableName('fleets')} (
`fleet_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`fleet_owner` BIGINT UNSIGNED NOT NULL,
`fleet_mission` TINYINT UNSIGNED NOT NULL,
`fleet_amount` DECIMAL(65,0) NOT NULL,
`fleet_array` TEXT NULL,
`fleet_start_time` TIMESTAMP NOT NULL,
`fleet_start_galaxy` TINYINT UNSIGNED NOT NULL,
`fleet_start_system` SMALLINT UNSIGNED NOT NULL,
`fleet_start_planet` TINYINT UNSIGNED NOT NULL,
`fleet_start_type` TINYINT UNSIGNED NOT NULL,
`fleet_end_time` TIMESTAMP NOT NULL,
`fleet_end_stay` TIMESTAMP NOT NULL,
`fleet_end_galaxy` TINYINT UNSIGNED NOT NULL,
`fleet_end_system` SMALLINT UNSIGNED NOT NULL,
`fleet_end_planet` TINYINT UNSIGNED NOT NULL,
`fleet_end_type` TINYINT UNSIGNED NOT NULL,
`fleet_target_owner` BIGINT UNSIGNED NOT NULL,
`fleet_resource_metal` DECIMAL(65,0) NOT NULL DEFAULT 0,
`fleet_resource_crystal` DECIMAL(65,0) NOT NULL DEFAULT 0,
`fleet_resource_deuterium` DECIMAL(65,0) NOT NULL DEFAULT 0,
`fleet_group` BIGINT UNSIGNED NOT NULL,
`fleet_mess` BIGINT UNSIGNED NOT NULL,
`start_time` TIMESTAMP NOT NULL,
PRIMARY KEY (`fleet_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
CREATE TABLE IF NOT EXISTS {$this->getTableName('galaxy')} (
`galaxy` SMALLINT UNSIGNED NOT NULL,
`system` SMALLINT UNSIGNED NOT NULL,
`planet` TINYINT UNSIGNED NOT NULL,
`id_planet` BIGINT UNSIGNED NOT NULL,
`metal` DECIMAL(65,0) NOT NULL DEFAULT 0,
`crystal` DECIMAL(65,0) NOT NULL DEFAULT 0,
`id_luna` BIGINT UNSIGNED NULL,
`luna` BOOL NOT NULL DEFAULT FALSE,
PRIMARY KEY (`galaxy`, `system`, `planet`),
KEY `galaxy` (`galaxy`),
KEY `system` (`system`),
KEY `planet` (`planet`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
CREATE TABLE IF NOT EXISTS {$this->getTableName('iraks')} (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`zeit` TIMESTAMP NOT NULL,
`galaxy` TINYINT UNSIGNED NOT NULL,
`system` SMALLINT UNSIGNED NOT NULL,
`planet` TINYINT UNSIGNED NOT NULL,
`galaxy_angreifer` TINYINT UNSIGNED NOT NULL,
`system_angreifer` SMALLINT UNSIGNED NOT NULL,
`planet_angreifer` TINYINT UNSIGNED NOT NULL,
`owner` BIGINT UNSIGNED NOT NULL,
`zielid` BIGINT UNSIGNED NOT NULL,
`anzahl` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
`primaer` SMALLINT UNSIGNED,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
CREATE TABLE IF NOT EXISTS {$this->getTableName('lunas')} (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`id_luna` BIGINT UNSIGNED NOT NULL,
`name` VARCHAR(100) NOT NULL DEFAULT 'Lune',
`image` VARCHAR(50) NOT NULL DEFAULT 'mond',
`destruyed` BOOL NOT NULL DEFAULT FALSE,
`id_owner` BIGINT UNSIGNED NOT NULL,
`galaxy` TINYINT UNSIGNED NOT NULL,
`system` SMALLINT UNSIGNED NOT NULL,
`lunapos` TINYINT UNSIGNED NOT NULL,
`temp_min` TINYINT NOT NULL DEFAULT 0,
`temp_max` TINYINT NOT NULL DEFAULT 0,
`diameter` INT UNSIGNED NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
CREATE TABLE IF NOT EXISTS {$this->getTableName('messages')} (
`message_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`message_owner` BIGINT UNSIGNED NOT NULL,
`message_sender` BIGINT UNSIGNED NOT NULL,
`message_time` TIMESTAMP NOT NULL,
`message_type` TINYINT UNSIGNED NOT NULL,
`message_from` VARCHAR(50),
`message_subject` VARCHAR(150),
`message_text` TEXT,
PRIMARY KEY (`message_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
CREATE TABLE IF NOT EXISTS {$this->getTableName('multi')} (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`player` BIGINT UNSIGNED NOT NULL,
`sharer` BIGINT UNSIGNED NOT NULL,
`reason` TEXT NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
CREATE TABLE IF NOT EXISTS {$this->getTableName('notes')} (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`owner` BIGINT UNSIGNED NOT NULL,
`time` TIMESTAMP NOT NULL,
`priority` TINYINT UNSIGNED NOT NULL,
`title` VARCHAR(32) NOT NULL,
`TEXT` TEXT NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
CREATE TABLE IF NOT EXISTS {$this->getTableName('planets')} (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(100) NOT NULL,
`id_owner` BIGINT UNSIGNED NOT NULL,
`id_level` TINYINT UNSIGNED NOT NULL,
`galaxy` TINYINT UNSIGNED NOT NULL,
`system` SMALLINT UNSIGNED NOT NULL,
`planet` TINYINT UNSIGNED NOT NULL,
`last_update` DATETIME NOT NULL,
`planet_type` TINYINT UNSIGNED NOT NULL,
`destruyed` INT UNSIGNED NOT NULL DEFAULT FALSE,
`b_building` DATETIME NOT NULL,
`b_building_id` TEXT NOT NULL,
`b_tech` DATETIME NOT NULL,
`b_tech_id` TEXT NOT NULL,
`b_hangar` DATETIME NOT NULL,
`b_hangar_id` TEXT NOT NULL,
`image` VARCHAR(50) NOT NULL DEFAULT 'normaltempplanet01',
`diameter` INT UNSIGNED NOT NULL DEFAULT 12800,
`points` DECIMAL(65,0) NOT NULL DEFAULT 0,
`ranks` BIGINT UNSIGNED NOT NULL,
`field_current` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
`field_max` SMALLINT UNSIGNED NOT NULL DEFAULT 163,
`temp_min` SMALLINT NOT NULL DEFAULT 0,
`temp_max` SMALLINT NOT NULL DEFAULT 0,
`metal` DECIMAL(65,0) NOT NULL DEFAULT 0,
`metal_perhour` DECIMAL(65,0) NOT NULL DEFAULT 0,
`metal_max` DECIMAL(65,0) NOT NULL DEFAULT 0,
`cristal` DECIMAL(65,0) NOT NULL DEFAULT 0,
`cristal_perhour` DECIMAL(65,0) NOT NULL DEFAULT 0,
`cristal_max` DECIMAL(65,0) NOT NULL DEFAULT 0,
`deuterium` DECIMAL(65,0) NOT NULL DEFAULT 0,
`deuterium_perhour` DECIMAL(65,0) NOT NULL DEFAULT 0,
`deuterium_max` DECIMAL(65,0) NOT NULL DEFAULT 0,
`energy_used` DECIMAL(65,0) NOT NULL DEFAULT 0,
`energy_max` DECIMAL(65,0) NOT NULL DEFAULT 0,
`metal_mine` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
`cristal_mine` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
`deuterium_sintetizer` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
`solar_plant` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
`fusion_plant` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
`robot_factory` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
`nano_factory` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
`hangar` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
`metal_store` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
`cristal_store` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
`deuterium_store` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
`laboratory` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
`terraformer` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
`ally_deposit` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
`silo` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
`mondbasis` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
`phalanx` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
`sprungtor` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
`small_ship_cargo` DECIMAL(65,0) NOT NULL DEFAULT 0,
`big_ship_cargo` DECIMAL(65,0) NOT NULL DEFAULT 0,
`light_hunter` DECIMAL(65,0) NOT NULL DEFAULT 0,
`heavy_hunter` DECIMAL(65,0) NOT NULL DEFAULT 0,
`crusher` DECIMAL(65,0) NOT NULL DEFAULT 0,
`battle_ship` DECIMAL(65,0) NOT NULL DEFAULT 0,
`colonizer` DECIMAL(65,0) NOT NULL DEFAULT 0,
`recycler` DECIMAL(65,0) NOT NULL DEFAULT 0,
`spy_sonde` DECIMAL(65,0) NOT NULL DEFAULT 0,
`bomber_ship` DECIMAL(65,0) NOT NULL DEFAULT 0,
`solar_satelit` DECIMAL(65,0) NOT NULL DEFAULT 0,
`destructor` DECIMAL(65,0) NOT NULL DEFAULT 0,
`dearth_star` DECIMAL(65,0) NOT NULL DEFAULT 0,
`battleship` DECIMAL(65,0) NOT NULL DEFAULT 0,
`supernova` DECIMAL(65,0) NOT NULL DEFAULT 0,
`ore_miner` DECIMAL(65,0) NOT NULL DEFAULT 0,
`misil_launcher` DECIMAL(65,0) NOT NULL DEFAULT 0,
`small_laser` DECIMAL(65,0) NOT NULL DEFAULT 0,
`big_laser` DECIMAL(65,0) NOT NULL DEFAULT 0,
`gauss_canyon` DECIMAL(65,0) NOT NULL DEFAULT 0,
`ionic_canyon` DECIMAL(65,0) NOT NULL DEFAULT 0,
`buster_canyon` DECIMAL(65,0) NOT NULL DEFAULT 0,
`small_protection_shield` ENUM('0','1') NOT NULL DEFAULT '0',
`big_protection_shield` ENUM('0','1') NOT NULL DEFAULT '0',
`interceptor_misil` SMALLINT NOT NULL DEFAULT 0,
`interplanetary_misil` SMALLINT NOT NULL DEFAULT 0,
`metal_mine_porcent` TINYINT NOT NULL DEFAULT 10,
`cristal_mine_porcent` TINYINT NOT NULL DEFAULT 10,
`deuterium_sintetizer_porcent` TINYINT NOT NULL DEFAULT 10,
`solar_plant_porcent` TINYINT NOT NULL DEFAULT 10,
`fusion_plant_porcent` TINYINT NOT NULL DEFAULT 10,
`solar_satelit_porcent` TINYINT NOT NULL DEFAULT 10,
`last_jump_time` TIMESTAMP NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
CREATE TABLE IF NOT EXISTS {$this->getTableName('rw')} (
`id_owner1` BIGINT UNSIGNED NOT NULL,
`id_owner2` BIGINT UNSIGNED NOT NULL,
`rid` VARCHAR(72) NOT NULL,
`raport` LONGTEXT NOT NULL,
`a_zestrzelona` TINYINT UNSIGNED NOT NULL,
`time` TIMESTAMP NOT NULL,
KEY (`rid`),
UNIQUE KEY `id_owner1` (`id_owner1`,`rid`),
UNIQUE KEY `id_owner2` (`id_owner2`,`rid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
CREATE TABLE IF NOT EXISTS {$this->getTableName('statpoints')} (
`id_owner` BIGINT UNSIGNED NOT NULL,
`id_ally` BIGINT UNSIGNED NOT NULL,
`stat_type` TINYINT UNSIGNED NOT NULL,
`stat_code` TINYINT UNSIGNED NOT NULL,
`tech_rank` BIGINT UNSIGNED NOT NULL,
`tech_old_rank` BIGINT UNSIGNED NOT NULL,
`tech_points` DECIMAL(65,0) NOT NULL,
`tech_count` BIGINT UNSIGNED NOT NULL,
`build_rank` BIGINT UNSIGNED NOT NULL,
`build_old_rank` BIGINT UNSIGNED NOT NULL,
`build_points` DECIMAL(65,0) NOT NULL,
`build_count` BIGINT UNSIGNED NOT NULL,
`defs_rank` BIGINT UNSIGNED NOT NULL,
`defs_old_rank` BIGINT UNSIGNED NOT NULL,
`defs_points` DECIMAL(65,0) NOT NULL,
`defs_count` BIGINT UNSIGNED NOT NULL,
`fleet_rank` BIGINT UNSIGNED NOT NULL,
`fleet_old_rank` BIGINT UNSIGNED NOT NULL,
`fleet_points` DECIMAL(65,0) NOT NULL,
`fleet_count` BIGINT UNSIGNED NOT NULL,
`total_rank` BIGINT UNSIGNED NOT NULL,
`total_old_rank` BIGINT UNSIGNED NOT NULL,
`total_points` DECIMAL(65,0) NOT NULL,
`total_count` BIGINT UNSIGNED NOT NULL,
`stat_date` TIMESTAMP NOT NULL,
KEY (`tech_points`),
KEY (`build_points`),
KEY (`defs_points`),
KEY (`fleet_points`),
KEY (`total_points`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
CREATE TABLE IF NOT EXISTS {$this->getTableName('users')} (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`username` VARCHAR(100) NOT NULL, -- FIXME
`password` VARCHAR(64) NOT NULL, -- FIXME
`email` VARCHAR(200) NOT NULL, -- FIXME
`email_2` VARCHAR(200) NOT NULL, -- FIXME
`lang` VARCHAR(3) NOT NULL DEFAULT 'fr',
`authlevel` TINYINT UNSIGNED NOT NULL DEFAULT 0, -- FIXME
`sex` ENUM('M','F') NULL DEFAULT NULL,
`avatar` VARCHAR(255) NULL DEFAULT NULL,
`sign` TEXT NULL,
`id_planet` BIGINT UNSIGNED NOT NULL, -- FIXME
`galaxy` TINYINT UNSIGNED NOT NULL, -- FIXME
`system` SMALLINT UNSIGNED NOT NULL, -- FIXME
`planet` TINYINT UNSIGNED NOT NULL, -- FIXME
`current_planet` BIGINT UNSIGNED NOT NULL, -- FIXME
`user_lastip` VARCHAR(16) NOT NULL, -- FIXME
`ip_at_reg` VARCHAR(16) NOT NULL, -- FIXME
`user_agent` TEXT NOT NULL, -- FIXME
`current_page` TEXT NOT NULL, -- FIXME
`register_time` TIMESTAMP NOT NULL, -- FIXME
`onlinetime` TIMESTAMP NOT NULL, -- FIXME
`dpath` VARCHAR(255) NOT NULL, -- FIXME
`design` TINYINT NOT NULL DEFAULT 1, -- FIXME
`noipcheck` BOOL NOT NULL DEFAULT TRUE, -- FIXME
`planet_sort` TINYINT NOT NULL DEFAULT 0, -- FIXME
`planet_sort_order` TINYINT NOT NULL DEFAULT 0, -- FIXME
`spio_anz` TINYINT UNSIGNED NOT NULL DEFAULT 1, -- FIXME
`settings_tooltiptime` TINYINT UNSIGNED NOT NULL DEFAULT 5, -- FIXME
`settings_fleetactions` TINYINT UNSIGNED NOT NULL DEFAULT 0, -- FIXME
`settings_allylogo` TINYINT UNSIGNED NOT NULL DEFAULT 0, -- FIXME
`settings_esp` TINYINT UNSIGNED NOT NULL DEFAULT 1, -- FIXME
`settings_wri` TINYINT UNSIGNED NOT NULL DEFAULT 1, -- FIXME
`settings_bud` TINYINT UNSIGNED NOT NULL DEFAULT 1, -- FIXME
`settings_mis` TINYINT UNSIGNED NOT NULL DEFAULT 1, -- FIXME
`settings_rep` TINYINT UNSIGNED NOT NULL DEFAULT 0, -- FIXME
`urlaubs_modus` TINYINT UNSIGNED NOT NULL DEFAULT 0, -- FIXME
`urlaubs_until` TIMESTAMP NOT NULL, -- FIXME
`db_deaktjava` BOOL NOT NULL DEFAULT FALSE, -- FIXME
`new_message` TINYINT UNSIGNED NOT NULL DEFAULT 0, -- FIXME
`fleet_shortcut` TEXT NULL,
`b_tech_planet` INT NOT NULL, -- FIXME
`spy_tech` TINYINT UNSIGNED NOT NULL, -- FIXME
`computer_tech` TINYINT UNSIGNED NOT NULL, -- FIXME
`military_tech` TINYINT UNSIGNED NOT NULL, -- FIXME
`defence_tech` TINYINT UNSIGNED NOT NULL, -- FIXME
`shield_tech` TINYINT UNSIGNED NOT NULL, -- FIXME
`energy_tech` TINYINT UNSIGNED NOT NULL, -- FIXME
`hyperspace_tech` TINYINT UNSIGNED NOT NULL, -- FIXME
`combustion_tech` TINYINT UNSIGNED NOT NULL, -- FIXME
`impulse_motor_tech` TINYINT UNSIGNED NOT NULL, -- FIXME
`hyperspace_motor_tech` TINYINT UNSIGNED NOT NULL, -- FIXME
`laser_tech` TINYINT UNSIGNED NOT NULL, -- FIXME
`ionic_tech` TINYINT UNSIGNED NOT NULL, -- FIXME
`buster_tech` TINYINT UNSIGNED NOT NULL, -- FIXME
`intergalactic_tech` TINYINT UNSIGNED NOT NULL, -- FIXME
`expedition_tech` TINYINT UNSIGNED NOT NULL, -- FIXME
`graviton_tech` TINYINT UNSIGNED NOT NULL, -- FIXME
`ore_mining_tech` TINYINT UNSIGNED NOT NULL, -- FIXME
`ally_id` BIGINT UNSIGNED NOT NULL,
`ally_name` VARCHAR(32) NULL, -- FIXME
`ally_request` BOOL NOT NULL DEFAULT FALSE, -- FIXME
`ally_request_text` TEXT NULL, -- FIXME
`ally_register_time` TIMESTAMP NOT NULL, -- FIXME
`ally_rank_id` BIGINT UNSIGNED NOT NULL, -- FIXME
`current_luna` INT NOT NULL, -- FIXME
`kolorminus` VARCHAR(11) NOT NULL DEFAULT 'red',
`kolorplus` VARCHAR(11) NOT NULL DEFAULT '#00FF00',
`kolorpoziom` VARCHAR(11) NOT NULL DEFAULT 'yellow',
`lvl_minier` BIGINT UNSIGNED NOT NULL, -- FIXME
`lvl_raid` BIGINT UNSIGNED NOT NULL, -- FIXME
`xpraid` BIGINT UNSIGNED NOT NULL, -- FIXME
`xpminier` BIGINT UNSIGNED NOT NULL, -- FIXME
`raids` BIGINT UNSIGNED NOT NULL, -- FIXME
`p_infligees` DECIMAL(65,0) NOT NULL, -- FIXME
`mnl_alliance` TINYINT UNSIGNED NOT NULL, -- FIXME
`mnl_joueur` TINYINT UNSIGNED NOT NULL, -- FIXME
`mnl_attaque` TINYINT UNSIGNED NOT NULL, -- FIXME
`mnl_spy` TINYINT UNSIGNED NOT NULL, -- FIXME
`mnl_exploit` TINYINT UNSIGNED NOT NULL, -- FIXME
`mnl_transport` TINYINT UNSIGNED NOT NULL, -- FIXME
`mnl_expedition` TINYINT UNSIGNED NOT NULL, -- FIXME
`mnl_general` TINYINT UNSIGNED NOT NULL, -- FIXME
`mnl_buildlist` TINYINT UNSIGNED NOT NULL, -- FIXME
`bana` BOOL NOT NULL DEFAULT FALSE, -- FIXME
`multi_validated` BOOL NOT NULL DEFAULT FALSE, -- FIXME
`banaday` TIMESTAMP NULL DEFAULT NULL, -- FIXME
`raids1` BIGINT UNSIGNED NOT NULL, -- FIXME
`raidswin` BIGINT UNSIGNED NOT NULL, -- FIXME
`raidsloose` BIGINT UNSIGNED NOT NULL, -- FIXME
PRIMARY KEY (`id`),
UNIQUE KEY (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SQL_EOF;
$this->query($sql);
/*
* Galaxy positions generation
*/
$galaxyCount = Wootook::getConfig('engine/universe/galaxies');
$systemCount = Wootook::getConfig('engine/universe/systems');
$sql = <<<SQL_EOF
INSERT INTO {$this->getTableName('galaxy')}
(`galaxy`, `system`, `planet`, `id_planet`, `metal`, `crystal`, `id_luna`, `luna`)
SELECT
_increment.galaxy AS `galaxy`,
_increment.system AS `system`,
0 AS `planet`,
0 AS `id_planet`,
0 AS `metal`,
0 AS `crystal`,
0 AS `id_luna`,
0 AS `luna`
FROM (
SELECT
(1 + _galaxy_10e0.galaxy + _galaxy_10e1.galaxy + _galaxy_10e2.galaxy + _galaxy_10e3.galaxy + _galaxy_10e4.galaxy) AS galaxy,
(1 + _system_10e0.system + _system_10e1.system + _system_10e2.system + _system_10e3.system + _system_10e4.system) AS system
FROM (
SELECT 0 AS system
UNION ALL
SELECT 1 AS system
UNION ALL
SELECT 2 AS system
UNION ALL
SELECT 3 AS system
UNION ALL
SELECT 4 AS system
UNION ALL
SELECT 5 AS system
UNION ALL
SELECT 6 AS system
UNION ALL
SELECT 7 AS system
UNION ALL
SELECT 8 AS system
UNION ALL
SELECT 9 AS system
) AS _system_10e0
SQL_EOF;
if ($systemCount > 10) {
$sql .= <<<SQL_EOF
CROSS JOIN (
SELECT 0 AS system
UNION ALL
SELECT 10 AS system
UNION ALL
SELECT 20 AS system
UNION ALL
SELECT 30 AS system
UNION ALL
SELECT 40 AS system
UNION ALL
SELECT 50 AS system
UNION ALL
SELECT 60 AS system
UNION ALL
SELECT 70 AS system
UNION ALL
SELECT 80 AS system
UNION ALL
SELECT 90 AS system
) AS _system_10e1
SQL_EOF;
} else {
$sql .= <<<SQL_EOF
CROSS JOIN (SELECT 0 AS system) AS _system_10e1
SQL_EOF;
}
if ($systemCount > 100) {
$sql .= <<<SQL_EOF
CROSS JOIN (
SELECT 0 AS system
UNION ALL
SELECT 100 AS system
UNION ALL
SELECT 200 AS system
UNION ALL
SELECT 300 AS system
UNION ALL
SELECT 400 AS system
UNION ALL
SELECT 500 AS system
UNION ALL
SELECT 600 AS system
UNION ALL
SELECT 700 AS system
UNION ALL
SELECT 800 AS system
UNION ALL
SELECT 900 AS system
) AS _system_10e2
SQL_EOF;
} else {
$sql .= <<<SQL_EOF
CROSS JOIN (SELECT 0 AS system) AS _system_10e2
SQL_EOF;
}
if ($systemCount > 1000) {
$sql .= <<<SQL_EOF
CROSS JOIN (
SELECT 0 AS system
UNION ALL
SELECT 1000 AS system
UNION ALL
SELECT 2000 AS system
UNION ALL
SELECT 3000 AS system
UNION ALL
SELECT 4000 AS system
UNION ALL
SELECT 5000 AS system
UNION ALL
SELECT 6000 AS system
UNION ALL
SELECT 7000 AS system
UNION ALL
SELECT 8000 AS system
UNION ALL
SELECT 9000 AS system
) AS _system_10e3
SQL_EOF;
} else {
$sql .= <<<SQL_EOF
CROSS JOIN (SELECT 0 AS system) AS _system_10e3
SQL_EOF;
}
if ($systemCount > 10000) {
$sql .= <<<SQL_EOF
CROSS JOIN (
SELECT 0 AS system
UNION ALL
SELECT 10000 AS system
UNION ALL
SELECT 20000 AS system
UNION ALL
SELECT 30000 AS system
UNION ALL
SELECT 40000 AS system
UNION ALL
SELECT 50000 AS system
UNION ALL
SELECT 60000 AS system
UNION ALL
SELECT 70000 AS system
UNION ALL
SELECT 80000 AS system
UNION ALL
SELECT 90000 AS system
) AS _system_10e4
SQL_EOF;
} else {
$sql .= <<<SQL_EOF
CROSS JOIN (SELECT 0 AS system) AS _system_10e4
SQL_EOF;
}
$sql .= <<<SQL_EOF
CROSS JOIN (
SELECT 0 AS galaxy
UNION ALL
SELECT 1 AS galaxy
UNION ALL
SELECT 2 AS galaxy
UNION ALL
SELECT 3 AS galaxy
UNION ALL
SELECT 4 AS galaxy
UNION ALL
SELECT 5 AS galaxy
UNION ALL
SELECT 6 AS galaxy
UNION ALL
SELECT 7 AS galaxy
UNION ALL
SELECT 8 AS galaxy
UNION ALL
SELECT 9 AS galaxy
) AS _galaxy_10e0
SQL_EOF;
if ($systemCount > 10) {
$sql .= <<<SQL_EOF
CROSS JOIN (
SELECT 0 AS galaxy
UNION ALL
SELECT 10 AS galaxy
UNION ALL
SELECT 20 AS galaxy
UNION ALL
SELECT 30 AS galaxy
UNION ALL
SELECT 40 AS galaxy
UNION ALL
SELECT 50 AS galaxy
UNION ALL
SELECT 60 AS galaxy
UNION ALL
SELECT 70 AS galaxy
UNION ALL
SELECT 80 AS galaxy
UNION ALL
SELECT 90 AS galaxy
) AS _galaxy_10e1
SQL_EOF;
} else {
$sql .= <<<SQL_EOF
CROSS JOIN (SELECT 0 AS galaxy) AS _galaxy_10e1
SQL_EOF;
}
if ($systemCount > 100) {
$sql .= <<<SQL_EOF
CROSS JOIN (
SELECT 0 AS galaxy
UNION ALL
SELECT 100 AS galaxy
UNION ALL
SELECT 200 AS galaxy
UNION ALL
SELECT 300 AS galaxy
UNION ALL
SELECT 400 AS galaxy
UNION ALL
SELECT 500 AS galaxy
UNION ALL
SELECT 600 AS galaxy
UNION ALL
SELECT 700 AS galaxy
UNION ALL
SELECT 800 AS galaxy
UNION ALL
SELECT 900 AS galaxy
) AS _galaxy_10e2
SQL_EOF;
} else {
$sql .= <<<SQL_EOF
CROSS JOIN (SELECT 0 AS galaxy) AS _galaxy_10e2
SQL_EOF;
}
if ($systemCount > 1000) {
$sql .= <<<SQL_EOF
CROSS JOIN (
SELECT 0 AS galaxy
UNION ALL
SELECT 1000 AS galaxy
UNION ALL
SELECT 2000 AS galaxy
UNION ALL
SELECT 3000 AS galaxy
UNION ALL
SELECT 4000 AS galaxy
UNION ALL
SELECT 5000 AS galaxy
UNION ALL
SELECT 6000 AS galaxy
UNION ALL
SELECT 7000 AS galaxy
UNION ALL
SELECT 8000 AS galaxy
UNION ALL
SELECT 9000 AS galaxy
) AS _galaxy_10e3
SQL_EOF;
} else {
$sql .= <<<SQL_EOF
CROSS JOIN (SELECT 0 AS galaxy) AS _galaxy_10e3
SQL_EOF;
}
if ($systemCount > 10000) {
$sql .= <<<SQL_EOF
CROSS JOIN (
SELECT 0 AS galaxy
UNION ALL
SELECT 10000 AS galaxy
UNION ALL
SELECT 20000 AS galaxy
UNION ALL
SELECT 30000 AS galaxy
UNION ALL
SELECT 40000 AS galaxy
UNION ALL
SELECT 50000 AS galaxy
UNION ALL
SELECT 60000 AS galaxy
UNION ALL
SELECT 70000 AS galaxy
UNION ALL
SELECT 80000 AS galaxy
UNION ALL
SELECT 90000 AS galaxy
) AS _galaxy_10e4
SQL_EOF;
} else {
$sql .= <<<SQL_EOF
CROSS JOIN (SELECT 0 AS galaxy) AS _galaxy_10e4
SQL_EOF;
}
$sql .= <<<SQL_EOF
) _increment
WHERE _increment.galaxy<={$galaxyCount}
AND _increment.system<={$systemCount}
SQL_EOF;
$this->query($sql);

View file

@ -1,151 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license Modified BSD
* @see https://github.com/gplanchat/one.platform
*
* Copyright (c) 2009-2010, Grégory PLANCHAT <g.planchat at gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* - Neither the name of Grégory PLANCHAT nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing One.Platform.
*
*/
$this->setSetupConnection('core_setup');
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('aks')};
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('alliance')};
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('annonce')};
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('banned')};
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('buddy')};
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('chat')};
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('declared')};
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('fleets')};
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('galaxy')};
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('iraks')};
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('lunas')};
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('messages')};
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('multi')};
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('notes')};
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('planets')};
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('rw')};
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('statpoints')};
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('users')};
SQL_EOF;
$this->query($sql);

View file

@ -1,37 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/agpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2011-Present, Grégory PLANCHAT <g.planchat@gmail.com>
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
/**
*
* Enter description here ...
* @author Greg
*
*/
interface Legacies_Exception {}

View file

@ -1,43 +0,0 @@
<?php
class Legacies_Stats_Block_View
extends Wootook_Core_Block_Template
{
protected $_statData = array();
public function getStatData($type)
{
if (empty($this->_statData)) {
$readAdapter = Wootook_Core_Database_ConnectionManager::getSingleton()->getConnection('core_read');
$statement = $readAdapter->select()
->from($readAdapter->getTable('statpoints'))
->where('stat_type', $type)
->prepare()
;
$statement->execute();
$this->_statData = $statement->fetchAll();
}
return $this->_statData;
}
public function getPlayerStatData()
{
if (empty($this->_statData)) {
$playerId = Wootook_Player_Model_Session::getSingleton()->getPlayerId();
$readAdapter = Wootook_Core_Database_ConnectionManager::getSingleton()->getConnection('core_read');
$statement = $readAdapter->select()
->from($readAdapter->getTable('statpoints'))
->where('id_owner', $playerId)
->prepare()
;
$statement->execute();
$this->_statData = $statement->fetchAll();
}
return $this->_statData;
}
}

View file

@ -1,843 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/agpl-3.0.txt
* @see http://wootook.org/
*
* Copyright (c) 2011-Present, Grégory PLANCHAT <g.planchat@gmail.com>
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
/**
* Bootstrap class, used to access main and global functionalities
*
* @package Wootook
* @category core
*/
class Wootook
{
/**
* Static list of application event listeners
*
* @var array
*/
private static $_listeners = array();
/**
* Static list of all locale translators
*
* @var array
*/
private static $_translators = array();
/**
* HTTP request management object
*
* @var Legacies_Core_Controller_Request_Http
*/
private static $_request = null;
/**
* HTTP response management object
*
* @var Legacies_Core_Controller_Response
*/
private static $_response = null;
/**
* The current timestamp
*
* @var int
*/
private static $_now = null;
/**
* Default locale identifier
*
* @var string
*/
private static $_defaultLocale = 'fr_FR';
/**
*
* Enter description here ...
* @var Wootook_Core_Helper_Config_ConfigHandler
*/
private static $_config = null;
/**
*
* Enter description here ...
* @var Wootook_Core_Helper_Config_ConfigHandler
*/
private static $_globalConfig = null;
/**
*
* Enter description here ...
* @var array
*/
private static $_websiteConfigs = array();
/**
*
* Enter description here ...
* @var array
*/
private static $_gameConfigs = array();
/**
*
* Enter description here ...
* @var array
*/
private static $_ignoreDatabaseConfig = false;
private static $_defaultWebsite = null;
private static $_defaultGame = null;
private static $_websitesById = array();
private static $_websitesByCode = array();
private static $_gamesById = array();
private static $_gamesByCode = array();
public static $isInstalled = true;
/**
* Registers an event listener to be called later in the application.
*
* @param string $event The event identifier
* @param callback $listener The event callback to be called
*/
public static function registerListener($event, $listener)
{
if (!isset(self::$_listeners[$event])) {
self::$_listeners[$event] = array();
}
self::$_listeners[$event][] = $listener;
}
/**
* Clear all event listeners
*/
public static function clearAllListeners()
{
self::$_listeners = array();
}
/**
* Clear a specific event's listeners
*
* @param unknown_type $event
*/
public static function clearEventListeners($event)
{
if (isset(self::$_listeners[$event])) {
self::$_listeners[$event] = array();
}
}
/**
* Dispatches an event, calls all callbacks that were previously registered
*
* @param string $event The event identifier
* @param array $params The event params
*/
public static function dispatchEvent($event, $params)
{
$eventObject = new Wootook_Core_Event($params);
if (!isset(self::$_listeners[$event])) {
return $eventObject;
}
foreach (self::$_listeners[$event] as $listener) {
call_user_func($listener, $eventObject);
}
return $eventObject;
}
/**
*
* Enter description here ...
* @param unknown_type $namespace
* @return Wootook_Core_Model_Session
*/
public static function getSession($namespace)
{
return Wootook_Core_Model_Session::factory($namespace);
}
/**
* @static
* @param string|null $locale
* @return Wootook_Core_Model_Translator
*/
public static function getTranslator($locale = null)
{
if ($locale === null) {
$locale = self::getLocale();
}
if (!isset($translator[$locale])) {
$path = dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'locale';
$translator[$locale] = new Wootook_Core_Model_Translator($path, $locale);
}
return $translator[$locale];
}
public static function translate($locale, $message, Array $args)
{
return self::getTranslator($locale)->translateArgs($message, $args);
}
public static function __($message, $_ = null)
{
$args = func_get_args();
array_shift($args);
return self::getTranslator(self::getLocale())->translateArgs($message, $args);
}
public static function getLocale()
{
$availableLocales = self::getWebsiteConfig('locales');
if ($availableLocales !== null) {
return self::getPreferredLocale($availableLocales->toArray());
}
return self::getPreferredLocale();
}
public static function setDefaultLocale($locale)
{
$oldLocale = self::$_defaultLocale;
self::$_defaultLocale = $locale;
return $oldLocale;
}
public static function getDefaultLocale()
{
return self::$_defaultLocale;
}
public static function getPreferredLocale($availableLocales = array())
{
if (empty($availableLocales)) {
return self::getDefaultLocale();
}
$userLocale = Wootook_Player_Model_Session::getSingleton()->getData('locale');
if ($userLocale !== null && in_array($userLocale, $availableLocales)) {
return $userLocale;
}
$locales = array();
if (($accept = self::getRequest()->getServer('HTTP_ACCEPT_LANGUAGE')) !== null) {
// break up string into pieces (languages and q factors)
preg_match_all('/([a-z]{1,8}(?:-([a-z]{1,8}))?)\s*(?:;\s*q\s*=\s*(1|0\.[0-9]+))?/i', $accept, $matches);
$length = count($matches[1]);
for ($i = 0; $i < $length; $i++) {
$locale = $matches[1][$i];
if (!empty($matches[2][$i])) {
$locale .= '_' . strtoupper($matches[2][$i]);
}
$locales[$locale] = !empty($matches[3][$i]) ? min(max(floatval($matches[3][$i]), 0), 1) : 1;
}
arsort($locales, SORT_NUMERIC);
}
if (empty($locales)) {
return self::getDefaultLocale();
}
$preferredLocale = current($availableLocales);
$preferredPriority = 0;
foreach ($locales as $locale => $piority) {
if (!in_array($locale, $availableLocales)) {
continue;
}
if ($preferredPriority < $piority) {
$preferredPriority = $piority;
$preferredLocale = $locale;
}
}
Wootook_Player_Model_Session::getSingleton()->setData('locale', $preferredLocale);
return $preferredLocale;
}
/**
* @static
* @return Wootook_Core_DateTime
*/
public static function now()
{
if (self::$_now === null) {
self::$_now = time();
}
return new Wootook_Core_DateTime(self::$_now);
}
/**
* @return Wootook_Core_Mvc_Controller_Request_Http
*/
public static function getRequest()
{
if (self::$_request === null) {
self::$_request = new Wootook_Core_Mvc_Controller_Request_Http();
}
return self::$_request;
}
public static function setRequest($request)
{
self::$_request = $request;
}
/**
* @return Wootook_Core_Mvc_Controller_Response_Http
*/
public static function getResponse()
{
if (self::$_response === null) {
self::$_response = new Wootook_Core_Mvc_Controller_Response_Http();
}
return self::$_response;
}
public static function setResponse($response)
{
self::$_response = $response;
}
public static function loadConfig($filename = null)
{
self::$_websiteConfigs = array();
self::$_gameConfigs = array();
self::$_config = new Wootook_Core_Config_Adapter_Array();
try {
self::$_config->load(APPLICATION_PATH . 'configs' . DIRECTORY_SEPARATOR . 'system.php');
if ($filename === null) {
$filename = APPLICATION_PATH . 'configs' . DIRECTORY_SEPARATOR . 'local.php';
}
if (is_string($filename)) {
if (!self::$isInstalled) {
throw new Wootook_Core_Exception_DataAccessException();
}
$localConfig = new Wootook_Core_Config_Adapter_Array($filename);
self::$_config->merge($localConfig);
} else if (is_array($filename)) {
$localConfig = new Wootook_Core_Config_Node($filename);
self::$_config->merge($localConfig);
} else if ($filename instanceof Wootook_Core_Config_Node) {
self::$_config->merge($filename);
} else {
throw new Wootook_Core_Exception_DataAccessException();
}
} catch (Wootook_Core_Exception_DataAccessException $e) {
self::$_globalConfig = new Wootook_Core_Config_Node(array(), self::$_config);
self::$_ignoreDatabaseConfig = true;
return self::$_config;
}
self::$_globalConfig = clone self::$_config['default'];
if (isset(self::$_config['global'])) {
self::$_globalConfig->merge(self::$_config['global']);
}
self::_appendDatabaseConfig(self::$_globalConfig);
return self::$_config;
}
private static function _appendDatabaseConfig(Wootook_Core_Config_Node $config, $type = 'global', $model = null)
{
if (self::$_ignoreDatabaseConfig || !self::$isInstalled) {
return $config;
}
try {
$adapter = Wootook_Core_Database_ConnectionManager::getSingleton()
->getConnection('core_read');
} catch (Wootook_Core_Exception_Database_AdapterError $e) {
// This may also occur when the pdo_sqlite driver isn't loaded
self::$isInstalled = false;
Wootook_Core_ErrorProfiler::getSingleton()->addException($e);
return $config;
}
$select = $adapter->select($adapter->getTable('core_config'));
switch ($type) {
case 'website':
$select->where(new Wootook_Core_Database_Sql_Placeholder_Expression('website_id = :website_id', array('website_id' => $model->getId())));
break;
case 'game':
$select->where(new Wootook_Core_Database_Sql_Placeholder_Expression('game_id = :game_id', array('game_id' => $model->getId())));
break;
default:
$select->where('website_id', 0);
$select->where('game_id', 0);
break;
}
$statement = $select->prepare();
$statement->execute();
foreach ($statement as $row) {
$config->setConfig($row['config_path'], $row['config_value']);
}
return $config;
}
public static function getWebsite($websiteId)
{
if (is_numeric($websiteId)) {
if (isset(self::$_websitesById[$websiteId])) {
return self::$_websitesById[$websiteId];
}
$website = new Wootook_Core_Model_Website();
try {
$website->load($websiteId);
$websiteCode = $website->getData('code');
self::$_websitesById[$websiteId] = $website;
self::$_websitesByCode[$websiteCode] = $website;
} catch (Wootook_Core_Exception_DataAccessException $e) {
throw new Wootook_Core_Exception_WebsiteError('Could not load website entity.', null, $e);
}
return $website;
} else {
if (isset(self::$_websitesByCode[$websiteId])) {
return self::$_websitesByCode[$websiteId];
}
$website = new Wootook_Core_Model_Website();
try {
$website->load($websiteId, 'code');
$websiteId = $website->getId();
$websiteCode = $website->getData('code');
self::$_websitesById[$websiteId] = $website;
self::$_websitesByCode[$websiteCode] = $website;
} catch (Wootook_Core_Exception_DataAccessException $e) {
throw new Wootook_Core_Exception_WebsiteError('Could not load website entity.', null, $e);
}
return $website;
}
}
public static function getGame($gameId)
{
if (is_numeric($gameId)) {
if (isset(self::$_gamesById[$gameId])) {
return self::$_gamesById[$gameId];
}
$game = new Wootook_Core_Model_Game();
try {
$game->load($gameId);
$gameCode = $game->getData('code');
self::$_gamesById[$gameId] = $game;
self::$_gamesByCode[$gameCode] = $game;
} catch (Wootook_Core_Exception_DataAccessException $e) {
throw new Wootook_Core_Exception_GameError('Could not load game entity.', null, $e);
}
return $game;
} else {
if (isset(self::$_gamesByCode[$gameId])) {
return self::$_gamesByCode[$gameId];
}
$game = new Wootook_Core_Model_Game();
try {
$game->load($gameId, 'code');
$gameId = $game->getId();
$gameCode = $game->getData('code');
self::$_gamesById[$gameId] = $game;
self::$_gamesByCode[$gameCode] = $game;
} catch (Wootook_Core_Exception_DataAccessException $e) {
throw new Wootook_Core_Exception_GameError('Could not load game entity.', null, $e);
}
return $game;
}
}
public static function addWebsite(Wootook_Core_Model_Website $website)
{
$websiteId = $website->getId();
$websiteKey = $website->getData('code');
self::$_websitesById[$websiteId] = $website;
self::$_websitesByCode[$websiteKey] = $website;
}
public static function addGame(Wootook_Core_Model_Game $game)
{
$gameId = $game->getId();
$gameKey = $game->getData('code');
self::$_gamesById[$gameId] = $game;
self::$_gamesByCode[$gameKey] = $game;
}
public static function setDefaultWebsite(Wootook_Core_Model_Website $website)
{
self::$_defaultWebsite = $website;
}
public static function getDefaultWebsite()
{
if (self::$_defaultWebsite === null) {
self::$_defaultWebsite = new Wootook_Core_Model_Website();
self::$_defaultWebsite->setId(1)->setData('code', Wootook_Core_Model_Website::DEFAULT_CODE);
}
return self::$_defaultWebsite;
}
public static function getDefaultGame()
{
if (self::$_defaultGame === null) {
self::$_defaultGame = new Wootook_Core_Model_Game();
self::$_defaultGame->setId(1)->setData('code', Wootook_Core_Model_Game::DEFAULT_CODE);
}
return self::$_defaultGame;
}
public static function setDefaultGame(Wootook_Core_Model_Game $game)
{
self::$_defaultGame = $game;
}
private static function _initWebsiteConfig($websiteId)
{
if (self::$_config === null) {
self::loadConfig();
}
if (!self::$isInstalled) {
if (isset(self::$_config['default'])) {
self::$_websiteConfigs[Wootook_Core_Model_Website::DEFAULT_CODE] = clone self::$_config['default'];
} else {
self::$_websiteConfigs[Wootook_Core_Model_Website::DEFAULT_CODE] = new Wootook_Core_Config_Node(array(), self::$_config);
}
if (isset(self::$_config['install'])) {
self::$_websiteConfigs[Wootook_Core_Model_Website::DEFAULT_CODE]->merge(self::$_config['install']);
}
return self::$_websiteConfigs[Wootook_Core_Model_Website::DEFAULT_CODE];
}
try {
$website = self::getWebsite($websiteId);
} catch (Wootook_Core_Exception_WebsiteError $e) {
self::$isInstalled = false;
Wootook_Core_ErrorProfiler::getSingleton()->addException($e);
$website = new Wootook_Core_Model_Website();
$website->setId(0)->setData('code', 'install');
self::addWebsite($website);
self::setDefaultWebsite($website);
} catch (Wootook_Core_Exception_RuntimeException $e) {
Wootook_Core_ErrorProfiler::getSingleton()->exceptionManager($e);
return null;
}
$websiteKey = $website->getData('code');
$websiteId = $website->getId();
if (!isset(self::$_websiteConfigs[$websiteKey])) {
self::$_websiteConfigs[$websiteKey] = clone self::$_config['default'];
if ($websiteId != 0 && isset(self::$_config['frontend'])) {
self::$_websiteConfigs[$websiteKey]->merge(self::$_config['frontend']);
} else if ($websiteId == 0 && isset(self::$_config['backend'])) {
self::$_websiteConfigs[$websiteKey]->merge(self::$_config['backend']);
}
$websiteConfig = self::$_config->getConfig("website/{$websiteKey}");
if ($websiteConfig !== null) {
self::$_websiteConfigs[$websiteKey]->merge($websiteConfig);
}
self::_appendDatabaseConfig(self::$_websiteConfigs[$websiteKey], 'website', $website);
}
return self::$_websiteConfigs[$websiteKey];
}
private static function _initGameConfig($gameId)
{
if (self::$_config === null) {
self::loadConfig();
}
if (!self::$isInstalled) {
if (isset(self::$_config['default'])) {
self::$_gameConfigs[Wootook_Core_Model_Game::DEFAULT_CODE] = clone self::$_config['default'];
} else {
self::$_gameConfigs[Wootook_Core_Model_Game::DEFAULT_CODE] = new Wootook_Core_Config_Node(array(), self::$_config);
}
if (isset(self::$_config['install'])) {
self::$_gameConfigs[Wootook_Core_Model_Game::DEFAULT_CODE]->merge(self::$_config['install']);
}
return self::$_gameConfigs[Wootook_Core_Model_Game::DEFAULT_CODE];
}
try {
$game = self::getGame($gameId);
} catch (Wootook_Core_Exception_GameError $e) {
self::$isInstalled = false;
Wootook_Core_ErrorProfiler::getSingleton()->addException($e);
$game = new Wootook_Core_Model_Game();
$game->setId(0)->setData('code', 'install')->setData('website_id', self::getDefaultWebsite()->getId());
self::addGame($game);
self::setDefaultGame($game);
} catch (Wootook_Core_Exception_RuntimeException $e) {
Wootook_Core_ErrorProfiler::getSingleton()->exceptionManager($e);
return null;
}
$gameKey = $game->getData('code');
$gameId = $game->getId();
$websiteId = $game->getData('website_id');
if (!isset(self::$_gameConfigs[$gameKey])) {
$websiteConfig = self::_initWebsiteConfig($websiteId);
if ($websiteConfig === null) {
return null;
}
self::$_gameConfigs[$gameKey] = clone $websiteConfig;
$gameConfig = self::$_config->getConfig("game/{$gameKey}");
if ($gameConfig !== null) {
self::$_gameConfigs[$gameKey]->merge($gameConfig);
}
self::_appendDatabaseConfig(self::$_gameConfigs[$gameKey], 'game', $game);
}
return self::$_gameConfigs[$gameKey];
}
public static function getConfig($path = null)
{
if (self::$_config === null) {
self::loadConfig();
}
if ($path !== null) {
return self::$_globalConfig->getConfig($path);
}
return self::$_globalConfig;
}
/**
* @static
* @param null $path
* @param null $gameKey
* @return Wootook_Core_Config_Node
*/
public static function getWebsiteConfig($path = null, $websiteKey = null)
{
if (self::$_config === null) {
self::loadConfig();
}
if ($websiteKey === null) {
//$websiteKey = Wootook_Core_Model_Website::DEFAULT_CODE;
$websiteKey = self::getDefaultWebsite()->getData('code');
}
$config = self::_initWebsiteConfig($websiteKey);
if ($config === null) {
return null;
}
if ($path !== null) {
return $config->getConfig($path);
}
return $config;
}
/**
* @static
* @param null $path
* @param null $gameKey
* @return Wootook_Core_Config_Node
*/
public static function getGameConfig($path = null, $gameKey = null)
{
if (self::$_config === null) {
self::loadConfig();
}
if ($gameKey === null) {
//$gameKey = Wootook_Core_Model_Game::DEFAULT_CODE;
$gameKey = self::getDefaultGame()->getData('code');
}
$config = self::_initGameConfig($gameKey);
if ($config === null) {
return null;
}
if ($path !== null) {
return $config->getConfig($path);
}
return $config;
}
public static function setConfig($path, $value, $websiteId = null, $gameId = null)
{
if (self::$_config === null) {
self::loadConfig();
}
if (!self::$_ignoreDatabaseConfig) {
$updater = new Wootook_Core_Model_Config();
$updater->setPath($path)->setValue($value);
if ($websiteId !== null) {
$updater->setWebsiteId($websiteId);
if ($gameId !== null) {
$updater->setGameId($gameId);
self::$_gameConfigs[$gameId]->setConfig($path, $value);
} else {
self::$_websiteConfigs[$websiteId]->setConfig($path, $value);
}
} else {
self::$_globalConfig->setConfig($path, $value);
}
$updater->save();
} else if ($websiteId !== null) {
if ($gameId !== null) {
self::$_gameConfigs[$gameId]->setConfig($path, $value);
} else {
self::$_websiteConfigs[$websiteId]->setConfig($path, $value);
}
} else {
self::$_globalConfig->setConfig($path, $value);
}
return true;
}
public static function getBaseUrl($domain = 'base')
{
$urlConfig = self::getGameConfig('web/url');
if (!$urlConfig instanceof Wootook_Core_Config_Node) {
return null;
}
if (!is_string($domain) || !isset($urlConfig->$domain)) {
return $urlConfig->base;
}
return $urlConfig->$domain;
}
public static function getBasePath($domain = 'base')
{
$pathConfig = self::getGameConfig('system/path');
if (!$pathConfig instanceof Wootook_Core_Config_Node) {
return null;
}
if (!is_string($domain) || !isset($pathConfig->$domain)) {
return $pathConfig->base;
}
return $pathConfig->$domain;
}
public static function getUrl($uri, Array $params = array())
{
$baseUrl = self::getBaseUrl();
$queryParams = array();
if (isset($params['_query'])) {
$queryParams = $params['_query'];
unset($params['_query']);
}
$serializedParams = array();
foreach ($params as $paramKey => $paramValue) {
if ($paramValue) {
$serializedParams[] = "{$paramKey}/{$paramValue}";
}
}
$serializedQueryParams = array();
foreach ($queryParams as $paramKey => $paramValue) {
if ($paramValue) {
$serializedQueryParams[] = "{$paramKey}={$paramValue}";
}
}
if (count($serializedQueryParams) > 0) {
return $baseUrl . $uri . '/' . implode('/', $serializedParams) . '?' . implode('&', $serializedQueryParams);
}
return $baseUrl . $uri . '/' . implode('/', $serializedParams);
}
public static function getStaticUrl($uri, Array $params = array())
{
$baseUrl = self::getBaseUrl('static');
$serializedParams = array();
foreach ($params as $paramKey => $paramValue) {
if ($paramValue) {
$serializedParams[] = "{$paramKey}={$paramValue}";
}
}
if (count($serializedParams) > 0) {
return $baseUrl . $uri . '?' . implode('&', $serializedParams);
}
return $baseUrl . $uri;
}
public static function fileExists($path)
{
if ($path === null || empty($path)) {
return false;
}
Wootook_Core_ErrorProfiler::getSingleton()->sleep();
if (($fp = @fopen($path, 'r', true)) === false) {
Wootook_Core_ErrorProfiler::getSingleton()->wakeup();
return false;
}
fclose($fp);
Wootook_Core_ErrorProfiler::getSingleton()->wakeup();
return true;
}
}

View file

@ -1,155 +0,0 @@
<?php
class Wootook_Core_App
{
/**
*
* Enter description here ...
* @var Wootook_Core_Config_Adapter_Adapter
*/
private $_globalConfig = null;
public function __construct($websiteCode, $gameCode)
{
$this->_globalConfig = Wootook::getConfig();
}
protected function _resolveClassType(&$namespaces, $module, $class)
{
$class = str_replace(' ', '', ucwords(str_replace('-', ' ', $class)));
$class = str_replace(' ', '_', ucwords(str_replace('.', ' ', $class)));
if (isset($namespaces[$module])) {
foreach ($namespaces[$module] as $namespace => $path) {
$className = $namespace . $class;
$fileName = $path . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php';
Wootook_Core_ErrorProfiler::getSingleton()->sleep();
if (!($fp = @fopen($fileName, 'r', true))) {
Wootook_Core_ErrorProfiler::getSingleton()->wakeup();
continue;
}
Wootook_Core_ErrorProfiler::getSingleton()->wakeup();
fclose($fp);
if (!class_exists($className, true)) {
continue;
}
return $className;
}
}
Wootook_Core_ErrorProfiler::getSingleton()
->addException(new Wootook_Core_Exception_LayoutException(sprintf('Class type "%s" could not be resolved.', $type)));
return null;
}
protected function _newInstance($className, Array $constructorParams)
{
if ($className === null) {
return null;
}
if (empty($constructorParams)) {
return new $className;
} else {
$reflection = new ReflectionClass($className);
return $reflection->newInstanceArgs($constructorParams);
}
}
protected function _parseIdentifier($identifier, &$module, &$class)
{
$offset = strpos($identifier, '/');
if ($offset === false) {
$module = $identifier;
$class = null;
return;
}
$module = substr($type, 0, $offset);
$class = substr($type, $offset + 1);
}
public function block($identifier)
{
$this->_parseIdentifier($identifier, $module, $class);
return $this->getBlock($module, $class);
}
public function model($identifier)
{
$this->_parseIdentifier($identifier, $module, $class);
return $this->getModel($module, $class);
}
public function resource($identifier)
{
$this->_parseIdentifier($identifier, $module, $class);
return $this->getResource($module, $class);
}
public function helper($identifier)
{
$this->_parseIdentifier($identifier, $module, $class);
if ($class === null) {
$class = 'data';
}
return $this->getResource($module, $class);
}
public function getBlock($module, $class, Array $constructorParams = array())
{
$className = $this->_resolveClassType($this->_globalConfig->blocks, $module, $class);
return $this->_newInstance($className, $constructorParams);
}
public function getModel($module, $class, Array $constructorParams = array())
{
$className = $this->_resolveClassType($this->_globalConfig->models, $module, $class);
return $this->_newInstance($className, $constructorParams);
}
public function getResource($module, $class, Array $constructorParams = array())
{
$className = $this->_resolveClassType($this->_globalConfig->resources, $module, $class);
return $this->_newInstance($className, $constructorParams);
}
public function getHelper($module, $class, Array $constructorParams = array())
{
$className = $this->_resolveClassType($this->_globalConfig->helpers, $module, $class);
return $this->_newInstance($className, $constructorParams);
}
public function getBlockSingleton($module, $class, Array $constructorParams = array())
{
}
public function getModelSingleton($module, $class, Array $constructorParams = array())
{
}
public function getResourceSingleton($module, $class, Array $constructorParams = array())
{
}
public function getHelperSingleton($module, $class, Array $constructorParams = array())
{
}
}

View file

@ -1,14 +0,0 @@
<?php
class Wootook_Core_Block_Concat
extends Wootook_Core_Mvc_View_View
{
public function render()
{
$content = '';
foreach ($this->_partials as $partial) {
$content .= $partial->render();
}
return $content;
}
}

View file

@ -1,10 +0,0 @@
<?php
class Wootook_Core_Block_Deprecated
extends Wootook_Core_Block_Template
{
public function getScriptPath()
{
return $this->getLayout()->getScriptPath();
}
}

View file

@ -1,11 +0,0 @@
<?php
class Wootook_Core_Block_Html_Form
extends Wootook_Core_Block_Template
{
public function getFormKey()
{
$session = Wootook::getSession('security');
return $session->getFormKey(true);
}
}

View file

@ -1,287 +0,0 @@
<?php
class Wootook_Core_Block_Html_Head
extends Wootook_Core_Block_Template
{
const TYPE_GLOBAL_CSS = 'global_css';
const TYPE_GLOBAL_JS = 'global_js';
const TYPE_SKIN_CSS = 'skin_css';
const TYPE_SKIN_JS = 'skin_js';
const TYPE_INLINE_CSS = 'inline_css';
const TYPE_INLINE_JS = 'inline_js';
const TITLE_CONCAT_BEFORE = 'BEFORE';
const TITLE_CONCAT_AFTER = 'AFTER';
const TITLE_OVERWRITE = 'OVERWRITE';
protected $_items = array();
protected $_title = null;
protected $_titleDefaultConcat = self::TITLE_CONCAT_AFTER;
protected $_titleSeparator = ' ¤ ';
protected $_titleConcatTypes = array(
self::TITLE_CONCAT_AFTER,
self::TITLE_CONCAT_BEFORE,
self::TITLE_OVERWRITE
);
public function setTitleSeparator($separator)
{
$this->_titleSeparator = $separator;
return $this;
}
public function getTitleSeparator()
{
return $this->_titleSeparator;
}
public function setTitleDefaultConcat($defaultConcat)
{
if (in_array($concatType, $this->_titleConcatTypes)) {
$this->_titleDefaultConcat = $defaultConcat;
}
return $this;
}
public function getTitleDefaultConcat()
{
return $this->_titleDefaultConcat;
}
public function setTitle($title, $concatType = self::TITLE_CONCAT_AFTER)
{
if (!in_array($concatType, $this->_titleConcatTypes)) {
$concatType = $this->getTitleDefaultConcat();
}
if ($concatType == self::TITLE_OVERWRITE || $this->_title === null) {
$this->_title = $title;
} else if ($concatType == self::TITLE_CONCAT_BEFORE) {
$this->_title = $title . $this->getTitleSeparator() . $this->_title;
} else if ($concatType == self::TITLE_CONCAT_AFTER) {
$this->_title .= $this->getTitleSeparator() . $title;
}
return $this;
}
public function getTitle()
{
return $this->_title;
}
public function addItem($type, Array $options = array())
{
if (!isset($this->_items[$type])) {
$this->_items[$type] = array();
}
$this->_items[$type][] = $options;
return $this;
}
public function addJs($script, $type = 'text/javascript', Array $options = array(), $theme = null, $package = null)
{
$options['type'] = $type;
$options['path'] = $script;
$options['theme'] = $theme;
$options['package'] = $package;
$this->addItem(self::TYPE_GLOBAL_JS, $options);
return $this;
}
public function addCss($stylesheet, $type = 'text/css', $condition = null, Array $options = array(), $theme = null, $package = null)
{
$options['type'] = $type;
$options['path'] = $stylesheet;
$options['condition'] = $condition;
$options['theme'] = $theme;
$options['package'] = $package;
$this->addItem(self::TYPE_GLOBAL_CSS, $options);
return $this;
}
public function addSkinJs($script, $type = 'text/javascript', Array $options = array(), $theme = null, $package = null)
{
$options['type'] = $type;
$options['path'] = $script;
$options['theme'] = $theme;
$options['package'] = $package;
$this->addItem(self::TYPE_SKIN_JS, $options);
return $this;
}
public function addSkinCss($stylesheet, $type = 'text/css', $condition = null, Array $options = array(), $theme = null, $package = null)
{
$options['type'] = $type;
$options['path'] = $stylesheet;
$options['condition'] = $condition;
$options['theme'] = $theme;
$options['package'] = $package;
$this->addItem(self::TYPE_SKIN_CSS, $options);
return $this;
}
public function addInlineJs($content, $type = 'text/javascript', Array $options = array())
{
$options['type'] = $type;
$options['content'] = $content;
$this->addItem(self::TYPE_INLINE_JS, $options);
return $this;
}
public function addInlineCss($content, $type = 'text/css', Array $options = array())
{
$options['type'] = $type;
$options['content'] = $content;
$this->addItem(self::TYPE_INLINE_CSS, $options);
return $this;
}
public function getCss()
{
if (isset($this->_items[self::TYPE_GLOBAL_CSS])) {
return $this->_items[self::TYPE_GLOBAL_CSS];
}
return array();
}
public function getSkinCss()
{
if (isset($this->_items[self::TYPE_SKIN_CSS])) {
return $this->_items[self::TYPE_SKIN_CSS];
}
return array();
}
public function getInlineCss()
{
if (isset($this->_items[self::TYPE_INLINE_CSS])) {
return $this->_items[self::TYPE_INLINE_CSS];
}
return array();
}
public function getJs()
{
if (isset($this->_items[self::TYPE_GLOBAL_JS])) {
return $this->_items[self::TYPE_GLOBAL_JS];
}
return array();
}
public function getSkinJs()
{
if (isset($this->_items[self::TYPE_SKIN_JS])) {
return $this->_items[self::TYPE_SKIN_JS];
}
return array();
}
public function getInlineJs()
{
if (isset($this->_items[self::TYPE_INLINE_JS])) {
return $this->_items[self::TYPE_INLINE_JS];
}
return array();
}
public function renderCss()
{
$render = '';
foreach ($this->getCss() as $css) {
if (!isset($css['media'])) {
$css['media'] = 'all';
}
$url = $this->getStaticUrl($css['path'], array());
$render .=<<<HTML_EOF
<link rel="stylesheet" type="{$css['type']}" src="{$url}" media="{$css['media']}" />
HTML_EOF;
}
}
public function renderSkinCss()
{
$render = '';
foreach ($this->getSkinCss() as $css) {
if (!isset($css['media'])) {
$css['media'] = 'all';
}
$url = $this->getSkinUrl($css['path'], array(), $css['theme'], $css['package']);
$render .=<<<HTML_EOF
<link rel="stylesheet" type="{$css['type']}" src="{$url}" media="{$css['media']}" />
HTML_EOF;
}
}
public function renderInlineCss()
{
foreach ($this->getInlineCss() as $css) {
if (!isset($css['media'])) {
$css['media'] = 'all';
}
$render .=<<<HTML_EOF
<style type="{$css['type']}">/*<![CDATA[*/{$css['content']}/*]]>*/</style>
HTML_EOF;
}
return $render;
}
public function renderJs()
{
$render = '';
foreach ($this->getJs() as $js) {
if (!isset($js['type'])) {
$js['type'] = 'text/javascript';
}
$url = $this->getStaticUrl($js['path']);
$render .=<<<HTML_EOF
<script type="{$js['type']}" src="{$url}"></script>
HTML_EOF;
}
return $render;
}
public function renderSkinJs()
{
$render = '';
foreach ($this->getJs() as $js) {
if (!isset($js['type'])) {
$js['type'] = 'text/javascript';
}
$url = $this->getSkinUrl($js['path'], array(), $js['theme'], $js['package']);
$render .=<<<HTML_EOF
<script type="{$js['type']}" src="{$url}"></script>
HTML_EOF;
}
return $render;
}
public function renderInlineJs()
{
foreach ($this->getInlineJs() as $js) {
$render .=<<<HTML_EOF
<script type="{$js['type']}">/*<![CDATA[*/{$js['content']}/*]]>*/</script>
HTML_EOF;
}
return $render;
}
}

View file

@ -1,22 +0,0 @@
<?php
/**
* Created by JetBrains PhpStorm.
* User: Greg
* Date: 24/03/12
* Time: 10:51
* To change this template use File | Settings | File Templates.
*/
class Wootook_Core_Block_Html_Home
extends Wootook_Core_Block_Template
{
public function getTitle()
{
return Wootook::getGameConfig('game/home/title');
}
public function getFormatedWelcomeText()
{
return Wootook::getGameConfig('game/home/formated-welcome-text');
}
}

View file

@ -1,127 +0,0 @@
<?php
class Wootook_Core_Block_Html_Navigation
extends Wootook_Core_Block_Template
{
public function addLink($name, $label, $title, $uri, Array $params = array(), Array $classes = array(), $template = null, Array $attributes = array())
{
$explodedPath = explode('/', $name);
$baseName = array_pop($explodedPath);
$parent = $this->_getNode($explodedPath);
$child = $this->getLayout()
->createBlock('core/html.navigation.link', $this->getNameInLayout() . '.' . $baseName, array(
'url' => array(
'uri' => $uri,
'params' => $params
),
'label' => $label,
'title' => $title,
'classes' => $classes,
'attributes' => $attributes
));
$parent->setPartial($baseName, $child);
if ($template !== null) {
$child->setTemplate($template);
}
return $this;
}
public function addStaticLink($name, $label, $title, $uri, Array $params = array(), Array $classes = array(), $template = null, Array $attributes = array())
{
$explodedPath = explode('/', $name);
$baseName = array_pop($explodedPath);
$parent = $this->_getNode($explodedPath);
$child = $this->getLayout()
->createBlock('core/html.navigation.link', $this->getNameInLayout() . '.' . $baseName, array(
'url' => array(
'uri' => $uri,
'params' => $params,
'static' => true
),
'label' => $label,
'title' => $title,
'classes' => $classes,
'attributes' => $attributes
));
$parent->setPartial($baseName, $child);
if ($template !== null) {
$child->setTemplate($template);
}
return $this;
}
public function addExternalLink($name, $label, $title, $url, Array $classes = array(), $template = null, Array $attributes = array())
{
$explodedPath = explode('/', $name);
$baseName = array_pop($explodedPath);
$parent = $this->_getNode($explodedPath);
$child = $this->getLayout()
->createBlock('core/html.navigation.link', $this->getNameInLayout() . '.' . $baseName, array(
'url' => $url,
'label' => $label,
'title' => $title,
'classes' => $classes,
'attributes' => $attributes
));
$parent->setPartial($baseName, $child);
if ($template !== null) {
$child->setTemplate($template);
}
return $this;
}
public function addPopupLink($name, $label, $title, $uri, Array $params = array(), Array $classes = array(), $template = null, Array $attributes = array())
{
$uri = $this->getStaticUrl($uri, $params);
$attributes['onclick'] = "f('{$params}', '{$label}');return false;";
return $this->addLink($name, $label, $title, null, array(), $classes, $template, $attributes);
}
public function setNodeTitle($path, $title)
{
return $this->getNode($path)->setTitle($title);
}
public function setNodeTemplate($path, $template)
{
return $this->getNode($path)->setTemplate($template);
}
public function getNode($path)
{
return $this->_getNode(explode('/', $path));
}
protected function _getNode($explodedPath)
{
$name = array_shift($explodedPath);
if ($this->hasPartial($name)) {
$child = $this->getPartial($name);
} else {
$child = $this->getLayout()
->createBlock('core/html.navigation.node', $this->getNameInLayout() . '.' . $name);
$this->setPartial($name, $child);
}
if ($child instanceof Wootook_Core_Block_Html_Navigation_Link) {
throw new Wootook_Core_Exception_RuntimeException('Node is a link. Could not append a child node to a link node.');
}
if (count($explodedPath) == 0) {
return $child;
}
return $child->_getNode($explodedPath);
}
}

View file

@ -1,201 +0,0 @@
<?php
class Wootook_Core_Block_Html_Navigation_Link
extends Wootook_Core_Block_Template
{
protected $_label = '';
protected $_title = '';
protected $_uri = null;
protected $_url = null;
protected $_params = array();
protected $_classes = array('link');
protected $_attributes = array();
public function getTemplate()
{
if ($this->_template !== null) {
return $this->_template;
}
return 'page/html/navigation/link.phtml';
}
public function setLabel($label)
{
$this->_label = $label;
return $this;
}
public function getLabel()
{
return $this->_label;
}
public function setTitle($title)
{
$this->_title = $title;
return $this;
}
public function getTitle()
{
return $this->_title;
}
public function setStaticUrl($uri, $params = array())
{
if ($uri === null) {
return $this;
}
$this->_uri = $uri;
$this->_params = $params;
$this->_url = $this->getStaticUrl($uri, $params);
return $this;
}
public function setUrl($uri, $params = array())
{
if ($uri === null) {
return $this;
}
$this->_uri = $uri;
$this->_params = $params;
$this->_url = $this->getUrl($uri, $params);
return $this;
}
public function setExternalUrl($url)
{
$this->_url = $url;
$this->_uri = null;
$this->_params = array();
return $this;
}
public function getLinkUrl($moreParams = array())
{
if (empty($moreParams) || $this->_uri === null) {
return $this->_url;
}
$params = array_merge($this->_params, $moreParams);
return $this->getStaticUrl($this->_uri, $params);
}
public function setAttribute($attributeName, $attributeValue)
{
$this->_attributes[$attributeName] = $attributeValue;
return $this;
}
public function getAttribute($attributeName)
{
if ($this->hasAttribute($attributeName)) {
return $this->_attributes[$attributeName];
}
return null;
}
public function hasAttribute($attributeName)
{
if (isset($this->_attributes[$attributeName])) {
return true;
}
return false;
}
public function unsetAttribute($attributeName)
{
if ($this->hasAttribute($attributeName)) {
unset($this->_attributes[$attributeName]);
}
return $this;
}
public function getAttributes()
{
return $this->_attributes;
}
public function addClass($class)
{
$this->_classes[] = $class;
return $this;
}
public function clearClasses()
{
$this->_classes = array();
return $this;
}
public function renderClasses(Array $moreClasses = array())
{
$classes = array_merge($this->_classes, $moreClasses);
return implode(' ', $classes);
}
public function __construct(Array $data = array())
{
if (isset($data['label'])) {
$this->setLabel($data['label']);
unset($data['label']);
}
if (isset($data['title'])) {
$this->setTitle($data['title']);
unset($data['title']);
}
if (isset($data['url'])) {
if (is_array($data['url']) && isset($data['url']['uri'])) {
if (isset($data['url']['static']) && $data['url']['static']) {
if (isset($data['url']['params'])) {
$this->setStaticUrl($data['url']['uri'], $data['url']['params']);
} else {
$this->setStaticUrl($data['url']['uri']);
}
} else {
if (isset($data['url']['params'])) {
$this->setUrl($data['url']['uri'], $data['url']['params']);
} else {
$this->setUrl($data['url']['uri']);
}
}
} else {
$this->setExternalUrl($data['url']);
}
unset($data['url']);
}
if (isset($data['classes'])) {
$classes = (array) $data['classes'];
unset($data['classes']);
foreach ($classes as $class) {
$this->addClass(trim($class));
}
}
if (isset($data['attributes'])) {
$attributes = (array) $data['attributes'];
unset($data['attributes']);
foreach ($attributes as $attributeName => $attributeValue) {
$this->setAttribute($attributeName, $attributeValue);
}
}
parent::__construct($data);
return $this;
}
}

View file

@ -1,27 +0,0 @@
<?php
class Wootook_Core_Block_Html_Navigation_Node
extends Wootook_Core_Block_Html_Navigation
{
protected $_title = '';
public function setTitle($title)
{
$this->_title = $title;
return $this;
}
public function getTitle()
{
return $this->_title;
}
public function getTemplate()
{
if ($this->_template !== null) {
return $this->_template;
}
return 'page/html/navigation/node.phtml';
}
}

View file

@ -1,19 +0,0 @@
<?php
class Wootook_Core_Block_Html_Page
extends Wootook_Core_Block_Template
{
protected $_bodyClasses = array();
public function getBodyClasses()
{
return implode(' ', $this->_bodyClasses);
}
public function addBodyClass($class)
{
$this->_bodyClasses[] = $class;
return $this;
}
}

Some files were not shown because too many files have changed in this diff Show more