Moved the Agents into their own repo. Kept the agent.pl just for reference

This commit is contained in:
Frank Harris 2025-09-11 13:27:32 -04:00
parent 22381be29a
commit 8680a02b13
18132 changed files with 0 additions and 2569420 deletions

View file

@ -1,995 +0,0 @@
NET2FTP LICENSE
MAIN CODE
====================
The main code of net2ftp is released under the GNU GENERAL PUBLIC LICENSE.
This includes the following files:
Directory / all files
Directory /includes all files except pcl*.lib.php and zip.lib.php
Directory /integration all files
Directory /languages all files
Directory /modules all files
Directory /skins all files except the images and HTML progress
Directory /temp all files
NET2FTP ALSO USES OTHER MODULES (PHP code, Javascript code, Java applets and images).
EACH OF THESE MODULES IS RELEASED UNDER ITS OWN LICENSE.
Read on for more details.
ZIP AND TAR CODE
====================
File: /includes/zip.lib.php
By: Eric Mueller, Denis125 and Peter Listiak
License: public domain
File: /includes/pclzip.lib.php
Website: http://www.phpconcept.net
By: Vincent Blavet
License: GNU LESSER GENERAL PUBLIC LICENSE (see text below)
Note: This application was slightly modified for use with net2ftp
Files: /includes/pcltar.lib.ph and pclerror.lib.php
Website: http://www.phpconcept.net
By: Vincent Blavet
License: GNU GENERAL PUBLIC LICENSE (see text below)
Note: This application was slightly modified for use with net2ftp
DIFF CODE
====================
File: /modules/updatefile/diff.inc.php
Website: http://www.holomind.de/phpnet/diff.php
By: Daniel Unterberger <diff.phpnet@holomind.de>
License: GPL
Note: Not yet in use by net2ftp
FCKEDITOR
====================
Directory: /plugins/fckeditor
Website: http://www.fckeditor.net
By: Frederico Caldeira Knabben
License: GNU LESSER GENERAL PUBLIC LICENSE (see text below)
Note: This application was slightly modified for use with net2ftp
LUMINOUS
====================
Directory: /plugins/luminous
Website: http://luminous.asgaard.co.uk
By: Mark Asgaard
License: GNU LESSER GENERAL PUBLIC LICENSE (see text below)
ACE
====================
Directory: /plugins/ace
Website: http://ace.ajax.org/
By: Ace team
License: BSD license
GESHI
====================
Directory: /plugins/geshi
Website: http://qbnz.com/highlighter
By: Nigel McNie (Oracle)
License: GNU GENERAL PUBLIC LICENSE (see text below)
CODEPRESS
====================
Directory: /plugins/codepress
Website: http://codepress.fermads.net/
By: Fernando M.A.d.S.
License: GNU LESSER GENERAL PUBLIC LICENSE (see text below)
HTML_PROGRESS
====================
Directory: /skins/blue/status and /skins/pastel/status
Website: http://pear.laurent-laville.org/HTML_Progress
By: Laurent Laville
License: PHP License 3.0
Note: This application was slightly modified for use with net2ftp
IMAGES
====================
The images within the /skins/*/images are released under the LGPL license.
They come from 2 different iconsets, originally developed for KDE.
For more information, refer to the links below.
Nuvola 1.0
Website: http://www.kde-look.org/content/show.php?content=5358
Website: http://www.icon-king.com/
By: David Vignoni
Noia for KDE 1.00
Website: http://www.kde-look.org/content/show.php?content=3883
Website: http://www.carlitus.net/
By: Carles Carbonell Bernado
JUPLOAD UPLOAD APPLET
====================
Website: http://www.jupload.biz/ and http://www.haller-systemservice.net/
By: Mike Haller
JUpload is *NOT* free software. The net2ftp development team has purchased a
Commercial Enterprise License, which allows the redistribution of JUpload and the
use of it on an unlimited number of servers.
You DO NOT HAVE TO PURCHASE an additional license of JUpload, unless you want
to use it in another product than net2ftp.
SHINRA SKIN
===========
Website: http://www.luiszuno.com
By: Luis Zuno
License: creative commons 3.0 (http://creativecommons.org/licenses/by/3.0/)
The Shinra skin uses the following images, icons or other files:
JAVASCRIPT
jQuery http://jquery.com/
jqueryui . Jquery ui Home page.
jQuery Easing Plugin http://gsgd.co.uk/sandbox/jquery/easing/
Jquery tabs http://flowplayer.org/tools/tabs/
PrettyPhoto http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/
DD_belatedPNG http://www.dillerdesign.com/experiment/DD_belatedPNG/
Superfish http://users.tpg.com.au/j_birch/plugins/superfish/
Google fonts api http://fonts.googleapis.com/
Scrollto http://flesler.blogspot.com
Nivo slider http://nivo.dev7studios.com
Poshytip http://vadikom.com/tools/poshy-tip-jquery-plugin-for-stylish-tooltips/
tabs http://flowplayer.org/tools/tabs/
tweet http://tweet.seaofclouds.com/
IMAGES
Social icons http://www.premiumpixels.com/
Knobs icons http://itweek.deviantart.com/art/Knob-Buttons-Toolbar-icons-73463960
Background images http://www.squidfingers.com/patterns/, http://backgrounds.mysitemyway.com, http://www.tutorial9.net/downloads/108-mono-icons-huge-set-of-minimal-icons/, http://www.webdesignerdepot.com
STONEPHPCRYPT
===================
Website: http://blog.sc.tri-bit.com/archives/101
By: John Haugeland
License: Modified BSD License
// Copyright (c) 2006, John Haugeland
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in
// the documentation and/or other materials provided with the
// distribution.
//
// * Neither the name of John Haugeland nor the names of project
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY JOHN HAUGELAND "AS-IS" AND ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
SWF UPLOAD APPLET
====================
Website: http://swfupload.mammon.se/
By: Mammon, Lars Huring, Olov Nilzén
License: MIT License (http://www.opensource.org/licenses/mit-license.php)
TINYMCE
====================
Directory: /plugins/tinymce
Website: http://tinymce.moxiecode.com
By: Moxiecode Systems AB
License: GNU LIBRARY GENERAL PUBLIC LICENSE
UBUNTU FONT
====================
Directory: not included with net2ftp
Website: http://font.ubuntu.com
By: Ubuntu team
License: Ubuntu Font License (see http://font.ubuntu.com/licence)
-------------------------------------------------------------------------------
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
-------------------------------------------------------------------------------
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 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.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
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 and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, 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 library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete 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 distribute a copy of this License along with the
Library.
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 Library or any portion
of it, thus forming a work based on the Library, 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) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
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 Library, 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 Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you 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.
If distribution of 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 satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be 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.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library 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.
9. 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 Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
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 with
this License.
11. 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 Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library 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 Library.
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.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library 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.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser 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 Library
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 Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
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
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "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
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. 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 LIBRARY 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
LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS

View file

@ -1,14 +0,0 @@
DROP TABLE IF EXISTS `net2ftp_logAccess`;
DROP TABLE IF EXISTS `net2ftp_log_access`;
CREATE TABLE `net2ftp_log_access` (`id` int(10) unsigned NOT NULL auto_increment,`date` date NOT NULL default '0000-00-00',`time` time NOT NULL default '00:00:00',`remote_addr` text NOT NULL,`remote_port` text NOT NULL,`http_user_agent` text NOT NULL,`page` text NOT NULL,`datatransfer` int(10) unsigned default '0',`executiontime` mediumint(8) unsigned default '0',`ftpserver` text NOT NULL,`username` text NOT NULL,`state` text NOT NULL,`state2` text NOT NULL,`screen` text NOT NULL,`directory` text NOT NULL,`entry` text NOT NULL,`http_referer` text NOT NULL,KEY `index1` (`id`)) TYPE=MyISAM;
DROP TABLE IF EXISTS `net2ftp_logError`;
DROP TABLE IF EXISTS `net2ftp_log_error`;
CREATE TABLE `net2ftp_log_error` (`date` date NOT NULL default '0000-00-00',`time` time NOT NULL default '00:00:00',`ftpserver` text NOT NULL,`username` text NOT NULL,`message` text NOT NULL,`backtrace` text NOT NULL,`state` text NOT NULL,`state2` text NOT NULL,`directory` text NOT NULL,`remote_addr` text NOT NULL,`remote_port` text NOT NULL,`http_user_agent` text NOT NULL,KEY `index1` (`date`,`time`,`ftpserver`(100),`username`(50))) TYPE=MyISAM;
DROP TABLE IF EXISTS `net2ftp_logConsumptionFtpserver`;
DROP TABLE IF EXISTS `net2ftp_log_consumption_ftpserver`;
CREATE TABLE `net2ftp_log_consumption_ftpserver`(`date` date NOT NULL default '0000-00-00',`ftpserver` varchar(255) NOT NULL default '0',`datatransfer` int(10) unsigned default '0',`executiontime` mediumint(8) unsigned default '0',PRIMARY KEY (`date`,`ftpserver`)) TYPE=MyISAM;
DROP TABLE IF EXISTS `net2ftp_logConsumptionIpaddress`;
DROP TABLE IF EXISTS `net2ftp_log_consumption_ipaddress`;
CREATE TABLE `net2ftp_log_consumption_ipaddress`(`date` date NOT NULL default '0000-00-00',`ipaddress` varchar(15) NOT NULL default '0',`datatransfer` int(10) unsigned default '0',`executiontime` mediumint(8) unsigned default '0',PRIMARY KEY (`date`,`ipaddress`)) TYPE=MyISAM;
DROP TABLE IF EXISTS `net2ftp_users`;
CREATE TABLE `net2ftp_users` (`ftpserver` varchar(255) NOT NULL default '0',`username` text NOT NULL,`homedirectory` text NOT NULL,KEY `index1` (`ftpserver`,`username`(50))) TYPE=MyISAM;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -1,67 +0,0 @@
<?php
/*
*
* OGP - Open Game Panel
* Copyright (C) 2008 - 2018 The OGP Development Team
*
* http://www.opengamepanel.org/
*
* 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 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.
*
*/
function exec_ogp_module()
{
global $db,$view,$settings;
if ( is_readable("includes/config.inc.php") ) require("includes/config.inc.php");
$isAdmin = $db->isAdmin( $_SESSION['user_id'] );
if ( $isAdmin )
{
$user_homes = $db->getHomesFor('admin', $_SESSION['user_id']);
}
else
{
$user_homes = $db->getHomesFor('user_and_group', $_SESSION['user_id']);
}
echo "<h2>".get_lang('ftp')."</h2>";
if( $user_homes === FALSE )
{
return;
}
if( empty( $_GET['home_id'] ) )
{
unset($_GET['home_id']);
}
if( isset($_GET['home_id']) ) $_SESSION['home_id'] = $_GET['home_id'];
$_SESSION['settings'] = $settings;
$_SESSION['remote_servers'] = $db->getRemoteServers();
$_SESSION['isAdmin'] = $isAdmin;
$_SESSION['user_homes'] = $user_homes;
?> <IFRAME SRC="modules/ftp/index.php<?php if( isset($_GET['home_id']) ) echo "?home_id=".$_GET['home_id']; ?>" ALIGN=center WIDTH=100% HEIGHT=460 style="border:1px solid transparent;background-color:white" > </IFRAME> <?php
echo "<div align='center'><form action='' method='get'>
<input type='hidden' name='m' value='gamemanager' />
<input type='hidden' name='p' value='game_monitor' />
<input type='hidden' name='home_id' value='".$_GET['home_id']."' />
<input type='submit' value='back to Game Monitor (Close FTP)' />
</form></div>";
}
?>

View file

@ -1,11 +0,0 @@
.collapsible.collapsed {
padding: 10px;
background: url('../../images/tablesorter_expand.png') no-repeat center center;
cursor: pointer;
}
.collapsible.expanded {
padding: 10px;
background: url('../../images/tablesorter_collapse.png') no-repeat center center;
cursor: pointer;
}

View file

@ -1,262 +0,0 @@
<script type="text/javascript" src="js/modules/ftp.js"></script>
<?php
/*
*
* OGP - Open Game Panel
* Copyright (C) 2008 - 2018 The OGP Development Team
*
* http://www.opengamepanel.org/
*
* 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 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.
*
*/
function exec_ogp_module()
{
include('includes/lib_remote.php');
global $db;
global $view;
if(isset($_POST['add_ftp_user']))
{
$success = true;
$server_row = $db->getRemoteServer($_POST['remote_server_id']);
$remote = new OGPRemoteLibrary($server_row['agent_ip'],$server_row['agent_port'],$server_row['encryption_key'],$server_row['timeout']);
$post_ftp_login = strip_real_escape_string($_POST['ftp_login']);
$post_ftp_password = strip_real_escape_string($_POST['ftp_password']);
$post_full_path = strip_real_escape_string($_POST['full_path']);
$host_stat = $remote->status_chk();
// Validation
if(strlen($post_ftp_login) > 20){
print_failure( get_lang("ftp_account_username_too_long") );
$success = false;
}
if(strlen($post_ftp_password) > 20){
print_failure( get_lang("ftp_account_password_too_long") );
$success = false;
}
$ftp_accounts_list = $remote->ftp_mgr("list");
$ftp_accounts = explode("\n",$ftp_accounts_list);
$user_exists = FALSE;
foreach($ftp_accounts as $ftp_account)
{
if( $ftp_account != "" )
{
list($ftp_login, $ftp_path) = explode("\t",$ftp_account);
$ftp_login = trim($ftp_login);
if ($ftp_login == $post_ftp_login)
{
$user_exists = TRUE;
break;
}
}
}
if( $user_exists === TRUE )
{
print_failure( get_lang("ftp_account_already_exists") );
}
else
{
if($success)
$remote->ftp_mgr("useradd", $post_ftp_login, $post_ftp_password, $post_full_path);
}
}
if(isset($_POST['del_ftp_user_y']))
{
$ftp_login = strip_real_escape_string($_POST['ftp_login']);
$server_row = $db->getRemoteServer($_POST['remote_server_id']);
$remote = new OGPRemoteLibrary($server_row['agent_ip'],$server_row['agent_port'],$server_row['encryption_key'],$server_row['timeout']);
$remote->ftp_mgr("userdel", $ftp_login);
$home_info = $db->getHomeByFtpLogin($server_row['remote_server_id'], $ftp_login);
$db->changeFtpStatus('disabled',$home_info['home_id']);
}
if(isset($_POST['edit_ftp_user']))
{
$server_row = $db->getRemoteServer($_POST['remote_server_id']);
$remote = new OGPRemoteLibrary($server_row['agent_ip'],$server_row['agent_port'],$server_row['encryption_key'],$server_row['timeout']);
$ftp_login = strip_real_escape_string($_POST['ftp_login']);
$settings = "";
foreach($_POST as $key => $value)
{
if ($key != "edit_ftp_user" and $key != "ftp_login" and $key != "remote_server_id")
{
$clean_value = strip_real_escape_string($value);
$account_settings .= "$key\t$clean_value\n";
}
}
$remote->ftp_mgr("usermod", $ftp_login, $account_settings );
}
echo "<h2>" . get_lang("ftp_admin") . "</h2>";
$servers = $db->getRemoteServers();
if ($servers !== false) {
echo "<tr><td colspan='3' >
<form method=POST >
<table class='center' style='width:100%' ><tr>
<td>". get_lang("remote_server") ." <select style='width:250px' name='remote_server_id' >";
foreach ( $servers as $server_row )
{
$display_ip = checkDisplayPublicIP($server_row['display_public_ip'],$server_row['agent_ip']);
echo "<option value='" . $server_row['remote_server_id'] . "' >" . $server_row['remote_server_name'] . " (" . $display_ip . ":" . $server_row['agent_port'] . ")</option>";
}
echo "</select>
</td>
<td>". get_lang("login") ."<input type=text name='ftp_login' /></td>
<td>". get_lang("password") ."<input type=text name='ftp_password' /></td>
<td>". get_lang("full_path") ."<input type=text name='full_path' /></td>
</tr>
<tr>
<td colspan=4 ><input style='width:100%;' type=submit name='add_ftp_user' value='". get_lang("add_ftp_account") ."' /></td>
</tr>
</table>
</form>
</td></tr>";
?>
<table id="servermonitor" class="tablesorter" data-sortlist='[[2,0]]'>
<thead>
<tr>
<th class="header sorter-false"></th><th><?php print_lang('remote_server'); ?></th><th><?php print_lang('login'); ?></th><th><?php print_lang('server_name'); ?></th><th><?php print_lang('full_path'); ?></th>
</tr>
</thead>
<tbody>
<?php
foreach ( $servers as $server_row )
{
$display_ip = checkDisplayPublicIP($server_row['display_public_ip'],$server_row['agent_ip']);
$remote = new OGPRemoteLibrary($server_row['agent_ip'],$server_row['agent_port'],$server_row['encryption_key'],$server_row['timeout']);
$host_stat = $remote->status_chk();
$status = ( $host_stat === 0 or $host_stat === -1 ) ? "<span class='failure'>". get_lang("offline") ."</span>" : "<span class='success'>". get_lang("online") ."</span>";
if( $host_stat === 1)
{
$ftp_accounts_list = $remote->ftp_mgr("list");
$ftp_accounts = explode("\n", $ftp_accounts_list);
foreach($ftp_accounts as $ftp_account)
{
if( !empty($ftp_account))
{
list($ftp_login, $ftp_path) = explode("\t", $ftp_account);
$ftp_login = trim($ftp_login);
$home_info = $db->getHomeByFtpLogin($server_row['remote_server_id'], $ftp_login);
$expandme = ( ( isset($_POST['ftp_login']) and $ftp_login == strip_real_escape_string($_POST['ftp_login']) ) AND ( isset($_POST['remote_server_id']) and $home_info['remote_server_id'] == $_POST['remote_server_id'] ) ) ? "expandme" : "";
$home_name = isset( $home_info['home_name'] ) ? $home_info['home_name'] : $ftp_path;
echo "<tr class='maintr $expandme'><td class='collapsible' ></td><td>".$server_row['remote_server_name']." (".$display_ip.")</td><td><b class='failure' >$ftp_login</td><td>" . htmlentities($home_name) . "</td><td>$ftp_path</td></tr>
<tr class='expand-child' ><td colspan='4' >
<form method=POST >
<table>";
$account_details = $remote->ftp_mgr("show",$ftp_login);
$ftp_account_detail_list = explode("\n",$account_details);
foreach($ftp_account_detail_list as $detail_line)
{
if( !empty($detail_line))
{
list($key,$value) = explode(" : ",$detail_line);
$key = trim($key);
$value = trim($value);
$blacklist = array("Login", "Password", "UID", "GID", "ftp_user_id", "username",
"username_prefix", "password", "sys_userid", "sys_groupid",
"sys_perm_user", "sys_perm_group", "sys_perm_other",
"server_id", "parent_domain_id", "uid", "gid" );
if( in_array($key, $blacklist) )
continue;
if(substr($value, -1) == ')')
{
$value_parts = explode(" ", $value);
if(is_numeric($value_parts[0]))
{
if(count($value_parts) > 1)
{
$value = array_shift($value_parts);
$advert = implode(" ", $value_parts);
}
}
else
{
$first_pos = array_shift($value_parts);
$parts = preg_split('/:|-/', $first_pos);
if(count(array_filter($parts, 'is_numeric') === 2))
{
$value = $first_pos;
$advert = implode(" ", $value_parts);
}
}
}
if ($key == "Allowed local IPs" or $key == "ul_ratio" or $key == "ForceSsl" or ( count($ftp_account_detail_list) == 4 and $key == "Directory" ) )
echo "</table>\n</td><td>\n<table>\n";
if ($key == "Directory" )
$value = str_replace( "/./", "", $value );
if($key == "Username")
$readOnly = true;
echo "<tr><td>$key</td><td>
<input type=text name='$key' value='$value' ";
if(isset($readOnly) && ($readOnly)){
echo "readonly ";
}
if(isset($advert))
echo "/>".
"</td><td>$advert</td></tr>\n";
else
echo "/>".
"</td></tr>\n";
unset($readOnly, $key, $value, $advert);
}
}
echo "<tr>
<td colspan='2' >
<center>
<input type=hidden name='remote_server_id' value='".$server_row['remote_server_id']."'/>
<input type=hidden name='ftp_login' value=\"" . str_replace('"', '&quot;', $ftp_login) . "\"/>
<input type=submit name='edit_ftp_user' value='". get_lang("change_account_details") ."' />
</center>
</td>
<td>
<input type='image' name='del_ftp_user' onsubmit='submit-form();' src='modules/administration/images/remove.gif'>". get_lang("remove_account") ."</input>
</td>
</tr>
</table>
</form>
</td>
</tr>";
}
}
} // end: host_stat === 1
} // end: foreach $servers as $server_row
} else {
echo get_lang('no_remote_servers');
}
echo "</tbody>";
echo "</table>\n";
}

View file

@ -1,15 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" dir="ltr">
<head>
<title>net2ftp help</title>
</head>
<frameset>
<frame frameborder="0" src="modules/help/help-user.html" />
</frameset>
<noframes><body>
Your browser can not handle frames. Please use a more recent browser to view this install guide.
</body></noframes>
</html>

View file

@ -1,8 +0,0 @@
# Rename this file to .htaccess if you want to allow large file uploads
# Note that this file is not always taken into account, depending on your server configuration
php_value max_execution_time 1200
php_value memory_limit 200M
php_value post_max_size 200M
php_value upload_max_filesize 200M

View file

@ -1,72 +0,0 @@
<?php
/////////
//
// Stone PHP SafeCrypt
// -------------------
//
// This library is intended to wrap and distance a programmer from encryption, which is
// not only difficult to use safely, but also difficult to detect flaws in. The purpose of
// SafeCrypt is to provide a convenient, correct, secure and flexible wrapper for the mcrypt
// library, to make encryption available at greater ease and lower risk.
//
// * Stone PHP SafeCrypt is genuinely free software, distributed under the Modified 3-Clause
// BSD License. This library is GPL compatible. Please resist the GPL menace. Free isn't
// truly free if it's only available to some. See LICENSE.TXT for details.
//
// * Stone PHP SafeCrypt may be used in commercial projects at no cost, without permission.
// See LICENSE.TXT for details. Copyright notice must be maintained.
//
// * No library can substitute for a working knowledge of cryptography. See LEARNING.TXT
// for resources on getting up to speed in crypto with relatively little pain.
if (defined('STONE_PHP_SAFE_CRYPT_HOST_DIRECTORY')) {
$basedir = STONE_PHP_SAFE_CRYPT_HOST_DIRECTORY;
} else {
// net2ftp
$basedir = $net2ftp_globals["application_includesdir"] . "/";
}
/////////
//
// Please see USAGE.TXT for general usage instructions, or
/////////
//
// You must set the MD5 salt in the config file before this library will function. All other
// configuration is optional. testconfig checks to make sure the config is valid.
require_once($basedir . 'StonePhpSafeCrypt_config.php');
require_once($basedir . 'StonePhpSafeCrypt_testconfig.php');
/////////
//
// This file sets up the compressor behavior. If you want to add a new compression method,
// put the data in this file.
require_once($basedir . 'StonePhpSafeCrypt_compressors.php');
/////////
//
// Various components added here. You shouldn't need to edit these.
require_once($basedir . 'StonePhpSafeCrypt_blockscramble.php');
require_once($basedir . 'StonePhpSafeCrypt_packcrypt.php');
// TODO add best-algorithm search using mcrypt_list_algorithms()
?>

View file

@ -1,92 +0,0 @@
<?php
/////////
//
// Stone PHP SafeCrypt Block Scrambler
// -----------------------------------
//
// Block scramble and block descramble are utility functions for Pack crypt and Pack decrypt.
// These are usable as lightweight encryption, and are very fast, but are also very weak and
// should not be used independantly. These are only used because of the specific, well-known
// characteristics of the IV stream as used by Pack crypt, where the OTP nature of the IV
// leader makes these scrambles sufficient to prevent CBC MITM leading-block attacks.
function BlockScramble(&$data, &$weakkey) {
// Performs a simple modulo arithmetic cipher on the IV and datastream. The PHP manual
// incorrectly states that the initialization vector may safely be transmitted plaintext;
// in http://www.ciphersbyritter.com/GLOSSARY.HTM#IV it's made clear that in CBC mode, a
// man in the middle attack is possible on the very first block returned by manipulating
// the IV. However, since the IV is just a randomness salt, it carries all of the
// important characteristics of a truncated one time pad; therefore, rotated with the MD5
// hash of the key, which is well-distributed, we have a non-attackable binary result.
// This protects CBC mode encryptions from a MITM leading block attack; also, it's nice
// to have an extra source of white noise in the signal to slow down identifications.
$strongkey = md5($weakkey);
$keysize = strlen($strongkey); // because calling sizeof() every ten cycles is retarded
$datasize = strlen($data); // and again
$output = str_repeat(' ', $datasize); // pre-allocate output buffer to prevent reallocation thrash
$di = 0; // data index cursor
$bi = 0; // block index cursor
// net2ftp - added the next line to avoid a PHP Notice about an "undefined variable"
$ki = 0;
for (; $di < $datasize; ++$di, ++$ki) {
if ($ki >= $keysize) { $ki = 0; } // key's usually smaller than data, so bound it
$output[$di] = chr((ord($data[$di]) + ord($strongkey[$ki])) % 256); // and record the scrambled byte
}
return $output;
}
function BlockDescramble(&$data, &$weakkey) {
// Performs a simple modulo arithmetic cipher on the IV and datastream. The PHP manual
// incorrectly states that the initialization vector may safely be transmitted plaintext;
// in http://www.ciphersbyritter.com/GLOSSARY.HTM#IV it's made clear that in CBC mode, a
// man in the middle attack is possible on the very first block returned by manipulating
// the IV. However, since the IV is just a randomness salt, it carries all of the
// important characteristics of a truncated one time pad; therefore, rotated with the MD5
// hash of the key, which is well-distributed, we have a non-attackable binary result.
// This protects CBC mode encryptions from a MITM leading block attack.
$strongkey = md5($weakkey);
$output = str_repeat(' ', strlen($data)); // pre-allocate output buffer to prevent reallocation thrash
$keysize = strlen($strongkey); // because calling sizeof() every ten cycles is retarded
$datasize = strlen($data); // and again
$di = 0; // data index cursor
$bi = 0; // block index cursor
// net2ftp - added the next line to avoid a PHP Notice about an "undefined variable"
$ki = 0;
for (; $di < $datasize; ++$di, ++$ki) {
if ($ki >= $keysize) { $ki = 0; } // key's usually smaller than data, so bound it
$work = (ord($data[$di]) - ord($strongkey[$ki])); // descramble the scrambled byte
if ($work < 0) { $work += 256; } // reorigin low-range bytes
$output[$di] = chr($work); // record the origin-normalized byte
}
return $output;
}
?>

View file

@ -1,56 +0,0 @@
<?php
/////////
//
// Stone PHP SafeCrypt Compressors
// -------------------------------
//
// To add a new compressor, create a new member in the $compressors array. Its key should be
// the string by which the user calls the compressor. Its value should be an array with two
// members, 'encode' and 'decode', each themselves arrays. Each of the compressor entries
// should also have a 'desc' member, to give a descriptive name to each compression method,
// in case someone wants to build something larger on this library and needs tooltip or
// statusbar descriptive text.
//
// Each encode and decode must have the 'fname' member, which contains the name of the encoding
// or decoding function as appropriate.
//
// Each may have the 'args' member, which is a list of arguments that will be passed to the
// function, in order. If either array has the 'args' member, it must therefore also have the
// 'data_arg' member, which is the index of the argument to override with the actual data to be
// compressed or uncompressed.
//
// If the array does not have the 'args' and 'data_args' members, the function will be assumed
// to take only one value, the data for compression or decompression.
$compressors = array(
'gz' => array(
'encode' => array('fname' => 'gzcompress', 'args' => array(false, 9), 'data_arg' => 0),
'decode' => array('fname' => 'gzuncompress'),
'desc' => 'RFC 1950 ZLib compression at maximum'
),
'gz_deflate' => array(
'encode' => array('fname' => 'gzdeflate', 'args' => array(false, 9), 'data_arg' => 0),
'decode' => array('fname' => 'gzinflate'),
'desc' => 'RFC 1951 ZLib deflate at maximum'
),
'bz' => array(
'encode' => array('fname' => 'bzcompress', 'args' => array(false, 9, 30), 'data_arg' => 0),
'decode' => array('fname' => 'bzdecompress'),
'desc' => 'BZip2 compress at maximum, using work factor 30'
),
// add other compressors here
);
?>

View file

@ -1,133 +0,0 @@
<?php
/////////
//
// Stone PHP SafeCrypt configuration file
// --------------------------------------
//
// You must set the default MD5 salt. Everything else is optional.
//////////////////////////////
////////// REQUIRED //////////
//////////////////////////////
/////////
//
// Default MD5 Salt
//
// Fill this string with pretty much whatever. A phrase, random letters,
// it really doesn't matter. This is a 'salt,' which is a technique used
// to defeat dictionary attacks. Changing the salt will break all of your
// previous keys until the salt is changed back, so if you're expecting to
// change this as a response to attacks, it's probably better to input this
// in the options from the containing application than to leave it in
// defaults. It *must* be set in defaults, though, because a lack of a
// salt is an unacceptable security risk.
//
// The actual contents of the salt don't matter, other than that they are
// a string. You would do well to just slap your hands against the
// keyboard for a while.
//
// For obvious reasons, be careful to escape backslashes and quote marks
// according to PHP rules. Or, avoid them entirely. Doesn't matter.
define('DEFAULT_MD5_SALT', $net2ftp_settings["md5_salt"]); // empty string is illegal
// examples:
//
// define('DEFAULT_MD5_SALT', 'l^3-40#9a+40bn_qr:0b/8n<0b}qrq SPAM SPAM SPAM EGGS AND SPAM');
// define('DEFAULT_MD5_SALT', 'I am the very model of a modern Major General');
// define('DEFAULT_MD5_SALT', 'For a good time, call 867-5309');
// define('DEFAULT_MD5_SALT', '1,3,7-trimethyl-1H-purine-2,6(3H,7H)-dione');
//////////////////////////////
////////// OPTIONAL //////////
//////////////////////////////
// TODO add DEFAULT_INCLUDE_DIRECTORY
/////////
//
// DEFAULT_ENCRYPTION_METHOD
// -------------------------
// default: '' (auto-detect)
//
// TripleDES is reasonable speed, reasonable security and available in
// most countries. Set this to false if you want the library to try to
// autodetect the best available algorithm.
//
// TODO actually make the autodetection, also get rid of tripledes
define('DEFAULT_ENCRYPTION_METHOD', 'twofish');
/////////
//
// DEFAULT_ENCRYPTION_MODE
// -----------------------
// default: 'cbc'
//
// TODO write description
// TODO ofb is badbear. test with CBC soon.
define('DEFAULT_ENCRYPTION_MODE', 'cbc');
/////////
//
// DEFAULT_ALGORITHM_DIRECTORY
// ---------------------------
// default: '' (auto-detect)
//
// On most machines, this should stay empty. This allows you to override
// the directory in which the compressors and decompressors will be looked
// for. PHP defaults for this are almost always correct, and should rarely
// be overridden. Fill only if you have specific reason to do so.
define('DEFAULT_ALGORITHM_DIRECTORY', '');
/////////
//
// DEFAULT_MODE_DIRECTORY
// ----------------------
// default: '' (auto-detect)
//
// As above, but for block modes instead of compressors. Again, fill only
// if you have a specific reason to do so.
define('DEFAULT_MODE_DIRECTORY', '');
/////////
//
// DEFAULT_COMPRESSION_METHOD
// --------------------------
// default: false
//
// Here, you may set the library to compress by default when encrypting.
// Whether this is desirable has a lot to do with whether your server is
// already compressing somewhere else, whether you can afford the CPU time,
// whether the space is important, and so on. I leave this off by default
// because you can turn it on during use, but if you always use it, hell,
// just set it here.
//
// Standard values are [ 'gz' , 'gz_deflate' , 'bz' , false ].
//
// User may add new values in StonePhpSafeCrypt_compressors.php .
//
// A value of false skips default compression, which is probably best.
define('DEFAULT_COMPRESSION_METHOD', false);
?>

View file

@ -1,234 +0,0 @@
<?php
function PackCrypt(&$Data, $WeakKey, $options=array() ) {
$result = array(
'success' => false,
'reason' => 'Incomplete pack for unknown reason; indicates horrible failure.',
'output' => false
);
// load options
if (isset($options['cipher'])) { // Check whether user specified an alternate cipher in the options
$CipherType = $options['cipher']; // if so, use it
} else {
$CipherType = DEFAULT_ENCRYPTION_METHOD; // otherwise, use the default cipher
}
if (isset($options['mode'])) { // Check whether user specified an alternate block mode in the options
$mode = $options['mode']; // if so, use it
} else {
$mode = DEFAULT_ENCRYPTION_MODE; // otherwise, use the default block mode
}
if (isset($options['salt'])) { // Check whether user specified an alternate md5 salt in the options
$salt = $options['salt']; // if so, use it
} else {
$salt = DEFAULT_MD5_SALT; // otherwise, use the default salt
}
// do preparation
$SecretData = serialize($Data); // Convert data into a serialized string for single packing
$compressor = false;
global $compressors;
// handle potential compression
if (isset($options['compressor'])) {
if (isset($compressors[$options['compressor']])) {
$compressor = $compressors[$options['compressor']];
if (function_exists($compressor['encode']['fname'])) {
if (function_exists($compressor['decode']['fname'])) {
if (isset($compressor['encode']['args'])) {
if (isset($compressor['encode']['data_arg'])) {
$largs = $compressor['encode']['args'];
$largs[$compressor['encode']['data_arg']] = $SecretData;
$SecretData = call_user_func_array($compressor['encode']['fname'], $largs);
} else {
$result['reason'] = 'The requested compressor, "' . $options['compressor'] . '", requires an argument list; however the data argument has not been specified, making call impossible.';
return $result;
}
} else {
$SecretData = $compressor['encode']['fname']($SecretData);
}
} else {
$result['reason'] = 'The requested compressor, "' . $options['compressor'] . '", requires the decode function "' . $compressor['decode']['fname'] . '", which is not present in this PHP installation.';
return $result;
}
} else {
$result['reason'] = 'The requested compressor, "' . $options['compressor'] . '", requires the encode function "' . $compressor['encode']['fname'] . '", which is not present in this PHP installation.';
return $result;
}
} else {
$result['reason'] = 'The requested compressor, "' . $options['compressor'] . '", is not configured in this script.';
return $result;
}
}
// do work
$td = mcrypt_module_open($CipherType, '', $mode, ''); // Open the cipher module
$ks = mcrypt_enc_get_key_size($td); // Get required key size
$strongkey = substr(md5($salt . $WeakKey), 0, $ks); // Harden key data into safe key
$ivsz = mcrypt_enc_get_iv_size($td); // Get the size of the appropriate local initialization vector
// net2ftp - the 2nd argument of mcrypt_create_iv must be different on Unix and Windows
// Try first Unix, and if $iv is empty try Windows
// Use prefix @ to suppress PHP Warning messages
$iv = @mcrypt_create_iv($ivsz, MCRYPT_DEV_RANDOM); // Generate an initialization vector ** Unix **
if ($iv == "") {
$iv = @mcrypt_create_iv($ivsz, MCRYPT_RAND); // Generate an initialization vector ** Windows **
}
mcrypt_generic_init($td, $strongkey, $iv); // Init encryption engine
$encrypted = mcrypt_generic($td, $SecretData); // Perform encryption
mcrypt_generic_deinit($td); // Shut down encryption engine
mcrypt_module_close($td); // Close the cipher module
$IvDataPack = $iv . $encrypted; // Prepend the IV onto the data stream for convenient transfer
$result['output'] = BlockScramble($IvDataPack, $strongkey); // Return the IV prepended to the data stream, CBC tamper protected
$result['success'] = true;
$result['reason'] = 'Successful pack.';
return $result;
}
function UnpackCrypt(&$SecretData, $WeakKey, $options=array() ) {// $CipherType = 'tripledes', $mode = 'ofb') {
$result = array(
'success' => false,
'reason' => 'Incomplete unpack for unknown reason; indicates horrible failure.',
'output' => false
);
// load options
if (isset($options['cipher'])) { // Check whether user specified an alternate cipher in the options
$CipherType = $options['cipher']; // if so, use it
} else {
$CipherType = DEFAULT_ENCRYPTION_METHOD; // otherwise, use the default cipher
}
if (isset($options['mode'])) { // Check whether user specified an alternate block mode in the options
$mode = $options['mode']; // if so, use it
} else {
$mode = DEFAULT_ENCRYPTION_MODE; // otherwise, use the default block mode
}
if (isset($options['salt'])) { // Check whether user specified an alternate md5 salt in the options
$salt = $options['salt']; // if so, use it
} else {
$salt = DEFAULT_MD5_SALT; // otherwise, use the default salt
}
// do work
$td = mcrypt_module_open($CipherType, '', $mode, ''); // Open the cipher module
$ks = mcrypt_enc_get_key_size($td); // Get required key size
$strongkey = substr(md5($salt . $WeakKey), 0, $ks); // Regenerate hardened key from weak key
$DescrambleData = BlockDescramble($SecretData, $strongkey); // Remove leading-block CBC tampering attack protection
$ivsz = mcrypt_enc_get_iv_size($td); // Get the size of the appropriate local initialization vector
$iv = substr($DescrambleData, 0, $ivsz); // Recover the initialization vector
$WorkData = substr($DescrambleData, $ivsz); // Recover the data block
mcrypt_generic_init($td, $strongkey, $iv); // Init decryption engine
$decrypted = mdecrypt_generic($td, $WorkData); // Perform decryption
mcrypt_generic_deinit($td); // Shut down decryption engine
mcrypt_module_close($td); // Close the cipher module
// handle potential decompression
global $compressors;
$compressor = false;
if (isset($options['compressor'])) {
if (isset($compressors[$options['compressor']])) {
$compressor = $compressors[$options['compressor']];
if (function_exists($compressor['encode']['fname'])) {
if (function_exists($compressor['decode']['fname'])) {
if (isset($compressor['decode']['args'])) {
if (isset($compressor['decode']['data_arg'])) {
$largs = $compressor['decode']['args'];
$largs[$compressor['decode']['data_arg']] = $decrypted;
$decrypted = call_user_func_array($compressor['decode']['fname'], $largs);
} else {
$result['reason'] = 'The requested compressor, "' . $options['compressor'] . '", requires an argument list; however the data argument has not been specified, making call impossible.';
return $result;
}
} else {
$decrypted = $compressor['decode']['fname']($decrypted);
}
} else {
$result['reason'] = 'The requested compressor, "' . $options['compressor'] . '", requires the decode function "' . $compressor['decode']['fname'] . '", which is not present in this PHP installation.';
return $result;
}
} else {
$result['reason'] = 'The requested compressor, "' . $options['compressor'] . '", requires the encode function "' . $compressor['encode']['fname'] . '", which is not present in this PHP installation.';
return $result;
}
} else {
$result['reason'] = 'The requested compressor, "' . $options['compressor'] . '", is not configured in this script.';
return $result;
}
}
$result['success'] = true;
$result['reason'] = 'Successful unpack.';
$result['output'] = unserialize($decrypted); // Convert data from a serialized string and return
return $result;
}
?>

View file

@ -1,9 +0,0 @@
<?php
$forcefail = array('Apply' => false, 'Reason' => '');
if (DEFAULT_MD5_SALT === '') {
$forcefail['Apply'] = true;
$forcefail['Reason'] = 'You must set the default MD5 salt on line 83 before this library will function.';
}
?>

View file

@ -1,749 +0,0 @@
<?php
// -------------------------------------------------------------------------------
// | net2ftp: a web based FTP client |
// | Copyright (c) 2003-2013 by David Gartner |
// | |
// | 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. |
// | |
// -------------------------------------------------------------------------------
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function encryptPassword($password) {
// --------------
// This function encrypts the FTP password
// --------------
// -------------------------------------------------------------------------
// Global variables and settings
// -------------------------------------------------------------------------
global $net2ftp_settings;
// -------------------------------------------------------------------------
// If mcrypt libraries are available, encrypt the password with the Stone PHP SafeCrypt library
// http://blog.sc.tri-bit.com/archives/101
// -------------------------------------------------------------------------
// if (function_exists("mcrypt_module_open") == true) {
// $packed = PackCrypt($password, DEFAULT_MD5_SALT);
// if ($packed["success"] == true) { return $packed["output"]; }
// else {
// setErrorVars(false, "An error occured when trying to encrypt the password: " . $packed["reason"], debug_backtrace(), __FILE__, __LINE__);
// }
// }
// -------------------------------------------------------------------------
// Else, XOR it with a random string
// -------------------------------------------------------------------------
// else {
$password_encrypted = "";
$encryption_string = sha1($net2ftp_settings["encryption_string"]);
if ($encryption_string % 2 == 1) { // we need even number of characters
$encryption_string .= $encryption_string{0};
}
for ($i=0; $i < strlen($password); $i++) { // encrypts one character - two bytes at once
$password_encrypted .= sprintf("%02X", hexdec(substr($encryption_string, 2*$i % strlen($encryption_string), 2)) ^ ord($password{$i}));
}
return $password_encrypted;
// }
} // End function encryptPassword
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function decryptPassword($password_encrypted) {
// --------------
// This function decrypts the FTP password
// --------------
// -------------------------------------------------------------------------
// Global variables and settings
// -------------------------------------------------------------------------
global $net2ftp_settings;
// -------------------------------------------------------------------------
// If mcrypt libraries are available, encrypt the password with the Stone PHP SafeCrypt library
// http://blog.sc.tri-bit.com/archives/101
// -------------------------------------------------------------------------
// if (function_exists("mcrypt_module_open") == true) {
// $unpacked = UnpackCrypt($password_encrypted, DEFAULT_MD5_SALT);
// if ($unpacked["success"] == true) { return $unpacked["output"]; }
// else {
// setErrorVars(false, "An error occured when trying to decrypt the password: " . $unpacked["reason"], debug_backtrace(), __FILE__, __LINE__);
// }
// }
// -------------------------------------------------------------------------
// Else, XOR it with a random string
// -------------------------------------------------------------------------
// else {
$password = "";
$encryption_string = sha1($net2ftp_settings["encryption_string"]);
if ($encryption_string % 2 == 1) { // we need even number of characters
$encryption_string .= $encryption_string{0};
}
for ($i=0; $i < strlen($password_encrypted); $i += 2) { // decrypts two bytes - one character at once
$password .= chr(hexdec(substr($encryption_string, $i % strlen($encryption_string), 2)) ^ hexdec(substr($password_encrypted, $i, 2)));
}
return $password;
// }
} // End function decryptPassword
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function checkIPinNetwork($ip, $network) {
// ----------
// This function checks if an IP address is part of a network
// If yes, it returns true; if no, it returns false
//
// The network's IP address range must be one of these notations:
// - Single IP (example: 192.168.1.1)
// - IP from-to (example: 192.168.1.1-192.168.1.10
// - CIDR notation (example: 192.168.1.0/30 or 192.168.1/30)
// ----------
$ip = trim($ip);
$network = trim($network);
$d = strpos($network,"-");
if ($d===false) {
$ip_arr = explode("/", $network);
if (!preg_match("@\d*\.\d*\.\d*\.\d*@", $ip_arr[0], $matches)){
$ip_arr[0] .= ".0"; // To handle networks like 192.168.1/30 (instead of 192.168.1.0/30)
}
$network_long = ip2long($ip_arr[0]);
$x = ip2long($ip_arr[1]);
$mask = long2ip($x) == $ip_arr[1] ? $x : (0xffffffff << (32 - $ip_arr[1]));
$ip_long = ip2long($ip);
return ($ip_long & $mask) == ($network_long & $mask);
}
else {
$from = ip2long(trim(substr($network,0,$d)));
$to = ip2long(trim(substr($network,$d+1)));
$ip = ip2long($ip);
return ($ip>=$from and $ip<=$to);
}
} // End function checkIPinNetwork
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function printLoginInfo() {
// --------------
// This function prints the ftpserver, username and login information
// --------------
global $net2ftp_globals;
echo "<input type=\"hidden\" name=\"ftpserver\" value=\"" . htmlEncode2($net2ftp_globals["ftpserver"]) . "\" />\n";
echo "<input type=\"hidden\" name=\"ftpserverport\" value=\"" . htmlEncode2($net2ftp_globals["ftpserverport"]) . "\" />\n";
echo "<input type=\"hidden\" name=\"username\" value=\"" . htmlEncode2($net2ftp_globals["username"]) . "\" />\n";
// echo "<input type=\"hidden\" name=\"password_encrypted\" value=\"" . htmlEncode2($net2ftp_globals["password_encrypted"]) . "\" />\n";
echo "<input type=\"hidden\" name=\"language\" value=\"" . htmlEncode2($net2ftp_globals["language"]) . "\" />\n";
echo "<input type=\"hidden\" name=\"skin\" value=\"" . htmlEncode2($net2ftp_globals["skin"]) . "\" />\n";
echo "<input type=\"hidden\" name=\"ftpmode\" value=\"" . htmlEncode2($net2ftp_globals["ftpmode"]) . "\" />\n";
echo "<input type=\"hidden\" name=\"passivemode\" value=\"" . htmlEncode2($net2ftp_globals["passivemode"]) . "\" />\n";
echo "<input type=\"hidden\" name=\"protocol\" value=\"" . htmlEncode2($net2ftp_globals["protocol"]) . "\" />\n";
echo "<input type=\"hidden\" name=\"viewmode\" value=\"" . htmlEncode2($net2ftp_globals["viewmode"]) . "\" />\n";
echo "<input type=\"hidden\" name=\"sort\" value=\"" . htmlEncode2($net2ftp_globals["sort"]) . "\" />\n";
echo "<input type=\"hidden\" name=\"sortorder\" value=\"" . htmlEncode2($net2ftp_globals["sortorder"]) . "\" />\n";
} // End function printLoginInfo
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function printLoginInfo_javascript() {
// --------------
// This function prints the ftpserver, username and login information -- for javascript input
// --------------
global $net2ftp_globals;
echo " d.writeln('<input type=\"hidden\" name=\"ftpserver\" value=\"" . javascriptEncode2($net2ftp_globals["ftpserver"]) . "\" />');\n";
echo " d.writeln('<input type=\"hidden\" name=\"ftpserverport\" value=\"" . javascriptEncode2($net2ftp_globals["ftpserverport"]) . "\" />');\n";
echo " d.writeln('<input type=\"hidden\" name=\"username\" value=\"" . javascriptEncode2($net2ftp_globals["username"]) . "\" />');\n";
// echo " d.writeln('<input type=\"hidden\" name=\"password_encrypted\" value=\"" . javascriptEncode2($net2ftp_globals["password_encrypted"]) . "\" />');\n";
echo " d.writeln('<input type=\"hidden\" name=\"language\" value=\"" . javascriptEncode2($net2ftp_globals["language"]) . "\" />');\n";
echo " d.writeln('<input type=\"hidden\" name=\"skin\" value=\"" . javascriptEncode2($net2ftp_globals["skin"]) . "\" />');\n";
echo " d.writeln('<input type=\"hidden\" name=\"ftpmode\" value=\"" . javascriptEncode2($net2ftp_globals["ftpmode"]) . "\" />');\n";
echo " d.writeln('<input type=\"hidden\" name=\"passivemode\" value=\"" . javascriptEncode2($net2ftp_globals["passivemode"]) . "\" />');\n";
echo " d.writeln('<input type=\"hidden\" name=\"protocol\" value=\"" . javascriptEncode2($net2ftp_globals["protocol"]) . "\" />');\n";
echo " d.writeln('<input type=\"hidden\" name=\"viewmode\" value=\"" . javascriptEncode2($net2ftp_globals["viewmode"]) . "\" />');\n";
echo " d.writeln('<input type=\"hidden\" name=\"sort\" value=\"" . javascriptEncode2($net2ftp_globals["sort"]) . "\" />');\n";
echo " d.writeln('<input type=\"hidden\" name=\"sortorder\" value=\"" . javascriptEncode2($net2ftp_globals["sortorder"]) . "\" />');\n";
} // End function printLoginInfo_javascript
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function printPHP_SELF($case) {
// --------------
// This function prints $PHP_SELF, the name of the script itself
// --------------
// -------------------------------------------------------------------------
// Global variables and settings
// -------------------------------------------------------------------------
global $net2ftp_globals, $net2ftp_settings;
$ftpserver = urlEncode2($net2ftp_globals["ftpserver"]);
$ftpserverport = urlEncode2($net2ftp_globals["ftpserverport"]);
$username = urlEncode2($net2ftp_globals["username"]);
$language = urlEncode2($net2ftp_globals["language"]);
$skin = urlEncode2($net2ftp_globals["skin"]);
$ftpmode = urlEncode2($net2ftp_globals["ftpmode"]);
$passivemode = urlEncode2($net2ftp_globals["passivemode"]);
$protocol = urlEncode2($net2ftp_globals["protocol"]);
$viewmode = urlEncode2($net2ftp_globals["viewmode"]);
$sort = urlEncode2($net2ftp_globals["sort"]);
$sortorder = urlEncode2($net2ftp_globals["sortorder"]);
$state_html = urlEncode2($net2ftp_globals["state"]);
$state2_html = urlEncode2($net2ftp_globals["state2"]);
$directory_html = urlEncode2($net2ftp_globals["directory"]);
$entry_html = urlEncode2($net2ftp_globals["entry"]);
if (isset($_SESSION["net2ftp_password_encrypted_" . $net2ftp_globals["ftpserver"] . $net2ftp_globals["username"]]) == true) {
$password_encrypted = urlEncode2($_SESSION["net2ftp_password_encrypted_" . $net2ftp_globals["ftpserver"] . $net2ftp_globals["username"]]);
}
elseif (isset($net2ftp_globals["password_encrypted"]) == true) {
$password_encrypted = urlEncode2($net2ftp_globals["password_encrypted"]);
}
else {
$password_encrypted = "";
}
// From /includes/registerglobals.inc.php
$URL = $net2ftp_globals["action_url"];
// If the URL already contains parameters (?param1=value1&amp;param2=value2...), append &amp;
// If not, append a ?
if (strpos($URL, "?") !== false) { $URL .= "&amp;"; }
else { $URL .= "?"; }
// Append further parameters
if ($case == "actions") {
$URL .= "ftpserver=$ftpserver&amp;ftpserverport=$ftpserverport&amp;username=$username&amp;language=$language&amp;skin=$skin&amp;ftpmode=$ftpmode&amp;passivemode=$passivemode&amp;protocol=$protocol&amp;viewmode=$viewmode&amp;sort=$sort&amp;sortorder=$sortorder";
}
// Bookmark with password: go straight to the bookmarked state
elseif ($case == "bookmark_withpw") {
$URL .= "ftpserver=$ftpserver&amp;amp;ftpserverport=$ftpserverport&amp;amp;username=$username&amp;amp;password_encrypted=$password_encrypted&amp;amp;language=$language&amp;amp;skin=$skin&amp;amp;ftpmode=$ftpmode&amp;amp;passivemode=$passivemode&amp;amp;protocol=$protocol&amp;amp;viewmode=$viewmode&amp;amp;sort=$sort&amp;amp;sortorder=$sortorder&amp;amp;state=$state_html&amp;amp;state2=$state2_html&amp;amp;directory=$directory_html&amp;amp;entry=$entry_html";
}
// Bookmark without password: go first to the login_small state to enter the password
elseif ($case == "bookmark_withoutpw") {
$URL .= "ftpserver=$ftpserver&amp;amp;ftpserverport=$ftpserverport&amp;amp;username=$username&amp;amp;language=$language&amp;amp;skin=$skin&amp;amp;ftpmode=$ftpmode&amp;amp;passivemode=$passivemode&amp;amp;protocol=$protocol&amp;amp;viewmode=$viewmode&amp;amp;sort=$sort&amp;amp;sortorder=$sortorder&amp;amp;state=login_small&amp;amp;state2=bookmark&amp;amp;go_to_state=$state_html&amp;amp;go_to_state2=$state2_html&amp;amp;directory=$directory_html&amp;amp;entry=$entry_html";
}
// Jupload java applet: the cookie information is added to the page using javascript (/skins/blue/jupload1.template.php)
elseif ($case == "jupload") {
$URL .= "ftpserver=$ftpserver&amp;ftpserverport=$ftpserverport&amp;username=$username&amp;language=$language&amp;skin=$skin&amp;ftpmode=$ftpmode&amp;passivemode=$passivemode&amp;protocol=$protocol&amp;directory=$directory_html&amp;state=jupload&amp;screen=2";
}
elseif ($case == "view") {
$URL .= "ftpserver=$ftpserver&amp;ftpserverport=$ftpserverport&amp;username=$username&amp;language=$language&amp;skin=$skin&amp;ftpmode=$ftpmode&amp;passivemode=$passivemode&amp;protocol=$protocol&amp;viewmode=$viewmode&amp;sort=$sort&amp;sortorder=$sortorder&amp;state=$state_html&amp;state2=image&amp;directory=$directory_html&amp;entry=$entry_html";
}
elseif ($case == "createDirectoryTreeWindow") {
$URL = $net2ftp_globals["application_rootdir_url"] . "/index.php";
}
// Change skin
elseif ($case == "defaultskin") {
$URL .= "ftpserver=$ftpserver&amp;ftpserverport=$ftpserverport&amp;username=$username&amp;language=$language&amp;skin=" . $net2ftp_settings["default_skin"] . "&amp;ftpmode=$ftpmode&amp;passivemode=$passivemode&amp;protocol=$protocol&amp;viewmode=$viewmode&amp;sort=$sort&amp;sortorder=$sortorder&amp;state=$state_html&amp;state2=$state2_html&amp;directory=$directory_html&amp;entry=$entry_html";
}
return $URL;
} // End function printPHP_SELF
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function checkAuthorization($ftpserver, $ftpserverport, $directory, $username) {
// --------------
// This function
// checks if the FTP server is in the list of those that may be accessed
// checks if the FTP server is in the list of those that may NOT be accessed
// checks if the IP address is in the list of banned IP addresses
// checks if the FTP server port is in the allowed range
// If all is OK, then the user may continue...
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_globals, $net2ftp_settings, $net2ftp_result;
// -------------------------------------------------------------------------
// Check if the FTP server is in the list of those that may be accessed
// -------------------------------------------------------------------------
if ($net2ftp_settings["allowed_ftpservers"][1] != "ALL") {
$result1 = array_search($ftpserver, $net2ftp_settings["allowed_ftpservers"]);
if ($result1 == false) {
$errormessage = __("The FTP server <b>%1\$s</b> is not in the list of allowed FTP servers.", $ftpserver);
setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
return false;
}
}
// -------------------------------------------------------------------------
// Check if the FTP server is in the list of those that may NOT be accessed
// -------------------------------------------------------------------------
if (isset($net2ftp_settings["banned_ftpservers"][1]) == true && $net2ftp_settings["banned_ftpservers"][1] != "NONE") {
$result2 = array_search($ftpserver, $net2ftp_settings["banned_ftpservers"]);
if ($result2 != false) {
$errormessage = __("The FTP server <b>%1\$s</b> is in the list of banned FTP servers.", $ftpserver);
setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
return false;
}
}
// -------------------------------------------------------------------------
// Check if the FTP server port is OK
// -------------------------------------------------------------------------
// Do not perform this check if ALL ports are allowed
if ($net2ftp_settings["allowed_ftpserverport"] != "ALL" ) {
// Report the error if another port nr has been entered than the one which is allowed
if ($ftpserverport != $net2ftp_settings["allowed_ftpserverport"]) {
$errormessage = __("The FTP server port %1\$s may not be used.", $ftpserverport);
setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
return false;
}
}
// -------------------------------------------------------------------------
// Check if the IP address is in the list of those that may be used
// -------------------------------------------------------------------------
if ($net2ftp_settings["allowed_addresses"][1] != "ALL") {
$result3 = false;
for ($i=1; $i<=sizeof($net2ftp_settings["allowed_addresses"]); $i++) {
if (checkIPinNetwork($net2ftp_globals["REMOTE_ADDR"], $net2ftp_settings["allowed_addresses"][$i]) == true) { $result3 = true; }
}
if ($result3 == false) {
$errormessage = __("Your IP address (%1\$s) is not in the list of allowed IP addresses.", $net2ftp_globals["REMOTE_ADDR"]);
setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
return false;
}
}
// -------------------------------------------------------------------------
// Check if the IP address is in the list of those that may NOT be used
// -------------------------------------------------------------------------
if (isset($net2ftp_settings["banned_addresses"][1]) == true && $net2ftp_settings["banned_addresses"][1] != "NONE") {
$result4 = false;
for ($i=1; $i<=sizeof($net2ftp_settings["banned_addresses"]); $i++) {
if (checkIPinNetwork($net2ftp_globals["REMOTE_ADDR"], $net2ftp_settings["banned_addresses"][$i]) == true) { $result4 = true; }
}
if ($result4 != false) {
$errormessage = __("Your IP address (%1\$s) is in the list of banned IP addresses.", $net2ftp_globals["REMOTE_ADDR"]);
setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
return false;
}
}
// -------------------------------------------------------------------------
// Check if the directory is authorised:
// 1 - Whether the current $directory name contains a banned keyword.
// 2 - If the current $directory is a subdirectory of the homedirectory.
// The rootdirectory is first checked for the current user; if this is not set,
// the default rootdirectory is checked.
// -------------------------------------------------------------------------
$result4 = checkAuthorizedDirectory($directory);
if ($net2ftp_result["success"] == false) { return false; }
if ($result4 == false) {
$net2ftp_globals["directory"] = $net2ftp_globals["homedirectory"];
$net2ftp_globals["directory_html"] = htmlEncode2($net2ftp_globals["directory"]);
$net2ftp_globals["directory_js"] = javascriptEncode2($net2ftp_globals["directory"]);
if (strlen($net2ftp_globals["directory"]) > 0) { $net2ftp_globals["printdirectory"] = $net2ftp_globals["directory"]; }
else { $net2ftp_globals["printdirectory"] = "/"; }
}
// -------------------------------------------------------------------------
// If everything is OK, return true
// -------------------------------------------------------------------------
return true;
} // end checkAuthorization
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function checkAuthorizedDirectory($directory) {
// --------------
// 1 - This function checks whether the current $directory name contains a banned
// keyword.
// 2 - It also checks if the current $directory is a subdirectory of the
// homedirectory. The rootdirectory is first checked for the current user;
// if this is not set, the default rootdirectory is checked.
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_globals, $net2ftp_settings, $net2ftp_result;
// -------------------------------------------------------------------------
// 1 - Check if the directory name contains a banned keyword
// -------------------------------------------------------------------------
if (checkAuthorizedName($directory) == false) { return false; }
// -------------------------------------------------------------------------
// 2 - Check if the directory is a subdirectory of the homedirectory (set in the DB)
// -------------------------------------------------------------------------
// ----------------------------------------------
// Initial checks
// ----------------------------------------------
if ($net2ftp_settings["use_database"] != "yes" || $net2ftp_settings["check_homedirectory"] != "yes") { return true; }
// ----------------------------------------------
// Get the homedirectory from the database, then store it in a global
// variable, and from then on, don't access the database any more
// ----------------------------------------------
$net2ftp_globals["homedirectory"] = getRootdirectory();
// ----------------------------------------------
// Check if the current directory is a subdirectory of the homedirectory
// ----------------------------------------------
if (isSubdirectory($net2ftp_globals["homedirectory"], $directory) == false) { return false; }
else { return true; }
} // end checkAuthorizedDirectory
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function checkAuthorizedName($dirfilename) {
// --------------
// This function checks if the directory/file/symlink name contains a forbidden keyword
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_settings;
// -------------------------------------------------------------------------
// Check
// -------------------------------------------------------------------------
if (isset($net2ftp_settings["banned_keywords"][1]) == true && $net2ftp_settings["banned_keywords"][1] != "NONE") {
for ($i=1; $i<=sizeof($net2ftp_settings["banned_keywords"]); $i++) {
if (strpos($dirfilename, $net2ftp_settings["banned_keywords"][$i]) !== false) { return false; }
}
}
return true;
} // end checkAuthorizedName
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function getRootdirectory() {
// --------------
// This function gets the user's root directory from the database and
// stores it in $net2ftp_globals["homedirectory"].
//
// If $net2ftp_globals["homedirectory"] is already filled in (cache), no connection
// is made to the DB and this value is returned.
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_globals, $net2ftp_settings, $net2ftp_result;
// -------------------------------------------------------------------------
// Initial checks
// -------------------------------------------------------------------------
if ($net2ftp_settings["use_database"] != "yes" || $net2ftp_settings["check_homedirectory"] != "yes") {
$net2ftp_globals["homedirectory"] = "/";
}
// -------------------------------------------------------------------------
// Get the homedirectory from the database, then store it in a global
// variable, and from then on, don't access the database any more
// -------------------------------------------------------------------------
if (isset($net2ftp_globals["homedirectory"]) == false) {
// -------------------------------------------------------------------------
// Add slashes to variables which are used in a SQL query, and which are
// potentially unsafe (supplied by the user)
// -------------------------------------------------------------------------
$net2ftp_ftpserver_safe = addslashes($net2ftp_globals["ftpserver"]);
$net2ftp_username_safe = addslashes($net2ftp_globals["username"]);
// -------------------------------------------------------------------------
// Connect
// -------------------------------------------------------------------------
$mydb = connect2db();
if ($net2ftp_result["success"] == false) { return false; }
// -------------------------------------------------------------------------
// Get user's home directory
// -------------------------------------------------------------------------
$sqlquery1 = "SELECT homedirectory FROM net2ftp_users WHERE ftpserver = '$net2ftp_ftpserver_safe' AND username = '$net2ftp_username_safe';";
$result1 = mysql_query("$sqlquery1") or die("Unable to execute SQL SELECT query (isAuthorizedDirectory > sqlquery1) <br /> $sqlquery1");
$nrofrows1 = mysql_num_rows($result1);
if ($nrofrows1 == 0) {
$net2ftp_globals["homedirectory"] = "/";
}
elseif ($nrofrows1 == 1) {
$resultRow1 = mysql_fetch_row($result1);
$net2ftp_globals["homedirectory"] = $resultRow1[0];
}
else {
setErrorVars(false, __("Table net2ftp_users contains duplicate rows."), debug_backtrace(), __FILE__, __LINE__);
return false;
}
}
return $net2ftp_globals["homedirectory"];
} // end getRootdirectory
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function isSubdirectory($parentdir, $childdir) {
// --------------
// Returns true if the childdir is a subdirectory of the parentdir
// --------------
// If the parentdir is empty or the root directory, then the childdir is
// a the same as or a subdirectory of the parentdir
if ($parentdir == "" || $parentdir == "/" || $parentdir == "\\") { return true; }
// Strip the directories of leading and trailing slashes
$parentdir = stripDirectory($parentdir);
$childdir = stripDirectory($childdir);
$parentdir_length = strlen($parentdir);
// Check if the first characters of the childdir are different from the
// parentdir. Example:
// parentdir: /home/abc
// childdir: /home/blabla ==> false
// childdir: /home/abcd ==> continue further checks
// childdir: /home/abc/xyz ==> continue further checks
$childdir_firstchars = substr($childdir, 0, $parentdir_length);
if ($childdir_firstchars != $parentdir) { return false; }
// If the first characters of the childdir are identical to the parentdir,
// check if the first next character of the childdir name is different.
// Example:
// parentdir: /home/abc
// childdir: /home/abcd ==> false
// childdir: /home/abc/xyz ==> true
$childdir_nextchar = substr($childdir, $parentdir_length, 1);
if ($childdir_nextchar != "/" && $childdir_nextchar != "\\") { return false; }
return true;
} // end isSubdirectory
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function checkAdminUsernamePassword() {
// --------------
// This function checks the Administrator username and password.
// If one of the two is not filled in or incorrect, a header() is sent
// to redirect the user to the login_small page.
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_globals, $net2ftp_settings, $net2ftp_result;
$input_admin_username = $_POST["input_admin_username"];
$input_admin_password = $_POST["input_admin_password"];
// -------------------------------------------------------------------------
// Check Admin username and password
// -------------------------------------------------------------------------
// Set the error message depending on the case
// Redirect the user to the login_small page
// No username or password filled in
if ($input_admin_username == "" || $input_admin_password == "") {
$errormessage = htmlEncode2(__("You did not enter your Administrator username or password."));
header("Location: " . $net2ftp_globals["action_url"] . "?state=login_small&state2=admin&go_to_state=" . $net2ftp_globals["state"] . "&go_to_state2=" . $net2ftp_globals["state2"] . "&errormessage=" . $errormessage);
$net2ftp_result["exit"] = true;
return false;
}
// Wrong username or password
elseif ($input_admin_username != $net2ftp_settings["admin_username"] ||
$input_admin_password != $net2ftp_settings["admin_password"]) {
$errormessage = htmlEncode2(__("Wrong username or password. Please try again."));
header("Location: " . $net2ftp_globals["action_url"] . "?state=login_small&state2=admin&go_to_state=" . $net2ftp_globals["state"] . "&go_to_state2=" . $net2ftp_globals["state2"] . "&errormessage=" . $errormessage);
$net2ftp_result["exit"] = true;
return false;
}
return true;
} // end checkAdminUsernamePassword()
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
?>

View file

@ -1,39 +0,0 @@
<?php
// -------------------------------------------------------------------------------
// | net2ftp: a web based FTP client |
// | Copyright (c) 2003-2013 by David Gartner |
// | |
// | 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. |
// | |
// -------------------------------------------------------------------------------
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function debug_backtrace() {
// --------------
// This function is defined when the PHP version is < 4.3.0
// --------------
return "There is no backtrace information available, because this websites runs an older version of PHP (before 4.3.0).";
} // end function debug_backtrace
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
?>

View file

@ -1,876 +0,0 @@
<?php
// -------------------------------------------------------------------------------
// | net2ftp: a web based FTP client |
// | Copyright (c) 2003-2013 by David Gartner |
// | |
// | 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. |
// | |
// -------------------------------------------------------------------------------
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function ftp_getlist($conn_id, $directory) {
// --------------
// This function connects to the FTP server and returns an array with a list of directories and files.
// One row per directory or file, with rows from index 1 to n
//
// Step 1: send ftp_rawlist request to the FTP server; this returns a string
// Step 2: parse that string and get a first array ($templist)
// Step 3: move the rows to another array, to index 1 to n ($list)
//
// This function is used in all functions which process directories recursively.
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_globals, $net2ftp_settings;
// -------------------------------------------------------------------------
// Initialization
// -------------------------------------------------------------------------
$warnings = "";
// -------------------------------------------------------------------------
// Step 1: Chdir to the directory and get the current directory
// -------------------------------------------------------------------------
// ----------------------------------------------
// Step 1a - Directory is "/"
// Chdir to the directory because otherwise the ftp_rawlist does not work on some FTP servers
// ----------------------------------------------
if ($directory == "/") {
$result1a = ftp_chdir($conn_id, $directory);
}
// ----------------------------------------------
// Step 1b - Directory is ""
// If the directory is "" then the user can be directed to his home directory
// We don't know which directory it is, so we request it from the FTP server
// ----------------------------------------------
elseif ($directory == "") {
$result1b = @ftp_chdir($conn_id, $directory);
$directory = ftp_pwd($conn_id);
}
// ----------------------------------------------
// Step 1c - Directory is not "/" or ""
// ----------------------------------------------
else {
// 1c1 - Replace \' by \\' to be able to delete directories with names containing \'
$directory1 = str_replace("\'", "\\\'", $directory);
// 1c2 - Chdir to the directory
// This is to check if the directory exists, but also because otherwise
// the ftp_rawlist does not work on some FTP servers.
$result1c = ftp_chdir($conn_id, $directory1);
// 1c3 - If the first ftp_chdir returns false, try a second time without the leading /
// Some Windows FTP servers do not work when you use a leading /
if ($result1c == false) {
$directory2 = stripDirectory($directory1);
$result2 = ftp_chdir($conn_id, $directory2);
// 1c3 - If the second ftp_chdir also does not work:
// For the Browse screen ==> go to the user's root directory
// For all other screens ==> return error
if ($result2 == false) {
if ($net2ftp_globals["state"] == "browse") {
$rootdirectory = getRootdirectory();
// User's root directory is different from the current directory, so switch to it
if ($directory != $rootdirectory) {
$warnings .= __("The directory <b>%1\$s</b> does not exist or could not be selected, so the directory <b>%2\$s</b> is shown instead.", $directory, $rootdirectory);
$directory = $rootdirectory;
$result3 = ftp_chdir($conn_id, $directory);
}
// The current directory *is* the user's root directory!
// We cannot display any other directory (like /), so print an error message.
else {
$errormessage = __("Your root directory <b>%1\$s</b> does not exist or could not be selected.", $directory);
setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
}
}
else {
$errormessage = __("The directory <b>%1\$s</b> could not be selected - you may not have sufficient rights to view this directory, or it may not exist.", $directory);
setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
}
} // end if result2
} // end if result1
} // end if / or "" or else
// -------------------------------------------------------------------------
// Step 2 - Get list of directories and files
// The -a option is used to show the hidden files as well on some FTP servers
// Some servers do not return anything when using -a, so in that case try again without the -a option
// -------------------------------------------------------------------------
$rawlist = ftp_rawlist($conn_id, "-a");
if (sizeof($rawlist) <= 1) { $rawlist = ftp_rawlist($conn_id, ""); }
// -------------------------------------------------------------------------
// Step 3 - Parse the raw list
// -------------------------------------------------------------------------
// ----------------------------------------------
// Initialize variables
// ----------------------------------------------
$list["directories"] = array();
$list["files"] = array();
$list["symlinks"] = array();
$list["unrecognized"] = array();
$directory_index = 1;
$file_index = 1;
$symlink_index = 1;
$unrecognized_index = 1;
$list["stats"]["directories"]["total_number"] = 0;
$list["stats"]["directories"]["total_size"] = 0;
$list["stats"]["directories"]["total_skipped"] = 0;
$list["stats"]["files"]["total_number"] = 0;
$list["stats"]["files"]["total_size"] = 0;
$list["stats"]["files"]["total_skipped"] = 0;
$list["stats"]["symlinks"]["total_number"] = 0;
$list["stats"]["symlinks"]["total_size"] = 0;
$list["stats"]["symlinks"]["total_skipped"] = 0;
$list["stats"]["unrecognized"]["total_number"] = 0;
$list["stats"]["unrecognized"]["total_size"] = 0;
$list["stats"]["unrecognized"]["total_skipped"] = 0;
// ----------------------------------------------
// Loop over the raw list lines
// ----------------------------------------------
$nr_entries_banned_keyword = 0;
$nr_entries_too_big = 0;
for($i=0; $i<sizeof($rawlist); $i++) {
// ----------------------------------------------
// Scan each line
// ----------------------------------------------
$listline = ftp_scanline($directory, $rawlist[$i]);
// If $listline is empty (e.g. if it contained ".."), continue to the next line
if ($listline == "") { continue; }
// Encode the name for HTML and Javascript
if (isset($listline["dirfilename"])) {
$listline["dirfilename_html"] = htmlEncode2($listline["dirfilename"]);
$listline["dirfilename_url"] = urlEncode2($listline["dirfilename"]);
$listline["dirfilename_js"] = javascriptEncode2($listline["dirfilename"]);
}
// Check if the filename contains a forbidden keyword
// If it does, then this line will not be selectable on the Browse screen
// Note: even if "selectable" is set to true here, it can still be set to false just below if the filesize is too big
if (checkAuthorizedName($listline["dirfilename"]) == true) { $listline["selectable"] = "ok"; }
else { $listline["selectable"] = "banned_keyword"; $nr_entries_banned_keyword++; }
// Check if the filesize is bigger than the maximum authorized filesize
if ($listline["dirorfile"] == "-" && isset($listline["size"]) && is_numeric($listline["size"])) {
if ($listline["selectable"] == "ok" && $listline["size"] > $net2ftp_settings["max_filesize"]) { $listline["selectable"] = "too_big"; $nr_entries_too_big++; }
}
// Form the new directory filename and encode it too
if ($listline["dirorfile"] == "d") {
$listline["newdir"] = glueDirectories($directory, $listline["dirfilename"]);
$listline["newdir_html"] = htmlEncode2($listline["newdir"]);
$listline["newdir_url"] = urlEncode2($listline["newdir"]);
$listline["newdir_js"] = javascriptEncode2($listline["newdir"]);
}
// ----------------------------------------------
// Depending on if the line contained a directory/file/symlink/unrecognized
// row, store the result in different variables
// ----------------------------------------------
if ($listline["dirorfile"] == "d") {
$list["directories"][$directory_index] = $listline;
$directory_index++;
if (isset($listline["size"]) && is_numeric($listline["size"])) {
$list["stats"]["directories"]["total_size"] = $list["stats"]["directories"]["total_size"] + $listline["size"];
}
else {
$list["stats"]["directories"]["total_skipped"] = $list["stats"]["directories"]["total_skipped"] + 1;
}
} // end if
elseif ($listline["dirorfile"] == "-") {
$list["files"][$file_index] = $listline;
$file_index++;
if (isset($listline["size"]) && is_numeric($listline["size"])) {
$list["stats"]["files"]["total_size"] = $list["stats"]["files"]["total_size"] + $listline["size"];
}
else {
$list["stats"]["files"]["total_skipped"] = $list["stats"]["files"]["total_skipped"] + 1;
}
} // end elseif
elseif ($listline["dirorfile"] == "l") {
$list["symlinks"][$symlink_index] = $listline;
$symlink_index++;
} // end elseif
elseif ($listline["dirorfile"] == "u") {
$list["unrecognized"][$unrecognized_index] = $listline;
$unrecognized_index++;
} // end elseif
} // end for
// Print a warning message if some directories, files or symlinks contain a banned keyword or if a file is
// too big to be downloaded
if ($nr_entries_banned_keyword > 0) {
$warnings .= __("Entries which contain banned keywords can't be managed using net2ftp. This is to avoid Paypal or Ebay scams from being uploaded through net2ftp.");
$warnings .= "<br />\n";
}
if ($nr_entries_too_big > 0) {
$warnings .= __("Files which are too big can't be downloaded, uploaded, copied, moved, searched, zipped, unzipped, viewed or edited; they can only be renamed, chmodded or deleted.");
$warnings .= "<br />\n";
}
// Store the warnings and new directory in $list["stats"]
if (isset($warnings) == true) { $list["stats"]["warnings"] = $warnings; }
else { $list["stats"]["warnings"] = ""; }
$list["stats"]["newdirectory"] = $directory;
// Store the statistics
$list["stats"]["directories"]["total_size_formated"] = formatFilesize($list["stats"]["directories"]["total_size"]);
$list["stats"]["files"]["total_size_formated"] = formatFilesize($list["stats"]["files"]["total_size"]);
$list["stats"]["directories"]["total_number"] = $directory_index - 1;
$list["stats"]["files"]["total_number"] = $file_index - 1;
$list["stats"]["symlinks"]["total_number"] = $symlink_index - 1;
$list["stats"]["unrecognized"]["total_number"] = $unrecognized_index - 1;
// Put everything together in $list["all"]
$list["all"] = $list["directories"] + $list["files"] + $list["symlinks"] + $list["unrecognized"];
// -------------------------------------------------------------------------
// Step 4 - Return the result
// -------------------------------------------------------------------------
return $list;
// -------------------------------------------------------------------------
// Some documentation:
// 1 - Some FTP servers return a total on the first line
// 2 - Some FTP servers return . and .. in their list of directories
// ftp_scanline does not return those entries.
// -------------------------------------------------------------------------
// 1 - After doing some tests on different public FTP servers, it appears that
// they reply differently to the ftp_rawlist request:
// - some FTP servers, like ftp.belnet.be, start with a line summarizing how
// many subdirectories and files there are in the current directory. The
// real list of subdirectories and files starts on the second line.
// [0] => total 15
// [1] => drwxr-xr-x 11 BELNET Archive 512 Feb 6 2000 BELNET
// [2] => drwxr-xr-x 2 BELNET Archive 512 Oct 29 2001 FVD-SFI
// - some other FTP servers, like ftp.redhat.com/pub, start directly with the
// list of subdirectories and files.
// [0] => drwxr-xr-x 9 ftp ftp 4096 Jan 11 06:34 contrib
// [1] => drwxr-xr-x 13 ftp ftp 4096 Jan 29 21:59 redhat
// [2] => drwxrwsr-x 6 ftp ftp 4096 Jun 05 2002 up2date
// 2 - Some FTP servers return "." and ".." as directories. These fake entries
// have to be eliminated!
// They would cause infinite loops in the copy/move/delete functions.
// [0] => drwxr-xr-x 5 80 www 512 Apr 10 09:39 .
// [1] => drwxr-xr-x 16 80 www 512 Apr 9 08:51 ..
// [2] => -rw-r--r-- 1 80 www 5647 Apr 9 08:12 _CHANGES_v0.5
// [3] => -rw-r--r-- 1 80 www 1239 Apr 9 08:12 _CREDITS_v0.5
} // End function ftp_getlist
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function ftp_scanline($directory, $rawlistline) {
// --------------
// This function scans an ftp_rawlist line string and returns its parts (directory/file, name, size,...) using preg_match()
//
// !!! Documentation about preg_match and FTP server's outputs are now at the end of the function !!!
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_settings, $net2ftp_messages;
// -------------------------------------------------------------------------
// Scanning:
// 1. first scan with strict rules
// 2. if that does not match, scan with less strict rules
// 3. if that does not match, scan with rules for specific FTP servers (AS400)
// 4. and if that does not match, return the raw line
// -------------------------------------------------------------------------
// ----------------------------------------------
// 1. Strict rules
// ----------------------------------------------
if (preg_match("/([-dl])([rwxsStT-]{9})[ ]+([0-9]+)[ ]+([^ ]+)[ ]+(.+)[ ]+([0-9]+)[ ]+([a-zA-Z]+[ ]+[0-9]+)[ ]+([0-9:]+)[ ]+(.*)/", $rawlistline, $regs) == true) {
// permissions number owner group size month day year/hour filename
$listline["scanrule"] = "rule-1";
$listline["dirorfile"] = "$regs[1]"; // Directory ==> d, File ==> -
$listline["dirfilename"] = "$regs[9]"; // Filename
$listline["size"] = "$regs[6]"; // Size
$listline["owner"] = "$regs[4]"; // Owner
$listline["group"] = trim($regs[5]); // Group
$listline["permissions"] = "$regs[2]"; // Permissions
$listline["mtime"] = "$regs[7] $regs[8]"; // Mtime -- format depends on what FTP server returns (year, month, day, hour, minutes... see above)
}
// ----------------------------------------------
// 2. Less strict rules
// ----------------------------------------------
elseif (preg_match("/([-dl])([rwxsStT-]{9})[ ]+(.*)[ ]+([a-zA-Z0-9 ]+)[ ]+([0-9:]+)[ ]+(.*)/", $rawlistline, $regs) == true) {
// permissions number/owner/group/size
// month-day year/hour filename
$listline["scanrule"] = "rule-2";
$listline["dirorfile"] = "$regs[1]"; // Directory ==> d, File ==> -
$listline["dirfilename"] = "$regs[6]"; // Filename
$listline["size"] = "$regs[3]"; // Number/Owner/Group/Size
$listline["permissions"] = "$regs[2]"; // Permissions
$listline["mtime"] = "$regs[4] $regs[5]"; // Mtime -- format depends on what FTP server returns (year, month, day, hour, minutes... see above)
}
// ----------------------------------------------
// 3. Specific FTP server rules
// ----------------------------------------------
// ---------------
// 3.1 Windows
// ---------------
elseif (preg_match("/([0-9\\/-]+)[ ]+([0-9:AMP]+)[ ]+([0-9]*|<DIR>)[ ]+(.*)/", $rawlistline, $regs) == true) {
// date time size filename
$listline["scanrule"] = "rule-3.1";
if ($regs[3] == "<DIR>") { $listline["size"] = ""; }
else { $listline["size"] = "$regs[3]"; } // Size
$listline["dirfilename"] = "$regs[4]"; // Filename
$listline["owner"] = ""; // Owner
$listline["group"] = ""; // Group
$listline["permissions"] = ""; // Permissions
$listline["mtime"] = "$regs[1] $regs[2]"; // Mtime -- format depends on what FTP server returns (year, month, day, hour, minutes... see above)
if ($listline["size"] != "") { $listline["dirorfile"] = "-"; }
else { $listline["dirorfile"] = "d"; }
}
// ---------------
// 3.2 Netware
// Thanks to Danny!
// ---------------
elseif (preg_match("/([-]|[d])[ ]+(.{10})[ ]+([^ ]+)[ ]+([0-9]*)[ ]+([a-zA-Z]*[ ]+[0-9]*)[ ]+([0-9:]*)[ ]+(.*)/", $rawlistline, $regs) == true) {
// dir/file perms owner size month day hour filename
$listline["scanrule"] = "rule-3.2";
$listline["dirorfile"] = "$regs[1]"; // Directory ==> d, File ==> -
$listline["dirfilename"] = "$regs[7]"; // Filename
$listline["size"] = "$regs[4]"; // Size
$listline["owner"] = "$regs[3]"; // Owner
$listline["group"] = ""; // Group
$listline["permissions"] = "$regs[2]"; // Permissions
$listline["mtime"] = "$regs[5] $regs6"; // Mtime -- format depends on what FTP server returns (year, month, day, hour, minutes... see above)
}
// ---------------
// 3.3 AS400
// ---------------
elseif (preg_match("/([a-zA-Z0-9_-]+)[ ]+([0-9]+)[ ]+([0-9\\/-]+)[ ]+([0-9:]+)[ ]+([a-zA-Z0-9_ -\*]+)[ \\/]+([^\\/]+)/", $rawlistline, $regs) == true) {
// owner size date time type filename
if ($regs[5] != "*STMF") { $directory_or_file = "d"; }
elseif ($regs[5] == "*STMF") { $directory_or_file = "-"; }
$listline["scanrule"] = "rule-3.3";
$listline["dirorfile"] = "$directory_or_file";// Directory ==> d, File ==> -
$listline["dirfilename"] = "$regs[6]"; // Filename
$listline["size"] = "$regs[2]"; // Size
$listline["owner"] = "$regs[1]"; // Owner
$listline["group"] = ""; // Group
$listline["permissions"] = ""; // Permissions
$listline["mtime"] = "$regs[3] $regs[4]"; // Mtime -- format depends on what FTP server returns (year, month, day, hour, minutes... see above)
}
// ---------------
// 3.4 Titan
// Owner, group are modified compared to rule 1
// TO DO: integrate this rule in rule 1 itself
// ---------------
elseif (preg_match("/([-dl])([rwxsStT-]{9})[ ]+([0-9]+)[ ]+([a-zA-Z0-9]+)[ ]+([a-zA-Z0-9]+)[ ]+([0-9]+)[ ]+([a-zA-Z]+[ ]+[0-9]+)[ ]+([0-9:]+)[ ](.*)/", $rawlistline, $regs) == true) {
// dir/file permissions number owner group size month date time file
$listline["scanrule"] = "rule-3.4";
$listline["dirorfile"] = "$regs[1]"; // Directory ==> d, File ==> -
$listline["dirfilename"] = "$regs[9]"; // Filename
$listline["size"] = "$regs[6]"; // Size
$listline["owner"] = "$regs[4]"; // Owner
$listline["group"] = "$regs[5]"; // Group
$listline["permissions"] = "$regs[2]"; // Permissions
$listline["mtime"] = "$regs[7] $regs[8]"; // Mtime -- format depends on what FTP server returns (year, month, day, hour, minutes... see above)
}
// ----------------------------------------------
// 4. If nothing matchs, return the raw line
// ----------------------------------------------
else {
$listline["scanrule"] = "rule-4";
$listline["dirorfile"] = "u";
$listline["dirfilename"] = $rawlistline;
}
// -------------------------------------------------------------------------
// Remove the . and .. entries
// Remove the total line that some servers return
// -------------------------------------------------------------------------
if ($listline["dirfilename"] == "." || $listline["dirfilename"] == "..") { return ""; }
elseif (substr($rawlistline,0,5) == "total") { return ""; }
// -------------------------------------------------------------------------
// And finally... return the nice list!
// -------------------------------------------------------------------------
return $listline;
// -------------------------------------------------------------------------
// Documentation
// -------------------------------------------------------------------------
/*
mholdgate@wakefield.co.uk
11-Jan-2002 11:51
^ Start of String
$ End of string
n* Zero or more of 'n'
n+ One or more of 'n'
n? A possible 'n'
n{2} Exactly two of 'n'
n{2,} At least 2 or more of 'n'
n{2,4} From 2 to 4 of 'n'
() Parenthesis to group expressions
(n|a) Either 'n' or 'a'
. Any single character
[1-6] A number between 1 and 6
[c-h] A lower case character between c and h
[D-M] An upper case character between D and M
[^a-z] Absence of lower case a to z
[_a-zA-Z] An underscore or any letter of the alphabet
^.{2}[a-z]{1,2}_?[0-9]*([1-6]|[a-f])[^1-9]{2}a+$
A string beginning with any two characters
Followed by either 1 or 2 lower case alphabet letters
Followed by an optional underscore
Followed by zero or more digits
Followed by either a number between 1 and 6 or a character between a and f (Lowercase)
Followed by a two characters which are not digits between 1 and 9
Followed by one or more n characters at the end of a string
// $regs can contain a maximum of 10 elements !! (regs[0] to regs[9])
// To specify what you really want back from ereg, use (). Only what is within () will be returned. See below.
*/
// ----------------------------------------------
// Sample FTP server's output
// ----------------------------------------------
// ---------------
// 1. "Standard" FTP servers output
// ---------------
// ftp.redhat.com
//drwxr-xr-x 6 0 0 4096 Aug 21 2001 pub (one or more spaces between entries)
//
// ftp.suse.com
//drwxr-xr-x 2 root root 4096 Jan 9 2001 bin
//-rw-r--r-- 1 suse susewww 664 May 23 16:24 README.txt
//
// ftp.belnet.be
//-rw-r--r-- 1 BELNET Mirror 162 Aug 6 2000 HEADER.html
//drwxr-xr-x 53 BELNET Archive 2048 Nov 13 12:03 mirror
//
// ftp.microsoft.com
//-r-xr-xr-x 1 owner group 0 Nov 27 2000 dirmap.htm
//
// ftp.sourceforge.net
//-rw-r--r-- 1 root staff 29136068 Apr 21 22:07 ls-lR.gz
//
// ftp.nec.com
//dr-xr-xr-x 12 other 512 Apr 3 2002 pub
//
// ftp.intel.com
//drwxr-sr-x 11 root ftp 4096 Sep 23 16:36 pub
// ---------------
// 3.1 Windows
// ---------------
//06-10-04 07:56PM 8175 garantie.html
//04-09-04 04:27PM <DIR> images
//05-25-04 09:18AM 9505 index.html
// ---------------
// 3.2 Netware
// ---------------
// total 0
// - [RWCEAFMS] USER 12 Mar 08 10:48 check.txt
// d [RWCEAFMS] USER 512 Mar 18 17:55 latest
// ---------------
// 3.3 AS400
// ---------------
// RGOVINDAN 932 03/29/01 14:59:53 *STMF /cert.txt
// QSYS 77824 12/17/01 15:33:14 *DIR /QOpenSys/
// QDOC 24576 12/31/69 20:00:00 *FLR /QDLS/
// QSYS 12832768 04/14/03 16:47:25 *LIB /QSYS.LIB/
// QDFTOWN 2147483647 12/31/69 20:00:00 *DDIR /QOPT/
// QSYS 2144 04/12/03 12:49:00 *DDIR /QFileSvr.400/
// QDFTOWN 1136 04/12/03 12:49:01 *DDIR /QNTC/
// ---------------
// 3.4 Titan FTP server
// ---------------
// total 6
// drwxrwx--- 1 owner group 512 Apr 19 11:44 .
// drwxrwx--- 1 owner group 512 Apr 19 11:44 ..
// -rw-rw---- 1 owner group 13171 Apr 15 13:50 default.asp
// drwxrwx--- 1 owner group 512 Apr 19 11:44 forum
// drwxrwx--- 1 owner group 512 Apr 15 13:32 images
// -rw-rw---- 1 owner group 764 Apr 15 11:07 styles.css
} // End function ftp_scanline
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function ftp2http($directory, $list_files, $htmltags) {
// --------------
// This function calculates the HTTP URL based on the FTP URL
//
// Given the FTP server (ftp.name.com),
// the directory and file (/directory/file.php)
// It has to return
// http://www.name.com/directory/file.php
//
// $htmltags indicates whether the url should be returned enclosed in HTML tags or not
//
// For efficiency reasons, this function processes a list of files
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_globals;
// -------------------------------------------------------------------------
// If no list is supplied, return ""
// -------------------------------------------------------------------------
if (sizeof($list_files) == 0) { return ""; }
// -------------------------------------------------------------------------
// Prepare the variables
// -------------------------------------------------------------------------
// Directory
if ($directory == "/") { $directory = ""; }
// Convert single quotes from ' to &#039;
if ($htmltags == "no") { $directory = javascriptEncode2($directory); }
else { $directory = urlEncode2($directory); }
// Filenames
if ($htmltags == "no") { $encoding = "dirfilename_js"; }
else { $encoding = "dirfilename_url"; }
// Username
if ($htmltags == "no") { $username = javascriptEncode2($net2ftp_globals["username"]); }
else { $username = htmlEncode2($net2ftp_globals["username"]); }
// -------------------------------------------------------------------------
// "ftp.t35.com" -----> "http://username" (username = username.t35.com)
// "ftp.t35.net" -----> "http://username" (username = username.t35.net)
// -------------------------------------------------------------------------
if (strpos($net2ftp_globals["ftpserver"], "ftp.t35") !== false) {
for ($i=1; $i<=sizeof($list_files); $i++) {
$URL = "http://" . $username . $directory . "/" . $list_files[$i][$encoding];
if ($htmltags == "no") { $list_links[$i] = $URL; }
else { $list_links[$i] = "<a href=\"" . $URL . "\" target=\"_blank\" title=\"" . __("Execute %1\$s in a new window", $list_files[$i][$encoding]) . "\">" . $list_files[$i][$encoding] . "</a>"; }
} // end for
}
// -------------------------------------------------------------------------
// "ftp-www.earthlink.net/webdocs/directory" -----> "http://home.earthlink.net/~username/directory"
// -------------------------------------------------------------------------
elseif (strpos($net2ftp_globals["ftpserver"], "ftp-www.earthlink.net") !== false) {
if (strlen($directory) < 8) {
for ($i=1; $i<=sizeof($list_files); $i++) {
if ($htmltags == "no") { $list_links[$i] = "javascript:alert('" . __("This file is not accessible from the web") . "');"; }
else { $list_links[$i] = "<a title=\"" . __("This file is not accessible from the web") . "\" onclick=\"alert('" . __("This file is not accessible from the web") . "');\">" . $list_files[$i][$encoding] . "</a>"; }
} // end for
}
else {
// Transform directory from /webdocs/dir to /dir --> remove the first 4 characters
$directory = substr($directory, 8);
for ($i=1; $i<=sizeof($list_files); $i++) {
$URL = "http://home.earthlink.net/~" . $username . $directory . "/" . $list_files[$i][$encoding];
if ($htmltags == "no") { $list_links[$i] = $URL; }
else { $list_links[$i] = "<a href=\"" . $URL . "\" target=\"_blank\" title=\"" . __("Execute %1\$s in a new window", $list_files[$i][$encoding]) . "\">" . $list_files[$i][$encoding] . "</a>"; }
} // end for
} // end if else strlen
}
// -------------------------------------------------------------------------
// "ftpperso.free.fr" -----> "http://username.free.fr"
// -------------------------------------------------------------------------
elseif (strpos($net2ftp_globals["ftpserver"], "ftpperso.free.fr") !== false) {
for ($i=1; $i<=sizeof($list_files); $i++) {
$URL = "http://" . $username . ".free.fr" . $directory . "/" . $list_files[$i][$encoding];
if ($htmltags == "no") { $list_links[$i] = $URL; }
else { $list_links[$i] = "<a href=\"" . $URL . "\" target=\"_blank\" title=\"" . __("Execute %1\$s in a new window", $list_files[$i][$encoding]) . "\">" . $list_files[$i][$encoding] . "</a>"; }
} // end for
}
// -------------------------------------------------------------------------
// "ftp.membres.lycos.fr" -----> "http://membres.lycos.fr/username"
// -------------------------------------------------------------------------
elseif (strpos($net2ftp_globals["ftpserver"],"ftp.membres.lycos.fr") !== false) {
for ($i=1; $i<=sizeof($list_files); $i++) {
$URL = "http://membres.lycos.fr/" . $username . $directory . "/" . $list_files[$i][$encoding];
if ($htmltags == "no") { $list_links[$i] = $URL; }
else { $list_links[$i] = "<a href=\"" . $URL . "\" target=\"_blank\" title=\"" . __("Execute %1\$s in a new window", $list_files[$i][$encoding]) . "\">" . $list_files[$i][$encoding] . "</a>"; }
} // end for
}
// -------------------------------------------------------------------------
// "home.planetinternet.be" -----> "http://home.planetinternet.be/~username"
// -------------------------------------------------------------------------
elseif (strpos($net2ftp_globals["ftpserver"], "home.planetinternet.be") !== false) {
for ($i=1; $i<=sizeof($list_files); $i++) {
$URL = "http://home.planetinternet.be/~" . $username . $directory . "/" . $list_files[$i][$encoding];
if ($htmltags == "no") { $list_links[$i] = $URL; }
else { $list_links[$i] = "<a href=\"" . $URL . "\" target=\"_blank\" title=\"" . __("Execute %1\$s in a new window", $list_files[$i][$encoding]) . "\">" . $list_files[$i][$encoding] . "</a>"; }
} // end for
}
// -------------------------------------------------------------------------
// "home.planet.nl" -----> "http://home.planet.nl/~username"
// -------------------------------------------------------------------------
elseif (strpos($net2ftp_globals["ftpserver"], "home.planet.nl") !== false) {
for ($i=1; $i<=sizeof($list_files); $i++) {
$URL = "http://home.planet.nl/~" . $username . $directory . "/" . $list_files[$i][$encoding];
if ($htmltags == "no") { $list_links[$i] = $URL; }
else { $list_links[$i] = "<a href=\"" . $URL . "\" target=\"_blank\" title=\"" . __("Execute %1\$s in a new window", $list_files[$i][$encoding]) . "\">" . $list_files[$i][$encoding] . "</a>"; }
} // end for
}
// -------------------------------------------------------------------------
// "users.skynet.be" -----> "http://users.skynet.be/username"
// -------------------------------------------------------------------------
elseif (strpos($net2ftp_globals["ftpserver"], "users.skynet.be") !== false) {
for ($i=1; $i<=sizeof($list_files); $i++) {
$URL = "http://users.skynet.be/" . $username . $directory . "/" . $list_files[$i][$encoding];
if ($htmltags == "no") { $list_links[$i] = $URL; }
else { $list_links[$i] = "<a href=\"" . $URL . "\" target=\"_blank\" title=\"" . __("Execute %1\$s in a new window", $list_files[$i][$encoding]) . "\">" . $list_files[$i][$encoding] . "</a>"; }
} // end for
}
// -------------------------------------------------------------------------
// "ftp.tripod.com" -----> "http://username.tripod.com"
// -------------------------------------------------------------------------
elseif (strpos($net2ftp_globals["ftpserver"], "ftp.tripod.com") !== false) {
for ($i=1; $i<=sizeof($list_files); $i++) {
$URL = "http://" . $username . ".tripod.com" . $directory . "/" . $list_files[$i][$encoding];
if ($htmltags == "no") { $list_links[$i] = $URL; }
else { $list_links[$i] = "<a href=\"" . $URL . "\" target=\"_blank\" title=\"" . __("Execute %1\$s in a new window", $list_files[$i][$encoding]) . "\">" . $list_files[$i][$encoding] . "</a>"; }
} // end for
}
// -------------------------------------------------------------------------
// "ftp.wanadoo.es" -----> "http://perso.wanadoo.es/username"
// -------------------------------------------------------------------------
elseif (strpos($net2ftp_globals["ftpserver"], "ftp.wanadoo.es") !== false) {
for ($i=1; $i<=sizeof($list_files); $i++) {
$URL = "http://perso.wanadoo.es/" . $username . $directory . "/" . $list_files[$i][$encoding];
if ($htmltags == "no") { $list_links[$i] = $URL; }
else { $list_links[$i] = "<a href=\"" . $URL . "\" target=\"_blank\" title=\"" . __("Execute %1\$s in a new window", $list_files[$i][$encoding]) . "\">" . $list_files[$i][$encoding] . "</a>"; }
} // end for
}
// -------------------------------------------------------------------------
// "perso-ftp.wanadoo.fr" -----> "http://perso.wanadoo.fr/username"
// -------------------------------------------------------------------------
elseif (strpos($net2ftp_globals["ftpserver"], "perso-ftp.wanadoo.fr") !== false) {
for ($i=1; $i<=sizeof($list_files); $i++) {
$URL = "http://perso.wanadoo.fr/" . $username . $directory . "/" . $list_files[$i][$encoding];
if ($htmltags == "no") { $list_links[$i] = $URL; }
else { $list_links[$i] = "<a href=\"" . $URL . "\" target=\"_blank\" title=\"" . __("Execute %1\$s in a new window", $list_files[$i][$encoding]) . "\">" . $list_files[$i][$encoding] . "</a>"; }
} // end for
}
// -------------------------------------------------------------------------
// "home.wanadoo.nl" -----> "http://home.wanadoo.nl/username"
// -------------------------------------------------------------------------
elseif (strpos($net2ftp_globals["ftpserver"], "home.wanadoo.nl") !== false) {
for ($i=1; $i<=sizeof($list_files); $i++) {
$URL = "http://home.wanadoo.nl/" . $username . $directory . "/" . $list_files[$i][$encoding];
if ($htmltags == "no") { $list_links[$i] = $URL; }
else { $list_links[$i] = "<a href=\"" . $URL . "\" target=\"_blank\" title=\"" . __("Execute %1\$s in a new window", $list_files[$i][$encoding]) . "\">" . $list_files[$i][$encoding] . "</a>"; }
} // end for
}
// -------------------------------------------------------------------------
// wanadoo uk
// "uploads.webspace.freeserve.net" -----> "http://www.username.freeserve.co.uk"
// -------------------------------------------------------------------------
elseif (strpos($net2ftp_globals["ftpserver"], "uploads.webspace.freeserve.net") !== false) {
for ($i=1; $i<=sizeof($list_files); $i++) {
$URL = "http://www." . $username . ".freeserve.co.uk" . $directory . "/" . $list_files[$i][$encoding];
if ($htmltags == "no") { $list_links[$i] = $URL; }
else { $list_links[$i] = "<a href=\"" . $URL . "\" target=\"_blank\" title=\"" . __("Execute %1\$s in a new window", $list_files[$i][$encoding]) . "\">" . $list_files[$i][$encoding] . "</a>"; }
} // end for
}
// -------------------------------------------------------------------------
// "ftp.xs4all.nl/WWW/directory" -----> "http://www.xs4all.nl/~username/directory"
// -------------------------------------------------------------------------
elseif (strpos($net2ftp_globals["ftpserver"], "ftp.xs4all.nl") !== false) {
if (strlen($directory) < 4) {
for ($i=1; $i<=sizeof($list_files); $i++) {
if ($htmltags == "no") { $list_links[$i] = "javascript:alert('" . __("This file is not accessible from the web") . "');"; }
else { $list_links[$i] = "<a title=\"" . __("This file is not accessible from the web") . "\" onclick=\"alert('" . __("This file is not accessible from the web") . "');\">" . $list_files[$i][$encoding] . "</a>"; }
} // end for
}
else {
// Transform directory from /WWW/dir to /dir --> remove the first 4 characters
$directory = substr($directory, 4);
for ($i=1; $i<=sizeof($list_files); $i++) {
$URL = "http://www.xs4all.nl/~" . $username . $directory . "/" . $list_files[$i][$encoding];
if ($htmltags == "no") { $list_links[$i] = $URL; }
else { $list_links[$i] = "<a href=\"" . $URL . "\" target=\"_blank\" title=\"" . __("Execute %1\$s in a new window", $list_files[$i][$encoding]) . "\">" . $list_files[$i][$encoding] . "</a>"; }
} // end for
}
}
// -------------------------------------------------------------------------
// "ftp.server.com/directory/file" -----> "http://www.server.com/directory/file"
// -------------------------------------------------------------------------
elseif (preg_match("/ftp.(.+)(.{2,4})/", $net2ftp_globals["ftpserver"], $regs)) {
// Check if the FTP directory contains "htdocs", "httpdocs" or "public_html"
// If it does, the HTTP directory root starts from there on
// Example: /srv/www/htdocs/directory1 ==> /directory1
$specialdirectories[1] = "htdocs";
$specialdirectories[2] = "httpdocs";
$specialdirectories[3] = "public_html";
for ($i=1; $i<=sizeof($specialdirectories); $i++) {
$pos = strpos($directory, $specialdirectories[$i]);
if ($pos !== false) {
$directory = substr($directory, $pos + strlen($specialdirectories[$i]));
break;
}
}
// Calculate all the URLs on the Browse screen
for ($i=1; $i<=sizeof($list_files); $i++) {
$URL = "http://www." . $regs[1] . $regs[2] . $directory . "/" . $list_files[$i][$encoding];
if ($htmltags == "no") { $list_links[$i] = $URL; }
else { $list_links[$i] = "<a href=\"" . $URL . "\" target=\"_blank\" title=\"" . __("Execute %1\$s in a new window", $list_files[$i][$encoding]) . "\">" . $list_files[$i][$encoding] . "</a>"; }
} // end for
}
// -------------------------------------------------------------------------
// "http://192.168.0.1/directory/file" can be determined using "192.168.0.1/directory/file":
// -------------------------------------------------------------------------
else {
// Check if the FTP directory contains "htdocs", "httpdocs" or "public_html"
// If it does, the HTTP directory root starts from there on
// Example: /srv/www/htdocs/directory1 ==> /directory1
$specialdirectories[1] = "htdocs";
$specialdirectories[2] = "httpdocs";
$specialdirectories[3] = "public_html";
for ($i=1; $i<=sizeof($specialdirectories); $i++) {
$pos = strpos($directory, $specialdirectories[$i]);
if ($pos !== false) {
$directory = substr($directory, $pos + strlen($specialdirectories[$i]));
break;
}
}
// Calculate all the URLs on the Browse screen
for ($i=1; $i<=sizeof($list_files); $i++) {
$URL = "http://" . $net2ftp_globals["ftpserver"]. $directory . "/" . $list_files[$i][$encoding];
if ($htmltags == "no") { $list_links[$i] = $URL; }
else { $list_links[$i] = "<a href=\"" . $URL . "\" target=\"_blank\" title=\"" . __("Execute %1\$s in a new window", $list_files[$i][$encoding]) . "\">" . $list_files[$i][$encoding] . "</a>"; }
} // end for
}
return $list_links;
} // end function ftp2http
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
?>

View file

@ -1,529 +0,0 @@
<?php
// -------------------------------------------------------------------------------
// | net2ftp: a web based FTP client |
// | Copyright (c) 2003-2013 by David Gartner |
// | |
// | 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. |
// | |
// -------------------------------------------------------------------------------
/*
The consumption of server and network resources is logged per client IP
address, and per target FTP server. The 2 database tables which contain
the logs are:
net2ftp_log_consumption_ipaddress: date, ipaddress, datatransfer, executiontime
net2ftp_log_consumption_ftpserver: date, ftpserver, datatransfer, executiontime
The database is read at the beginning of the script, and updated at the end
of the script. There are 6 global variables:
These variables
$consumption_ipaddress_datatransfer,
$consumption_ipaddress_executiontime,
$consumption_ftpserver_datatransfer,
$consumption_ftpserver_executiontime;
contain the data transfer volume, script execution time and number of FTP
servers that were accessed. They are inititialized at the beginning of the
script and updated each time data is read/written from/to the FTP server.
The variable
$consumption_datatransfer_changeflag;
is initialized as 0 and changed to 1 if data was transferred.
This is to avoid having to run an SQL query if no data was transferred, e.g. when
logging in, browsing the FTP server, when confirming an action or even for some
actions like delete or chmod.
The variable
$consumption_database_updated;
is initialized as 0 and changed to 1 when the database is updated with the consumption
in putConsumption(). This is to avoid updating the database twice. The putConsumption()
function is called from index.php and from shutdown() in filesystem.inc.php. On Windows
the shutdown() function is called after *every* script execution.
*/
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function getConsumption() {
// --------------
// This function reads the consumption from the database.
// It is run at the beginning of the script.
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_globals, $net2ftp_settings, $net2ftp_result;
// -------------------------------------------------------------------------
// Initial checks
// -------------------------------------------------------------------------
// Verify if a database is used, and if consumption checking is turned on. If not: don't continue.
if ($net2ftp_settings["use_database"] != "yes" || $net2ftp_settings["check_consumption"] != "yes") { return true; }
// When user is not logged in, the FTP server is not set
if ($net2ftp_globals["ftpserver"] == "") { return true; }
// If the REMOTE_ADDR is not filled in, then there is a problem (IP spoofing), so return an error
if ($net2ftp_globals["REMOTE_ADDR"] == "") {
setErrorVars(false, __("Unable to determine your IP address."), debug_backtrace(), __FILE__, __LINE__);
return false;
}
// Add slashes to variables which are used in a SQL query, and which are
// potentially unsafe (supplied by the user).
// $date is calculated in this function
// $time is calculated in this function
$REMOTE_ADDR_safe = addslashes($net2ftp_globals["REMOTE_ADDR"]);
$net2ftp_ftpserver_safe = addslashes($net2ftp_globals["ftpserver"]);
// ----------------------------------------------
// Do not log accesses, errors and consumption while the logs are being rotated
// ----------------------------------------------
$logStatus = getLogStatus();
if ($net2ftp_result["success"] == false) { return false; }
if ($logStatus != 0) { return true; }
// -------------------------------------------------------------------------
// Set the change flags to the initial value
// -------------------------------------------------------------------------
$net2ftp_globals["consumption_datatransfer_changeflag"] = 0;
$net2ftp_globals["consumption_database_updated"] = 0;
// -------------------------------------------------------------------------
// Get date
// -------------------------------------------------------------------------
$date = date("Y-m-d");
// -------------------------------------------------------------------------
// Connect
// -------------------------------------------------------------------------
$mydb = connect2db();
if ($net2ftp_result["success"] == false) { return false; }
// -------------------------------------------------------------------------
// Get consumed data volume and execution time by the current IP address
// -------------------------------------------------------------------------
$sqlquery1 = "SELECT datatransfer, executiontime FROM net2ftp_log_consumption_ipaddress WHERE date = '$date' AND ipaddress = '$REMOTE_ADDR_safe';";
$result1 = mysql_query("$sqlquery1") or die("Unable to execute SQL SELECT query (getConsumption > sqlquery1) <br /> $sqlquery1");
$nrofrows1 = mysql_num_rows($result1);
if ($nrofrows1 == 0) {
$net2ftp_globals["consumption_ipaddress_datatransfer"] = 0;
$net2ftp_globals["consumption_ipaddress_executiontime"] = 0;
}
elseif ($nrofrows1 == 1) {
$resultRow1 = mysql_fetch_row($result1);
$net2ftp_globals["consumption_ipaddress_datatransfer"] = $resultRow1[0];
$net2ftp_globals["consumption_ipaddress_executiontime"] = $resultRow1[1];
}
else {
setErrorVars(false, __("Table net2ftp_log_consumption_ipaddress contains duplicate rows."), debug_backtrace(), __FILE__, __LINE__);
return false;
}
// -------------------------------------------------------------------------
// Get consumed data volume and execution time to the current FTP server
// -------------------------------------------------------------------------
$sqlquery2 = "SELECT datatransfer, executiontime FROM net2ftp_log_consumption_ftpserver WHERE date = '$date' AND ftpserver = '$net2ftp_ftpserver_safe';";
$result2 = mysql_query("$sqlquery2") or die("Unable to execute SQL SELECT query (getConsumption > sqlquery2) <br /> $sqlquery2");
$nrofrows2 = mysql_num_rows($result2);
if ($nrofrows2 == 0) {
$net2ftp_globals["consumption_ftpserver_datatransfer"] = 0;
$net2ftp_globals["consumption_ftpserver_executiontime"] = 0;
}
elseif ($nrofrows2 == 1) {
$resultRow2 = mysql_fetch_row($result2);
$net2ftp_globals["consumption_ftpserver_datatransfer"] = $resultRow2[0];
$net2ftp_globals["consumption_ftpserver_executiontime"] = $resultRow2[1];
}
else {
setErrorVars(false, __("Table net2ftp_log_consumption_ftpserver contains duplicate rows."), debug_backtrace(), __FILE__, __LINE__);
return false;
}
// Return true
return true;
} // End getConsumption
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function putConsumption() {
// --------------
// This function writes the consumption to the database.
// It is run at the end of the script.
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_globals, $net2ftp_settings, $net2ftp_result;
// -------------------------------------------------------------------------
// Initial checks
// -------------------------------------------------------------------------
// Verify if a database is used, and if consumption checking is turned on. If not: don't continue.
if ($net2ftp_settings["use_database"] != "yes" || $net2ftp_settings["check_consumption"] != "yes") { return true; }
// When user is not logged in, the FTP server is not set
if ($net2ftp_globals["ftpserver"] == "") { return true; }
// If the REMOTE_ADDR is not filled in, then there is a problem (IP spoofing), so return an error
if ($net2ftp_globals["REMOTE_ADDR"] == "") {
setErrorVars(false, __("Unable to determine your IP address."), debug_backtrace(), __FILE__, __LINE__);
return false;
}
// If the database has already been updated, don't do it a second time.
// This is to avoid updating the database twice. The putConsumption() function
// is called from index.php and from shutdown() in filesystem.inc.php. On Windows
// the shutdown() function is called after *every* script execution.
if ($net2ftp_globals["consumption_database_updated"] == 1) { return true; }
// Add slashes to variables which are used in a SQL query, and which are
// potentially unsafe (supplied by the user).
// $date is calculated in this function
// $time is calculated in this function
$REMOTE_ADDR_safe = addslashes($net2ftp_globals["REMOTE_ADDR"]);
$net2ftp_ftpserver_safe = addslashes($net2ftp_globals["ftpserver"]);
// ----------------------------------------------
// Do not log accesses, errors and consumption while the logs are being rotated
// ----------------------------------------------
$logStatus = getLogStatus();
if ($net2ftp_result["success"] == false) { return false; }
if ($logStatus != 0) { return true; }
// -------------------------------------------------------------------------
// Check the input
// -------------------------------------------------------------------------
// if (preg_match("/^[0-9]+$/", $net2ftp_globals["consumption_ipaddress_datatransfer) == FALSE) {
// setErrorVars(false, __("The variable <b>consumption_ipaddress_datatransfer</b> is not numeric."), debug_backtrace(), __FILE__, __LINE__);
// return false;
// }
// -------------------------------------------------------------------------
// Connect
// -------------------------------------------------------------------------
$mydb = connect2db();
if ($net2ftp_result["success"] == false) { return false; }
// -------------------------------------------------------------------------
// Get date
// -------------------------------------------------------------------------
$date = date("Y-m-d");
// -------------------------------------------------------------------------
// Put consumed data volume and execution time by the current IP address
// -------------------------------------------------------------------------
$sqlquery1 = "SELECT * FROM net2ftp_log_consumption_ipaddress WHERE date = '$date' AND ipaddress = '$REMOTE_ADDR_safe';";
$result1 = mysql_query("$sqlquery1");
$nrofrows1 = mysql_num_rows($result1);
if ($nrofrows1 == 1) {
$sqlquery2 = "UPDATE net2ftp_log_consumption_ipaddress SET datatransfer = '" . $net2ftp_globals["consumption_ipaddress_datatransfer"] . "', executiontime = '" . round($net2ftp_globals["consumption_ipaddress_executiontime"]) . "' WHERE date = '$date' AND ipaddress = '$REMOTE_ADDR_safe';";
$result2 = mysql_query("$sqlquery2");
$nrofrows2 = mysql_affected_rows($mydb);
// Don't check on the UPDATE nr of rows, because when the values in the variables and in the table are the same,
// the $nrofrows2 is set to 0. (This happens on the Browse screen, when the loading is fast: the datatransfer is 0
// and the executiontime is the same as in the table.)
// if ($nrofrows2 != 1) {
// setErrorVars(false, __("Table net2ftp_log_consumption_ipaddress could not be updated."), debug_backtrace(), __FILE__, __LINE__);
// return false;
// }
}
elseif ($nrofrows1 == 0) {
$sqlquery3 = "INSERT INTO net2ftp_log_consumption_ipaddress VALUES('$date', '$REMOTE_ADDR_safe', '" . $net2ftp_globals["consumption_ipaddress_datatransfer"] . "', '" . round($net2ftp_globals["consumption_ipaddress_executiontime"]) . "');";
$result3 = mysql_query("$sqlquery3");
$nrofrows3 = mysql_affected_rows($mydb);
if ($nrofrows3 != 1) {
setErrorVars(false, __("Table net2ftp_log_consumption_ipaddress could not be updated."), debug_backtrace(), __FILE__, __LINE__);
return false;
}
}
else {
setErrorVars(false, __("Table net2ftp_log_consumption_ipaddress contains duplicate entries."), debug_backtrace(), __FILE__, __LINE__);
return false;
}
// MySQL > 4.1.0
// $sqlquery1 = "INSERT INTO net2ftp_log_consumption_ipaddress VALUES('$date', '$REMOTE_ADDR_safe', '" . $net2ftp_globals["consumption_ipaddress_datatransfer"] . "', '" . round($net2ftp_globals["consumption_ipaddress_executiontime"]) . "') ON DUPLICATE KEY UPDATE datatransfer = '" . $net2ftp_globals["consumption_ipaddress_datatransfer"] . "', executiontime = '" . round($net2ftp_globals["consumption_ipaddress_executiontime"]) . "';";
// -------------------------------------------------------------------------
// Put consumed data volume and execution time to the current FTP server
// -------------------------------------------------------------------------
$sqlquery4 = "SELECT * FROM net2ftp_log_consumption_ftpserver WHERE date = '$date' AND ftpserver = '$net2ftp_ftpserver_safe';";
$result4 = mysql_query("$sqlquery4");
$nrofrows4 = mysql_num_rows($result4);
if ($nrofrows4 == 1) {
$sqlquery5 = "UPDATE net2ftp_log_consumption_ftpserver SET datatransfer = '" . $net2ftp_globals["consumption_ftpserver_datatransfer"] . "', executiontime = '" . round($net2ftp_globals["consumption_ftpserver_executiontime"]) . "' WHERE date = '$date' AND ftpserver = '$net2ftp_ftpserver_safe';";
$result5 = mysql_query("$sqlquery5");
$nrofrows5 = mysql_affected_rows($mydb);
// Don't check on the UPDATE nr of rows, because when the values in the variables and in the table are the same,
// the $nrofrows2 is set to 0. (This happens on the Browse screen, when the loading is fast: the datatransfer is 0
// and the executiontime is the same as in the table.)
// if ($nrofrows5 != 1) {
// setErrorVars(false, __("Table net2ftp_log_consumption_ftpserver could not be updated."), debug_backtrace(), __FILE__, __LINE__);
// return false;
// }
}
elseif ($nrofrows4 == 0) {
$sqlquery6 = "INSERT INTO net2ftp_log_consumption_ftpserver VALUES('$date', '$net2ftp_ftpserver_safe', '" . $net2ftp_globals["consumption_ftpserver_datatransfer"] . "', '" . round($net2ftp_globals["consumption_ftpserver_executiontime"]) . "');";
$result6 = mysql_query("$sqlquery6");
$nrofrows6 = mysql_affected_rows($mydb);
if ($nrofrows6 != 1) {
setErrorVars(false, __("Table net2ftp_log_consumption_ftpserver could not be updated."), debug_backtrace(), __FILE__, __LINE__);
return false;
}
}
else {
setErrorVars(false, __("Table net2ftp_log_consumption_ftpserver contains duplicate entries."), debug_backtrace(), __FILE__, __LINE__);
return false;
}
// -------------------------------------------------------------------------
// Update the net2ftp_log_access record with the consumed data volume and execution time
// -------------------------------------------------------------------------
$sqlquery7 = "SELECT * FROM net2ftp_log_access WHERE id = '" . $net2ftp_globals["log_access_id"] . "';";
$result7 = mysql_query("$sqlquery7");
$nrofrows7 = mysql_num_rows($result7);
if ($nrofrows7 == 1) {
$sqlquery8 = "UPDATE net2ftp_log_access SET datatransfer = '" . $net2ftp_globals["consumption_datatransfer"] . "', executiontime = '" . round($net2ftp_globals["consumption_executiontime"]) . "' WHERE id = '" . $net2ftp_globals["log_access_id"] . "'";
$result8 = mysql_query("$sqlquery8");
$nrofrows8 = mysql_affected_rows($mydb);
// Don't check on the UPDATE nr of rows, because when the values in the variables and in the table are the same,
// the $nrofrows2 is set to 0. (This happens on the Browse screen, when the loading is fast: the datatransfer is 0
// and the executiontime is the same as in the table.)
// if ($nrofrows8 != 1) {
// setErrorVars(false, __("Table net2ftp_log_access could not be updated."), debug_backtrace(), __FILE__, __LINE__);
// return false;
// }
}
elseif ($nrofrows7 == 0) {
$sqlquery9 = "INSERT INTO net2ftp_log_access VALUES('$date', '$REMOTE_ADDR_safe', '" . $net2ftp_globals["consumption_ipaddress_datatransfer"] . "', '" . round($net2ftp_globals["consumption_ipaddress_executiontime"]) . "');";
$result9 = mysql_query("$sqlquery9");
$nrofrows9 = mysql_affected_rows($mydb);
if ($nrofrows9 != 1) {
setErrorVars(false, __("Table net2ftp_log_access could not be updated."), debug_backtrace(), __FILE__, __LINE__);
return false;
}
}
else {
setErrorVars(false, __("Table net2ftp_log_access contains duplicate entries."), debug_backtrace(), __FILE__, __LINE__);
return false;
}
// -------------------------------------------------------------------------
// If all 3 tables have been updated, set the flag to 1
// -------------------------------------------------------------------------
$net2ftp_globals["consumption_database_updated"] = 1;
// Return true
return true;
} // End putConsumption
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function addConsumption($data, $time) {
// --------------
// This function adds the $data and $time given in the argument of the function
// to the global variables
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_globals, $net2ftp_settings, $net2ftp_result;
// -------------------------------------------------------------------------
// Initial checks
// -------------------------------------------------------------------------
// Verify if a database is used, and if consumption checking is turned on. If not: don't continue.
if ($net2ftp_settings["use_database"] != "yes" || $net2ftp_settings["check_consumption"] != "yes") { return true; }
// Initialize variables if needed
if (isset($net2ftp_globals["consumption_datatransfer"]) == false) { $net2ftp_globals["consumption_datatransfer"] = 0; }
if (isset($net2ftp_globals["consumption_executiontime"]) == false) { $net2ftp_globals["consumption_executiontime"] = 0; }
if (isset($net2ftp_globals["consumption_ipaddress_datatransfer"]) == false) { $net2ftp_globals["consumption_ipaddress_datatransfer"] = 0; }
if (isset($net2ftp_globals["consumption_ipaddress_executiontime"]) == false) { $net2ftp_globals["consumption_ipaddress_executiontime"] = 0; }
if (isset($net2ftp_globals["consumption_ftpserver_datatransfer"]) == false) { $net2ftp_globals["consumption_ftpserver_datatransfer"] = 0; }
if (isset($net2ftp_globals["consumption_ftpserver_executiontime"]) == false) { $net2ftp_globals["consumption_ftpserver_executiontime"] = 0; }
// -------------------------------------------------------------------------
// Add the consumption to the global variables
// -------------------------------------------------------------------------
if ($data != "" && $data > 0) {
$net2ftp_globals["consumption_datatransfer_changeflag"] = 1;
$net2ftp_globals["consumption_datatransfer"] = $net2ftp_globals["consumption_datatransfer"] + $data;
$net2ftp_globals["consumption_ipaddress_datatransfer"] = $net2ftp_globals["consumption_ipaddress_datatransfer"] + $data;
$net2ftp_globals["consumption_ftpserver_datatransfer"] = $net2ftp_globals["consumption_ftpserver_datatransfer"] + $data;
}
if ($time != "" && $time > 0) {
$net2ftp_globals["consumption_executiontime"] = $net2ftp_globals["consumption_executiontime"] + $time;
$net2ftp_globals["consumption_ipaddress_executiontime"] = $net2ftp_globals["consumption_ipaddress_executiontime"] + $time;
$net2ftp_globals["consumption_ftpserver_executiontime"] = $net2ftp_globals["consumption_ftpserver_executiontime"] + $time;
}
// Return true
return true;
} // End addConsumption
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function printConsumption() {
// --------------
// This function prints the global consumption variables.
// It is only used for debugging.
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_globals, $net2ftp_settings, $net2ftp_result;
// -------------------------------------------------------------------------
// Print the variables
// -------------------------------------------------------------------------
echo "FTP server: " . $net2ftp_globals["ftpserver"] . "<br />\n";
echo "Remote address: " . $net2ftp_globals["REMOTE_ADDR"] . "<br />\n";
echo "consumption_datatransfer: " . $net2ftp_globals["consumption_datatransfer"] . "<br />\n";
echo "consumption_executiontime: " . $net2ftp_globals["consumption_executiontime"] . "<br />\n";
echo "consumption_ipaddress_datatransfer: " . $net2ftp_globals["consumption_ipaddress_datatransfer"] . "<br />\n";
echo "consumption_ipaddress_executiontime: " . $net2ftp_globals["consumption_ipaddress_executiontime"] . "<br />\n";
echo "consumption_ftpserver_datatransfer: " . $net2ftp_globals["consumption_ftpserver_datatransfer"] . "<br />\n";
echo "consumption_ftpserver_executiontime: " . $net2ftp_globals["consumption_ftpserver_executiontime"] . "<br />\n";
echo "consumption_datatransfer_changeflag: " . $net2ftp_globals["consumption_datatransfer_changeflag"] . "<br />\n";
echo "consumption_ipaddress_executiontime: " . $net2ftp_globals["consumption_ipaddress_executiontime"] . "<br />\n";
} // End printConsumption()
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function checkConsumption() {
// --------------
// This function checks the consumption and returns an error message if
// the limit has been reached.
// It returns true if all is OK, false if the limit has been reached.
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_globals, $net2ftp_settings, $net2ftp_result;
// -------------------------------------------------------------------------
// Initial checks
// -------------------------------------------------------------------------
// Verify if a database is used, and if consumption checking is turned on. If not: don't continue.
if ($net2ftp_settings["use_database"] != "yes" || $net2ftp_settings["check_consumption"] != "yes") { return true; }
// -------------------------------------------------------------------------
// Check if the limit has been reached
// -------------------------------------------------------------------------
if ($net2ftp_globals["consumption_ipaddress_datatransfer"] > $net2ftp_settings["max_consumption_ipaddress_datatransfer"]) { return false; }
if ($net2ftp_globals["consumption_ipaddress_executiontime"] > $net2ftp_settings["max_consumption_ipaddress_executiontime"]) { return false; }
if ($net2ftp_globals["consumption_ftpserver_datatransfer"] > $net2ftp_settings["max_consumption_ftpserver_datatransfer"]) { return false; }
if ($net2ftp_globals["consumption_ftpserver_executiontime"] > $net2ftp_settings["max_consumption_ftpserver_executiontime"]) { return false; }
return true;
} // End checkConsumption()
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
?>

View file

@ -1,52 +0,0 @@
<?php
// -------------------------------------------------------------------------------
// | net2ftp: a web based FTP client |
// | Copyright (c) 2003-2013 by David Gartner |
// | |
// | 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. |
// | |
// -------------------------------------------------------------------------------
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function connect2db() {
// --------------
// This function logs user accesses to the site
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_settings;
$mydb = mysql_connect($net2ftp_settings["dbserver"], $net2ftp_settings["dbusername"], $net2ftp_settings["dbpassword"]);
if ($mydb == false) {
setErrorVars(false, __("Unable to connect to the MySQL database. Please check your MySQL database settings in net2ftp's configuration file settings.inc.php."), debug_backtrace(), __FILE__, __LINE__);
return false;
}
$result2 = mysql_select_db($net2ftp_settings["dbname"]);
if ($result2 == false) {
setErrorVars(false, __("Unable to select the MySQL database. Please check your MySQL database settings in net2ftp's configuration file settings.inc.php."), debug_backtrace(), __FILE__, __LINE__);
return false;
}
return $mydb;
} // End connect2db
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
?>

View file

@ -1,168 +0,0 @@
<?php
// -------------------------------------------------------------------------------
// | net2ftp: a web based FTP client |
// | Copyright (c) 2003-2013 by David Gartner |
// | |
// | 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 is how error-handing works within net2ftp
-------------------------------------------------------------------------
There are 3 global variables:
- $net2ftp_result["success"], which is true or false
- $net2ftp_result["errormessage"], which contains an error message
- $net2ftp_result["debug_backtrace"], which contains the debugging backtrace (to indicate *where* the error happened)
---------------------------------
Low-level function executes a standard PHP function
- If everything goes OK, the low-level function simply returns its $finalresult
- If there is an error, the global variable $net2ftp_result["success"] is set to false, and
$net2ftp_result["errormessage"] will be filled with the error message
---------------------------------
function low_level {
$result = php_function();
if ($result == false) { setErrorVars(false, "errormessage", debug_backtrace(), __FILE, __LINE__); return false; }
...
return $finalresult;
}
---------------------------------
Middle-level function executes a low-level function (it may also execute standard PHP functions)
- If everything goes OK, the middle-level function simply returns its $finalresult
- If there is an error, the function can either return to its parent, or continue
---------------------------------
function middle_level {
global $net2ftp_result;
$result = low_level();
// Return to its parent, leave the error message as is:
if ($net2ftp_result["success"] == false) { return false; }
// Return to its parent, change the error message (leave the debug backtrace as is):
if ($net2ftp_result["success"] == false) { setErrorVars(false, "errormessage2", $net2ftp_result["debug_backtrace"], __FILE, __LINE__); return false; }
// Reset the error variables and continue:
if ($net2ftp_result["success"] == false) { setErrorVars(true, "", "", "", ""); }
...
return $finalresult;
// Print error message and exit -- THIS IS NOT DONE ANY MORE, as exit() calls must be avoided at all cost to
// keep net2ftp integrateable within other web applications.
// This case is replaced by case 1: return to the parent function, and leave the error message as is.
//// if ($net2ftp_result["success"] == false) { printErrorMessage(); }
}
---------------------------------
High-level function executes a middle-level function (it may also execute standard PHP functions)
- If everything goes OK, the high-level function simply returns its $finalresult
- If there is an error, the function returs to its parent (the script which called the net2ftp() function). It is
up to the parent to see if and how an error message should be printed -- see index.php for an example.
---------------------------------
function high_level {
global $net2ftp_result;
$result = middle_level();
if ($net2ftp_result["success"] == false) { return false; }
...
return $finalresult;
}
------------------------------------------------------------------------- */
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function setErrorVars($success, $errormessage, $debug_backtrace, $file, $line) {
// --------------
// This function modifies the 3 global error-handling variables
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_result, $net2ftp_settings;
// -------------------------------------------------------------------------
// Set the error-handling variables
// -------------------------------------------------------------------------
$net2ftp_result["success"] = $success;
$net2ftp_result["errormessage"] = $errormessage;
$net2ftp_result["debug_backtrace"] = $debug_backtrace;
$net2ftp_result["file"] = $file;
$net2ftp_result["line"] = $line;
// -------------------------------------------------------------------------
// Log the error if an error occured ($success == false)
// If the error vars are set to true again ($success == true), don't log the error once more
// -------------------------------------------------------------------------
// DON'T LOG THE ERROR HERE, AS THE FUNCTION logError() MAY CALL setErrorVars() AGAIN,
// CAUSING AN INFINITE LOOP!
// if ($success == false) {
// logError();
// }
} // end setErrorVars
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftpErrorHandler($errno, $errmsg, $file, $line, $vars) {
// --------------
// This function processes PHP notices, warnings and errors
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_output;
// -------------------------------------------------------------------------
// Put error details in variable
// -------------------------------------------------------------------------
if ($errno == E_USER_ERROR || $errno == E_ERROR || $errno == E_PARSE) {
$net2ftp_output["php_error"][] = "Error [$errno] $errstr in file $file on line $line";
echo "Error [$errno] $errstr in file $file on line $line";
exit();
}
elseif ($errorno == E_USER_WARNING || $errno == E_WARNING) {
$net2ftp_output["php_warning"][] = "Warning [$errno] $errstr in file $file on line $line";
}
elseif ($errorno == E_USER_NOTICE) {
$net2ftp_output["php_notice"][] = "Notice [$errno] $errstr in file $file on line $line";
}
else {
$net2ftp_output["php_error"][] = "Unknown error type [$errno] $errstr in file $file on line $line";
}
} // end setErrorVars
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
?>

File diff suppressed because it is too large Load diff

View file

@ -1,205 +0,0 @@
<?php
// -------------------------------------------------------------------------------
// | net2ftp: a web based FTP client |
// | Copyright (c) 2003-2013 by David Gartner |
// | |
// | 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. |
// | |
// -------------------------------------------------------------------------------
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function timer() {
// --------------
// This function calculates the time between starttime and endtime in milliseconds
// --------------
global $net2ftp_globals;
list($start_usec, $start_sec) = explode(' ', $net2ftp_globals["starttime"]);
$starttime = ((float)$start_usec + (float)$start_sec);
list($end_usec, $end_sec) = explode(' ', $net2ftp_globals["endtime"]);
$endtime = ((float)$end_usec + (float)$end_sec);
$time_taken = ($endtime - $starttime); // to convert from microsec to sec
$time_taken = number_format($time_taken, 2); // optional
return $time_taken;
} // End function timer
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function mytime() {
$datetime = date("Y-m-d H:i:s");
return $datetime;
}
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function mytime_short() {
$datetime = date("H:i");
return $datetime;
}
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function getBrowser($what) {
// --------------
// This function returns the browser name, version and platform using the http_user_agent string
// --------------
// Original code comes from http://www.phpbuilder.com/columns/tim20000821.php3?print_mode=1
// Written by Tim Perdue, and released under the GPL license
//
// SourceForge: Breaking Down the Barriers to Open Source Development
// Copyright 1999-2000 (c) The SourceForge Crew
// http://sourceforge.net
//
// $Id: tim20000821.php3,v 1.2 2001/05/22 19:22:47 tim Exp $
// -------------------------------------------------------------------------
// If no information is available, return ""
// -------------------------------------------------------------------------
if (isset($_SERVER["HTTP_USER_AGENT"]) == false) { return ""; }
// -------------------------------------------------------------------------
// Remove XSS code
// -------------------------------------------------------------------------
$http_user_agent = validateGenericInput($_SERVER["HTTP_USER_AGENT"]);
// -------------------------------------------------------------------------
// Determine browser and version
// -------------------------------------------------------------------------
if ($what == "version" || $what == "agent") {
// !!! If a new browser is added, add is also in the plugin properties
// Else, functionality will be broken when loading the plugin in printTextareaSelect().
if (preg_match('#MSIE ([0-9].[0-9]{1,2})#', $http_user_agent, $regs)) {
$BROWSER_VERSION = $regs[1];
$BROWSER_AGENT = 'IE';
}
elseif (preg_match('#Chrome/([0-9]{1,2}.[0-9]{1,4}.[0-9]{1,4}.[0-9]{1,4})#', $http_user_agent, $regs)) {
$BROWSER_VERSION = $regs[1];
$BROWSER_AGENT = 'Chrome';
}
elseif (preg_match('#Safari/([0-9].[0-9]{1,2})#', $http_user_agent, $regs)) {
$BROWSER_VERSION = $regs[1];
$BROWSER_AGENT = 'Safari';
}
elseif (preg_match('#Opera ([0-9].[0-9]{1,2})#', $http_user_agent, $regs)) {
$BROWSER_VERSION = $regs[1];
$BROWSER_AGENT = 'Opera';
}
elseif (preg_match('#Mozilla/([0-9].[0-9]{1,2})#', $http_user_agent, $regs)) {
$BROWSER_VERSION = $regs[1];
$BROWSER_AGENT = 'Mozilla';
}
else {
$BROWSER_VERSION = 0;
$BROWSER_AGENT = 'Other';
}
if ($what == "version") { return $BROWSER_VERSION; }
elseif ($what == "agent") { return $BROWSER_AGENT; }
} // end if
// -------------------------------------------------------------------------
// Determine platform
// -------------------------------------------------------------------------
elseif ($what == "platform") {
if ( strstr($http_user_agent, 'BlackBerry') ||
strstr($http_user_agent, 'DoCoMo') ||
strstr($http_user_agent, 'Nokia') ||
strstr($http_user_agent, 'Palm') ||
strstr($http_user_agent, 'SonyEricsson') ||
strstr($http_user_agent, 'SymbianOS') ||
strstr($http_user_agent, 'Windows CE')) {
$BROWSER_PLATFORM = 'Mobile';
}
/*elseif (strstr($http_user_agent, 'iPhone') || strstr($http_user_agent, 'iPod')) {
$BROWSER_PLATFORM = 'iPhone';
}*/
elseif (strstr($http_user_agent, 'Win')) {
$BROWSER_PLATFORM = 'Win';
}
else if (strstr($http_user_agent, 'Mac')) {
$BROWSER_PLATFORM = 'Mac';
}
else if (strstr($http_user_agent, 'Linux')) {
$BROWSER_PLATFORM = 'Linux';
}
else if (strstr($http_user_agent, 'Unix')) {
$BROWSER_PLATFORM = 'Unix';
}
else {
$BROWSER_PLATFORM = 'Other';
}
return $BROWSER_PLATFORM;
} // end if elseif
} // End function getBrowser
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
?>

View file

@ -1,95 +0,0 @@
<?php
// Samples of FTP LIST responses.
// Some samples are from FileZilla source code, file FtpListResult.cpp
// License: GPL
// Some samples are from http://cr.yp.to/ftpparse/ftpparse.c
// By D. J. Bernstein, djb@cr.yp.to http://cr.yp.to/ftpparse.html
// License: Commercial use is fine, if you let me know what programs you're using this in.
// Some samples are provided by net2ftp users to the net2ftp development team
// License: GPL
$list_samples["UNIX-style listing, without inum and without blocks"][1] = "-rw-r--r-- 1 root other 531 Jan 29 03:26 README";
$list_samples["UNIX-style listing, without inum and without blocks"][2] = "dr-xr-xr-x 2 root other 512 Apr 8 1994 etc";
$list_samples["UNIX-style listing, without inum and without blocks"][3] = "dr-xr-xr-x 2 root 512 Apr 8 1994 etc2";
$list_samples["UNIX-style listing, without inum and without blocks"][4] = "lrwxrwxrwx 1 root other 7 Jan 25 00:17 bin -> usr/bin";
$list_samples["Some listings with uncommon date/time format"][1] = "-rw-r--r-- 1 root other 531 09-26 2000 README2";
$list_samples["Some listings with uncommon date/time format"][2] = "-rw-r--r-- 1 root other 531 09-26 13:45 README3";
$list_samples["Some listings with uncommon date/time format"][3] = "-rw-r--r-- 1 root other 531 2005-06-07 21:22 README4";
$list_samples["Also produced by Microsoft's FTP servers for Windows"][1] = "---------- 1 owner group 1803128 Jul 10 10:18 ls-lR.Z";
$list_samples["Also produced by Microsoft's FTP servers for Windows"][2] = "d--------- 1 owner group 0 May 9 19:45 Softlib";
$list_samples["Also WFTPD for MSDOS"][1] = "-rwxrwxrwx 1 noone nogroup 322 Aug 19 1996 message.ftp";
$list_samples["Also NetWare"][1] = "d [R----F--] supervisor 512 Jan 16 18:53 login";
$list_samples["Also NetWare"][2] = "- [R----F--] rhesus 214059 Oct 20 15:27 cx.exe";
$list_samples["Also NetPresenz for the Mac"][1] = "-------r-- 326 1391972 1392298 Nov 22 1995 MegaPhone.sit";
$list_samples["Also NetPresenz for the Mac"][2] = "drwxrwxr-x folder 2 May 10 1996 network";
$list_samples["MSDOS format"][1] = "04-27-00 09:09PM <DIR> licensed";
$list_samples["MSDOS format"][2] = "07-18-00 10:16AM <DIR> pub";
$list_samples["MSDOS format"][3] = "04-14-00 03:47PM 589 readme.htm";
$list_samples["Some other formats some windows servers send"][1] = "-rw-r--r-- 1 root 531 Jan 29 03:26 README5";
$list_samples["Some other formats some windows servers send"][2] = "-rw-r--r-- 1 group domain user 531 Jan 29 03:26 README6";
$list_samples["EPLF directory listings"][1] = "+i8388621.48594,m825718503,r,s280,\teplf test 1.file";
$list_samples["EPLF directory listings"][2] = "+i8388621.50690,m824255907,/,\teplf test 2.dir";
$list_samples["EPLF directory listings"][3] = "+i8388621.48598,m824253270,r,s612,\teplf test 3.file";
$list_samples["MSDOS type listing used by IIS"][1] = "04-27-00 12:09PM <DIR> DOS dir 1";
$list_samples["MSDOS type listing used by IIS"][2] = "04-14-00 03:47PM 589 DOS file 1";
$list_samples["Another type of MSDOS style listings"][1] = "2002-09-02 18:48 <DIR> DOS dir 2";
$list_samples["Another type of MSDOS style listings"][2] = "2002-09-02 19:06 9,730 DOS file 2";
$list_samples["Numerical Unix style format"][1] = "0100644 500 101 12345 123456789 filename";
$list_samples["This one is used by SSH-2.0-VShell_2_1_2_143, this is the old VShell format"][1] = "206876 Apr 04, 2000 21:06 VShell (old)";
$list_samples["This one is used by SSH-2.0-VShell_2_1_2_143, this is the old VShell format"][2] = "0 Dec 12, 2002 02:13 VShell (old) Dir/";
$list_samples["This type of directory listings is sent by some newer versions of VShell both year and time in one line is uncommon."][1] = "-rwxr-xr-x 1 user group 9 Oct 08, 2002 09:47 VShell (new)";
$list_samples["Next ones come from an OS/2 server. The server obviously isn't Y2K aware"][1] = "36611 A 04-23-103 10:57 OS2 test1.file";
$list_samples["Next ones come from an OS/2 server. The server obviously isn't Y2K aware"][2] = " 1123 A 07-14-99 12:37 OS2 test2.file";
$list_samples["Next ones come from an OS/2 server. The server obviously isn't Y2K aware"][3] = " 0 DIR 02-11-103 16:15 OS2 test1.dir";
$list_samples["Next ones come from an OS/2 server. The server obviously isn't Y2K aware"][4] = " 1123 DIR A 10-05-100 23:38 OS2 test2.dir";
$list_samples["Some servers send localized date formats, here the German one"][1] = "dr-xr-xr-x 2 root other 2235 26. Juli, 20:10 datetest1 (ger)";
$list_samples["Some servers send localized date formats, here the German one"][2] = "-r-xr-xr-x 2 root other 2235 2. Okt. 2003 datetest2 (ger)";
$list_samples["Some servers send localized date formats, here the German one"][3] = "-r-xr-xr-x 2 root other 2235 1999/10/12 17:12 datetest3";
$list_samples["Some servers send localized date formats, here the German one"][4] = "-r-xr-xr-x 2 root other 2235 24-04-2003 17:12 datetest4";
$list_samples["Here a Japanese one"][1] = "-rw-r--r-- 1 root sys 8473 4\x8c\x8e 18\x93\xfa 2003\x94\x4e datatest1 (jap)";
$list_samples["VMS style listings"][1] = "vms_dir_1.DIR;1 1 19-NOV-2001 21:41 [root,root] (RWE,RWE,RE,RE)";
$list_samples["VMS style listings"][2] = "vms_file_3;1 155 2-JUL-2003 10:30:13.64";
$list_samples["VMS style listings without time"][1] = "vms_file_4;1 2/8 15-JAN-2000 [IV2_XXX] (RWED,RWED,RE,)";
$list_samples["VMS style listings without time"][2] = "vms_file_5;1 6/8 15-JUI-2002 PRONAS (RWED,RWED,RE,)";
$list_samples["VMS multiline"][1] = "VMS_file_1;1\r\n170774/170775 24-APR-2003 08:16:15 [FTP_CLIENT,SCOT] (RWED,RWED,RE,)";
$list_samples["VMS multiline"][2] = "VMS_file_2;1\r\n10 2-JUL-2003 10:30:08.59 [FTP_CLIENT,SCOT] (RWED,RWED,RE,)";
$list_samples["IBM AS/400 style listing"][1] = "QSYS 77824 02/23/00 15:09:55 *DIR IBM AS/400 Dir1/";
$list_samples["IBM AS/400 style listing"][2] = "QSYS 77824 23/02/00 15:09:55 *FILE IBM AS/400 File1 strangedate";
$list_samples["aligned directory listing with too long size"][1] = "-r-xr-xr-x longowner longgroup123456 Feb 12 17:20 long size test1";
$list_samples["short directory listing with month name"][1] = "-r-xr-xr-x 2 owner group 4512 01-jun-99 shortdate with monthname";
$list_samples["the following format is sent by the Connect:Enterprise server by Sterling Commerce"][1] = "-C--E-----FTP B BCC3I1 7670 1294495 Jan 13 07:42 ConEnt file";
$list_samples["the following format is sent by the Connect:Enterprise server by Sterling Commerce"][2] = "-C--E-----FTS B BCC3I1 7670 1294495 Jan 13 07:42 ConEnt file2";
$list_samples["the following format is sent by the Connect:Enterprise server by Sterling Commerce"][3] = "-AR--M----TCP B ceunix 17570 2313708 Mar 29 08:56 ALL_SHORT1.zip";
$list_samples["Nortel wfFtp router"][1] = "nortel.wfFtp 1014196 06/03/04 Thur. 10:20:03";
$list_samples["VxWorks based server used in Nortel routers"][1] = "2048 Feb-28-1998 05:23:30 nortel.VwWorks dir <DIR>";
?>

View file

@ -1,734 +0,0 @@
<?php
// -------------------------------------------------------------------------------
// | net2ftp: a web based FTP client |
// | Copyright (c) 2003-2013 by David Gartner |
// | |
// | 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. |
// | |
// -------------------------------------------------------------------------------
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function logAccess() {
// --------------
// This function logs user accesses to the site
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_globals, $net2ftp_settings, $net2ftp_result;
if ($net2ftp_settings["log_access"] == "yes") {
// -------------------------------------------------------------------------
// Date and time
// -------------------------------------------------------------------------
$date = date("Y-m-d");
$time = date("H:i:s");
// -------------------------------------------------------------------------
// Logging to the database
// -------------------------------------------------------------------------
if ($net2ftp_settings["use_database"] == "yes") {
// ----------------------------------------------
// Do not log accesses, errors and consumption while the logs are being rotated
// ----------------------------------------------
$logStatus = getLogStatus();
if ($net2ftp_result["success"] == false) { return false; }
if ($logStatus != 0) { return true; }
// ----------------------------------------------
// Input checks
// ----------------------------------------------
// Add slashes to variables which are used in a SQL query, and which are
// potentially unsafe (supplied by the user).
// $date is calculated in this function
// $time is calculated in this function
$REMOTE_ADDR_safe = addslashes($net2ftp_globals["REMOTE_ADDR"]);
$REMOTE_PORT_safe = addslashes($net2ftp_globals["REMOTE_PORT"]);
$HTTP_USER_AGENT_safe = addslashes($net2ftp_globals["HTTP_USER_AGENT"]);
$PHP_SELF_safe = addslashes($net2ftp_globals["PHP_SELF"]);
if (isset($net2ftp_globals["consumption_datatransfer"]) == true) {
$consumption_datatransfer_safe = addslashes($net2ftp_globals["consumption_datatransfer"]);
}
else {
$consumption_datatransfer_safe = "0";
}
if (isset($net2ftp_globals["consumption_executiontime"]) == true) {
$consumption_executiontime_safe = addslashes($net2ftp_globals["consumption_executiontime"]);
}
else {
$consumption_executiontime_safe = "0";
}
$net2ftp_ftpserver_safe = addslashes($net2ftp_globals["ftpserver"]);
$net2ftp_username_safe = addslashes($net2ftp_globals["username"]);
$state_safe = addslashes($net2ftp_globals["state"]);
$state2_safe = addslashes($net2ftp_globals["state2"]);
$screen_safe = addslashes($net2ftp_globals["screen"]);
$directory_safe = addslashes($net2ftp_globals["directory"]);
$entry_safe = addslashes($net2ftp_globals["entry"]);
$HTTP_REFERER_safe = addslashes($net2ftp_globals["HTTP_REFERER"]);
// ----------------------------------------------
// Connect to the DB
// ----------------------------------------------
$mydb = connect2db();
if ($net2ftp_result["success"] == false) { return false; }
// ----------------------------------------------
// Add record to the database table
// ----------------------------------------------
$sqlquery1 = "INSERT INTO net2ftp_log_access VALUES(null, '$date', '$time', '$REMOTE_ADDR_safe', '$REMOTE_PORT_safe', '$HTTP_USER_AGENT_safe', '$PHP_SELF_safe', '$consumption_datatransfer_safe', '$consumption_executiontime_safe', '$net2ftp_ftpserver_safe', '$net2ftp_username_safe', '$state_safe', '$state2_safe', '$screen_safe', '$directory_safe', '$entry_safe', '$HTTP_REFERER_safe')";
$result1 = mysql_query($sqlquery1);
if ($result1 == false) {
$errormessage = __("Unable to execute the SQL query.");
setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
return false;
}
$nrofrows1 = mysql_affected_rows($mydb);
$net2ftp_globals["log_access_id"] = mysql_insert_id();
} // end if use_database
// -------------------------------------------------------------------------
// Logging to the system log
// -------------------------------------------------------------------------
if ($net2ftp_settings["use_syslog"] == "yes") {
// ----------------------------------------------
// Get consumption values
// ----------------------------------------------
if (isset($net2ftp_globals["consumption_datatransfer"]) == true) {
$consumption_datatransfer = $net2ftp_globals["consumption_datatransfer"];
}
else {
$consumption_datatransfer = "0";
}
if (isset($net2ftp_globals["consumption_executiontime"]) == true) {
$consumption_executiontime = $net2ftp_globals["consumption_executiontime"];
}
else {
$consumption_executiontime = "0";
}
// ----------------------------------------------
// Create message
// ----------------------------------------------
$message2log = "$date $time " . $net2ftp_globals["REMOTE_ADDR"] . " " . $net2ftp_globals["REMOTE_PORT"] . " " . $net2ftp_globals["PHP_SELF"] . " " . $consumption_datatransfer . " " . $consumption_executiontime . " " . $net2ftp_globals["ftpserver"] . " " . $net2ftp_globals["username"] . " " . $net2ftp_globals["state"] . " " . $net2ftp_globals["state2"] . " " . $net2ftp_globals["screen"] . " " . $net2ftp_globals["directory"] . " " . $net2ftp_globals["entry"];
$result2 = openlog($net2ftp_settings["syslog_ident"], 0, $net2ftp_settings["syslog_facility"]);
if ($result2 == false) {
$errormessage = __("Unable to open the system log.");
setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
return false;
}
// ----------------------------------------------
// Write message to system logger
// ----------------------------------------------
$result3 = syslog($net2ftp_settings["syslog_priority"], $message2log);
if ($result3 == false) {
$errormessage = __("Unable to write a message to the system log.");
setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
return false;
}
} // end if use_syslog
} // end if log_access
} // end logAccess()
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function logError() {
// --------------
// This function logs user accesses to the site
//
// IMPORTANT: this function uses, but does not change the global $net2ftp_result[""] variables.
// It returns true on success, false on failure.
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_globals, $net2ftp_settings, $net2ftp_result;
if ($net2ftp_settings["log_error"] == "yes") {
// -------------------------------------------------------------------------
// Take a copy of the $net2ftp_result
// If an error occurs within logError, logError will return false and reset the
// $net2ftp_result variable to it's original value
// Also if no error occurs logError will return the variable to it's original value
// -------------------------------------------------------------------------
$net2ftp_result_original = $net2ftp_result;
setErrorVars(true, "", "", "", "");
// -------------------------------------------------------------------------
// Errormessage and debug backtrace
// -------------------------------------------------------------------------
$errormessage = addslashes($net2ftp_result_original["errormessage"]);
$debug_backtrace = "";
$i = sizeof($net2ftp_result_original["debug_backtrace"])-1;
if ($i > 0) {
$debug_backtrace .= addslashes("function " . $net2ftp_result_original["debug_backtrace"][$i]["function"] . " (" . $net2ftp_result_original["debug_backtrace"][$i]["file"] . " on line " . $net2ftp_result_original["debug_backtrace"][$i]["line"] . ")\n");
for ($j=0; $j<sizeof($net2ftp_result_original["debug_backtrace"][$i]["args"]); $j++) {
$debug_backtrace .= addslashes("argument $j: " . $net2ftp_result_original["debug_backtrace"][$i]["args"][$j] . "\n");
}
}
// -------------------------------------------------------------------------
// Date and time
// -------------------------------------------------------------------------
$date = date("Y-m-d");
$time = date("H:i:s");
// -------------------------------------------------------------------------
// Logging to the database
// -------------------------------------------------------------------------
if ($net2ftp_settings["use_database"] == "yes") {
// ----------------------------------------------
// Do not log accesses and errors while the logs are being rotated
// ----------------------------------------------
$logStatus = getLogStatus();
if ($net2ftp_result["success"] == false) { return false; }
if ($logStatus != 0) { return true; }
// ----------------------------------------------
// Input checks
// ----------------------------------------------
// Add slashes to variables which are used in a SQL query, and which are
// potentially unsafe (supplied by the user).
// $date is calculated in this function
// $time is calculated in this function
$net2ftp_ftpserver_safe = addslashes($net2ftp_globals["ftpserver"]);
$net2ftp_username_safe = addslashes($net2ftp_globals["username"]);
$state_safe = addslashes($net2ftp_globals["state"]);
$state2_safe = addslashes($net2ftp_globals["state2"]);
$directory_safe = addslashes($net2ftp_globals["directory"]);
$REMOTE_ADDR_safe = addslashes($net2ftp_globals["REMOTE_ADDR"]);
$REMOTE_PORT_safe = addslashes($net2ftp_globals["REMOTE_PORT"]);
$HTTP_USER_AGENT_safe = addslashes($net2ftp_globals["HTTP_USER_AGENT"]);
// ----------------------------------------------
// Connect to the DB
// ----------------------------------------------
$mydb = connect2db();
if ($net2ftp_result["success"] == false) {
setErrorVars($net2ftp_result_original["success"], $net2ftp_result_original["errormessage"], $net2ftp_result_original["debug_backtrace"], $net2ftp_result_original["file"], $net2ftp_result_original["line"]);
return false;
}
// ----------------------------------------------
// Add record to the database table
// ----------------------------------------------
$sqlquerystring = "INSERT INTO net2ftp_log_error VALUES('$date', '$time', '$net2ftp_ftpserver_safe', '$net2ftp_username_safe', '$errormessage', '$debug_backtrace', '$state_safe', '$state2_safe', '$directory_safe', '$REMOTE_ADDR_safe', '$REMOTE_PORT_safe', '$HTTP_USER_AGENT_safe')";
$result_mysql_query = mysql_query($sqlquerystring);
if ($result_mysql_query == false) {
setErrorVars($net2ftp_result_original["success"], $net2ftp_result_original["errormessage"], $net2ftp_result_original["debug_backtrace"], $net2ftp_result_original["file"], $net2ftp_result_original["line"]);
return false;
}
} // end if use_database
// -------------------------------------------------------------------------
// Logging to the system log
// -------------------------------------------------------------------------
if ($net2ftp_settings["use_syslog"] == "yes") {
// ----------------------------------------------
// Get consumption values
// ----------------------------------------------
if (isset($net2ftp_globals["consumption_datatransfer"]) == true) {
$consumption_datatransfer = $net2ftp_globals["consumption_datatransfer"];
}
else {
$consumption_datatransfer = "0";
}
if (isset($net2ftp_globals["consumption_executiontime"]) == true) {
$consumption_executiontime = $net2ftp_globals["consumption_executiontime"];
}
else {
$consumption_executiontime = "0";
}
// ----------------------------------------------
// Create message
// ----------------------------------------------
$message2log = "$date $time " . $net2ftp_globals["ftpserver"] . " " . $net2ftp_globals["username"] . " " . $net2ftp_result["errormessage"] . " $debug_backtrace " . $net2ftp_globals["state"] . " " . $net2ftp_globals["state2"] . " " . $net2ftp_globals["directory"] . " " . $net2ftp_globals["REMOTE_ADDR"] . " " . $net2ftp_globals["HTTP_USER_AGENT"];
$result2 = openlog($net2ftp_settings["syslog_ident"], 0, $net2ftp_settings["syslog_facility"]);
if ($result2 == false) {
$errormessage = __("Unable to open the system log.");
setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
return false;
}
// ----------------------------------------------
// Write message to system logger
// ----------------------------------------------
$result3 = syslog($net2ftp_settings["syslog_priority"], $message2log);
if ($result3 == false) {
$errormessage = __("Unable to write a message to the system log.");
setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
return false;
}
} // end if use_syslog
// -------------------------------------------------------------------------
// Reset the variable to it's original value
// -------------------------------------------------------------------------
setErrorVars($net2ftp_result_original["success"], $net2ftp_result_original["errormessage"], $net2ftp_result_original["debug_backtrace"], $net2ftp_result_original["file"], $net2ftp_result_original["line"]);
} // end if logErrors
} // end logError()
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function getLogStatus() {
// --------------
// This function reads the log rotation status from the database.
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_globals, $net2ftp_settings, $net2ftp_result;
// -------------------------------------------------------------------------
// Initial checks
// -------------------------------------------------------------------------
// Verify if a database is used. If not: don't continue.
if ($net2ftp_settings["use_database"] != "yes") { return true; }
// -------------------------------------------------------------------------
// Determine current month and last month
// -------------------------------------------------------------------------
$currentmonth = date("Ym"); // e.g. 201207
$lastmonth = date("Ym", mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
// -------------------------------------------------------------------------
// Connect to the database
// -------------------------------------------------------------------------
$mydb = connect2db();
if ($net2ftp_result["success"] == false) { return false; }
// -------------------------------------------------------------------------
// Get log rotation status
// -------------------------------------------------------------------------
$sqlquery1 = "SELECT status FROM net2ftp_log_status WHERE month = '$currentmonth';";
$result1 = mysql_query("$sqlquery1") or die("Unable to execute SQL SELECT query (getLogStatus > sqlquery1) <br /> $sqlquery1");
$nrofrows1 = mysql_num_rows($result1);
if ($nrofrows1 == 0) {
$logStatus = 1;
}
elseif ($nrofrows1 == 1) {
$resultRow1 = mysql_fetch_row($result1);
$logStatus = $resultRow1[0];
}
else {
setErrorVars(false, __("Table net2ftp_log_status contains duplicate entries."), debug_backtrace(), __FILE__, __LINE__);
return false;
}
// Return $logStatus
return $logStatus;
} // End getLogStatus
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function putLogStatus($logStatus) {
// --------------
// This function writes the log rotation status to the database.
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_globals, $net2ftp_settings, $net2ftp_result;
// -------------------------------------------------------------------------
// Initial checks
// -------------------------------------------------------------------------
// Verify if a database is used. If not: don't continue.
if ($net2ftp_settings["use_database"] != "yes") { return true; }
// -------------------------------------------------------------------------
// Determine current month and last month
// -------------------------------------------------------------------------
$currentmonth = date("Ym"); // e.g. 201207
$lastmonth = date("Ym", mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
$datetime = mytime();
// -------------------------------------------------------------------------
// Connect to the database
// -------------------------------------------------------------------------
$mydb = connect2db();
if ($net2ftp_result["success"] == false) { return false; }
// -------------------------------------------------------------------------
// Put log rotation status
// -------------------------------------------------------------------------
$sqlquery1 = "SELECT status, changelog FROM net2ftp_log_status WHERE month = '$currentmonth';";
$result1 = mysql_query("$sqlquery1");
$nrofrows1 = mysql_num_rows($result1);
if ($nrofrows1 == 1) {
$resultRow1 = mysql_fetch_row($result1);
$logStatus_old = $resultRow1[0];
$changelog_old = $resultRow1[1];
$changelog_new = $changelog_old . "From $logStatus_old to $logStatus on $datetime. ";
$sqlquery2 = "UPDATE net2ftp_log_status SET status = '" . $logStatus . "', changelog = '" . $changelog_new . "' WHERE month = '$currentmonth';";
$result2 = mysql_query("$sqlquery2");
$nrofrows2 = mysql_affected_rows($mydb);
}
// Don't check on the UPDATE nr of rows, because when the values in the variables and in the table are the same,
// the $nrofrows2 is set to 0.
elseif ($nrofrows1 == 0) {
$changelog_new = "Set to $logStatus on $datetime. ";
$sqlquery3 = "INSERT INTO net2ftp_log_status VALUES('$currentmonth', '" . $logStatus . "', '" . $changelog_new . "');";
$result3 = mysql_query("$sqlquery3");
$nrofrows3 = mysql_affected_rows($mydb);
if ($nrofrows3 != 1) {
setErrorVars(false, __("Table net2ftp_log_status could not be updated."), debug_backtrace(), __FILE__, __LINE__);
return false;
}
}
else {
setErrorVars(false, __("Table net2ftp_log_status contains duplicate entries."), debug_backtrace(), __FILE__, __LINE__);
return false;
}
// -------------------------------------------------------------------------
// Return true
// -------------------------------------------------------------------------
return true;
} // End putLogStatus
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function emptyLogs($datefrom, $dateto) {
// --------------
// This function deletes the log records for the dates between $datefrom
// and $dateto.
// The global variable $net2ftp_output["emptyLogs"] is filled with result messages.
// The function returns true on success, false on failure.
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_globals, $net2ftp_result, $net2ftp_output;
$toreturn = true;
// -------------------------------------------------------------------------
// Connect to the database
// -------------------------------------------------------------------------
$mydb = connect2db();
if ($net2ftp_result["success"] == false) { return false; }
$tables[1] = "net2ftp_log_access";
$tables[2] = "net2ftp_log_error";
$tables[3] = "net2ftp_log_consumption_ftpserver";
$tables[4] = "net2ftp_log_consumption_ipaddress";
// -------------------------------------------------------------------------
// Execute the queries
// -------------------------------------------------------------------------
for ($i=1; $i<=sizeof($tables); $i++) {
$sqlquery_empty = "DELETE FROM $tables[$i] WHERE date BETWEEN '$datefrom' AND '$dateto';";
$result_empty[$i] = mysql_query("$sqlquery_empty");
$sqlquery_optimize = "OPTIMIZE TABLE `" . $tables[$i] . "`;";
$result_optimize[$i] = mysql_query("$sqlquery_optimize");
if ($result_empty[$i] == true) {
$net2ftp_output["emptyLogs"][] = __("The table <b>%1\$s</b> was emptied successfully.", $tables[$i]);
}
else {
$toreturn = false;
$net2ftp_output["emptyLogs"][] = __("The table <b>%1\$s</b> could not be emptied.", $tables[$i]);
}
if ($result_optimize[$i] == true) {
$net2ftp_output["emptyLogs"][] = __("The table <b>%1\$s</b> was optimized successfully.", $tables[$i]);
}
else {
$toreturn = false;
$net2ftp_output["emptyLogs"][] = __("The table <b>%1\$s</b> could not be optimized.", $tables[$i]);
}
} // end for
return $toreturn;
} // end emptyLogs()
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function rotateLogs() {
// --------------
// Rotate the tables
// net2ftp_log_access = active table
// net2ftp_log_access_YYYYMM = archive table with information of month MM and year YYYY
// net2ftp_log_access_template = template table (empty table)
//
// To avoid that the log rotation actions would be executed multiple times at
// the end of the period, a "log rotation status" is used:
// 0 = no rotation needed
// 1 = step 1 not yet started (renaming active tables to archived tables)
// 2 = step 1 in progress
// 3 = step 2 not yet started (copying template tables to the active tables)
// 4 = step 2 in progress
// 5 = step 3 not yet started (dropping oldest archive tables)
// 6 = step 3 in progress
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_globals, $net2ftp_settings, $net2ftp_result, $net2ftp_output;
$toreturn = true;
// -------------------------------------------------------------------------
// Verify if a database is used. If not: don't continue.
// -------------------------------------------------------------------------
if ($net2ftp_settings["use_database"] != "yes") { return true; }
// -------------------------------------------------------------------------
// Check if the setting is within the allowed range; if not, set it to 12 months
// -------------------------------------------------------------------------
if (!($net2ftp_settings["log_length_months"] > 1 && $net2ftp_settings["log_length_months"] < 99)) {
$net2ftp_settings["log_length_months"] = 12;
}
// -------------------------------------------------------------------------
// Current month, next month, previous month
// -------------------------------------------------------------------------
$currentmonth = date("Ym"); // e.g. 201207
$lastmonth = date("Ym", mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
$nextmonth = date("Ym", mktime(0, 0, 0, date("m")+1, date("d"), date("Y")));
$dropmonth = date("Ym", mktime(0, 0, 0, date("m")-$net2ftp_settings["log_length_months"]-1, date("d"), date("Y")));
// -------------------------------------------------------------------------
// Connect to the database
// -------------------------------------------------------------------------
$mydb = connect2db();
if ($net2ftp_result["success"] == false) { return false; }
// -------------------------------------------------------------------------
// Get the log rotation status
// -------------------------------------------------------------------------
$logStatus = getLogStatus();
if ($net2ftp_result["success"] == false) { return false; }
// No log rotation needed
if ($logStatus === 0) { return true; }
// -------------------------------------------------------------------------
// Table names and SQL queries to create the tables
// -------------------------------------------------------------------------
$tables[1]["name"] = "net2ftp_log_access";
$tables[2]["name"] = "net2ftp_log_error";
$tables[3]["name"] = "net2ftp_log_consumption_ftpserver";
$tables[4]["name"] = "net2ftp_log_consumption_ipaddress";
// -------------------------------------------------------------------------
// step 1 of rotation: rename active tables to archived tables
// -------------------------------------------------------------------------
if ($logStatus == 1) {
// Set the log status to indicate this step is in progress
putLogStatus(2);
if ($net2ftp_result["success"] == false) { return false; }
// Execute the step
for ($i=1; $i<=sizeof($tables); $i++) {
$table = $tables[$i]["name"]; // Example: net2ftp_log_access
$table_archive = $table . "_" . $lastmonth; // Example: net2ftp_log_access_201206
$table_archive_drop = $table . "_" . $dropmonth; // Example: net2ftp_log_access_201106
$sqlquery_rename = "RENAME TABLE $table TO $table_archive";
$result_rename[$i] = mysql_query("$sqlquery_rename");
if ($result_rename[$i] == true) {
$net2ftp_output["rotateLogs"][] = __("The log tables were renamed successfully.");
}
else {
$toreturn = false;
$net2ftp_output["rotateLogs"][] = __("The log tables could not be renamed.");
}
} // end for
// Set the log status to indicate this step is in done and the next can start
putLogStatus(3);
if ($net2ftp_result["success"] == false) { return false; }
}
// -------------------------------------------------------------------------
// step 2 of rotation: copy template tables to the active
// -------------------------------------------------------------------------
elseif ($logStatus == 3) {
// Set the log status to indicate this step is in progress
putLogStatus(4);
if ($net2ftp_result["success"] == false) { return false; }
// Execute the step
for ($i=1; $i<=sizeof($tables); $i++) {
$table = $tables[$i]["name"]; // Example: net2ftp_log_access
$table_archive = $table . "_" . $lastmonth; // Example: net2ftp_log_access_201206
$table_archive_drop = $table . "_" . $dropmonth; // Example: net2ftp_log_access_201106
$sqlquery_copy = "CREATE TABLE $table LIKE $table_archive";
$result_copy[$i] = mysql_query("$sqlquery_copy");
if ($result_copy[$i] == true) {
$net2ftp_output["rotateLogs"][] = __("The log tables were copied successfully.");
}
else {
$toreturn = false;
$net2ftp_output["rotateLogs"][] = __("The log tables could not be copied.");
}
} // end for
// Set the log status to indicate this step is in done and the next can start
putLogStatus(5);
if ($net2ftp_result["success"] == false) { return false; }
}
// -------------------------------------------------------------------------
// step 3 of rotation: drop oldest archive tables
// -------------------------------------------------------------------------
elseif ($logStatus == 5) {
// Set the log status to indicate this step is in progress
putLogStatus(6);
if ($net2ftp_result["success"] == false) { return false; }
// Execute the step
for ($i=1; $i<=sizeof($tables); $i++) {
$table = $tables[$i]["name"]; // Example: net2ftp_log_access
$table_archive = $table . "_" . $lastmonth; // Example: net2ftp_log_access_201206
$table_archive_drop = $table . "_" . $dropmonth; // Example: net2ftp_log_access_201106
$sqlquery_drop = "DROP TABLE IF EXISTS $table_archive_drop;";
$result_drop[$i] = mysql_query("$sqlquery_drop");
if ($result_drop[$i] == true) {
$net2ftp_output["rotateLogs"][] = __("The oldest log table was dropped successfully.");
}
else {
$toreturn = false;
$net2ftp_output["rotateLogs"][] = __("The oldest log table could not be dropped.");
}
} // end for
// Set the log status to indicate this step is in done and the rotation is over
putLogStatus(0);
if ($net2ftp_result["success"] == false) { return false; }
}
return $toreturn;
} // end rotateLogs()
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
?>

View file

@ -1,509 +0,0 @@
<?php
// -------------------------------------------------------------------------------
// | net2ftp: a web based FTP client |
// | Copyright (c) 2003-2013 by David Gartner |
// | |
// | 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 |
// | |
// -------------------------------------------------------------------------------
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp($action) {
// --------------
// This function is the main net2ftp function; it is the interface between 3rd party
// scripts (CMS, control panels, etc), and the internal net2ftp modules and plugins.
//
// This function is called 5 times per pageload: to send the HTTP headers, to print
// the javascript code, to print the CSS code, to print the body onload actions and
// finally to print the body content.
// --------------
// -------------------------------------------------------------------------
// Check that "sendHttpHeaders" action is only executed once
// Check that no other actions can be executed if "sendHttpHeaders" has not yet been executed
// -------------------------------------------------------------------------
if ($action == "sendHttpHeaders") {
if (defined("NET2FTP_SENDHTTPHEADERS") == true) { echo "Error: please call the net2ftp(\$action) function only once with \$action = \"sendHttpHeaders\"!"; return false; }
else { define("NET2FTP_SENDHTTPHEADERS", 1); }
}
else {
if (defined("NET2FTP_SENDHTTPHEADERS") == false) { echo "Error: please call the net2ftp(\$action) function first with \$action = \"sendHttpHeaders\"!"; return false; }
}
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_settings, $net2ftp_globals, $net2ftp_result, $net2ftp_messages;
// Set the NET2FTP constant which is used to check if template files are called by net2ftp
if (defined("NET2FTP") == false) { define("NET2FTP", 1); }
// Initialize the global variables
if ($action == "sendHttpHeaders") {
$net2ftp_globals = array();
$net2ftp_messages = array();
$net2ftp_output = array();
$net2ftp_result["success"] = true;
$net2ftp_result["errormessage"] = "";
$net2ftp_result["debug_backtrace"] = "";
$net2ftp_result["exit"] = false;
$net2ftp_settings = array();
}
// -------------------------------------------------------------------------
// If an error occured during a previous execution of net2ftp(), return false
// and let index.php print the error message
// -------------------------------------------------------------------------
if ($net2ftp_result["success"] == false) { return false; }
// -------------------------------------------------------------------------
// Input checks
// -------------------------------------------------------------------------
if ($action != "sendHttpHeaders" && $action != "printJavascript" && $action != "printCss" && $action != "printBodyOnload" && $action != "printBody") {
$net2ftp_result["success"] = false;
$net2ftp_result["errormessage"] = "The \$action variable has an unknown value: $action.";
$net2ftp_result["debug_backtrace"] = debug_backtrace();
logError();
return false;
}
// -------------------------------------------------------------------------
// Read settings files
// -------------------------------------------------------------------------
if ($action == "sendHttpHeaders") {
require(NET2FTP_APPLICATION_ROOTDIR . "/settings.inc.php");
require(NET2FTP_APPLICATION_ROOTDIR . "/settings_authorizations.inc.php");
require(NET2FTP_APPLICATION_ROOTDIR . "/settings_screens.inc.php");
}
// -------------------------------------------------------------------------
// Main directories
// -------------------------------------------------------------------------
$net2ftp_globals["application_rootdir"] = NET2FTP_APPLICATION_ROOTDIR;
if (NET2FTP_APPLICATION_ROOTDIR_URL == "/") { $net2ftp_globals["application_rootdir_url"] = ""; }
else { $net2ftp_globals["application_rootdir_url"] = NET2FTP_APPLICATION_ROOTDIR_URL; }
$net2ftp_globals["application_includesdir"] = $net2ftp_globals["application_rootdir"] . "/includes";
$net2ftp_globals["application_languagesdir"] = $net2ftp_globals["application_rootdir"] . "/languages";
$net2ftp_globals["application_modulesdir"] = $net2ftp_globals["application_rootdir"] . "/modules";
$net2ftp_globals["application_pluginsdir"] = $net2ftp_globals["application_rootdir"] . "/plugins";
$net2ftp_globals["application_skinsdir"] = $net2ftp_globals["application_rootdir"] . "/skins";
$net2ftp_globals["application_tempdir"] = $net2ftp_globals["application_rootdir"] . "/temp";
// -------------------------------------------------------------------------
// Set basic settings
// -------------------------------------------------------------------------
if ($action == "sendHttpHeaders") {
// Do not run the script to the end if the user hits the stop button
// ignore_user_abort();
// Execute function shutdown() if the script reaches the maximum execution time (usually 30 seconds)
// DON'T REGISTER IT HERE YET, as this causes errors on newer versions of PHP; first include the function libraries
// register_shutdown_function("net2ftp_shutdown");
// Set the error reporting level
// Note: the error reporting level is already set to none in index.xml.php, to avoid XML parsing errors
if (substr($_SERVER["PHP_SELF"], strlen($_SERVER["PHP_SELF"])-8, 8) == ".xml.php") { error_reporting(0); }
elseif ($net2ftp_settings["error_reporting"] == "ALL") { error_reporting(E_ALL); }
elseif ($net2ftp_settings["error_reporting"] == "NONE") { error_reporting(0); }
else { error_reporting(E_ERROR | E_WARNING | E_PARSE); }
// Timer: start
$net2ftp_globals["starttime"] = microtime();
$net2ftp_globals["endtime"] = microtime();
}
// Set default timezone
date_default_timezone_set("Europe/Paris");
// Set the PHP temporary directory
// putenv("TMPDIR=" . $net2ftp_globals["application_tempdir"]);
// -------------------------------------------------------------------------
// Function libraries:
// 1. Libraries which are always needed
// 2. Register global variables
// 3. Function libraries which are needed depending on certain variables
// // --> Do this only once, when $action == "sendHttpHeaders"
// -------------------------------------------------------------------------
if ($action == "sendHttpHeaders") {
// 1. Libraries which are always needed
require_once($net2ftp_globals["application_includesdir"] . "/authorizations.inc.php");
require_once($net2ftp_globals["application_includesdir"] . "/consumption.inc.php");
require_once($net2ftp_globals["application_includesdir"] . "/database.inc.php");
require_once($net2ftp_globals["application_includesdir"] . "/errorhandling.inc.php");
require_once($net2ftp_globals["application_includesdir"] . "/filesystem.inc.php");
require_once($net2ftp_globals["application_includesdir"] . "/html.inc.php");
require_once($net2ftp_globals["application_includesdir"] . "/StonePhpSafeCrypt.php");
require_once($net2ftp_globals["application_includesdir"] . "/logging.inc.php");
require_once($net2ftp_globals["application_languagesdir"] . "/languages.inc.php");
require_once($net2ftp_globals["application_skinsdir"] . "/skins.inc.php");
// 1. Define functions which are used, but which did not exist before PHP version 4.3.0
if (version_compare(phpversion(), "4.3.0", "<")) {
require_once($net2ftp_globals["application_includesdir"] . "/before430.inc.php");
}
// 2. Register global variables (POST, GET, GLOBAL, ...)
require_once($net2ftp_globals["application_includesdir"] . "/registerglobals.inc.php");
// 3. Function libraries which are needed depending on certain variables
if ($net2ftp_globals["state"] == "upload" || $net2ftp_globals["state"] == "unzip") {
require_once($net2ftp_globals["application_includesdir"] . "/pclerror.lib.php");
require_once($net2ftp_globals["application_includesdir"] . "/pcltar.lib.php");
require_once($net2ftp_globals["application_includesdir"] . "/pcltrace.lib.php");
require_once($net2ftp_globals["application_includesdir"] . "/pclzip.lib.php");
}
if ($net2ftp_globals["state"] == "advanced_ftpserver" || $net2ftp_globals["state"] == "advanced_parsing" ||
$net2ftp_globals["state"] == "advanced_webserver" || $net2ftp_globals["state"] == "browse" ||
$net2ftp_globals["state"] == "copymovedelete" || $net2ftp_globals["state"] == "chmod" ||
$net2ftp_globals["state"] == "calculatesize" || $net2ftp_globals["state"] == "downloadzip" ||
$net2ftp_globals["state"] == "findstring" || $net2ftp_globals["state"] == "followsymlink" ||
$net2ftp_globals["state"] == "install" || $net2ftp_globals["state"] == "zip") {
require_once($net2ftp_globals["application_includesdir"] . "/browse.inc.php");
}
if ($net2ftp_globals["state"] == "downloadzip" || $net2ftp_globals["state"] == "zip") {
require_once($net2ftp_globals["application_includesdir"] . "/zip.lib.php");
}
// 4. Load the plugins
require_once($net2ftp_globals["application_pluginsdir"] . "/plugins.inc.php");
$net2ftp_globals["activePlugins"] = getActivePlugins();
net2ftp_plugin_includePhpFiles();
// 5. Load the language file
includeLanguageFile();
}
// -------------------------------------------------------------------------
// Execute function shutdown() if the script reaches the maximum execution time (usually 30 seconds)
// -------------------------------------------------------------------------
if ($action == "sendHttpHeaders") {
register_shutdown_function("net2ftp_shutdown");
}
// -------------------------------------------------------------------------
// Log access and rotate logs
// --> Do this only once, when $action == "sendHttpHeaders"
// -------------------------------------------------------------------------
if ($action == "sendHttpHeaders") {
logAccess();
if ($net2ftp_result["success"] == false) {
logError();
return false;
}
rotateLogs();
if ($net2ftp_result["success"] == false) {
logError();
return false;
}
}
// -------------------------------------------------------------------------
// Check authorizations
// --> Do this only once, when $action == "sendHttpHeaders"
// -------------------------------------------------------------------------
if ($action == "sendHttpHeaders" && $net2ftp_settings["check_authorization"] == "yes" && $net2ftp_globals["ftpserver"] != "") {
checkAuthorization($net2ftp_globals["ftpserver"], $net2ftp_globals["ftpserverport"], $net2ftp_globals["directory"], $net2ftp_globals["username"]);
if ($net2ftp_result["success"] == false) {
logError();
return false;
}
}
// -------------------------------------------------------------------------
// Get the consumption counter values from the database
// This retrieves the consumption of network and server resources for the
// current IP address and FTP server from the database, and stores these
// values in global variables. See /includes/consumption.inc.php for the details.
// --> Do this only once, when $action == "sendHttpHeaders"
// -------------------------------------------------------------------------
if ($action == "sendHttpHeaders") {
getConsumption();
if ($net2ftp_result["success"] == false) {
logError();
return false;
}
}
// -------------------------------------------------------------------------
// Execute the action!
// -------------------------------------------------------------------------
// ------------------------------------
// For most modules, everything must be done: send headers, print body, etc
// ------------------------------------
if ($net2ftp_globals["state"] == "admin" ||
$net2ftp_globals["state"] == "admin_createtables" ||
$net2ftp_globals["state"] == "admin_emptylogs" ||
$net2ftp_globals["state"] == "admin_viewlogs" ||
$net2ftp_globals["state"] == "advanced" ||
$net2ftp_globals["state"] == "advanced_ftpserver" ||
$net2ftp_globals["state"] == "advanced_parsing" ||
$net2ftp_globals["state"] == "advanced_webserver" ||
$net2ftp_globals["state"] == "bookmark" ||
$net2ftp_globals["state"] == "browse" ||
$net2ftp_globals["state"] == "calculatesize" ||
$net2ftp_globals["state"] == "chmod" ||
$net2ftp_globals["state"] == "copymovedelete" ||
$net2ftp_globals["state"] == "edit" ||
$net2ftp_globals["state"] == "findstring" ||
$net2ftp_globals["state"] == "getcookies" ||
$net2ftp_globals["state"] == "install" ||
($net2ftp_globals["state"] == "jupload" && $net2ftp_globals["screen"] == 1) ||
$net2ftp_globals["state"] == "login" ||
$net2ftp_globals["state"] == "login_small" ||
$net2ftp_globals["state"] == "logout" ||
$net2ftp_globals["state"] == "newdir" ||
$net2ftp_globals["state"] == "raw" ||
$net2ftp_globals["state"] == "rename" ||
$net2ftp_globals["state"] == "unzip" ||
$net2ftp_globals["state"] == "upload" ||
($net2ftp_globals["state"] == "view" && $net2ftp_globals["state2"] == "") ||
$net2ftp_globals["state"] == "zip") {
require_once($net2ftp_globals["application_modulesdir"] . "/" . $net2ftp_globals["state"] . "/" . $net2ftp_globals["state"] . ".inc.php");
if ($action == "sendHttpHeaders") {
net2ftp_module_sendHttpHeaders();
// If needed, exit to avoid sending non-header output (by net2ftp or other application)
// Example: if a module sends a HTTP redirect header (See /includes/authorizations.inc.php function checkAdminUsernamePassword()!)
if ($net2ftp_result["exit"] == true) { exit(); }
}
elseif ($action == "printJavascript") {
net2ftp_module_printJavascript();
net2ftp_plugin_printJavascript();
net2ftp_skin_printJavascript();
}
elseif ($action == "printCss") {
net2ftp_module_printCss();
net2ftp_plugin_printCss();
net2ftp_skin_printCss();
}
elseif ($action == "printBodyOnload") {
net2ftp_module_printBodyOnload();
net2ftp_plugin_printBodyOnload();
}
elseif ($action == "printBody") {
// Print the status bar to be able to show the progress
if (isStatusbarActive() == true) {
require_once($net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/header.template.php");
}
require_once($net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/status/status.inc.php");
// Do the work and meanwhile update the progress bar
net2ftp_module_printBody();
// Update the consumption statistics
$net2ftp_globals["endtime"] = microtime();
$net2ftp_globals["time_taken"] = timer();
addConsumption(0, $net2ftp_globals["time_taken"]);
putConsumption();
// Set the progress bar to "finished"
if (isStatusbarActive() == true) {
$statusmessage = __("Script finished in %1\$s seconds", $net2ftp_globals["time_taken"]);
setStatus(1, 1, $statusmessage);
}
}
}
// ------------------------------------
// For some modules, only headers must be sent
// ------------------------------------
elseif ($net2ftp_globals["state"] == "clearcookies" ||
$net2ftp_globals["state"] == "downloadfile" ||
$net2ftp_globals["state"] == "downloadzip" ||
$net2ftp_globals["state"] == "followsymlink" ||
($net2ftp_globals["state"] == "jupload" && $net2ftp_globals["screen"] == 2) ||
($net2ftp_globals["state"] == "view" && $net2ftp_globals["state2"] != "")) {
require_once($net2ftp_globals["application_modulesdir"] . "/" . $net2ftp_globals["state"] . "/" . $net2ftp_globals["state"] . ".inc.php");
if ($action == "sendHttpHeaders") {
// Do the work - do not update the progress bar
net2ftp_module_sendHttpHeaders();
// Update the consumption statistics
$net2ftp_globals["endtime"] = microtime();
$net2ftp_globals["time_taken"] = timer();
addConsumption(0, $net2ftp_globals["time_taken"]);
putConsumption();
// Exit to avoid sending non-header output (by net2ftp or other application)
exit();
}
elseif ($action == "printJavascript") { }
elseif ($action == "printCss") { }
elseif ($action == "printBodyOnload") { }
elseif ($action == "printBody") { }
}
else {
$errormessage = __("Unexpected state string: %1\$s. Exiting.", $net2ftp_globals["state"]);
setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
logError();
return false;
}
// -------------------------------------------------------------------------
// Log errors
// -------------------------------------------------------------------------
if ($net2ftp_result["success"] == false) {
logError();
return false;
}
} // end function net2ftp_main
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function isStatusbarActive() {
// --------------
// This function returns if the status bar should be shown or not, depending
// on the state and state2 variables
// --------------
global $net2ftp_globals;
// If $net2ftp_globals["isStatusbarActive"] is not yet filled, calculate its value
// and fill it in
if (isset($net2ftp_globals["isStatusbarActive"]) == false) {
if ($net2ftp_globals["skin"] == "openlaszlo") { $net2ftp_globals["isStatusbarActive"] = false; }
elseif (
$net2ftp_globals["state"] == "admin" ||
$net2ftp_globals["state"] == "admin_createtables" ||
$net2ftp_globals["state"] == "admin_emptylogs" ||
$net2ftp_globals["state"] == "admin_viewlogs" ||
$net2ftp_globals["state"] == "advanced" ||
$net2ftp_globals["state"] == "advanced_ftpserver" ||
$net2ftp_globals["state"] == "advanced_parsing" ||
$net2ftp_globals["state"] == "advanced_webserver" ||
$net2ftp_globals["state"] == "bookmark" ||
($net2ftp_globals["state"] == "browse" && $net2ftp_globals["state2"] == "main") ||
$net2ftp_globals["state"] == "calculatesize" ||
$net2ftp_globals["state"] == "chmod" ||
$net2ftp_globals["state"] == "copymovedelete" ||
$net2ftp_globals["state"] == "easywebsite" ||
$net2ftp_globals["state"] == "findstring" ||
$net2ftp_globals["state"] == "install" ||
$net2ftp_globals["state"] == "jupload" ||
$net2ftp_globals["state"] == "newdir" ||
$net2ftp_globals["state"] == "newfile" ||
$net2ftp_globals["state"] == "raw" ||
$net2ftp_globals["state"] == "rename" ||
$net2ftp_globals["state"] == "unzip" ||
$net2ftp_globals["state"] == "updatefile" ||
$net2ftp_globals["state"] == "upload" ||
$net2ftp_globals["state"] == "view" ||
$net2ftp_globals["state"] == "zip") {
$net2ftp_globals["isStatusbarActive"] = true;
}
else {
$net2ftp_globals["isStatusbarActive"] = false;
}
}
// Return the value of $net2ftp_globals["isStatusbarActive"]
return $net2ftp_globals["isStatusbarActive"];
} // end function isStatusbarActive
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function stopwatch() {
// --------------
// This function prints the total time elapsed, and the time elapsed since the previous call
// --------------
global $net2ftp_globals;
// Now
list($now_usec, $now_sec) = explode(' ', microtime());
$now = ((float)$now_usec + (float)$now_sec);
// Initialization
if (isset($net2ftp_globals["stopwatch_starttime"]) == false) {
$net2ftp_globals["stopwatch_starttime"] = $now;
}
if (isset($net2ftp_globals["stopwatch_endtime"]) == false) {
$net2ftp_globals["stopwatch_endtime"] = $now;
}
// Total time elapsed = now - starttime
$total_elapsed = $now - $net2ftp_globals["stopwatch_starttime"];
$total_elapsed = number_format($total_elapsed, 4);
// Time since previous stopwatch = now - previous endtime
$delta_elapsed = $now - $net2ftp_globals["stopwatch_endtime"];
$delta_elapsed = number_format($delta_elapsed, 4);
// Set the new value for endtime
$net2ftp_globals["stopwatch_endtime"] = $now;
// Print $total_elapsed and $delta_elapsed
echo $total_elapsed . " - " . $delta_elapsed . "<br />\n";
} // End function stopwatch()
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
?>

View file

@ -1,132 +0,0 @@
<?php
// --------------------------------------------------------------------------------
// PhpConcept Library (PCL) Error 1.0
// --------------------------------------------------------------------------------
// License GNU/GPL - Vincent Blavet - Mars 2001
// http://www.phpconcept.net & http://phpconcept.free.fr
// --------------------------------------------------------------------------------
// Français :
// La description de l'usage de la librairie PCL Error 1.0 n'est pas encore
// disponible. Celle-ci n'est pour le moment distribuée qu'avec les
// développements applicatifs de PhpConcept.
// Une version indépendante sera bientot disponible sur http://www.phpconcept.net
//
// English :
// The PCL Error 1.0 library description is not available yet. This library is
// released only with PhpConcept application and libraries.
// An independant release will be soon available on http://www.phpconcept.net
//
// --------------------------------------------------------------------------------
//
// * Avertissement :
//
// Cette librairie a été créée de façon non professionnelle.
// Son usage est au risque et péril de celui qui l'utilise, en aucun cas l'auteur
// de ce code ne pourra être tenu pour responsable des éventuels dégats qu'il pourrait
// engendrer.
// Il est entendu cependant que l'auteur a réalisé ce code par plaisir et n'y a
// caché aucun virus, ni malveillance.
// Cette libairie est distribuée sous la license GNU/GPL (http://www.gnu.org)
//
// * Auteur :
//
// Ce code a été écrit par Vincent Blavet (vincent@blavet.net) sur son temps
// de loisir.
//
// --------------------------------------------------------------------------------
// ----- Look for double include
if (!defined("PCLERROR_LIB"))
{
define( "PCLERROR_LIB", 1 );
// ----- Version
$g_pcl_error_version = "1.0";
// ----- Internal variables
// These values must only be change by PclError library functions
$g_pcl_error_string = "";
$g_pcl_error_code = 1;
// --------------------------------------------------------------------------------
// Function : PclErrorLog()
// Description :
// Parameters :
// --------------------------------------------------------------------------------
function PclErrorLog($p_error_code=0, $p_error_string="")
{
global $g_pcl_error_string;
global $g_pcl_error_code;
$g_pcl_error_code = $p_error_code;
$g_pcl_error_string = $p_error_string;
}
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// Function : PclErrorFatal()
// Description :
// Parameters :
// --------------------------------------------------------------------------------
function PclErrorFatal($p_file, $p_line, $p_error_string="")
{
global $g_pcl_error_string;
global $g_pcl_error_code;
$v_message = "<html><body>";
$v_message .= "<p align=center><font color=red bgcolor=white><b>PclError Library has detected a fatal error on file '$p_file', line $p_line</b></font></p>";
$v_message .= "<p align=center><font color=red bgcolor=white><b>$p_error_string</b></font></p>";
$v_message .= "</body></html>";
die($v_message);
}
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// Function : PclErrorReset()
// Description :
// Parameters :
// --------------------------------------------------------------------------------
function PclErrorReset()
{
global $g_pcl_error_string;
global $g_pcl_error_code;
$g_pcl_error_code = 1;
$g_pcl_error_string = "";
}
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// Function : PclErrorCode()
// Description :
// Parameters :
// --------------------------------------------------------------------------------
function PclErrorCode()
{
global $g_pcl_error_string;
global $g_pcl_error_code;
return($g_pcl_error_code);
}
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// Function : PclErrorString()
// Description :
// Parameters :
// --------------------------------------------------------------------------------
function PclErrorString()
{
global $g_pcl_error_string;
global $g_pcl_error_code;
return($g_pcl_error_string." [code $g_pcl_error_code]");
}
// --------------------------------------------------------------------------------
// ----- End of double include look
}
?>

File diff suppressed because it is too large Load diff

View file

@ -1,735 +0,0 @@
<?php
// --------------------------------------------------------------------------------
// PhpConcept Library (PCL) Trace 2.0-beta1
// --------------------------------------------------------------------------------
// License GNU/GPL - Vincent Blavet - August 2003
// http://www.phpconcept.net
// --------------------------------------------------------------------------------
//
// The PCL Trace library description is not available yet.
// This library was first released only with PclZip library.
// An independant release will be soon available on http://www.phpconcept.net
//
// --------------------------------------------------------------------------------
//
// Warning :
// This library and the associated files are non commercial, non professional
// work.
// It should not have unexpected results. However if any damage is caused by
// this software the author can not be responsible.
// The use of this software is at the risk of the user.
//
// --------------------------------------------------------------------------------
// ----- Version
$g_pcltrace_version = "2.0-beta1";
// ----- Internal variables
// These values must be change by PclTrace library functions
$g_pcl_trace_mode = "memory";
$g_pcl_trace_filename = "trace.txt";
$g_pcl_trace_name = array();
$g_pcl_trace_index = 0;
$g_pcl_trace_level = 0;
$g_pcl_trace_suspend = false;
//$g_pcl_trace_entries = array();
// ----- For compatibility reason
define ('PCLTRACE_LIB', 1);
// --------------------------------------------------------------------------------
// Function : TrOn($p_level, $p_mode, $p_filename)
// Description :
// Parameters :
// $p_level : Trace level
// $p_mode : Mode of trace displaying :
// 'normal' : messages are displayed at function call
// 'memory' : messages are memorized in a table and can be display by
// TrDisplay() function. (default)
// 'log' : messages are writed in the file $p_filename
// --------------------------------------------------------------------------------
function PclTraceOn($p_level=1, $p_mode="memory", $p_filename="trace.txt")
{
TrOn($p_level, $p_mode, $p_filename);
}
function TrOn($p_level=1, $p_mode="memory", $p_filename="trace.txt")
{
global $g_pcl_trace_level;
global $g_pcl_trace_mode;
global $g_pcl_trace_filename;
global $g_pcl_trace_name;
global $g_pcl_trace_index;
global $g_pcl_trace_entries;
global $g_pcl_trace_suspend;
// ----- Enable trace mode
$g_pcl_trace_level = $p_level;
// ----- Memorize mode and filename
switch ($p_mode) {
case "normal" :
case "memory" :
case "log" :
$g_pcl_trace_mode = $p_mode;
break;
default :
$g_pcl_trace_mode = "logged";
}
// ----- Memorize filename
$g_pcl_trace_filename = $p_filename;
$g_pcl_trace_suspend = false;
}
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// Function : IsTrOn()
// Description :
// Return value :
// The trace level (0 for disable).
// --------------------------------------------------------------------------------
function PclTraceIsOn()
{
return IsTrOn();
}
function IsTrOn()
{
global $g_pcl_trace_level;
return($g_pcl_trace_level);
}
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// Function : TrOff()
// Description :
// Parameters :
// --------------------------------------------------------------------------------
function PclTraceOff()
{
TrOff();
}
function TrOff()
{
global $g_pcl_trace_level;
global $g_pcl_trace_mode;
global $g_pcl_trace_filename;
global $g_pcl_trace_name;
global $g_pcl_trace_index;
// ----- Clean
$g_pcl_trace_mode = "memory";
unset($g_pcl_trace_entries);
unset($g_pcl_trace_name);
unset($g_pcl_trace_index);
// ----- Switch off trace
$g_pcl_trace_level = 0;
}
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// Function : PclTraceSuspend()
// Description :
// Parameters :
// --------------------------------------------------------------------------------
function PclTraceSuspend()
{
global $g_pcl_trace_suspend;
$g_pcl_trace_suspend = true;
}
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// Function : PclTraceResume()
// Description :
// Parameters :
// --------------------------------------------------------------------------------
function PclTraceResume()
{
global $g_pcl_trace_suspend;
$g_pcl_trace_suspend = false;
}
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// Function : TrFctStart()
// Description :
// Just a trace function for debbugging purpose before I use a better tool !!!!
// Start and stop of this function is by $g_pcl_trace_level global variable.
// Parameters :
// $p_level : Level of trace required.
// --------------------------------------------------------------------------------
function PclTraceFctStart($p_file, $p_line, $p_name, $p_param="", $p_message="")
{
TrFctStart($p_file, $p_line, $p_name, $p_param, $p_message);
}
function TrFctStart($p_file, $p_line, $p_name, $p_param="", $p_message="")
{
global $g_pcl_trace_level;
global $g_pcl_trace_mode;
global $g_pcl_trace_filename;
global $g_pcl_trace_name;
global $g_pcl_trace_index;
global $g_pcl_trace_entries;
global $g_pcl_trace_suspend;
// ----- Look for disabled trace
if (($g_pcl_trace_level < 1) || ($g_pcl_trace_suspend))
return;
// ----- Add the function name in the list
if (!isset($g_pcl_trace_name))
$g_pcl_trace_name = $p_name;
else
$g_pcl_trace_name .= ",".$p_name;
// ----- Update the function entry
$i = sizeof($g_pcl_trace_entries);
$g_pcl_trace_entries[$i]['name'] = $p_name;
$g_pcl_trace_entries[$i]['param'] = $p_param;
$g_pcl_trace_entries[$i]['message'] = "";
$g_pcl_trace_entries[$i]['file'] = $p_file;
$g_pcl_trace_entries[$i]['line'] = $p_line;
$g_pcl_trace_entries[$i]['index'] = $g_pcl_trace_index;
$g_pcl_trace_entries[$i]['type'] = "1"; // means start of function
// ----- Update the message entry
if ($p_message != "")
{
$i = sizeof($g_pcl_trace_entries);
$g_pcl_trace_entries[$i]['name'] = "";
$g_pcl_trace_entries[$i]['param'] = "";
$g_pcl_trace_entries[$i]['message'] = $p_message;
$g_pcl_trace_entries[$i]['file'] = $p_file;
$g_pcl_trace_entries[$i]['line'] = $p_line;
$g_pcl_trace_entries[$i]['index'] = $g_pcl_trace_index;
$g_pcl_trace_entries[$i]['type'] = "3"; // means message
}
// ----- Action depending on mode
PclTraceAction($g_pcl_trace_entries[$i]);
// ----- Increment the index
$g_pcl_trace_index++;
}
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// Function : TrFctEnd()
// Description :
// Just a trace function for debbugging purpose before I use a better tool !!!!
// Start and stop of this function is by $g_pcl_trace_level global variable.
// Parameters :
// $p_level : Level of trace required.
// --------------------------------------------------------------------------------
function PclTraceFctEnd($p_file, $p_line, $p_return=1, $p_message="")
{
TrFctEnd($p_file, $p_line, $p_return, $p_message);
}
function TrFctEnd($p_file, $p_line, $p_return=1, $p_message="")
{
global $g_pcl_trace_level;
global $g_pcl_trace_mode;
global $g_pcl_trace_filename;
global $g_pcl_trace_name;
global $g_pcl_trace_index;
global $g_pcl_trace_entries;
global $g_pcl_trace_suspend;
// ----- Look for disabled trace
if (($g_pcl_trace_level < 1) || ($g_pcl_trace_suspend))
return;
// ----- Extract the function name in the list
// ----- Remove the function name in the list
if (!($v_name = strrchr($g_pcl_trace_name, ",")))
{
$v_name = $g_pcl_trace_name;
$g_pcl_trace_name = "";
}
else
{
$g_pcl_trace_name = substr($g_pcl_trace_name, 0, strlen($g_pcl_trace_name)-strlen($v_name));
$v_name = substr($v_name, -strlen($v_name)+1);
}
// ----- Decrement the index
$g_pcl_trace_index--;
// ----- Update the message entry
if ($p_message != "")
{
$i = sizeof($g_pcl_trace_entries);
$g_pcl_trace_entries[$i]['name'] = "";
$g_pcl_trace_entries[$i]['param'] = "";
$g_pcl_trace_entries[$i]['message'] = $p_message;
$g_pcl_trace_entries[$i]['file'] = $p_file;
$g_pcl_trace_entries[$i]['line'] = $p_line;
$g_pcl_trace_entries[$i]['index'] = $g_pcl_trace_index;
$g_pcl_trace_entries[$i]['type'] = "3"; // means message
}
// ----- Update the function entry
$i = sizeof($g_pcl_trace_entries);
$g_pcl_trace_entries[$i]['name'] = $v_name;
$g_pcl_trace_entries[$i]['param'] = $p_return;
$g_pcl_trace_entries[$i]['message'] = "";
$g_pcl_trace_entries[$i]['file'] = $p_file;
$g_pcl_trace_entries[$i]['line'] = $p_line;
$g_pcl_trace_entries[$i]['index'] = $g_pcl_trace_index;
$g_pcl_trace_entries[$i]['type'] = "2"; // means end of function
// ----- Action depending on mode
PclTraceAction($g_pcl_trace_entries[$i]);
}
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// Function : TrFctMessage()
// Description :
// Parameters :
// --------------------------------------------------------------------------------
function PclTraceFctMessage($p_file, $p_line, $p_level, $p_message="")
{
TrFctMessage($p_file, $p_line, $p_level, $p_message);
}
function TrFctMessage($p_file, $p_line, $p_level, $p_message="")
{
global $g_pcl_trace_level;
global $g_pcl_trace_mode;
global $g_pcl_trace_filename;
global $g_pcl_trace_name;
global $g_pcl_trace_index;
global $g_pcl_trace_entries;
global $g_pcl_trace_suspend;
// ----- Look for disabled trace
if (($g_pcl_trace_level < $p_level) || ($g_pcl_trace_suspend))
return;
// ----- Update the entry
$i = sizeof($g_pcl_trace_entries);
$g_pcl_trace_entries[$i]['name'] = "";
$g_pcl_trace_entries[$i]['param'] = "";
$g_pcl_trace_entries[$i]['message'] = $p_message;
$g_pcl_trace_entries[$i]['file'] = $p_file;
$g_pcl_trace_entries[$i]['line'] = $p_line;
$g_pcl_trace_entries[$i]['index'] = $g_pcl_trace_index;
$g_pcl_trace_entries[$i]['type'] = "3"; // means message of function
// ----- Action depending on mode
PclTraceAction($g_pcl_trace_entries[$i]);
}
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// Function : TrMessage()
// Description :
// Parameters :
// --------------------------------------------------------------------------------
function PclTraceMessage($p_file, $p_line, $p_level, $p_message="")
{
TrMessage($p_file, $p_line, $p_level, $p_message);
}
function TrMessage($p_file, $p_line, $p_level, $p_message="")
{
global $g_pcl_trace_level;
global $g_pcl_trace_mode;
global $g_pcl_trace_filename;
global $g_pcl_trace_name;
global $g_pcl_trace_index;
global $g_pcl_trace_entries;
global $g_pcl_trace_suspend;
// ----- Look for disabled trace
if (($g_pcl_trace_level < $p_level) || ($g_pcl_trace_suspend))
return;
// ----- Update the entry
$i = sizeof($g_pcl_trace_entries);
$g_pcl_trace_entries[$i]['name'] = "";
$g_pcl_trace_entries[$i]['param'] = "";
$g_pcl_trace_entries[$i]['message'] = $p_message;
$g_pcl_trace_entries[$i]['file'] = $p_file;
$g_pcl_trace_entries[$i]['line'] = $p_line;
$g_pcl_trace_entries[$i]['index'] = $g_pcl_trace_index;
$g_pcl_trace_entries[$i]['type'] = "4"; // means simple message
// ----- Action depending on mode
PclTraceAction($g_pcl_trace_entries[$i]);
}
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// Function : TrDisplay()
// Description :
// Parameters :
// --------------------------------------------------------------------------------
function PclTraceDisplay()
{
TrDisplay();
}
function TrDisplay()
{
global $g_pcl_trace_level;
global $g_pcl_trace_mode;
global $g_pcl_trace_filename;
global $g_pcl_trace_name;
global $g_pcl_trace_index;
global $g_pcl_trace_entries;
global $g_pcl_trace_suspend;
// ----- Look for disabled trace
if (($g_pcl_trace_level <= 0) || ($g_pcl_trace_mode != "memory") || ($g_pcl_trace_suspend))
return;
$v_font = "\"Verdana, Arial, Helvetica, sans-serif\"";
// ----- Trace Header
echo "<table width=100% border=0 cellspacing=0 cellpadding=0>";
echo "<tr bgcolor=#0000CC>";
echo "<td bgcolor=#0000CC width=1>";
echo "</td>";
echo "<td><div align=center><font size=3 color=#FFFFFF face=$v_font>Trace</font></div></td>";
echo "</tr>";
echo "<tr>";
echo "<td bgcolor=#0000CC width=1>";
echo "</td>";
echo "<td>";
// ----- Content header
echo "<table width=100% border=0 cellspacing=0 cellpadding=0>";
// ----- Display
$v_again=0;
for ($i=0; $i<sizeof($g_pcl_trace_entries); $i++)
{
// ---- Row header
echo "<tr>";
echo "<td><table width=100% border=0 cellspacing=0 cellpadding=0><tr>";
$n = ($g_pcl_trace_entries[$i]['index']+1)*10;
echo "<td width=".$n."><table width=100% border=0 cellspacing=0 cellpadding=0><tr>";
for ($j=0; $j<=$g_pcl_trace_entries[$i]['index']; $j++)
{
if ($j==$g_pcl_trace_entries[$i]['index'])
{
if (($g_pcl_trace_entries[$i]['type'] == 1) || ($g_pcl_trace_entries[$i]['type'] == 2))
echo "<td width=10><div align=center><font size=2 face=$v_font>+</font></div></td>";
}
else
echo "<td width=10><div align=center><font size=2 face=$v_font>|</font></div></td>";
}
//echo "<td>&nbsp</td>";
echo "</tr></table></td>";
echo "<td width=2></td>";
switch ($g_pcl_trace_entries[$i]['type']) {
case 1:
echo "<td><font size=2 face=$v_font>".$g_pcl_trace_entries[$i]['name']."(".$g_pcl_trace_entries[$i]['param'].")</font></td>";
break;
case 2:
echo "<td><font size=2 face=$v_font>".$g_pcl_trace_entries[$i]['name']."()=".$g_pcl_trace_entries[$i]['param']."</font></td>";
break;
case 3:
case 4:
echo "<td><table width=100% border=0 cellspacing=0 cellpadding=0><td width=20></td><td>";
echo "<font size=2 face=$v_font>".$g_pcl_trace_entries[$i]['message']."</font>";
echo "</td></table></td>";
break;
default:
echo "<td><font size=2 face=$v_font>".$g_pcl_trace_entries[$i]['name']."(".$g_pcl_trace_entries[$i]['param'].")</font></td>";
}
echo "</tr></table></td>";
echo "<td width=5></td>";
echo "<td><font size=1 face=$v_font>".basename($g_pcl_trace_entries[$i]['file'])."</font></td>";
echo "<td width=5></td>";
echo "<td><font size=1 face=$v_font>".$g_pcl_trace_entries[$i]['line']."</font></td>";
echo "</tr>";
}
// ----- Content footer
echo "</table>";
// ----- Trace footer
echo "</td>";
echo "<td bgcolor=#0000CC width=1>";
echo "</td>";
echo "</tr>";
echo "<tr bgcolor=#0000CC>";
echo "<td bgcolor=#0000CC width=1>";
echo "</td>";
echo "<td><div align=center><font color=#FFFFFF face=$v_font>&nbsp</font></div></td>";
echo "</tr>";
echo "</table>";
}
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// Function : TrDisplayNew()
// Description :
// Parameters :
// --------------------------------------------------------------------------------
function PclTraceDisplayNew()
{
global $g_pcl_trace_level;
global $g_pcl_trace_mode;
global $g_pcl_trace_filename;
global $g_pcl_trace_name;
global $g_pcl_trace_index;
global $g_pcl_trace_entries;
global $g_pcl_trace_suspend;
// ----- Look for disabled trace
if (($g_pcl_trace_level <= 0) || ($g_pcl_trace_mode != "memory") || ($g_pcl_trace_suspend))
return;
?>
<script language="javascript">
function PclTraceToggleView(element) {
if (element.style.visibility == 'visible') {
PclTraceHide(element);
} else {
PclTraceShow(element);
}
}
function PclTraceShow(element) {
element.style.visibility = 'visible';
element.style.position='relative';
}
function PclTraceHide(element) {
element.style.visibility = 'hidden';
element.style.position='absolute';
}
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0" bordercolor="#0000CC">
<tr>
<td bgcolor="#0000CC">
<div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF"><b>Trace</b></font></div>
</td>
</tr>
<tr>
<td>
<?php
$v_font = "\"Verdana, Arial, Helvetica, sans-serif\"";
// ----- Trace Header
// ----- Display the items
$v_again=0;
for ($i=0; $i<sizeof($g_pcl_trace_entries); $i++)
{
switch ($g_pcl_trace_entries[$i]['type']) {
case 1: // fct start
PclTraceDisplayItemStart($i);
break;
case 2: // fct stop
PclTraceDisplayItemStop($i);
break;
case 3: // fct msg
case 4: // msg
PclTraceDisplayItemMsg($i);
break;
default:
}
/*
echo "</tr></table></td>";
echo "<td width=5></td>";
echo "<td><font size=1 face=$v_font>".basename($g_pcl_trace_entries[$i]['file'])."</font></td>";
echo "<td width=5></td>";
echo "<td><font size=1 face=$v_font>".$g_pcl_trace_entries[$i]['line']."</font></td>";
echo "</tr>";
*/
}
// ----- Trace footer
?>
</td>
</tr>
<tr>
<td bgcolor="#0000CC">&nbsp;</td>
</tr>
</table>
<script language="javascript">
function PclTraceShowAll() {
<?php
for ($i=0; $i<sizeof($g_pcl_trace_entries); $i++) {
if ($g_pcl_trace_entries[$i]['type'] == 1) {
echo "PclTraceShow(document.getElementById('fct-".$i."'));";
}
}
?>
}
function PclTraceHideAll() {
<?php
for ($i=0; $i<sizeof($g_pcl_trace_entries); $i++) {
if ($g_pcl_trace_entries[$i]['type'] == 1) {
echo "PclTraceHide(document.getElementById('fct-".$i."'));";
}
}
?>
}
</script>
<form id="formulaire" action="POST">
<p>
<input type='button' value='Show All' onclick="PclTraceShowAll();"></input>
<input type='button' value='Hide All' onclick="PclTraceHideAll();"></input>
</p>
</form>
<?php
}
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// Function : TrDisplayNew()
// Description :
// Parameters :
// --------------------------------------------------------------------------------
function PclTraceDisplayItemStart($p_id)
{
global $g_pcl_trace_level;
global $g_pcl_trace_mode;
global $g_pcl_trace_filename;
global $g_pcl_trace_name;
global $g_pcl_trace_index;
global $g_pcl_trace_entries;
global $g_pcl_trace_suspend;
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="10"><font face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF"><b><font color="#000000" size="2">+</font></b></font></td>
<td style="width:2px;"></td>
<td><font face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF"><b><font color="#000000" size="2">
<a href="javascript:null();"
title="<?php echo 'File:'.basename($g_pcl_trace_entries[$p_id]['file'])." Line: ".$g_pcl_trace_entries[$p_id]['line'];?>"
onclick="PclTraceToggleView(document.getElementById('<?php echo 'fct-'.$p_id; ?>'));">
<?php echo $g_pcl_trace_entries[$p_id]['name']."(".$g_pcl_trace_entries[$p_id]['param'].")" ?>
</a></font></b></font></td>
</tr>
<tr id="<?php echo 'fct-'.$p_id; ?>" style="visibility:hidden;position:absolute;">
<td width="10">&nbsp;</td>
<td style="width:2px;" bgcolor="#0000CC"></td>
<td>
<?php
}
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// Function : TrDisplayNew()
// Description :
// Parameters :
// --------------------------------------------------------------------------------
function PclTraceDisplayItemStop($p_id)
{
global $g_pcl_trace_level;
global $g_pcl_trace_mode;
global $g_pcl_trace_filename;
global $g_pcl_trace_name;
global $g_pcl_trace_index;
global $g_pcl_trace_entries;
global $g_pcl_trace_suspend;
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><font face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF"><b><font color="#000000" size="2">
<?php echo $g_pcl_trace_entries[$p_id]['name']."()=".$g_pcl_trace_entries[$p_id]['param']; ?>
</font></b></font></td>
</tr>
</table>
</td>
</tr>
</table>
<?php
}
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// Function : TrDisplayNew()
// Description :
// Parameters :
// --------------------------------------------------------------------------------
function PclTraceDisplayItemMsg($p_id)
{
global $g_pcl_trace_level;
global $g_pcl_trace_mode;
global $g_pcl_trace_filename;
global $g_pcl_trace_name;
global $g_pcl_trace_index;
global $g_pcl_trace_entries;
global $g_pcl_trace_suspend;
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="10"><font face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF"><b><font color="#000000" size="2"><center>.</center></font></b></font></td>
<td style="width:2px;"></td>
<td><font face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF"><b><font color="#000000" size="2">
<?php echo $g_pcl_trace_entries[$p_id]['message'] ?>
</font></b></font></td>
<td width=5></td>
<td><font size=1 face="Verdana, Arial, Helvetica, sans-serif"><?php echo basename($g_pcl_trace_entries[$p_id]['file']); ?></font></td>
<td width=5></td>
<td><font size=1 face="Verdana, Arial, Helvetica, sans-serif"><?php echo $g_pcl_trace_entries[$p_id]['line']; ?></font></td>
</tr>
</table>
<?php
}
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// Function : PclTraceAction()
// Description :
// Parameters :
// --------------------------------------------------------------------------------
function PclTraceAction($p_entry)
{
global $g_pcl_trace_level;
global $g_pcl_trace_mode;
global $g_pcl_trace_filename;
global $g_pcl_trace_name;
global $g_pcl_trace_index;
global $g_pcl_trace_entries;
if ($g_pcl_trace_mode == "normal")
{
for ($i=0; $i<$p_entry['index']; $i++)
echo "---";
if ($p_entry['type'] == 1)
echo "<b>".$p_entry['name']."</b>(".$p_entry['param'].") : ".$p_entry['message']." [".$p_entry[file].", ".$p_entry[line]."]<br>";
else if ($p_entry['type'] == 2)
echo "<b>".$p_entry['name']."</b>()=".$p_entry['param']." : ".$p_entry['message']." [".$p_entry[file].", ".$p_entry[line]."]<br>";
else
echo $p_entry['message']." [".$p_entry['file'].", ".$p_entry['line']."]<br>";
}
}
// --------------------------------------------------------------------------------
?>

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,208 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
*
* @package PhpMyAdmin
*/
/**
* Zip file creation class.
* Makes zip files.
*
* @see Official ZIP file format: http://www.pkware.com/support/zip-app-note
*
* @access public
* @package PhpMyAdmin
*/
class zipfile
{
/**
* Whether to echo zip as it's built or return as string from -> file
*
* @var boolean $doWrite
*/
var $doWrite = false;
/**
* Array to store compressed data
*
* @var array $datasec
*/
var $datasec = array();
/**
* Central directory
*
* @var array $ctrl_dir
*/
var $ctrl_dir = array();
/**
* End of central directory record
*
* @var string $eof_ctrl_dir
*/
var $eof_ctrl_dir = "\x50\x4b\x05\x06\x00\x00\x00\x00";
/**
* Last offset position
*
* @var integer $old_offset
*/
var $old_offset = 0;
/**
* Sets member variable this -> doWrite to true
* - Should be called immediately after class instantiantion
* - If set to true, then ZIP archive are echo'ed to STDOUT as each
* file is added via this -> addfile(), and central directories are
* echoed to STDOUT on final call to this -> file(). Also,
* this -> file() returns an empty string so it is safe to issue a
* "echo $zipfile;" command
*
* @access public
*
* @return nothing
*/
function setDoWrite()
{
$this -> doWrite = true;
} // end of the 'setDoWrite()' method
/**
* Converts an Unix timestamp to a four byte DOS date and time format (date
* in high two bytes, time in low two bytes allowing magnitude comparison).
*
* @param integer $unixtime the current Unix timestamp
*
* @return integer the current date in a four byte DOS format
*
* @access private
*/
function unix2DosTime($unixtime = 0)
{
$timearray = ($unixtime == 0) ? getdate() : getdate($unixtime);
if ($timearray['year'] < 1980) {
$timearray['year'] = 1980;
$timearray['mon'] = 1;
$timearray['mday'] = 1;
$timearray['hours'] = 0;
$timearray['minutes'] = 0;
$timearray['seconds'] = 0;
} // end if
return (($timearray['year'] - 1980) << 25) | ($timearray['mon'] << 21) | ($timearray['mday'] << 16) |
($timearray['hours'] << 11) | ($timearray['minutes'] << 5) | ($timearray['seconds'] >> 1);
} // end of the 'unix2DosTime()' method
/**
* Adds "file" to archive
*
* @param string $data file contents
* @param string $name name of the file in the archive (may contains the path)
* @param integer $time the current timestamp
*
* @access public
*
* @return nothing
*/
function addFile($data, $name, $time = 0)
{
$name = str_replace('\\', '/', $name);
$dtime = substr("00000000" . dechex($this->unix2DosTime($time)), -8);
$hexdtime = '\x' . $dtime[6] . $dtime[7]
. '\x' . $dtime[4] . $dtime[5]
. '\x' . $dtime[2] . $dtime[3]
. '\x' . $dtime[0] . $dtime[1];
eval('$hexdtime = "' . $hexdtime . '";');
$fr = "\x50\x4b\x03\x04";
$fr .= "\x14\x00"; // ver needed to extract
$fr .= "\x00\x00"; // gen purpose bit flag
$fr .= "\x08\x00"; // compression method
$fr .= $hexdtime; // last mod time and date
// "local file header" segment
$unc_len = strlen($data);
$crc = crc32($data);
$zdata = gzcompress($data);
$zdata = substr(substr($zdata, 0, strlen($zdata) - 4), 2); // fix crc bug
$c_len = strlen($zdata);
$fr .= pack('V', $crc); // crc32
$fr .= pack('V', $c_len); // compressed filesize
$fr .= pack('V', $unc_len); // uncompressed filesize
$fr .= pack('v', strlen($name)); // length of filename
$fr .= pack('v', 0); // extra field length
$fr .= $name;
// "file data" segment
$fr .= $zdata;
// echo this entry on the fly, ...
if ( $this -> doWrite) {
echo $fr;
} else { // ... OR add this entry to array
$this -> datasec[] = $fr;
}
// now add to central directory record
$cdrec = "\x50\x4b\x01\x02";
$cdrec .= "\x00\x00"; // version made by
$cdrec .= "\x14\x00"; // version needed to extract
$cdrec .= "\x00\x00"; // gen purpose bit flag
$cdrec .= "\x08\x00"; // compression method
$cdrec .= $hexdtime; // last mod time & date
$cdrec .= pack('V', $crc); // crc32
$cdrec .= pack('V', $c_len); // compressed filesize
$cdrec .= pack('V', $unc_len); // uncompressed filesize
$cdrec .= pack('v', strlen($name)); // length of filename
$cdrec .= pack('v', 0); // extra field length
$cdrec .= pack('v', 0); // file comment length
$cdrec .= pack('v', 0); // disk number start
$cdrec .= pack('v', 0); // internal file attributes
$cdrec .= pack('V', 32); // external file attributes - 'archive' bit set
$cdrec .= pack('V', $this -> old_offset); // relative offset of local header
$this -> old_offset += strlen($fr);
$cdrec .= $name;
// optional extra field, file comment goes here
// save to central directory
$this -> ctrl_dir[] = $cdrec;
} // end of the 'addFile()' method
/**
* Echo central dir if ->doWrite==true, else build string to return
*
* @return string if ->doWrite {empty string} else the ZIP file contents
*
* @access public
*/
function file()
{
$ctrldir = implode('', $this -> ctrl_dir);
$header = $ctrldir .
$this -> eof_ctrl_dir .
pack('v', sizeof($this -> ctrl_dir)) . // total # of entries "on this disk"
pack('v', sizeof($this -> ctrl_dir)) . // total # of entries overall
pack('V', strlen($ctrldir)) . // size of central dir
pack('V', $this -> old_offset) . // offset to start of central dir
"\x00\x00"; // .zip file comment length
if ( $this -> doWrite ) { // Send central directory & end ctrl dir to STDOUT
echo $header;
return ""; // Return empty string
} else { // Return entire ZIP archive as string
$data = implode('', $this -> datasec);
return $data . $header;
}
} // end of the 'file()' method
} // end of the 'zipfile' class
?>

View file

@ -1,92 +0,0 @@
<?php
/* Hi,
Thanks for downloading net2ftp!
This page shows how to integrate net2ftp in a generic PHP page.
It is quite easy:
1. Define the constants NET2FTP_APPLICATION_ROOTDIR and NET2FTP_APPLICATION_ROOTDIR_URL
2. Include the file main.inc.php
3. Execute 5 net2ftp() calls to send the HTTP headers, print the Javascript
code, print the HTML body, etc...
4. Check if an error occured to print out an error message.
Look in /integration for more elaborate examples.
Enjoy,
David
*/
error_reporting(E_ERROR);
if(file_exists("includes/helpers.php")){
require_once("includes/helpers.php");
}else{
if(file_exists(__DIR__ . "/../../includes/helpers.php")){
require_once(__DIR__ . "/../../includes/helpers.php");
}
}
if(function_exists("startSession")){
startSession();
}else{
session_name("opengamepanel_web");
session_start();
}
$settings = $_SESSION['settings'];
// ------------------------------------------------------------------------
// 1. Define the constants NET2FTP_APPLICATION_ROOTDIR and NET2FTP_APPLICATION_ROOTDIR_URL
// ------------------------------------------------------------------------
$server_protocol = "http://";
// This is wrong
// if (isset($_SERVER["SERVER_PROTOCOL"]) == true && stripos($_SERVER["SERVER_PROTOCOL"], "https") !== false) { $server_protocol = "https://"; }
// Check HTTPS like this:
if (isset($_SERVER["HTTPS"]) && !empty($_SERVER["HTTPS"])) { $server_protocol = "https://"; }
$http_host = "";
if (isset($_SERVER["HTTP_HOST"]) == true) { $http_host = $_SERVER["HTTP_HOST"]; }
$script_name = "/index.php";
if (isset($_SERVER["SCRIPT_NAME"]) == true) { $script_name = dirname($_SERVER["SCRIPT_NAME"]); }
elseif (isset($_SERVER["PHP_SELF"]) == true) { $script_name = dirname($_SERVER["PHP_SELF"]); }
define("NET2FTP_APPLICATION_ROOTDIR", dirname(__FILE__));
define("NET2FTP_APPLICATION_ROOTDIR_URL", $server_protocol . $http_host . $script_name);
// ------------------------------------------------------------------------
// 2. Include the file /path/to/net2ftp/includes/main.inc.php
// ------------------------------------------------------------------------
require_once("./includes/main.inc.php");
// ------------------------------------------------------------------------
// 3. Execute net2ftp($action). Note that net2ftp("sendHttpHeaders") MUST
// be called once before the other net2ftp() calls!
// ------------------------------------------------------------------------
net2ftp("sendHttpHeaders");
if ($net2ftp_result["success"] == false) {
require_once("./skins/blue/error_wrapped.template.php");
exit();
}
?>
<!DOCTYPE html PUBLIC "XHTML 1.0 Transitional" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml:lang="<?php echo __("en"); ?>" dir="<?php echo __("ltr"); ?>">
<head>
<meta http-equiv="Content-type" content="text/html;charset=<?php echo __("iso-8859-1"); ?>" />
<?php net2ftp("printJavascript"); ?>
<?php net2ftp("printCss"); ?>
</head>
<body onload="<?php net2ftp("printBodyOnload"); ?>">
<?php net2ftp("printBody"); ?>
<?php
// ------------------------------------------------------------------------
// 4. Check the result and print out an error message. This can be done using
// a template, or by accessing the $net2ftp_result variable directly.
// ------------------------------------------------------------------------
if ($net2ftp_result["success"] == false) {
require_once($net2ftp_globals["application_rootdir"] . "/skins/" . $net2ftp_globals["skin"] . "/error.template.php");
}
?>
</body>
</html>

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,245 +0,0 @@
<?php
// -------------------------------------------------------------------------------
// | net2ftp: a web based FTP client |
// | Copyright (c) 2003-2013 by David Gartner |
// | |
// | 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. |
// | |
// -------------------------------------------------------------------------------
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function getLanguageArray() {
// --------------
// This function returns an array of languages
// Use the ISO 639 code described here: http://www.w3.org/WAI/ER/IG/ert/iso639.htm
// --------------
$languageArray["ar"]["name"] = "Arabic";
$languageArray["ar"]["file"] = "ar.inc.php";
$languageArray["ar-utf"]["name"] = "Arabic UTF-8";
$languageArray["ar-utf"]["file"] = "ar-utf.inc.php";
$languageArray["zh"]["name"] = "Simplified Chinese";
$languageArray["zh"]["file"] = "zh.inc.php";
$languageArray["tc"]["name"] = "Traditional Chinese";
$languageArray["tc"]["file"] = "tc.inc.php";
$languageArray["cs"]["name"] = "Czech";
$languageArray["cs"]["file"] = "cs.inc.php";
$languageArray["da"]["name"] = "Danish UTF-8";
$languageArray["da"]["file"] = "da-utf.inc.php";
$languageArray["nl"]["name"] = "Dutch";
$languageArray["nl"]["file"] = "nl.inc.php";
$languageArray["en"]["name"] = "English";
$languageArray["en"]["file"] = "en.inc.php";
$languageArray["en-utf"]["name"] = "English UTF-8";
$languageArray["en-utf"]["file"] = "en-utf.inc.php";
$languageArray["fr"]["name"] = "French";
$languageArray["fr"]["file"] = "fr.inc.php";
$languageArray["de"]["name"] = "German";
$languageArray["de"]["file"] = "de.inc.php";
$languageArray["fi"]["name"] = "Finnish";
$languageArray["fi"]["file"] = "fi.inc.php";
$languageArray["he"]["name"] = "Hebrew";
$languageArray["he"]["file"] = "he-utf.inc.php";
$languageArray["hu"]["name"] = "Hungarian";
$languageArray["hu"]["file"] = "hu.inc.php";
$languageArray["hu-utf"]["name"] = "Hungarian UTF-8";
$languageArray["hu-utf"]["file"] = "hu-utf.inc.php";
$languageArray["it"]["name"] = "Italian";
$languageArray["it"]["file"] = "it.inc.php";
$languageArray["ja"]["name"] = "Japanese";
$languageArray["ja"]["file"] = "ja.inc.php";
$languageArray["pl"]["name"] = "Polish";
$languageArray["pl"]["file"] = "pl.inc.php";
$languageArray["pt"]["name"] = "Portugese";
$languageArray["pt"]["file"] = "pt.inc.php";
$languageArray["ru"]["name"] = "Russian";
$languageArray["ru"]["file"] = "ru.inc.php";
$languageArray["es"]["name"] = "Spanish";
$languageArray["es"]["file"] = "es.inc.php";
$languageArray["sv"]["name"] = "Swedish";
$languageArray["sv"]["file"] = "sv.inc.php";
$languageArray["tr"]["name"] = "Turkish";
$languageArray["tr"]["file"] = "tr.inc.php";
$languageArray["ua"]["name"] = "Ukrainian";
$languageArray["ua"]["file"] = "ua.inc.php";
$languageArray["vi"]["name"] = "Vietnamese";
$languageArray["vi"]["file"] = "vi.inc.php";
return $languageArray;
} // End function getLanguageArray
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function printLanguageSelect($fieldname, $onchange, $style, $class) {
// --------------
// This function prints a select with the available languages
// Language nr 1 is the default language
// --------------
global $net2ftp_globals;
$languageArray = getLanguageArray();
if ($net2ftp_globals["language"] != "") { $currentlanguage = $net2ftp_globals["language"]; }
else { $currentlanguage = "en"; }
if ($onchange == "") { $onchange_full = ""; }
else { $onchange_full = "onchange=\"$onchange\""; }
if ($style == "") { $style_full = ""; }
else { $style_full = "style=\"$style\""; }
if ($class == "") { $class_full = ""; }
else { $class_full = "class=\"$class\""; }
echo "<select name=\"$fieldname\" id=\"$fieldname\" $onchange_full $style_full $class_full>\n";
while (list($key,$value) = each($languageArray)) {
// $key loops over "en", "fr", "nl", ...
// $value will be an array like $value["name"] = "English" and $value["file"] = "en.inc.php"
if ($key == $currentlanguage) { $selected = "selected=\"selected\""; }
else { $selected = ""; }
echo "<option value=\"" . $key . "\" $selected>" . $value["name"] . "</option>\n";
} // end while
echo "</select>\n";
} // End function printLanguageSelect
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function includeLanguageFile() {
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_globals, $net2ftp_messages;
$languageArray = getLanguageArray();
// If language exists, include the language file
if (array_key_exists($net2ftp_globals["language"], $languageArray) == true) {
$languageFile = glueDirectories($net2ftp_globals["application_languagesdir"], $languageArray[$net2ftp_globals["language"]]["file"]);
require_once($languageFile);
}
// If it does not exist, use the default language nr "en" (English)
else {
$net2ftp_globals["language"] = "en";
$languageFile = glueDirectories($net2ftp_globals["application_languagesdir"], $languageArray[$net2ftp_globals["language"]]["file"]);
require_once($languageFile);
}
} // end function includeLanguageFile
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function __() {
// --------------
// This function returns a translated message; the core standard function used is sprintf (see manual)
// Input: - from function argument: message name $args[0] and variable parts in the message $args[1], $args[2],...
// (there is a variable nr of variable parts)
// - from globals: the array of messages $message
// Output: string in the language indicated in $net2ftp_language
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_globals, $net2ftp_messages;
// -------------------------------------------------------------------------
// Get the arguments of this function
// $args[0] contains the messagename
// $args[1], $args[2], ... contain the variables in the message
// -------------------------------------------------------------------------
$numargs = func_num_args();
$args = func_get_args();
$messagename = $args[0];
// -------------------------------------------------------------------------
// Create the argument for the sprintf function
// Aim is to have something like: sprintf($string_with_percents, $args[1], $args[2], ...);
// As there is a variable nr of arguments in the function __, there is also a variable
// nr of arguments in sprintf, and this must be constructed with a loop
// -------------------------------------------------------------------------
// Check if the message with that $messagename exists
if (@array_key_exists($messagename, $net2ftp_messages)) { $string_with_percents = $net2ftp_messages[$messagename]; }
else { return "MESSAGE NOT FOUND $messagename"; }
$sprintf_argument = "\$translated_string = sprintf(\$string_with_percents";
for ($i=1; $i<$numargs; $i++) {
$sprintf_argument .= ", @htmlentities(\$args[$i], ENT_QUOTES)";
} // end for
$sprintf_argument .= ");";
// -------------------------------------------------------------------------
// Run the sprintf function
// -------------------------------------------------------------------------
eval($sprintf_argument);
return $translated_string;
} // end function __
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
?>

View file

@ -1,282 +0,0 @@
<?php
echo "This script is used for net2ftp development... nothing to see here! ;-)";
exit();
// -------------------------------------------------------------------------
// Settings
// -------------------------------------------------------------------------
$languagesArray[] = "ar";
$languagesArray[] = "ar-utf";
$languagesArray[] = "cs";
$languagesArray[] = "da-utf";
$languagesArray[] = "de";
$languagesArray[] = "en";
$languagesArray[] = "en-utf";
$languagesArray[] = "es";
$languagesArray[] = "fr";
$languagesArray[] = "fi";
$languagesArray[] = "he-utf";
$languagesArray[] = "it";
$languagesArray[] = "ja";
$languagesArray[] = "nl";
$languagesArray[] = "pl";
$languagesArray[] = "pt";
$languagesArray[] = "ru";
$languagesArray[] = "sv";
$languagesArray[] = "tc";
$languagesArray[] = "tr";
$languagesArray[] = "ua";
$languagesArray[] = "vi";
$languagesArray[] = "zh";
$directory_old = "";
$directory_new = "../languages-new";
$extension = ".inc.php";
// -------------------------------------------------------------------------
// LOOP: for all language files
// -------------------------------------------------------------------------
for ($i=0; $i<sizeof($languagesArray); $i++) {
// ------------------------------------
// Send status
// ------------------------------------
echo "Language $i - " . $languagesArray[$i] . "<br />\n";
flush();
// ------------------------------------
// Read the English file and get the lines
// ------------------------------------
$en_string = local_readfile($directory_old . "en" . $extension);
$en_lines = explode_lines($en_string);
// ------------------------------------
// Read the old translated file
// ------------------------------------
$translated_old_string = local_readfile($directory_old . $languagesArray[$i] . $extension);
$translated_old_lines = explode_lines($translated_old_string);
// $en_lines contains:
// [694] => $net2ftp_messages["Zip"] = "Zip";
// [695] => $net2ftp_messages["Size"] = "Size";
// [696] => $net2ftp_messages["Search"] = "Search";
// ------------------------------------
// Initialize the translated string
// ------------------------------------
$translated_new_string = "";
$translated_new_lines = array();
// -------------------------------------------------------------------------
// SUBLOOP: for all lines
// -------------------------------------------------------------------------
for ($j=1; $j<sizeof($en_lines); $j++) {
// ------------------------------------
// Send status
// ------------------------------------
if ($j % 20 == 0) {
echo "Language $i line $j <br />\n";
flush();
}
// ------------------------------------
// Real messages
// ------------------------------------
if (substr($en_lines[$j], 0, 1) == "$") {
// Find the position of the first = character
$equalsign_position = strpos($en_lines[$j], "] =");
if ($equalsign_position === false || $equalsign_position == false) {
echo "Language $i, line $j: Equal sign not found or at first position. String is " . $en_lines[$j] . ". Continuing.<br />\n";
$translated_new_lines[$j] = $en_lines[$j];
continue;
}
// Add 3 because we looked for "] =" instead of "="
else {
$equalsign_position = $equalsign_position + 3;
}
// Get the message "$n2f["abd"] ="
$message = substr($en_lines[$j], 0, $equalsign_position);
// Search for the translation
$translation = search_translation($message, $translated_old_lines);
// Debugging info
// echo "Language $i, line $j: message is $message, translation is $translation. <br />\n";
// If the translation is not found, use the English message
if ($translation == false) {
$translated_new_lines[$j] = $en_lines[$j];
}
// If the translation is found
else {
$translated_new_lines[$j] = "$message $translation";
}
} // end if
// ------------------------------------
// Comments and control structures
// ------------------------------------
else {
$translated_new_lines[$j] = $en_lines[$j];
} // end else
} // end for
// ------------------------------------
// Write the new translated string to a file
// ------------------------------------
//print_r($en_lines);
//print_r($translated_new_lines);
// Glue the array to a string
$translated_new_string = implode("\n", $translated_new_lines);
// Write the string to a file
local_writefile($directory_new . "/" . $languagesArray[$i] . $extension, $translated_new_string);
} // end for
// -------------------------------------------------------------------------
// Done
// -------------------------------------------------------------------------
echo "Done. <br />\n";
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function search_translation($message, $translated_old_lines) {
// --------------
// Search an array for a message
// --------------
// Go over all the lines of the old translated file
for ($k=0; $k<sizeof($translated_old_lines); $k++) {
if (substr($translated_old_lines[$k], 0, strlen($message)) == $message) {
$toreturn = substr($translated_old_lines[$k], strlen($message)+1);
return $toreturn;
}
}
// If nothing is found, return false
return false;
} // end search_translation
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function local_readfile($file) {
// --------------
// Open the local file $file and return its content as a string
// --------------
$handle = fopen($file, "rb"); // Open the file for reading only
if ($handle == false) { echo "Unable to execute fopen() in local_readfile. Exiting.<br />\n"; exit(); }
clearstatcache(); // for filesize
$filesize = filesize($file);
if ($filesize == 0) { return ""; }
$string = fread($handle, $filesize);
if ($string == false && filesize($file)>0) { echo "Unable to execute fread() in local_readfile. Exiting.<br />\n"; exit(); }
$success3 = fclose($handle);
if ($success3 == false) { echo "Unable to execute fclose() in local_readfile. Exiting.<br />\n"; exit(); }
return $string;
} // end local_readfile
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function local_writefile($file, $string) {
// --------------
// Open the local file $file and write the $string to it
// --------------
$handle = fopen($file, "wb");
if ($handle == false) { echo "Unable to execute fopen() in local_writefile. Exiting.<br />\n"; exit(); }
$success1 = fwrite($handle, $string);
if ($success1 == false && strlen($string)>0) { echo "Unable to execute fwrite() in local_writefile. Exiting.<br />\n"; exit(); }
$success2 = fclose($handle);
if ($success2 == false) { echo "Unable to execute fclose() in local_writefile. Exiting.<br />\n"; exit(); }
} // end local_writefile
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function explode_lines($string) {
// --------------
// Input: $string which may have Windows or Unix end-of-line characters
// Output: $lines array with the lines
// --------------
// $string = standardize_eol($string);
// Add a \n in the beginning of the strings so that the first line of the string would
// be in the first element of the exploded array
$lines = explode("\n", "\n" . $string);
return $lines;
} // explode_lines
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
?>

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,493 +0,0 @@
<?php
// -------------------------------------------------------------------------------
// | net2ftp: a web based FTP client |
// | Copyright (c) 2003-2008 by David Gartner |
// | |
// | 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 |
// | |
// -------------------------------------------------------------------------------
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp($action) {
// --------------
// This function is the main net2ftp function; it is the interface between 3rd party
// scripts (CMS, control panels, etc), and the internal net2ftp modules and plugins.
//
// This function is called 5 times per pageload: to send the HTTP headers, to print
// the javascript code, to print the CSS code, to print the body onload actions and
// finally to print the body content.
// --------------
// -------------------------------------------------------------------------
// Check that "sendHttpHeaders" action is only executed once
// Check that no other actions can be executed if "sendHttpHeaders" has not yet been executed
// -------------------------------------------------------------------------
if ($action == "sendHttpHeaders") {
if (defined("NET2FTP_SENDHTTPHEADERS") == true) { echo "Error: please call the net2ftp(\$action) function only once with \$action = \"sendHttpHeaders\"!"; return false; }
else { define("NET2FTP_SENDHTTPHEADERS", 1); }
}
else {
if (defined("NET2FTP_SENDHTTPHEADERS") == false) { echo "Error: please call the net2ftp(\$action) function first with \$action = \"sendHttpHeaders\"!"; return false; }
}
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_settings, $net2ftp_globals, $net2ftp_result, $net2ftp_messages;
// Set the NET2FTP constant which is used to check if template files are called by net2ftp
if (defined("NET2FTP") == false) { define("NET2FTP", 1); }
// Initialize the global variables
if ($action == "sendHttpHeaders") {
$net2ftp_globals = array();
$net2ftp_messages = array();
$net2ftp_output = array();
$net2ftp_result["success"] = true;
$net2ftp_result["errormessage"] = "";
$net2ftp_result["debug_backtrace"] = "";
$net2ftp_result["exit"] = false;
$net2ftp_settings = array();
}
// -------------------------------------------------------------------------
// If an error occured during a previous execution of net2ftp(), return false
// and let index.php print the error message
// -------------------------------------------------------------------------
if ($net2ftp_result["success"] == false) { return false; }
// -------------------------------------------------------------------------
// Input checks
// -------------------------------------------------------------------------
if ($action != "sendHttpHeaders" && $action != "printJavascript" && $action != "printCss" && $action != "printBodyOnload" && $action != "printBody") {
$net2ftp_result["success"] = false;
$net2ftp_result["errormessage"] = "The \$action variable has an unknown value: $action.";
$net2ftp_result["debug_backtrace"] = debug_backtrace();
logError();
return false;
}
// -------------------------------------------------------------------------
// Read settings files
// -------------------------------------------------------------------------
if ($action == "sendHttpHeaders") {
require(NET2FTP_APPLICATION_ROOTDIR . "/settings.inc.php");
require(NET2FTP_APPLICATION_ROOTDIR . "/settings_authorizations.inc.php");
require(NET2FTP_APPLICATION_ROOTDIR . "/settings_screens.inc.php");
}
// -------------------------------------------------------------------------
// Main directories
// -------------------------------------------------------------------------
$net2ftp_globals["application_rootdir"] = NET2FTP_APPLICATION_ROOTDIR;
if (NET2FTP_APPLICATION_ROOTDIR_URL == "/") { $net2ftp_globals["application_rootdir_url"] = ""; }
else { $net2ftp_globals["application_rootdir_url"] = NET2FTP_APPLICATION_ROOTDIR_URL; }
$net2ftp_globals["application_includesdir"] = $net2ftp_globals["application_rootdir"] . "/includes";
$net2ftp_globals["application_languagesdir"] = $net2ftp_globals["application_rootdir"] . "/languages";
$net2ftp_globals["application_modulesdir"] = $net2ftp_globals["application_rootdir"] . "/modules";
$net2ftp_globals["application_pluginsdir"] = $net2ftp_globals["application_rootdir"] . "/plugins";
$net2ftp_globals["application_skinsdir"] = $net2ftp_globals["application_rootdir"] . "/skins";
$net2ftp_globals["application_tempdir"] = $net2ftp_globals["application_rootdir"] . "/temp";
// -------------------------------------------------------------------------
// Set basic settings
// -------------------------------------------------------------------------
if ($action == "sendHttpHeaders") {
// Run the script to the end, even if the user hits the stop button
ignore_user_abort();
// Execute function shutdown() if the script reaches the maximum execution time (usually 30 seconds)
// DON'T REGISTER IT HERE YET, as this causes errors on newer versions of PHP; first include the function libraries
// register_shutdown_function("net2ftp_shutdown");
// Set the error reporting level
if ($net2ftp_settings["error_reporting"] == "ALL") { error_reporting(E_ALL); }
elseif ($net2ftp_settings["error_reporting"] == "NONE") { error_reporting(0); }
else { error_reporting(E_ERROR | E_WARNING | E_PARSE); }
// Timer: start
$net2ftp_globals["starttime"] = microtime();
$net2ftp_globals["endtime"] = microtime();
}
// Set the PHP temporary directory
// putenv("TMPDIR=" . $net2ftp_globals["application_tempdir"]);
// -------------------------------------------------------------------------
// Function libraries:
// 1. Libraries which are always needed
// 2. Register global variables
// 3. Function libraries which are needed depending on certain variables
// // --> Do this only once, when $action == "sendHttpHeaders"
// -------------------------------------------------------------------------
if ($action == "sendHttpHeaders") {
// 1. Libraries which are always needed
require_once($net2ftp_globals["application_includesdir"] . "/authorizations.inc.php");
require_once($net2ftp_globals["application_includesdir"] . "/consumption.inc.php");
require_once($net2ftp_globals["application_includesdir"] . "/database.inc.php");
require_once($net2ftp_globals["application_includesdir"] . "/errorhandling.inc.php");
require_once($net2ftp_globals["application_includesdir"] . "/filesystem.inc.php");
require_once($net2ftp_globals["application_includesdir"] . "/html.inc.php");
require_once($net2ftp_globals["application_includesdir"] . "/StonePhpSafeCrypt.php");
require_once($net2ftp_globals["application_languagesdir"] . "/languages.inc.php");
require_once($net2ftp_globals["application_skinsdir"] . "/skins.inc.php");
// 1. Define functions which are used, but which did not exist before PHP version 4.3.0
if (version_compare(phpversion(), "4.3.0", "<")) {
require_once($net2ftp_globals["application_includesdir"] . "/before430.inc.php");
}
// 2. Register global variables (POST, GET, GLOBAL, ...)
require_once($net2ftp_globals["application_includesdir"] . "/registerglobals.inc.php");
// 3. Function libraries which are needed depending on certain variables
if ($net2ftp_globals["state"] == "upload" || $net2ftp_globals["state"] == "unzip") {
require_once($net2ftp_globals["application_includesdir"] . "/pclerror.lib.php");
require_once($net2ftp_globals["application_includesdir"] . "/pcltar.lib.php");
require_once($net2ftp_globals["application_includesdir"] . "/pcltrace.lib.php");
require_once($net2ftp_globals["application_includesdir"] . "/pclzip.lib.php");
}
if ($net2ftp_globals["state"] == "advanced_ftpserver" || $net2ftp_globals["state"] == "advanced_parsing" ||
$net2ftp_globals["state"] == "advanced_webserver" || $net2ftp_globals["state"] == "browse" ||
$net2ftp_globals["state"] == "copymovedelete" || $net2ftp_globals["state"] == "chmod" ||
$net2ftp_globals["state"] == "calculatesize" || $net2ftp_globals["state"] == "downloadzip" ||
$net2ftp_globals["state"] == "findstring" || $net2ftp_globals["state"] == "followsymlink" ||
$net2ftp_globals["state"] == "install" || $net2ftp_globals["state"] == "zip") {
require_once($net2ftp_globals["application_includesdir"] . "/browse.inc.php");
}
if ($net2ftp_globals["state"] == "downloadzip" || $net2ftp_globals["state"] == "zip") {
require_once($net2ftp_globals["application_includesdir"] . "/zip.lib.php");
}
// 4. Load the plugins
require_once($net2ftp_globals["application_pluginsdir"] . "/plugins.inc.php");
$net2ftp_globals["activePlugins"] = getActivePlugins();
net2ftp_plugin_includePhpFiles();
// 5. Load the language file
includeLanguageFile();
}
// -------------------------------------------------------------------------
// Execute function shutdown() if the script reaches the maximum execution time (usually 30 seconds)
// -------------------------------------------------------------------------
if ($action == "sendHttpHeaders") {
register_shutdown_function("net2ftp_shutdown");
}
// -------------------------------------------------------------------------
// Log access
// --> Do this only once, when $action == "sendHttpHeaders"
// -------------------------------------------------------------------------
if ($action == "sendHttpHeaders") {
logAccess();
if ($net2ftp_result["success"] == false) {
logError();
return false;
}
}
// -------------------------------------------------------------------------
// Check authorizations
// --> Do this only once, when $action == "sendHttpHeaders"
// -------------------------------------------------------------------------
if ($action == "sendHttpHeaders" && $net2ftp_settings["check_authorization"] == "yes" && $net2ftp_globals["ftpserver"] != "") {
checkAuthorization($net2ftp_globals["ftpserver"], $net2ftp_globals["ftpserverport"], $net2ftp_globals["directory"], $net2ftp_globals["username"]);
if ($net2ftp_result["success"] == false) {
logError();
return false;
}
}
// -------------------------------------------------------------------------
// Get the consumption counter values from the database
// This retrieves the consumption of network and server resources for the
// current IP address and FTP server from the database, and stores these
// values in global variables. See /includes/consumption.inc.php for the details.
// --> Do this only once, when $action == "sendHttpHeaders"
// -------------------------------------------------------------------------
if ($action == "sendHttpHeaders") {
getConsumption();
if ($net2ftp_result["success"] == false) {
logError();
return false;
}
}
// -------------------------------------------------------------------------
// Execute the action!
// -------------------------------------------------------------------------
// ------------------------------------
// For most modules, everything must be done: send headers, print body, etc
// ------------------------------------
if ($net2ftp_globals["state"] == "admin" ||
$net2ftp_globals["state"] == "admin_createtables" ||
$net2ftp_globals["state"] == "admin_emptylogs" ||
$net2ftp_globals["state"] == "admin_viewlogs" ||
$net2ftp_globals["state"] == "advanced" ||
$net2ftp_globals["state"] == "advanced_ftpserver" ||
$net2ftp_globals["state"] == "advanced_parsing" ||
$net2ftp_globals["state"] == "advanced_webserver" ||
$net2ftp_globals["state"] == "bookmark" ||
$net2ftp_globals["state"] == "browse" ||
$net2ftp_globals["state"] == "calculatesize" ||
$net2ftp_globals["state"] == "chmod" ||
$net2ftp_globals["state"] == "copymovedelete" ||
$net2ftp_globals["state"] == "edit" ||
$net2ftp_globals["state"] == "findstring" ||
$net2ftp_globals["state"] == "install" ||
($net2ftp_globals["state"] == "jupload" && $net2ftp_globals["screen"] == 1) ||
$net2ftp_globals["state"] == "login" ||
$net2ftp_globals["state"] == "login_small" ||
$net2ftp_globals["state"] == "logout" ||
$net2ftp_globals["state"] == "newdir" ||
$net2ftp_globals["state"] == "raw" ||
$net2ftp_globals["state"] == "rename" ||
$net2ftp_globals["state"] == "unzip" ||
$net2ftp_globals["state"] == "upload" ||
($net2ftp_globals["state"] == "view" && $net2ftp_globals["state2"] == "") ||
$net2ftp_globals["state"] == "zip") {
require_once($net2ftp_globals["application_modulesdir"] . "/" . $net2ftp_globals["state"] . "/" . $net2ftp_globals["state"] . ".inc.php");
if ($action == "sendHttpHeaders") {
net2ftp_module_sendHttpHeaders();
// If needed, exit to avoid sending non-header output (by net2ftp or other application)
// Example: if a module sends a HTTP redirect header (See /includes/authorizations.inc.php function checkAdminUsernamePassword()!)
if ($net2ftp_result["exit"] == true) { exit(); }
}
elseif ($action == "printJavascript") {
net2ftp_module_printJavascript();
net2ftp_plugin_printJavascript();
}
elseif ($action == "printCss") {
net2ftp_module_printCss();
net2ftp_plugin_printCss();
}
elseif ($action == "printBodyOnload") {
net2ftp_module_printBodyOnload();
net2ftp_plugin_printBodyOnload();
}
elseif ($action == "printBody") {
// Print the status bar to be able to show the progress
if (isStatusbarActive() == true) {
require_once($net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/statusbar.template.php");
}
require_once($net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/status/status.inc.php");
// Do the work and meanwhile update the progress bar
net2ftp_module_printBody();
// Update the consumption statistics
$net2ftp_globals["endtime"] = microtime();
$net2ftp_globals["time_taken"] = timer();
addConsumption(0, $net2ftp_globals["time_taken"]);
putConsumption();
// Set the progress bar to "finished"
if (isStatusbarActive() == true) {
$statusmessage = __("Script finished in %1\$s seconds", $net2ftp_globals["time_taken"]);
setStatus(1, 1, $statusmessage);
}
}
}
// ------------------------------------
// For some modules, only headers must be sent
// ------------------------------------
elseif ($net2ftp_globals["state"] == "clearcookies" ||
$net2ftp_globals["state"] == "downloadfile" ||
$net2ftp_globals["state"] == "downloadzip" ||
$net2ftp_globals["state"] == "followsymlink" ||
($net2ftp_globals["state"] == "jupload" && $net2ftp_globals["screen"] == 2) ||
($net2ftp_globals["state"] == "view" && $net2ftp_globals["state2"] != "")) {
require_once($net2ftp_globals["application_modulesdir"] . "/" . $net2ftp_globals["state"] . "/" . $net2ftp_globals["state"] . ".inc.php");
if ($action == "sendHttpHeaders") {
// Do the work - do not update the progress bar
net2ftp_module_sendHttpHeaders();
// Update the consumption statistics
$net2ftp_globals["endtime"] = microtime();
$net2ftp_globals["time_taken"] = timer();
addConsumption(0, $net2ftp_globals["time_taken"]);
putConsumption();
// Exit to avoid sending non-header output (by net2ftp or other application)
exit();
}
elseif ($action == "printJavascript") { }
elseif ($action == "printCss") { }
elseif ($action == "printBodyOnload") { }
elseif ($action == "printBody") { }
}
elseif ($net2ftp_globals["state"] == "error") {
logError();
return false;
}
else {
$errormessage = __("Unexpected state string: %1\$s. Exiting.", $net2ftp_globals["state"]);
setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
logError();
return false;
}
} // end function net2ftp_main
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function isStatusbarActive() {
// --------------
// This function returns if the status bar should be shown or not, depending
// on the state and state2 variables
// --------------
global $net2ftp_globals;
// If $net2ftp_globals["isStatusbarActive"] is not yet filled, calculate its value
// and fill it in
if (isset($net2ftp_globals["isStatusbarActive"]) == false) {
if ($net2ftp_globals["skin"] == "openlaszlo") { $net2ftp_globals["isStatusbarActive"] = false; }
elseif (
$net2ftp_globals["state"] == "admin" ||
$net2ftp_globals["state"] == "admin_createtables" ||
$net2ftp_globals["state"] == "admin_emptylogs" ||
$net2ftp_globals["state"] == "admin_viewlogs" ||
$net2ftp_globals["state"] == "advanced" ||
$net2ftp_globals["state"] == "advanced_ftpserver" ||
$net2ftp_globals["state"] == "advanced_parsing" ||
$net2ftp_globals["state"] == "advanced_webserver" ||
$net2ftp_globals["state"] == "bookmark" ||
($net2ftp_globals["state"] == "browse" && $net2ftp_globals["state2"] == "main") ||
$net2ftp_globals["state"] == "calculatesize" ||
$net2ftp_globals["state"] == "chmod" ||
$net2ftp_globals["state"] == "copymovedelete" ||
$net2ftp_globals["state"] == "easywebsite" ||
$net2ftp_globals["state"] == "findstring" ||
$net2ftp_globals["state"] == "install" ||
$net2ftp_globals["state"] == "jupload" ||
$net2ftp_globals["state"] == "newdir" ||
$net2ftp_globals["state"] == "newfile" ||
$net2ftp_globals["state"] == "raw" ||
$net2ftp_globals["state"] == "rename" ||
$net2ftp_globals["state"] == "unzip" ||
$net2ftp_globals["state"] == "updatefile" ||
$net2ftp_globals["state"] == "upload" ||
$net2ftp_globals["state"] == "view" ||
$net2ftp_globals["state"] == "zip") {
$net2ftp_globals["isStatusbarActive"] = true;
}
else {
$net2ftp_globals["isStatusbarActive"] = false;
}
}
// Return the value of $net2ftp_globals["isStatusbarActive"]
return $net2ftp_globals["isStatusbarActive"];
} // end function isStatusbarActive
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function stopwatch() {
// --------------
// This function prints the total time elapsed, and the time elapsed since the previous call
// --------------
global $net2ftp_globals;
// Now
list($now_usec, $now_sec) = explode(' ', microtime());
$now = ((float)$now_usec + (float)$now_sec);
// Initialization
if (isset($net2ftp_globals["stopwatch_starttime"]) == false) {
$net2ftp_globals["stopwatch_starttime"] = $now;
}
if (isset($net2ftp_globals["stopwatch_endtime"]) == false) {
$net2ftp_globals["stopwatch_endtime"] = $now;
}
// Total time elapsed = now - starttime
$total_elapsed = $now - $net2ftp_globals["stopwatch_starttime"];
$total_elapsed = number_format($total_elapsed, 4);
// Time since previous stopwatch = now - previous endtime
$delta_elapsed = $now - $net2ftp_globals["stopwatch_endtime"];
$delta_elapsed = number_format($delta_elapsed, 4);
// Set the new value for endtime
$net2ftp_globals["stopwatch_endtime"] = $now;
// Print $total_elapsed and $delta_elapsed
echo $total_elapsed . " - " . $delta_elapsed . "<br />\n";
} // End function stopwatch()
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
?>

View file

@ -1,32 +0,0 @@
<?php
/*
*
* OGP - Open Game Panel
* Copyright (C) 2008 - 2018 The OGP Development Team
*
* http://www.opengamepanel.org/
*
* 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 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.
*
*/
// Module general information
$module_title = "ftp";
$module_version = "1.41";
$db_version = 1;
$module_required = TRUE;
$module_menus = array( array( 'subpage' => 'ftp_admin', 'name'=>'FTP Admin', 'group'=>'admin' ) );
$module_access_rights = array('t' => 'allow_ftp');
?>

View file

@ -1,189 +0,0 @@
<?php
// -------------------------------------------------------------------------------
// | net2ftp: a web based FTP client |
// | Copyright (c) 2003-2013 by David Gartner |
// | |
// | 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. |
// | |
// -------------------------------------------------------------------------------
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_sendHttpHeaders() {
// --------------
// This function sends HTTP headers
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
// -------------------------------------------------------------------------
// Check Admin username and password
// Redirect to the login_small page if needed
// -------------------------------------------------------------------------
checkAdminUsernamePassword();
// -------------------------------------------------------------------------
// Send XHTML header
// -------------------------------------------------------------------------
// header("Content-type: application/xhtml+xml; charset=" . __("iso-8859-1"));
} // end net2ftp_sendHttpHeaders
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printJavascript() {
// --------------
// This function prints Javascript code and includes
// --------------
// global $net2ftp_settings, $net2ftp_globals;
// Code
// echo "<script type=\"text/javascript\"><!--\n";
// echo "//--></script>\n";
// Include
// echo "<script type=\"text/javascript\" src=\"". $net2ftp_globals["application_rootdir_url"] . "/modules/login/login.js\"></script>\n";
} // end net2ftp_printJavascript
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printCss() {
// --------------
// This function prints CSS code and includes
// --------------
global $net2ftp_settings, $net2ftp_globals;
// Include
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"". $net2ftp_globals["application_rootdir_url"] . "/skins/" . $net2ftp_globals["skin"] . "/css/main.css.php?ltr=" . __("ltr") . "&amp;image_url=" . urlEncode2($net2ftp_globals["image_url"]) . "\" />\n";
} // end net2ftp_printCssInclude
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printBodyOnload() {
// --------------
// This function prints the <body onload="" actions
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
// echo "";
} // end net2ftp_printBodyOnload
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printBody() {
// --------------
// This function prints the login screen
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
if (isset($_POST["input_admin_username"]) == true) { $input_admin_username = htmlEncode2(validateGenericInput($_POST["input_admin_username"])); }
else { $input_admin_username = ""; }
if (isset($_POST["input_admin_password"]) == true) { $input_admin_password = htmlEncode2(validateGenericInput($_POST["input_admin_password"])); }
else { $input_admin_password = ""; }
// -------------------------------------------------------------------------
// Variables
// -------------------------------------------------------------------------
// Title
$title = __("Admin functions");
// Form name, back and forward buttons
$formname = "AdminForm";
$back_onclick = "document.forms['" . $formname . "'].state.value='login';document.forms['" . $formname . "'].submit();";
// Current build number
$application_build_nr = $net2ftp_settings["application_build_nr"];
// Date from and to
$today = date("Y-m-d");
$oneweekago = date("Y-m-d", time() - 3600*24*7);
$datefrom = $oneweekago;
$dateto = $today;
// -------------------------------------------------------------------------
// Print the output
// -------------------------------------------------------------------------
require_once($net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php");
} // End net2ftp_printBody
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
?>

View file

@ -1,264 +0,0 @@
<?php
// -------------------------------------------------------------------------------
// | net2ftp: a web based FTP client |
// | Copyright (c) 2003-2013 by David Gartner |
// | |
// | 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. |
// | |
// -------------------------------------------------------------------------------
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_sendHttpHeaders() {
// --------------
// This function sends HTTP headers
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
// -------------------------------------------------------------------------
// Check Admin username and password
// Redirect to the login_small page if needed
// -------------------------------------------------------------------------
checkAdminUsernamePassword();
} // end net2ftp_sendHttpHeaders
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printJavascript() {
// --------------
// This function prints Javascript code and includes
// --------------
// global $net2ftp_settings, $net2ftp_globals;
// Code
// echo "<script type=\"text/javascript\"><!--\n";
// echo "//--></script>\n";
// Include
// echo "<script type=\"text/javascript\" src=\"". $net2ftp_globals["application_rootdir_url"] . "/modules/login/login.js\"></script>\n";
} // end net2ftp_printJavascript
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printCss() {
// --------------
// This function prints CSS code and includes
// --------------
global $net2ftp_settings, $net2ftp_globals;
// Include
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"". $net2ftp_globals["application_rootdir_url"] . "/skins/" . $net2ftp_globals["skin"] . "/css/main.css.php?ltr=" . __("ltr") . "&amp;image_url=" . urlEncode2($net2ftp_globals["image_url"]) . "\" />\n";
} // end net2ftp_printCssInclude
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printBodyOnload() {
// --------------
// This function prints the <body onload="" actions
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
// echo "";
} // end net2ftp_printBodyOnload
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printBody() {
// --------------
// This function prints the login screen
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
if (isset($_POST["input_admin_username"]) == true) { $input_admin_username = htmlEncode2(validateGenericInput($_POST["input_admin_username"])); }
else { $input_admin_username = ""; }
if (isset($_POST["input_admin_password"]) == true) { $input_admin_password = htmlEncode2(validateGenericInput($_POST["input_admin_password"])); }
else { $input_admin_password = ""; }
if (isset($_POST["dbusername2"]) == true) { $dbusername2 = validateUsername($_POST["dbusername2"]); }
else { $dbusername2 = ""; }
if (isset($_POST["dbpassword2"]) == true) { $dbpassword2 = validatePassword($_POST["dbpassword2"]); }
else { $dbpassword2 = ""; }
if (isset($_POST["dbname2"]) == true) { $dbname2 = validateGenericInput($_POST["dbname2"]); }
else { $dbname2 = ""; }
if (isset($_POST["dbserver2"]) == true) { $dbserver2 = validateGenericInput($_POST["dbserver2"]); }
else { $dbserver2 = ""; }
$dbusername2_html = htmlEncode2($dbusername2);
$dbpassword2_html = htmlEncode2($dbpassword2);
$dbname2_html = htmlEncode2($dbname2);
$dbserver2_html = htmlEncode2($dbserver2);
if ($dbserver2 == "") { $dbserver2 = "localhost"; }
// -------------------------------------------------------------------------
// Variables for all screens
// -------------------------------------------------------------------------
// Output variable
$net2ftp_output["admin_createtables"][] = "";
// Title
$title = __("Admin functions");
// Form name
$formname = "AdminForm";
// Read the SQL file
$filename = $net2ftp_globals["application_rootdir"] . "/modules/admin_createtables/create_tables.sql");
$handle = fopen($filename, "rb"); // Open the file for reading only
if ($handle == false) { $net2ftp_output["admin_createtables"][] = __("The handle of file %1\$s could not be opened.", $filename); }
clearstatcache(); // for filesize
$sqlquerystring = fread($handle, filesize($filename));
if ($sqlquerystring == false) { $net2ftp_output["admin_createtables"][] = __("The file %1\$s could not be opened.", $filename); }
$result1 = fclose($handle);
if ($result1 == false) { $net2ftp_output["admin_createtables"][] = __("The handle of file %1\$s could not be closed.", $filename); }
// Split the SQL file in individual queries
$sqlquerypieces = explode("\n", $sqlquerystring);
// -------------------------------------------------------------------------
// Variables for screen 1
// -------------------------------------------------------------------------
if ($net2ftp_globals["screen"] == 1) {
// Next screen
$nextscreen = 2;
// Back and forward buttons
$back_onclick = "document.forms['" . $formname . "'].state.value='admin';document.forms['" . $formname . "'].screen.value='1';document.forms['" . $formname . "'].submit();";
$forward_onclick = "document.forms['" . $formname . "'].submit();";
} // end if
// -------------------------------------------------------------------------
// Variables for screen 2
// -------------------------------------------------------------------------
elseif ($net2ftp_globals["screen"] == 2) {
// Next screen
$nextscreen = 1;
// Back and forward buttons
$back_onclick = "document.forms['" . $formname . "'].state.value='admin';document.forms['" . $formname . "'].screen.value='1';document.forms['" . $formname . "'].submit();";
$dbpassword2_length = strlen($dbpassword2);
// ------------------------------------
// Connect
// ------------------------------------
$mydb = mysql_connect($dbserver2, $dbusername2, $dbpassword2);
if ($mydb == false) { $net2ftp_output["admin_createtables"][] = __("The connection to the server <b>%1\$s</b> could not be set up. Please check the database settings you've entered.", $dbserver2_html) . "\n"; }
// ------------------------------------
// Select
// ------------------------------------
if ($mydb != false) {
$mysql_select_db_result = mysql_select_db($dbname2);
if ($mysql_select_db_result == false) { $net2ftp_output["admin_createtables"][] = __("Unable to select the database <b>%1\$s</b>.", $dbserver2_html) . "\n"; }
}
// ------------------------------------
// Query
// ------------------------------------
if ($mydb != false && $mysql_select_db_result != false) {
for ($i=0; $i<sizeof($sqlquerypieces); $i++) {
$mysql_query_results[$i] = mysql_query($sqlquerypieces[$i]);
if ($mysql_query_results[$i] == false) { $net2ftp_output["admin_createtables"][] = __("The SQL query nr <b>%1\$s</b> could not be executed.", $i+1) . "\n"; }
else { $net2ftp_output["admin_createtables"][] = __("The SQL query nr <b>%1\$s</b> was executed successfully.", $i+1) . "\n"; }
}
}
} // end elseif
// -------------------------------------------------------------------------
// Print the output
// -------------------------------------------------------------------------
require_once($net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php");
} // End net2ftp_printBody
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
?>

View file

@ -1,12 +0,0 @@
DROP TABLE IF EXISTS `net2ftp_log_access`;
CREATE TABLE `net2ftp_log_access` (`id` int(10) unsigned NOT NULL auto_increment,`date` date NOT NULL default '0000-00-00',`time` time NOT NULL default '00:00:00',`remote_addr` text NOT NULL,`remote_port` text NOT NULL,`http_user_agent` text NOT NULL,`page` text NOT NULL,`datatransfer` int(10) unsigned default '0',`executiontime` mediumint(8) unsigned default '0',`ftpserver` text NOT NULL,`username` text NOT NULL,`state` text NOT NULL,`state2` text NOT NULL,`screen` text NOT NULL,`directory` text NOT NULL,`entry` text NOT NULL,`http_referer` text NOT NULL,KEY `index1` (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `net2ftp_log_error`;
CREATE TABLE `net2ftp_log_error` (`date` date NOT NULL default '0000-00-00',`time` time NOT NULL default '00:00:00',`ftpserver` text NOT NULL,`username` text NOT NULL,`message` text NOT NULL,`backtrace` text NOT NULL,`state` text NOT NULL,`state2` text NOT NULL,`directory` text NOT NULL,`remote_addr` text NOT NULL,`remote_port` text NOT NULL,`http_user_agent` text NOT NULL,KEY `index1` (`date`,`time`,`ftpserver`(100),`username`(50))) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `net2ftp_log_consumption_ftpserver`;
CREATE TABLE `net2ftp_log_consumption_ftpserver`(`date` date NOT NULL default '0000-00-00',`ftpserver` varchar(255) NOT NULL default '0',`datatransfer` int(10) unsigned default '0',`executiontime` mediumint(8) unsigned default '0',PRIMARY KEY (`date`,`ftpserver`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `net2ftp_log_consumption_ipaddress`;
CREATE TABLE `net2ftp_log_consumption_ipaddress`(`date` date NOT NULL default '0000-00-00',`ipaddress` varchar(15) NOT NULL default '0',`datatransfer` int(10) unsigned default '0',`executiontime` mediumint(8) unsigned default '0',PRIMARY KEY (`date`,`ipaddress`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `net2ftp_users`;
CREATE TABLE `net2ftp_users` (`ftpserver` varchar(255) NOT NULL default '0',`username` text NOT NULL,`homedirectory` text NOT NULL,KEY `index1` (`ftpserver`,`username`(50))) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `net2ftp_log_status`;
CREATE TABLE `net2ftp_log_status` (`month` varchar(6) NOT NULL, `status` int(3) NOT NULL, `changelog` text NOT NULL, PRIMARY KEY (`month`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View file

@ -1,207 +0,0 @@
<?php
// -------------------------------------------------------------------------------
// | net2ftp: a web based FTP client |
// | Copyright (c) 2003-2013 by David Gartner |
// | |
// | 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. |
// | |
// -------------------------------------------------------------------------------
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_sendHttpHeaders() {
// --------------
// This function sends HTTP headers
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
// -------------------------------------------------------------------------
// Check Admin username and password
// Redirect to the login_small page if needed
// -------------------------------------------------------------------------
checkAdminUsernamePassword();
} // end net2ftp_sendHttpHeaders
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printJavascript() {
// --------------
// This function prints Javascript code and includes
// --------------
// global $net2ftp_settings, $net2ftp_globals;
// Code
// echo "<script type=\"text/javascript\"><!--\n";
// echo "//--></script>\n";
// Include
// echo "<script type=\"text/javascript\" src=\"". $net2ftp_globals["application_rootdir_url"] . "/modules/login/login.js\"></script>\n";
} // end net2ftp_printJavascript
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printCss() {
// --------------
// This function prints CSS code and includes
// --------------
global $net2ftp_settings, $net2ftp_globals;
// Include
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"". $net2ftp_globals["application_rootdir_url"] . "/skins/" . $net2ftp_globals["skin"] . "/css/main.css.php?ltr=" . __("ltr") . "&amp;image_url=" . urlEncode2($net2ftp_globals["image_url"]) . "\" />\n";
} // end net2ftp_printCssInclude
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printBodyOnload() {
// --------------
// This function prints the <body onload="" actions
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
// echo "";
} // end net2ftp_printBodyOnload
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printBody() {
// --------------
// This function prints the login screen
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result, $net2ftp_output;
if (isset($_POST["input_admin_username"]) == true) { $input_admin_username = htmlEncode2(validateGenericInput($_POST["input_admin_username"])); }
else { $input_admin_username = ""; }
if (isset($_POST["input_admin_password"]) == true) { $input_admin_password = htmlEncode2(validateGenericInput($_POST["input_admin_password"])); }
else { $input_admin_password = ""; }
if (isset($_POST["datefrom"]) == true) { $datefrom = addslashes(validateGenericInput($_POST["datefrom"])); }
else { $datefrom = ""; }
if (isset($_POST["dateto"]) == true) { $dateto = addslashes(validateGenericInput($_POST["dateto"])); }
else { $dateto = ""; }
// -------------------------------------------------------------------------
// Variables for all screens
// -------------------------------------------------------------------------
// Output variable
$net2ftp_output["admin_emptylogs"][] = "";
// Title
$title = __("Admin functions");
// Form name, back and forward buttons
$formname = "AdminForm";
$back_onclick = "document.forms['" . $formname . "'].state.value='admin';document.forms['" . $formname . "'].submit();";
$forward_onclick = "document.forms['" . $formname . "'].submit();";
// -------------------------------------------------------------------------
// Variables for screen 1
// -------------------------------------------------------------------------
// ------------------------------------
// Input checks
// ------------------------------------
// Add slashes to variables which are used in a SQL query, and which are
// potentially unsafe (supplied by the user).
$datefrom = addslashes($datefrom);
$dateto = addslashes($dateto);
if ($datefrom == "" || $datefrom == 0) { return false; }
if ($dateto == "" || $dateto == 0) { return false; }
// ------------------------------------
// Delete empty logs
// ------------------------------------
emptyLogs($datefrom, $dateto);
if (isset($net2ftp_output["emptyLogs"]) == true) {
$net2ftp_output["admin_emptylogs"] = $net2ftp_output["admin_emptylogs"] + $net2ftp_output["emptyLogs"];
}
// -------------------------------------------------------------------------
// Print the output
// -------------------------------------------------------------------------
require_once($net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php");
} // End net2ftp_printBody
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
?>

View file

@ -1,303 +0,0 @@
<?php
// -------------------------------------------------------------------------------
// | net2ftp: a web based FTP client |
// | Copyright (c) 2003-2013 by David Gartner |
// | |
// | 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. |
// | |
// -------------------------------------------------------------------------------
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_sendHttpHeaders() {
// --------------
// This function sends HTTP headers
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
// -------------------------------------------------------------------------
// Check Admin username and password
// Redirect to the login_small page if needed
// -------------------------------------------------------------------------
checkAdminUsernamePassword();
} // end net2ftp_sendHttpHeaders
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printJavascript() {
// --------------
// This function prints Javascript code and includes
// --------------
// global $net2ftp_settings, $net2ftp_globals;
// Code
// echo "<script type=\"text/javascript\"><!--\n";
// echo "//--></script>\n";
// Include
// echo "<script type=\"text/javascript\" src=\"". $net2ftp_globals["application_rootdir_url"] . "/modules/login/login.js\"></script>\n";
} // end net2ftp_printJavascript
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printCss() {
// --------------
// This function prints CSS code and includes
// --------------
global $net2ftp_settings, $net2ftp_globals;
// Include
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"". $net2ftp_globals["application_rootdir_url"] . "/skins/" . $net2ftp_globals["skin"] . "/css/main.css.php?ltr=" . __("ltr") . "&amp;image_url=" . urlEncode2($net2ftp_globals["image_url"]) . "\" />\n";
} // end net2ftp_printCssInclude
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printBodyOnload() {
// --------------
// This function prints the <body onload="" actions
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
// echo "";
} // end net2ftp_printBodyOnload
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printBody() {
// --------------
// This function prints the login screen
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
if (isset($_POST["input_admin_username"]) == true) { $input_admin_username = htmlEncode2(validateGenericInput($_POST["input_admin_username"])); }
else { $input_admin_username = ""; }
if (isset($_POST["input_admin_password"]) == true) { $input_admin_password = htmlEncode2(validateGenericInput($_POST["input_admin_password"])); }
else { $input_admin_password = ""; }
if (isset($_POST["datefrom"]) == true) { $datefrom = addslashes(validateGenericInput($_POST["datefrom"])); }
else { $datefrom = ""; }
if (isset($_POST["dateto"]) == true) { $dateto = addslashes(validateGenericInput($_POST["dateto"])); }
else { $dateto = ""; }
// -------------------------------------------------------------------------
// Variables for all screens
// -------------------------------------------------------------------------
// Output variable
$net2ftp_output["admin_viewlogs"][] = "";
// Title
$title = __("Admin functions");
// Form name, back and forward buttons
$formname = "AdminForm";
$back_onclick = "document.forms['" . $formname . "'].state.value='admin';document.forms['" . $formname . "'].submit();";
$forward_onclick = "document.forms['" . $formname . "'].submit();";
// -------------------------------------------------------------------------
// Variables for screen 1
// -------------------------------------------------------------------------
// ------------------------------------
// Connect to the database
// ------------------------------------
$mydb = connect2db();
if ($net2ftp_result["success"] == false) { return false; }
// ------------------------------------
// Execute the SQL query and print the data
// ------------------------------------
// Query 1
$sqlquery1 = "SELECT * FROM net2ftp_log_access WHERE date BETWEEN '$datefrom' AND '$dateto' ORDER BY date DESC, time DESC;";
$table1 = printTable($sqlquery1);
if ($net2ftp_result["success"] == false) { return false; }
// Query 2
$sqlquery2 = "SELECT * FROM net2ftp_log_error WHERE date BETWEEN '$datefrom' AND '$dateto' ORDER BY date DESC, time DESC;";
$table2 = printTable($sqlquery2);
if ($net2ftp_result["success"] == false) { return false; }
// Query 3
$sqlquery3 = "SELECT * FROM net2ftp_log_consumption_ftpserver WHERE date BETWEEN '$datefrom' AND '$dateto' ORDER BY datatransfer DESC, date DESC;";
$table3 = printTable($sqlquery3);
if ($net2ftp_result["success"] == false) { return false; }
// Query 4
$sqlquery4 = "SELECT * FROM net2ftp_log_consumption_ipaddress WHERE date BETWEEN '$datefrom' AND '$dateto' ORDER BY datatransfer DESC, date DESC;";
$table4 = printTable($sqlquery4);
if ($net2ftp_result["success"] == false) { return false; }
// -------------------------------------------------------------------------
// Print the output
// -------------------------------------------------------------------------
require_once($net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php");
} // End net2ftp_printBody
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function printTable($sqlquery) {
// --------------
// This function executes the SQL query and prints a nice HTML table with the results
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result, $net2ftp_output;
// -------------------------------------------------------------------------
// Execute the SQL query
// -------------------------------------------------------------------------
$result = mysql_query("$sqlquery");
if ($result == false) {
$errormessage = __("Unable to execute the SQL query <b>%1\$s</b>.", $sqlquery);
setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
return false;
}
$nrofrows = mysql_num_rows($result);
$nrofcolumns_withindex = mysql_num_fields($result) + 1;
// -------------------------------------------------------------------------
// Print the table
// -------------------------------------------------------------------------
// Table begin
$output = "<table border=\"1\">\n";
// First row: SQL query
$output .= "<tr><td colspan=\"$nrofcolumns_withindex\" class=\"tdheader1\" style=\"font-size: 120%;\">$sqlquery</td></tr>\n";
if ($nrofrows != 0) {
// Second row: header
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$output .= "<tr>\n";
$output .= "<td>Index</td>\n";
while(list($fieldname, $fieldvalue) = each($row) ) { $output .= "<td>$fieldname</td>\n"; }
$output .= "</tr>\n";
mysql_data_seek($result, 0); // reset row pointer to the first row
// 3rd and next rows: data
$rowcounter = 1;
while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$output .= "<tr>\n";
$output .= "<td>$rowcounter</td>\n";
while(list($fieldname, $fieldvalue) = each($row) ) { $output .= "<td>" . htmlEncode2($fieldvalue) . "</td>\n"; }
$output .= "</tr>\n";
$rowcounter++;
}
}
// If there is no data
else {
$output .= "<tr><td colspan=\"$nrofcolumns_withindex\">" . __("No data") . "</td></tr>";
}
// Table end
$output .= "</table>\n";
// -------------------------------------------------------------------------
// Free the $result
// -------------------------------------------------------------------------
mysql_free_result($result);
return $output;
} // End printTable
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
?>

View file

@ -1,168 +0,0 @@
<?php
// -------------------------------------------------------------------------------
// | net2ftp: a web based FTP client |
// | Copyright (c) 2003-2013 by David Gartner |
// | |
// | 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. |
// | |
// -------------------------------------------------------------------------------
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_sendHttpHeaders() {
// --------------
// This function sends HTTP headers
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
} // end net2ftp_sendHttpHeaders
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printJavascript() {
// --------------
// This function prints Javascript code and includes
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
// Code
// echo "<script type=\"text/javascript\"><!--\n";
// echo "//--></script>\n";
// Include
// echo "<script type=\"text/javascript\" src=\"". $net2ftp_globals["application_rootdir_url"] . "/modules/login/login.js\"></script>\n";
} // end net2ftp_printJavascript
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printCss() {
// --------------
// This function prints CSS code and includes
// --------------
global $net2ftp_settings, $net2ftp_globals;
// Include
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"". $net2ftp_globals["application_rootdir_url"] . "/skins/" . $net2ftp_globals["skin"] . "/css/main.css.php?ltr=" . __("ltr") . "&amp;image_url=" . urlEncode2($net2ftp_globals["image_url"]) . "\" />\n";
} // end net2ftp_printCssInclude
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printBodyOnload() {
// --------------
// This function prints the <body onload="" actions
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
// echo "";
} // end net2ftp_printBodyOnload
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printBody() {
// --------------
// This function prints the login screen
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result, $net2ftp_output;
// -------------------------------------------------------------------------
// Variables
// -------------------------------------------------------------------------
if ($net2ftp_globals["screen"] == 1) {
// Title
$title = __("Advanced functions");
// Form name, back and forward buttons
$formname = "AdvancedForm";
$back_onclick = "document.forms['" . $formname . "'].state.value='browse';document.forms['" . $formname . "'].state2.value='main';document.forms['" . $formname . "'].submit();";
} // end if
// -------------------------------------------------------------------------
// Print the output
// -------------------------------------------------------------------------
require_once($net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php");
} // End net2ftp_printBody
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
?>

View file

@ -1,257 +0,0 @@
<?php
// -------------------------------------------------------------------------------
// | net2ftp: a web based FTP client |
// | Copyright (c) 2003-2013 by David Gartner |
// | |
// | 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. |
// | |
// -------------------------------------------------------------------------------
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_sendHttpHeaders() {
// --------------
// This function sends HTTP headers
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
} // end net2ftp_sendHttpHeaders
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printJavascript() {
// --------------
// This function prints Javascript code and includes
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
// Code
// echo "<script type=\"text/javascript\"><!--\n";
// echo "//--></script>\n";
// Include
// echo "<script type=\"text/javascript\" src=\"". $net2ftp_globals["application_rootdir_url"] . "/modules/login/login.js\"></script>\n";
} // end net2ftp_printJavascript
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printCss() {
// --------------
// This function prints CSS code and includes
// --------------
global $net2ftp_settings, $net2ftp_globals;
// Include
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"". $net2ftp_globals["application_rootdir_url"] . "/skins/" . $net2ftp_globals["skin"] . "/css/main.css.php?ltr=" . __("ltr") . "&amp;image_url=" . urlEncode2($net2ftp_globals["image_url"]) . "\" />\n";
} // end net2ftp_printCssInclude
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printBodyOnload() {
// --------------
// This function prints the <body onload="" actions
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
// echo "";
} // end net2ftp_printBodyOnload
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printBody() {
// --------------
// This function prints the login screen
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result, $net2ftp_output;
if (isset($_POST["troubleshoot_ftpserver"]) == true) { $troubleshoot_ftpserver = validateFtpserver($_POST["troubleshoot_ftpserver"]); }
else { $troubleshoot_ftpserver = ""; }
if (isset($_POST["troubleshoot_ftpserverport"]) == true) { $troubleshoot_ftpserverport = validateFtpserverport($_POST["troubleshoot_ftpserverport"]); }
else { $troubleshoot_ftpserverport = ""; }
if (isset($_POST["troubleshoot_username"]) == true) { $troubleshoot_username = validateUsername($_POST["troubleshoot_username"]); }
else { $troubleshoot_username = ""; }
if (isset($_POST["troubleshoot_password"]) == true) { $troubleshoot_password = validatePassword($_POST["troubleshoot_password"]); }
else { $troubleshoot_password = ""; }
if (isset($_POST["troubleshoot_directory"]) == true) { $troubleshoot_directory = validateDirectory($_POST["troubleshoot_directory"]); }
else { $troubleshoot_directory = "/"; }
if (isset($_POST["troubleshoot_passivemode"]) == true) { $troubleshoot_passivemode = validatePassivemode($_POST["troubleshoot_passivemode"]); }
else { $troubleshoot_passivemode = ""; }
$troubleshoot_ftpserver_html = htmlEncode2($troubleshoot_ftpserver);
$troubleshoot_ftpserverport_html = htmlEncode2($troubleshoot_ftpserverport);
$troubleshoot_username_html = htmlEncode2($troubleshoot_username);
$troubleshoot_directory_html = htmlEncode2($troubleshoot_directory);
$troubleshoot_passivemode_html = htmlEncode2($troubleshoot_passivemode);
// -------------------------------------------------------------------------
// Variables for all screens
// -------------------------------------------------------------------------
// Title
$title = __("Troubleshoot an FTP server");
// Form name
$formname = "AdvancedForm";
// -------------------------------------------------------------------------
// Variables for screen 1
// -------------------------------------------------------------------------
if ($net2ftp_globals["screen"] == 1) {
// Next screen
$nextscreen = 2;
// Back and forward buttons
$back_onclick = "document.forms['" . $formname . "'].state.value='advanced';document.forms['" . $formname . "'].screen.value='1';document.forms['" . $formname . "'].submit();";
$forward_onclick = "document.forms['" . $formname . "'].submit();";
} // end if
// -------------------------------------------------------------------------
// Variables for screen 2
// -------------------------------------------------------------------------
elseif ($net2ftp_globals["screen"] == 2) {
// Back and forward buttons
$back_onclick = "document.forms['" . $formname . "'].state.value='advanced_ftpserver'; document.forms['" . $formname . "'].submit();";
// Initial checks
if ($troubleshoot_passivemode != "yes") { $troubleshoot_passivemode = "no"; }
// Connect
setStatus(1, 10, __("Connecting to the FTP server"));
$conn_id = ftp_connect("$troubleshoot_ftpserver", $troubleshoot_ftpserverport);
// Login with username and password
setStatus(2, 10, __("Logging into the FTP server"));
$ftp_login_result = ftp_login($conn_id, $troubleshoot_username, $troubleshoot_password);
// Passive mode
if ($troubleshoot_passivemode == "yes") {
setStatus(3, 10, __("Setting the passive mode"));
$ftp_pasv_result = ftp_pasv($conn_id, TRUE);
}
else {
$ftp_pasv_result = true;
}
// Get the FTP system type
setStatus(4, 10, __("Getting the FTP system type"));
$ftp_systype_result = ftp_systype($conn_id);
// Change the directory
setStatus(5, 10, __("Changing the directory"));
$ftp_chdir_result = ftp_chdir($conn_id, $troubleshoot_directory);
// Get the current directory from the FTP server
setStatus(6, 10, __("Getting the current directory"));
$ftp_pwd_result = ftp_pwd($conn_id);
// Try to get a raw list
setStatus(7, 10, __("Getting the list of directories and files"));
$ftp_rawlist_result = ftp_rawlist($conn_id, "-a");
if (sizeof($ftp_rawlist_result) <= 1) {
$ftp_rawlist_result = ftp_rawlist($conn_id, "");
}
// Parse the list
setStatus(8, 10, __("Parsing the list of directories and files"));
for($i=0; $i<sizeof($ftp_rawlist_result); $i++) {
$parsedlist[$i] = ftp_scanline($troubleshoot_directory, $ftp_rawlist_result[$i]);
} // end for
// Quiting; ftp_quit doesn't return a value
setStatus(9, 10, __("Logging out of the FTP server"));
ftp_quit($conn_id);
} // end if
// -------------------------------------------------------------------------
// Print the output
// -------------------------------------------------------------------------
setStatus(10, 10, __("Printing the result"));
require_once($net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php");
} // End net2ftp_printBody
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
?>

View file

@ -1,203 +0,0 @@
<?php
// -------------------------------------------------------------------------------
// | net2ftp: a web based FTP client |
// | Copyright (c) 2003-2013 by David Gartner |
// | |
// | 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. |
// | |
// -------------------------------------------------------------------------------
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_sendHttpHeaders() {
// --------------
// This function sends HTTP headers
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
} // end net2ftp_sendHttpHeaders
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printJavascript() {
// --------------
// This function prints Javascript code and includes
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
// Code
// echo "<script type=\"text/javascript\"><!--\n";
// echo "//--></script>\n";
// Include
// echo "<script type=\"text/javascript\" src=\"". $net2ftp_globals["application_rootdir_url"] . "/modules/advanced_parsing/advanced_parsing.js\"></script>\n";
} // end net2ftp_printJavascript
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printCss() {
// --------------
// This function prints CSS code and includes
// --------------
global $net2ftp_settings, $net2ftp_globals;
// Include
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"". $net2ftp_globals["application_rootdir_url"] . "/skins/" . $net2ftp_globals["skin"] . "/css/main.css.php?ltr=" . __("ltr") . "&amp;image_url=" . urlEncode2($net2ftp_globals["image_url"]) . "\" />\n";
} // end net2ftp_printCssInclude
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printBodyOnload() {
// --------------
// This function prints the <body onload="" actions
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
// echo "";
} // end net2ftp_printBodyOnload
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printBody() {
// --------------
// This function prints the chmod screen
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result, $net2ftp_output;
// -------------------------------------------------------------------------
// Variables for all screens
// -------------------------------------------------------------------------
// Title
$title = __("Test the net2ftp list parsing rules");
// Form name, back and forward buttons
$formname = "AdvancedParsingForm";
$back_onclick = "document.forms['" . $formname . "'].state.value='advanced';document.forms['" . $formname . "'].screen.value='1';document.forms['" . $formname . "'].submit();";
// Initialize output variable
$net2ftp_output["advanced_parsing"] = array();
// -------------------------------------------------------------------------
// Open the file with the samples
// -------------------------------------------------------------------------
require_once($net2ftp_globals["application_rootdir"] . "/modules/advanced_parsing/list_samples.inc.php");
// -------------------------------------------------------------------------
// For each sample
// -------------------------------------------------------------------------
while(list($sampleName, $sampleLines) = each($list_samples)) {
$net2ftp_output["advanced_parsing"][] = "<span style=\"font-size: 120%; font-weight: bold;\">" . $sampleName . "</span><br />\n";
// ------------------------------------
// Input
// ------------------------------------
$net2ftp_output["advanced_parsing"][] = "<span style=\"text-decoration: underline;\">Sample input</span>:<br />\n";
for ($i=1; $i<=sizeof($sampleLines); $i++) {
$net2ftp_output["advanced_parsing"][] = "Line $i: " . htmlEncode2($sampleLines[$i]) . "<br />\n";
}
$net2ftp_output["advanced_parsing"][] = "<br />\n";
// ------------------------------------
// Output
// ------------------------------------
$net2ftp_output["advanced_parsing"][] = "<span style=\"text-decoration: underline;\">Parsed output</span>:<br />\n";
for ($i=1; $i<=sizeof($sampleLines); $i++) {
// Scan the sample
$outputArray = ftp_scanline("", $sampleLines[$i]);
while(list($fieldName, $fieldValue) = each($outputArray)) {
$net2ftp_output["advanced_parsing"][] = "Line $i: " . $fieldName . ": " . htmlEncode2($fieldValue) . "<br />\n";
} // end while
$net2ftp_output["advanced_parsing"][] = "<br />\n";
}
$net2ftp_output["advanced_parsing"][] = "<br /><br />\n";
}
// -------------------------------------------------------------------------
// Print the output
// -------------------------------------------------------------------------
require_once($net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php");
} // End net2ftp_printBody
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
?>

View file

@ -1,95 +0,0 @@
<?php
// Samples of FTP LIST responses.
// Some samples are from FileZilla source code, file FtpListResult.cpp
// License: GPL
// Some samples are from http://cr.yp.to/ftpparse/ftpparse.c
// By D. J. Bernstein, djb@cr.yp.to http://cr.yp.to/ftpparse.html
// License: Commercial use is fine, if you let me know what programs you're using this in.
// Some samples are provided by net2ftp users to the net2ftp development team
// License: GPL
$list_samples["UNIX-style listing, without inum and without blocks"][1] = "-rw-r--r-- 1 root other 531 Jan 29 03:26 README";
$list_samples["UNIX-style listing, without inum and without blocks"][2] = "dr-xr-xr-x 2 root other 512 Apr 8 1994 etc";
$list_samples["UNIX-style listing, without inum and without blocks"][3] = "dr-xr-xr-x 2 root 512 Apr 8 1994 etc2";
$list_samples["UNIX-style listing, without inum and without blocks"][4] = "lrwxrwxrwx 1 root other 7 Jan 25 00:17 bin -> usr/bin";
$list_samples["Some listings with uncommon date/time format"][1] = "-rw-r--r-- 1 root other 531 09-26 2000 README2";
$list_samples["Some listings with uncommon date/time format"][2] = "-rw-r--r-- 1 root other 531 09-26 13:45 README3";
$list_samples["Some listings with uncommon date/time format"][3] = "-rw-r--r-- 1 root other 531 2005-06-07 21:22 README4";
$list_samples["Also produced by Microsoft's FTP servers for Windows"][1] = "---------- 1 owner group 1803128 Jul 10 10:18 ls-lR.Z";
$list_samples["Also produced by Microsoft's FTP servers for Windows"][2] = "d--------- 1 owner group 0 May 9 19:45 Softlib";
$list_samples["Also WFTPD for MSDOS"][1] = "-rwxrwxrwx 1 noone nogroup 322 Aug 19 1996 message.ftp";
$list_samples["Also NetWare"][1] = "d [R----F--] supervisor 512 Jan 16 18:53 login";
$list_samples["Also NetWare"][2] = "- [R----F--] rhesus 214059 Oct 20 15:27 cx.exe";
$list_samples["Also NetPresenz for the Mac"][1] = "-------r-- 326 1391972 1392298 Nov 22 1995 MegaPhone.sit";
$list_samples["Also NetPresenz for the Mac"][2] = "drwxrwxr-x folder 2 May 10 1996 network";
$list_samples["MSDOS format"][1] = "04-27-00 09:09PM <DIR> licensed";
$list_samples["MSDOS format"][2] = "07-18-00 10:16AM <DIR> pub";
$list_samples["MSDOS format"][3] = "04-14-00 03:47PM 589 readme.htm";
$list_samples["Some other formats some windows servers send"][1] = "-rw-r--r-- 1 root 531 Jan 29 03:26 README5";
$list_samples["Some other formats some windows servers send"][2] = "-rw-r--r-- 1 group domain user 531 Jan 29 03:26 README6";
$list_samples["EPLF directory listings"][1] = "+i8388621.48594,m825718503,r,s280,\teplf test 1.file";
$list_samples["EPLF directory listings"][2] = "+i8388621.50690,m824255907,/,\teplf test 2.dir";
$list_samples["EPLF directory listings"][3] = "+i8388621.48598,m824253270,r,s612,\teplf test 3.file";
$list_samples["MSDOS type listing used by IIS"][1] = "04-27-00 12:09PM <DIR> DOS dir 1";
$list_samples["MSDOS type listing used by IIS"][2] = "04-14-00 03:47PM 589 DOS file 1";
$list_samples["Another type of MSDOS style listings"][1] = "2002-09-02 18:48 <DIR> DOS dir 2";
$list_samples["Another type of MSDOS style listings"][2] = "2002-09-02 19:06 9,730 DOS file 2";
$list_samples["Numerical Unix style format"][1] = "0100644 500 101 12345 123456789 filename";
$list_samples["This one is used by SSH-2.0-VShell_2_1_2_143, this is the old VShell format"][1] = "206876 Apr 04, 2000 21:06 VShell (old)";
$list_samples["This one is used by SSH-2.0-VShell_2_1_2_143, this is the old VShell format"][2] = "0 Dec 12, 2002 02:13 VShell (old) Dir/";
$list_samples["This type of directory listings is sent by some newer versions of VShell both year and time in one line is uncommon."][1] = "-rwxr-xr-x 1 user group 9 Oct 08, 2002 09:47 VShell (new)";
$list_samples["Next ones come from an OS/2 server. The server obviously isn't Y2K aware"][1] = "36611 A 04-23-103 10:57 OS2 test1.file";
$list_samples["Next ones come from an OS/2 server. The server obviously isn't Y2K aware"][2] = " 1123 A 07-14-99 12:37 OS2 test2.file";
$list_samples["Next ones come from an OS/2 server. The server obviously isn't Y2K aware"][3] = " 0 DIR 02-11-103 16:15 OS2 test1.dir";
$list_samples["Next ones come from an OS/2 server. The server obviously isn't Y2K aware"][4] = " 1123 DIR A 10-05-100 23:38 OS2 test2.dir";
$list_samples["Some servers send localized date formats, here the German one"][1] = "dr-xr-xr-x 2 root other 2235 26. Juli, 20:10 datetest1 (ger)";
$list_samples["Some servers send localized date formats, here the German one"][2] = "-r-xr-xr-x 2 root other 2235 2. Okt. 2003 datetest2 (ger)";
$list_samples["Some servers send localized date formats, here the German one"][3] = "-r-xr-xr-x 2 root other 2235 1999/10/12 17:12 datetest3";
$list_samples["Some servers send localized date formats, here the German one"][4] = "-r-xr-xr-x 2 root other 2235 24-04-2003 17:12 datetest4";
$list_samples["Here a Japanese one"][1] = "-rw-r--r-- 1 root sys 8473 4\x8c\x8e 18\x93\xfa 2003\x94\x4e datatest1 (jap)";
$list_samples["VMS style listings"][1] = "vms_dir_1.DIR;1 1 19-NOV-2001 21:41 [root,root] (RWE,RWE,RE,RE)";
$list_samples["VMS style listings"][2] = "vms_file_3;1 155 2-JUL-2003 10:30:13.64";
$list_samples["VMS style listings without time"][1] = "vms_file_4;1 2/8 15-JAN-2000 [IV2_XXX] (RWED,RWED,RE,)";
$list_samples["VMS style listings without time"][2] = "vms_file_5;1 6/8 15-JUI-2002 PRONAS (RWED,RWED,RE,)";
$list_samples["VMS multiline"][1] = "VMS_file_1;1\r\n170774/170775 24-APR-2003 08:16:15 [FTP_CLIENT,SCOT] (RWED,RWED,RE,)";
$list_samples["VMS multiline"][2] = "VMS_file_2;1\r\n10 2-JUL-2003 10:30:08.59 [FTP_CLIENT,SCOT] (RWED,RWED,RE,)";
$list_samples["IBM AS/400 style listing"][1] = "QSYS 77824 02/23/00 15:09:55 *DIR IBM AS/400 Dir1/";
$list_samples["IBM AS/400 style listing"][2] = "QSYS 77824 23/02/00 15:09:55 *FILE IBM AS/400 File1 strangedate";
$list_samples["aligned directory listing with too long size"][1] = "-r-xr-xr-x longowner longgroup123456 Feb 12 17:20 long size test1";
$list_samples["short directory listing with month name"][1] = "-r-xr-xr-x 2 owner group 4512 01-jun-99 shortdate with monthname";
$list_samples["the following format is sent by the Connect:Enterprise server by Sterling Commerce"][1] = "-C--E-----FTP B BCC3I1 7670 1294495 Jan 13 07:42 ConEnt file";
$list_samples["the following format is sent by the Connect:Enterprise server by Sterling Commerce"][2] = "-C--E-----FTS B BCC3I1 7670 1294495 Jan 13 07:42 ConEnt file2";
$list_samples["the following format is sent by the Connect:Enterprise server by Sterling Commerce"][3] = "-AR--M----TCP B ceunix 17570 2313708 Mar 29 08:56 ALL_SHORT1.zip";
$list_samples["Nortel wfFtp router"][1] = "nortel.wfFtp 1014196 06/03/04 Thur. 10:20:03";
$list_samples["VxWorks based server used in Nortel routers"][1] = "2048 Feb-28-1998 05:23:30 nortel.VwWorks dir <DIR>";
?>

View file

@ -1,257 +0,0 @@
<?php
// -------------------------------------------------------------------------------
// | net2ftp: a web based FTP client |
// | Copyright (c) 2003-2013 by David Gartner |
// | |
// | 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. |
// | |
// -------------------------------------------------------------------------------
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_sendHttpHeaders() {
// --------------
// This function sends HTTP headers
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
} // end net2ftp_sendHttpHeaders
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printJavascript() {
// --------------
// This function prints Javascript code and includes
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
// Code
// echo "<script type=\"text/javascript\"><!--\n";
// echo "//--></script>\n";
// Include
// echo "<script type=\"text/javascript\" src=\"". $net2ftp_globals["application_rootdir_url"] . "/modules/login/login.js\"></script>\n";
} // end net2ftp_printJavascript
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printCss() {
// --------------
// This function prints CSS code and includes
// --------------
global $net2ftp_settings, $net2ftp_globals;
// Include
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"". $net2ftp_globals["application_rootdir_url"] . "/skins/" . $net2ftp_globals["skin"] . "/css/main.css.php?ltr=" . __("ltr") . "&amp;image_url=" . urlEncode2($net2ftp_globals["image_url"]) . "\" />\n";
} // end net2ftp_printCssInclude
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printBodyOnload() {
// --------------
// This function prints the <body onload="" actions
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
// echo "";
} // end net2ftp_printBodyOnload
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printBody() {
// --------------
// This function prints the login screen
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result, $net2ftp_output;
// ----------------------------------------------
// Settings for the test FTP server: ftp.belnet.be
// ----------------------------------------------
$troubleshoot_ftpserver = "ftp.belnet.be";
$troubleshoot_ftpserverport = 21;
$troubleshoot_username = "anonymous";
$troubleshoot_password = "test@net2ftp.com";
$troubleshoot_passivemode = "yes";
$troubleshoot_directory = "/";
// -------------------------------------------------------------------------
// Variables for all screens
// -------------------------------------------------------------------------
// Title
$title = __("Troubleshoot your net2ftp installation");
// Form name
$formname = "AdvancedForm";
// -------------------------------------------------------------------------
// Variables for screen 1
// -------------------------------------------------------------------------
// ----------------------------------------------
// Back and forward buttons
// ----------------------------------------------
$back_onclick = "document.forms['" . $formname . "'].state.value='advanced';document.forms['" . $formname . "'].screen.value='1';document.forms['" . $formname . "'].submit();";
$forward_onclick = "document.forms['" . $formname . "'].submit();";
// ----------------------------------------------
// Check if the FTP functions are availabe
// ----------------------------------------------
// See the template file
// ----------------------------------------------
// Check if the /net2ftp/temp folder has been chmodded to 777
// ----------------------------------------------
$tempfilename = @tempnam($net2ftp_globals["application_tempdir"], "net2ftp-test") . ".txt";
$handle = @fopen($tempfilename, "wb");
$string = "This is a test file generated net2ftp, which should have been deleted automatically. The function responsible for this is troubleshoot_webserver(). You can safely delete this file.";
$success1 = @fwrite($handle, $string);
$success2 = @fclose($handle);
$success3 = @unlink($tempfilename);
// ----------------------------------------------
// Connect to an FTP server
// ----------------------------------------------
if (function_exists("ftp_connect") == true) {
// Connect
setStatus(1, 10, __("Connecting to the FTP server"));
$conn_id = ftp_connect("$troubleshoot_ftpserver", $troubleshoot_ftpserverport);
// Login with username and password
setStatus(2, 10, __("Logging into the FTP server"));
$ftp_login_result = ftp_login($conn_id, $troubleshoot_username, $troubleshoot_password);
// Passive mode
if ($troubleshoot_passivemode == "yes") {
setStatus(3, 10, __("Setting the passive mode"));
$ftp_pasv_result = ftp_pasv($conn_id, TRUE);
}
else {
$ftp_pasv_result = true;
}
// Get the FTP system type
setStatus(4, 10, __("Getting the FTP system type"));
$ftp_systype_result = htmlEncode2(ftp_systype($conn_id));
// Change the directory
setStatus(5, 10, __("Changing the directory"));
$ftp_chdir_result = ftp_chdir($conn_id, $troubleshoot_directory);
// Get the current directory from the FTP server
setStatus(6, 10, __("Getting the current directory"));
$ftp_pwd_result = ftp_pwd($conn_id);
// Try to get a raw list
setStatus(7, 10, __("Getting the list of directories and files"));
$ftp_rawlist_result = ftp_rawlist($conn_id, "-a");
if (sizeof($ftp_rawlist_result) <= 1) {
$ftp_rawlist_result = ftp_rawlist($conn_id, "");
}
// Parse the list
setStatus(8, 10, __("Parsing the list of directories and files"));
for($i=0; $i<sizeof($ftp_rawlist_result); $i++) {
$parsedlist[$i] = ftp_scanline($troubleshoot_directory, $ftp_rawlist_result[$i]);
} // end for
// Quiting; ftp_quit doesn't return a value
setStatus(9, 10, __("Logging out of the FTP server"));
ftp_quit($conn_id);
} // end if
// -------------------------------------------------------------------------
// Print the output
// -------------------------------------------------------------------------
setStatus(10, 10, __("Printing the result"));
require_once($net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php");
} // End net2ftp_printBody
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
?>

View file

@ -1,181 +0,0 @@
<?php
// -------------------------------------------------------------------------------
// | net2ftp: a web based FTP client |
// | Copyright (c) 2003-2013 by David Gartner |
// | |
// | 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. |
// | |
// -------------------------------------------------------------------------------
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_sendHttpHeaders() {
// --------------
// This function sends HTTP headers
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
} // end net2ftp_sendHttpHeaders
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printJavascript() {
// --------------
// This function prints Javascript code and includes
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
// Code
// echo "<script type=\"text/javascript\"><!--\n";
// echo "//--></script>\n";
// Include
// echo "<script type=\"text/javascript\" src=\"". $net2ftp_globals["application_rootdir_url"] . "/modules/login/login.js\"></script>\n";
} // end net2ftp_printJavascript
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printCss() {
// --------------
// This function prints CSS code and includes
// --------------
global $net2ftp_settings, $net2ftp_globals;
// Include
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"". $net2ftp_globals["application_rootdir_url"] . "/skins/" . $net2ftp_globals["skin"] . "/css/main.css.php?ltr=" . __("ltr") . "&amp;image_url=" . urlEncode2($net2ftp_globals["image_url"]) . "\" />\n";
} // end net2ftp_printCssInclude
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printBodyOnload() {
// --------------
// This function prints the <body onload="" actions
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
// echo "";
} // end net2ftp_printBodyOnload
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printBody() {
// --------------
// This function prints the login screen
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result, $net2ftp_output;
// url
if (isset($_POST["url_withpw"]) == true) {
// Do not urlEncode2() this variable, it's already encoded in printPHP_SELF()
$url_withpw = $_POST["url_withpw"];
$url_withoutpw = $_POST["url_withoutpw"];
}
else {
$url = "";
}
// text
if (isset($_POST["text"]) == true) { $text = validateGenericInput($_POST["text"]); }
else { $text = ""; }
// -------------------------------------------------------------------------
// Variables
// -------------------------------------------------------------------------
if ($net2ftp_globals["screen"] == 1) {
// Title
$title = __("Bookmark");
// Form name, back and forward buttons
$formname = "BookmarkForm";
$back_onclick = "document.forms['" . $formname . "'].state.value='browse';document.forms['" . $formname . "'].state2.value='main';document.forms['" . $formname . "'].submit();";
} // end if
// -------------------------------------------------------------------------
// Print the output
// -------------------------------------------------------------------------
require_once($net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php");
} // End net2ftp_printBody
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
?>

View file

@ -1,569 +0,0 @@
<?php
// -------------------------------------------------------------------------------
// | net2ftp: a web based FTP client |
// | Copyright (c) 2003-2013 by David Gartner |
// | |
// | 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. |
// | |
// -------------------------------------------------------------------------------
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_sendHttpHeaders() {
// --------------
// This function sends HTTP headers
// --------------
global $net2ftp_globals;
$cookie_expire = time()+60*60*24*30; // 30 days
setcookie("net2ftpcookie_ftpserver", $net2ftp_globals["ftpserver"], $cookie_expire);
setcookie("net2ftpcookie_ftpserverport", $net2ftp_globals["ftpserverport"], $cookie_expire);
setcookie("net2ftpcookie_username", $net2ftp_globals["username"], $cookie_expire);
setcookie("net2ftpcookie_language", $net2ftp_globals["language"], $cookie_expire);
setcookie("net2ftpcookie_skin", $net2ftp_globals["skin"], $cookie_expire);
setcookie("net2ftpcookie_ftpmode", $net2ftp_globals["ftpmode"], $cookie_expire);
setcookie("net2ftpcookie_passivemode", $net2ftp_globals["passivemode"], $cookie_expire);
setcookie("net2ftpcookie_protocol", $net2ftp_globals["protocol"], $cookie_expire);
setcookie("net2ftpcookie_viewmode", $net2ftp_globals["viewmode"], $cookie_expire);
setcookie("net2ftpcookie_sort", $net2ftp_globals["sort"], $cookie_expire);
setcookie("net2ftpcookie_sortorder", $net2ftp_globals["sortorder"], $cookie_expire);
setcookie("net2ftpcookie_directory", $net2ftp_globals["directory"], $cookie_expire);
} // end function net2ftp_sendHttpHeaders
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printJavascript() {
// --------------
// This function prints Javascript code and includes
// --------------
global $net2ftp_settings, $net2ftp_globals;
// -------------------------------------------------------------------------
// Do not print anything for Mobile skins
// -------------------------------------------------------------------------
if ($net2ftp_globals["skin"] == "mobile" || $net2ftp_globals["skin"] == "iphone") {
echo "<script type=\"text/javascript\" src=\"". $net2ftp_globals["application_rootdir_url"] . "/modules/browse/browse_main_mobile.js\"></script>\n";
}
// -------------------------------------------------------------------------
// For the other skins, do print more Javascript functions
// -------------------------------------------------------------------------
else {
// ------------------------------------
// Code
// ------------------------------------
echo "<script type=\"text/javascript\"><!--\n";
echo "function createDirectoryTreeWindow(directory, FormAndFieldName) {\n";
echo " directoryTreeWindow = window.open(\"\",\"directoryTreeWindow\",\"height=450,width=300,resizable=yes,scrollbars=yes\");\n";
echo " var d = directoryTreeWindow.document;\n";
echo " d.writeln('<html>');\n";
echo " d.writeln('<head>');\n";
echo " d.writeln('<title>" . __("Choose a directory") . "<\/title>');\n";
echo " d.writeln('<\/head>');\n";
echo " d.writeln('<bo' + 'dy on' + 'load=\"document.DirectoryTreeForm.submit();\">');\n";
// echo " d.writeln('<body>');\n";
echo " d.writeln('" . __("Please wait...") . "<br /><br />');\n";
echo " d.writeln('<form name=\"DirectoryTreeForm\" id=\"DirectoryTreeForm\" action=\"" . printPHP_SELF("createDirectoryTreeWindow") . "\" method=\"post\" />');\n";
printLoginInfo_javascript();
echo " d.writeln('<input type=\"hidden\" name=\"state\" value=\"browse\" />');\n";
echo " d.writeln('<input type=\"hidden\" name=\"state2\" value=\"popup\" />');\n";
echo " d.writeln('<input type=\"hidden\" name=\"directory\" value=\"' + directory + '\" />');\n";
echo " d.writeln('<input type=\"hidden\" name=\"FormAndFieldName\" value=\"' + FormAndFieldName + '\" />');\n";
echo " d.writeln('<\/form>');\n";
echo " d.writeln('<\/div>');\n";
echo " d.writeln('<\/body>');\n";
echo " d.writeln('<\/html>');\n";
echo " d.close();\n";
echo "} // end function createDirectoryTreeWindow\n";
echo "//--></script>\n";
// ------------------------------------
// Include
// ------------------------------------
if ($net2ftp_globals["state2"] == "main") {
echo "<script type=\"text/javascript\" src=\"". $net2ftp_globals["application_rootdir_url"] . "/modules/browse/browse_main.js.php?skin=" . $net2ftp_globals["skin"] . "\"></script>\n";
}
if ($net2ftp_globals["state2"] == "popup") {
echo "<script type=\"text/javascript\" src=\"". $net2ftp_globals["application_rootdir_url"] . "/modules/browse/browse_popup.js\"></script>\n";
}
}
} // end function net2ftp_printJavascript
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printCss() {
// --------------
// This function prints CSS code and includes
// --------------
global $net2ftp_settings, $net2ftp_globals;
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"". $net2ftp_globals["application_rootdir_url"] . "/skins/" . $net2ftp_globals["skin"] . "/css/main.css.php?ltr=" . __("ltr") . "&amp;image_url=" . urlEncode2($net2ftp_globals["image_url"]) . "\" />\n";
// -------------------------------------------------------------------------
// Do not print anything for Mobile skins
// -------------------------------------------------------------------------
if ($net2ftp_globals["skin"] == "mobile" || $net2ftp_globals["skin"] == "iphone") {
}
// -------------------------------------------------------------------------
// For the other skins, do print more Javascript functions
// -------------------------------------------------------------------------
else {
}
} // end function net2ftp_printCssInclude
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printBodyOnload() {
// --------------
// This function prints the <body onload="" actions
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
// echo "";
} // end function net2ftp_printBodyOnload
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printBody() {
// --------------
// This function prints the browse screen ($state2=="main") or the directory popup screen ($state2=="popup")
// For the browse screen ($state2=="main"), 2 template files are called
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
// -------------------------------------------------------------------------
// Check if the directory name contains \' and if it does, print an error message
// Note: these directories cannot be browsed, but can be deleted
// -------------------------------------------------------------------------
// if (strstr($directory, "\'") != false) {
// $errormessage = __("Directories with names containing \' cannot be displayed correctly. They can only be deleted. Please go back and select another subdirectory.");
// setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
// return false;
// }
// -------------------------------------------------------------------------
// Variables
// With status update if $state2=="main"
// -------------------------------------------------------------------------
// ------------------------------------
// Open connection
// ------------------------------------
if ($net2ftp_globals["state2"] == "main") { setStatus(2, 10, __("Connecting to the FTP server")); }
$conn_id = ftp_openconnection();
if ($net2ftp_result["success"] == false) { return false; }
// ------------------------------------
// Get raw list of directories and files; parse the raw list and return a nice list
// This function may change the current $directory; a warning message is returned in that case
// ------------------------------------
if ($net2ftp_globals["state2"] == "main") { setStatus(4, 10, __("Getting the list of directories and files")); }
$list = ftp_getlist($conn_id, $net2ftp_globals["directory"]);
if ($net2ftp_result["success"] == false) { return false; }
// ------------------------------------
// Close connection
// ------------------------------------
ftp_closeconnection($conn_id);
// ------------------------------------
// Sort the list
// ------------------------------------
$list_directories = sort_list($list["directories"]);
$list_files = sort_list($list["files"]);
$list_symlinks = sort_list($list["symlinks"]);
$list_unrecognized = sort_list($list["unrecognized"]);
$warning_directory = $list["stats"]["warnings"];
$directory = $list["stats"]["newdirectory"];
$directory_html = htmlEncode2($directory);
$directory_url = urlEncode2($directory);
$directory_js = javascriptEncode2($directory);
$updirectory = upDir($directory);
$updirectory_html = htmlEncode2($updirectory);
$updirectory_url = urlEncode2($updirectory);
$updirectory_js = javascriptEncode2($updirectory);
// ------------------------------------
// Calculate the list of HTTP URLs
// ------------------------------------
if ($net2ftp_globals["state2"] == "main") {
$list_links_js = ftp2http($net2ftp_globals["directory"], $list_files, "no");
$list_links_url = ftp2http($net2ftp_globals["directory"], $list_files, "yes");
}
// ------------------------------------
// Consumption message
// ------------------------------------
$warning_consumption = "";
if (checkConsumption() == false) {
$warning_consumption .= "<b>" . __("Daily limit reached: you will not be able to transfer data") . "</b><br /><br />\n";
$warning_consumption .= __("In order to guarantee the fair use of the web server for everyone, the data transfer volume and script execution time are limited per user, and per day. Once this limit is reached, you can still browse the FTP server but not transfer data to/from it.") . "<br /><br />\n";
$warning_consumption .= __("If you need unlimited usage, please install net2ftp on your own web server.") . "<br />\n";
}
// ------------------------------------
// Browse message
// ------------------------------------
if ($net2ftp_settings["message_browse"] != "" && $net2ftp_settings["message_browse"] != "Setting message_browse does not exist") {
$warning_message = $net2ftp_settings["message_browse"];
}
// ------------------------------------
// Directory tree
// ------------------------------------
$directory_exploded = explode("/", stripDirectory($directory));
if ($directory != "/" && checkAuthorizedDirectory("/") == true) { $directory_tree = "<a href=\"javascript:submitBrowseForm('/','','browse','main');\">root</a> "; }
else { $directory_tree = "root "; }
$directory_goto = "";
for ($i=0; $i<sizeof($directory_exploded)-1; $i++) {
$directory_goto = glueDirectories($directory_goto, $directory_exploded[$i]);
$directory_goto_url = urlEncode2($directory_goto);
if (checkAuthorizedDirectory($directory_goto) == true) { $directory_tree .= "/<a href=\"javascript:submitBrowseForm('" . $directory_goto_url . "','','browse','main');\">" . htmlEncode2($directory_exploded[$i]) . "</a> "; }
else { $directory_tree .= "/" . $directory_exploded[$i] . " "; }
}
$directory_tree .= "/" . $directory_exploded[sizeof($directory_exploded)-1];
// ------------------------------------
// Language
// ------------------------------------
$language_onchange = "document.BrowseForm.language.value=document.forms['BrowseForm'].language2.options[document.forms['BrowseForm'].language2.selectedIndex].value; submitBrowseForm('$directory_js', '', 'browse', 'main');";
// ------------------------------------
// Skin
// ------------------------------------
$skin_onchange = "document.BrowseForm.skin.value=document.forms['BrowseForm'].skin2.options[document.forms['BrowseForm'].skin2.selectedIndex].value; submitBrowseForm('$directory_js', '', 'browse', 'main');";
// ------------------------------------
// $rowcounter counts the total nr of rows
// ------------------------------------
$rowcounter = 0;
// ------------------------------------
// Column spans
// ------------------------------------
$action_colspan = 1;
if ($net2ftp_settings["functionuse_view"] == "yes") { $action_colspan++; }
if ($net2ftp_settings["functionuse_edit"] == "yes") { $action_colspan++; }
if ($net2ftp_settings["functionuse_update"] == "yes") { $action_colspan++; }
// Total nr of columns
$total_colspan = $action_colspan + 9;
// ------------------------------------
// Name, Type, Size, ...
// Determine the sort criteria and direction (ascending/descending)
// ------------------------------------
$sortArray["dirfilename"]["text"] = __("Name");
$sortArray["type"]["text"] = __("Type");
$sortArray["size"]["text"] = __("Size");
$sortArray["owner"]["text"] = __("Owner");
$sortArray["group"]["text"] = __("Group");
$sortArray["permissions"]["text"] = __("Perms");
$sortArray["mtime"]["text"] = __("Mod Time");
$icon_directory = $net2ftp_globals["application_rootdir_url"] . "/skins/" . $net2ftp_globals["skin"] . "/images/mime";
// Loop over all the sort possibilities
while(list($key, $value) = each($sortArray)) {
// The list is sorted by the current $key
// Print the icon representing the current sortorder
// Print the link to sort using the other sortorder
if ($net2ftp_globals["sort"] == $key) {
// Ascending
if ($net2ftp_globals["sortorder"] == "ascending") {
$sortArray[$key]["title"] = __("Click to sort by %1\$s in descending order", $value["text"]);
$sortArray[$key]["onclick"] = "do_sort('" . $key . "','descending');";
$icon = "ascend.png";
$alt = __("Ascending order");
}
// Descending
else {
$sortArray[$key]["title"] = __("Click to sort by %1\$s in ascending order", $value["text"]);
$sortArray[$key]["onclick"] = "do_sort('" . $key . "','ascending');";
$icon = "descend.png";
$alt = __("Descending order");
}
}
// The list is not sorted by the current $key
// Do not print an icon
// Print the link to sort ascending
else {
$sortArray[$key]["title"] = __("Click to sort by %1\$s in ascending order", $value["text"]);
$sortArray[$key]["onclick"] = "do_sort('" . $key . "','ascending');";
$icon = "";
$alt = "";
}
// The icon to be printed is determined above
// Now, print the full HTML depending on the browser agent, version and platform
if ($icon != "") {
if ($net2ftp_globals["browser_agent"] == "IE" && ($net2ftp_globals["browser_version"] == "5.5" || $net2ftp_globals["browser_version"] == "6") && $net2ftp_globals["browser_platform"] == "Win") {
$sortArray[$key]["icon"] = "<img src=\"$icon_directory/spacer.gif\" alt=\"$alt\" style=\"border: 0px; width: 16px; height: 16px; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='$icon_directory/$icon', sizingMethod='scale');\" />\n";
}
else {
$sortArray[$key]["icon"] = "<img src=\"$icon_directory/$icon\" alt=\"$alt\" style=\"border: 0px; width: 16px; height: 16px;\" />\n";
}
}
else {
$sortArray[$key]["icon"] = "";
}
}
// ------------------------------------
// popup - FormAndFieldname
// ------------------------------------
if (isset($_POST["FormAndFieldName"]) == true) { $FormAndFieldName = validateGenericInput($_POST["FormAndFieldName"]); }
else { $FormAndFieldName = ""; }
// ------------------------------------
// Action URL
// Used for Up, Subdirectories, Files (download + actions)
// ------------------------------------
$action_url = printPHP_SELF("actions");
// ------------------------------------
// Data transfer statistics
// Print this only if the consumption statistics are available (logging must be on, using a MySQL database)
// ------------------------------------
if (isset($net2ftp_globals["consumption_ipaddress_datatransfer"]) == true || isset($net2ftp_globals["consumption_ftpserver_datatransfer"]) == true) {
$print_consumption = true;
$consumption_ipaddress_datatransfer = formatFilesize($net2ftp_globals["consumption_ipaddress_datatransfer"]);
$consumption_ftpserver_datatransfer = formatFilesize($net2ftp_globals["consumption_ftpserver_datatransfer"]);
}
else {
$print_consumption = false;
}
// ------------------------------------
// HTTP URL
// ------------------------------------
$list_files_tmp[1]["dirfilename_url"] = "";
$httplink = ftp2http($directory, $list_files_tmp, "no");
// -------------------------------------------------------------------------
// Print the output - part 2
// -------------------------------------------------------------------------
if ($net2ftp_globals["state2"] == "main") {
setStatus(6, 10, __("Printing the list of directories and files"));
require_once($net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/browse_main.template.php");
}
elseif ($net2ftp_globals["state2"] == "popup") {
require_once($net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/browse_popup.template.php");
}
} // end function net2ftp_printBody
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// **
function sort_list($list) {
// --------------
// This function sorts the list of directories and files
// Written by Slynderdale
// --------------
// -------------------------------------------------------------------------
// Global variables and settings
// -------------------------------------------------------------------------
global $net2ftp_globals;
// -------------------------------------------------------------------------
// If the list is empty, return immediately
// -------------------------------------------------------------------------
if ($net2ftp_globals["sort"] == "" || is_array($list) == false || sizeof($list) <= 1) { return $list; }
// -------------------------------------------------------------------------
// Default values
// -------------------------------------------------------------------------
// Sort flags
if ($net2ftp_globals["sort"] == "size") { $sortflag = SORT_NUMERIC; }
else { $sortflag = SORT_REGULAR; }
// Sort ascending or descending
if ($net2ftp_globals["sortorder"] == "ascending") { $sortfunction = "asort"; }
else { $sortfunction = "arsort"; }
// -------------------------------------------------------------------------
// Create a temporary array $temp which contains only the key $i and the value based on which the sorting is done
// -------------------------------------------------------------------------
// ------------------------------------
// Sorting according to name, size, owner, group, permissions
// ------------------------------------
if ($net2ftp_globals["sort"] != "mtime" && $net2ftp_globals["sort"] != "type") {
for($i=1; $i<=sizeof($list); $i++) {
$temp[$i] = strtolower($list[$i][$net2ftp_globals["sort"]]);
}
}
// ------------------------------------
// When sorting according to the modification time, do not sort alphabetically (April, February, January, March),
// but according to the corresponding Unix timestamp
// ------------------------------------
elseif ($net2ftp_globals["sort"] == "mtime") {
for($i=1; $i<=sizeof($list); $i++) {
// Some FTP servers return the date and time in a non-standard format
// For example: "Apr 06 12:57". Transform this to "06 April 2005 12:57"
if (preg_match("/([a-zA-Z]{3})[ ]+([0-9]{1,2})[ ]+([0-9]{1,2}:[0-9]{2})/", $list[$i]["mtime"], $regs) == true) {
$month = $regs[1];
$day = $regs[2];
$hour = $regs[3];
$year = date("Y");
if ($month == "Jan") { $month = "January"; }
elseif ($month == "Feb") { $month = "February"; }
elseif ($month == "Mar") { $month = "March"; }
elseif ($month == "Apr") { $month = "April"; }
elseif ($month == "May") { $month = "May"; }
elseif ($month == "Jun") { $month = "June"; }
elseif ($month == "Jul") { $month = "July"; }
elseif ($month == "Aug") { $month = "August"; }
elseif ($month == "Sep") { $month = "September"; }
elseif ($month == "Oct") { $month = "October"; }
elseif ($month == "Nov") { $month = "November"; }
elseif ($month == "Dec") { $month = "December"; }
$mtime_correct = "$day $month $year $hour";
$temp[$i] = strtotime($mtime_correct);
}
else {
$temp[$i] = strtotime($list[$i]["mtime"]);
}
} // end for
}
// ------------------------------------
// When sorting according to the file type, get the mime type for each entry
// ------------------------------------
elseif ($net2ftp_globals["sort"] == "type") {
for($i=1; $i<=sizeof($list); $i++) {
$mime = getMime($list[$i]);
$temp[$i] = $mime["mime_type"];
} // end for
}
// -------------------------------------------------------------------------
// Execute the sorting on the $temp array
// -------------------------------------------------------------------------
$sortfunction($temp, $sortflag);
// -------------------------------------------------------------------------
// Fill the $return array
// -------------------------------------------------------------------------
$i=1;
while(list($tname, $tvalue) = each($temp)) {
$return[$i] = $list[$tname];
$i++;
}
// -------------------------------------------------------------------------
// Return the result
// -------------------------------------------------------------------------
return $return;
} // end function sort_list
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
?>

View file

@ -1,102 +0,0 @@
<?php
header("Content-type: text/javascript");
if (isset($_GET["skin"]) == true && $_GET["skin"] == "india") { $extracheck = "|| (state == 'edit' && state2 == '') || state == 'view' || state == 'update'"; }
else { $extracheck = ""; }
?>
function submitBrowseForm(directory, entry, state, state2) {
// Check that at least 1 checkbox is checked
var nr_checkboxes_checked = 0;
if (state == 'calculatesize' || state == 'chmod' || state == 'copymovedelete' || state == 'downloadzip' ||
state == 'findstring' || state == 'rename' || state == 'unzip' || state == 'zip' <?php echo $extracheck; ?>) {
for (var i = 0; i < document.forms['BrowseForm'].elements.length; i++) {
if (document.forms['BrowseForm'].elements[i].type == 'checkbox') {
if (document.forms['BrowseForm'].elements[i].checked == true) { nr_checkboxes_checked++; break; }
}
}
if (nr_checkboxes_checked == 0) {
alert('Please select at least one directory or file.');
return false;
}
}
// For the skins with a <select> drop-down box on top (e.g. India), determine the value of the
// 'entry' variable based on the first selected entry
if (entry == '' && (state == 'view' || state == 'edit' || state == 'update')) {
for (var i = 0; i < document.forms['BrowseForm'].elements.length; i++) {
if (document.forms['BrowseForm'].elements[i].type == 'checkbox') {
if (document.forms['BrowseForm'].elements[i].checked == true) { entry = document.forms['BrowseForm'].elements[i].value; break; }
}
}
}
// Set BrowseForm values
document.forms['BrowseForm'].state.value=state;
document.forms['BrowseForm'].state2.value=state2;
document.forms['BrowseForm'].directory.value=directory;
document.forms['BrowseForm'].entry.value=entry;
// Set the select back to the first entry
for (var i = 0; i < document.forms['BrowseForm'].elements.length; i++) {
if (document.forms['BrowseForm'].elements[i].name == 'BrowseSelect') { document.forms['BrowseForm'].BrowseSelect.selectedIndex = 0; }
}
// Submit
document.forms['BrowseForm'].submit();
}
function do_sort(sort, sortorder) {
document.forms['BrowseForm'].state.value='browse';
document.forms['BrowseForm'].state2.value='main';
document.forms['BrowseForm'].sort.value=sort;
document.forms['BrowseForm'].sortorder.value=sortorder;
document.forms['BrowseForm'].submit();
}
function CheckAll(myform) {
var nr_checkboxes = 0;
for (var i = 0; i < myform.elements.length; i++) {
if (myform.elements[i].type == 'checkbox') {
myform.elements[i].checked = !(myform.elements[i].checked);
nr_checkboxes = nr_checkboxes + 1;
}
}
for (var j = 1; j <= nr_checkboxes; j++) {
setColor_js(j, 'checkbox')
}
}
function setStatus_js(text) {
id = 'status';
if (document.getElementById) {
document.getElementById(id).value = text;
}
else if (document.all) {
document.all[id].value = text;
}
}
function toggleElement(name) {
var name_shown = name + '_shown';
var name_hidden = name + '_hidden';
if (document.getElementById) {
var element_shown = document.getElementById(name_shown);
var element_hidden = document.getElementById(name_hidden);
}
else if (document.all) {
var element_shown = document.all[name_shown];
var element_hidden = document.all[name_hidden];
}
if(element_shown.style.display == "none" || element_shown.style.display == false) {
element_shown.style.display = "block";
element_hidden.style.display = "none";
}
else if(element_shown.style.display == "block") {
element_shown.style.display = "none";
element_hidden.style.display = "block";
}
}

View file

@ -1,42 +0,0 @@
function submitBrowseForm(directory, entry, state, state2) {
// Check that at least 1 checkbox is checked
var nr_checkboxes_checked = 0;
if (state == 'calculatesize' || state == 'chmod' || state == 'copymovedelete' || state == 'downloadzip' ||
state == 'findstring' || state == 'rename' || state == 'unzip' || state == 'zip' || (state == 'edit' && state2 == '') || state == 'view' || state == 'update') {
for (var i = 0; i < document.forms['BrowseForm'].elements.length; i++) {
if (document.forms['BrowseForm'].elements[i].type == 'checkbox') {
if (document.forms['BrowseForm'].elements[i].checked == true) { nr_checkboxes_checked++; break; }
}
}
if (nr_checkboxes_checked == 0) {
alert('Please select at least one directory or file.');
return false;
}
}
// For the skins with a <select> drop-down box on top, determine the value of the
// 'entry' variable based on the first selected entry
if (entry == '' && (state == 'view' || state == 'edit' || state == 'update')) {
for (var i = 0; i < document.forms['BrowseForm'].elements.length; i++) {
if (document.forms['BrowseForm'].elements[i].type == 'checkbox') {
if (document.forms['BrowseForm'].elements[i].checked == true) { entry = document.forms['BrowseForm'].elements[i].value; break; }
}
}
}
// Set BrowseForm values
document.forms['BrowseForm'].state.value=state;
document.forms['BrowseForm'].state2.value=state2;
document.forms['BrowseForm'].directory.value=directory;
document.forms['BrowseForm'].entry.value=entry;
// Set the select back to the first entry
for (var i = 0; i < document.forms['BrowseForm'].elements.length; i++) {
if (document.forms['BrowseForm'].elements[i].name == 'BrowseSelect') { document.forms['BrowseForm'].BrowseSelect.selectedIndex = 0; }
}
// Submit
document.forms['BrowseForm'].submit();
}

View file

@ -1,21 +0,0 @@
function submitDirectoryTreeForm(last_directory_index) {
if (document.forms['DirectoryTreeForm'].DirectoryTreeSelect.selectedIndex <= last_directory_index) {
if (document.forms['DirectoryTreeForm'].DirectoryTreeSelect.options[document.forms['DirectoryTreeForm'].DirectoryTreeSelect.selectedIndex].value != 'up') {
if (document.forms['DirectoryTreeForm'].directory.value == '/') {
document.forms['DirectoryTreeForm'].directory.value = '/' + document.forms['DirectoryTreeForm'].DirectoryTreeSelect.options[document.forms['DirectoryTreeForm'].DirectoryTreeSelect.selectedIndex].value;
}
else {
document.forms['DirectoryTreeForm'].directory.value = document.forms['DirectoryTreeForm'].directory.value + '/' + document.forms['DirectoryTreeForm'].DirectoryTreeSelect.options[document.forms['DirectoryTreeForm'].DirectoryTreeSelect.selectedIndex].value;
}
}
else {
document.forms['DirectoryTreeForm'].directory.value = document.forms['DirectoryTreeForm'].updirectory.value;
}
}
else {
document.forms['DirectoryTreeForm'].state.value = 'followsymlink';
document.forms['DirectoryTreeForm'].state2.value = 'popup';
document.forms['DirectoryTreeForm'].entry.value = document.forms['DirectoryTreeForm'].DirectoryTreeSelect.options[document.forms['DirectoryTreeForm'].DirectoryTreeSelect.selectedIndex].value;
}
document.forms['DirectoryTreeForm'].submit();
}

View file

@ -1,190 +0,0 @@
<?php
// -------------------------------------------------------------------------------
// | net2ftp: a web based FTP client |
// | Copyright (c) 2003-2013 by David Gartner |
// | |
// | 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. |
// | |
// -------------------------------------------------------------------------------
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_sendHttpHeaders() {
// --------------
// This function sends HTTP headers
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
} // end net2ftp_sendHttpHeaders
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printJavascript() {
// --------------
// This function prints Javascript code and includes
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
// Code
// echo "<script type=\"text/javascript\"><!--\n";
// echo "//--></script>\n";
// Include
// echo "<script type=\"text/javascript\" src=\"". $net2ftp_globals["application_rootdir_url"] . "/modules/login/login.js\"></script>\n";
} // end net2ftp_printJavascript
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printCss() {
// --------------
// This function prints CSS code and includes
// --------------
global $net2ftp_settings, $net2ftp_globals;
// Include
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"". $net2ftp_globals["application_rootdir_url"] . "/skins/" . $net2ftp_globals["skin"] . "/css/main.css.php?ltr=" . __("ltr") . "&amp;image_url=" . urlEncode2($net2ftp_globals["image_url"]) . "\" />\n";
} // end net2ftp_printCssInclude
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printBodyOnload() {
// --------------
// This function prints the <body onload="" actions
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
// echo "";
} // end net2ftp_printBodyOnload
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printBody() {
// --------------
// This function prints the login screen
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result, $net2ftp_output;
if (isset($_POST["list"]) == true) { $list = getSelectedEntries($_POST["list"]); }
else { $list = ""; }
// -------------------------------------------------------------------------
// Variables
// -------------------------------------------------------------------------
// Title
$title = __("Size of selected directories and files");
// Form name, back and forward buttons
$formname = "CalculateSizeForm";
$back_onclick = "document.forms['" . $formname . "'].state.value='browse';document.forms['" . $formname . "'].state2.value='main';document.forms['" . $formname . "'].submit();";
// Open connection
setStatus(2, 10, __("Connecting to the FTP server"));
$conn_id = ftp_openconnection();
if ($net2ftp_result["success"] == false) { return false; }
// Calculate the size
$options = array();
$result['size'] = 0;
$result['skipped'] = 0;
$result = ftp_processfiles("calculatesize", $conn_id, $net2ftp_globals["directory"], $list, $options, $result, 0);
// Close connection
ftp_closeconnection($conn_id);
// Print message
$net2ftp_output["calculatesize"][] = __("The total size taken by the selected directories and files is:") . " <b>" . formatFilesize($result['size']) . "</b> (" . $result['size'] . " Bytes)";
if ($result['skipped'] > 0) {
$net2ftp_output["calculatesize"][] = __("The number of files which were skipped is:") . " <b>" . $result['skipped'] . "</b>";
}
// -------------------------------------------------------------------------
// Print the output
// -------------------------------------------------------------------------
require_once($net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php");
} // End net2ftp_printBody
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
?>

View file

@ -1,280 +0,0 @@
<?php
// -------------------------------------------------------------------------------
// | net2ftp: a web based FTP client |
// | Copyright (c) 2003-2013 by David Gartner |
// | |
// | 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. |
// | |
// -------------------------------------------------------------------------------
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_sendHttpHeaders() {
// --------------
// This function sends HTTP headers
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
} // end net2ftp_sendHttpHeaders
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printJavascript() {
// --------------
// This function prints Javascript code and includes
// --------------
global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
// Code
// echo "<script type=\"text/javascript\"><!--\n";
// echo "//--></script>\n";
// Include
echo "<script type=\"text/javascript\" src=\"". $net2ftp_globals["application_rootdir_url"] . "/modules/chmod/chmod.js\"></script>\n";
} // end net2ftp_printJavascript
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printCss() {
// --------------
// This function prints CSS code and includes
// --------------
global $net2ftp_settings, $net2ftp_globals;
// Include
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"". $net2ftp_globals["application_rootdir_url"] . "/skins/" . $net2ftp_globals["skin"] . "/css/main.css.php?ltr=" . __("ltr") . "&amp;image_url=" . urlEncode2($net2ftp_globals["image_url"]) . "\" />\n";
} // end net2ftp_printCssInclude
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printBodyOnload() {
// --------------
// This function prints the <body onload="" actions
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
// echo "";
} // end net2ftp_printBodyOnload
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printBody() {
// --------------
// This function prints the chmod screen
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result, $net2ftp_output;
if (isset($_POST["list"]) == true) { $list = getSelectedEntries($_POST["list"]); }
else { $list = ""; }
// -------------------------------------------------------------------------
// Variables for all screens
// -------------------------------------------------------------------------
// Title
$title = __("Chmod directories and files");
// Form name, back and forward buttons
$formname = "ChmodForm";
$back_onclick = "document.forms['" . $formname . "'].state.value='browse';document.forms['" . $formname . "'].state2.value='main';document.forms['" . $formname . "'].submit();";
$forward_onclick = "document.forms['" . $formname . "'].submit();";
// -------------------------------------------------------------------------
// Variables for screen 1
// -------------------------------------------------------------------------
if ($net2ftp_globals["screen"] == 1) {
// Next screen
$nextscreen = 2;
// Initialize variables
$directory_index = 1;
$file_index = 1;
$symlink_index = 1;
for ($i=1; $i<=count($list["all"]); $i++) {
if ($list["all"][$i]["dirorfile"] == "d") { $list["all"][$i]["message"] = __("Set the permissions of directory <b>%1\$s</b> to: ", $list["all"][$i]["dirfilename"]) . "<br />\n"; }
elseif ($list["all"][$i]["dirorfile"] == "-") { $list["all"][$i]["message"] = __("Set the permissions of file <b>%1\$s</b> to: ", $list["all"][$i]["dirfilename"]) . "<br />\n"; }
elseif ($list["all"][$i]["dirorfile"] == "l") { $list["all"][$i]["message"] = __("Set the permissions of symlink <b>%1\$s</b> to: ", $list["all"][$i]["dirfilename"]) . "<br />\n"; }
$owner_chmod = 0;
if (substr($list["all"][$i]["permissions"], 0, 1) == "r") { $owner_chmod+=4; $list["all"][$i]["owner_read"] = "checked=\"checked\""; }
else { $list["all"][$i]["owner_read"] = ""; }
if (substr($list["all"][$i]["permissions"], 1, 1) == "w") { $owner_chmod+=2; $list["all"][$i]["owner_write"] = "checked=\"checked\""; }
else { $list["all"][$i]["owner_write"] = ""; }
if (substr($list["all"][$i]["permissions"], 2, 1) == "x") { $owner_chmod+=1; $list["all"][$i]["owner_execute"] = "checked=\"checked\""; }
else { $list["all"][$i]["owner_execute"] = ""; }
$group_chmod = 0;
if (substr($list["all"][$i]["permissions"], 3, 1) == "r") { $group_chmod+=4; $list["all"][$i]["group_read"] = "checked=\"checked\""; }
else { $list["all"][$i]["group_read"] = ""; }
if (substr($list["all"][$i]["permissions"], 4, 1) == "w") { $group_chmod+=2; $list["all"][$i]["group_write"] = "checked=\"checked\""; }
else { $list["all"][$i]["group_write"] = ""; }
if (substr($list["all"][$i]["permissions"], 5, 1) == "x") { $group_chmod+=1; $list["all"][$i]["group_execute"] = "checked=\"checked\""; }
else { $list["all"][$i]["group_execute"] = ""; }
$other_chmod = 0;
if (substr($list["all"][$i]["permissions"], 6, 1) == "r") { $other_chmod+=4; $list["all"][$i]["other_read"] = "checked=\"checked\""; }
else { $list["all"][$i]["other_read"] = ""; }
if (substr($list["all"][$i]["permissions"], 7, 1) == "w") { $other_chmod+=2; $list["all"][$i]["other_write"] = "checked=\"checked\""; }
else { $list["all"][$i]["other_write"] = ""; }
if (substr($list["all"][$i]["permissions"], 8, 1) == "x") { $other_chmod+=1; $list["all"][$i]["other_execute"] = "checked=\"checked\""; }
else { $list["all"][$i]["other_execute"] = ""; }
$list["all"][$i]["chmodvalue"] = $owner_chmod.$group_chmod.$other_chmod;
if ($list["all"][$i]["dirorfile"] == "d") { $list["directories"][$directory_index]["chmodvalue"] = $list["all"][$i]["chmodvalue"]; $directory_index++; }
elseif ($list["all"][$i]["dirorfile"] == "-") { $list["files"][$file_index]["chmodvalue"] = $list["all"][$i]["chmodvalue"]; $file_index++; }
elseif ($list["all"][$i]["dirorfile"] == "l") { $list["symlinks"][$symlink_index]["chmodvalue"] = $list["all"][$i]["chmodvalue"]; $symlink_index++; }
} // end for
} // end if
// -------------------------------------------------------------------------
// Variables for screen 2
// -------------------------------------------------------------------------
elseif ($net2ftp_globals["screen"] == 2) {
// Initialize variables
$directory_index = 1;
$file_index = 1;
$symlink_index = 1;
// Calculate the chmod octal
for ($i=1; $i<=count($list["all"]); $i++) {
if (isset($list["all"][$i]["owner_read"]) == false) { $list["all"][$i]["owner_read"] = 0; }
if (isset($list["all"][$i]["owner_write"]) == false) { $list["all"][$i]["owner_write"] = 0; }
if (isset($list["all"][$i]["owner_execute"]) == false) { $list["all"][$i]["owner_execute"] = 0; }
if (isset($list["all"][$i]["group_read"]) == false) { $list["all"][$i]["group_read"] = 0; }
if (isset($list["all"][$i]["group_write"]) == false) { $list["all"][$i]["group_write"] = 0; }
if (isset($list["all"][$i]["group_execute"]) == false) { $list["all"][$i]["group_execute"] = 0; }
if (isset($list["all"][$i]["other_read"]) == false) { $list["all"][$i]["other_read"] = 0; }
if (isset($list["all"][$i]["other_write"]) == false) { $list["all"][$i]["other_write"] = 0; }
if (isset($list["all"][$i]["other_execute"]) == false) { $list["all"][$i]["other_execute"] = 0; }
$ownerOctal = $list["all"][$i]["owner_read"] + $list["all"][$i]["owner_write"] + $list["all"][$i]["owner_execute"];
$groupOctal = $list["all"][$i]["group_read"] + $list["all"][$i]["group_write"] + $list["all"][$i]["group_execute"];
$otherOctal = $list["all"][$i]["other_read"] + $list["all"][$i]["other_write"] + $list["all"][$i]["other_execute"];
$chmodOctal = $ownerOctal . $groupOctal . $otherOctal;
if ($chmodOctal > 777 || $chmodOctal < 0) {
$errormessage = __("The chmod nr <b>%1\$s</b> is out of the range 000-777. Please try again.", $chmodOctal);
setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
return false;
}
else {
$list["all"][$i]["chmodoctal"] = $chmodOctal;
if ($list["all"][$i]["dirorfile"] == "d") { $list["directories"][$directory_index]["chmodoctal"] = $list["all"][$i]["chmodoctal"]; $directory_index++; }
elseif ($list["all"][$i]["dirorfile"] == "-") { $list["files"][$file_index]["chmodoctal"] = $list["all"][$i]["chmodoctal"]; $file_index++; }
elseif ($list["all"][$i]["dirorfile"] == "l") { $list["symlinks"][$symlink_index]["chmodoctal"] = $list["all"][$i]["chmodoctal"]; $symlink_index++; }
}
} // End for
// Open connection
setStatus(2, 10, __("Connecting to the FTP server"));
$conn_id = ftp_openconnection();
if ($conn_id == false) { return false; }
// Chmod the entries
setStatus(4, 10, __("Processing the entries"));
ftp_chmod2($conn_id, $net2ftp_globals["directory"], $list, 0);
if ($net2ftp_result["success"] == false) { return false; }
// Close connection
ftp_closeconnection($conn_id);
} // end elseif
// -------------------------------------------------------------------------
// Print the output
// -------------------------------------------------------------------------
require_once($net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php");
} // End net2ftp_printBody
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
?>

View file

@ -1,127 +0,0 @@
function update_field(id,text) {
if (document.getElementById) {
document.getElementById(id).value = text;
}
else if (document.all) {
document.all[id].value = text;
}
}
function get_field(id) {
if (document.getElementById) {
var value = document.getElementById(id).value;
}
else if (document.all) {
var value = document.all[id].value;
}
return value;
}
function update_input(num) {
var myform = document.forms['ChmodForm'];
var myfield = 'chmod';
var regexp = /list\[([0-9]+)\]\[(owner|group|other)_(read|write|execute)\]/i;
var myArray = new Array();
var maxfields = 0;
for (var i = 0; i < myform.elements.length; i++) {
if (regexp.test(myform.elements[i].name)) {
var ar = regexp.exec(myform.elements[i].name);
var checked = myform.elements[i].checked;
if (maxfields<ar[1]) maxfields = ar[1];
myArray[myArray.length] = new Array(ar[1],ar[2],ar[3],checked);
}
}
if (!num || num=="all" || num == '') num = 0;
for(var i=0; i<maxfields; i++) {
var id = i+1;
if (num==0 || num==id) {
var owner = 0;
var group = 0;
var other = 0;
var add = 0;
for (var j=0; j<myArray.length; j++) {
checked = myArray[j][3];
if (checked && id==myArray[j][0]) {
if(myArray[j][2]=='read') add = 4;
else if(myArray[j][2]=='write') add = 2;
else if(myArray[j][2]=='execute') add = 1;
if(myArray[j][1]=='owner') owner += add;
else if(myArray[j][1]=='group') group += add;
else if(myArray[j][1]=='other') other += add;
}
}
update_field(myfield+id,owner+''+group+''+other);
if (num!=0 && num==id) break;
}
}
}
function update_checkbox(num) {
var myform = document.forms['ChmodForm'];
var myfield = 'chmod';
var regexp = /list\[([0-9]+)\]\[(owner|group|other)_(read|write|execute)\]/i;
if (!num || num=="all" || num == '') num = 0;
for (var i = 0; i < myform.elements.length; i++) {
var name = myform.elements[i].name;
if (name.substr(0,myfield.length) == myfield) {
var id = name.substr(myfield.length,name.length);
if (id>0 && (num==0 || num==id)) {
var field = get_field(myfield+id);
var o = field.substr(0,1);
var g = field.substr(1,1);
var e = field.substr(2,1);
if (field.length==3 && o>=0 && o<=7 && g>=0 && g<=7 && e>=0 && e<=7) {
for (var j = 0; j < myform.elements.length; j++) {
if (regexp.test(myform.elements[j].name)) {
var ar = regexp.exec(myform.elements[j].name);
if (ar[1]==id) {
var check = false;
if (ar[2]=='owner') {
if (ar[3]=='read' && (o==4 || o==5 || o==6 || o==7))
check = true;
if (ar[3]=='write' && (o==2 || o==3 || o==6 || o==7))
check = true;
if (ar[3]=='execute' && (o==1 || o==3 || o==5 || o==7))
check = true;
}
else if (ar[2]=='group') {
if (ar[3]=='read' && (g==4 || g==5 || g==6 || g==7))
check = true;
if (ar[3]=='write' && (g==2 || g==3 || g==6 || g==7))
check = true;
if (ar[3]=='execute' && (g==1 || g==3 || g==5 || g==7))
check = true;
}
else if (ar[2]=='other') {
if (ar[3]=='read' && (e==4 || e==5 || e==6 || e==7))
check = true;
if (ar[3]=='write' && (e==2 || e==3 || e==6 || e==7))
check = true;
if (ar[3]=='execute' && (e==1 || e==3 || e==5 || e==7))
check = true;
}
if (check==true) myform.elements[j].checked = 1;
else myform.elements[j].checked = 0;
}
}
}
}
else {
update_input(id);
}
}
}
}
}
function CopyCheckboxToAll(myform, mysourcefieldname, mytargetfieldname) {
for (var i = 0; i < myform.elements.length; i++) {
if (myform.elements[i].name.indexOf(mysourcefieldname) >= 0) {
for (var j = 0; j < myform.elements.length; j++) {
if (myform.elements[j].name.indexOf(mytargetfieldname) >= 0) {
myform.elements[j].checked = myform.elements[i].checked;
}
}
}
}
}

View file

@ -1,52 +0,0 @@
<?php
// -------------------------------------------------------------------------------
// | net2ftp: a web based FTP client |
// | Copyright (c) 2003-2013 by David Gartner |
// | |
// | 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. |
// | |
// -------------------------------------------------------------------------------
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_sendHttpHeaders() {
// --------------
// This function sends HTTP headers
// --------------
setcookie("net2ftpcookie_ftpserver", "", 1);
setcookie("net2ftpcookie_ftpserverport", "", 1);
setcookie("net2ftpcookie_username", "", 1);
setcookie("net2ftpcookie_language", "", 1);
setcookie("net2ftpcookie_skin", "", 1);
setcookie("net2ftpcookie_ftpmode", "", 1);
setcookie("net2ftpcookie_passivemode", "", 1);
setcookie("net2ftpcookie_protocol", "", 1);
setcookie("net2ftpcookie_viewmode", "", 1);
setcookie("net2ftpcookie_sort", "", 1);
setcookie("net2ftpcookie_sortorder", "", 1);
setcookie("net2ftpcookie_directory", "", 1);
header("Location: index.php");
} // end net2ftp_sendHttpHeaders
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
?>

View file

@ -1,290 +0,0 @@
<?php
// -------------------------------------------------------------------------------
// | net2ftp: a web based FTP client |
// | Copyright (c) 2003-2013 by David Gartner |
// | |
// | 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. |
// | |
// -------------------------------------------------------------------------------
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_sendHttpHeaders() {
// --------------
// This function sends HTTP headers
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
} // end net2ftp_sendHttpHeaders
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printJavascript() {
// --------------
// This function prints Javascript code and includes
// --------------
global $net2ftp_settings, $net2ftp_globals, $net2ftp_result;
// -------------------------------------------------------------------------
// Mobile skins
// -------------------------------------------------------------------------
if ($net2ftp_globals["skin"] == "mobile" || $net2ftp_globals["skin"] == "iphone") {
echo "<script type=\"text/javascript\"><!--\n";
echo "function CopyValueToAll(myform, mysourcefield, mytargetfieldname) {\n";
echo " for (var i = 0; i < myform.elements.length; i++) {\n";
echo " if (myform.elements[i].name.indexOf(mytargetfieldname) >= 0) {\n";
echo " myform.elements[i].value = mysourcefield.value;\n";
echo " }\n";
echo " }\n";
echo "}\n";
echo "//--></script>\n";
}
// -------------------------------------------------------------------------
// Other skins
// -------------------------------------------------------------------------
else {
echo "<script type=\"text/javascript\"><!--\n";
echo "function createDirectoryTreeWindow(directory, FormAndFieldName) {\n";
echo " directoryTreeWindow = window.open(\"\",\"directoryTreeWindow\",\"height=450,width=300,resizable=yes,scrollbars=yes\");\n";
echo " var d = directoryTreeWindow.document;\n";
echo " d.writeln('<html>');\n";
echo " d.writeln('<head>');\n";
echo " d.writeln('<title>" . __("Choose a directory") . "<\/title>');\n";
echo " d.writeln('<\/head>');\n";
echo " d.writeln('<bo' + 'dy on' + 'load=\"document.DirectoryTreeForm.submit();\">');\n";
// echo " d.writeln('<body>');\n";
echo " d.writeln('" . __("Please wait...") . "<br /><br />');\n";
echo " d.writeln('<form name=\"DirectoryTreeForm\" id=\"DirectoryTreeForm\" action=\"" . printPHP_SELF("createDirectoryTreeWindow") . "\" method=\"post\" />');\n";
printLoginInfo_javascript();
echo " d.writeln('<input type=\"hidden\" name=\"state\" value=\"browse\" />');\n";
echo " d.writeln('<input type=\"hidden\" name=\"state2\" value=\"popup\" />');\n";
echo " d.writeln('<input type=\"hidden\" name=\"directory\" value=\"' + directory + '\" />');\n";
echo " d.writeln('<input type=\"hidden\" name=\"FormAndFieldName\" value=\"' + FormAndFieldName + '\" />');\n";
echo " d.writeln('<\/form>');\n";
echo " d.writeln('<\/div>');\n";
echo " d.writeln('<\/body>');\n";
echo " d.writeln('<\/html>');\n";
echo " d.close();\n";
echo "} // end function createDirectoryTreeWindow\n";
echo "\n";
echo "function CopyValueToAll(myform, mysourcefield, mytargetfieldname) {\n";
echo " for (var i = 0; i < myform.elements.length; i++) {\n";
echo " if (myform.elements[i].name.indexOf(mytargetfieldname) >= 0) {\n";
echo " myform.elements[i].value = mysourcefield.value;\n";
echo " }\n";
echo " }\n";
echo "}\n";
echo "//--></script>\n";
}
} // end net2ftp_printJavascript
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printCss() {
// --------------
// This function prints CSS code and includes
// --------------
global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages;
// Include
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"". $net2ftp_globals["application_rootdir_url"] . "/skins/" . $net2ftp_globals["skin"] . "/css/main.css.php?ltr=" . __("ltr") . "&amp;image_url=" . urlEncode2($net2ftp_globals["image_url"]) . "\" />\n";
} // end net2ftp_printCssInclude
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printBodyOnload() {
// --------------
// This function prints the <body onload="" actions
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_result;
// echo "";
} // end net2ftp_printBodyOnload
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printBody() {
// --------------
// This function prints the copy/move/delete screen
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result, $net2ftp_output;
if (isset($_POST["list"]) == true) { $list = getSelectedEntries($_POST["list"]); }
else { $list = ""; }
if (isset($_POST["ftpserver2"]) == true) { $net2ftp_globals["ftpserver2"] = validateFtpserver($_POST["ftpserver2"]); }
else { $net2ftp_globals["ftpserver2"] = ""; }
if (isset($_POST["ftpserverport2"]) == true) { $net2ftp_globals["ftpserverport2"] = validateFtpserverport($_POST["ftpserverport2"]); }
else { $net2ftp_globals["ftpserverport2"] = ""; }
if (isset($_POST["username2"]) == true) { $net2ftp_globals["username2"] = validateUsername($_POST["username2"]); }
else { $net2ftp_globals["username2"] = ""; }
if (isset($_POST["password2"]) == true) { $net2ftp_globals["password2"] = validatePassword($_POST["password2"]); }
else { $net2ftp_globals["password2"] = ""; }
if (isset($_POST["protocol2"]) == true) { $net2ftp_globals["protocol2"] = validateProtocol($_POST["protocol2"]); }
else { $net2ftp_globals["protocol2"] = ""; }
// -------------------------------------------------------------------------
// Variables for all screens
// -------------------------------------------------------------------------
// Title
if ($net2ftp_globals["state2"] == "copy") {
$title = __("Copy directories and files");
}
elseif ($net2ftp_globals["state2"] == "move") {
$title = __("Move directories and files");
}
elseif ($net2ftp_globals["state2"] == "delete") {
$title = __("Delete directories and files");
}
// Form name, back and forward buttons
$formname = "CopyMoveDeleteForm";
$back_onclick = "document.forms['" . $formname . "'].state.value='browse';document.forms['" . $formname . "'].state2.value='main';document.forms['" . $formname . "'].submit();";
$forward_onclick = "document.forms['" . $formname . "'].submit();";
// -------------------------------------------------------------------------
// Variables for screen 1
// -------------------------------------------------------------------------
if ($net2ftp_globals["screen"] == 1) {
// Next screen
$nextscreen = 2;
// Protocol
$protocol["inputType"] = "hidden";
$protocol["list"][1] = "FTP";
if (function_exists("ssh2_connect") == true) { $protocol["list"][2] = "FTP over SSH2"; $protocol["inputType"] = "select"; }
if (function_exists("ftp_ssl_connect") == true) { $protocol["list"][3] = "FTP with SSL"; $protocol["inputType"] = "select"; }
} // end if
// -------------------------------------------------------------------------
// Variables for screen 2
// -------------------------------------------------------------------------
elseif ($net2ftp_globals["screen"] == 2) {
// ---------------------------------------
// Open connection to the source server
// ---------------------------------------
setStatus(2, 10, __("Connecting to the FTP server"));
$conn_id_source = ftp_openconnection();
if ($net2ftp_result["success"] == false) { return false; }
// ---------------------------------------
// Open connection to the target server, if it is different from the source server, or if the username
// is different (different users may have different authorizations on the same FTP server)
// ---------------------------------------
if (($net2ftp_globals["ftpserver2"] != "" || $net2ftp_globals["username2"] != "") &&
($net2ftp_globals["ftpserver2"] != $net2ftp_globals["ftpserver"] || $net2ftp_globals["username2"] != $net2ftp_globals["username"])) {
$conn_id_target = ftp_openconnection2(); // Note: ftp_openconnection2 cleans the input values
if ($net2ftp_result["success"] == false) { return false; }
}
else { $conn_id_target = $conn_id_source; }
// ---------------------------------------
// Copy, move or delete the files and directories
// ---------------------------------------
ftp_copymovedelete($conn_id_source, $conn_id_target, $list, $net2ftp_globals["state2"], 0);
// ---------------------------------------
// Close the connection to the source server
// ---------------------------------------
ftp_closeconnection($conn_id_source);
// ---------------------------------------
// Close the connection to the target server, if it is different from the source server
// ---------------------------------------
if ($conn_id_source != $conn_id_target) { ftp_closeconnection($conn_id_target); }
} // end elseif
// -------------------------------------------------------------------------
// Print the output
// -------------------------------------------------------------------------
require_once($net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php");
} // End net2ftp_printBody
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
?>

View file

@ -1,48 +0,0 @@
<?php
// -------------------------------------------------------------------------------
// | net2ftp: a web based FTP client |
// | Copyright (c) 2003-2013 by David Gartner |
// | |
// | 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. |
// | |
// -------------------------------------------------------------------------------
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_sendHttpHeaders() {
// --------------
// This function sends HTTP headers
// --------------
global $net2ftp_globals, $net2ftp_settings;
if ($net2ftp_settings["functionuse_downloadfile"] == "yes") {
ftp_downloadfile($net2ftp_globals["directory"], $net2ftp_globals["entry"]);
}
else {
$errormessage = __("This function has been disabled by the Administrator of this website.");
setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
return false;
}
} // end net2ftp_sendHttpHeaders
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
?>

View file

@ -1,55 +0,0 @@
<?php
// -------------------------------------------------------------------------------
// | net2ftp: a web based FTP client |
// | Copyright (c) 2003-2013 by David Gartner |
// | |
// | 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. |
// | |
// -------------------------------------------------------------------------------
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_sendHttpHeaders() {
// --------------
// This function sends HTTP headers
// --------------
global $net2ftp_globals, $net2ftp_settings;
if (isset($_POST["list"]) == true) { $list = getSelectedEntries($_POST["list"]); }
elseif (isset($_GET["list"]) == true) { $list = getSelectedEntries($_GET["list"]); }
else { $list = ""; }
if ($net2ftp_settings["functionuse_downloadzip"] == "yes") {
$zipactions["download"] = "yes";
$zipactions["email"] = "no";
$zipactions["save"] = "no";
ftp_zip("", $net2ftp_globals["directory"], $list, $zipactions, "", 0);
}
else {
$errormessage = __("This function has been disabled by the Administrator of this website.");
setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
return false;
}
} // end net2ftp_sendHttpHeaders
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
?>

View file

@ -1,763 +0,0 @@
<?php
// -------------------------------------------------------------------------------
// | net2ftp: a web based FTP client |
// | Copyright (c) 2003-2013 by David Gartner |
// | |
// | 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. |
// | |
// -------------------------------------------------------------------------------
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_sendHttpHeaders() {
// --------------
// This function sends HTTP headers
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
} // end net2ftp_sendHttpHeaders
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printJavascript() {
// --------------
// This function prints Javascript code and includes
// --------------
global $net2ftp_settings, $net2ftp_globals;
if (isset($_POST["textareaType"]) == true) { $textareaType = validateTextareaType($_POST["textareaType"]); }
else { $textareaType = ""; }
// -------------------------------------------------------------------------
// Do not print anything for Mobile skins
// -------------------------------------------------------------------------
if ($net2ftp_globals["skin"] == "mobile" || $net2ftp_globals["skin"] == "iphone") {
}
// -------------------------------------------------------------------------
// For the other skins, do print more Javascript functions
// -------------------------------------------------------------------------
else {
if ($textareaType == "" || $textareaType == "plain") {
echo "<script type=\"text/javascript\"><!--\n";
echo "function TabText() {\n";
echo " if (event != null) {\n";
echo " if (event.srcElement) {\n";
echo " if (event.srcElement.value) {\n";
echo " if (event.keyCode == 9) {\n";
echo " if (document.selection != null) {\n";
echo " document.selection.createRange().text = '\\t';\n";
echo " event.returnValue = false;\n";
echo " }\n";
echo " else {\n";
echo " event.srcElement.value += '\\t';\n";
echo " return false;\n";
echo " }\n";
echo " }\n";
echo " }\n";
echo " }\n";
echo " }\n";
echo "}\n";
echo "//--></script>\n";
}
// Include
echo "<script type=\"text/javascript\" src=\"". $net2ftp_globals["application_rootdir_url"] . "/modules/edit/edit.js\"></script>\n";
}
} // end net2ftp_printJavascript
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printCss() {
// --------------
// This function prints CSS code and includes
// --------------
global $net2ftp_settings, $net2ftp_globals;
// Include
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"". $net2ftp_globals["application_rootdir_url"] . "/skins/" . $net2ftp_globals["skin"] . "/css/main.css.php?ltr=" . __("ltr") . "&amp;image_url=" . urlEncode2($net2ftp_globals["image_url"]) . "\" />\n";
} // end net2ftp_printCssInclude
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printBodyOnload() {
// --------------
// This function prints the <body onload="" actions
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
// echo "";
} // end net2ftp_printBodyOnload
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printBody() {
// --------------
// This function prints the edit screen
// For screen == 1, the file is read from the FTP server
// For screen == 2, the textarea is changed, the file is not read from the FTP server but comes from the HTML form
// For screen == 3, the file is saved to the FTP server
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
if (isset($_POST["textareaType"]) == true) { $textareaType = validateTextareaType($_POST["textareaType"]); }
else { $textareaType = ""; }
if (isset($_POST["text"]) == true) { $text = $_POST["text"]; }
else { $text = ""; }
if (isset($_POST["text_splitted"]) == true) { $text_splitted = $_POST["text_splitted"]; }
else { $text_splitted = ""; }
if (isset($_POST["encodingSelect"]) == true) { $encodingSelect = $_POST["encodingSelect"]; }
else { $encodingSelect = ""; }
if (isset($_POST["breakSelect"]) == true) { $breakSelect = $_POST["breakSelect"]; }
else { $breakSelect = ""; }
$text_encoding_selected = "";
$line_break_selected = "";
// -------------------------------------------------------------------------
// Variables for all screens
// -------------------------------------------------------------------------
// Form name, back and forward buttons
$formname = "EditForm";
$back_onclick = "document.forms['" . $formname . "'].state.value='browse';document.forms['" . $formname . "'].state2.value='main';document.forms['" . $formname . "'].submit();";
// Directory + file name
$dirfilename = htmlEncode2(glueDirectories($net2ftp_globals["directory"], $net2ftp_globals["entry"]));
// TextareaSelect onchange
$onchange = "document.forms['EditForm'].screen.value=2;document.forms['EditForm'].textareaType.value=document.forms['EditForm'].textareaSelect.options[document.forms['EditForm'].textareaSelect.selectedIndex].value;document.forms['EditForm'].submit();";
// Character encoding (requires multibyte string module to be installed)
// With this, you can save a text with specified encoding and line break sequence
// http://www.net2ftp.org/forums/viewtopic.php?id=2449
if (($net2ftp_globals["language"] == "ja" || $net2ftp_globals["language"] == "tc" || $net2ftp_messages["iso-8859-1"] == "UTF-8") && function_exists("mb_detect_encoding") == true) {
// $textarea_encodings is an array which contains the possible character encodings
$textarea_encodings = getTextareaEncodingsArray();
// $textarea_breaks is an array which contains the possible line breaks
$textarea_breaks[] = "CRLF";
$textarea_breaks[] = "CR";
$textarea_breaks[] = "LF";
// $text_encoding_old is the original encoding which is detected when the file is first read
// $text_encoding_new is the requested encoding from the drop-down box
// Default = encoding used for the page, which is defined by the language file in /languages/xx.inc.php
// HTML uses BIG5, PHP uses BIG-5 (Traditional Chinese)
// If the HTML encoding is not foreseen in the PHP function, set it to the default ISO-8859-1
// $text_encoding is changed further on too
if($encodingSelect != "" && in_array($encodingSelect, $textarea_encodings)) { $text_encoding_new = $encodingSelect; }
else { $text_encoding_new = ""; }
// $line_break_old is the original line break which is detected when the file is first read
// $line_break is the requested line break from the drop-down box
if($breakSelect != "" && in_array($breakSelect, $textarea_breaks) == true) { $line_break_new = $breakSelect; }
else { $line_break_new = "LF"; }
}
// Programming language (for Ace syntax highlighting)
if ($textareaType == "ace") {
// See examples at http://ace.ajax.org/build/kitchen-sink.html
$ace_theme = "eclipse";
$filename_extension = get_filename_extension($net2ftp_globals["entry"]);
if ($filename_extension == "abap") { $ace_mode = "abap"; }
elseif ($filename_extension == "css") { $ace_mode = "css"; }
elseif ($filename_extension == "cgi") { $ace_mode = "perl"; }
elseif ($filename_extension == "htm") { $ace_mode = "html"; }
elseif ($filename_extension == "html") { $ace_mode = "html"; }
elseif ($filename_extension == "java") { $ace_mode = "java"; }
elseif ($filename_extension == "js") { $ace_mode = "javascript"; }
elseif ($filename_extension == "javascript") { $ace_mode = "javascript"; }
elseif ($filename_extension == "pl") { $ace_mode = "perl"; }
elseif ($filename_extension == "perl") { $ace_mode = "perl"; }
elseif ($filename_extension == "php") { $ace_mode = "php"; }
elseif ($filename_extension == "phps") { $ace_mode = "php"; }
elseif ($filename_extension == "phtml") { $ace_mode = "php"; }
elseif ($filename_extension == "py") { $ace_mode = "python"; }
elseif ($filename_extension == "ruby") { $ace_mode = "ruby"; }
elseif ($filename_extension == "sh") { $ace_mode = "sh"; }
elseif ($filename_extension == "sql") { $ace_mode = "sql"; }
elseif ($filename_extension == "txt") { $ace_mode = "text"; }
elseif ($filename_extension == "xml") { $ace_mode = "xml"; }
else { $ace_mode = "text"; }
}
else {
$ace_mode = "";
}
// -------------------------------------------------------------------------
// Variables for screen 1
// Read the remote file (edit), or read the local template (new file)
// -------------------------------------------------------------------------
if ($net2ftp_globals["screen"] == 1) {
// Template file
$templatefile = $net2ftp_globals["application_rootdir"] . "/modules/edit/template.txt";
// Edit: read the file from the FTP server
if ($net2ftp_globals["state2"] == "") {
$text = ftp_readfile("", $net2ftp_globals["directory"], $net2ftp_globals["entry"]);
if ($net2ftp_result["success"] == false) { return false; }
// Character encoding (requires multibyte string module to be installed)
// Detect the original encoding of the text, and change the encoding of the text to the encoding of the page
if (($net2ftp_globals["language"] == "ja" || $net2ftp_globals["language"] == "tc" || $net2ftp_messages["iso-8859-1"] == "UTF-8") && function_exists("mb_detect_encoding") == true) {
// Detect original encoding
$text_encoding_old = mb_detect_encoding($text, $textarea_encodings);
$text_encoding_selected = $text_encoding_old;
// If original encoding is detected and different from the page encoding, convert the text to the page encoding
if($text_encoding_old != "" && strcasecmp($text_encoding_old, $net2ftp_messages["iso-8859-1"]) != 0) {
$text = mb_convert_encoding($text, $net2ftp_messages["iso-8859-1"], $text_encoding_old);
}
// Detect original line break
if (strpos($text, "\r\n") !== false) { $line_break_old = "CRLF"; }
elseif (strpos($text, "\n") !== false) { $line_break_old = "LF"; }
elseif (strpos($text, "\r") !== false) { $line_break_old = "CR"; }
else { $line_break_old = "LF"; }
$line_break_selected = $line_break_old;
}
}
// New file: read the template file
elseif ($net2ftp_globals["state2"] == "newfile") {
$handle = fopen($templatefile, "r"); // Open the local template file for reading only
if ($handle == false) {
$errormessage = __("Unable to open the template file");
setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
return false;
}
clearstatcache(); // for filesize
$text = trim(fread($handle, filesize($templatefile)));
if ($text == false) {
$errormessage = __("Unable to read the template file");
setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
return false;
}
@fclose($handle);
}
// Save status
$savestatus = __("Status: This file has not yet been saved");
$savestatus_short = __("Not yet saved");
}
// -------------------------------------------------------------------------
// Variables for screen 2
// Change the textarea without saving the changes to the FTP server
// -------------------------------------------------------------------------
elseif ($net2ftp_globals["screen"] == 2) {
// For HTML WYSIWYG editors, split the HTML
if (($textareaType == "tinymce" || $textareaType == "ckeditor") && $text_splitted == "") {
$text_splitted = splitHtml($text, $textareaType);
}
// For other textareas, join the HTML
elseif (($textareaType == "plain" || $textareaType == "ace") && $text == "" && isset($text_splitted["top"]) == true) {
$text = $text_splitted["top"];
$text .= $text_splitted["middle"];
$text .= $text_splitted["bottom"];
}
// Save status
$savestatus = __("Status: This file has not yet been saved");
$savestatus_short = __("Not yet saved");
}
// -------------------------------------------------------------------------
// Variables for screen 3
// Save the changes to the FTP server
// -------------------------------------------------------------------------
elseif ($net2ftp_globals["screen"] == 3) {
// Check if a filename is specified
if (strlen($net2ftp_globals["entry"])<1) {
$errormessage = __("Please specify a filename");
setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
return false;
}
// For HTML WYSIWYG editors, join the HTML
if ($textareaType == "tinymce" || $textareaType == "ckeditor") {
$text = $text_splitted["top"];
$text .= $text_splitted["middle"];
$text .= $text_splitted["bottom"];
}
// $text_file contains the text which is written to the FTP server
// It is equal to the text shown on screen, except if a different character encoding is chosen
$text_file = $text;
// Character encoding (requires multibyte string module to be installed)
// Change the encoding of the text from the original or page encoding to the selected encoding
if (($net2ftp_globals["language"] == "ja" || $net2ftp_globals["language"] == "tc" || $net2ftp_messages["iso-8859-1"] == "UTF-8") && function_exists("mb_detect_encoding") == true) {
$break_map = array("CRLF" => "\r\n", "CR" => "\r", "LF" => "\n");
if(isset($break_map[$line_break_new]) == true) {
$text_file = preg_replace('/(\\r\\n)|\\r|\\n/', $break_map[$line_break_new], $text_file);
}
if($text_encoding_new != "" && strcasecmp($text_encoding_new, $net2ftp_messages["iso-8859-1"]) != 0) {
$text_file = mb_convert_encoding($text_file, $text_encoding_new, $net2ftp_messages["iso-8859-1"]);
}
$text_encoding_selected = $text_encoding_new;
$line_break_selected = $line_break_new;
}
// Write the string to the FTP server
// Note: this function also replaces CarriageReturn+LineFeed by LineFeed
ftp_writefile("", $net2ftp_globals["directory"], $net2ftp_globals["entry"], $text_file);
if ($net2ftp_result["success"] == false) {
setErrorVars(true, "", "", "", ""); // Continue anyway and print warning message
$savestatus = __("Status: <b>This file could not be saved</b>");
$savestatus_short = __("Could not be saved");
}
else {
$mytime = mytime();
$mytime_short = mytime_short();
$ftpmode = ftpAsciiBinary($net2ftp_globals["entry"]);
if ($ftpmode == FTP_ASCII) { $printftpmode = "FTP_ASCII"; }
elseif ($ftpmode == FTP_BINARY) { $printftpmode = "FTP_BINARY"; }
$savestatus = __("Status: Saved on <b>%1\$s</b> using mode %2\$s", $mytime, $printftpmode);
$savestatus_short = __("Saved at %1\$s", $mytime_short);
}
}
// -------------------------------------------------------------------------
// Convert special characters to HTML entities
// -------------------------------------------------------------------------
// Plain textarea
if ($textareaType == "" || $textareaType == "plain") {
$text = htmlspecialchars($text, ENT_QUOTES);
}
// CKEditor
elseif ($textareaType == "ckeditor") {
$text_splitted["top"] = htmlspecialchars($text_splitted["top"], ENT_QUOTES);
$text_splitted["bottom"] = htmlspecialchars($text_splitted["bottom"], ENT_QUOTES);
// Do not encode the middle part, this is done by CKEditor itself
// $text_splitted["middle"] = htmlspecialchars($text_splitted["middle"], ENT_QUOTES);
}
// TinyMCE
elseif ($textareaType == "tinymce") {
$text_splitted["top"] = htmlspecialchars($text_splitted["top"], ENT_QUOTES);
$text_splitted["middle"] = htmlspecialchars($text_splitted["middle"], ENT_QUOTES);
$text_splitted["bottom"] = htmlspecialchars($text_splitted["bottom"], ENT_QUOTES);
}
// Ace
elseif ($textareaType == "ace") {
$text = htmlspecialchars($text, ENT_QUOTES);
$ace_onclick = "document.forms['" . $formname . "'].text.value=editor.getValue();";
}
// -------------------------------------------------------------------------
// Print the output
// -------------------------------------------------------------------------
require_once($net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/edit.template.php");
} // End net2ftp_printBody
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function printTextareaSelect($onchange) {
// --------------
// This function prints a select with the available textareas
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_globals;
$pluginProperties = getPluginProperties();
if (isset($_POST["textareaType"]) == true) { $textareaType = validateTextareaType($_POST["textareaType"]); }
else { $textareaType = ""; }
$filename_extension = get_filename_extension($net2ftp_globals["entry"]);
// Convert *htm* to html
if (strpos($filename_extension, "htm") !== false) { $filename_extension = "html"; }
echo "<select name=\"textareaSelect\" id=\"textareaSelect\" onchange=\"$onchange\">\n";
if ($textareaType == "" || $textareaType == "plain") { $plainselected = "selected=\"selected\""; }
echo "<option value=\"plain\" $plainselected>Normal textarea</option>\n";
while(list($pluginName, $value) = each($pluginProperties)) {
// Print only the plugins which have 'use' set to yes
// which are textareas
// which are suitable for this browser
// which are suitable for this type of file
if ($pluginProperties[$pluginName]["use"] == "yes" && $pluginProperties[$pluginName]["type"] == "textarea" && in_array($net2ftp_globals["browser_agent"], $pluginProperties[$pluginName]["browsers"]) == true && in_array($filename_extension, $pluginProperties[$pluginName]["filename_extensions"]) == true) {
if ($pluginName == $textareaType) { $selected = "selected=\"selected\""; }
else { $selected = ""; }
echo "<option value=\"$pluginName\" $selected>" . $pluginProperties[$pluginName]["label"] . "</option>\n";
} // end if
} // end while
echo "</select>\n";
} // End function printTextareaSelect
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function printEncodingSelect($text_encoding) {
// --------------
// This function prints a select with the available encodings
// --------------
global $net2ftp_globals, $net2ftp_messages;
if (($net2ftp_globals["language"] == "ja" || $net2ftp_globals["language"] == "tc" || $net2ftp_messages["iso-8859-1"] == "UTF-8") && function_exists("mb_detect_encoding") == true) {
$textarea_encodings = getTextareaEncodingsArray();
echo "<select name=\"encodingSelect\" id=\"encodingSelect\" style=\"width: 100px;\">\n";
foreach($textarea_encodings as $value) {
if(strcasecmp($value, $text_encoding) == 0) { $selected = "selected=\"selected\""; }
else { $selected = ""; }
echo "<option value=\"$value\" $selected>$value</option>\n";
}
echo "</select>\n";
}
} // End function printEncodingSelect
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function printLineBreakSelect($line_break) {
// --------------
// This function prints a select with the available line-break sequences.
// --------------
global $net2ftp_messages, $net2ftp_globals;
if (($net2ftp_globals["language"] == "ja" || $net2ftp_globals["language"] == "tc" || $net2ftp_messages["iso-8859-1"] == "UTF-8") && function_exists("mb_detect_encoding") == true) {
echo "<select name=\"breakSelect\" id=\"breakSelect\" style=\"width: 60px;\">\n";
foreach(array("CRLF", "CR", "LF") as $value) {
if(strcasecmp($value, $line_break) == 0) { $selected = "selected=\"selected\""; }
else { $selected = ""; }
echo "<option value=\"$value\" $selected>$value</option>\n";
}
echo "</select>\n";
}
} // End function printLineBreakSelect
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function getTextareaEncodingsArray() {
// --------------
// This function returns an array which contains the possible character encodings
// See the "Supported Character Encodings" section at http://www.php.net/manual/en/ref.mbstring.php
// --------------
global $net2ftp_globals;
if ($net2ftp_globals["language"] == "ja") {
$textarea_encodings[] = "UTF-8";
$textarea_encodings[] = "EUC-JP";
$textarea_encodings[] = "SJIS";
}
elseif ($net2ftp_globals["language"] == "tc" || $net2ftp_globals["language"] == "zh") {
$textarea_encodings[] = "UTF-8";
$textarea_encodings[] = "BIG-5";
}
else {
// BIG-5 must be before SJIS, otherwise BIG-5 text is incorrectly identified as SJIS
$textarea_encodings[] = "UTF-8";
$textarea_encodings[] = "ISO-8859-1";
}
/*
$textarea_encodings[] = "ISO-8859-1";
$textarea_encodings[] = "UCS-4";
$textarea_encodings[] = "UCS-4BE";
$textarea_encodings[] = "UCS-4LE";
$textarea_encodings[] = "UCS-2";
$textarea_encodings[] = "UCS-2BE";
$textarea_encodings[] = "UCS-2LE";
$textarea_encodings[] = "UTF-32";
$textarea_encodings[] = "UTF-32BE";
$textarea_encodings[] = "UTF-32LE";
$textarea_encodings[] = "UTF-16";
$textarea_encodings[] = "UTF-16BE";
$textarea_encodings[] = "UTF-16LE";
$textarea_encodings[] = "UTF-7";
$textarea_encodings[] = "UTF7-IMAP";
$textarea_encodings[] = "UTF-8";
$textarea_encodings[] = "ASCII";
$textarea_encodings[] = "EUC-JP";
$textarea_encodings[] = "SJIS";
$textarea_encodings[] = "eucJP-win";
$textarea_encodings[] = "SJIS-win";
$textarea_encodings[] = "ISO-2022-JP";
$textarea_encodings[] = "JIS";
$textarea_encodings[] = "ISO-8859-2";
$textarea_encodings[] = "ISO-8859-3";
$textarea_encodings[] = "ISO-8859-4";
$textarea_encodings[] = "ISO-8859-5";
$textarea_encodings[] = "ISO-8859-6";
$textarea_encodings[] = "ISO-8859-7";
$textarea_encodings[] = "ISO-8859-8";
$textarea_encodings[] = "ISO-8859-9";
$textarea_encodings[] = "ISO-8859-10";
$textarea_encodings[] = "ISO-8859-13";
$textarea_encodings[] = "ISO-8859-14";
$textarea_encodings[] = "ISO-8859-15";
$textarea_encodings[] = "byte2be";
$textarea_encodings[] = "byte2le";
$textarea_encodings[] = "byte4be";
$textarea_encodings[] = "byte4le";
$textarea_encodings[] = "BASE64";
$textarea_encodings[] = "HTML-ENTITIES";
$textarea_encodings[] = "7bit";
$textarea_encodings[] = "8bit";
$textarea_encodings[] = "EUC-CN";
$textarea_encodings[] = "CP936";
$textarea_encodings[] = "HZ";
$textarea_encodings[] = "EUC-TW";
$textarea_encodings[] = "CP950";
$textarea_encodings[] = "EUC-KR";
$textarea_encodings[] = "UHC (CP949)";
$textarea_encodings[] = "ISO-2022-KR";
$textarea_encodings[] = "Windows-1251 (CP1251)";
$textarea_encodings[] = "Windows-1252 (CP1252)";
$textarea_encodings[] = "CP866 (IBM866)";
$textarea_encodings[] = "KOI8-R";
*/
return $textarea_encodings;
} // End function getTextareaEncodingsArray
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function syntaxTextareaEncode($string) {
// --------------
// Replace tabs, line-feeds and carriage-returns by \t and \n respectively.
// --------------
$tab = chr(9);
$lf = chr(10);
$cr = chr(13);
$newstring = $string;
// Replace \' and '
$newstring = str_replace("\'", "\\\'", $newstring);
$newstring = str_replace("'", "\'", $newstring);
// Replace $cr$lf by $lf
$newstring = str_replace("$cr$lf", "$lf", $newstring);
// Replace $lf and $tab
$newstring = str_replace($lf, "\\n", $newstring);
$newstring = str_replace($tab, "\\t", $newstring);
return $newstring;
} // end syntaxTextareaEncode
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function splitHtml($text, $textareaType) {
// --------------
// This function reads an HTML file, and returns the head and the body parts.
// --------------
$pattern = "/(.*?)<body([^\\>]*)\\>(.*)\\<\\/body\\>(.*)/is";
// Everything before the <body tag ==> {1}
// Start of the body tag <body
// Body tag contents ==> {2}
// Body contents ==> {3}
// </body> tag
// Stuff after the </body> tag ==> {4}
$preg_match_result = preg_match($pattern, $text, $matches);
if ($preg_match_result != 0) {
$text_splitted["top"] = $matches[1];
$text_splitted["top"] .= "<body" . $matches[2] . ">";
$text_splitted["middle"] = $matches[3];
$text_splitted["bottom"] = "</body>" . $matches[4];
}
else {
$text_splitted["top"] = "";
$text_splitted["middle"] = $text;
$text_splitted["bottom"] = "";
}
return $text_splitted;
} // end splitHtml
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
?>

View file

@ -1,22 +0,0 @@
function toggleTextarea(name) {
var name_shown = name + '_shown';
var name_hidden = name + '_hidden';
if (document.getElementById) {
var element_shown = document.getElementById(name_shown);
var element_hidden = document.getElementById(name_hidden);
}
else if (document.all) {
var element_shown = document.all[name_shown];
var element_hidden = document.all[name_hidden];
}
if(element_shown.style.display == "none" || element_shown.style.display == false) {
element_shown.style.display = "block";
element_hidden.style.display = "none";
}
else if(element_shown.style.display == "block") {
element_shown.style.display = "none";
element_hidden.style.display = "block";
}
}

View file

@ -1,3 +0,0 @@
[Enter code here]

View file

@ -1,280 +0,0 @@
<?php
// -------------------------------------------------------------------------------
// | net2ftp: a web based FTP client |
// | Copyright (c) 2003-2013 by David Gartner |
// | |
// | 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. |
// | |
// -------------------------------------------------------------------------------
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_sendHttpHeaders() {
// --------------
// This function sends HTTP headers
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
} // end net2ftp_sendHttpHeaders
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printJavascript() {
// --------------
// This function prints Javascript code and includes
// --------------
global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
// Code
// echo "<script type=\"text/javascript\"><!--\n";
// echo "//--></script>\n";
// Include
echo "<script type=\"text/javascript\" src=\"". $net2ftp_globals["application_rootdir_url"] . "/modules/findstring/findstring.js\"></script>\n";
} // end net2ftp_printJavascript
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printCss() {
// --------------
// This function prints CSS code and includes
// --------------
global $net2ftp_settings, $net2ftp_globals;
// Include
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"". $net2ftp_globals["application_rootdir_url"] . "/skins/" . $net2ftp_globals["skin"] . "/css/main.css.php?ltr=" . __("ltr") . "&amp;image_url=" . urlEncode2($net2ftp_globals["image_url"]) . "\" />\n";
} // end net2ftp_printCssInclude
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printBodyOnload() {
// --------------
// This function prints the <body onload="" actions
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
// echo "";
} // end net2ftp_printBodyOnload
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printBody() {
// --------------
// This function prints the search screen
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result, $net2ftp_output;
if (isset($_POST["list"]) == true) { $list = getSelectedEntries($_POST["list"]); }
else { $list = ""; }
if (isset($_POST["searchoptions"]) == true) { $searchoptions = $_POST["searchoptions"]; }
if (isset($searchoptions["string"]) == false) { $searchoptions["string"] = ""; }
if (isset($searchoptions["case_sensitive"]) == false) { $searchoptions["case_sensitive"] = ""; }
if (isset($searchoptions["filename"]) == false) { $searchoptions["filename"] = ""; }
if (isset($searchoptions["size_from"]) == false) { $searchoptions["size_from"] = ""; }
if (isset($searchoptions["size_to"]) == false) { $searchoptions["size_to"] = ""; }
if (isset($searchoptions["modified_from"]) == false) { $searchoptions["modified_from"] = ""; }
if (isset($searchoptions["modified_to"]) == false) { $searchoptions["modified_to"] = ""; }
// -------------------------------------------------------------------------
// Variables for all screens
// -------------------------------------------------------------------------
// Title
// See below
// Form name, back and forward buttons
$formname = "FindstringForm";
$back_onclick = "document.forms['" . $formname . "'].state.value='browse';document.forms['" . $formname . "'].state2.value='main';document.forms['" . $formname . "'].submit();";
$forward_onclick = "document.forms['" . $formname . "'].submit();";
// Next screen
$nextscreen = 2;
// -------------------------------------------------------------------------
// Variables for screen 1
// -------------------------------------------------------------------------
if ($net2ftp_globals["screen"] == 1) {
// Title
$title = __("Search directories and files");
// From and to dates
$tomorrow = date("Y-m-d", time() + 3600*24);
$oneweekago = date("Y-m-d", time() - 3600*24*7);
$modified_from = $oneweekago;
$modified_to = $tomorrow;
} // end if
// -------------------------------------------------------------------------
// Variables for screen 2
// -------------------------------------------------------------------------
elseif ($net2ftp_globals["screen"] == 2) {
// Title
$title = __("Search results");
// Check if $searchoptions["string"] is a valid string
if (is_string($searchoptions["string"]) == false) {
$errormessage = __("Please enter a valid search word or phrase.");
setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
return false;
}
// Check if $searchoptions["filename"] is a valid filename with a possible wildcard character *
if ($searchoptions["filename"] != "" && preg_match("/^[a-zA-Z0-9_ *\.-]*$/", $searchoptions["filename"]) == 0) {
$errormessage = __("Please enter a valid filename.");
setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
return false;
}
// Check if $searchoptions["size_from"] and $searchoptions["size_to"] are valid numbers
if ($searchoptions["size_from"] != "" && is_numeric($searchoptions["size_from"]) == false) {
$errormessage = __("Please enter a valid file size in the \"from\" textbox, for example 0.");
setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
return false;
}
if ($searchoptions["size_to"] != "" && is_numeric($searchoptions["size_to"]) == false) {
$errormessage = __("Please enter a valid file size in the \"to\" textbox, for example 500000.");
setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
return false;
}
// Check if $searchoptions["modified_from"] and $searchoptions["modified_to"] are valid dates
if ($searchoptions["modified_from"] != "" && preg_match("/^[0-9-]*$/", $searchoptions["modified_from"]) == 0) {
$errormessage = __("Please enter a valid date in Y-m-d format in the \"from\" textbox.");
setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
return false;
}
if ($searchoptions["modified_to"] != "" && preg_match("/^[0-9-]*$/", $searchoptions["modified_to"]) == 0) {
$errormessage = __("Please enter a valid date in Y-m-d format in the \"to\" textbox.");
setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
return false;
}
// ------------
// CONVERSIONS
// ------------
// Convert the wildcard character * in the filename by the wildcard .* that can be read by preg_match
// So this *.* becomes this .*..*
$searchoptions["filename"] = str_replace("*", ".*", $searchoptions["filename"]);
// Convert the mtime to a unix timestamp
$searchoptions["modified_from"] = strtotime($searchoptions["modified_from"]);
$searchoptions["modified_to"] = strtotime($searchoptions["modified_to"]);
// Open connection
setStatus(2, 10, __("Connecting to the FTP server"));
$conn_id = ftp_openconnection();
if ($net2ftp_result["success"] == false) { return false; }
// Find the files
$result = array();
setStatus(4, 10, __("Searching the files..."));
$result = ftp_processfiles("findstring", $conn_id, $net2ftp_globals["directory"], $list, $searchoptions, $result, 0);
if ($net2ftp_result["success"] == false) { return false; }
// Close connection
ftp_closeconnection($conn_id);
if (sizeof($result) == 0) {
$net2ftp_output["findstring"][] = __("The word <b>%1\$s</b> was not found in the selected directories and files.", $searchoptions["string"]);
}
else {
$net2ftp_output["findstring"][] = __("The word <b>%1\$s</b> was found in the following files:", $searchoptions["string"]);
for ($i=0; $i<sizeof($result); $i++) {
$net2ftp_output["findstring"][] = glueDirectories($result[$i]["directory"], $result[$i]["dirfilename"]) . " line " . $result[$i]["line"];
} // end for
}
} // end if
// -------------------------------------------------------------------------
// Print the output
// -------------------------------------------------------------------------
require_once($net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php");
} // End net2ftp_printBody
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
?>

View file

@ -1,9 +0,0 @@
function submitFindstringForm(directory, entry, state, state2, screen) {
document.forms['FindstringForm'].directory.value=directory;
document.forms['FindstringForm'].entry.value=entry;
document.forms['FindstringForm'].state.value=state;
document.forms['FindstringForm'].state2.value=state2;
document.forms['FindstringForm'].screen.value=screen;
document.forms['FindstringForm'].submit();
}

View file

@ -1,120 +0,0 @@
<?php
// -------------------------------------------------------------------------------
// | net2ftp: a web based FTP client |
// | Copyright (c) 2003-2013 by David Gartner |
// | |
// | 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. |
// | |
// -------------------------------------------------------------------------------
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_sendHttpHeaders() {
// --------------
// This function sends HTTP headers
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
// -------------------------------------------------------------------------
// Construct the symlink target
// -------------------------------------------------------------------------
// A symlink has $entry = FreeBSD -> mirror/ftp.freebsd.org/pub/FreeBSD
// Get the 1st part before the "->" (this is what we need to access, not the 2nd part)
$pos = strpos($net2ftp_globals["entry"], " -> ");
$entry_part1 = substr($net2ftp_globals["entry"], 0, $pos);
// Glue the current directory with the symlink
// and resolve the .. which it may contain (this is done by validateDirectory)
$symlinktarget = validateDirectory(glueDirectories($net2ftp_globals["directory"], $entry_part1));
// -------------------------------------------------------------------------
// Check if the symlink points to a directory
// -------------------------------------------------------------------------
// ------------------------------------
// Open connection
// ------------------------------------
$conn_id = ftp_openconnection();
if ($net2ftp_result["success"] == false) { return false; }
// ------------------------------------
// Get raw list of directories and files
// ------------------------------------
$list = ftp_getlist($conn_id, $symlinktarget);
if ($net2ftp_result["success"] == false) {
$is_directory = false;
setErrorVars(true, "", "", "", "");
}
else {
$is_directory = true;
}
// ------------------------------------
// Close connection
// ------------------------------------
ftp_closeconnection($conn_id);
// -------------------------------------------------------------------------
// Directory (main or popup): redirect to Browse page
// -------------------------------------------------------------------------
if ($is_directory == true) {
$action_url = printPHP_SELF("actions");
$action_url = str_replace("&amp;", "&", $action_url);
header("Location: " . $action_url . "&state=browse&state2=" . $net2ftp_globals["state2"] . "&directory=" . $symlinktarget);
}
// -------------------------------------------------------------------------
// File (popup): redirect to Browse page of same directory
// -------------------------------------------------------------------------
elseif ($net2ftp_globals["state2"] == "popup") {
$action_url = printPHP_SELF("actions");
$action_url = str_replace("&amp;", "&", $action_url);
header("Location: " . $action_url . "&state=browse&state2=" . $net2ftp_globals["state2"] . "&directory=" . $net2ftp_globals["directory"]);
}
// -------------------------------------------------------------------------
// File (main): download the file
// -------------------------------------------------------------------------
elseif ($net2ftp_globals["state2"] == "main") {
if ($net2ftp_settings["functionuse_downloadfile"] == "yes") {
$newdirectory = dirname($symlinktarget);
$newfile = basename($symlinktarget);
ftp_downloadfile($newdirectory, $newfile);
}
else {
$errormessage = __("This function has been disabled by the Administrator of this website.");
setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
return false;
}
}
} // end net2ftp_sendHttpHeaders
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
?>

View file

@ -1,136 +0,0 @@
<?php
// -------------------------------------------------------------------------------
// | net2ftp: a web based FTP client |
// | Copyright (c) 2003-2013 by David Gartner |
// | |
// | 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. |
// | |
// -------------------------------------------------------------------------------
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_sendHttpHeaders() {
// --------------
// This function sends HTTP headers
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
} // end net2ftp_sendHttpHeaders
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printJavascript() {
// --------------
// This function prints Javascript code and includes
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
} // end net2ftp_printJavascript
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printCss() {
// --------------
// This function prints CSS code and includes
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
} // end net2ftp_printCssInclude
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printBodyOnload() {
// --------------
// This function prints the <body onload="" actions
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
} // end net2ftp_printBodyOnload
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printBody() {
// --------------
// This function prints the login screen
// --------------
global $net2ftp_globals;
require_once($net2ftp_globals["application_skinsdir"] . "/openlaszlo/getcookies.template.php");
} // End net2ftp_printBody
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
?>

View file

@ -1,129 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" dir="ltr">
<head>
<title>net2ftp help</title>
<link rel="stylesheet" type="text/css" href="main.css.php?ltr=ltr" />
</head>
<body style="margin-left: 70px; margin-right: 70px;">
<div style="border: 1px solid black; background-color: #CCCCCC; padding: 10px; margin-top: 20px;">
Welcome! The purpose of these pages is to provide help for the 3 kinds of people using net2ftp:
<ul>
<li> <a href="02-user.html">Users</a> - how to upload files, how to copy a directory</li>
<li> <a href="03-administrator.html">Administrators</a> - how to install net2ftp on your own web server</li>
<li> <a href="04-developer.html">Developers</a> - how the code is structured</li>
</ul>
</div>
<br />
Follow the links above to go to the section that you're interested in, or continue to read below for a brief explanation of what is net2ftp.
<br /><br />
<div style="text-align: center;">
<script type="text/javascript"><!--
google_ad_client = "pub-8420366685399799";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text_image";
google_ad_channel ="4549075632";
google_color_border = "E5E5E5";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_text = "000000";
google_color_url = "008000";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
<br />
<div class="header21">What is net2ftp?</div>
<b>net2ftp is a web-based FTP client written in PHP.</b>
Lets explain this in detail.
<i>Web-based</i> means that net2ftp runs on a web server, and that you use a browser (for example Internet Explorer or Mozilla).
<i>FTP</i> is the communication method to access files on a remote computer. You need it to access your files on the account given by your provider to host your homepage. FTP is different from HTTP in that it was made specially to transfer (big) files. If a transfer is interrupted, with FTP you can resume it where it broke off, whereas with HTTP you can not.
<i>PHP</i> is a programming language that is used to make dynamic websites.
<br /><br />
You can use net2ftp at <a href="http://www.net2ftp.com">http://www.net2ftp.com</a>, or you can install it on your own web server and use it from there.
<br /><br />
<div class="header21">User features</div>
<ul>
<li> Navigate the FTP server<br /> <span style="font-size: 80%;">
Once you have logged in, you can browse from directory to directory and see all the subdirectories and files.</span></li>
<li> Upload files<br /> <span style="font-size: 80%;">
There are 3 different ways to upload files: the standard upload form, the upload-and-unzip functionality, and the Java Applet.</span></li>
<li> Download files<br /> <span style="font-size: 80%;">
Click on a filename to quickly download one file.<br />
Select multiple files and click on Download; the selected files will be downloaded in a zip archive.</span></li>
<li> Zip files<br /> <span style="font-size: 80%;">
... and save the zip archive on the FTP server, or email it to someone.</span></li>
<li> Unzip files<br /> <span style="font-size: 80%;">
Different formats are supported: .zip, .tar, .tgz and .gz.</span></li>
<li> Install software<br /> <span style="font-size: 80%;">
Choose from a list of popular applications (PHP required on the target server).</span></li>
<li> Copy, move and delete<br /> <span style="font-size: 80%;">
Directories are handled recursively, meaning that their content
(subdirectories and files) will also be copied, moved or deleted.</span></li>
<li> Copy or move to a 2nd FTP server<br /> <span style="font-size: 80%;">
Handy to import files to your FTP server, or to export files from your FTP server to another FTP server.</span></li>
<li> Rename and chmod<br /> <span style="font-size: 80%;">
Chmod handles directories recursively.</span></li>
<li> View code with syntax highlighting<br /> <span style="font-size: 80%;">
PHP functions are linked to the documentation on php.net.</span></li>
<li> Plain text editor<br /> <span style="font-size: 80%;">
Edit text right from your browser; every time you save the changes the new file is transferred to the FTP server.</span></li>
<li> HTML editors<br /> <span style="font-size: 80%;">
Edit HTML a What-You-See-Is-What-You-Get (WYSIWYG) form; there are 2 different editors to choose from (FCKEditor and TinyMCE).</span></li>
<li> Code editor<br /> <span style="font-size: 80%;">
Edit HTML and PHP in an editor with syntax highlighting (CodePress).</span></li>
<li> Search for words or phrases<br /> <span style="font-size: 80%;">
Filter out files based on the filename, last modification time and filesize.</span></li>
<li> Calculate size<br /> <span style="font-size: 80%;">
Calculate the size of directories and files.</span></li>
</ul>
<br />
<div class="header21">Administrator features</div>
<ul>
<li> Safe Mode<br /> <span style="font-size: 80%;">
net2ftp works perfectly under safemode.</span></li>
<li> MySQL database<br /> <span style="font-size: 80%;">
... is optional. A MySQL database is only needed for logging, and for the Daily Limit (see below).</span></li>
<li> Authorizations<br /> <span style="font-size: 80%;">
Allow the users to connect to all FTP servers, or to only a predefined list of FTP servers.<br />
The input box on the login page will change accordingly.</span></li>
<li> Logging<br /> <span style="font-size: 80%;">
Activate or deactivate 3 kinds of logging: pages requested, logins and errors.</span></li>
<li> Daily Limit<br /> <span style="font-size: 80%;">
Restrict each user's daily data transfer volume and script execution
time. Once a user reaches the daily consumption limit, he will still be
able to browse FTP servers, but the transfer of data to/from the server
will be blocked.</span></li>
<li> Large File Limit<br /> <span style="font-size: 80%;">
Files bigger than this limit can't be downloaded/uploaded/copied/etc
but can still be renamed/deleted/chmodded.</span></li>
<li> Banned keywords<br /> <span style="font-size: 80%;">
Directories and files containing banned keywords can't be processed.
This is to avoid net2ftp being used to upload Paypal and Ebay scams.</span></li>
<li> Templates<br /> <span style="font-size: 80%;">
Change the layout of net2ftp as you want using the template files.</span></li>
<li> Integration in other PHP applications<br /> <span style="font-size: 80%;">
net2ftp can easily be integrated in other PHP applications.
Modules for <a href="http://www.mamboserver.com">Mambo</a>, <a href="http://www.drupal.org">Drupal</a> and <a href="http://www.xoops.org">Xoops</a> are provided in the zip file.</span></li>
</ul>
<br /><br /><br /><br />
</body>
</html>

View file

@ -1,259 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" dir="ltr">
<head>
<title>net2ftp help</title>
<link rel="stylesheet" type="text/css" href="main.css.php?ltr=ltr" />
</head>
<body style="margin-left: 70px; margin-right: 70px;">
<div class="header21">What is FTP?</div>
You want to build a website, so you start creating web pages on your computer.<br /><br />
Next, you need to publish them: you need to put those pages on a web server so that everyone would be able to view them.<br /><br />
To transfer the files from your computer to that web server, a special protocol (transfer method) is used: FTP - the File Transfer Protocol.
This protocol was designed to be able to handle big files; it can for example resume a transfer if it was interrupted in the middle.
<br /><br />
<div style="text-align: center;">
<script type="text/javascript"><!--
google_ad_client = "pub-8420366685399799";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text_image";
google_ad_channel ="4568160369";
google_color_border = "E5E5E5";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_text = "000000";
google_color_url = "008000";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
<br />
<div class="header21">What is net2ftp?</div>
The normal way to connect to your FTP server is to use an FTP client and to communicate via the FTP protocol. This is however not always possible:
<ul>
<li>you may be behind a corporate firewall at work, which may block the FTP communications;</li>
<li>you may be on holiday and connecting to the internet via a CyberCafe, where you may not be allowed to install an FTP client.</li>
</ul><br />
When you use net2ftp these problems are solved: you connect to net2ftp using a regular web browser, and net2ftp translates your requests and takes care of the FTP communication.<br /><br />
net2ftp also provides additional features, on top of the regular FTP features: the possibility to edit code using your web browser, to view the code with syntax highlighting, to upload-and-unzip archives, and to search for words on the FTP server.<br /><br />
<br /><br />
<div class="header21">Icons used</div>
net2ftp uses the beautiful icons made by <a href="http://www.icon-king.com">David Vignoni</a> for <a href="http://www.kde.org">KDE</a>.<br /><br />
Their meaning should be pretty straight-forward, but just in case, here are the conventions used:<br /><br />
<img src="../../skins/blue/images/actions/back.png" alt="Icon" /> Cancel and go back<br />
<img src="../../skins/blue/images/actions/button_ok.png" alt="Icon" /> Execute the action<br />
<img src="../../skins/blue/images/actions/filesave.png" alt="Icon" /> Save the file<br />
<img src="../../skins/blue/images/actions/bookmark.png" alt="Icon" /> Bookmark the page<br />
<img src="../../skins/blue/images/actions/reload.png" alt="Icon" /> Refresh the page<br />
<img src="../../skins/blue/images/actions/exit.png" alt="Icon" /> Logout<br /><br />
All icons will also display a tooltip with additional information if you keep your mouse pointer on the button for a second, without clicking on it.<br />
Try with this icon: <img src="../../skins/blue/images/actions/bookmark.png" alt="Bookmark this page" />
<br /><br />
<div style="font-size: 80%; margin-left: 20px;">
Note: these PNG icons have transparent regions which are not displayed correctly on Internet Explorer on this Help page: the transparent regions appear as grey.
This is a bug specific to Internet Explorer; refer to the <a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q294714">Microsoft website</a> for more details.
In net2ftp itself however, a fix has been applied which corrects this.
</div>
<br /><br />
<div class="header21">Logging in</div>
Enter your FTP server, username and password.
The FTP server name can be "ftp.my-domain.com" if you have your own domain name.
If you don't have your own domain name, then it depends on your web hosting company.
It can be for example "ftp.geocities.com" or "ftp-www.earthlink.net".
<br /><br />
If you don't know your FTP server, username or password, then check out the support pages of your hosting company or contact their helpdesk.<br />
<br /><br />
<div class="header21">Browsing the FTP server</div>
The first time you log in, you will see the contents of the root directory "/".
To go to a subdirectory, simply click on the subdirectory's name.
To go up to the parent directory, click on the top row with the label Up.
<br /><br />
If you know the name of the subdirectory you want to go to, you can also enter that name directly in the textbox on top of the page, and press ENTER.<br />
If you don't know the name exactly, click on <img src="../../skins/blue/images/actions/view_tree.png" alt="Icon" />.
A window will pop up, which allows you to browse the FTP server and choose a directory.
Double-click on a subdirectory to go to that subdirectory. To go up, double-click on "..".
Once you are in the subdirectory you wanted to find, click on Choose.
The subdirectory name will be copied from the popup to the main window.
<br /><br />
It can happen that the FTP server returns the list of directories and files in an uncommon format.
In that case net2ftp shows you the lines bottom of the screen, under the heading "FTP server's output which is not recognized is shown below".
<br /><br />
If you want this fixed please contact the net2ftp developers.
They will analyse the output of your FTP server and improve the way net2ftp scans it.
<br /><br />
<div class="header21">Upload files, upload-and-unzip archives</div>
On the Browse Screen, click on the Upload button to go to the Upload Screen.<br /><br />
There is one column on the left to upload files, and there can also be a right column to upload-and-unzip archives.<br /><br />
Click on the Browse button to specify which file on your computer you want to upload or upload-and-unzip to the FTP server.<br /><br />
Once you are ready to start the upload, click on <img src="../../skins/blue/images/actions/button_ok.png" alt="Icon" />.<br /><br />
The result screen will tell you if the upload was successful or not.<br />
To upload a file, you need write permissions on that directory of the FTP server. <br />
The file should also not be too big, as on most web servers the execution time of a script may be limited to 30 seconds.<br />
<br /><br />
<div class="header21">Upload files using a Java applet (JUpload)</div>
On the Browse Screen, click on the Java Upload button.<br /><br />
Click on the Add button to add directories and files to the upload queue (top left).<br />
When you select a directory, all the files inside will be transferred, and subdirectories will be created automatically.<br /><br />
Once you are ready to start the upload, click on the Upload button.<br /><br />
The results of the upload are printed just below the upload queue (bottom left).<br />
Two upload progress bars are displayed on the right: one indicating the progress of the current file, and the other indicating the total progress.<br /><br />
As for the normal upload, the maximum filesize and maximum execution time is limited; by default this is 2 MB and 30 seconds.<br />
If the total size of the files in the upload queue is larger than a certain limit, the Java Applet will split the request in several smaller parts.<br />
<br /><br />
<div class="header21">Downloading and zipping</div>
To download a file, simply click on its filename.<br /><br />
To zip-and-download files and directories, select them on the Browse Screen and click on Download.<br />
The directories and their contents will be retrieved and zipped.<br />
A popup window will ask you where you would like to save the Zip file on your computer.<br /><br />
Note that if the files inside are too big, the script will timeout and you won't be able to download anything.<br />
If this happens, try again with less directories and omit those which contain big files.<br /><br />
You can also zip files and email them in attachment, or save them on the FTP server.<br />
On the Browse Screen, select the directories and files and click on Zip.<br />
<br /><br />
<div class="header21">View code with syntax highlighting</div>
On the Browse Screen, click on the View link on the same line as the filename.<br />
<br /><br />
<div class="header21">Edit text</div>
On the Browse Screen, click on the Edit link on the same line as the filename.<br />
Edit the text and press <img src="../../skins/blue/images/actions/filesave.png" alt="Icon" /> to save the changes (you'll need write permissions for that). <br /><br />
Depending on the type of file you're editing, alternative textareas can be used:<br />
<ul>
<li> For HTML files, there are 2 WYSIWYG (What-You-See-Is-What-You-Get) textareas: <a href="http://www.fckeditor.net">FCKEditor</a> and <a href="http://tinymce.moxiecode.com/">TinyMCE</a>. </li>
<li> To edit code with syntax highlighting use CodePress; it can highlight PHP, Javascript, Java and HTML code. </li>
</ul>
<br /><br />
<div class="header21">Copy, move, delete</div>
Select some files or directories and click on the Copy, Move or Delete button.<br /><br />
If you copy or move, then choose the target directory.
This can be different for each directory or file that you selected.
To set all target directories to the same value, enter the target directory in the top textbox and click on the button "Set all targetdirectories".<br /><br />
If you don't know the exact name of the target directory, click on <img src="../../skins/blue/images/actions/view_tree.png" alt="Icon" />. A window will pop up, which allows you to browse the FTP server and choose a directory. Double-click on a subdirectory to go to that subdirectory. To go up, double-click on "..". Once you are in the subdirectory you wanted to find, click on Choose. The subdirectory name will be copied from the popup to the main window.<br />
To copy or move files to a second FTP server, enter the FTP server name, username and password on top.<br />
You need write permissions to be able to copy or move files to a directory.<br /><br />
Once you are ready, click on <img src="../../skins/blue/images/actions/button_ok.png" alt="Icon" />.<br /><br />
The result screen will tell you if the action was successful or not.
If the files were too big, the script will run until the timeout is reached.
On most web servers the execution time of a script is limited to 30 seconds.
<br /><br />
<div class="header21">Rename</div>
Select directories or files and click on Rename on the Browse Screen.<br />
The next screen will ask for the new names.<br />
Fill these in and click on <img src="../../skins/blue/images/actions/button_ok.png" alt="Icon" />.
<br /><br />
<div class="header21">Chmod</div>
Select directories or files and click on Chmod on the Browse Screen.<br />
The next screen show the current permissions; select or unselect the checkboxes which represent a permission.<br />
Click on <img src="../../skins/blue/images/actions/button_ok.png" alt="Icon" />.<br /><br />
Note that for the moment directories are not chmodded recursively -- subdirectories and files will remain unaffected. In the future, recursive chmodding will be added to net2ftp.<br />
<br /><br />
<div class="header21">Update a file (beta function)</div>
This function is still in development, use it at your own risk. It can be activated or deactivated by the administrator in settings.inc.php.<br /><br />
The purpose of this function is to merge a new version of a text file with an older version stored on the FTP server.<br /><br />
On the Browse Screen, click on Update link on the same line as the filename.<br />
<ul>
<li> First, upload the new file.</li>
<li> net2ftp will compare the old file stored on the FTP server with the new file that was uploaded, and a the code will be printed the changes highlighted in red and green.
There are only 2 kinds of changes: a line can be deleted or added -- more complex changes such as move or edit are not foreseen, they're handled as a delete + an add.
Select the changes and indicate if you accept or reject them. By default all changes are marked as accepted.</li>
<li> Once you're done, submit the page, and the merged text will be shown in the Edit Screen.
At this point, nothing is saved yet, the original file is not yet overwritten. Once you've reviewed the changes, save them.</li>
</ul>
<br /><br />
<div class="header21">Access keys</div>
Since version 0.81, most actions can be executed with the keyboard.<br />
On Windows, use ALT + a letter. On Apple computers, use CTRL + a letter.<br />
On Internet Explorer, ALT + a letter will only focus on the page element; press ENTER to execute the action.<br /><br />
Which letter can be used is shown in the tooltip.<br />
For example: to go back, the tooltip is "Back (accesskey b)".<br />
To display a tooltip, leave your mouse cursor for a few seconds over an icon or link without clicking it.<br /><br />
Internet Explorer, Netscape and Mozilla browsers support Access Keys, but Opera doesn't.
<br /><br />
<div class="header21">Daily consumption limit</div>
Since version 0.81, the Administrator can choose to restrict each user's daily data transfer volume and script execution time.<br />
By default the data transfer volume is set to 50 MB per day and the script execution time to 2500 seconds per day - but this may be changed by the Administrator.<br />
Both figures are logged per IP address, and per FTP server.<br /><br />
Once the daily consumption limit is reached, you will still be able to browse FTP servers, but the transfer of data to/from the server will be blocked.<br />
If you need unrestricted access to net2ftp, contact your net2ftp Administrator or install net2ftp on your own web server.<br />
<br /><br /><br /><br />
</body>
</html>

View file

@ -1,179 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" dir="ltr">
<head>
<title>net2ftp help</title>
<link rel="stylesheet" type="text/css" href="main.css.php?ltr=ltr" />
</head>
<body style="margin-left: 70px; margin-right: 70px;">
<div class="header21">Web server requirements</div>
<ul>
<li> Web server: any web server which can run PHP. The most popular one is <a href="http://httpd.apache.org" target="_blank">Apache</a>.</li>
<li> <a href="http://www.php.net" target="_blank">PHP</a>: at least version 4.2.3. net2ftp works under <a href="http://www.php.net/manual/en/features.safe-mode.php" target="_blank">Safe Mode</a>. One advanced feature requires PHP 5 (send raw FTP command).</li>
<li> Disk space: 7.5 MB for net2ftp (less if you remove the plugins), and a few MB for the temporary files.</li>
</ul>
<br />
<div style="text-align: center;">
<script type="text/javascript"><!--
google_ad_client = "pub-8420366685399799";
google_ad_output = "textlink";
google_ad_format = "ref_text";
google_cpa_choice = "CAAQidTQgAIaCDFyD7PiBqtPKN2uuIEB";
google_ad_channel = "0194414494";
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
<br />
<div class="header21">Installation procedure</div>
<br />
1 - Unzip all the files on your computer, and upload them to your server.<br /><br />
2 - The /temp directory should be chmodded to 777 (you can use <a href="http://www.net2ftp.com">net2ftp.com</a> to do this).<br /><br />
3 - Set your settings in the settings.inc.php file; read "Next steps" below for more details.<br /><br />
4 - A database is only required if you want to log the actions of the users. To create the tables, execute the SQL queries below (also in the "create_tables.sql" file). This can be done easily in <a href="http://www.phpmyadmin.net/" target="_blank">PhpMyAdmin</a>, the popular front-end to MySQL.<br />
<br />
<textarea cols="70" rows="8" style="white-space: nowrap;">
DROP TABLE IF EXISTS `net2ftp_logAccess`;
DROP TABLE IF EXISTS `net2ftp_log_access`;
CREATE TABLE `net2ftp_log_access` (`id` int(10) unsigned NOT NULL auto_increment,`date` date NOT NULL default '0000-00-00',`time` time NOT NULL default '00:00:00',`remote_addr` text NOT NULL,`remote_port` text NOT NULL,`http_user_agent` text NOT NULL,`page` text NOT NULL,`datatransfer` int(10) unsigned default '0',`executiontime` mediumint(8) unsigned default '0',`ftpserver` text NOT NULL,`username` text NOT NULL,`state` text NOT NULL,`state2` text NOT NULL,`screen` text NOT NULL,`directory` text NOT NULL,`entry` text NOT NULL,`http_referer` text NOT NULL,KEY `index1` (`id`)) TYPE=MyISAM;
DROP TABLE IF EXISTS `net2ftp_logError`;
DROP TABLE IF EXISTS `net2ftp_log_error`;
CREATE TABLE `net2ftp_log_error` (`date` date NOT NULL default '0000-00-00',`time` time NOT NULL default '00:00:00',`ftpserver` text NOT NULL,`username` text NOT NULL,`message` text NOT NULL,`backtrace` text NOT NULL,`state` text NOT NULL,`state2` text NOT NULL,`directory` text NOT NULL,`remote_addr` text NOT NULL,`remote_port` text NOT NULL,`http_user_agent` text NOT NULL,KEY `index1` (`date`,`time`,`ftpserver`(100),`username`(50))) TYPE=MyISAM;
DROP TABLE IF EXISTS `net2ftp_logConsumptionFtpserver`;
DROP TABLE IF EXISTS `net2ftp_log_consumption_ftpserver`;
CREATE TABLE `net2ftp_log_consumption_ftpserver`(`date` date NOT NULL default '0000-00-00',`ftpserver` varchar(255) NOT NULL default '0',`datatransfer` int(10) unsigned default '0',`executiontime` mediumint(8) unsigned default '0',PRIMARY KEY (`date`,`ftpserver`)) TYPE=MyISAM;
DROP TABLE IF EXISTS `net2ftp_logConsumptionIpaddress`;
DROP TABLE IF EXISTS `net2ftp_log_consumption_ipaddress`;
CREATE TABLE `net2ftp_log_consumption_ipaddress`(`date` date NOT NULL default '0000-00-00',`ipaddress` varchar(15) NOT NULL default '0',`datatransfer` int(10) unsigned default '0',`executiontime` mediumint(8) unsigned default '0',PRIMARY KEY (`date`,`ipaddress`)) TYPE=MyISAM;
DROP TABLE IF EXISTS `net2ftp_users`;
CREATE TABLE `net2ftp_users` (`ftpserver` varchar(255) NOT NULL default '0',`username` text NOT NULL,`homedirectory` text NOT NULL,KEY `index1` (`ftpserver`,`username`(50))) TYPE=MyISAM;
</textarea><br />
<br /><br />
<div class="header21">Next steps</div>
<ul>
<li> Important settings in settings.inc.php:
<ul>
<li> Enter an Admin panel password. If no password is entered, the Admin panel is not accessible.</li>
<li> Turn logging on or off (requires a MySQL database).</li>
<li> Choose if you want to set a daily consumption limit (requires a MySQL database).
Since version 0.81, it is possible to restrict each user's daily data transfer volume and script execution time.
By default the data transfer volume is set to 50 MB per day and the script execution time to 1000 seconds per day - but this may be changed.
Both figures are logged per IP address, and per FTP server.
Once the daily consumption limit is reached, you will still be able to browse FTP servers, but the transfer of data to/from the server will be blocked.
If you need unrestricted access to net2ftp, contact your net2ftp Administrator or install net2ftp on your own web server.</li>
</ul>
</li>
<li> Set authorizations in settings_authorizations.inc.php:
<ul>
<li> Allow the users to connect to any FTP server, or only to a restricted list of FTP servers</li>
<li> Ban certain FTP servers</li>
<li> Ban certain IP addresses; users connecting from these addresses will not be able to use the website</li>
<li> Allow the users to connect to any FTP server port, or only to one port</li>
<li> Set the user home directories in the table net2ftp_users.
This will direct a user to his home directory when he logs in, and also restrict the browsing to this directory.
The other actions (rename, copy, ...) are not protected!!
If you need tighter security, set the user permissions directly on the FTP server.
</li>
</ul>
</li>
<li> To allow large file uploads and transfers, you may have to change these settings:
<ul>
<li> in the file php.ini (directory C:\windows or /etc): upload_max_filesize, post_max_size, max_execution_time, memory_limit</li>
<li> in the file php.conf (directory /etc/httpd/conf.d): LimitRequestBody</li>
</ul>
</li>
<li>Protect the /temp directory. If you use the Apache web server, the .htaccess file which is provided already does this.</li>
<li> In your php.ini file, register_globals can be set to "off" (this is more secure), but the application will off course also work if it is set to "on".</li>
<li> The files are transmitted using the BINARY mode by default. There is a list of file extensions (txt, php, ...) which are transmitted in ASCII mode. Edit this list if needed, it is located in /includes/filesystem.inc.php. Look for function ftpAsciiBinary.</li>
</ul>
<br /><br />
<div class="header21">Integration of net2ftp in an existing website</div>
<div class="header31">General tips and tricks</div>
The overall architecture of net2ftp has been completely reviewed in version 0.90, to allow easy integration of net2ftp in other web-based PHP applications.
The index.php file is a school example of how to integrate net2ftp: <br /><br />
<ul>
<li> Set the constants NET2FTP_APPLICATION_ROOTDIR and NET2FTP_APPLICATION_ROOTDIR_URL </li>
<li> Include the net2ftp file main.inc.php </li>
<li> Execute 5 net2ftp() calls to send the HTTP headers, print the Javascript code, etc. </li>
<li> Check if an error occured to print out an error message. </li>
</ul>
<br /><br />
<div class="header31">Linking directly to a particular net2ftp page</div>
It is possible to direct users to a particular net2ftp page (browse a particular directory, upload page, ...).
Log in, go to the page you want to link to, and click on the Bookmark button: <img src="../../skins/blue/images/actions/bookmark.png" alt="Icon" />.
The next page will show you the link to use; this link does not contain any login information (username or password).
When the users click on the link, they will be prompted for their login information by a popup window.
<br /><br />
<div class="header31">Mambo, Drupal and Xoops modules</div>
Ready-made net2ftp modules for Mambo, Drupal and Xoops are provided with net2ftp version 0.90!
Detailed installation instructions are given in the readme.txt file in the respective directories.
In all cases you'll first need to install the standalone version of net2ftp, and then install the Mambo, Drupal or Xoops module.
Read the instructions carefully, as each step is important.
<br /><br />
<div class="header31">Web-based control panels</div>
net2ftp has been integrated in the following control panels:
<ul>
<li> Zpanel: <a href="http://www.thezpanel.com/">http://www.thezpanel.com/</a></li>
<li> Web-cp (as of version 0.6): <a href="http://www.web-cp.net/demo.php">http://www.web-cp.net/demo.php</a></li>
</ul>
<br /><br />
<div class="header21">Known bugs and limitations</div>
<div class="header31">PHP bugs</div>
<ul>
<li> There is a bug in the PHP FTP function ftp_get() which causes end-of-line characters to be wrongly translated.
As a result, \r\n becomes \r on Windows when using the ASCII mode.
There is a workaround: on the net2ftp login screen, the BINARY mode is chosen by default.
Refer to <a href="http://bugs.php.net/bug.php?id=27633">http://bugs.php.net/bug.php?id=27633</a> for more details.
<br />UPDATE 2004-12-13: A patch has been posted for this bug on the PHP internals mailing list.
<br />UPDATE 2005-04-08: This bug is fixed in PHP version 4.3.11 and 5.0.4.
</li>
</ul>
<div class="header31">If your web server runs on Windows</div>
If you can log in but you cannot see any directory or file in the Browse Screen, then it is probably caused by a filesystem permission problem on your web server.<br /><br />
<span style="text-decoration: underline;">Quote from the PHP bug report database:</span><br />
<i>
ftp_rawlist requires write permissions to the system's tempoarary directory. <br />
IIS's default installation does not include this in the permissions for IUSR.<br />
The bug is in system configuration, not PHP.<br />
</i><br />
This was discussed in the following PHP bug reports:<br />
<a href="http://bugs.php.net/bug.php?id=8874" target="_blank">http://bugs.php.net/bug.php?id=8874</a><br />
<a href="http://bugs.php.net/bug.php?id=13720" target="_blank">http://bugs.php.net/bug.php?id=13720</a><br />
<a href="http://bugs.php.net/bug.php?id=16057" target="_blank">http://bugs.php.net/bug.php?id=16057</a><br /><br />
<div class="header31">If your FTP server is the IIS FTP server</div>
In the FTP server's configuration, set it for UNIX style directory listings rather than MSDOS style listings.
<br /><br />
</body>
</html>

View file

@ -1,26 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" dir="ltr">
<head>
<title>net2ftp help</title>
<link rel="stylesheet" type="text/css" href="main.css.php?ltr=ltr" />
</head>
<body style="margin-left: 70px; margin-right: 70px;">
<div class="header21">Participate in the development!</div>
There is no real "development team"; net2ftp is mainly developed by David, while other people occasionally send in bug reports, patches and new language files.
It's up to you to decide which part you want to work on, depending on your skills and what you feel is most important.
<br /><br />
Experience in web development with PHP, HTML and MySQL is required to work on net2ftp itself.
However, there are lots of other things to do even if you have little experience: testing beta releases of net2ftp, translating net2ftp in a new language or maintaining existing translations or completing these Help pages.
<br /><br />
Before you start any major development, please post a message on the <a href="http://www.net2ftp.org/forums">forum</a> or mail David (david at net2ftp dot com - put "net2ftp" in the subject of your email) to check if no-one else is working on the same topic and to discuss integration aspects.
Same if you need help to locate something in the code - feel free to ask.
</body>
</html>

View file

@ -1,409 +0,0 @@
<!DOCTYPE html PUBLIC "XHTML 1.0 Transitional" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml:lang="en" dir="ltr">
<head>
<meta http-equiv="Content-type" content="text/html;charset=iso-8859-1" />
<meta name="keywords" content="net2ftp, web, ftp, based, web-based, xftp, client, PHP, SSL, SSH, SSH2, password, server, free, gnu, gpl, gnu/gpl, net, net to ftp, netftp, connect, user, gui, interface, web2ftp, edit, editor, online, code, php, upload, download, copy, move, delete, zip, tar, unzip, untar, recursive, rename, chmod, syntax, highlighting, host, hosting, ISP, webserver, plan, bandwidth" />
<meta name="description" content="net2ftp is a web based FTP client. It is mainly aimed at managing websites using a browser. Edit code, upload/download files, copy/move/delete directories recursively, rename files and directories -- without installing any software." />
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
<link rel="shortcut icon" href="favicon.ico" />
<link rel="apple-touch-icon" href="favicon.png"/>
<title>net2ftp - a web based FTP client</title>
<script type="text/javascript" src="../../skins/shinra/js/jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="../../skins/shinra/js/jquery-ui-1.8.13.custom.min.js"></script>
<script type="text/javascript" src="../../skins/shinra/js/easing.js"></script>
<script type="text/javascript" src="../../skins/shinra/js/jquery.scrollTo-1.4.2-min.js"></script>
<script type="text/javascript" src="../../skins/shinra/js/jquery.cycle.all.js"></script>
<script type="text/javascript" src="../../skins/shinra/js/custom.js"></script>
<script type="text/javascript" src="../../skins/shinra/js/DD_belatedPNG.js"></script>
<script type="text/javascript" src="../../skins/shinra/js/superfish-1.4.8/js/hoverIntent.js"></script>
<script type="text/javascript" src="../../skins/shinra/js/superfish-1.4.8/js/superfish.js"></script>
<script type="text/javascript" src="../../skins/shinra/js/superfish-1.4.8/js/supersubs.js"></script>
<script type="text/javascript" src="../../skins/shinra/js/poshytip-1.0/src/jquery.poshytip.min.js"></script>
<script type="text/javascript" src="../../skins/shinra/js/html5.js"></script>
<link rel="stylesheet" href="../../skins/shinra/css/main.css.php?ltr=ltr&amp;image_url=skins%2Fshinra%2Fimages" type="text/css" />
<link rel="stylesheet" href="../../skins/shinra/css/style.css.php?show_ads=no" type="text/css" media="screen" />
<link rel="stylesheet" href="../../skins/shinra/css/social-icons.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../skins/shinra/css/ie8-hacks.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../skins/shinra/css/superfish.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../skins/shinra/css/superfish-left.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../skins/shinra/skins/glossy/style.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../skins/shinra/js/poshytip-1.0/src/tip-twitter/tip-twitter.css" type="text/css" />
<link rel="stylesheet" href="../../skins/shinra/js/poshytip-1.0/src/tip-yellowsimple/tip-yellowsimple.css" type="text/css" />
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Ubuntu" type="text/css">
</head>
<body onload="">
<!-- WRAPPER -->
<div id="wrapper">
<!-- HEADER -->
<div id="header" style="height: 100px;">
<img id="logo" src="../../skins/blue/images/img/logo.png" alt="net2ftp" />
</div>
<!-- ENDS HEADER -->
<!-- MAIN -->
<div id="main">
<!-- content -->
<div id="content">
<!-- title -->
<div id="page-title">
<span class="title">Help for users</span>
<span class="subtitle"></span>
</div>
<!-- ENDS title -->
<!-- Posts -->
<div id="posts" class="single">
<!-- post -->
<div class="post">
<h1><a id="ftp">What is FTP?</a></h1>
<div>
<p>
You want to build a website, so you start creating web pages on your computer.<br /><br />
Next, you need to publish them: you need to put those pages on a web server so that everyone would be able to view them.<br /><br />
To transfer the files from your computer to that web server, a special protocol (transfer method) is used: FTP - the File Transfer Protocol.
This protocol was designed to be able to handle big files; it can for example resume a transfer if it was interrupted in the middle.
</p>
</div>
</div>
<!-- ENDS post -->
<!-- post -->
<div class="post">
<h1><a id="net2ftp">What is net2ftp?</a></h1>
<div>
<p>
The normal way to connect to your FTP server is to use an FTP client and to communicate via the FTP protocol. This is however not always possible:
<div class="lists-star">
<ul>
<li>you may be behind a corporate firewall at work, which may block the FTP communications;</li>
<li>you may be on holiday and connecting to the internet via a CyberCafe, where you may not be allowed to install an FTP client.</li>
</ul>
</div>
When you use net2ftp these problems are solved: you connect to net2ftp using a regular web browser, and net2ftp translates your requests and takes care of the FTP communication.<br /><br />
net2ftp also provides additional features, on top of the regular FTP features: the possibility to edit code using your web browser, to view the code with syntax highlighting, to upload-and-unzip archives, and to search for words on the FTP server.
</p>
</div>
</div>
<!-- ENDS post -->
<!-- post -->
<div class="post">
<h1><a id="icons">Icons used</a></h1>
<div>
<p>
net2ftp uses the beautiful icons made by <a href="http://www.icon-king.com">David Vignoni</a> for <a href="http://www.kde.org">KDE</a>.<br /><br />
Their meaning should be pretty straight-forward, but just in case, here are the conventions used:<br /><br />
<img src="../../skins/shinra/images/actions/back.png" alt="Icon" /> Cancel and go back<br />
<img src="../../skins/shinra/images/actions/button_ok.png" alt="Icon" /> Execute the action<br />
<img src="../../skins/shinra/images/actions/filesave.png" alt="Icon" /> Save the file<br />
<img src="../../skins/shinra/images/actions/bookmark.png" alt="Icon" /> Bookmark the page<br />
<img src="../../skins/shinra/images/actions/reload.png" alt="Icon" /> Refresh the page<br />
<img src="../../skins/shinra/images/actions/exit.png" alt="Icon" /> Logout<br /><br />
All icons will also display a tooltip with additional information if you keep your mouse pointer on the button for a second, without clicking on it.<br />
Try with this icon: <img src="../../skins/shinra/images/actions/bookmark.png" alt="Bookmark this page" />
</p>
</div>
</div>
<!-- ENDS post -->
<!-- post -->
<div class="post">
<h1><a id="login">Logging in</a></h1>
<div>
<p>
Enter your FTP server, username and password.
The FTP server name can be "ftp.my-domain.com" if you have your own domain name.
If you don't have your own domain name, then it depends on your web hosting company.
It can be for example "ftp.geocities.com" or "ftp-www.earthlink.net".
<br /><br />
If you don't know your FTP server, username or password, then check out the support pages of your hosting company or contact their helpdesk.
</p>
</div>
</div>
<!-- ENDS post -->
<!-- post -->
<div class="post">
<h1><a id="browse">Browsing the FTP server</a></h1>
<div>
<p>
The first time you log in, you will see the contents of the root directory "/".
To go to a subdirectory, simply click on the subdirectory's name.
To go up to the parent directory, click on the top row with the label Up.
<br /><br />
If you know the name of the subdirectory you want to go to, you can also enter that name directly in the textbox on top of the page, and press ENTER.<br />
If you don't know the name exactly, click on <img src="../../skins/shinra/images/actions/view_tree.png" alt="Icon" />.
A window will pop up, which allows you to browse the FTP server and choose a directory.
Double-click on a subdirectory to go to that subdirectory. To go up, double-click on "..".
Once you are in the subdirectory you wanted to find, click on Choose.
The subdirectory name will be copied from the popup to the main window.
<br /><br />
It can happen that the FTP server returns the list of directories and files in an uncommon format.
In that case net2ftp shows you the lines bottom of the screen, under the heading "FTP server's output which is not recognized is shown below".
<br /><br />
If you want this fixed please contact the net2ftp developers.
They will analyse the output of your FTP server and improve the way net2ftp scans it.
</p>
</div>
</div>
<!-- ENDS post -->
<!-- post -->
<div class="post">
<h1><a id="upload">Upload files, upload-and-unzip archives</a></h1>
<div>
<p>
On the Browse Screen, click on the Upload button to go to the Upload Screen.<br /><br />
There is one column on the left to upload files, and there can also be a right column to upload-and-unzip archives.<br /><br />
Click on the Browse button to specify which file on your computer you want to upload or upload-and-unzip to the FTP server.<br /><br />
Once you are ready to start the upload, click on <img src="../../skins/shinra/images/actions/button_ok.png" alt="Icon" />.<br /><br />
The result screen will tell you if the upload was successful or not.<br />
To upload a file, you need write permissions on that directory of the FTP server. <br />
The file should also not be too big, as on most web servers the execution time of a script may be limited to 30 seconds.
</p>
</div>
</div>
<!-- ENDS post -->
<!-- post -->
<div class="post">
<h1><a id="jupload">Upload files using a Java applet (JUpload)</a></h1>
<div>
<p>
On the Browse Screen, click on the Java Upload button.<br /><br />
Click on the Add button to add directories and files to the upload queue (top left).<br />
When you select a directory, all the files inside will be transferred, and subdirectories will be created automatically.<br /><br />
Once you are ready to start the upload, click on the Upload button.<br /><br />
The results of the upload are printed just below the upload queue (bottom left).<br />
Two upload progress bars are displayed on the right: one indicating the progress of the current file, and the other indicating the total progress.<br /><br />
As for the normal upload, the maximum filesize and maximum execution time is limited; by default this is 2 MB and 30 seconds.<br />
If the total size of the files in the upload queue is larger than a certain limit, the Java Applet will split the request in several smaller parts.
</p>
</div>
</div>
<!-- ENDS post -->
<!-- post -->
<div class="post">
<h1><a id="download">Downloading and zipping</a></h1>
<div>
<p>
To download a file, simply click on its filename.<br /><br />
To zip-and-download files and directories, select them on the Browse Screen and click on Download.<br />
The directories and their contents will be retrieved and zipped.<br />
A popup window will ask you where you would like to save the Zip file on your computer.<br /><br />
Note that if the files inside are too big, the script will timeout and you won't be able to download anything.<br />
If this happens, try again with less directories and omit those which contain big files.<br /><br />
You can also zip files and email them in attachment, or save them on the FTP server.<br />
On the Browse Screen, select the directories and files and click on Zip.
</p>
</div>
</div>
<!-- ENDS post -->
<!-- post -->
<div class="post">
<h1><a id="view">View code with syntax highlighting</a></h1>
<div>
<p>
On the Browse Screen, click on the View link on the same line as the filename.
</p>
</div>
</div>
<!-- ENDS post -->
<!-- post -->
<div class="post">
<h1><a id="edit">Edit text</a></h1>
<div>
<p>
On the Browse Screen, click on the Edit link on the same line as the filename.<br />
Edit the text and press <img src="../../skins/shinra/images/actions/filesave.png" alt="Icon" /> to save the changes (you'll need write permissions for that). <br /><br />
Depending on the type of file you're editing, alternative textareas can be used:<br />
<div class="lists-star">
<ul>
<li> For HTML files, there are 2 WYSIWYG (What-You-See-Is-What-You-Get) textareas: <a href="http://www.fckeditor.net">FCKEditor</a> and <a href="http://tinymce.moxiecode.com/">TinyMCE</a>. </li>
<li> To edit code with syntax highlighting use Ace; it can highlight PHP, Javascript, Java and HTML code. </li>
</ul>
</div>
</p>
</div>
</div>
<!-- ENDS post -->
<!-- post -->
<div class="post">
<h1><a id="copy">Copy, move, delete</a></h1>
<div>
<p>
Select some files or directories and click on the Copy, Move or Delete button.<br /><br />
If you copy or move, then choose the target directory.
This can be different for each directory or file that you selected.
To set all target directories to the same value, enter the target directory in the top textbox and click on the button "Set all targetdirectories".<br /><br />
If you don't know the exact name of the target directory, click on <img src="../../skins/shinra/images/actions/view_tree.png" alt="Icon" />. A window will pop up, which allows you to browse the FTP server and choose a directory. Double-click on a subdirectory to go to that subdirectory. To go up, double-click on "..". Once you are in the subdirectory you wanted to find, click on Choose. The subdirectory name will be copied from the popup to the main window.<br />
To copy or move files to a second FTP server, enter the FTP server name, username and password on top.<br />
You need write permissions to be able to copy or move files to a directory.<br /><br />
Once you are ready, click on <img src="../../skins/shinra/images/actions/button_ok.png" alt="Icon" />.<br /><br />
The result screen will tell you if the action was successful or not.
If the files were too big, the script will run until the timeout is reached.
On most web servers the execution time of a script is limited to 30 seconds.
</p>
</div>
</div>
<!-- ENDS post -->
<!-- post -->
<div class="post">
<h1><a id="rename">Rename</a></h1>
<div>
<p>
Select directories or files and click on Rename on the Browse Screen.<br />
The next screen will ask for the new names.<br />
Fill these in and click on <img src="../../skins/shinra/images/actions/button_ok.png" alt="Icon" />.
</p>
</div>
</div>
<!-- ENDS post -->
<!-- post -->
<div class="post">
<h1><a id="chmod">Chmod</a></h1>
<div>
<p>
Select directories or files and click on Chmod on the Browse Screen.<br />
The next screen show the current permissions; select or unselect the checkboxes which represent a permission.<br />
Click on <img src="../../skins/shinra/images/actions/button_ok.png" alt="Icon" />.<br /><br />
Note that for the moment directories are not chmodded recursively -- subdirectories and files will remain unaffected. In the future, recursive chmodding will be added to net2ftp.
</p>
</div>
</div>
<!-- ENDS post -->
<!-- post -->
<div class="post">
<h1><a id="access">Access keys</a></h1>
<div>
<p>
Since version 0.81, most actions can be executed with the keyboard.<br />
On Windows, use ALT + a letter. On Apple computers, use CTRL + a letter.<br />
On Internet Explorer, ALT + a letter will only focus on the page element; press ENTER to execute the action.<br /><br />
Which letter can be used is shown in the tooltip.<br />
For example: to go back, the tooltip is "Back (accesskey b)".<br />
To display a tooltip, leave your mouse cursor for a few seconds over an icon or link without clicking it.<br /><br />
Internet Explorer, Netscape and Mozilla browsers support Access Keys, but Opera doesn't.
</p>
</div>
</div>
<!-- ENDS post -->
<!-- post -->
<div class="post">
<h1><a id="daily">Daily consumption limit</a></h1>
<div>
<p>
Since version 0.81, the Administrator can choose to restrict each user's daily data transfer volume and script execution time.<br />
By default the data transfer volume is set to 50 MB per day and the script execution time to 2500 seconds per day - but this may be changed by the Administrator.<br />
Both figures are logged per IP address, and per FTP server.<br /><br />
Once the daily consumption limit is reached, you will still be able to browse FTP servers, but the transfer of data to/from the server will be blocked.<br />
If you need unrestricted access to net2ftp, contact your net2ftp Administrator or install net2ftp on your own web server.
</p>
</div>
</div>
<!-- ENDS post -->
</div>
<!-- ENDS Posts -->
<!-- sidebar -->
<ul id="sidebar">
<!-- init sidebar -->
<li>
<h6>Jump to:</h6>
<ul>
<li class="cat-item"><a href="#ftp">What is FTP?</a></li>
<li class="cat-item"><a href="#net2ftp">What is net2ftp?</a></li>
<li class="cat-item"><a href="#icons">Icons used</a></li>
<li class="cat-item"><a href="#login">Logging in</a></li>
<li class="cat-item"><a href="#browse">Browsing the FTP server</a></li>
<li class="cat-item"><a href="#upload">Upload files, upload-and-unzip archives</a></li>
<li class="cat-item"><a href="#jupload">Upload files using a Java applet (JUpload)</a></li>
<li class="cat-item"><a href="#download">Downloading and zipping</a></li>
<li class="cat-item"><a href="#view">View code with syntax highlighting</a></li>
<li class="cat-item"><a href="#edit">Edit text</a></li>
<li class="cat-item"><a href="#copy">Copy, move, delete</a></li>
<li class="cat-item"><a href="#rename">Rename</a></li>
<li class="cat-item"><a href="#chmod">Chmod</a></li>
<li class="cat-item"><a href="#access">Access keys</a></li>
<li class="cat-item"><a href="#daily">Daily consumption limit</a></li>
</ul>
</li>
<!-- ENDS init sidebar -->
</ul>
<!-- ENDS sidebar -->
</div>
<!-- ENDS content -->
</div>
<!-- ENDS MAIN -->
<!-- FOOTER -->
<div id="footer">
<!-- Bottom -->
<div id="bottom">
Powered by <a href="http://www.net2ftp.com">net2ftp</a> on a template designed by <a href="http://www.luiszuno.com">Luiszuno</a>
<div id="to-top" class="poshytip" title="To top"></div>
</div>
<!-- ENDS Bottom -->
</div>
<!-- ENDS FOOTER -->
</div>
<!-- ENDS WRAPPER -->
</body>
</html>

View file

@ -1,376 +0,0 @@
<?php
header("Content-type: text/css");
if ($_GET["ltr"] != "rtl") { $left = "left"; $right = "right"; }
else { $left = "right"; $right = "left"; }
?>
/*------------------------------------------------------------------------
General settings
------------------------------------------------------------------------*/
body {
background-color : #FFFFFF;
color: #000000;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: normal;
line-height: normal;
margin-top: 3px;
margin-bottom: 3px;
margin-<?php echo $left; ?>: 3px;
margin-<?php echo $right; ?>: 3px;
}
A:link {
color: #0000FF;
text-decoration: underline;
}
A:visited {
color: #0000FF;
text-decoration: underline;
}
A:hover {
}
li {
margin-top: 5px;
}
h1, h2, h3, p, form {
margin: 0;
}
.menu_header {
background-color: #3333DD;
color: #FFFFFF;
font-size: 110%;
font-weight: bold;
padding-<?php echo $left; ?>: 10px;
padding-<?php echo $right; ?>: 10px;
padding-top: 3px;
padding-bottom: 3px;
}
.menu_item {
line-height: 130%;
padding-top: 3px;
padding-bottom: 3px;
padding-<?php echo $left; ?>: 10px;
padding-<?php echo $right; ?>: 10px;
padding-bottom: 30px;
}
/*------------------------------------------------------------------------
Header level 1-3
------------------------------------------------------------------------*/
.header_table {
background-color: #3333DD;
color: #FFFFFF;
width: 100%;
}
.header11 {
background-color: #3333DD;
color: #FFFFFF;
border: 3px;
border-style: solid;
border-color: #CCCCCC;
margin-<?php echo $left; ?>: auto;
margin-<?php echo $right; ?>: auto;
margin-top: 10px;
margin-bottom: 10px;
width: 200px;
padding-bottom : 8px;
padding-top : 8px;
padding-<?php echo $left; ?> : 12px;
padding-<?php echo $right; ?> : 12px;
font-family: arial black, monaco, chicago;
font-size: 180%;
letter-spacing: 4px;
line-height: 30px;
text-align: center;
}
.header21 {
color: #3333DD;
font-size: 150%;
font-weight: bold;
margin-top: 10px;
margin-bottom: 10px;
padding-top : 5px;
}
.header31 {
color: #3333DD;
font-size: 110%;
font-weight: bold;
text-decoration: underline;
}
/*------------------------------------------------------------------------
Form objects: textboxes, buttons,...
------------------------------------------------------------------------*/
.input {
background-color: #FFFFFF;
color: #000000;
border-color: #330066;
border-width: 1px;
}
.longinput {
background-color: #FFFFFF;
color: #000000;
border-color: #330066;
border-width: 1px;
width: 300px;
}
.textarea {
background-color: #FFFFFF;
border-color: black;
border-width: 1px;
}
.microbutton {
background-color: #DEDEDE;
color: #000000;
height: 17px;
font-size: 8px;
}
.smallbutton {
background-color: #DEDEDE;
color: #000000;
height: 20px;
font-size: 10px;
}
.smalllongbutton {
background-color: #DEDEDE;
color: #000000;
height: 20px;
font-size: 10px;
}
.button {
background-color: #DEDEDE;
color: #000000;
height: 25px;
}
.longbutton {
background-color: #DEDEDE;
color: #000000;
height: 25px;
width: 120px;
}
.extralongbutton {
background-color: #DEDEDE;
color: #000000;
height: 25px;
}
.uploadinputbutton {
background-color: #FFFFFF;
height: 20px;
}
/*------------------------------------------------------------------------
Browse
------------------------------------------------------------------------*/
.browse_table {
margin-top: 0px;
width: 100%;
border: 2px solid #CCCCFF;
}
.browse_rows_heading {
color: #000000;
background-color: #CCCCFF;
font-size: 110%;
font-weight: bold;
}
.browse_rows_actions {
color: #000000;
background-color: #CCCCFF;
font-size: 80%;
font-weight: normal;
text-align: <?php echo $left; ?>;
}
.browse_rows_odd {
color: #000000;
background-color: #FFFFFF;
font-size: 80%;
font-weight: normal;
text-align: <?php echo $left; ?>;
}
.browse_rows_even {
color: #000000;
background-color: #EFEFEF;
font-size: 80%;
font-weight: normal;
text-align: <?php echo $left; ?>;
}
.browse_rows_separator {
color: #000000;
background-color: #CCCCFF;
font-size: 80%;
text-align: center;
}
/*------------------------------------------------------------------------
View
------------------------------------------------------------------------*/
.view {
border: 1px;
border-style: solid;
border-color: #000066;
background-color: #FFFFFF;
font-family: Courier;
font-size: 90%;
margin-<?php echo $left; ?>: 10px;
margin-<?php echo $right; ?>: 10px;
margin-bottom: 10px;
margin-top: 10px;
padding: 10px;
}
/*------------------------------------------------------------------------
Edit
------------------------------------------------------------------------*/
.edit {
font-size: 11px;
font-family: Courier;
}
/*------------------------------------------------------------------------
Error
------------------------------------------------------------------------*/
.error-table {
border: 2px;
border-style: solid;
border-color: #FF0000;
margin: 10px;
padding: 0px;
width: 750px;
}
.error-header {
background-color: #FF0000;
color: #FFFFFF;
text-decoration: underline;
font-size: 120%;
font-weight: bold;
line-height: 25px;
padding-<?php echo $left; ?>: 10px;
padding-<?php echo $right; ?>: 10px;
padding-top: 5px;
padding-bottom: 5px;
}
.error-text {
color: #FF0000;
font-size: 100%;
text-align: <?php echo $left; ?>;
padding: 10px;
}
.warning-box {
background-color: #FFDD00;
color: #000000;
border: 2px;
border-style: solid;
border-color: #FFCC33;
margin-<?php echo $left; ?>: auto;
margin-<?php echo $right; ?>: auto;
width: 90%;
}
.warning-text {
padding-bottom : 5px;
padding-top : 5px;
padding-<?php echo $left; ?> : 10px;
padding-<?php echo $right; ?> : 10px;
}
/*------------------------------------------------------------------------
Admin
------------------------------------------------------------------------*/
.tdheader1 {
font-size: 80%;
font-weight: bold;
text-align: center;
}
.tditem1 {
font-size: 65%;
font-weight: normal;
text-align: <?php echo $left; ?>;
}
/*------------------------------------------------------------------------
Process bar
From the PHP Pear package HTML_Progress
http://pear.laurent-laville.org/HTML_Progress/examples/horizontal/string.php
------------------------------------------------------------------------*/
.p_561b57 .progressBar {
background-color: #FFFFFF;
width: 172px;
height: 24px;
position: relative;
<?php echo $left; ?>: 0px;
top: 0px;
}
.p_561b57 .progressBarBorder {
background-color: #FFFFFF;
width: 172px;
height: 24px;
position: relative;
<?php echo $left; ?>: 0px;
top: 0px;
border-width: 0px;
border-style: solid;
border-color: #000000;
}
.p_561b57 .installationProgress {
width: 300px;
text-align: <?php echo $left; ?>;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #000000;
background-color: #FFFFFF;
}
.p_561b57 .cellI {
width: 15px;
height: 20px;
font-family: Courier, Verdana;
font-size: 8px;
float: <?php echo $left; ?>;
background-color: #CCCCCC;
}
.p_561b57 .cellA {
width: 15px;
height: 20px;
font-family: Courier, Verdana;
font-size: 8px;
float: <?php echo $left; ?>;
background-color: #006600;
visibility: hidden;
}

View file

@ -1,23 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" dir="ltr">
<head>
<title>net2ftp help</title>
<link rel="stylesheet" type="text/css" href="main.css.php?ltr=ltr" />
</head>
<body>
<table align="center" style="border: 2px solid #3333DD;" cellspacing="0" cellpadding="5">
<tr>
<td style="text-align: center; background-color: #3333DD; color: #FFFFFF; font-size: large;">net2ftp help</td>
</tr>
<tr>
<td style="text-align: center;">
<a href="01-welcome.html" target="middle">Welcome!</a> |
<a href="02-user.html" target="middle">User</a> |
<a href="03-administrator.html" target="middle">Administrator</a> |
<a href="04-developer.html" target="middle">Developer</a>
</td>
</tr>
</table>
</body>
</html>

View file

@ -1,308 +0,0 @@
<?php
// -------------------------------------------------------------------------------
// | net2ftp: a web based FTP client |
// | Copyright (c) 2003-2013 by David Gartner |
// | |
// | 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. |
// | |
// -------------------------------------------------------------------------------
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_sendHttpHeaders() {
// --------------
// This function sends HTTP headers
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
} // end net2ftp_sendHttpHeaders
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printJavascript() {
// --------------
// This function prints Javascript code and includes
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
// Code
// echo "<script type=\"text/javascript\"><!--\n";
// echo "//--></script>\n";
// Include
// echo "<script type=\"text/javascript\" src=\"". $net2ftp_globals["application_rootdir_url"] . "/modules/install/install.js\"></script>\n";
} // end net2ftp_printJavascript
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printCss() {
// --------------
// This function prints CSS code and includes
// --------------
global $net2ftp_settings, $net2ftp_globals;
// Include
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"". $net2ftp_globals["application_rootdir_url"] . "/skins/" . $net2ftp_globals["skin"] . "/css/main.css.php?ltr=" . __("ltr") . "&amp;image_url=" . urlEncode2($net2ftp_globals["image_url"]) . "\" />\n";
} // end net2ftp_printCssInclude
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printBodyOnload() {
// --------------
// This function prints the <body onload="" actions
// --------------
// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
// echo "";
} // end net2ftp_printBodyOnload
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function net2ftp_module_printBody() {
// --------------
// This function prints the chmod screen
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result, $net2ftp_output;
if (isset($_POST["list"]) == true) { $list = getSelectedEntries($_POST["list"]); }
else { $list = ""; }
// -------------------------------------------------------------------------
// Variables for all screens
// -------------------------------------------------------------------------
// Title
$title = __("Install software packages");
// Form name, back and forward buttons
$formname = "InstallForm";
$back_onclick = "document.forms['" . $formname . "'].state.value='browse';document.forms['" . $formname . "'].state2.value='main';document.forms['" . $formname . "'].submit();";
// -------------------------------------------------------------------------
// Screen 1
// -------------------------------------------------------------------------
if ($net2ftp_globals["screen"] == 1) {
// ----------------------------------------------
// Read the net2ftp installer script template $text
// ----------------------------------------------
$templatefile = $net2ftp_globals["application_rootdir"] . "/modules/install/net2ftp_installer.txt";
$handle = fopen($templatefile, "r"); // Open the local template file for reading only
if ($handle == false) {
$errormessage = __("Unable to open the template file");
setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
return false;
}
clearstatcache(); // for filesize
$text = fread($handle, filesize($templatefile));
if ($text == false) {
$errormessage = __("Unable to read the template file");
setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
return false;
}
@fclose($handle);
// ----------------------------------------------
// Read the list of packages
// ----------------------------------------------
$packagelistfile_net2ftp = "http://www.net2ftp.com/package_list.txt";
$packagelistfile_local = $net2ftp_globals["application_rootdir"] . "/modules/install/package_list.txt";
// Get the list of packages from net2ftp.com
$handle_net2ftp = @fopen($packagelistfile_net2ftp, "r");
clearstatcache(); // for filesize
$packagelist_net2ftp = @fread($handle_net2ftp, filesize($packagelistfile_net2ftp));
@fclose($handle_net2ftp);
// If net2ftp.com can't be reached, get it from the local installation
if ($packagelist_net2ftp == false) {
$handle_local = @fopen($packagelistfile_local, "r");
clearstatcache(); // for filesize
$packagelist_local = @fread($handle_local, filesize($packagelistfile_local));
@fclose($handle_local);
}
// Issue an error message if no list could be read
if ($packagelist_net2ftp != "") { $packagelist = $packagelist_net2ftp; }
elseif ($packagelist_local != "") { $packagelist = $packagelist_local; }
else {
$errormessage = __("Unable to get the list of packages");
setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
return false;
}
// ----------------------------------------------
// Security code
// Random key generator by goochivasquez -at- gmail (15-Apr-2005 11:53)
// ----------------------------------------------
// Random key generator
$keychars = "abcdefghijklmnopqrstuvwxyz0123456789";
$length = 20;
$security_code = "";
for ($i=0;$i<$length;$i++) { $security_code .= substr($keychars,rand(1,strlen($keychars)),1); }
// Random key generator
$keychars = "abcdefghijklmnopqrstuvwxyz0123456789";
$length = 5;
$tempdir_extension = "";
for ($i=0;$i<$length;$i++) { $tempdir_extension .= substr($keychars,rand(1,strlen($keychars)),1); }
$tempdir_ftp = glueDirectories($net2ftp_globals["directory"], "net2ftp_temp_") . $tempdir_extension;
// ----------------------------------------------
// Replace certain values
// ----------------------------------------------
$text = str_replace("NET2FTP_SECURITY_CODE", $security_code, $text);
$text = str_replace("NET2FTP_TEMPDIR_EXTENSION", $tempdir_extension, $text);
$text = str_replace("NET2FTP_PACKAGELIST", $packagelist, $text);
$text = str_replace("NET2FTP_FTP_SERVER", $net2ftp_globals["ftpserver"], $text);
$text = str_replace("NET2FTP_FTPSERVER_PORT", $net2ftp_globals["ftpserverport"], $text);
$text = str_replace("NET2FTP_USERNAME", $net2ftp_globals["username"], $text);
$text = str_replace("NET2FTP_DIRECTORY", $net2ftp_globals["directory"], $text);
// ----------------------------------------------
// Open connection
// ----------------------------------------------
setStatus(2, 10, __("Connecting to the FTP server"));
$conn_id = ftp_openconnection();
if ($conn_id == false) { return false; }
// ----------------------------------------------
// Create temporary /net2ftp_temp directory
// ----------------------------------------------
setStatus(4, 10, __("Creating a temporary directory on the FTP server"));
ftp_newdirectory($conn_id, $tempdir_ftp);
if ($net2ftp_result["success"] == false) { setErrorVars(true, "", "", "", ""); }
// ----------------------------------------------
// Chmodding the temporary /net2ftp_temp directory to 777
// ----------------------------------------------
setStatus(6, 10, __("Setting the permissions of the temporary directory"));
$sitecommand = "chmod 0777 " . $tempdir_ftp;
$ftp_site_result = @ftp_site($conn_id, $sitecommand);
// ----------------------------------------------
// Put a .htaccess in the /net2ftp_temp directory to avoid anyone else reading the contents it
// (Works only for Apache web servers...)
// ----------------------------------------------
ftp_writefile($conn_id, $tempdir_ftp, ".htaccess", "deny from all");
if ($net2ftp_result["success"] == false) { setErrorVars(true, "", "", "", ""); }
// ----------------------------------------------
// Write the net2ftp installer script to the FTP server
// ----------------------------------------------
setStatus(8, 10, __("Copying the net2ftp installer script to the FTP server"));
ftp_writefile($conn_id, $net2ftp_globals["directory"], "net2ftp_installer.php", $text);
if ($net2ftp_result["success"] == false) { return false; }
// ----------------------------------------------
// Close connection
// ----------------------------------------------
ftp_closeconnection($conn_id);
// ----------------------------------------------
// Variables for screen 1
// ----------------------------------------------
// URL to the installer script
$list_files[1]["dirfilename_js"] = "net2ftp_installer.php?security_code=" . $security_code;
$ftp2http_result = ftp2http($net2ftp_globals["directory"], $list_files, "no");
$net2ftp_installer_url = $ftp2http_result[1];
} // end if
// -------------------------------------------------------------------------
// Print the output
// -------------------------------------------------------------------------
require_once($net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php");
} // End net2ftp_printBody
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
?>

File diff suppressed because it is too large Load diff

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