mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-03 14:10:57 +08:00
init
This commit is contained in:
9
.gitignore
vendored
Normal file
9
.gitignore
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
/node_modules
|
||||||
|
/vendor
|
||||||
|
/.idea
|
||||||
|
/.vagrant
|
||||||
|
npm-debug.log
|
||||||
|
.env
|
||||||
|
/.settings
|
||||||
|
.buildpath
|
||||||
|
.project
|
||||||
12
.htaccess
Normal file
12
.htaccess
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<ifModule mod_rewrite.c>
|
||||||
|
RewriteEngine on
|
||||||
|
RewriteRule \.svn/ - [F]
|
||||||
|
RewriteCond %{QUERY_STRING} ^(.+)$
|
||||||
|
RewriteRule ^(.*)forums/$ $1forums.php?action=viewtopic&%1 [L]
|
||||||
|
|
||||||
|
RewriteRule ^(.*)forums/$ $1forums.php?action=viewtopic
|
||||||
|
</ifModule>
|
||||||
|
Options FollowSymLinks
|
||||||
|
Order allow,deny
|
||||||
|
Allow from all
|
||||||
|
|
||||||
215
INSTALL
Normal file
215
INSTALL
Normal file
@@ -0,0 +1,215 @@
|
|||||||
|
NexusPHP 1.5 beta 4 20100517 Installation
|
||||||
|
This guide is intended for experienced webmasters and takes Ubuntu Server 10.04 as the example. Check out http://www.nexusphp.com for more tutorials.
|
||||||
|
1.Environment
|
||||||
|
This project should work on most operation systems where PHP is supported, such as Linux, Unix and Microsoft Windows.
|
||||||
|
1.1.Required:
|
||||||
|
A web server, Apache HTTP Server (v2.2.X tested) preferred. IIS HTTP Server (6.0 tested) should work as well but not recommended.
|
||||||
|
PHP 5 (v5.2.X and v5.3.X tested). Multibyte String(mbstring), MySQL(mysql), Memcache(memcache), GD extensions are required.
|
||||||
|
MySQL Server (v5.0.X tested).
|
||||||
|
memcached
|
||||||
|
|
||||||
|
1.2.Optional:
|
||||||
|
PEAR with HTTP_Request2 package. For the feature of IMDb information scraping.
|
||||||
|
A SMTP server, Postfix preferred. IIS SMTP Server (6.0 tested) should work, too. For sending email.
|
||||||
|
|
||||||
|
2.INSTALL
|
||||||
|
2.1.Apache web server
|
||||||
|
2.1.1.install the web server.
|
||||||
|
on Ubuntu Server 10.04:
|
||||||
|
# OS commandline starts
|
||||||
|
sudo apt-get install apache2
|
||||||
|
# OS commandline ends
|
||||||
|
2.1.2.edit the configuration file (usually named 'Apache2.conf' or 'httpd.conf')
|
||||||
|
on Ubuntu Server 10.04:
|
||||||
|
# OS commandline starts
|
||||||
|
sudo nano /etc/apache2/sites-enabled/000-default
|
||||||
|
# OS commandline ends
|
||||||
|
|
||||||
|
# configuration starts
|
||||||
|
<IfModule dir_module>
|
||||||
|
DirectoryIndex index.php index.html
|
||||||
|
</IfModule>
|
||||||
|
<VirtualHost *:80>
|
||||||
|
DocumentRoot "/your/http/document/root"
|
||||||
|
<Directory "/your/http/document/root">
|
||||||
|
Options FollowSymLinks
|
||||||
|
AllowOverride None
|
||||||
|
Order allow,deny
|
||||||
|
Allow from all
|
||||||
|
</Directory>
|
||||||
|
<DirectoryMatch /\.svn/>
|
||||||
|
AllowOverride None
|
||||||
|
Order allow,deny
|
||||||
|
Deny from all
|
||||||
|
</DirectoryMatch>
|
||||||
|
<Directory "/your/http/document/root/_db">
|
||||||
|
AllowOverride None
|
||||||
|
Order allow,deny
|
||||||
|
Deny from all
|
||||||
|
</Directory>
|
||||||
|
<Directory "/your/http/document/root/config">
|
||||||
|
AllowOverride None
|
||||||
|
Order allow,deny
|
||||||
|
Deny from all
|
||||||
|
</Directory>
|
||||||
|
<Directory "/your/http/document/root/_doc">
|
||||||
|
Options +Indexes
|
||||||
|
Order allow,deny
|
||||||
|
Allow from all
|
||||||
|
</Directory>
|
||||||
|
<Directory "/your/http/document/root/lang">
|
||||||
|
AllowOverride None
|
||||||
|
Order allow,deny
|
||||||
|
Deny from all
|
||||||
|
</Directory>
|
||||||
|
</VirtualHost>
|
||||||
|
# configuration ends
|
||||||
|
|
||||||
|
Note: replace '/your/http/document/root' with your own path, e.g. '/var/www/nexusphp'
|
||||||
|
|
||||||
|
2.2.PHP
|
||||||
|
2.2.1.install PHP with all required extensions.
|
||||||
|
on Ubuntu Server 10.04:
|
||||||
|
# OS commandline starts
|
||||||
|
sudo apt-get install php5 php5-gd php5-memcache php5-mysql
|
||||||
|
# OS commandline ends
|
||||||
|
2.2.2.edit the configuration file (usually named 'php.ini')
|
||||||
|
on Ubuntu Server 10.04:
|
||||||
|
# OS commandline starts
|
||||||
|
sudo nano /etc/php5/apache2/php.ini
|
||||||
|
# OS commandline ends
|
||||||
|
IMPORTANT: You must turn off the 'magic quotes' feature in PHP. It is unfortunately turned on by default with PHP 5.2
|
||||||
|
|
||||||
|
; configuration starts
|
||||||
|
magic_quotes_gpc = Off
|
||||||
|
magic_quotes_runtime = Off
|
||||||
|
magic_quotes_sybase = Off
|
||||||
|
; Optional. Increase it if memory-limit-reached error occurs when uploading large torrent files.
|
||||||
|
memory_limit = 128M
|
||||||
|
; configuration ends
|
||||||
|
|
||||||
|
2.3.MySQL server
|
||||||
|
2.3.1.install it.
|
||||||
|
on Ubuntu Server 10.04:
|
||||||
|
# OS commandline starts
|
||||||
|
sudo apt-get install mysql-server
|
||||||
|
# OS commandline ends
|
||||||
|
2.3.2.edit the configuration file (usually named 'my.cnf' or 'my.ini')
|
||||||
|
on Ubuntu Server 10.04:
|
||||||
|
# OS commandline starts
|
||||||
|
sudo nano /etc/mysql/my.cnf
|
||||||
|
# OS commandline ends
|
||||||
|
|
||||||
|
IMPORTANT: Do not set any SQL Modes. This project is not tested to work with them.
|
||||||
|
# configuration starts
|
||||||
|
sql-mode=""
|
||||||
|
; Optional. Increase it if mysql connection-failure occurs under heavy traffic load.
|
||||||
|
max_connections = 1000
|
||||||
|
# configuration ends
|
||||||
|
|
||||||
|
2.3.3.with the 1.5 beta 4 release, no installation script comes with the project. So you have to do everything yourself, such as creating a database:
|
||||||
|
2.3.3.1.connect to MySQL server
|
||||||
|
# OS commandline starts
|
||||||
|
mysql --user=yourdbusername --password=yourdbpassword --host=yourdbhostname
|
||||||
|
# OS commandline ends
|
||||||
|
Note: replace 'yourdbusername' with your own MySQL username e.g. 'root', 'yourdbpassword' with your MySQL user password, and 'yourdbhostname' with your MySQL hostname e.g. 'localhost'
|
||||||
|
2.3.3.2.create a database.
|
||||||
|
-- MySQL commandline starts
|
||||||
|
CREATE DATABASE yourdbname;
|
||||||
|
USE yourdbname;
|
||||||
|
-- MySQL commandline end
|
||||||
|
Note: replace 'yourdbname' with your own mysql database name, e.g. 'nexusphp'.
|
||||||
|
2.3.3.3.import database structure from this project.
|
||||||
|
-- MySQL commandline starts
|
||||||
|
SET NAMES utf8;
|
||||||
|
SOURCE /path/to/project/source/_db/dbstructure.sql;
|
||||||
|
-- MySQL commandline ends
|
||||||
|
Note: replace '/path/to/project/source' with your own path where you save files from this project.
|
||||||
|
2.3.3.4.quit MySQL
|
||||||
|
-- MySQL commandline starts
|
||||||
|
quit;
|
||||||
|
-- MySQL commandline ends
|
||||||
|
|
||||||
|
2.4.Memcached
|
||||||
|
2.4.1.install it.
|
||||||
|
on Ubuntu Server 10.04:
|
||||||
|
# OS commandline starts
|
||||||
|
sudo apt-get install memcached
|
||||||
|
# OS commandline ends
|
||||||
|
2.4.2.run it as a daemon.
|
||||||
|
on Ubuntu Server 10.04:
|
||||||
|
# OS commandline starts
|
||||||
|
memcached -d -u nobody
|
||||||
|
# OS commandline ends
|
||||||
|
|
||||||
|
2.5.PEAR and HTTP_Request2 package
|
||||||
|
To save the trouble, a package named 'Required.Files.From.PEAR' is available from the website http://www.nexusphp.com. You may skipped the following procedure if you have downloaded that package.
|
||||||
|
2.5.1.install PEAR basic package
|
||||||
|
on Ubuntu Server 10.04:
|
||||||
|
# OS commandline starts
|
||||||
|
sudo apt-get install php-pear
|
||||||
|
# OS commandline ends
|
||||||
|
2.5.2.set preferred package state of PEAR to 'alpha'
|
||||||
|
on Ubuntu Server 10.04:
|
||||||
|
# OS commandline starts
|
||||||
|
sudo pear config-set preferred_state alpha
|
||||||
|
# OS commandline ends
|
||||||
|
2.5.3.install HTTP_Request2 package.
|
||||||
|
# OS commandline starts
|
||||||
|
sudo pear install HTTP_Request2
|
||||||
|
# OS commandline ends
|
||||||
|
|
||||||
|
2.6.Postfix
|
||||||
|
2.6.1.install it.
|
||||||
|
on Ubuntu Server 10.04:
|
||||||
|
# OS commandline starts
|
||||||
|
sudo apt-get install postfix
|
||||||
|
# OS commandline ends
|
||||||
|
|
||||||
|
2.7.Restart MySQL and Apache HTTP Server services
|
||||||
|
For edits of configuration to take effect, services need to be restarted.
|
||||||
|
on Ubuntu Server 10.04:
|
||||||
|
# OS commandline starts
|
||||||
|
sudo /etc/init.d/apache2 restart
|
||||||
|
sudo /etc/init.d/mysql restart
|
||||||
|
# OS commandline ends
|
||||||
|
|
||||||
|
3.Set up this project
|
||||||
|
3.1.put all files from this project into the document root of your http server, e.g. '/var/www/nexusphp'
|
||||||
|
3.2.on *nix OS, change files' access permission to 777
|
||||||
|
on Ubuntu Server 10.04:
|
||||||
|
# OS commandline starts
|
||||||
|
sudo chmod -Rf 777 /your/http/document/root
|
||||||
|
# OS commandline ends
|
||||||
|
Note: replace '/your/http/document/root' with your own path, e.g. '/var/www/nexusphp'
|
||||||
|
3.3.edit the configuration file (named 'config/allconfig.php') of this project
|
||||||
|
|
||||||
|
// configuration starts
|
||||||
|
$BASIC=array(
|
||||||
|
'SITENAME' => 'yoursitename',
|
||||||
|
'BASEURL' => 'yoursiteurl',
|
||||||
|
'announce_url' => 'yoursiteurl/announce.php',
|
||||||
|
'mysql_host' => 'yourdbhostname',
|
||||||
|
'mysql_user' => 'yourdbusername',
|
||||||
|
'mysql_pass' => 'yourdbpassword',
|
||||||
|
'mysql_db' => 'yourdbname',
|
||||||
|
);
|
||||||
|
// configuration ends
|
||||||
|
Note: replace 'yoursitename' with your own name of the website e.g. 'MyTracker', 'yoursiteurl' with your site base URL (without prefixing 'http://') e.g. 'www.nexusphp.com', 'mysql_host' with your MySQL hostname e.g. 'localhost', 'yourdbhostname' with your MySQL username e.g. 'root', 'yourdbusername' with your MySQL user password, and 'mysql_db' with your MySQL database name e.g. 'nexusphp'.
|
||||||
|
3.4.visit your site. Register a new user.
|
||||||
|
3.5.set yourself the Staff Leader.
|
||||||
|
Again, you have to do it the dirty way, namely running MySQL query manually.
|
||||||
|
3.5.1.connect to mysql server
|
||||||
|
# OS commandline starts
|
||||||
|
mysql --user=yourdbusername --password=yourdbpassword --host=yourdbhostname yourdbname
|
||||||
|
# OS commandline ends
|
||||||
|
Note: replace 'yourdbusername' with your own MySQL username e.g. 'root', 'yourdbpassword' with your MySQL user password, 'yourdbhostname' with your MySQL hostname e.g. 'localhost', and 'yourdbname' with your MySQL database name e.g. 'nexusphp'.
|
||||||
|
3.5.2.set your class to Staff Leader
|
||||||
|
-- MySQL commandline starts
|
||||||
|
UPDATE users SET class=16 WHERE username='yourwebsiteusername';
|
||||||
|
-- MySQL commandline ends
|
||||||
|
NOTE: replace 'yourwebsiteusername' with the username you have just registered on the website.
|
||||||
|
3.5.3.quit MySQL
|
||||||
|
-- MySQL commandline starts
|
||||||
|
quit;
|
||||||
|
-- MySQL commandline ends
|
||||||
342
LICENSE
Normal file
342
LICENSE
Normal file
@@ -0,0 +1,342 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||||
|
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
License is intended to guarantee your freedom to share and change free
|
||||||
|
software--to make sure the software is free for all its users. This
|
||||||
|
General Public License applies to most of the Free Software
|
||||||
|
Foundation's software and to any other program whose authors commit to
|
||||||
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
|
the GNU Library General Public License instead.) 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
|
||||||
|
this service 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 make restrictions that forbid
|
||||||
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
|
These restrictions translate to certain responsibilities for you if you
|
||||||
|
distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
|
you have. 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.
|
||||||
|
|
||||||
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
|
distribute and/or modify the software.
|
||||||
|
|
||||||
|
Also, for each author's protection and ours, we want to make certain
|
||||||
|
that everyone understands that there is no warranty for this free
|
||||||
|
software. If the software is modified by someone else and passed on, we
|
||||||
|
want its recipients to know that what they have is not the original, so
|
||||||
|
that any problems introduced by others will not reflect on the original
|
||||||
|
authors' reputations.
|
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software
|
||||||
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
|
program will individually obtain patent licenses, in effect making the
|
||||||
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
|
patent must be licensed for everyone's free use or not licensed at all.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License applies to any program or other work which contains
|
||||||
|
a notice placed by the copyright holder saying it may be distributed
|
||||||
|
under the terms of this General Public License. The "Program", below,
|
||||||
|
refers to any such program or work, and a "work based on the Program"
|
||||||
|
means either the Program or any derivative work under copyright law:
|
||||||
|
that is to say, a work containing the Program or a portion of it,
|
||||||
|
either verbatim or with modifications and/or translated into another
|
||||||
|
language. (Hereinafter, translation is included without limitation in
|
||||||
|
the term "modification".) Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running the Program is not restricted, and the output from the Program
|
||||||
|
is covered only if its contents constitute a work based on the
|
||||||
|
Program (independent of having been made by running the Program).
|
||||||
|
Whether that is true depends on what the Program does.
|
||||||
|
|
||||||
|
1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the
|
||||||
|
notices that refer to this License and to the absence of any warranty;
|
||||||
|
and give any other recipients of the Program a copy of this License
|
||||||
|
along with the Program.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
|
you may at your option offer warranty protection in exchange for a fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Program or any portion
|
||||||
|
of it, thus forming a work based on the Program, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) You must cause the modified files to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
b) You must cause any work that you distribute or publish, that in
|
||||||
|
whole or in part contains or is derived from the Program or any
|
||||||
|
part thereof, to be licensed as a whole at no charge to all third
|
||||||
|
parties under the terms of this License.
|
||||||
|
|
||||||
|
c) If the modified program normally reads commands interactively
|
||||||
|
when run, you must cause it, when started running for such
|
||||||
|
interactive use in the most ordinary way, to print or display an
|
||||||
|
announcement including an appropriate copyright notice and a
|
||||||
|
notice that there is no warranty (or else, saying that you provide
|
||||||
|
a warranty) and that users may redistribute the program under
|
||||||
|
these conditions, and telling the user how to view a copy of this
|
||||||
|
License. (Exception: if the Program itself is interactive but
|
||||||
|
does not normally print such an announcement, your work based on
|
||||||
|
the Program is not required to print an announcement.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Program,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Program.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Program
|
||||||
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may copy and distribute the Program (or a work based on it,
|
||||||
|
under Section 2) in object code or executable form under the terms of
|
||||||
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
|
|
||||||
|
a) Accompany it with the complete corresponding machine-readable
|
||||||
|
source code, which must be distributed under the terms of Sections
|
||||||
|
1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
|
b) Accompany it with a written offer, valid for at least three
|
||||||
|
years, to give any third party, for a charge no more than your
|
||||||
|
cost of physically performing source distribution, a complete
|
||||||
|
machine-readable copy of the corresponding source code, to be
|
||||||
|
distributed under the terms of Sections 1 and 2 above on a medium
|
||||||
|
customarily used for software interchange; or,
|
||||||
|
|
||||||
|
c) Accompany it with the information you received as to the offer
|
||||||
|
to distribute corresponding source code. (This alternative is
|
||||||
|
allowed only for noncommercial distribution and only if you
|
||||||
|
received the program in object code or executable form with such
|
||||||
|
an offer, in accord with Subsection b above.)
|
||||||
|
|
||||||
|
The source code for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For an executable work, complete source
|
||||||
|
code means all the source code for all modules it contains, plus any
|
||||||
|
associated interface definition files, plus the scripts used to
|
||||||
|
control compilation and installation of the executable. However, as a
|
||||||
|
special exception, the source code distributed need not include
|
||||||
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
|
operating system on which the executable runs, unless that component
|
||||||
|
itself accompanies the executable.
|
||||||
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
|
distribution of the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
4. You may not copy, modify, sublicense, or distribute the Program
|
||||||
|
except as expressly provided under this License. Any attempt
|
||||||
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
|
void, and will automatically terminate your rights under this License.
|
||||||
|
However, parties who have received copies, or rights, from you under
|
||||||
|
this License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
5. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Program or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Program (or any work based on the
|
||||||
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Program or works based on it.
|
||||||
|
|
||||||
|
6. Each time you redistribute the Program (or any work based on the
|
||||||
|
Program), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
|
these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
this License.
|
||||||
|
|
||||||
|
7. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
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
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Program at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Program by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Program.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under
|
||||||
|
any particular circumstance, the balance of the section is intended to
|
||||||
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system, which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
8. If the distribution and/or use of the Program is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Program under this License
|
||||||
|
may add an explicit geographical distribution limitation excluding
|
||||||
|
those countries, so that distribution is permitted only in or among
|
||||||
|
countries not thus excluded. In such case, this License incorporates
|
||||||
|
the limitation as if written in the body of this License.
|
||||||
|
|
||||||
|
9. The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the 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 a version number of this License which applies to it and "any
|
||||||
|
later version", you have the option of following the terms and conditions
|
||||||
|
either of that version or of any later version published by the Free
|
||||||
|
Software Foundation. If the Program does not specify a version number of
|
||||||
|
this License, you may choose any version ever published by the Free Software
|
||||||
|
Foundation.
|
||||||
|
|
||||||
|
10. If you wish to incorporate parts of the Program into other free
|
||||||
|
programs whose distribution conditions are different, write to the author
|
||||||
|
to ask for permission. For software which is copyrighted by the Free
|
||||||
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||||
|
make exceptions for this. Our decision will be guided by the two goals
|
||||||
|
of preserving the free status of all derivatives of our free software and
|
||||||
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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.
|
||||||
|
|
||||||
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||||
|
REDISTRIBUTE 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.
|
||||||
|
|
||||||
|
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
|
||||||
|
convey 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 2 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, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program is interactive, make it output a short notice like this
|
||||||
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
|
Gnomovision version 69, Copyright (C) year name of author
|
||||||
|
Gnomovision 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, the commands you use may
|
||||||
|
be called something other than `show w' and `show c'; they could even be
|
||||||
|
mouse-clicks or menu items--whatever suits your program.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1989
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
This 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 Library General
|
||||||
|
Public License instead of this License.
|
||||||
|
|
||||||
|
|
||||||
7
README
Normal file
7
README
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
ABOUT NexusPHP
|
||||||
|
This Project NexusPHP is an open-sourced private tracker script written in PHP.
|
||||||
|
It forks from the TBSource project and some other open-sourced projects.
|
||||||
|
Please read the LICENSE file before using this project.
|
||||||
|
Read the INSTALL file for information about how to use it.
|
||||||
|
Read the RELEASENOTE file about this release.
|
||||||
|
Visit http://www.nexusphp.com for more information about this project.
|
||||||
31
RELEASENOTE
Normal file
31
RELEASENOTE
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
Release note for v1.5 beta 5 20120707
|
||||||
|
fix tracker "can't unzip" issue when zlib is not enabled
|
||||||
|
|
||||||
|
Release note for v1.5 beta 5 20120301
|
||||||
|
Fix: several security issues
|
||||||
|
Fix: takesignup not checking invitation code
|
||||||
|
Fix: function sqlesc() with numeric value
|
||||||
|
Fix: sendmail delay issue
|
||||||
|
Fix: language file in docleanup()
|
||||||
|
Fix: language setting at FAQ and Rules
|
||||||
|
Mod: default promotion display type to 'icon'
|
||||||
|
thank http://wiki.nexusphp.org for reporting bugs
|
||||||
|
|
||||||
|
Release note for v1.5 beta 4 20100919
|
||||||
|
Fix: "There is a minimum announce time of 30 seconds", caused by timezone settings. Now you should set correct timezone in php.ini
|
||||||
|
Fix: varchar column length exceed 255 characters, which causes errors in MySQL 5.0.3 and later
|
||||||
|
Mod: set mysql sql_mode in php level
|
||||||
|
Mod: change mysql_pconnect to mysql_connect
|
||||||
|
Release note for v1.5 beta 4 20100905
|
||||||
|
Add: promotion timeout setting per torrent
|
||||||
|
Fix: some minor bugs
|
||||||
|
Release note for v1.5 beta 4 20100615
|
||||||
|
Change default cleanup from cron-triggered to browser-triggered
|
||||||
|
Release note for v1.5 beta 4 20100603
|
||||||
|
Fix a few minor bugs from previous release
|
||||||
|
Release note for v1.5 beta 4 20100531
|
||||||
|
Fix a few minor bugs from previous release
|
||||||
|
Release note for v1.5 beta 4 20100517
|
||||||
|
This release is not considered stable and ready for major time. A lot of things, especially those in staff panel, may not work as expected.
|
||||||
|
No installer available yet.
|
||||||
|
Use it at your own risk.
|
||||||
3
_db/.htaccess
Normal file
3
_db/.htaccess
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
Options -Indexes
|
||||||
|
Order allow,deny
|
||||||
|
Deny from all
|
||||||
2504
_db/dbstructure.sql
Normal file
2504
_db/dbstructure.sql
Normal file
File diff suppressed because one or more lines are too long
3
_doc/.htaccess
Normal file
3
_doc/.htaccess
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
Options +Indexes
|
||||||
|
Order allow,deny
|
||||||
|
Allow from all
|
||||||
65
aboutnexus.php
Normal file
65
aboutnexus.php
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
require_once(get_langfile_path());
|
||||||
|
|
||||||
|
stdhead(PROJECTNAME);
|
||||||
|
print ("<h1>".PROJECTNAME."</h1>");
|
||||||
|
begin_main_frame();
|
||||||
|
begin_frame("<span id=\"version\">".$lang_aboutnexus['text_version']."</span>");
|
||||||
|
print ($lang_aboutnexus['text_version_note']);
|
||||||
|
print ("<br /><br /><table class=\"main\" border=\"1\" cellspacing=\"0\" cellpadding=\"5\" align=\"center\">");
|
||||||
|
tr($lang_aboutnexus['text_main_version'],$mainversion_code,1);
|
||||||
|
tr($lang_aboutnexus['text_sub_version'],$subversion_code,1);
|
||||||
|
tr($lang_aboutnexus['text_release_date'],$releasedate_code,1);
|
||||||
|
print ("</table>");
|
||||||
|
print ("<br /><br />");
|
||||||
|
end_frame();
|
||||||
|
begin_frame("<span id=\"nexus\">".$lang_aboutnexus['text_nexus'].PROJECTNAME."</span>");
|
||||||
|
print (PROJECTNAME.$lang_aboutnexus['text_nexus_note']);
|
||||||
|
print ("<br /><br />");
|
||||||
|
end_frame();
|
||||||
|
begin_frame("<span id=\"authorization\">".$lang_aboutnexus['text_authorization']."</span>");
|
||||||
|
print ($lang_aboutnexus['text_authorization_note']);
|
||||||
|
print ("<br /><br />");
|
||||||
|
end_frame();
|
||||||
|
unset($ppl);
|
||||||
|
$res = sql_query("SELECT * FROM language ORDER BY trans_state") or sqlerr();
|
||||||
|
while ($arr = mysql_fetch_assoc($res))
|
||||||
|
{
|
||||||
|
$ppl .= "<tr><td class=\"rowfollow\"><img width=\"24\" height=\"15\" src=\"pic/flag/".$arr[flagpic]."\" alt=\"".$arr[lang_name]."\" title=\"".$arr[lang_name]."\" style=\"padding-bottom:1px;\" /></td>
|
||||||
|
<td class=\"rowfollow\">".$arr['lang_name']."</td>".
|
||||||
|
"<td class=\"rowfollow\">".$arr['trans_state']."</td></tr>\n";
|
||||||
|
}
|
||||||
|
begin_frame("<span id=\"translation\">".$lang_aboutnexus['text_translation']."</span>");
|
||||||
|
print (PROJECTNAME.$lang_aboutnexus['text_translation_note']);
|
||||||
|
print ("<br /><br /><table class=\"main\" border=\"1\" cellspacing=\"0\" cellpadding=\"5\" align=\"center\"><tr><td class=\"colhead\">".$lang_aboutnexus['text_flag']."</td><td class=\"colhead\">".$lang_aboutnexus['text_language']."</td><td class=\"colhead\">".$lang_aboutnexus['text_state']."</td></tr>");
|
||||||
|
print ($ppl);
|
||||||
|
print ("</table>");
|
||||||
|
print ("<br /><br />");
|
||||||
|
end_frame();
|
||||||
|
unset($ppl);
|
||||||
|
$res = sql_query("SELECT * FROM stylesheets ORDER BY id") or sqlerr();
|
||||||
|
while ($arr = mysql_fetch_assoc($res))
|
||||||
|
{
|
||||||
|
$ppl .= "<tr><td class=\"rowfollow\">".$arr['name']."</td>
|
||||||
|
<td class=\"rowfollow\">".$arr['designer']."</td>".
|
||||||
|
"<td class=\"rowfollow\">".$arr['comment']."</td></tr>\n";
|
||||||
|
}
|
||||||
|
begin_frame("<span id=\"stylesheet\">".$lang_aboutnexus['text_stylesheet']."</span>");
|
||||||
|
print ($lang_aboutnexus['text_stylesheet_note']);
|
||||||
|
print ("<br /><br /><table class=\"main\" border=\"1\" cellspacing=\"0\" cellpadding=\"5\" align=\"center\"><tr><td class=\"colhead\">".$lang_aboutnexus['text_name']."</td><td class=\"colhead\">".$lang_aboutnexus['text_designer']."</td><td class=\"colhead\">".$lang_aboutnexus['text_comment']."</td></tr>");
|
||||||
|
print ($ppl);
|
||||||
|
print ("</table>");
|
||||||
|
print ("<br /><br />");
|
||||||
|
end_frame();
|
||||||
|
begin_frame("<span id=\"contact\">".$lang_aboutnexus['text_contact'].PROJECTNAME."</span>");
|
||||||
|
print ($lang_aboutnexus['text_contact_note']);
|
||||||
|
print ("<br /><br /><table class=\"main\" border=\"1\" cellspacing=\"0\" cellpadding=\"5\" align=\"center\">");
|
||||||
|
tr($lang_aboutnexus['text_web_site'],$website_code ? $website_code : "N/A",1);
|
||||||
|
print ("</table>");
|
||||||
|
print ("<br /><br />");
|
||||||
|
end_frame();
|
||||||
|
end_main_frame();
|
||||||
|
stdfoot();
|
||||||
|
?>
|
||||||
58
adduser.php
Normal file
58
adduser.php
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
<?php
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
loggedinorreturn();
|
||||||
|
if (get_user_class() < UC_ADMINISTRATOR)
|
||||||
|
stderr("Error", "Access denied.");
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] == "POST")
|
||||||
|
{
|
||||||
|
if ($_POST["username"] == "" || $_POST["password"] == "" || $_POST["email"] == "")
|
||||||
|
stderr("Error", "Missing form data.");
|
||||||
|
if ($_POST["password"] != $_POST["password2"])
|
||||||
|
stderr("Error", "Passwords mismatch.");
|
||||||
|
$email = htmlspecialchars(trim($_POST["email"]));
|
||||||
|
$email = safe_email($email);
|
||||||
|
if (!check_email($email))
|
||||||
|
stderr("Error","Invalid email address!");
|
||||||
|
|
||||||
|
$username = $_POST["username"];
|
||||||
|
|
||||||
|
if (!validusername($username))
|
||||||
|
stderr("Error","Invalid username.");
|
||||||
|
$username = sqlesc($username);
|
||||||
|
$res = sql_query("SELECT id FROM users WHERE username=$username");
|
||||||
|
$arr = mysql_fetch_row($res);
|
||||||
|
if ($arr)
|
||||||
|
stderr("Error","Username already exists!");
|
||||||
|
$password = $_POST["password"];
|
||||||
|
$email = sqlesc($_POST["email"]);
|
||||||
|
$res = sql_query("SELECT id FROM users WHERE email=$email");
|
||||||
|
$arr = mysql_fetch_row($res);
|
||||||
|
if ($arr)
|
||||||
|
stderr("Error","The e-mail address is already in use.");
|
||||||
|
$secret = mksecret();
|
||||||
|
$passhash = sqlesc(md5($secret . $password . $secret));
|
||||||
|
$secret = sqlesc($secret);
|
||||||
|
|
||||||
|
sql_query("INSERT INTO users (added, last_access, secret, username, passhash, status, stylesheet, class,email) VALUES(NOW(), NOW(), $secret, $username, $passhash, 'confirmed', ".$defcss.",".$defaultclass_class.",$email)") or sqlerr(__FILE__, __LINE__);
|
||||||
|
$res = sql_query("SELECT id FROM users WHERE username=$username");
|
||||||
|
$arr = mysql_fetch_row($res);
|
||||||
|
if (!$arr)
|
||||||
|
stderr("Error", "Unable to create the account. The user name is possibly already taken.");
|
||||||
|
header("Location: " . get_protocol_prefix() . "$BASEURL/userdetails.php?id=".htmlspecialchars($arr[0]));
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
stdhead("Add user");
|
||||||
|
|
||||||
|
?>
|
||||||
|
<h1>Add user</h1>
|
||||||
|
<form method=post action=adduser.php>
|
||||||
|
<table border=1 cellspacing=0 cellpadding=5>
|
||||||
|
<tr><td class=rowhead>User name</td><td><input type=text name=username size=40></td></tr>
|
||||||
|
<tr><td class=rowhead>Password</td><td><input type=password name=password size=40></td></tr>
|
||||||
|
<tr><td class=rowhead>Re-type password</td><td><input type=password name=password2 size=40></td></tr>
|
||||||
|
<tr><td class=rowhead>E-mail</td><td><input type=text name=email size=40></td></tr>
|
||||||
|
<tr><td colspan=2 align=center><input type=submit value="Okay" class=btn></td></tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
<?php stdfoot();
|
||||||
426
admanage.php
Normal file
426
admanage.php
Normal file
@@ -0,0 +1,426 @@
|
|||||||
|
<?php
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
require_once(get_langfile_path());
|
||||||
|
loggedinorreturn();
|
||||||
|
|
||||||
|
if (get_user_class() < UC_MODERATOR)
|
||||||
|
permissiondenied();
|
||||||
|
$allowxhtmlclass = UC_ADMINISTRATOR;
|
||||||
|
function get_position_name($position)
|
||||||
|
{
|
||||||
|
global $lang_admanage;
|
||||||
|
switch ($position)
|
||||||
|
{
|
||||||
|
case 'header':
|
||||||
|
$name = $lang_admanage['text_header'];
|
||||||
|
break;
|
||||||
|
case 'footer':
|
||||||
|
$name = $lang_admanage['text_footer'];
|
||||||
|
break;
|
||||||
|
case 'belownav':
|
||||||
|
$name = $lang_admanage['text_below_navigation'];
|
||||||
|
break;
|
||||||
|
case 'belowsearchbox':
|
||||||
|
$name = $lang_admanage['text_below_searchbox'];
|
||||||
|
break;
|
||||||
|
case 'torrentdetail':
|
||||||
|
$name = $lang_admanage['text_torrent_detail'];
|
||||||
|
break;
|
||||||
|
case 'comment':
|
||||||
|
$name = $lang_admanage['text_comment_page'];
|
||||||
|
break;
|
||||||
|
case 'interoverforums':
|
||||||
|
$name = $lang_admanage['text_inter_overforums'];
|
||||||
|
break;
|
||||||
|
case 'forumpost':
|
||||||
|
$name = $lang_admanage['text_forum_post_page'];
|
||||||
|
break;
|
||||||
|
case 'popup':
|
||||||
|
$name = $lang_admanage['text_popup'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $name;
|
||||||
|
}
|
||||||
|
function get_type_name($type)
|
||||||
|
{
|
||||||
|
global $lang_admanage;
|
||||||
|
switch ($type)
|
||||||
|
{
|
||||||
|
case 'bbcodes':
|
||||||
|
$name = $lang_admanage['text_bbcodes'];
|
||||||
|
break;
|
||||||
|
case 'xhtml':
|
||||||
|
$name = $lang_admanage['text_xhtml'];
|
||||||
|
break;
|
||||||
|
case 'text':
|
||||||
|
$name = $lang_admanage['text_text'];
|
||||||
|
break;
|
||||||
|
case 'image':
|
||||||
|
$name = $lang_admanage['text_image'];
|
||||||
|
break;
|
||||||
|
case 'flash':
|
||||||
|
$name = $lang_admanage['text_flash'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $name;
|
||||||
|
}
|
||||||
|
function print_ad_editor($position, $row = "")
|
||||||
|
{
|
||||||
|
global $lang_admanage;
|
||||||
|
switch ($position)
|
||||||
|
{
|
||||||
|
case 'header':
|
||||||
|
$note = $lang_admanage['text_header_note'];
|
||||||
|
break;
|
||||||
|
case 'footer':
|
||||||
|
$note = $lang_admanage['text_footer_note'];
|
||||||
|
break;
|
||||||
|
case 'belownav':
|
||||||
|
$note = $lang_admanage['text_below_navigation_note'];
|
||||||
|
break;
|
||||||
|
case 'belowsearchbox':
|
||||||
|
$note = $lang_admanage['text_below_searchbox_note'];
|
||||||
|
break;
|
||||||
|
case 'torrentdetail':
|
||||||
|
$note = $lang_admanage['text_torrent_detail_note'];
|
||||||
|
break;
|
||||||
|
case 'comment':
|
||||||
|
$note = $lang_admanage['text_comment_page_note'];
|
||||||
|
break;
|
||||||
|
case 'interoverforums':
|
||||||
|
$note = $lang_admanage['text_inter_overforums_note'];
|
||||||
|
break;
|
||||||
|
case 'forumpost':
|
||||||
|
$note = $lang_admanage['text_forum_post_page_note'];
|
||||||
|
break;
|
||||||
|
case 'popup':
|
||||||
|
$note = $lang_admanage['text_popup_note'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if ($row)
|
||||||
|
{
|
||||||
|
$pararow = @unserialize($row['parameters']);
|
||||||
|
$name = $row['name'];
|
||||||
|
$starttime = $row['starttime'];
|
||||||
|
$endtime = $row['endtime'];
|
||||||
|
$displayorder = $row['displayorder'];
|
||||||
|
$enabled = $row['enabled'];
|
||||||
|
$type = $row['type'];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$name = "";
|
||||||
|
$starttime = "";
|
||||||
|
$endtime = "";
|
||||||
|
$displayorder = 0;
|
||||||
|
$enabled = 1;
|
||||||
|
$type = 'image';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<div style="width: 940px">
|
||||||
|
<h1 align="center"><a class="faqlink" href="admanage.php"><?php echo $lang_admanage['text_ad']?></a> - <?php echo get_position_name($position)?></h1>
|
||||||
|
<div><p align="center"><?php echo $note?></p></div>
|
||||||
|
<h2 align="left"><?php echo $lang_admanage['text_ad_detail']?></h2>
|
||||||
|
<table border="1" cellspacing="0" cellpadding="10" width="100%">
|
||||||
|
<?php
|
||||||
|
tr($lang_admanage['row_name']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"ad[name]\" value=\"".htmlspecialchars($name)."\" style=\"width: 300px\" /> " . $lang_admanage['text_name_note'], 1);
|
||||||
|
tr($lang_admanage['row_start_time'], "<input type=\"text\" name=\"ad[starttime]\" value=\"".$starttime."\" style=\"width: 300px\" /> " . $lang_admanage['text_start_time_note'], 1);
|
||||||
|
tr($lang_admanage['row_end_time'], "<input type=\"text\" name=\"ad[endtime]\" value=\"".$endtime."\" style=\"width: 300px\" /> ".$lang_admanage['text_end_time_note'], 1);
|
||||||
|
tr($lang_admanage['row_order'], "<input type=\"text\" name=\"ad[displayorder]\" value=\"".$displayorder."\" style=\"width: 100px\" /> ".$lang_admanage['text_order_note'], 1);
|
||||||
|
tr($lang_admanage['row_enabled']."<font color=\"red\">*</font>", "<input type=\"radio\" name=\"ad[enabled]\"".($enabled ? " checked=\"checked\"" : "")." value=\"1\" />".$lang_admanage['text_yes']."<input type=\"radio\" name=\"ad[enabled]\"".($enabled ? "" : " checked=\"checked\"")." value=\"0\" />".$lang_admanage['text_no']."<br />".$lang_admanage['text_enabled_note'], 1);
|
||||||
|
tr($lang_admanage['row_type']."<font color=\"red\">*</font>", "<select name=\"ad[type]\" onchange=\"var key, types; types=new Array('image','text','bbcodes','xhtml','flash'); for(key in types){var obj=$('type_'+types[key]); obj.style.display=types[key]==this.options[this.selectedIndex].value?'':'none';}\"><option value=\"image\"".($type == 'image' ? " selected=\"selected\"" : "").">".$lang_admanage['text_image']."</option><option value=\"text\"".($type == 'text' ? " selected=\"selected\"" : "").">".$lang_admanage['text_text']."</option><option value=\"bbcodes\"".($type == 'bbcodes' ? " selected=\"selected\"" : "").">".$lang_admanage['text_bbcodes']."</option>".(get_user_class() >= $allowxhtmlclass ? "<option value=\"xhtml\"".($type == 'xhtml' ? " selected=\"selected\"" : "").">".$lang_admanage['text_xhtml']."</option>" : "")."<option value=\"flash\"".($type == 'flash' ? " selected=\"selected\"" : "").">".$lang_admanage['text_flash']."</option></select> ".$lang_admanage['text_type_note'], 1);
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
<div id="type_image"<?php echo $type == 'image' ? "" : " style=\"display: none;\""?>>
|
||||||
|
<h2 align="left"><?php echo $lang_admanage['text_image']?></h2>
|
||||||
|
<table border="1" cellspacing="0" cellpadding="10" width="100%">
|
||||||
|
<?php
|
||||||
|
tr($lang_admanage['row_image_url']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"ad[image][url]\"".($type == 'image' ? " value=\"".$pararow['url']."\"" : "")." style=\"width: 300px\" /> ".$lang_admanage['text_image_url_note'], 1);
|
||||||
|
tr($lang_admanage['row_image_link']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"ad[image][link]\"".($type == 'image' ? " value=\"".$pararow['link']."\"" : "")." style=\"width: 300px\" /> ".$lang_admanage['text_image_link_note'], 1);
|
||||||
|
tr($lang_admanage['row_image_width'], "<input type=\"text\" name=\"ad[image][width]\"".($type == 'image' ? " value=\"".$pararow['width']."\"" : "")." style=\"width: 100px\" /> ".$lang_admanage['text_image_width_note'], 1);
|
||||||
|
tr($lang_admanage['row_image_height'], "<input type=\"text\" name=\"ad[image][height]\"".($type == 'image' ? " value=\"".$pararow['height']."\"" : "")." style=\"width: 100px\" /> ".$lang_admanage['text_image_height_note'], 1);
|
||||||
|
tr($lang_admanage['row_image_tooltip'], "<input type=\"text\" name=\"ad[image][title]\"".($type == 'image' ? " value=\"".$pararow['title']."\"" : "")." style=\"width: 300px\" /> ".$lang_admanage['text_image_tooltip_note'], 1);
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div id="type_text"<?php echo $type == 'text' ? "" : " style=\"display: none;\""?>>
|
||||||
|
<h2 align="left"><?php echo $lang_admanage['text_text']?></h2>
|
||||||
|
<table border="1" cellspacing="0" cellpadding="10" width="100%">
|
||||||
|
<?php
|
||||||
|
tr($lang_admanage['row_text_content']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"ad[text][content]\"".($type == 'text' ? " value=\"".$pararow['content']."\"" : "")." style=\"width: 300px\" /> ".$lang_admanage['text_text_content_note'], 1);
|
||||||
|
tr($lang_admanage['row_text_link']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"ad[text][link]\"".($type == 'text' ? " value=\"".$pararow['link']."\"" : "")." style=\"width: 300px\" /> ".$lang_admanage['text_text_link_note'], 1);
|
||||||
|
tr($lang_admanage['row_text_size'], "<input type=\"text\" name=\"ad[text][size]\"".($type == 'text' ? " value=\"".$pararow['size']."\"" : "")." style=\"width: 100px\" /> ".$lang_admanage['text_text_size_note'], 1);
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div id="type_bbcodes"<?php echo $type == 'bbcodes' ? "" : " style=\"display: none;\""?>>
|
||||||
|
<h2 align="left"><?php echo $lang_admanage['text_bbcodes']?></h2>
|
||||||
|
<table border="1" cellspacing="0" cellpadding="10" width="100%">
|
||||||
|
<?php
|
||||||
|
tr($lang_admanage['row_bbcodes_code']."<font color=\"red\">*</font>", "<textarea name=\"ad[bbcodes][code]\" cols=\"50\" rows=\"6\" style=\"width: 300px\">".($type == 'bbcodes' ? $pararow['code'] : "")."</textarea><br />".$lang_admanage['text_bbcodes_code_note']."<a class=\"altlink\" href=\"tags.php\"><b>".$lang_admanage['text_here']."</b></a>", 1);
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div id="type_xhtml"<?php echo $type == 'xhtml' ? "" : " style=\"display: none;\""?>>
|
||||||
|
<h2 align="left"><?php echo $lang_admanage['text_xhtml']?></h2>
|
||||||
|
<table border="1" cellspacing="0" cellpadding="10" width="100%">
|
||||||
|
<?php
|
||||||
|
tr($lang_admanage['row_xhtml_code']."<font color=\"red\">*</font>", "<textarea name=\"ad[xhtml][code]\" cols=\"50\" rows=\"6\" style=\"width: 300px\">".($type == 'xhtml' ? $pararow['code'] : "")."</textarea><br />".$lang_admanage['text_xhmtl_code_note'], 1);
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div id="type_flash"<?php echo $type == 'flash' ? "" : " style=\"display: none;\""?>>
|
||||||
|
<h2 align="left"><?php echo $lang_admanage['text_flash']?></h2>
|
||||||
|
<table border="1" cellspacing="0" cellpadding="10" width="100%">
|
||||||
|
<?php
|
||||||
|
tr($lang_admanage['row_flash_url']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"ad[flash][url]\"".($type == 'flash' ? " value=\"".$pararow['url']."\"" : "")." style=\"width: 300px\" /> ".$lang_admanage['text_flash_url_note'], 1);
|
||||||
|
tr($lang_admanage['row_flash_width']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"ad[flash][width]\"".($type == 'flash' ? " value=\"".$pararow['width']."\"" : "")." style=\"width: 100px\" /> ".$lang_admanage['text_flash_width_note'], 1);
|
||||||
|
tr($lang_admanage['row_flash_height']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"ad[flash][height]\"".($type == 'flash' ? " value=\"".$pararow['height']."\"" : "")." style=\"width: 100px\" /> ".$lang_admanage['text_flash_height_note'], 1);
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div style="text-align: center; margin-top: 10px;">
|
||||||
|
<input type="submit" value="<?php echo $lang_admanage['submit_submit']?>" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
$action = $_GET['action'];
|
||||||
|
if ($action == 'del')
|
||||||
|
{
|
||||||
|
$id = 0 + $_GET['id'];
|
||||||
|
if (!$id)
|
||||||
|
{
|
||||||
|
stderr($lang_admanage['std_error'], $lang_admanage['std_invalid_id']);
|
||||||
|
}
|
||||||
|
$res = sql_query ("SELECT * FROM advertisements WHERE id = ".sqlesc($id)." LIMIT 1");
|
||||||
|
if ($row = mysql_fetch_array($res))
|
||||||
|
sql_query("DELETE FROM advertisements WHERE id = ".sqlesc($row['id'])) or sqlerr(__FILE__, __LINE__);
|
||||||
|
$Cache->delete_value('current_ad_array', false);
|
||||||
|
header("Location: ".get_protocol_prefix() . $BASEURL."/admanage.php");
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
elseif ($action == 'edit')
|
||||||
|
{
|
||||||
|
$id = 0 + $_GET['id'];
|
||||||
|
if (!$id)
|
||||||
|
{
|
||||||
|
stderr($lang_admanage['std_error'], $lang_admanage['std_invalid_id']);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$res = sql_query("SELECT * FROM advertisements WHERE id = ".sqlesc($id)." LIMIT 1");
|
||||||
|
if (!$row = mysql_fetch_array($res))
|
||||||
|
stderr($lang_admanage['std_error'], $lang_admanage['std_invalid_id']);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$position = $row['position'];
|
||||||
|
stdhead($lang_admanage['head_edit_ad']);
|
||||||
|
print("<form method=\"post\" action=\"?action=submit&position=".$position."\">");
|
||||||
|
print("<input type=\"hidden\" name=\"isedit\" value=\"1\" />");
|
||||||
|
print("<input type=\"hidden\" name=\"id\" value=\"".$id."\" />");
|
||||||
|
print_ad_editor($position, $row);
|
||||||
|
print("</form>");
|
||||||
|
stdfoot();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif ($action == 'add')
|
||||||
|
{
|
||||||
|
$position = $_GET['position'];
|
||||||
|
$validpos = array('header', 'footer', 'belownav', 'belowsearchbox', 'torrentdetail', 'comment', 'interoverforums', 'forumpost', 'popup');
|
||||||
|
if (!in_array($position, $validpos))
|
||||||
|
stderr($lang_admanage['std_error'], $lang_admanage['std_invalid_position']);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
stdhead($lang_admanage['head_add_ad']);
|
||||||
|
print("<form method=\"post\" action=\"?action=submit&position=".htmlspecialchars($position)."\">");
|
||||||
|
print("<input type=\"hidden\" name=\"isedit\" value=\"0\" />");
|
||||||
|
print_ad_editor($position);
|
||||||
|
print("</form>");
|
||||||
|
stdfoot();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif ($action == 'submit')
|
||||||
|
{
|
||||||
|
$position = $_GET['position'];
|
||||||
|
$validpos = array('header', 'footer', 'belownav', 'belowsearchbox', 'torrentdetail', 'comment', 'interoverforums', 'forumpost', 'popup');
|
||||||
|
if (!in_array($position, $validpos))
|
||||||
|
stderr($lang_admanage['std_error'], $lang_admanage['std_invalid_position']);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($_POST['isedit']){
|
||||||
|
$id = 0 + $_POST['id'];
|
||||||
|
if (!$id)
|
||||||
|
{
|
||||||
|
stderr($lang_admanage['std_error'], $lang_admanage['std_invalid_id']);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$adid = $id;
|
||||||
|
$res = sql_query("SELECT * FROM advertisements WHERE id = ".sqlesc($id)." LIMIT 1");
|
||||||
|
if (!$row = mysql_fetch_array($res))
|
||||||
|
stderr($lang_admanage['std_error'], $lang_admanage['std_invalid_id']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$res = sql_query("SELECT id FROM advertisements ORDER BY id DESC LIMIT 1");
|
||||||
|
$row = mysql_fetch_array($res);
|
||||||
|
if (!$row)
|
||||||
|
$adid = 1;
|
||||||
|
else $adid = $row['id']+1;
|
||||||
|
}
|
||||||
|
$name = $_POST['ad']['name'];
|
||||||
|
$starttime = $_POST['ad']['starttime'];
|
||||||
|
$endtime = $_POST['ad']['endtime'];
|
||||||
|
$displayorder = 0+$_POST['ad']['displayorder'];
|
||||||
|
$enabled = 0+$_POST['ad']['enabled'];
|
||||||
|
$type = $_POST['ad']['type'];
|
||||||
|
if (!$name || !$type)
|
||||||
|
{
|
||||||
|
stderr($lang_admanage['std_error'], $lang_admanage['std_missing_form_data']);
|
||||||
|
}
|
||||||
|
if (get_user_class() >= $allowxhtmlclass)
|
||||||
|
$validtype = array('bbcodes', 'xhtml', 'text', 'image', 'flash');
|
||||||
|
else
|
||||||
|
$validtype = array('bbcodes', 'text', 'image', 'flash');
|
||||||
|
if (!in_array($type, $validtype))
|
||||||
|
stderr($lang_admanage['std_error'], $lang_admanage['std_invalid_type']);
|
||||||
|
switch ($type)
|
||||||
|
{
|
||||||
|
case 'bbcodes':
|
||||||
|
if (!$_POST['ad']['bbcodes']['code'])
|
||||||
|
stderr($lang_admanage['std_error'], $lang_admanage['std_missing_form_data']);
|
||||||
|
$parameters = serialize($_POST['ad']['bbcodes']);
|
||||||
|
$code = format_comment($_POST['ad']['bbcodes']['code'], true, false, true, true, 700, true, true, -1, 0, $adid);
|
||||||
|
break;
|
||||||
|
case 'xhtml':
|
||||||
|
if (!$_POST['ad']['xhtml']['code'])
|
||||||
|
stderr($lang_admanage['std_error'], $lang_admanage['std_missing_form_data']);
|
||||||
|
$parameters = serialize($_POST['ad']['xhtml']);
|
||||||
|
$code = $_POST['ad']['xhtml']['code'];
|
||||||
|
break;
|
||||||
|
case 'text':
|
||||||
|
if (!$_POST['ad']['text']['content'] || !$_POST['ad']['text']['link'])
|
||||||
|
stderr($lang_admanage['std_error'], $lang_admanage['std_missing_form_data']);
|
||||||
|
$parameters = serialize($_POST['ad']['text']);
|
||||||
|
$content = htmlspecialchars($_POST['ad']['text']['content']);
|
||||||
|
if ($_POST['ad']['text']['size'])
|
||||||
|
$content = "<span style=\"font-size: ".htmlspecialchars($_POST['ad']['text']['size'])."\">".$content."</span>";
|
||||||
|
else
|
||||||
|
$content = "<span style=\"font-size: 30pt\">".$content."</span>";
|
||||||
|
$code = "<a href=\"adredir.php?id=".$adid."&url=".rawurlencode(htmlspecialchars($_POST['ad']['text']['link']))."\" target=\"_blank\">".$content."</a>";
|
||||||
|
break;
|
||||||
|
case 'image':
|
||||||
|
if (!$_POST['ad']['image']['url'] || !$_POST['ad']['image']['link'])
|
||||||
|
stderr($lang_admanage['std_error'], $lang_admanage['std_missing_form_data']);
|
||||||
|
$_POST['ad']['image']['width'] = 0+$_POST['ad']['image']['width'];
|
||||||
|
$_POST['ad']['image']['height'] = 0+$_POST['ad']['image']['height'];
|
||||||
|
$parameters = serialize($_POST['ad']['image']);
|
||||||
|
$imgadd = "";
|
||||||
|
if ($_POST['ad']['image']['width'])
|
||||||
|
$imgadd .= " width=\"".$_POST['ad']['image']['width']."\"";
|
||||||
|
if ($_POST['ad']['image']['height'])
|
||||||
|
$imgadd .= " height=\"".$_POST['ad']['image']['height']."\"";
|
||||||
|
if ($_POST['ad']['image']['title'])
|
||||||
|
$imgadd .= " title=\"".$_POST['ad']['image']['title']."\"";
|
||||||
|
$code = "<a href=\"adredir.php?id=".$adid."&url=".rawurlencode(htmlspecialchars($_POST['ad']['image']['link']))."\" target=\"_blank\"><img border=\"0\" src=\"".htmlspecialchars($_POST['ad']['image']['url'])."\"".$imgadd." alt=\"ad\" /></a>";
|
||||||
|
break;
|
||||||
|
case 'flash':
|
||||||
|
$_POST['ad']['flash']['width'] = 0+$_POST['ad']['flash']['width'];
|
||||||
|
$_POST['ad']['flash']['height'] = 0+$_POST['ad']['flash']['height'];
|
||||||
|
if (!$_POST['ad']['flash']['url'] || !$_POST['ad']['flash']['width'] || !$_POST['ad']['flash']['height'])
|
||||||
|
stderr($lang_admanage['std_error'], $lang_admanage['std_missing_form_data']);
|
||||||
|
$parameters = serialize($_POST['ad']['flash']);
|
||||||
|
$code = "<object width=\"".$_POST['ad']['flash']['width']."\" height=\"".$_POST['ad']['flash']['height']."\"><param name=\"movie\" value=\"".htmlspecialchars($_POST['ad']['flash']['url'])."\" /><embed src=\"".htmlspecialchars($_POST['ad']['flash']['url'])."\" width=\"".$_POST['ad']['flash']['width']."\" height=\"".$_POST['ad']['flash']['height']."\" type=\"application/x-shockwave-flash\"></embed></object>";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if ($_POST['isedit']){
|
||||||
|
sql_query("UPDATE advertisements SET enabled=".sqlesc($enabled).", type=".sqlesc($type).", displayorder=".sqlesc($displayorder).", name=".sqlesc($name).", parameters=".sqlesc($parameters).", code=".sqlesc($code).", starttime=".($starttime ? sqlesc($starttime) : "NULL").", endtime=".($endtime ? sqlesc($endtime) : "NULL")." WHERE id=".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
|
||||||
|
$Cache->delete_value('current_ad_array', false);
|
||||||
|
stderr($lang_admanage['std_success'], $lang_admanage['std_edit_success']."<a href=\"?\"><b>".$lang_admanage['std_go_back']."</b></a>", false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sql_query("INSERT INTO advertisements (`enabled`, `type`, `position`, `displayorder`, `name`, `parameters`, `code`, `starttime`, `endtime`) VALUES (".sqlesc($enabled).", ".sqlesc($type).", ".sqlesc($position).", ".sqlesc($displayorder).", ".sqlesc($name).", ".sqlesc($parameters).", ".sqlesc($code).", ".($starttime ? sqlesc($starttime) : "NULL").", ".($endtime ? sqlesc($endtime) : "NULL").")") or sqlerr(__FILE__, __LINE__);
|
||||||
|
$Cache->delete_value('current_ad_array', false);
|
||||||
|
stderr($lang_admanage['std_success'], $lang_admanage['std_add_success']."<a href=\"?\"><b>".$lang_admanage['std_go_back']."</b></a>", false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
stdhead($lang_admanage['head_ad_management']);
|
||||||
|
begin_main_frame();
|
||||||
|
?>
|
||||||
|
<h1 align="center"><?php echo $lang_admanage['text_ad_management']?></h1>
|
||||||
|
<div>
|
||||||
|
<span id="addad" onclick="dropmenu(this);"><span style="cursor: pointer;" class="big"><b><?php echo $lang_admanage['text_add_ad']?></b></span>
|
||||||
|
<div id="addadlist" class="dropmenu" style="display: none"><ul>
|
||||||
|
<li><a href="?action=add&position=header"><?php echo $lang_admanage['text_header']?></a></li>
|
||||||
|
<li><a href="?action=add&position=footer"><?php echo $lang_admanage['text_footer']?></a></li>
|
||||||
|
<li><a href="?action=add&position=belownav"><?php echo $lang_admanage['text_below_navigation']?></a></li>
|
||||||
|
<li><a href="?action=add&position=belowsearchbox"><?php echo $lang_admanage['text_below_searchbox']?></a></li>
|
||||||
|
<li><a href="?action=add&position=torrentdetail"><?php echo $lang_admanage['text_torrent_detail']?></a></li>
|
||||||
|
<li><a href="?action=add&position=comment"><?php echo $lang_admanage['text_comment_page']?></a></li>
|
||||||
|
<li><a href="?action=add&position=interoverforums"><?php echo $lang_admanage['text_inter_overforums']?></a></li>
|
||||||
|
<li><a href="?action=add&position=forumpost"><?php echo $lang_admanage['text_forum_post_page']?></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div style="margin-top: 8px">
|
||||||
|
<?php
|
||||||
|
$perpage = 20;
|
||||||
|
$num = get_row_count("advertisements");
|
||||||
|
if (!$num)
|
||||||
|
print("<p align=\"center\">".$lang_admanage['text_no_ads_yet']."</p>");
|
||||||
|
else{
|
||||||
|
list($pagertop, $pagerbottom, $limit) = pager($perpage, $num, "?");
|
||||||
|
$res = sql_query("SELECT * FROM advertisements ORDER BY id DESC ".(int)$limit) or sqlerr(__FILE__, __LINE__);
|
||||||
|
?>
|
||||||
|
<table border="1" cellspacing="0" cellpadding="5" width="940">
|
||||||
|
<tr>
|
||||||
|
<td class="colhead"><?php echo $lang_admanage['col_enabled']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_admanage['col_name']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_admanage['col_position']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_admanage['col_order']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_admanage['col_type']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_admanage['col_start_time']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_admanage['col_end_time']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_admanage['col_clicks']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_admanage['col_action']?></td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
while ($row = mysql_fetch_array($res))
|
||||||
|
{
|
||||||
|
$clickcount=get_row_count("adclicks", "WHERE adid=".sqlesc($row['id']));
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td class="colfollow"><?php echo $row['enabled'] ? "<font color=\"green\">".$lang_admanage['text_yes']."</font>" : "<font color=\"red\">".$lang_admanage['text_no']."</font>" ?></td>
|
||||||
|
<td class="colfollow"><?php echo htmlspecialchars($row['name'])?></td>
|
||||||
|
<td class="colfollow"><?php echo get_position_name($row['position'])?></td>
|
||||||
|
<td class="colfollow"><?php echo $row['displayorder']?></td>
|
||||||
|
<td class="colfollow"><?php echo get_type_name($row['type'])?></td>
|
||||||
|
<td class="colfollow"><?php echo $row['starttime'] ? $row['starttime'] : $lang_admanage['text_unlimited']?></td>
|
||||||
|
<td class="colfollow"><?php echo $row['endtime'] ? $row['endtime'] : $lang_admanage['text_unlimited']?></td>
|
||||||
|
<td class="colfollow"><?php echo $clickcount?></td>
|
||||||
|
<td class="colfollow"><a href="javascript:confirm_delete('<?php echo $row['id']?>', '<?php echo $lang_admanage['js_sure_to_delete_ad']?>', '');"><?php echo $lang_admanage['text_delete']?></a> | <a href="?action=edit&id=<?php echo $row['id']?>"><?php echo $lang_admanage['text_edit']?></a></td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
<?php
|
||||||
|
print($pagerbottom);
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
end_main_frame();
|
||||||
|
stdfoot();
|
||||||
|
}
|
||||||
|
?>
|
||||||
22
adredir.php
Normal file
22
adredir.php
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
require_once(get_langfile_path());
|
||||||
|
if ($enablead_advertisement != 'yes')
|
||||||
|
stderr($lang_adredir['std_error'], $lang_adredir['std_ad_system_disabled']);
|
||||||
|
$id=0+$_GET['id'];
|
||||||
|
if (!$id)
|
||||||
|
stderr($lang_adredir['std_error'], $lang_adredir['std_invalid_ad_id']);
|
||||||
|
$redir=htmlspecialchars_decode(urldecode($_GET['url']));
|
||||||
|
if (!$redir)
|
||||||
|
stderr($lang_adredir['std_error'], $lang_adredir['std_no_redirect_url']);
|
||||||
|
$adcount=get_row_count("advertisements", "WHERE id=".sqlesc($id));
|
||||||
|
if (!$adcount)
|
||||||
|
stderr($lang_adredir['std_error'], $lang_adredir['std_invalid_ad_id']);
|
||||||
|
if ($adclickbonus_advertisement){
|
||||||
|
$clickcount=get_row_count("adclicks", "WHERE adid=".sqlesc($id)." AND userid=".sqlesc($CURUSER['id']));
|
||||||
|
if (!$clickcount)
|
||||||
|
KPS("+",$adclickbonus_advertisement,$CURUSER['id']);
|
||||||
|
}
|
||||||
|
sql_query("INSERT INTO adclicks (adid, userid, added) VALUES (".sqlesc($id).", ".sqlesc($CURUSER['id']).", ".sqlesc(date("Y-m-d H:i:s")).")");
|
||||||
|
header("Location: $redir");
|
||||||
13
ajaxbasic.js
Normal file
13
ajaxbasic.js
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
function $(e){if(typeof e=='string')e=document.getElementById(e);return e};
|
||||||
|
function collect(a,f){var n=[];for(var i=0;i<a.length;i++){var v=f(a[i]);if(v!=null)n.push(v)}return n};
|
||||||
|
|
||||||
|
ajax={};
|
||||||
|
ajax.x=function(){try{return new ActiveXObject('Msxml2.XMLHTTP')}catch(e){try{return new ActiveXObject('Microsoft.XMLHTTP')}catch(e){return new XMLHttpRequest()}}};
|
||||||
|
ajax.serialize=function(f){var g=function(n){return f.getElementsByTagName(n)};var nv=function(e){if(e.name)return encodeURIComponent(e.name)+'='+encodeURIComponent(e.value);else return ''};var i=collect(g('input'),function(i){if((i.type!='radio'&&i.type!='checkbox')||i.checked)return nv(i)});var s=collect(g('select'),nv);var t=collect(g('textarea'),nv);return i.concat(s).concat(t).join('&');};
|
||||||
|
ajax.send=function(u,f,m,a){var x=ajax.x();x.open(m,u,true);x.onreadystatechange=function(){if(x.readyState==4)f(x.responseText)};if(m=='POST')x.setRequestHeader('Content-type','application/x-www-form-urlencoded');x.send(a)};
|
||||||
|
ajax.get=function(url,func){ajax.send(url,func,'GET')};
|
||||||
|
ajax.gets=function(url){var x=ajax.x();x.open('GET',url,false);x.send(null);return x.responseText};
|
||||||
|
ajax.post=function(url,func,args){ajax.send(url,func,'POST',args)};
|
||||||
|
ajax.posts=function(url,args){var x=ajax.x(); x.open('POST',url,false); x.setRequestHeader('Content-type','application/x-www-form-urlencoded'); x.send(args); return x.responseText};
|
||||||
|
ajax.update=function(url,elm){var e=$(elm);var f=function(r){e.innerHTML=r};ajax.get(url,f)};
|
||||||
|
ajax.submit=function(url,elm,frm){var e=$(elm);var f=function(r){e.innerHTML=r};ajax.post(url,f,ajax.serialize(frm))};
|
||||||
16
allagents.php
Normal file
16
allagents.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
loggedinorreturn();
|
||||||
|
if (get_user_class() < UC_MODERATOR)
|
||||||
|
stderr("Error", "Permission denied.");
|
||||||
|
$res2 = sql_query("SELECT agent,peer_id FROM peers GROUP BY agent ") or sqlerr();
|
||||||
|
stdhead("All Clients");
|
||||||
|
print("<table align=center border=3 cellspacing=0 cellpadding=5>\n");
|
||||||
|
print("<tr><td class=colhead>Client</td><td class=colhead>Peer ID</td></tr>\n");
|
||||||
|
while($arr2 = mysql_fetch_assoc($res2))
|
||||||
|
{
|
||||||
|
print("</a></td><td align=left>$arr2[agent]</td><td align=left>$arr2[peer_id]</td></tr>\n");
|
||||||
|
}
|
||||||
|
print("</table>\n");
|
||||||
|
stdfoot();
|
||||||
32
allowedemails.php
Normal file
32
allowedemails.php
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
//Allow Email Address registration
|
||||||
|
define("ALLOWEMAILVERSION", "Allow Email");
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
loggedinorreturn();
|
||||||
|
if (get_user_class() < UC_SYSOP)
|
||||||
|
stderr("Error", "Access denied.");
|
||||||
|
|
||||||
|
$action = isset($_POST['action']) ? htmlspecialchars($_POST['action']) : (isset($_GET['action']) ? htmlspecialchars($_GET['action']) : 'showlist');
|
||||||
|
|
||||||
|
if ($action == 'showlist') {
|
||||||
|
stdhead ("Show List");
|
||||||
|
print("<table border=1 cellspacing=0 cellpadding=5 width=737>\n");
|
||||||
|
$sql = sql_query("SELECT * FROM allowedemails") or sqlerr(__FILE__, __LINE__);
|
||||||
|
$list = mysql_fetch_array($sql);
|
||||||
|
?>
|
||||||
|
<form method=post action=allowedemails.php>
|
||||||
|
<input type=hidden name=action value=savelist>
|
||||||
|
<tr><td>Enter a list of allowed email addresses (separated by spaces):<br />To allow a specific address enter "email@domain.com", to allow an entire domain enter "@domain.com"</td>
|
||||||
|
<td><textarea name="value" rows="5" cols="40"><?php echo $list[value]?></textarea>
|
||||||
|
<input type=submit value="save"></form></td>
|
||||||
|
</tr></table>
|
||||||
|
<?php
|
||||||
|
stdfoot () ;
|
||||||
|
}elseif ($action == 'savelist') {
|
||||||
|
stdhead ("Save List");
|
||||||
|
$value = trim ( htmlspecialchars ( $_POST[value] ) ) ;
|
||||||
|
sql_query("UPDATE allowedemails SET value = ".sqlesc($value)) or sqlerr(__FILE__, __LINE__);
|
||||||
|
Print ("Saved.");
|
||||||
|
stdfoot () ;
|
||||||
|
}
|
||||||
56
amountbonus.php
Normal file
56
amountbonus.php
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
loggedinorreturn();
|
||||||
|
if (get_user_class() < UC_MODERATOR)
|
||||||
|
stderr("Error", "Access denied.");
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] == "POST")
|
||||||
|
{
|
||||||
|
if ($_POST['doit'] == 'yes') {
|
||||||
|
sql_query("UPDATE users SET seedbonus = seedbonus + 25.0 WHERE status='confirmed'");
|
||||||
|
stderr("Bonus", "25.0 bonus point is sent to everyone...");
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_POST["username"] == "" || $_POST["seedbonus"] == "" || $_POST["seedbonus"] == "")
|
||||||
|
stderr("Error", "Missing form data.");
|
||||||
|
$username = sqlesc($_POST["username"]);
|
||||||
|
$seedbonus = sqlesc($_POST["seedbonus"]);
|
||||||
|
|
||||||
|
sql_query("UPDATE users SET seedbonus=seedbonus + $seedbonus WHERE username=$username") or sqlerr(__FILE__, __LINE__);
|
||||||
|
$res = sql_query("SELECT id FROM users WHERE username=$username");
|
||||||
|
$arr = mysql_fetch_row($res);
|
||||||
|
if (!$arr)
|
||||||
|
stderr("Error", "Unable to update account.");
|
||||||
|
header("Location: " . get_protocol_prefix() . "$BASEURL/userdetails.php?id=".htmlspecialchars($arr[0]));
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
stdhead("Update Users Upload Amounts");
|
||||||
|
?>
|
||||||
|
<h1>Update Users Bonus Amounts</h1>
|
||||||
|
<?php
|
||||||
|
begin_main_frame("",false, 30);
|
||||||
|
begin_main_frame("Add to Specific User",false,30);
|
||||||
|
echo "<form method=\"post\" action=\"amountbonus.php\">";
|
||||||
|
print("<table width=100% border=1 cellspacing=0 cellpadding=5>\n");
|
||||||
|
?>
|
||||||
|
<tr><td class="rowhead">User name</td><td class="rowfollow"><input type="text" name="username" size="30"/></td></tr>
|
||||||
|
<tr><td class="rowhead">Bonus</td><td class="rowfollow"><input type="text" name="seedbonus" size="5"/></td></tr>
|
||||||
|
<tr><td colspan="2" class="toolbox" align="center"><input type="submit" value="Okay" class="btn"/></td></tr>
|
||||||
|
<?php end_table();?>
|
||||||
|
</form>
|
||||||
|
<?php end_main_frame();?>
|
||||||
|
<?php begin_main_frame("Send 25.0 bonus point to everyone",false,30);?>
|
||||||
|
<form action="amountbonus.php" method="post">
|
||||||
|
<table width=100% border=1 cellspacing=0 cellpadding=5>
|
||||||
|
<tr><td class="rowfollow" width="100%">
|
||||||
|
Are you sure you want to give all confirmed users 25.0 extra bonus point?<br /><br /></td></tr>
|
||||||
|
<tr><td class="toolbox" align="center"><input type = "hidden" name = "doit" value = "yes" />
|
||||||
|
<input type="submit" class="btn" value="Yes" />
|
||||||
|
</td></tr>
|
||||||
|
<?php end_table();?>
|
||||||
|
</form>
|
||||||
|
<?php
|
||||||
|
end_main_frame();
|
||||||
|
end_main_frame();
|
||||||
|
stdfoot();
|
||||||
128
amountupload.php
Normal file
128
amountupload.php
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
<?php
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
loggedinorreturn();
|
||||||
|
if (get_user_class() < UC_SYSOP)
|
||||||
|
stderr("Sorry", "Access denied.");
|
||||||
|
stdhead("Add Upload", false);
|
||||||
|
?>
|
||||||
|
<table class=main width=737 border=0 cellspacing=0 cellpadding=0><tr><td class=embedded>
|
||||||
|
<div align=center>
|
||||||
|
<h1>Add upload to all staff members and users:</a></h1>
|
||||||
|
<form method=post action=takeamountupload.php>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
if ($_GET["returnto"] || $_SERVER["HTTP_REFERER"])
|
||||||
|
{
|
||||||
|
?>
|
||||||
|
<input type=hidden name=returnto value="<?php echo htmlspecialchars($_GET["returnto"]) ? htmlspecialchars($_GET["returnto"]) : htmlspecialchars($_SERVER["HTTP_REFERER"])?>">
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<table cellspacing=0 cellpadding=5>
|
||||||
|
<?php
|
||||||
|
if ($_GET["sent"] == 1) {
|
||||||
|
?>
|
||||||
|
<tr><td colspan=2 class="text" align="center"><font color=red><b>Upload amount has been added and inform message has been sent.</font></b></tr></td>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<tr><td class="rowhead" valign="top">Amount </td><td class="rowfollow"><input type=text name=amount size=10> (in GB)</td></tr>
|
||||||
|
<tr>
|
||||||
|
<td class="rowhead" valign="top">Add to</td><td class="rowfollow">
|
||||||
|
<table style="border: 0" width="100%" cellpadding="0" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td style="border: 0" width="20"><input type="checkbox" name="clases[]" value="0">
|
||||||
|
</td>
|
||||||
|
<td style="border: 0">Peasant</td>
|
||||||
|
|
||||||
|
<td style="border: 0" width="20"><input type="checkbox" name="clases[]" value="1">
|
||||||
|
</td>
|
||||||
|
<td style="border: 0">User</td>
|
||||||
|
|
||||||
|
<td style="border: 0" width="20"><input type="checkbox" name="clases[]" value="2">
|
||||||
|
</td>
|
||||||
|
<td style="border: 0">Power User</td>
|
||||||
|
|
||||||
|
<td style="border: 0" width="20"><input type="checkbox" name="clases[]" value="3">
|
||||||
|
</td>
|
||||||
|
<td style="border: 0">Elite User</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="border: 0" width="20"><input type="checkbox" name="clases[]" value="4">
|
||||||
|
</td>
|
||||||
|
<td style="border: 0">Crazy User</td>
|
||||||
|
|
||||||
|
<td style="border: 0" width="20"><input type="checkbox" name="clases[]" value="5">
|
||||||
|
</td>
|
||||||
|
<td style="border: 0">Insane User</td>
|
||||||
|
|
||||||
|
<td style="border: 0" width="20"><input type="checkbox" name="clases[]" value="6">
|
||||||
|
</td>
|
||||||
|
<td style="border: 0">Veteran User</td>
|
||||||
|
|
||||||
|
<td style="border: 0" width="20"><input type="checkbox" name="clases[]" value="7">
|
||||||
|
</td>
|
||||||
|
<td style="border: 0">Extreme User</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td style="border: 0" width="20"><input type="checkbox" name="clases[]" value="8">
|
||||||
|
</td>
|
||||||
|
<td style="border: 0">Ultimate User</td>
|
||||||
|
|
||||||
|
<td style="border: 0" width="20"><input type="checkbox" name="clases[]" value="9">
|
||||||
|
</td>
|
||||||
|
<td style="border: 0">Nexus Master</td>
|
||||||
|
|
||||||
|
<td style="border: 0" width="20"><input type="checkbox" name="clases[]" value="10">
|
||||||
|
</td>
|
||||||
|
<td style="border: 0">VIP</td>
|
||||||
|
|
||||||
|
<td style="border: 0" width="20"><input type="checkbox" name="clases[]" value="11">
|
||||||
|
</td>
|
||||||
|
<td style="border: 0">Uploader</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td style="border: 0" width="20"><input type="checkbox" name="clases[]" value="12">
|
||||||
|
</td>
|
||||||
|
<td style="border: 0">Moderator</td>
|
||||||
|
|
||||||
|
<td style="border: 0" width="20"><input type="checkbox" name="clases[]" value="13">
|
||||||
|
</td>
|
||||||
|
<td style="border: 0">Administrator</td>
|
||||||
|
|
||||||
|
<td style="border: 0" width="20"><input type="checkbox" name="clases[]" value="14">
|
||||||
|
</td>
|
||||||
|
<td style="border: 0">SysOp</td>
|
||||||
|
|
||||||
|
<td style="border: 0" width="20"><input type="checkbox" name="clases[]" value="15">
|
||||||
|
</td>
|
||||||
|
<td style="border: 0">Staff Leader</td>
|
||||||
|
|
||||||
|
<td style="border: 0"> </td>
|
||||||
|
<td style="border: 0"> </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td class="rowhead" valign="top">Subject </td><td class="rowfollow"><input type=text name=subject size=82></td></tr>
|
||||||
|
<tr><td class="rowhead" valign="top">Reason </td><td class="rowfollow"><textarea name=msg cols=80 rows=5><?php echo $body?></textarea></td></tr>
|
||||||
|
<tr>
|
||||||
|
<td class="rowfollow" colspan=2><div align="center"><b>Operator: </b>
|
||||||
|
<?php echo $CURUSER['username']?>
|
||||||
|
<input name="sender" type="radio" value="self" checked>
|
||||||
|
System
|
||||||
|
<input name="sender" type="radio" value="system">
|
||||||
|
</div></td></tr>
|
||||||
|
<tr><td class="rowfollow" colspan=2 align=center><input type=submit value="Do It!" class=btn></td></tr>
|
||||||
|
</table>
|
||||||
|
<input type=hidden name=receiver value=<?php echo $receiver?>>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div></td></tr></table>
|
||||||
|
<br />
|
||||||
|
NOTE: Do not user BB codes. (NO HTML)
|
||||||
|
<?php
|
||||||
|
stdfoot();
|
||||||
392
announce.php
Normal file
392
announce.php
Normal file
@@ -0,0 +1,392 @@
|
|||||||
|
<?php
|
||||||
|
require_once('include/bittorrent_announce.php');
|
||||||
|
require_once('include/benc.php');
|
||||||
|
dbconn_announce();
|
||||||
|
//1. BLOCK ACCESS WITH WEB BROWSERS AND CHEATS!
|
||||||
|
$agent = $_SERVER["HTTP_USER_AGENT"];
|
||||||
|
block_browser();
|
||||||
|
//2. GET ANNOUNCE VARIABLES
|
||||||
|
// get string type passkey, info_hash, peer_id, event, ip from client
|
||||||
|
foreach (array("passkey","info_hash","peer_id","event") as $x)
|
||||||
|
{
|
||||||
|
if(isset($_GET["$x"]))
|
||||||
|
$GLOBALS[$x] = $_GET[$x];
|
||||||
|
}
|
||||||
|
// get integer type port, downloaded, uploaded, left from client
|
||||||
|
foreach (array("port","downloaded","uploaded","left","compact","no_peer_id") as $x)
|
||||||
|
{
|
||||||
|
$GLOBALS[$x] = 0 + $_GET[$x];
|
||||||
|
}
|
||||||
|
//check info_hash, peer_id and passkey
|
||||||
|
foreach (array("passkey","info_hash","peer_id","port","downloaded","uploaded","left") as $x)
|
||||||
|
if (!isset($x)) err("Missing key: $x");
|
||||||
|
foreach (array("info_hash","peer_id") as $x)
|
||||||
|
if (strlen($GLOBALS[$x]) != 20) err("Invalid $x (" . strlen($GLOBALS[$x]) . " - " . rawurlencode($GLOBALS[$x]) . ")");
|
||||||
|
if (strlen($passkey) != 32) err("Invalid passkey (" . strlen($passkey) . " - $passkey)");
|
||||||
|
|
||||||
|
//4. GET IP AND CHECK PORT
|
||||||
|
$ip = getip(); // avoid to get the spoof ip from some agent
|
||||||
|
if (!$port || $port > 0xffff)
|
||||||
|
err("invalid port");
|
||||||
|
if (!ip2long($ip)) //Disable compact announce with IPv6
|
||||||
|
$compact = 0;
|
||||||
|
|
||||||
|
// check port and connectable
|
||||||
|
if (portblacklisted($port))
|
||||||
|
err("Port $port is blacklisted.");
|
||||||
|
|
||||||
|
//5. GET PEER LIST
|
||||||
|
// Number of peers that the client would like to receive from the tracker.This value is permitted to be zero. If omitted, typically defaults to 50 peers.
|
||||||
|
$rsize = 50;
|
||||||
|
foreach(array("numwant", "num want", "num_want") as $k)
|
||||||
|
{
|
||||||
|
if (isset($_GET[$k]))
|
||||||
|
{
|
||||||
|
$rsize = 0 + $_GET[$k];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// set if seeder based on left field
|
||||||
|
$seeder = ($left == 0) ? "yes" : "no";
|
||||||
|
|
||||||
|
// check passkey
|
||||||
|
if (!$az = $Cache->get_value('user_passkey_'.$passkey.'_content')){
|
||||||
|
$res = sql_query("SELECT id, downloadpos, enabled, uploaded, downloaded, class, parked, clientselect, showclienterror FROM users WHERE passkey=". sqlesc($passkey)." LIMIT 1");
|
||||||
|
$az = mysql_fetch_array($res);
|
||||||
|
$Cache->cache_value('user_passkey_'.$passkey.'_content', $az, 950);
|
||||||
|
}
|
||||||
|
if (!$az) err("Invalid passkey! Re-download the .torrent from $BASEURL");
|
||||||
|
$userid = 0+$az['id'];
|
||||||
|
|
||||||
|
//3. CHECK IF CLIENT IS ALLOWED
|
||||||
|
$clicheck_res = check_client($peer_id,$agent,$client_familyid);
|
||||||
|
if($clicheck_res){
|
||||||
|
if ($az['showclienterror'] == 'no')
|
||||||
|
{
|
||||||
|
sql_query("UPDATE users SET showclienterror = 'yes' WHERE id = ".sqlesc($userid));
|
||||||
|
$Cache->delete_value('user_passkey_'.$passkey.'_content');
|
||||||
|
}
|
||||||
|
err($clicheck_res);
|
||||||
|
}
|
||||||
|
elseif ($az['showclienterror'] == 'yes'){
|
||||||
|
$USERUPDATESET[] = "showclienterror = 'no'";
|
||||||
|
$Cache->delete_value('user_passkey_'.$passkey.'_content');
|
||||||
|
}
|
||||||
|
|
||||||
|
// check torrent based on info_hash
|
||||||
|
if (!$torrent = $Cache->get_value('torrent_hash_'.$info_hash.'_content')){
|
||||||
|
$res = sql_query("SELECT id, owner, sp_state, seeders, leechers, UNIX_TIMESTAMP(added) AS ts, banned FROM torrents WHERE " . hash_where("info_hash", $info_hash));
|
||||||
|
$torrent = mysql_fetch_array($res);
|
||||||
|
$Cache->cache_value('torrent_hash_'.$info_hash.'_content', $torrent, 350);
|
||||||
|
}
|
||||||
|
if (!$torrent) err("torrent not registered with this tracker");
|
||||||
|
elseif ($torrent['banned'] == 'yes' && $az['class'] < $seebanned_class) err("torrent banned");
|
||||||
|
// select peers info from peers table for this torrent
|
||||||
|
$torrentid = $torrent["id"];
|
||||||
|
$numpeers = $torrent["seeders"]+$torrent["leechers"];
|
||||||
|
|
||||||
|
if ($seeder == 'yes'){ //Don't report seeds to other seeders
|
||||||
|
$only_leech_query = " AND seeder = 'no' ";
|
||||||
|
$newnumpeers = $torrent["leechers"];
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$only_leech_query = "";
|
||||||
|
$newnumpeers = $numpeers;
|
||||||
|
}
|
||||||
|
if ($newnumpeers > $rsize)
|
||||||
|
$limit = " ORDER BY RAND() LIMIT $rsize";
|
||||||
|
else $limit = "";
|
||||||
|
$announce_wait = 30;
|
||||||
|
|
||||||
|
$fields = "seeder, peer_id, ip, port, uploaded, downloaded, (".TIMENOW." - UNIX_TIMESTAMP(last_action)) AS announcetime, UNIX_TIMESTAMP(prev_action) AS prevts";
|
||||||
|
$peerlistsql = "SELECT ".$fields." FROM peers WHERE torrent = ".$torrentid." AND connectable = 'yes' ".$only_leech_query.$limit;
|
||||||
|
$res = sql_query($peerlistsql);
|
||||||
|
|
||||||
|
$real_annnounce_interval = $announce_interval;
|
||||||
|
if ($anninterthreeage && ($anninterthree > $announce_wait) && (TIMENOW - $torrent['ts']) >= ($anninterthreeage * 86400))
|
||||||
|
$real_annnounce_interval = $anninterthree;
|
||||||
|
elseif ($annintertwoage && ($annintertwo > $announce_wait) && (TIMENOW - $torrent['ts']) >= ($annintertwoage * 86400))
|
||||||
|
$real_annnounce_interval = $annintertwo;
|
||||||
|
|
||||||
|
$resp = "d" . benc_str("interval") . "i" . $real_annnounce_interval . "e" . benc_str("min interval") . "i" . $announce_wait . "e". benc_str("complete") . "i" . $torrent["seeders"] . "e" . benc_str("incomplete") . "i" . $torrent["leechers"] . "e" . benc_str("peers");
|
||||||
|
|
||||||
|
$peer_list = "";
|
||||||
|
unset($self);
|
||||||
|
// bencoding the peers info get for this announce
|
||||||
|
while ($row = mysql_fetch_assoc($res))
|
||||||
|
{
|
||||||
|
$row["peer_id"] = hash_pad($row["peer_id"]);
|
||||||
|
|
||||||
|
// $peer_id is the announcer's peer_id while $row["peer_id"] is randomly selected from the peers table
|
||||||
|
if ($row["peer_id"] === $peer_id)
|
||||||
|
{
|
||||||
|
$self = $row;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($compact == 1){
|
||||||
|
$longip = ip2long($row['ip']);
|
||||||
|
if ($longip) //Ignore ipv6 address
|
||||||
|
$peer_list .= pack("Nn", sprintf("%d",$longip), $row['port']);
|
||||||
|
}
|
||||||
|
elseif ($no_peer_id == 1)
|
||||||
|
$peer_list .= "d" .
|
||||||
|
benc_str("ip") . benc_str($row["ip"]) .
|
||||||
|
benc_str("port") . "i" . $row["port"] . "e" .
|
||||||
|
"e";
|
||||||
|
else
|
||||||
|
$peer_list .= "d" .
|
||||||
|
benc_str("ip") . benc_str($row["ip"]) .
|
||||||
|
benc_str("peer id") . benc_str($row["peer_id"]) .
|
||||||
|
benc_str("port") . "i" . $row["port"] . "e" .
|
||||||
|
"e";
|
||||||
|
}
|
||||||
|
if ($compact == 1)
|
||||||
|
$resp .= benc_str($peer_list);
|
||||||
|
else
|
||||||
|
$resp .= "l".$peer_list."e";
|
||||||
|
|
||||||
|
$resp .= "e";
|
||||||
|
$selfwhere = "torrent = $torrentid AND " . hash_where("peer_id", $peer_id);
|
||||||
|
|
||||||
|
//no found in the above random selection
|
||||||
|
if (!isset($self))
|
||||||
|
{
|
||||||
|
$res = sql_query("SELECT $fields FROM peers WHERE $selfwhere LIMIT 1");
|
||||||
|
$row = mysql_fetch_assoc($res);
|
||||||
|
if ($row)
|
||||||
|
{
|
||||||
|
$self = $row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// min announce time
|
||||||
|
if(isset($self) && $self['prevts'] > (TIMENOW - $announce_wait))
|
||||||
|
err('There is a minimum announce time of ' . $announce_wait . ' seconds');
|
||||||
|
|
||||||
|
// current peer_id, or you could say session with tracker not found in table peers
|
||||||
|
if (!isset($self))
|
||||||
|
{
|
||||||
|
$valid = @mysql_fetch_row(@sql_query("SELECT COUNT(*) FROM peers WHERE torrent=$torrentid AND userid=" . sqlesc($userid)));
|
||||||
|
if ($valid[0] >= 1 && $seeder == 'no') err("You already are downloading the same torrent. You may only leech from one location at a time.");
|
||||||
|
if ($valid[0] >= 3 && $seeder == 'yes') err("You cannot seed the same torrent from more than 3 locations.");
|
||||||
|
|
||||||
|
if ($az["enabled"] == "no")
|
||||||
|
err("Your account is disabled!");
|
||||||
|
elseif ($az["parked"] == "yes")
|
||||||
|
err("Your account is parked! (Read the FAQ)");
|
||||||
|
elseif ($az["downloadpos"] == "no")
|
||||||
|
err("Your downloading priviledges have been disabled! (Read the rules)");
|
||||||
|
|
||||||
|
if ($az["class"] < UC_VIP)
|
||||||
|
{
|
||||||
|
$ratio = (($az["downloaded"] > 0) ? ($az["uploaded"] / $az["downloaded"]) : 1);
|
||||||
|
$gigs = $az["downloaded"] / (1024*1024*1024);
|
||||||
|
if ($waitsystem == "yes")
|
||||||
|
{
|
||||||
|
if($gigs > 10)
|
||||||
|
{
|
||||||
|
$elapsed = strtotime(date("Y-m-d H:i:s")) - $torrent["ts"];
|
||||||
|
if ($ratio < 0.4) $wait = 24;
|
||||||
|
elseif ($ratio < 0.5) $wait = 12;
|
||||||
|
elseif ($ratio < 0.6) $wait = 6;
|
||||||
|
elseif ($ratio < 0.8) $wait = 3;
|
||||||
|
else $wait = 0;
|
||||||
|
|
||||||
|
if ($elapsed < $wait)
|
||||||
|
err("Your ratio is too low! You need to wait " . mkprettytime($wait * 3600 - $elapsed) . " to start, please read $BASEURL/faq.php#id46 for details");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($maxdlsystem == "yes")
|
||||||
|
{
|
||||||
|
if($gigs > 10)
|
||||||
|
if ($ratio < 0.5) $max = 1;
|
||||||
|
elseif ($ratio < 0.65) $max = 2;
|
||||||
|
elseif ($ratio < 0.8) $max = 3;
|
||||||
|
elseif ($ratio < 0.95) $max = 4;
|
||||||
|
else $max = 0;
|
||||||
|
if ($max > 0)
|
||||||
|
{
|
||||||
|
$res = sql_query("SELECT COUNT(*) AS num FROM peers WHERE userid='$userid' AND seeder='no'") or err("Tracker error 5");
|
||||||
|
$row = mysql_fetch_assoc($res);
|
||||||
|
if ($row['num'] >= $max) err("Your slot limit is reached! You may at most download $max torrents at the same time, please read $BASEURL/faq.php#id66 for details");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // continue an existing session
|
||||||
|
{
|
||||||
|
$upthis = $trueupthis = max(0, $uploaded - $self["uploaded"]);
|
||||||
|
$downthis = $truedownthis = max(0, $downloaded - $self["downloaded"]);
|
||||||
|
$announcetime = ($self["seeder"] == "yes" ? "seedtime = seedtime + $self[announcetime]" : "leechtime = leechtime + $self[announcetime]");
|
||||||
|
$is_cheater = false;
|
||||||
|
|
||||||
|
if ($cheaterdet_security){
|
||||||
|
if ($az['class'] < $nodetect_security && $self['announcetime'] > 10)
|
||||||
|
{
|
||||||
|
$is_cheater = check_cheater($userid, $torrent['id'], $upthis, $downthis, $self['announcetime'], $torrent['seeders'], $torrent['leechers']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$is_cheater && ($trueupthis > 0 || $truedownthis > 0))
|
||||||
|
{
|
||||||
|
$global_promotion_state = get_global_sp_state();
|
||||||
|
if($global_promotion_state == 1)// Normal, see individual torrent
|
||||||
|
{
|
||||||
|
if($torrent['sp_state']==3) //2X
|
||||||
|
{
|
||||||
|
$USERUPDATESET[] = "uploaded = uploaded + 2*$trueupthis";
|
||||||
|
$USERUPDATESET[] = "downloaded = downloaded + $truedownthis";
|
||||||
|
}
|
||||||
|
elseif($torrent['sp_state']==4) //2X Free
|
||||||
|
{
|
||||||
|
$USERUPDATESET[] = "uploaded = uploaded + 2*$trueupthis";
|
||||||
|
}
|
||||||
|
elseif($torrent['sp_state']==6) //2X 50%
|
||||||
|
{
|
||||||
|
$USERUPDATESET[] = "uploaded = uploaded + 2*$trueupthis";
|
||||||
|
$USERUPDATESET[] = "downloaded = downloaded + $truedownthis/2";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if ($torrent['owner'] == $userid && $uploaderdouble_torrent > 0)
|
||||||
|
$upthis = $trueupthis * $uploaderdouble_torrent;
|
||||||
|
|
||||||
|
if($torrent['sp_state']==2) //Free
|
||||||
|
{
|
||||||
|
$USERUPDATESET[] = "uploaded = uploaded + $upthis";
|
||||||
|
}
|
||||||
|
elseif($torrent['sp_state']==5) //50%
|
||||||
|
{
|
||||||
|
$USERUPDATESET[] = "uploaded = uploaded + $upthis";
|
||||||
|
$USERUPDATESET[] = "downloaded = downloaded + $truedownthis/2";
|
||||||
|
}
|
||||||
|
elseif($torrent['sp_state']==7) //30%
|
||||||
|
{
|
||||||
|
$USERUPDATESET[] = "uploaded = uploaded + $upthis";
|
||||||
|
$USERUPDATESET[] = "downloaded = downloaded + $truedownthis*3/10";
|
||||||
|
}
|
||||||
|
elseif($torrent['sp_state']==1) //Normal
|
||||||
|
{
|
||||||
|
$USERUPDATESET[] = "uploaded = uploaded + $upthis";
|
||||||
|
$USERUPDATESET[] = "downloaded = downloaded + $truedownthis";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif($global_promotion_state == 2) //Free
|
||||||
|
{
|
||||||
|
if ($torrent['owner'] == $userid && $uploaderdouble_torrent > 0)
|
||||||
|
$upthis = $trueupthis * $uploaderdouble_torrent;
|
||||||
|
$USERUPDATESET[] = "uploaded = uploaded + $upthis";
|
||||||
|
}
|
||||||
|
elseif($global_promotion_state == 3) //2X
|
||||||
|
{
|
||||||
|
if ($uploaderdouble_torrent > 2 && $torrent['owner'] == $userid && $uploaderdouble_torrent > 0)
|
||||||
|
$upthis = $trueupthis * $uploaderdouble_torrent;
|
||||||
|
else $upthis = 2*$trueupthis;
|
||||||
|
$USERUPDATESET[] = "uploaded = uploaded + $upthis";
|
||||||
|
$USERUPDATESET[] = "downloaded = downloaded + $truedownthis";
|
||||||
|
}
|
||||||
|
elseif($global_promotion_state == 4) //2X Free
|
||||||
|
{
|
||||||
|
if ($uploaderdouble_torrent > 2 && $torrent['owner'] == $userid && $uploaderdouble_torrent > 0)
|
||||||
|
$upthis = $trueupthis * $uploaderdouble_torrent;
|
||||||
|
else $upthis = 2*$trueupthis;
|
||||||
|
$USERUPDATESET[] = "uploaded = uploaded + $upthis";
|
||||||
|
}
|
||||||
|
elseif($global_promotion_state == 5){ // 50%
|
||||||
|
if ($torrent['owner'] == $userid && $uploaderdouble_torrent > 0)
|
||||||
|
$upthis = $trueupthis * $uploaderdouble_torrent;
|
||||||
|
$USERUPDATESET[] = "uploaded = uploaded + $upthis";
|
||||||
|
$USERUPDATESET[] = "downloaded = downloaded + $truedownthis/2";
|
||||||
|
}
|
||||||
|
elseif($global_promotion_state == 6){ //2X 50%
|
||||||
|
if ($uploaderdouble_torrent > 2 && $torrent['owner'] == $userid && $uploaderdouble_torrent > 0)
|
||||||
|
$upthis = $trueupthis * $uploaderdouble_torrent;
|
||||||
|
else $upthis = 2*$trueupthis;
|
||||||
|
$USERUPDATESET[] = "uploaded = uploaded + $upthis";
|
||||||
|
$USERUPDATESET[] = "downloaded = downloaded + $truedownthis/2";
|
||||||
|
}
|
||||||
|
elseif($global_promotion_state == 7){ //30%
|
||||||
|
if ($torrent['owner'] == $userid && $uploaderdouble_torrent > 0)
|
||||||
|
$upthis = $trueupthis * $uploaderdouble_torrent;
|
||||||
|
$USERUPDATESET[] = "uploaded = uploaded + $upthis";
|
||||||
|
$USERUPDATESET[] = "downloaded = downloaded + $truedownthis*3/10";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$dt = sqlesc(date("Y-m-d H:i:s"));
|
||||||
|
$updateset = array();
|
||||||
|
// set non-type event
|
||||||
|
if (!isset($event))
|
||||||
|
$event = "";
|
||||||
|
if (isset($self) && $event == "stopped")
|
||||||
|
{
|
||||||
|
sql_query("DELETE FROM peers WHERE $selfwhere") or err("D Err");
|
||||||
|
if (mysql_affected_rows())
|
||||||
|
{
|
||||||
|
$updateset[] = ($self["seeder"] == "yes" ? "seeders = seeders - 1" : "leechers = leechers - 1");
|
||||||
|
sql_query("UPDATE snatched SET uploaded = uploaded + $trueupthis, downloaded = downloaded + $truedownthis, to_go = $left, $announcetime, last_action = ".$dt." WHERE torrentid = $torrentid AND userid = $userid") or err("SL Err 1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif(isset($self))
|
||||||
|
{
|
||||||
|
if ($event == "completed")
|
||||||
|
{
|
||||||
|
//sql_query("UPDATE snatched SET finished = 'yes', completedat = $dt WHERE torrentid = $torrentid AND userid = $userid");
|
||||||
|
$finished = ", finishedat = ".TIMENOW;
|
||||||
|
$finished_snatched = ", completedat = ".$dt . ", finished = 'yes'";
|
||||||
|
$updateset[] = "times_completed = times_completed + 1";
|
||||||
|
}
|
||||||
|
|
||||||
|
sql_query("UPDATE peers SET ip = ".sqlesc($ip).", port = $port, uploaded = $uploaded, downloaded = $downloaded, to_go = $left, prev_action = last_action, last_action = $dt, seeder = '$seeder', agent = ".sqlesc($agent)." $finished WHERE $selfwhere") or err("PL Err 1");
|
||||||
|
|
||||||
|
if (mysql_affected_rows())
|
||||||
|
{
|
||||||
|
if ($seeder <> $self["seeder"])
|
||||||
|
$updateset[] = ($seeder == "yes" ? "seeders = seeders + 1, leechers = leechers - 1" : "seeders = seeders - 1, leechers = leechers + 1");
|
||||||
|
sql_query("UPDATE snatched SET uploaded = uploaded + $trueupthis, downloaded = downloaded + $truedownthis, to_go = $left, $announcetime, last_action = ".$dt." $finished_snatched WHERE torrentid = $torrentid AND userid = $userid") or err("SL Err 2");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sockres = @pfsockopen($ip, $port, $errno, $errstr, 5);
|
||||||
|
if (!$sockres)
|
||||||
|
{
|
||||||
|
$connectable = "no";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$connectable = "yes";
|
||||||
|
@fclose($sockres);
|
||||||
|
}
|
||||||
|
sql_query("INSERT INTO peers (torrent, userid, peer_id, ip, port, connectable, uploaded, downloaded, to_go, started, last_action, seeder, agent, downloadoffset, uploadoffset, passkey) VALUES ($torrentid, $userid, ".sqlesc($peer_id).", ".sqlesc($ip).", $port, '$connectable', $uploaded, $downloaded, $left, $dt, $dt, '$seeder', ".sqlesc($agent).", $downloaded, $uploaded, ".sqlesc($passkey).")") or err("PL Err 2");
|
||||||
|
|
||||||
|
if (mysql_affected_rows())
|
||||||
|
{
|
||||||
|
$updateset[] = ($seeder == "yes" ? "seeders = seeders + 1" : "leechers = leechers + 1");
|
||||||
|
|
||||||
|
$check = @mysql_fetch_row(@sql_query("SELECT COUNT(*) FROM snatched WHERE torrentid = $torrentid AND userid = $userid"));
|
||||||
|
if (!$check['0'])
|
||||||
|
sql_query("INSERT INTO snatched (torrentid, userid, ip, port, uploaded, downloaded, to_go, startdat, last_action) VALUES ($torrentid, $userid, ".sqlesc($ip).", $port, $uploaded, $downloaded, $left, $dt, $dt)") or err("SL Err 4");
|
||||||
|
else
|
||||||
|
sql_query("UPDATE snatched SET to_go = $left, last_action = ".$dt ." WHERE torrentid = $torrentid AND userid = $userid") or err("SL Err 3.1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($updateset)) // Update only when there is change in peer counts
|
||||||
|
{
|
||||||
|
$updateset[] = "visible = 'yes'";
|
||||||
|
$updateset[] = "last_action = $dt";
|
||||||
|
sql_query("UPDATE torrents SET " . join(",", $updateset) . " WHERE id = $torrentid");
|
||||||
|
}
|
||||||
|
|
||||||
|
if($client_familyid != 0 && $client_familyid != $az['clientselect'])
|
||||||
|
$USERUPDATESET[] = "clientselect = ".sqlesc($client_familyid);
|
||||||
|
|
||||||
|
if(count($USERUPDATESET) && $userid)
|
||||||
|
{
|
||||||
|
sql_query("UPDATE users SET " . join(",", $USERUPDATESET) . " WHERE id = ".$userid);
|
||||||
|
}
|
||||||
|
benc_resp_raw($resp);
|
||||||
|
?>
|
||||||
263
attachment.php
Normal file
263
attachment.php
Normal file
@@ -0,0 +1,263 @@
|
|||||||
|
<?php
|
||||||
|
require_once("include/bittorrent.php");
|
||||||
|
dbconn();
|
||||||
|
require_once(get_langfile_path());
|
||||||
|
loggedinorreturn();
|
||||||
|
include_once($rootpath . 'classes/class_attachment.php');
|
||||||
|
|
||||||
|
$Attach = new ATTACHMENT($CURUSER['id']);
|
||||||
|
$count_limit = $Attach->get_count_limit();
|
||||||
|
$count_limit = (int)$count_limit;
|
||||||
|
$count_left = $Attach->get_count_left();
|
||||||
|
$size_limit = $Attach->get_size_limit_byte();
|
||||||
|
$allowed_exts = $Attach->get_allowed_ext();
|
||||||
|
$css_uri = get_css_uri();
|
||||||
|
$altsize = $_POST['altsize'];
|
||||||
|
?>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link rel="stylesheet" href="<?php echo get_font_css_uri()?>" type="text/css">
|
||||||
|
<link rel="stylesheet" href="<?php echo $css_uri."theme.css"?>" type="text/css">
|
||||||
|
</head>
|
||||||
|
<body class="inframe">
|
||||||
|
<table width="100%">
|
||||||
|
<?php
|
||||||
|
if ($Attach->enable_attachment())
|
||||||
|
{
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] == "POST")
|
||||||
|
{
|
||||||
|
$file = $_FILES['file'];
|
||||||
|
$filesize = $file["size"];
|
||||||
|
$filetype = $file["type"];
|
||||||
|
$origfilename = $file['name'];
|
||||||
|
$ext_l = strrpos($origfilename, ".");
|
||||||
|
$ext = strtolower(substr($origfilename, $ext_l+1, strlen($origfilename)-($ext_l+1)));
|
||||||
|
$banned_ext = array('exe', 'com', 'bat', 'msi');
|
||||||
|
$img_ext = array('jpeg', 'jpg', 'png', 'gif');
|
||||||
|
$warning = "";
|
||||||
|
if (!$file || $filesize == 0 || $file["name"] == "") // nothing received
|
||||||
|
{
|
||||||
|
$warning = $lang_attachment['text_nothing_received'];
|
||||||
|
}
|
||||||
|
elseif (!$count_left) //user cannot upload more files
|
||||||
|
{
|
||||||
|
$warning = $lang_attachment['text_file_number_limit_reached'];
|
||||||
|
}
|
||||||
|
elseif ($filesize > $size_limit || $filesize >= 5242880) //do not allow file bigger than 5 MB
|
||||||
|
{
|
||||||
|
$warning = $lang_attachment['text_file_size_too_big'];
|
||||||
|
}
|
||||||
|
elseif (!in_array($ext, $allowed_exts) || in_array($ext, $banned_ext)) //the file extension is banned
|
||||||
|
{
|
||||||
|
$warning = $lang_attachment['text_file_extension_not_allowed'];
|
||||||
|
}
|
||||||
|
else //everythins is okay
|
||||||
|
{
|
||||||
|
if (in_array($ext, $img_ext))
|
||||||
|
$isimage = true;
|
||||||
|
else $isimage = false;
|
||||||
|
if ($savedirectorytype_attachment == 'onedir')
|
||||||
|
$savepath = "";
|
||||||
|
elseif ($savedirectorytype_attachment == 'monthdir')
|
||||||
|
$savepath = date("Ym")."/";
|
||||||
|
elseif ($savedirectorytype_attachment == 'daydir')
|
||||||
|
$savepath = date("Ymd")."/";
|
||||||
|
$filemd5 = md5_file($file['tmp_name']);
|
||||||
|
$filename = date("YmdHis").$filemd5;
|
||||||
|
$file_location = make_folder($savedirectory_attachment."/", $savepath) . $filename;
|
||||||
|
$db_file_location = $savepath.$filename;
|
||||||
|
$abandonorig = false;
|
||||||
|
$hasthumb = false;
|
||||||
|
$width = 0;
|
||||||
|
if ($isimage) //the uploaded file is a image
|
||||||
|
{
|
||||||
|
$maycreatethumb = false;
|
||||||
|
$stop = false;
|
||||||
|
$imagesize = getimagesize($file['tmp_name']);
|
||||||
|
if ($imagesize){
|
||||||
|
$height = $imagesize[1];
|
||||||
|
$width = $imagesize[0];
|
||||||
|
$it = $imagesize[2];
|
||||||
|
if ($it != 1 || !$Attach->is_gif_ani($file['tmp_name'])){ //if it is an animation GIF, stop creating thumbnail and adding watermark
|
||||||
|
if ($thumbnailtype_attachment != 'no') //create thumbnail for big image
|
||||||
|
{
|
||||||
|
//determine the size of thumbnail
|
||||||
|
if ($altsize == 'yes'){
|
||||||
|
$targetwidth = $altthumbwidth_attachment;
|
||||||
|
$targetheight = $altthumbheight_attachment;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$targetwidth = $thumbwidth_attachment;
|
||||||
|
$targetheight = $thumbheight_attachment;
|
||||||
|
}
|
||||||
|
$hscale=$height/$targetheight;
|
||||||
|
$wscale=$width/$targetwidth;
|
||||||
|
$scale=($hscale < 1 && $wscale < 1) ? 1 : (( $hscale > $wscale) ? $hscale : $wscale);
|
||||||
|
$newwidth=floor($width/$scale);
|
||||||
|
$newheight=floor($height/$scale);
|
||||||
|
if ($scale != 1){ //thumbnail is needed
|
||||||
|
if ($it==1)
|
||||||
|
$orig=@imagecreatefromgif($file["tmp_name"]);
|
||||||
|
elseif ($it == 2)
|
||||||
|
$orig=@imagecreatefromjpeg($file["tmp_name"]);
|
||||||
|
else
|
||||||
|
$orig=@imagecreatefrompng($file["tmp_name"]);
|
||||||
|
if ($orig && !$stop)
|
||||||
|
{
|
||||||
|
$thumb = imagecreatetruecolor($newwidth, $newheight);
|
||||||
|
imagecopyresized($thumb, $orig, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
|
||||||
|
if ($thumbnailtype_attachment == 'createthumb'){
|
||||||
|
$hasthumb = true;
|
||||||
|
imagejpeg($thumb, $file_location.".".$ext.".thumb.jpg", $thumbquality_attachment);
|
||||||
|
}
|
||||||
|
elseif ($thumbnailtype_attachment == 'resizebigimg'){
|
||||||
|
$ext = "jpg";
|
||||||
|
$filetype = "image/jpeg";
|
||||||
|
$it = 2;
|
||||||
|
$height = $newheight;
|
||||||
|
$width = $newwidth;
|
||||||
|
$maycreatethumb = true;
|
||||||
|
$abandonorig = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$watermarkpos = $watermarkpos_attachment;
|
||||||
|
if ($watermarkpos != 'no' && !$stop) //add watermark to image
|
||||||
|
{
|
||||||
|
if ($width > $watermarkwidth_attachment && $height > $watermarkheight_attachment)
|
||||||
|
{
|
||||||
|
if ($abandonorig)
|
||||||
|
{
|
||||||
|
$resource = $thumb;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$resource=imagecreatetruecolor($width,$height);
|
||||||
|
if ($it==1)
|
||||||
|
$resource_p=@imagecreatefromgif($file["tmp_name"]);
|
||||||
|
elseif ($it==2)
|
||||||
|
$resource_p=@imagecreatefromjpeg($file["tmp_name"]);
|
||||||
|
else
|
||||||
|
$resource_p=@imagecreatefrompng($file["tmp_name"]);
|
||||||
|
imagecopy($resource, $resource_p, 0, 0, 0, 0, $width, $height);
|
||||||
|
}
|
||||||
|
$watermark = imagecreatefrompng('pic/watermark.png');
|
||||||
|
$watermark_width = imagesx($watermark);
|
||||||
|
$watermark_height = imagesy($watermark);
|
||||||
|
//the position of the watermark
|
||||||
|
if ($watermarkpos == 'random')
|
||||||
|
$watermarkpos = mt_rand(1, 9);
|
||||||
|
switch ($watermarkpos)
|
||||||
|
{
|
||||||
|
case 1: {
|
||||||
|
$wmx = 5;
|
||||||
|
$wmy = 5;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 2: {
|
||||||
|
$wmx = ($width-$watermark_width)/2;
|
||||||
|
$wmy = 5;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 3: {
|
||||||
|
$wmx = $width-$watermark_width-5;
|
||||||
|
$wmy = 5;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 4: {
|
||||||
|
$wmx = 5;
|
||||||
|
$wmy = ($height-$watermark_height)/2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 5: {
|
||||||
|
$wmx = ($width-$watermark_width)/2;
|
||||||
|
$wmy = ($height-$watermark_height)/2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 6: {
|
||||||
|
$wmx = $width-$watermark_width-5;
|
||||||
|
$wmy = ($height-$watermark_height)/2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 7: {
|
||||||
|
$wmx = 5;
|
||||||
|
$wmy = $height-$watermark_height-5;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 8: {
|
||||||
|
$wmx = ($width-$watermark_width)/2;
|
||||||
|
$wmy = $height-$watermark_height-5;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 9: {
|
||||||
|
$wmx = $width-$watermark_width-5;
|
||||||
|
$wmy = $height-$watermark_height-5;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
imagecopy($resource, $watermark, $wmx, $wmy, 0, 0, $watermark_width, $watermark_height);
|
||||||
|
if ($it==1)
|
||||||
|
imagegif($resource, $file_location.".".$ext);
|
||||||
|
elseif ($it==2)
|
||||||
|
imagejpeg($resource, $file_location.".".$ext, $watermarkquality_attachment);
|
||||||
|
else
|
||||||
|
imagepng($resource, $file_location.".".$ext);
|
||||||
|
$filesize = filesize($file_location.".".$ext);
|
||||||
|
$maycreatethumb = false;
|
||||||
|
$abandonorig = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($maycreatethumb){ // if no watermark is added, create the thumbnail now for the above resized image.
|
||||||
|
imagejpeg($thumb, $file_location.".".$ext, $thumbquality_attachment);
|
||||||
|
$filesize = filesize($file_location.".".$ext);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else $warning = $lang_attachment['text_invalid_image_file'];
|
||||||
|
}
|
||||||
|
if (!$abandonorig){
|
||||||
|
if(!move_uploaded_file($file["tmp_name"], $file_location.".".$ext))
|
||||||
|
$warning = $lang_attachment['text_cannot_move_file'];
|
||||||
|
}
|
||||||
|
if (!$warning) //insert into database and add code to editor
|
||||||
|
{
|
||||||
|
$dlkey = md5($db_file_location.".".$ext);
|
||||||
|
sql_query("INSERT INTO attachments (userid, width, added, filename, filetype, filesize, location, dlkey, isimage, thumb) VALUES (".$CURUSER['id'].", ".$width.", ".sqlesc(date("Y-m-d H:i:s")).", ".sqlesc($origfilename).", ".sqlesc($filetype).", ".$filesize.", ".sqlesc($db_file_location.".".$ext).", ".sqlesc($dlkey).", ".($isimage ? 1 : 0).", ".($hasthumb ? 1 : 0).")") or sqlerr(__FILE__, __LINE__);
|
||||||
|
$count_left--;
|
||||||
|
echo("<script type=\"text/javascript\">parent.tag_extimage('". "[attach]" . $dlkey . "[/attach]" . "');</script>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print("<form enctype=\"multipart/form-data\" name=\"attachment\" method=\"post\" action=\"attachment.php\">");
|
||||||
|
print("<tr>");
|
||||||
|
print("<td class=\"embedded\" colspan=\"2\" align=left>");
|
||||||
|
print("<input type=\"file\" name=\"file\"".($count_left ? "" : " disabled=\"disabled\"")." /> ");
|
||||||
|
print("<input type=\"checkbox\" name=\"altsize\" value=\"yes\"".($altsize == 'yes' ? " checked=\"checked\"" : "")." />".$lang_attachment['text_small_thumbnail']." ");
|
||||||
|
print("<input type=\"submit\" name=\"submit\" value=\"".$lang_attachment['submit_upload']."\"".($count_left ? "" : " disabled=\"disabled\"")." /> ");
|
||||||
|
if ($warning) {
|
||||||
|
print('<span class="striking">'.$warning.'</span>');
|
||||||
|
} else {
|
||||||
|
print("<b>".$lang_attachment['text_left']."</b><font color=\"red\">".$count_left."</font>".$lang_attachment['text_of'].$count_limit." <b>".$lang_attachment['text_size_limit']."</b>".mksize($size_limit)." <b>".$lang_attachment['text_file_extensions']."</b>");
|
||||||
|
$allowedextsblock = "";
|
||||||
|
foreach($allowed_exts as $ext) {
|
||||||
|
$allowedextsblock .= $ext."/";
|
||||||
|
}
|
||||||
|
$allowedextsblock = rtrim(trim($allowedextsblock), "/");
|
||||||
|
if (!$allowedextsblock) {
|
||||||
|
$allowedextsblock = 'N/A';
|
||||||
|
}
|
||||||
|
print("<span title=\"".htmlspecialchars($allowedextsblock)."\"><i>".$lang_attachment['text_mouse_over_here']."</i></span>");
|
||||||
|
}
|
||||||
|
|
||||||
|
print("</td>");
|
||||||
|
print("</tr>");
|
||||||
|
print("</form>");
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
3
attachments/.htaccess
Normal file
3
attachments/.htaccess
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
Options -Indexes
|
||||||
|
Order allow,deny
|
||||||
|
Allow from all
|
||||||
30
bannedemails.php
Normal file
30
bannedemails.php
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
loggedinorreturn();
|
||||||
|
if (get_user_class() < UC_SYSOP)
|
||||||
|
stderr("Error", "Access denied.");
|
||||||
|
|
||||||
|
$action = isset($_POST['action']) ? htmlspecialchars($_POST['action']) : (isset($_GET['action']) ? htmlspecialchars($_GET['action']) : 'showlist');
|
||||||
|
|
||||||
|
if ($action == 'showlist') {
|
||||||
|
stdhead (VERSION." - Show List");
|
||||||
|
print("<table border=1 cellspacing=0 cellpadding=5 width=737>\n");
|
||||||
|
$sql = sql_query("SELECT * FROM bannedemails") or sqlerr(__FILE__, __LINE__);
|
||||||
|
$list = mysql_fetch_array($sql);
|
||||||
|
?>
|
||||||
|
<form method=post action=bannedemails.php>
|
||||||
|
<input type=hidden name=action value=savelist>
|
||||||
|
<tr><td>Enter a list of banned email addresses (separated by spaces):<br />To ban a specific address enter "email@domain.com", to ban an entire domain enter "@domain.com"</td>
|
||||||
|
<td><textarea name="value" rows="5" cols="40"><?php echo $list[value]?></textarea>
|
||||||
|
<input type=submit value="save"></form></td>
|
||||||
|
</tr></table>
|
||||||
|
<?php
|
||||||
|
stdfoot () ;
|
||||||
|
}elseif ($action == 'savelist') {
|
||||||
|
stdhead (VERSION." - Save List");
|
||||||
|
$value = trim ( htmlspecialchars ( $_POST[value] ) ) ;
|
||||||
|
sql_query("UPDATE bannedemails SET value = ".sqlesc($value)) or sqlerr(__FILE__, __LINE__);
|
||||||
|
Print ("Saved.");
|
||||||
|
stdfoot () ;
|
||||||
|
}
|
||||||
71
bans.php
Normal file
71
bans.php
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
<?php
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
loggedinorreturn();
|
||||||
|
if (get_user_class() < UC_ADMINISTRATOR)
|
||||||
|
stderr("Sorry", "Access denied.");
|
||||||
|
|
||||||
|
$remove = (int)$_GET['remove'];
|
||||||
|
if (is_valid_id($remove))
|
||||||
|
{
|
||||||
|
sql_query("DELETE FROM bans WHERE id=".mysql_real_escape_string($remove)) or sqlerr();
|
||||||
|
write_log("Ban ".htmlspecialchars($remove)." was removed by $CURUSER[id] ($CURUSER[username])",'mod');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] == "POST" && get_user_class() >= UC_ADMINISTRATOR)
|
||||||
|
{
|
||||||
|
$first = trim($_POST["first"]);
|
||||||
|
$last = trim($_POST["last"]);
|
||||||
|
$comment = trim($_POST["comment"]);
|
||||||
|
if (!$first || !$last || !$comment)
|
||||||
|
stderr("Error", "Missing form data.");
|
||||||
|
$firstlong = ip2long($first);
|
||||||
|
$lastlong = ip2long($last);
|
||||||
|
if ($firstlong == -1 || $lastlong == -1)
|
||||||
|
stderr("Error", "Bad IP address.");
|
||||||
|
$comment = sqlesc($comment);
|
||||||
|
$added = sqlesc(date("Y-m-d H:i:s"));
|
||||||
|
sql_query("INSERT INTO bans (added, addedby, first, last, comment) VALUES($added, ".mysql_real_escape_string($CURUSER[id]).", $firstlong, $lastlong, $comment)") or sqlerr(__FILE__, __LINE__);
|
||||||
|
header("Location: $_SERVER[REQUEST_URI]");
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
//ob_start("ob_gzhandler");
|
||||||
|
|
||||||
|
$res = sql_query("SELECT * FROM bans ORDER BY added DESC") or sqlerr();
|
||||||
|
|
||||||
|
stdhead("Bans");
|
||||||
|
|
||||||
|
print("<h1>Current Bans</h1>\n");
|
||||||
|
|
||||||
|
if (mysql_num_rows($res) == 0)
|
||||||
|
print("<p align=center><b>Nothing found</b></p>\n");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print("<table border=1 cellspacing=0 cellpadding=5>\n");
|
||||||
|
print("<tr><td class=colhead>Added</td><td class=colhead align=left>First IP</td><td class=colhead align=left>Last IP</td>".
|
||||||
|
"<td class=colhead align=left>By</td><td class=colhead align=left>Comment</td><td class=colhead>Remove</td></tr>\n");
|
||||||
|
|
||||||
|
while ($arr = mysql_fetch_assoc($res))
|
||||||
|
{
|
||||||
|
print("<tr><td>".gettime($arr[added])."</td><td align=left>".long2ip($arr[first])."</td><td align=left>".long2ip($arr[last])."</td><td align=left>". get_username($arr['addedby']) .
|
||||||
|
"</td><td align=left>$arr[comment]</td><td><a href=bans.php?remove=$arr[id]>Remove</a></td></tr>\n");
|
||||||
|
}
|
||||||
|
print("</table>\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (get_user_class() >= UC_ADMINISTRATOR)
|
||||||
|
{
|
||||||
|
print("<h1>Add ban</h1>\n");
|
||||||
|
print("<table border=1 cellspacing=0 cellpadding=5>\n");
|
||||||
|
print("<form method=post action=bans.php>\n");
|
||||||
|
print("<tr><td class=rowhead>First IP</td><td><input type=text name=first size=40></td></tr>\n");
|
||||||
|
print("<tr><td class=rowhead>Last IP</td><td><input type=text name=last size=40></td></tr>\n");
|
||||||
|
print("<tr><td class=rowhead>Comment</td><td><input type=text name=comment size=40></td></tr>\n");
|
||||||
|
print("<tr><td colspan=2 align=center><input type=submit value='Okay' class=btn></td></tr>\n");
|
||||||
|
print("</form>\n</table>\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
stdfoot();
|
||||||
|
|
||||||
|
?>
|
||||||
83
bitbucket-upload.php
Normal file
83
bitbucket-upload.php
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
<?php
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
require_once(get_langfile_path());
|
||||||
|
loggedinorreturn();
|
||||||
|
parked();
|
||||||
|
if ($enablebitbucket_main != 'yes')
|
||||||
|
permissiondenied();
|
||||||
|
$maxfilesize = 256 * 1024;
|
||||||
|
$imgtypes = array (null,'gif','jpg','png');
|
||||||
|
$scaleh = 200; // set our height size desired
|
||||||
|
$scalew = 150; // set our width size desired
|
||||||
|
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] == "POST")
|
||||||
|
{
|
||||||
|
$file = $_FILES["file"];
|
||||||
|
if (!isset($file) || $file["size"] < 1)
|
||||||
|
stderr($lang_bitbucketupload['std_upload_failed'], $lang_bitbucketupload['std_nothing_received']);
|
||||||
|
if ($file["size"] > $maxfilesize)
|
||||||
|
stderr($lang_bitbucketupload['std_upload_failed'], $lang_bitbucketupload['std_file_too_large']);
|
||||||
|
$pp=pathinfo($filename = $file["name"]);
|
||||||
|
if($pp['basename'] != $filename)
|
||||||
|
stderr($lang_bitbucketupload['std_upload_failed'], $lang_bitbucketupload['std_bad_file_name']);
|
||||||
|
$tgtfile = "$bitbucket/$filename";
|
||||||
|
if (file_exists($tgtfile))
|
||||||
|
stderr($lang_bitbucketupload['std_upload_failed'], $lang_bitbucketupload['std_file_already_exists'].htmlspecialchars($filename).$lang_bitbucketupload['std_already_exists'],false);
|
||||||
|
|
||||||
|
$size = getimagesize($file["tmp_name"]);
|
||||||
|
$height = $size[1];
|
||||||
|
$width = $size[0];
|
||||||
|
$it = $size[2];
|
||||||
|
if($imgtypes[$it] == null || $imgtypes[$it] != strtolower($pp['extension']))
|
||||||
|
stderr($lang_bitbucketupload['std_error'], $lang_bitbucketupload['std_invalid_image_format'],false);
|
||||||
|
|
||||||
|
// Scale image to appropriate avatar dimensions
|
||||||
|
$hscale=$height/$scaleh;
|
||||||
|
$wscale=$width/$scalew;
|
||||||
|
$scale=($hscale < 1 && $wscale < 1) ? 1 : (( $hscale > $wscale) ? $hscale : $wscale);
|
||||||
|
$newwidth=floor($width/$scale);
|
||||||
|
$newheight=floor($height/$scale);
|
||||||
|
|
||||||
|
if ($it==1)
|
||||||
|
$orig=@imagecreatefromgif($file["tmp_name"]);
|
||||||
|
elseif ($it == 2)
|
||||||
|
$orig=@imagecreatefromjpeg($file["tmp_name"]);
|
||||||
|
else
|
||||||
|
$orig=@imagecreatefrompng($file["tmp_name"]);
|
||||||
|
if(!$orig)
|
||||||
|
stderr($lang_bitbucketupload['std_image_processing_failed'],$lang_bitbucketupload['std_sorry_the_uploaded']."$imgtypes[$it]".$lang_bitbucketupload['std_failed_processing']);
|
||||||
|
$thumb = imagecreatetruecolor($newwidth, $newheight);
|
||||||
|
imagecopyresized($thumb, $orig, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
|
||||||
|
$ret=($it==1)?imagegif($thumb, $tgtfile): ($it==2)?imagejpeg($thumb, $tgtfile):imagepng($thumb, $tgtfile);
|
||||||
|
|
||||||
|
$url = str_replace(" ", "%20", htmlspecialchars(get_protocol_prefix()."$BASEURL/bitbucket/$filename"));
|
||||||
|
$name = sqlesc($filename);
|
||||||
|
$added = sqlesc(date("Y-m-d H:i:s"));
|
||||||
|
if ($_POST['public'] != 'yes' )
|
||||||
|
$public='"0"';
|
||||||
|
else
|
||||||
|
$public='"1"';
|
||||||
|
sql_query("INSERT INTO bitbucket (owner, name, added, public) VALUES ($CURUSER[id], $name, $added, $public)") or sqlerr(__FILE__, __LINE__);
|
||||||
|
sql_query("UPDATE users SET avatar = ".sqlesc($url)." WHERE id = $CURUSER[id]") or sqlerr(__FILE__, __LINE__);
|
||||||
|
|
||||||
|
stderr($lang_bitbucketupload['std_success'], $lang_bitbucketupload['std_use_following_url']."<br /><b><a href=\"$url\">$url</a></b><p><a href=bitbucket-upload.php>".$lang_bitbucketupload['std_upload_another_file']."</a>.<br /><br /><img src=\"$url\" border=0><br /><br />".$lang_bitbucketupload['std_image']. ($width=$newwidth && $height==$newheight ? $lang_bitbucketupload['std_need_not_rescaling']:$lang_bitbucketupload['std_rescaled_from']."$height x $width".$lang_bitbucketupload['std_to']."$newheight x $newwidth") .$lang_bitbucketupload['std_profile_updated'],false);
|
||||||
|
}
|
||||||
|
|
||||||
|
stdhead($lang_bitbucketupload['head_avatar_upload']);
|
||||||
|
?>
|
||||||
|
<h1><?php echo $lang_bitbucketupload['text_avatar_upload'] ?></h1>
|
||||||
|
<form method="post" action=bitbucket-upload.php enctype="multipart/form-data">
|
||||||
|
<table border=1 cellspacing=0 cellpadding=5>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
if(!is_writable("$bitbucket"))
|
||||||
|
print("<tr><td align=left colspan=2>".$lang_bitbucketupload['text_upload_directory_unwritable']."</tr></td>");
|
||||||
|
print("<tr><td align=left colspan=2>".$lang_bitbucketupload['text_disclaimer']."$scaleh".$lang_bitbucketupload['text_disclaimer_two']."$scalew".$lang_bitbucketupload['text_disclaimer_three'].number_format($maxfilesize).$lang_bitbucketupload['text_disclaimer_four']);
|
||||||
|
?>
|
||||||
|
<tr><td class=rowhead><?php echo $lang_bitbucketupload['row_file'] ?></td><td class="rowfollow"><input type="file" name="file" size="60"></td></tr>
|
||||||
|
<tr><td colspan=2 align=left class="toolbox"><input class="checkbox" type=checkbox name=public value=yes><?php echo $lang_bitbucketupload['checkbox_avatar_shared']?> <input type="submit" value=<?php echo $lang_bitbucketupload['submit_upload'] ?>></td></tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
<?php
|
||||||
|
stdfoot();
|
||||||
3
bitbucket/.htaccess
Normal file
3
bitbucket/.htaccess
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
Options -Indexes
|
||||||
|
Order allow,deny
|
||||||
|
Allow from all
|
||||||
53
bitbucketlog.php
Normal file
53
bitbucketlog.php
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
loggedinorreturn();
|
||||||
|
parked();
|
||||||
|
if (get_user_class() < UC_ADMINISTRATOR)
|
||||||
|
stderr("Sorry", "Access denied.");
|
||||||
|
$bucketpath = "$bitbucket";
|
||||||
|
if (get_user_class() >= UC_MODERATOR)
|
||||||
|
{
|
||||||
|
$delete = $_GET["delete"];
|
||||||
|
if (is_valid_id($delete)) {
|
||||||
|
$r = sql_query("SELECT name,owner FROM bitbucket WHERE id=".mysql_real_escape_string($delete)) or sqlerr(__FILE__, __LINE__);
|
||||||
|
if (mysql_num_rows($r) == 1) {
|
||||||
|
$a = mysql_fetch_assoc($r);
|
||||||
|
if (get_user_class() >= UC_MODERATOR || $a["owner"] == $CURUSER["id"]) {
|
||||||
|
sql_query("DELETE FROM bitbucket WHERE id=".mysql_real_escape_string($delete)) or sqlerr(__FILE__, __LINE__);
|
||||||
|
if (!unlink("$bucketpath/$a[name]"))
|
||||||
|
stderr("Warning", "Unable to unlink file: <b>$a[name]</b>. You should contact an administrator about this error.",false);
|
||||||
|
} } } }
|
||||||
|
stdhead("BitBucket Log");
|
||||||
|
$res = sql_query("SELECT count(*) FROM bitbucket") or die(mysql_error()); $row = mysql_fetch_array($res); $count = $row[0];
|
||||||
|
$perpage = 10;
|
||||||
|
list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, $_SERVER["PHP_SELF"] . "?out=" . $_GET["out"] . "&" );
|
||||||
|
print("<h1>BitBucket Log</h1>\n");
|
||||||
|
print("Total Images Stored: $count");
|
||||||
|
echo $pagertop;
|
||||||
|
$res = sql_query("SELECT * FROM bitbucket ORDER BY added DESC $limit") or sqlerr(__FILE__, __LINE__);
|
||||||
|
if (mysql_num_rows($res) == 0)
|
||||||
|
print("<b>BitBucket Log is empty</b>\n");
|
||||||
|
else {
|
||||||
|
print("<table align='center' border='0' cellspacing='0' cellpadding='5'>\n");
|
||||||
|
while ($arr = mysql_fetch_assoc($res)) {
|
||||||
|
$date = substr($arr['added'], 0, strpos($arr['added'], " "));
|
||||||
|
$time = substr($arr['added'], strpos($arr['added'], " ") + 1);
|
||||||
|
$name = $arr["name"];
|
||||||
|
list($width, $height, $type, $attr) = getimagesize("" . get_protocol_prefix() . "$BASEURL/$bitbucket/$name");
|
||||||
|
$url = str_replace(" ", "%20", htmlspecialchars("$bitbucket/$name"));
|
||||||
|
print("<tr>");
|
||||||
|
print("<td><center><a href=$url><img src=\"".$url."\" border=0 onLoad='SetSize(this, 400)'></a></center>");
|
||||||
|
print("Uploaded by: " . get_username($arr[owner]). "<br />");
|
||||||
|
print("(#$arr[id]) Filename: $name ($width x $height)");
|
||||||
|
if (get_user_class() >= UC_MODERATOR)
|
||||||
|
print(" <b><a href=?delete=$arr[id]>[Delete]</a></b><br />");
|
||||||
|
print("Added: $date $time");
|
||||||
|
print("</tr>");
|
||||||
|
}
|
||||||
|
print("</table>");
|
||||||
|
}
|
||||||
|
echo
|
||||||
|
$pagerbottom;
|
||||||
|
stdfoot();
|
||||||
|
?>
|
||||||
28
bookmark.php
Normal file
28
bookmark.php
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
|
||||||
|
//Send some headers to keep the user's browser from caching the response.
|
||||||
|
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
|
||||||
|
header("Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" );
|
||||||
|
header("Cache-Control: no-cache, must-revalidate" );
|
||||||
|
header("Pragma: no-cache" );
|
||||||
|
header("Content-Type: text/xml; charset=utf-8");
|
||||||
|
|
||||||
|
$torrentid = 0 + $_GET['torrentid'];
|
||||||
|
if(isset($CURUSER))
|
||||||
|
{
|
||||||
|
$res_bookmark = sql_query("SELECT * FROM bookmarks WHERE torrentid=" . sqlesc($torrentid) . " AND userid=" . sqlesc($CURUSER[id]));
|
||||||
|
if (mysql_num_rows($res_bookmark) == 1){
|
||||||
|
sql_query("DELETE FROM bookmarks WHERE torrentid=" . sqlesc($torrentid) . " AND userid=" . sqlesc($CURUSER['id'])) or sqlerr(__FILE__,__LINE__);
|
||||||
|
$Cache->delete_value('user_'.$CURUSER['id'].'_bookmark_array');
|
||||||
|
echo "deleted";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
sql_query("INSERT INTO bookmarks (torrentid, userid) VALUES (" . sqlesc($torrentid) . "," . sqlesc($CURUSER['id']) . ")") or sqlerr(__FILE__,__LINE__);
|
||||||
|
$Cache->delete_value('user_'.$CURUSER['id'].'_bookmark_array');
|
||||||
|
echo "added";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else echo "failed";
|
||||||
|
?>
|
||||||
790
catmanage.php
Normal file
790
catmanage.php
Normal file
@@ -0,0 +1,790 @@
|
|||||||
|
<?php
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
require_once(get_langfile_path());
|
||||||
|
loggedinorreturn();
|
||||||
|
|
||||||
|
if (get_user_class() < UC_ADMINISTRATOR)
|
||||||
|
permissiondenied();
|
||||||
|
|
||||||
|
function return_category_db_table_name($type)
|
||||||
|
{
|
||||||
|
switch($type)
|
||||||
|
{
|
||||||
|
case 'category':
|
||||||
|
$dbtablename = 'categories';
|
||||||
|
break;
|
||||||
|
case 'source':
|
||||||
|
$dbtablename = 'sources';
|
||||||
|
break;
|
||||||
|
case 'medium':
|
||||||
|
$dbtablename = 'media';
|
||||||
|
break;
|
||||||
|
case 'codec':
|
||||||
|
$dbtablename = 'codecs';
|
||||||
|
break;
|
||||||
|
case 'standard':
|
||||||
|
$dbtablename = 'standards';
|
||||||
|
break;
|
||||||
|
case 'processing':
|
||||||
|
$dbtablename = 'processings';
|
||||||
|
break;
|
||||||
|
case 'team':
|
||||||
|
$dbtablename = 'teams';
|
||||||
|
break;
|
||||||
|
case 'audiocodec':
|
||||||
|
$dbtablename = 'audiocodecs';
|
||||||
|
break;
|
||||||
|
case 'searchbox':
|
||||||
|
$dbtablename = 'searchbox';
|
||||||
|
break;
|
||||||
|
case 'secondicon':
|
||||||
|
$dbtablename = 'secondicons';
|
||||||
|
break;
|
||||||
|
case 'caticon':
|
||||||
|
$dbtablename = 'caticons';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return $dbtablename;
|
||||||
|
}
|
||||||
|
function return_category_mode_selection($selname, $selectionid)
|
||||||
|
{
|
||||||
|
$res = sql_query("SELECT * FROM searchbox ORDER BY id ASC");
|
||||||
|
$selection = "<select name=\"".$selname."\">";
|
||||||
|
while ($row = mysql_fetch_array($res))
|
||||||
|
$selection .= "<option value=\"" . $row["id"] . "\"". ($row["id"]==$selectedid ? " selected=\"selected\"" : "").">" . htmlspecialchars($row["name"]) . "</option>\n";
|
||||||
|
$selection .= "</select>";
|
||||||
|
return $selection;
|
||||||
|
}
|
||||||
|
function return_type_name($type)
|
||||||
|
{
|
||||||
|
global $lang_catmanage;
|
||||||
|
switch ($type)
|
||||||
|
{
|
||||||
|
case 'searchbox':
|
||||||
|
$name = $lang_catmanage['text_searchbox'];
|
||||||
|
break;
|
||||||
|
case 'caticon':
|
||||||
|
$name = $lang_catmanage['text_category_icons'];
|
||||||
|
break;
|
||||||
|
case 'secondicon':
|
||||||
|
$name = $lang_catmanage['text_second_icons'];
|
||||||
|
break;
|
||||||
|
case 'category':
|
||||||
|
$name = $lang_catmanage['text_categories'];
|
||||||
|
break;
|
||||||
|
case 'source':
|
||||||
|
$name = $lang_catmanage['text_sources'];
|
||||||
|
break;
|
||||||
|
case 'medium':
|
||||||
|
$name = $lang_catmanage['text_media'];
|
||||||
|
break;
|
||||||
|
case 'codec':
|
||||||
|
$name = $lang_catmanage['text_codecs'];
|
||||||
|
break;
|
||||||
|
case 'standard':
|
||||||
|
$name = $lang_catmanage['text_standards'];
|
||||||
|
break;
|
||||||
|
case 'processing':
|
||||||
|
$name = $lang_catmanage['text_processings'];
|
||||||
|
break;
|
||||||
|
case 'team':
|
||||||
|
$name = $lang_catmanage['text_teams'];
|
||||||
|
break;
|
||||||
|
case 'audiocodec':
|
||||||
|
$name = $lang_catmanage['text_audio_codecs'];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return $name;
|
||||||
|
}
|
||||||
|
|
||||||
|
function print_type_list($type){
|
||||||
|
global $lang_catmanage;
|
||||||
|
$typename=return_type_name($type);
|
||||||
|
stdhead($lang_catmanage['head_category_management']." - ".$typename);
|
||||||
|
begin_main_frame();
|
||||||
|
?>
|
||||||
|
<h1 align="center"><?php echo $lang_catmanage['text_category_management']?> - <?php echo $typename?></h1>
|
||||||
|
<div>
|
||||||
|
<span id="item" onclick="dropmenu(this);"><span style="cursor: pointer;" class="big"><b><?php echo $lang_catmanage['text_manage']?></b></span>
|
||||||
|
<div id="itemlist" class="dropmenu" style="display: none"><ul>
|
||||||
|
<li><a href="?action=view&type=searchbox"><?php echo $lang_catmanage['text_searchbox']?></a></li>
|
||||||
|
<li><a href="?action=view&type=caticon"><?php echo $lang_catmanage['text_category_icons']?></a></li>
|
||||||
|
<li><a href="?action=view&type=secondicon"><?php echo $lang_catmanage['text_second_icons']?></a></li>
|
||||||
|
<li><a href="?action=view&type=category"><?php echo $lang_catmanage['text_categories']?></a></li>
|
||||||
|
<li><a href="?action=view&type=source"><?php echo $lang_catmanage['text_sources']?></a></li>
|
||||||
|
<li><a href="?action=view&type=medium"><?php echo $lang_catmanage['text_media']?></a></li>
|
||||||
|
<li><a href="?action=view&type=codec"><?php echo $lang_catmanage['text_codecs']?></a></li>
|
||||||
|
<li><a href="?action=view&type=standard"><?php echo $lang_catmanage['text_standards']?></a></li>
|
||||||
|
<li><a href="?action=view&type=processing"><?php echo $lang_catmanage['text_processings']?></a></li>
|
||||||
|
<li><a href="?action=view&type=team"><?php echo $lang_catmanage['text_teams']?></a></li>
|
||||||
|
<li><a href="?action=view&type=audiocodec"><?php echo $lang_catmanage['text_audio_codecs']?></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span id="add">
|
||||||
|
<a href="?action=add&type=<?php echo $type?>" class="big"><b><?php echo $lang_catmanage['text_add']?></b></a>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
function check_valid_type($type)
|
||||||
|
{
|
||||||
|
global $lang_catmanage;
|
||||||
|
$validtype=array('searchbox', 'caticon', 'secondicon', 'category', 'source', 'medium', 'codec', 'standard', 'processing', 'team', 'audiocodec');
|
||||||
|
if (!in_array($type, $validtype))
|
||||||
|
stderr($lang_catmanage['std_error'], $lang_catmanage['std_invalid_type']);
|
||||||
|
}
|
||||||
|
function print_sub_category_list($type)
|
||||||
|
{
|
||||||
|
global $lang_catmanage;
|
||||||
|
$dbtablename = return_category_db_table_name($type);
|
||||||
|
$perpage = 50;
|
||||||
|
$num = get_row_count($dbtablename);
|
||||||
|
if (!$num)
|
||||||
|
print("<p align=\"center\">".$lang_catmanage['text_no_record_yet']."</p>");
|
||||||
|
else{
|
||||||
|
list($pagertop, $pagerbottom, $limit) = pager($perpage, $num, "?");
|
||||||
|
$res = sql_query("SELECT * FROM ".$dbtablename." ORDER BY id DESC ".$limit) or sqlerr(__FILE__, __LINE__);
|
||||||
|
?>
|
||||||
|
<table border="1" cellspacing="0" cellpadding="5" width="940">
|
||||||
|
<tr>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['col_id']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['col_name']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['col_order']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['col_action']?></td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
while ($row = mysql_fetch_array($res))
|
||||||
|
{
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td class="colfollow"><?php echo $row['id']?></td>
|
||||||
|
<td class="colfollow"><?php echo htmlspecialchars($row['name'])?></td>
|
||||||
|
<td class="colfollow"><?php echo $row['sort_index']?></td>
|
||||||
|
<td class="colfollow"><a href="javascript:confirm_delete('<?php echo $row['id']?>', '<?php echo $lang_catmanage['js_sure_to_delete_this']?>', 'type=<?php echo $type?>');"><?php echo $lang_catmanage['text_delete']?></a> | <a href="?action=edit&type=<?php echo $type?>&id=<?php echo $row['id']?>"><?php echo $lang_catmanage['text_edit']?></a></td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
<?php
|
||||||
|
print($pagerbottom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function print_category_editor($type, $row='')
|
||||||
|
{
|
||||||
|
global $lang_catmanage;
|
||||||
|
global $validsubcattype;
|
||||||
|
if (in_array($type, $validsubcattype))
|
||||||
|
print_sub_category_editor($type, $row);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$typename=return_type_name($type);
|
||||||
|
?>
|
||||||
|
<div style="width: 940px">
|
||||||
|
<h1 align="center"><a class="faqlink" href="?action=view&type=<?php echo $type?>"><?php echo $typename?></a></h1>
|
||||||
|
<div>
|
||||||
|
<table border="1" cellspacing="0" cellpadding="10" width="100%">
|
||||||
|
<?php
|
||||||
|
if ($type=='searchbox')
|
||||||
|
{
|
||||||
|
if ($row)
|
||||||
|
{
|
||||||
|
$name = $row['name'];
|
||||||
|
$showsource = $row['showsource'];
|
||||||
|
$showmedium = $row['showmedium'];
|
||||||
|
$showcodec = $row['showcodec'];
|
||||||
|
$showstandard = $row['showstandard'];
|
||||||
|
$showprocessing = $row['showprocessing'];
|
||||||
|
$showteam = $row['showteam'];
|
||||||
|
$showaudiocodec = $row['showaudiocodec'];
|
||||||
|
$catsperrow = $row['catsperrow'];
|
||||||
|
$catpadding = $row['catpadding'];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$name = '';
|
||||||
|
$showsource = 0;
|
||||||
|
$showmedium = 0;
|
||||||
|
$showcodec = 0;
|
||||||
|
$showstandard = 0;
|
||||||
|
$showprocessing = 0;
|
||||||
|
$showteam = 0;
|
||||||
|
$showaudiocodec = 0;
|
||||||
|
$catsperrow = 8;
|
||||||
|
$catpadding = 3;
|
||||||
|
}
|
||||||
|
tr($lang_catmanage['row_searchbox_name']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"name\" value=\"".htmlspecialchars($name)."\" style=\"width: 300px\" /> " . $lang_catmanage['text_searchbox_name_note'], 1);
|
||||||
|
tr($lang_catmanage['row_show_sub_category'], "<input type=\"checkbox\" name=\"showsource\" value=\"1\"".($showsource ? " checked=\"checked\"" : "")." /> " . $lang_catmanage['text_sources'] . "<input type=\"checkbox\" name=\"showmedium\" value=\"1\"".($showmedium ? " checked=\"checked\"" : "")." /> " . $lang_catmanage['text_media'] . "<input type=\"checkbox\" name=\"showcodec\" value=\"1\"".($showcodec ? " checked=\"checked\"" : "")." /> " . $lang_catmanage['text_codecs'] . "<input type=\"checkbox\" name=\"showstandard\" value=\"1\"".($showstandard ? " checked=\"checked\"" : "")." /> " . $lang_catmanage['text_standards'] . "<input type=\"checkbox\" name=\"showprocessing\" value=\"1\"".($showprocessing ? " checked=\"checked\"" : "")." /> " . $lang_catmanage['text_processings'] . "<input type=\"checkbox\" name=\"showteam\" value=\"1\"".($showteam ? " checked=\"checked\"" : "")." /> " . $lang_catmanage['text_teams'] . "<input type=\"checkbox\" name=\"showaudiocodec\" value=\"1\"".($showaudiocodec ? " checked=\"checked\"" : "")." /> " . $lang_catmanage['text_audio_codecs']."<br />".$lang_catmanage['text_show_sub_category_note'], 1);
|
||||||
|
tr($lang_catmanage['row_items_per_row']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"catsperrow\" value=\"".$catsperrow."\" style=\"width: 100px\" /> " . $lang_catmanage['text_items_per_row_note'], 1);
|
||||||
|
tr($lang_catmanage['row_padding_between_items']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"catpadding\" value=\"".$catpadding."\" style=\"width: 100px\" /> " . $lang_catmanage['text_padding_between_items_note'], 1);
|
||||||
|
}
|
||||||
|
elseif ($type=='caticon')
|
||||||
|
{
|
||||||
|
if ($row)
|
||||||
|
{
|
||||||
|
$name = $row['name'];
|
||||||
|
$folder = $row['folder'];
|
||||||
|
$multilang = $row['multilang'];
|
||||||
|
$secondicon = $row['secondicon'];
|
||||||
|
$cssfile = $row['cssfile'];
|
||||||
|
$designer = $row['designer'];
|
||||||
|
$comment = $row['comment'];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$name = '';
|
||||||
|
$folder = '';
|
||||||
|
$multilang = 'no';
|
||||||
|
$secondicon = 'no';
|
||||||
|
$cssfile = '';
|
||||||
|
$designer = '';
|
||||||
|
$comment = '';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<tr><td colspan="2"><?php echo $lang_catmanage['text_icon_directory_note']?></td></tr>
|
||||||
|
<?php
|
||||||
|
tr($lang_catmanage['col_name']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"name\" value=\"".htmlspecialchars($name)."\" style=\"width: 300px\" /> " . $lang_catmanage['text_category_icon_name_note'], 1);
|
||||||
|
tr($lang_catmanage['col_folder']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"folder\" value=\"".htmlspecialchars($folder)."\" style=\"width: 300px\" /><br />" . $lang_catmanage['text_folder_note'], 1);
|
||||||
|
tr($lang_catmanage['text_multi_language'], "<input type=\"checkbox\" name=\"multilang\" value=\"yes\"".($multilang == 'yes' ? " checked=\"checked\"" : "")." />".$lang_catmanage['text_yes'] ."<br />". $lang_catmanage['text_multi_language_note'], 1);
|
||||||
|
tr($lang_catmanage['text_second_icon'], "<input type=\"checkbox\" name=\"secondicon\" value=\"yes\"".($secondicon == 'yes' ? " checked=\"checked\"" : "")." />".$lang_catmanage['text_yes'] ."<br />". $lang_catmanage['text_second_icon_note'], 1);
|
||||||
|
tr($lang_catmanage['text_css_file'], "<input type=\"text\" name=\"cssfile\" value=\"".htmlspecialchars($cssfile)."\" style=\"width: 300px\" /> ". $lang_catmanage['text_css_file_note'], 1);
|
||||||
|
tr($lang_catmanage['text_designer'], "<input type=\"text\" name=\"designer\" value=\"".htmlspecialchars($designer)."\" style=\"width: 300px\" /> ". $lang_catmanage['text_designer_note'], 1);
|
||||||
|
tr($lang_catmanage['text_comment'], "<input type=\"text\" name=\"comment\" value=\"".htmlspecialchars($comment)."\" style=\"width: 300px\" /> ". $lang_catmanage['text_comment_note'], 1);
|
||||||
|
}
|
||||||
|
elseif ($type=='secondicon')
|
||||||
|
{
|
||||||
|
if ($row)
|
||||||
|
{
|
||||||
|
$name = $row['name'];
|
||||||
|
$image = $row['image'];
|
||||||
|
$class_name = $row['class_name'];
|
||||||
|
$source = $row['source'];
|
||||||
|
$medium = $row['medium'];
|
||||||
|
$codec = $row['codec'];
|
||||||
|
$standard = $row['standard'];
|
||||||
|
$processing = $row['processing'];
|
||||||
|
$team = $row['team'];
|
||||||
|
$audiocodec = $row['audiocodec'];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$name = '';
|
||||||
|
$image = '';
|
||||||
|
$class_name = '';
|
||||||
|
$source = 0;
|
||||||
|
$medium = 0;
|
||||||
|
$codec = 0;
|
||||||
|
$standard = 0;
|
||||||
|
$processing = 0;
|
||||||
|
$team = 0;
|
||||||
|
$audiocodec = 0;
|
||||||
|
}
|
||||||
|
tr($lang_catmanage['col_name']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"name\" value=\"".htmlspecialchars($name)."\" style=\"width: 300px\" /> " . $lang_catmanage['text_second_icon_name_note'], 1);
|
||||||
|
tr($lang_catmanage['col_image']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"image\" value=\"".htmlspecialchars($image)."\" style=\"width: 300px\" /><br />" . $lang_catmanage['text_image_note'], 1);
|
||||||
|
tr($lang_catmanage['text_class_name'], "<input type=\"text\" name=\"class_name\" value=\"".htmlspecialchars($class_name)."\" style=\"width: 300px\" /><br />" . $lang_catmanage['text_class_name_note'], 1);
|
||||||
|
tr($lang_catmanage['row_selections']."<font color=\"red\">*</font>", torrent_selection(return_type_name('source'), 'source', return_category_db_table_name('source'), $source) . torrent_selection(return_type_name('source'), 'source', return_category_db_table_name('source'), $source) . torrent_selection(return_type_name('medium'), 'medium', return_category_db_table_name('medium'), $medium) . torrent_selection(return_type_name('codec'), 'codec', return_category_db_table_name('codec'), $codec) . torrent_selection(return_type_name('standard'), 'standard', return_category_db_table_name('standard'), $standard) . torrent_selection(return_type_name('processing'), 'processing', return_category_db_table_name('processing'), $processing) . torrent_selection(return_type_name('team'), 'team', return_category_db_table_name('team'), $team) . torrent_selection(return_type_name('audiocodec'), 'audiocodec', return_category_db_table_name('audiocodec'), $audiocodec)."<br />".$lang_catmanage['text_selections_note'], 1);
|
||||||
|
}
|
||||||
|
elseif ($type=='category')
|
||||||
|
{
|
||||||
|
if ($row)
|
||||||
|
{
|
||||||
|
$name = $row['name'];
|
||||||
|
$mode = $row['mode'];
|
||||||
|
$image = $row['image'];
|
||||||
|
$class_name = $row['class_name'];
|
||||||
|
$sort_index = $row['sort_index'];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$name = '';
|
||||||
|
$mode = 1;
|
||||||
|
$image = '';
|
||||||
|
$class_name = '';
|
||||||
|
$sort_index = 0;
|
||||||
|
}
|
||||||
|
tr($lang_catmanage['row_category_name']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"name\" value=\"".htmlspecialchars($name)."\" style=\"width: 300px\" /> " . $lang_catmanage['text_category_name_note'], 1);
|
||||||
|
tr($lang_catmanage['col_image']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"image\" value=\"".htmlspecialchars($image)."\" style=\"width: 300px\" /><br />" . $lang_catmanage['text_image_note'], 1);
|
||||||
|
tr($lang_catmanage['text_class_name'], "<input type=\"text\" name=\"class_name\" value=\"".htmlspecialchars($class_name)."\" style=\"width: 300px\" /><br />" . $lang_catmanage['text_class_name_note'], 1);
|
||||||
|
tr($lang_catmanage['row_mode']."<font color=\"red\">*</font>", return_category_mode_selection('mode', $mode), 1);
|
||||||
|
tr($lang_catmanage['col_order'], "<input type=\"text\" name=\"sort_index\" value=\"".$sort_index."\" style=\"width: 100px\" /> " . $lang_catmanage['text_order_note'], 1);
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div style="text-align: center; margin-top: 10px;">
|
||||||
|
<input type="submit" value="<?php echo $lang_catmanage['submit_submit']?>" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function print_sub_category_editor($type, $row='')
|
||||||
|
{
|
||||||
|
global $lang_catmanage;
|
||||||
|
$typename=return_type_name($type);
|
||||||
|
if ($row)
|
||||||
|
{
|
||||||
|
$name = $row['name'];
|
||||||
|
$sort_index = $row['sort_index'];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$name = '';
|
||||||
|
$sort_index = 0;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<div style="width: 940px">
|
||||||
|
<h1 align="center"><a class="faqlink" href="?action=view&type=<?php echo $type?>"><?php echo $typename?></a></h1>
|
||||||
|
<table border="1" cellspacing="0" cellpadding="10" width="100%">
|
||||||
|
<?php
|
||||||
|
tr($lang_catmanage['col_name']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"name\" value=\"".htmlspecialchars($name)."\" style=\"width: 300px\" /> " . $lang_catmanage['text_subcategory_name_note'], 1);
|
||||||
|
tr($lang_catmanage['col_order'], "<input type=\"text\" name=\"sort_index\" value=\"".$sort_index."\" style=\"width: 100px\" /> " . $lang_catmanage['text_order_note'], 1);
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
<div style="text-align: center; margin-top: 10px;">
|
||||||
|
<input type="submit" value="<?php echo $lang_catmanage['submit_submit']?>" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
$validsubcattype=array('source', 'medium', 'codec', 'standard', 'processing', 'team', 'audiocodec');
|
||||||
|
$type = $_GET['type'];
|
||||||
|
if ($type == '')
|
||||||
|
$type = 'searchbox';
|
||||||
|
else
|
||||||
|
check_valid_type($type);
|
||||||
|
$action = $_GET['action'];
|
||||||
|
if ($action == '')
|
||||||
|
$action = 'view';
|
||||||
|
if ($action == 'view')
|
||||||
|
{
|
||||||
|
print_type_list($type);
|
||||||
|
?>
|
||||||
|
<div style="margin-top: 8px">
|
||||||
|
<?php
|
||||||
|
if (in_array($type, $validsubcattype)){
|
||||||
|
print_sub_category_list($type);
|
||||||
|
}
|
||||||
|
elseif ($type=='searchbox')
|
||||||
|
{
|
||||||
|
$perpage = 50;
|
||||||
|
$dbtablename=return_category_db_table_name($type);
|
||||||
|
$num = get_row_count($dbtablename);
|
||||||
|
if (!$num)
|
||||||
|
print("<p align=\"center\">".$lang_catmanage['text_no_record_yet']."</p>");
|
||||||
|
else{
|
||||||
|
list($pagertop, $pagerbottom, $limit) = pager($perpage, $num, "?");
|
||||||
|
$res = sql_query("SELECT * FROM ".$dbtablename." ORDER BY id ASC ".$limit) or sqlerr(__FILE__, __LINE__);
|
||||||
|
?>
|
||||||
|
<table border="1" cellspacing="0" cellpadding="5" width="940">
|
||||||
|
<tr>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['col_id']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['col_name']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['col_sub_category']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['text_sources']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['text_media']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['text_codecs']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['text_standards']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['text_processings']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['text_teams']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['text_audio_codecs']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['text_per_row']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['text_padding']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['col_action']?></td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
while ($row = mysql_fetch_array($res))
|
||||||
|
{
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td class="colfollow"><?php echo $row['id']?></td>
|
||||||
|
<td class="colfollow"><?php echo htmlspecialchars($row['name'])?></td>
|
||||||
|
<td class="colfollow"><?php echo $row['showsubcat'] ? "<font color=\"green\">".$lang_catmanage['text_enabled']."</font>" : "<font color=\"red\">".$lang_catmanage['text_disabled']."</font>"?></td>
|
||||||
|
<td class="colfollow"><?php echo $row['showsource'] ? "<font color=\"green\">".$lang_catmanage['text_enabled']."</font>" : "<font color=\"red\">".$lang_catmanage['text_disabled']."</font>"?></td>
|
||||||
|
<td class="colfollow"><?php echo $row['showmedium'] ? "<font color=\"green\">".$lang_catmanage['text_enabled']."</font>" : "<font color=\"red\">".$lang_catmanage['text_disabled']."</font>"?></td>
|
||||||
|
<td class="colfollow"><?php echo $row['showcodec'] ? "<font color=\"green\">".$lang_catmanage['text_enabled']."</font>" : "<font color=\"red\">".$lang_catmanage['text_disabled']."</font>"?></td>
|
||||||
|
<td class="colfollow"><?php echo $row['showstandard'] ? "<font color=\"green\">".$lang_catmanage['text_enabled']."</font>" : "<font color=\"red\">".$lang_catmanage['text_disabled']."</font>"?></td>
|
||||||
|
<td class="colfollow"><?php echo $row['showprocessing'] ? "<font color=\"green\">".$lang_catmanage['text_enabled']."</font>" : "<font color=\"red\">".$lang_catmanage['text_disabled']."</font>"?></td>
|
||||||
|
<td class="colfollow"><?php echo $row['showteam'] ? "<font color=\"green\">".$lang_catmanage['text_enabled']."</font>" : "<font color=\"red\">".$lang_catmanage['text_disabled']."</font>"?></td>
|
||||||
|
<td class="colfollow"><?php echo $row['showaudiocodec'] ? "<font color=\"green\">".$lang_catmanage['text_enabled']."</font>" : "<font color=\"red\">".$lang_catmanage['text_disabled']."</font>"?></td>
|
||||||
|
<td class="colfollow"><?php echo $row['catsperrow']?></td>
|
||||||
|
<td class="colfollow"><?php echo $row['catpadding']?></td>
|
||||||
|
<td class="colfollow"><a href="javascript:confirm_delete('<?php echo $row['id']?>', '<?php echo $lang_catmanage['js_sure_to_delete_this']?>', 'type=<?php echo $type?>');"><?php echo $lang_catmanage['text_delete']?></a> | <a href="?action=edit&type=<?php echo $type?>&id=<?php echo $row['id']?>"><?php echo $lang_catmanage['text_edit']?></a></td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
<?php
|
||||||
|
print($pagerbottom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif($type=='caticon')
|
||||||
|
{
|
||||||
|
$perpage = 50;
|
||||||
|
$dbtablename=return_category_db_table_name($type);
|
||||||
|
$num = get_row_count($dbtablename);
|
||||||
|
if (!$num)
|
||||||
|
print("<p align=\"center\">".$lang_catmanage['text_no_record_yet']."</p>");
|
||||||
|
else{
|
||||||
|
list($pagertop, $pagerbottom, $limit) = pager($perpage, $num, "?");
|
||||||
|
$res = sql_query("SELECT * FROM ".$dbtablename." ORDER BY id ASC ".$limit) or sqlerr(__FILE__, __LINE__);
|
||||||
|
?>
|
||||||
|
<table border="1" cellspacing="0" cellpadding="5" width="940">
|
||||||
|
<tr>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['col_id']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['col_name']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['col_folder']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['text_multi_language']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['text_second_icon']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['text_css_file']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['text_designer']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['text_comment']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['col_action']?></td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
while ($row = mysql_fetch_array($res))
|
||||||
|
{
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td class="colfollow"><?php echo $row['id']?></td>
|
||||||
|
<td class="colfollow"><?php echo htmlspecialchars($row['name'])?></td>
|
||||||
|
<td class="colfollow"><?php echo htmlspecialchars($row['folder'])?></td>
|
||||||
|
<td class="colfollow"><?php echo $row['multilang']=='yes' ? "<font color=\"green\">".$lang_catmanage['text_yes']."</font>" : "<font color=\"red\">".$lang_catmanage['text_no']."</font>"?></td>
|
||||||
|
<td class="colfollow"><?php echo $row['secondicon']=='yes' ? "<font color=\"green\">".$lang_catmanage['text_yes']."</font>" : "<font color=\"red\">".$lang_catmanage['text_no']."</font>"?></td>
|
||||||
|
<td class="colfollow"><?php echo $row['cssfile'] ? htmlspecialchars($row['cssfile']) : $lang_catmanage['text_none']?></td>
|
||||||
|
<td class="colfollow"><?php echo htmlspecialchars($row['designer'])?></td>
|
||||||
|
<td class="colfollow"><?php echo htmlspecialchars($row['comment'])?></td>
|
||||||
|
<td class="colfollow"><a href="javascript:confirm_delete('<?php echo $row['id']?>', '<?php echo $lang_catmanage['js_sure_to_delete_this']?>', 'type=<?php echo $type?>');"><?php echo $lang_catmanage['text_delete']?></a> | <a href="?action=edit&type=<?php echo $type?>&id=<?php echo $row['id']?>"><?php echo $lang_catmanage['text_edit']?></a></td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
<?php
|
||||||
|
print($pagerbottom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif($type=='secondicon')
|
||||||
|
{
|
||||||
|
$perpage = 50;
|
||||||
|
$dbtablename=return_category_db_table_name($type);
|
||||||
|
$num = get_row_count($dbtablename);
|
||||||
|
if (!$num)
|
||||||
|
print("<p align=\"center\">".$lang_catmanage['text_no_record_yet']."</p>");
|
||||||
|
else{
|
||||||
|
list($pagertop, $pagerbottom, $limit) = pager($perpage, $num, "?");
|
||||||
|
$res = sql_query("SELECT * FROM ".$dbtablename." ORDER BY id ASC ".$limit) or sqlerr(__FILE__, __LINE__);
|
||||||
|
?>
|
||||||
|
<table border="1" cellspacing="0" cellpadding="5" width="940">
|
||||||
|
<tr>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['col_id']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['col_name']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['col_image']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['text_class_name']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['text_sources']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['text_media']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['text_codecs']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['text_standards']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['text_processings']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['text_teams']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['text_audio_codecs']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['col_action']?></td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
while ($row = mysql_fetch_array($res))
|
||||||
|
{
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td class="colfollow"><?php echo $row['id']?></td>
|
||||||
|
<td class="colfollow"><?php echo htmlspecialchars($row['name'])?></td>
|
||||||
|
<td class="colfollow"><?php echo htmlspecialchars($row['image'])?></td>
|
||||||
|
<td class="colfollow"><?php echo $row['class_name'] ? htmlspecialchars($row['class_name']) : $lang_catmanage['text_none']?></td>
|
||||||
|
<td class="colfollow"><?php echo $row['source']?></td>
|
||||||
|
<td class="colfollow"><?php echo $row['medium']?></td>
|
||||||
|
<td class="colfollow"><?php echo $row['codec']?></td>
|
||||||
|
<td class="colfollow"><?php echo $row['standard']?></td>
|
||||||
|
<td class="colfollow"><?php echo $row['processing']?></td>
|
||||||
|
<td class="colfollow"><?php echo $row['team']?></td>
|
||||||
|
<td class="colfollow"><?php echo $row['audiocodec']?></td>
|
||||||
|
<td class="colfollow"><a href="javascript:confirm_delete('<?php echo $row['id']?>', '<?php echo $lang_catmanage['js_sure_to_delete_this']?>', 'type=<?php echo $type?>');"><?php echo $lang_catmanage['text_delete']?></a> | <a href="?action=edit&type=<?php echo $type?>&id=<?php echo $row['id']?>"><?php echo $lang_catmanage['text_edit']?></a></td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
<?php
|
||||||
|
print($pagerbottom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif($type=='category')
|
||||||
|
{
|
||||||
|
$perpage = 50;
|
||||||
|
$dbtablename=return_category_db_table_name($type);
|
||||||
|
$num = get_row_count($dbtablename);
|
||||||
|
if (!$num)
|
||||||
|
print("<p align=\"center\">".$lang_catmanage['text_no_record_yet']."</p>");
|
||||||
|
else{
|
||||||
|
list($pagertop, $pagerbottom, $limit) = pager($perpage, $num, "?");
|
||||||
|
$res = sql_query("SELECT ".$dbtablename.".*, searchbox.name AS catmodename FROM ".$dbtablename." LEFT JOIN searchbox ON ".$dbtablename.".mode=searchbox.id ORDER BY ".$dbtablename.".mode ASC, ".$dbtablename.".id ASC ".$limit) or sqlerr(__FILE__, __LINE__);
|
||||||
|
?>
|
||||||
|
<table border="1" cellspacing="0" cellpadding="5" width="940">
|
||||||
|
<tr>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['col_id']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['col_mode']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['col_name']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['col_image']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['text_class_name']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['col_order']?></td>
|
||||||
|
<td class="colhead"><?php echo $lang_catmanage['col_action']?></td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
while ($row = mysql_fetch_array($res))
|
||||||
|
{
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td class="colfollow"><?php echo $row['id']?></td>
|
||||||
|
<td class="colfollow"><?php echo htmlspecialchars($row['catmodename'])?></td>
|
||||||
|
<td class="colfollow"><?php echo htmlspecialchars($row['name'])?></td>
|
||||||
|
<td class="colfollow"><?php echo htmlspecialchars($row['image'])?></td>
|
||||||
|
<td class="colfollow"><?php echo $row['class_name'] ? htmlspecialchars($row['class_name']) : $lang_catmanage['text_none']?></td>
|
||||||
|
<td class="colfollow"><?php echo $row['sort_index']?></td>
|
||||||
|
<td class="colfollow"><a href="javascript:confirm_delete('<?php echo $row['id']?>', '<?php echo $lang_catmanage['js_sure_to_delete_this']?>', 'type=<?php echo $type?>');"><?php echo $lang_catmanage['text_delete']?></a> | <a href="?action=edit&type=<?php echo $type?>&id=<?php echo $row['id']?>"><?php echo $lang_catmanage['text_edit']?></a></td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
<?php
|
||||||
|
print($pagerbottom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
end_main_frame();
|
||||||
|
stdfoot();
|
||||||
|
}
|
||||||
|
elseif($action == 'del')
|
||||||
|
{
|
||||||
|
$id = 0 + $_GET['id'];
|
||||||
|
if (!$id)
|
||||||
|
{
|
||||||
|
stderr($lang_catmanage['std_error'], $lang_catmanage['std_invalid_id']);
|
||||||
|
}
|
||||||
|
$dbtablename=return_category_db_table_name($type);
|
||||||
|
$res = sql_query ("SELECT * FROM ".$dbtablename." WHERE id = ".sqlesc($id)." LIMIT 1");
|
||||||
|
if ($row = mysql_fetch_array($res)){
|
||||||
|
sql_query("DELETE FROM ".$dbtablename." WHERE id = ".sqlesc($row['id'])) or sqlerr(__FILE__, __LINE__);
|
||||||
|
if(in_array($type, $validsubcattype))
|
||||||
|
$Cache->delete_value($dbtablename.'_list');
|
||||||
|
elseif ($type=='searchbox')
|
||||||
|
$Cache->delete_value('searchbox_content');
|
||||||
|
elseif ($type=='caticon')
|
||||||
|
$Cache->delete_value('category_icon_content');
|
||||||
|
elseif ($type=='secondicon')
|
||||||
|
$Cache->delete_value('secondicon_'.$row['source'].'_'.$row['medium'].'_'.$row['codec'].'_'.$row['standard'].'_'.$row['processing'].'_'.$row['team'].'_'.$row['audiocodec'].'_content');
|
||||||
|
elseif ($type=='category'){
|
||||||
|
$Cache->delete_value('category_content');
|
||||||
|
$Cache->delete_value('category_list_mode_'.$row['mode']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
header("Location: ".get_protocol_prefix() . $BASEURL."/catmanage.php?action=view&type=".$type);
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
elseif($action == 'edit')
|
||||||
|
{
|
||||||
|
$id = 0 + $_GET['id'];
|
||||||
|
if (!$id)
|
||||||
|
{
|
||||||
|
stderr($lang_catmanage['std_error'], $lang_catmanage['std_invalid_id']);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$dbtablename=return_category_db_table_name($type);
|
||||||
|
$res = sql_query ("SELECT * FROM ".$dbtablename." WHERE id = ".sqlesc($id)." LIMIT 1");
|
||||||
|
if (!$row = mysql_fetch_array($res))
|
||||||
|
stderr($lang_catmanage['std_error'], $lang_catmanage['std_invalid_id']);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$typename=return_type_name($type);
|
||||||
|
stdhead($lang_catmanage['head_edit']." - ".$typename);
|
||||||
|
print("<form method=\"post\" action=\"?action=submit&type=".$type."\">");
|
||||||
|
print("<input type=\"hidden\" name=\"isedit\" value=\"1\" />");
|
||||||
|
print("<input type=\"hidden\" name=\"id\" value=\"".$id."\" />");
|
||||||
|
print_category_editor($type, $row);
|
||||||
|
print("</form>");
|
||||||
|
stdfoot();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif($action == 'add')
|
||||||
|
{
|
||||||
|
$typename=return_type_name($type);
|
||||||
|
stdhead($lang_catmanage['head_add']." - ".$typename);
|
||||||
|
print("<form method=\"post\" action=\"?action=submit&type=".$type."\">");
|
||||||
|
print("<input type=\"hidden\" name=\"isedit\" value=\"0\" />");
|
||||||
|
print_category_editor($type);
|
||||||
|
print("</form>");
|
||||||
|
stdfoot();
|
||||||
|
}
|
||||||
|
elseif($action == 'submit')
|
||||||
|
{
|
||||||
|
$dbtablename=return_category_db_table_name($type);
|
||||||
|
if ($_POST['isedit']){
|
||||||
|
$id = 0 + $_POST['id'];
|
||||||
|
if (!$id)
|
||||||
|
{
|
||||||
|
stderr($lang_catmanage['std_error'], $lang_catmanage['std_invalid_id']);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$res = sql_query("SELECT * FROM ".$dbtablename." WHERE id = ".sqlesc($id)." LIMIT 1");
|
||||||
|
if (!$row = mysql_fetch_array($res))
|
||||||
|
stderr($lang_catmanage['std_error'], $lang_catmanage['std_invalid_id']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$updateset = array();
|
||||||
|
if (in_array($type, $validsubcattype)){
|
||||||
|
$name = $_POST['name'];
|
||||||
|
if (!$name)
|
||||||
|
stderr($lang_catmanage['std_error'], $lang_catmanage['std_missing_form_data']);
|
||||||
|
$updateset[] = "name=".sqlesc($name);
|
||||||
|
$sort_index = 0+$_POST['sort_index'];
|
||||||
|
$updateset[] = "sort_index=".sqlesc($sort_index);
|
||||||
|
$Cache->delete_value($dbtablename.'_list');
|
||||||
|
}
|
||||||
|
elseif ($type=='searchbox'){
|
||||||
|
$name = $_POST['name'];
|
||||||
|
$catsperrow = 0+$_POST['catsperrow'];
|
||||||
|
$catpadding = 0+$_POST['catpadding'];
|
||||||
|
if (!$name || !$catsperrow || !$catpadding)
|
||||||
|
stderr($lang_catmanage['std_error'], $lang_catmanage['std_missing_form_data']);
|
||||||
|
$showsource = 0+$_POST['showsource'];
|
||||||
|
$showmedium = 0+$_POST['showmedium'];
|
||||||
|
$showcodec = 0+$_POST['showcodec'];
|
||||||
|
$showstandard = 0+$_POST['showstandard'];
|
||||||
|
$showprocessing = 0+$_POST['showprocessing'];
|
||||||
|
$showteam = 0+$_POST['showteam'];
|
||||||
|
$showaudiocodec = 0+$_POST['showaudiocodec'];
|
||||||
|
$updateset[] = "catsperrow=".sqlesc($catsperrow);
|
||||||
|
$updateset[] = "catpadding=".sqlesc($catpadding);
|
||||||
|
$updateset[] = "name=".sqlesc($name);
|
||||||
|
$updateset[] = "showsource=".sqlesc($showsource);
|
||||||
|
$updateset[] = "showmedium=".sqlesc($showmedium);
|
||||||
|
$updateset[] = "showcodec=".sqlesc($showcodec);
|
||||||
|
$updateset[] = "showstandard=".sqlesc($showstandard);
|
||||||
|
$updateset[] = "showprocessing=".sqlesc($showprocessing);
|
||||||
|
$updateset[] = "showteam=".sqlesc($showteam);
|
||||||
|
$updateset[] = "showaudiocodec=".sqlesc($showaudiocodec);
|
||||||
|
if ($showsource || $showmedium || $showcodec || $showstandard || $showprocessing || $showteam || $showaudiocodec)
|
||||||
|
$updateset[] = "showsubcat=1";
|
||||||
|
else
|
||||||
|
$updateset[] = "showsubcat=0";
|
||||||
|
if($_POST['isedit'])
|
||||||
|
$Cache->delete_value('searchbox_content');
|
||||||
|
}
|
||||||
|
elseif ($type=='caticon'){
|
||||||
|
$name = $_POST['name'];
|
||||||
|
$folder = trim($_POST['folder']);
|
||||||
|
$cssfile = trim($_POST['cssfile']);
|
||||||
|
$multilang = ($_POST['multilang'] == 'yes' ? 'yes' : 'no');
|
||||||
|
$secondicon = ($_POST['secondicon'] == 'yes' ? 'yes' : 'no');
|
||||||
|
$designer = $_POST['designer'];
|
||||||
|
$comment = $_POST['comment'];
|
||||||
|
if (!$name || !$folder)
|
||||||
|
stderr($lang_catmanage['std_error'], $lang_catmanage['std_missing_form_data']);
|
||||||
|
if (!valid_file_name($folder))
|
||||||
|
stderr($lang_catmanage['std_error'], $lang_catmanage['std_invalid_character_in_filename'].htmlspecialchars($folder));
|
||||||
|
if ($cssfile && !valid_file_name($cssfile))
|
||||||
|
stderr($lang_catmanage['std_error'], $lang_catmanage['std_invalid_character_in_filename'].htmlspecialchars($cssfile));
|
||||||
|
$updateset[] = "name=".sqlesc($name);
|
||||||
|
$updateset[] = "folder=".sqlesc($folder);
|
||||||
|
$updateset[] = "multilang=".sqlesc($multilang);
|
||||||
|
$updateset[] = "secondicon=".sqlesc($secondicon);
|
||||||
|
$updateset[] = "cssfile=".sqlesc($cssfile);
|
||||||
|
$updateset[] = "designer=".sqlesc($designer);
|
||||||
|
$updateset[] = "comment=".sqlesc($comment);
|
||||||
|
if($_POST['isedit'])
|
||||||
|
$Cache->delete_value('category_icon_content');
|
||||||
|
}
|
||||||
|
elseif ($type=='secondicon'){
|
||||||
|
$name = $_POST['name'];
|
||||||
|
$image = trim($_POST['image']);
|
||||||
|
$class_name = trim($_POST['class_name']);
|
||||||
|
$source = 0+$_POST['source'];
|
||||||
|
$medium = 0+$_POST['medium'];
|
||||||
|
$codec = 0+$_POST['codec'];
|
||||||
|
$standard = 0+$_POST['standard'];
|
||||||
|
$processing = 0+$_POST['processing'];
|
||||||
|
$team = 0+$_POST['team'];
|
||||||
|
$audiocodec = 0+$_POST['audiocodec'];
|
||||||
|
if (!$name || !$image)
|
||||||
|
stderr($lang_catmanage['std_error'], $lang_catmanage['std_missing_form_data']);
|
||||||
|
if (!valid_file_name($image))
|
||||||
|
stderr($lang_catmanage['std_error'], $lang_catmanage['std_invalid_character_in_filename'].htmlspecialchars($image));
|
||||||
|
if ($class_name && !valid_class_name($class_name))
|
||||||
|
stderr($lang_catmanage['std_error'], $lang_catmanage['std_invalid_character_in_filename'].htmlspecialchars($class_name));
|
||||||
|
if (!$source && !$medium && !$codec && !$standard && !$processing && !$team && !$audiocodec)
|
||||||
|
stderr($lang_catmanage['std_error'], $lang_catmanage['std_must_define_one_selection']);
|
||||||
|
$updateset[] = "name=".sqlesc($name);
|
||||||
|
$updateset[] = "image=".sqlesc($image);
|
||||||
|
$updateset[] = "class_name=".sqlesc($class_name);
|
||||||
|
$updateset[] = "medium=".sqlesc($medium);
|
||||||
|
$updateset[] = "codec=".sqlesc($codec);
|
||||||
|
$updateset[] = "standard=".sqlesc($standard);
|
||||||
|
$updateset[] = "processing=".sqlesc($processing);
|
||||||
|
$updateset[] = "team=".sqlesc($team);
|
||||||
|
$updateset[] = "audiocodec=".sqlesc($audiocodec);
|
||||||
|
if($_POST['isedit']){
|
||||||
|
$res2=sql_query("SELECT * FROM secondicons WHERE id=".sqlesc($id)." LIMIT 1");
|
||||||
|
if ($row2=mysql_fetch_array($res))
|
||||||
|
{
|
||||||
|
$Cache->delete_value('secondicon_'.$row2['source'].'_'.$row2['medium'].'_'.$row2['codec'].'_'.$row2['standard'].'_'.$row2['processing'].'_'.$row2['team'].'_'.$row2['audiocodec'].'_content');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$Cache->delete_value('secondicon_'.$source.'_'.$medium.'_'.$codec.'_'.$standard.'_'.$processing.'_'.$team.'_'.$audiocodec.'_content');
|
||||||
|
}
|
||||||
|
elseif ($type=='category'){
|
||||||
|
$name = $_POST['name'];
|
||||||
|
$image = trim($_POST['image']);
|
||||||
|
$mode = 0+$_POST['mode'];
|
||||||
|
$class_name = trim($_POST['class_name']);
|
||||||
|
$sort_index = 0+$_POST['sort_index'];
|
||||||
|
if (!$name || !$image)
|
||||||
|
stderr($lang_catmanage['std_error'], $lang_catmanage['std_missing_form_data']);
|
||||||
|
if (!valid_file_name($image))
|
||||||
|
stderr($lang_catmanage['std_error'], $lang_catmanage['std_invalid_character_in_filename'].htmlspecialchars($image));
|
||||||
|
if ($class_name && !valid_class_name($class_name))
|
||||||
|
stderr($lang_catmanage['std_error'], $lang_catmanage['std_invalid_character_in_filename'].htmlspecialchars($class_name));
|
||||||
|
if (!$mode)
|
||||||
|
stderr($lang_catmanage['std_error'], $lang_catmanage['std_invalid_mode_id']);
|
||||||
|
$updateset[] = "name=".sqlesc($name);
|
||||||
|
$updateset[] = "image=".sqlesc($image);
|
||||||
|
$updateset[] = "mode=".sqlesc($mode);
|
||||||
|
$updateset[] = "class_name=".sqlesc($class_name);
|
||||||
|
$updateset[] = "sort_index=".sqlesc($sort_index);
|
||||||
|
if($_POST['isedit']){
|
||||||
|
$Cache->delete_value('category_content');
|
||||||
|
}
|
||||||
|
$Cache->delete_value('category_list_mode_'.$mode);
|
||||||
|
}
|
||||||
|
if ($_POST['isedit'])
|
||||||
|
{
|
||||||
|
sql_query("UPDATE ".$dbtablename." SET " . join(",", $updateset) . " WHERE id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sql_query("INSERT INTO ".$dbtablename." SET " . join(",", $updateset) ) or sqlerr(__FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
header("Location: ".get_protocol_prefix() . $BASEURL."/catmanage.php?action=view&type=".$type);
|
||||||
|
}
|
||||||
|
?>
|
||||||
129
cc98bar.php
Normal file
129
cc98bar.php
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
<?php
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
$pattern = "/.*cc98bar\.php\/(nn([0,1]{1}))?(nr([0-9]+))?(ng([0-9]+))?(nb([0-9]+))?(ns([1-5]{1}))?(nx([0-9]+))?(ny([0-9]+))?(nu([0,1]{1}))?(ur([0-9]+))?(ug([0-9]+))?(ub([0-9]+))?(us([1-5]{1}))?(ux([0-9]+))?(uy([0-9]+))?(nd([0,1]{1}))?(dr([0-9]+))?(dg([0-9]+))?(db([0-9]+))?(ds([1-5]{1}))?(dx([0-9]+))?(dy([0-9]+))?(bg([0-9]+))?id([0-9]+)\.png$/i";
|
||||||
|
if (!preg_match($pattern, $_SERVER['REQUEST_URI'])){
|
||||||
|
echo "Error! Invalid URL format.";
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
if (!$my_img = $Cache->get_value('userbar_'.$_SERVER['REQUEST_URI'])){
|
||||||
|
$nn = preg_replace($pattern, "\\2", $_SERVER['REQUEST_URI']);
|
||||||
|
$nr = preg_replace($pattern, "\\4", $_SERVER['REQUEST_URI']);
|
||||||
|
$ng = preg_replace($pattern, "\\6", $_SERVER['REQUEST_URI']);
|
||||||
|
$nb = preg_replace($pattern, "\\8", $_SERVER['REQUEST_URI']);
|
||||||
|
$ns = preg_replace($pattern, "\\10", $_SERVER['REQUEST_URI']);
|
||||||
|
$nx = preg_replace($pattern, "\\12", $_SERVER['REQUEST_URI']);
|
||||||
|
$ny = preg_replace($pattern, "\\14", $_SERVER['REQUEST_URI']);
|
||||||
|
$nu = preg_replace($pattern, "\\16", $_SERVER['REQUEST_URI']);
|
||||||
|
$ur = preg_replace($pattern, "\\18", $_SERVER['REQUEST_URI']);
|
||||||
|
$ug = preg_replace($pattern, "\\20", $_SERVER['REQUEST_URI']);
|
||||||
|
$ub = preg_replace($pattern, "\\22", $_SERVER['REQUEST_URI']);
|
||||||
|
$us = preg_replace($pattern, "\\24", $_SERVER['REQUEST_URI']);
|
||||||
|
$ux = preg_replace($pattern, "\\26", $_SERVER['REQUEST_URI']);
|
||||||
|
$uy = preg_replace($pattern, "\\28", $_SERVER['REQUEST_URI']);
|
||||||
|
$nd = preg_replace($pattern, "\\30", $_SERVER['REQUEST_URI']);
|
||||||
|
$dr = preg_replace($pattern, "\\32", $_SERVER['REQUEST_URI']);
|
||||||
|
$dg = preg_replace($pattern, "\\34", $_SERVER['REQUEST_URI']);
|
||||||
|
$db = preg_replace($pattern, "\\36", $_SERVER['REQUEST_URI']);
|
||||||
|
$ds = preg_replace($pattern, "\\38", $_SERVER['REQUEST_URI']);
|
||||||
|
$dx = preg_replace($pattern, "\\40", $_SERVER['REQUEST_URI']);
|
||||||
|
$dy = preg_replace($pattern, "\\42", $_SERVER['REQUEST_URI']);
|
||||||
|
$bg = 0 + preg_replace($pattern, "\\44", $_SERVER['REQUEST_URI']);
|
||||||
|
$id = preg_replace($pattern, "\\45", $_SERVER['REQUEST_URI']);
|
||||||
|
|
||||||
|
$res = sql_query("SELECT username, uploaded, downloaded, class, privacy FROM users WHERE id=".sqlesc($id)." LIMIT 1");
|
||||||
|
$row = mysql_fetch_array($res);
|
||||||
|
if (!$row)
|
||||||
|
die;
|
||||||
|
elseif($row['privacy'] == 'strong')
|
||||||
|
die;
|
||||||
|
elseif($row['class'] < $userbar_class)
|
||||||
|
die;
|
||||||
|
else{
|
||||||
|
$username = $row['username'];
|
||||||
|
$uploaded = mksize($row['uploaded']);
|
||||||
|
$downloaded = mksize($row['downloaded']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$my_img=imagecreatefrompng("pic/userbar/".$bg.".png");
|
||||||
|
imagealphablending($my_img, false);
|
||||||
|
|
||||||
|
if (!$nn)
|
||||||
|
{
|
||||||
|
if ($nr != "" && $nr >=0 && $nr <=255)
|
||||||
|
$namered = $nr;
|
||||||
|
else $namered=255;
|
||||||
|
if ($ng != "" && $ng >=0 && $ng <=255)
|
||||||
|
$namegreen = $ng;
|
||||||
|
else $namegreen=255;
|
||||||
|
if ($nb != "" && $nb >=0 && $nb <=255)
|
||||||
|
$nameblue = $nb;
|
||||||
|
else $nameblue=255;
|
||||||
|
if ($ns != "" && $ns >=1 && $ns <=5)
|
||||||
|
$namesize = $ns;
|
||||||
|
else $namesize=3;
|
||||||
|
if ($nx != "" && $nx >=0 && $nx <=350)
|
||||||
|
$namex = $nx;
|
||||||
|
else $namex=10;
|
||||||
|
if ($ny != "" && $ny >=0 && $ny <=19)
|
||||||
|
$namey = $ny;
|
||||||
|
else $namey=3;
|
||||||
|
$name_colour = imagecolorallocate($my_img, $namered, $namegreen, $nameblue);
|
||||||
|
imagestring($my_img, $namesize, $namex, $namey, $username, $name_colour);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$nu)
|
||||||
|
{
|
||||||
|
if ($ur != "" && $ur >=0 && $ur <=255)
|
||||||
|
$upred = $ur;
|
||||||
|
else $upred=0;
|
||||||
|
if ($ug != "" && $ug >=0 && $ug <=255)
|
||||||
|
$upgreen = $ug;
|
||||||
|
else $upgreen=255;
|
||||||
|
if ($ub != "" && $ub >=0 && $ub <=255)
|
||||||
|
$upblue = $ub;
|
||||||
|
else $upblue=0;
|
||||||
|
if ($us != "" && $us >=1 && $us <=5)
|
||||||
|
$upsize = $us;
|
||||||
|
else $upsize=3;
|
||||||
|
if ($ux != "" && $ux >=0 && $ux <=350)
|
||||||
|
$upx = $ux;
|
||||||
|
else $upx=100;
|
||||||
|
if ($uy != "" && $uy >=0 && $uy <=19)
|
||||||
|
$upy = $uy;
|
||||||
|
else $upy=3;
|
||||||
|
$up_colour = imagecolorallocate($my_img, $upred, $upgreen, $upblue);
|
||||||
|
imagestring($my_img, $upsize, $upx, $upy, $uploaded, $up_colour);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$nd)
|
||||||
|
{
|
||||||
|
if ($dr != "" && $dr >=0 && $dr <=255)
|
||||||
|
$downred = $dr;
|
||||||
|
else $downred=255;
|
||||||
|
if ($dg != "" && $dg >=0 && $dg <=255)
|
||||||
|
$downgreen = $dg;
|
||||||
|
else $downgreen=0;
|
||||||
|
if ($dg != "" && $db >=0 && $db <=255)
|
||||||
|
$downblue = $db;
|
||||||
|
else $downblue=0;
|
||||||
|
if ($ds != "" && $ds >=1 && $ds <=5)
|
||||||
|
$downsize = $ds;
|
||||||
|
else $downsize=3;
|
||||||
|
if ($dx != "" && $dx >=0 && $dx <=350)
|
||||||
|
$downx = $dx;
|
||||||
|
else $downx=180;
|
||||||
|
if ($dy != "" && $dy >=0 && $dy <=19)
|
||||||
|
$downy = $dy;
|
||||||
|
else $downy=3;
|
||||||
|
$down_colour = imagecolorallocate($my_img, $downred, $downgreen, $downblue);
|
||||||
|
imagestring($my_img, $downsize, $downx, $downy, $downloaded, $down_colour);
|
||||||
|
}
|
||||||
|
imagesavealpha($my_img, true);
|
||||||
|
$Cache->cache_value('userbar_'.$_SERVER['REQUEST_URI'], $my_img, 300);
|
||||||
|
}
|
||||||
|
header("Content-type: image/png");
|
||||||
|
imagepng($my_img);
|
||||||
|
imagedestroy($my_img);
|
||||||
|
?>
|
||||||
|
|
||||||
72
cheaterbox.php
Normal file
72
cheaterbox.php
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
<?php
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
require_once(get_langfile_path());
|
||||||
|
loggedinorreturn();
|
||||||
|
parked();
|
||||||
|
|
||||||
|
if (get_user_class() < $staffmem_class)
|
||||||
|
permissiondenied();
|
||||||
|
|
||||||
|
|
||||||
|
if ($_POST['setdealt']){
|
||||||
|
$res = sql_query ("SELECT id FROM cheaters WHERE dealtwith=0 AND id IN (" . implode(", ", $_POST[delcheater]) . ")");
|
||||||
|
while ($arr = mysql_fetch_assoc($res))
|
||||||
|
sql_query ("UPDATE cheaters SET dealtwith=1, dealtby = $CURUSER[id] WHERE id = $arr[id]") or sqlerr();
|
||||||
|
$Cache->delete_value('staff_new_cheater_count');
|
||||||
|
}
|
||||||
|
elseif ($_POST['delete']){
|
||||||
|
$res = sql_query ("SELECT id FROM cheaters WHERE id IN (" . implode(", ", $_POST[delcheater]) . ")");
|
||||||
|
while ($arr = mysql_fetch_assoc($res))
|
||||||
|
sql_query ("DELETE from cheaters WHERE id = $arr[id]") or sqlerr();
|
||||||
|
$Cache->delete_value('staff_new_cheater_count');
|
||||||
|
}
|
||||||
|
|
||||||
|
$count = get_row_count("cheaters");
|
||||||
|
if (!$count){
|
||||||
|
stderr($lang_cheaterbox['std_oho'], $lang_cheaterbox['std_no_suspect_detected']);
|
||||||
|
}
|
||||||
|
$perpage = 10;
|
||||||
|
list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, "cheaterbox.php?");
|
||||||
|
stdhead($lang_cheaterbox['head_cheaterbox']);
|
||||||
|
?>
|
||||||
|
<style type="text/css">
|
||||||
|
table.cheaterbox td
|
||||||
|
{
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<?php
|
||||||
|
begin_main_frame();
|
||||||
|
print("<h1 align=center>".$lang_cheaterbox['text_cheaterbox']."</h1>");
|
||||||
|
print("<table class=cheaterbox border=1 cellspacing=0 cellpadding=5 align=center>\n");
|
||||||
|
print("<tr><td class=colhead><nobr>".$lang_cheaterbox['col_added']."</nobr></td><td class=colhead>".$lang_cheaterbox['col_suspect']."</td><td class=colhead><nobr>".$lang_cheaterbox['col_hit']."</nobr></td><td class=colhead>".$lang_cheaterbox['col_torrent']."</td><td class=colhead>".$lang_cheaterbox['col_ul']."</td><td class=colhead>".$lang_cheaterbox['col_dl']."</td><td class=colhead><nobr>".$lang_cheaterbox['col_ann_time']."</nobr></td><td class=colhead><nobr>".$lang_cheaterbox['col_seeders']."</nobr></td><td class=colhead><nobr>".$lang_cheaterbox['col_leechers']."</nobr></td><td class=colhead>".$lang_cheaterbox['col_comment']."</td><td class=colhead><nobr>".$lang_cheaterbox['col_dealt_with']."</nobr></td><td class=colhead><nobr>".$lang_cheaterbox['col_action']."</nobr></td></tr>");
|
||||||
|
|
||||||
|
print("<form method=post action=cheaterbox.php>");
|
||||||
|
$cheatersres = sql_query("SELECT * FROM cheaters ORDER BY dealtwith ASC, id DESC $limit");
|
||||||
|
|
||||||
|
while ($row = mysql_fetch_array($cheatersres))
|
||||||
|
{
|
||||||
|
$upspeed = ($row['uploaded'] > 0 ? $row['uploaded'] / $row['anctime'] : 0);
|
||||||
|
$lespeed = ($row['downloaded'] > 0 ? $row['downloaded'] / $row['anctime'] : 0);
|
||||||
|
$torrentres = sql_query("SELECT name FROM torrents WHERE id=".sqlesc($row['torrentid']));
|
||||||
|
$torrentrow = mysql_fetch_array($torrentres);
|
||||||
|
if ($torrentrow)
|
||||||
|
$torrent = "<a href=details.php?id=".$row['torrentid'].">".htmlspecialchars($torrentrow['name'])."</a>";
|
||||||
|
else $torrent = $lang_cheaterbox['text_torrent_does_not_exist'];
|
||||||
|
if ($row['dealtwith'])
|
||||||
|
$dealtwith = "<font color=green>".$lang_cheaterbox['text_yes']."</font> - " . get_username($row['dealtby']);
|
||||||
|
else
|
||||||
|
$dealtwith = "<font color=red>".$lang_cheaterbox['text_no']."</font>";
|
||||||
|
|
||||||
|
print("<tr><td class=rowfollow>".gettime($row['added'])."</td><td class=rowfollow>" . get_username($row['userid']) . "</td><td class=rowfollow>" . $row['hit'] . "</td><td class=rowfollow>" . $torrent . "</td><td class=rowfollow>".mksize($row['uploaded']).($upspeed ? " @ ".mksize($upspeed)."/s" : "")."</td><td class=rowfollow>".mksize($row['downloaded']).($lespeed ? " @ ".mksize($lespeed)."/s" : "")."</td><td class=rowfollow>".$row['anctime']." sec"."</td><td class=rowfollow>".$row['seeders']."</td><td class=rowfollow>".$row['leechers']."</td><td class=rowfollow>".htmlspecialchars($row['comment'])."</td><td class=rowfollow>".$dealtwith."</td><td class=rowfollow><input type=\"checkbox\" name=\"delcheater[]\" value=\"" . $row[id] . "\" /></td></tr>\n");
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<tr><td class="colhead" colspan="12" style="text-align: right"><input type="submit" name="setdealt" value="<?php echo $lang_cheaterbox['submit_set_dealt']?>" /><input type="submit" name="delete" value="<?php echo $lang_cheaterbox['submit_delete']?>" /></td></tr>
|
||||||
|
</form>
|
||||||
|
<?php
|
||||||
|
print("</table>");
|
||||||
|
print($pagerbottom);
|
||||||
|
end_main_frame();
|
||||||
|
stdfoot();
|
||||||
|
?>
|
||||||
111
cheaters.php
Normal file
111
cheaters.php
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
<?php
|
||||||
|
// mod_cheat for torrentbits based tracker
|
||||||
|
// Copy this file to the same dir as the rest of the tracker stuff...
|
||||||
|
|
||||||
|
$top = 100; // Only look at the top xxx most likely...
|
||||||
|
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
|
||||||
|
dbconn();
|
||||||
|
|
||||||
|
loggedinorreturn();
|
||||||
|
|
||||||
|
if (get_user_class() < UC_MODERATOR) stderr("Error", "Permission denied.");
|
||||||
|
|
||||||
|
stdhead("Cheaters");
|
||||||
|
begin_frame('Cheaters');
|
||||||
|
|
||||||
|
$page = @$_GET['page'];
|
||||||
|
//$perpage = 100; // currently ignored
|
||||||
|
|
||||||
|
$class = @$_GET['c'];
|
||||||
|
if (!is_valid_user_class($class-2)) $class = '';
|
||||||
|
|
||||||
|
$ratio = @$_GET['r'];
|
||||||
|
if (!is_valid_id($ratio) && $ratio>=1 && $ratio<=7) $ratio = '';
|
||||||
|
|
||||||
|
echo '<center><form method="get" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
|
begin_table();
|
||||||
|
|
||||||
|
echo '<tr><th colspan="4">Important</th></tr><tr><td colspan="4" class="left">';
|
||||||
|
echo 'Although the word <b>cheat</b> is used here, it should be kept in mind that this<br />';
|
||||||
|
echo 'is statistical analysis - "There are lies, damm lies, and statistics!"<br />';
|
||||||
|
echo 'The value for cheating can and will change quite drastically depending on what<br />';
|
||||||
|
echo 'is happening, so you should always take into account other factors before<br />';
|
||||||
|
echo 'issueing a warning.<br />';
|
||||||
|
echo 'Somebody might get quite a high cheat value, but never cheat in their life - simply<br />';
|
||||||
|
echo 'from bad luck in when the client updates the tracker - but that will drop again in<br />';
|
||||||
|
echo 'the future. A true cheater will stay consistantly high...';
|
||||||
|
echo '</td></tr>';
|
||||||
|
echo '<tr><th>Class:</th>';
|
||||||
|
echo '<td><select name="c"><option value="1">(any)</option>';
|
||||||
|
for ($i = 2; ;++$i)
|
||||||
|
{
|
||||||
|
if ($c = get_user_class_name($i-2)) echo '<option value="'.$i.'"'.($class == $i? ' selected' : '')."><= $c</option>\n";
|
||||||
|
else break;
|
||||||
|
}
|
||||||
|
echo '</select></td>';
|
||||||
|
|
||||||
|
echo '<th>Ratio:</th>';
|
||||||
|
echo '<td><select name="r"><option value="1"'.($ratio == 1?' selected' : '').'>(any)</option>';
|
||||||
|
echo '<option value="2"'.($ratio == 2?' selected' : '').'>>= 1.000</option>';
|
||||||
|
echo '<option value="3"'.($ratio == 3?' selected' : '').'>>= 2.000</option>';
|
||||||
|
echo '<option value="4"'.($ratio == 4?' selected' : '').'>>= 3.000</option>';
|
||||||
|
echo '<option value="5"'.($ratio == 5?' selected' : '').'>>= 4.000</option>';
|
||||||
|
echo '<option value="6"'.($ratio == 6?' selected' : '').'>>= 5.000</option>';
|
||||||
|
echo '</select></td>';
|
||||||
|
|
||||||
|
echo '</tr><tr><td colspan="4"><input name="submit" type="submit"></td></tr>';
|
||||||
|
end_table();
|
||||||
|
echo '</form>';
|
||||||
|
|
||||||
|
$query = 'WHERE enabled = 1 AND downloaded > 0 AND uploaded > 0';
|
||||||
|
//' AND cheat >= '.$min
|
||||||
|
if ($class>2) $query .= ' AND class < '.($class - 1);
|
||||||
|
if ($ratio>1) $query .= ' AND (uploaded / downloaded) > '.($ratio - 1);
|
||||||
|
|
||||||
|
$res = sql_query("SELECT COUNT(*),MIN(cheat),MAX(cheat) FROM users $query") or sqlerr();
|
||||||
|
$arr = mysql_fetch_row($res);
|
||||||
|
$top = MIN($top, $arr[0]);
|
||||||
|
$min = $arr[1];
|
||||||
|
$max = $arr[2];
|
||||||
|
|
||||||
|
$pages = ceil($top / 20);
|
||||||
|
if ($page < 1) $page = 1;
|
||||||
|
elseif ($page > $pages) $page = $pages;
|
||||||
|
|
||||||
|
list($pagertop, $pagerbottom, $limit) = pager(20, $top, "cheaters.php?");
|
||||||
|
|
||||||
|
echo $pagertop;
|
||||||
|
begin_table();
|
||||||
|
print("<tr><th class=\"left\">User name</th><th>Registered</th><th>Uploaded</th><th>Downloaded</th><th>Ratio</th><th>Cheat Value</th><th>Cheat Spread</th></tr>\n");
|
||||||
|
|
||||||
|
$res = sql_query("SELECT * FROM users $query ORDER BY cheat DESC $limit") or sqlerr();
|
||||||
|
while ($arr = mysql_fetch_assoc($res))
|
||||||
|
{
|
||||||
|
if ($arr['added'] == "0000-00-00 00:00:00") $joindate = 'N/A';
|
||||||
|
else $joindate = get_elapsed_time(strtotime($arr['added'])).' ago';
|
||||||
|
$age = date('U') - date('U',strtotime($arr['added']));
|
||||||
|
if ($arr["downloaded"] > 0)
|
||||||
|
{
|
||||||
|
$ratio = number_format($arr["uploaded"] / $arr["downloaded"], 3);
|
||||||
|
$ratio = "<font color=" . get_ratio_color($ratio) . ">$ratio</font>";
|
||||||
|
} else {
|
||||||
|
if ($arr["uploaded"] > 0) $ratio = "Inf.";
|
||||||
|
else $ratio = "---";
|
||||||
|
}
|
||||||
|
if ($arr['added'] == '0000-00-00 00:00:00') $arr['added'] = '-';
|
||||||
|
echo '<tr><th class="left"><a href="userdetails.php?id='.$arr['id'].'"><b>'.$arr['username'].'</b></a></th>';
|
||||||
|
echo '<td>'.$joindate.'</td>';
|
||||||
|
echo '<td class="right">'.mksize($arr['uploaded']).' @ '.mksize($arr['uploaded'] / $age).'ps</td>';
|
||||||
|
echo '<td class="right">'.mksize($arr['downloaded']).' @ '.mksize($arr['downloaded'] / $age).'ps</td>';
|
||||||
|
echo '<td>'.$ratio.'</td>';
|
||||||
|
echo '<td>'.$arr['cheat'].'</td>';
|
||||||
|
echo '<td class="right">'.ceil(($arr['cheat'] - $min) / max(1, ($max - $min)) * 100).'%</td></tr>'."\n";
|
||||||
|
}
|
||||||
|
end_table();
|
||||||
|
echo $pagerbottom;
|
||||||
|
end_frame();
|
||||||
|
|
||||||
|
stdfoot();
|
||||||
|
?>
|
||||||
62
checkuser.php
Normal file
62
checkuser.php
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
<?php
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
require_once(get_langfile_path());
|
||||||
|
loggedinorreturn();
|
||||||
|
parked();
|
||||||
|
$id = 0 + $_GET["id"];
|
||||||
|
int_check($id,true);
|
||||||
|
function bark($msg)
|
||||||
|
{
|
||||||
|
global $lang_checkuser;
|
||||||
|
stdhead();
|
||||||
|
stdmsg($lang_checkuser['std_error'], $msg);
|
||||||
|
stdfoot();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$r = @sql_query("SELECT * FROM users WHERE status = 'pending' AND id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
|
||||||
|
$user = mysql_fetch_array($r) or bark($lang_checkuser['std_no_user_id']);
|
||||||
|
|
||||||
|
if (get_user_class() < UC_MODERATOR) {
|
||||||
|
if ($user[invited_by] != $CURUSER[id])
|
||||||
|
bark($lang_checkuser['std_no_permission']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($user["gender"] == "Male") $gender = "<img src=pic/male.png alt='Male' style='margin-left: 4pt'>";
|
||||||
|
elseif ($user["gender"] == "Female") $gender = "<img src=pic/female.png alt='Female' style='margin-left: 4pt'>";
|
||||||
|
elseif ($user["gender"] == "N/A") $gender = "<img src=pic/na.gif alt='N/A' style='margin-left: 4pt'>";
|
||||||
|
|
||||||
|
if ($user[added] == "0000-00-00 00:00:00")
|
||||||
|
$joindate = 'N/A';
|
||||||
|
else
|
||||||
|
$joindate = "$user[added] (" . get_elapsed_time(strtotime($user["added"])) . " ago)";
|
||||||
|
|
||||||
|
$res = sql_query("SELECT name,flagpic FROM countries WHERE id=$user[country] LIMIT 1") or sqlerr();
|
||||||
|
if (mysql_num_rows($res) == 1)
|
||||||
|
{
|
||||||
|
$arr = mysql_fetch_assoc($res);
|
||||||
|
$country = "<td class=embedded><img src=pic/flag/$arr[flagpic] alt=\"$arr[name]\" style='margin-left: 8pt'></td>";
|
||||||
|
}
|
||||||
|
|
||||||
|
stdhead($lang_checkuser['head_detail_for'] . $user["username"]);
|
||||||
|
|
||||||
|
$enabled = $user["enabled"] == 'yes';
|
||||||
|
print("<p><table class=main border=0 cellspacing=0 cellpadding=0>".
|
||||||
|
"<tr><td class=embedded><h1 style='margin:0px'>" . get_username($user['id'], true, false) . "</h1></td>$country</tr></table></p><br />\n");
|
||||||
|
|
||||||
|
if (!$enabled)
|
||||||
|
print($lang_checkuser['text_account_disabled']);
|
||||||
|
?>
|
||||||
|
<table width=737 border=1 cellspacing=0 cellpadding=5>
|
||||||
|
<tr><td class=rowhead width=1%><?php echo $lang_checkuser['row_join_date'] ?></td><td align=left width=99%><?php echo $joindate;?></td></tr>
|
||||||
|
<tr><td class=rowhead width=1%><?php echo $lang_checkuser['row_gender'] ?></td><td align=left width=99%><?php echo $gender;?></td></tr>
|
||||||
|
<tr><td class=rowhead width=1%><?php echo $lang_checkuser['row_email'] ?></td><td align=left width=99%><a href=mailto:<?php echo $user[email];?>><?php echo $user[email];?></a></td></tr>
|
||||||
|
<?php
|
||||||
|
if (get_user_class() >= UC_MODERATOR AND $user[ip] != '')
|
||||||
|
print ("<tr><td class=rowhead width=1%>".$lang_checkuser['row_ip']."</td><td align=left width=99%>$user[ip]</td></tr>");
|
||||||
|
print("<form method=post action=takeconfirm.php?id=".htmlspecialchars($id).">");
|
||||||
|
print("<input type=hidden name=email value=$user[email]>");
|
||||||
|
print("<tr><td class=rowhead width=1%><input type=\"checkbox\" name=\"conusr[]\" value=\"" . $id . "\" checked/></td>");
|
||||||
|
print("<td align=left width=99%><input type=submit style='height: 20px' value=\"".$lang_checkuser['submit_confirm_this_user'] ."\"></form></tr></td></table>");
|
||||||
|
stdfoot();
|
||||||
3
classes/.htaccess
Normal file
3
classes/.htaccess
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
Options -Indexes
|
||||||
|
Order allow,deny
|
||||||
|
Deny from all
|
||||||
81
classes/class_advertisement.php
Normal file
81
classes/class_advertisement.php
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
<?php
|
||||||
|
class ADVERTISEMENT{
|
||||||
|
var $userid;
|
||||||
|
var $showad;
|
||||||
|
var $userrow = array();
|
||||||
|
var $adrow = array();
|
||||||
|
|
||||||
|
function __construct($userid) {
|
||||||
|
$this->userid = $userid;
|
||||||
|
$this->set_userrow();
|
||||||
|
$this->set_showad();
|
||||||
|
$this->set_adrow();
|
||||||
|
}
|
||||||
|
|
||||||
|
function set_userrow()
|
||||||
|
{
|
||||||
|
$userid = $this->userid;
|
||||||
|
$row = get_user_row($userid);
|
||||||
|
$this->userrow = $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
function enable_ad()
|
||||||
|
{
|
||||||
|
global $enablead_advertisement;
|
||||||
|
if ($enablead_advertisement == 'yes')
|
||||||
|
return true;
|
||||||
|
else return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function show_ad()
|
||||||
|
{
|
||||||
|
if (!$this->enable_ad())
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($this->userrow['noad'] == 'yes')
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function set_showad()
|
||||||
|
{
|
||||||
|
$showad = $this->show_ad();
|
||||||
|
$this->showad = $showad;
|
||||||
|
}
|
||||||
|
|
||||||
|
function set_adrow()
|
||||||
|
{
|
||||||
|
global $Cache;
|
||||||
|
if (!$arr = $Cache->get_value('current_ad_array'))
|
||||||
|
{
|
||||||
|
$now = date("Y-m-d H:i:s");
|
||||||
|
$validpos = $this->get_validpos();
|
||||||
|
foreach ($validpos as $pos)
|
||||||
|
{
|
||||||
|
$res = sql_query("SELECT code FROM advertisements WHERE enabled=1 AND position=".sqlesc($pos)." AND (starttime IS NULL OR starttime < ".sqlesc($now).") AND (endtime IS NULL OR endtime > ".sqlesc($now).") ORDER BY displayorder ASC, id DESC LIMIT 10") or sqlerr(__FILE__, __LINE__);
|
||||||
|
$adarray = array();
|
||||||
|
while($row = mysql_fetch_array($res))
|
||||||
|
$adarray[]=$row['code'];
|
||||||
|
$arr[$pos]=$adarray;
|
||||||
|
}
|
||||||
|
$Cache->cache_value('current_ad_array', $arr, 3600);
|
||||||
|
}
|
||||||
|
$this->adrow=$arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_validpos()
|
||||||
|
{
|
||||||
|
return array('header', 'footer', 'belownav', 'belowsearchbox', 'torrentdetail', 'comment', 'interoverforums', 'forumpost', 'popup');
|
||||||
|
}
|
||||||
|
function get_ad($pos)
|
||||||
|
{
|
||||||
|
$validpos = $this->get_validpos();
|
||||||
|
if (in_array($pos, $validpos) && $this->showad)
|
||||||
|
return $this->adrow[$pos];
|
||||||
|
else return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
189
classes/class_attachment.php
Normal file
189
classes/class_attachment.php
Normal file
@@ -0,0 +1,189 @@
|
|||||||
|
<?php
|
||||||
|
class ATTACHMENT{
|
||||||
|
var $userid;
|
||||||
|
var $class;
|
||||||
|
var $countlimit;
|
||||||
|
var $countsofar=0;
|
||||||
|
var $sizelimit;
|
||||||
|
var $allowedext = array();
|
||||||
|
|
||||||
|
function __construct($userid) {
|
||||||
|
$this->userid = $userid;
|
||||||
|
$this->set_class();
|
||||||
|
$this->set_count_so_far();
|
||||||
|
$this->set_count_limit();
|
||||||
|
$this->set_size_limit();
|
||||||
|
$this->set_allowed_ext();
|
||||||
|
}
|
||||||
|
|
||||||
|
function enable_attachment()
|
||||||
|
{
|
||||||
|
global $enableattach_attachment;
|
||||||
|
if ($enableattach_attachment == 'yes')
|
||||||
|
return true;
|
||||||
|
else return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function set_class()
|
||||||
|
{
|
||||||
|
$userid = $this->userid;
|
||||||
|
$row = get_user_row($userid);
|
||||||
|
$this->class = $row['class'];
|
||||||
|
}
|
||||||
|
|
||||||
|
function set_count_so_far()
|
||||||
|
{
|
||||||
|
$userid = $this->userid;
|
||||||
|
$now = date("Y-m-d H:i:s", TIMENOW-86400);
|
||||||
|
$countsofar = get_row_count("attachments", "WHERE userid=".sqlesc($userid)." AND added > ".sqlesc($now));
|
||||||
|
$this->countsofar = $countsofar;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_count_so_far()
|
||||||
|
{
|
||||||
|
return $this->countsofar;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_count_limit_class($class)
|
||||||
|
{
|
||||||
|
global $classone_attachment, $classtwo_attachment, $classthree_attachment, $classfour_attachment,$countone_attachment, $counttwo_attachment, $countthree_attachment, $countfour_attachment;
|
||||||
|
if ($class >= $classfour_attachment && $countfour_attachment)
|
||||||
|
return $countfour_attachment;
|
||||||
|
elseif ($class >= $classthree_attachment && $countthree_attachment)
|
||||||
|
return $countthree_attachment;
|
||||||
|
elseif ($class >= $classtwo_attachment && $counttwo_attachment)
|
||||||
|
return $counttwo_attachment;
|
||||||
|
elseif ($class >= $classone_attachment && $countone_attachment)
|
||||||
|
return $countone_attachment;
|
||||||
|
}
|
||||||
|
|
||||||
|
function set_count_limit()
|
||||||
|
{
|
||||||
|
$class = $this->class;
|
||||||
|
$countlimit = $this->get_count_limit_class($class);
|
||||||
|
$this->countlimit = $countlimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_count_limit()
|
||||||
|
{
|
||||||
|
return $this->countlimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_count_left()
|
||||||
|
{
|
||||||
|
$left = $this->countlimit - $this->countsofar;
|
||||||
|
return $left;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_size_limit_class($class)
|
||||||
|
{
|
||||||
|
global $classone_attachment, $classtwo_attachment, $classthree_attachment, $classfour_attachment,$sizeone_attachment, $sizetwo_attachment, $sizethree_attachment, $sizefour_attachment;
|
||||||
|
if ($class >= $classfour_attachment && $sizefour_attachment)
|
||||||
|
return $sizefour_attachment;
|
||||||
|
elseif ($class >= $classthree_attachment && $sizethree_attachment)
|
||||||
|
return $sizethree_attachment;
|
||||||
|
elseif ($class >= $classtwo_attachment && $sizetwo_attachment)
|
||||||
|
return $sizetwo_attachment;
|
||||||
|
elseif ($class >= $classone_attachment && $sizeone_attachment)
|
||||||
|
return $sizeone_attachment;
|
||||||
|
}
|
||||||
|
|
||||||
|
function set_size_limit()
|
||||||
|
{
|
||||||
|
$class = $this->class;
|
||||||
|
$sizelimit = $this->get_size_limit_class($class);
|
||||||
|
$this->sizelimit = $sizelimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_size_limit_kb()
|
||||||
|
{
|
||||||
|
return $this->sizelimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_size_limit_byte()
|
||||||
|
{
|
||||||
|
return $this->sizelimit * 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_allowed_ext_class($class)
|
||||||
|
{
|
||||||
|
global $classone_attachment, $classtwo_attachment, $classthree_attachment, $classfour_attachment,$extone_attachment, $exttwo_attachment, $extthree_attachment, $extfour_attachment;
|
||||||
|
$allowedext = array();
|
||||||
|
if ($class >= $classone_attachment){
|
||||||
|
$temprow = $this->extract_allowed_ext($extone_attachment);
|
||||||
|
if (count($temprow)){
|
||||||
|
foreach ($temprow as $temp){
|
||||||
|
$allowedext[] = $temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($class >= $classtwo_attachment){
|
||||||
|
$temprow = $this->extract_allowed_ext($exttwo_attachment);
|
||||||
|
if (count($temprow)){
|
||||||
|
foreach ($temprow as $temp){
|
||||||
|
$allowedext[] = $temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($class >= $classthree_attachment){
|
||||||
|
$temprow = $this->extract_allowed_ext($extthree_attachment);
|
||||||
|
if (count($temprow)){
|
||||||
|
foreach ($temprow as $temp){
|
||||||
|
$allowedext[] = $temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($class >= $classfour_attachment){
|
||||||
|
$temprow = $this->extract_allowed_ext($extfour_attachment);
|
||||||
|
if (count($temprow)){
|
||||||
|
foreach ($temprow as $temp){
|
||||||
|
$allowedext[] = $temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $allowedext;
|
||||||
|
}
|
||||||
|
|
||||||
|
function set_allowed_ext()
|
||||||
|
{
|
||||||
|
$class = $this->class;
|
||||||
|
$allowedext = $this->get_allowed_ext_class($class);
|
||||||
|
$this->allowedext = $allowedext;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_allowed_ext()
|
||||||
|
{
|
||||||
|
return $this->allowedext;
|
||||||
|
}
|
||||||
|
|
||||||
|
function extract_allowed_ext($string)
|
||||||
|
{
|
||||||
|
$string = rtrim(trim($string), ",");
|
||||||
|
$exts = explode(",", $string);
|
||||||
|
$extrow = array();
|
||||||
|
foreach ($exts as $ext){
|
||||||
|
$extrow[] = trim($ext);
|
||||||
|
}
|
||||||
|
return $extrow;
|
||||||
|
}
|
||||||
|
|
||||||
|
function is_gif_ani($filename) {
|
||||||
|
if(!($fh = @fopen($filename, 'rb')))
|
||||||
|
return false;
|
||||||
|
$count = 0;
|
||||||
|
//an animated gif contains multiple "frames", with each frame having a
|
||||||
|
//header made up of:
|
||||||
|
// * a static 4-byte sequence (\x00\x21\xF9\x04)
|
||||||
|
// * 4 variable bytes
|
||||||
|
// * a static 2-byte sequence (\x00\x2C)
|
||||||
|
|
||||||
|
// We read through the file til we reach the end of the file, or we've found
|
||||||
|
// at least 2 frame headers
|
||||||
|
while(!feof($fh) && $count < 2){
|
||||||
|
$chunk = fread($fh, 1024 * 100); //read 100kb at a time
|
||||||
|
$count += preg_match_all('#\x00\x21\xF9\x04.{4}\x00\x2C#s', $chunk, $matches);
|
||||||
|
}
|
||||||
|
return $count > 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
261
classes/class_cache.php
Normal file
261
classes/class_cache.php
Normal file
@@ -0,0 +1,261 @@
|
|||||||
|
<?php
|
||||||
|
//Caching class (Based on file From ProjectGazelle)
|
||||||
|
|
||||||
|
class CACHE extends Memcache{
|
||||||
|
var $isEnabled;
|
||||||
|
var $clearCache = 0;
|
||||||
|
var $language = 'en';
|
||||||
|
var $Page = array();
|
||||||
|
var $Row = 1;
|
||||||
|
var $Part = 0;
|
||||||
|
var $MemKey = "";
|
||||||
|
var $Duration = 0;
|
||||||
|
var $cacheReadTimes = 0;
|
||||||
|
var $cacheWriteTimes = 0;
|
||||||
|
var $keyHits = array();
|
||||||
|
var $languageFolderArray = array();
|
||||||
|
|
||||||
|
function __construct($host = 'localhost', $port = 11211) {
|
||||||
|
$success = $this->connect($host, $port); // Connect to memcache
|
||||||
|
if ($success) {
|
||||||
|
$this->isEnabled = 1;
|
||||||
|
} else {
|
||||||
|
$this->isEnabled = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getIsEnabled() {
|
||||||
|
return $this->isEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setClearCache($isEnabled) {
|
||||||
|
$this->clearCache = $isEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getLanguageFolderArray() {
|
||||||
|
return $this->languageFolderArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setLanguageFolderArray($languageFolderArray) {
|
||||||
|
$this->languageFolderArray = $languageFolderArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getClearCache() {
|
||||||
|
return $this->clearCache;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setLanguage($language) {
|
||||||
|
$this->language = $language;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getLanguage() {
|
||||||
|
return $this->language;
|
||||||
|
}
|
||||||
|
|
||||||
|
function new_page($MemKey = '', $Duration = 3600, $Lang = true) {
|
||||||
|
if ($Lang) {
|
||||||
|
$language = $this->getLanguage();
|
||||||
|
$this->MemKey = $language."_".$MemKey;
|
||||||
|
} else {
|
||||||
|
$this->MemKey = $MemKey;
|
||||||
|
}
|
||||||
|
$this->Duration = $Duration;
|
||||||
|
$this->Row = 1;
|
||||||
|
$this->Part = 0;
|
||||||
|
$this->Page = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
function set_key(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------- Adding functions ----------//
|
||||||
|
|
||||||
|
function add_row(){
|
||||||
|
$this->Part = 0;
|
||||||
|
$this->Page[$this->Row] = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
function end_row(){
|
||||||
|
$this->Row++;
|
||||||
|
}
|
||||||
|
|
||||||
|
function add_part(){
|
||||||
|
ob_start();
|
||||||
|
}
|
||||||
|
|
||||||
|
function end_part(){
|
||||||
|
$this->Page[$this->Row][$this->Part]=ob_get_clean();
|
||||||
|
$this->Part++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shorthand for:
|
||||||
|
// add_row();
|
||||||
|
// add_part();
|
||||||
|
// You should only use this function if the row is only going to have one part in it (convention),
|
||||||
|
// although it will theoretically work with multiple parts.
|
||||||
|
function add_whole_row(){
|
||||||
|
$this->Part = 0;
|
||||||
|
$this->Page[$this->Row] = array();
|
||||||
|
ob_start();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shorthand for:
|
||||||
|
// end_part();
|
||||||
|
// end_row();
|
||||||
|
// You should only use this function if the row is only going to have one part in it (convention),
|
||||||
|
// although it will theoretically work with multiple parts.
|
||||||
|
function end_whole_row(){
|
||||||
|
$this->Page[$this->Row][$this->Part]=ob_get_clean();
|
||||||
|
$this->Row++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set a variable that will only be availabe when the system is on its row
|
||||||
|
// This variable is stored in the same way as pages, so don't use an integer for the $Key.
|
||||||
|
function set_row_value($Key, $Value){
|
||||||
|
$this->Page[$this->Row][$Key] = $Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set a variable that will always be available, no matter what row the system is on.
|
||||||
|
// This variable is stored in the same way as rows, so don't use an integer for the $Key.
|
||||||
|
function set_constant_value($Key, $Value){
|
||||||
|
$this->Page[$Key] = $Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Inserts a 'false' value into a row, which breaks out of while loops.
|
||||||
|
// This is not necessary if the end of $this->Page is also the end of the while loop.
|
||||||
|
function break_loop(){
|
||||||
|
if(count($this->Page)>0){
|
||||||
|
$this->Page[$this->Row] = FALSE;
|
||||||
|
$this->Row++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------- Locking functions ----------//
|
||||||
|
|
||||||
|
// These functions 'lock' a key.
|
||||||
|
// Users cannot proceed until it is unlocked.
|
||||||
|
|
||||||
|
function lock($Key){
|
||||||
|
$this->cache_value('lock_'.$Key, 'true', 3600);
|
||||||
|
}
|
||||||
|
|
||||||
|
function unlock($Key) {
|
||||||
|
$this->delete('lock_'.$Key);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------- Caching functions ----------//
|
||||||
|
|
||||||
|
// Cache $this->Page and resets $this->Row and $this->Part
|
||||||
|
function cache_page(){
|
||||||
|
$this->cache_value($this->MemKey,$this->Page, $this->Duration);
|
||||||
|
$this->Row = 0;
|
||||||
|
$this->Part = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exact same as cache_page, but does not store the page in cache
|
||||||
|
// This is so that we can use classes that normally cache values in
|
||||||
|
// situations where caching is not required
|
||||||
|
function setup_page(){
|
||||||
|
$this->Row = 0;
|
||||||
|
$this->Part = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrapper for Memcache::set, with the zlib option removed and default duration of 1 hour
|
||||||
|
function cache_value($Key, $Value, $Duration = 3600){
|
||||||
|
$this->set($Key,$Value, 0, $Duration);
|
||||||
|
$this->cacheWriteTimes++;
|
||||||
|
$this->keyHits['write'][$Key] = !$this->keyHits['write'][$Key] ? 1 : $this->keyHits['write'][$Key]+1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------- Getting functions ----------//
|
||||||
|
|
||||||
|
// Returns the next row in the page
|
||||||
|
// If there's only one part in the row, return that part.
|
||||||
|
function next_row(){
|
||||||
|
$this->Row++;
|
||||||
|
$this->Part = 0;
|
||||||
|
if($this->Page[$this->Row] == false){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
elseif(count($this->Page[$this->Row]) == 1){
|
||||||
|
return $this->Page[$this->Row][0];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return $this->Page[$this->Row];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns the next part in the row
|
||||||
|
function next_part(){
|
||||||
|
$Return = $this->Page[$this->Row][$this->Part];
|
||||||
|
$this->Part++;
|
||||||
|
return $Return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns a 'row value' (a variable that changes for each row - see above).
|
||||||
|
function get_row_value($Key){
|
||||||
|
return $this->Page[$this->Row][$Key];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns a 'constant value' (a variable that doesn't change with the rows - see above)
|
||||||
|
function get_constant_value($Key){
|
||||||
|
return $this->Page[$Key];
|
||||||
|
}
|
||||||
|
|
||||||
|
// If a cached version of the page exists, set $this->Page to it and return true.
|
||||||
|
// Otherwise, return false.
|
||||||
|
function get_page(){
|
||||||
|
$Result = $this->get_value($this->MemKey);
|
||||||
|
if($Result){
|
||||||
|
$this->Row = 0;
|
||||||
|
$this->Part = 0;
|
||||||
|
$this->Page = $Result;
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrapper for Memcache::get. Why? Because wrappers are cool.
|
||||||
|
function get_value($Key) {
|
||||||
|
if($this->getClearCache()){
|
||||||
|
$this->delete_value($Key);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// If we've locked it
|
||||||
|
// Xia Zuojie: we disable the following lock feature 'cause we don't need it and it doubles the time to fetch a value from a key
|
||||||
|
/*while($Lock = $this->get('lock_'.$Key)){
|
||||||
|
sleep(2);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
$Return = $this->get($Key);
|
||||||
|
$this->cacheReadTimes++;
|
||||||
|
$this->keyHits['read'][$Key] = !$this->keyHits['read'][$Key] ? 1 : $this->keyHits['read'][$Key]+1;
|
||||||
|
return $Return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrapper for Memcache::delete. For a reason, see above.
|
||||||
|
function delete_value($Key, $AllLang = false){
|
||||||
|
if ($AllLang){
|
||||||
|
$langfolder_array = $this->getLanguageFolderArray();
|
||||||
|
foreach($langfolder_array as $lf)
|
||||||
|
$this->delete($lf."_".$Key);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->delete($Key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCacheReadTimes() {
|
||||||
|
return $this->cacheReadTimes;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCacheWriteTimes() {
|
||||||
|
return $this->cacheWriteTimes;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getKeyHits ($type='read') {
|
||||||
|
return (array)$this->keyHits[$type];
|
||||||
|
}
|
||||||
|
}
|
||||||
33
clearcache.php
Normal file
33
clearcache.php
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
loggedinorreturn();
|
||||||
|
if (get_user_class() < UC_MODERATOR)
|
||||||
|
stderr("Error", "Permission denied.");
|
||||||
|
$done = false;
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] == "POST")
|
||||||
|
{
|
||||||
|
$cachename = $_POST["cachename"];
|
||||||
|
if ($cachename == "")
|
||||||
|
stderr("Error", "You must fill in cache name.");
|
||||||
|
if ($_POST['multilang'] == 'yes')
|
||||||
|
$Cache->delete_value($cachename, true);
|
||||||
|
else
|
||||||
|
$Cache->delete_value($cachename);
|
||||||
|
$done = true;
|
||||||
|
}
|
||||||
|
stdhead("Clear cache");
|
||||||
|
?>
|
||||||
|
<h1>Clear cache</h1>
|
||||||
|
<?php
|
||||||
|
if ($done)
|
||||||
|
print ("<p align=center><font class=striking>Cache cleared</font></p>");
|
||||||
|
?>
|
||||||
|
<form method=post action=clearcache.php>
|
||||||
|
<table border=1 cellspacing=0 cellpadding=5>
|
||||||
|
<tr><td class=rowhead>Cache name</td><td><input type=text name=cachename size=40></td></tr>
|
||||||
|
<tr><td class=rowhead>Multi languages</td><td><input type=checkbox name=multilang>Yes</td></tr>
|
||||||
|
<tr><td colspan=2 align=center><input type=submit value="Okay" class=btn></td></tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
<?php stdfoot();
|
||||||
176
colorfade.js
Normal file
176
colorfade.js
Normal file
@@ -0,0 +1,176 @@
|
|||||||
|
if(!window.JSFX)JSFX=new Object();
|
||||||
|
|
||||||
|
var LinkFadeInStep=10;
|
||||||
|
var LinkFadeOutStep=10;
|
||||||
|
var LinkEndColor="FF6600"
|
||||||
|
|
||||||
|
var LinkStartColor="FFFFFF";
|
||||||
|
var LinkFadeRunning=false;
|
||||||
|
|
||||||
|
document.onmouseover = theOnOver;
|
||||||
|
document.onmouseout = theOnOut;
|
||||||
|
if(document.captureEvents)
|
||||||
|
document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT);
|
||||||
|
function hex2dec(hex){return(parseInt(hex,16));}
|
||||||
|
function dec2hex(dec){return (dec < 16 ? "0" : "") + dec.toString(16);}
|
||||||
|
function getColor(start, end, percent)
|
||||||
|
{
|
||||||
|
|
||||||
|
var r1=hex2dec(start.slice(0,2));
|
||||||
|
var g1=hex2dec(start.slice(2,4));
|
||||||
|
var b1=hex2dec(start.slice(4,6));
|
||||||
|
|
||||||
|
var r2=hex2dec(end.slice(0,2));
|
||||||
|
var g2=hex2dec(end.slice(2,4));
|
||||||
|
var b2=hex2dec(end.slice(4,6));
|
||||||
|
|
||||||
|
var pc=percent/100;
|
||||||
|
|
||||||
|
var r=Math.floor(r1+(pc*(r2-r1)) + .5);
|
||||||
|
var g=Math.floor(g1+(pc*(g2-g1)) + .5);
|
||||||
|
var b=Math.floor(b1+(pc*(b2-b1)) + .5);
|
||||||
|
|
||||||
|
return("#" + dec2hex(r) + dec2hex(g) + dec2hex(b));
|
||||||
|
}
|
||||||
|
JSFX.getCurrentElementColor = function(el)
|
||||||
|
{
|
||||||
|
var result = LinkStartColor;
|
||||||
|
|
||||||
|
if (el.currentStyle)
|
||||||
|
result = (el.currentStyle.color);
|
||||||
|
else if (document.defaultView)
|
||||||
|
result = (document.defaultView.getComputedStyle(el,'').getPropertyValue('color'));
|
||||||
|
else if(el.style.color)
|
||||||
|
result = el.style.color;
|
||||||
|
|
||||||
|
if(result.charAt(0) == "#")
|
||||||
|
result = result.slice(1, 8);
|
||||||
|
else if(result.charAt(0) == "r")
|
||||||
|
{
|
||||||
|
var v1 = result.slice(result.indexOf("(")+1, result.indexOf(")") );
|
||||||
|
var v2 = v1.split(",");
|
||||||
|
result = (dec2hex(parseInt(v2[0])) + dec2hex(parseInt(v2[1])) + dec2hex(parseInt(v2[2])));
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
JSFX.findTagIE = function(el)
|
||||||
|
{
|
||||||
|
while (el && el.tagName != 'A')
|
||||||
|
el = el.parentElement;
|
||||||
|
return(el);
|
||||||
|
}
|
||||||
|
JSFX.findTagNS= function(el)
|
||||||
|
{
|
||||||
|
while (el && el.nodeName != 'A')
|
||||||
|
el = el.parentNode;
|
||||||
|
return(el);
|
||||||
|
}
|
||||||
|
function theOnOver(e)
|
||||||
|
{
|
||||||
|
var lnk;
|
||||||
|
if(window.event)
|
||||||
|
lnk=JSFX.findTagIE(event.srcElement);
|
||||||
|
else
|
||||||
|
lnk=JSFX.findTagNS(e.target);
|
||||||
|
|
||||||
|
if(lnk)
|
||||||
|
JSFX.linkFadeUp(lnk);
|
||||||
|
}
|
||||||
|
JSFX.linkFadeUp = function(lnk)
|
||||||
|
{
|
||||||
|
if(lnk.state == null)
|
||||||
|
{
|
||||||
|
lnk.state = "OFF";
|
||||||
|
lnk.index = 0;
|
||||||
|
lnk.startColor = JSFX.getCurrentElementColor(lnk);
|
||||||
|
lnk.endColor = LinkEndColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(lnk.state == "OFF")
|
||||||
|
{
|
||||||
|
lnk.state = "FADE_UP";
|
||||||
|
JSFX.startLinkFader();
|
||||||
|
}
|
||||||
|
else if( lnk.state == "FADE_UP_DOWN"
|
||||||
|
|| lnk.state == "FADE_DOWN")
|
||||||
|
{
|
||||||
|
lnk.state = "FADE_UP";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function theOnOut(e)
|
||||||
|
{
|
||||||
|
var lnk;
|
||||||
|
if(window.event)
|
||||||
|
lnk=JSFX.findTagIE(event.srcElement);
|
||||||
|
else
|
||||||
|
lnk=JSFX.findTagNS(e.target);
|
||||||
|
|
||||||
|
if(lnk)
|
||||||
|
JSFX.linkFadeDown(lnk);
|
||||||
|
}
|
||||||
|
JSFX.linkFadeDown = function(lnk)
|
||||||
|
{
|
||||||
|
if(lnk.state=="ON")
|
||||||
|
{
|
||||||
|
lnk.state="FADE_DOWN";
|
||||||
|
JSFX.startLinkFader();
|
||||||
|
}
|
||||||
|
else if(lnk.state == "FADE_UP")
|
||||||
|
{
|
||||||
|
lnk.state="FADE_UP_DOWN";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
JSFX.startLinkFader = function()
|
||||||
|
{
|
||||||
|
if(!LinkFadeRunning)
|
||||||
|
JSFX.LinkFadeAnimation();
|
||||||
|
}
|
||||||
|
JSFX.LinkFadeAnimation = function()
|
||||||
|
{
|
||||||
|
LinkFadeRunning = false;
|
||||||
|
for(i=0 ; i<document.links.length ; i++)
|
||||||
|
{
|
||||||
|
var lnk = document.links[i];
|
||||||
|
if(lnk.state)
|
||||||
|
{
|
||||||
|
if(lnk.state == "FADE_UP")
|
||||||
|
{
|
||||||
|
lnk.index+=LinkFadeInStep;
|
||||||
|
if(lnk.index > 100)
|
||||||
|
lnk.index = 100;
|
||||||
|
lnk.style.color=getColor(lnk.startColor, lnk.endColor, lnk.index);
|
||||||
|
|
||||||
|
if(lnk.index == 100)
|
||||||
|
lnk.state="ON";
|
||||||
|
else
|
||||||
|
LinkFadeRunning = true;
|
||||||
|
}
|
||||||
|
else if(lnk.state == "FADE_UP_DOWN")
|
||||||
|
{
|
||||||
|
lnk.index+=LinkFadeOutStep;
|
||||||
|
if(lnk.index>100)
|
||||||
|
lnk.index = 100;
|
||||||
|
lnk.style.color=getColor(lnk.startColor, lnk.endColor, lnk.index);
|
||||||
|
|
||||||
|
if(lnk.index == 100)
|
||||||
|
lnk.state="FADE_DOWN";
|
||||||
|
LinkFadeRunning = true;
|
||||||
|
}
|
||||||
|
else if(lnk.state == "FADE_DOWN")
|
||||||
|
{
|
||||||
|
lnk.index-=LinkFadeOutStep;
|
||||||
|
if(lnk.index<0)
|
||||||
|
lnk.index = 0;
|
||||||
|
lnk.style.color=getColor(lnk.startColor, lnk.endColor, lnk.index);
|
||||||
|
|
||||||
|
if(lnk.index == 0)
|
||||||
|
lnk.state="OFF";
|
||||||
|
else
|
||||||
|
LinkFadeRunning = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(LinkFadeRunning)
|
||||||
|
setTimeout("JSFX.LinkFadeAnimation()", 40);
|
||||||
|
}
|
||||||
305
comment.php
Normal file
305
comment.php
Normal file
@@ -0,0 +1,305 @@
|
|||||||
|
<?php
|
||||||
|
require_once("include/bittorrent.php");
|
||||||
|
dbconn();
|
||||||
|
require_once(get_langfile_path());
|
||||||
|
require(get_langfile_path("",true));
|
||||||
|
|
||||||
|
$action = htmlspecialchars($_GET["action"]);
|
||||||
|
$sub = htmlspecialchars($_GET["sub"]);
|
||||||
|
$type = htmlspecialchars($_GET["type"]);
|
||||||
|
|
||||||
|
loggedinorreturn();
|
||||||
|
parked();
|
||||||
|
|
||||||
|
function check_comment_type($type)
|
||||||
|
{
|
||||||
|
if($type != "torrent" && $type != "request" && $type != "offer")
|
||||||
|
stderr($lang_comment['std_error'],$lang_comment['std_error']);
|
||||||
|
}
|
||||||
|
|
||||||
|
check_comment_type($type);
|
||||||
|
|
||||||
|
if ($action == "add")
|
||||||
|
{
|
||||||
|
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] == "POST")
|
||||||
|
{
|
||||||
|
// Anti Flood Code
|
||||||
|
// This code ensures that a member can only send one comment per minute.
|
||||||
|
if (get_user_class() < $commanage_class) {
|
||||||
|
if (strtotime($CURUSER['last_comment']) > (TIMENOW - 10))
|
||||||
|
{
|
||||||
|
$secs = 10 - (TIMENOW - strtotime($CURUSER['last_comment']));
|
||||||
|
stderr($lang_comment['std_error'],$lang_comment['std_comment_flooding_denied']."$secs".$lang_comment['std_before_posting_another']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$parent_id = 0 + $_POST["pid"];
|
||||||
|
int_check($parent_id,true);
|
||||||
|
|
||||||
|
if($type == "torrent")
|
||||||
|
$res = sql_query("SELECT name, owner FROM torrents WHERE id = $parent_id") or sqlerr(__FILE__,__LINE__);
|
||||||
|
else if($type == "offer")
|
||||||
|
$res = sql_query("SELECT name, userid as owner FROM offers WHERE id = $parent_id") or sqlerr(__FILE__,__LINE__);
|
||||||
|
else if($type == "request")
|
||||||
|
$res = sql_query("SELECT requests.request as name, userid as owner FROM requests WHERE id = $parent_id") or sqlerr(__FILE__,__LINE__);
|
||||||
|
|
||||||
|
$arr = mysql_fetch_array($res);
|
||||||
|
if (!$arr)
|
||||||
|
stderr($lang_comment['std_error'], $lang_comment['std_no_torrent_id']);
|
||||||
|
|
||||||
|
$text = trim($_POST["body"]);
|
||||||
|
if (!$text)
|
||||||
|
stderr($lang_comment['std_error'], $lang_comment['std_comment_body_empty']);
|
||||||
|
|
||||||
|
if($type == "torrent"){
|
||||||
|
sql_query("INSERT INTO comments (user, torrent, added, text, ori_text) VALUES (" .$CURUSER["id"] . ",$parent_id, '" . date("Y-m-d H:i:s") . "', " . sqlesc($text) . "," . sqlesc($text) . ")");
|
||||||
|
$Cache->delete_value('torrent_'.$parent_id.'_last_comment_content');
|
||||||
|
}
|
||||||
|
elseif($type == "offer"){
|
||||||
|
sql_query("INSERT INTO comments (user, offer, added, text, ori_text) VALUES (" .$CURUSER["id"] . ",$parent_id, '" . date("Y-m-d H:i:s") . "', " . sqlesc($text) . "," . sqlesc($text) . ")");
|
||||||
|
$Cache->delete_value('offer_'.$parent_id.'_last_comment_content');
|
||||||
|
}
|
||||||
|
elseif($type == "request")
|
||||||
|
sql_query("INSERT INTO comments (user, request, added, text, ori_text) VALUES (" .$CURUSER["id"] . ",$parent_id, '" . date("Y-m-d H:i:s") . "', " . sqlesc($text) . "," . sqlesc($text) . ")");
|
||||||
|
|
||||||
|
$newid = mysql_insert_id();
|
||||||
|
|
||||||
|
if($type == "torrent")
|
||||||
|
sql_query("UPDATE torrents SET comments = comments + 1 WHERE id = $parent_id");
|
||||||
|
else if($type == "offer")
|
||||||
|
sql_query("UPDATE offers SET comments = comments + 1 WHERE id = $parent_id");
|
||||||
|
else if($type == "request")
|
||||||
|
sql_query("UPDATE requests SET comments = comments + 1 WHERE id = $parent_id");
|
||||||
|
|
||||||
|
$ras = sql_query("SELECT commentpm FROM users WHERE id = $arr[owner]") or sqlerr(__FILE__,__LINE__);
|
||||||
|
$arg = mysql_fetch_array($ras);
|
||||||
|
|
||||||
|
if($arg["commentpm"] == 'yes' && $CURUSER['id'] != $arr["owner"])
|
||||||
|
{
|
||||||
|
$added = sqlesc(date("Y-m-d H:i:s"));
|
||||||
|
$subject = sqlesc($lang_comment_target[get_user_lang($arr["owner"])]['msg_new_comment']);
|
||||||
|
if($type == "torrent")
|
||||||
|
$notifs = sqlesc($lang_comment_target[get_user_lang($arr["owner"])]['msg_torrent_receive_comment'] . " [url=" . get_protocol_prefix() . "$BASEURL/details.php?id=$parent_id] " . $arr['name'] . "[/url].");
|
||||||
|
if($type == "offer")
|
||||||
|
$notifs = sqlesc($lang_comment_target[get_user_lang($arr["owner"])]['msg_torrent_receive_comment'] . " [url=" . get_protocol_prefix() . "$BASEURL/offers.php?id=$parent_id&off_details=1] " . $arr['name'] . "[/url].");
|
||||||
|
if($type == "request")
|
||||||
|
$notifs = sqlesc($lang_comment_target[get_user_lang($arr["owner"])]['msg_torrent_receive_comment'] . " [url=" . get_protocol_prefix() . "$BASEURL/viewrequests.php?id=$parent_id&req_details=1] " . $arr['name'] . "[/url].");
|
||||||
|
|
||||||
|
sql_query("INSERT INTO messages (sender, receiver, subject, msg, added) VALUES(0, " . $arr['owner'] . ", $subject, $notifs, $added)") or sqlerr(__FILE__, __LINE__);
|
||||||
|
$Cache->delete_value('user_'.$arr['owner'].'_unread_message_count');
|
||||||
|
$Cache->delete_value('user_'.$arr['owner'].'_inbox_count');
|
||||||
|
}
|
||||||
|
|
||||||
|
KPS("+",$addcomment_bonus,$CURUSER["id"]);
|
||||||
|
|
||||||
|
// Update Last comment sent...
|
||||||
|
sql_query("UPDATE users SET last_comment = NOW() WHERE id = ".sqlesc($CURUSER['id'])) or sqlerr(__FILE__, __LINE__);
|
||||||
|
|
||||||
|
if($type == "torrent")
|
||||||
|
header("Refresh: 0; url=details.php?id=$parent_id#$newid");
|
||||||
|
else if($type == "offer")
|
||||||
|
header("Refresh: 0; url=offers.php?id=$parent_id&off_details=1#$newid");
|
||||||
|
else if($type == "request")
|
||||||
|
header("Refresh: 0; url=viewrequests.php?id=$parent_id&req_details=1#$newid");
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
$parent_id = 0 + $_GET["pid"];
|
||||||
|
int_check($parent_id,true);
|
||||||
|
|
||||||
|
if($sub == "quote")
|
||||||
|
{
|
||||||
|
$commentid = 0 + $_GET["cid"];
|
||||||
|
int_check($commentid,true);
|
||||||
|
|
||||||
|
$res2 = sql_query("SELECT comments.text, users.username FROM comments JOIN users ON comments.user = users.id WHERE comments.id=$commentid") or sqlerr(__FILE__, __LINE__);
|
||||||
|
|
||||||
|
if (mysql_num_rows($res2) != 1)
|
||||||
|
stderr($lang_forums['std_error'], $lang_forums['std_no_comment_id']);
|
||||||
|
|
||||||
|
$arr2 = mysql_fetch_assoc($res2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($type == "torrent"){
|
||||||
|
$res = sql_query("SELECT name, owner FROM torrents WHERE id = $parent_id") or sqlerr(__FILE__,__LINE__);
|
||||||
|
$url="details.php?id=$parent_id";
|
||||||
|
}
|
||||||
|
else if($type == "offer"){
|
||||||
|
$res = sql_query("SELECT name, userid as owner FROM offers WHERE id = $parent_id") or sqlerr(__FILE__,__LINE__);
|
||||||
|
$url="offers.php?id=$parent_id&off_details=1";
|
||||||
|
}
|
||||||
|
else if($type == "request"){
|
||||||
|
$res = sql_query("SELECT requests.request as name, userid as owner FROM requests WHERE id = $parent_id") or sqlerr(__FILE__,__LINE__);
|
||||||
|
$url="viewrequests.php?id=$parent_id&req_details=1";
|
||||||
|
}
|
||||||
|
$arr = mysql_fetch_array($res);
|
||||||
|
if (!$arr)
|
||||||
|
stderr($lang_comment['std_error'], $lang_comment['std_no_torrent_id']);
|
||||||
|
|
||||||
|
stdhead($lang_comment['head_add_comment_to']. $arr["name"]);
|
||||||
|
begin_main_frame();
|
||||||
|
$title = $lang_comment['text_add_comment_to']."<a href=$url>". htmlspecialchars($arr["name"]) . "</a>";
|
||||||
|
print("<form id=compose method=post name=\"compose\" action=\"comment.php?action=add&type=$type\">\n");
|
||||||
|
print("<input type=\"hidden\" name=\"pid\" value=\"$parent_id\"/>\n");
|
||||||
|
begin_compose($title, ($sub == "quote" ? "quote" : "reply"), ($sub == "quote" ? htmlspecialchars("[quote=".htmlspecialchars($arr2["username"])."]".unesc($arr2["text"])."[/quote]") : ""), false);
|
||||||
|
end_compose();
|
||||||
|
print("</form>");
|
||||||
|
end_main_frame();
|
||||||
|
stdfoot();
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
elseif ($action == "edit")
|
||||||
|
{
|
||||||
|
$commentid = 0 + $_GET["cid"];
|
||||||
|
int_check($commentid,true);
|
||||||
|
|
||||||
|
if($type == "torrent")
|
||||||
|
$res = sql_query("SELECT c.*, t.name, t.id AS parent_id FROM comments AS c JOIN torrents AS t ON c.torrent = t.id WHERE c.id=$commentid") or sqlerr(__FILE__,__LINE__);
|
||||||
|
else if($type == "offer")
|
||||||
|
$res = sql_query("SELECT c.*, o.name, o.id AS parent_id FROM comments AS c JOIN offers AS o ON c.offer = o.id WHERE c.id=$commentid") or sqlerr(__FILE__,__LINE__);
|
||||||
|
else if($type == "request")
|
||||||
|
$res = sql_query("SELECT c.*, r.request as name, r.id AS parent_id FROM comments AS c JOIN requests AS r ON c.request = r.id WHERE c.id=$commentid") or sqlerr(__FILE__,__LINE__);
|
||||||
|
|
||||||
|
$arr = mysql_fetch_array($res);
|
||||||
|
if (!$arr)
|
||||||
|
stderr($lang_comment['std_error'], $lang_comment['std_invalid_id']);
|
||||||
|
|
||||||
|
if ($arr["user"] != $CURUSER["id"] && get_user_class() < $commanage_class)
|
||||||
|
stderr($lang_comment['std_error'], $lang_comment['std_permission_denied']);
|
||||||
|
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] == "POST")
|
||||||
|
{
|
||||||
|
$text = $_POST["body"];
|
||||||
|
$returnto = htmlspecialchars($_POST["returnto"]) ? $_POST["returnto"] : htmlspecialchars($_SERVER["HTTP_REFERER"]);
|
||||||
|
|
||||||
|
if ($text == "")
|
||||||
|
stderr($lang_comment['std_error'], $lang_comment['std_comment_body_empty']);
|
||||||
|
$text = sqlesc($text);
|
||||||
|
$editdate = sqlesc(date("Y-m-d H:i:s"));
|
||||||
|
|
||||||
|
sql_query("UPDATE comments SET text=$text, editdate=$editdate, editedby=$CURUSER[id] WHERE id=".sqlesc($commentid)) or sqlerr(__FILE__, __LINE__);
|
||||||
|
if($type == "torrent")
|
||||||
|
$Cache->delete_value('torrent_'.$arr['parent_id'].'_last_comment_content');
|
||||||
|
elseif ($type == "offer")
|
||||||
|
$Cache->delete_value('offer_'.$arr['parent_id'].'_last_comment_content');
|
||||||
|
header("Location: $returnto");
|
||||||
|
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
$parent_id = $arr["parent_id"];
|
||||||
|
if($type == "torrent")
|
||||||
|
$url="details.php?id=$parent_id";
|
||||||
|
else if($type == "offer")
|
||||||
|
$url="offers.php?id=$parent_id&off_details=1";
|
||||||
|
else if($type == "request")
|
||||||
|
$url="viewrequests.php?id=$parent_id&req_details=1";
|
||||||
|
stdhead($lang_comment['head_edit_comment_to']."\"". $arr["name"] . "\"");
|
||||||
|
begin_main_frame();
|
||||||
|
$title = $lang_comment['head_edit_comment_to']."<a href=$url>". htmlspecialchars($arr["name"]) . "</a>";
|
||||||
|
print("<form id=compose method=post name=\"compose\" action=\"comment.php?action=edit&cid=$commentid&type=$type\">\n");
|
||||||
|
print("<input type=\"hidden\" name=\"returnto\" value=\"" . htmlspecialchars($_SERVER["HTTP_REFERER"]) . "\" />\n");
|
||||||
|
begin_compose($title, "edit", htmlspecialchars(unesc($arr["text"])), false);
|
||||||
|
end_compose();
|
||||||
|
print("</form>");
|
||||||
|
end_main_frame();
|
||||||
|
stdfoot();
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
elseif ($action == "delete")
|
||||||
|
{
|
||||||
|
if (get_user_class() < $commanage_class)
|
||||||
|
stderr($lang_comment['std_error'], $lang_comment['std_permission_denied']);
|
||||||
|
|
||||||
|
$commentid = 0 + $_GET["cid"];
|
||||||
|
$sure = $_GET["sure"];
|
||||||
|
int_check($commentid,true);
|
||||||
|
|
||||||
|
if (!$sure)
|
||||||
|
{
|
||||||
|
$referer = $_SERVER["HTTP_REFERER"];
|
||||||
|
stderr($lang_comment['std_delete_comment'], $lang_comment['std_delete_comment_note'] ."<a href=comment.php?action=delete&cid=$commentid&sure=1&type=$type" .($referer ? "&returnto=" . rawurlencode($referer) : "") . $lang_comment['std_here_if_sure'],false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
int_check($sure,true);
|
||||||
|
|
||||||
|
|
||||||
|
if($type == "torrent")
|
||||||
|
$res = sql_query("SELECT torrent as pid,user FROM comments WHERE id=$commentid") or sqlerr(__FILE__,__LINE__);
|
||||||
|
else if($type == "offer")
|
||||||
|
$res = sql_query("SELECT offer as pid,user FROM comments WHERE id=$commentid") or sqlerr(__FILE__,__LINE__);
|
||||||
|
else if($type == "request")
|
||||||
|
$res = sql_query("SELECT request as pid,user FROM comments WHERE id=$commentid") or sqlerr(__FILE__,__LINE__);
|
||||||
|
|
||||||
|
$arr = mysql_fetch_array($res);
|
||||||
|
if ($arr)
|
||||||
|
{
|
||||||
|
$parent_id = $arr["pid"];
|
||||||
|
$userpostid = $arr["user"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
stderr($lang_comment['std_error'], $lang_comment['std_invalid_id']);
|
||||||
|
|
||||||
|
sql_query("DELETE FROM comments WHERE id=$commentid") or sqlerr(__FILE__,__LINE__);
|
||||||
|
if ($type == "torrent")
|
||||||
|
$Cache->delete_value('torrent_'.$arr['pid'].'_last_comment_content');
|
||||||
|
elseif ($type == "offer")
|
||||||
|
$Cache->delete_value('offer_'.$arr['pid'].'_last_comment_content');
|
||||||
|
if ($parent_id && mysql_affected_rows() > 0)
|
||||||
|
{
|
||||||
|
if($type == "torrent")
|
||||||
|
sql_query("UPDATE torrents SET comments = comments - 1 WHERE id = $parent_id") or sqlerr(__FILE__,__LINE__);
|
||||||
|
else if($type == "offer")
|
||||||
|
sql_query("UPDATE offers SET comments = comments - 1 WHERE id = $parent_id") or sqlerr(__FILE__,__LINE__);
|
||||||
|
else if($type == "request")
|
||||||
|
sql_query("UPDATE requests SET comments = comments - 1 WHERE id = $parent_id") or sqlerr(__FILE__,__LINE__);
|
||||||
|
}
|
||||||
|
|
||||||
|
KPS("-",$addcomment_bonus,$userpostid);
|
||||||
|
|
||||||
|
$returnto = $_GET["returnto"] ? $_GET["returnto"] : htmlspecialchars($_SERVER["HTTP_REFERER"]);
|
||||||
|
|
||||||
|
header("Location: $returnto");
|
||||||
|
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
elseif ($action == "vieworiginal")
|
||||||
|
{
|
||||||
|
if (get_user_class() < $commanage_class)
|
||||||
|
stderr($lang_comment['std_error'], $lang_comment['std_permission_denied']);
|
||||||
|
|
||||||
|
$commentid = 0 + $_GET["cid"];
|
||||||
|
int_check($commentid,true);
|
||||||
|
|
||||||
|
if($type == "torrent")
|
||||||
|
$res = sql_query("SELECT c.*, t.name FROM comments AS c JOIN torrents AS t ON c.torrent = t.id WHERE c.id=$commentid") or sqlerr(__FILE__,__LINE__);
|
||||||
|
else if($type == "offer")
|
||||||
|
$res = sql_query("SELECT c.*, o.name FROM comments AS c JOIN offers AS o ON c.offer = o.id WHERE c.id=$commentid") or sqlerr(__FILE__,__LINE__);
|
||||||
|
else if($type == "request")
|
||||||
|
$res = sql_query("SELECT c.*, r.request as name FROM comments AS c JOIN requests AS r ON c.request = r.id WHERE c.id=$commentid") or sqlerr(__FILE__,__LINE__);
|
||||||
|
|
||||||
|
$arr = mysql_fetch_array($res);
|
||||||
|
if (!$arr)
|
||||||
|
stderr($lang_comment['std_error'], $lang_comment['std_invalid_id']);
|
||||||
|
|
||||||
|
stdhead($lang_comment['head_original_comment']);
|
||||||
|
print("<h1>".$lang_comment['text_original_content_of_comment']."#$commentid</h1>");
|
||||||
|
print("<table width=\"737\" border=\"1\" cellspacing=\"0\" cellpadding=\"5\">");
|
||||||
|
print("<tr><td class=\"text\">\n");
|
||||||
|
echo format_comment($arr["ori_text"]);
|
||||||
|
print("</td></tr></table>\n");
|
||||||
|
|
||||||
|
$returnto = htmlspecialchars($_SERVER["HTTP_REFERER"]);
|
||||||
|
|
||||||
|
if ($returnto)
|
||||||
|
print("<p><font size=\"small\">(<a href=\"".$returnto."\">".$lang_comment['text_back']."</a>)</font></p>\n");
|
||||||
|
|
||||||
|
stdfoot();
|
||||||
|
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
stderr($lang_comment['std_error'], $lang_comment['std_unknown_action']);
|
||||||
|
|
||||||
|
die;
|
||||||
|
?>
|
||||||
374
common.js
Normal file
374
common.js
Normal file
@@ -0,0 +1,374 @@
|
|||||||
|
function postvalid(form){
|
||||||
|
$('qr').disabled = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function dropmenu(obj){
|
||||||
|
$(obj.id + 'list').style.display = $(obj.id + 'list').style.display == 'none' ? '' : 'none';
|
||||||
|
}
|
||||||
|
|
||||||
|
function confirm_delete(id, note, addon)
|
||||||
|
{
|
||||||
|
if(confirm(note))
|
||||||
|
{
|
||||||
|
self.location.href='?action=del'+(addon ? '&'+addon : '')+'&id='+id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//viewfilelist.js
|
||||||
|
|
||||||
|
function viewfilelist(torrentid)
|
||||||
|
{
|
||||||
|
var result=ajax.gets('viewfilelist.php?id='+torrentid);
|
||||||
|
document.getElementById("showfl").style.display = 'none';
|
||||||
|
document.getElementById("hidefl").style.display = 'block';
|
||||||
|
showlist(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
function showlist(filelist)
|
||||||
|
{
|
||||||
|
document.getElementById("filelist").innerHTML=filelist;
|
||||||
|
}
|
||||||
|
|
||||||
|
function hidefilelist()
|
||||||
|
{
|
||||||
|
document.getElementById("hidefl").style.display = 'none';
|
||||||
|
document.getElementById("showfl").style.display = 'block';
|
||||||
|
document.getElementById("filelist").innerHTML="";
|
||||||
|
}
|
||||||
|
|
||||||
|
//viewpeerlist.js
|
||||||
|
|
||||||
|
function viewpeerlist(torrentid)
|
||||||
|
{
|
||||||
|
var list=ajax.gets('viewpeerlist.php?id='+torrentid);
|
||||||
|
document.getElementById("showpeer").style.display = 'none';
|
||||||
|
document.getElementById("hidepeer").style.display = 'block';
|
||||||
|
document.getElementById("peercount").style.display = 'none';
|
||||||
|
document.getElementById("peerlist").innerHTML=list;
|
||||||
|
}
|
||||||
|
function hidepeerlist()
|
||||||
|
{
|
||||||
|
document.getElementById("hidepeer").style.display = 'none';
|
||||||
|
document.getElementById("peerlist").innerHTML="";
|
||||||
|
document.getElementById("showpeer").style.display = 'block';
|
||||||
|
document.getElementById("peercount").style.display = 'block';
|
||||||
|
}
|
||||||
|
|
||||||
|
// smileit.js
|
||||||
|
|
||||||
|
function SmileIT(smile,form,text){
|
||||||
|
document.forms[form].elements[text].value = document.forms[form].elements[text].value+" "+smile+" ";
|
||||||
|
document.forms[form].elements[text].focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
// saythanks.js
|
||||||
|
|
||||||
|
function saythanks(torrentid)
|
||||||
|
{
|
||||||
|
var list=ajax.post('thanks.php','','id='+torrentid);
|
||||||
|
document.getElementById("thanksbutton").innerHTML = document.getElementById("thanksadded").innerHTML;
|
||||||
|
document.getElementById("nothanks").innerHTML = "";
|
||||||
|
document.getElementById("addcuruser").innerHTML = document.getElementById("curuser").innerHTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
// preview.js
|
||||||
|
|
||||||
|
function preview(obj) {
|
||||||
|
var poststr = encodeURIComponent( document.getElementById("body").value );
|
||||||
|
var result=ajax.posts('preview.php','body='+poststr);
|
||||||
|
document.getElementById("previewouter").innerHTML=result;
|
||||||
|
document.getElementById("previewouter").style.display = 'block';
|
||||||
|
document.getElementById("editorouter").style.display = 'none';
|
||||||
|
document.getElementById("unpreviewbutton").style.display = 'block';
|
||||||
|
document.getElementById("previewbutton").style.display = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
|
function unpreview(obj){
|
||||||
|
document.getElementById("previewouter").style.display = 'none';
|
||||||
|
document.getElementById("editorouter").style.display = 'block';
|
||||||
|
document.getElementById("unpreviewbutton").style.display = 'none';
|
||||||
|
document.getElementById("previewbutton").style.display = 'block';
|
||||||
|
}
|
||||||
|
|
||||||
|
// java_klappe.js
|
||||||
|
|
||||||
|
function klappe(id)
|
||||||
|
{
|
||||||
|
var klappText = document.getElementById('k' + id);
|
||||||
|
var klappBild = document.getElementById('pic' + id);
|
||||||
|
|
||||||
|
if (klappText.style.display == 'none') {
|
||||||
|
klappText.style.display = 'block';
|
||||||
|
// klappBild.src = 'pic/blank.gif';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
klappText.style.display = 'none';
|
||||||
|
// klappBild.src = 'pic/blank.gif';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function klappe_news(id)
|
||||||
|
{
|
||||||
|
var klappText = document.getElementById('k' + id);
|
||||||
|
var klappBild = document.getElementById('pic' + id);
|
||||||
|
|
||||||
|
if (klappText.style.display == 'none') {
|
||||||
|
klappText.style.display = '';
|
||||||
|
klappBild.className = 'minus';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
klappText.style.display = 'none';
|
||||||
|
klappBild.className = 'plus';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function klappe_ext(id)
|
||||||
|
{
|
||||||
|
var klappText = document.getElementById('k' + id);
|
||||||
|
var klappBild = document.getElementById('pic' + id);
|
||||||
|
var klappPoster = document.getElementById('poster' + id);
|
||||||
|
if (klappText.style.display == 'none') {
|
||||||
|
klappText.style.display = 'block';
|
||||||
|
klappPoster.style.display = 'block';
|
||||||
|
klappBild.className = 'minus';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
klappText.style.display = 'none';
|
||||||
|
klappPoster.style.display = 'none';
|
||||||
|
klappBild.className = 'plus';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// disableother.js
|
||||||
|
|
||||||
|
function disableother(select,target)
|
||||||
|
{
|
||||||
|
if (document.getElementById(select).value == 0)
|
||||||
|
document.getElementById(target).disabled = false;
|
||||||
|
else {
|
||||||
|
document.getElementById(target).disabled = true;
|
||||||
|
document.getElementById(select).disabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function disableother2(oricat,newcat)
|
||||||
|
{
|
||||||
|
if (document.getElementById("movecheck").checked == true){
|
||||||
|
document.getElementById(oricat).disabled = true;
|
||||||
|
document.getElementById(newcat).disabled = false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
document.getElementById(oricat).disabled = false;
|
||||||
|
document.getElementById(newcat).disabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ctrlenter.js
|
||||||
|
var submitted = false;
|
||||||
|
function ctrlenter(event,formname,submitname){
|
||||||
|
if (submitted == false){
|
||||||
|
var keynum;
|
||||||
|
if (event.keyCode){
|
||||||
|
keynum = event.keyCode;
|
||||||
|
}
|
||||||
|
else if (event.which){
|
||||||
|
keynum = event.which;
|
||||||
|
}
|
||||||
|
if (event.ctrlKey && keynum == 13){
|
||||||
|
submitted = true;
|
||||||
|
document.getElementById(formname).submit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function gotothepage(page){
|
||||||
|
var url=window.location.href;
|
||||||
|
var end=url.lastIndexOf("page");
|
||||||
|
url = url.replace(/#[0-9]+/g,"");
|
||||||
|
if (end == -1){
|
||||||
|
if (url.lastIndexOf("?") == -1)
|
||||||
|
window.location.href=url+"?page="+page;
|
||||||
|
else
|
||||||
|
window.location.href=url+"&page="+page;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
url = url.replace(/page=.+/g,"");
|
||||||
|
window.location.href=url+"page="+page;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function changepage(event){
|
||||||
|
var gotopage;
|
||||||
|
var keynum;
|
||||||
|
var altkey;
|
||||||
|
if (navigator.userAgent.toLowerCase().indexOf('presto') != -1)
|
||||||
|
altkey = event.shiftKey;
|
||||||
|
else altkey = event.altKey;
|
||||||
|
if (event.keyCode){
|
||||||
|
keynum = event.keyCode;
|
||||||
|
}
|
||||||
|
else if (event.which){
|
||||||
|
keynum = event.which;
|
||||||
|
}
|
||||||
|
if(altkey && keynum==33){
|
||||||
|
if(currentpage<=0) return;
|
||||||
|
gotopage=currentpage-1;
|
||||||
|
gotothepage(gotopage);
|
||||||
|
}
|
||||||
|
else if (altkey && keynum == 34){
|
||||||
|
if(currentpage>=maxpage) return;
|
||||||
|
gotopage=currentpage+1;
|
||||||
|
gotothepage(gotopage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(window.document.addEventListener){
|
||||||
|
window.addEventListener("keydown",changepage,false);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
window.attachEvent("onkeydown",changepage,false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// bookmark.js
|
||||||
|
function bookmark(torrentid,counter)
|
||||||
|
{
|
||||||
|
var result=ajax.gets('bookmark.php?torrentid='+torrentid);
|
||||||
|
bmicon(result,counter);
|
||||||
|
}
|
||||||
|
function bmicon(status,counter)
|
||||||
|
{
|
||||||
|
if (status=="added")
|
||||||
|
document.getElementById("bookmark"+counter).innerHTML="<img class=\"bookmark\" src=\"pic/trans.gif\" alt=\"Bookmarked\" />";
|
||||||
|
else if (status=="deleted")
|
||||||
|
document.getElementById("bookmark"+counter).innerHTML="<img class=\"delbookmark\" src=\"pic/trans.gif\" src=\"pic/trans.gif\" alt=\"Unbookmarked\" />";
|
||||||
|
}
|
||||||
|
|
||||||
|
// check.js
|
||||||
|
var checkflag = "false";
|
||||||
|
function check(field,checkall_name,uncheckall_name) {
|
||||||
|
if (checkflag == "false") {
|
||||||
|
for (i = 0; i < field.length; i++) {
|
||||||
|
field[i].checked = true;}
|
||||||
|
checkflag = "true";
|
||||||
|
return uncheckall_name; }
|
||||||
|
else {
|
||||||
|
for (i = 0; i < field.length; i++) {
|
||||||
|
field[i].checked = false; }
|
||||||
|
checkflag = "false";
|
||||||
|
return checkall_name; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// in torrents.php
|
||||||
|
var form='searchbox';
|
||||||
|
function SetChecked(chkName,ctrlName,checkall_name,uncheckall_name,start,count) {
|
||||||
|
dml=document.forms[form];
|
||||||
|
len = dml.elements.length;
|
||||||
|
var begin;
|
||||||
|
var end;
|
||||||
|
if (start == -1){
|
||||||
|
begin = 0;
|
||||||
|
end = len;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
begin = start;
|
||||||
|
end = start + count;
|
||||||
|
}
|
||||||
|
var check_state;
|
||||||
|
for( i=0 ; i<len ; i++) {
|
||||||
|
if(dml.elements[i].name==ctrlName)
|
||||||
|
{
|
||||||
|
if(dml.elements[i].value == checkall_name)
|
||||||
|
{
|
||||||
|
dml.elements[i].value = uncheckall_name;
|
||||||
|
check_state=1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dml.elements[i].value = checkall_name;
|
||||||
|
check_state=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
for( i=begin ; i<end ; i++) {
|
||||||
|
if (dml.elements[i].name.indexOf(chkName) != -1) {
|
||||||
|
dml.elements[i].checked=check_state;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// funvote.js
|
||||||
|
function funvote(funid,yourvote)
|
||||||
|
{
|
||||||
|
var result=ajax.gets('fun.php?action=vote&id='+funid+"&yourvote="+yourvote);
|
||||||
|
voteaccept(yourvote);
|
||||||
|
}
|
||||||
|
function voteaccept(yourvote)
|
||||||
|
{
|
||||||
|
if (yourvote=="fun" || yourvote=="dull"){
|
||||||
|
document.getElementById("funvote").style.display = 'none';
|
||||||
|
document.getElementById("voteaccept").style.display = 'block';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// in upload.php
|
||||||
|
function getname()
|
||||||
|
{
|
||||||
|
var filename = document.getElementById("torrent").value;
|
||||||
|
var filename = filename.toString();
|
||||||
|
var lowcase = filename.toLowerCase();
|
||||||
|
var start = lowcase.lastIndexOf("\\"); //for Google Chrome on windows
|
||||||
|
if (start == -1){
|
||||||
|
start = lowcase.lastIndexOf("\/"); // for Google Chrome on linux
|
||||||
|
if (start == -1)
|
||||||
|
start == 0;
|
||||||
|
else start = start + 1;
|
||||||
|
}
|
||||||
|
else start = start + 1;
|
||||||
|
var end = lowcase.lastIndexOf("torrent");
|
||||||
|
var noext = filename.substring(start,end-1);
|
||||||
|
noext = noext.replace(/H\.264/ig,"H_264");
|
||||||
|
noext = noext.replace(/5\.1/g,"5_1");
|
||||||
|
noext = noext.replace(/2\.1/g,"2_1");
|
||||||
|
noext = noext.replace(/\./g," ");
|
||||||
|
noext = noext.replace(/H_264/g,"H.264");
|
||||||
|
noext = noext.replace(/5_1/g,"5.1");
|
||||||
|
noext = noext.replace(/2_1/g,"2.1");
|
||||||
|
document.getElementById("name").value=noext;
|
||||||
|
}
|
||||||
|
|
||||||
|
// in userdetails.php
|
||||||
|
function getusertorrentlistajax(userid, type, blockid)
|
||||||
|
{
|
||||||
|
if (document.getElementById(blockid).innerHTML==""){
|
||||||
|
var infoblock=ajax.gets('getusertorrentlistajax.php?userid='+userid+'&type='+type);
|
||||||
|
document.getElementById(blockid).innerHTML=infoblock;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// in functions.php
|
||||||
|
function get_ext_info_ajax(blockid,url,cache,type)
|
||||||
|
{
|
||||||
|
if (document.getElementById(blockid).innerHTML==""){
|
||||||
|
var infoblock=ajax.gets('getextinfoajax.php?url='+url+'&cache='+cache+'&type='+type);
|
||||||
|
document.getElementById(blockid).innerHTML=infoblock;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// in userdetails.php
|
||||||
|
function enabledel(msg){
|
||||||
|
document.deluser.submit.disabled=document.deluser.submit.checked;
|
||||||
|
alert (msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
function disabledel(){
|
||||||
|
document.deluser.submit.disabled=!document.deluser.submit.checked;
|
||||||
|
}
|
||||||
|
|
||||||
|
// in mybonus.php
|
||||||
|
function customgift()
|
||||||
|
{
|
||||||
|
if (document.getElementById("giftselect").value == '0'){
|
||||||
|
document.getElementById("giftselect").disabled = true;
|
||||||
|
document.getElementById("giftcustom").disabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
3
config/.htaccess
Normal file
3
config/.htaccess
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
Options -Indexes
|
||||||
|
Order allow,deny
|
||||||
|
Deny from all
|
||||||
334
config/allconfig.php
Normal file
334
config/allconfig.php
Normal file
@@ -0,0 +1,334 @@
|
|||||||
|
<?php
|
||||||
|
$ACCOUNT=array(
|
||||||
|
'neverdelete' => '6',
|
||||||
|
'neverdeletepacked' => '3',
|
||||||
|
'deletepacked' => '400',
|
||||||
|
'deleteunpacked' => '150',
|
||||||
|
'deletenotransfer' => '60',
|
||||||
|
'deletenotransfertwo' => '0',
|
||||||
|
'deletepeasant' => '30',
|
||||||
|
'psdlone' => '50',
|
||||||
|
'psratioone' => '0.4',
|
||||||
|
'psdltwo' => '100',
|
||||||
|
'psratiotwo' => '0.5',
|
||||||
|
'psdlthree' => '200',
|
||||||
|
'psratiothree' => '0.6',
|
||||||
|
'psdlfour' => '400',
|
||||||
|
'psratiofour' => '0.7',
|
||||||
|
'psdlfive' => '800',
|
||||||
|
'psratiofive' => '0.8',
|
||||||
|
'putime' => '4',
|
||||||
|
'pudl' => '50',
|
||||||
|
'puprratio' => '1.05',
|
||||||
|
'puderatio' => '0.95',
|
||||||
|
'eutime' => '8',
|
||||||
|
'eudl' => '120',
|
||||||
|
'euprratio' => '1.55',
|
||||||
|
'euderatio' => '1.45',
|
||||||
|
'cutime' => '15',
|
||||||
|
'cudl' => '300',
|
||||||
|
'cuprratio' => '2.05',
|
||||||
|
'cuderatio' => '1.95',
|
||||||
|
'iutime' => '25',
|
||||||
|
'iudl' => '500',
|
||||||
|
'iuprratio' => '2.55',
|
||||||
|
'iuderatio' => '2.45',
|
||||||
|
'vutime' => '40',
|
||||||
|
'vudl' => '750',
|
||||||
|
'vuprratio' => '3.05',
|
||||||
|
'vuderatio' => '2.95',
|
||||||
|
'exutime' => '60',
|
||||||
|
'exudl' => '1024',
|
||||||
|
'exuprratio' => '3.55',
|
||||||
|
'exuderatio' => '3.45',
|
||||||
|
'uutime' => '80',
|
||||||
|
'uudl' => '1536',
|
||||||
|
'uuprratio' => '4.05',
|
||||||
|
'uuderatio' => '3.95',
|
||||||
|
'nmtime' => '100',
|
||||||
|
'nmdl' => '3072',
|
||||||
|
'nmprratio' => '4.55',
|
||||||
|
'nmderatio' => '4.45',
|
||||||
|
'getInvitesByPromotion' => array(
|
||||||
|
'2' => '1',
|
||||||
|
'3' => '0',
|
||||||
|
'4' => '2',
|
||||||
|
'5' => '0',
|
||||||
|
'6' => '3',
|
||||||
|
'7' => '0',
|
||||||
|
'8' => '5',
|
||||||
|
'9' => '10',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
$ADVERTISEMENT=array(
|
||||||
|
'enablead' => 'yes',
|
||||||
|
'enablenoad' => 'yes',
|
||||||
|
'noad' => '12',
|
||||||
|
'enablebonusnoad' => 'yes',
|
||||||
|
'bonusnoad' => '2',
|
||||||
|
'bonusnoadpoint' => '10000',
|
||||||
|
'bonusnoadtime' => '15',
|
||||||
|
'adclickbonus' => '0',
|
||||||
|
);
|
||||||
|
$ATTACHMENT=array(
|
||||||
|
'enableattach' => 'yes',
|
||||||
|
'classone' => '1',
|
||||||
|
'countone' => '5',
|
||||||
|
'sizeone' => '256',
|
||||||
|
'extone' => 'jpg, jpeg, png, gif',
|
||||||
|
'classtwo' => '2',
|
||||||
|
'counttwo' => '10',
|
||||||
|
'sizetwo' => '512',
|
||||||
|
'exttwo' => 'torrent, zip, rar, 7z, gzip, gz',
|
||||||
|
'classthree' => '5',
|
||||||
|
'countthree' => '20',
|
||||||
|
'sizethree' => '1024',
|
||||||
|
'extthree' => 'mp3, ogg, oga, flv',
|
||||||
|
'classfour' => '13',
|
||||||
|
'countfour' => '500',
|
||||||
|
'sizefour' => '2048',
|
||||||
|
'extfour' => 'doc, xls',
|
||||||
|
'savedirectory' => './attachments',
|
||||||
|
'httpdirectory' => 'attachments',
|
||||||
|
'savedirectorytype' => 'monthdir',
|
||||||
|
'thumbnailtype' => 'createthumb',
|
||||||
|
'thumbquality' => '80',
|
||||||
|
'thumbwidth' => '500',
|
||||||
|
'thumbheight' => '500',
|
||||||
|
'watermarkpos' => '9',
|
||||||
|
'watermarkwidth' => '300',
|
||||||
|
'watermarkheight' => '300',
|
||||||
|
'watermarkquality' => '85',
|
||||||
|
'altthumbwidth' => '180',
|
||||||
|
'altthumbheight' => '135',
|
||||||
|
);
|
||||||
|
$AUTHORITY=array(
|
||||||
|
'defaultclass' => '1',
|
||||||
|
'staffmem' => '13',
|
||||||
|
'newsmanage' => '14',
|
||||||
|
'newfunitem' => '1',
|
||||||
|
'funmanage' => '13',
|
||||||
|
'sbmanage' => '13',
|
||||||
|
'pollmanage' => '14',
|
||||||
|
'applylink' => '1',
|
||||||
|
'linkmanage' => '14',
|
||||||
|
'postmanage' => '13',
|
||||||
|
'commanage' => '13',
|
||||||
|
'forummanage' => '14',
|
||||||
|
'viewuserlist' => '2',
|
||||||
|
'torrentmanage' => '13',
|
||||||
|
'torrentsticky' => '14',
|
||||||
|
'askreseed' => '2',
|
||||||
|
'viewnfo' => '2',
|
||||||
|
'torrentstructure' => '8',
|
||||||
|
'sendinvite' => '2',
|
||||||
|
'viewhistory' => '6',
|
||||||
|
'topten' => '2',
|
||||||
|
'log' => '5',
|
||||||
|
'confilog' => '13',
|
||||||
|
'userprofile' => '14',
|
||||||
|
'torrenthistory' => '2',
|
||||||
|
'prfmanage' => '13',
|
||||||
|
'cruprfmanage' => '14',
|
||||||
|
'uploadsub' => '1',
|
||||||
|
'delownsub' => '2',
|
||||||
|
'submanage' => '13',
|
||||||
|
'updateextinfo' => '7',
|
||||||
|
'viewanonymous' => '12',
|
||||||
|
'beanonymous' => '4',
|
||||||
|
'addoffer' => '0',
|
||||||
|
'offermanage' => '13',
|
||||||
|
'upload' => '2',
|
||||||
|
'uploadspecial' => NULL,
|
||||||
|
'movetorrent' => NULL,
|
||||||
|
'chrmanage' => '13',
|
||||||
|
'viewinvite' => '13',
|
||||||
|
'buyinvite' => '5',
|
||||||
|
'seebanned' => '12',
|
||||||
|
'againstoffer' => '1',
|
||||||
|
'userbar' => '2',
|
||||||
|
);
|
||||||
|
$BASIC=array(
|
||||||
|
'SITENAME' => 'NexusPHP',
|
||||||
|
'BASEURL' => 'localhost',
|
||||||
|
'announce_url' => 'localhost/announce.php',
|
||||||
|
'mysql_host' => 'localhost',
|
||||||
|
'mysql_user' => 'root',
|
||||||
|
'mysql_pass' => 'nexusphprocks',
|
||||||
|
'mysql_db' => 'nexusphp',
|
||||||
|
);
|
||||||
|
$BONUS=array(
|
||||||
|
'donortimes' => '2',
|
||||||
|
'perseeding' => '1',
|
||||||
|
'maxseeding' => '7',
|
||||||
|
'tzero' => '4',
|
||||||
|
'nzero' => '7',
|
||||||
|
'bzero' => '100',
|
||||||
|
'l' => '300',
|
||||||
|
'uploadtorrent' => '15',
|
||||||
|
'uploadsubtitle' => '5',
|
||||||
|
'starttopic' => '2',
|
||||||
|
'makepost' => '1',
|
||||||
|
'addcomment' => '1',
|
||||||
|
'pollvote' => '1',
|
||||||
|
'offervote' => '1',
|
||||||
|
'funboxvote' => '1',
|
||||||
|
'saythanks' => '0.5',
|
||||||
|
'receivethanks' => '0',
|
||||||
|
'funboxreward' => '5',
|
||||||
|
'onegbupload' => '300',
|
||||||
|
'fivegbupload' => '800',
|
||||||
|
'tengbupload' => '1300',
|
||||||
|
'ratiolimit' => '6',
|
||||||
|
'dlamountlimit' => '50',
|
||||||
|
'oneinvite' => '1000',
|
||||||
|
'customtitle' => '5000',
|
||||||
|
'vipstatus' => '8000',
|
||||||
|
'bonusgift' => 'yes',
|
||||||
|
'basictax' => '4',
|
||||||
|
'taxpercentage' => '10',
|
||||||
|
'prolinkpoint' => '1',
|
||||||
|
'prolinktime' => '600',
|
||||||
|
);
|
||||||
|
$CODE=array(
|
||||||
|
'mainversion' => 'NexusPHP',
|
||||||
|
'subversion' => 'Standard v1.5 Beta 4',
|
||||||
|
'releasedate' => '2010-09-19',
|
||||||
|
'website' => '<a href="http://www.nexusphp.com">http://www.nexusphp.com</a>',
|
||||||
|
);
|
||||||
|
$MAIN=array(
|
||||||
|
'site_online' => 'yes',
|
||||||
|
'max_torrent_size' => '1048576',
|
||||||
|
'announce_interval' => '1800',
|
||||||
|
'annintertwoage' => '7',
|
||||||
|
'annintertwo' => '2700',
|
||||||
|
'anninterthreeage' => '30',
|
||||||
|
'anninterthree' => '3600',
|
||||||
|
'signup_timeout' => '259200',
|
||||||
|
'minoffervotes' => '15',
|
||||||
|
'offervotetimeout' => '259200',
|
||||||
|
'offeruptimeout' => '86400',
|
||||||
|
'maxsubsize' => '3145728',
|
||||||
|
'postsperpage' => '10',
|
||||||
|
'topicsperpage' => '20',
|
||||||
|
'torrentsperpage' => '50',
|
||||||
|
'maxnewsnum' => '3',
|
||||||
|
'max_dead_torrent_time' => '21600',
|
||||||
|
'maxusers' => '50000',
|
||||||
|
'torrent_dir' => 'torrents',
|
||||||
|
'iniupload' => '0',
|
||||||
|
'SITEEMAIL' => 'nobody@gmail.com',
|
||||||
|
'ACCOUNTANTID' => '1',
|
||||||
|
'ALIPAYACCOUNT' => '',
|
||||||
|
'PAYPALACCOUNT' => '',
|
||||||
|
'SLOGAN' => 'The Ultimate File Sharing Experience',
|
||||||
|
'icplicense' => '',
|
||||||
|
'autoclean_interval_one' => '900',
|
||||||
|
'autoclean_interval_two' => '1800',
|
||||||
|
'autoclean_interval_three' => '3600',
|
||||||
|
'autoclean_interval_four' => '43200',
|
||||||
|
'autoclean_interval_five' => '648000',
|
||||||
|
'reportemail' => 'nobody@gmail.com',
|
||||||
|
'invitesystem' => 'no',
|
||||||
|
'registration' => 'yes',
|
||||||
|
'showhotmovies' => 'no',
|
||||||
|
'showclassicmovies' => 'no',
|
||||||
|
'showimdbinfo' => 'no',
|
||||||
|
'enablenfo' => 'yes',
|
||||||
|
'enableschool' => 'no',
|
||||||
|
'restrictemail' => 'no',
|
||||||
|
'showpolls' => 'yes',
|
||||||
|
'showstats' => 'yes',
|
||||||
|
'showlastxtorrents' => 'no',
|
||||||
|
'showtrackerload' => 'yes',
|
||||||
|
'showshoutbox' => 'yes',
|
||||||
|
'showfunbox' => 'no',
|
||||||
|
'showoffer' => 'yes',
|
||||||
|
'sptime' => 'no',
|
||||||
|
'showhelpbox' => 'no',
|
||||||
|
'enablebitbucket' => 'yes',
|
||||||
|
'smalldescription' => 'yes',
|
||||||
|
'altname' => NULL,
|
||||||
|
'extforum' => 'no',
|
||||||
|
'extforumurl' => 'http://www.cc98.org',
|
||||||
|
'defaultlang' => 'en',
|
||||||
|
'defstylesheet' => '3',
|
||||||
|
'donation' => 'yes',
|
||||||
|
'spsct' => NULL,
|
||||||
|
'browsecat' => '4',
|
||||||
|
'specialcat' => NULL,
|
||||||
|
'waitsystem' => 'no',
|
||||||
|
'maxdlsystem' => 'no',
|
||||||
|
'bitbucket' => 'bitbucket',
|
||||||
|
'torrentnameprefix' => '[Nexus]',
|
||||||
|
'showforumstats' => 'yes',
|
||||||
|
'verification' => 'automatic',
|
||||||
|
'invite_count' => '0',
|
||||||
|
'invite_timeout' => '7',
|
||||||
|
'seeding_leeching_time_calc_start' => '',
|
||||||
|
'startsubid' => NULL,
|
||||||
|
'logo' => '',
|
||||||
|
);
|
||||||
|
$SECURITY=array(
|
||||||
|
'securelogin' => 'no',
|
||||||
|
'securetracker' => 'no',
|
||||||
|
'https_announce_url' => '',
|
||||||
|
'iv' => 'yes',
|
||||||
|
'maxip' => '2',
|
||||||
|
'maxloginattempts' => '10',
|
||||||
|
'changeemail' => 'no',
|
||||||
|
'cheaterdet' => '1',
|
||||||
|
'nodetect' => '11',
|
||||||
|
);
|
||||||
|
$SMTP=array(
|
||||||
|
'smtptype' => 'advanced',
|
||||||
|
'emailnotify' => 'no',
|
||||||
|
'smtp_host' => 'localhost',
|
||||||
|
'smtp_port' => '233',
|
||||||
|
'smtp_from' => NULL,
|
||||||
|
);
|
||||||
|
$TORRENT=array(
|
||||||
|
'prorules' => 'no',
|
||||||
|
'randomhalfleech' => '5',
|
||||||
|
'randomfree' => '2',
|
||||||
|
'randomtwoup' => '2',
|
||||||
|
'randomtwoupfree' => '1',
|
||||||
|
'randomtwouphalfdown' => '0',
|
||||||
|
'randomthirtypercentdown' => '0',
|
||||||
|
'largesize' => '20',
|
||||||
|
'largepro' => '2',
|
||||||
|
'expirehalfleech' => '150',
|
||||||
|
'expirefree' => '60',
|
||||||
|
'expiretwoup' => '60',
|
||||||
|
'expiretwoupfree' => '30',
|
||||||
|
'expiretwouphalfleech' => '30',
|
||||||
|
'expirethirtypercentleech' => '0',
|
||||||
|
'expirenormal' => '0',
|
||||||
|
'hotdays' => '7',
|
||||||
|
'hotseeder' => '10',
|
||||||
|
'halfleechbecome' => '1',
|
||||||
|
'freebecome' => '1',
|
||||||
|
'twoupbecome' => '1',
|
||||||
|
'twoupfreebecome' => '1',
|
||||||
|
'twouphalfleechbecome' => '1',
|
||||||
|
'thirtypercentleechbecome' => '1',
|
||||||
|
'normalbecome' => '1',
|
||||||
|
'uploaderdouble' => '1',
|
||||||
|
'deldeadtorrent' => '0',
|
||||||
|
);
|
||||||
|
$TWEAK=array(
|
||||||
|
'where' => 'no',
|
||||||
|
'iplog1' => 'yes',
|
||||||
|
'bonus' => 'enable',
|
||||||
|
'datefounded' => '2010-08-19',
|
||||||
|
'titlekeywords' => '',
|
||||||
|
'metakeywords' => '',
|
||||||
|
'metadescription' => '',
|
||||||
|
'enablelocation' => 'yes',
|
||||||
|
'enablesqldebug' => 'no',
|
||||||
|
'sqldebug' => '13',
|
||||||
|
'cssdate' => '',
|
||||||
|
'enabletooltip' => 'yes',
|
||||||
|
'prolinkimg' => 'pic/prolink.png',
|
||||||
|
'analyticscode' => '',
|
||||||
|
);
|
||||||
47
confirm.php
Normal file
47
confirm.php
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
require_once("include/bittorrent.php");
|
||||||
|
header("Content-Type: text/html; charset=utf-8");
|
||||||
|
$id = (int) $_GET["id"];
|
||||||
|
$confirm_md5 = $_GET["secret"];
|
||||||
|
|
||||||
|
if (!$id)
|
||||||
|
httperr();
|
||||||
|
|
||||||
|
dbconn();
|
||||||
|
|
||||||
|
$res = sql_query("SELECT passhash, secret, editsecret, status FROM users WHERE id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
|
||||||
|
$row = mysql_fetch_assoc($res);
|
||||||
|
|
||||||
|
if (!$row)
|
||||||
|
httperr();
|
||||||
|
|
||||||
|
if ($row["status"] != "pending") {
|
||||||
|
header("Refresh: 0; url=ok.php?type=confirmed");
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
$confirm_sec = hash_pad($row["secret"]);
|
||||||
|
if ($confirm_md5 != md5($confirm_sec))
|
||||||
|
httperr();
|
||||||
|
|
||||||
|
sql_query("UPDATE users SET status='confirmed', editsecret='' WHERE id=".sqlesc($id)." AND status='pending'") or sqlerr(__FILE__, __LINE__);
|
||||||
|
|
||||||
|
if (!mysql_affected_rows())
|
||||||
|
httperr();
|
||||||
|
|
||||||
|
|
||||||
|
if ($securelogin == "yes")
|
||||||
|
{
|
||||||
|
$securelogin_indentity_cookie = true;
|
||||||
|
$passh = md5($row["passhash"].$_SERVER["REMOTE_ADDR"]);
|
||||||
|
}
|
||||||
|
else // when it's op, default is not use secure login
|
||||||
|
{
|
||||||
|
$securelogin_indentity_cookie = false;
|
||||||
|
$passh = md5($row["passhash"]);
|
||||||
|
}
|
||||||
|
logincookie($row["id"], $passh,1,0x7fffffff,$securelogin_indentity_cookie);
|
||||||
|
//sessioncookie($row["id"], $passh,false);
|
||||||
|
|
||||||
|
header("Refresh: 0; url=ok.php?type=confirm");
|
||||||
|
?>
|
||||||
123
confirm_resend.php
Normal file
123
confirm_resend.php
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
<?php
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
failedloginscheck ("Re-send",true);
|
||||||
|
|
||||||
|
$langid = 0 + $_GET['sitelanguage'];
|
||||||
|
if ($langid)
|
||||||
|
{
|
||||||
|
$lang_folder = validlang($langid);
|
||||||
|
if(get_langfolder_cookie() != $lang_folder)
|
||||||
|
{
|
||||||
|
set_langfolder_cookie($lang_folder);
|
||||||
|
header("Location: " . $_SERVER['PHP_SELF']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
require_once(get_langfile_path("", false, $CURLANGDIR));
|
||||||
|
|
||||||
|
function bark($msg) {
|
||||||
|
global $lang_confirm_resend;
|
||||||
|
stdhead();
|
||||||
|
stdmsg($lang_confirm_resend['resend_confirmation_email_failed'], $msg);
|
||||||
|
stdfoot();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
if ($verification == "admin")
|
||||||
|
bark($lang_confirm_resend['std_need_admin_verification']);
|
||||||
|
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] == "POST")
|
||||||
|
{
|
||||||
|
if ($iv == "yes")
|
||||||
|
check_code ($_POST['imagehash'], $_POST['imagestring'],"confirm_resend.php",true);
|
||||||
|
$email = unesc(htmlspecialchars(trim($_POST["email"])));
|
||||||
|
$wantpassword = unesc(htmlspecialchars(trim($_POST["wantpassword"])));
|
||||||
|
$passagain = unesc(htmlspecialchars(trim($_POST["passagain"])));
|
||||||
|
|
||||||
|
$email = safe_email($email);
|
||||||
|
if (empty($wantpassword) || empty($passagain) || empty($email))
|
||||||
|
bark($lang_confirm_resend['std_fields_blank']);
|
||||||
|
|
||||||
|
if (!check_email($email))
|
||||||
|
failedlogins($lang_confirm_resend['std_invalid_email_address'],true);
|
||||||
|
$res = sql_query("SELECT * FROM users WHERE email=" . sqlesc($email) . " LIMIT 1") or sqlerr(__FILE__, __LINE__);
|
||||||
|
$arr = mysql_fetch_assoc($res) or failedlogins($lang_confirm_resend['std_email_not_found'],true);
|
||||||
|
if($arr["status"] != "pending") failedlogins($lang_confirm_resend['std_user_already_confirm'],true);
|
||||||
|
|
||||||
|
if ($wantpassword != $passagain)
|
||||||
|
bark($lang_confirm_resend['std_passwords_unmatched']);
|
||||||
|
|
||||||
|
if (strlen($wantpassword) < 6)
|
||||||
|
bark($lang_confirm_resend['std_password_too_short']);
|
||||||
|
|
||||||
|
if (strlen($wantpassword) > 40)
|
||||||
|
bark($lang_confirm_resend['std_password_too_long']);
|
||||||
|
|
||||||
|
if ($wantpassword == $wantusername)
|
||||||
|
bark($lang_confirm_resend['std_password_equals_username']);
|
||||||
|
|
||||||
|
$secret = mksecret();
|
||||||
|
$wantpasshash = md5($secret . $wantpassword . $secret);
|
||||||
|
$editsecret = ($verification == 'admin' ? '' : $secret);
|
||||||
|
|
||||||
|
sql_query("UPDATE users SET passhash=" .sqlesc($wantpasshash) . ",secret=" . sqlesc($secret) . ",editsecret=" . sqlesc($editsecret) . " WHERE id=" . sqlesc($arr["id"])) or sqlerr(__FILE__, __LINE__);
|
||||||
|
|
||||||
|
if (!mysql_affected_rows())
|
||||||
|
stderr($lang_confirm_resend['std_error'], $lang_confirm_resend['std_database_error']);
|
||||||
|
|
||||||
|
$psecret = md5($editsecret);
|
||||||
|
$ip = getip() ;
|
||||||
|
$usern = $arr["username"];
|
||||||
|
$id = $arr["id"];
|
||||||
|
$title = $SITENAME.$lang_confirm_resend['mail_title'];
|
||||||
|
|
||||||
|
$body = <<<EOD
|
||||||
|
{$lang_confirm_resend['mail_one']}$usern{$lang_confirm_resend['mail_two']}($email){$lang_confirm_resend['mail_three']}$ip{$lang_confirm_resend['mail_four']}
|
||||||
|
<b><a href="javascript:void(null)" onclick="window.open('http://$BASEURL/confirm.php?id=$id&secret=$psecret')">
|
||||||
|
{$lang_confirm_resend['mail_this_link']} </a></b><br />
|
||||||
|
http://$BASEURL/confirm.php?id=$id&secret=$psecret
|
||||||
|
{$lang_confirm_resend['mail_four_1']}
|
||||||
|
<b><a href="javascript:void(null)" onclick="window.open('http://$BASEURL/confirm_resend.php')">{$lang_confirm_resend['mail_here']}</a></b><br />
|
||||||
|
http://$BASEURL/confirm_resend.php
|
||||||
|
<br />
|
||||||
|
{$lang_confirm_resend['mail_five']}
|
||||||
|
EOD;
|
||||||
|
|
||||||
|
sent_mail($email,$SITENAME,$SITEEMAIL,change_email_encode(get_langfolder_cookie(), $title),change_email_encode(get_langfolder_cookie(),$body),"signup",false,false,'',get_email_encode(get_langfolder_cookie()));
|
||||||
|
header("Location: " . get_protocol_prefix() . "$BASEURL/ok.php?type=signup&email=" . rawurlencode($email));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
stdhead();
|
||||||
|
$s = "<select name=\"sitelanguage\" onchange='submit()'>\n";
|
||||||
|
|
||||||
|
$langs = langlist("site_lang");
|
||||||
|
|
||||||
|
foreach ($langs as $row)
|
||||||
|
{
|
||||||
|
if ($row["site_lang_folder"] == get_langfolder_cookie()) $se = " selected=\"selected\""; else $se = "";
|
||||||
|
$s .= "<option value=\"". $row["id"]."\" " . $se. ">" . htmlspecialchars($row["lang_name"]) . "</option>\n";
|
||||||
|
}
|
||||||
|
$s .= "\n</select>";
|
||||||
|
?>
|
||||||
|
<form method="get" action="<?php echo $_SERVER['PHP_SELF'] ?>">
|
||||||
|
<?php
|
||||||
|
print("<div align=\"right\">".$lang_confirm_resend['text_select_lang']. $s . "</div>");
|
||||||
|
?>
|
||||||
|
</form>
|
||||||
|
<?php echo $lang_confirm_resend['text_resend_confirmation_mail_note']?>
|
||||||
|
<p><?php echo $lang_confirm_resend['text_you_have'] ?><b><?php echo remaining ();?></b><?php echo $lang_confirm_resend['text_remaining_tries'] ?></p>
|
||||||
|
<form method="post" action="confirm_resend.php">
|
||||||
|
<table border="1" cellspacing="0" cellpadding="10">
|
||||||
|
<tr><td class="rowhead nowrap"><?php echo $lang_confirm_resend['row_registered_email'] ?></td>
|
||||||
|
<td class="rowfollow"><input type="text" style="width: 200px" name="email" /></td></tr>
|
||||||
|
<tr><td class="rowhead nowrap"><?php echo $lang_confirm_resend['row_new_password'] ?></td><td align="left"><input type="password" style="width: 200px" name="wantpassword" /><br />
|
||||||
|
<font class="small"><?php echo $lang_confirm_resend['text_password_note'] ?></font></td></tr>
|
||||||
|
<tr><td class="rowhead nowrap"><?php echo $lang_confirm_resend['row_enter_password_again'] ?></td><td align="left"><input type="password" style="width: 200px" name="passagain" /></td></tr>
|
||||||
|
<?php
|
||||||
|
show_image_code();
|
||||||
|
?>
|
||||||
|
<tr><td class="toolbox" colspan="2" align="center"><input type="submit" class="btn" value="<?php echo $lang_confirm_resend['submit_send_it'] ?>" /></td></tr>
|
||||||
|
</table></form>
|
||||||
|
<?php
|
||||||
|
stdfoot();
|
||||||
|
}
|
||||||
35
confirmemail.php
Normal file
35
confirmemail.php
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
require_once("include/bittorrent.php");
|
||||||
|
|
||||||
|
if (!preg_match(':^/(\d{1,10})/([\w]{32})/(.+)$:', $_SERVER["PATH_INFO"], $matches))
|
||||||
|
httperr();
|
||||||
|
|
||||||
|
$id = 0 + $matches[1];
|
||||||
|
$md5 = $matches[2];
|
||||||
|
$email = urldecode($matches[3]);
|
||||||
|
//print($email);
|
||||||
|
//die();
|
||||||
|
|
||||||
|
if (!$id)
|
||||||
|
httperr();
|
||||||
|
dbconn();
|
||||||
|
|
||||||
|
$res = sql_query("SELECT editsecret FROM users WHERE id = $id");
|
||||||
|
$row = mysql_fetch_array($res);
|
||||||
|
|
||||||
|
if (!$row)
|
||||||
|
httperr();
|
||||||
|
|
||||||
|
$sec = hash_pad($row["editsecret"]);
|
||||||
|
if (preg_match('/^ *$/s', $sec))
|
||||||
|
httperr();
|
||||||
|
if ($md5 != md5($sec . $email . $sec))
|
||||||
|
httperr();
|
||||||
|
|
||||||
|
sql_query("UPDATE users SET editsecret='', email=" . sqlesc($email) . " WHERE id=$id AND editsecret=" . sqlesc($row["editsecret"]));
|
||||||
|
|
||||||
|
if (!mysql_affected_rows())
|
||||||
|
httperr();
|
||||||
|
|
||||||
|
header("Refresh: 0; url=" . get_protocol_prefix() . "$BASEURL/usercp.php?action=security&type=saved");
|
||||||
|
?>
|
||||||
16
contactstaff.php
Normal file
16
contactstaff.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
require_once(get_langfile_path());
|
||||||
|
|
||||||
|
loggedinorreturn();
|
||||||
|
stdhead($lang_contactstaff['head_contact_staff'], false);
|
||||||
|
begin_main_frame();
|
||||||
|
print("<form id=compose method=post name=\"compose\" action=takecontact.php>");
|
||||||
|
if ($_GET["returnto"] || $_SERVER["HTTP_REFERER"])
|
||||||
|
print("<input type=hidden name=returnto value=\"".(htmlspecialchars($_GET["returnto"]) ? htmlspecialchars($_GET["returnto"]) : htmlspecialchars($_SERVER["HTTP_REFERER"]))."\">");
|
||||||
|
begin_compose($lang_contactstaff['text_message_to_staff'], "new");
|
||||||
|
end_compose();
|
||||||
|
print("</form>");
|
||||||
|
end_main_frame();
|
||||||
|
stdfoot();
|
||||||
13
cron.php
Normal file
13
cron.php
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
require_once("include/bittorrent.php");
|
||||||
|
dbconn();
|
||||||
|
if ($useCronTriggerCleanUp) {
|
||||||
|
$return = autoclean();
|
||||||
|
if ($return) {
|
||||||
|
echo $return."\n";
|
||||||
|
} else {
|
||||||
|
echo "Clean-up not triggered.\n";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo "Forbidden. Clean-up is set to be browser-triggered.\n";
|
||||||
|
}
|
||||||
86
curtain_imageresizer.js
Normal file
86
curtain_imageresizer.js
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
if (navigator.appName=="Netscape") {
|
||||||
|
document.write("<style type='text/css'>body {overflow-y:scroll;}<\/style>");
|
||||||
|
}
|
||||||
|
var userAgent = navigator.userAgent.toLowerCase();
|
||||||
|
var is_ie = (userAgent.indexOf('msie') != -1) && userAgent.substr(userAgent.indexOf('msie') + 5, 3);
|
||||||
|
|
||||||
|
function $() {
|
||||||
|
var elements = new Array();
|
||||||
|
for (var i = 0; i < arguments.length; i++) {
|
||||||
|
var element = arguments[i];
|
||||||
|
if (typeof element == 'string')
|
||||||
|
element = document.getElementById(element);
|
||||||
|
if (arguments.length == 1)
|
||||||
|
return element;
|
||||||
|
elements.push(element);
|
||||||
|
}
|
||||||
|
return elements;
|
||||||
|
}
|
||||||
|
|
||||||
|
function Scale(image, max_width, max_height) {
|
||||||
|
var tempimage = new Image();
|
||||||
|
tempimage.src = image.src;
|
||||||
|
var tempwidth = tempimage.width;
|
||||||
|
var tempheight = tempimage.height;
|
||||||
|
if (tempwidth > max_width) {
|
||||||
|
image.height = tempheight = Math.round(((max_width)/tempwidth) * tempheight);
|
||||||
|
image.width = tempwidth = max_width;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (max_height != 0 && tempheight > max_height)
|
||||||
|
{
|
||||||
|
image.width = Math.round(((max_height)/tempheight) * tempwidth);
|
||||||
|
image.height = max_height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function check_avatar(image, langfolder){
|
||||||
|
var tempimage = new Image();
|
||||||
|
tempimage.src = image.src;
|
||||||
|
var displayheight = image.height;
|
||||||
|
var tempwidth = tempimage.width;
|
||||||
|
var tempheight = tempimage.height;
|
||||||
|
if (tempwidth > 250 || tempheight > 250 || displayheight > 250) {
|
||||||
|
image.src='pic/forum_pic/'+langfolder+'/avatartoobig.png';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Preview(image) {
|
||||||
|
if (!is_ie || is_ie >= 7){
|
||||||
|
$('lightbox').innerHTML = "<a onclick=\"Return();\"><img src=\"" + image.src + "\" /></a>";
|
||||||
|
$('curtain').style.display = "block";
|
||||||
|
$('lightbox').style.display = "block";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
window.open(image.src);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Previewurl(url) {
|
||||||
|
if (!is_ie || is_ie >= 7){
|
||||||
|
$('lightbox').innerHTML = "<a onclick=\"Return();\"><img src=\"" + url + "\" /></a>";
|
||||||
|
$('curtain').style.display = "block";
|
||||||
|
$('lightbox').style.display = "block";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
window.open(url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function findPosition( oElement ) {
|
||||||
|
if( typeof( oElement.offsetParent ) != 'undefined' ) {
|
||||||
|
for( var posX = 0, posY = 0; oElement; oElement = oElement.offsetParent ) {
|
||||||
|
posX += oElement.offsetLeft;
|
||||||
|
posY += oElement.offsetTop;
|
||||||
|
}
|
||||||
|
return [ posX, posY ];
|
||||||
|
} else {
|
||||||
|
return [ oElement.x, oElement.y ];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Return() {
|
||||||
|
$('lightbox').style.display = "none";
|
||||||
|
$('curtain').style.display = "none";
|
||||||
|
$('lightbox').innerHTML = "";
|
||||||
|
}
|
||||||
37
delacctadmin.php
Normal file
37
delacctadmin.php
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
if (get_user_class() < UC_ADMINISTRATOR)
|
||||||
|
stderr("Error", "Permission denied.");
|
||||||
|
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] == "POST")
|
||||||
|
{
|
||||||
|
$userid = trim($_POST["userid"]);
|
||||||
|
|
||||||
|
if (!$userid)
|
||||||
|
stderr("Error", "Please fill out the form correctly.");
|
||||||
|
|
||||||
|
$res = sql_query("SELECT * FROM users WHERE id=" . sqlesc($userid)) or sqlerr();
|
||||||
|
if (mysql_num_rows($res) != 1)
|
||||||
|
stderr("Error", "Bad user id or password. Please verify that all entered information is correct.");
|
||||||
|
$arr = mysql_fetch_assoc($res);
|
||||||
|
|
||||||
|
$id = $arr['id'];
|
||||||
|
$name = $arr['username'];
|
||||||
|
$res = sql_query("DELETE FROM users WHERE id=$id") or sqlerr();
|
||||||
|
if (mysql_affected_rows() != 1)
|
||||||
|
stderr("Error", "Unable to delete the account.");
|
||||||
|
stderr("Success", "The account <b>".htmlspecialchars($name)."</b> was deleted.",false);
|
||||||
|
}
|
||||||
|
stdhead("Delete account");
|
||||||
|
?>
|
||||||
|
<h1>Delete account</h1>
|
||||||
|
<table border=1 cellspacing=0 cellpadding=5>
|
||||||
|
<form method=post action=delacctadmin.php>
|
||||||
|
<tr><td class=rowhead>User name</td><td><input size=40 name=userid></td></tr>
|
||||||
|
|
||||||
|
<tr><td colspan=2><input type=submit class=btn value='Delete'></td></tr>
|
||||||
|
</form>
|
||||||
|
</table>
|
||||||
|
<?php
|
||||||
|
stdfoot();
|
||||||
87
delete.php
Normal file
87
delete.php
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
<?php
|
||||||
|
require_once("include/bittorrent.php");
|
||||||
|
dbconn();
|
||||||
|
require_once(get_langfile_path());
|
||||||
|
require_once(get_langfile_path("",true));
|
||||||
|
loggedinorreturn();
|
||||||
|
|
||||||
|
function bark($msg) {
|
||||||
|
global $lang_delete;
|
||||||
|
stdhead();
|
||||||
|
stdmsg($lang_delete['std_delete_failed'], $msg);
|
||||||
|
stdfoot();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!mkglobal("id"))
|
||||||
|
bark($lang_delete['std_missing_form_date']);
|
||||||
|
|
||||||
|
$id = 0 + $id;
|
||||||
|
if (!$id)
|
||||||
|
die();
|
||||||
|
|
||||||
|
$res = sql_query("SELECT name,owner,seeders,anonymous FROM torrents WHERE id = ".sqlesc($id));
|
||||||
|
$row = mysql_fetch_array($res);
|
||||||
|
if (!$row)
|
||||||
|
die();
|
||||||
|
|
||||||
|
if ($CURUSER["id"] != $row["owner"] && get_user_class() < $torrentmanage_class)
|
||||||
|
bark($lang_delete['std_not_owner']);
|
||||||
|
|
||||||
|
$rt = 0 + $_POST["reasontype"];
|
||||||
|
|
||||||
|
if (!is_int($rt) || $rt < 1 || $rt > 5)
|
||||||
|
bark($lang_delete['std_invalid_reason']."$rt.");
|
||||||
|
|
||||||
|
$r = $_POST["r"];
|
||||||
|
$reason = $_POST["reason"];
|
||||||
|
|
||||||
|
if ($rt == 1)
|
||||||
|
$reasonstr = "Dead: 0 seeders, 0 leechers = 0 peers total";
|
||||||
|
elseif ($rt == 2)
|
||||||
|
$reasonstr = "Dupe" . ($reason[0] ? (": " . trim($reason[0])) : "!");
|
||||||
|
elseif ($rt == 3)
|
||||||
|
$reasonstr = "Nuked" . ($reason[1] ? (": " . trim($reason[1])) : "!");
|
||||||
|
elseif ($rt == 4)
|
||||||
|
{
|
||||||
|
if (!$reason[2])
|
||||||
|
bark($lang_delete['std_describe_violated_rule']);
|
||||||
|
$reasonstr = $SITENAME." rules broken: " . trim($reason[2]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!$reason[3])
|
||||||
|
bark($lang_delete['std_enter_reason']);
|
||||||
|
$reasonstr = trim($reason[3]);
|
||||||
|
}
|
||||||
|
|
||||||
|
deletetorrent($id);
|
||||||
|
|
||||||
|
if ($row['anonymous'] == 'yes' && $CURUSER["id"] == $row["owner"]) {
|
||||||
|
write_log("Torrent $id ($row[name]) was deleted by its anonymous uploader ($reasonstr)",'normal');
|
||||||
|
} else {
|
||||||
|
write_log("Torrent $id ($row[name]) was deleted by $CURUSER[username] ($reasonstr)",'normal');
|
||||||
|
}
|
||||||
|
|
||||||
|
//===remove karma
|
||||||
|
KPS("-",$uploadtorrent_bonus,$row["owner"]);
|
||||||
|
|
||||||
|
//Send pm to torrent uploader
|
||||||
|
if ($CURUSER["id"] != $row["owner"]){
|
||||||
|
$dt = sqlesc(date("Y-m-d H:i:s"));
|
||||||
|
$subject = sqlesc($lang_delete_target[get_user_lang($row["owner"])]['msg_torrent_deleted']);
|
||||||
|
$msg = sqlesc($lang_delete_target[get_user_lang($row["owner"])]['msg_the_torrent_you_uploaded'].$row['name'].$lang_delete_target[get_user_lang($row["owner"])]['msg_was_deleted_by']."[url=userdetails.php?id=".$CURUSER['id']."]".$CURUSER['username']."[/url]".$lang_delete_target[get_user_lang($row["owner"])]['msg_reason_is'].$reasonstr);
|
||||||
|
sql_query("INSERT INTO messages (sender, receiver, subject, added, msg) VALUES(0, $row[owner], $subject, $dt, $msg)") or sqlerr(__FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
stdhead($lang_delete['head_torrent_deleted']);
|
||||||
|
|
||||||
|
if (isset($_POST["returnto"]))
|
||||||
|
$ret = "<a href=\"" . htmlspecialchars($_POST["returnto"]) . "\">".$lang_delete['text_go_back']."</a>";
|
||||||
|
else
|
||||||
|
$ret = "<a href=\"index.php\">".$lang_delete['text_back_to_index']."</a>";
|
||||||
|
|
||||||
|
?>
|
||||||
|
<h1><?php echo $lang_delete['text_torrent_deleted'] ?></h1>
|
||||||
|
<p><?php echo $ret ?></p>
|
||||||
|
<?php
|
||||||
|
stdfoot();
|
||||||
44
deletedisabled.php
Normal file
44
deletedisabled.php
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
loggedinorreturn();
|
||||||
|
require_once(get_langfile_path());
|
||||||
|
if (get_user_class() < UC_SYSOP)
|
||||||
|
permissiondenied();
|
||||||
|
|
||||||
|
$shownotice=false;
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] == "POST")
|
||||||
|
{
|
||||||
|
if ($_POST['sure'])
|
||||||
|
{
|
||||||
|
$res=sql_query("DELETE FROM users WHERE enabled='no'");
|
||||||
|
$deletecount=mysql_affected_rows();
|
||||||
|
$shownotice=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stdhead($lang_deletedisabled['head_delete_diasabled']);
|
||||||
|
begin_main_frame();
|
||||||
|
?>
|
||||||
|
<h1 align="center"><?php echo $lang_deletedisabled['text_delete_diasabled']?></h1>
|
||||||
|
<?php
|
||||||
|
if ($shownotice)
|
||||||
|
{
|
||||||
|
?>
|
||||||
|
<div style="text-align: center;"><?php echo $deletecount.$lang_deletedisabled['text_users_are_disabled']?></div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
?>
|
||||||
|
<div style="text-align: center;"><?php echo $lang_deletedisabled['text_delete_disabled_note']?></div>
|
||||||
|
<div style="text-align: center; margin-top: 10px;">
|
||||||
|
<form method="post" action="?">
|
||||||
|
<input type="hidden" name="sure" value="1" />
|
||||||
|
<input type="submit" value="<?php echo $lang_deletedisabled['submit_delete_all_disabled_users']?>" />
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
end_main_frame();
|
||||||
|
stdfoot();
|
||||||
|
?>
|
||||||
43
deletemessage.php
Normal file
43
deletemessage.php
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
$id = $_GET["id"];
|
||||||
|
if (!is_numeric($id) || $id < 1 || floor($id) != $id)
|
||||||
|
die("Invalid ID");
|
||||||
|
|
||||||
|
$type = $_GET["type"];
|
||||||
|
|
||||||
|
dbconn();
|
||||||
|
require_once(get_langfile_path());
|
||||||
|
loggedinorreturn();
|
||||||
|
if ($type == 'in')
|
||||||
|
{
|
||||||
|
// make sure message is in CURUSER's Inbox
|
||||||
|
$res = sql_query("SELECT receiver, location FROM messages WHERE id=" . sqlesc($id)) or die("barf");
|
||||||
|
$arr = mysql_fetch_array($res) or die($lang_deletemessage['std_bad_message_id']);
|
||||||
|
if ($arr["receiver"] != $CURUSER["id"])
|
||||||
|
die($lang_deletemessage['std_not_suggested']);
|
||||||
|
if ($arr["location"] == 'in')
|
||||||
|
sql_query("DELETE FROM messages WHERE id=" . sqlesc($id)) or die('delete failed (error code 1).. this should never happen, contact an admin.');
|
||||||
|
else if ($arr["location"] == 'both')
|
||||||
|
sql_query("UPDATE messages SET location = 'out' WHERE id=" . sqlesc($id)) or die('delete failed (error code 2).. this should never happen, contact an admin.');
|
||||||
|
else
|
||||||
|
die($lang_deletemessage['std_not_in_inbox']);
|
||||||
|
}
|
||||||
|
elseif ($type == 'out')
|
||||||
|
{
|
||||||
|
// make sure message is in CURUSER's Sentbox
|
||||||
|
$res = sql_query("SELECT sender, location FROM messages WHERE id=" . sqlesc($id)) or die("barf");
|
||||||
|
$arr = mysql_fetch_array($res) or die($lang_deletemessage['std_bad_message_id']);
|
||||||
|
if ($arr["sender"] != $CURUSER["id"])
|
||||||
|
die($lang_deletemessage['std_not_suggested']);
|
||||||
|
if ($arr["location"] == 'out')
|
||||||
|
sql_query("DELETE FROM messages WHERE id=" . sqlesc($id)) or die('delete failed (error code 3).. this should never happen, contact an admin.');
|
||||||
|
else if ($arr["location"] == 'both')
|
||||||
|
sql_query("UPDATE messages SET location = 'in' WHERE id=" . sqlesc($id)) or die('delete failed (error code 4).. this should never happen, contact an admin.');
|
||||||
|
else
|
||||||
|
die($lang_deletemessage['std_not_in_sentbox']);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
die($lang_deletemessage['std_unknown_pm_type']);
|
||||||
|
header("Location: " . get_protocol_prefix() . "$BASEURL/messages.php".($type == 'out'?"?out=1":""));
|
||||||
|
?>
|
||||||
583
details.php
Normal file
583
details.php
Normal file
@@ -0,0 +1,583 @@
|
|||||||
|
<?php
|
||||||
|
ob_start(); //Do not delete this line
|
||||||
|
require_once("include/bittorrent.php");
|
||||||
|
dbconn();
|
||||||
|
require_once(get_langfile_path());
|
||||||
|
if ($showextinfo['imdb'] == 'yes')
|
||||||
|
require_once("imdb/imdb.class.php");
|
||||||
|
loggedinorreturn();
|
||||||
|
|
||||||
|
$id = 0 + $_GET["id"];
|
||||||
|
|
||||||
|
int_check($id);
|
||||||
|
if (!isset($id) || !$id)
|
||||||
|
die();
|
||||||
|
|
||||||
|
$res = sql_query("SELECT torrents.cache_stamp, torrents.sp_state, torrents.url, torrents.small_descr, torrents.seeders, torrents.banned, torrents.leechers, torrents.info_hash, torrents.filename, nfo, LENGTH(torrents.nfo) AS nfosz, torrents.last_action, torrents.name, torrents.owner, torrents.save_as, torrents.descr, torrents.visible, torrents.size, torrents.added, torrents.views, torrents.hits, torrents.times_completed, torrents.id, torrents.type, torrents.numfiles, torrents.anonymous, categories.name AS cat_name, sources.name AS source_name, media.name AS medium_name, codecs.name AS codec_name, standards.name AS standard_name, processings.name AS processing_name, teams.name AS team_name, audiocodecs.name AS audiocodec_name FROM torrents LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN sources ON torrents.source = sources.id LEFT JOIN media ON torrents.medium = media.id LEFT JOIN codecs ON torrents.codec = codecs.id LEFT JOIN standards ON torrents.standard = standards.id LEFT JOIN processings ON torrents.processing = processings.id LEFT JOIN teams ON torrents.team = teams.id LEFT JOIN audiocodecs ON torrents.audiocodec = audiocodecs.id WHERE torrents.id = $id LIMIT 1")
|
||||||
|
or sqlerr();
|
||||||
|
$row = mysql_fetch_array($res);
|
||||||
|
|
||||||
|
if (get_user_class() >= $torrentmanage_class || $CURUSER["id"] == $row["owner"])
|
||||||
|
$owned = 1;
|
||||||
|
else $owned = 0;
|
||||||
|
|
||||||
|
if (!$row)
|
||||||
|
stderr($lang_details['std_error'], $lang_details['std_no_torrent_id']);
|
||||||
|
elseif ($row['banned'] == 'yes' && get_user_class() < $seebanned_class)
|
||||||
|
permissiondenied();
|
||||||
|
else {
|
||||||
|
if ($_GET["hit"]) {
|
||||||
|
sql_query("UPDATE torrents SET views = views + 1 WHERE id = $id");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($_GET["cmtpage"])) {
|
||||||
|
stdhead($lang_details['head_details_for_torrent']. "\"" . $row["name"] . "\"");
|
||||||
|
|
||||||
|
if ($_GET["uploaded"])
|
||||||
|
{
|
||||||
|
print("<h1 align=\"center\">".$lang_details['text_successfully_uploaded']."</h1>");
|
||||||
|
print("<p>".$lang_details['text_redownload_torrent_note']."</p>");
|
||||||
|
header("refresh: 1; url=download.php?id=$id");
|
||||||
|
//header("refresh: 1; url=getimdb.php?id=$id&type=1");
|
||||||
|
}
|
||||||
|
elseif ($_GET["edited"]) {
|
||||||
|
print("<h1 align=\"center\">".$lang_details['text_successfully_edited']."</h1>");
|
||||||
|
if (isset($_GET["returnto"]))
|
||||||
|
print("<p><b>".$lang_details['text_go_back'] . "<a href=\"".htmlspecialchars($_GET["returnto"])."\">" . $lang_details['text_whence_you_came']."</a></b></p>");
|
||||||
|
}
|
||||||
|
$sp_torrent = get_torrent_promotion_append($row[sp_state],'word');
|
||||||
|
|
||||||
|
$s=htmlspecialchars($row["name"]).($sp_torrent ? " ".$sp_torrent : "");
|
||||||
|
print("<h1 align=\"center\" id=\"top\">".$s."</h1>\n");
|
||||||
|
print("<table width=\"940\" cellspacing=\"0\" cellpadding=\"5\">\n");
|
||||||
|
|
||||||
|
$url = "edit.php?id=" . $row["id"];
|
||||||
|
if (isset($_GET["returnto"])) {
|
||||||
|
$url .= "&returnto=" . rawurlencode($_GET["returnto"]);
|
||||||
|
}
|
||||||
|
$editlink = "a title=\"".$lang_details['title_edit_torrent']."\" href=\"$url\"";
|
||||||
|
|
||||||
|
// ------------- start upped by block ------------------//
|
||||||
|
if($row['anonymous'] == 'yes') {
|
||||||
|
if (get_user_class() < $viewanonymous_class)
|
||||||
|
$uprow = "<i>".$lang_details['text_anonymous']."</i>";
|
||||||
|
else
|
||||||
|
$uprow = "<i>".$lang_details['text_anonymous']."</i> (" . get_username($row['owner'], false, true, true, false, false, true) . ")";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$uprow = (isset($row['owner']) ? get_username($row['owner'], false, true, true, false, false, true) : "<i>".$lang_details['text_unknown']."</i>");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($CURUSER["id"] == $row["owner"])
|
||||||
|
$CURUSER["downloadpos"] = "yes";
|
||||||
|
if ($CURUSER["downloadpos"] != "no")
|
||||||
|
{
|
||||||
|
print("<tr><td class=\"rowhead\" width=\"13%\">".$lang_details['row_download']."</td><td class=\"rowfollow\" width=\"87%\" align=\"left\">");
|
||||||
|
if ($CURUSER['timetype'] != 'timealive')
|
||||||
|
$uploadtime = $lang_details['text_at'].$row['added'];
|
||||||
|
else $uploadtime = $lang_details['text_blank'].gettime($row['added'],true,false);
|
||||||
|
print("<a class=\"index\" href=\"download.php?id=$id\">" . htmlspecialchars($torrentnameprefix ."." .$row["save_as"]) . ".torrent</a> <a id=\"bookmark0\" href=\"javascript: bookmark(".$row['id'].",0);\">".get_torrent_bookmark_state($CURUSER['id'], $row['id'], false)."</a> ".$lang_details['row_upped_by']." ".$uprow.$uploadtime);
|
||||||
|
print("</td></tr>");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
tr($lang_details['row_download'], $lang_details['text_downloading_not_allowed']);
|
||||||
|
if ($smalldescription_main == 'yes')
|
||||||
|
tr($lang_details['row_small_description'],htmlspecialchars(trim($row["small_descr"])),true);
|
||||||
|
|
||||||
|
$size_info = "<b>".$lang_details['text_size']."</b>" . mksize($row["size"]);
|
||||||
|
$type_info = " <b>".$lang_details['row_type'].":</b> ".$row["cat_name"];
|
||||||
|
if (isset($row["source_name"]))
|
||||||
|
$source_info = " <b>".$lang_details['text_source']." </b>".$row[source_name];
|
||||||
|
if (isset($row["medium_name"]))
|
||||||
|
$medium_info = " <b>".$lang_details['text_medium']." </b>".$row[medium_name];
|
||||||
|
if (isset($row["codec_name"]))
|
||||||
|
$codec_info = " <b>".$lang_details['text_codec']." </b>".$row[codec_name];
|
||||||
|
if (isset($row["standard_name"]))
|
||||||
|
$standard_info = " <b>".$lang_details['text_stardard']." </b>".$row[standard_name];
|
||||||
|
if (isset($row["processing_name"]))
|
||||||
|
$processing_info = " <b>".$lang_details['text_processing']." </b>".$row[processing_name];
|
||||||
|
if (isset($row["team_name"]))
|
||||||
|
$team_info = " <b>".$lang_details['text_team']." </b>".$row[team_name];
|
||||||
|
if (isset($row["audiocodec_name"]))
|
||||||
|
$audiocodec_info = " <b>".$lang_details['text_audio_codec']." </b>".$row[audiocodec_name];
|
||||||
|
|
||||||
|
tr($lang_details['row_basic_info'], $size_info.$type_info.$source_info . $medium_info. $codec_info . $audiocodec_info. $standard_info . $processing_info . $team_info, 1);
|
||||||
|
if ($CURUSER["downloadpos"] != "no")
|
||||||
|
$download = "<a title=\"".$lang_details['title_download_torrent']."\" href=\"download.php?id=".$id."\"><img class=\"dt_download\" src=\"pic/trans.gif\" alt=\"download\" /> <b><font class=\"small\">".$lang_details['text_download_torrent']."</font></b></a> | ";
|
||||||
|
else $download = "";
|
||||||
|
|
||||||
|
tr($lang_details['row_action'], $download. ($owned == 1 ? "<$editlink><img class=\"dt_edit\" src=\"pic/trans.gif\" alt=\"edit\" /> <b><font class=\"small\">".$lang_details['text_edit_torrent'] . "</font></b></a> | " : ""). (get_user_class() >= $askreseed_class && $row[seeders] == 0 ? "<a title=\"".$lang_details['title_ask_for_reseed']."\" href=\"takereseed.php?reseedid=$id\"><img class=\"dt_reseed\" src=\"pic/trans.gif\" alt=\"reseed\"> <b><font class=\"small\">".$lang_details['text_ask_for_reseed'] ."</font></b></a> | " : "") . "<a title=\"".$lang_details['title_report_torrent']."\" href=\"report.php?torrent=$id\"><img class=\"dt_report\" src=\"pic/trans.gif\" alt=\"report\" /> <b><font class=\"small\">".$lang_details['text_report_torrent']."</font></b></a>", 1);
|
||||||
|
|
||||||
|
// ---------------- start subtitle block -------------------//
|
||||||
|
$r = sql_query("SELECT subs.*, language.flagpic, language.lang_name FROM subs LEFT JOIN language ON subs.lang_id=language.id WHERE torrent_id = " . sqlesc($row["id"]). " ORDER BY subs.lang_id ASC") or sqlerr(__FILE__, __LINE__);
|
||||||
|
print("<tr><td class=\"rowhead\" valign=\"top\">".$lang_details['row_subtitles']."</td>");
|
||||||
|
print("<td class=\"rowfollow\" align=\"left\" valign=\"top\">");
|
||||||
|
print("<table border=\"0\" cellspacing=\"0\">");
|
||||||
|
if (mysql_num_rows($r) > 0)
|
||||||
|
{
|
||||||
|
while($a = mysql_fetch_assoc($r))
|
||||||
|
{
|
||||||
|
$lang = "<tr><td class=\"embedded\"><img border=\"0\" src=\"pic/flag/". $a["flagpic"] . "\" alt=\"" . $a["lang_name"] . "\" title=\"" . $a["lang_name"] . "\" style=\"padding-bottom: 4px\" /></td>";
|
||||||
|
$lang .= "<td class=\"embedded\"> <a href=\"downloadsubs.php?torrentid=".$a[torrent_id]."&subid=".$a[id]."\"><u>". $a["title"]. "</u></a>".(get_user_class() >= $submanage_class || (get_user_class() >= $delownsub_class && $a["uppedby"] == $CURUSER["id"]) ? " <font class=\"small\"><a href=\"subtitles.php?delete=".$a[id]."\">[".$lang_details['text_delete']."</a>]</font>" : "")."</td><td class=\"embedded\"> ".($a["anonymous"] == 'yes' ? $lang_details['text_anonymous'] . (get_user_class() >= $viewanonymous_class ? get_username($a['uppedby'],false,true,true,false,true) : "") : get_username($a['uppedby']))."</td></tr>";
|
||||||
|
print($lang);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
print("<tr><td class=\"embedded\">".$lang_details['text_no_subtitles']."</td></tr>");
|
||||||
|
print("</table>");
|
||||||
|
print("<table border=\"0\" cellspacing=\"0\"><tr>");
|
||||||
|
if($CURUSER['id']==$row['owner'] || get_user_class() >= $uploadsub_class)
|
||||||
|
{
|
||||||
|
print("<td class=\"embedded\"><form method=\"post\" action=\"subtitles.php\"><input type=\"hidden\" name=\"torrent_name\" value=\"" . $row["name"]. "\" /><input type=\"hidden\" name=\"detail_torrent_id\" value=\"" . $row["id"]. "\" /><input type=\"hidden\" name=\"in_detail\" value=\"in_detail\" /><input type=\"submit\" value=\"".$lang_details['submit_upload_subtitles']."\" /></form></td>");
|
||||||
|
}
|
||||||
|
$moviename = "";
|
||||||
|
$imdb_id = parse_imdb_id($row["url"]);
|
||||||
|
if ($imdb_id && $showextinfo['imdb'] == 'yes')
|
||||||
|
{
|
||||||
|
$thenumbers = $imdb_id;
|
||||||
|
if (!$moviename = $Cache->get_value('imdb_id_'.$thenumbers.'_movie_name')){
|
||||||
|
$movie = new imdb ($thenumbers);
|
||||||
|
$target = array('Title');
|
||||||
|
switch ($movie->cachestate($target)){
|
||||||
|
case "1":{
|
||||||
|
$moviename = $movie->title (); break;
|
||||||
|
$Cache->cache_value('imdb_id_'.$thenumbers.'_movie_name', $moviename, 1296000);
|
||||||
|
}
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print("<td class=\"embedded\"><form method=\"get\" action=\"http://shooter.cn/sub/\" target=\"_blank\"><input type=\"text\" name=\"searchword\" id=\"keyword\" style=\"width: 250px\" value=\"".$moviename."\" /><input type=\"submit\" value=\"".$lang_details['submit_search_at_shooter']."\" /></form></td><td class=\"embedded\"><form method=\"get\" action=\"http://www.opensubtitles.org/en/search2/\" target=\"_blank\"><input type=\"hidden\" id=\"moviename\" name=\"MovieName\" /><input type=\"hidden\" name=\"action\" value=\"search\" /><input type=\"hidden\" name=\"SubLanguageID\" value=\"all\" /><input onclick=\"document.getElementById('moviename').value=document.getElementById('keyword').value;\" type=\"submit\" value=\"".$lang_details['submit_search_at_opensubtitles']."\" /></form></td>\n");
|
||||||
|
print("</tr></table>");
|
||||||
|
print("</td></tr>\n");
|
||||||
|
// ---------------- end subtitle block -------------------//
|
||||||
|
|
||||||
|
if ($CURUSER['showdescription'] != 'no' && !empty($row["descr"])){
|
||||||
|
$torrentdetailad=$Advertisement->get_ad('torrentdetail');
|
||||||
|
tr("<a href=\"javascript: klappe_news('descr')\"><span class=\"nowrap\"><img class=\"minus\" src=\"pic/trans.gif\" alt=\"Show/Hide\" id=\"picdescr\" title=\"".$lang_detail['title_show_or_hide']."\" /> ".$lang_details['row_description']."</span></a>", "<div id='kdescr'>".($Advertisement->enable_ad() && $torrentdetailad ? "<div align=\"left\" style=\"margin-bottom: 10px\" id=\"ad_torrentdetail\">".$torrentdetailad[0]."</div>" : "").format_comment($row["descr"])."</div>", 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (get_user_class() >= $viewnfo_class && $CURUSER['shownfo'] != 'no' && $row["nfosz"] > 0){
|
||||||
|
if (!$nfo = $Cache->get_value('nfo_block_torrent_id_'.$id)){
|
||||||
|
$nfo = code($row["nfo"], $view == "magic");
|
||||||
|
$Cache->cache_value('nfo_block_torrent_id_'.$id, $nfo, 604800);
|
||||||
|
}
|
||||||
|
tr("<a href=\"javascript: klappe_news('nfo')\"><img class=\"plus\" src=\"pic/trans.gif\" alt=\"Show/Hide\" id=\"picnfo\" title=\"".$lang_detail['title_show_or_hide']."\" /> ".$lang_details['text_nfo']."</a><br /><a href=\"viewnfo.php?id=".$row[id]."\" class=\"sublink\">". $lang_details['text_view_nfo']. "</a>", "<div id='knfo' style=\"display: none;\"><pre style=\"font-size:10pt; font-family: 'Courier New', monospace;\">".$nfo."</pre></div>\n", 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($imdb_id && $showextinfo['imdb'] == 'yes' && $CURUSER['showimdb'] != 'no')
|
||||||
|
{
|
||||||
|
$thenumbers = $imdb_id;
|
||||||
|
|
||||||
|
$Cache->new_page('imdb_id_'.$thenumbers.'_large', 1296000, true);
|
||||||
|
if (!$Cache->get_page()){
|
||||||
|
$movie = new imdb ($thenumbers);
|
||||||
|
$movieid = $thenumbers;
|
||||||
|
$movie->setid ($movieid);
|
||||||
|
$target = array('Title', 'Credits', 'Plot');
|
||||||
|
switch ($movie->cachestate($target))
|
||||||
|
{
|
||||||
|
case "0" : //cache is not ready, try to
|
||||||
|
{
|
||||||
|
if($row['cache_stamp']==0 || ($row['cache_stamp'] != 0 && (time()-$row['cache_stamp']) > $auto_obj->timeout)) //not exist or timed out
|
||||||
|
tr($lang_details['text_imdb'] . $lang_details['row_info'] , $lang_details['text_imdb'] . $lang_details['text_not_ready']."<a href=\"retriver.php?id=". $id ."&type=1&siteid=1\">".$lang_details['text_here_to_retrieve'] . $lang_details['text_imdb'],1);
|
||||||
|
else
|
||||||
|
tr($lang_details['text_imdb'] . $lang_details['row_info'] , "<img src=\"pic/progressbar.gif\" alt=\"\" /> " . $lang_details['text_someone_has_requested'] . $lang_details['text_imdb'] . " ".min(max(time()-$row['cache_stamp'],0),$auto_obj->timeout) . $lang_details['text_please_be_patient'],1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "1" :
|
||||||
|
{
|
||||||
|
reset_cachetimestamp($row['id']);
|
||||||
|
$country = $movie->country ();
|
||||||
|
$director = $movie->director();
|
||||||
|
$creator = $movie->creator(); // For TV series
|
||||||
|
$write = $movie->writing();
|
||||||
|
$produce = $movie->producer();
|
||||||
|
$cast = $movie->cast();
|
||||||
|
$plot = $movie->plot ();
|
||||||
|
$plot_outline = $movie->plotoutline();
|
||||||
|
$compose = $movie->composer();
|
||||||
|
$gen = $movie->genres();
|
||||||
|
//$comment = $movie->comment();
|
||||||
|
$similiar_movies = $movie->similiar_movies();
|
||||||
|
|
||||||
|
if (($photo_url = $movie->photo_localurl() ) != FALSE)
|
||||||
|
$smallth = "<img src=\"".$photo_url. "\" width=\"105\" onclick=\"Preview(this);\" alt=\"poster\" />";
|
||||||
|
else
|
||||||
|
$smallth = "<img src=\"pic/imdb_pic/nophoto.gif\" alt=\"no poster\" />";
|
||||||
|
|
||||||
|
$autodata = '<a href="http://www.imdb.com/title/tt'.$thenumbers.'">http://www.imdb.com/title/tt'.$thenumbers."</a><br /><strong><font color=\"navy\">------------------------------------------------------------------------------------------------------------------------------------</font><br />\n";
|
||||||
|
$autodata .= "<font color=\"darkred\" size=\"3\">".$lang_details['text_information']."</font><br />\n";
|
||||||
|
$autodata .= "<font color=\"navy\">------------------------------------------------------------------------------------------------------------------------------------</font></strong><br />\n";
|
||||||
|
$autodata .= "<strong><font color=\"DarkRed\">". $lang_details['text_title']."</font></strong>" . "".$movie->title ()."<br />\n";
|
||||||
|
$autodata .= "<strong><font color=\"DarkRed\">".$lang_details['text_also_known_as']."</font></strong>";
|
||||||
|
|
||||||
|
$temp = "";
|
||||||
|
foreach ($movie->alsoknow() as $ak)
|
||||||
|
{
|
||||||
|
$temp .= $ak["title"].$ak["year"]. ($ak["country"] != "" ? " (".$ak["country"].")" : "") . ($ak["comment"] != "" ? " (" . $ak["comment"] . ")" : "") . ", ";
|
||||||
|
}
|
||||||
|
$autodata .= rtrim(trim($temp), ",");
|
||||||
|
$runtimes = str_replace(" min",$lang_details['text_mins'], $movie->runtime_all());
|
||||||
|
$autodata .= "<br />\n<strong><font color=\"DarkRed\">".$lang_details['text_year']."</font></strong>" . "".$movie->year ()."<br />\n";
|
||||||
|
$autodata .= "<strong><font color=\"DarkRed\">".$lang_details['text_runtime']."</font></strong>".$runtimes."<br />\n";
|
||||||
|
$autodata .= "<strong><font color=\"DarkRed\">".$lang_details['text_votes']."</font></strong>" . "".$movie->votes ()."<br />\n";
|
||||||
|
$autodata .= "<strong><font color=\"DarkRed\">".$lang_details['text_rating']."</font></strong>" . "".$movie->rating ()."<br />\n";
|
||||||
|
$autodata .= "<strong><font color=\"DarkRed\">".$lang_details['text_language']."</font></strong>" . "".$movie->language ()."<br />\n";
|
||||||
|
$autodata .= "<strong><font color=\"DarkRed\">".$lang_details['text_country']."</font></strong>";
|
||||||
|
|
||||||
|
$temp = "";
|
||||||
|
for ($i = 0; $i < count ($country); $i++)
|
||||||
|
{
|
||||||
|
$temp .="$country[$i], ";
|
||||||
|
}
|
||||||
|
$autodata .= rtrim(trim($temp), ",");
|
||||||
|
|
||||||
|
$autodata .= "<br />\n<strong><font color=\"DarkRed\">".$lang_details['text_all_genres']."</font></strong>";
|
||||||
|
$temp = "";
|
||||||
|
for ($i = 0; $i < count($gen); $i++)
|
||||||
|
{
|
||||||
|
$temp .= "$gen[$i], ";
|
||||||
|
}
|
||||||
|
$autodata .= rtrim(trim($temp), ",");
|
||||||
|
|
||||||
|
$autodata .= "<br />\n<strong><font color=\"DarkRed\">".$lang_details['text_tagline']."</font></strong>" . "".$movie->tagline ()."<br />\n";
|
||||||
|
if ($director){
|
||||||
|
$autodata .= "<strong><font color=\"DarkRed\">".$lang_details['text_director']."</font></strong>";
|
||||||
|
$temp = "";
|
||||||
|
for ($i = 0; $i < count ($director); $i++)
|
||||||
|
{
|
||||||
|
$temp .= "<a target=\"_blank\" href=\"http://www.imdb.com/Name?" . "".$director[$i]["imdb"]."" ."\">" . $director[$i]["name"] . "</a>, ";
|
||||||
|
}
|
||||||
|
$autodata .= rtrim(trim($temp), ",");
|
||||||
|
}
|
||||||
|
elseif ($creator)
|
||||||
|
$autodata .= "<strong><font color=\"DarkRed\">".$lang_details['text_creator']."</font></strong>".$creator;
|
||||||
|
|
||||||
|
$autodata .= "<br />\n<strong><font color=\"DarkRed\">".$lang_details['text_written_by']."</font></strong>";
|
||||||
|
$temp = "";
|
||||||
|
for ($i = 0; $i < count ($write); $i++)
|
||||||
|
{
|
||||||
|
$temp .= "<a target=\"_blank\" href=\"http://www.imdb.com/Name?" . "".$write[$i]["imdb"]."" ."\">" . "".$write[$i]["name"]."" . "</a>, ";
|
||||||
|
}
|
||||||
|
$autodata .= rtrim(trim($temp), ",");
|
||||||
|
|
||||||
|
$autodata .= "<br />\n<strong><font color=\"DarkRed\">".$lang_details['text_produced_by']."</font></strong>";
|
||||||
|
$temp = "";
|
||||||
|
for ($i = 0; $i < count ($produce); $i++)
|
||||||
|
{
|
||||||
|
$temp .= "<a target=\"_blank\" href=\"http://www.imdb.com/Name?" . "".$produce[$i]["imdb"]."" ." \">" . "".$produce[$i]["name"]."" . "</a>, ";
|
||||||
|
}
|
||||||
|
$autodata .= rtrim(trim($temp), ",");
|
||||||
|
|
||||||
|
$autodata .= "<br />\n<strong><font color=\"DarkRed\">".$lang_details['text_music']."</font></strong>";
|
||||||
|
$temp = "";
|
||||||
|
for ($i = 0; $i < count($compose); $i++)
|
||||||
|
{
|
||||||
|
$temp .= "<a target=\"_blank\" href=\"http://www.imdb.com/Name?" . "".$compose[$i]["imdb"]."" ." \">" . "".$compose[$i]["name"]."" . "</a>, ";
|
||||||
|
}
|
||||||
|
$autodata .= rtrim(trim($temp), ",");
|
||||||
|
|
||||||
|
$autodata .= "<br /><br />\n\n<strong><font color=\"navy\">------------------------------------------------------------------------------------------------------------------------------------</font><br />\n";
|
||||||
|
$autodata .= "<font color=\"darkred\" size=\"3\">".$lang_details['text_plot_outline']."</font><br />\n";
|
||||||
|
$autodata .= "<font color=\"navy\">------------------------------------------------------------------------------------------------------------------------------------</font></strong>";
|
||||||
|
|
||||||
|
if(count($plot) == 0)
|
||||||
|
{
|
||||||
|
$autodata .= "<br />\n".$plot_outline;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for ($i = 0; $i < count ($plot); $i++)
|
||||||
|
{
|
||||||
|
$autodata .= "<br />\n<font color=\"DarkRed\">.</font> ";
|
||||||
|
$autodata .= $plot[$i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$autodata .= "<br /><br />\n\n<strong><font color=\"navy\">------------------------------------------------------------------------------------------------------------------------------------</font><br />\n";
|
||||||
|
$autodata .= "<font color=\"darkred\" size=\"3\">".$lang_details['text_cast']."</font><br />\n";
|
||||||
|
$autodata .= "<font color=\"navy\">------------------------------------------------------------------------------------------------------------------------------------</font></strong><br />\n";
|
||||||
|
|
||||||
|
for ($i = 0; $i < count ($cast); $i++)
|
||||||
|
{
|
||||||
|
if ($i > 9)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$autodata .= "<font color=\"DarkRed\">.</font> " . "<a target=\"_blank\" href=\"http://www.imdb.com/Name?" . "".$cast[$i]["imdb"]."" ."\">" . $cast[$i]["name"] . "</a> " .$lang_details['text_as']."<strong><font color=\"DarkRed\">" . "".$cast[$i]["role"]."" . " </font></strong><br />\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*$autodata .= "<br /><strong><font color=\"navy\">------------------------------------------------------------------------------------------------------------------------------------</font><br />\n";
|
||||||
|
$autodata .= "<font color=\"darkred\" size=\"3\">".$lang_details['text_may_also_like']."</font><br />\n";
|
||||||
|
$autodata .= "<font color=\"navy\">------------------------------------------------------------------------------------------------------------------------------------</font></strong><br />\n";
|
||||||
|
|
||||||
|
$autodata .= "<table cellpadding=\"10\"><tr>";
|
||||||
|
if($similiar_movies)
|
||||||
|
{
|
||||||
|
$counter = 0;
|
||||||
|
foreach($similiar_movies as $similiar_movies_each)
|
||||||
|
{
|
||||||
|
$on_site = "";
|
||||||
|
$imdb_config_inst = new imdb_config();
|
||||||
|
if($imdb_id_new = parse_imdb_id($imdb_config_inst->imdbsite . $similiar_movies_each['Link']))
|
||||||
|
{
|
||||||
|
$similiar_res = sql_query("SELECT id FROM torrents WHERE url = " . sqlesc((int)$imdb_id_new) . " AND id != ".sqlesc($id)." ORDER BY RAND() LIMIT 1") or sqlerr(__FILE__, __LINE__);
|
||||||
|
while($similiar_arr = mysql_fetch_array($similiar_res)) {
|
||||||
|
$on_site = "<strong><a href=\"" .htmlspecialchars(get_protocol_prefix() . $BASEURL . "/details.php?id=" . $similiar_arr['id'] . "&hit=1")."\">" . $lang_details['text_local_link'] . "</a></strong>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$autodata .= ($counter == 5 ? "</tr><tr>" : "" ) . "<td align=\"center\" style=\"border: 0px; padding-left: 20px; padding-right: 20px; padding-bottom: 10px\"><a href=\"" . $movie->protocol_prefix . $movie->imdbsite . $similiar_movies_each['Link'] . "\" title=\"\"><img style=\"border:0px;\" src=\"" . $similiar_movies_each['Local'] . "\" alt=\"" . $similiar_movies_each['Name'] . "\" /><br />" . $similiar_movies_each['Name'] . "</a><br />" . ($on_site != "" ? $on_site : " ") . "</td>";
|
||||||
|
$counter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$autodata .= "</tr></table>";*/
|
||||||
|
|
||||||
|
//$autodata .= "<br />\n\n<strong><font color=\"navy\">------------------------------------------------------------------------------------------------------------------------------------</font><br />\n";
|
||||||
|
//$autodata .= "<font color=\"darkred\" size=\"3\">".$lang_details['text_recommended_comment']."</font><br />\n";
|
||||||
|
//$autodata .= "<font color=\"navy\">------------------------------------------------------------------------------------------------------------------------------------</font></strong>";
|
||||||
|
|
||||||
|
//$autodata .= "<br />".$comment;
|
||||||
|
$cache_time = $movie->getcachetime();
|
||||||
|
|
||||||
|
$Cache->add_whole_row();
|
||||||
|
print("<tr>");
|
||||||
|
print("<td class=\"rowhead\"><a href=\"javascript: klappe_ext('imdb')\"><span class=\"nowrap\"><img class=\"minus\" src=\"pic/trans.gif\" alt=\"Show/Hide\" id=\"picimdb\" title=\"".$lang_detail['title_show_or_hide']."\" /> ".$lang_details['text_imdb'] . $lang_details['row_info'] ."</span></a><div id=\"posterimdb\">". $smallth."</div></td>");
|
||||||
|
$Cache->end_whole_row();
|
||||||
|
$Cache->add_row();
|
||||||
|
$Cache->add_part();
|
||||||
|
print("<td class=\"rowfollow\" align=\"left\"><div id='kimdb'>".$autodata);
|
||||||
|
$Cache->end_part();
|
||||||
|
$Cache->add_part();
|
||||||
|
print($lang_details['text_information_updated_at'] . date("Y-m-d", $cache_time) . $lang_details['text_might_be_outdated']."<a href=\"".htmlspecialchars("retriver.php?id=". $id ."&type=2&siteid=1")."\">".$lang_details['text_here_to_update']);
|
||||||
|
$Cache->end_part();
|
||||||
|
$Cache->end_row();
|
||||||
|
$Cache->add_whole_row();
|
||||||
|
print("</div></td></tr>");
|
||||||
|
$Cache->end_whole_row();
|
||||||
|
$Cache->cache_page();
|
||||||
|
echo $Cache->next_row();
|
||||||
|
$Cache->next_row();
|
||||||
|
echo $Cache->next_part();
|
||||||
|
if (get_user_class() >= $updateextinfo_class)
|
||||||
|
echo $Cache->next_part();
|
||||||
|
echo $Cache->next_row();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "2" :
|
||||||
|
{
|
||||||
|
tr($lang_details['text_imdb'] . $lang_details['row_info'] ,$lang_details['text_network_error'],1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "3" :// not a valid imdb url
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
echo $Cache->next_row();
|
||||||
|
$Cache->next_row();
|
||||||
|
echo $Cache->next_part();
|
||||||
|
if (get_user_class() >= $updateextinfo_class){
|
||||||
|
echo $Cache->next_part();
|
||||||
|
}
|
||||||
|
echo $Cache->next_row();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($imdb_id)
|
||||||
|
{
|
||||||
|
$where_area = " url = " . sqlesc((int)$imdb_id) ." AND torrents.id != ".sqlesc($id);
|
||||||
|
$copies_res = sql_query("SELECT torrents.id, torrents.name, torrents.sp_state, torrents.size, torrents.added, torrents.seeders, torrents.leechers, categories.id AS catid, categories.name AS catname, categories.image AS catimage, sources.name AS source_name, media.name AS medium_name, codecs.name AS codec_name, standards.name AS standard_name, processings.name AS processing_name FROM torrents LEFT JOIN categories ON torrents.category=categories.id LEFT JOIN sources ON torrents.source = sources.id LEFT JOIN media ON torrents.medium = media.id LEFT JOIN codecs ON torrents.codec = codecs.id LEFT JOIN standards ON torrents.standard = standards.id LEFT JOIN processings ON torrents.processing = processings.id WHERE " . $where_area . " ORDER BY torrents.id DESC") or sqlerr(__FILE__, __LINE__);
|
||||||
|
|
||||||
|
$copies_count = mysql_num_rows($copies_res);
|
||||||
|
if($copies_count > 0)
|
||||||
|
{
|
||||||
|
$s = "<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\">\n";
|
||||||
|
$s.="<tr><td class=\"colhead\" style=\"padding: 0px; text-align:center;\">".$lang_details['col_type']."</td><td class=\"colhead\" align=\"left\">".$lang_details['col_name']."</td><td class=\"colhead\" align=\"center\">".$lang_details['col_quality']."</td><td class=\"colhead\" align=\"center\"><img class=\"size\" src=\"pic/trans.gif\" alt=\"size\" title=\"".$lang_details['title_size']."\" /></td><td class=\"colhead\" align=\"center\"><img class=\"time\" src=\"pic/trans.gif\" alt=\"time added\" title=\"".$lang_details['title_time_added']."\" /></td><td class=\"colhead\" align=\"center\"><img class=\"seeders\" src=\"pic/trans.gif\" alt=\"seeders\" title=\"".$lang_details['title_seeders']."\" /></td><td class=\"colhead\" align=\"center\"><img class=\"leechers\" src=\"pic/trans.gif\" alt=\"leechers\" title=\"".$lang_details['title_leechers']."\" /></td></tr>\n";
|
||||||
|
while ($copy_row = mysql_fetch_assoc($copies_res))
|
||||||
|
{
|
||||||
|
$dispname = htmlspecialchars(trim($copy_row["name"]));
|
||||||
|
$count_dispname=strlen($dispname);
|
||||||
|
$max_lenght_of_torrent_name="80"; // maximum lenght
|
||||||
|
if($count_dispname > $max_lenght_of_torrent_name)
|
||||||
|
{
|
||||||
|
$dispname=substr($dispname, 0, $max_lenght_of_torrent_name) . "..";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($copy_row["source_name"]))
|
||||||
|
$other_source_info = $copy_row[source_name].", ";
|
||||||
|
if (isset($copy_row["medium_name"]))
|
||||||
|
$other_medium_info = $copy_row[medium_name].", ";
|
||||||
|
if (isset($copy_row["codec_name"]))
|
||||||
|
$other_codec_info = $copy_row[codec_name].", ";
|
||||||
|
if (isset($copy_row["standard_name"]))
|
||||||
|
$other_standard_info = $copy_row[standard_name].", ";
|
||||||
|
if (isset($copy_row["processing_name"]))
|
||||||
|
$other_processing_info = $copy_row[processing_name].", ";
|
||||||
|
|
||||||
|
$sphighlight = get_torrent_bg_color($copy_row['sp_state']);
|
||||||
|
$sp_info = get_torrent_promotion_append($copy_row['sp_state']);
|
||||||
|
|
||||||
|
$s .= "<tr". $sphighlight."><td class=\"rowfollow nowrap\" valign=\"middle\" style='padding: 0px'>".return_category_image($copy_row["catid"], "torrents.php?allsec=1&")."</td><td class=\"rowfollow\" align=\"left\"><a href=\"" . htmlspecialchars(get_protocol_prefix() . $BASEURL . "/details.php?id=" . $copy_row["id"]. "&hit=1")."\">" . $dispname ."</a>". $sp_info."</td>" .
|
||||||
|
"<td class=\"rowfollow\" align=\"left\">" . rtrim(trim($other_source_info . $other_medium_info . $other_codec_info . $other_standard_info . $other_processing_info), ","). "</td>" .
|
||||||
|
"<td class=\"rowfollow\" align=\"center\">" . mksize($copy_row["size"]) . "</td>" .
|
||||||
|
"<td class=\"rowfollow nowrap\" align=\"center\">" . str_replace(" ", "<br />", gettime($copy_row["added"],false)). "</td>" .
|
||||||
|
"<td class=\"rowfollow\" align=\"center\">" . $copy_row["seeders"] . "</td>" .
|
||||||
|
"<td class=\"rowfollow\" align=\"center\">" . $copy_row["leechers"] . "</td>" .
|
||||||
|
"</tr>\n";
|
||||||
|
}
|
||||||
|
$s .= "</table>\n";
|
||||||
|
tr("<a href=\"javascript: klappe_news('othercopy')\"><span class=\"nowrap\"><img class=\"".($copies_count > 5 ? "plus" : "minus")."\" src=\"pic/trans.gif\" alt=\"Show/Hide\" id=\"picothercopy\" title=\"".$lang_detail['title_show_or_hide']."\" /> ".$lang_details['row_other_copies']."</span></a>", "<b>".$copies_count.$lang_details['text_other_copies']." </b><br /><div id='kothercopy' style=\"".($copies_count > 5 ? "display: none;" : "display: block;")."\">".$s."</div>",1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($row["type"] == "multi")
|
||||||
|
{
|
||||||
|
$files_info = "<b>".$lang_details['text_num_files']."</b>". $row["numfiles"] . $lang_details['text_files'] . "<br />";
|
||||||
|
$files_info .= "<span id=\"showfl\"><a href=\"javascript: viewfilelist(".$id.")\" >".$lang_details['text_see_full_list']."</a></span><span id=\"hidefl\" style=\"display: none;\"><a href=\"javascript: hidefilelist()\">".$lang_details['text_hide_list']."</a></span>";
|
||||||
|
}
|
||||||
|
function hex_esc($matches) {
|
||||||
|
return sprintf("%02x", ord($matches[0]));
|
||||||
|
}
|
||||||
|
if ($enablenfo_main=='yes')
|
||||||
|
tr($lang_details['row_torrent_info'], "<table><tr>" . ($files_info != "" ? "<td class=\"no_border_wide\">" . $files_info . "</td>" : "") . "<td class=\"no_border_wide\"><b>".$lang_details['row_info_hash'].":</b> ".preg_replace_callback('/./s', "hex_esc", hash_pad($row["info_hash"]))."</td>". (get_user_class() >= $torrentstructure_class ? "<td class=\"no_border_wide\"><b>" . $lang_details['text_torrent_structure'] . "</b><a href=\"torrent_info.php?id=".$id."\">".$lang_details['text_torrent_info_note']."</a></td>" : "") . "</tr></table><span id='filelist'></span>",1);
|
||||||
|
tr($lang_details['row_hot_meter'], "<table><tr><td class=\"no_border_wide\"><b>" . $lang_details['text_views']."</b>". $row["views"] . "</td><td class=\"no_border_wide\"><b>" . $lang_details['text_hits']. "</b>" . $row["hits"] . "</td><td class=\"no_border_wide\"><b>" .$lang_details['text_snatched'] . "</b><a href=\"viewsnatches.php?id=".$id."\"><b>" . $row["times_completed"]. $lang_details['text_view_snatches'] . "</td><td class=\"no_border_wide\"><b>" . $lang_details['row_last_seeder']. "</b>" . gettime($row["last_action"]) . "</td></tr></table>",1);
|
||||||
|
$bwres = sql_query("SELECT uploadspeed.name AS upname, downloadspeed.name AS downname, isp.name AS ispname FROM users LEFT JOIN uploadspeed ON users.upload = uploadspeed.id LEFT JOIN downloadspeed ON users.download = downloadspeed.id LEFT JOIN isp ON users.isp = isp.id WHERE users.id=".$row['owner']);
|
||||||
|
$bwrow = mysql_fetch_array($bwres);
|
||||||
|
if ($bwrow['upname'] && $bwrow['downname'])
|
||||||
|
tr($lang_details['row_uploader_bandwidth'], "<img class=\"speed_down\" src=\"pic/trans.gif\" alt=\"Downstream Rate\" /> ".$bwrow['downname']." <img class=\"speed_up\" src=\"pic/trans.gif\" alt=\"Upstream Rate\" /> ".$bwrow['upname']." ".$bwrow['ispname'],1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Health
|
||||||
|
$seedersTmp = $row['seeders'];
|
||||||
|
$leechersTmp = $row['leechers'];
|
||||||
|
if ($leechersTmp >= 1) // it is possible that there's traffic while have no seeders
|
||||||
|
{
|
||||||
|
$progressPerTorrent = 0;
|
||||||
|
$i = 0;
|
||||||
|
$subres = sql_query("SELECT seeder, finishedat, downloadoffset, uploadoffset, ip, port, uploaded, downloaded, to_go, UNIX_TIMESTAMP(started) AS st, connectable, agent, peer_id, UNIX_TIMESTAMP(last_action) AS la, userid FROM peers WHERE torrent = $row[id]") or sqlerr();
|
||||||
|
|
||||||
|
while ($subrow = mysql_fetch_array($subres)) {
|
||||||
|
$progressPerTorrent += sprintf("%.2f", 100 * (1 - ($subrow["to_go"] / $row["size"])));
|
||||||
|
$i++;
|
||||||
|
if ($subrow["seeder"] == "yes")
|
||||||
|
$seeders[] = $subrow;
|
||||||
|
else
|
||||||
|
$downloaders[] = $subrow;
|
||||||
|
}
|
||||||
|
if ($i == 0)
|
||||||
|
$i = 1;
|
||||||
|
$progressTotal = sprintf("%.2f", $progressPerTorrent / $i);
|
||||||
|
|
||||||
|
$totalspeed = 0;
|
||||||
|
|
||||||
|
if($seedersTmp >=1)
|
||||||
|
{
|
||||||
|
if ($seeders) {
|
||||||
|
foreach($seeders as $e) {
|
||||||
|
$totalspeed = $totalspeed + ($e["uploaded"] - $e["uploadoffset"]) / max(1, ($e["la"] - $e["st"]));
|
||||||
|
$totalspeed = $totalspeed + ($e["downloaded"] - $e["downloadoffset"]) / max(1, $e["finishedat"] - $e[st]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($downloaders) {
|
||||||
|
foreach($downloaders as $e) {
|
||||||
|
$totalspeed = $totalspeed + ($e["uploaded"] - $e["uploadoffset"]) / max(1, ($e["la"] - $e["st"]));
|
||||||
|
$totalspeed = $totalspeed + ($e["downloaded"] - $e["downloadoffset"]) / max(1, ($e["la"] - $e["st"]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$avgspeed = $lang_details['text_average_speed']."<b>" . mksize($totalspeed/($seedersTmp+$leechersTmp)) . "/s</b>";
|
||||||
|
$totalspeed = $lang_details['text_total_speed']."<b>" . mksize($totalspeed) . "/s</b> ".$lang_details['text_health_note'];
|
||||||
|
$health = $lang_details['text_avprogress'] . get_percent_completed_image(floor($progressTotal))." (".round($progressTotal)."%) <b>".$lang_details['text_traffic']."</b>" . $avgspeed ." ". $totalspeed;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$health = "<b>".$lang_details['text_traffic']. "</b>" . $lang_details['text_no_traffic'];
|
||||||
|
|
||||||
|
if ($row["visible"] == "no")
|
||||||
|
$health = "<b>".$lang_details['text_status']."</b>" . $lang_details['text_dead'] ." ". $health;
|
||||||
|
|
||||||
|
tr($lang_details['row_health'], $health, 1);*/
|
||||||
|
tr("<span id=\"seeders\"></span><span id=\"leechers\"></span>".$lang_details['row_peers']."<br /><span id=\"showpeer\"><a href=\"javascript: viewpeerlist(".$row['id'].");\" class=\"sublink\">".$lang_details['text_see_full_list']."</a></span><span id=\"hidepeer\" style=\"display: none;\"><a href=\"javascript: hidepeerlist();\" class=\"sublink\">".$lang_details['text_hide_list']."</a></span>", "<div id=\"peercount\"><b>".$row['seeders'].$lang_details['text_seeders'].add_s($row['seeders'])."</b> | <b>".$row['leechers'].$lang_details['text_leechers'].add_s($row['leechers'])."</b></div><div id=\"peerlist\"></div>" , 1);
|
||||||
|
if ($_GET['dllist'] == 1)
|
||||||
|
{
|
||||||
|
$scronload = "viewpeerlist(".$row['id'].")";
|
||||||
|
|
||||||
|
echo "<script type=\"text/javascript\">\n";
|
||||||
|
echo $scronload;
|
||||||
|
echo "</script>";
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------- start thanked-by block--------------//
|
||||||
|
|
||||||
|
$torrentid = $id;
|
||||||
|
$thanksby = "";
|
||||||
|
$nothanks = "";
|
||||||
|
$thanks_said = 0;
|
||||||
|
$thanks_sql = sql_query("SELECT userid FROM thanks WHERE torrentid=".sqlesc($torrentid)." ORDER BY id DESC LIMIT 20");
|
||||||
|
$thanksCount = get_row_count("thanks", "WHERE torrentid=".sqlesc($torrentid));
|
||||||
|
$thanks_all = mysql_num_rows($thanks_sql);
|
||||||
|
if ($thanks_all) {
|
||||||
|
while($rows_t = mysql_fetch_array($thanks_sql)) {
|
||||||
|
$thanks_userid = $rows_t["userid"];
|
||||||
|
if ($rows_t["userid"] == $CURUSER['id']) {
|
||||||
|
$thanks_said = 1;
|
||||||
|
} else {
|
||||||
|
$thanksby .= get_username($thanks_userid)." ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else $nothanks = $lang_details['text_no_thanks_added'];
|
||||||
|
|
||||||
|
if (!$thanks_said) {
|
||||||
|
$thanks_said = get_row_count("thanks", "WHERE torrentid=$torrentid AND userid=".sqlesc($CURUSER['id']));
|
||||||
|
}
|
||||||
|
if ($thanks_said == 0) {
|
||||||
|
$buttonvalue = " value=\"".$lang_details['submit_say_thanks']."\"";
|
||||||
|
} else {
|
||||||
|
$buttonvalue = " value=\"".$lang_details['submit_you_said_thanks']."\" disabled=\"disabled\"";
|
||||||
|
$thanksby = get_username($CURUSER['id'])." ".$thanksby;
|
||||||
|
}
|
||||||
|
$thanksbutton = "<input class=\"btn\" type=\"button\" id=\"saythanks\" onclick=\"saythanks(".$torrentid.");\" ".$buttonvalue." />";
|
||||||
|
tr($lang_details['row_thanks_by'],"<span id=\"thanksadded\" style=\"display: none;\"><input class=\"btn\" type=\"button\" value=\"".$lang_details['text_thanks_added']."\" disabled=\"disabled\" /></span><span id=\"curuser\" style=\"display: none;\">".get_username($CURUSER['id'])." </span><span id=\"thanksbutton\">".$thanksbutton."</span> <span id=\"nothanks\">".$nothanks."</span><span id=\"addcuruser\"></span>".$thanksby.($thanks_all < $thanksCount ? $lang_details['text_and_more'].$thanksCount.$lang_details['text_users_in_total'] : ""),1);
|
||||||
|
// ------------- end thanked-by block--------------//
|
||||||
|
|
||||||
|
print("</table>\n");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
stdhead($lang_details['head_comments_for_torrent']."\"" . $row["name"] . "\"");
|
||||||
|
print("<h1 id=\"top\">".$lang_details['text_comments_for']."<a href=\"details.php?id=".$id."\">" . htmlspecialchars($row["name"]) . "</a></h1>\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------COMMENT SECTION ---------------------//
|
||||||
|
if ($CURUSER['showcomment'] != 'no'){
|
||||||
|
$count = get_row_count("comments","WHERE torrent=".sqlesc($id));
|
||||||
|
if ($count)
|
||||||
|
{
|
||||||
|
print("<br /><br />");
|
||||||
|
print("<h1 align=\"center\" id=\"startcomments\">" .$lang_details['h1_user_comments'] . "</h1>\n");
|
||||||
|
list($pagertop, $pagerbottom, $limit) = pager(10, $count, "details.php?id=$id&cmtpage=1&", array(lastpagedefault => 1), "page");
|
||||||
|
|
||||||
|
$subres = sql_query("SELECT id, text, user, added, editedby, editdate FROM comments WHERE torrent = $id ORDER BY id $limit") or sqlerr(__FILE__, __LINE__);
|
||||||
|
$allrows = array();
|
||||||
|
while ($subrow = mysql_fetch_array($subres)) {
|
||||||
|
$allrows[] = $subrow;
|
||||||
|
}
|
||||||
|
print($pagertop);
|
||||||
|
commenttable($allrows,"torrent",$id);
|
||||||
|
print($pagerbottom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print("<br /><br />");
|
||||||
|
print ("<table style='border:1px solid #000000;'><tr><td class=\"text\" align=\"center\"><b>".$lang_details['text_quick_comment']."</b><br /><br /><form id=\"compose\" name=\"comment\" method=\"post\" action=\"".htmlspecialchars("comment.php?action=add&type=torrent")."\" onsubmit=\"return postvalid(this);\"><input type=\"hidden\" name=\"pid\" value=\"".$id."\" /><br />");
|
||||||
|
quickreply('comment', 'body', $lang_details['submit_add_comment']);
|
||||||
|
print("</form></td></tr></table>");
|
||||||
|
print("<p align=\"center\"><a class=\"index\" href=\"".htmlspecialchars("comment.php?action=add&pid=".$id."&type=torrent")."\">".$lang_details['text_add_a_comment']."</a></p>\n");
|
||||||
|
}
|
||||||
|
stdfoot();
|
||||||
28
docleanup.php
Normal file
28
docleanup.php
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
ob_start();
|
||||||
|
require_once("include/bittorrent.php");
|
||||||
|
dbconn();
|
||||||
|
|
||||||
|
if (get_user_class() < UC_SYSOP) {
|
||||||
|
die('forbidden');
|
||||||
|
}
|
||||||
|
echo "<html><head><title>Do Clean-up</title></head><body>";
|
||||||
|
echo "<p>";
|
||||||
|
echo "clean-up in progress...please wait<br />";
|
||||||
|
ob_flush();
|
||||||
|
flush();
|
||||||
|
if ($_GET['forceall']) {
|
||||||
|
$forceall = 1;
|
||||||
|
} else {
|
||||||
|
$forceall = 0;
|
||||||
|
echo "you may force full clean-up by adding the parameter 'forceall=1' to URL<br />";
|
||||||
|
}
|
||||||
|
echo "</p>";
|
||||||
|
$tstart = getmicrotime();
|
||||||
|
require_once("include/cleanup.php");
|
||||||
|
print("<p>".docleanup($forceall, 1)."</p>");
|
||||||
|
$tend = getmicrotime();
|
||||||
|
$totaltime = ($tend - $tstart);
|
||||||
|
printf ("Time consumed: %f sec<br />", $totaltime);
|
||||||
|
echo "Done<br />";
|
||||||
|
echo "</body></html>";
|
||||||
704
domLib.js
Normal file
704
domLib.js
Normal file
@@ -0,0 +1,704 @@
|
|||||||
|
/** $Id: domLib.js 2321 2006-06-12 06:45:41Z dallen $ */
|
||||||
|
// {{{ license
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright 2002-2005 Dan Allen, Mojavelinux.com (dan.allen@mojavelinux.com)
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// }}}
|
||||||
|
// {{{ intro
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Title: DOM Library Core
|
||||||
|
* Version: 0.70
|
||||||
|
*
|
||||||
|
* Summary:
|
||||||
|
* A set of commonly used functions that make it easier to create javascript
|
||||||
|
* applications that rely on the DOM.
|
||||||
|
*
|
||||||
|
* Updated: 2005/05/17
|
||||||
|
*
|
||||||
|
* Maintainer: Dan Allen <dan.allen@mojavelinux.com>
|
||||||
|
* Maintainer: Jason Rust <jrust@rustyparts.com>
|
||||||
|
*
|
||||||
|
* License: Apache 2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
// }}}
|
||||||
|
// {{{ global constants (DO NOT EDIT)
|
||||||
|
|
||||||
|
// -- Browser Detection --
|
||||||
|
var domLib_userAgent = navigator.userAgent.toLowerCase();
|
||||||
|
var domLib_isMac = navigator.appVersion.indexOf('Mac') != -1;
|
||||||
|
var domLib_isWin = domLib_userAgent.indexOf('windows') != -1;
|
||||||
|
// NOTE: could use window.opera for detecting Opera
|
||||||
|
var domLib_isOpera = domLib_userAgent.indexOf('opera') != -1;
|
||||||
|
var domLib_isOpera7up = domLib_userAgent.match(/opera.(7|8)/i);
|
||||||
|
var domLib_isSafari = domLib_userAgent.indexOf('safari') != -1;
|
||||||
|
var domLib_isKonq = domLib_userAgent.indexOf('konqueror') != -1;
|
||||||
|
// Both konqueror and safari use the khtml rendering engine
|
||||||
|
var domLib_isKHTML = (domLib_isKonq || domLib_isSafari || domLib_userAgent.indexOf('khtml') != -1);
|
||||||
|
var domLib_isIE = (!domLib_isKHTML && !domLib_isOpera && domLib_userAgent.indexOf('msie') != -1);
|
||||||
|
var domLib_isIE5up = domLib_isIE;
|
||||||
|
var domLib_isIE50 = (domLib_isIE && domLib_userAgent.indexOf('msie 5.0') != -1);
|
||||||
|
var domLib_isIE55 = (domLib_isIE && domLib_userAgent.indexOf('msie 5.5') != -1);
|
||||||
|
var domLib_isIE5 = (domLib_isIE50 || domLib_isIE55);
|
||||||
|
// safari and konq may use string "khtml, like gecko", so check for destinctive /
|
||||||
|
var domLib_isGecko = domLib_userAgent.indexOf('gecko/') != -1;
|
||||||
|
var domLib_isMacIE = (domLib_isIE && domLib_isMac);
|
||||||
|
var domLib_isIE55up = domLib_isIE5up && !domLib_isIE50 && !domLib_isMacIE;
|
||||||
|
var domLib_isIE6up = domLib_isIE55up && !domLib_isIE55;
|
||||||
|
|
||||||
|
// -- Browser Abilities --
|
||||||
|
var domLib_standardsMode = (document.compatMode && document.compatMode == 'CSS1Compat');
|
||||||
|
var domLib_useLibrary = (domLib_isOpera7up || domLib_isKHTML || domLib_isIE5up || domLib_isGecko || domLib_isMacIE || document.defaultView);
|
||||||
|
// fixed in Konq3.2
|
||||||
|
var domLib_hasBrokenTimeout = (domLib_isMacIE || (domLib_isKonq && domLib_userAgent.match(/konqueror\/3.([2-9])/) == null));
|
||||||
|
var domLib_canFade = (domLib_isGecko || domLib_isIE || domLib_isSafari || domLib_isOpera);
|
||||||
|
var domLib_canDrawOverSelect = (domLib_isMac || domLib_isOpera || domLib_isGecko);
|
||||||
|
var domLib_canDrawOverFlash = (domLib_isMac || domLib_isWin);
|
||||||
|
|
||||||
|
// -- Event Variables --
|
||||||
|
var domLib_eventTarget = domLib_isIE ? 'srcElement' : 'currentTarget';
|
||||||
|
var domLib_eventButton = domLib_isIE ? 'button' : 'which';
|
||||||
|
var domLib_eventTo = domLib_isIE ? 'toElement' : 'relatedTarget';
|
||||||
|
var domLib_stylePointer = domLib_isIE ? 'hand' : 'pointer';
|
||||||
|
// NOTE: a bug exists in Opera that prevents maxWidth from being set to 'none', so we make it huge
|
||||||
|
var domLib_styleNoMaxWidth = domLib_isOpera ? '10000px' : 'none';
|
||||||
|
var domLib_hidePosition = '-1000px';
|
||||||
|
var domLib_scrollbarWidth = 14;
|
||||||
|
var domLib_autoId = 1;
|
||||||
|
var domLib_zIndex = 100;
|
||||||
|
|
||||||
|
// -- Detection --
|
||||||
|
var domLib_collisionElements;
|
||||||
|
var domLib_collisionsCached = false;
|
||||||
|
|
||||||
|
var domLib_timeoutStateId = 0;
|
||||||
|
var domLib_timeoutStates = new Hash();
|
||||||
|
|
||||||
|
// }}}
|
||||||
|
// {{{ DOM enhancements
|
||||||
|
|
||||||
|
if (!document.ELEMENT_NODE)
|
||||||
|
{
|
||||||
|
document.ELEMENT_NODE = 1;
|
||||||
|
document.ATTRIBUTE_NODE = 2;
|
||||||
|
document.TEXT_NODE = 3;
|
||||||
|
document.DOCUMENT_NODE = 9;
|
||||||
|
document.DOCUMENT_FRAGMENT_NODE = 11;
|
||||||
|
}
|
||||||
|
|
||||||
|
function domLib_clone(obj)
|
||||||
|
{
|
||||||
|
var copy = {};
|
||||||
|
for (var i in obj)
|
||||||
|
{
|
||||||
|
var value = obj[i];
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (value != null && typeof(value) == 'object' && value != window && !value.nodeType)
|
||||||
|
{
|
||||||
|
copy[i] = domLib_clone(value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
copy[i] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(e)
|
||||||
|
{
|
||||||
|
copy[i] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
// }}}
|
||||||
|
// {{{ class Hash()
|
||||||
|
|
||||||
|
function Hash()
|
||||||
|
{
|
||||||
|
this.length = 0;
|
||||||
|
this.numericLength = 0;
|
||||||
|
this.elementData = [];
|
||||||
|
for (var i = 0; i < arguments.length; i += 2)
|
||||||
|
{
|
||||||
|
if (typeof(arguments[i + 1]) != 'undefined')
|
||||||
|
{
|
||||||
|
this.elementData[arguments[i]] = arguments[i + 1];
|
||||||
|
this.length++;
|
||||||
|
if (arguments[i] == parseInt(arguments[i]))
|
||||||
|
{
|
||||||
|
this.numericLength++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// using prototype as opposed to inner functions saves on memory
|
||||||
|
Hash.prototype.get = function(in_key)
|
||||||
|
{
|
||||||
|
if (typeof(this.elementData[in_key]) != 'undefined') {
|
||||||
|
return this.elementData[in_key];
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Hash.prototype.set = function(in_key, in_value)
|
||||||
|
{
|
||||||
|
if (typeof(in_value) != 'undefined')
|
||||||
|
{
|
||||||
|
if (typeof(this.elementData[in_key]) == 'undefined')
|
||||||
|
{
|
||||||
|
this.length++;
|
||||||
|
if (in_key == parseInt(in_key))
|
||||||
|
{
|
||||||
|
this.numericLength++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.elementData[in_key] = in_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Hash.prototype.remove = function(in_key)
|
||||||
|
{
|
||||||
|
var tmp_value;
|
||||||
|
if (typeof(this.elementData[in_key]) != 'undefined')
|
||||||
|
{
|
||||||
|
this.length--;
|
||||||
|
if (in_key == parseInt(in_key))
|
||||||
|
{
|
||||||
|
this.numericLength--;
|
||||||
|
}
|
||||||
|
|
||||||
|
tmp_value = this.elementData[in_key];
|
||||||
|
delete this.elementData[in_key];
|
||||||
|
}
|
||||||
|
|
||||||
|
return tmp_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
Hash.prototype.size = function()
|
||||||
|
{
|
||||||
|
return this.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
Hash.prototype.has = function(in_key)
|
||||||
|
{
|
||||||
|
return typeof(this.elementData[in_key]) != 'undefined';
|
||||||
|
}
|
||||||
|
|
||||||
|
Hash.prototype.find = function(in_obj)
|
||||||
|
{
|
||||||
|
for (var tmp_key in this.elementData)
|
||||||
|
{
|
||||||
|
if (this.elementData[tmp_key] == in_obj)
|
||||||
|
{
|
||||||
|
return tmp_key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Hash.prototype.merge = function(in_hash)
|
||||||
|
{
|
||||||
|
for (var tmp_key in in_hash.elementData)
|
||||||
|
{
|
||||||
|
if (typeof(this.elementData[tmp_key]) == 'undefined')
|
||||||
|
{
|
||||||
|
this.length++;
|
||||||
|
if (tmp_key == parseInt(tmp_key))
|
||||||
|
{
|
||||||
|
this.numericLength++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.elementData[tmp_key] = in_hash.elementData[tmp_key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Hash.prototype.compare = function(in_hash)
|
||||||
|
{
|
||||||
|
if (this.length != in_hash.length)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var tmp_key in this.elementData)
|
||||||
|
{
|
||||||
|
if (this.elementData[tmp_key] != in_hash.elementData[tmp_key])
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// }}}
|
||||||
|
// {{{ domLib_isDescendantOf()
|
||||||
|
|
||||||
|
function domLib_isDescendantOf(in_object, in_ancestor, in_bannedTags)
|
||||||
|
{
|
||||||
|
if (in_object == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_object == in_ancestor)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof(in_bannedTags) != 'undefined' &&
|
||||||
|
(',' + in_bannedTags.join(',') + ',').indexOf(',' + in_object.tagName + ',') != -1)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (in_object != document.documentElement)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if ((tmp_object = in_object.offsetParent) && tmp_object == in_ancestor)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if ((tmp_object = in_object.parentNode) == in_ancestor)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
in_object = tmp_object;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// in case we get some wierd error, assume we left the building
|
||||||
|
catch(e)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// }}}
|
||||||
|
// {{{ domLib_detectCollisions()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For any given target element, determine if elements on the page
|
||||||
|
* are colliding with it that do not obey the rules of z-index.
|
||||||
|
*/
|
||||||
|
function domLib_detectCollisions(in_object, in_recover, in_useCache)
|
||||||
|
{
|
||||||
|
// the reason for the cache is that if the root menu is built before
|
||||||
|
// the page is done loading, then it might not find all the elements.
|
||||||
|
// so really the only time you don't use cache is when building the
|
||||||
|
// menu as part of the page load
|
||||||
|
if (!domLib_collisionsCached)
|
||||||
|
{
|
||||||
|
var tags = [];
|
||||||
|
|
||||||
|
if (!domLib_canDrawOverFlash)
|
||||||
|
{
|
||||||
|
tags[tags.length] = 'object';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!domLib_canDrawOverSelect)
|
||||||
|
{
|
||||||
|
tags[tags.length] = 'select';
|
||||||
|
}
|
||||||
|
|
||||||
|
domLib_collisionElements = domLib_getElementsByTagNames(tags, true);
|
||||||
|
domLib_collisionsCached = in_useCache;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if we don't have a tip, then unhide selects
|
||||||
|
if (in_recover)
|
||||||
|
{
|
||||||
|
for (var cnt = 0; cnt < domLib_collisionElements.length; cnt++)
|
||||||
|
{
|
||||||
|
var thisElement = domLib_collisionElements[cnt];
|
||||||
|
|
||||||
|
if (!thisElement.hideList)
|
||||||
|
{
|
||||||
|
thisElement.hideList = new Hash();
|
||||||
|
}
|
||||||
|
|
||||||
|
thisElement.hideList.remove(in_object.id);
|
||||||
|
if (!thisElement.hideList.length)
|
||||||
|
{
|
||||||
|
domLib_collisionElements[cnt].style.visibility = 'visible';
|
||||||
|
if (domLib_isKonq)
|
||||||
|
{
|
||||||
|
domLib_collisionElements[cnt].style.display = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (domLib_collisionElements.length == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// okay, we have a tip, so hunt and destroy
|
||||||
|
var objectOffsets = domLib_getOffsets(in_object);
|
||||||
|
|
||||||
|
for (var cnt = 0; cnt < domLib_collisionElements.length; cnt++)
|
||||||
|
{
|
||||||
|
var thisElement = domLib_collisionElements[cnt];
|
||||||
|
|
||||||
|
// if collision element is in active element, move on
|
||||||
|
// WARNING: is this too costly?
|
||||||
|
if (domLib_isDescendantOf(thisElement, in_object))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// konqueror only has trouble with multirow selects
|
||||||
|
if (domLib_isKonq &&
|
||||||
|
thisElement.tagName == 'SELECT' &&
|
||||||
|
(thisElement.size <= 1 && !thisElement.multiple))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!thisElement.hideList)
|
||||||
|
{
|
||||||
|
thisElement.hideList = new Hash();
|
||||||
|
}
|
||||||
|
|
||||||
|
var selectOffsets = domLib_getOffsets(thisElement);
|
||||||
|
var center2centerDistance = Math.sqrt(Math.pow(selectOffsets.get('leftCenter') - objectOffsets.get('leftCenter'), 2) + Math.pow(selectOffsets.get('topCenter') - objectOffsets.get('topCenter'), 2));
|
||||||
|
var radiusSum = selectOffsets.get('radius') + objectOffsets.get('radius');
|
||||||
|
// the encompassing circles are overlapping, get in for a closer look
|
||||||
|
if (center2centerDistance < radiusSum)
|
||||||
|
{
|
||||||
|
// tip is left of select
|
||||||
|
if ((objectOffsets.get('leftCenter') <= selectOffsets.get('leftCenter') && objectOffsets.get('right') < selectOffsets.get('left')) ||
|
||||||
|
// tip is right of select
|
||||||
|
(objectOffsets.get('leftCenter') > selectOffsets.get('leftCenter') && objectOffsets.get('left') > selectOffsets.get('right')) ||
|
||||||
|
// tip is above select
|
||||||
|
(objectOffsets.get('topCenter') <= selectOffsets.get('topCenter') && objectOffsets.get('bottom') < selectOffsets.get('top')) ||
|
||||||
|
// tip is below select
|
||||||
|
(objectOffsets.get('topCenter') > selectOffsets.get('topCenter') && objectOffsets.get('top') > selectOffsets.get('bottom')))
|
||||||
|
{
|
||||||
|
thisElement.hideList.remove(in_object.id);
|
||||||
|
if (!thisElement.hideList.length)
|
||||||
|
{
|
||||||
|
thisElement.style.visibility = 'visible';
|
||||||
|
if (domLib_isKonq)
|
||||||
|
{
|
||||||
|
thisElement.style.display = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
thisElement.hideList.set(in_object.id, true);
|
||||||
|
thisElement.style.visibility = 'hidden';
|
||||||
|
if (domLib_isKonq)
|
||||||
|
{
|
||||||
|
thisElement.style.display = 'none';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// }}}
|
||||||
|
// {{{ domLib_getOffsets()
|
||||||
|
|
||||||
|
function domLib_getOffsets(in_object, in_preserveScroll)
|
||||||
|
{
|
||||||
|
if (typeof(in_preserveScroll) == 'undefined') {
|
||||||
|
in_preserveScroll = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var originalObject = in_object;
|
||||||
|
var originalWidth = in_object.offsetWidth;
|
||||||
|
var originalHeight = in_object.offsetHeight;
|
||||||
|
var offsetLeft = 0;
|
||||||
|
var offsetTop = 0;
|
||||||
|
|
||||||
|
while (in_object)
|
||||||
|
{
|
||||||
|
offsetLeft += in_object.offsetLeft;
|
||||||
|
offsetTop += in_object.offsetTop;
|
||||||
|
in_object = in_object.offsetParent;
|
||||||
|
// consider scroll offset of parent elements
|
||||||
|
if (in_object && !in_preserveScroll)
|
||||||
|
{
|
||||||
|
offsetLeft -= in_object.scrollLeft;
|
||||||
|
offsetTop -= in_object.scrollTop;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MacIE misreports the offsets (even with margin: 0 in body{}), still not perfect
|
||||||
|
if (domLib_isMacIE) {
|
||||||
|
offsetLeft += 10;
|
||||||
|
offsetTop += 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Hash(
|
||||||
|
'left', offsetLeft,
|
||||||
|
'top', offsetTop,
|
||||||
|
'right', offsetLeft + originalWidth,
|
||||||
|
'bottom', offsetTop + originalHeight,
|
||||||
|
'leftCenter', offsetLeft + originalWidth/2,
|
||||||
|
'topCenter', offsetTop + originalHeight/2,
|
||||||
|
'radius', Math.max(originalWidth, originalHeight)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// }}}
|
||||||
|
// {{{ domLib_setTimeout()
|
||||||
|
|
||||||
|
function domLib_setTimeout(in_function, in_timeout, in_args)
|
||||||
|
{
|
||||||
|
if (typeof(in_args) == 'undefined')
|
||||||
|
{
|
||||||
|
in_args = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_timeout == -1)
|
||||||
|
{
|
||||||
|
// timeout event is disabled
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else if (in_timeout == 0)
|
||||||
|
{
|
||||||
|
in_function(in_args);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// must make a copy of the arguments so that we release the reference
|
||||||
|
var args = domLib_clone(in_args);
|
||||||
|
|
||||||
|
if (!domLib_hasBrokenTimeout)
|
||||||
|
{
|
||||||
|
return setTimeout(function() { in_function(args); }, in_timeout);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var id = domLib_timeoutStateId++;
|
||||||
|
var data = new Hash();
|
||||||
|
data.set('function', in_function);
|
||||||
|
data.set('args', args);
|
||||||
|
domLib_timeoutStates.set(id, data);
|
||||||
|
|
||||||
|
data.set('timeoutId', setTimeout('domLib_timeoutStates.get(' + id + ').get(\'function\')(domLib_timeoutStates.get(' + id + ').get(\'args\')); domLib_timeoutStates.remove(' + id + ');', in_timeout));
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// }}}
|
||||||
|
// {{{ domLib_clearTimeout()
|
||||||
|
|
||||||
|
function domLib_clearTimeout(in_id)
|
||||||
|
{
|
||||||
|
if (!domLib_hasBrokenTimeout)
|
||||||
|
{
|
||||||
|
if (in_id > 0) {
|
||||||
|
clearTimeout(in_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (domLib_timeoutStates.has(in_id))
|
||||||
|
{
|
||||||
|
clearTimeout(domLib_timeoutStates.get(in_id).get('timeoutId'))
|
||||||
|
domLib_timeoutStates.remove(in_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// }}}
|
||||||
|
// {{{ domLib_getEventPosition()
|
||||||
|
|
||||||
|
function domLib_getEventPosition(in_eventObj)
|
||||||
|
{
|
||||||
|
var eventPosition = new Hash('x', 0, 'y', 0, 'scrollX', 0, 'scrollY', 0);
|
||||||
|
|
||||||
|
// IE varies depending on standard compliance mode
|
||||||
|
if (domLib_isIE)
|
||||||
|
{
|
||||||
|
var doc = (domLib_standardsMode ? document.documentElement : document.body);
|
||||||
|
// NOTE: events may fire before the body has been loaded
|
||||||
|
if (doc)
|
||||||
|
{
|
||||||
|
eventPosition.set('x', in_eventObj.clientX + doc.scrollLeft);
|
||||||
|
eventPosition.set('y', in_eventObj.clientY + doc.scrollTop);
|
||||||
|
eventPosition.set('scrollX', doc.scrollLeft);
|
||||||
|
eventPosition.set('scrollY', doc.scrollTop);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
eventPosition.set('x', in_eventObj.pageX);
|
||||||
|
eventPosition.set('y', in_eventObj.pageY);
|
||||||
|
eventPosition.set('scrollX', in_eventObj.pageX - in_eventObj.clientX);
|
||||||
|
eventPosition.set('scrollY', in_eventObj.pageY - in_eventObj.clientY);
|
||||||
|
}
|
||||||
|
|
||||||
|
return eventPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
// }}}
|
||||||
|
// {{{ domLib_cancelBubble()
|
||||||
|
|
||||||
|
function domLib_cancelBubble(in_event)
|
||||||
|
{
|
||||||
|
var eventObj = in_event ? in_event : window.event;
|
||||||
|
eventObj.cancelBubble = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// }}}
|
||||||
|
// {{{ domLib_getIFrameReference()
|
||||||
|
|
||||||
|
function domLib_getIFrameReference(in_frame)
|
||||||
|
{
|
||||||
|
if (domLib_isGecko || domLib_isIE)
|
||||||
|
{
|
||||||
|
return in_frame.frameElement;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// we could either do it this way or require an id on the frame
|
||||||
|
// equivalent to the name
|
||||||
|
var name = in_frame.name;
|
||||||
|
if (!name || !in_frame.parent)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var candidates = in_frame.parent.document.getElementsByTagName('iframe');
|
||||||
|
for (var i = 0; i < candidates.length; i++)
|
||||||
|
{
|
||||||
|
if (candidates[i].name == name)
|
||||||
|
{
|
||||||
|
return candidates[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// }}}
|
||||||
|
// {{{ domLib_getElementsByClass()
|
||||||
|
|
||||||
|
function domLib_getElementsByClass(in_class)
|
||||||
|
{
|
||||||
|
var elements = domLib_isIE5 ? document.all : document.getElementsByTagName('*');
|
||||||
|
var matches = [];
|
||||||
|
var cnt = 0;
|
||||||
|
for (var i = 0; i < elements.length; i++)
|
||||||
|
{
|
||||||
|
if ((" " + elements[i].className + " ").indexOf(" " + in_class + " ") != -1)
|
||||||
|
{
|
||||||
|
matches[cnt++] = elements[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return matches;
|
||||||
|
}
|
||||||
|
|
||||||
|
// }}}
|
||||||
|
// {{{ domLib_getElementsByTagNames()
|
||||||
|
|
||||||
|
function domLib_getElementsByTagNames(in_list, in_excludeHidden)
|
||||||
|
{
|
||||||
|
var elements = [];
|
||||||
|
for (var i = 0; i < in_list.length; i++)
|
||||||
|
{
|
||||||
|
var matches = document.getElementsByTagName(in_list[i]);
|
||||||
|
for (var j = 0; j < matches.length; j++)
|
||||||
|
{
|
||||||
|
// skip objects that have nested embeds, or else we get "flashing"
|
||||||
|
if (matches[j].tagName == 'OBJECT' && domLib_isGecko)
|
||||||
|
{
|
||||||
|
var kids = matches[j].childNodes;
|
||||||
|
var skip = false;
|
||||||
|
for (var k = 0; k < kids.length; k++)
|
||||||
|
{
|
||||||
|
if (kids[k].tagName == 'EMBED')
|
||||||
|
{
|
||||||
|
skip = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (skip) continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_excludeHidden && domLib_getComputedStyle(matches[j], 'visibility') == 'hidden')
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
elements[elements.length] = matches[j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return elements;
|
||||||
|
}
|
||||||
|
|
||||||
|
// }}}
|
||||||
|
// {{{ domLib_getComputedStyle()
|
||||||
|
|
||||||
|
function domLib_getComputedStyle(in_obj, in_property)
|
||||||
|
{
|
||||||
|
if (domLib_isIE)
|
||||||
|
{
|
||||||
|
var humpBackProp = in_property.replace(/-(.)/, function (a, b) { return b.toUpperCase(); });
|
||||||
|
return eval('in_obj.currentStyle.' + humpBackProp);
|
||||||
|
}
|
||||||
|
// getComputedStyle() is broken in konqueror, so let's go for the style object
|
||||||
|
else if (domLib_isKonq)
|
||||||
|
{
|
||||||
|
//var humpBackProp = in_property.replace(/-(.)/, function (a, b) { return b.toUpperCase(); });
|
||||||
|
return eval('in_obj.style.' + in_property);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return document.defaultView.getComputedStyle(in_obj, null).getPropertyValue(in_property);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// }}}
|
||||||
|
// {{{ makeTrue()
|
||||||
|
|
||||||
|
function makeTrue()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// }}}
|
||||||
|
// {{{ makeFalse()
|
||||||
|
|
||||||
|
function makeFalse()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// }}}
|
||||||
102
domTT_drag.js
Normal file
102
domTT_drag.js
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
/** $Id: domTT_drag.js 2315 2006-06-12 05:45:36Z dallen $ */
|
||||||
|
// {{{ license
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright 2002-2005 Dan Allen, Mojavelinux.com (dan.allen@mojavelinux.com)
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// }}}
|
||||||
|
// {{{ globals (DO NOT EDIT)
|
||||||
|
|
||||||
|
var domTT_dragEnabled = true;
|
||||||
|
var domTT_currentDragTarget;
|
||||||
|
var domTT_dragMouseDown;
|
||||||
|
var domTT_dragOffsetLeft;
|
||||||
|
var domTT_dragOffsetTop;
|
||||||
|
|
||||||
|
// }}}
|
||||||
|
// {{{ domTT_dragStart()
|
||||||
|
|
||||||
|
function domTT_dragStart(in_this, in_event)
|
||||||
|
{
|
||||||
|
if (typeof(in_event) == 'undefined') { in_event = window.event; }
|
||||||
|
|
||||||
|
var eventButton = in_event[domLib_eventButton];
|
||||||
|
if (eventButton != 1 && !domLib_isKHTML)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
domTT_currentDragTarget = in_this;
|
||||||
|
in_this.style.cursor = 'move';
|
||||||
|
|
||||||
|
// upgrade our z-index
|
||||||
|
in_this.style.zIndex = ++domLib_zIndex;
|
||||||
|
|
||||||
|
var eventPosition = domLib_getEventPosition(in_event);
|
||||||
|
|
||||||
|
var targetPosition = domLib_getOffsets(in_this);
|
||||||
|
domTT_dragOffsetLeft = eventPosition.get('x') - targetPosition.get('left');
|
||||||
|
domTT_dragOffsetTop = eventPosition.get('y') - targetPosition.get('top');
|
||||||
|
domTT_dragMouseDown = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// }}}
|
||||||
|
// {{{ domTT_dragUpdate()
|
||||||
|
|
||||||
|
function domTT_dragUpdate(in_event)
|
||||||
|
{
|
||||||
|
if (domTT_dragMouseDown)
|
||||||
|
{
|
||||||
|
if (domLib_isGecko)
|
||||||
|
{
|
||||||
|
window.getSelection().removeAllRanges()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (domTT_useGlobalMousePosition && domTT_mousePosition != null)
|
||||||
|
{
|
||||||
|
var eventPosition = domTT_mousePosition;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (typeof(in_event) == 'undefined') { in_event = window.event; }
|
||||||
|
var eventPosition = domLib_getEventPosition(in_event);
|
||||||
|
}
|
||||||
|
|
||||||
|
domTT_currentDragTarget.style.left = (eventPosition.get('x') - domTT_dragOffsetLeft) + 'px';
|
||||||
|
domTT_currentDragTarget.style.top = (eventPosition.get('y') - domTT_dragOffsetTop) + 'px';
|
||||||
|
|
||||||
|
// update the collision detection
|
||||||
|
domLib_detectCollisions(domTT_currentDragTarget);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// }}}
|
||||||
|
// {{{ domTT_dragStop()
|
||||||
|
|
||||||
|
function domTT_dragStop()
|
||||||
|
{
|
||||||
|
if (domTT_dragMouseDown) {
|
||||||
|
domTT_dragMouseDown = false;
|
||||||
|
domTT_currentDragTarget.style.cursor = 'default';
|
||||||
|
domTT_currentDragTarget = null;
|
||||||
|
if (domLib_isGecko)
|
||||||
|
{
|
||||||
|
window.getSelection().removeAllRanges()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// }}}
|
||||||
100
donate.php
Normal file
100
donate.php
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
<?php
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
require_once(get_langfile_path());
|
||||||
|
if ($enabledonation != 'yes')
|
||||||
|
stderr($lang_donate['std_sorry'], $lang_donate['std_do_not_accept_donation']);
|
||||||
|
|
||||||
|
$do = $_GET['do'];
|
||||||
|
|
||||||
|
if ($do == 'thanks') {
|
||||||
|
stderr($lang_donate['std_success'], $lang_donate['std_donation_success_note_one']."<a href=\"sendmessage.php?receiver=".$ACCOUNTANTID."\"><b>".$lang_donate['std_here']."</b></a>".$lang_donate['std_donation_success_note_two'], false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$paypal = safe_email($PAYPALACCOUNT);
|
||||||
|
if ($paypal && check_email($paypal))
|
||||||
|
$showpaypal = true;
|
||||||
|
else
|
||||||
|
$showpaypal = false;
|
||||||
|
$alipay = safe_email($ALIPAYACCOUNT);
|
||||||
|
if ($alipay && check_email($alipay))
|
||||||
|
$showalipay = true;
|
||||||
|
else
|
||||||
|
$showalipay = false;
|
||||||
|
|
||||||
|
if ($showpaypal && $showalipay)
|
||||||
|
$tdattr = "width=\"50%\"";
|
||||||
|
elseif ($showpaypal || $showalipay)
|
||||||
|
$tdattr = "colspan=\"2\" width=\"100%\"";
|
||||||
|
else
|
||||||
|
stderr($lang_donate['std_error'], $lang_donate['std_no_donation_account_available'], false);
|
||||||
|
|
||||||
|
stdhead($lang_donate['head_donation']);
|
||||||
|
begin_main_frame();
|
||||||
|
print("<h2>".$lang_donate['text_donate']."</h2>");
|
||||||
|
print("<table width=100%><tr>");
|
||||||
|
print("<td colspan=2 class=text align=left>".$lang_donate['text_donation_note']."</td></tr>");
|
||||||
|
print("<tr>");
|
||||||
|
if ($showpaypal){
|
||||||
|
?>
|
||||||
|
<td class=text align=left valign=top <?php echo $tdattr?>>
|
||||||
|
<b><?php echo $lang_donate['text_donate_with_paypal']?></b><br /><br />
|
||||||
|
<?php echo $lang_donate['text_donate_paypal_note']?>
|
||||||
|
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
|
||||||
|
<input type="hidden" name="cmd" value="_xclick">
|
||||||
|
<input type="hidden" name="business" value="<?php echo $paypal;?>">
|
||||||
|
<input type="hidden" name="item_name" value="Donation to <?php echo $SITENAME;?>">
|
||||||
|
<p align="center">
|
||||||
|
<br />
|
||||||
|
<?php echo $lang_donate['text_select_donation_amount']?>
|
||||||
|
<br />
|
||||||
|
<select name="amount">
|
||||||
|
<option value="" selected><?php echo $lang_donate['select_choose_donation_amount']?></option>
|
||||||
|
<?php
|
||||||
|
$allowedDonationUsdAmounts = array(0, 1, 5, 10, 15, 20, 30, 40, 50, 60, 100, 300);
|
||||||
|
//$allowedDonationUsdAmounts = array(32, 64, 320);
|
||||||
|
foreach ($allowedDonationUsdAmounts as $amount) {
|
||||||
|
if ($amount == 0) {
|
||||||
|
echo '<option value="">'.$lang_donate['select_other_donation_amount'].'</option>';
|
||||||
|
} else {
|
||||||
|
$amount = number_format($amount, 2);
|
||||||
|
echo '<option value='.$amount.'>'.$lang_donate['text_usd_mark'].$amount.$lang_donate['text_donation'].'</option>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
<input type="hidden" name="image_url" value="">
|
||||||
|
<input type="hidden" name="shipping" value="0">
|
||||||
|
<input type="hidden" name="currency_code" value="USD">
|
||||||
|
<input type="hidden" name="return" value="<?php echo get_protocol_prefix() . $BASEURL;?>/donate.php?do=thanks">
|
||||||
|
<input type="hidden" name="cancel_return" value="<?php echo get_protocol_prefix() . $BASEURL;?>/donate.php">
|
||||||
|
<br />
|
||||||
|
</p>
|
||||||
|
<p align="center">
|
||||||
|
<input type="image" src="pic/paypalbutton.gif" border="0" name="I1" alt="Make payments with PayPal">
|
||||||
|
<br /><br /></p>
|
||||||
|
</form></td>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
if ($showalipay){
|
||||||
|
?>
|
||||||
|
<td class=text align=left valign=top <?php echo $tdattr?>>
|
||||||
|
<b><?php echo $lang_donate['text_donate_with_alipay']?></b><br /><br />
|
||||||
|
<form action="https://www.alipay.com/trade/fast_pay.htm" method="get">
|
||||||
|
<?php echo $lang_donate['text_donate_alipay_note_one']."<b>".$alipay."</b>".$lang_donate['text_donate_alipay_note_two']?>
|
||||||
|
<br /><br /><br /><br /><br />
|
||||||
|
<p align="center">
|
||||||
|
<input type="image" src="pic/alipaybutton.gif" border="0" name="I2" alt="Make payments with Alipay" />
|
||||||
|
<br /><br /></p>
|
||||||
|
</form></td>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
print("</tr>");
|
||||||
|
print("<tr><td class=text colspan=2 align=left>".$lang_donate['text_after_donation_note_one']
|
||||||
|
."<a href=\"sendmessage.php?receiver=".$ACCOUNTANTID."\"><font class=\"striking\"><b>".$lang_donate['text_send_us']."</b></font></a>".$lang_donate['text_after_donation_note_two']."</td></tr>");
|
||||||
|
print("</table>");
|
||||||
|
end_main_frame();
|
||||||
|
stdfoot();
|
||||||
|
}
|
||||||
|
?>
|
||||||
32
donated.php
Normal file
32
donated.php
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
loggedinorreturn();
|
||||||
|
if (get_user_class() < UC_SYSOP)
|
||||||
|
stderr("Error", "Access denied.");
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] == "POST")
|
||||||
|
{
|
||||||
|
if ($_POST["username"] == "" || $_POST["donated"] == "")
|
||||||
|
stderr("Error", "Missing form data.");
|
||||||
|
$username = sqlesc($_POST["username"]);
|
||||||
|
$donated = sqlesc($_POST["donated"]);
|
||||||
|
|
||||||
|
sql_query("UPDATE users SET donated=$donated WHERE username=$username") or sqlerr(__FILE__, __LINE__);
|
||||||
|
$res = sql_query("SELECT id FROM users WHERE username=$username");
|
||||||
|
$arr = mysql_fetch_row($res);
|
||||||
|
if (!$arr)
|
||||||
|
stderr("Error", "Unable to update account.");
|
||||||
|
header("Location: " . get_protocol_prefix() . "$BASEURL/userdetails.php?id=$arr[0]");
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
stdhead("Update Users Donated Amounts");
|
||||||
|
?>
|
||||||
|
<h1>Update Users Donated Amounts</h1>
|
||||||
|
<form method=post action=donated.php>
|
||||||
|
<table border=1 cellspacing=0 cellpadding=5>
|
||||||
|
<tr><td class=rowhead>User name</td><td><input type=text name=username size=40></td></tr>
|
||||||
|
<tr><td class=rowhead>Donated</td><td><input type=uploaded name=donated size=5></td></tr>
|
||||||
|
<tr><td colspan=2 align=center><input type=submit value="Okay" class=btn></td></tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
<?php stdfoot();
|
||||||
43
donorlist.php
Normal file
43
donorlist.php
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
loggedinorreturn();
|
||||||
|
|
||||||
|
if (get_user_class() > UC_MODERATOR) {
|
||||||
|
$res = sql_query("SELECT COUNT(*) FROM users WHERE donor='yes'");
|
||||||
|
$row = mysql_fetch_array($res);
|
||||||
|
$count = $row[0];
|
||||||
|
|
||||||
|
list($pagertop, $pagerbottom, $limit) = pager(50, $count, "donorlist.php?");
|
||||||
|
stdhead("Donorlist");
|
||||||
|
if (mysql_num_rows($res) == 0)
|
||||||
|
begin_main_frame();
|
||||||
|
// ===================================
|
||||||
|
$users = number_format(get_row_count("users", "WHERE donor='yes'"));
|
||||||
|
begin_frame("Donor List ($users)", true);
|
||||||
|
begin_table();
|
||||||
|
echo $pagerbottom;
|
||||||
|
?>
|
||||||
|
<form method="post">
|
||||||
|
<tr><td class="colhead">ID</td><td class="colhead" align="left">Username</td><td class="colhead" align="left">e-mail</td><td class="colhead" align="left">Joined</td><td class="colhead" align="left">How much?</td></tr>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$res=sql_query("SELECT id,username,email,added,donated FROM users WHERE donor='yes' ORDER BY id DESC $limit") or print(mysql_error());
|
||||||
|
// ------------------
|
||||||
|
while ($arr = @mysql_fetch_assoc($res)) {
|
||||||
|
echo "<tr><td>" . $arr[id] . "</td><td align=\"left\">" . get_username($arr[id]) . "</td><td align=\"left\"><a href=mailto:" . $arr[email] . ">" . $arr[email] . "</a></td><td align=\"left\">" . $arr[added] . "</a></td><td align=\"left\">$" . $arr[donated] . "</td></tr>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
<?php
|
||||||
|
// ------------------
|
||||||
|
end_table();
|
||||||
|
end_frame();
|
||||||
|
// ===================================
|
||||||
|
end_main_frame();
|
||||||
|
stdfoot();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
stderr("Sorry", "Access denied!");
|
||||||
|
}
|
||||||
153
download.php
Normal file
153
download.php
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
<?php
|
||||||
|
require_once("include/bittorrent.php");
|
||||||
|
dbconn();
|
||||||
|
$id = (int)$_GET["id"];
|
||||||
|
if (!$id)
|
||||||
|
httperr();
|
||||||
|
$passkey = $_GET['passkey'];
|
||||||
|
if ($passkey){
|
||||||
|
$res = sql_query("SELECT * FROM users WHERE passkey=". sqlesc($passkey)." LIMIT 1");
|
||||||
|
$user = mysql_fetch_array($res);
|
||||||
|
if (!$user)
|
||||||
|
die("invalid passkey");
|
||||||
|
elseif ($user['enabled'] == 'no' || $user['parked'] == 'yes')
|
||||||
|
die("account disabed or parked");
|
||||||
|
$oldip = $user['ip'];
|
||||||
|
$user['ip'] = getip();
|
||||||
|
$CURUSER = $user;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
loggedinorreturn();
|
||||||
|
parked();
|
||||||
|
$letdown = $_GET['letdown'];
|
||||||
|
if (!$letdown && $CURUSER['showdlnotice'] == 1)
|
||||||
|
{
|
||||||
|
header("Location: " . get_protocol_prefix() . "$BASEURL/downloadnotice.php?torrentid=".$id."&type=firsttime");
|
||||||
|
}
|
||||||
|
elseif (!$letdown && $CURUSER['showclienterror'] == 'yes')
|
||||||
|
{
|
||||||
|
header("Location: " . get_protocol_prefix() . "$BASEURL/downloadnotice.php?torrentid=".$id."&type=client");
|
||||||
|
}
|
||||||
|
elseif (!$letdown && $CURUSER['leechwarn'] == 'yes')
|
||||||
|
{
|
||||||
|
header("Location: " . get_protocol_prefix() . "$BASEURL/downloadnotice.php?torrentid=".$id."&type=ratio");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//User may choose to download torrent from RSS. So log ip changes when downloading torrents.
|
||||||
|
if ($iplog1 == "yes") {
|
||||||
|
if (($oldip != $CURUSER["ip"]) && $CURUSER["ip"])
|
||||||
|
sql_query("INSERT INTO iplog (ip, userid, access) VALUES (" . sqlesc($CURUSER['ip']) . ", " . $CURUSER['id'] . ", '" . $CURUSER['last_access'] . "')");
|
||||||
|
}
|
||||||
|
//User may choose to download torrent from RSS. So update his last_access and ip when downloading torrents.
|
||||||
|
sql_query("UPDATE users SET last_access = ".sqlesc(date("Y-m-d H:i:s")).", ip = ".sqlesc($CURUSER['ip'])." WHERE id = ".sqlesc($CURUSER['id']));
|
||||||
|
|
||||||
|
/*
|
||||||
|
@ini_set('zlib.output_compression', 'Off');
|
||||||
|
@set_time_limit(0);
|
||||||
|
|
||||||
|
if (@ini_get('output_handler') == 'ob_gzhandler' AND @ob_get_length() !== false)
|
||||||
|
{ // if output_handler = ob_gzhandler, turn it off and remove the header sent by PHP
|
||||||
|
@ob_end_clean();
|
||||||
|
header('Content-Encoding:');
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
if ($_COOKIE["c_secure_tracker_ssl"] == base64("yeah"))
|
||||||
|
$tracker_ssl = true;
|
||||||
|
else
|
||||||
|
$tracker_ssl = false;
|
||||||
|
if ($tracker_ssl == true){
|
||||||
|
$ssl_torrent = "https://";
|
||||||
|
if ($https_announce_urls[0] != "")
|
||||||
|
$base_announce_url = $https_announce_urls[0];
|
||||||
|
else
|
||||||
|
$base_announce_url = $announce_urls[0];
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$ssl_torrent = "http://";
|
||||||
|
$base_announce_url = $announce_urls[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$res = sql_query("SELECT name, filename, save_as, size, owner,banned FROM torrents WHERE id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
|
||||||
|
$row = mysql_fetch_assoc($res);
|
||||||
|
$fn = "$torrent_dir/$id.torrent";
|
||||||
|
if ($CURUSER['downloadpos']=="no")
|
||||||
|
permissiondenied();
|
||||||
|
if (!$row || !is_file($fn) || !is_readable($fn))
|
||||||
|
httperr();
|
||||||
|
if ($row['banned'] == 'yes' && get_user_class() < $seebanned_class)
|
||||||
|
permissiondenied();
|
||||||
|
sql_query("UPDATE torrents SET hits = hits + 1 WHERE id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
|
||||||
|
|
||||||
|
require_once "include/benc.php";
|
||||||
|
|
||||||
|
if (strlen($CURUSER['passkey']) != 32) {
|
||||||
|
$CURUSER['passkey'] = md5($CURUSER['username'].date("Y-m-d H:i:s").$CURUSER['passhash']);
|
||||||
|
sql_query("UPDATE users SET passkey=".sqlesc($CURUSER[passkey])." WHERE id=".sqlesc($CURUSER[id]));
|
||||||
|
}
|
||||||
|
|
||||||
|
$dict = bdec_file($fn, $max_torrent_size);
|
||||||
|
$dict['value']['announce']['value'] = $ssl_torrent . $base_announce_url . "?passkey=$CURUSER[passkey]";
|
||||||
|
$dict['value']['announce']['string'] = strlen($dict['value']['announce']['value']).":".$dict['value']['announce']['value'];
|
||||||
|
$dict['value']['announce']['strlen'] = strlen($dict['value']['announce']['string']);
|
||||||
|
/*if ($announce_urls[1] != "") // add multi-tracker
|
||||||
|
{
|
||||||
|
$dict['value']['announce-list']['type'] = "list";
|
||||||
|
$dict['value']['announce-list']['value'][0]['type'] = "list";
|
||||||
|
$dict['value']['announce-list']['value'][0]['value'][0]["type"] = "string";
|
||||||
|
$dict['value']['announce-list']['value'][0]['value'][0]["value"] = $ssl_torrent . $announce_urls[0] . "?passkey=$CURUSER[passkey]";
|
||||||
|
$dict['value']['announce-list']['value'][0]['value'][0]["string"] = strlen($dict['value']['announce-list']['value'][0]['value'][0]["value"]).":".$dict['value']['announce-list']['value'][0]['value'][0]["value"];
|
||||||
|
$dict['value']['announce-list']['value'][0]['value'][0]["strlen"] = strlen($dict['value']['announce-list']['value'][0]['value'][0]["string"]);
|
||||||
|
$dict['value']['announce-list']['value'][0]['string'] = "l".$dict['value']['announce-list']['value'][0]['value'][0]["string"]."e";
|
||||||
|
$dict['value']['announce-list']['value'][0]['strlen'] = strlen($dict['value']['announce-list']['value'][0]['string']);
|
||||||
|
$dict['value']['announce-list']['value'][1]['type'] = "list";
|
||||||
|
$dict['value']['announce-list']['value'][1]['value'][0]["type"] = "string";
|
||||||
|
$dict['value']['announce-list']['value'][1]['value'][0]["value"] = $ssl_torrent . $announce_urls[1] . "?passkey=$CURUSER[passkey]";
|
||||||
|
$dict['value']['announce-list']['value'][1]['value'][0]["string"] = strlen($dict['value']['announce-list']['value'][0]['value'][0]["value"]).":".$dict['value']['announce-list']['value'][0]['value'][0]["value"];
|
||||||
|
$dict['value']['announce-list']['value'][1]['value'][0]["strlen"] = strlen($dict['value']['announce-list']['value'][0]['value'][0]["string"]);
|
||||||
|
$dict['value']['announce-list']['value'][1]['string'] = "l".$dict['value']['announce-list']['value'][0]['value'][0]["string"]."e";
|
||||||
|
$dict['value']['announce-list']['value'][1]['strlen'] = strlen($dict['value']['announce-list']['value'][0]['string']);
|
||||||
|
$dict['value']['announce-list']['string'] = "l".$dict['value']['announce-list']['value'][0]['string'].$dict['value']['announce-list']['value'][1]['string']."e";
|
||||||
|
$dict['value']['announce-list']['strlen'] = strlen($dict['value']['announce-list']['string']);
|
||||||
|
}*/
|
||||||
|
/*
|
||||||
|
header ("Expires: Tue, 1 Jan 1980 00:00:00 GMT");
|
||||||
|
header ("Last-Modified: ".date("D, d M Y H:i:s"));
|
||||||
|
header ("Cache-Control: no-store, no-cache, must-revalidate");
|
||||||
|
header ("Cache-Control: post-check=0, pre-check=0", false);
|
||||||
|
header ("Pragma: no-cache");
|
||||||
|
header ("X-Powered-By: ".VERSION." (c) ".date("Y")." ".$SITENAME."");
|
||||||
|
header ("Accept-Ranges: bytes");
|
||||||
|
header ("Connection: close");
|
||||||
|
header ("Content-Transfer-Encoding: binary");
|
||||||
|
*/
|
||||||
|
|
||||||
|
header("Content-Type: application/x-bittorrent");
|
||||||
|
|
||||||
|
if ( str_replace("Gecko", "", $_SERVER['HTTP_USER_AGENT']) != $_SERVER['HTTP_USER_AGENT'])
|
||||||
|
{
|
||||||
|
header ("Content-Disposition: attachment; filename=\"$torrentnameprefix.".$row["save_as"].".torrent\" ; charset=utf-8");
|
||||||
|
}
|
||||||
|
else if ( str_replace("Firefox", "", $_SERVER['HTTP_USER_AGENT']) != $_SERVER['HTTP_USER_AGENT'] )
|
||||||
|
{
|
||||||
|
header ("Content-Disposition: attachment; filename=\"$torrentnameprefix.".$row["save_as"].".torrent\" ; charset=utf-8");
|
||||||
|
}
|
||||||
|
else if ( str_replace("Opera", "", $_SERVER['HTTP_USER_AGENT']) != $_SERVER['HTTP_USER_AGENT'] )
|
||||||
|
{
|
||||||
|
header ("Content-Disposition: attachment; filename=\"$torrentnameprefix.".$row["save_as"].".torrent\" ; charset=utf-8");
|
||||||
|
}
|
||||||
|
else if ( str_replace("IE", "", $_SERVER['HTTP_USER_AGENT']) != $_SERVER['HTTP_USER_AGENT'] )
|
||||||
|
{
|
||||||
|
header ("Content-Disposition: attachment; filename=".str_replace("+", "%20", rawurlencode("$torrentnameprefix." . $row["save_as"] .".torrent")));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
header ("Content-Disposition: attachment; filename=".str_replace("+", "%20", rawurlencode("$torrentnameprefix." . $row["save_as"] .".torrent")));
|
||||||
|
}
|
||||||
|
|
||||||
|
//header ("Content-Disposition: attachment; filename=".$row["filename"]."");
|
||||||
|
//ob_implicit_flush(true);
|
||||||
|
print(benc($dict));
|
||||||
|
?>
|
||||||
164
downloadnotice.php
Normal file
164
downloadnotice.php
Normal file
@@ -0,0 +1,164 @@
|
|||||||
|
<?php
|
||||||
|
require_once("include/bittorrent.php");
|
||||||
|
dbconn();
|
||||||
|
require_once(get_langfile_path());
|
||||||
|
loggedinorreturn();
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] == "POST")
|
||||||
|
{
|
||||||
|
$torrentid = 0+$_POST['id'];
|
||||||
|
$type = $_POST['type'];
|
||||||
|
$hidenotice = $_POST['hidenotice'];
|
||||||
|
if (!$torrentid || !in_array($type,array('firsttime', 'client', 'ratio')))
|
||||||
|
die("error");
|
||||||
|
elseif ($type == 'firsttime')
|
||||||
|
{
|
||||||
|
if ($hidenotice){
|
||||||
|
sql_query("UPDATE users SET showdlnotice=0 WHERE id=".sqlesc($CURUSER['id']));
|
||||||
|
}
|
||||||
|
header("Location: " . get_protocol_prefix() . "$BASEURL/download.php?id=".$torrentid."&letdown=1");
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
elseif ($type == 'client')
|
||||||
|
{
|
||||||
|
if ($hidenotice){
|
||||||
|
sql_query("UPDATE users SET showclienterror='no' WHERE id=".sqlesc($CURUSER['id']));
|
||||||
|
}
|
||||||
|
header("Location: " . get_protocol_prefix() . "$BASEURL/download.php?id=".$torrentid."&letdown=1");
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
header("Location: " . get_protocol_prefix() . "$BASEURL/download.php?id=".$torrentid."&letdown=1");
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$torrentid = (int)$_GET["torrentid"];
|
||||||
|
$type = $_GET["type"];
|
||||||
|
switch ($type)
|
||||||
|
{
|
||||||
|
case 'client':
|
||||||
|
{
|
||||||
|
$title = $lang_downloadnotice['text_client_banned_notice'];
|
||||||
|
$note = $lang_downloadnotice['text_client_banned_note'];
|
||||||
|
$noticenexttime = $lang_downloadnotice['text_notice_not_show_again'];
|
||||||
|
$showrationotice = false;
|
||||||
|
$showclientnotice = true;
|
||||||
|
$forcecheck = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'ratio':
|
||||||
|
{
|
||||||
|
$title = $lang_downloadnotice['text_low_ratio_notice'];
|
||||||
|
$leechwarnuntiltime = strtotime($CURUSER['leechwarnuntil']);
|
||||||
|
if (TIMENOW < $leechwarnuntiltime){
|
||||||
|
$kicktimeout = gettime($CURUSER['leechwarnuntil'], false, false, true);
|
||||||
|
$note = $lang_downloadnotice['text_low_ratio_note_one'].$kicktimeout.$lang_downloadnotice['text_low_ratio_note_two'];
|
||||||
|
}
|
||||||
|
$noticenexttime = $lang_downloadnotice['text_notice_always_show'];
|
||||||
|
$showrationotice = true;
|
||||||
|
$showclientnotice = false;
|
||||||
|
$forcecheck = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'firsttime':
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
$type = 'firsttime';
|
||||||
|
$title = $lang_downloadnotice['text_first_time_download_notice'];
|
||||||
|
$note = $lang_downloadnotice['text_first_time_download_note'];
|
||||||
|
$noticenexttime = $lang_downloadnotice['text_notice_not_show_again'];
|
||||||
|
$showrationotice = true;
|
||||||
|
$showclientnotice = true;
|
||||||
|
$forcecheck = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($showrationotice && $showclientnotice)
|
||||||
|
$tdattr = "width=\"50%\"";
|
||||||
|
else
|
||||||
|
$tdattr = "colspan=\"2\" width=\"100%\"";
|
||||||
|
stdhead($lang_downloadnotice['head_download_notice']);
|
||||||
|
begin_main_frame();
|
||||||
|
?>
|
||||||
|
<h2><?php echo $title?></h2>
|
||||||
|
<table width="100%"><tr>
|
||||||
|
<td colspan="2" class="text" align="left"><p><?php echo $note?></p></td></tr>
|
||||||
|
<tr>
|
||||||
|
<?php
|
||||||
|
if ($showrationotice)
|
||||||
|
{
|
||||||
|
?>
|
||||||
|
<td class="text" align="left" valign="top" <?php echo $tdattr?>>
|
||||||
|
<h3><?php echo $lang_downloadnotice['text_this_is_private_tracker']?></h3>
|
||||||
|
<p><?php echo $lang_downloadnotice['text_private_tracker_note_one']?><i>(<?php echo $lang_downloadnotice['text_learn_more']?><a class="faqlink" href="<?php echo NEXUSWIKIURL?>/Private Tracker" target="_blank"><?php echo $lang_downloadnotice['text_nexuswiki']?></a>)</i></p>
|
||||||
|
<p><?php echo $lang_downloadnotice['text_private_tracker_note_two']?><i>(<?php echo $lang_downloadnotice['text_see_ratio']?><a class="faqlink" href="faq.php#id23" target="_blank"><?php echo $lang_downloadnotice['text_faq']?></a>)</i></p>
|
||||||
|
<p><?php echo $lang_downloadnotice['text_private_tracker_note_three']?></p>
|
||||||
|
<img src="pic/ratio.png" alt="ratio" />
|
||||||
|
<p><?php echo $lang_downloadnotice['text_private_tracker_note_four']?></p>
|
||||||
|
</td>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
if ($showclientnotice)
|
||||||
|
{
|
||||||
|
?>
|
||||||
|
<td class="text" align="left" valign="top" <?php echo $tdattr?>>
|
||||||
|
<h3><?php echo $lang_downloadnotice['text_use_allowed_clients']?></h3>
|
||||||
|
<p><?php echo $lang_downloadnotice['text_allowed_clients_note_one']?><i>(<?php echo $lang_downloadnotice['text_why_banned']?><a class="faqlink" href="<?php echo NEXUSWIKIURL?>/客户端测试报告" target="_blank"><?php echo $lang_downloadnotice['text_nexuswiki']?></a>)</i></p>
|
||||||
|
<p><?php echo $lang_downloadnotice['text_allowed_clients_note_two']?><a class='faqlink' href='faq.php#id29' target='_blank'><?php echo $lang_downloadnotice['text_faq']?></a><?php echo $lang_downloadnotice['text_allowed_clients_note_three']?></p>
|
||||||
|
<table width="100%">
|
||||||
|
<tr>
|
||||||
|
<td class="embedded" style="text-align: center; padding: 5px;" width="50%">
|
||||||
|
<a href="http://www.utorrent.com/download.php" target="_blank" title="<?php echo $lang_downloadnotice['title_download']?>uTorrent"><img src="pic/utorrentbig.png" alt="uTorrent" /></a>
|
||||||
|
</td>
|
||||||
|
<td class="embedded" style="text-align: center; padding: 5px;" width="50%">
|
||||||
|
<a href="http://azureus.sourceforge.net/download.php" target="_blank" title="<?php echo $lang_downloadnotice['title_download']?>Vuze"><img src="pic/vuzebig.png" alt="Vuze" /></a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="embedded" style="text-align: center; padding: 5px;">
|
||||||
|
<div class="big"><a href="http://www.utorrent.com/download.php" target="_blank" title="<?php echo $lang_downloadnotice['title_download']?>uTorrent"><b>uTorrent</b></a></div>
|
||||||
|
<div><?php echo $lang_downloadnotice['text_for']?>Windows</div>
|
||||||
|
</td>
|
||||||
|
<td class="embedded" style="text-align: center; padding: 5px;">
|
||||||
|
<div class="big"><a href="http://azureus.sourceforge.net/download.php" target="_blank" title="<?php echo $lang_downloadnotice['title_download']?>Vuze"><b>Vuze</b></a></div>
|
||||||
|
<div><?php echo $lang_downloadnotice['text_for']?>Windows, Linux, Mac OS X</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
if ($torrentid)
|
||||||
|
{
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td class="text" colspan="2">
|
||||||
|
<form action="?" method="post"><p><?php echo $lang_downloadnotice['text_for_more_information_read']?><a class="faqlink" href="rules.php" target="_blank"><?php echo $lang_downloadnotice['text_rules']?></a><?php echo $lang_downloadnotice['text_and']?><a class="faqlink" href="faq.php" target="_blank"><?php echo $lang_downloadnotice['text_faq']?></a><br />
|
||||||
|
<input type="hidden" name="id" value="<?php echo $torrentid?>" />
|
||||||
|
<input type="hidden" name="type" value="<?php echo htmlspecialchars($type)?>" />
|
||||||
|
<input type="checkbox" name="hidenotice" id="hidenotice" value="1"<?php echo $forcecheck ? " disabled=\"disabled\"" : " checked=\"checked\""?> /><label for="hidenotice"><?php echo $noticenexttime?></label>
|
||||||
|
<?php
|
||||||
|
if ($forcecheck)
|
||||||
|
{
|
||||||
|
?>
|
||||||
|
<br /><input type="checkbox" name="letmedown" id="letmedown" value="<?php echo htmlspecialchars($type)?>" onclick="if (this.checked) {document.getElementById('continuedownload').disabled = false;}else{document.getElementById('continuedownload').disabled = true;}" /><label for="letmedown"><span class="big"><?php echo $lang_downloadnotice['text_let_me_download']?></span></label>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</p>
|
||||||
|
<div><input type="submit" name="submit" id="continuedownload" style="font-size: 20pt; height: 40px;" value="<?php echo $lang_downloadnotice['submit_download_the_torrent']?>"<?php echo $forcecheck ? " disabled=\"disabled\"" : ""?> /></div>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
<?php
|
||||||
|
end_main_frame();
|
||||||
|
stdfoot();
|
||||||
|
}
|
||||||
63
downloadsubs.php
Normal file
63
downloadsubs.php
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
<?php
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
if (!$CURUSER)
|
||||||
|
{
|
||||||
|
Header("Location: " . get_protocol_prefix() . "$BASEURL/");
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
$filename = $_GET["subid"];
|
||||||
|
$dirname = $_GET["torrentid"];
|
||||||
|
|
||||||
|
if (!$filename || !$dirname)
|
||||||
|
die("File name missing\n");
|
||||||
|
|
||||||
|
$filename = 0 + $filename;
|
||||||
|
$dirname = 0 + $dirname;
|
||||||
|
|
||||||
|
$res = sql_query("SELECT * FROM subs WHERE id=$filename") or sqlerr(__FILE__, __LINE__);
|
||||||
|
$arr = mysql_fetch_assoc($res);
|
||||||
|
if (!$arr)
|
||||||
|
die("Not found\n");
|
||||||
|
|
||||||
|
sql_query("UPDATE subs SET hits=hits+1 WHERE id=$filename") or sqlerr(__FILE__, __LINE__);
|
||||||
|
$file = "$SUBSPATH/$dirname/$filename.$arr[ext]";
|
||||||
|
|
||||||
|
if (!is_file($file))
|
||||||
|
die("File not found\n");
|
||||||
|
$f = fopen($file, "rb");
|
||||||
|
if (!$f)
|
||||||
|
die("Cannot open file\n");
|
||||||
|
header("Content-Length: " . filesize($file));
|
||||||
|
header("Content-Type: application/octet-stream");
|
||||||
|
|
||||||
|
if ( str_replace("Gecko", "", $_SERVER['HTTP_USER_AGENT']) != $_SERVER['HTTP_USER_AGENT'])
|
||||||
|
{
|
||||||
|
header ("Content-Disposition: attachment; filename=\"$arr[filename]\" ; charset=utf-8");
|
||||||
|
}
|
||||||
|
else if ( str_replace("Firefox", "", $_SERVER['HTTP_USER_AGENT']) != $_SERVER['HTTP_USER_AGENT'] )
|
||||||
|
{
|
||||||
|
header ("Content-Disposition: attachment; filename=\"$arr[filename]\" ; charset=utf-8");
|
||||||
|
}
|
||||||
|
else if ( str_replace("Opera", "", $_SERVER['HTTP_USER_AGENT']) != $_SERVER['HTTP_USER_AGENT'] )
|
||||||
|
{
|
||||||
|
header ("Content-Disposition: attachment; filename=\"$arr[filename]\" ; charset=utf-8");
|
||||||
|
}
|
||||||
|
else if ( str_replace("IE", "", $_SERVER['HTTP_USER_AGENT']) != $_SERVER['HTTP_USER_AGENT'] )
|
||||||
|
{
|
||||||
|
header ("Content-Disposition: attachment; filename=".str_replace("+", "%20", rawurlencode($arr[filename])));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
header ("Content-Disposition: attachment; filename=".str_replace("+", "%20", rawurlencode($arr[filename])));
|
||||||
|
}
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
$s = fread($f, 4096);
|
||||||
|
print($s);
|
||||||
|
} while (!feof($f));
|
||||||
|
//closefile($f);
|
||||||
|
exit;
|
||||||
|
?>
|
||||||
174
edit.php
Normal file
174
edit.php
Normal file
@@ -0,0 +1,174 @@
|
|||||||
|
<?php
|
||||||
|
require_once("include/bittorrent.php");
|
||||||
|
dbconn();
|
||||||
|
require_once(get_langfile_path());
|
||||||
|
loggedinorreturn();
|
||||||
|
|
||||||
|
$id = 0 + $_GET['id'];
|
||||||
|
if (!$id)
|
||||||
|
die();
|
||||||
|
|
||||||
|
$res = sql_query("SELECT torrents.*, categories.mode as cat_mode FROM torrents LEFT JOIN categories ON category = categories.id WHERE torrents.id = $id");
|
||||||
|
$row = mysql_fetch_array($res);
|
||||||
|
if (!$row) die();
|
||||||
|
|
||||||
|
if ($enablespecial == 'yes' && get_user_class() >= $movetorrent_class)
|
||||||
|
$allowmove = true; //enable moving torrent to other section
|
||||||
|
else $allowmove = false;
|
||||||
|
|
||||||
|
$sectionmode = $row['cat_mode'];
|
||||||
|
if ($sectionmode == $browsecatmode)
|
||||||
|
{
|
||||||
|
$othermode = $specialcatmode;
|
||||||
|
$movenote = $lang_edit['text_move_to_special'];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$othermode = $browsecatmode;
|
||||||
|
$movenote = $lang_edit['text_move_to_browse'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$showsource = (get_searchbox_value($sectionmode, 'showsource') || ($allowmove && get_searchbox_value($othermode, 'showsource'))); //whether show sources or not
|
||||||
|
$showmedium = (get_searchbox_value($sectionmode, 'showmedium') || ($allowmove && get_searchbox_value($othermode, 'showmedium'))); //whether show media or not
|
||||||
|
$showcodec = (get_searchbox_value($sectionmode, 'showcodec') || ($allowmove && get_searchbox_value($othermode, 'showcodec'))); //whether show codecs or not
|
||||||
|
$showstandard = (get_searchbox_value($sectionmode, 'showstandard') || ($allowmove && get_searchbox_value($othermode, 'showstandard'))); //whether show standards or not
|
||||||
|
$showprocessing = (get_searchbox_value($sectionmode, 'showprocessing') || ($allowmove && get_searchbox_value($othermode, 'showprocessing'))); //whether show processings or not
|
||||||
|
$showteam = (get_searchbox_value($sectionmode, 'showteam') || ($allowmove && get_searchbox_value($othermode, 'showteam'))); //whether show teams or not
|
||||||
|
$showaudiocodec = (get_searchbox_value($sectionmode, 'showaudiocodec') || ($allowmove && get_searchbox_value($othermode, 'showaudiocodec'))); //whether show audio codecs or not
|
||||||
|
|
||||||
|
stdhead($lang_edit['head_edit_torrent'] . "\"". $row["name"] . "\"");
|
||||||
|
|
||||||
|
if (!isset($CURUSER) || ($CURUSER["id"] != $row["owner"] && get_user_class() < $torrentmanage_class)) {
|
||||||
|
print("<h1 align=\"center\">".$lang_edit['text_cannot_edit_torrent']."</h1>");
|
||||||
|
print("<p>".$lang_edit['text_cannot_edit_torrent_note']."</p>");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
print("<form method=\"post\" id=\"compose\" name=\"edittorrent\" action=\"takeedit.php\" enctype=\"multipart/form-data\">");
|
||||||
|
print("<input type=\"hidden\" name=\"id\" value=\"$id\" />");
|
||||||
|
if (isset($_GET["returnto"]))
|
||||||
|
print("<input type=\"hidden\" name=\"returnto\" value=\"" . htmlspecialchars($_GET["returnto"]) . "\" />");
|
||||||
|
print("<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\" width=\"940\">\n");
|
||||||
|
print("<tr><td class='colhead' colspan='2' align='center'>".htmlspecialchars($row["name"])."</td></tr>");
|
||||||
|
tr($lang_edit['row_torrent_name']."<font color=\"red\">*</font>", "<input type=\"text\" style=\"width: 650px;\" name=\"name\" value=\"" . htmlspecialchars($row["name"]) . "\" />", 1);
|
||||||
|
if ($smalldescription_main == 'yes')
|
||||||
|
tr($lang_edit['row_small_description'], "<input type=\"text\" style=\"width: 650px;\" name=\"small_descr\" value=\"" . htmlspecialchars($row["small_descr"]) . "\" />", 1);
|
||||||
|
|
||||||
|
get_external_tr($row["url"]);
|
||||||
|
|
||||||
|
if ($enablenfo_main=='yes')
|
||||||
|
tr($lang_edit['row_nfo_file'], "<font class=\"medium\"><input type=\"radio\" name=\"nfoaction\" value=\"keep\" checked=\"checked\" />".$lang_edit['radio_keep_current'].
|
||||||
|
"<input type=\"radio\" name=\"nfoaction\" value=\"remove\" />".$lang_edit['radio_remove'].
|
||||||
|
"<input id=\"nfoupdate\" type=\"radio\" name=\"nfoaction\" value=\"update\" />".$lang_edit['radio_update']."</font><br /><input type=\"file\" name=\"nfo\" onchange=\"document.getElementById('nfoupdate').checked=true\" />", 1);
|
||||||
|
print("<tr><td class=\"rowhead\">".$lang_edit['row_description']."<font color=\"red\">*</font></td><td class=\"rowfollow\">");
|
||||||
|
textbbcode("edittorrent","descr",($row["descr"]), false);
|
||||||
|
print("</td></tr>");
|
||||||
|
$s = "<select name=\"type\" id=\"oricat\">";
|
||||||
|
|
||||||
|
$cats = genrelist($sectionmode);
|
||||||
|
foreach ($cats as $subrow) {
|
||||||
|
$s .= "<option value=\"" . $subrow["id"] . "\"";
|
||||||
|
if ($subrow["id"] == $row["category"])
|
||||||
|
$s .= " selected=\"selected\"";
|
||||||
|
$s .= ">" . htmlspecialchars($subrow["name"]) . "</option>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$s .= "</select>\n";
|
||||||
|
if ($allowmove){
|
||||||
|
$s2 = "<select name=\"type\" id=newcat disabled>\n";
|
||||||
|
$cats2 = genrelist($othermode);
|
||||||
|
foreach ($cats2 as $subrow) {
|
||||||
|
$s2 .= "<option value=\"" . $subrow["id"] . "\"";
|
||||||
|
if ($subrow["id"] == $row["category"])
|
||||||
|
$s2 .= " selected=\"selected\"";
|
||||||
|
$s2 .= ">" . htmlspecialchars($subrow["name"]) . "</option>\n";
|
||||||
|
}
|
||||||
|
$s2 .= "</select>\n";
|
||||||
|
$movecheckbox = "<input type=\"checkbox\" id=movecheck name=\"movecheck\" value=\"1\" onclick=\"disableother2('oricat','newcat')\" />";
|
||||||
|
}
|
||||||
|
tr($lang_edit['row_type']."<font color=\"red\">*</font>", $s.($allowmove ? " ".$movecheckbox.$movenote.$s2 : ""), 1);
|
||||||
|
if ($showsource || $showmedium || $showcodec || $showaudiocodec || $showstandard || $showprocessing){
|
||||||
|
if ($showsource){
|
||||||
|
$source_select = torrent_selection($lang_edit['text_source'],"source_sel","sources",$row["source"]);
|
||||||
|
}
|
||||||
|
else $source_select = "";
|
||||||
|
|
||||||
|
if ($showmedium){
|
||||||
|
$medium_select = torrent_selection($lang_edit['text_medium'],"medium_sel","media",$row["medium"]);
|
||||||
|
}
|
||||||
|
else $medium_select = "";
|
||||||
|
|
||||||
|
if ($showcodec){
|
||||||
|
$codec_select = torrent_selection($lang_edit['text_codec'],"codec_sel","codecs",$row["codec"]);
|
||||||
|
}
|
||||||
|
else $codec_select = "";
|
||||||
|
|
||||||
|
if ($showaudiocodec){
|
||||||
|
$audiocodec_select = torrent_selection($lang_edit['text_audio_codec'],"audiocodec_sel","audiocodecs",$row["audiocodec"]);
|
||||||
|
}
|
||||||
|
else $audiocodec_select = "";
|
||||||
|
|
||||||
|
if ($showstandard){
|
||||||
|
$standard_select = torrent_selection($lang_edit['text_standard'],"standard_sel","standards",$row["standard"]);
|
||||||
|
}
|
||||||
|
else $standard_select = "";
|
||||||
|
|
||||||
|
if ($showprocessing){
|
||||||
|
$processing_select = torrent_selection($lang_edit['text_processing'],"processing_sel","processings",$row["processing"]);
|
||||||
|
}
|
||||||
|
else $processing_select = "";
|
||||||
|
|
||||||
|
tr($lang_edit['row_quality'], $source_select . $medium_select . $codec_select . $audiocodec_select. $standard_select . $processing_select, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($showteam){
|
||||||
|
if ($showteam){
|
||||||
|
$team_select = torrent_selection($lang_edit['text_team'],"team_sel","teams",$row["team"]);
|
||||||
|
}
|
||||||
|
else $showteam = "";
|
||||||
|
|
||||||
|
tr($lang_edit['row_content'],$team_select,1);
|
||||||
|
}
|
||||||
|
tr($lang_edit['row_check'], "<input type=\"checkbox\" name=\"visible\"" . ($row["visible"] == "yes" ? " checked=\"checked\"" : "" ) . " value=\"1\" /> ".$lang_edit['checkbox_visible']." ".(get_user_class() >= $beanonymous_class || get_user_class() >= $torrentmanage_class ? "<input type=\"checkbox\" name=\"anonymous\"" . ($row["anonymous"] == "yes" ? " checked=\"checked\"" : "" ) . " value=\"1\" />".$lang_edit['checkbox_anonymous_note']." " : "").(get_user_class() >= $torrentmanage_class ? "<input type=\"checkbox\" name=\"banned\"" . (($row["banned"] == "yes") ? " checked=\"checked\"" : "" ) . " value=\"yes\" /> ".$lang_edit['checkbox_banned'] : ""), 1);
|
||||||
|
if (get_user_class()>= $torrentsticky_class || (get_user_class() >= $torrentmanage_class && $CURUSER["picker"] == 'yes')){
|
||||||
|
$pickcontent = "";
|
||||||
|
|
||||||
|
if(get_user_class()>=$torrentsticky_class)
|
||||||
|
{
|
||||||
|
$pickcontent .= "<b>".$lang_edit['row_special_torrent'].": </b>"."<select name=\"sel_spstate\" style=\"width: 100px;\">" .promotion_selection($row["sp_state"], 0). "</select> ";
|
||||||
|
$pickcontent .= "<b>".$lang_edit['row_torrent_position'].": </b>"."<select name=\"sel_posstate\" style=\"width: 100px;\">" .
|
||||||
|
"<option" . (($row["pos_state"] == "normal") ? " selected=\"selected\"" : "" ) . " value=\"0\">".$lang_edit['select_normal']."</option>" .
|
||||||
|
"<option" . (($row["pos_state"] == "sticky") ? " selected=\"selected\"" : "" ) . " value=\"1\">".$lang_edit['select_sticky']."</option>" .
|
||||||
|
"</select> ";
|
||||||
|
}
|
||||||
|
if(get_user_class()>=$torrentmanage_class && $CURUSER["picker"] == 'yes')
|
||||||
|
{
|
||||||
|
$pickcontent .= "<b>".$lang_edit['row_recommended_movie'].": </b>"."<select name=\"sel_recmovie\" style=\"width: 100px;\">" .
|
||||||
|
"<option" . (($row["picktype"] == "normal") ? " selected=\"selected\"" : "" ) . " value=\"0\">".$lang_edit['select_normal']."</option>" .
|
||||||
|
"<option" . (($row["picktype"] == "hot") ? " selected=\"selected\"" : "" ) . " value=\"1\">".$lang_edit['select_hot']."</option>" .
|
||||||
|
"<option" . (($row["picktype"] == "classic") ? " selected=\"selected\"" : "" ) . " value=\"2\">".$lang_edit['select_classic']."</option>" .
|
||||||
|
"<option" . (($row["picktype"] == "recommended") ? " selected=\"selected\"" : "" ) . " value=\"3\">".$lang_edit['select_recommended']."</option>" .
|
||||||
|
"</select>";
|
||||||
|
}
|
||||||
|
tr($lang_edit['row_pick'], $pickcontent, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
print("<tr><td class=\"toolbox\" colspan=\"2\" align=\"center\"><input id=\"qr\" type=\"submit\" value=\"".$lang_edit['submit_edit_it']."\" /> <input type=\"reset\" value=\"".$lang_edit['submit_revert_changes']."\" /></td></tr>\n");
|
||||||
|
print("</table>\n");
|
||||||
|
print("</form>\n");
|
||||||
|
print("<br /><br />");
|
||||||
|
print("<form method=\"post\" action=\"delete.php\">\n");
|
||||||
|
print("<input type=\"hidden\" name=\"id\" value=\"$id\" />\n");
|
||||||
|
if (isset($_GET["returnto"]))
|
||||||
|
print("<input type=\"hidden\" name=\"returnto\" value=\"" . htmlspecialchars($_GET["returnto"]) . "\" />\n");
|
||||||
|
print("<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\">\n");
|
||||||
|
print("<tr><td class=\"colhead\" align=\"left\" style='padding-bottom: 3px' colspan=\"2\">".$lang_edit['text_delete_torrent']."</td></tr>");
|
||||||
|
tr("<input name=\"reasontype\" type=\"radio\" value=\"1\" /> ".$lang_edit['radio_dead'], $lang_edit['text_dead_note'], 1);
|
||||||
|
tr("<input name=\"reasontype\" type=\"radio\" value=\"2\" /> ".$lang_edit['radio_dupe'], "<input type=\"text\" style=\"width: 200px\" name=\"reason[]\" />", 1);
|
||||||
|
tr("<input name=\"reasontype\" type=\"radio\" value=\"3\" /> ".$lang_edit['radio_nuked'], "<input type=\"text\" style=\"width: 200px\" name=\"reason[]\" />", 1);
|
||||||
|
tr("<input name=\"reasontype\" type=\"radio\" value=\"4\" /> ".$lang_edit['radio_rules'], "<input type=\"text\" style=\"width: 200px\" name=\"reason[]\" />".$lang_edit['text_req'], 1);
|
||||||
|
tr("<input name=\"reasontype\" type=\"radio\" value=\"5\" checked=\"checked\" /> ".$lang_edit['radio_other'], "<input type=\"text\" style=\"width: 200px\" name=\"reason[]\" />".$lang_edit['text_req'], 1);
|
||||||
|
print("<tr><td class=\"toolbox\" colspan=\"2\" align=\"center\"><input type=\"submit\" style='height: 25px' value=\"".$lang_edit['submit_delete_it']."\" /></td></tr>\n");
|
||||||
|
print("</table>");
|
||||||
|
print("</form>\n");
|
||||||
|
}
|
||||||
|
stdfoot();
|
||||||
67
email-gateway.php
Normal file
67
email-gateway.php
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
<?php
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
$id = 0 + $_GET["id"];
|
||||||
|
int_check($id,true);
|
||||||
|
|
||||||
|
$res = sql_query("SELECT username, class, email FROM users WHERE id=".mysql_real_escape_string($id));
|
||||||
|
$arr = mysql_fetch_assoc($res) or stderr("Error", "No such user.");
|
||||||
|
$username = $arr["username"];
|
||||||
|
if ($arr["class"] < UC_MODERATOR)
|
||||||
|
stderr("Error", "The gateway can only be used to e-mail staff members.");
|
||||||
|
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] == "POST")
|
||||||
|
{
|
||||||
|
$to = $arr["email"];
|
||||||
|
$from = substr(htmlspecialchars(trim($_POST["from"])), 0, 80);
|
||||||
|
if ($from == "") $from = "Anonymous";
|
||||||
|
|
||||||
|
$from_email = substr(htmlspecialchars(trim($_POST["from_email"])), 0, 80);
|
||||||
|
if ($from_email == "") $from_email = "".$SITEEMAIL."";
|
||||||
|
$from_email = safe_email($from_email);
|
||||||
|
if (!$from_email)
|
||||||
|
stderr("Error","You must enter an email address!");
|
||||||
|
if (!check_email($from_email))
|
||||||
|
stderr("Error","Invalid email address!");
|
||||||
|
$from = "$from <$from_email>";
|
||||||
|
|
||||||
|
$subject = substr(htmlspecialchars(trim($_POST["subject"])), 0, 80);
|
||||||
|
if ($subject == "") $subject = "(No subject)";
|
||||||
|
$subject = "Fw: $subject";
|
||||||
|
|
||||||
|
$message = htmlspecialchars(trim($_POST["message"]));
|
||||||
|
if ($message == "") stderr("Error", "No message text!");
|
||||||
|
|
||||||
|
$message = "Message submitted from ".getip()." at " . date("Y-m-d H:i:s") . ".\n" .
|
||||||
|
"Note: By replying to this e-mail you will reveal your e-mail address.\n" .
|
||||||
|
"---------------------------------------------------------------------\n\n" .
|
||||||
|
$message . "\n\n" .
|
||||||
|
"---------------------------------------------------------------------\n$SITENAME E-Mail Gateway\n";
|
||||||
|
|
||||||
|
$success = sent_mail($to,$from,$from_email,$subject,$message,"E-Mail Gateway",false);
|
||||||
|
|
||||||
|
if ($success)
|
||||||
|
stderr("Success", "E-mail successfully queued for delivery.");
|
||||||
|
else
|
||||||
|
stderr("Error", "The mail could not be sent. Please try again later.");
|
||||||
|
}
|
||||||
|
|
||||||
|
stdhead("E-mail gateway");
|
||||||
|
?>
|
||||||
|
<p><table border=0 class=main cellspacing=0 cellpadding=0><tr>
|
||||||
|
<td class=embedded style='padding-left: 10px'><font size=3><b>Send e-mail to <?php echo $username;?></b></font></td>
|
||||||
|
</tr></table></p>
|
||||||
|
<table border=1 cellspacing=0 cellpadding=5>
|
||||||
|
<form method=post action=email-gateway.php?id=<?php echo $id?>>
|
||||||
|
<tr><td class=rowhead>Your name</td><td><input type=text name=from size=80></td></tr>
|
||||||
|
<tr><td class=rowhead>Your e-mail</td><td><input type=text name=from_email size=80></td></tr>
|
||||||
|
<tr><td class=rowhead>Subject</td><td><input type=text name=subject size=80></td></tr>
|
||||||
|
<tr><td class=rowhead>Message</td><td><textarea name=message cols=80 rows=20></textarea></td></tr>
|
||||||
|
<tr><td colspan=2 align=center><input type=submit value="Send" class=btn></td></tr>
|
||||||
|
</form>
|
||||||
|
</table>
|
||||||
|
<p>
|
||||||
|
<font class=small><b>Note:</b> Your IP-address will be logged and visible to the recipient to prevent abuse.<br />
|
||||||
|
Make sure to supply a valid e-mail address if you expect a reply.</font>
|
||||||
|
</p>
|
||||||
|
<?php stdfoot();
|
||||||
180
fadomatic.js
Normal file
180
fadomatic.js
Normal file
@@ -0,0 +1,180 @@
|
|||||||
|
/** $Id$ */
|
||||||
|
// Title: Fadomatic
|
||||||
|
// Version: 1.2
|
||||||
|
// Homepage: http://chimpen.com/fadomatic
|
||||||
|
// Author: Philip McCarthy <fadomatic@chimpen.com>
|
||||||
|
|
||||||
|
// Fade interval in milliseconds
|
||||||
|
// Make this larger if you experience performance issues
|
||||||
|
Fadomatic.INTERVAL_MILLIS = 50;
|
||||||
|
|
||||||
|
// Creates a fader
|
||||||
|
// element - The element to fade
|
||||||
|
// speed - The speed to fade at, from 0.0 to 100.0
|
||||||
|
// initialOpacity (optional, default 100) - element's starting opacity, 0 to 100
|
||||||
|
// minOpacity (optional, default 0) - element's minimum opacity, 0 to 100
|
||||||
|
// maxOpacity (optional, default 0) - element's minimum opacity, 0 to 100
|
||||||
|
function Fadomatic (element, rate, initialOpacity, minOpacity, maxOpacity) {
|
||||||
|
this._element = element;
|
||||||
|
this._intervalId = null;
|
||||||
|
this._rate = rate;
|
||||||
|
this._isFadeOut = true;
|
||||||
|
|
||||||
|
// Set initial opacity and bounds
|
||||||
|
// NB use 99 instead of 100 to avoid flicker at start of fade
|
||||||
|
this._minOpacity = 0;
|
||||||
|
this._maxOpacity = 99;
|
||||||
|
this._opacity = 99;
|
||||||
|
|
||||||
|
if (typeof minOpacity != 'undefined') {
|
||||||
|
if (minOpacity < 0) {
|
||||||
|
this._minOpacity = 0;
|
||||||
|
} else if (minOpacity > 99) {
|
||||||
|
this._minOpacity = 99;
|
||||||
|
} else {
|
||||||
|
this._minOpacity = minOpacity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof maxOpacity != 'undefined') {
|
||||||
|
if (maxOpacity < 0) {
|
||||||
|
this._maxOpacity = 0;
|
||||||
|
} else if (maxOpacity > 99) {
|
||||||
|
this._maxOpacity = 99;
|
||||||
|
} else {
|
||||||
|
this._maxOpacity = maxOpacity;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._maxOpacity < this._minOpacity) {
|
||||||
|
this._maxOpacity = this._minOpacity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof initialOpacity != 'undefined') {
|
||||||
|
if (initialOpacity > this._maxOpacity) {
|
||||||
|
this._opacity = this._maxOpacity;
|
||||||
|
} else if (initialOpacity < this._minOpacity) {
|
||||||
|
this._opacity = this._minOpacity;
|
||||||
|
} else {
|
||||||
|
this._opacity = initialOpacity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// See if we're using W3C opacity, MSIE filter, or just
|
||||||
|
// toggling visiblity
|
||||||
|
if(typeof element.style.opacity != 'undefined') {
|
||||||
|
|
||||||
|
this._updateOpacity = this._updateOpacityW3c;
|
||||||
|
|
||||||
|
} else if(typeof element.style.filter != 'undefined') {
|
||||||
|
|
||||||
|
// If there's not an alpha filter on the element already,
|
||||||
|
// add one
|
||||||
|
if (element.style.filter.indexOf("alpha") == -1) {
|
||||||
|
|
||||||
|
// Attempt to preserve existing filters
|
||||||
|
var existingFilters="";
|
||||||
|
if (element.style.filter) {
|
||||||
|
existingFilters = element.style.filter+" ";
|
||||||
|
}
|
||||||
|
element.style.filter = existingFilters+"alpha(opacity="+this._opacity+")";
|
||||||
|
}
|
||||||
|
|
||||||
|
this._updateOpacity = this._updateOpacityMSIE;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
this._updateOpacity = this._updateVisibility;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._updateOpacity();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initiates a fade out
|
||||||
|
Fadomatic.prototype.fadeOut = function () {
|
||||||
|
this._isFadeOut = true;
|
||||||
|
this._beginFade();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initiates a fade in
|
||||||
|
Fadomatic.prototype.fadeIn = function () {
|
||||||
|
this._isFadeOut = false;
|
||||||
|
this._beginFade();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Makes the element completely opaque, stops any fade in progress
|
||||||
|
Fadomatic.prototype.show = function () {
|
||||||
|
this.haltFade();
|
||||||
|
this._opacity = this._maxOpacity;
|
||||||
|
this._updateOpacity();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Makes the element completely transparent, stops any fade in progress
|
||||||
|
Fadomatic.prototype.hide = function () {
|
||||||
|
this.haltFade();
|
||||||
|
this._opacity = 0;
|
||||||
|
this._updateOpacity();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Halts any fade in progress
|
||||||
|
Fadomatic.prototype.haltFade = function () {
|
||||||
|
|
||||||
|
clearInterval(this._intervalId);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Resumes a fade where it was halted
|
||||||
|
Fadomatic.prototype.resumeFade = function () {
|
||||||
|
|
||||||
|
this._beginFade();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pseudo-private members
|
||||||
|
|
||||||
|
Fadomatic.prototype._beginFade = function () {
|
||||||
|
|
||||||
|
this.haltFade();
|
||||||
|
var objref = this;
|
||||||
|
this._intervalId = setInterval(function() { objref._tickFade(); },Fadomatic.INTERVAL_MILLIS);
|
||||||
|
}
|
||||||
|
|
||||||
|
Fadomatic.prototype._tickFade = function () {
|
||||||
|
|
||||||
|
if (this._isFadeOut) {
|
||||||
|
this._opacity -= this._rate;
|
||||||
|
if (this._opacity < this._minOpacity) {
|
||||||
|
this._opacity = this._minOpacity;
|
||||||
|
this.haltFade();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this._opacity += this._rate;
|
||||||
|
if (this._opacity > this._maxOpacity ) {
|
||||||
|
this._opacity = this._maxOpacity;
|
||||||
|
this.haltFade();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this._updateOpacity();
|
||||||
|
}
|
||||||
|
|
||||||
|
Fadomatic.prototype._updateVisibility = function () {
|
||||||
|
|
||||||
|
if (this._opacity > 0) {
|
||||||
|
this._element.style.visibility = 'visible';
|
||||||
|
} else {
|
||||||
|
this._element.style.visibility = 'hidden';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Fadomatic.prototype._updateOpacityW3c = function () {
|
||||||
|
|
||||||
|
this._element.style.opacity = this._opacity/100;
|
||||||
|
this._updateVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
|
Fadomatic.prototype._updateOpacityMSIE = function () {
|
||||||
|
|
||||||
|
this._element.filters.alpha.opacity = this._opacity;
|
||||||
|
this._updateVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
|
Fadomatic.prototype._updateOpacity = null;
|
||||||
106
faq.php
Normal file
106
faq.php
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
<?php
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
require_once(get_langfile_path());
|
||||||
|
loggedinorreturn();
|
||||||
|
|
||||||
|
stdhead($lang_faq['head_faq']);
|
||||||
|
$Cache->new_page('faq', 900, true);
|
||||||
|
if (!$Cache->get_page())
|
||||||
|
{
|
||||||
|
$Cache->add_whole_row();
|
||||||
|
//make_folder("cache/" , get_langfolder_cookie());
|
||||||
|
//cache_check ('faq');
|
||||||
|
begin_main_frame();
|
||||||
|
|
||||||
|
begin_frame($lang_faq['text_welcome_to'].$SITENAME." - ".$SLOGAN);
|
||||||
|
print($lang_faq['text_welcome_content_one'].$lang_faq['text_welcome_content_two']);
|
||||||
|
end_frame();
|
||||||
|
|
||||||
|
$lang_id = get_guest_lang_id();
|
||||||
|
$is_rulelang = get_single_value("language","rule_lang","WHERE id = ".sqlesc($lang_id));
|
||||||
|
if (!$is_rulelang){
|
||||||
|
$lang_id = 6; //English
|
||||||
|
}
|
||||||
|
$res = sql_query("SELECT `id`, `link_id`, `question`, `flag` FROM `faq` WHERE `type`='categ' AND `lang_id` = ".sqlesc($lang_id)." ORDER BY `order` ASC");
|
||||||
|
while ($arr = mysql_fetch_array($res)) {
|
||||||
|
$faq_categ[$arr[link_id]][title] = $arr[question];
|
||||||
|
$faq_categ[$arr[link_id]][flag] = $arr[flag];
|
||||||
|
$faq_categ[$arr[link_id]][link_id] = $arr[link_id];
|
||||||
|
}
|
||||||
|
|
||||||
|
$res = sql_query("SELECT `id`, `link_id`, `question`, `answer`, `flag`, `categ` FROM `faq` WHERE `type`='item' AND `lang_id` = ".sqlesc($lang_id)." ORDER BY `order` ASC");
|
||||||
|
while ($arr = mysql_fetch_array($res, MYSQL_BOTH)) {
|
||||||
|
$faq_categ[$arr[categ]][items][$arr[id]][question] = $arr[question];
|
||||||
|
$faq_categ[$arr[categ]][items][$arr[id]][answer] = $arr[answer];
|
||||||
|
$faq_categ[$arr[categ]][items][$arr[id]][flag] = $arr[flag];
|
||||||
|
$faq_categ[$arr[categ]][items][$arr[id]][link_id] = $arr[link_id];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($faq_categ)) {
|
||||||
|
// gather orphaned items
|
||||||
|
/*
|
||||||
|
foreach ($faq_categ as $id => $temp)
|
||||||
|
{
|
||||||
|
if (!array_key_exists("title", $faq_categ[$id]))
|
||||||
|
{
|
||||||
|
foreach ($faq_categ[$id][items] as $id2 => $temp)
|
||||||
|
{
|
||||||
|
$faq_orphaned[$id2][question] = $faq_categ[$id][items][$id2][question];
|
||||||
|
$faq_orphaned[$id2][answer] = $faq_categ[$id][items][$id2][answer];
|
||||||
|
$faq_orphaned[$id2][flag] = $faq_categ[$id][items][$id2][flag];
|
||||||
|
unset($faq_categ[$id]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
begin_frame("<span id=\"top\">".$lang_faq['text_contents'] . "</span>");
|
||||||
|
foreach ($faq_categ as $id => $temp)
|
||||||
|
{
|
||||||
|
if ($faq_categ[$id][flag] == "1")
|
||||||
|
{
|
||||||
|
print("<ul><li><a href=\"#id". $faq_categ[$id][link_id] ."\"><b>". $faq_categ[$id][title] ."</b></a><ul>\n");
|
||||||
|
if (array_key_exists("items", $faq_categ[$id]))
|
||||||
|
{
|
||||||
|
foreach ($faq_categ[$id][items] as $id2 => $temp)
|
||||||
|
{
|
||||||
|
if ($faq_categ[$id][items][$id2][flag] == "1") print("<li><a href=\"#id". $faq_categ[$id][items][$id2][link_id] ."\" class=\"faqlink\">". $faq_categ[$id][items][$id2][question] ."</a></li>\n");
|
||||||
|
elseif ($faq_categ[$id][items][$id2][flag] == "2") print("<li><a href=\"#id". $faq_categ[$id][items][$id2][link_id] ."\" class=\"faqlink\">". $faq_categ[$id][items][$id2][question] ."</a> <img class=\"faq_updated\" src=\"pic/trans.gif\" alt=\"Updated\" /></li>\n");
|
||||||
|
elseif ($faq_categ[$id][items][$id2][flag] == "3") print("<li><a href=\"#id". $faq_categ[$id][items][$id2][link_id] ."\" class=\"faqlink\">". $faq_categ[$id][items][$id2][question] ."</a> <img class=\"faq_new\" src=\"pic/trans.gif\" alt=\"New\" /></li>\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print("</ul></li></ul><br />");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end_frame();
|
||||||
|
|
||||||
|
foreach ($faq_categ as $id => $temp) {
|
||||||
|
if ($faq_categ[$id][flag] == "1")
|
||||||
|
{
|
||||||
|
$frame = $faq_categ[$id][title] ." - <a href=\"#top\"><img class=\"top\" src=\"pic/trans.gif\" alt=\"Top\" title=\"Top\" /></a>";
|
||||||
|
begin_frame($frame);
|
||||||
|
print("<span id=\"id". $faq_categ[$id][link_id] ."\"></span>");
|
||||||
|
if (array_key_exists("items", $faq_categ[$id]))
|
||||||
|
{
|
||||||
|
foreach ($faq_categ[$id][items] as $id2 => $temp)
|
||||||
|
{
|
||||||
|
if ($faq_categ[$id][items][$id2][flag] != "0")
|
||||||
|
{
|
||||||
|
print("<br /><span id=\"id".$faq_categ[$id][items][$id2][link_id]."\"><b>". $faq_categ[$id][items][$id2][question] ."</b></span><br />\n");
|
||||||
|
print("<br />". $faq_categ[$id][items][$id2][answer] ."\n<br /><br />\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end_frame();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end_main_frame();
|
||||||
|
$Cache->end_whole_row();
|
||||||
|
$Cache->cache_page();
|
||||||
|
}
|
||||||
|
echo $Cache->next_row();
|
||||||
|
//cache_save ('faq');
|
||||||
|
stdfoot();
|
||||||
|
?>
|
||||||
197
faqactions.php
Normal file
197
faqactions.php
Normal file
@@ -0,0 +1,197 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
+--------------------------------------------------------------------------
|
||||||
|
| MySQL driven FAQ version 1.1 Beta
|
||||||
|
| ========================================
|
||||||
|
| by avataru
|
||||||
|
| (c) 2002 - 2005 avataru
|
||||||
|
| http://www.avataru.net
|
||||||
|
| ========================================
|
||||||
|
| Web: http://www.avataru.net
|
||||||
|
| Release: 1/9/2005 1:03 AM
|
||||||
|
| Email: avataru@avataru.net
|
||||||
|
| Tracker: http://www.sharereactor.ro
|
||||||
|
+---------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| > FAQ Management actions
|
||||||
|
| > Written by avataru
|
||||||
|
| > Date started: 1/7/2005
|
||||||
|
|
|
||||||
|
+--------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
loggedinorreturn();
|
||||||
|
|
||||||
|
if (get_user_class() < UC_ADMINISTRATOR) {
|
||||||
|
stderr("Error","Only Administrators and above can modify the FAQ, sorry.");
|
||||||
|
}
|
||||||
|
|
||||||
|
//stdhead("FAQ Management");
|
||||||
|
|
||||||
|
// ACTION: reorder - reorder sections and items
|
||||||
|
if ($_GET[action] == "reorder") {
|
||||||
|
foreach($_POST[order] as $id => $position) sql_query("UPDATE `faq` SET `order`=".sqlesc($position)." WHERE id=".sqlesc($id)) or sqlerr();
|
||||||
|
header("Location: " . get_protocol_prefix() . "$BASEURL/faqmanage.php");
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ACTION: edit - edit a section or item
|
||||||
|
elseif ($_GET[action] == "edit" && isset($_GET[id])) {
|
||||||
|
stdhead("FAQ Management");
|
||||||
|
begin_main_frame();
|
||||||
|
print("<h1 align=\"center\">Edit Section or Item</h1>");
|
||||||
|
|
||||||
|
$res = sql_query("SELECT * FROM faq WHERE id=".sqlesc($_GET[id])." LIMIT 1");
|
||||||
|
while ($arr = mysql_fetch_array($res, MYSQL_BOTH)) {
|
||||||
|
$arr[question] = htmlspecialchars($arr[question]);
|
||||||
|
$arr[answer] = htmlspecialchars($arr[answer]);
|
||||||
|
if ($arr[type] == "item") {
|
||||||
|
$lang_id = $arr['lang_id'];
|
||||||
|
print("<form method=\"post\" action=\"faqactions.php?action=edititem\">");
|
||||||
|
print("<table border=\"1\" cellspacing=\"0\" cellpadding=\"10\" align=\"center\">\n");
|
||||||
|
print("<tr><td>ID:</td><td>$arr[id] <input type=\"hidden\" name=\"id\" value=\"$arr[id]\" /></td></tr>\n");
|
||||||
|
print("<tr><td>Question:</td><td><input style=\"width: 600px;\" type=\"text\" name=\"question\" value=\"$arr[question]\" /></td></tr>\n");
|
||||||
|
print("<tr><td style=\"vertical-align: top;\">Answer:</td><td><textarea rows=20 style=\"width: 600px; height=600px;\" name=\"answer\">$arr[answer]</textarea></td></tr>\n");
|
||||||
|
if ($arr[flag] == "0") print("<tr><td>Status:</td><td><select name=\"flag\" style=\"width: 110px;\"><option value=\"0\" style=\"color: #FF0000;\" selected=\"selected\">Hidden</option><option value=\"1\" style=\"color: #000000;\">Normal</option><option value=\"2\" style=\"color: #0000FF;\">Updated</option><option value=\"3\" style=\"color: #008000;\">New</option></select></td></tr>");
|
||||||
|
elseif ($arr[flag] == "2") print("<tr><td>Status:</td><td><select name=\"flag\" style=\"width: 110px;\"><option value=\"0\" style=\"color: #FF0000;\">Hidden</option><option value=\"1\" style=\"color: #000000;\">Normal</option><option value=\"2\" style=\"color: #0000FF;\" selected=\"selected\">Updated</option><option value=\"3\" style=\"color: #008000;\">New</option></select></td></tr>");
|
||||||
|
elseif ($arr[flag] == "3") print("<tr><td>Status:</td><td><select name=\"flag\" style=\"width: 110px;\"><option value=\"0\" style=\"color: #FF0000;\">Hidden</option><option value=\"1\" style=\"color: #000000;\">Normal</option><option value=\"2\" style=\"color: #0000FF;\">Updated</option><option value=\"3\" style=\"color: #008000;\" selected=\"selected\">New</option></select></td></tr>");
|
||||||
|
else print("<tr><td>Status:</td><td><select name=\"flag\" style=\"width: 110px;\"><option value=\"0\" style=\"color: #FF0000;\">Hidden</option><option value=\"1\" style=\"color: #000000;\" selected=\"selected\">Normal</option><option value=\"2\" style=\"color: #0000FF;\">Updated</option><option value=\"3\" style=\"color: #008000;\">New</option></select></td></tr>");
|
||||||
|
print("<tr><td>Category:</td><td><select style=\"width: 400px;\" name=\"categ\" />");
|
||||||
|
$res2 = sql_query("SELECT `id`, `question`, `link_id` FROM `faq` WHERE `type`='categ' AND `lang_id` = ".sqlesc($lang_id)." ORDER BY `order` ASC");
|
||||||
|
while ($arr2 = mysql_fetch_array($res2, MYSQL_BOTH)) {
|
||||||
|
$selected = ($arr2[link_id] == $arr[categ]) ? " selected=\"selected\"" : "";
|
||||||
|
print("<option value=\"$arr2[link_id]\"". $selected .">$arr2[question]</option>");
|
||||||
|
}
|
||||||
|
print("</td></tr>\n");
|
||||||
|
print("<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" name=\"edit\" value=\"Edit\" style=\"width: 60px;\"></td></tr>\n");
|
||||||
|
print("</table>");
|
||||||
|
}
|
||||||
|
elseif ($arr[type] == "categ") {
|
||||||
|
$lang_res = sql_query("SELECT lang_name FROM language WHERE id=".sqlesc($arr[lang_id])." LIMIT 1");
|
||||||
|
if ($lang_arr = mysql_fetch_array($lang_res))
|
||||||
|
$lang_name = $lang_arr['lang_name'];
|
||||||
|
print("<form method=\"post\" action=\"faqactions.php?action=editsect\">");
|
||||||
|
print("<table border=\"1\" cellspacing=\"0\" cellpadding=\"10\" align=\"center\">\n");
|
||||||
|
print("<tr><td>ID:</td><td>$arr[id] <input type=\"hidden\" name=\"id\" value=\"$arr[id]\" /></td></tr>\n");
|
||||||
|
print("<tr><td>Language:</td><td>$lang_name</td></tr>\n");
|
||||||
|
print("<tr><td>Title:</td><td><input style=\"width: 300px;\" type=\"text\" name=\"title\" value=\"$arr[question]\" /></td></tr>\n");
|
||||||
|
if ($arr[flag] == "0") print("<tr><td>Status:</td><td><select name=\"flag\" style=\"width: 110px;\"><option value=\"0\" style=\"color: #FF0000;\" selected=\"selected\">Hidden</option><option value=\"1\" style=\"color: #000000;\">Normal</option></select></td></tr>");
|
||||||
|
else print("<tr><td>Status:</td><td><select name=\"flag\" style=\"width: 110px;\"><option value=\"0\" style=\"color: #FF0000;\">Hidden</option><option value=\"1\" style=\"color: #000000;\" selected=\"selected\">Normal</option></select></td></tr>");
|
||||||
|
print("<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" name=\"edit\" value=\"Edit\" style=\"width: 60px;\"></td></tr>\n");
|
||||||
|
print("</table>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
end_main_frame();
|
||||||
|
stdfoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
// subACTION: edititem - edit an item
|
||||||
|
elseif ($_GET[action] == "edititem" && $_POST[id] != NULL && $_POST[question] != NULL && $_POST[answer] != NULL && $_POST[flag] != NULL && $_POST[categ] != NULL) {
|
||||||
|
$question = $_POST[question];
|
||||||
|
$answer = $_POST[answer];
|
||||||
|
sql_query("UPDATE `faq` SET `question`=".sqlesc($question).", `answer`=".sqlesc($answer).", `flag`=".sqlesc($_POST[flag]).", `categ`=".sqlesc($_POST[categ])." WHERE id=".sqlesc($_POST[id])) or sqlerr();
|
||||||
|
header("Location: " . get_protocol_prefix() . "$BASEURL/faqmanage.php");
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
// subACTION: editsect - edit a section
|
||||||
|
elseif ($_GET[action] == "editsect" && $_POST[id] != NULL && $_POST[title] != NULL && $_POST[flag] != NULL) {
|
||||||
|
$title = $_POST[title];
|
||||||
|
sql_query("UPDATE `faq` SET `question`=".sqlesc($title).", `answer`='', `flag`=".sqlesc($_POST[flag]).", `categ`='0' WHERE id=".sqlesc($_POST[id])) or sqlerr();
|
||||||
|
header("Location: " . get_protocol_prefix() . "$BASEURL/faqmanage.php");
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ACTION: delete - delete a section or item
|
||||||
|
elseif ($_GET[action] == "delete" && isset($_GET[id])) {
|
||||||
|
if ($_GET[confirm] == "yes") {
|
||||||
|
sql_query("DELETE FROM `faq` WHERE `id`=".sqlesc(0+$_GET[id])." LIMIT 1") or sqlerr();
|
||||||
|
header("Location: " . get_protocol_prefix() . "$BASEURL/faqmanage.php");
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
stdhead("FAQ Management");
|
||||||
|
begin_main_frame();
|
||||||
|
print("<h1 align=\"center\">Confirmation required</h1>");
|
||||||
|
print("<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\" align=\"center\" width=\"95%\">\n<tr><td align=\"center\">Please click <a href=\"faqactions.php?action=delete&id=$_GET[id]&confirm=yes\">here</a> to confirm.</td></tr>\n</table>\n");
|
||||||
|
end_main_frame();
|
||||||
|
stdfoot();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ACTION: additem - add a new item
|
||||||
|
elseif ($_GET[action] == "additem" && $_GET[inid] && $_GET[langid]) {
|
||||||
|
stdhead("FAQ Management");
|
||||||
|
begin_main_frame();
|
||||||
|
print("<h1 align=\"center\">Add Item</h1>");
|
||||||
|
print("<form method=\"post\" action=\"faqactions.php?action=addnewitem\">");
|
||||||
|
print("<table border=\"1\" cellspacing=\"0\" cellpadding=\"10\" align=\"center\">\n");
|
||||||
|
print("<tr><td>Question:</td><td><input style=\"width: 600px;\" type=\"text\" name=\"question\" value=\"\" /></td></tr>\n");
|
||||||
|
print("<tr><td style=\"vertical-align: top;\">Answer:</td><td><textarea rows=20 style=\"width: 600px; height=600px;\" name=\"answer\"></textarea></td></tr>\n");
|
||||||
|
print("<tr><td>Status:</td><td><select name=\"flag\" style=\"width: 110px;\"><option value=\"0\" style=\"color: #FF0000;\">Hidden</option><option value=\"1\" style=\"color: #000000;\">Normal</option><option value=\"2\" style=\"color: #0000FF;\">Updated</option><option value=\"3\" style=\"color: #008000;\" selected=\"selected\">New</option></select></td></tr>");
|
||||||
|
print("<input type=hidden name=categ value=\"".(0+$_GET[inid])."\">");
|
||||||
|
print("<input type=hidden name=langid value=\"".(0+$_GET[langid])."\">");
|
||||||
|
print("<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"Add\" style=\"width: 60px;\"></td></tr>\n");
|
||||||
|
print("</table></form>");
|
||||||
|
end_main_frame();
|
||||||
|
stdfoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ACTION: addsection - add a new section
|
||||||
|
elseif ($_GET[action] == "addsection") {
|
||||||
|
stdhead("FAQ Management");
|
||||||
|
begin_main_frame();
|
||||||
|
print("<h1 align=\"center\">Add Section</h1>");
|
||||||
|
print("<form method=\"post\" action=\"faqactions.php?action=addnewsect\">");
|
||||||
|
print("<table border=\"1\" cellspacing=\"0\" cellpadding=\"10\" align=\"center\">\n");
|
||||||
|
print("<tr><td>Title:</td><td><input style=\"width: 300px;\" type=\"text\" name=\"title\" value=\"\" /></td></tr>\n");
|
||||||
|
$s = "<select name=language>";
|
||||||
|
$langs = langlist("rule_lang");
|
||||||
|
foreach ($langs as $row)
|
||||||
|
{
|
||||||
|
if($row["site_lang_folder"] == $deflang) $se = " selected"; else $se = "";
|
||||||
|
$s .= "<option value=". $row["id"] . $se. ">" . htmlspecialchars($row["lang_name"]) . "</option>\n";
|
||||||
|
}
|
||||||
|
$s .= "</select>";
|
||||||
|
print("<tr><td>Language:</td><td>".$s."</td></tr>");
|
||||||
|
print("<tr><td>Status:</td><td><select name=\"flag\" style=\"width: 110px;\"><option value=\"0\" style=\"color: #FF0000;\">Hidden</option><option value=\"1\" style=\"color: #000000;\" selected=\"selected\">Normal</option></select></td></tr>");
|
||||||
|
print("<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" name=\"edit\" value=\"Add\" style=\"width: 60px;\"></td></tr>\n");
|
||||||
|
print("</table>");
|
||||||
|
end_main_frame();
|
||||||
|
stdfoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
// subACTION: addnewitem - add a new item to the db
|
||||||
|
elseif ($_GET[action] == "addnewitem" && $_POST[question] != NULL && $_POST[answer] != NULL) {
|
||||||
|
$question = $_POST[question];
|
||||||
|
$answer = $_POST[answer];
|
||||||
|
$categ = 0+$_POST[categ];
|
||||||
|
$langid = 0+$_POST[langid];
|
||||||
|
$res = sql_query("SELECT MAX(`order`) AS maxorder, MAX(`link_id`) AS maxlinkid FROM `faq` WHERE `type`='item' AND `categ`=".sqlesc($categ)." AND lang_id=".sqlesc($langid));
|
||||||
|
while ($arr = mysql_fetch_array($res, MYSQL_BOTH))
|
||||||
|
{
|
||||||
|
$order = $arr['maxorder'] + 1;
|
||||||
|
$link_id = $arr['maxlinkid']+1;
|
||||||
|
}
|
||||||
|
sql_query("INSERT INTO `faq` (`link_id`, `type`, `lang_id`, `question`, `answer`, `flag`, `categ`, `order`) VALUES ('$link_id', 'item', ".sqlesc($langid).", ".sqlesc($question).", ".sqlesc($answer).", " . sqlesc(0+$_POST[flag]) . ", ".sqlesc($categ).", ".sqlesc($order).")") or sqlerr();
|
||||||
|
header("Location: " . get_protocol_prefix() . "$BASEURL/faqmanage.php");
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
// subACTION: addnewsect - add a new section to the db
|
||||||
|
elseif ($_GET[action] == "addnewsect" && $_POST[title] != NULL && $_POST[flag] != NULL) {
|
||||||
|
$title = $_POST[title];
|
||||||
|
$language = 0+$_POST['language'];
|
||||||
|
$res = sql_query("SELECT MAX(`order`) AS maxorder, MAX(`link_id`) AS maxlinkid FROM `faq` WHERE `type`='categ' AND `lang_id` = ".sqlesc($language));
|
||||||
|
while ($arr = mysql_fetch_array($res, MYSQL_BOTH)) {$order = $arr['maxorder'] + 1;$link_id = $arr['maxlinkid']+1;}
|
||||||
|
sql_query("INSERT INTO `faq` (`link_id`,`type`,`lang_id`, `question`, `answer`, `flag`, `categ`, `order`) VALUES (".sqlesc($link_id).",'categ', ".sqlesc($language).", ".sqlesc($title).", '', ".sqlesc($_POST[flag]).", '0', ".sqlesc($order).")") or sqlerr();
|
||||||
|
header("Location: " . get_protocol_prefix() . "$BASEURL/faqmanage.php");
|
||||||
|
die;
|
||||||
|
} else {
|
||||||
|
header("Location: " . get_protocol_prefix() . "$BASEURL/faqmanage.php");
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
?>
|
||||||
118
faqmanage.php
Normal file
118
faqmanage.php
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
<?php
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
loggedinorreturn();
|
||||||
|
|
||||||
|
if (get_user_class() < UC_ADMINISTRATOR) {
|
||||||
|
permissiondenied();
|
||||||
|
}
|
||||||
|
|
||||||
|
stdhead("FAQ Management");
|
||||||
|
begin_main_frame();
|
||||||
|
|
||||||
|
print("<h1 align=\"center\">FAQ Management</h1>");
|
||||||
|
|
||||||
|
// make the array that has all the faq in a nice structured
|
||||||
|
$res = sql_query("SELECT faq.id, faq.link_id, faq.lang_id, lang_name, faq.question, faq.flag, faq.order FROM faq LEFT JOIN language on faq.lang_id = language.id WHERE type='categ' ORDER BY lang_name, `order` ASC");
|
||||||
|
while ($arr = mysql_fetch_array($res, MYSQL_BOTH)) {
|
||||||
|
$faq_categ[$arr[lang_id]][$arr[link_id]][title] = $arr[question];
|
||||||
|
$faq_categ[$arr[lang_id]][$arr[link_id]][flag] = $arr[flag];
|
||||||
|
$faq_categ[$arr[lang_id]][$arr[link_id]][order] = $arr[order];
|
||||||
|
$faq_categ[$arr[lang_id]][$arr[link_id]][id] = $arr[id];
|
||||||
|
$faq_categ[$arr[lang_id]][$arr[link_id]][lang_name] = $arr[lang_name];
|
||||||
|
}
|
||||||
|
|
||||||
|
$res = sql_query("SELECT faq.id, faq.question, faq.lang_id, faq.flag, faq.categ, faq.order FROM faq WHERE type='item' ORDER BY `order` ASC");
|
||||||
|
while ($arr = mysql_fetch_array($res)) {
|
||||||
|
$faq_categ[$arr[lang_id]][$arr[categ]][items][$arr[id]][question] = $arr[question];
|
||||||
|
$faq_categ[$arr[lang_id]][$arr[categ]][items][$arr[id]][flag] = $arr[flag];
|
||||||
|
$faq_categ[$arr[lang_id]][$arr[categ]][items][$arr[id]][order] = $arr[order];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($faq_categ))
|
||||||
|
{
|
||||||
|
// gather orphaned items
|
||||||
|
foreach ($faq_categ as $lang => $temp2){
|
||||||
|
foreach ($temp2 as $id => $temp)
|
||||||
|
{
|
||||||
|
if (!array_key_exists("title", $temp2[$id]))
|
||||||
|
{
|
||||||
|
foreach ($temp2[$id][items] as $id2 => $temp)
|
||||||
|
{
|
||||||
|
$faq_orphaned[$lang][$id2][question] = $temp2[$id][items][$id2][question];
|
||||||
|
$faq_orphaned[$lang][$id2][flag] = $temp2[$id][items][$id2][flag];
|
||||||
|
unset($temp2[$id]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// print the faq table
|
||||||
|
print("<form method=\"post\" action=\"faqactions.php?action=reorder\">");
|
||||||
|
foreach ($faq_categ as $lang => $temp2)
|
||||||
|
{
|
||||||
|
foreach ($temp2 as $id => $temp)
|
||||||
|
{
|
||||||
|
print("<br />\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\" align=\"center\" width=\"95%\">\n");
|
||||||
|
print("<tr><td class=\"colhead\" align=\"center\" colspan=\"2\">Position</td><td class=\"colhead\" align=\"left\">Section/Item Title</td><td class=\"colhead\" align=\"center\">Language</td><td class=\"colhead\" align=\"center\">Status</td><td class=\"colhead\" align=\"center\">Actions</td></tr>\n");
|
||||||
|
|
||||||
|
print("<tr><td align=\"center\" width=\"40px\"><select name=\"order[". $id ."]\">");
|
||||||
|
for ($n=1; $n <= count($temp2); $n++)
|
||||||
|
{
|
||||||
|
$sel = ($n == $temp2[$id][order]) ? " selected=\"selected\"" : "";
|
||||||
|
print("<option value=\"$n\"". $sel .">". $n ."</option>");
|
||||||
|
}
|
||||||
|
$status = ($temp2[$id][flag] == "0") ? "<font color=\"red\">Hidden</font>" : "Normal";
|
||||||
|
print("</select></td><td align=\"center\" width=\"40px\"> </td><td><b>". $temp2[$id][title] ."</b></td><td align=\"center\" width=\"60px\">". $temp2[$id][lang_name] ."</td><td align=\"center\" width=\"60px\">". $status ."</td><td align=\"center\" width=\"60px\"><a href=\"faqactions.php?action=edit&id=". $temp2[$id][id] ."\">Edit</a> <a href=\"faqactions.php?action=delete&id=". $temp2[$id][id] ."\">Delete</a></td></tr>\n");
|
||||||
|
|
||||||
|
if (array_key_exists("items", $temp2[$id]))
|
||||||
|
{
|
||||||
|
foreach ($temp2[$id][items] as $id2 => $temp)
|
||||||
|
{
|
||||||
|
print("<tr><td align=\"center\" width=\"40px\"> </td><td align=\"center\" width=\"40px\"><select name=\"order[". $id2 ."]\">");
|
||||||
|
for ($n=1; $n <= count($temp2[$id][items]); $n++)
|
||||||
|
{
|
||||||
|
$sel = ($n == $temp2[$id][items][$id2][order]) ? " selected=\"selected\"" : "";
|
||||||
|
print("<option value=\"$n\"". $sel .">". $n ."</option>");
|
||||||
|
}
|
||||||
|
if ($temp2[$id][items][$id2][flag] == "0") $status = "<font color=\"#FF0000\">Hidden</font>";
|
||||||
|
elseif ($temp2[$id][items][$id2][flag] == "2") $status = "<font color=\"#0000FF\"><img src=\"pic/updated.png\" alt=\"Updated\" width=\"46\" height=\"11\" align=\"absbottom\"></font>";
|
||||||
|
elseif ($temp2[$id][items][$id2][flag] == "3") $status = "<font color=\"#008000\"><img src=\"pic/new.png\" alt=\"New\" width=\"27\" height=\"11\" align=\"absbottom\"></font>";
|
||||||
|
else $status = "Normal";
|
||||||
|
print("</select></td><td>". $temp2[$id][items][$id2][question] ."</td><td align=\"center\"></td><td align=\"center\" width=\"60px\">". $status ."</td><td align=\"center\" width=\"60px\"><a href=\"faqactions.php?action=edit&id=". $id2 ."\">Edit</a> <a href=\"faqactions.php?action=delete&id=". $id2 ."\">Delete</a></td></tr>\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print("<tr><td colspan=\"6\" align=\"center\"><a href=\"faqactions.php?action=additem&inid=". $id ."&langid=".$lang."\">Add new item</a></td></tr>\n");
|
||||||
|
print("</table>\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// print the orphaned items table
|
||||||
|
if (isset($faq_orphaned)) {
|
||||||
|
print("<br />\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\" align=\"center\" width=\"95%\">\n");
|
||||||
|
print("<tr><td align=\"center\" colspan=\"3\"><b style=\"color: #FF0000\">Orphaned Items</b></td>\n");
|
||||||
|
print("<tr><td class=\"colhead\" align=\"left\">Item Title</td><td class=\"colhead\" align=\"center\">Status</td><td class=\"colhead\" align=\"center\">Actions</td></tr>\n");
|
||||||
|
foreach ($faq_orphaned as $lang => $temp2){
|
||||||
|
foreach ($temp2 as $id => $temp)
|
||||||
|
{
|
||||||
|
if ($temp2[$id][flag] == "0") $status = "<font color=\"#FF0000\">Hidden</font>";
|
||||||
|
elseif ($temp2[$id][flag] == "2") $status = "<font color=\"#0000FF\">Updated</font>";
|
||||||
|
elseif ($temp2[$id][flag] == "3") $status = "<font color=\"#008000\">New</font>";
|
||||||
|
else $status = "Normal";
|
||||||
|
print("<tr><td>". $temp2[$id][question] ."</td><td align=\"center\" width=\"60px\">". $status ."</td><td align=\"center\" width=\"60px\"><a href=\"faqactions.php?action=edit&id=". $id ."\">edit</a> <a href=\"faqactions.php?action=delete&id=". $id ."\">delete</a></td></tr>\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print("</table>\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
print("<br />\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\" align=\"center\" width=\"95%\">\n<tr><td align=\"center\"><a href=\"faqactions.php?action=addsection\">Add new section</a></td></tr>\n</table>\n");
|
||||||
|
print("<p align=\"center\"><input type=\"submit\" name=\"reorder\" value=\"Reorder\"></p>\n");
|
||||||
|
print("</form>\n");
|
||||||
|
print("<p>When the position numbers don't reflect the position in the table, it means the order id is bigger than the total number of sections/items and you should check all the order id's in the table and click \"reorder\"</p>");
|
||||||
|
echo $pagerbottom;
|
||||||
|
|
||||||
|
end_main_frame();
|
||||||
|
stdfoot();
|
||||||
|
?>
|
||||||
50
fastdelete.php
Normal file
50
fastdelete.php
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
require_once("include/bittorrent.php");
|
||||||
|
dbconn();
|
||||||
|
require_once(get_langfile_path());
|
||||||
|
require_once(get_langfile_path("",true));
|
||||||
|
loggedinorreturn();
|
||||||
|
function bark($msg) {
|
||||||
|
global $lang_fastdelete;
|
||||||
|
stdhead();
|
||||||
|
stdmsg($lang_fastdelete['std_delete_failed'], $msg);
|
||||||
|
stdfoot();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!mkglobal("id"))
|
||||||
|
bark($lang_fastdelete['std_missing_form_data']);
|
||||||
|
|
||||||
|
$id = 0 + $id;
|
||||||
|
int_check($id);
|
||||||
|
$sure = $_GET["sure"];
|
||||||
|
|
||||||
|
$res = sql_query("SELECT name,owner,seeders,anonymous FROM torrents WHERE id = $id");
|
||||||
|
$row = mysql_fetch_array($res);
|
||||||
|
if (!$row)
|
||||||
|
die();
|
||||||
|
|
||||||
|
if (get_user_class() < $torrentmanage_class)
|
||||||
|
bark($lang_fastdelete['text_no_permission']);
|
||||||
|
|
||||||
|
if (!$sure)
|
||||||
|
{
|
||||||
|
stderr($lang_fastdelete['std_delete_torrent'], $lang_fastdelete['std_delete_torrent_note']."<a class=altlink href=fastdelete.php?id=$id&sure=1>".$lang_fastdelete['std_here_if_sure'],false);
|
||||||
|
}
|
||||||
|
|
||||||
|
deletetorrent($id);
|
||||||
|
KPS("-",$uploadtorrent_bonus,$row["owner"]);
|
||||||
|
if ($row['anonymous'] == 'yes' && $CURUSER["id"] == $row["owner"]) {
|
||||||
|
write_log("Torrent $id ($row[name]) was deleted by its anonymous uploader",'normal');
|
||||||
|
} else {
|
||||||
|
write_log("Torrent $id ($row[name]) was deleted by $CURUSER[username]",'normal');
|
||||||
|
}
|
||||||
|
//Send pm to torrent uploader
|
||||||
|
if ($CURUSER["id"] != $row["owner"]){
|
||||||
|
$dt = sqlesc(date("Y-m-d H:i:s"));
|
||||||
|
$subject = sqlesc($lang_fastdelete_target[get_user_lang($row["owner"])]['msg_torrent_deleted']);
|
||||||
|
$msg = sqlesc($lang_fastdelete_target[get_user_lang($row["owner"])]['msg_the_torrent_you_uploaded'].$row['name'].$lang_fastdelete_target[get_user_lang($row["owner"])]['msg_was_deleted_by']."[url=userdetails.php?id=".$CURUSER['id']."]".$CURUSER['username']."[/url]".$lang_fastdelete_target[get_user_lang($row["owner"])]['msg_blank']);
|
||||||
|
sql_query("INSERT INTO messages (sender, receiver, subject, added, msg) VALUES(0, $row[owner], $subject, $dt, $msg)") or sqlerr(__FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
header("Refresh: 0; url=torrents.php");
|
||||||
|
?>
|
||||||
BIN
favicon.ico
Normal file
BIN
favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
BIN
flvplayer.swf
Normal file
BIN
flvplayer.swf
Normal file
Binary file not shown.
215
formats.php
Normal file
215
formats.php
Normal file
@@ -0,0 +1,215 @@
|
|||||||
|
<?php
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
loggedinorreturn();
|
||||||
|
stdhead("Downloaded Files");
|
||||||
|
?>
|
||||||
|
<table class=main width=737 border=0 cellspacing=0 cellpadding=0><tr><td class=embedded>
|
||||||
|
<h2>A Handy Guide to Using the Files You've Downloaded</h2>
|
||||||
|
<table width=100% border=1 cellspacing=0 cellpadding=10><tr><td class=text>
|
||||||
|
|
||||||
|
Hey guys, here's some info about common files that you can download from the internet,
|
||||||
|
and a little bit about using these files for their intended purposes. If you're stuck
|
||||||
|
on what exactly a file is or how to open it maybe your answer lies ahead. If you dont'
|
||||||
|
find your answer here, then please post in the "Forum". So without further adieu lets
|
||||||
|
get the show on the road!<br />
|
||||||
|
</td></tr></table>
|
||||||
|
</td></tr></table>
|
||||||
|
<br />
|
||||||
|
<table class=main width=737 border=0 cellspacing=0 cellpadding=0><tr><td class=embedded>
|
||||||
|
<h2>Compression Files</h2>
|
||||||
|
<table width=100% border=1 cellspacing=0 cellpadding=10><tr><td class=text>
|
||||||
|
|
||||||
|
<b>.rar .zip .ace .r01 .001</b><br />
|
||||||
|
<br />
|
||||||
|
These extensions are quite common and mean that your file(s) are compressed into an "archive".<br />
|
||||||
|
This is just a way of making the files more compact and easier to download.<br />
|
||||||
|
<br />
|
||||||
|
To open any of those archives listed above you can use <a href="http://www.rarsoft.com/download.htm">WinRAR</a> (Make sure you have the latest version) or <a href="http://www.powerarchiver.com/download/">PowerArchiver</a>.<br />
|
||||||
|
<br />
|
||||||
|
If those progams aren't working for you and you have a .zip file you can try
|
||||||
|
<a href="http://www.winzip.com/download.htm">WinZip</a> (Trial version).<br />
|
||||||
|
<br />
|
||||||
|
If the two first mentioned programs aren't working for you and you have a .ace or .001
|
||||||
|
file you can try <a href="http://www.winace.com/">Winace</a> (Trial version).<br />
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<b>.cbr .cbz</b><br />
|
||||||
|
<br />
|
||||||
|
These are usually comic books in an archive format. a .cbr file is actually the same
|
||||||
|
thing as a .rar file and a .cbz file is the same as a .zip file. However, often when
|
||||||
|
opening them with WinRAR or WinZip it will disorder your pages. To display these
|
||||||
|
archives properly it's often best to use <a href="http://www.geocities.com/davidayton/CDisplay">
|
||||||
|
CDisplay</a>.<br />
|
||||||
|
<br />
|
||||||
|
</td></tr></table>
|
||||||
|
</td></tr></table>
|
||||||
|
<br />
|
||||||
|
<table class=main width=737 border=0 cellspacing=0 cellpadding=0><tr><td class=embedded>
|
||||||
|
<h2>Multimedia Files</h2>
|
||||||
|
<table width=100% border=1 cellspacing=0 cellpadding=10><tr><td class=text>
|
||||||
|
|
||||||
|
<b>.avi .mpg. .mpeg .divx .xvid .wmv</b><br />
|
||||||
|
<br />
|
||||||
|
These files are usually movies or TVshows, or a host of other types of media. They can
|
||||||
|
be viewed using various media players, but I suggest using
|
||||||
|
<a href="http://www.inmatrix.com/files/zoomplayer_download.shtml">Zoomplayer</a>,
|
||||||
|
<a href="http://www.bsplayer.org/">BSPlayer</a>, <a href="http://www.videolan.org/vlc/">VLC media player</a>
|
||||||
|
or <a href="http://www.microsoft.com/windows/
|
||||||
|
windowsmedia/default.aspx">Windows Media Player</a>. Also, you'll need to make sure you have
|
||||||
|
the right codecs to play each individual file. Codecs are a tricky business sometimes so to help
|
||||||
|
you out with your file and what exact codecs it needs try using <a href="http://www.headbands.com/
|
||||||
|
gspot/download.html">GSpot</a>. It tells you what codecs you need. Then just look on the net to find
|
||||||
|
them, below are some common codecs and their download links for quick reference:<br />
|
||||||
|
<br />
|
||||||
|
<a href="http://sourceforge.net/project/showfiles.php?group_id=53761&release_id=95213">ffdshow</a> (Recommended! (plays many formats: XviD, DivX, 3ivX, mpeg-4))<br />
|
||||||
|
<a href="http://nic.dnsalias.com/xvid.html">XviD codec</a><br />
|
||||||
|
<a href="http://www.divx.com/divx/">DivX codec</a><br />
|
||||||
|
<a href="http://sourceforge.net/project/showfiles.php?group_id=66022&release_id=178906">ac3filter</a> (for AC3 soundtracks, aka "5.1")<br />
|
||||||
|
<a href="http://tobias.everwicked.com/oggds.htm">Ogg media codec</a> (for .OGM files)<br />
|
||||||
|
<br />
|
||||||
|
Can't find what you're looking for? Check out these sites...<br />
|
||||||
|
<br />
|
||||||
|
<a href="http://www.divx-digest.com/">DivX-Digest</a><br />
|
||||||
|
<a href="http://www.digital-digest.com/">Digital-Digest</a><br />
|
||||||
|
<a href="http://www.doom9.org/">Doom9</a><br />
|
||||||
|
<a href="http://www.dvdrhelp.com/">DVD-R Help</a><br />
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<b>.mov</b><br />
|
||||||
|
<br />
|
||||||
|
These are <a href="http://www.apple.com/quicktime/">QuickTime</a> files. Hopefully you
|
||||||
|
won't have to open these as I hate quicktime, but if you do you can
|
||||||
|
<a href="http://www.apple.com/quicktime/download/">get it here</a>.
|
||||||
|
There are however alternatives to the original program,
|
||||||
|
Check out <a href="http://home.hccnet.nl/h.edskes/finalbuilds.htm">QuickTime Alternative</a>.<br />
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<b>.ra .rm .ram</b><br />
|
||||||
|
<br />
|
||||||
|
These are <a href="http://www.real.com">RealPlayer</a> files. RealPlayer IMO is the
|
||||||
|
devils work. It installs lord knows what on your system and never really goes away when
|
||||||
|
you want to uninstall it. Still if you insists you can get the player
|
||||||
|
<a href="http://service.real.com/downloads.html">here</a>.
|
||||||
|
There are however alternatives to the original program,
|
||||||
|
check out <a href="http://home.hccnet.nl/h.edskes/finalbuilds.htm">Real Alternative</a>.<br />
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<b>vcd/svcd</b><br />
|
||||||
|
<br />
|
||||||
|
These can be a pain on some peoples setups, but more so, on your stand-alone DVD player.
|
||||||
|
For all your vcd needs check out <a href="http://www.dvdrhelp.com">www.dvdrhelp.com</a>.
|
||||||
|
These guys know their stuff, and can help you with all kinds of media related questions.<br />
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<b>.mp3 .mp2</b><br />
|
||||||
|
<br />
|
||||||
|
Usually music files. Play them with <a href="http://www.winamp.com/">WinAmp</a>.<br />
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<b>.ogm .ogg</b><br />
|
||||||
|
<br />
|
||||||
|
Ogg Vorbis media files. You can find out more about them and download applications
|
||||||
|
<a href="http://www.vorbis.com/download.psp">here</a>.
|
||||||
|
This filetype is another music file format, but can be used for various media. You will
|
||||||
|
probably want to download the <a href="http://tobias.everwicked.com/oggds.htm">
|
||||||
|
DirectShow Ogg filter</a> to play back OGM files. Any new version of
|
||||||
|
<a href="http://www.winamp.com">WinAmp</a> will also do.<br />
|
||||||
|
<br />
|
||||||
|
</td></tr></table>
|
||||||
|
</td></tr></table>
|
||||||
|
<br />
|
||||||
|
<table class=main width=737 border=0 cellspacing=0 cellpadding=0><tr><td class=embedded>
|
||||||
|
<h2>CD Image Files</h2>
|
||||||
|
<table width=100% border=1 cellspacing=0 cellpadding=10><tr><td class=text>
|
||||||
|
|
||||||
|
<b>.bin and .cue</b><br />
|
||||||
|
<br />
|
||||||
|
These are your standard images of a CD, and are used quite alot these days. To open them
|
||||||
|
you have a couple options. You can burn them using <a href="http://www.ahead.de">Nero</a>
|
||||||
|
(Trial Version) or <a href="http://www.alcohol-software.com/">Alcohol 120%</a>,
|
||||||
|
but this proves to be soooooooo problematic for a lot of people. You should also consult
|
||||||
|
this tutorial for burning images with various software programs You can also use
|
||||||
|
<a href="http://www.daemon-tools.cc/portal/portal.php">Daemon Tools</a>, which lets you
|
||||||
|
mount the image to a "virtual cd-rom", so basically it tricks your computer into thinking
|
||||||
|
that you have another cd-rom and that you're putting a cd with your image file on it into
|
||||||
|
this virtual cd-rom, it's great cuz you'll never make a bad cd again, Alcohol 120% also
|
||||||
|
sports a virtual cd-rom feature. Finally, if you're still struggling to access the files
|
||||||
|
contained within any given image file you can use <a href="http://cdmage.cjb.net/">CDMage</a>
|
||||||
|
to extract the files and then burn them, or just access them from your hard drive. You can
|
||||||
|
also use <a href="http://www.vcdgear.com/">VCDGear</a> to extract the mpeg contents of a
|
||||||
|
SVCD or VCD image file such as bin/cue.<br />
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<b>.iso</b><br />
|
||||||
|
<br />
|
||||||
|
Another type of image file that follows similar rules as .bin and .cue, only you extract
|
||||||
|
or create them using <a href="http://www.winiso.com">WinISO</a> or
|
||||||
|
<a href="http://ww.smart-projects.net/isobuster/">ISOBuster.</a> Sometimes converting a
|
||||||
|
problematic .bin and .cue file to an .iso can help you burn it to a cd.<br />
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<b>.ccd .img .sub</b><br />
|
||||||
|
<br />
|
||||||
|
All these files go together and are in the <a href="http://www.elby.ch/english/products/
|
||||||
|
clone_cd/index.html"> CloneCD</a> format. CloneCD is like most other CD-Burning programs,
|
||||||
|
see the .bin and .cue section if you're having problems with these files.<br />
|
||||||
|
<br />
|
||||||
|
</td></tr></table>
|
||||||
|
</td></tr></table>
|
||||||
|
<br />
|
||||||
|
<table class=main width=737 border=0 cellspacing=0 cellpadding=0><tr><td class=embedded>
|
||||||
|
<h2>Other Files</h2>
|
||||||
|
<table width=100% border=1 cellspacing=0 cellpadding=10><tr><td class=text>
|
||||||
|
|
||||||
|
<b>.txt .doc</b><br />
|
||||||
|
<br />
|
||||||
|
These are text files. .txt files can be opened with notepad or watever you default text
|
||||||
|
editor happens to be, and .doc are opened with Microsoft Word.<br />
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<b>.nfo</b><br />
|
||||||
|
<br />
|
||||||
|
These contain information about the file you just downloaded, and it's HIGHLY recommended
|
||||||
|
that you read these! They are plain text files, often with ascii-art. You can open them
|
||||||
|
with Notepad, Wordpad, <a href="http://www.damn.to/software/nfoviewer.html">DAMN NFO Viewer</a>
|
||||||
|
or <a href="http://www.ultraedit.com/">UltraEdit</a>.<br />
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<b>.pdf</b><br />
|
||||||
|
<br />
|
||||||
|
Opened with <a href="http://www.adobe.com/products/acrobat/main.html">Adobe Acrobat Reader</a>.<br />
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<b>.jpg .gif .tga .psd</b><br />
|
||||||
|
<br />
|
||||||
|
Basic image files. These files generally contain pictures, and can be opened with Adobe
|
||||||
|
Photoshop or whatever your default image viewer is.<br />
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<b>.sfv</b><br />
|
||||||
|
<br />
|
||||||
|
Checks to make sure that your multi-volume archives are complete. This just lets you know
|
||||||
|
if you've downloaded something complete or not. (This is not really an issue when DL:ing
|
||||||
|
via torrent.) You can open/activate these files with <a href="http://www.traction-software.co.uk/SFVChecker/">
|
||||||
|
SFVChecker</a> (Trial version) or <a href="http://www.big-o-software.com/products/hksfv/">hkSFV</a> for example.<br />
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<p><b>.par</b></p>
|
||||||
|
This is a parity file, and is often used when downloading from newsgroups. These files can
|
||||||
|
fill in gaps when you're downloading a multi-volume archive and get corrupted or missing parts.
|
||||||
|
Open them with <a href="http://www.pbclements.co.uk/QuickPar/">QuickPar</a>.
|
||||||
|
<br />
|
||||||
|
</td></tr></table>
|
||||||
|
</td></tr></table>
|
||||||
|
<br />
|
||||||
|
<table class=main width=737 border=0 cellspacing=0 cellpadding=0><tr><td class=embedded>
|
||||||
|
<table width=100% border=1 cellspacing=0 cellpadding=10><tr><td class=text>
|
||||||
|
|
||||||
|
If you have any suggestion/changes <a href=staff.php><b>PM</b></a> one of the Admins/SysOp!<br />
|
||||||
|
<br />
|
||||||
|
This file was originally written by hussdiesel at filesoup, then edited by Rhomboid and re-edited by us.<br />
|
||||||
|
</td></tr></table>
|
||||||
|
</td></tr></table>
|
||||||
|
<br />
|
||||||
|
<?php
|
||||||
299
forummanage.php
Normal file
299
forummanage.php
Normal file
@@ -0,0 +1,299 @@
|
|||||||
|
<?php
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
require_once(get_langfile_path());
|
||||||
|
loggedinorreturn();
|
||||||
|
|
||||||
|
if (get_user_class() < $forummanage_class)
|
||||||
|
permissiondenied();
|
||||||
|
|
||||||
|
// DELETE FORUM ACTION
|
||||||
|
if ($_GET['action'] == "del") {
|
||||||
|
$id = 0 + $_GET['id'];
|
||||||
|
if (!$id) {
|
||||||
|
header("Location: forummanage.php");
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
$result = sql_query ("SELECT * FROM topics where forumid = ".sqlesc($id));
|
||||||
|
if ($row = mysql_fetch_array($result)) {
|
||||||
|
do {
|
||||||
|
sql_query ("DELETE FROM posts where topicid = ".$row["id"]) or sqlerr(__FILE__, __LINE__);
|
||||||
|
} while($row = mysql_fetch_array($result));
|
||||||
|
}
|
||||||
|
sql_query ("DELETE FROM topics where forumid = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
|
||||||
|
sql_query ("DELETE FROM forums where id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
|
||||||
|
sql_query ("DELETE FROM forummods where forumid = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
|
||||||
|
$Cache->delete_value('forums_list');
|
||||||
|
$Cache->delete_value('forum_moderator_array');
|
||||||
|
header("Location: forummanage.php");
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
//EDIT FORUM ACTION
|
||||||
|
elseif ($_POST['action'] == "editforum") {
|
||||||
|
$name = $_POST['name'];
|
||||||
|
$desc = $_POST['desc'];
|
||||||
|
$id = $_POST['id'];
|
||||||
|
if (!$name && !$desc && !$id) {
|
||||||
|
header("Location: " . get_protocol_prefix() . "$BASEURL/forummanage.php");
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
if ($_POST["moderator"]){
|
||||||
|
$moderator = $_POST["moderator"];
|
||||||
|
set_forum_moderators($moderator,$id);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
sql_query("DELETE FROM forummods WHERE forumid=".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
sql_query("UPDATE forums SET sort = '" . $_POST['sort'] . "', name = " . sqlesc($_POST['name']). ", description = " . sqlesc($_POST['desc']). ", forid = ".sqlesc(($_POST['overforums'])).", minclassread = '" . $_POST['readclass'] . "', minclasswrite = '" . $_POST['writeclass'] . "', minclasscreate = '" . $_POST['createclass'] . "' where id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
|
||||||
|
$Cache->delete_value('forums_list');
|
||||||
|
$Cache->delete_value('forum_moderator_array');
|
||||||
|
header("Location: forummanage.php");
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
//ADD FORUM ACTION
|
||||||
|
elseif ($_POST['action'] == "addforum") {
|
||||||
|
$name = ($_POST['name']);
|
||||||
|
$desc = ($_POST['desc']);
|
||||||
|
if (!$name && !$desc) {
|
||||||
|
header("Location: " . get_protocol_prefix() . "$BASEURL/forummanage.php");
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
sql_query("INSERT INTO forums (sort, name, description, minclassread, minclasswrite, minclasscreate, forid) VALUES(" . $_POST['sort'] . ", " . sqlesc($_POST['name']). ", " . sqlesc($_POST['desc']). ", " . $_POST['readclass'] . ", " . $_POST['writeclass'] . ", " . $_POST['createclass'] . ", ".sqlesc(($_POST['overforums'])).")") or sqlerr(__FILE__, __LINE__);
|
||||||
|
$Cache->delete_value('forums_list');
|
||||||
|
if ($_POST["moderator"]){
|
||||||
|
$id = mysql_insert_id();
|
||||||
|
$moderator = $_POST["moderator"];
|
||||||
|
set_forum_moderators($moderator,$id);
|
||||||
|
}
|
||||||
|
header("Location: forummanage.php");
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
// SHOW FORUMS WITH FORUM MANAGMENT TOOLS
|
||||||
|
stdhead($lang_forummanage['head_forum_management']);
|
||||||
|
begin_main_frame();
|
||||||
|
if ($_GET['action'] == "editforum") {
|
||||||
|
//EDIT PAGE FOR THE FORUMS
|
||||||
|
$id = 0 + ($_GET["id"]);
|
||||||
|
$result = sql_query ("SELECT * FROM forums where id = ".sqlesc($id));
|
||||||
|
if ($row = mysql_fetch_array($result)) {
|
||||||
|
do {
|
||||||
|
?>
|
||||||
|
<h1 align=center><a class=faqlink href=forummanage.php><?php echo $lang_forummanage['text_forum_management']?></a><b>--></b><?php echo $lang_forummanage['text_edit_forum']?></h2>
|
||||||
|
<br />
|
||||||
|
<form method=post action="<?php echo $_SERVER["PHP_SELF"];?>">
|
||||||
|
<table width="100%" border="0" cellspacing="0" cellpadding="3" align="center">
|
||||||
|
<tr align="center">
|
||||||
|
<td colspan="2" class=colhead><?php echo $lang_forummanage['text_edit_forum']?> -- <?php echo htmlspecialchars($row["name"]);?></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<td><b><?php echo $lang_forummanage['row_forum_name']?></td>
|
||||||
|
<td><input name="name" type="text" style="width: 200px" maxlength="60" value="<?php echo $row["name"];?>"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><b><?php echo $lang_forummanage['row_forum_description']?></td>
|
||||||
|
<td><input name="desc" type="text" style="width: 400px" maxlength="200" value="<?php echo $row["description"];?>"></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><b><?php echo $lang_forummanage['row_overforum']?></td>
|
||||||
|
<td>
|
||||||
|
<select name=overforums>
|
||||||
|
<?php
|
||||||
|
$forid = $row["forid"];
|
||||||
|
$res = sql_query("SELECT * FROM overforums");
|
||||||
|
while ($arr = mysql_fetch_array($res)) {
|
||||||
|
|
||||||
|
$name = $arr["name"];
|
||||||
|
$i = $arr["id"];
|
||||||
|
|
||||||
|
print("<option value=$i" . ($forid == $i ? " selected" : "") . ">$prefix" . $name . "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
$username = get_forum_moderators($row['id'],true);
|
||||||
|
?>
|
||||||
|
<tr><td><b><?php echo $lang_forummanage['row_moderator']?></b></td><td><input name="moderator" type="text" style="width: 200px" maxlength="200" value="<?php echo $username?>"> <?php echo $lang_forummanage['text_moderator_note']?></td></tr>
|
||||||
|
<tr>
|
||||||
|
<td><b><?php echo $lang_forummanage['row_minimum_read_permission']?></td>
|
||||||
|
<td>
|
||||||
|
<select name=readclass>
|
||||||
|
<?php
|
||||||
|
$maxclass = get_user_class();
|
||||||
|
for ($i = 0; $i <= $maxclass; ++$i)
|
||||||
|
print("<option value=$i" . ($row["minclassread"] == $i ? " selected" : "") . ">$prefix" . get_user_class_name($i,false,true,true));
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><b><?php echo $lang_forummanage['row_minimum_write_permission']?></td>
|
||||||
|
<td><select name=writeclass>
|
||||||
|
<?php
|
||||||
|
$maxclass = get_user_class();
|
||||||
|
for ($i = 0; $i <= $maxclass; ++$i)
|
||||||
|
print("<option value=$i" . ($row["minclasswrite"] == $i ? " selected" : "") . ">$prefix" . get_user_class_name($i,false,true,true) . "\n");
|
||||||
|
?>
|
||||||
|
</select></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><b><?php echo $lang_forummanage['row_minimum_create_topic_permission']?></td>
|
||||||
|
<td><select name=createclass>
|
||||||
|
<?php
|
||||||
|
$maxclass = get_user_class();
|
||||||
|
for ($i = 0; $i <= $maxclass; ++$i)
|
||||||
|
print("<option value=$i" . ($row["minclasscreate"] == $i ? " selected" : "") . ">$prefix" . get_user_class_name($i,false,true,true) . "\n");
|
||||||
|
?>
|
||||||
|
</select></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><b><?php echo $lang_forummanage['row_forum_order']?></td>
|
||||||
|
<td>
|
||||||
|
<select name=sort>
|
||||||
|
<?php
|
||||||
|
$res = sql_query ("SELECT sort FROM forums");
|
||||||
|
$nr = mysql_num_rows($res);
|
||||||
|
$maxclass = $nr + 1;
|
||||||
|
for ($i = 0; $i <= $maxclass; ++$i)
|
||||||
|
print("<option value=$i" . ($row["sort"] == $i ? " selected" : "") . ">$i \n");
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
<?php echo $lang_forummanage['text_forum_order_note']?></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr align="center">
|
||||||
|
<td colspan="2"><input type="hidden" name="action" value="editforum"><input type="hidden" name="id" value="<?php echo $id;?>"><input type="submit" name="Submit" value="<?php echo $lang_forummanage['submit_edit_forum']?>" class="btn"></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
} while($row = mysql_fetch_array($result));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print ($lang_forummanage['text_no_records_found']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
|
elseif ($_GET['action'] == "newforum"){
|
||||||
|
?>
|
||||||
|
<h2 class=transparentbg align=center><a class=faqlink href=forummanage.php><?php echo $lang_forummanage['text_forum_management']?></a><b>--></b><?php echo $lang_forummanage['text_add_forum']?></h2>
|
||||||
|
<br />
|
||||||
|
<form method=post action="<?php echo $_SERVER["PHP_SELF"];?>">
|
||||||
|
<table width="100%" border="0" cellspacing="0" cellpadding="3" align="center">
|
||||||
|
<tr align="center">
|
||||||
|
<td colspan="2" class=colhead><?php echo $lang_forummanage['text_make_new_forum']?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><b><?php echo $lang_forummanage['row_forum_name']?></td>
|
||||||
|
<td><input name="name" type="text" style="width: 200px" maxlength="60"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><b><?php echo $lang_forummanage['row_forum_description']?></td>
|
||||||
|
<td><input name="desc" type="text" style="width: 400px" maxlength="200"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><b><?php echo $lang_forummanage['row_overforum']?></td>
|
||||||
|
<td>
|
||||||
|
<select name=overforums>
|
||||||
|
<?php
|
||||||
|
$forid = $row["forid"];
|
||||||
|
$res = sql_query("SELECT * FROM overforums");
|
||||||
|
while ($arr = mysql_fetch_array($res)) {
|
||||||
|
|
||||||
|
$name = $arr["name"];
|
||||||
|
$i = $arr["id"];
|
||||||
|
|
||||||
|
print("<option value=$i" . ($forid == $i ? " selected" : "") . ">$prefix" . $name . "\n");
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td><b><?php echo $lang_forummanage['row_moderator']?></b></td><td><input name="moderator" type="text" style="width: 200px" maxlength="200"> <?php echo $lang_forummanage['text_moderator_note']?></td></tr>
|
||||||
|
<tr>
|
||||||
|
<td><b><?php echo $lang_forummanage['row_minimum_read_permission']?></td>
|
||||||
|
<td>
|
||||||
|
<select name=readclass>
|
||||||
|
<?php
|
||||||
|
$maxclass = get_user_class();
|
||||||
|
for ($i = 0; $i <= $maxclass; ++$i)
|
||||||
|
print("<option value=$i" . ($user["class"] == $i ? " selected" : "") . ">$prefix" . get_user_class_name($i,false,true,true) . "\n");
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><b><?php echo $lang_forummanage['row_minimum_write_permission']?></td>
|
||||||
|
<td><select name=writeclass>
|
||||||
|
<?php
|
||||||
|
$maxclass = get_user_class();
|
||||||
|
for ($i = 0; $i <= $maxclass; ++$i)
|
||||||
|
print("<option value=$i" . ($user["class"] == $i ? " selected" : "") . ">$prefix" . get_user_class_name($i,false,true,true) . "\n");
|
||||||
|
?>
|
||||||
|
</select></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><b><?php echo $lang_forummanage['row_minimum_create_topic_permission']?></td>
|
||||||
|
<td><select name=createclass>
|
||||||
|
<?php
|
||||||
|
$maxclass = get_user_class();
|
||||||
|
for ($i = 0; $i <= $maxclass; ++$i)
|
||||||
|
print("<option value=$i" . ($user["class"] == $i ? " selected" : "") . ">$prefix" . get_user_class_name($i,false,true,true) . "\n");
|
||||||
|
?>
|
||||||
|
</select></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><b><?php echo $lang_forummanage['row_forum_order']?></td>
|
||||||
|
<td>
|
||||||
|
<select name=sort>
|
||||||
|
<?php
|
||||||
|
$res = sql_query ("SELECT sort FROM forums");
|
||||||
|
$nr = mysql_num_rows($res);
|
||||||
|
$maxclass = $nr + 1;
|
||||||
|
for ($i = 0; $i <= $maxclass; ++$i)
|
||||||
|
print("<option value=$i>$i \n");
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
<?php echo $lang_forummanage['text_forum_order_note']?></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr align="center">
|
||||||
|
<td colspan="2"><input type="hidden" name="action" value="addforum"><input type="submit" name="Submit" value="<?php echo $lang_forummanage['submit_make_forum']?>" class=btn></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
?>
|
||||||
|
<h2 class=transparentbg align=center><?php echo $lang_forummanage['text_forum_management']?></h2>
|
||||||
|
<table border=0 class=main cellspacing=0 cellpadding=5 width=1%><tr>
|
||||||
|
<td class=embedded align=left><form method="get" action="moforums.php"><input type="submit" value="<?php echo $lang_forummanage['submit_overforum_management']?>" class="btn"></form></td><td class=embedded align=left><form method="get" action="forummanage.php"><input type=hidden name="action" value="newforum"><input type="submit" value="<?php echo $lang_forummanage['submit_add_forum']?>" class="btn"></form></td>
|
||||||
|
</tr></table>
|
||||||
|
<?php
|
||||||
|
echo '<table width="100%" border="0" align="center" cellpadding="2" cellspacing="0">';
|
||||||
|
echo "<tr><td class=colhead align=left>".$lang_forummanage['col_name']."</td><td class=colhead>".$lang_forummanage['col_overforum']."</td><td class=colhead>".$lang_forummanage['col_read']."</td><td class=colhead>".$lang_forummanage['col_write']."</td><td class=colhead>".$lang_forummanage['col_create_topic']."</td><td class=colhead>".$lang_forummanage['col_moderator']."</td><td class=colhead>".$lang_forummanage['col_modify']."</td></tr>";
|
||||||
|
$result = sql_query ("SELECT forums.*, overforums.name AS of_name FROM forums LEFT JOIN overforums ON forums.forid=overforums.id ORDER BY forums.sort ASC");
|
||||||
|
if ($row = mysql_fetch_array($result)) {
|
||||||
|
do {
|
||||||
|
$name = $row['of_name'];
|
||||||
|
$moderators = get_forum_moderators($row['id'],false);
|
||||||
|
if (!$moderators)
|
||||||
|
$moderators = $lang_forummanage['text_not_available'];
|
||||||
|
echo "<tr><td><a href=forums.php?action=viewforum&forumid=".$row["id"]."><b>".htmlspecialchars($row["name"])."</b></a><br />".htmlspecialchars($row["description"])."</td>";
|
||||||
|
echo "<td>".htmlspecialchars($name)."</td><td>" . get_user_class_name($row["minclassread"],false,true,true) . "</td><td>" . get_user_class_name($row["minclasswrite"],false,true,true) . "</td><td>" . get_user_class_name($row["minclasscreate"],false,true,true) . "</td><td>".$moderators."</td><td><b><a href=\"".$PHP_SELF."?action=editforum&id=".$row["id"]."\">".$lang_forummanage['text_edit']."</a> | <a href=\"javascript:confirm_delete('".$row["id"]."', '".$lang_forummanage['js_sure_to_delete_forum']."', '');\"><font color=red>".$lang_forummanage['text_delete']."</font></a></b></td></tr>";
|
||||||
|
} while($row = mysql_fetch_array($result));
|
||||||
|
} else {print "<tr><td colspan=6>".$lang_forummanage['text_no_records_found']."</td></tr>";}
|
||||||
|
echo "</table>";
|
||||||
|
}
|
||||||
|
|
||||||
|
end_main_frame();
|
||||||
|
stdfoot();
|
||||||
1537
forums.php
Normal file
1537
forums.php
Normal file
File diff suppressed because it is too large
Load Diff
49
freeleech.php
Normal file
49
freeleech.php
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
loggedinorreturn();
|
||||||
|
if (get_user_class() < UC_ADMINISTRATOR)
|
||||||
|
stderr("Error", "Permission denied.");
|
||||||
|
|
||||||
|
$action = isset($_POST['action']) ? htmlspecialchars($_POST['action']) : (isset($_GET['action']) ? htmlspecialchars($_GET['action']) : 'main');
|
||||||
|
if ($action == 'setallfree')
|
||||||
|
{
|
||||||
|
sql_query("UPDATE torrents_state SET global_sp_state = 2");
|
||||||
|
$Cache->delete_value('global_promotion_state');
|
||||||
|
stderr('Success','All torrents have been set free..');
|
||||||
|
}
|
||||||
|
elseif ($action == 'setall2up')
|
||||||
|
{
|
||||||
|
sql_query("UPDATE torrents_state SET global_sp_state = 3");
|
||||||
|
$Cache->delete_value('global_promotion_state');
|
||||||
|
stderr('Success','All torrents have been set 2x up..');
|
||||||
|
}
|
||||||
|
elseif ($action == 'setall2up_free')
|
||||||
|
{
|
||||||
|
sql_query("UPDATE torrents_state SET global_sp_state = 4");
|
||||||
|
$Cache->delete_value('global_promotion_state');
|
||||||
|
stderr('Success','All torrents have been set 2x up and free..');
|
||||||
|
}
|
||||||
|
elseif ($action == 'setallhalf_down')
|
||||||
|
{
|
||||||
|
sql_query("UPDATE torrents_state SET global_sp_state = 5");
|
||||||
|
$Cache->delete_value('global_promotion_state');
|
||||||
|
stderr('Success','All torrents have been set half down..');
|
||||||
|
}
|
||||||
|
elseif ($action == 'setall2up_half_down')
|
||||||
|
{
|
||||||
|
sql_query("UPDATE torrents_state SET global_sp_state = 6");
|
||||||
|
$Cache->delete_value('global_promotion_state');
|
||||||
|
stderr('Success','All torrents have been set half down..');
|
||||||
|
}
|
||||||
|
elseif ($action == 'setallnormal')
|
||||||
|
{
|
||||||
|
sql_query("UPDATE torrents_state SET global_sp_state = 1");
|
||||||
|
$Cache->delete_value('global_promotion_state');
|
||||||
|
stderr('Success','All torrents have been set normal..');
|
||||||
|
}
|
||||||
|
elseif ($action == 'main')
|
||||||
|
{
|
||||||
|
stderr('Select action','Click <a class=altlink href=freeleech.php?action=setallfree>here</a> to set all torrents free.. <br /> Click <a class=altlink href=freeleech.php?action=setall2up>here</a> to set all torrents 2x up..<br /> Click <a class=altlink href=freeleech.php?action=setall2up_free>here</a> to set all torrents 2x up and free.. <br />Click <a class=altlink href=freeleech.php?action=setallhalf_down>here</a> to set all torrents half down..<br />Click <a class=altlink href=freeleech.php?action=setall2up_half_down>here</a> to set all torrents 2x up and half down..<br />Click <a class=altlink href=freeleech.php?action=setallnormal>here</a> to set all torrents normal..', false);
|
||||||
|
}
|
||||||
|
?>
|
||||||
356
friends.php
Normal file
356
friends.php
Normal file
@@ -0,0 +1,356 @@
|
|||||||
|
<?php
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
require_once(get_langfile_path());
|
||||||
|
loggedinorreturn();
|
||||||
|
parked();
|
||||||
|
|
||||||
|
|
||||||
|
function purge_neighbors_cache()
|
||||||
|
{
|
||||||
|
global $CURUSER;
|
||||||
|
$cachefile = "cache/" . get_langfolder_cookie() . "/neighbors/" . $CURUSER['id'] . ".html";
|
||||||
|
if (file_exists($cachefile))
|
||||||
|
unlink($cachefile);
|
||||||
|
}
|
||||||
|
|
||||||
|
//make_folder("cache/" , get_langfolder_cookie());
|
||||||
|
//make_folder("cache/" , get_langfolder_cookie() . "/neighbors");
|
||||||
|
|
||||||
|
$userid = $CURUSER['id'];
|
||||||
|
$action = $_GET['action'];
|
||||||
|
|
||||||
|
if (!is_valid_id($userid))
|
||||||
|
stderr($lang_friends['std_error'], $lang_friends['std_invalid_id']."$userid.");
|
||||||
|
|
||||||
|
$user = $CURUSER;
|
||||||
|
// action: add -------------------------------------------------------------
|
||||||
|
|
||||||
|
if ($action == 'add')
|
||||||
|
{
|
||||||
|
$targetid = $_GET['targetid'];
|
||||||
|
$type = $_GET['type'];
|
||||||
|
|
||||||
|
if (!is_valid_id($targetid))
|
||||||
|
stderr($lang_friends['std_error'], $lang_friends['std_invalid_id']."$targetid.");
|
||||||
|
|
||||||
|
if ($type == 'friend')
|
||||||
|
{
|
||||||
|
$table_is = $frag = 'friends';
|
||||||
|
$field_is = 'friendid';
|
||||||
|
}
|
||||||
|
elseif ($type == 'block')
|
||||||
|
{
|
||||||
|
$table_is = $frag = 'blocks';
|
||||||
|
$field_is = 'blockid';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
stderr($lang_friends['std_error'], $lang_friends['std_unknown_type']."$type");
|
||||||
|
|
||||||
|
$r = sql_query("SELECT id FROM $table_is WHERE userid=$userid AND $field_is=$targetid") or sqlerr(__FILE__, __LINE__);
|
||||||
|
if (mysql_num_rows($r) == 1)
|
||||||
|
stderr($lang_friends['std_error'], $lang_friends['std_user_id'].$targetid.$lang_friends['std_already_in'].$table_is.$lang_friends['std_list']);
|
||||||
|
|
||||||
|
sql_query("INSERT INTO $table_is VALUES (0,$userid, $targetid)") or sqlerr(__FILE__, __LINE__);
|
||||||
|
|
||||||
|
purge_neighbors_cache();
|
||||||
|
|
||||||
|
header("Location: " . get_protocol_prefix() . "$BASEURL/friends.php?id=$userid#$frag");
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
// action: delete ----------------------------------------------------------
|
||||||
|
|
||||||
|
if ($action == 'delete')
|
||||||
|
{
|
||||||
|
$targetid = $_GET['targetid'];
|
||||||
|
$sure = $_GET['sure'];
|
||||||
|
$type = $_GET['type'];
|
||||||
|
|
||||||
|
if ($type == 'friend')
|
||||||
|
$typename = $lang_friends['text_friend'];
|
||||||
|
else $typename = $lang_friends['text_block'];
|
||||||
|
if (!is_valid_id($targetid))
|
||||||
|
stderr($lang_friends['std_error'], $lang_friends['std_invalid_id']."$userid.");
|
||||||
|
|
||||||
|
if (!$sure)
|
||||||
|
stderr($lang_friends['std_delete'].$type, $lang_friends['std_delete_note'].$typename.$lang_friends['std_click'].
|
||||||
|
"<a href=?id=$userid&action=delete&type=$type&targetid=$targetid&sure=1>".$lang_friends['std_here_if_sure'],false);
|
||||||
|
|
||||||
|
if ($type == 'friend')
|
||||||
|
{
|
||||||
|
sql_query("DELETE FROM friends WHERE userid=$userid AND friendid=$targetid") or sqlerr(__FILE__, __LINE__);
|
||||||
|
if (mysql_affected_rows() == 0)
|
||||||
|
stderr($lang_friends['std_error'], $lang_friends['std_no_friend_found']."$targetid");
|
||||||
|
$frag = "friends";
|
||||||
|
}
|
||||||
|
elseif ($type == 'block')
|
||||||
|
{
|
||||||
|
sql_query("DELETE FROM blocks WHERE userid=$userid AND blockid=$targetid") or sqlerr(__FILE__, __LINE__);
|
||||||
|
if (mysql_affected_rows() == 0)
|
||||||
|
stderr($lang_friends['std_error'], $lang_friends['std_no_block_found']."$targetid");
|
||||||
|
$frag = "blocks";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
stderr($lang_friends['std_error'], $lang_friends['std_unknown_type']."$type");
|
||||||
|
|
||||||
|
|
||||||
|
purge_neighbors_cache();
|
||||||
|
|
||||||
|
header("Location: " . get_protocol_prefix() . "$BASEURL/friends.php?id=$userid#$frag");
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
// main body -----------------------------------------------------------------
|
||||||
|
|
||||||
|
stdhead($lang_friends['head_personal_lists_for']. $user['username']);
|
||||||
|
|
||||||
|
print("<p><table class=main border=0 cellspacing=0 cellpadding=0>".
|
||||||
|
"<tr><td class=embedded><h1 style='margin:0px'> " . $lang_friends['text_personallist'] . " ".get_username($user[id])."</h1></td></tr></table></p>\n");
|
||||||
|
|
||||||
|
//Start: Friends
|
||||||
|
print("<table class=main width=737 border=0 cellspacing=0 cellpadding=0><tr><td class=embedded>");
|
||||||
|
|
||||||
|
print("<br />");
|
||||||
|
print("<h2 align=left><a name=\"friends\">" . $lang_friends['text_friendlist'] . "</a></h2>\n");
|
||||||
|
|
||||||
|
print("<table width=737 border=1 cellspacing=0 cellpadding=5><tr class=tablea><td>");
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
unset($friend_id_arr);
|
||||||
|
$res = sql_query("SELECT f.friendid as id, u.last_access, u.class, u.avatar, u.title FROM friends AS f LEFT JOIN users as u ON f.friendid = u.id WHERE userid=$userid ORDER BY id") or sqlerr(__FILE__, __LINE__);
|
||||||
|
if(mysql_num_rows($res) == 0)
|
||||||
|
$friends = $lang_friends['text_friends_empty'];
|
||||||
|
else
|
||||||
|
while ($friend = mysql_fetch_array($res))
|
||||||
|
{
|
||||||
|
$friend_id_arr[] = $friend["id"];
|
||||||
|
$title = $friend["title"];
|
||||||
|
if (!$title)
|
||||||
|
$title = get_user_class_name($friend["class"],false,true,true);
|
||||||
|
$body1 = get_username($friend["id"]) .
|
||||||
|
" ($title)<br /><br />".$lang_friends['text_last_seen_on']. gettime($friend['last_access'],true, false);
|
||||||
|
$body2 = "<a href=friends.php?id=$userid&action=delete&type=friend&targetid=" . $friend['id'] . ">".$lang_friends['text_remove_from_friends']."</a>".
|
||||||
|
"<br /><br /><a href=sendmessage.php?receiver=" . $friend['id'] . ">".$lang_friends['text_send_pm']."</a>";
|
||||||
|
|
||||||
|
$avatar = ($CURUSER["avatars"] == "yes" ? htmlspecialchars($friend["avatar"]) : "");
|
||||||
|
if (!$avatar)
|
||||||
|
$avatar = "pic/default_avatar.png";
|
||||||
|
if ($i % 2 == 0)
|
||||||
|
print("<table width=100% style='padding: 0px'><tr><td class=bottom style='padding: 5px' width=50% align=center>");
|
||||||
|
else
|
||||||
|
print("<td class=bottom style='padding: 5px' width=50% align=center class=tablea>");
|
||||||
|
print("<table class=main width=100% height=75px class=tablea>");
|
||||||
|
print("<tr valign=top class=tableb><td width=75 align=center style='padding: 0px'>" .
|
||||||
|
($avatar ? "<div style='width:75px;height:75px;overflow: hidden'><img width=75px src=\"$avatar\"></div>" : ""). "</td><td>\n");
|
||||||
|
print("<table class=main>");
|
||||||
|
print("<tr><td class=embedded style='padding: 5px' width=80%>$body1</td>\n");
|
||||||
|
print("<td class=embedded style='padding: 5px' width=20%>$body2</td></tr>\n");
|
||||||
|
print("</table>");
|
||||||
|
print("</td></tr>");
|
||||||
|
print("</td></tr></table>\n");
|
||||||
|
if ($i % 2 == 1)
|
||||||
|
print("</td></tr></table>\n");
|
||||||
|
else
|
||||||
|
print("</td>\n");
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
if ($i % 2 == 1)
|
||||||
|
print("<td class=bottom width=50%> </td></tr></table>\n");
|
||||||
|
print($friends);
|
||||||
|
print("</td></tr></table><br />\n");
|
||||||
|
//End: Friends
|
||||||
|
|
||||||
|
//Start: Neighbors
|
||||||
|
/*
|
||||||
|
print("<table class=main width=737 border=0 cellspacing=0 cellpadding=0><tr><td class=embedded>");
|
||||||
|
|
||||||
|
print("<br />");
|
||||||
|
print("<h2 align=left><a name=\"friendsadded\">".$lang_friends['text_neighbors']."</a></h2>\n");
|
||||||
|
|
||||||
|
print("<table width=737 border=1 cellspacing=0 cellpadding=5><tr class=tablea><td>");
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
$cachefile = "cache/" . get_langfolder_cookie() . "/neighbors/" . $CURUSER['id'] . ".html";
|
||||||
|
$cachetime = 24 * 60 * 60; // 1 day
|
||||||
|
if (file_exists($cachefile) && (time() - $cachetime< filemtime($cachefile)))
|
||||||
|
{
|
||||||
|
include($cachefile);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ob_start(); // start the output buffer
|
||||||
|
|
||||||
|
$user_snatched = sql_query("SELECT * FROM snatched WHERE userid = $CURUSER[id]") or sqlerr(__FILE__, __LINE__);
|
||||||
|
if(mysql_num_rows($user_snatched) == 0)
|
||||||
|
$neighbors_info = $lang_friends['text_neighbors_empty'];
|
||||||
|
else
|
||||||
|
{
|
||||||
|
while ($user_snatched_arr = mysql_fetch_array($user_snatched))
|
||||||
|
{
|
||||||
|
$torrent_2_user_value = get_torrent_2_user_value($user_snatched_arr);
|
||||||
|
|
||||||
|
$user_snatched_res_target = sql_query("SELECT * FROM snatched WHERE torrentid = " . $user_snatched_arr['torrentid'] . " AND userid != " . $user_snatched_arr['userid']) or sqlerr(__FILE__, __LINE__); //
|
||||||
|
if(mysql_num_rows($user_snatched_res_target)>0) // have other peole snatched this torrent
|
||||||
|
{
|
||||||
|
while($user_snatched_arr_target = mysql_fetch_array($user_snatched_res_target)) // find target user's current analyzing torrent's snatch info
|
||||||
|
{
|
||||||
|
$torrent_2_user_value_target = get_torrent_2_user_value($user_snatched_arr_target); //get this torrent to target user's value
|
||||||
|
|
||||||
|
if(!isset($other_user_2_curuser_value[$user_snatched_arr_target['userid']])) // first, set to 0
|
||||||
|
$other_user_2_curuser_value[$user_snatched_arr_target['userid']] = 0.0;
|
||||||
|
|
||||||
|
$other_user_2_curuser_value[$user_snatched_arr_target['userid']] += $torrent_2_user_value_target * $torrent_2_user_value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
arsort($other_user_2_curuser_value,SORT_NUMERIC);
|
||||||
|
$counter = 0;
|
||||||
|
$total_user = count($other_user_2_curuser_value);
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
list($other_user_2_curuser_value_key, $other_user_2_curuser_value_val) = each($other_user_2_curuser_value);
|
||||||
|
//print(" userid: " . $other_user_2_curuser_value_key . " value: " . $other_user_2_curuser_value_val . "<br />");
|
||||||
|
|
||||||
|
|
||||||
|
$neighbors_res = sql_query("SELECT * FROM users WHERE id = " . intval($other_user_2_curuser_value_key)) or sqlerr(__FILE__, __LINE__);
|
||||||
|
if(mysql_num_rows($neighbors_res) == 1)
|
||||||
|
{
|
||||||
|
$neighbors_arr = mysql_fetch_array($neighbors_res) or sqlerr(__FILE__, __LINE__);
|
||||||
|
if($neighbors_arr['enabled'] == 'yes')
|
||||||
|
{
|
||||||
|
$title = $neighbors_arr["title"];
|
||||||
|
if (!$title)
|
||||||
|
$title = get_user_class_name($neighbors_arr["class"],false,true,true);
|
||||||
|
$body1 = get_username($neighbors_arr["id"]) .
|
||||||
|
" ($title)<br /><br />".$lang_friends['text_last_seen_on']. gettime($neighbors_arr['last_access'], true, false);
|
||||||
|
|
||||||
|
|
||||||
|
$body2 = ((empty($friend_id_arr)||(!in_array($neighbors_arr["id"],$friend_id_arr))) ? "<a href=friends.php?id=$userid&action=add&type=friend&targetid=" . $neighbors_arr['id'] . ">".$lang_friends['text_add_to_friends']."</a>" : "<a href=friends.php?id=$userid&action=delete&type=friend&targetid=" . $neighbors_arr['id'] . ">".$lang_friends['text_remove_from_friends']."</a>") .
|
||||||
|
"<br /><br /><a href=sendmessage.php?receiver=" . $neighbors_arr['id'] . ">".$lang_friends['text_send_pm']."</a>";
|
||||||
|
$avatar = ($CURUSER["avatars"] == "yes" ? htmlspecialchars($neighbors_arr["avatar"]) : "");
|
||||||
|
if (!$avatar)
|
||||||
|
$avatar = "pic/default_avatar.png";
|
||||||
|
if ($i % 2 == 0)
|
||||||
|
print("<table width=100% style='padding: 0px'><tr><td class=bottom style='padding: 5px' width=50% align=center>");
|
||||||
|
else
|
||||||
|
print("<td class=bottom style='padding: 5px' width=50% align=center>");
|
||||||
|
print("<table class=main width=100% height=75px>");
|
||||||
|
print("<tr valign=top><td width=75 align=center style='padding: 0px'>" .
|
||||||
|
($avatar ? "<div style='width:75px;height:75px;overflow: hidden'><img width=75px src=\"$avatar\"></div>" : ""). "</td><td>\n");
|
||||||
|
print("<table class=main>");
|
||||||
|
print("<tr><td class=embedded style='padding: 5px' width=80%>$body1</td>\n");
|
||||||
|
print("<td class=embedded style='padding: 5px' width=20%>$body2</td></tr>\n");
|
||||||
|
print("</table>");
|
||||||
|
print("</td></tr>");
|
||||||
|
print("</td></tr></table>\n");
|
||||||
|
if ($i % 2 == 1)
|
||||||
|
print("</td></tr></table>\n");
|
||||||
|
else
|
||||||
|
print("</td>\n");
|
||||||
|
$i++;
|
||||||
|
$counter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$total_user--;
|
||||||
|
if($counter == 20 || $total_user<=0) break; //only the largest 20
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($i % 2 == 1)
|
||||||
|
print("<td class=bottom width=50%> </td></tr></table>\n");
|
||||||
|
print($neighbors_info);
|
||||||
|
print("</td></tr></table></table><br />\n");
|
||||||
|
|
||||||
|
// CACHE END //////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// open the cache file for writing
|
||||||
|
$fp = fopen($cachefile, 'w');
|
||||||
|
// save the contents of output buffer to the file
|
||||||
|
fwrite($fp, ob_get_contents());
|
||||||
|
// close the file
|
||||||
|
fclose($fp);
|
||||||
|
// Send the output to the browser
|
||||||
|
ob_end_flush();
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(mysql_num_rows($friendadd) == 0)
|
||||||
|
$friendsno = $lang_friends['text_friends_empty'];
|
||||||
|
else
|
||||||
|
while ($friend = mysql_fetch_array($friendadd))
|
||||||
|
{
|
||||||
|
$title = $friend["title"];
|
||||||
|
if (!$title)
|
||||||
|
$title = get_user_class_name($friend["class"],false,true,true);
|
||||||
|
$body1 = get_username($friend["fuid"]) .
|
||||||
|
" ($title)<br /><br />".$lang_friends['text_last_seen_on']. $friend['last_access'] .
|
||||||
|
"<br />(" . get_elapsed_time(strtotime($friend[last_access])) . $lang_friends['text_ago'].")";
|
||||||
|
$body2 = "<a href=friends.php?id=$userid&action=add&type=friend&targetid=" . $friend['fuid'] . ">".$lang_friends['text_add_to_friends']."</a>".
|
||||||
|
"<br /><br /><a href=sendmessage.php?receiver=" . $friend['fuid'] . ">".$lang_friends['text_send_pm']."</a>";
|
||||||
|
$avatar = ($CURUSER["avatars"] == "yes" ? htmlspecialchars($friend["avatar"]) : "");
|
||||||
|
if (!$avatar)
|
||||||
|
$avatar = "pic/default_avatar.png";
|
||||||
|
if ($i % 2 == 0)
|
||||||
|
print("<table width=100% style='padding: 0px'><tr><td class=bottom style='padding: 5px' width=50% align=center>");
|
||||||
|
else
|
||||||
|
print("<td class=bottom style='padding: 5px' width=50% align=center class=tablea>");
|
||||||
|
print("<table class=main width=100% height=75px class=tablea>");
|
||||||
|
print("<tr valign=top class=tableb><td width=75 align=center style='padding: 0px'>" .
|
||||||
|
($avatar ? "<div style='width:75px;height:75px;overflow: hidden'><img width=75px src=\"$avatar\"></div>" : ""). "</td><td>\n");
|
||||||
|
print("<table class=main>");
|
||||||
|
print("<tr><td class=embedded style='padding: 5px' width=80%>$body1</td>\n");
|
||||||
|
print("<td class=embedded style='padding: 5px' width=20%>$body2</td></tr>\n");
|
||||||
|
print("</table>");
|
||||||
|
print("</td></tr>");
|
||||||
|
print("</td></tr></table>\n");
|
||||||
|
if ($i % 2 == 1)
|
||||||
|
print("</td></tr></table>\n");
|
||||||
|
else
|
||||||
|
print("</td>\n");
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
if ($i % 2 == 1)
|
||||||
|
print("<td class=bottom width=50%> </td></tr></table>\n");
|
||||||
|
print($neighbors_info);
|
||||||
|
print("</td></tr></table></table><br />\n");
|
||||||
|
*/
|
||||||
|
//End: Neighbors
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$res = sql_query("SELECT blockid as id FROM blocks WHERE userid=$userid ORDER BY id") or sqlerr(__FILE__, __LINE__);
|
||||||
|
if(mysql_num_rows($res) == 0)
|
||||||
|
$blocks = $lang_friends['text_blocklist_empty'];
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$i = 0;
|
||||||
|
$blocks = "<table width=100% cellspacing=0 cellpadding=0>";
|
||||||
|
while ($block = mysql_fetch_array($res))
|
||||||
|
{
|
||||||
|
if ($i % 6 == 0)
|
||||||
|
$blocks .= "<tr>";
|
||||||
|
$blocks .= "<td style='border: none; padding: 4px; spacing: 0px;'>[<font class=small><a href=friends.php?id=$userid&action=delete&type=block&targetid=" .
|
||||||
|
$block['id'] . ">D</a></font>] " . get_username($block["id"]) . "</td>";
|
||||||
|
if ($i % 6 == 5)
|
||||||
|
$blocks .= "</tr>";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
$blocks .= "</table>\n";
|
||||||
|
}
|
||||||
|
print("<br /><br />");
|
||||||
|
print("<table class=main width=737 border=0 cellspacing=0 cellpadding=5><tr><td class=embedded>");
|
||||||
|
print("<h2 align=left><a name=\"blocks\">".$lang_friends['text_blocked_users']."</a></h2></td></tr>");
|
||||||
|
print("<tr class=tableb><td style='padding: 10px;'>");
|
||||||
|
print($blocks);
|
||||||
|
print("</td></tr></table>\n");
|
||||||
|
|
||||||
|
print("</td></tr></table>\n");
|
||||||
|
if (get_user_class() >= $viewuserlist_class)
|
||||||
|
print("<p><a href=users.php><b>".$lang_friends['text_find_user']."</b></a></p>");
|
||||||
|
stdfoot();
|
||||||
|
?>
|
||||||
285
fun.php
Normal file
285
fun.php
Normal file
@@ -0,0 +1,285 @@
|
|||||||
|
<?php
|
||||||
|
require_once("include/bittorrent.php");
|
||||||
|
dbconn();
|
||||||
|
require_once(get_langfile_path());
|
||||||
|
require_once(get_langfile_path("",true));
|
||||||
|
$action=$_GET["action"];
|
||||||
|
if (!$action)
|
||||||
|
{
|
||||||
|
$action = (string) $_POST['action'];
|
||||||
|
if (!$action)
|
||||||
|
$action = 'view';
|
||||||
|
}
|
||||||
|
if ($action == 'delete')
|
||||||
|
{
|
||||||
|
$id = 0+$_GET["id"];
|
||||||
|
int_check($id,true);
|
||||||
|
$res = sql_query("SELECT userid FROM fun WHERE id=$id") or sqlerr(__FILE__,__LINE__);
|
||||||
|
$arr = mysql_fetch_array($res);
|
||||||
|
if (!$arr)
|
||||||
|
stderr($lang_fun['std_error'], $lang_fun['std_invalid_id']);
|
||||||
|
if (get_user_class() < $funmanage_class)
|
||||||
|
permissiondenied();
|
||||||
|
$sure = 0+$_GET["sure"];
|
||||||
|
$returnto = $_GET["returnto"] ? htmlspecialchars($_GET["returnto"]) : htmlspecialchars($_SERVER["HTTP_REFERER"]);
|
||||||
|
if (!$sure)
|
||||||
|
stderr($lang_fun['std_delete_fun'],$lang_fun['text_please_click'] ."<a class=altlink href=?action=delete&id=$id&returnto=$returnto&sure=1>".$lang_fun['text_here_if_sure'],false);
|
||||||
|
sql_query("DELETE FROM fun WHERE id=".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
|
||||||
|
$Cache->delete_value('current_fun_content');
|
||||||
|
$Cache->delete_value('current_fun', true);
|
||||||
|
$Cache->delete_value('current_fun_vote_count');
|
||||||
|
$Cache->delete_value('current_fun_vote_funny_count');
|
||||||
|
if ($returnto != "")
|
||||||
|
header("Location: $returnto");
|
||||||
|
}
|
||||||
|
if ($action == 'new')
|
||||||
|
{
|
||||||
|
$sql = "SELECT *, IF(ADDTIME(added, '1 0:0:0') < NOW(),true,false) AS neednew FROM fun WHERE status != 'banned' AND status != 'dull' ORDER BY added DESC LIMIT 1";
|
||||||
|
$result = sql_query($sql) or sqlerr(__FILE__,__LINE__);
|
||||||
|
$row = mysql_fetch_array($result);
|
||||||
|
if ($row && !$row['neednew'])
|
||||||
|
stderr($lang_fun['std_error'],$lang_fun['std_the_newest_fun_item'].htmlspecialchars($row['title']).$lang_fun['std_posted_on'].$row['added'].$lang_fun['std_need_to_wait']);
|
||||||
|
else {
|
||||||
|
stdhead($lang_fun['head_new_fun']);
|
||||||
|
begin_main_frame();
|
||||||
|
$title = $lang_fun['text_submit_new_fun'];
|
||||||
|
print("<form id=compose method=post name=\"compose\" action=?action=add>\n");
|
||||||
|
begin_compose($title, 'new');
|
||||||
|
end_compose();
|
||||||
|
end_main_frame();
|
||||||
|
}
|
||||||
|
stdfoot();
|
||||||
|
}
|
||||||
|
if ($action == 'add')
|
||||||
|
{
|
||||||
|
$sql = "SELECT *, IF(ADDTIME(added, '1 0:0:0') < NOW(),true,false) AS neednew FROM fun WHERE status != 'banned' AND status != 'dull' ORDER BY added DESC LIMIT 1";
|
||||||
|
$result = sql_query($sql) or sqlerr(__FILE__,__LINE__);
|
||||||
|
$row = mysql_fetch_array($result);
|
||||||
|
if ($row && !$row['neednew'])
|
||||||
|
stderr($lang_fun['std_error'],$lang_fun['std_the_newest_fun_item'].htmlspecialchars($row['title']).$lang_fun['std_posted_on'].$row['added'].$lang_fun['std_need_to_wait']);
|
||||||
|
else {
|
||||||
|
$body = $_POST['body'];
|
||||||
|
if (!$body)
|
||||||
|
stderr($lang_fun['std_error'],$lang_fun['std_body_is_empty']);
|
||||||
|
$title = htmlspecialchars($_POST['subject']);
|
||||||
|
if (!$title)
|
||||||
|
stderr($lang_fun['std_error'],$lang_fun['std_title_is_empty']);
|
||||||
|
$sql = "INSERT INTO fun (userid, added, body, title, status) VALUES (".sqlesc($CURUSER['id']).",".sqlesc(date("Y-m-d H:i:s")).",".sqlesc($body).",".sqlesc($title).", 'normal')";
|
||||||
|
sql_query($sql) or sqlerr(__FILE__, __LINE__);
|
||||||
|
$Cache->delete_value('current_fun_content');
|
||||||
|
$Cache->delete_value('current_fun', true);
|
||||||
|
$Cache->delete_value('current_fun_vote_count');
|
||||||
|
$Cache->delete_value('current_fun_vote_funny_count');
|
||||||
|
if (mysql_affected_rows() == 1)
|
||||||
|
$warning = $lang_fun['std_fun_added_successfully'];
|
||||||
|
else
|
||||||
|
stderr($lang_fun['std_error'],$lang_fun['std_error_happened']);
|
||||||
|
header("Location: " . get_protocol_prefix() . "$BASEURL/index.php");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($action == 'view')
|
||||||
|
{
|
||||||
|
?>
|
||||||
|
<html><head>
|
||||||
|
<title><?php echo $lang_fun['head_fun']; ?></title>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link rel="stylesheet" href="<?php echo get_font_css_uri()?>" type="text/css">
|
||||||
|
<link rel="stylesheet" href="<?php echo get_css_uri()."theme.css"?>" type="text/css">
|
||||||
|
<link rel="stylesheet" href="styles/curtain_imageresizer.css" type="text/css">
|
||||||
|
<script src="curtain_imageresizer.js" type="text/javascript"></script><style type="text/css">body {overflow-y:scroll; overflow-x: hidden}</style>
|
||||||
|
</head><body class='inframe'>
|
||||||
|
<?php
|
||||||
|
print(get_style_addicode());
|
||||||
|
if (!$row = $Cache->get_value('current_fun_content')){
|
||||||
|
$result = sql_query("SELECT fun.*, IF(ADDTIME(added, '1 0:0:0') < NOW(),true,false) AS neednew FROM fun WHERE status != 'banned' AND status != 'dull' ORDER BY added DESC LIMIT 1") or sqlerr(__FILE__,__LINE__);
|
||||||
|
$row = mysql_fetch_array($result);
|
||||||
|
$Cache->cache_value('current_fun_content', $row, 1043);
|
||||||
|
}
|
||||||
|
if ($row){
|
||||||
|
$title = $row['title'];
|
||||||
|
$username = get_username($row["userid"],false,true,true,true,false,false,"",false);
|
||||||
|
if ($CURUSER['timetype'] != 'timealive')
|
||||||
|
$time = $lang_fun['text_on'].$row['added'];
|
||||||
|
else $time = $lang_fun['text_blank'].gettime($row['added'],true,false);
|
||||||
|
$Cache->new_page('current_fun', 874, true);
|
||||||
|
if (!$Cache->get_page()){
|
||||||
|
$Cache->add_row();
|
||||||
|
$Cache->add_part();
|
||||||
|
print("<table border=0 cellspacing=0 cellpadding=2 width='100%'><tr><td class=shoutrow align=center><font class=big>".$title."</font><font class=small>".$lang_fun['text_posted_by']);
|
||||||
|
$Cache->end_part();
|
||||||
|
$Cache->add_part();
|
||||||
|
print("</font></td></tr><tr><td class=shoutrow>\n");
|
||||||
|
print(format_comment($row['body'], true, true, true)."</td></tr></table>");
|
||||||
|
$Cache->end_part();
|
||||||
|
$Cache->end_row();
|
||||||
|
$Cache->cache_page();
|
||||||
|
}
|
||||||
|
while($Cache->next_row()){
|
||||||
|
echo $Cache->next_part();
|
||||||
|
print($username.$time);
|
||||||
|
echo $Cache->next_part();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print("</body></html>");
|
||||||
|
}
|
||||||
|
if ($action == 'edit'){
|
||||||
|
$id = 0+$_GET["id"];
|
||||||
|
int_check($id,true);
|
||||||
|
$res = sql_query("SELECT * FROM fun WHERE id=$id") or sqlerr(__FILE__,__LINE__);
|
||||||
|
$arr = mysql_fetch_array($res);
|
||||||
|
if (!$arr)
|
||||||
|
stderr($lang_fun['std_error'], $lang_fun['std_invalid_id']);
|
||||||
|
if ($arr["userid"] != $CURUSER["id"] && get_user_class() < $funmanage_class)
|
||||||
|
permissiondenied();
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] == 'POST')
|
||||||
|
{
|
||||||
|
$body = $_POST['body'];
|
||||||
|
|
||||||
|
if ($body == "")
|
||||||
|
stderr($lang_fun['std_error'],$lang_fun['std_body_is_empty']);
|
||||||
|
|
||||||
|
$title = htmlspecialchars($_POST['subject']);
|
||||||
|
|
||||||
|
if ($title == "")
|
||||||
|
stderr($lang_fun['std_error'],$lang_fun['std_title_is_empty']);
|
||||||
|
|
||||||
|
$body = sqlesc($body);
|
||||||
|
$title = sqlesc($title);
|
||||||
|
sql_query("UPDATE fun SET body=$body, title=$title WHERE id=".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
|
||||||
|
$Cache->delete_value('current_fun_content');
|
||||||
|
$Cache->delete_value('current_fun', true);
|
||||||
|
header("Location: " . get_protocol_prefix() . "$BASEURL/index.php");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
stdhead($lang_fun['head_edit_fun']);
|
||||||
|
begin_main_frame();
|
||||||
|
$title = $lang_fun['text_edit_fun'];
|
||||||
|
print("<form id=compose method=post name=\"compose\" action=?action=edit&id=".$id.">\n");
|
||||||
|
begin_compose($title, 'edit',$arr['body'], true, $arr['title']);
|
||||||
|
end_compose();
|
||||||
|
end_main_frame();
|
||||||
|
}
|
||||||
|
stdfoot();
|
||||||
|
}
|
||||||
|
if ($action == 'ban')
|
||||||
|
{
|
||||||
|
if (get_user_class() < $funmanage_class)
|
||||||
|
permissiondenied();
|
||||||
|
$id = 0+$_GET["id"];
|
||||||
|
int_check($id,true);
|
||||||
|
$res = sql_query("SELECT * FROM fun WHERE id=$id") or sqlerr(__FILE__,__LINE__);
|
||||||
|
$arr = mysql_fetch_array($res);
|
||||||
|
if (!$arr)
|
||||||
|
stderr($lang_fun['std_error'], $lang_fun['std_invalid_id']);
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] == 'POST')
|
||||||
|
{
|
||||||
|
$banreason = htmlspecialchars($_POST['banreason'],ENT_QUOTES);
|
||||||
|
$title = htmlspecialchars($arr['title']);
|
||||||
|
if ($banreason == "")
|
||||||
|
stderr($lang_fun['std_error'],$lang_fun['std_reason_is_empty']);
|
||||||
|
sql_query("UPDATE fun SET status='banned' WHERE id=".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
|
||||||
|
|
||||||
|
$Cache->delete_value('current_fun_content');
|
||||||
|
$Cache->delete_value('current_fun', true);
|
||||||
|
$Cache->delete_value('current_fun_vote_count');
|
||||||
|
$Cache->delete_value('current_fun_vote_funny_count');
|
||||||
|
|
||||||
|
$subject = $lang_fun_target[get_user_lang($arr[userid])]['msg_fun_item_banned'];
|
||||||
|
$msg = $lang_fun_target[get_user_lang($arr[userid])]['msg_your_fun_item'].$title.$lang_fun_target[get_user_lang($arr[userid])]['msg_is_ban_by'].$CURUSER['username'].$lang_fun_target[get_user_lang($arr[userid])]['msg_reason'].$banreason;
|
||||||
|
sql_query("INSERT INTO messages (sender, subject, receiver, added, msg) VALUES(0, ".sqlesc($subject).", ".$arr['userid'].", '" . date("Y-m-d H:i:s") . "', " . sqlesc($msg) . ")") or sqlerr(__FILE__, __LINE__);
|
||||||
|
$Cache->delete_value('user_'.$arr['userid'].'_unread_message_count');
|
||||||
|
$Cache->delete_value('user_'.$arr['userid'].'_inbox_count');
|
||||||
|
write_log("Fun item $id ($title) was banned by $CURUSER[username]. Reason: $banreason", 'normal');
|
||||||
|
stderr($lang_fun['std_success'], $lang_fun['std_fun_item_banned']);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
stderr($lang_fun['std_are_you_sure'], $lang_fun['std_only_against_rule']."<br /><form name=ban method=post action=fun.php?action=ban&id=".$id."><input type=hidden name=sure value=1>".$lang_fun['std_reason_required']."<input type=text style=\"width: 200px\" name=banreason><input type=submit value=".$lang_fun['submit_okay']."></form>", false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function funreward($funvote, $totalvote, $title, $posterid, $bonus)
|
||||||
|
{
|
||||||
|
global $lang_fun_target, $lang_fun;
|
||||||
|
KPS("+",$bonus,$posterid);
|
||||||
|
$subject = $lang_fun_target[get_user_lang($posterid)]['msg_fun_item_reward'];
|
||||||
|
$msg = $funvote.$lang_fun_target[get_user_lang($posterid)]['msg_out_of'].$totalvote.$lang_fun_target[get_user_lang($posterid)]['msg_people_think'].$title.$lang_fun_target[get_user_lang($posterid)]['msg_is_fun'].$bonus.$lang_fun_target[get_user_lang($posterid)]['msg_bonus_as_reward'];
|
||||||
|
$sql = "INSERT INTO messages (sender, subject, receiver, added, msg) VALUES(0, ".sqlesc($subject).",". $posterid. ",'" . date("Y-m-d H:i:s") . "', " . sqlesc($msg) . ")";
|
||||||
|
sql_query($sql) or sqlerr(__FILE__, __LINE__);
|
||||||
|
$Cache->delete_value('user_'.$posterid.'_unread_message_count');
|
||||||
|
$Cache->delete_value('user_'.$posterid.'_inbox_count');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action == 'vote')
|
||||||
|
{
|
||||||
|
$id = 0+$_GET["id"];
|
||||||
|
int_check($id,true);
|
||||||
|
$res = sql_query("SELECT * FROM fun WHERE id=$id") or sqlerr(__FILE__,__LINE__);
|
||||||
|
$arr = mysql_fetch_array($res);
|
||||||
|
if (!$arr)
|
||||||
|
stderr($lang_fun['std_error'], $lang_fun['std_invalid_id']);
|
||||||
|
else {
|
||||||
|
$res = sql_query("SELECT * FROM funvotes WHERE funid=$id AND userid = $CURUSER[id]") or sqlerr(__FILE__,__LINE__);
|
||||||
|
$checkvote = mysql_fetch_array($res);
|
||||||
|
if ($checkvote)
|
||||||
|
stderr($lang_fun['std_error'], $lang_fun['std_already_vote']);
|
||||||
|
else {
|
||||||
|
if ($_GET["yourvote"] == 'dull')
|
||||||
|
$vote = 'dull';
|
||||||
|
else $vote = 'fun';
|
||||||
|
$sql = "INSERT INTO funvotes (funid, userid, added, vote) VALUES (".sqlesc($id).",".$CURUSER['id'].",".sqlesc(date("Y-m-d H:i:s")).",".sqlesc($vote).")";
|
||||||
|
sql_query($sql) or sqlerr(__FILE__,__LINE__);
|
||||||
|
KPS("+",$funboxvote_bonus,$CURUSER['id']); //voter gets 1.0 bonus per vote
|
||||||
|
$totalvote = $Cache->get_value('current_fun_vote_count');
|
||||||
|
if ($totalvote == ""){
|
||||||
|
$totalvote = get_row_count("funvotes", "WHERE funid = ".sqlesc($row['id']));
|
||||||
|
}
|
||||||
|
else $totalvote++;
|
||||||
|
$Cache->cache_value('current_fun_vote_count', $totalvote, 756);
|
||||||
|
$funvote = $Cache->get_value('current_fun_vote_funny_count');
|
||||||
|
if ($funvote == ""){
|
||||||
|
$funvote = get_row_count("funvotes", "WHERE funid = ".sqlesc($row['id'])." AND vote='fun'");
|
||||||
|
}
|
||||||
|
elseif($vote == 'fun')
|
||||||
|
$funvote++;
|
||||||
|
$Cache->cache_value('current_fun_vote_funny_count', $funvote, 756);
|
||||||
|
if ($totalvote) $ratio = $funvote / $totalvote; else $ratio = 1;
|
||||||
|
if ($totalvote >= 20){
|
||||||
|
if ($ratio > 0.75){
|
||||||
|
sql_query("UPDATE fun SET status = 'veryfunny' WHERE id = ".sqlesc($id));
|
||||||
|
if ($totalvote == 25) //Give fun item poster some bonus and write a message to him
|
||||||
|
funreward($funvote, $totalvote, $arr['title'], $arr['userid'], $funboxreward_bonus * 2);
|
||||||
|
if ($totalvote == 50)
|
||||||
|
funreward($funvote, $totalvote, $arr['title'], $arr['userid'], $funboxreward_bonus * 2);
|
||||||
|
if ($totalvote == 100)
|
||||||
|
funreward($funvote, $totalvote, $arr['title'], $arr['userid'], $funboxreward_bonus * 2);
|
||||||
|
if ($totalvote == 200)
|
||||||
|
funreward($funvote, $totalvote, $arr['title'], $arr['userid'], $funboxreward_bonus * 2);
|
||||||
|
}
|
||||||
|
elseif ($ratio > 0.5){
|
||||||
|
sql_query("UPDATE fun SET status = 'funny' WHERE id = ".sqlesc($id));
|
||||||
|
if ($totalvote == 25) //Give fun item poster some bonus and write a message to him
|
||||||
|
funreward($funvote, $totalvote, $arr['id'], $arr['userid'], $funboxreward_bonus);
|
||||||
|
if ($totalvote == 50)
|
||||||
|
funreward($funvote, $totalvote, $arr['id'], $arr['userid'], $funboxreward_bonus);
|
||||||
|
if ($totalvote == 100)
|
||||||
|
funreward($funvote, $totalvote, $arr['id'], $arr['userid'], $funboxreward_bonus);
|
||||||
|
if ($totalvote == 200)
|
||||||
|
funreward($funvote, $totalvote, $arr['id'], $arr['userid'], $funboxreward_bonus);
|
||||||
|
}
|
||||||
|
elseif ($ratio > 0.25){
|
||||||
|
sql_query("UPDATE fun SET status = 'notfunny' WHERE id = ".sqlesc($id));
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
sql_query("UPDATE fun SET status = 'dull' WHERE id = ".sqlesc($id));
|
||||||
|
//write a message to fun item poster
|
||||||
|
$subject = $lang_fun_target[get_user_lang($arr['userid'])]['msg_fun_item_dull'];
|
||||||
|
$msg = ($totalvote - $funvote).$lang_fun_target[get_user_lang($arr['userid'])]['msg_out_of'].$totalvote.$lang_fun_target[get_user_lang($arr['userid'])]['msg_people_think'].$arr['title'].$lang_fun_target[get_user_lang($arr['userid'])]['msg_is_dull'];
|
||||||
|
$sql = "INSERT INTO messages (sender, subject, receiver, added, msg) VALUES(0, ".sqlesc($subject).",". $arr['userid'].", '" . date("Y-m-d H:i:s") . "', " . sqlesc($msg) . ")";
|
||||||
|
sql_query($sql) or sqlerr(__FILE__, __LINE__);
|
||||||
|
$Cache->delete_value('user_'.$arr['userid'].'_unread_message_count');
|
||||||
|
$Cache->delete_value('user_'.$arr['userid'].'_inbox_count');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
57
getattachment.php
Normal file
57
getattachment.php
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
require_once("include/bittorrent.php");
|
||||||
|
dbconn();
|
||||||
|
loggedinorreturn();
|
||||||
|
parked();
|
||||||
|
$id = (int)$_GET["id"];
|
||||||
|
|
||||||
|
if (!$id)
|
||||||
|
die('Invalid id.');
|
||||||
|
$dlkey = $_GET["dlkey"];
|
||||||
|
|
||||||
|
if (!$dlkey)
|
||||||
|
die('Invalid key');
|
||||||
|
$res = sql_query("SELECT * FROM attachments WHERE id = ".sqlesc($id)." AND dlkey = ".sqlesc($dlkey)." LIMIT 1") or sqlerr(__FILE__, __LINE__);
|
||||||
|
$row = mysql_fetch_assoc($res);
|
||||||
|
if (!$row)
|
||||||
|
die('No attachment found.');
|
||||||
|
$filelocation = $httpdirectory_attachment."/".$row['location'];
|
||||||
|
if (!is_file($filelocation) || !is_readable($filelocation))
|
||||||
|
die('File not found or cannot be read.');
|
||||||
|
$f = fopen($filelocation, "rb");
|
||||||
|
if (!$f)
|
||||||
|
die("Cannot open file");
|
||||||
|
|
||||||
|
header("Content-Length: " . $row['filesize']);
|
||||||
|
header("Content-Type: application/octet-stream");
|
||||||
|
|
||||||
|
if ( str_replace("Gecko", "", $_SERVER['HTTP_USER_AGENT']) != $_SERVER['HTTP_USER_AGENT'])
|
||||||
|
{
|
||||||
|
header ("Content-Disposition: attachment; filename=\"$row[filename]\" ; charset=utf-8");
|
||||||
|
}
|
||||||
|
else if ( str_replace("Firefox", "", $_SERVER['HTTP_USER_AGENT']) != $_SERVER['HTTP_USER_AGENT'] )
|
||||||
|
{
|
||||||
|
header ("Content-Disposition: attachment; filename=\"$row[filename]\" ; charset=utf-8");
|
||||||
|
}
|
||||||
|
else if ( str_replace("Opera", "", $_SERVER['HTTP_USER_AGENT']) != $_SERVER['HTTP_USER_AGENT'] )
|
||||||
|
{
|
||||||
|
header ("Content-Disposition: attachment; filename=\"$row[filename]\" ; charset=utf-8");
|
||||||
|
}
|
||||||
|
else if ( str_replace("IE", "", $_SERVER['HTTP_USER_AGENT']) != $_SERVER['HTTP_USER_AGENT'] )
|
||||||
|
{
|
||||||
|
header ("Content-Disposition: attachment; filename=".str_replace("+", "%20", rawurlencode($row[filename])));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
header ("Content-Disposition: attachment; filename=".str_replace("+", "%20", rawurlencode($row[filename])));
|
||||||
|
}
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
$s = fread($f, 4096);
|
||||||
|
print($s);
|
||||||
|
} while (!feof($f));
|
||||||
|
sql_query("UPDATE attachments SET downloads = downloads + 1 WHERE id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
|
||||||
|
$Cache->delete_value('attachment_'.$dlkey.'_content');
|
||||||
|
exit;
|
||||||
|
?>
|
||||||
27
getextinfoajax.php
Normal file
27
getextinfoajax.php
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
require_once ("imdb/imdb.class.php");
|
||||||
|
dbconn();
|
||||||
|
//Send some headers to keep the user's browser from caching the response.
|
||||||
|
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
|
||||||
|
header("Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" );
|
||||||
|
header("Cache-Control: no-cache, must-revalidate" );
|
||||||
|
header("Pragma: no-cache" );
|
||||||
|
header("Content-Type: text/xml; charset=utf-8");
|
||||||
|
$imdblink = $_GET['url'];
|
||||||
|
$mode = $_GET['type'];
|
||||||
|
$cache_stamp = $_GET['cache'];
|
||||||
|
$imdb_id = parse_imdb_id($imdblink);
|
||||||
|
$Cache->new_page('imdb_id_'.$imdb_id.'_'.$mode, 1296000, true);
|
||||||
|
if (!$Cache->get_page()){
|
||||||
|
$infoblock = getimdb($imdb_id, $cache_stamp, $mode);
|
||||||
|
if ($infoblock){
|
||||||
|
$Cache->add_whole_row();
|
||||||
|
print($infoblock);
|
||||||
|
$Cache->end_whole_row();
|
||||||
|
$Cache->cache_page();
|
||||||
|
echo $Cache->next_row();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else echo $Cache->next_row();
|
||||||
|
?>
|
||||||
343
getrss.php
Normal file
343
getrss.php
Normal file
@@ -0,0 +1,343 @@
|
|||||||
|
<?php
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
require_once(get_langfile_path());
|
||||||
|
loggedinorreturn();
|
||||||
|
|
||||||
|
$brsectiontype = $browsecatmode;
|
||||||
|
$spsectiontype = $specialcatmode;
|
||||||
|
if ($enablespecial == 'yes')
|
||||||
|
$allowspecial = true;
|
||||||
|
else $allowspecial = false;
|
||||||
|
$showsubcat = (get_searchbox_value($brsectiontype, 'showsubcat') || ($allowspecial && get_searchbox_value($spsectiontype, 'showsubcat')));
|
||||||
|
$showsource = (get_searchbox_value($brsectiontype, 'showsource') || ($allowspecial && get_searchbox_value($spsectiontype, 'showsource'))); //whether show sources or not
|
||||||
|
$showmedium = (get_searchbox_value($brsectiontype, 'showmedium') || ($allowspecial && get_searchbox_value($spsectiontype, 'showmedium'))); //whether show media or not
|
||||||
|
$showcodec = (get_searchbox_value($brsectiontype, 'showcodec') || ($allowspecial && get_searchbox_value($spsectiontype, 'showcodec'))); //whether show codecs or not
|
||||||
|
$showstandard = (get_searchbox_value($brsectiontype, 'showstandard') || ($allowspecial && get_searchbox_value($spsectiontype, 'showstandard'))); //whether show standards or not
|
||||||
|
$showprocessing = (get_searchbox_value($brsectiontype, 'showprocessing') || ($allowspecial && get_searchbox_value($spsectiontype, 'showprocessing'))); //whether show processings or not
|
||||||
|
$showteam = (get_searchbox_value($brsectiontype, 'showteam') || ($allowspecial && get_searchbox_value($spsectiontype, 'showteam'))); //whether show teams or not
|
||||||
|
$showaudiocodec = (get_searchbox_value($brsectiontype, 'showaudiocodec') || ($allowspecial && get_searchbox_value($spsectiontype, 'showaudiocodec'))); //whether show audio codecs or not
|
||||||
|
$brcatsperror = get_searchbox_value($brsectiontype, 'catsperrow');
|
||||||
|
$catsperrow = get_searchbox_value($spsectiontype, 'catsperrow');
|
||||||
|
$catsperrow = (!$allowspecial ? $brcatsperror : ($catsperrow > $catsperrow ? $catsperrow : $catsperrow)); //show how many cats per line
|
||||||
|
|
||||||
|
$brcatpadding = get_searchbox_value($brsectiontype, 'catpadding');
|
||||||
|
$spcatpadding = get_searchbox_value($spsectiontype, 'catpadding');
|
||||||
|
$catpadding = (!$allowspecial ? $brcatpadding : ($brcatpadding < $spcatpadding ? $brcatpadding : $spcatpadding)); //padding space between categories in pixel
|
||||||
|
|
||||||
|
$brcats = genrelist($brsectiontype);
|
||||||
|
$spcats = genrelist($spsectiontype);
|
||||||
|
|
||||||
|
if ($showsubcat){
|
||||||
|
if ($showsource) $sources = searchbox_item_list("sources");
|
||||||
|
if ($showmedium) $media = searchbox_item_list("media");
|
||||||
|
if ($showcodec) $codecs = searchbox_item_list("codecs");
|
||||||
|
if ($showstandard) $standards = searchbox_item_list("standards");
|
||||||
|
if ($showprocessing) $processings = searchbox_item_list("processings");
|
||||||
|
if ($showteam) $teams = searchbox_item_list("teams");
|
||||||
|
if ($showaudiocodec) $audiocodecs = searchbox_item_list("audiocodecs");
|
||||||
|
}
|
||||||
|
stdhead($lang_getrss['head_rss_feeds']);
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] == "POST") {
|
||||||
|
$allowed_showrows=array('10','20','30','40','50');
|
||||||
|
$link = get_protocol_prefix(). $BASEURL ."/torrentrss.php";
|
||||||
|
if (isset($_POST['showrows']) && in_array($_POST['showrows'], $allowed_showrows, 1))
|
||||||
|
$query[] = "rows=".(int)$_POST['showrows'];
|
||||||
|
else {
|
||||||
|
stdmsg($lang_getrss['std_error'],$lang_getrss['std_no_row']);
|
||||||
|
stdfoot();
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
foreach ($brcats as $cat)
|
||||||
|
{
|
||||||
|
if ($_POST["cat$cat[id]"])
|
||||||
|
{
|
||||||
|
$query[] = "cat$cat[id]=1";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($enablespecial == 'yes')
|
||||||
|
{
|
||||||
|
foreach ($spcats as $cat)
|
||||||
|
{
|
||||||
|
if ($_POST["cat$cat[id]"])
|
||||||
|
{
|
||||||
|
$query[] = "cat$cat[id]=1";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($showsubcat){
|
||||||
|
if ($showsource)
|
||||||
|
foreach ($sources as $source)
|
||||||
|
{
|
||||||
|
if ($_POST["sou$source[id]"])
|
||||||
|
{
|
||||||
|
$query[] = "sou$source[id]=1";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($showmedium)
|
||||||
|
foreach ($media as $medium)
|
||||||
|
{
|
||||||
|
if ($_POST["med$medium[id]"])
|
||||||
|
{
|
||||||
|
$query[] = "med$medium[id]=1";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($showcodec)
|
||||||
|
foreach ($codecs as $codec)
|
||||||
|
{
|
||||||
|
if ($_POST["cod$codec[id]"])
|
||||||
|
{
|
||||||
|
$query[] = "cod$codec[id]=1";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($showstandard)
|
||||||
|
foreach ($standards as $standard)
|
||||||
|
{
|
||||||
|
if ($_POST["sta$standard[id]"])
|
||||||
|
{
|
||||||
|
$query[] = "sta$standard[id]=1";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($showprocessing)
|
||||||
|
foreach ($processings as $processing)
|
||||||
|
{
|
||||||
|
if ($_POST["pro$processing[id]"])
|
||||||
|
{
|
||||||
|
$query[] = "pro$processing[id]=1";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($showteam)
|
||||||
|
foreach ($teams as $team)
|
||||||
|
{
|
||||||
|
if ($_POST["tea$team[id]"])
|
||||||
|
{
|
||||||
|
$query[] = "tea$team[id]=1";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($showaudiocodec)
|
||||||
|
foreach ($audiocodecs as $audiocodec)
|
||||||
|
{
|
||||||
|
if ($_POST["aud$audiocodec[id]"])
|
||||||
|
{
|
||||||
|
$query[] = "aud$audiocodec[id]=1";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($_POST["itemcategory"])
|
||||||
|
{
|
||||||
|
$query[] = "icat=1";
|
||||||
|
}
|
||||||
|
if ($_POST["itemsmalldescr"])
|
||||||
|
{
|
||||||
|
$query[] = "ismalldescr=1";
|
||||||
|
}
|
||||||
|
if ($_POST["itemsize"])
|
||||||
|
{
|
||||||
|
$query[] = "isize=1";
|
||||||
|
}
|
||||||
|
if ($_POST["itemuploader"])
|
||||||
|
{
|
||||||
|
$query[] = "iuplder=1";
|
||||||
|
}
|
||||||
|
$searchstr = mysql_real_escape_string(trim($_POST["search"]));
|
||||||
|
if (empty($searchstr))
|
||||||
|
unset($searchstr);
|
||||||
|
if ($searchstr)
|
||||||
|
{
|
||||||
|
$query[] = "search=".rawurlencode($searchstr);
|
||||||
|
if ($_POST["search_mode"]){
|
||||||
|
$search_mode = 0 + $_POST["search_mode"];
|
||||||
|
if (!in_array($search_mode,array(0,1,2)))
|
||||||
|
{
|
||||||
|
$search_mode = 0;
|
||||||
|
}
|
||||||
|
$query[] = "search_mode=".$search_mode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$inclbookmarked=0+$_POST['inclbookmarked'];
|
||||||
|
if($inclbookmarked)
|
||||||
|
{
|
||||||
|
if (!in_array($inclbookmarked,array(0,1)))
|
||||||
|
{
|
||||||
|
$inclbookmarked = 0;
|
||||||
|
}
|
||||||
|
$addinclbm = "&inclbookmarked=".$inclbookmarked;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$addinclbm="";
|
||||||
|
}
|
||||||
|
$queries = implode("&", $query);
|
||||||
|
if ($queries)
|
||||||
|
$link .= "?".$queries;
|
||||||
|
$msg = $lang_getrss['std_use_following_url'] ."\n".$link."\n\n".$lang_getrss['std_utorrent_feed_url']."\n".$link."&linktype=dl&passkey=".$CURUSER['passkey'].$addinclbm;
|
||||||
|
stdmsg($lang_getrss['std_done'],format_comment($msg));
|
||||||
|
stdfoot();
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<h1 align="center"><?php echo $lang_getrss['text_rss_feeds']?></h1>
|
||||||
|
<form method="post" action="getrss.php">
|
||||||
|
<table cellspacing="1" cellpadding="5" width="940">
|
||||||
|
<tr>
|
||||||
|
<td class="rowhead"><?php echo $lang_getrss['row_categories_to_retrieve']?>
|
||||||
|
</td>
|
||||||
|
<td class="rowfollow" align="left">
|
||||||
|
<?php
|
||||||
|
$categories = "<table><tr><td class=\"embedded\" align=\"left\"><b>".$lang_getrss['text_category']."</b></td></tr><tr>";
|
||||||
|
$i = 0;
|
||||||
|
foreach ($brcats as $cat)//print category list of Torrents section
|
||||||
|
{
|
||||||
|
$numinrow = $i % $catsperrow;
|
||||||
|
$rownum = (int)($i / $catsperrow);
|
||||||
|
if ($i && $numinrow == 0){
|
||||||
|
$categories .= "</tr>".($brenablecatrow ? "<tr><td class=\"embedded\" align=\"left\"><b>".$brcatrow[$rownum]."</b></td></tr>" : "")."<tr>";
|
||||||
|
}
|
||||||
|
$categories .= "<td align=\"left\" class=\"bottom\" style=\"padding-bottom: 4px;padding-left: ".$catpadding."px\"><input name=\"cat".$cat[id]."\" type=\"checkbox\" " . (strpos($CURUSER['notifs'], "[cat".$cat[id]."]") !== false ? " checked=\"checked\"" : "")." value='yes' />".return_category_image($cat['id'], "torrents.php?allsec=1&")."</td>\n";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
$categories .= "</tr>";
|
||||||
|
if ($allowspecial) //print category list of Special section
|
||||||
|
{
|
||||||
|
$categories .= "<tr>";
|
||||||
|
$i = 0;
|
||||||
|
foreach ($spcats as $cat)
|
||||||
|
{
|
||||||
|
$numinrow = $i % $catsperrow;
|
||||||
|
$rownum = (int)($i / $catsperrow);
|
||||||
|
if ($i && $numinrow == 0){
|
||||||
|
$categories .= "</tr>".($spenablecatrow ? "<tr><td class=\"embedded\" align=\"left\"><b>".$spcatrow[$rownum]."</b></td></tr>" : "")."<tr>";
|
||||||
|
}
|
||||||
|
$categories .= "<td align=\"left\" class=\"bottom\" style=\"padding-bottom: 4px;padding-left: ".$catpadding."px\"><input name=\"cat".$cat[id]."\" type=\"checkbox\" " . (strpos($CURUSER['notifs'], "[cat".$cat[id]."]") !== false ? " checked=\"checked\"" : "")." value='yes' />".return_category_image($cat['id'], "torrents.php?allsec=1&")."</td>\n";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
$categories .= "</tr>";
|
||||||
|
}
|
||||||
|
if ($showsubcat)//Show subcategory (i.e. source, codecs) selections
|
||||||
|
{
|
||||||
|
if ($showsource){
|
||||||
|
$categories .= "<tr><td class=\"embedded\" align=\"left\"><b>".$lang_getrss['text_source']."</b></td></tr><tr>";
|
||||||
|
$i = 0;
|
||||||
|
foreach ($sources as $source)
|
||||||
|
{
|
||||||
|
$categories .= ($i && $i % $catsperrow == 0) ? "</tr><tr>" : "";
|
||||||
|
$categories .= "<td align=\"left\" class=\"bottom\" style=\"padding-bottom: 4px;padding-left: ".$catpadding."px\"><input name=\"sou".$source[id]."\" type=\"checkbox\" " . (strpos($CURUSER['notifs'], "[sou".$source[id]."]") !== false ? " checked=\"checked\"" : "") . " value='yes' />".$source[name]."</td>\n";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
$categories .= "</tr>";
|
||||||
|
}
|
||||||
|
if ($showmedium){
|
||||||
|
$categories .= "<tr><td class=\"embedded\" align=\"left\"><b>".$lang_getrss['text_medium']."</b></td></tr><tr>";
|
||||||
|
$i = 0;
|
||||||
|
foreach ($media as $medium)
|
||||||
|
{
|
||||||
|
$categories .= ($i && $i % $catsperrow == 0) ? "</tr><tr>" : "";
|
||||||
|
$categories .= "<td align=\"left\" class=\"bottom\" style=\"padding-bottom: 4px;padding-left: ".$catpadding."px\"><input name=\"med".$medium[id]."\" type=\"checkbox\" " . (strpos($CURUSER['notifs'], "[med".$medium[id]."]") !== false ? " checked=\"checked\"" : "") . " value='yes' />".$medium[name]."</td>\n";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
$categories .= "</tr>";
|
||||||
|
}
|
||||||
|
if ($showcodec){
|
||||||
|
$categories .= "<tr><td class=\"embedded\" align=\"left\"><b>".$lang_getrss['text_codec']."</b></td></tr><tr>";
|
||||||
|
$i = 0;
|
||||||
|
foreach ($codecs as $codec)
|
||||||
|
{
|
||||||
|
$categories .= ($i && $i % $catsperrow == 0) ? "</tr><tr>" : "";
|
||||||
|
$categories .= "<td align=\"left\" class=\"bottom\" style=\"padding-bottom: 4px;padding-left: ".$catpadding."px\"><input name=\"cod".$codec[id]."\" type=\"checkbox\" " . (strpos($CURUSER['notifs'], "[cod".$codec[id]."]") !== false ? " checked=\"checked\"" : "") . " value='yes' />".$codec[name]."</td>\n";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
$categories .= "</tr>";
|
||||||
|
}
|
||||||
|
if ($showaudiocodec){
|
||||||
|
$categories .= "<tr><td class=\"embedded\" align=\"left\"><b>".$lang_getrss['text_audio_codec']."</b></td></tr><tr>";
|
||||||
|
$i = 0;
|
||||||
|
foreach ($audiocodecs as $audiocodec)
|
||||||
|
{
|
||||||
|
$categories .= ($i && $i % $catsperrow == 0) ? "</tr><tr>" : "";
|
||||||
|
$categories .= "<td align=\"left\" class=\"bottom\" style=\"padding-bottom: 4px;padding-left: ".$catpadding."px\"><input name=\"aud".$audiocodec[id]."\" type=\"checkbox\" " . (strpos($CURUSER['notifs'], "[aud".$audiocodec[id]."]") !== false ? " checked=\"checked\"" : "") . " value='yes' />".$audiocodec[name]."</td>\n";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
$categories .= "</tr>";
|
||||||
|
}
|
||||||
|
if ($showstandard){
|
||||||
|
$categories .= "<tr><td class=\"embedded\" align=\"left\"><b>".$lang_getrss['text_standard']."</b></td></tr><tr>";
|
||||||
|
$i = 0;
|
||||||
|
foreach ($standards as $standard)
|
||||||
|
{
|
||||||
|
$categories .= ($i && $i % $catsperrow == 0) ? "</tr><tr>" : "";
|
||||||
|
$categories .= "<td align=\"left\" class=\"bottom\" style=\"padding-bottom: 4px;padding-left: ".$catpadding."px\"><input name=\"sta".$standard[id]."\" type=\"checkbox\" " . (strpos($CURUSER['notifs'], "[sta".$standard[id]."]") !== false ? " checked=\"checked\"" : "") . " value='yes' />".$standard[name]."</td>\n";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
$categories .= "</tr>";
|
||||||
|
}
|
||||||
|
if ($showprocessing){
|
||||||
|
$categories .= "<tr><td class=\"embedded\" align=\"left\"><b>".$lang_getrss['text_processing']."</b></td></tr><tr>";
|
||||||
|
$i = 0;
|
||||||
|
foreach ($processings as $processing)
|
||||||
|
{
|
||||||
|
$categories .= ($i && $i % $catsperrow == 0) ? "</tr><tr>" : "";
|
||||||
|
$categories .= "<td align=\"left\" class=\"bottom\" style=\"padding-bottom: 4px;padding-left: ".$catpadding."px\"><input name=\"pro".$processing[id]."\" type=\"checkbox\" " . (strpos($CURUSER['notifs'], "[pro".$processing[id]."]") !== false ? " checked=\"checked\"" : "") . " value='yes' />".$processing[name]."</td>\n";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
$categories .= "</tr>";
|
||||||
|
}
|
||||||
|
if ($showteam){
|
||||||
|
$categories .= "<tr><td class=\"embedded\" align=\"left\"><b>".$lang_getrss['text_team']."</b></td></tr><tr>";
|
||||||
|
$i = 0;
|
||||||
|
foreach ($teams as $team)
|
||||||
|
{
|
||||||
|
$categories .= ($i && $i % $catsperrow == 0) ? "</tr><tr>" : "";
|
||||||
|
$categories .= "<td align=\"left\" class=\"bottom\" style=\"padding-bottom: 4px;padding-left: ".$catpadding."px\"><input name=\"tea".$team[id]."\" type=\"checkbox\" " . (strpos($CURUSER['notifs'], "[tea".$team[id]."]") !== false ? " checked=\"checked\"" : "") . " value='yes' />".$team[name]."</td>\n";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
$categories .= "</tr>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$categories .= "</table>";
|
||||||
|
print($categories);
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="rowhead"><?php echo $lang_getrss['row_show_bookmarked']?>
|
||||||
|
</td>
|
||||||
|
<td class="rowfollow" align="left">
|
||||||
|
<input type="radio" name="inclbookmarked" id="inclbookmarked0" value="0" checked="checked" /><label for="inclbookmarked0"><?php echo $lang_getrss['text_all']?></label> <input type="radio" name="inclbookmarked" id="inclbookmarked1" value="1" /><label for="inclbookmarked1"><?php echo $lang_getrss['text_only_bookmarked']?></label><div><?php echo $lang_getrss['text_show_bookmarked_note']?></div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="rowhead"><?php echo $lang_getrss['row_item_title_type']?>
|
||||||
|
</td>
|
||||||
|
<td class="rowfollow" align="left">
|
||||||
|
<input type="checkbox" name="itemcategory" value="1" /><?php echo $lang_getrss['text_item_category']?> <input type="checkbox" name="itemtitle" checked="checked" disabled="disabled" /><?php echo $lang_getrss['text_item_title']?> <input type="checkbox" name="itemsmalldescr" value="1" /><?php echo $lang_getrss['text_item_small_description']?> <input type="checkbox" name="itemsize" value="1" /><?php echo $lang_getrss['text_item_size']?> <input type="checkbox" name="itemuploader" value="1" /><?php echo $lang_getrss['text_item_uploader']?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td class="rowhead"><?php echo $lang_getrss['row_rows_per_page']?></td><td class="rowfollow" align="left"><select name="showrows">
|
||||||
|
<option value="10">10</option>
|
||||||
|
<option value="20">20</option>
|
||||||
|
<option value="30">30</option>
|
||||||
|
<option value="40">40</option>
|
||||||
|
<option value="50">50</option>
|
||||||
|
</select></td></tr>
|
||||||
|
<tr><td class="rowhead"><?php echo $lang_getrss['row_keyword']?></td>
|
||||||
|
<td class="rowfollow" align="left">
|
||||||
|
<input type="text" name="search" style="width: 200px;" /> <?php echo $lang_getrss['text_with']?>
|
||||||
|
<select name="search_mode" style="width: 60px;">
|
||||||
|
<option value="0"><?php echo $lang_getrss['select_and'] ?></option>
|
||||||
|
<option value="1" selected="selected"><?php echo $lang_getrss['select_or'] ?></option>
|
||||||
|
<option value="2"><?php echo $lang_getrss['select_exact'] ?></option>
|
||||||
|
</select>
|
||||||
|
<?php echo $lang_getrss['text_mode']?>
|
||||||
|
<div><?php echo $lang_getrss['text_keyword_note'] ?></div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2" align="center">
|
||||||
|
<input type="submit" value="<?php echo $lang_getrss['submit_generatte_rss_link']?>" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
<?php
|
||||||
|
stdfoot();
|
||||||
241
getusertorrentlistajax.php
Normal file
241
getusertorrentlistajax.php
Normal file
@@ -0,0 +1,241 @@
|
|||||||
|
<?php
|
||||||
|
require "include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
require_once(get_langfile_path());
|
||||||
|
//Send some headers to keep the user's browser from caching the response.
|
||||||
|
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
|
||||||
|
header("Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" );
|
||||||
|
header("Cache-Control: no-cache, must-revalidate" );
|
||||||
|
header("Pragma: no-cache" );
|
||||||
|
header("Content-Type: text/xml; charset=utf-8");
|
||||||
|
function maketable($res, $mode = 'seeding')
|
||||||
|
{
|
||||||
|
global $lang_getusertorrentlistajax,$CURUSER,$smalldescription_main;
|
||||||
|
switch ($mode)
|
||||||
|
{
|
||||||
|
case 'uploaded': {
|
||||||
|
$showsize = true;
|
||||||
|
$showsenum = true;
|
||||||
|
$showlenum = true;
|
||||||
|
$showuploaded = true;
|
||||||
|
$showdownloaded = false;
|
||||||
|
$showratio = false;
|
||||||
|
$showsetime = true;
|
||||||
|
$showletime = false;
|
||||||
|
$showcotime = false;
|
||||||
|
$showanonymous = true;
|
||||||
|
$columncount = 8;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'seeding': {
|
||||||
|
$showsize = true;
|
||||||
|
$showsenum = true;
|
||||||
|
$showlenum = true;
|
||||||
|
$showuploaded = true;
|
||||||
|
$showdownloaded = true;
|
||||||
|
$showratio = true;
|
||||||
|
$showsetime = false;
|
||||||
|
$showletime = false;
|
||||||
|
$showcotime = false;
|
||||||
|
$showanonymous = false;
|
||||||
|
$columncount = 8;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'leeching': {
|
||||||
|
$showsize = true;
|
||||||
|
$showsenum = true;
|
||||||
|
$showlenum = true;
|
||||||
|
$showuploaded = true;
|
||||||
|
$showdownloaded = true;
|
||||||
|
$showratio = true;
|
||||||
|
$showsetime = false;
|
||||||
|
$showletime = false;
|
||||||
|
$showcotime = false;
|
||||||
|
$showanonymous = false;
|
||||||
|
$columncount = 8;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'completed': {
|
||||||
|
$showsize = false;
|
||||||
|
$showsenum = false;
|
||||||
|
$showlenum = false;
|
||||||
|
$showuploaded = true;
|
||||||
|
$showdownloaded = false;
|
||||||
|
$showratio = false;
|
||||||
|
$showsetime = true;
|
||||||
|
$showletime = true;
|
||||||
|
$showcotime = true;
|
||||||
|
$showanonymous = false;
|
||||||
|
$columncount = 8;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'incomplete': {
|
||||||
|
$showsize = false;
|
||||||
|
$showsenum = false;
|
||||||
|
$showlenum = false;
|
||||||
|
$showuploaded = true;
|
||||||
|
$showdownloaded = true;
|
||||||
|
$showratio = true;
|
||||||
|
$showsetime = false;
|
||||||
|
$showletime = true;
|
||||||
|
$showcotime = false;
|
||||||
|
$showanonymous = false;
|
||||||
|
$columncount = 7;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
$ret = "<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\" width=\"800\"><tr><td class=\"colhead\" style=\"padding: 0px\">".$lang_getusertorrentlistajax['col_type']."</td><td class=\"colhead\" align=\"center\">".$lang_getusertorrentlistajax['col_name']."</td>".
|
||||||
|
($showsize ? "<td class=\"colhead\" align=\"center\"><img class=\"size\" src=\"pic/trans.gif\" alt=\"size\" title=\"".$lang_getusertorrentlistajax['title_size']."\" /></td>" : "").($showsenum ? "<td class=\"colhead\" align=\"center\"><img class=\"seeders\" src=\"pic/trans.gif\" alt=\"seeders\" title=\"".$lang_getusertorrentlistajax['title_seeders']."\" /></td>" : "").($showlenum ? "<td class=\"colhead\" align=\"center\"><img class=\"leechers\" src=\"pic/trans.gif\" alt=\"leechers\" title=\"".$lang_getusertorrentlistajax['title_leechers']."\" /></td>" : "").($showuploaded ? "<td class=\"colhead\" align=\"center\">".$lang_getusertorrentlistajax['col_uploaded']."</td>" : "") . ($showdownloaded ? "<td class=\"colhead\" align=\"center\">".$lang_getusertorrentlistajax['col_downloaded']."</td>" : "").($showratio ? "<td class=\"colhead\" align=\"center\">".$lang_getusertorrentlistajax['col_ratio']."</td>" : "").($showsetime ? "<td class=\"colhead\" align=\"center\">".$lang_getusertorrentlistajax['col_se_time']."</td>" : "").($showletime ? "<td class=\"colhead\" align=\"center\">".$lang_getusertorrentlistajax['col_le_time']."</td>" : "").($showcotime ? "<td class=\"colhead\" align=\"center\">".$lang_getusertorrentlistajax['col_time_completed']."</td>" : "").($showanonymous ? "<td class=\"colhead\" align=\"center\">".$lang_getusertorrentlistajax['col_anonymous']."</td>" : "")."</tr>\n";
|
||||||
|
while ($arr = mysql_fetch_assoc($res))
|
||||||
|
{
|
||||||
|
$catimage = htmlspecialchars($arr["image"]);
|
||||||
|
$catname = htmlspecialchars($arr["catname"]);
|
||||||
|
|
||||||
|
$sphighlight = get_torrent_bg_color($arr['sp_state']);
|
||||||
|
$sp_torrent = get_torrent_promotion_append($arr['sp_state']);
|
||||||
|
|
||||||
|
//torrent name
|
||||||
|
$dispname = $nametitle = htmlspecialchars($arr["torrentname"]);
|
||||||
|
$count_dispname=mb_strlen($dispname,"UTF-8");
|
||||||
|
$max_lenght_of_torrent_name=($CURUSER['fontsize'] == 'large' ? 70 : 80);
|
||||||
|
if($count_dispname > $max_lenght_of_torrent_name)
|
||||||
|
$dispname=mb_substr($dispname, 0, $max_lenght_of_torrent_name,"UTF-8") . "..";
|
||||||
|
if ($smalldescription_main == 'yes'){
|
||||||
|
//small description
|
||||||
|
$dissmall_descr = htmlspecialchars(trim($arr["small_descr"]));
|
||||||
|
$count_dissmall_descr=mb_strlen($dissmall_descr,"UTF-8");
|
||||||
|
$max_lenght_of_small_descr=80; // maximum length
|
||||||
|
if($count_dissmall_descr > $max_lenght_of_small_descr)
|
||||||
|
{
|
||||||
|
$dissmall_descr=mb_substr($dissmall_descr, 0, $max_lenght_of_small_descr,"UTF-8") . "..";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else $dissmall_descr == "";
|
||||||
|
$ret .= "<tr" . $sphighlight . "><td class=\"rowfollow nowrap\" valign=\"middle\" style='padding: 0px'>".return_category_image($arr['category'], "torrents.php?allsec=1&")."</td>\n" .
|
||||||
|
"<td class=\"rowfollow\" width=\"100%\" align=\"left\"><a href=\"".htmlspecialchars("details.php?id=".$arr[torrent]."&hit=1")."\" title=\"".$nametitle."\"><b>" . $dispname . "</b></a>". $sp_torrent .($dissmall_descr == "" ? "" : "<br />" . $dissmall_descr) . "</td>";
|
||||||
|
//size
|
||||||
|
if ($showsize)
|
||||||
|
$ret .= "<td class=\"rowfollow\" align=\"center\">". mksize_compact($arr['size'])."</td>";
|
||||||
|
//number of seeders
|
||||||
|
if ($showsenum)
|
||||||
|
$ret .= "<td class=\"rowfollow\" align=\"center\">".$arr['seeders']."</td>";
|
||||||
|
//number of leechers
|
||||||
|
if ($showlenum)
|
||||||
|
$ret .= "<td class=\"rowfollow\" align=\"center\">".$arr['leechers']."</td>";
|
||||||
|
//uploaded amount
|
||||||
|
if ($showuploaded){
|
||||||
|
$uploaded = mksize_compact($arr["uploaded"]);
|
||||||
|
$ret .= "<td class=\"rowfollow\" align=\"center\">".$uploaded."</td>";
|
||||||
|
}
|
||||||
|
//downloaded amount
|
||||||
|
if ($showdownloaded){
|
||||||
|
$downloaded = mksize_compact($arr["downloaded"]);
|
||||||
|
$ret .= "<td class=\"rowfollow\" align=\"center\">".$downloaded."</td>";
|
||||||
|
}
|
||||||
|
//ratio
|
||||||
|
if ($showratio){
|
||||||
|
if ($arr['downloaded'] > 0)
|
||||||
|
{
|
||||||
|
$ratio = number_format($arr['uploaded'] / $arr['downloaded'], 3);
|
||||||
|
$ratio = "<font color=\"" . get_ratio_color($ratio) . "\">".$ratio."</font>";
|
||||||
|
}
|
||||||
|
elseif ($arr['uploaded'] > 0) $ratio = "Inf.";
|
||||||
|
else $ratio = "---";
|
||||||
|
$ret .= "<td class=\"rowfollow\" align=\"center\">".$ratio."</td>";
|
||||||
|
}
|
||||||
|
if ($showsetime){
|
||||||
|
$ret .= "<td class=\"rowfollow\" align=\"center\">".mkprettytime($arr['seedtime'])."</td>";
|
||||||
|
}
|
||||||
|
if ($showletime){
|
||||||
|
$ret .= "<td class=\"rowfollow\" align=\"center\">".mkprettytime($arr['leechtime'])."</td>";
|
||||||
|
}
|
||||||
|
if ($showcotime)
|
||||||
|
$ret .= "<td class=\"rowfollow\" align=\"center\">"."". str_replace(" ", "<br />", gettime($arr['completedat'],false)). "</td>";
|
||||||
|
if ($showanonymous)
|
||||||
|
$ret .= "<td class=\"rowfollow\" align=\"center\">".$arr['anonymous']."</td>";
|
||||||
|
$ret .="</tr>\n";
|
||||||
|
|
||||||
|
}
|
||||||
|
$ret .= "</table>\n";
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
$id = 0+$_GET['userid'];
|
||||||
|
$type = $_GET['type'];
|
||||||
|
if (!in_array($type,array('uploaded','seeding','leeching','completed','incomplete')))
|
||||||
|
die;
|
||||||
|
if(get_user_class() < $torrenthistory_class && $id != $CURUSER["id"])
|
||||||
|
permissiondenied();
|
||||||
|
|
||||||
|
switch ($type)
|
||||||
|
{
|
||||||
|
case 'uploaded':
|
||||||
|
{
|
||||||
|
$res = sql_query("SELECT torrents.id AS torrent, torrents.name as torrentname, small_descr, seeders, leechers, anonymous, categories.name AS catname, categories.image, category, sp_state, size, snatched.seedtime, snatched.uploaded FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories ON torrents.category = categories.id WHERE torrents.owner=$id AND snatched.userid=$id " . (($CURUSER["id"] != $id)?((get_user_class() < $viewanonymous_class) ? " AND anonymous = 'no'":""):"") ." ORDER BY torrents.added DESC") or sqlerr(__FILE__, __LINE__);
|
||||||
|
$count = mysql_num_rows($res);
|
||||||
|
if ($count > 0)
|
||||||
|
{
|
||||||
|
$torrentlist = maketable($res, 'uploaded');
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Current Seeding
|
||||||
|
case 'seeding':
|
||||||
|
{
|
||||||
|
$res = sql_query("SELECT torrent,added,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, categories.name as catname,size,image,category,seeders,leechers FROM peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='yes' ORDER BY torrents.added DESC") or sqlerr();
|
||||||
|
$count = mysql_num_rows($res);
|
||||||
|
if ($count > 0){
|
||||||
|
$torrentlist = maketable($res, 'seeding');
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Current Leeching
|
||||||
|
case 'leeching':
|
||||||
|
{
|
||||||
|
$res = sql_query("SELECT torrent,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, categories.name as catname,size,image,category,seeders,leechers FROM peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='no' ORDER BY torrents.added DESC") or sqlerr();
|
||||||
|
$count = mysql_num_rows($res);
|
||||||
|
if ($count > 0){
|
||||||
|
$torrentlist = maketable($res, 'leeching');
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Completed torrents
|
||||||
|
case 'completed':
|
||||||
|
{
|
||||||
|
$res = sql_query("SELECT torrents.id AS torrent, torrents.name AS torrentname, small_descr, categories.name AS catname, categories.image, category, sp_state, size, snatched.uploaded, snatched.seedtime, snatched.leechtime, snatched.completedat FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='yes' AND torrents.owner != $id AND userid=$id ORDER BY snatched.completedat DESC") or sqlerr();
|
||||||
|
$count = mysql_num_rows($res);
|
||||||
|
if ($count > 0)
|
||||||
|
{
|
||||||
|
$torrentlist = maketable($res, 'completed');
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Incomplete torrents
|
||||||
|
case 'incomplete':
|
||||||
|
{
|
||||||
|
$res = sql_query("SELECT torrents.id AS torrent, torrents.name AS torrentname, small_descr, categories.name AS catname, categories.image, category, sp_state, size, snatched.uploaded, snatched.downloaded, snatched.leechtime FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='no' AND userid=$id AND torrents.owner != $id ORDER BY snatched.startdat DESC") or sqlerr();
|
||||||
|
$count = mysql_num_rows($res);
|
||||||
|
if ($count > 0)
|
||||||
|
{
|
||||||
|
$torrentlist = maketable($res, 'incomplete');
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
$count = 0;
|
||||||
|
$torrentlist = "";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($count)
|
||||||
|
echo "<b>".$count."</b>".$lang_getusertorrentlistajax['text_record'].add_s($count)."<br />".$torrentlist;
|
||||||
|
else
|
||||||
|
echo $lang_getusertorrentlistajax['text_no_record'];
|
||||||
|
?>
|
||||||
58
image.php
Normal file
58
image.php
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
<?php
|
||||||
|
require_once("include/bittorrent.php");
|
||||||
|
dbconn();
|
||||||
|
$action = $_GET['action'];
|
||||||
|
$imagehash = $_GET['imagehash'];
|
||||||
|
if($action == "regimage")
|
||||||
|
{
|
||||||
|
$query = "SELECT * FROM regimages WHERE imagehash= ".sqlesc($imagehash);
|
||||||
|
$sql = sql_query($query);
|
||||||
|
$regimage = mysql_fetch_array($sql);
|
||||||
|
$imagestring = $regimage['imagestring'];
|
||||||
|
for($i=0;$i<strlen($imagestring);$i++)
|
||||||
|
{
|
||||||
|
$newstring .= $space.$imagestring[$i];
|
||||||
|
$space = " ";
|
||||||
|
}
|
||||||
|
$imagestring = $newstring;
|
||||||
|
|
||||||
|
if(function_exists("imagecreatefrompng"))
|
||||||
|
{
|
||||||
|
$fontwidth = imageFontWidth(5);
|
||||||
|
$fontheight = imageFontHeight(5);
|
||||||
|
$textwidth = $fontwidth*strlen($imagestring);
|
||||||
|
$textheight = $fontheight;
|
||||||
|
|
||||||
|
$randimg = rand(1, 5);
|
||||||
|
$im = imagecreatefrompng("pic/regimages/reg".$randimg.".png");
|
||||||
|
|
||||||
|
$imgheight = 40;
|
||||||
|
$imgwidth = 150;
|
||||||
|
$textposh = ($imgwidth-$textwidth)/2;
|
||||||
|
$textposv = ($imgheight-$textheight)/2;
|
||||||
|
|
||||||
|
$dots = $imgheight*$imgwidth/35;
|
||||||
|
for($i=1;$i<=$dots;$i++)
|
||||||
|
{
|
||||||
|
imagesetpixel($im, rand(0, $imgwidth), rand(0, $imgheight), $textcolor);
|
||||||
|
}
|
||||||
|
|
||||||
|
$textcolor = imagecolorallocate($im, 0, 0, 0);
|
||||||
|
imagestring($im, 5, $textposh, $textposv, $imagestring, $textcolor);
|
||||||
|
|
||||||
|
// output the image
|
||||||
|
header("Content-type: image/png");
|
||||||
|
imagepng($im);
|
||||||
|
imagedestroy($im);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
header("Location: pic/clear.gif");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
die('invalid action');
|
||||||
|
}
|
||||||
|
?>
|
||||||
3
imdb/.htaccess
Normal file
3
imdb/.htaccess
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
Options -Indexes
|
||||||
|
Order allow,deny
|
||||||
|
Allow from all
|
||||||
1257
imdb/imdb.class.php
Normal file
1257
imdb/imdb.class.php
Normal file
File diff suppressed because it is too large
Load Diff
92
imdb/imdb_config.php
Normal file
92
imdb/imdb_config.php
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
<?php
|
||||||
|
#############################################################################
|
||||||
|
# IMDBPHP (c) Giorgos Giagas & Itzchak Rehberg #
|
||||||
|
# written by Giorgos Giagas #
|
||||||
|
# extended & maintained by Itzchak Rehberg <izzysoft@qumran.org> #
|
||||||
|
# http://www.qumran.org/homes/izzy/ #
|
||||||
|
# ------------------------------------------------------------------------- #
|
||||||
|
# This program is free software; you can redistribute and/or modify it #
|
||||||
|
# under the terms of the GNU General Public License (see doc/LICENSE) #
|
||||||
|
#############################################################################
|
||||||
|
|
||||||
|
/* $Id: imdb_config.php,v 1.3 2007/02/26 22:44:14 izzy Exp $ */
|
||||||
|
|
||||||
|
// the proxy to use for connections to imdb.
|
||||||
|
// leave it empty for no proxy.
|
||||||
|
// this is only supported with PEAR.
|
||||||
|
define ('PROXY', "");
|
||||||
|
define ('PROXY_PORT', "");
|
||||||
|
|
||||||
|
/** Configuration part of the IMDB classes
|
||||||
|
* @package Api
|
||||||
|
* @class imdb_config
|
||||||
|
*/
|
||||||
|
class imdb_config {
|
||||||
|
var $imdbsite;
|
||||||
|
var $cachedir;
|
||||||
|
var $usecache;
|
||||||
|
var $storecache;
|
||||||
|
var $cache_expire;
|
||||||
|
var $photodir;
|
||||||
|
var $photoroot;
|
||||||
|
var $timeout;
|
||||||
|
var $imageext;
|
||||||
|
|
||||||
|
/** Constructor and only method of this base class.
|
||||||
|
* There's no need to call this yourself - you should just place your
|
||||||
|
* configuration data here.
|
||||||
|
* @constructor imdb_config
|
||||||
|
*/
|
||||||
|
function imdb_config(){
|
||||||
|
// protocol prefix
|
||||||
|
$this->protocol_prefix = "http://";
|
||||||
|
// the imdb server to use.
|
||||||
|
// choices are us.imdb.com uk.imdb.com german.imdb.com and italian.imdb.com
|
||||||
|
// the localized ones (i.e. italian and german) are only qualified to find
|
||||||
|
// the movies IMDB ID -- but parsing for the details will fail at the moment.
|
||||||
|
$this->imdbsite = "www.imdb.com";
|
||||||
|
// cachedir should be writable by the webserver. This doesn't need to be
|
||||||
|
// under documentroot.
|
||||||
|
$this->cachedir = './imdb/cache';
|
||||||
|
//whether to use a cached page to retrieve the information if available.
|
||||||
|
$this->usecache = true;
|
||||||
|
//whether to store the pages retrieved for later use.
|
||||||
|
$this->storecache = true;
|
||||||
|
// automatically delete cached files older than X secs
|
||||||
|
$this->cache_expire = 365*24*60*60;
|
||||||
|
// the extension of cached images
|
||||||
|
$this->imageext = '.jpg';
|
||||||
|
// images are stored here after calling photo_localurl()
|
||||||
|
// this needs to be under documentroot to be able to display them on your pages.
|
||||||
|
$this->photodir = './imdb/images/';
|
||||||
|
// this is the URL to the images, i.e. start at your servers DOCUMENT_ROOT
|
||||||
|
// when specifying absolute path
|
||||||
|
$this->photoroot = './imdb/images/';
|
||||||
|
// TWEAKING OPTIONS:
|
||||||
|
// limit the result set to X movies (0 to disable, comment out to use default of 20)
|
||||||
|
$this->maxresults = 5000;
|
||||||
|
// timeout for retriving info, uint in second
|
||||||
|
$this->timeout = 120;
|
||||||
|
// out dated time for retrived info, (7 days for default)
|
||||||
|
$this->outdate_time = 60*60*24*7;
|
||||||
|
// search variants. Valid options are "sevec" and "moonface". Comment out
|
||||||
|
// (or set to empty string) to use the default
|
||||||
|
$this->searchvariant = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once ("HTTP/Request2.php");
|
||||||
|
|
||||||
|
class IMDB_Request extends HTTP_Request2
|
||||||
|
{
|
||||||
|
function IMDB_Request($url){
|
||||||
|
parent::__construct($url);
|
||||||
|
if ( PROXY != ""){
|
||||||
|
$this->setConfig(array('proxy_host' => PROXY, 'proxy_port' => PROXY_PORT));
|
||||||
|
}
|
||||||
|
$this->setConfig('follow_redirects', false);
|
||||||
|
$this->setHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
3
include/.htaccess
Normal file
3
include/.htaccess
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
Options -Indexes
|
||||||
|
Order allow,deny
|
||||||
|
Deny from all
|
||||||
133
include/benc.php
Normal file
133
include/benc.php
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
<?php
|
||||||
|
function benc($obj) {
|
||||||
|
if (!is_array($obj) || !isset($obj["type"]) || !isset($obj["value"]))
|
||||||
|
return;
|
||||||
|
$c = $obj["value"];
|
||||||
|
switch ($obj["type"]) {
|
||||||
|
case "string":
|
||||||
|
return benc_str($c);
|
||||||
|
case "integer":
|
||||||
|
return benc_int($c);
|
||||||
|
case "list":
|
||||||
|
return benc_list($c);
|
||||||
|
case "dictionary":
|
||||||
|
return benc_dict($c);
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function benc_str($s) {
|
||||||
|
return strlen($s) . ":$s";
|
||||||
|
}
|
||||||
|
function benc_int($i) {
|
||||||
|
return "i" . $i . "e";
|
||||||
|
}
|
||||||
|
function benc_list($a) {
|
||||||
|
$s = "l";
|
||||||
|
foreach ($a as $e) {
|
||||||
|
$s .= benc($e);
|
||||||
|
}
|
||||||
|
$s .= "e";
|
||||||
|
return $s;
|
||||||
|
}
|
||||||
|
function benc_dict($d) {
|
||||||
|
$s = "d";
|
||||||
|
$keys = array_keys($d);
|
||||||
|
sort($keys);
|
||||||
|
foreach ($keys as $k) {
|
||||||
|
$v = $d[$k];
|
||||||
|
$s .= benc_str($k);
|
||||||
|
$s .= benc($v);
|
||||||
|
}
|
||||||
|
$s .= "e";
|
||||||
|
return $s;
|
||||||
|
}
|
||||||
|
function bdec_file($f, $ms) {
|
||||||
|
$fp = fopen($f, "rb");
|
||||||
|
if (!$fp)
|
||||||
|
return;
|
||||||
|
$e = fread($fp, $ms);
|
||||||
|
fclose($fp);
|
||||||
|
return bdec($e);
|
||||||
|
}
|
||||||
|
function bdec($s) {
|
||||||
|
if (preg_match('/^(\d+):/', $s, $m)) {
|
||||||
|
$l = $m[1];
|
||||||
|
$pl = strlen($l) + 1;
|
||||||
|
$v = substr($s, $pl, $l);
|
||||||
|
$ss = substr($s, 0, $pl + $l);
|
||||||
|
if (strlen($v) != $l)
|
||||||
|
return;
|
||||||
|
return array('type' => "string", 'value' => $v, 'strlen' => strlen($ss), 'string' => $ss);
|
||||||
|
}
|
||||||
|
if (preg_match('/^i(\d+)e/', $s, $m)) {
|
||||||
|
$v = $m[1];
|
||||||
|
$ss = "i" . $v . "e";
|
||||||
|
if ($v === "-0")
|
||||||
|
return;
|
||||||
|
if ($v[0] == "0" && strlen($v) != 1)
|
||||||
|
return;
|
||||||
|
return array('type' => "integer", 'value' => $v, 'strlen' => strlen($ss), 'string' => $ss);
|
||||||
|
}
|
||||||
|
switch ($s[0]) {
|
||||||
|
case "l":
|
||||||
|
return bdec_list($s);
|
||||||
|
case "d":
|
||||||
|
return bdec_dict($s);
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function bdec_list($s) {
|
||||||
|
if ($s[0] != "l")
|
||||||
|
return;
|
||||||
|
$sl = strlen($s);
|
||||||
|
$i = 1;
|
||||||
|
$v = array();
|
||||||
|
$ss = "l";
|
||||||
|
for (;;) {
|
||||||
|
if ($i >= $sl)
|
||||||
|
return;
|
||||||
|
if ($s[$i] == "e")
|
||||||
|
break;
|
||||||
|
$ret = bdec(substr($s, $i));
|
||||||
|
if (!isset($ret) || !is_array($ret))
|
||||||
|
return;
|
||||||
|
$v[] = $ret;
|
||||||
|
$i += $ret["strlen"];
|
||||||
|
$ss .= $ret["string"];
|
||||||
|
}
|
||||||
|
$ss .= "e";
|
||||||
|
return array('type' => "list", 'value' => $v, 'strlen' => strlen($ss), 'string' => $ss);
|
||||||
|
}
|
||||||
|
function bdec_dict($s) {
|
||||||
|
if ($s[0] != "d")
|
||||||
|
return;
|
||||||
|
$sl = strlen($s);
|
||||||
|
$i = 1;
|
||||||
|
$v = array();
|
||||||
|
$ss = "d";
|
||||||
|
for (;;) {
|
||||||
|
if ($i >= $sl)
|
||||||
|
return;
|
||||||
|
if ($s[$i] == "e")
|
||||||
|
break;
|
||||||
|
$ret = bdec(substr($s, $i));
|
||||||
|
if (!isset($ret) || !is_array($ret) || $ret["type"] != "string")
|
||||||
|
return;
|
||||||
|
$k = $ret["value"];
|
||||||
|
$i += $ret["strlen"];
|
||||||
|
$ss .= $ret["string"];
|
||||||
|
if ($i >= $sl)
|
||||||
|
return;
|
||||||
|
$ret = bdec(substr($s, $i));
|
||||||
|
if (!isset($ret) || !is_array($ret))
|
||||||
|
return;
|
||||||
|
$v[$k] = $ret;
|
||||||
|
$i += $ret["strlen"];
|
||||||
|
$ss .= $ret["string"];
|
||||||
|
}
|
||||||
|
$ss .= "e";
|
||||||
|
return array('type' => "dictionary", 'value' => $v, 'strlen' => strlen($ss), 'string' => $ss);
|
||||||
|
}
|
||||||
|
?>
|
||||||
13
include/bittorrent.php
Normal file
13
include/bittorrent.php
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
define('IN_TRACKER', true);
|
||||||
|
define("PROJECTNAME","NexusPHP");
|
||||||
|
define("NEXUSPHPURL","http://www.nexusphp.com");
|
||||||
|
define("NEXUSWIKIURL","http://www.nexusphp.com/wiki");
|
||||||
|
define("VERSION","Powered by <a href=\"aboutnexus.php\">".PROJECTNAME."</a>");
|
||||||
|
define("THISTRACKER","General");
|
||||||
|
$showversion = " - Powered by ".PROJECTNAME;
|
||||||
|
$rootpath=realpath(dirname(__FILE__) . '/..');
|
||||||
|
set_include_path(get_include_path() . PATH_SEPARATOR . $rootpath);
|
||||||
|
$rootpath .= "/";
|
||||||
|
include($rootpath . 'include/core.php');
|
||||||
|
include_once($rootpath . 'include/functions.php');
|
||||||
7
include/bittorrent_announce.php
Normal file
7
include/bittorrent_announce.php
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
# IMPORTANT: Do not edit below unless you know what you are doing!
|
||||||
|
define('IN_TRACKER', true);
|
||||||
|
$rootpath=realpath(dirname(__FILE__) . '/..')."/";
|
||||||
|
include($rootpath . 'include/core.php');
|
||||||
|
include_once($rootpath . 'include/functions_announce.php');
|
||||||
|
?>
|
||||||
270
include/browser/browseremulator.class.php
Normal file
270
include/browser/browseremulator.class.php
Normal file
@@ -0,0 +1,270 @@
|
|||||||
|
<?php
|
||||||
|
/***************************************************************************
|
||||||
|
|
||||||
|
Browser Emulating file functions v2.0
|
||||||
|
(c) Kai Blankenhorn
|
||||||
|
www.bitfolge.de/en
|
||||||
|
kaib@bitfolge.de
|
||||||
|
|
||||||
|
|
||||||
|
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 2
|
||||||
|
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, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
****************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
Changelog:
|
||||||
|
|
||||||
|
v2.0 03-09-03
|
||||||
|
added a wrapper class; this has the advantage that you no longer need
|
||||||
|
to specify a lot of parameters, just call the methods to set
|
||||||
|
each option
|
||||||
|
added option to use a special port number, may be given by setPort or
|
||||||
|
as part of the URL (e.g. server.com:80)
|
||||||
|
added getLastResponseHeaders()
|
||||||
|
|
||||||
|
v1.5
|
||||||
|
added Basic HTTP user authorization
|
||||||
|
minor optimizations
|
||||||
|
|
||||||
|
v1.0
|
||||||
|
initial release
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
***************************************************************************/
|
||||||
|
/**
|
||||||
|
* BrowserEmulator class. Provides methods for opening urls and emulating
|
||||||
|
* a web browser request.
|
||||||
|
**/
|
||||||
|
class BrowserEmulator {
|
||||||
|
|
||||||
|
var $headerLines = Array ();
|
||||||
|
var $postData = Array ();
|
||||||
|
var $authUser = "";
|
||||||
|
var $authPass = "";
|
||||||
|
var $port;
|
||||||
|
var $lastResponse = Array ();
|
||||||
|
|
||||||
|
function BrowserEmulator () {
|
||||||
|
$this->resetHeaderLines ();
|
||||||
|
$this->resetPort ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a single header field to the HTTP request header. The resulting header
|
||||||
|
* line will have the format
|
||||||
|
* $name: $value\n
|
||||||
|
**/
|
||||||
|
function addHeaderLine ($name, $value) {
|
||||||
|
$this->headerLines[$name] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes all custom header lines. This will not remove the User-Agent header field,
|
||||||
|
* which is necessary for correct operation.
|
||||||
|
**/
|
||||||
|
function resetHeaderLines () {
|
||||||
|
$this->headerLines = Array ();
|
||||||
|
|
||||||
|
/*******************************************************************************/
|
||||||
|
/************** YOU MAX SET THE USER AGENT STRING HERE *******************/
|
||||||
|
/* */
|
||||||
|
/* default is "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)", */
|
||||||
|
/* which means Internet Explorer 6.0 on WinXP */
|
||||||
|
|
||||||
|
$this->headerLines["User-Agent"] =
|
||||||
|
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
|
||||||
|
|
||||||
|
/*******************************************************************************/
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a post parameter. Post parameters are sent in the body of an HTTP POST request.
|
||||||
|
**/
|
||||||
|
function addPostData ($name, $value) {
|
||||||
|
$this->postData[$name] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes all custom post parameters.
|
||||||
|
**/
|
||||||
|
function resetPostData () {
|
||||||
|
$this->postData = Array ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets an auth user and password to use for the request.
|
||||||
|
* Set both as empty strings to disable authentication.
|
||||||
|
**/
|
||||||
|
function setAuth ($user, $pass) {
|
||||||
|
$this->authUser = $user;
|
||||||
|
$this->authPass = $pass;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects a custom port to use for the request.
|
||||||
|
**/
|
||||||
|
function setPort ($portNumber) {
|
||||||
|
$this->port = $portNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resets the port used for request to the HTTP default (80).
|
||||||
|
**/
|
||||||
|
function resetPort () {
|
||||||
|
$this->port = 80;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make an fopen call to $url with the parameters set by previous member
|
||||||
|
* method calls. Send all set headers, post data and user authentication data.
|
||||||
|
* Returns a file handle on success, or false on failure.
|
||||||
|
**/
|
||||||
|
function fopen ($url) {
|
||||||
|
$debug = false;
|
||||||
|
|
||||||
|
$this->lastResponse = Array ();
|
||||||
|
|
||||||
|
preg_match ("~([a-z]*://)?([^:^/]*)(:([0-9]{1,5}))?(/.*)?~i", $url,
|
||||||
|
$matches);
|
||||||
|
if ($debug)
|
||||||
|
var_dump ($matches);
|
||||||
|
$protocol = $matches[1];
|
||||||
|
$server = $matches[2];
|
||||||
|
$port = $matches[4];
|
||||||
|
$path = $matches[5];
|
||||||
|
if ($port != "") {
|
||||||
|
$this->setPort ($port);
|
||||||
|
}
|
||||||
|
if ($path == "")
|
||||||
|
$path = "/";
|
||||||
|
$socket = false;
|
||||||
|
$socket = fsockopen ($server, $this->port);
|
||||||
|
if ($socket) {
|
||||||
|
$this->headerLines["Host"] = $server;
|
||||||
|
|
||||||
|
if ($this->authUser != "" AND $this->authPass != "") {
|
||||||
|
$headers["Authorization"] =
|
||||||
|
"Basic ".base64_encode ($this->authUser.":".$this->
|
||||||
|
authPass);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count ($this->postData) == 0) {
|
||||||
|
$request = "GET $path HTTP/1.0\r\n";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$request = "POST $path HTTP/1.0\r\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($debug)
|
||||||
|
echo $request;
|
||||||
|
fputs ($socket, $request);
|
||||||
|
|
||||||
|
if (count ($this->postData) > 0) {
|
||||||
|
$PostStringArray = Array ();
|
||||||
|
foreach ($this->postData AS $key => $value) {
|
||||||
|
$PostStringArray[] = "$key=$value";
|
||||||
|
}
|
||||||
|
$PostString = join ("&", $PostStringArray);
|
||||||
|
$this->headerLines["Content-Length"] =
|
||||||
|
strlen ($PostString);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($this->headerLines AS $key => $value) {
|
||||||
|
if ($debug)
|
||||||
|
echo "$key: $value\n";
|
||||||
|
fputs ($socket, "$key: $value\r\n");
|
||||||
|
}
|
||||||
|
if ($debug)
|
||||||
|
echo "\n";
|
||||||
|
fputs ($socket, "\r\n");
|
||||||
|
if (count ($this->postData) > 0) {
|
||||||
|
if ($debug)
|
||||||
|
echo "$PostString";
|
||||||
|
fputs ($socket, $PostString."\r\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($debug)
|
||||||
|
echo "\n";
|
||||||
|
if ($socket) {
|
||||||
|
$line = fgets ($socket, 1000);
|
||||||
|
if ($debug)
|
||||||
|
echo $line;
|
||||||
|
$this->lastResponse[] = $line;
|
||||||
|
$status = substr ($line, 9, 3);
|
||||||
|
while (trim ($line = fgets ($socket, 1000)) != "") {
|
||||||
|
if ($debug)
|
||||||
|
echo "$line";
|
||||||
|
$this->lastResponse[] = $line;
|
||||||
|
if ($status == "401" AND strpos ($line, "WWW-Authenticate: Basic realm=\"") === 0) {
|
||||||
|
fclose ($socket);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $socket;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make an file call to $url with the parameters set by previous member
|
||||||
|
* method calls. Send all set headers, post data and user authentication data.
|
||||||
|
* Returns the requested file as an array on success, or false on failure.
|
||||||
|
**/
|
||||||
|
function file ($url) {
|
||||||
|
$file = Array ();
|
||||||
|
$socket = $this->fopen ($url);
|
||||||
|
if ($socket) {
|
||||||
|
$file = Array ();
|
||||||
|
while (!feof ($socket)) {
|
||||||
|
$file[] = fgets ($socket, 10000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getLastResponseHeaders () {
|
||||||
|
return $this->lastResponse;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// example code
|
||||||
|
/*
|
||||||
|
$be = new BrowserEmulator();
|
||||||
|
//$be->addHeaderLine("Referer", "http://previous.server.com/");
|
||||||
|
//$be->addHeaderLine("Accept-Encoding", "x-compress; x-zip");
|
||||||
|
//$be->addPostData("Submit", "OK");
|
||||||
|
//$be->addPostData("item", "42");
|
||||||
|
//$be->setAuth("admin", "secretpass");
|
||||||
|
// also possible:
|
||||||
|
// $be->setPort(10080);
|
||||||
|
|
||||||
|
$file = $be->fopen("http://us.imdb.com/Title?0209144");
|
||||||
|
$response = $be->getLastResponseHeaders();
|
||||||
|
|
||||||
|
while ($line = fgets($file, 1024)) {
|
||||||
|
// do something with the file
|
||||||
|
echo $line;
|
||||||
|
}
|
||||||
|
fclose($file);
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
?>
|
||||||
114
include/browser/info_extractor.php
Normal file
114
include/browser/info_extractor.php
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class info_extractor{
|
||||||
|
function info_extractor(){}
|
||||||
|
|
||||||
|
/** truncate a given string
|
||||||
|
* @method truncate
|
||||||
|
* @param string src(source string), string s_str(starting needle), string e_str(ending needle, "" for open end), integer e_offset(optional where to start finding the $e_str)
|
||||||
|
* @return string trucated string
|
||||||
|
*/
|
||||||
|
function truncate($src, $s_str, $e_str = "", $e_offset = 0)
|
||||||
|
{
|
||||||
|
$ret = "";
|
||||||
|
$e_offset = strlen($s_str);
|
||||||
|
|
||||||
|
$ret = strstr($src, $s_str);
|
||||||
|
if($ret == false)
|
||||||
|
return "";
|
||||||
|
|
||||||
|
if($e_str != "")
|
||||||
|
{
|
||||||
|
$endpos = strpos ($ret , $e_str, $e_offset);
|
||||||
|
if($endpos == false)
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
return substr($ret, strlen($s_str), $endpos - strlen($s_str));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** find a certain pattern in a given string
|
||||||
|
* @method find_pattern
|
||||||
|
* @param string src(source string), string regex(regular expression), boolean multiple(if pattern has multiple occurance), array string res_where_array(where the res should be in regex, order of res_where_array and res_array should be the same, for example: res_array could be "array(array('Name' => '', 'Cloudsize' => '', 'Link' => ''))", then the first element in res_where_array could be, say, "3", which corrsponds to 'Name'), array string res_array(one or multi-dimensional array for the extraced info)
|
||||||
|
* @return boolean found_pattern
|
||||||
|
*/
|
||||||
|
function find_pattern($src, $regex, $multiple, $res_where_array)
|
||||||
|
{
|
||||||
|
$res_array = array();
|
||||||
|
if($multiple == true)
|
||||||
|
{
|
||||||
|
if(!preg_match_all($regex,$src,$info_block,PREG_SET_ORDER))
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$counter_infoblock = 0;
|
||||||
|
foreach($info_block as $info)
|
||||||
|
{
|
||||||
|
$counter_reswhere = 0;
|
||||||
|
foreach ($res_where_array as $res_where_array_each)
|
||||||
|
{
|
||||||
|
$res_array[$counter_infoblock][$counter_reswhere] = $info[$res_where_array_each];
|
||||||
|
$counter_reswhere++;
|
||||||
|
}
|
||||||
|
$counter_infoblock++;
|
||||||
|
}
|
||||||
|
return $res_array;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(!preg_match($regex,$src,$info))
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$counter = 0;
|
||||||
|
foreach ($res_where_array as $res_where_array_each)
|
||||||
|
{
|
||||||
|
$res_array[$counter] = $info[$res_where_array_each];
|
||||||
|
$counter++;
|
||||||
|
}
|
||||||
|
return $res_array;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** remove a given pattern from a given string
|
||||||
|
* @method truncate
|
||||||
|
* @param string src(source string), string $regex_s(starting needle), string $regex_e(ending needle), integer max(set it to 1 if you are sure the pattern only occurs once, otherwise, it indicates the maximum possible occurance in case of dead loop), boolean all(if remove all or just the pattern)
|
||||||
|
* @return string processed string
|
||||||
|
*/
|
||||||
|
function remove($src, $regex_s, $regex_e, $max = 100, $all = false)
|
||||||
|
{
|
||||||
|
$ret = "";
|
||||||
|
$ret = preg_replace("/" . $regex_s . "((\s|.)+?)" . $regex_e . "/i", ($all == false ? "\\1" : ""), $src, $max);
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** trim a given array of strings types from a given string
|
||||||
|
* @method trim_str
|
||||||
|
* @param string src(source string), string array regex_trim_array(specifies strings to be trimmed), integersafe_counter(maximum possible occurance of string to be trimmed)
|
||||||
|
* @return string processed string
|
||||||
|
*/
|
||||||
|
function trim_str($src, $regex_trim_array, $safe_counter =10)
|
||||||
|
{
|
||||||
|
$ret = "";
|
||||||
|
|
||||||
|
while($safe_counter>0)
|
||||||
|
{
|
||||||
|
$safe_counter--;
|
||||||
|
$break_flag = true;
|
||||||
|
foreach($regex_trim_array as $regex_trim_array_each)
|
||||||
|
{
|
||||||
|
$ret = preg_replace("/^((" . $regex_trim_array_each . ")*)((\s|.)+?)((" . $regex_trim_array_each . ")*)$/i","\\3", trim($src), 1);
|
||||||
|
if($ret != $src)
|
||||||
|
$break_flag = false;
|
||||||
|
$src = $ret;
|
||||||
|
}
|
||||||
|
if($break_flag)
|
||||||
|
break;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
762
include/cleanup.php
Normal file
762
include/cleanup.php
Normal file
@@ -0,0 +1,762 @@
|
|||||||
|
<?php
|
||||||
|
# IMPORTANT: Do not edit below unless you know what you are doing!
|
||||||
|
if(!defined('IN_TRACKER'))
|
||||||
|
die('Hacking attempt!');
|
||||||
|
|
||||||
|
function printProgress($msg) {
|
||||||
|
echo $msg.'...done<br />';
|
||||||
|
ob_flush();
|
||||||
|
flush();
|
||||||
|
}
|
||||||
|
function docleanup($forceAll = 0, $printProgress = false) {
|
||||||
|
//require_once(get_langfile_path("cleanup.php",true));
|
||||||
|
global $lang_cleanup_target;
|
||||||
|
global $torrent_dir, $signup_timeout, $max_dead_torrent_time, $autoclean_interval_one, $autoclean_interval_two, $autoclean_interval_three, $autoclean_interval_four, $autoclean_interval_five, $SITENAME,$bonus,$invite_timeout,$offervotetimeout_main,$offeruptimeout_main, $iniupload_main;
|
||||||
|
global $donortimes_bonus, $perseeding_bonus, $maxseeding_bonus, $tzero_bonus, $nzero_bonus, $bzero_bonus, $l_bonus;
|
||||||
|
global $expirehalfleech_torrent, $expirefree_torrent, $expiretwoup_torrent, $expiretwoupfree_torrent, $expiretwouphalfleech_torrent, $expirethirtypercentleech_torrent, $expirenormal_torrent, $hotdays_torrent, $hotseeder_torrent,$halfleechbecome_torrent,$freebecome_torrent,$twoupbecome_torrent,$twoupfreebecome_torrent, $twouphalfleechbecome_torrent, $thirtypercentleechbecome_torrent, $normalbecome_torrent, $deldeadtorrent_torrent;
|
||||||
|
global $neverdelete_account, $neverdeletepacked_account, $deletepacked_account, $deleteunpacked_account, $deletenotransfer_account, $deletenotransfertwo_account, $deletepeasant_account, $psdlone_account, $psratioone_account, $psdltwo_account, $psratiotwo_account, $psdlthree_account, $psratiothree_account, $psdlfour_account, $psratiofour_account, $psdlfive_account, $psratiofive_account, $putime_account, $pudl_account, $puprratio_account, $puderatio_account, $eutime_account, $eudl_account, $euprratio_account, $euderatio_account, $cutime_account, $cudl_account, $cuprratio_account, $cuderatio_account, $iutime_account, $iudl_account, $iuprratio_account, $iuderatio_account, $vutime_account, $vudl_account, $vuprratio_account, $vuderatio_account, $exutime_account, $exudl_account, $exuprratio_account, $exuderatio_account, $uutime_account, $uudl_account, $uuprratio_account, $uuderatio_account, $nmtime_account, $nmdl_account, $nmprratio_account, $nmderatio_account, $getInvitesByPromotion_class;
|
||||||
|
global $enablenoad_advertisement, $noad_advertisement;
|
||||||
|
global $Cache;
|
||||||
|
global $rootpath;
|
||||||
|
|
||||||
|
require_once($rootpath . '/lang/_target/lang_cleanup.php');
|
||||||
|
|
||||||
|
set_time_limit(0);
|
||||||
|
ignore_user_abort(1);
|
||||||
|
$now = time();
|
||||||
|
|
||||||
|
//Priority Class 1: cleanup every 15 mins
|
||||||
|
//2.update peer status
|
||||||
|
$deadtime = deadtime();
|
||||||
|
$deadtime = date("Y-m-d H:i:s",$deadtime);
|
||||||
|
sql_query("DELETE FROM peers WHERE last_action < ".sqlesc($deadtime)) or sqlerr(__FILE__, __LINE__);
|
||||||
|
if ($printProgress) {
|
||||||
|
printProgress('update peer status');
|
||||||
|
}
|
||||||
|
//11.calculate seeding bonus
|
||||||
|
$res = sql_query("SELECT DISTINCT userid FROM peers WHERE seeder = 'yes'") or sqlerr(__FILE__, __LINE__);
|
||||||
|
if (mysql_num_rows($res) > 0)
|
||||||
|
{
|
||||||
|
$sqrtof2 = sqrt(2);
|
||||||
|
$logofpointone = log(0.1);
|
||||||
|
$valueone = $logofpointone / $tzero_bonus;
|
||||||
|
$pi = 3.141592653589793;
|
||||||
|
$valuetwo = $bzero_bonus * ( 2 / $pi);
|
||||||
|
$valuethree = $logofpointone / ($nzero_bonus - 1);
|
||||||
|
$timenow = TIMENOW;
|
||||||
|
$sectoweek = 7*24*60*60;
|
||||||
|
while ($arr = mysql_fetch_assoc($res)) //loop for different users
|
||||||
|
{
|
||||||
|
$A = 0;
|
||||||
|
$count = 0;
|
||||||
|
$all_bonus = 0;
|
||||||
|
$torrentres = sql_query("select torrents.added, torrents.size, torrents.seeders from torrents LEFT JOIN peers ON peers.torrent = torrents.id WHERE peers.userid = $arr[userid] AND peers.seeder ='yes'") or sqlerr(__FILE__, __LINE__);
|
||||||
|
while ($torrent = mysql_fetch_array($torrentres))
|
||||||
|
{
|
||||||
|
$weeks_alive = ($timenow - strtotime($torrent[added])) / $sectoweek;
|
||||||
|
$gb_size = $torrent[size] / 1073741824;
|
||||||
|
$temp = (1 - exp($valueone * $weeks_alive)) * $gb_size * (1 + $sqrtof2 * exp($valuethree * ($torrent[seeders] - 1)));
|
||||||
|
$A += $temp;
|
||||||
|
$count++;
|
||||||
|
}
|
||||||
|
if ($count > $maxseeding_bonus)
|
||||||
|
$count = $maxseeding_bonus;
|
||||||
|
$all_bonus = ($valuetwo * atan($A / $l_bonus) + ($perseeding_bonus * $count)) / (3600 / $autoclean_interval_one);
|
||||||
|
$is_donor = get_single_value("users","donor","WHERE id=".$arr['userid']);
|
||||||
|
if ($is_donor == 'yes' && $donortimes_bonus > 0)
|
||||||
|
$all_bonus = $all_bonus * $donortimes_bonus;
|
||||||
|
KPS("+",$all_bonus,$arr["userid"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($printProgress) {
|
||||||
|
printProgress('calculate seeding bonus');
|
||||||
|
}
|
||||||
|
|
||||||
|
//Priority Class 2: cleanup every 30 mins
|
||||||
|
$res = sql_query("SELECT value_u FROM avps WHERE arg = 'lastcleantime2'");
|
||||||
|
$row = mysql_fetch_array($res);
|
||||||
|
if (!$row) {
|
||||||
|
sql_query("INSERT INTO avps (arg, value_u) VALUES ('lastcleantime2',".sqlesc($now).")") or sqlerr(__FILE__, __LINE__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$ts = $row[0];
|
||||||
|
if ($ts + $autoclean_interval_two > $now && !$forceAll) {
|
||||||
|
return 'Cleanup ends at Priority Class 1';
|
||||||
|
} else {
|
||||||
|
sql_query("UPDATE avps SET value_u = ".sqlesc($now)." WHERE arg='lastcleantime2'") or sqlerr(__FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
|
||||||
|
//2.5.update torrents' visibility
|
||||||
|
$deadtime = deadtime() - $max_dead_torrent_time;
|
||||||
|
sql_query("UPDATE torrents SET visible='no' WHERE visible='yes' AND last_action < FROM_UNIXTIME($deadtime) AND seeders=0") or sqlerr(__FILE__, __LINE__);
|
||||||
|
if ($printProgress) {
|
||||||
|
printProgress("update torrents' visibility");
|
||||||
|
}
|
||||||
|
//Priority Class 3: cleanup every 60 mins
|
||||||
|
$res = sql_query("SELECT value_u FROM avps WHERE arg = 'lastcleantime3'");
|
||||||
|
$row = mysql_fetch_array($res);
|
||||||
|
if (!$row) {
|
||||||
|
sql_query("INSERT INTO avps (arg, value_u) VALUES ('lastcleantime3',$now)") or sqlerr(__FILE__, __LINE__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$ts = $row[0];
|
||||||
|
if ($ts + $autoclean_interval_three > $now && !$forceAll) {
|
||||||
|
return 'Cleanup ends at Priority Class 2';
|
||||||
|
} else {
|
||||||
|
sql_query("UPDATE avps SET value_u = ".sqlesc($now)." WHERE arg='lastcleantime3'") or sqlerr(__FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
|
||||||
|
//4.update count of seeders, leechers, comments for torrents
|
||||||
|
$torrents = array();
|
||||||
|
$res = sql_query("SELECT torrent, seeder, COUNT(*) AS c FROM peers GROUP BY torrent, seeder") or sqlerr(__FILE__, __LINE__);
|
||||||
|
while ($row = mysql_fetch_assoc($res)) {
|
||||||
|
if ($row["seeder"] == "yes")
|
||||||
|
$key = "seeders";
|
||||||
|
else
|
||||||
|
$key = "leechers";
|
||||||
|
$torrents[$row["torrent"]][$key] = $row["c"];
|
||||||
|
}
|
||||||
|
|
||||||
|
$res = sql_query("SELECT torrent, COUNT(*) AS c FROM comments GROUP BY torrent") or sqlerr(__FILE__, __LINE__);
|
||||||
|
while ($row = mysql_fetch_assoc($res)) {
|
||||||
|
$torrents[$row["torrent"]]["comments"] = $row["c"];
|
||||||
|
}
|
||||||
|
|
||||||
|
$fields = explode(":", "comments:leechers:seeders");
|
||||||
|
$res = sql_query("SELECT id, seeders, leechers, comments FROM torrents") or sqlerr(__FILE__, __LINE__);
|
||||||
|
while ($row = mysql_fetch_assoc($res)) {
|
||||||
|
$id = $row["id"];
|
||||||
|
$torr = $torrents[$id];
|
||||||
|
foreach ($fields as $field) {
|
||||||
|
if (!isset($torr[$field]))
|
||||||
|
$torr[$field] = 0;
|
||||||
|
}
|
||||||
|
$update = array();
|
||||||
|
foreach ($fields as $field) {
|
||||||
|
if ($torr[$field] != $row[$field])
|
||||||
|
$update[] = "$field = " . $torr[$field];
|
||||||
|
}
|
||||||
|
if (count($update))
|
||||||
|
sql_query("UPDATE torrents SET " . implode(",", $update) . " WHERE id = $id") or sqlerr(__FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
if ($printProgress) {
|
||||||
|
printProgress("update count of seeders, leechers, comments for torrents");
|
||||||
|
}
|
||||||
|
|
||||||
|
//set no-advertisement-by-bonus time out
|
||||||
|
sql_query("UPDATE users SET noad='no' WHERE noaduntil < ".sqlesc(date("Y-m-d H:i:s")).($enablenoad_advertisement == 'yes' ? " AND class < ".sqlesc($noad_advertisement) : ""));
|
||||||
|
if ($printProgress) {
|
||||||
|
printProgress("set no-advertisement-by-bonus time out");
|
||||||
|
}
|
||||||
|
//12. update forum post/topic count
|
||||||
|
$forums = sql_query("select id from forums") or sqlerr(__FILE__, __LINE__);
|
||||||
|
while ($forum = mysql_fetch_assoc($forums))
|
||||||
|
{
|
||||||
|
$postcount = 0;
|
||||||
|
$topiccount = 0;
|
||||||
|
$topics = sql_query("select id from topics where forumid=$forum[id]") or sqlerr(__FILE__, __LINE__);
|
||||||
|
while ($topic = mysql_fetch_assoc($topics))
|
||||||
|
{
|
||||||
|
$res = sql_query("select count(*) from posts where topicid=$topic[id]") or sqlerr(__FILE__, __LINE__);
|
||||||
|
$arr = mysql_fetch_row($res);
|
||||||
|
$postcount += $arr[0];
|
||||||
|
++$topiccount;
|
||||||
|
}
|
||||||
|
sql_query("update forums set postcount=$postcount, topiccount=$topiccount where id=$forum[id]") or sqlerr(__FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
$Cache->delete_value('forums_list');
|
||||||
|
if ($printProgress) {
|
||||||
|
printProgress("update forum post/topic count");
|
||||||
|
}
|
||||||
|
//14.cleanup offers
|
||||||
|
//Delete offers if not voted on after some time
|
||||||
|
if($offervotetimeout_main){
|
||||||
|
$secs = (int)$offervotetimeout_main;
|
||||||
|
$dt = sqlesc(date("Y-m-d H:i:s",(TIMENOW - ($offervotetimeout_main))));
|
||||||
|
$res = sql_query("SELECT id, name FROM offers WHERE added < $dt AND allowed <> 'allowed'") or sqlerr(__FILE__, __LINE__);
|
||||||
|
while($arr = mysql_fetch_assoc($res)){
|
||||||
|
sql_query("DELETE FROM offers WHERE id=$arr[id]") or sqlerr(__FILE__, __LINE__);
|
||||||
|
sql_query("DELETE FROM offervotes WHERE offerid=$arr[id]") or sqlerr(__FILE__, __LINE__);
|
||||||
|
sql_query("DELETE FROM comments WHERE offer=$arr[id]") or sqlerr(__FILE__, __LINE__);
|
||||||
|
write_log("Offer $arr[id] ($arr[name]) was deleted by system (vote timeout)",'normal');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($printProgress) {
|
||||||
|
printProgress("delete offers if not voted on after some time");
|
||||||
|
}
|
||||||
|
|
||||||
|
//Delete offers if not uploaded after being voted on for some time.
|
||||||
|
if($offeruptimeout_main){
|
||||||
|
$secs = (int)$offeruptimeout_main;
|
||||||
|
$dt = sqlesc(date("Y-m-d H:i:s",(TIMENOW - ($secs))));
|
||||||
|
$res = sql_query("SELECT id, name FROM offers WHERE allowedtime < $dt AND allowed = 'allowed'") or sqlerr(__FILE__, __LINE__);
|
||||||
|
while($arr = mysql_fetch_assoc($res)){
|
||||||
|
sql_query("DELETE FROM offers WHERE id=$arr[id]") or sqlerr(__FILE__, __LINE__);
|
||||||
|
sql_query("DELETE FROM offervotes WHERE offerid=$arr[id]") or sqlerr(__FILE__, __LINE__);
|
||||||
|
sql_query("DELETE FROM comments WHERE offer=$arr[id]") or sqlerr(__FILE__, __LINE__);
|
||||||
|
write_log("Offer $arr[id] ($arr[name]) was deleted by system (upload timeout)",'normal');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($printProgress) {
|
||||||
|
printProgress("delete offers if not uploaded after being voted on for some time.");
|
||||||
|
}
|
||||||
|
|
||||||
|
//15.cleanup torrents
|
||||||
|
//Start: expire torrent promotion
|
||||||
|
function torrent_promotion_expire($days, $type = 2, $targettype = 1){
|
||||||
|
$secs = (int)($days * 86400); //XX days
|
||||||
|
$dt = sqlesc(date("Y-m-d H:i:s",(TIMENOW - ($secs))));
|
||||||
|
$res = sql_query("SELECT id, name FROM torrents WHERE added < $dt AND sp_state = ".sqlesc($type).' AND promotion_time_type=0') or sqlerr(__FILE__, __LINE__);
|
||||||
|
switch($targettype)
|
||||||
|
{
|
||||||
|
case 1: //normal
|
||||||
|
{
|
||||||
|
$sp_state = 1;
|
||||||
|
$become = "normal";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 2: //Free
|
||||||
|
{
|
||||||
|
$sp_state = 2;
|
||||||
|
$become = "Free";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 3: //2X
|
||||||
|
{
|
||||||
|
$sp_state = 3;
|
||||||
|
$become = "2X";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 4: //2X Free
|
||||||
|
{
|
||||||
|
$sp_state = 4;
|
||||||
|
$become = "2X Free";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 5: //Half Leech
|
||||||
|
{
|
||||||
|
$sp_state = 5;
|
||||||
|
$become = "50%";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 6: //2X Half Leech
|
||||||
|
{
|
||||||
|
$sp_state = 6;
|
||||||
|
$become = "2X 50%";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: //normal
|
||||||
|
{
|
||||||
|
$sp_state = 1;
|
||||||
|
$become = "normal";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while($arr = mysql_fetch_assoc($res)){
|
||||||
|
sql_query("UPDATE torrents SET sp_state = ".sqlesc($sp_state)." WHERE id=$arr[id]") or sqlerr(__FILE__, __LINE__);
|
||||||
|
if ($sp_state == 1)
|
||||||
|
write_log("Torrent $arr[id] ($arr[name]) is no longer on promotion (time expired)",'normal');
|
||||||
|
else write_log("Promotion type for torrent $arr[id] ($arr[name]) is changed to ".$become." (time expired)",'normal');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($expirehalfleech_torrent)
|
||||||
|
torrent_promotion_expire($expirehalfleech_torrent, 5, $halfleechbecome_torrent);
|
||||||
|
if ($expirefree_torrent)
|
||||||
|
torrent_promotion_expire($expirefree_torrent, 2, $freebecome_torrent);
|
||||||
|
if ($expiretwoup_torrent)
|
||||||
|
torrent_promotion_expire($expiretwoup_torrent, 3, $twoupbecome_torrent);
|
||||||
|
if ($expiretwoupfree_torrent)
|
||||||
|
torrent_promotion_expire($expiretwoupfree_torrent, 4, $twoupfreebecome_torrent);
|
||||||
|
if ($expiretwouphalfleech_torrent)
|
||||||
|
torrent_promotion_expire($expiretwouphalfleech_torrent, 6, $twouphalfleechbecome_torrent);
|
||||||
|
if ($expirethirtypercentleech_torrent)
|
||||||
|
torrent_promotion_expire($expirethirtypercentleech_torrent, 7, $thirtypercentleechbecome_torrent);
|
||||||
|
if ($expirenormal_torrent)
|
||||||
|
torrent_promotion_expire($expirenormal_torrent, 1, $normalbecome_torrent);
|
||||||
|
|
||||||
|
//expire individual torrent promotion
|
||||||
|
sql_query("UPDATE torrents SET sp_state = 1, promotion_time_type=0, promotion_until='0000-00-00 00:00:00' WHERE promotion_time_type=2 AND promotion_until < ".sqlesc(date("Y-m-d H:i:s",TIMENOW))) or sqlerr(__FILE__, __LINE__);
|
||||||
|
|
||||||
|
//End: expire torrent promotion
|
||||||
|
if ($printProgress) {
|
||||||
|
printProgress("expire torrent promotion");
|
||||||
|
}
|
||||||
|
//automatically pick hot
|
||||||
|
if ($hotdays_torrent)
|
||||||
|
{
|
||||||
|
$secs = (int)($hotdays_torrent * 86400); //XX days
|
||||||
|
$dt = sqlesc(date("Y-m-d H:i:s",(TIMENOW - ($secs))));
|
||||||
|
sql_query("UPDATE torrents SET picktype = 'hot' WHERE added > $dt AND picktype = 'normal' AND seeders > ".sqlesc($hotseeder_torrent)) or sqlerr(__FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
if ($printProgress) {
|
||||||
|
printProgress("automatically pick hot");
|
||||||
|
}
|
||||||
|
|
||||||
|
//Priority Class 4: cleanup every 24 hours
|
||||||
|
$res = sql_query("SELECT value_u FROM avps WHERE arg = 'lastcleantime4'");
|
||||||
|
$row = mysql_fetch_array($res);
|
||||||
|
if (!$row) {
|
||||||
|
sql_query("INSERT INTO avps (arg, value_u) VALUES ('lastcleantime4',$now)") or sqlerr(__FILE__, __LINE__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$ts = $row[0];
|
||||||
|
if ($ts + $autoclean_interval_four > $now && !$forceAll) {
|
||||||
|
return 'Cleanup ends at Priority Class 3';
|
||||||
|
} else {
|
||||||
|
sql_query("UPDATE avps SET value_u = ".sqlesc($now)." WHERE arg='lastcleantime4'") or sqlerr(__FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
|
||||||
|
//3.delete unconfirmed accounts
|
||||||
|
$deadtime = time() - $signup_timeout;
|
||||||
|
sql_query("DELETE FROM users WHERE status = 'pending' AND added < FROM_UNIXTIME($deadtime) AND last_login < FROM_UNIXTIME($deadtime) AND last_access < FROM_UNIXTIME($deadtime)") or sqlerr(__FILE__, __LINE__);
|
||||||
|
if ($printProgress) {
|
||||||
|
printProgress("delete unconfirmed accounts");
|
||||||
|
}
|
||||||
|
|
||||||
|
//5.delete old login attempts
|
||||||
|
$secs = 12*60*60; // Delete failed login attempts per half day.
|
||||||
|
$dt = sqlesc(date("Y-m-d H:i:s",(TIMENOW - $secs))); // calculate date.
|
||||||
|
sql_query("DELETE FROM loginattempts WHERE banned='no' AND added < $dt") or sqlerr(__FILE__, __LINE__);
|
||||||
|
if ($printProgress) {
|
||||||
|
printProgress("delete old login attempts");
|
||||||
|
}
|
||||||
|
|
||||||
|
//6.delete old invite codes
|
||||||
|
$secs = $invite_timeout*24*60*60; // when?
|
||||||
|
$dt = sqlesc(date("Y-m-d H:i:s",(TIMENOW - $secs))); // calculate date.
|
||||||
|
sql_query("DELETE FROM invites WHERE time_invited < $dt") or sqlerr(__FILE__, __LINE__);
|
||||||
|
if ($printProgress) {
|
||||||
|
printProgress("delete old invite codes");
|
||||||
|
}
|
||||||
|
|
||||||
|
//7.delete regimage codes
|
||||||
|
sql_query("TRUNCATE TABLE `regimages`") or sqlerr(__FILE__, __LINE__);
|
||||||
|
if ($printProgress) {
|
||||||
|
printProgress("delete regimage codes");
|
||||||
|
}
|
||||||
|
//10.clean up user accounts
|
||||||
|
// make sure VIP or above never get deleted
|
||||||
|
$neverdelete_account = ($neverdelete_account <= UC_VIP ? $neverdelete_account : UC_VIP);
|
||||||
|
|
||||||
|
//delete inactive user accounts, no transfer. Alt. 1: last access time
|
||||||
|
if ($deletenotransfer_account){
|
||||||
|
$secs = $deletenotransfer_account*24*60*60;
|
||||||
|
$dt = sqlesc(date("Y-m-d H:i:s",(TIMENOW - $secs)));
|
||||||
|
$maxclass = $neverdelete_account;
|
||||||
|
sql_query("DELETE FROM users WHERE parked='no' AND status='confirmed' AND class < $maxclass AND last_access < $dt AND (uploaded = 0 || uploaded = ".sqlesc($iniupload_main).") AND downloaded = 0") or sqlerr(__FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
if ($printProgress) {
|
||||||
|
printProgress("delete inactive user accounts, no transfer. Alt. 1: last access time");
|
||||||
|
}
|
||||||
|
|
||||||
|
//delete inactive user accounts, no transfer. Alt. 2: registering time
|
||||||
|
if ($deletenotransfertwo_account){
|
||||||
|
$secs = $deletenotransfertwo_account*24*60*60;
|
||||||
|
$dt = sqlesc(date("Y-m-d H:i:s",(TIMENOW - $secs)));
|
||||||
|
$maxclass = $neverdelete_account;
|
||||||
|
sql_query("DELETE FROM users WHERE parked='no' AND status='confirmed' AND class < $maxclass AND added < $dt AND (uploaded = 0 || uploaded = ".sqlesc($iniupload_main).") AND downloaded = 0") or sqlerr(__FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
if ($printProgress) {
|
||||||
|
printProgress("delete inactive user accounts, no transfer. Alt. 2: registering time");
|
||||||
|
}
|
||||||
|
|
||||||
|
//delete inactive user accounts, not parked
|
||||||
|
if ($deleteunpacked_account){
|
||||||
|
$secs = $deleteunpacked_account*24*60*60;
|
||||||
|
$dt = sqlesc(date("Y-m-d H:i:s",(TIMENOW - $secs)));
|
||||||
|
$maxclass = $neverdelete_account;
|
||||||
|
sql_query("DELETE FROM users WHERE parked='no' AND status='confirmed' AND class < $maxclass AND last_access < $dt") or sqlerr(__FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
if ($printProgress) {
|
||||||
|
printProgress("delete inactive user accounts, not parked");
|
||||||
|
}
|
||||||
|
|
||||||
|
//delete parked user accounts, parked
|
||||||
|
if ($deletepacked_account){
|
||||||
|
$secs = $deletepacked_account*24*60*60;
|
||||||
|
$dt = sqlesc(date("Y-m-d H:i:s",(TIMENOW - $secs)));
|
||||||
|
$maxclass = $neverdeletepacked_account;
|
||||||
|
sql_query("DELETE FROM users WHERE parked='yes' AND status='confirmed' AND class < $maxclass AND last_access < $dt") or sqlerr(__FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
if ($printProgress) {
|
||||||
|
printProgress("delete parked user accounts, parked");
|
||||||
|
}
|
||||||
|
|
||||||
|
//remove VIP status if time's up
|
||||||
|
$res = sql_query("SELECT id, modcomment FROM users WHERE vip_added='yes' AND vip_until < NOW()") or sqlerr(__FILE__, __LINE__);
|
||||||
|
if (mysql_num_rows($res) > 0)
|
||||||
|
{
|
||||||
|
while ($arr = mysql_fetch_assoc($res))
|
||||||
|
{
|
||||||
|
$dt = sqlesc(date("Y-m-d H:i:s"));
|
||||||
|
$subject = sqlesc($lang_cleanup_target[get_user_lang($arr[id])]['msg_vip_status_removed']);
|
||||||
|
$msg = sqlesc($lang_cleanup_target[get_user_lang($arr[id])]['msg_vip_status_removed_body']);
|
||||||
|
///---AUTOSYSTEM MODCOMMENT---//
|
||||||
|
$modcomment = htmlspecialchars($arr["modcomment"]);
|
||||||
|
$modcomment = date("Y-m-d") . " - VIP status removed by - AutoSystem.\n". $modcomment;
|
||||||
|
$modcom = sqlesc($modcomment);
|
||||||
|
///---end
|
||||||
|
sql_query("UPDATE users SET class = '1', vip_added = 'no', vip_until = '0000-00-00 00:00:00', modcomment = $modcom WHERE id = $arr[id]") or sqlerr(__FILE__, __LINE__);
|
||||||
|
sql_query("INSERT INTO messages (sender, receiver, added, msg, subject) VALUES(0, $arr[id], $dt, $msg, $subject)") or sqlerr(__FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($printProgress) {
|
||||||
|
printProgress("remove VIP status if time's up");
|
||||||
|
}
|
||||||
|
|
||||||
|
// promote peasant back to user
|
||||||
|
function peasant_to_user($down_floor_gb, $down_roof_gb, $minratio){
|
||||||
|
global $lang_cleanup_target;
|
||||||
|
|
||||||
|
if ($down_floor_gb){
|
||||||
|
$downlimit_floor = $down_floor_gb*1024*1024*1024;
|
||||||
|
$downlimit_roof = $down_roof_gb*1024*1024*1024;
|
||||||
|
$res = sql_query("SELECT id FROM users WHERE class = 0 AND downloaded >= $downlimit_floor ".($downlimit_roof > $down_floor_gb ? " AND downloaded < $downlimit_roof" : "")." AND uploaded / downloaded >= $minratio") or sqlerr(__FILE__, __LINE__);
|
||||||
|
if (mysql_num_rows($res) > 0)
|
||||||
|
{
|
||||||
|
$dt = sqlesc(date("Y-m-d H:i:s"));
|
||||||
|
while ($arr = mysql_fetch_assoc($res))
|
||||||
|
{
|
||||||
|
$subject = sqlesc($lang_cleanup_target[get_user_lang($arr[id])]['msg_low_ratio_warning_removed']);
|
||||||
|
$msg = sqlesc($lang_cleanup_target[get_user_lang($arr[id])]['msg_your_ratio_warning_removed']);
|
||||||
|
writecomment($arr[id],"Leech Warning removed by System.");
|
||||||
|
sql_query("UPDATE users SET class = 1, leechwarn = 'no', leechwarnuntil = '0000-00-00 00:00:00' WHERE id = $arr[id]") or sqlerr(__FILE__, __LINE__);
|
||||||
|
sql_query("INSERT INTO messages (sender, receiver, added, subject, msg) VALUES(0, $arr[id], $dt, $subject, $msg)") or sqlerr(__FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
peasant_to_user($psdlfive_account,0, $psratiofive_account);
|
||||||
|
peasant_to_user($psdlfour_account,$psdlfive_account, $psratiofour_account);
|
||||||
|
peasant_to_user($psdlthree_account,$psdlfour_account, $psratiothree_account);
|
||||||
|
peasant_to_user($psdltwo_account,$psdlthree_account, $psratiotwo_account);
|
||||||
|
peasant_to_user($psdlone_account,$psdltwo_account, $psratioone_account);
|
||||||
|
if ($printProgress) {
|
||||||
|
printProgress("promote peasant back to user");
|
||||||
|
}
|
||||||
|
//end promote peasant back to user
|
||||||
|
|
||||||
|
// start promotion
|
||||||
|
function promotion($class, $down_floor_gb, $minratio, $time_week, $addinvite = 0){
|
||||||
|
global $lang_cleanup_target;
|
||||||
|
$oriclass = $class - 1;
|
||||||
|
|
||||||
|
if ($down_floor_gb){
|
||||||
|
$limit = $down_floor_gb*1024*1024*1024;
|
||||||
|
$maxdt = date("Y-m-d H:i:s",(TIMENOW - 86400*7*$time_week));
|
||||||
|
$res = sql_query("SELECT id, max_class_once FROM users WHERE class = $oriclass AND downloaded >= $limit AND uploaded / downloaded >= $minratio AND added < ".sqlesc($maxdt)) or sqlerr(__FILE__, __LINE__);
|
||||||
|
if (mysql_num_rows($res) > 0)
|
||||||
|
{
|
||||||
|
$dt = sqlesc(date("Y-m-d H:i:s"));
|
||||||
|
while ($arr = mysql_fetch_assoc($res))
|
||||||
|
{
|
||||||
|
$subject = sqlesc($lang_cleanup_target[get_user_lang($arr[id])]['msg_promoted_to'].get_user_class_name($class,false,false,false));
|
||||||
|
$msg = sqlesc($lang_cleanup_target[get_user_lang($arr[id])]['msg_now_you_are'].get_user_class_name($class,false,false,false).$lang_cleanup_target[get_user_lang($arr[id])]['msg_see_faq']);
|
||||||
|
if($class<=$arr[max_class_once])
|
||||||
|
sql_query("UPDATE users SET class = $class WHERE id = $arr[id]") or sqlerr(__FILE__, __LINE__);
|
||||||
|
else
|
||||||
|
sql_query("UPDATE users SET class = $class, max_class_once=$class, invites=invites+$addinvite WHERE id = $arr[id]") or sqlerr(__FILE__, __LINE__);
|
||||||
|
|
||||||
|
sql_query("INSERT INTO messages (sender, receiver, added, subject, msg) VALUES(0, $arr[id], $dt, $subject, $msg)") or sqlerr(__FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//do not change the ascending order
|
||||||
|
promotion(UC_POWER_USER, $pudl_account, $puprratio_account, $putime_account, $getInvitesByPromotion_class[UC_POWER_USER]);
|
||||||
|
promotion(UC_ELITE_USER, $eudl_account, $euprratio_account, $eutime_account, $getInvitesByPromotion_class[UC_ELITE_USER]);
|
||||||
|
promotion(UC_CRAZY_USER, $cudl_account, $cuprratio_account, $cutime_account, $getInvitesByPromotion_class[UC_CRAZY_USER]);
|
||||||
|
promotion(UC_INSANE_USER, $iudl_account, $iuprratio_account, $iutime_account, $getInvitesByPromotion_class[UC_INSANE_USER]);
|
||||||
|
promotion(UC_VETERAN_USER, $vudl_account, $vuprratio_account, $vutime_account, $getInvitesByPromotion_class[UC_VETERAN_USER]);
|
||||||
|
promotion(UC_EXTREME_USER, $exudl_account, $exuprratio_account, $exutime_account, $getInvitesByPromotion_class[UC_EXTREME_USER]);
|
||||||
|
promotion(UC_ULTIMATE_USER, $uudl_account, $uuprratio_account, $uutime_account, $getInvitesByPromotion_class[UC_ULTIMATE_USER]);
|
||||||
|
promotion(UC_NEXUS_MASTER, $nmdl_account, $nmprratio_account, $nmtime_account, $getInvitesByPromotion_class[UC_NEXUS_MASTER]);
|
||||||
|
// end promotion
|
||||||
|
if ($printProgress) {
|
||||||
|
printProgress("promote users to other classes");
|
||||||
|
}
|
||||||
|
|
||||||
|
// start demotion
|
||||||
|
function demotion($class,$deratio){
|
||||||
|
global $lang_cleanup_target;
|
||||||
|
|
||||||
|
$newclass = $class - 1;
|
||||||
|
$res = sql_query("SELECT id FROM users WHERE class = $class AND uploaded / downloaded < $deratio") or sqlerr(__FILE__, __LINE__);
|
||||||
|
if (mysql_num_rows($res) > 0)
|
||||||
|
{
|
||||||
|
$dt = sqlesc(date("Y-m-d H:i:s"));
|
||||||
|
while ($arr = mysql_fetch_assoc($res))
|
||||||
|
{
|
||||||
|
$subject = $lang_cleanup_target[get_user_lang($arr[id])]['msg_demoted_to'].get_user_class_name($newclass,false,false,false);
|
||||||
|
$msg = $lang_cleanup_target[get_user_lang($arr[id])]['msg_demoted_from'].get_user_class_name($class,false,false,false).$lang_cleanup_target[get_user_lang($arr[id])]['msg_to'].get_user_class_name($newclass,false,false,false).$lang_cleanup_target[get_user_lang($arr[id])]['msg_because_ratio_drop_below'].$deratio.".\n";
|
||||||
|
sql_query("UPDATE users SET class = $newclass WHERE id = $arr[id]") or sqlerr(__FILE__, __LINE__);
|
||||||
|
sql_query("INSERT INTO messages (sender, receiver, added, subject, msg) VALUES(0, $arr[id], $dt, ".sqlesc($subject).", ".sqlesc($msg).")") or sqlerr(__FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//do not change the descending order
|
||||||
|
demotion(UC_NEXUS_MASTER,$nmderatio_account);
|
||||||
|
demotion(UC_ULTIMATE_USER,$uuderatio_account);
|
||||||
|
demotion(UC_EXTREME_USER,$exuderatio_account);
|
||||||
|
demotion(UC_VETERAN_USER,$vuderatio_account);
|
||||||
|
demotion(UC_INSANE_USER,$iuderatio_account);
|
||||||
|
demotion(UC_CRAZY_USER,$cuderatio_account);
|
||||||
|
demotion(UC_ELITE_USER,$euderatio_account);
|
||||||
|
demotion(UC_POWER_USER,$puderatio_account);
|
||||||
|
if ($printProgress) {
|
||||||
|
printProgress("demote users to other classes");
|
||||||
|
}
|
||||||
|
// end demotion
|
||||||
|
|
||||||
|
// start demote users to peasant
|
||||||
|
function user_to_peasant($down_floor_gb, $minratio){
|
||||||
|
global $lang_cleanup_target;
|
||||||
|
global $deletepeasant_account;
|
||||||
|
|
||||||
|
$length = $deletepeasant_account*86400; // warn users until xxx days
|
||||||
|
$until = date("Y-m-d H:i:s",(TIMENOW + $length));
|
||||||
|
$downlimit_floor = $down_floor_gb*1024*1024*1024;
|
||||||
|
$res = sql_query("SELECT id FROM users WHERE class = 1 AND downloaded > $downlimit_floor AND uploaded / downloaded < $minratio") or sqlerr(__FILE__, __LINE__);
|
||||||
|
if (mysql_num_rows($res) > 0)
|
||||||
|
{
|
||||||
|
$dt = sqlesc(date("Y-m-d H:i:s"));
|
||||||
|
while ($arr = mysql_fetch_assoc($res))
|
||||||
|
{
|
||||||
|
$subject = $lang_cleanup_target[get_user_lang($arr[id])]['msg_demoted_to'].get_user_class_name(UC_PEASANT,false,false,false);
|
||||||
|
$msg = $lang_cleanup_target[get_user_lang($arr[id])]['msg_must_fix_ratio_within'].$deletepeasant_account.$lang_cleanup_target[get_user_lang($arr[id])]['msg_days_or_get_banned'];
|
||||||
|
writecomment($arr[id],"Leech Warned by System - Low Ratio.");
|
||||||
|
sql_query("UPDATE users SET class = 0 , leechwarn = 'yes', leechwarnuntil = ".sqlesc($until)." WHERE id = $arr[id]") or sqlerr(__FILE__, __LINE__);
|
||||||
|
sql_query("INSERT INTO messages (sender, receiver, added, subject, msg) VALUES(0, $arr[id], $dt, ".sqlesc($subject).", ".sqlesc($msg).")") or sqlerr(__FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
user_to_peasant($psdlone_account, $psratioone_account);
|
||||||
|
user_to_peasant($psdltwo_account, $psratiotwo_account);
|
||||||
|
user_to_peasant($psdlthree_account, $psratiothree_account);
|
||||||
|
user_to_peasant($psdlfour_account, $psratiofour_account);
|
||||||
|
user_to_peasant($psdlfive_account, $psratiofive_account);
|
||||||
|
if ($printProgress) {
|
||||||
|
printProgress("demote Users to peasant");
|
||||||
|
}
|
||||||
|
// end Users to Peasant
|
||||||
|
|
||||||
|
//ban users with leechwarning expired
|
||||||
|
$dt = sqlesc(date("Y-m-d H:i:s")); // take date time
|
||||||
|
$res = sql_query("SELECT id FROM users WHERE enabled = 'yes' AND leechwarn = 'yes' AND leechwarnuntil < $dt") or sqlerr(__FILE__, __LINE__);
|
||||||
|
|
||||||
|
if (mysql_num_rows($res) > 0)
|
||||||
|
{
|
||||||
|
while ($arr = mysql_fetch_assoc($res))
|
||||||
|
{
|
||||||
|
writecomment($arr[id],"Banned by System because of Leech Warning expired.");
|
||||||
|
|
||||||
|
sql_query("UPDATE users SET enabled = 'no', leechwarnuntil = '0000-00-00 00:00:00' WHERE id = $arr[id]") or sqlerr(__FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($printProgress) {
|
||||||
|
printProgress("ban users with leechwarning expired");
|
||||||
|
}
|
||||||
|
|
||||||
|
//Remove warning of users
|
||||||
|
$dt = sqlesc(date("Y-m-d H:i:s")); // take date time
|
||||||
|
$res = sql_query("SELECT id FROM users WHERE enabled = 'yes' AND warned = 'yes' AND warneduntil < $dt") or sqlerr(__FILE__, __LINE__);
|
||||||
|
|
||||||
|
if (mysql_num_rows($res) > 0)
|
||||||
|
{
|
||||||
|
while ($arr = mysql_fetch_assoc($res))
|
||||||
|
{
|
||||||
|
$subject = $lang_cleanup_target[get_user_lang($arr[id])]['msg_warning_removed'];
|
||||||
|
$msg = $lang_cleanup_target[get_user_lang($arr[id])]['msg_your_warning_removed'];
|
||||||
|
writecomment($arr[id],"Warning removed by System.");
|
||||||
|
sql_query("UPDATE users SET warned = 'no', warneduntil = '0000-00-00 00:00:00' WHERE id = $arr[id]") or sqlerr(__FILE__, __LINE__);
|
||||||
|
sql_query("INSERT INTO messages (sender, receiver, added, subject, msg) VALUES(0, $arr[id], $dt, ".sqlesc($subject).", ".sqlesc($msg).")") or sqlerr(__FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($printProgress) {
|
||||||
|
printProgress("remove warning of users");
|
||||||
|
}
|
||||||
|
|
||||||
|
//17.update total seeding and leeching time of users
|
||||||
|
$res = sql_query("SELECT * FROM users") or sqlerr(__FILE__, __LINE__);
|
||||||
|
while($arr = mysql_fetch_assoc($res))
|
||||||
|
{
|
||||||
|
//die("s" . $arr['id']);
|
||||||
|
$res2 = sql_query("SELECT SUM(seedtime) as st, SUM(leechtime) as lt FROM snatched where userid = " . $arr['id'] . " LIMIT 1") or sqlerr(__FILE__, __LINE__);
|
||||||
|
$arr2 = mysql_fetch_assoc($res2) or sqlerr(__FILE__, __LINE__);
|
||||||
|
|
||||||
|
//die("ss" . $arr2['st']);
|
||||||
|
//die("sss" . "UPDATE users SET seedtime = " . $arr2['st'] . ", leechtime = " . $arr2['lt'] . " WHERE id = " . $arr['id']);
|
||||||
|
|
||||||
|
sql_query("UPDATE users SET seedtime = " . intval($arr2['st']) . ", leechtime = " . intval($arr2['lt']) . " WHERE id = " . $arr['id']) or sqlerr(__FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
if ($printProgress) {
|
||||||
|
printProgress("update total seeding and leeching time of users");
|
||||||
|
}
|
||||||
|
|
||||||
|
// delete torrents that have been dead for a long time
|
||||||
|
if ($deldeadtorrent_torrent > 0){
|
||||||
|
$length = $deldeadtorrent_torrent*86400;
|
||||||
|
$until = date("Y-m-d H:i:s",(TIMENOW - $length));
|
||||||
|
$dt = sqlesc(date("Y-m-d H:i:s"));
|
||||||
|
$res = sql_query("SELECT id, name, owner FROM torrents WHERE visible = 'no' AND last_action < ".sqlesc($until)." AND seeders = 0 AND leechers = 0") or sqlerr(__FILE__, __LINE__);
|
||||||
|
while($arr = mysql_fetch_assoc($res))
|
||||||
|
{
|
||||||
|
deletetorrent($arr['id']);
|
||||||
|
$subject = $lang_cleanup_target[get_user_lang($arr[owner])]['msg_your_torrent_deleted'];
|
||||||
|
$msg = $lang_cleanup_target[get_user_lang($arr[owner])]['msg_your_torrent']."[i]".$arr['name']."[/i]".$lang_cleanup_target[get_user_lang($arr[owner])]['msg_was_deleted_because_dead'];
|
||||||
|
sql_query("INSERT INTO messages (sender, receiver, added, subject, msg) VALUES(0, $arr[owner], $dt, ".sqlesc($subject).", ".sqlesc($msg).")") or sqlerr(__FILE__, __LINE__);
|
||||||
|
write_log("Torrent $arr[id] ($arr[name]) is deleted by system because of being dead for a long time.",'normal');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($printProgress) {
|
||||||
|
printProgress("delete torrents that have been dead for a long time");
|
||||||
|
}
|
||||||
|
|
||||||
|
//Priority Class 5: cleanup every 15 days
|
||||||
|
$res = sql_query("SELECT value_u FROM avps WHERE arg = 'lastcleantime5'");
|
||||||
|
$row = mysql_fetch_array($res);
|
||||||
|
if (!$row) {
|
||||||
|
sql_query("INSERT INTO avps (arg, value_u) VALUES ('lastcleantime5',$now)") or sqlerr(__FILE__, __LINE__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$ts = $row[0];
|
||||||
|
if ($ts + $autoclean_interval_five > $now && !$forceAll) {
|
||||||
|
return 'Cleanup ends at Priority Class 4';
|
||||||
|
} else {
|
||||||
|
sql_query("UPDATE avps SET value_u = ".sqlesc($now)." WHERE arg='lastcleantime5'") or sqlerr(__FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
|
||||||
|
//update clients' popularity
|
||||||
|
$res = sql_query("SELECT id FROM agent_allowed_family");
|
||||||
|
while($row = mysql_fetch_array($res)){
|
||||||
|
$count = get_row_count("users","WHERE clientselect=".sqlesc($row['id']));
|
||||||
|
sql_query("UPDATE agent_allowed_family SET hits=".sqlesc($count)." WHERE id=".sqlesc($row['id']));
|
||||||
|
}
|
||||||
|
if ($printProgress) {
|
||||||
|
printProgress("update clients' popularity");
|
||||||
|
}
|
||||||
|
|
||||||
|
//delete old messages sent by system
|
||||||
|
$length = 180*86400; //half a year
|
||||||
|
$until = date("Y-m-d H:i:s",(TIMENOW - $length));
|
||||||
|
sql_query("DELETE FROM messages WHERE sender = 0 AND added < ".sqlesc($until));
|
||||||
|
if ($printProgress) {
|
||||||
|
printProgress("delete old messages sent by system");
|
||||||
|
}
|
||||||
|
|
||||||
|
//delete old readpost records
|
||||||
|
$length = 180*86400; //half a year
|
||||||
|
$until = date("Y-m-d H:i:s",(TIMENOW - $length));
|
||||||
|
$postIdHalfYearAgo = get_single_value('posts', 'id', 'WHERE added < ' . sqlesc($until).' ORDER BY added DESC');
|
||||||
|
if ($postIdHalfYearAgo) {
|
||||||
|
sql_query("UPDATE users SET last_catchup = ".sqlesc($postIdHalfYearAgo)." WHERE last_catchup < ".sqlesc($postIdHalfYearAgo));
|
||||||
|
sql_query("DELETE FROM readposts WHERE lastpostread < ".sqlesc($postIdHalfYearAgo));
|
||||||
|
}
|
||||||
|
if ($printProgress) {
|
||||||
|
printProgress("delete old readpost records");
|
||||||
|
}
|
||||||
|
|
||||||
|
//delete old ip log
|
||||||
|
$length = 365*86400; //a year
|
||||||
|
$until = date("Y-m-d H:i:s",(TIMENOW - $length));
|
||||||
|
sql_query("DELETE FROM iplog WHERE access < ".sqlesc($until));
|
||||||
|
if ($printProgress) {
|
||||||
|
printProgress("delete old ip log");
|
||||||
|
}
|
||||||
|
|
||||||
|
//delete old general log
|
||||||
|
$secs = 365*86400; //a year
|
||||||
|
$until = date("Y-m-d H:i:s",(TIMENOW - $length));
|
||||||
|
sql_query("DELETE FROM sitelog WHERE added < ".sqlesc($until)) or sqlerr(__FILE__, __LINE__);
|
||||||
|
if ($printProgress) {
|
||||||
|
printProgress("delete old general log");
|
||||||
|
}
|
||||||
|
|
||||||
|
//1.delete torrents that doesn't exist any more
|
||||||
|
do {
|
||||||
|
$res = sql_query("SELECT id FROM torrents") or sqlerr(__FILE__, __LINE__);
|
||||||
|
$ar = array();
|
||||||
|
while ($row = mysql_fetch_array($res)) {
|
||||||
|
$id = $row[0];
|
||||||
|
$ar[$id] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!count($ar))
|
||||||
|
break;
|
||||||
|
|
||||||
|
$dp = @opendir($torrent_dir);
|
||||||
|
if (!$dp)
|
||||||
|
break;
|
||||||
|
|
||||||
|
$ar2 = array();
|
||||||
|
while (($file = readdir($dp)) !== false) {
|
||||||
|
if (!preg_match('/^(\d+)\.torrent$/', $file, $m))
|
||||||
|
continue;
|
||||||
|
$id = $m[1];
|
||||||
|
$ar2[$id] = 1;
|
||||||
|
if (isset($ar[$id]) && $ar[$id])
|
||||||
|
continue;
|
||||||
|
$ff = $torrent_dir . "/$file";
|
||||||
|
unlink($ff);
|
||||||
|
}
|
||||||
|
closedir($dp);
|
||||||
|
|
||||||
|
if (!count($ar2))
|
||||||
|
break;
|
||||||
|
|
||||||
|
$delids = array();
|
||||||
|
foreach (array_keys($ar) as $k) {
|
||||||
|
if (isset($ar2[$k]) && $ar2[$k])
|
||||||
|
continue;
|
||||||
|
$delids[] = $k;
|
||||||
|
unset($ar[$k]);
|
||||||
|
}
|
||||||
|
if (count($delids))
|
||||||
|
sql_query("DELETE FROM torrents WHERE id IN (" . join(",", $delids) . ")") or sqlerr(__FILE__, __LINE__);
|
||||||
|
|
||||||
|
$res = sql_query("SELECT torrent FROM peers GROUP BY torrent") or sqlerr(__FILE__, __LINE__);
|
||||||
|
$delids = array();
|
||||||
|
while ($row = mysql_fetch_array($res)) {
|
||||||
|
$id = $row[0];
|
||||||
|
if (isset($ar[$id]) && $ar[$id])
|
||||||
|
continue;
|
||||||
|
$delids[] = $id;
|
||||||
|
}
|
||||||
|
if (count($delids))
|
||||||
|
sql_query("DELETE FROM peers WHERE torrent IN (" . join(",", $delids) . ")") or sqlerr(__FILE__, __LINE__);
|
||||||
|
|
||||||
|
$res = sql_query("SELECT torrent FROM files GROUP BY torrent") or sqlerr(__FILE__, __LINE__);
|
||||||
|
$delids = array();
|
||||||
|
while ($row = mysql_fetch_array($res)) {
|
||||||
|
$id = $row[0];
|
||||||
|
if ($ar[$id])
|
||||||
|
continue;
|
||||||
|
$delids[] = $id;
|
||||||
|
}
|
||||||
|
if (count($delids))
|
||||||
|
sql_query("DELETE FROM files WHERE torrent IN (" . join(",", $delids) . ")") or sqlerr(__FILE__, __LINE__);
|
||||||
|
} while (0);
|
||||||
|
if ($printProgress) {
|
||||||
|
printProgress("delete torrents that doesn't exist any more");
|
||||||
|
}
|
||||||
|
|
||||||
|
//8.lock topics where last post was made more than x days ago
|
||||||
|
$secs = 365*24*60*60;
|
||||||
|
sql_query("UPDATE topics, posts SET topics.locked='yes' WHERE topics.lastpost = posts.id AND topics.sticky = 'no' AND UNIX_TIMESTAMP(posts.added) < ".TIMENOW." - $secs") or sqlerr(__FILE__, __LINE__);
|
||||||
|
|
||||||
|
if ($printProgress) {
|
||||||
|
printProgress("lock topics where last post was made more than x days ago");
|
||||||
|
}
|
||||||
|
|
||||||
|
//9.delete report items older than four week
|
||||||
|
$secs = 4*7*24*60*60;
|
||||||
|
$dt = sqlesc(date("Y-m-d H:i:s",(TIMENOW - $secs)));
|
||||||
|
sql_query("DELETE FROM reports WHERE dealtwith=1 AND added < $dt") or sqlerr(__FILE__, __LINE__);
|
||||||
|
if ($printProgress) {
|
||||||
|
printProgress("delete report items older than four week");
|
||||||
|
}
|
||||||
|
return 'Full cleanup is done';
|
||||||
|
}
|
||||||
|
?>
|
||||||
403
include/config.php
Normal file
403
include/config.php
Normal file
@@ -0,0 +1,403 @@
|
|||||||
|
<?php
|
||||||
|
# IMPORTANT: Do not edit below unless you know what you are doing!
|
||||||
|
if(!defined('IN_TRACKER'))
|
||||||
|
die('Hacking attempt!');
|
||||||
|
|
||||||
|
$CONFIGURATIONS = array('ACCOUNT', 'ADVERTISEMENT', 'ATTACHMENT', 'AUTHORITY', 'BASIC', 'BONUS', 'CODE', 'MAIN', 'SECURITY', 'SMTP', 'TORRENT', 'TWEAK');
|
||||||
|
function ReadConfig ($configname = NULL) {
|
||||||
|
global $CONFIGURATIONS;
|
||||||
|
if ($configname) {
|
||||||
|
$configname = basename($configname);
|
||||||
|
$tmp = oldReadConfig($configname);
|
||||||
|
WriteConfig($configname, $tmp);
|
||||||
|
@unlink('./config/'.$configname);
|
||||||
|
return $tmp;
|
||||||
|
} else {
|
||||||
|
foreach ($CONFIGURATIONS as $CONFIGURATION) {
|
||||||
|
$GLOBALS[$CONFIGURATION] = ReadConfig($CONFIGURATION);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function oldReadConfig ($configname) {
|
||||||
|
if (strstr($configname, ',')) {
|
||||||
|
$configlist = explode(',', $configname);
|
||||||
|
foreach ($configlist as $key=>$configname) {
|
||||||
|
ReadConfig(trim($configname));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$configname = basename($configname);
|
||||||
|
$path = './config/'.$configname;
|
||||||
|
if (!file_exists($path)) {
|
||||||
|
die("Error! File <b>".htmlspecialchars($configname)."</b> doesn't exist!</font><br /><font color=blue>Before the setup starts, please ensure that you have properly configured file and directory access permissions. Please see below.</font><br /><br />chmod 777 config/<br />chmod 777 config/".$configname);
|
||||||
|
}
|
||||||
|
|
||||||
|
$fp = fopen($path, 'r');
|
||||||
|
$content = '';
|
||||||
|
while (!feof($fp)) {
|
||||||
|
$content .= fread($fp, 102400);
|
||||||
|
}
|
||||||
|
fclose($fp);
|
||||||
|
|
||||||
|
if (empty($content)) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
$tmp = @unserialize($content);
|
||||||
|
|
||||||
|
if (empty($tmp)) {
|
||||||
|
die("Error! <font color=red>Cannot read configuration file <b>".htmlspecialchars($configname)."</b></font><br /><font color=blue>Before the setup starts, please ensure that you have properly configured file and directory access permissions. For *nix system, please see below.</font><br />chmod 777 config <br />chmod 777 config/".$configname."<br /><br /> If access permission is alright, perhaps there's some misconfiguration or the configuration file is corrupted. Please check config/".$configname);
|
||||||
|
}
|
||||||
|
$GLOBALS[$configname] = $tmp;
|
||||||
|
return $tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (file_exists('config/allconfig.php')) {
|
||||||
|
require('config/allconfig.php');
|
||||||
|
} else {
|
||||||
|
ReadConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
$SITENAME = $BASIC['SITENAME'];
|
||||||
|
$BASEURL = $BASIC['BASEURL'];
|
||||||
|
$announce_urls = array();
|
||||||
|
$announce_urls[] = $BASIC['announce_url'];
|
||||||
|
$mysql_host = $BASIC['mysql_host'];
|
||||||
|
$mysql_user = $BASIC['mysql_user'];
|
||||||
|
$mysql_pass = $BASIC['mysql_pass'];
|
||||||
|
$mysql_db = $BASIC['mysql_db'];
|
||||||
|
|
||||||
|
|
||||||
|
$SITE_ONLINE = $MAIN['site_online'];
|
||||||
|
$max_torrent_size = $MAIN['max_torrent_size'];
|
||||||
|
$announce_interval = (int)$MAIN['announce_interval'];
|
||||||
|
$annintertwoage = (int)$MAIN['annintertwoage'];
|
||||||
|
$annintertwo = (int)$MAIN['annintertwo'];
|
||||||
|
$anninterthreeage = (int)$MAIN['anninterthreeage'];
|
||||||
|
$anninterthree = (int)$MAIN['anninterthree'];
|
||||||
|
$signup_timeout = $MAIN['signup_timeout'];
|
||||||
|
$minoffervotes = $MAIN['minoffervotes'];
|
||||||
|
$offervotetimeout_main = $MAIN['offervotetimeout'];
|
||||||
|
$offeruptimeout_main = $MAIN['offeruptimeout'];
|
||||||
|
$maxsubsize_main = $MAIN['maxsubsize'];
|
||||||
|
$maxnewsnum_main = $MAIN['maxnewsnum'];
|
||||||
|
$forumpostsperpage = $MAIN['postsperpage'];
|
||||||
|
$forumtopicsperpage_main = $MAIN['topicsperpage'];
|
||||||
|
$torrentsperpage_main = (int)$MAIN['torrentsperpage'];
|
||||||
|
$max_dead_torrent_time = $MAIN['max_dead_torrent_time'];
|
||||||
|
$maxusers = $MAIN['maxusers'];
|
||||||
|
$torrent_dir = $MAIN['torrent_dir'];
|
||||||
|
$iniupload_main = $MAIN['iniupload'];
|
||||||
|
$SITEEMAIL = $MAIN['SITEEMAIL'];
|
||||||
|
$ACCOUNTANTID = (int)$MAIN['ACCOUNTANTID'];
|
||||||
|
$ALIPAYACCOUNT = $MAIN['ALIPAYACCOUNT'];
|
||||||
|
$PAYPALACCOUNT = $MAIN['PAYPALACCOUNT'];
|
||||||
|
$SLOGAN = $MAIN['SLOGAN'];
|
||||||
|
$icplicense_main = $MAIN['icplicense'];
|
||||||
|
$autoclean_interval_one = $MAIN['autoclean_interval_one'];
|
||||||
|
$autoclean_interval_two = $MAIN['autoclean_interval_two'];
|
||||||
|
$autoclean_interval_three = $MAIN['autoclean_interval_three'];
|
||||||
|
$autoclean_interval_four = $MAIN['autoclean_interval_four'];
|
||||||
|
$autoclean_interval_five = $MAIN['autoclean_interval_five'];
|
||||||
|
$REPORTMAIL = $MAIN['reportemail'];
|
||||||
|
$invitesystem = $MAIN['invitesystem'];
|
||||||
|
$registration = $MAIN['registration'];
|
||||||
|
$showmovies['hot'] = $MAIN['showhotmovies'];
|
||||||
|
$showmovies['classic'] = $MAIN['showclassicmovies'];
|
||||||
|
$showextinfo['imdb'] = $MAIN['showimdbinfo'];
|
||||||
|
$enablenfo_main = $MAIN['enablenfo'];
|
||||||
|
$showschool = $MAIN['enableschool'];
|
||||||
|
$restrictemaildomain = $MAIN['restrictemail'];
|
||||||
|
$showpolls_main = $MAIN['showpolls'];
|
||||||
|
$showstats_main = $MAIN['showstats'];
|
||||||
|
//$showlastxforumposts_main = $MAIN['showlastxforumposts'];
|
||||||
|
$showlastxtorrents_main = $MAIN['showlastxtorrents'];
|
||||||
|
$showtrackerload = $MAIN['showtrackerload'];
|
||||||
|
$showshoutbox_main = $MAIN['showshoutbox'];
|
||||||
|
$showfunbox_main = $MAIN['showfunbox'];
|
||||||
|
$enableoffer = $MAIN['showoffer'];
|
||||||
|
$sptime = $MAIN['sptime'];
|
||||||
|
$showhelpbox_main = $MAIN['showhelpbox'];
|
||||||
|
$enablebitbucket_main = $MAIN['enablebitbucket'];
|
||||||
|
$smalldescription_main = $MAIN['smalldescription'];
|
||||||
|
$altname_main = $MAIN['altname'];
|
||||||
|
$enableextforum = $MAIN['extforum'];
|
||||||
|
$extforumurl = $MAIN['extforumurl'];
|
||||||
|
$deflang = $MAIN['defaultlang'];
|
||||||
|
$defcss = $MAIN['defstylesheet'];
|
||||||
|
$enabledonation = $MAIN['donation'];
|
||||||
|
$enablespecial = $MAIN['spsct'];
|
||||||
|
$browsecatmode = (int)$MAIN['browsecat'];
|
||||||
|
$specialcatmode = (int)$MAIN['specialcat'];
|
||||||
|
$waitsystem = $MAIN['waitsystem'];
|
||||||
|
$maxdlsystem = $MAIN['maxdlsystem'];
|
||||||
|
$bitbucket = $MAIN['bitbucket'];
|
||||||
|
$torrentnameprefix = $MAIN['torrentnameprefix'];
|
||||||
|
$showforumstats_main = $MAIN['showforumstats'];
|
||||||
|
$verification = $MAIN['verification'];
|
||||||
|
$invite_count = $MAIN['invite_count'];
|
||||||
|
$invite_timeout = $MAIN['invite_timeout'];
|
||||||
|
$seeding_leeching_time_calc_start = $MAIN['seeding_leeching_time_calc_start'];
|
||||||
|
$logo_main = $MAIN['logo'];
|
||||||
|
|
||||||
|
|
||||||
|
$emailnotify_smtp = $SMTP['emailnotify'];
|
||||||
|
$smtptype = $SMTP['smtptype'];
|
||||||
|
$smtp_host = $SMTP['smtp_host'];
|
||||||
|
$smtp_port = $SMTP['smtp_port'];
|
||||||
|
if (strtoupper(substr(PHP_OS,0,3)=='WIN'))
|
||||||
|
$smtp_from = $SMTP['smtp_from'];
|
||||||
|
$smtpaddress = $SMTP['smtpaddress'];
|
||||||
|
$smtpport = $SMTP['smtpport'];
|
||||||
|
$accountname = $SMTP['accountname'];
|
||||||
|
$accountpassword = $SMTP['accountpassword'];
|
||||||
|
|
||||||
|
$securelogin = $SECURITY['securelogin'];
|
||||||
|
$securetracker = $SECURITY['securetracker'];
|
||||||
|
$https_announce_urls = array();
|
||||||
|
$https_announce_urls[] = $SECURITY['https_announce_url'];
|
||||||
|
$iv = $SECURITY['iv'];
|
||||||
|
$maxip = $SECURITY['maxip'];
|
||||||
|
$maxloginattempts = $SECURITY['maxloginattempts'];
|
||||||
|
$disableemailchange = $SECURITY['changeemail'];
|
||||||
|
$cheaterdet_security = $SECURITY['cheaterdet'];
|
||||||
|
$nodetect_security = $SECURITY['nodetect'];
|
||||||
|
|
||||||
|
$defaultclass_class = $AUTHORITY['defaultclass'];
|
||||||
|
$staffmem_class = $AUTHORITY['staffmem'];
|
||||||
|
$newsmanage_class = $AUTHORITY['newsmanage'];
|
||||||
|
$newfunitem_class = $AUTHORITY['newfunitem'];
|
||||||
|
$funmanage_class = $AUTHORITY['funmanage'];
|
||||||
|
$sbmanage_class = $AUTHORITY['sbmanage'];
|
||||||
|
$pollmanage_class = $AUTHORITY['pollmanage'];
|
||||||
|
$applylink_class = $AUTHORITY['applylink'];
|
||||||
|
$linkmanage_class = $AUTHORITY['linkmanage'];
|
||||||
|
$postmanage_class = $AUTHORITY['postmanage'];
|
||||||
|
$commanage_class = $AUTHORITY['commanage'];
|
||||||
|
$forummanage_class = $AUTHORITY['forummanage'];
|
||||||
|
$viewuserlist_class = $AUTHORITY['viewuserlist'];
|
||||||
|
$torrentmanage_class = $AUTHORITY['torrentmanage'];
|
||||||
|
$torrentsticky_class = $AUTHORITY['torrentsticky'];
|
||||||
|
$torrentonpromotion_class = $AUTHORITY['torrentonpromotion'];
|
||||||
|
$askreseed_class = $AUTHORITY['askreseed'];
|
||||||
|
$viewnfo_class = $AUTHORITY['viewnfo'];
|
||||||
|
$torrentstructure_class = $AUTHORITY['torrentstructure'];
|
||||||
|
$sendinvite_class = $AUTHORITY['sendinvite'];
|
||||||
|
$viewhistory_class = $AUTHORITY['viewhistory'];
|
||||||
|
$topten_class = $AUTHORITY['topten'];
|
||||||
|
$log_class = $AUTHORITY['log'];
|
||||||
|
$confilog_class = $AUTHORITY['confilog'];
|
||||||
|
$userprofile_class = $AUTHORITY['userprofile'];
|
||||||
|
$torrenthistory_class = $AUTHORITY['torrenthistory'];
|
||||||
|
$prfmanage_class = $AUTHORITY['prfmanage'];
|
||||||
|
$cruprfmanage_class = $AUTHORITY['cruprfmanage'];
|
||||||
|
$uploadsub_class = $AUTHORITY['uploadsub'];
|
||||||
|
$delownsub_class = $AUTHORITY['delownsub'];
|
||||||
|
$submanage_class = $AUTHORITY['submanage'];
|
||||||
|
$updateextinfo_class = $AUTHORITY['updateextinfo'];
|
||||||
|
$viewanonymous_class = $AUTHORITY['viewanonymous'];
|
||||||
|
$beanonymous_class = $AUTHORITY['beanonymous'];
|
||||||
|
$addoffer_class = $AUTHORITY['addoffer'];
|
||||||
|
$offermanage_class = $AUTHORITY['offermanage'];
|
||||||
|
$upload_class = $AUTHORITY['upload'];
|
||||||
|
$uploadspecial_class = $AUTHORITY['uploadspecial'];
|
||||||
|
$movetorrent_class = $AUTHORITY['movetorrent'];
|
||||||
|
$chrmanage_class = $AUTHORITY['chrmanage'];
|
||||||
|
$viewinvite_class = $AUTHORITY['viewinvite'];
|
||||||
|
$buyinvite_class = $AUTHORITY['buyinvite'];
|
||||||
|
$seebanned_class = $AUTHORITY['seebanned'];
|
||||||
|
$againstoffer_class = $AUTHORITY['againstoffer'];
|
||||||
|
$userbar_class = $AUTHORITY['userbar'];
|
||||||
|
|
||||||
|
$where_tweak = $TWEAK['where'];
|
||||||
|
$iplog1 = $TWEAK['iplog1'];
|
||||||
|
$bonus_tweak = $TWEAK['bonus'];
|
||||||
|
$titlekeywords_tweak = $TWEAK['titlekeywords'];
|
||||||
|
$metakeywords_tweak = $TWEAK['metakeywords'];
|
||||||
|
$metadescription_tweak = $TWEAK['metadescription'];
|
||||||
|
$datefounded = $TWEAK['datefounded'];
|
||||||
|
$enablelocation_tweak = $TWEAK['enablelocation'];
|
||||||
|
$enablesqldebug_tweak = $TWEAK['enablesqldebug'];
|
||||||
|
$sqldebug_tweak = $TWEAK['sqldebug'];
|
||||||
|
$cssdate_tweak = $TWEAK['cssdate'];
|
||||||
|
$enabletooltip_tweak = $TWEAK['enabletooltip'];
|
||||||
|
$prolinkimg = $TWEAK['prolinkimg'];
|
||||||
|
$analyticscode_tweak = $TWEAK['analyticscode'];
|
||||||
|
|
||||||
|
$enableattach_attachment = $ATTACHMENT['enableattach'];
|
||||||
|
$classone_attachment = $ATTACHMENT['classone'];
|
||||||
|
$countone_attachment = $ATTACHMENT['countone'];
|
||||||
|
$sizeone_attachment = $ATTACHMENT['sizeone'];
|
||||||
|
$extone_attachment = $ATTACHMENT['extone'];
|
||||||
|
$classtwo_attachment = $ATTACHMENT['classtwo'];
|
||||||
|
$counttwo_attachment = $ATTACHMENT['counttwo'];
|
||||||
|
$sizetwo_attachment = $ATTACHMENT['sizetwo'];
|
||||||
|
$exttwo_attachment = $ATTACHMENT['exttwo'];
|
||||||
|
$classthree_attachment = $ATTACHMENT['classthree'];
|
||||||
|
$countthree_attachment = $ATTACHMENT['countthree'];
|
||||||
|
$sizethree_attachment = $ATTACHMENT['sizethree'];
|
||||||
|
$extthree_attachment = $ATTACHMENT['extthree'];
|
||||||
|
$classfour_attachment = $ATTACHMENT['classfour'];
|
||||||
|
$countfour_attachment = $ATTACHMENT['countfour'];
|
||||||
|
$sizefour_attachment = $ATTACHMENT['sizefour'];
|
||||||
|
$extfour_attachment = $ATTACHMENT['extfour'];
|
||||||
|
$savedirectory_attachment = $ATTACHMENT['savedirectory'];
|
||||||
|
$httpdirectory_attachment = $ATTACHMENT['httpdirectory'];
|
||||||
|
$savedirectorytype_attachment = $ATTACHMENT['savedirectorytype'];
|
||||||
|
$thumbnailtype_attachment = $ATTACHMENT['thumbnailtype'];
|
||||||
|
$thumbquality_attachment = $ATTACHMENT['thumbquality'];
|
||||||
|
$thumbwidth_attachment = $ATTACHMENT['thumbwidth'];
|
||||||
|
$thumbheight_attachment = $ATTACHMENT['thumbheight'];
|
||||||
|
$watermarkpos_attachment = $ATTACHMENT['watermarkpos'];
|
||||||
|
$watermarkwidth_attachment = $ATTACHMENT['watermarkwidth'];
|
||||||
|
$watermarkheight_attachment = $ATTACHMENT['watermarkheight'];
|
||||||
|
$watermarkquality_attachment = $ATTACHMENT['watermarkquality'];
|
||||||
|
$altthumbwidth_attachment = $ATTACHMENT['altthumbwidth'];
|
||||||
|
$altthumbheight_attachment = $ATTACHMENT['altthumbheight'];
|
||||||
|
|
||||||
|
|
||||||
|
$enablead_advertisement = $ADVERTISEMENT['enablead'];
|
||||||
|
$enablenoad_advertisement = $ADVERTISEMENT['enablenoad'];
|
||||||
|
$noad_advertisement = $ADVERTISEMENT['noad'];
|
||||||
|
$enablebonusnoad_advertisement = $ADVERTISEMENT['enablebonusnoad'];
|
||||||
|
$bonusnoad_advertisement = $ADVERTISEMENT['bonusnoad'];
|
||||||
|
$bonusnoadpoint_advertisement = $ADVERTISEMENT['bonusnoadpoint'];
|
||||||
|
$bonusnoadtime_advertisement = $ADVERTISEMENT['bonusnoadtime'];
|
||||||
|
$adclickbonus_advertisement = $ADVERTISEMENT['adclickbonus'];
|
||||||
|
|
||||||
|
$mainversion_code = $CODE['mainversion'];
|
||||||
|
$subversion_code = $CODE['subversion'];
|
||||||
|
$releasedate_code = $CODE['releasedate'];
|
||||||
|
$website_code = $CODE['website'];
|
||||||
|
|
||||||
|
$donortimes_bonus = $BONUS['donortimes'];
|
||||||
|
$perseeding_bonus = $BONUS['perseeding'];
|
||||||
|
$maxseeding_bonus = $BONUS['maxseeding'];
|
||||||
|
$tzero_bonus = $BONUS['tzero'];
|
||||||
|
$nzero_bonus = $BONUS['nzero'];
|
||||||
|
$bzero_bonus = $BONUS['bzero'];
|
||||||
|
$l_bonus = $BONUS['l'];
|
||||||
|
$uploadtorrent_bonus = $BONUS['uploadtorrent'];
|
||||||
|
$uploadsubtitle_bonus = $BONUS['uploadsubtitle'];
|
||||||
|
$starttopic_bonus = $BONUS['starttopic'];
|
||||||
|
$makepost_bonus = $BONUS['makepost'];
|
||||||
|
$addcomment_bonus = $BONUS['addcomment'];
|
||||||
|
$pollvote_bonus = $BONUS['pollvote'];
|
||||||
|
$offervote_bonus = $BONUS['offervote'];
|
||||||
|
$funboxvote_bonus = $BONUS['funboxvote'];
|
||||||
|
$saythanks_bonus = $BONUS['saythanks'];
|
||||||
|
$receivethanks_bonus = $BONUS['receivethanks'];
|
||||||
|
$funboxreward_bonus = $BONUS['funboxreward'];
|
||||||
|
$onegbupload_bonus = $BONUS['onegbupload'];
|
||||||
|
$fivegbupload_bonus = $BONUS['fivegbupload'];
|
||||||
|
$tengbupload_bonus = $BONUS['tengbupload'];
|
||||||
|
$ratiolimit_bonus = $BONUS['ratiolimit'];
|
||||||
|
$dlamountlimit_bonus = $BONUS['dlamountlimit'];
|
||||||
|
$oneinvite_bonus = $BONUS['oneinvite'];
|
||||||
|
$customtitle_bonus = $BONUS['customtitle'];
|
||||||
|
$vipstatus_bonus = $BONUS['vipstatus'];
|
||||||
|
$bonusgift_bonus = $BONUS['bonusgift'];
|
||||||
|
$basictax_bonus = 0+$BONUS['basictax'];
|
||||||
|
$taxpercentage_bonus = 0+$BONUS['taxpercentage'];
|
||||||
|
$prolinkpoint_bonus = $BONUS['prolinkpoint'];
|
||||||
|
$prolinktime_bonus = $BONUS['prolinktime'];
|
||||||
|
|
||||||
|
$neverdelete_account = $ACCOUNT['neverdelete'];
|
||||||
|
$neverdeletepacked_account = $ACCOUNT['neverdeletepacked'];
|
||||||
|
$deletepacked_account = $ACCOUNT['deletepacked'];
|
||||||
|
$deleteunpacked_account = $ACCOUNT['deleteunpacked'];
|
||||||
|
$deletenotransfer_account = $ACCOUNT['deletenotransfer'];
|
||||||
|
$deletenotransfertwo_account = $ACCOUNT['deletenotransfertwo'];
|
||||||
|
$deletepeasant_account = $ACCOUNT['deletepeasant'];
|
||||||
|
$psdlone_account = $ACCOUNT['psdlone'];
|
||||||
|
$psratioone_account = $ACCOUNT['psratioone'];
|
||||||
|
$psdltwo_account = $ACCOUNT['psdltwo'];
|
||||||
|
$psratiotwo_account = $ACCOUNT['psratiotwo'];
|
||||||
|
$psdlthree_account = $ACCOUNT['psdlthree'];
|
||||||
|
$psratiothree_account = $ACCOUNT['psratiothree'];
|
||||||
|
$psdlfour_account = $ACCOUNT['psdlfour'];
|
||||||
|
$psratiofour_account = $ACCOUNT['psratiofour'];
|
||||||
|
$psdlfive_account = $ACCOUNT['psdlfive'];
|
||||||
|
$psratiofive_account = $ACCOUNT['psratiofive'];
|
||||||
|
$putime_account = $ACCOUNT['putime'];
|
||||||
|
$pudl_account = $ACCOUNT['pudl'];
|
||||||
|
$puprratio_account = $ACCOUNT['puprratio'];
|
||||||
|
$puderatio_account = $ACCOUNT['puderatio'];
|
||||||
|
$eutime_account = $ACCOUNT['eutime'];
|
||||||
|
$eudl_account = $ACCOUNT['eudl'];
|
||||||
|
$euprratio_account = $ACCOUNT['euprratio'];
|
||||||
|
$euderatio_account = $ACCOUNT['euderatio'];
|
||||||
|
$cutime_account = $ACCOUNT['cutime'];
|
||||||
|
$cudl_account = $ACCOUNT['cudl'];
|
||||||
|
$cuprratio_account = $ACCOUNT['cuprratio'];
|
||||||
|
$cuderatio_account = $ACCOUNT['cuderatio'];
|
||||||
|
$iutime_account = $ACCOUNT['iutime'];
|
||||||
|
$iudl_account = $ACCOUNT['iudl'];
|
||||||
|
$iuprratio_account = $ACCOUNT['iuprratio'];
|
||||||
|
$iuderatio_account = $ACCOUNT['iuderatio'];
|
||||||
|
$vutime_account = $ACCOUNT['vutime'];
|
||||||
|
$vudl_account = $ACCOUNT['vudl'];
|
||||||
|
$vuprratio_account = $ACCOUNT['vuprratio'];
|
||||||
|
$vuderatio_account = $ACCOUNT['vuderatio'];
|
||||||
|
$exutime_account = $ACCOUNT['exutime'];
|
||||||
|
$exudl_account = $ACCOUNT['exudl'];
|
||||||
|
$exuprratio_account = $ACCOUNT['exuprratio'];
|
||||||
|
$exuderatio_account = $ACCOUNT['exuderatio'];
|
||||||
|
$uutime_account = $ACCOUNT['uutime'];
|
||||||
|
$uudl_account = $ACCOUNT['uudl'];
|
||||||
|
$uuprratio_account = $ACCOUNT['uuprratio'];
|
||||||
|
$uuderatio_account = $ACCOUNT['uuderatio'];
|
||||||
|
$nmtime_account = $ACCOUNT['nmtime'];
|
||||||
|
$nmdl_account = $ACCOUNT['nmdl'];
|
||||||
|
$nmprratio_account = $ACCOUNT['nmprratio'];
|
||||||
|
$nmderatio_account = $ACCOUNT['nmderatio'];
|
||||||
|
$getInvitesByPromotion_class = $ACCOUNT['getInvitesByPromotion'];
|
||||||
|
|
||||||
|
$prorules_torrent = $TORRENT['prorules'];
|
||||||
|
$randomhalfleech_torrent = $TORRENT['randomhalfleech'];
|
||||||
|
$randomfree_torrent = $TORRENT['randomfree'];
|
||||||
|
$randomtwoup_torrent = $TORRENT['randomtwoup'];
|
||||||
|
$randomtwoupfree_torrent = $TORRENT['randomtwoupfree'];
|
||||||
|
$randomtwouphalfdown_torrent = $TORRENT['randomtwouphalfdown'];
|
||||||
|
$randomthirtypercentdown_torrent = $TORRENT['randomthirtypercentdown'];
|
||||||
|
$largesize_torrent = $TORRENT['largesize'];
|
||||||
|
$largepro_torrent = $TORRENT['largepro'];
|
||||||
|
$expirehalfleech_torrent = $TORRENT['expirehalfleech'];
|
||||||
|
$expirefree_torrent = $TORRENT['expirefree'];
|
||||||
|
$expiretwoup_torrent = $TORRENT['expiretwoup'];
|
||||||
|
$expiretwoupfree_torrent = $TORRENT['expiretwoupfree'];
|
||||||
|
$expiretwouphalfleech_torrent = $TORRENT['expiretwouphalfleech'];
|
||||||
|
$expirethirtypercentleech_torrent = $TORRENT['expirethirtypercentleech'];
|
||||||
|
$expirenormal_torrent = $TORRENT['expirenormal'];
|
||||||
|
$hotdays_torrent = $TORRENT['hotdays'];
|
||||||
|
$hotseeder_torrent = $TORRENT['hotseeder'];
|
||||||
|
$halfleechbecome_torrent = $TORRENT['halfleechbecome'];
|
||||||
|
$freebecome_torrent = $TORRENT['freebecome'];
|
||||||
|
$twoupbecome_torrent = $TORRENT['twoupbecome'];
|
||||||
|
$twoupfreebecome_torrent = $TORRENT['twoupfreebecome'];
|
||||||
|
$twouphalfleechbecome_torrent = $TORRENT['twouphalfleechbecome'];
|
||||||
|
$thirtypercentleechbecome_torrent = $TORRENT['thirtypercentleechbecome'];
|
||||||
|
$normalbecome_torrent = $TORRENT['normalbecome'];
|
||||||
|
$uploaderdouble_torrent = $TORRENT['uploaderdouble'];
|
||||||
|
$deldeadtorrent_torrent = $TORRENT['deldeadtorrent'];
|
||||||
|
|
||||||
|
foreach ($CONFIGURATIONS as $CONFIGURATION) {
|
||||||
|
unset($GLOBALS[$CONFIGURATION]);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Directory for subs
|
||||||
|
$SUBSPATH = "subs";
|
||||||
|
//Whether clean-up is triggered by cron, instead of the default browser clicks.
|
||||||
|
//Set this to true ONLY if you have setup other method to schedule the clean-up process.
|
||||||
|
//e.g. cron on *nix, add the following line (without "") in your crontab file
|
||||||
|
//"*/5 * * * * wget -O - -q -t 1 http://www.nexusphp.com/cron.php"
|
||||||
|
//NOTE:
|
||||||
|
//Make sure you have wget installed on your OS
|
||||||
|
//replace "http://www.nexusphp.com/" with your own site address
|
||||||
|
|
||||||
|
$useCronTriggerCleanUp = false;
|
||||||
|
//some promotion rules
|
||||||
|
//$promotionrules_torrent = array(0 => array("mediumid" => array(1), "promotion" => 5), 1 => array("mediumid" => array(3), "promotion" => 5), 2 => array("catid" => array(402), "standardid" => array(3), "promotion" => 4), 3 => array("catid" => array(403), "standardid" => array(3), "promotion" => 4));
|
||||||
|
$promotionrules_torrent = array();
|
||||||
|
?>
|
||||||
65
include/core.php
Normal file
65
include/core.php
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
if(!defined('IN_TRACKER'))
|
||||||
|
die('Hacking attempt!');
|
||||||
|
error_reporting(E_ERROR | E_PARSE);
|
||||||
|
ini_set('display_errors', 0);
|
||||||
|
include_once($rootpath . 'classes/class_cache.php'); //Require the caching class
|
||||||
|
$Cache = NEW CACHE(); //Load the caching class
|
||||||
|
$Cache->setLanguageFolderArray(get_langfolder_list());
|
||||||
|
define('TIMENOW', time());
|
||||||
|
$USERUPDATESET = array();
|
||||||
|
$query_name=array();
|
||||||
|
|
||||||
|
define ("UC_PEASANT", 0);
|
||||||
|
define ("UC_USER", 1);
|
||||||
|
define ("UC_POWER_USER", 2);
|
||||||
|
define ("UC_ELITE_USER", 3);
|
||||||
|
define ("UC_CRAZY_USER", 4);
|
||||||
|
define ("UC_INSANE_USER", 5);
|
||||||
|
define ("UC_VETERAN_USER", 6);
|
||||||
|
define ("UC_EXTREME_USER", 7);
|
||||||
|
define ("UC_ULTIMATE_USER", 8);
|
||||||
|
define ("UC_NEXUS_MASTER", 9);
|
||||||
|
define ("UC_VIP", 10);
|
||||||
|
define ("UC_RETIREE",11);
|
||||||
|
define ("UC_UPLOADER",12);
|
||||||
|
//define ("UC_FORUM_MODERATOR", 12);
|
||||||
|
define ("UC_MODERATOR",13);
|
||||||
|
define ("UC_ADMINISTRATOR",14);
|
||||||
|
define ("UC_SYSOP",15);
|
||||||
|
define ("UC_STAFFLEADER",16);
|
||||||
|
ignore_user_abort(1);
|
||||||
|
@set_time_limit(60);
|
||||||
|
|
||||||
|
function strip_magic_quotes($arr)
|
||||||
|
{
|
||||||
|
foreach ($arr as $k => $v)
|
||||||
|
{
|
||||||
|
if (is_array($v))
|
||||||
|
{
|
||||||
|
$arr[$k] = strip_magic_quotes($v);
|
||||||
|
} else {
|
||||||
|
$arr[$k] = stripslashes($v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc())
|
||||||
|
{
|
||||||
|
if (!empty($_GET)) {
|
||||||
|
$_GET = strip_magic_quotes($_GET);
|
||||||
|
}
|
||||||
|
if (!empty($_POST)) {
|
||||||
|
$_POST = strip_magic_quotes($_POST);
|
||||||
|
}
|
||||||
|
if (!empty($_COOKIE)) {
|
||||||
|
$_COOKIE = strip_magic_quotes($_COOKIE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_langfolder_list()
|
||||||
|
{
|
||||||
|
//do not access db for speed up, or for flexibility
|
||||||
|
return array("en", "chs", "cht", "ko", "ja");
|
||||||
|
}
|
||||||
4325
include/functions.php
Normal file
4325
include/functions.php
Normal file
File diff suppressed because it is too large
Load Diff
341
include/functions_announce.php
Normal file
341
include/functions_announce.php
Normal file
@@ -0,0 +1,341 @@
|
|||||||
|
<?php
|
||||||
|
# IMPORTANT: Do not edit below unless you know what you are doing!
|
||||||
|
if(!defined('IN_TRACKER'))
|
||||||
|
die('Hacking attempt!');
|
||||||
|
include_once($rootpath . 'include/globalfunctions.php');
|
||||||
|
include_once($rootpath . 'include/config.php');
|
||||||
|
|
||||||
|
function dbconn_announce() {
|
||||||
|
global $mysql_host, $mysql_user, $mysql_pass, $mysql_db;
|
||||||
|
|
||||||
|
if (!@mysql_connect($mysql_host, $mysql_user, $mysql_pass))
|
||||||
|
{
|
||||||
|
die('dbconn: mysql_connect: ' . mysql_error());
|
||||||
|
}
|
||||||
|
mysql_query("SET NAMES UTF8");
|
||||||
|
mysql_query("SET collation_connection = 'utf8_general_ci'");
|
||||||
|
mysql_query("SET sql_mode=''");
|
||||||
|
mysql_select_db($mysql_db) or die('dbconn: mysql_select_db: ' + mysql_error());
|
||||||
|
}
|
||||||
|
|
||||||
|
function hash_where_arr($name, $hash_arr) {
|
||||||
|
$new_hash_arr = Array();
|
||||||
|
foreach ($hash_arr as $hash) {
|
||||||
|
$new_hash_arr[] = sqlesc((urldecode($hash)));
|
||||||
|
}
|
||||||
|
return $name." IN ( ".implode(", ",$new_hash_arr)." )";
|
||||||
|
}
|
||||||
|
|
||||||
|
function emu_getallheaders() {
|
||||||
|
foreach($_SERVER as $name => $value)
|
||||||
|
if(substr($name, 0, 5) == 'HTTP_')
|
||||||
|
$headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
|
||||||
|
return $headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
function block_browser()
|
||||||
|
{
|
||||||
|
$agent = $_SERVER["HTTP_USER_AGENT"];
|
||||||
|
if (preg_match("/^Mozilla/", $agent) || preg_match("/^Opera/", $agent) || preg_match("/^Links/", $agent) || preg_match("/^Lynx/", $agent) )
|
||||||
|
err("Browser access blocked!");
|
||||||
|
// check headers
|
||||||
|
if (function_exists('getallheaders')){ //getallheaders() is only supported when PHP is installed as an Apache module
|
||||||
|
$headers = getallheaders();
|
||||||
|
//else
|
||||||
|
// $headers = emu_getallheaders();
|
||||||
|
|
||||||
|
if($_SERVER["HTTPS"] != "on")
|
||||||
|
{
|
||||||
|
if (isset($headers["Cookie"]) || isset($headers["Accept-Language"]) || isset($headers["Accept-Charset"]))
|
||||||
|
err("Anti-Cheater: You cannot use this agent");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function benc_resp($d)
|
||||||
|
{
|
||||||
|
benc_resp_raw(benc(array('type' => 'dictionary', 'value' => $d)));
|
||||||
|
}
|
||||||
|
function benc_resp_raw($x) {
|
||||||
|
|
||||||
|
header("Content-Type: text/plain; charset=utf-8");
|
||||||
|
header("Pragma: no-cache");
|
||||||
|
|
||||||
|
if ($_SERVER["HTTP_ACCEPT_ENCODING"] == "gzip" && function_exists('gzencode')) {
|
||||||
|
header("Content-Encoding: gzip");
|
||||||
|
echo gzencode($x, 9, FORCE_GZIP);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
echo $x;
|
||||||
|
}
|
||||||
|
function err($msg, $userid = 0, $torrentid = 0)
|
||||||
|
{
|
||||||
|
benc_resp(array('failure reason' => array('type' => 'string', 'value' => $msg)));
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
function check_cheater($userid, $torrentid, $uploaded, $downloaded, $anctime, $seeders=0, $leechers=0){
|
||||||
|
global $cheaterdet_security,$nodetect_security;
|
||||||
|
|
||||||
|
$time = date("Y-m-d H:i:s");
|
||||||
|
$upspeed = ($uploaded > 0 ? $uploaded / $anctime : 0);
|
||||||
|
|
||||||
|
if ($uploaded > 1073741824 && $upspeed > (104857600/$cheaterdet_security)) //Uploaded more than 1 GB with uploading rate higher than 100 MByte/S (For Consertive level). This is no doubt cheating.
|
||||||
|
{
|
||||||
|
$comment = "User account was automatically disabled by system";
|
||||||
|
mysql_query("INSERT INTO cheaters (added, userid, torrentid, uploaded, downloaded, anctime, seeders, leechers, comment) VALUES (".sqlesc($time).", $userid, $torrentid, $uploaded, $downloaded, $anctime, $seeders, $leechers, ".sqlesc($comment).")") or err("Tracker error 51");
|
||||||
|
mysql_query("UPDATE users SET enabled = 'no' WHERE id=$userid") or err("Tracker error 50"); //automatically disable user account;
|
||||||
|
err("We believe you're trying to cheat. And your account is disabled.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if ($uploaded > 1073741824 && $upspeed > (10485760/$cheaterdet_security)) //Uploaded more than 1 GB with uploading rate higher than 10 MByte/S (For Consertive level). This is likely cheating.
|
||||||
|
{
|
||||||
|
$secs = 24*60*60; //24 hours
|
||||||
|
$dt = sqlesc(date("Y-m-d H:i:s",(strtotime(date("Y-m-d H:i:s")) - $secs))); // calculate date.
|
||||||
|
$countres = mysql_query("SELECT id FROM cheaters WHERE userid=$userid AND torrentid=$torrentid AND added > $dt");
|
||||||
|
if (mysql_num_rows($countres) == 0)
|
||||||
|
{
|
||||||
|
$comment = "Abnormally high uploading rate";
|
||||||
|
mysql_query("INSERT INTO cheaters (added, userid, torrentid, uploaded, downloaded, anctime, seeders, leechers, hit, comment) VALUES (".sqlesc($time).", $userid, $torrentid, $uploaded, $downloaded, $anctime, $seeders, $leechers, 1,".sqlesc($comment).")") or err("Tracker error 52");
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$row = mysql_fetch_row($countres);
|
||||||
|
mysql_query("UPDATE cheaters SET hit=hit+1, dealtwith = 0 WHERE id=".$row[0]);
|
||||||
|
}
|
||||||
|
//mysql_query("UPDATE users SET downloadpos = 'no' WHERE id=$userid") or err("Tracker error 53"); //automatically remove user's downloading privileges;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ($cheaterdet_security > 1){// do not check this with consertive level
|
||||||
|
if ($uploaded > 1073741824 && $upspeed > 1048576 && $leechers < (2 * $cheaterdet_security)) //Uploaded more than 1 GB with uploading rate higher than 1 MByte/S when there is less than 8 leechers (For Consertive level). This is likely cheating.
|
||||||
|
{
|
||||||
|
$secs = 24*60*60; //24 hours
|
||||||
|
$dt = sqlesc(date("Y-m-d H:i:s",(strtotime(date("Y-m-d H:i:s")) - $secs))); // calculate date.
|
||||||
|
$countres = mysql_query("SELECT id FROM cheaters WHERE userid=$userid AND torrentid=$torrentid AND added > $dt");
|
||||||
|
if (mysql_num_rows($countres) == 0)
|
||||||
|
{
|
||||||
|
$comment = "User is uploading fast when there is few leechers";
|
||||||
|
mysql_query("INSERT INTO cheaters (added, userid, torrentid, uploaded, downloaded, anctime, seeders, leechers, comment) VALUES (".sqlesc($time).", $userid, $torrentid, $uploaded, $downloaded, $anctime, $seeders, $leechers, ".sqlesc($comment).")") or err("Tracker error 52");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$row = mysql_fetch_row($countres);
|
||||||
|
mysql_query("UPDATE cheaters SET hit=hit+1, dealtwith = 0 WHERE id=".$row[0]);
|
||||||
|
}
|
||||||
|
//mysql_query("UPDATE users SET downloadpos = 'no' WHERE id=$userid") or err("Tracker error 53"); //automatically remove user's downloading privileges;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ($uploaded > 10485760 && $upspeed > 102400 && $leechers == 0) //Uploaded more than 10 MB with uploading speed faster than 100 KByte/S when there is no leecher. This is likely cheating.
|
||||||
|
{
|
||||||
|
$secs = 24*60*60; //24 hours
|
||||||
|
$dt = sqlesc(date("Y-m-d H:i:s",(strtotime(date("Y-m-d H:i:s")) - $secs))); // calculate date.
|
||||||
|
$countres = mysql_query("SELECT id FROM cheaters WHERE userid=$userid AND torrentid=$torrentid AND added > $dt");
|
||||||
|
if (mysql_num_rows($countres) == 0)
|
||||||
|
{
|
||||||
|
$comment = "User is uploading when there is no leecher";
|
||||||
|
mysql_query("INSERT INTO cheaters (added, userid, torrentid, uploaded, downloaded, anctime, seeders, leechers, comment) VALUES (".sqlesc($time).", $userid, $torrentid, $uploaded, $downloaded, $anctime, $seeders, $leechers, ".sqlesc($comment).")") or err("Tracker error 52");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$row = mysql_fetch_row($countres);
|
||||||
|
mysql_query("UPDATE cheaters SET hit=hit+1, dealtwith = 0 WHERE id=".$row[0]);
|
||||||
|
}
|
||||||
|
//mysql_query("UPDATE users SET downloadpos = 'no' WHERE id=$userid") or err("Tracker error 53"); //automatically remove user's downloading privileges;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
function portblacklisted($port)
|
||||||
|
{
|
||||||
|
// direct connect
|
||||||
|
if ($port >= 411 && $port <= 413) return true;
|
||||||
|
// bittorrent
|
||||||
|
if ($port >= 6881 && $port <= 6889) return true;
|
||||||
|
// kazaa
|
||||||
|
if ($port == 1214) return true;
|
||||||
|
// gnutella
|
||||||
|
if ($port >= 6346 && $port <= 6347) return true;
|
||||||
|
// emule
|
||||||
|
if ($port == 4662) return true;
|
||||||
|
// winmx
|
||||||
|
if ($port == 6699) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ipv4_to_compact($ip, $port)
|
||||||
|
{
|
||||||
|
$compact = pack("Nn", sprintf("%d",ip2long($ip)), $port);
|
||||||
|
return $compact;
|
||||||
|
}
|
||||||
|
|
||||||
|
function check_client($peer_id, $agent, &$agent_familyid)
|
||||||
|
{
|
||||||
|
global $BASEURL, $Cache;
|
||||||
|
|
||||||
|
if (!$clients = $Cache->get_value('allowed_client_list')){
|
||||||
|
$clients = array();
|
||||||
|
$res = mysql_query("SELECT * FROM agent_allowed_family ORDER BY hits DESC") or err("check err");
|
||||||
|
while ($row = mysql_fetch_array($res))
|
||||||
|
$clients[] = $row;
|
||||||
|
$Cache->cache_value('allowed_client_list', $clients, 86400);
|
||||||
|
}
|
||||||
|
foreach ($clients as $row_allowed_ua)
|
||||||
|
{
|
||||||
|
$allowed_flag_peer_id = false;
|
||||||
|
$allowed_flag_agent = false;
|
||||||
|
$version_low_peer_id = false;
|
||||||
|
$version_low_agent = false;
|
||||||
|
|
||||||
|
if($row_allowed_ua['peer_id_pattern'] != '')
|
||||||
|
{
|
||||||
|
if(!preg_match($row_allowed_ua['peer_id_pattern'], $row_allowed_ua['peer_id_start'], $match_bench))
|
||||||
|
err("regular expression err for: " . $row_allowed_ua['peer_id_start'] . ", please ask sysop to fix this");
|
||||||
|
|
||||||
|
if(preg_match($row_allowed_ua['peer_id_pattern'], $peer_id, $match_target))
|
||||||
|
{
|
||||||
|
if($row_allowed_ua['peer_id_match_num'] != 0)
|
||||||
|
{
|
||||||
|
for($i = 0 ; $i < $row_allowed_ua['peer_id_match_num']; $i++)
|
||||||
|
{
|
||||||
|
if($row_allowed_ua['peer_id_matchtype'] == 'dec')
|
||||||
|
{
|
||||||
|
$match_target[$i+1] = 0 + $match_target[$i+1];
|
||||||
|
$match_bench[$i+1] = 0 + $match_bench[$i+1];
|
||||||
|
}
|
||||||
|
else if($row_allowed_ua['peer_id_matchtype'] == 'hex')
|
||||||
|
{
|
||||||
|
$match_target[$i+1] = hexdec($match_target[$i+1]);
|
||||||
|
$match_bench[$i+1] = hexdec($match_bench[$i+1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($match_target[$i+1] > $match_bench[$i+1])
|
||||||
|
{
|
||||||
|
$allowed_flag_peer_id = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if($match_target[$i+1] < $match_bench[$i+1])
|
||||||
|
{
|
||||||
|
$allowed_flag_peer_id = false;
|
||||||
|
$version_low_peer_id = true;
|
||||||
|
$low_version = "Your " . $row_allowed_ua['family'] . " 's version is too low, please update it after " . $row_allowed_ua['start_name'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if($match_target[$i+1] == $match_bench[$i+1])//equal
|
||||||
|
{
|
||||||
|
if($i+1 == $row_allowed_ua['peer_id_match_num']) //last
|
||||||
|
{
|
||||||
|
$allowed_flag_peer_id = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // no need to compare version
|
||||||
|
$allowed_flag_peer_id = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // not need to match pattern
|
||||||
|
$allowed_flag_peer_id = true;
|
||||||
|
|
||||||
|
if($row_allowed_ua['agent_pattern'] != '')
|
||||||
|
{
|
||||||
|
if(!preg_match($row_allowed_ua['agent_pattern'], $row_allowed_ua['agent_start'], $match_bench))
|
||||||
|
err("regular expression err for: " . $row_allowed_ua['agent_start'] . ", please ask sysop to fix this");
|
||||||
|
|
||||||
|
if(preg_match($row_allowed_ua['agent_pattern'], $agent, $match_target))
|
||||||
|
{
|
||||||
|
if( $row_allowed_ua['agent_match_num'] != 0)
|
||||||
|
{
|
||||||
|
for($i = 0 ; $i < $row_allowed_ua['agent_match_num']; $i++)
|
||||||
|
{
|
||||||
|
if($row_allowed_ua['agent_matchtype'] == 'dec')
|
||||||
|
{
|
||||||
|
$match_target[$i+1] = 0 + $match_target[$i+1];
|
||||||
|
$match_bench[$i+1] = 0 + $match_bench[$i+1];
|
||||||
|
}
|
||||||
|
else if($row_allowed_ua['agent_matchtype'] == 'hex')
|
||||||
|
{
|
||||||
|
$match_target[$i+1] = hexdec($match_target[$i+1]);
|
||||||
|
$match_bench[$i+1] = hexdec($match_bench[$i+1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($match_target[$i+1] > $match_bench[$i+1])
|
||||||
|
{
|
||||||
|
$allowed_flag_agent = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if($match_target[$i+1] < $match_bench[$i+1])
|
||||||
|
{
|
||||||
|
$allowed_flag_agent = false;
|
||||||
|
$version_low_agent = true;
|
||||||
|
$low_version = "Your " . $row_allowed_ua['family'] . " 's version is too low, please update it after " . $row_allowed_ua['start_name'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else //equal
|
||||||
|
{
|
||||||
|
if($i+1 == $row_allowed_ua['agent_match_num']) //last
|
||||||
|
$allowed_flag_agent = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // no need to compare version
|
||||||
|
$allowed_flag_agent = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$allowed_flag_agent = true;
|
||||||
|
|
||||||
|
if($allowed_flag_peer_id && $allowed_flag_agent)
|
||||||
|
{
|
||||||
|
$exception = $row_allowed_ua['exception'];
|
||||||
|
$family_id = $row_allowed_ua['id'];
|
||||||
|
$allow_https = $row_allowed_ua['allowhttps'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
elseif(($allowed_flag_peer_id || $allowed_flag_agent) || ($version_low_peer_id || $version_low_agent)) //client spoofing possible
|
||||||
|
;//add anti-cheat code here
|
||||||
|
}
|
||||||
|
|
||||||
|
if($allowed_flag_peer_id && $allowed_flag_agent)
|
||||||
|
{
|
||||||
|
if($exception == 'yes')
|
||||||
|
{
|
||||||
|
if (!$clients_exp = $Cache->get_value('allowed_client_exception_family_'.$family_id.'_list')){
|
||||||
|
$clients_exp = array();
|
||||||
|
$res = mysql_query("SELECT * FROM agent_allowed_exception WHERE family_id = $family_id") or err("check err");
|
||||||
|
while ($row = mysql_fetch_array($res))
|
||||||
|
$clients_exp[] = $row;
|
||||||
|
$Cache->cache_value('allowed_client_exception_family_'.$family_id.'_list', $clients_exp, 86400);
|
||||||
|
}
|
||||||
|
if($clients_exp)
|
||||||
|
{
|
||||||
|
foreach ($clients_exp as $row_allowed_ua_exp)
|
||||||
|
{
|
||||||
|
if($row_allowed_ua_exp['agent'] == $agent && preg_match("/^" . $row_allowed_ua_exp['peer_id'] . "/", $peer_id))
|
||||||
|
return "Client " . $row_allowed_ua_exp['name'] . " is banned due to: " . $row_allowed_ua_exp['comment'] . ".";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$agent_familyid = $row_allowed_ua['id'];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$agent_familyid = $row_allowed_ua['id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if($_SERVER["HTTPS"] == "on")
|
||||||
|
{
|
||||||
|
if($allow_https == 'yes')
|
||||||
|
return 0;
|
||||||
|
else
|
||||||
|
return "This client does not support https well, Please goto $BASEURL/faq.php#id29 for a list of proper clients";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return 0; // no exception found, so allowed or just allowed
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if($version_low_peer_id && $version_low_agent)
|
||||||
|
return $low_version;
|
||||||
|
else
|
||||||
|
return "Banned Client, Please goto $BASEURL/faq.php#id29 for a list of acceptable clients";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
88
include/globalfunctions.php
Normal file
88
include/globalfunctions.php
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
<?php
|
||||||
|
if(!defined('IN_TRACKER'))
|
||||||
|
die('Hacking attempt!');
|
||||||
|
|
||||||
|
function get_global_sp_state()
|
||||||
|
{
|
||||||
|
global $Cache;
|
||||||
|
static $global_promotion_state;
|
||||||
|
if (!$global_promotion_state){
|
||||||
|
if (!$global_promotion_state = $Cache->get_value('global_promotion_state')){
|
||||||
|
$res = mysql_query("SELECT * FROM torrents_state");
|
||||||
|
$row = mysql_fetch_assoc($res);
|
||||||
|
$global_promotion_state = $row["global_sp_state"];
|
||||||
|
$Cache->cache_value('global_promotion_state', $global_promotion_state, 57226);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $global_promotion_state;
|
||||||
|
}
|
||||||
|
|
||||||
|
// IP Validation
|
||||||
|
function validip($ip)
|
||||||
|
{
|
||||||
|
if (!ip2long($ip)) //IPv6
|
||||||
|
return true;
|
||||||
|
if (!empty($ip) && $ip == long2ip(ip2long($ip)))
|
||||||
|
{
|
||||||
|
// reserved IANA IPv4 addresses
|
||||||
|
// http://www.iana.org/assignments/ipv4-address-space
|
||||||
|
$reserved_ips = array (
|
||||||
|
array('192.0.2.0','192.0.2.255'),
|
||||||
|
array('192.168.0.0','192.168.255.255'),
|
||||||
|
array('255.255.255.0','255.255.255.255')
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($reserved_ips as $r)
|
||||||
|
{
|
||||||
|
$min = ip2long($r[0]);
|
||||||
|
$max = ip2long($r[1]);
|
||||||
|
if ((ip2long($ip) >= $min) && (ip2long($ip) <= $max)) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getip() {
|
||||||
|
if (isset($_SERVER)) {
|
||||||
|
if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && validip($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
||||||
|
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||||
|
} elseif (isset($_SERVER['HTTP_CLIENT_IP']) && validip($_SERVER['HTTP_CLIENT_IP'])) {
|
||||||
|
$ip = $_SERVER['HTTP_CLIENT_IP'];
|
||||||
|
} else {
|
||||||
|
$ip = $_SERVER['REMOTE_ADDR'];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (getenv('HTTP_X_FORWARDED_FOR') && validip(getenv('HTTP_X_FORWARDED_FOR'))) {
|
||||||
|
$ip = getenv('HTTP_X_FORWARDED_FOR');
|
||||||
|
} elseif (getenv('HTTP_CLIENT_IP') && validip(getenv('HTTP_CLIENT_IP'))) {
|
||||||
|
$ip = getenv('HTTP_CLIENT_IP');
|
||||||
|
} else {
|
||||||
|
$ip = getenv('REMOTE_ADDR');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ip;
|
||||||
|
}
|
||||||
|
|
||||||
|
function sql_query($query)
|
||||||
|
{
|
||||||
|
global $query_name;
|
||||||
|
$query_name[] = $query;
|
||||||
|
return mysql_query($query);
|
||||||
|
}
|
||||||
|
|
||||||
|
function sqlesc($value) {
|
||||||
|
$value = "'" . mysql_real_escape_string($value) . "'";
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function hash_pad($hash) {
|
||||||
|
return str_pad($hash, 20);
|
||||||
|
}
|
||||||
|
|
||||||
|
function hash_where($name, $hash) {
|
||||||
|
$shhash = preg_replace('/ *$/s', "", $hash);
|
||||||
|
return "($name = " . sqlesc($hash) . " OR $name = " . sqlesc($shhash) . ")";
|
||||||
|
}
|
||||||
|
?>
|
||||||
13
include/smtp/net.const.php
Normal file
13
include/smtp/net.const.php
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$mechs = array('LOGIN', 'PLAIN', 'CRAM_MD5');
|
||||||
|
|
||||||
|
foreach ($mechs as $mech) {
|
||||||
|
if (!defined($mech)) {
|
||||||
|
define($mech, $mech);
|
||||||
|
} elseif (constant($mech) != $mech) {
|
||||||
|
trigger_error(sprintf("Constant %s already defined, can't proceed", $mech), E_USER_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
58
include/smtp/sasl.lib.php
Normal file
58
include/smtp/sasl.lib.php
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SASL Mechanisms
|
||||||
|
* @package SASL
|
||||||
|
* @author Fredrik Haugbergsmyr <smtp.lib@lagnut.net>
|
||||||
|
*/
|
||||||
|
$rootpath = './';
|
||||||
|
require_once ($rootpath . 'include/smtp/net.const.php');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @version 0.0.1
|
||||||
|
* @access public
|
||||||
|
* @todo phpdoc
|
||||||
|
*/
|
||||||
|
class sasl
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
function _hmac_md5($key, $data)
|
||||||
|
{
|
||||||
|
if (strlen($key) > 64) {
|
||||||
|
$key = pack('H32', md5($key));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strlen($key) < 64) {
|
||||||
|
$key = str_pad($key, 64, chr(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
$k_ipad = substr($key, 0, 64) ^ str_repeat(chr(0x36), 64);
|
||||||
|
$k_opad = substr($key, 0, 64) ^ str_repeat(chr(0x5C), 64);
|
||||||
|
|
||||||
|
$inner = pack('H32', md5($k_ipad . $data));
|
||||||
|
$digest = md5($k_opad . $inner);
|
||||||
|
|
||||||
|
return $digest;
|
||||||
|
}
|
||||||
|
|
||||||
|
function cram_md5($user, $pass, $challenge)
|
||||||
|
{
|
||||||
|
var_dump($challenge);
|
||||||
|
$chall = base64_decode($challenge);
|
||||||
|
var_dump($chall);
|
||||||
|
return base64_encode(sprintf('%s %s', $user, $this->_hmac_md5($pass, $chall)));
|
||||||
|
}
|
||||||
|
|
||||||
|
function plain($username, $password)
|
||||||
|
{
|
||||||
|
return base64_encode(sprintf('%c%s%c%s', 0, $username, 0, $password));
|
||||||
|
}
|
||||||
|
|
||||||
|
function login($input)
|
||||||
|
{
|
||||||
|
return base64_encode(sprintf('%s', $input));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user