Subversion Repositories cryptochat

Compare Revisions

No changes between revisions

Regard whitespace Rev 1 → Rev 2

/trunk/AUTHOR
0,0 → 1,4
Name: Daniel Marschall
Organisation: ViaThinkSoft
Web: http://www.viathinksoft.com/
E-Mail: daniel-marschall & viathinksoft.de
/trunk/CHANGELOG
0,0 → 1,35
0.25 Beta (2018-04-18)
- Fixed small PHP warning
- Black background is now darkblue
 
0.24 Beta (2014-03-01)
- New feature: User online list
Added configuration flags: USERSTAT_INACTIVE_SECS and DELETE_OLD_USERSTATS
- fixed compatibility problem with Chrome
- smaller fixes
 
0.23.1 beta (2014-02-23)
- fixed compatibility problem with Chrome
 
0.23 beta (2014-02-21)
- Decryption will start without delay if enter is pressed
- improved page title line (room name is now in front)
- htmlentities() to prevent XSS on username and roomname
- smaller fixes
 
0.22 beta (2014-02-17)
- New feature: List chat rooms (requires password)
- Improved username coloring function
- Username, Chat name and admin password will now be trimmed
- Chat names are now automatically converted to lowercase
- Added config symbol THEME_DARK
- Added config symbol CFG_CIPHERSUITE (replaces USE_MD5_COMPAT)
- Renamed config symbol ADMIN_PASSWORD to PWD_CREATE_ROOM
- Added config symbol PWD_LIST_ROOMS
- Added config symbol LIST_CHATS_REQUIRE_PWD
- Renamed config symbol NEEDS_TLS to REQUIRE_TLS
- Small bug fixes
 
0.21 beta (2014-02-16)
- First public release
 
/trunk/DEPENDENCIES
0,0 → 1,36
LICENSE DEPENDENCY TREE
 
[ ] ViaThinkSoft CryptoChat
| License: GPLv3 ( http://www.gnu.de/documents/gpl-3.0.en.html )
|
+--- Code snippets included in source code:
| * JS get_html_translation_table(): From http://phpjs.org/functions
| * JS Array.prototype.remove: By John Resig (MIT Licensed)
| * JS htmlentities(): From http://phpjs.org/functions
| * JS sleep(): From http://www.phpied.com/sleep-in-javascript/
| * JS scrollToBottom(): From http://www.sourcetricks.com/2010/07/javascript-scroll-to-bottom-of-page.html
| * JS randomString(): From http://stackoverflow.com/a/1349426 (modified)
| * JS pad(): From http://stackoverflow.com/a/2998822
| * JS HSVtoRGB(): From http://stackoverflow.com/a/17243070
| * JS luminance_perceived(): From http://stackoverflow.com/a/596243
| * CSS hand pointer cursor line: From http://www.drweb.de/magazin/browser-cursor-hand/
|
+---[ ] CryptoJS 3.1.2
| Web site: http://code.google.com/p/crypto-js/
| License: MIT license ( http://opensource.org/licenses/MIT )
|
+---[ ] SAJAX 0.13
| Web site: http://www.modernmethod.com/sajax/
| License: "open source BSD license"
|
+---[ ] CRC32 for JavaScript
| Web site: https://github.com/wbond/crc32-js-php
| License: MIT license ( http://opensource.org/licenses/MIT )
|
+---[ ] JSONWrapper
| Web site: http://www.boutell.com/scripts/jsonwrapper.html
| License: Public Domain
|
+---[ ] Services_JSON PEAR library
Web site: http://pear.php.net/package/Services_JSON
License: BSD 2-Clause License ( http://opensource.org/licenses/bsd-license.php )
/trunk/INSTALL
0,0 → 1,9
How to install CryptoChat
 
1. Copy config/config.original.inc.php
to config/config.inc.php
 
and edit it.
 
2. You are ready
 
/trunk/LICENSE
0,0 → 1,675
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
 
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
 
Preamble
 
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
 
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
 
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
 
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
 
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
 
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
 
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
 
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
 
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
 
The precise terms and conditions for copying, distribution and
modification follow.
 
TERMS AND CONDITIONS
 
0. Definitions.
 
"This License" refers to version 3 of the GNU General Public License.
 
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
 
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
 
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
 
A "covered work" means either the unmodified Program or a work based
on the Program.
 
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
 
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
 
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
 
1. Source Code.
 
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
 
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
 
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
 
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
 
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
 
The Corresponding Source for a work in source code form is that
same work.
 
2. Basic Permissions.
 
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
 
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
 
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
 
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
 
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
 
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
 
4. Conveying Verbatim Copies.
 
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
 
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
 
5. Conveying Modified Source Versions.
 
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
 
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
 
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
 
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
 
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
 
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
 
6. Conveying Non-Source Forms.
 
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
 
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
 
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
 
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
 
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
 
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
 
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
 
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
 
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
 
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
 
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
 
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
 
7. Additional Terms.
 
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
 
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
 
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
 
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
 
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
 
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
 
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
 
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
 
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
 
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
 
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
 
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
 
8. Termination.
 
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
 
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
 
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
 
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
 
9. Acceptance Not Required for Having Copies.
 
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
 
10. Automatic Licensing of Downstream Recipients.
 
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
 
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
 
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
 
11. Patents.
 
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
 
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
 
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
 
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
 
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
 
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
 
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
 
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
 
12. No Surrender of Others' Freedom.
 
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
 
13. Use with the GNU Affero General Public License.
 
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
 
14. Revised Versions of this License.
 
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
 
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
 
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
 
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
 
15. Disclaimer of Warranty.
 
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
 
16. Limitation of Liability.
 
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
 
17. Interpretation of Sections 15 and 16.
 
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
 
END OF TERMS AND CONDITIONS
 
How to Apply These Terms to Your New Programs
 
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
 
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
 
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
 
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
 
Also add information on how to contact you by electronic and paper mail.
 
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
 
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
 
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
 
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
 
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
 
/trunk/README
0,0 → 1,11
This is an AJAX crypto chat which encrypts and decrypts using JavaScript on client side.
The chat log is saved encrypted on the server.
 
Note about security:
- Please ensure that you are using HTTPS, otherwise the JavaScript could be manipulated using MITM.
 
What is encrypted?
- Messages which are shown ORANGE are encrypted. White messages are not encrypted.
- Usernames and time stamps are not encrypted.
- Chat room names are not encrypted.
 
/trunk/REQUIREMENTS
0,0 → 1,7
Server:
- Linux
- PHP
- Apache
 
Clients:
- JavaScript capable web browser
/trunk/VERSION
0,0 → 1,2
0.25
 
/trunk/chats/.htaccess
0,0 → 1,3
Order Deny,Allow
Deny From All
 
/trunk/chats
Property changes:
Added: svn:ignore
+*.html
+*.session
/trunk/config/.htaccess
0,0 → 1,3
Order Deny,Allow
Deny From All
 
/trunk/config/config.original.inc.php
0,0 → 1,42
<?php
 
define('X_SALT', '<enter something secret here>'); // If you change this, existing chats will become unreadable.
define('KEEP_X_SALT_SECRET', true); // More secure. Only applies to manual_create.php
define('CHAT_MUST_EXIST', true); // If set to false, users can create chat rooms themselves.
define('PWD_LIST_ROOMS', ''); // Password for listing chat rooms
define('LIST_CHATS_REQUIRE_PWD', true); // If set to true, you need a password for listing all chat rooms.
define('PWD_CREATE_ROOM', ''); // Password for creating new chat rooms
define('REQUIRE_TLS', true); // If set to true, you can only connect via HTTPS.
define('TIMER_1', 2500); // Default reload timer (ms)
define('TIMER_2', 1000); // Reload timer (ms) when a new message arrived
define('TIMER_KEYCHANGE', 1000); // Timer when the key edit was changed
define('TIMER_DEAD', 5000); // Max timeout until AJAX request is seen as failed
define('THEME_DARK', true); // Please set to true if you use a dark theme (important for automatical username coloring)
define('USERSTAT_INACTIVE_SECS', 10); // After how many seconds will the user be removed from the online list?
define('DELETE_OLD_USERSTATS', true); // Delete user stats when the activity is above USERSTAT_INACTIVE_SECS?
 
// Default cipher suite for sending new messages. Note that messages sent with another cipher suite still will be decrypted using the original algorithm.
// ----+-------+----------------------------------------------------------------
// Num | Since | Description
// ----+-------+----------------------------------------------------------------
// 1 | 0.9 | AES Encryption. Salted SHA256 hash, AES encryption.
// 2 | 0.9 | AES Encryption. Salted&Cascaded MD5 because of SHA256 compatibility issues with OpenPandora's web browser.
define('CFG_CIPHERSUITE', 2);
 
// CryptoJS
// Minimum required version: 3.1.2
// Get it here: http://code.google.com/p/crypto-js/
define('DEP_DIR_CRYPTOJS', 'dependencies/cryptojs');
 
// SAJAX
// Minimum required version: 0.13
// Get it here: https://github.com/AJenbo/Sajax/
define('DEP_DIR_SAJAX', 'dependencies/sajax');
 
// JSONWrapper
// Get it here: http://www.boutell.com/scripts/jsonwrapper.html
define('DEP_DIR_JSONWRAPPER', 'dependencies/jsonwrapper');
 
// CRC32 JS PHP
// Get it here: https://github.com/wbond/crc32-js-php
define('DEP_DIR_CRC32', 'dependencies/crc32-js-php');
/trunk/config
Property changes:
Added: svn:ignore
+config.inc.php
/trunk/dependencies/crc32-js-php/crc32.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/aes-min.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/aes.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/cipher-core-min.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/cipher-core.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/core-min.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/core.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/enc-base64-min.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/enc-base64.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/enc-utf16-min.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/enc-utf16.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/evpkdf-min.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/evpkdf.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/format-hex-min.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/format-hex.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/hmac-min.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/hmac.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/lib-typedarrays-min.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/lib-typedarrays.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/md5-min.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/md5.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/mode-cfb-min.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/mode-cfb.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/mode-ctr-gladman-min.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/mode-ctr-gladman.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/mode-ctr-min.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/mode-ctr.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/mode-ecb-min.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/mode-ecb.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/mode-ofb-min.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/mode-ofb.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/pad-ansix923-min.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/pad-ansix923.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/pad-iso10126-min.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/pad-iso10126.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/pad-iso97971-min.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/pad-iso97971.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/pad-nopadding-min.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/pad-nopadding.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/pad-zeropadding-min.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/pad-zeropadding.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/pbkdf2-min.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/pbkdf2.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/rabbit-legacy-min.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/rabbit-legacy.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/rabbit-min.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/rabbit.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/rc4-min.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/rc4.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/ripemd160-min.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/ripemd160.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/sha1-min.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/sha1.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/sha224-min.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/sha224.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/sha256-min.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/sha256.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/sha3-min.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/sha3.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/sha384-min.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/sha384.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/sha512-min.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/sha512.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/tripledes-min.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/tripledes.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/x64-core-min.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/components/x64-core.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/rollups/aes.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/rollups/hmac-md5.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/rollups/hmac-ripemd160.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/rollups/hmac-sha1.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/rollups/hmac-sha224.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/rollups/hmac-sha256.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/rollups/hmac-sha3.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/rollups/hmac-sha384.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/rollups/hmac-sha512.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/rollups/md5.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/rollups/pbkdf2.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/rollups/rabbit-legacy.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/rollups/rabbit.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/rollups/rc4.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/rollups/ripemd160.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/rollups/sha1.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/rollups/sha224.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/rollups/sha256.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/rollups/sha3.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/rollups/sha384.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/rollups/sha512.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/cryptojs/rollups/tripledes.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/jsonwrapper/JSON/JSON.php
0,0 → 1,806
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
 
/**
* Converts to and from JSON format.
*
* JSON (JavaScript Object Notation) is a lightweight data-interchange
* format. It is easy for humans to read and write. It is easy for machines
* to parse and generate. It is based on a subset of the JavaScript
* Programming Language, Standard ECMA-262 3rd Edition - December 1999.
* This feature can also be found in Python. JSON is a text format that is
* completely language independent but uses conventions that are familiar
* to programmers of the C-family of languages, including C, C++, C#, Java,
* JavaScript, Perl, TCL, and many others. These properties make JSON an
* ideal data-interchange language.
*
* This package provides a simple encoder and decoder for JSON notation. It
* is intended for use with client-side Javascript applications that make
* use of HTTPRequest to perform server communication functions - data can
* be encoded into JSON notation for use in a client-side javascript, or
* decoded from incoming Javascript requests. JSON format is native to
* Javascript, and can be directly eval()'ed with no further parsing
* overhead
*
* All strings should be in ASCII or UTF-8 format!
*
* LICENSE: 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.
*
* THIS SOFTWARE IS PROVIDED ``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 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.
*
* @category
* @package Services_JSON
* @author Michal Migurski <mike-json@teczno.com>
* @author Matt Knapp <mdknapp[at]gmail[dot]com>
* @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
* @copyright 2005 Michal Migurski
* @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $
* @license http://www.opensource.org/licenses/bsd-license.php
* @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
*/
 
/**
* Marker constant for Services_JSON::decode(), used to flag stack state
*/
define('SERVICES_JSON_SLICE', 1);
 
/**
* Marker constant for Services_JSON::decode(), used to flag stack state
*/
define('SERVICES_JSON_IN_STR', 2);
 
/**
* Marker constant for Services_JSON::decode(), used to flag stack state
*/
define('SERVICES_JSON_IN_ARR', 3);
 
/**
* Marker constant for Services_JSON::decode(), used to flag stack state
*/
define('SERVICES_JSON_IN_OBJ', 4);
 
/**
* Marker constant for Services_JSON::decode(), used to flag stack state
*/
define('SERVICES_JSON_IN_CMT', 5);
 
/**
* Behavior switch for Services_JSON::decode()
*/
define('SERVICES_JSON_LOOSE_TYPE', 16);
 
/**
* Behavior switch for Services_JSON::decode()
*/
define('SERVICES_JSON_SUPPRESS_ERRORS', 32);
 
/**
* Converts to and from JSON format.
*
* Brief example of use:
*
* <code>
* // create a new instance of Services_JSON
* $json = new Services_JSON();
*
* // convert a complexe value to JSON notation, and send it to the browser
* $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4)));
* $output = $json->encode($value);
*
* print($output);
* // prints: ["foo","bar",[1,2,"baz"],[3,[4]]]
*
* // accept incoming POST data, assumed to be in JSON notation
* $input = file_get_contents('php://input', 1000000);
* $value = $json->decode($input);
* </code>
*/
class Services_JSON
{
/**
* constructs a new JSON instance
*
* @param int $use object behavior flags; combine with boolean-OR
*
* possible values:
* - SERVICES_JSON_LOOSE_TYPE: loose typing.
* "{...}" syntax creates associative arrays
* instead of objects in decode().
* - SERVICES_JSON_SUPPRESS_ERRORS: error suppression.
* Values which can't be encoded (e.g. resources)
* appear as NULL instead of throwing errors.
* By default, a deeply-nested resource will
* bubble up with an error, so all return values
* from encode() should be checked with isError()
*/
function Services_JSON($use = 0)
{
$this->use = $use;
}
 
/**
* convert a string from one UTF-16 char to one UTF-8 char
*
* Normally should be handled by mb_convert_encoding, but
* provides a slower PHP-only method for installations
* that lack the multibye string extension.
*
* @param string $utf16 UTF-16 character
* @return string UTF-8 character
* @access private
*/
function utf162utf8($utf16)
{
// oh please oh please oh please oh please oh please
if(function_exists('mb_convert_encoding')) {
return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
}
 
$bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
 
switch(true) {
case ((0x7F & $bytes) == $bytes):
// this case should never be reached, because we are in ASCII range
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr(0x7F & $bytes);
 
case (0x07FF & $bytes) == $bytes:
// return a 2-byte UTF-8 character
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr(0xC0 | (($bytes >> 6) & 0x1F))
. chr(0x80 | ($bytes & 0x3F));
 
case (0xFFFF & $bytes) == $bytes:
// return a 3-byte UTF-8 character
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr(0xE0 | (($bytes >> 12) & 0x0F))
. chr(0x80 | (($bytes >> 6) & 0x3F))
. chr(0x80 | ($bytes & 0x3F));
}
 
// ignoring UTF-32 for now, sorry
return '';
}
 
/**
* convert a string from one UTF-8 char to one UTF-16 char
*
* Normally should be handled by mb_convert_encoding, but
* provides a slower PHP-only method for installations
* that lack the multibye string extension.
*
* @param string $utf8 UTF-8 character
* @return string UTF-16 character
* @access private
*/
function utf82utf16($utf8)
{
// oh please oh please oh please oh please oh please
if(function_exists('mb_convert_encoding')) {
return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
}
 
switch(strlen($utf8)) {
case 1:
// this case should never be reached, because we are in ASCII range
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return $utf8;
 
case 2:
// return a UTF-16 character from a 2-byte UTF-8 char
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr(0x07 & (ord($utf8{0}) >> 2))
. chr((0xC0 & (ord($utf8{0}) << 6))
| (0x3F & ord($utf8{1})));
 
case 3:
// return a UTF-16 character from a 3-byte UTF-8 char
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr((0xF0 & (ord($utf8{0}) << 4))
| (0x0F & (ord($utf8{1}) >> 2)))
. chr((0xC0 & (ord($utf8{1}) << 6))
| (0x7F & ord($utf8{2})));
}
 
// ignoring UTF-32 for now, sorry
return '';
}
 
/**
* encodes an arbitrary variable into JSON format
*
* @param mixed $var any number, boolean, string, array, or object to be encoded.
* see argument 1 to Services_JSON() above for array-parsing behavior.
* if var is a strng, note that encode() always expects it
* to be in ASCII or UTF-8 format!
*
* @return mixed JSON string representation of input var or an error if a problem occurs
* @access public
*/
function encode($var)
{
switch (gettype($var)) {
case 'boolean':
return $var ? 'true' : 'false';
 
case 'NULL':
return 'null';
 
case 'integer':
return (int) $var;
 
case 'double':
case 'float':
return (float) $var;
 
case 'string':
// STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
$ascii = '';
$strlen_var = strlen($var);
 
/*
* Iterate over every character in the string,
* escaping with a slash or encoding to UTF-8 where necessary
*/
for ($c = 0; $c < $strlen_var; ++$c) {
 
$ord_var_c = ord($var{$c});
 
switch (true) {
case $ord_var_c == 0x08:
$ascii .= '\b';
break;
case $ord_var_c == 0x09:
$ascii .= '\t';
break;
case $ord_var_c == 0x0A:
$ascii .= '\n';
break;
case $ord_var_c == 0x0C:
$ascii .= '\f';
break;
case $ord_var_c == 0x0D:
$ascii .= '\r';
break;
 
case $ord_var_c == 0x22:
case $ord_var_c == 0x2F:
case $ord_var_c == 0x5C:
// double quote, slash, slosh
$ascii .= '\\'.$var{$c};
break;
 
case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
// characters U-00000000 - U-0000007F (same as ASCII)
$ascii .= $var{$c};
break;
 
case (($ord_var_c & 0xE0) == 0xC0):
// characters U-00000080 - U-000007FF, mask 110XXXXX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$char = pack('C*', $ord_var_c, ord($var{$c + 1}));
$c += 1;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
break;
 
case (($ord_var_c & 0xF0) == 0xE0):
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$char = pack('C*', $ord_var_c,
ord($var{$c + 1}),
ord($var{$c + 2}));
$c += 2;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
break;
 
case (($ord_var_c & 0xF8) == 0xF0):
// characters U-00010000 - U-001FFFFF, mask 11110XXX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$char = pack('C*', $ord_var_c,
ord($var{$c + 1}),
ord($var{$c + 2}),
ord($var{$c + 3}));
$c += 3;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
break;
 
case (($ord_var_c & 0xFC) == 0xF8):
// characters U-00200000 - U-03FFFFFF, mask 111110XX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$char = pack('C*', $ord_var_c,
ord($var{$c + 1}),
ord($var{$c + 2}),
ord($var{$c + 3}),
ord($var{$c + 4}));
$c += 4;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
break;
 
case (($ord_var_c & 0xFE) == 0xFC):
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$char = pack('C*', $ord_var_c,
ord($var{$c + 1}),
ord($var{$c + 2}),
ord($var{$c + 3}),
ord($var{$c + 4}),
ord($var{$c + 5}));
$c += 5;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
break;
}
}
 
return '"'.$ascii.'"';
 
case 'array':
/*
* As per JSON spec if any array key is not an integer
* we must treat the the whole array as an object. We
* also try to catch a sparsely populated associative
* array with numeric keys here because some JS engines
* will create an array with empty indexes up to
* max_index which can cause memory issues and because
* the keys, which may be relevant, will be remapped
* otherwise.
*
* As per the ECMA and JSON specification an object may
* have any string as a property. Unfortunately due to
* a hole in the ECMA specification if the key is a
* ECMA reserved word or starts with a digit the
* parameter is only accessible using ECMAScript's
* bracket notation.
*/
 
// treat as a JSON object
if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
$properties = array_map(array($this, 'name_value'),
array_keys($var),
array_values($var));
 
foreach($properties as $property) {
if(Services_JSON::isError($property)) {
return $property;
}
}
 
return '{' . join(',', $properties) . '}';
}
 
// treat it like a regular array
$elements = array_map(array($this, 'encode'), $var);
 
foreach($elements as $element) {
if(Services_JSON::isError($element)) {
return $element;
}
}
 
return '[' . join(',', $elements) . ']';
 
case 'object':
$vars = get_object_vars($var);
 
$properties = array_map(array($this, 'name_value'),
array_keys($vars),
array_values($vars));
 
foreach($properties as $property) {
if(Services_JSON::isError($property)) {
return $property;
}
}
 
return '{' . join(',', $properties) . '}';
 
default:
return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
? 'null'
: new Services_JSON_Error(gettype($var)." can not be encoded as JSON string");
}
}
 
/**
* array-walking function for use in generating JSON-formatted name-value pairs
*
* @param string $name name of key to use
* @param mixed $value reference to an array element to be encoded
*
* @return string JSON-formatted name-value pair, like '"name":value'
* @access private
*/
function name_value($name, $value)
{
$encoded_value = $this->encode($value);
 
if(Services_JSON::isError($encoded_value)) {
return $encoded_value;
}
 
return $this->encode(strval($name)) . ':' . $encoded_value;
}
 
/**
* reduce a string by removing leading and trailing comments and whitespace
*
* @param $str string string value to strip of comments and whitespace
*
* @return string string value stripped of comments and whitespace
* @access private
*/
function reduce_string($str)
{
$str = preg_replace(array(
 
// eliminate single line comments in '// ...' form
'#^\s*//(.+)$#m',
 
// eliminate multi-line comments in '/* ... */' form, at start of string
'#^\s*/\*(.+)\*/#Us',
 
// eliminate multi-line comments in '/* ... */' form, at end of string
'#/\*(.+)\*/\s*$#Us'
 
), '', $str);
 
// eliminate extraneous space
return trim($str);
}
 
/**
* decodes a JSON string into appropriate variable
*
* @param string $str JSON-formatted string
*
* @return mixed number, boolean, string, array, or object
* corresponding to given JSON input string.
* See argument 1 to Services_JSON() above for object-output behavior.
* Note that decode() always returns strings
* in ASCII or UTF-8 format!
* @access public
*/
function decode($str)
{
$str = $this->reduce_string($str);
 
switch (strtolower($str)) {
case 'true':
return true;
 
case 'false':
return false;
 
case 'null':
return null;
 
default:
$m = array();
 
if (is_numeric($str)) {
// Lookie-loo, it's a number
 
// This would work on its own, but I'm trying to be
// good about returning integers where appropriate:
// return (float)$str;
 
// Return float or int, as appropriate
return ((float)$str == (integer)$str)
? (integer)$str
: (float)$str;
 
} elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {
// STRINGS RETURNED IN UTF-8 FORMAT
$delim = substr($str, 0, 1);
$chrs = substr($str, 1, -1);
$utf8 = '';
$strlen_chrs = strlen($chrs);
 
for ($c = 0; $c < $strlen_chrs; ++$c) {
 
$substr_chrs_c_2 = substr($chrs, $c, 2);
$ord_chrs_c = ord($chrs{$c});
 
switch (true) {
case $substr_chrs_c_2 == '\b':
$utf8 .= chr(0x08);
++$c;
break;
case $substr_chrs_c_2 == '\t':
$utf8 .= chr(0x09);
++$c;
break;
case $substr_chrs_c_2 == '\n':
$utf8 .= chr(0x0A);
++$c;
break;
case $substr_chrs_c_2 == '\f':
$utf8 .= chr(0x0C);
++$c;
break;
case $substr_chrs_c_2 == '\r':
$utf8 .= chr(0x0D);
++$c;
break;
 
case $substr_chrs_c_2 == '\\"':
case $substr_chrs_c_2 == '\\\'':
case $substr_chrs_c_2 == '\\\\':
case $substr_chrs_c_2 == '\\/':
if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
($delim == "'" && $substr_chrs_c_2 != '\\"')) {
$utf8 .= $chrs{++$c};
}
break;
 
case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)):
// single, escaped unicode character
$utf16 = chr(hexdec(substr($chrs, ($c + 2), 2)))
. chr(hexdec(substr($chrs, ($c + 4), 2)));
$utf8 .= $this->utf162utf8($utf16);
$c += 5;
break;
 
case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
$utf8 .= $chrs{$c};
break;
 
case ($ord_chrs_c & 0xE0) == 0xC0:
// characters U-00000080 - U-000007FF, mask 110XXXXX
//see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$utf8 .= substr($chrs, $c, 2);
++$c;
break;
 
case ($ord_chrs_c & 0xF0) == 0xE0:
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$utf8 .= substr($chrs, $c, 3);
$c += 2;
break;
 
case ($ord_chrs_c & 0xF8) == 0xF0:
// characters U-00010000 - U-001FFFFF, mask 11110XXX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$utf8 .= substr($chrs, $c, 4);
$c += 3;
break;
 
case ($ord_chrs_c & 0xFC) == 0xF8:
// characters U-00200000 - U-03FFFFFF, mask 111110XX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$utf8 .= substr($chrs, $c, 5);
$c += 4;
break;
 
case ($ord_chrs_c & 0xFE) == 0xFC:
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$utf8 .= substr($chrs, $c, 6);
$c += 5;
break;
 
}
 
}
 
return $utf8;
 
} elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {
// array, or object notation
 
if ($str{0} == '[') {
$stk = array(SERVICES_JSON_IN_ARR);
$arr = array();
} else {
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
$stk = array(SERVICES_JSON_IN_OBJ);
$obj = array();
} else {
$stk = array(SERVICES_JSON_IN_OBJ);
$obj = new stdClass();
}
}
 
array_push($stk, array('what' => SERVICES_JSON_SLICE,
'where' => 0,
'delim' => false));
 
$chrs = substr($str, 1, -1);
$chrs = $this->reduce_string($chrs);
 
if ($chrs == '') {
if (reset($stk) == SERVICES_JSON_IN_ARR) {
return $arr;
 
} else {
return $obj;
 
}
}
 
//print("\nparsing {$chrs}\n");
 
$strlen_chrs = strlen($chrs);
 
for ($c = 0; $c <= $strlen_chrs; ++$c) {
 
$top = end($stk);
$substr_chrs_c_2 = substr($chrs, $c, 2);
 
if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
// found a comma that is not inside a string, array, etc.,
// OR we've reached the end of the character list
$slice = substr($chrs, $top['where'], ($c - $top['where']));
array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false));
//print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
 
if (reset($stk) == SERVICES_JSON_IN_ARR) {
// we are in an array, so just push an element onto the stack
array_push($arr, $this->decode($slice));
 
} elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
// we are in an object, so figure
// out the property name and set an
// element in an associative array,
// for now
$parts = array();
if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
// "name":value pair
$key = $this->decode($parts[1]);
$val = $this->decode($parts[2]);
 
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
$obj[$key] = $val;
} else {
$obj->$key = $val;
}
} elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
// name:value pair, where name is unquoted
$key = $parts[1];
$val = $this->decode($parts[2]);
 
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
$obj[$key] = $val;
} else {
$obj->$key = $val;
}
}
 
}
 
} elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
// found a quote, and we are not inside a string
array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c}));
//print("Found start of string at {$c}\n");
 
} elseif (($chrs{$c} == $top['delim']) &&
($top['what'] == SERVICES_JSON_IN_STR) &&
((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) {
// found a quote, we're in a string, and it's not escaped
// we know that it's not escaped becase there is _not_ an
// odd number of backslashes at the end of the string so far
array_pop($stk);
//print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
 
} elseif (($chrs{$c} == '[') &&
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
// found a left-bracket, and we are in an array, object, or slice
array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
//print("Found start of array at {$c}\n");
 
} elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
// found a right-bracket, and we're in an array
array_pop($stk);
//print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
 
} elseif (($chrs{$c} == '{') &&
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
// found a left-brace, and we are in an array, object, or slice
array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
//print("Found start of object at {$c}\n");
 
} elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
// found a right-brace, and we're in an object
array_pop($stk);
//print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
 
} elseif (($substr_chrs_c_2 == '/*') &&
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
// found a comment start, and we are in an array, object, or slice
array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false));
$c++;
//print("Found start of comment at {$c}\n");
 
} elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) {
// found a comment end, and we're in one now
array_pop($stk);
$c++;
 
for ($i = $top['where']; $i <= $c; ++$i)
$chrs = substr_replace($chrs, ' ', $i, 1);
 
//print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
 
}
 
}
 
if (reset($stk) == SERVICES_JSON_IN_ARR) {
return $arr;
 
} elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
return $obj;
 
}
 
}
}
}
 
/**
* @todo Ultimately, this should just call PEAR::isError()
*/
function isError($data, $code = null)
{
if (class_exists('pear')) {
return PEAR::isError($data, $code);
} elseif (is_object($data) && (get_class($data) == 'services_json_error' ||
is_subclass_of($data, 'services_json_error'))) {
return true;
}
 
return false;
}
}
 
if (class_exists('PEAR_Error')) {
 
class Services_JSON_Error extends PEAR_Error
{
function Services_JSON_Error($message = 'unknown error', $code = null,
$mode = null, $options = null, $userinfo = null)
{
parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
}
}
 
} else {
 
/**
* @todo Ultimately, this class shall be descended from PEAR_Error
*/
class Services_JSON_Error
{
function Services_JSON_Error($message = 'unknown error', $code = null,
$mode = null, $options = null, $userinfo = null)
{
 
}
}
 
}
?>
/trunk/dependencies/jsonwrapper/JSON/LICENSE
0,0 → 1,21
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.
 
THIS SOFTWARE IS PROVIDED ``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 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.
/trunk/dependencies/jsonwrapper/JSON/Test-JSON.php
0,0 → 1,521
<?php
// $Id: Test-JSON.php,v 1.28 2006/06/28 05:54:17 migurski Exp $
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
 
/**
* Unit tests for Services_JSON.
* @see JSON.php
*
* @category
* @package Services_JSON
* @author Michal Migurski <mike-json@teczno.com>
* @author Matt Knapp <mdknapp[at]gmail[dot]com>
* @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
* @copyright 2005 Michal Migurski
* @version CVS: $Id: Test-JSON.php,v 1.28 2006/06/28 05:54:17 migurski Exp $
* @license http://www.opensource.org/licenses/bsd-license.php
* @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
*/
 
error_reporting(E_ALL);
 
require_once 'PHPUnit.php';
require_once 'JSON.php';
 
class Services_JSON_EncDec_TestCase extends PHPUnit_TestCase {
 
function Services_JSON_EncDec_TestCase($name) {
$this->PHPUnit_TestCase($name);
}
 
function setUp() {
$this->json = new Services_JSON();
 
$obj = new stdClass();
$obj->a_string = '"he":llo}:{world';
$obj->an_array = array(1, 2, 3);
$obj->obj = new stdClass();
$obj->obj->a_number = 123;
 
$this->obj = $obj;
$this->obj_j = '{"a_string":"\"he\":llo}:{world","an_array":[1,2,3],"obj":{"a_number":123}}';
$this->obj_d = 'object with properties, nested object and arrays';
 
$this->arr = array(null, true, array(1, 2, 3), "hello\"],[world!");
$this->arr_j = '[null,true,[1,2,3],"hello\"],[world!"]';
$this->arr_d = 'array with elements and nested arrays';
 
$this->str1 = 'hello world';
$this->str1_j = '"hello world"';
$this->str1_j_ = "'hello world'";
$this->str1_d = 'hello world';
$this->str1_d_ = 'hello world, double quotes';
 
$this->str2 = "hello\t\"world\"";
$this->str2_j = '"hello\\t\\"world\\""';
$this->str2_d = 'hello world, with tab, double-quotes';
 
$this->str3 = "\\\r\n\t\"/";
$this->str3_j = '"\\\\\\r\\n\\t\\"\\/"';
$this->str3_d = 'backslash, return, newline, tab, double-quote';
 
$this->str4 = 'héllö wørłd';
$this->str4_j = '"h\u00e9ll\u00f6 w\u00f8r\u0142d"';
$this->str4_j_ = '"héllö wørłd"';
$this->str4_d = 'hello world, with unicode';
}
 
function test_to_JSON()
{
$this->assertEquals('null', $this->json->encode(null), 'type case: null');
$this->assertEquals('true', $this->json->encode(true), 'type case: boolean true');
$this->assertEquals('false', $this->json->encode(false), 'type case: boolean false');
 
$this->assertEquals('1', $this->json->encode(1), 'numeric case: 1');
$this->assertEquals('-1', $this->json->encode(-1), 'numeric case: -1');
$this->assertEquals('1.000000', $this->json->encode(1.0), 'numeric case: 1.0');
$this->assertEquals('1.100000', $this->json->encode(1.1), 'numeric case: 1.1');
 
$this->assertEquals($this->str1_j, $this->json->encode($this->str1), "string case: {$this->str1_d}");
$this->assertEquals($this->str2_j, $this->json->encode($this->str2), "string case: {$this->str2_d}");
$this->assertEquals($this->str3_j, $this->json->encode($this->str3), "string case: {$this->str3_d}");
$this->assertEquals($this->str4_j, $this->json->encode($this->str4), "string case: {$this->str4_d}");
 
$this->assertEquals($this->arr_j, $this->json->encode($this->arr), "array case: {$this->arr_d}");
$this->assertEquals($this->obj_j, $this->json->encode($this->obj), "object case: {$this->obj_d}");
}
 
function test_from_JSON()
{
$this->assertEquals(null, $this->json->decode('null'), 'type case: null');
$this->assertEquals(true, $this->json->decode('true'), 'type case: boolean true');
$this->assertEquals(false, $this->json->decode('false'), 'type case: boolean false');
 
$this->assertEquals(1, $this->json->decode('1'), 'numeric case: 1');
$this->assertEquals(-1, $this->json->decode('-1'), 'numeric case: -1');
$this->assertEquals(1.0, $this->json->decode('1.0'), 'numeric case: 1.0');
$this->assertEquals(1.1, $this->json->decode('1.1'), 'numeric case: 1.1');
 
$this->assertEquals(11.0, $this->json->decode('1.1e1'), 'numeric case: 1.1e1');
$this->assertEquals(11.0, $this->json->decode('1.10e+1'), 'numeric case: 1.10e+1');
$this->assertEquals(0.11, $this->json->decode('1.1e-1'), 'numeric case: 1.1e-1');
$this->assertEquals(-0.11, $this->json->decode('-1.1e-1'), 'numeric case: -1.1e-1');
 
$this->assertEquals($this->str1, $this->json->decode($this->str1_j), "string case: {$this->str1_d}");
$this->assertEquals($this->str1, $this->json->decode($this->str1_j_), "string case: {$this->str1_d_}");
$this->assertEquals($this->str2, $this->json->decode($this->str2_j), "string case: {$this->str2_d}");
$this->assertEquals($this->str3, $this->json->decode($this->str3_j), "string case: {$this->str3_d}");
$this->assertEquals($this->str4, $this->json->decode($this->str4_j), "string case: {$this->str4_d}");
$this->assertEquals($this->str4, $this->json->decode($this->str4_j_), "string case: {$this->str4_d}");
 
$this->assertEquals($this->arr, $this->json->decode($this->arr_j), "array case: {$this->arr_d}");
$this->assertEquals($this->obj, $this->json->decode($this->obj_j), "object case: {$this->obj_d}");
}
 
function test_to_then_from_JSON()
{
$this->assertEquals(null, $this->json->decode($this->json->encode(null)), 'type case: null');
$this->assertEquals(true, $this->json->decode($this->json->encode(true)), 'type case: boolean true');
$this->assertEquals(false, $this->json->decode($this->json->encode(false)), 'type case: boolean false');
 
$this->assertEquals(1, $this->json->decode($this->json->encode(1)), 'numeric case: 1');
$this->assertEquals(-1, $this->json->decode($this->json->encode(-1)), 'numeric case: -1');
$this->assertEquals(1.0, $this->json->decode($this->json->encode(1.0)), 'numeric case: 1.0');
$this->assertEquals(1.1, $this->json->decode($this->json->encode(1.1)), 'numeric case: 1.1');
 
$this->assertEquals($this->str1, $this->json->decode($this->json->encode($this->str1)), "string case: {$this->str1_d}");
$this->assertEquals($this->str2, $this->json->decode($this->json->encode($this->str2)), "string case: {$this->str2_d}");
$this->assertEquals($this->str3, $this->json->decode($this->json->encode($this->str3)), "string case: {$this->str3_d}");
$this->assertEquals($this->str4, $this->json->decode($this->json->encode($this->str4)), "string case: {$this->str4_d}");
 
$this->assertEquals($this->arr, $this->json->decode($this->json->encode($this->arr)), "array case: {$this->arr_d}");
$this->assertEquals($this->obj, $this->json->decode($this->json->encode($this->obj)), "object case: {$this->obj_d}");
}
 
function test_from_then_to_JSON()
{
$this->assertEquals('null', $this->json->encode($this->json->decode('null')), 'type case: null');
$this->assertEquals('true', $this->json->encode($this->json->decode('true')), 'type case: boolean true');
$this->assertEquals('false', $this->json->encode($this->json->decode('false')), 'type case: boolean false');
 
$this->assertEquals('1', $this->json->encode($this->json->decode('1')), 'numeric case: 1');
$this->assertEquals('-1', $this->json->encode($this->json->decode('-1')), 'numeric case: -1');
$this->assertEquals('1.0', $this->json->encode($this->json->decode('1.0')), 'numeric case: 1.0');
$this->assertEquals('1.1', $this->json->encode($this->json->decode('1.1')), 'numeric case: 1.1');
 
$this->assertEquals($this->str1_j, $this->json->encode($this->json->decode($this->str1_j)), "string case: {$this->str1_d}");
$this->assertEquals($this->str2_j, $this->json->encode($this->json->decode($this->str2_j)), "string case: {$this->str2_d}");
$this->assertEquals($this->str3_j, $this->json->encode($this->json->decode($this->str3_j)), "string case: {$this->str3_d}");
$this->assertEquals($this->str4_j, $this->json->encode($this->json->decode($this->str4_j)), "string case: {$this->str4_d}");
$this->assertEquals($this->str4_j, $this->json->encode($this->json->decode($this->str4_j_)), "string case: {$this->str4_d}");
 
$this->assertEquals($this->arr_j, $this->json->encode($this->json->decode($this->arr_j)), "array case: {$this->arr_d}");
$this->assertEquals($this->obj_j, $this->json->encode($this->json->decode($this->obj_j)), "object case: {$this->obj_d}");
}
}
 
class Services_JSON_AssocArray_TestCase extends PHPUnit_TestCase {
 
function Services_JSON_AssocArray_TestCase($name) {
$this->PHPUnit_TestCase($name);
}
 
function setUp() {
$this->json_l = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
$this->json_s = new Services_JSON();
 
$this->arr = array('car1'=> array('color'=> 'tan', 'model' => 'sedan'),
'car2' => array('color' => 'red', 'model' => 'sports'));
$this->arr_jo = '{"car1":{"color":"tan","model":"sedan"},"car2":{"color":"red","model":"sports"}}';
$this->arr_d = 'associative array with nested associative arrays';
 
$this->arn = array(0=> array(0=> 'tan\\', 'model\\' => 'sedan'), 1 => array(0 => 'red', 'model' => 'sports'));
$this->arn_ja = '[{"0":"tan\\\\","model\\\\":"sedan"},{"0":"red","model":"sports"}]';
$this->arn_d = 'associative array with nested associative arrays, and some numeric keys thrown in';
 
$this->arrs = array (1 => 'one', 2 => 'two', 5 => 'five');
$this->arrs_jo = '{"1":"one","2":"two","5":"five"}';
$this->arrs_d = 'associative array numeric keys which are not fully populated in a range of 0 to length-1';
}
 
function test_type()
{
$this->assertEquals('array', gettype($this->json_l->decode($this->arn_ja)), "loose type should be array");
$this->assertEquals('array', gettype($this->json_s->decode($this->arn_ja)), "strict type should be array");
}
 
function test_to_JSON()
{
// both strict and loose JSON should result in an object
$this->assertEquals($this->arr_jo, $this->json_l->encode($this->arr), "array case - loose: {$this->arr_d}");
$this->assertEquals($this->arr_jo, $this->json_s->encode($this->arr), "array case - strict: {$this->arr_d}");
 
// ...unless the input array has some numeric indeces, in which case the behavior is to degrade to a regular array
$this->assertEquals($this->arn_ja, $this->json_s->encode($this->arn), "array case - strict: {$this->arn_d}");
 
// Test a sparsely populated numerically indexed associative array
$this->assertEquals($this->arrs_jo, $this->json_l->encode($this->arrs), "sparse numeric assoc array: {$this->arrs_d}");
}
 
function test_to_then_from_JSON()
{
// these tests motivated by a bug in which strings that end
// with backslashes followed by quotes were incorrectly decoded.
foreach(array('\\"', '\\\\"', '\\"\\"', '\\""\\""', '\\\\"\\\\"') as $v) {
$this->assertEquals(array($v), $this->json_l->decode($this->json_l->encode(array($v))));
$this->assertEquals(array('a' => $v), $this->json_l->decode($this->json_l->encode(array('a' => $v))));
}
}
}
 
class Services_JSON_NestedArray_TestCase extends PHPUnit_TestCase {
 
function Services_JSON_NestedArray_TestCase($name) {
$this->PHPUnit_TestCase($name);
}
 
function setUp() {
$this->json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
 
$this->str1 = '[{"this":"that"}]';
$this->arr1 = array(array('this' => 'that'));
 
$this->str2 = '{"this":["that"]}';
$this->arr2 = array('this' => array('that'));
 
$this->str3 = '{"params":[{"foo":["1"],"bar":"1"}]}';
$this->arr3 = array('params' => array(array('foo' => array('1'), 'bar' => '1')));
 
$this->str4 = '{"0": {"foo": "bar", "baz": "winkle"}}';
$this->arr4 = array('0' => array('foo' => 'bar', 'baz' => 'winkle'));
 
$this->str5 = '{"params":[{"options": {"old": [ ], "new": {"0": {"elements": {"old": [], "new": {"0": {"elementName": "aa", "isDefault": false, "elementRank": "0", "priceAdjust": "0", "partNumber": ""}}}, "optionName": "aa", "isRequired": false, "optionDesc": null}}}}]}';
$this->arr5 = array (
'params' => array (
0 => array (
'options' =>
array (
'old' => array(),
'new' => array (
0 => array (
'elements' => array (
'old' => array(),
'new' => array (
0 => array (
'elementName' => 'aa',
'isDefault' => false,
'elementRank' => '0',
'priceAdjust' => '0',
'partNumber' => '',
),
),
),
'optionName' => 'aa',
'isRequired' => false,
'optionDesc' => NULL,
),
),
),
),
),
);
}
 
function test_type()
{
$this->assertEquals('array', gettype($this->json->decode($this->str1)), "loose type should be array");
$this->assertEquals('array', gettype($this->json->decode($this->str2)), "loose type should be array");
$this->assertEquals('array', gettype($this->json->decode($this->str3)), "loose type should be array");
}
 
function test_from_JSON()
{
$this->assertEquals($this->arr1, $this->json->decode($this->str1), "simple compactly-nested array");
$this->assertEquals($this->arr2, $this->json->decode($this->str2), "simple compactly-nested array");
$this->assertEquals($this->arr3, $this->json->decode($this->str3), "complex compactly nested array");
$this->assertEquals($this->arr4, $this->json->decode($this->str4), "complex compactly nested array");
$this->assertEquals($this->arr5, $this->json->decode($this->str5), "super complex compactly nested array");
}
 
function _test_from_JSON()
{
$super = '{"params":[{"options": {"old": {}, "new": {"0": {"elements": {"old": {}, "new": {"0": {"elementName": "aa", "isDefault": false, "elementRank": "0", "priceAdjust": "0", "partNumber": ""}}}, "optionName": "aa", "isRequired": false, "optionDesc": ""}}}}]}';
print("trying {$super}...\n");
print var_export($this->json->decode($super));
}
}
 
class Services_JSON_Object_TestCase extends PHPUnit_TestCase {
 
function Services_JSON_Object_TestCase($name) {
$this->PHPUnit_TestCase($name);
}
 
function setUp() {
$this->json_l = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
$this->json_s = new Services_JSON();
 
$this->obj_j = '{"a_string":"\"he\":llo}:{world","an_array":[1,2,3],"obj":{"a_number":123}}';
 
$this->obj1->car1->color = 'tan';
$this->obj1->car1->model = 'sedan';
$this->obj1->car2->color = 'red';
$this->obj1->car2->model = 'sports';
$this->obj1_j = '{"car1":{"color":"tan","model":"sedan"},"car2":{"color":"red","model":"sports"}}';
$this->obj1_d = 'Object with nested objects';
}
 
function test_type()
{
$this->assertEquals('object', gettype($this->json_s->decode($this->obj_j)), "checking whether decoded type is object");
$this->assertEquals('array', gettype($this->json_l->decode($this->obj_j)), "checking whether decoded type is array");
}
 
function test_to_JSON()
{
$this->assertEquals($this->obj1_j, $this->json_s->encode($this->obj1), "object - strict: {$this->obj1_d}");
$this->assertEquals($this->obj1_j, $this->json_l->encode($this->obj1), "object - loose: {$this->obj1_d}");
}
 
function test_from_then_to_JSON()
{
$this->assertEquals($this->obj_j, $this->json_s->encode($this->json_s->decode($this->obj_j)), "object case");
$this->assertEquals($this->obj_j, $this->json_l->encode($this->json_l->decode($this->obj_j)), "array case");
}
}
 
class Services_JSON_Spaces_Comments_TestCase extends PHPUnit_TestCase {
 
function Services_JSON_Spaces_Comments_TestCase($name) {
$this->PHPUnit_TestCase($name);
}
 
function setUp() {
$this->json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
 
$this->obj_j = '{"a_string":"\"he\":llo}:{world","an_array":[1,2,3],"obj":{"a_number":123}}';
 
$this->obj_js = '{"a_string": "\"he\":llo}:{world",
"an_array":[1, 2, 3],
"obj": {"a_number":123}}';
 
$this->obj_jc1 = '{"a_string": "\"he\":llo}:{world",
// here is a comment, hoorah
"an_array":[1, 2, 3],
"obj": {"a_number":123}}';
 
$this->obj_jc2 = '/* this here is the sneetch */ "the sneetch"
// this has been the sneetch.';
 
$this->obj_jc3 = '{"a_string": "\"he\":llo}:{world",
/* here is a comment, hoorah */
"an_array":[1, 2, 3 /* and here is another */],
"obj": {"a_number":123}}';
 
$this->obj_jc4 = '{\'a_string\': "\"he\":llo}:{world",
/* here is a comment, hoorah */
\'an_array\':[1, 2, 3 /* and here is another */],
"obj": {"a_number":123}}';
}
 
function test_spaces()
{
$this->assertEquals($this->json->decode($this->obj_j), $this->json->decode($this->obj_js), "checking whether notation with spaces works");
}
 
function test_comments()
{
$this->assertEquals($this->json->decode($this->obj_j), $this->json->decode($this->obj_jc1), "checking whether notation with single line comments works");
$this->assertEquals('the sneetch', $this->json->decode($this->obj_jc2), "checking whether notation with multiline comments works");
$this->assertEquals($this->json->decode($this->obj_j), $this->json->decode($this->obj_jc3), "checking whether notation with multiline comments works");
$this->assertEquals($this->json->decode($this->obj_j), $this->json->decode($this->obj_jc4), "checking whether notation with single-quotes and multiline comments works");
}
}
 
class Services_JSON_Empties_TestCase extends PHPUnit_TestCase {
 
function Services_JSON_Empties_TestCase($name) {
$this->PHPUnit_TestCase($name);
}
 
function setUp() {
$this->json_l = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
$this->json_s = new Services_JSON();
 
$this->obj0_j = '{}';
$this->arr0_j = '[]';
 
$this->obj1_j = '{ }';
$this->arr1_j = '[ ]';
 
$this->obj2_j = '{ /* comment inside */ }';
$this->arr2_j = '[ /* comment inside */ ]';
}
 
function test_type()
{
$this->assertEquals('array', gettype($this->json_l->decode($this->arr0_j)), "should be array");
$this->assertEquals('object', gettype($this->json_s->decode($this->obj0_j)), "should be object");
 
$this->assertEquals(0, count($this->json_l->decode($this->arr0_j)), "should be empty array");
$this->assertEquals(0, count(get_object_vars($this->json_s->decode($this->obj0_j))), "should be empty object");
 
$this->assertEquals('array', gettype($this->json_l->decode($this->arr1_j)), "should be array, even with space");
$this->assertEquals('object', gettype($this->json_s->decode($this->obj1_j)), "should be object, even with space");
 
$this->assertEquals(0, count($this->json_l->decode($this->arr1_j)), "should be empty array, even with space");
$this->assertEquals(0, count(get_object_vars($this->json_s->decode($this->obj1_j))), "should be empty object, even with space");
 
$this->assertEquals('array', gettype($this->json_l->decode($this->arr2_j)), "should be array, despite comment");
$this->assertEquals('object', gettype($this->json_s->decode($this->obj2_j)), "should be object, despite comment");
 
$this->assertEquals(0, count($this->json_l->decode($this->arr2_j)), "should be empty array, despite comment");
$this->assertEquals(0, count(get_object_vars($this->json_s->decode($this->obj2_j))), "should be empty object, despite commentt");
}
}
 
class Services_JSON_UnquotedKeys_TestCase extends PHPUnit_TestCase {
 
function Services_JSON_UnquotedKeys_TestCase($name) {
$this->PHPUnit_TestCase($name);
}
 
function setUp() {
$this->json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
 
$this->arn = array(0=> array(0=> 'tan', 'model' => 'sedan'), 1 => array(0 => 'red', 'model' => 'sports'));
$this->arn_ja = '[{0:"tan","model":"sedan"},{"0":"red",model:"sports"}]';
$this->arn_d = 'associative array with unquoted keys, nested associative arrays, and some numeric keys thrown in';
 
$this->arrs = array (1 => 'one', 2 => 'two', 5 => 'fi"ve');
$this->arrs_jo = '{"1":"one",2:"two","5":\'fi"ve\'}';
$this->arrs_d = 'associative array with unquoted keys, single-quoted values, numeric keys which are not fully populated in a range of 0 to length-1';
}
 
function test_from_JSON()
{
// ...unless the input array has some numeric indeces, in which case the behavior is to degrade to a regular array
$this->assertEquals($this->arn, $this->json->decode($this->arn_ja), "array case - strict: {$this->arn_d}");
 
// Test a sparsely populated numerically indexed associative array
$this->assertEquals($this->arrs, $this->json->decode($this->arrs_jo), "sparse numeric assoc array: {$this->arrs_d}");
}
}
 
class Services_JSON_ErrorSuppression_TestCase extends PHPUnit_TestCase {
 
function Services_JSON_ErrorSuppression_TestCase($name) {
$this->PHPUnit_TestCase($name);
}
 
function setUp() {
$this->json = new Services_JSON();
$this->json_ = new Services_JSON(SERVICES_JSON_SUPPRESS_ERRORS);
 
$this->res = tmpfile();
$this->res_j_ = 'null';
$this->res_d = 'naked resource';
 
$this->arr = array('a', 1, tmpfile());
$this->arr_j_ = '["a",1,null]';
$this->arr_d = 'array with string, number and resource';
 
$obj = new stdClass();
$obj->a_string = '"he":llo}:{world';
$obj->an_array = array(1, 2, 3);
$obj->resource = tmpfile();
 
$this->obj = $obj;
$this->obj_j_ = '{"a_string":"\"he\":llo}:{world","an_array":[1,2,3],"resource":null}';
$this->obj_d = 'object with properties, array, and nested resource';
}
 
function test_to_JSON()
{
$this->assertTrue(Services_JSON::isError($this->json->encode($this->res)), "resource case: {$this->res_d}");
$this->assertTrue(Services_JSON::isError($this->json->encode($this->arr)), "array case: {$this->arr_d}");
$this->assertTrue(Services_JSON::isError($this->json->encode($this->obj)), "object case: {$this->obj_d}");
}
 
function test_to_JSON_suppressed()
{
$this->assertEquals($this->res_j_, $this->json_->encode($this->res), "resource case: {$this->res_d}");
$this->assertEquals($this->arr_j_, $this->json_->encode($this->arr), "array case: {$this->arr_d}");
$this->assertEquals($this->obj_j_, $this->json_->encode($this->obj), "object case: {$this->obj_d}");
}
}
 
$suite = new PHPUnit_TestSuite('Services_JSON_EncDec_TestCase');
$result = PHPUnit::run($suite);
echo $result->toString();
 
$suite = new PHPUnit_TestSuite('Services_JSON_AssocArray_TestCase');
$result = PHPUnit::run($suite);
echo $result->toString();
 
$suite = new PHPUnit_TestSuite('Services_JSON_NestedArray_TestCase');
$result = PHPUnit::run($suite);
echo $result->toString();
 
$suite = new PHPUnit_TestSuite('Services_JSON_Object_TestCase');
$result = PHPUnit::run($suite);
echo $result->toString();
 
$suite = new PHPUnit_TestSuite('Services_JSON_Spaces_Comments_TestCase');
$result = PHPUnit::run($suite);
echo $result->toString();
 
$suite = new PHPUnit_TestSuite('Services_JSON_Empties_TestCase');
$result = PHPUnit::run($suite);
echo $result->toString();
 
$suite = new PHPUnit_TestSuite('Services_JSON_UnquotedKeys_TestCase');
$result = PHPUnit::run($suite);
echo $result->toString();
 
$suite = new PHPUnit_TestSuite('Services_JSON_ErrorSuppression_TestCase');
$result = PHPUnit::run($suite);
echo $result->toString();
 
?>
/trunk/dependencies/jsonwrapper/JSON/doc/Services_JSON/Services_JSON.html
0,0 → 1,210
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title>Docs For Class Services_JSON</title>
<link rel="stylesheet" href="../media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<div class="page-body">
<h2 class="class-name">Class Services_JSON</h2>
 
<a name="sec-description"></a>
<div class="info-box">
<div class="info-box-title">Description</div>
<div class="nav-bar">
<span class="disabled">Description</span> |
<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
</div>
<div class="info-box-body">
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Converts to and from JSON format.</p>
<p class="description"><p>Brief example of use:</p><p><pre><code><pre><br />1 <span class="src-comm">// create a new instance of Services_JSON</span><br />2 <span class="src-var">$json</span> = <span class="src-key">new</span> <a href="../Services_JSON/Services_JSON.html#methodServices_JSON">Services_JSON</a><span class="src-sym">(</span><span class="src-sym">)</span>;<br />3 <br />4 <span class="src-comm">// convert a complexe value to JSON notation, and send it to the browser</span><br />5 <span class="src-var">$value</span> = <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'foo'</span><span class="src-sym">,</span> <span class="src-str">'bar'</span><span class="src-sym">,</span> <span class="src-key">array</span><span class="src-sym">(</span><span class="src-num">1</span><span class="src-sym">,</span> <span class="src-num">2</span><span class="src-sym">,</span> <span class="src-str">'baz'</span><span class="src-sym">)</span><span class="src-sym">,</span> <span class="src-key">array</span><span class="src-sym">(</span><span class="src-num">3</span><span class="src-sym">,</span> <span class="src-key">array</span><span class="src-sym">(</span><span class="src-num">4</span><span class="src-sym">)</span><span class="src-sym">)</span><span class="src-sym">)</span>;<br />6 <span class="src-var">$output</span> = <span class="src-var">$json</span><span class="src-sym">-&gt;</span><a href="../Services_JSON/Services_JSON.html#methodencode">encode</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">)</span>;<br />7 <br />8 print<span class="src-sym">(</span><span class="src-var">$output</span><span class="src-sym">)</span>;<br />9 <span class="src-comm">// prints: [&quot;foo&quot;,&quot;bar&quot;,[1,2,&quot;baz&quot;],[3,[4]]]</span><br />10 <br />11 <span class="src-comm">// accept incoming POST data, assumed to be in JSON notation</span><br />12 <span class="src-var">$input</span> = <a href="http://www.php.net/file_get_contents">file_get_contents</a><span class="src-sym">(</span><span class="src-str">'php://input'</span><span class="src-sym">,</span> <span class="src-num">1000000</span><span class="src-sym">)</span>;<br />13 <span class="src-var">$value</span> = <span class="src-var">$json</span><span class="src-sym">-&gt;</span><a href="../Services_JSON/Services_JSON.html#methoddecode">decode</a><span class="src-sym">(</span><span class="src-var">$input</span><span class="src-sym">)</span>;</pre></code></pre></p></p>
<p class="notes">
Located in <a class="field" href="_JSON_php.html">/JSON.php</a> (line <span class="field">115</span>)
</p>
<pre></pre>
</div>
</div>
 
 
 
<a name="sec-method-summary"></a>
<div class="info-box">
<div class="info-box-title">Method Summary</span></div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
</div>
<div class="info-box-body">
<div class="method-summary">
<div class="method-definition">
<span class="method-result">Services_JSON</span>
<a href="#Services_JSON" title="details" class="method-name">Services_JSON</a>
(<span class="var-type">int</span>&nbsp;<span class="var-name">$use</span>)
</div>
<div class="method-definition">
<span class="method-result">mixed</span>
<a href="#decode" title="details" class="method-name">decode</a>
(<span class="var-type">string</span>&nbsp;<span class="var-name">$str</span>)
</div>
<div class="method-definition">
<span class="method-result">mixed</span>
<a href="#encode" title="details" class="method-name">encode</a>
(<span class="var-type">mixed</span>&nbsp;<span class="var-name">$var</span>)
</div>
<div class="method-definition">
<span class="method-result">void</span>
<a href="#isError" title="details" class="method-name">isError</a>
(<span class="var-type">mixed</span>&nbsp;<span class="var-name">$data</span>, [<span class="var-type">mixed</span>&nbsp;<span class="var-name">$code</span> = <span class="var-default">null</span>])
</div>
</div>
</div>
</div>
 
<a name="sec-methods"></a>
<div class="info-box">
<div class="info-box-title">Methods</div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
</div>
<div class="info-box-body">
<A NAME='method_detail'></A>
<a name="methodServices_JSON" id="Services_JSON"><!-- --></a>
<div class="evenrow">
<div class="method-header">
<span class="method-title">Constructor Services_JSON</span> (line <span class="line-number">133</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">constructs a new JSON instance</p>
<div class="method-signature">
<span class="method-result">Services_JSON</span>
<span class="method-name">
Services_JSON
</span>
(<span class="var-type">int</span>&nbsp;<span class="var-name">$use</span>)
</div>
<ul class="parameters">
<li>
<span class="var-type">int</span>
<span class="var-name">$use</span><span class="var-description">: <p>object behavior flags; combine with boolean-OR</p><p>possible values: <ul><li>SERVICES_JSON_LOOSE_TYPE: loose typing.
&quot;{...}&quot; syntax creates associative arrays
instead of objects in decode().</li><li>SERVICES_JSON_SUPPRESS_ERRORS: error suppression.
Values which can't be encoded (e.g. resources)
appear as NULL instead of throwing errors.
By default, a deeply-nested resource will
bubble up with an error, so all return values
from encode() should be checked with isError()</li></ul></p></span> </li>
</ul>
</div>
<a name="methoddecode" id="decode"><!-- --></a>
<div class="oddrow">
<div class="method-header">
<span class="method-title">decode</span> (line <span class="line-number">484</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">decodes a JSON string into appropriate variable</p>
<ul class="tags">
<li><span class="field">return:</span> number, boolean, string, array, or object corresponding to given JSON input string. See argument 1 to Services_JSON() above for object-output behavior. Note that decode() always returns strings in ASCII or UTF-8 format!</li>
<li><span class="field">access:</span> public</li>
</ul>
<div class="method-signature">
<span class="method-result">mixed</span>
<span class="method-name">
decode
</span>
(<span class="var-type">string</span>&nbsp;<span class="var-name">$str</span>)
</div>
<ul class="parameters">
<li>
<span class="var-type">string</span>
<span class="var-name">$str</span><span class="var-description">: JSON-formatted string</span> </li>
</ul>
</div>
<a name="methodencode" id="encode"><!-- --></a>
<div class="evenrow">
<div class="method-header">
<span class="method-title">encode</span> (line <span class="line-number">237</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">encodes an arbitrary variable into JSON format</p>
<ul class="tags">
<li><span class="field">return:</span> JSON string representation of input var or an error if a problem occurs</li>
<li><span class="field">access:</span> public</li>
</ul>
<div class="method-signature">
<span class="method-result">mixed</span>
<span class="method-name">
encode
</span>
(<span class="var-type">mixed</span>&nbsp;<span class="var-name">$var</span>)
</div>
<ul class="parameters">
<li>
<span class="var-type">mixed</span>
<span class="var-name">$var</span><span class="var-description">: any number, boolean, string, array, or object to be encoded. see argument 1 to Services_JSON() above for array-parsing behavior. if var is a strng, note that encode() always expects it to be in ASCII or UTF-8 format!</span> </li>
</ul>
</div>
<a name="methodisError" id="isError"><!-- --></a>
<div class="oddrow">
<div class="method-header">
<span class="method-title">isError</span> (line <span class="line-number">766</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<ul class="tags">
<li><span class="field">todo:</span> Ultimately, this should just call PEAR::isError()</li>
</ul>
<div class="method-signature">
<span class="method-result">void</span>
<span class="method-name">
isError
</span>
(<span class="var-type">mixed</span>&nbsp;<span class="var-name">$data</span>, [<span class="var-type">mixed</span>&nbsp;<span class="var-name">$code</span> = <span class="var-default">null</span>])
</div>
</div>
</div>
</div>
<p class="notes" id="credit">
Documentation generated on Tue, 27 Jun 2006 22:54:25 -0700 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
</p>
</div></body>
</html>
Property changes:
Added: svn:mime-type
+text/html
\ No newline at end of property
/trunk/dependencies/jsonwrapper/JSON/doc/Services_JSON/Services_JSON_AssocArray_TestCase.html
0,0 → 1,200
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title>Docs For Class Services_JSON_AssocArray_TestCase</title>
<link rel="stylesheet" href="../media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<div class="page-body">
<h2 class="class-name">Class Services_JSON_AssocArray_TestCase</h2>
 
<a name="sec-description"></a>
<div class="info-box">
<div class="info-box-title">Description</div>
<div class="nav-bar">
<span class="disabled">Description</span> |
<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
</div>
<div class="info-box-body">
<!-- ========== Info from phpDoc block ========= -->
<p class="notes">
Located in <a class="field" href="_Test-JSON_php.html">/Test-JSON.php</a> (line <span class="field">157</span>)
</p>
<pre>PHPUnit_TestCase
|
--Services_JSON_AssocArray_TestCase</pre>
</div>
</div>
 
 
 
<a name="sec-method-summary"></a>
<div class="info-box">
<div class="info-box-title">Method Summary</span></div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
</div>
<div class="info-box-body">
<div class="method-summary">
<div class="method-definition">
<span class="method-result">Services_JSON_AssocArray_TestCase</span>
<a href="#Services_JSON_AssocArray_TestCase" title="details" class="method-name">Services_JSON_AssocArray_TestCase</a>
(<span class="var-type">mixed</span>&nbsp;<span class="var-name">$name</span>)
</div>
<div class="method-definition">
<span class="method-result">void</span>
<a href="#setUp" title="details" class="method-name">setUp</a>
()
</div>
<div class="method-definition">
<span class="method-result">void</span>
<a href="#test_to_JSON" title="details" class="method-name">test_to_JSON</a>
()
</div>
<div class="method-definition">
<span class="method-result">void</span>
<a href="#test_to_then_from_JSON" title="details" class="method-name">test_to_then_from_JSON</a>
()
</div>
<div class="method-definition">
<span class="method-result">void</span>
<a href="#test_type" title="details" class="method-name">test_type</a>
()
</div>
</div>
</div>
</div>
 
<a name="sec-methods"></a>
<div class="info-box">
<div class="info-box-title">Methods</div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
</div>
<div class="info-box-body">
<A NAME='method_detail'></A>
<a name="methodServices_JSON_AssocArray_TestCase" id="Services_JSON_AssocArray_TestCase"><!-- --></a>
<div class="evenrow">
<div class="method-header">
<span class="method-title">Constructor Services_JSON_AssocArray_TestCase</span> (line <span class="line-number">159</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<div class="method-signature">
<span class="method-result">Services_JSON_AssocArray_TestCase</span>
<span class="method-name">
Services_JSON_AssocArray_TestCase
</span>
(<span class="var-type">mixed</span>&nbsp;<span class="var-name">$name</span>)
</div>
</div>
<a name="methodsetUp" id="setUp"><!-- --></a>
<div class="oddrow">
<div class="method-header">
<span class="method-title">setUp</span> (line <span class="line-number">163</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<div class="method-signature">
<span class="method-result">void</span>
<span class="method-name">
setUp
</span>
()
</div>
</div>
<a name="methodtest_to_JSON" id="test_to_JSON"><!-- --></a>
<div class="evenrow">
<div class="method-header">
<span class="method-title">test_to_JSON</span> (line <span class="line-number">187</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<div class="method-signature">
<span class="method-result">void</span>
<span class="method-name">
test_to_JSON
</span>
()
</div>
</div>
<a name="methodtest_to_then_from_JSON" id="test_to_then_from_JSON"><!-- --></a>
<div class="oddrow">
<div class="method-header">
<span class="method-title">test_to_then_from_JSON</span> (line <span class="line-number">200</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<div class="method-signature">
<span class="method-result">void</span>
<span class="method-name">
test_to_then_from_JSON
</span>
()
</div>
</div>
<a name="methodtest_type" id="test_type"><!-- --></a>
<div class="evenrow">
<div class="method-header">
<span class="method-title">test_type</span> (line <span class="line-number">181</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<div class="method-signature">
<span class="method-result">void</span>
<span class="method-name">
test_type
</span>
()
</div>
</div>
</div>
</div>
<p class="notes" id="credit">
Documentation generated on Tue, 27 Jun 2006 22:54:26 -0700 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
</p>
</div></body>
</html>
Property changes:
Added: svn:mime-type
+text/html
\ No newline at end of property
/trunk/dependencies/jsonwrapper/JSON/doc/Services_JSON/Services_JSON_Empties_TestCase.html
0,0 → 1,148
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title>Docs For Class Services_JSON_Empties_TestCase</title>
<link rel="stylesheet" href="../media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<div class="page-body">
<h2 class="class-name">Class Services_JSON_Empties_TestCase</h2>
 
<a name="sec-description"></a>
<div class="info-box">
<div class="info-box-title">Description</div>
<div class="nav-bar">
<span class="disabled">Description</span> |
<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
</div>
<div class="info-box-body">
<!-- ========== Info from phpDoc block ========= -->
<p class="notes">
Located in <a class="field" href="_Test-JSON_php.html">/Test-JSON.php</a> (line <span class="field">364</span>)
</p>
<pre>PHPUnit_TestCase
|
--Services_JSON_Empties_TestCase</pre>
</div>
</div>
 
 
 
<a name="sec-method-summary"></a>
<div class="info-box">
<div class="info-box-title">Method Summary</span></div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
</div>
<div class="info-box-body">
<div class="method-summary">
<div class="method-definition">
<span class="method-result">Services_JSON_Empties_TestCase</span>
<a href="#Services_JSON_Empties_TestCase" title="details" class="method-name">Services_JSON_Empties_TestCase</a>
(<span class="var-type">mixed</span>&nbsp;<span class="var-name">$name</span>)
</div>
<div class="method-definition">
<span class="method-result">void</span>
<a href="#setUp" title="details" class="method-name">setUp</a>
()
</div>
<div class="method-definition">
<span class="method-result">void</span>
<a href="#test_type" title="details" class="method-name">test_type</a>
()
</div>
</div>
</div>
</div>
 
<a name="sec-methods"></a>
<div class="info-box">
<div class="info-box-title">Methods</div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
</div>
<div class="info-box-body">
<A NAME='method_detail'></A>
<a name="methodServices_JSON_Empties_TestCase" id="Services_JSON_Empties_TestCase"><!-- --></a>
<div class="oddrow">
<div class="method-header">
<span class="method-title">Constructor Services_JSON_Empties_TestCase</span> (line <span class="line-number">366</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<div class="method-signature">
<span class="method-result">Services_JSON_Empties_TestCase</span>
<span class="method-name">
Services_JSON_Empties_TestCase
</span>
(<span class="var-type">mixed</span>&nbsp;<span class="var-name">$name</span>)
</div>
</div>
<a name="methodsetUp" id="setUp"><!-- --></a>
<div class="evenrow">
<div class="method-header">
<span class="method-title">setUp</span> (line <span class="line-number">370</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<div class="method-signature">
<span class="method-result">void</span>
<span class="method-name">
setUp
</span>
()
</div>
</div>
<a name="methodtest_type" id="test_type"><!-- --></a>
<div class="oddrow">
<div class="method-header">
<span class="method-title">test_type</span> (line <span class="line-number">384</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<div class="method-signature">
<span class="method-result">void</span>
<span class="method-name">
test_type
</span>
()
</div>
</div>
</div>
</div>
<p class="notes" id="credit">
Documentation generated on Tue, 27 Jun 2006 22:54:26 -0700 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
</p>
</div></body>
</html>
Property changes:
Added: svn:mime-type
+text/html
\ No newline at end of property
/trunk/dependencies/jsonwrapper/JSON/doc/Services_JSON/Services_JSON_EncDec_TestCase.html
0,0 → 1,226
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title>Docs For Class Services_JSON_EncDec_TestCase</title>
<link rel="stylesheet" href="../media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<div class="page-body">
<h2 class="class-name">Class Services_JSON_EncDec_TestCase</h2>
 
<a name="sec-description"></a>
<div class="info-box">
<div class="info-box-title">Description</div>
<div class="nav-bar">
<span class="disabled">Description</span> |
<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
</div>
<div class="info-box-body">
<!-- ========== Info from phpDoc block ========= -->
<p class="notes">
Located in <a class="field" href="_Test-JSON_php.html">/Test-JSON.php</a> (line <span class="field">25</span>)
</p>
<pre>PHPUnit_TestCase
|
--Services_JSON_EncDec_TestCase</pre>
</div>
</div>
 
 
 
<a name="sec-method-summary"></a>
<div class="info-box">
<div class="info-box-title">Method Summary</span></div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
</div>
<div class="info-box-body">
<div class="method-summary">
<div class="method-definition">
<span class="method-result">Services_JSON_EncDec_TestCase</span>
<a href="#Services_JSON_EncDec_TestCase" title="details" class="method-name">Services_JSON_EncDec_TestCase</a>
(<span class="var-type">mixed</span>&nbsp;<span class="var-name">$name</span>)
</div>
<div class="method-definition">
<span class="method-result">void</span>
<a href="#setUp" title="details" class="method-name">setUp</a>
()
</div>
<div class="method-definition">
<span class="method-result">void</span>
<a href="#test_from_JSON" title="details" class="method-name">test_from_JSON</a>
()
</div>
<div class="method-definition">
<span class="method-result">void</span>
<a href="#test_from_then_to_JSON" title="details" class="method-name">test_from_then_to_JSON</a>
()
</div>
<div class="method-definition">
<span class="method-result">void</span>
<a href="#test_to_JSON" title="details" class="method-name">test_to_JSON</a>
()
</div>
<div class="method-definition">
<span class="method-result">void</span>
<a href="#test_to_then_from_JSON" title="details" class="method-name">test_to_then_from_JSON</a>
()
</div>
</div>
</div>
</div>
 
<a name="sec-methods"></a>
<div class="info-box">
<div class="info-box-title">Methods</div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
</div>
<div class="info-box-body">
<A NAME='method_detail'></A>
<a name="methodServices_JSON_EncDec_TestCase" id="Services_JSON_EncDec_TestCase"><!-- --></a>
<div class="evenrow">
<div class="method-header">
<span class="method-title">Constructor Services_JSON_EncDec_TestCase</span> (line <span class="line-number">27</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<div class="method-signature">
<span class="method-result">Services_JSON_EncDec_TestCase</span>
<span class="method-name">
Services_JSON_EncDec_TestCase
</span>
(<span class="var-type">mixed</span>&nbsp;<span class="var-name">$name</span>)
</div>
</div>
<a name="methodsetUp" id="setUp"><!-- --></a>
<div class="oddrow">
<div class="method-header">
<span class="method-title">setUp</span> (line <span class="line-number">31</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<div class="method-signature">
<span class="method-result">void</span>
<span class="method-name">
setUp
</span>
()
</div>
</div>
<a name="methodtest_from_JSON" id="test_from_JSON"><!-- --></a>
<div class="evenrow">
<div class="method-header">
<span class="method-title">test_from_JSON</span> (line <span class="line-number">88</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<div class="method-signature">
<span class="method-result">void</span>
<span class="method-name">
test_from_JSON
</span>
()
</div>
</div>
<a name="methodtest_from_then_to_JSON" id="test_from_then_to_JSON"><!-- --></a>
<div class="oddrow">
<div class="method-header">
<span class="method-title">test_from_then_to_JSON</span> (line <span class="line-number">135</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<div class="method-signature">
<span class="method-result">void</span>
<span class="method-name">
test_from_then_to_JSON
</span>
()
</div>
</div>
<a name="methodtest_to_JSON" id="test_to_JSON"><!-- --></a>
<div class="evenrow">
<div class="method-header">
<span class="method-title">test_to_JSON</span> (line <span class="line-number">68</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<div class="method-signature">
<span class="method-result">void</span>
<span class="method-name">
test_to_JSON
</span>
()
</div>
</div>
<a name="methodtest_to_then_from_JSON" id="test_to_then_from_JSON"><!-- --></a>
<div class="oddrow">
<div class="method-header">
<span class="method-title">test_to_then_from_JSON</span> (line <span class="line-number">115</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<div class="method-signature">
<span class="method-result">void</span>
<span class="method-name">
test_to_then_from_JSON
</span>
()
</div>
</div>
</div>
</div>
<p class="notes" id="credit">
Documentation generated on Tue, 27 Jun 2006 22:54:26 -0700 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
</p>
</div></body>
</html>
Property changes:
Added: svn:mime-type
+text/html
\ No newline at end of property
/trunk/dependencies/jsonwrapper/JSON/doc/Services_JSON/Services_JSON_Error.html
0,0 → 1,96
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title>Docs For Class Services_JSON_Error</title>
<link rel="stylesheet" href="../media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<div class="page-body">
<h2 class="class-name">Class Services_JSON_Error</h2>
 
<a name="sec-description"></a>
<div class="info-box">
<div class="info-box-title">Description</div>
<div class="nav-bar">
<span class="disabled">Description</span> |
<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
</div>
<div class="info-box-body">
<!-- ========== Info from phpDoc block ========= -->
<p class="notes">
Located in <a class="field" href="_JSON_php.html">/JSON.php</a> (line <span class="field">781</span>)
</p>
<pre>PEAR_Error
|
--Services_JSON_Error</pre>
</div>
</div>
 
 
 
<a name="sec-method-summary"></a>
<div class="info-box">
<div class="info-box-title">Method Summary</span></div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
</div>
<div class="info-box-body">
<div class="method-summary">
<div class="method-definition">
<span class="method-result">Services_JSON_Error</span>
<a href="#Services_JSON_Error" title="details" class="method-name">Services_JSON_Error</a>
([<span class="var-type">mixed</span>&nbsp;<span class="var-name">$message</span> = <span class="var-default">'unknown error'</span>], [<span class="var-type">mixed</span>&nbsp;<span class="var-name">$code</span> = <span class="var-default">null</span>], [<span class="var-type">mixed</span>&nbsp;<span class="var-name">$mode</span> = <span class="var-default">null</span>], [<span class="var-type">mixed</span>&nbsp;<span class="var-name">$options</span> = <span class="var-default">null</span>], [<span class="var-type">mixed</span>&nbsp;<span class="var-name">$userinfo</span> = <span class="var-default">null</span>])
</div>
</div>
</div>
</div>
 
<a name="sec-methods"></a>
<div class="info-box">
<div class="info-box-title">Methods</div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
</div>
<div class="info-box-body">
<A NAME='method_detail'></A>
<a name="methodServices_JSON_Error" id="Services_JSON_Error"><!-- --></a>
<div class="evenrow">
<div class="method-header">
<span class="method-title">Constructor Services_JSON_Error</span> (line <span class="line-number">783</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<div class="method-signature">
<span class="method-result">Services_JSON_Error</span>
<span class="method-name">
Services_JSON_Error
</span>
([<span class="var-type">mixed</span>&nbsp;<span class="var-name">$message</span> = <span class="var-default">'unknown error'</span>], [<span class="var-type">mixed</span>&nbsp;<span class="var-name">$code</span> = <span class="var-default">null</span>], [<span class="var-type">mixed</span>&nbsp;<span class="var-name">$mode</span> = <span class="var-default">null</span>], [<span class="var-type">mixed</span>&nbsp;<span class="var-name">$options</span> = <span class="var-default">null</span>], [<span class="var-type">mixed</span>&nbsp;<span class="var-name">$userinfo</span> = <span class="var-default">null</span>])
</div>
</div>
</div>
</div>
<p class="notes" id="credit">
Documentation generated on Tue, 27 Jun 2006 22:54:26 -0700 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
</p>
</div></body>
</html>
Property changes:
Added: svn:mime-type
+text/html
\ No newline at end of property
/trunk/dependencies/jsonwrapper/JSON/doc/Services_JSON/Services_JSON_ErrorSuppression_TestCase.html
0,0 → 1,174
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title>Docs For Class Services_JSON_ErrorSuppression_TestCase</title>
<link rel="stylesheet" href="../media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<div class="page-body">
<h2 class="class-name">Class Services_JSON_ErrorSuppression_TestCase</h2>
 
<a name="sec-description"></a>
<div class="info-box">
<div class="info-box-title">Description</div>
<div class="nav-bar">
<span class="disabled">Description</span> |
<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
</div>
<div class="info-box-body">
<!-- ========== Info from phpDoc block ========= -->
<p class="notes">
Located in <a class="field" href="_Test-JSON_php.html">/Test-JSON.php</a> (line <span class="field">434</span>)
</p>
<pre>PHPUnit_TestCase
|
--Services_JSON_ErrorSuppression_TestCase</pre>
</div>
</div>
 
 
 
<a name="sec-method-summary"></a>
<div class="info-box">
<div class="info-box-title">Method Summary</span></div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
</div>
<div class="info-box-body">
<div class="method-summary">
<div class="method-definition">
<span class="method-result">Services_JSON_ErrorSuppression_TestCase</span>
<a href="#Services_JSON_ErrorSuppression_TestCase" title="details" class="method-name">Services_JSON_ErrorSuppression_TestCase</a>
(<span class="var-type">mixed</span>&nbsp;<span class="var-name">$name</span>)
</div>
<div class="method-definition">
<span class="method-result">void</span>
<a href="#setUp" title="details" class="method-name">setUp</a>
()
</div>
<div class="method-definition">
<span class="method-result">void</span>
<a href="#test_to_JSON" title="details" class="method-name">test_to_JSON</a>
()
</div>
<div class="method-definition">
<span class="method-result">void</span>
<a href="#test_to_JSON_suppressed" title="details" class="method-name">test_to_JSON_suppressed</a>
()
</div>
</div>
</div>
</div>
 
<a name="sec-methods"></a>
<div class="info-box">
<div class="info-box-title">Methods</div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
</div>
<div class="info-box-body">
<A NAME='method_detail'></A>
<a name="methodServices_JSON_ErrorSuppression_TestCase" id="Services_JSON_ErrorSuppression_TestCase"><!-- --></a>
<div class="evenrow">
<div class="method-header">
<span class="method-title">Constructor Services_JSON_ErrorSuppression_TestCase</span> (line <span class="line-number">436</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<div class="method-signature">
<span class="method-result">Services_JSON_ErrorSuppression_TestCase</span>
<span class="method-name">
Services_JSON_ErrorSuppression_TestCase
</span>
(<span class="var-type">mixed</span>&nbsp;<span class="var-name">$name</span>)
</div>
</div>
<a name="methodsetUp" id="setUp"><!-- --></a>
<div class="oddrow">
<div class="method-header">
<span class="method-title">setUp</span> (line <span class="line-number">440</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<div class="method-signature">
<span class="method-result">void</span>
<span class="method-name">
setUp
</span>
()
</div>
</div>
<a name="methodtest_to_JSON" id="test_to_JSON"><!-- --></a>
<div class="evenrow">
<div class="method-header">
<span class="method-title">test_to_JSON</span> (line <span class="line-number">462</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<div class="method-signature">
<span class="method-result">void</span>
<span class="method-name">
test_to_JSON
</span>
()
</div>
</div>
<a name="methodtest_to_JSON_suppressed" id="test_to_JSON_suppressed"><!-- --></a>
<div class="oddrow">
<div class="method-header">
<span class="method-title">test_to_JSON_suppressed</span> (line <span class="line-number">469</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<div class="method-signature">
<span class="method-result">void</span>
<span class="method-name">
test_to_JSON_suppressed
</span>
()
</div>
</div>
</div>
</div>
<p class="notes" id="credit">
Documentation generated on Tue, 27 Jun 2006 22:54:26 -0700 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
</p>
</div></body>
</html>
Property changes:
Added: svn:mime-type
+text/html
\ No newline at end of property
/trunk/dependencies/jsonwrapper/JSON/doc/Services_JSON/Services_JSON_NestedArray_TestCase.html
0,0 → 1,200
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title>Docs For Class Services_JSON_NestedArray_TestCase</title>
<link rel="stylesheet" href="../media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<div class="page-body">
<h2 class="class-name">Class Services_JSON_NestedArray_TestCase</h2>
 
<a name="sec-description"></a>
<div class="info-box">
<div class="info-box-title">Description</div>
<div class="nav-bar">
<span class="disabled">Description</span> |
<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
</div>
<div class="info-box-body">
<!-- ========== Info from phpDoc block ========= -->
<p class="notes">
Located in <a class="field" href="_Test-JSON_php.html">/Test-JSON.php</a> (line <span class="field">212</span>)
</p>
<pre>PHPUnit_TestCase
|
--Services_JSON_NestedArray_TestCase</pre>
</div>
</div>
 
 
 
<a name="sec-method-summary"></a>
<div class="info-box">
<div class="info-box-title">Method Summary</span></div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
</div>
<div class="info-box-body">
<div class="method-summary">
<div class="method-definition">
<span class="method-result">Services_JSON_NestedArray_TestCase</span>
<a href="#Services_JSON_NestedArray_TestCase" title="details" class="method-name">Services_JSON_NestedArray_TestCase</a>
(<span class="var-type">mixed</span>&nbsp;<span class="var-name">$name</span>)
</div>
<div class="method-definition">
<span class="method-result">void</span>
<a href="#setUp" title="details" class="method-name">setUp</a>
()
</div>
<div class="method-definition">
<span class="method-result">void</span>
<a href="#test_from_JSON" title="details" class="method-name">test_from_JSON</a>
()
</div>
<div class="method-definition">
<span class="method-result">void</span>
<a href="#test_type" title="details" class="method-name">test_type</a>
()
</div>
<div class="method-definition">
<span class="method-result">void</span>
<a href="#_test_from_JSON" title="details" class="method-name">_test_from_JSON</a>
()
</div>
</div>
</div>
</div>
 
<a name="sec-methods"></a>
<div class="info-box">
<div class="info-box-title">Methods</div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
</div>
<div class="info-box-body">
<A NAME='method_detail'></A>
<a name="methodServices_JSON_NestedArray_TestCase" id="Services_JSON_NestedArray_TestCase"><!-- --></a>
<div class="evenrow">
<div class="method-header">
<span class="method-title">Constructor Services_JSON_NestedArray_TestCase</span> (line <span class="line-number">214</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<div class="method-signature">
<span class="method-result">Services_JSON_NestedArray_TestCase</span>
<span class="method-name">
Services_JSON_NestedArray_TestCase
</span>
(<span class="var-type">mixed</span>&nbsp;<span class="var-name">$name</span>)
</div>
</div>
<a name="methodsetUp" id="setUp"><!-- --></a>
<div class="oddrow">
<div class="method-header">
<span class="method-title">setUp</span> (line <span class="line-number">218</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<div class="method-signature">
<span class="method-result">void</span>
<span class="method-name">
setUp
</span>
()
</div>
</div>
<a name="methodtest_from_JSON" id="test_from_JSON"><!-- --></a>
<div class="evenrow">
<div class="method-header">
<span class="method-title">test_from_JSON</span> (line <span class="line-number">272</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<div class="method-signature">
<span class="method-result">void</span>
<span class="method-name">
test_from_JSON
</span>
()
</div>
</div>
<a name="methodtest_type" id="test_type"><!-- --></a>
<div class="oddrow">
<div class="method-header">
<span class="method-title">test_type</span> (line <span class="line-number">265</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<div class="method-signature">
<span class="method-result">void</span>
<span class="method-name">
test_type
</span>
()
</div>
</div>
<a name="method_test_from_JSON" id="_test_from_JSON"><!-- --></a>
<div class="evenrow">
<div class="method-header">
<span class="method-title">_test_from_JSON</span> (line <span class="line-number">281</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<div class="method-signature">
<span class="method-result">void</span>
<span class="method-name">
_test_from_JSON
</span>
()
</div>
</div>
</div>
</div>
<p class="notes" id="credit">
Documentation generated on Tue, 27 Jun 2006 22:54:26 -0700 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
</p>
</div></body>
</html>
Property changes:
Added: svn:mime-type
+text/html
\ No newline at end of property
/trunk/dependencies/jsonwrapper/JSON/doc/Services_JSON/Services_JSON_Object_TestCase.html
0,0 → 1,200
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title>Docs For Class Services_JSON_Object_TestCase</title>
<link rel="stylesheet" href="../media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<div class="page-body">
<h2 class="class-name">Class Services_JSON_Object_TestCase</h2>
 
<a name="sec-description"></a>
<div class="info-box">
<div class="info-box-title">Description</div>
<div class="nav-bar">
<span class="disabled">Description</span> |
<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
</div>
<div class="info-box-body">
<!-- ========== Info from phpDoc block ========= -->
<p class="notes">
Located in <a class="field" href="_Test-JSON_php.html">/Test-JSON.php</a> (line <span class="field">289</span>)
</p>
<pre>PHPUnit_TestCase
|
--Services_JSON_Object_TestCase</pre>
</div>
</div>
 
 
 
<a name="sec-method-summary"></a>
<div class="info-box">
<div class="info-box-title">Method Summary</span></div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
</div>
<div class="info-box-body">
<div class="method-summary">
<div class="method-definition">
<span class="method-result">Services_JSON_Object_TestCase</span>
<a href="#Services_JSON_Object_TestCase" title="details" class="method-name">Services_JSON_Object_TestCase</a>
(<span class="var-type">mixed</span>&nbsp;<span class="var-name">$name</span>)
</div>
<div class="method-definition">
<span class="method-result">void</span>
<a href="#setUp" title="details" class="method-name">setUp</a>
()
</div>
<div class="method-definition">
<span class="method-result">void</span>
<a href="#test_from_then_to_JSON" title="details" class="method-name">test_from_then_to_JSON</a>
()
</div>
<div class="method-definition">
<span class="method-result">void</span>
<a href="#test_to_JSON" title="details" class="method-name">test_to_JSON</a>
()
</div>
<div class="method-definition">
<span class="method-result">void</span>
<a href="#test_type" title="details" class="method-name">test_type</a>
()
</div>
</div>
</div>
</div>
 
<a name="sec-methods"></a>
<div class="info-box">
<div class="info-box-title">Methods</div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
</div>
<div class="info-box-body">
<A NAME='method_detail'></A>
<a name="methodServices_JSON_Object_TestCase" id="Services_JSON_Object_TestCase"><!-- --></a>
<div class="oddrow">
<div class="method-header">
<span class="method-title">Constructor Services_JSON_Object_TestCase</span> (line <span class="line-number">291</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<div class="method-signature">
<span class="method-result">Services_JSON_Object_TestCase</span>
<span class="method-name">
Services_JSON_Object_TestCase
</span>
(<span class="var-type">mixed</span>&nbsp;<span class="var-name">$name</span>)
</div>
</div>
<a name="methodsetUp" id="setUp"><!-- --></a>
<div class="evenrow">
<div class="method-header">
<span class="method-title">setUp</span> (line <span class="line-number">295</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<div class="method-signature">
<span class="method-result">void</span>
<span class="method-name">
setUp
</span>
()
</div>
</div>
<a name="methodtest_from_then_to_JSON" id="test_from_then_to_JSON"><!-- --></a>
<div class="oddrow">
<div class="method-header">
<span class="method-title">test_from_then_to_JSON</span> (line <span class="line-number">321</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<div class="method-signature">
<span class="method-result">void</span>
<span class="method-name">
test_from_then_to_JSON
</span>
()
</div>
</div>
<a name="methodtest_to_JSON" id="test_to_JSON"><!-- --></a>
<div class="evenrow">
<div class="method-header">
<span class="method-title">test_to_JSON</span> (line <span class="line-number">315</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<div class="method-signature">
<span class="method-result">void</span>
<span class="method-name">
test_to_JSON
</span>
()
</div>
</div>
<a name="methodtest_type" id="test_type"><!-- --></a>
<div class="oddrow">
<div class="method-header">
<span class="method-title">test_type</span> (line <span class="line-number">309</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<div class="method-signature">
<span class="method-result">void</span>
<span class="method-name">
test_type
</span>
()
</div>
</div>
</div>
</div>
<p class="notes" id="credit">
Documentation generated on Tue, 27 Jun 2006 22:54:26 -0700 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
</p>
</div></body>
</html>
Property changes:
Added: svn:mime-type
+text/html
\ No newline at end of property
/trunk/dependencies/jsonwrapper/JSON/doc/Services_JSON/Services_JSON_Spaces_Comments_TestCase.html
0,0 → 1,174
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title>Docs For Class Services_JSON_Spaces_Comments_TestCase</title>
<link rel="stylesheet" href="../media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<div class="page-body">
<h2 class="class-name">Class Services_JSON_Spaces_Comments_TestCase</h2>
 
<a name="sec-description"></a>
<div class="info-box">
<div class="info-box-title">Description</div>
<div class="nav-bar">
<span class="disabled">Description</span> |
<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
</div>
<div class="info-box-body">
<!-- ========== Info from phpDoc block ========= -->
<p class="notes">
Located in <a class="field" href="_Test-JSON_php.html">/Test-JSON.php</a> (line <span class="field">328</span>)
</p>
<pre>PHPUnit_TestCase
|
--Services_JSON_Spaces_Comments_TestCase</pre>
</div>
</div>
 
 
 
<a name="sec-method-summary"></a>
<div class="info-box">
<div class="info-box-title">Method Summary</span></div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
</div>
<div class="info-box-body">
<div class="method-summary">
<div class="method-definition">
<span class="method-result">Services_JSON_Spaces_Comments_TestCase</span>
<a href="#Services_JSON_Spaces_Comments_TestCase" title="details" class="method-name">Services_JSON_Spaces_Comments_TestCase</a>
(<span class="var-type">mixed</span>&nbsp;<span class="var-name">$name</span>)
</div>
<div class="method-definition">
<span class="method-result">void</span>
<a href="#setUp" title="details" class="method-name">setUp</a>
()
</div>
<div class="method-definition">
<span class="method-result">void</span>
<a href="#test_comments" title="details" class="method-name">test_comments</a>
()
</div>
<div class="method-definition">
<span class="method-result">void</span>
<a href="#test_spaces" title="details" class="method-name">test_spaces</a>
()
</div>
</div>
</div>
</div>
 
<a name="sec-methods"></a>
<div class="info-box">
<div class="info-box-title">Methods</div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
</div>
<div class="info-box-body">
<A NAME='method_detail'></A>
<a name="methodServices_JSON_Spaces_Comments_TestCase" id="Services_JSON_Spaces_Comments_TestCase"><!-- --></a>
<div class="evenrow">
<div class="method-header">
<span class="method-title">Constructor Services_JSON_Spaces_Comments_TestCase</span> (line <span class="line-number">330</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<div class="method-signature">
<span class="method-result">Services_JSON_Spaces_Comments_TestCase</span>
<span class="method-name">
Services_JSON_Spaces_Comments_TestCase
</span>
(<span class="var-type">mixed</span>&nbsp;<span class="var-name">$name</span>)
</div>
</div>
<a name="methodsetUp" id="setUp"><!-- --></a>
<div class="oddrow">
<div class="method-header">
<span class="method-title">setUp</span> (line <span class="line-number">334</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<div class="method-signature">
<span class="method-result">void</span>
<span class="method-name">
setUp
</span>
()
</div>
</div>
<a name="methodtest_comments" id="test_comments"><!-- --></a>
<div class="evenrow">
<div class="method-header">
<span class="method-title">test_comments</span> (line <span class="line-number">355</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<div class="method-signature">
<span class="method-result">void</span>
<span class="method-name">
test_comments
</span>
()
</div>
</div>
<a name="methodtest_spaces" id="test_spaces"><!-- --></a>
<div class="oddrow">
<div class="method-header">
<span class="method-title">test_spaces</span> (line <span class="line-number">350</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<div class="method-signature">
<span class="method-result">void</span>
<span class="method-name">
test_spaces
</span>
()
</div>
</div>
</div>
</div>
<p class="notes" id="credit">
Documentation generated on Tue, 27 Jun 2006 22:54:26 -0700 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
</p>
</div></body>
</html>
Property changes:
Added: svn:mime-type
+text/html
\ No newline at end of property
/trunk/dependencies/jsonwrapper/JSON/doc/Services_JSON/Services_JSON_UnquotedKeys_TestCase.html
0,0 → 1,148
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title>Docs For Class Services_JSON_UnquotedKeys_TestCase</title>
<link rel="stylesheet" href="../media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<div class="page-body">
<h2 class="class-name">Class Services_JSON_UnquotedKeys_TestCase</h2>
 
<a name="sec-description"></a>
<div class="info-box">
<div class="info-box-title">Description</div>
<div class="nav-bar">
<span class="disabled">Description</span> |
<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
</div>
<div class="info-box-body">
<!-- ========== Info from phpDoc block ========= -->
<p class="notes">
Located in <a class="field" href="_Test-JSON_php.html">/Test-JSON.php</a> (line <span class="field">406</span>)
</p>
<pre>PHPUnit_TestCase
|
--Services_JSON_UnquotedKeys_TestCase</pre>
</div>
</div>
 
 
 
<a name="sec-method-summary"></a>
<div class="info-box">
<div class="info-box-title">Method Summary</span></div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
</div>
<div class="info-box-body">
<div class="method-summary">
<div class="method-definition">
<span class="method-result">Services_JSON_UnquotedKeys_TestCase</span>
<a href="#Services_JSON_UnquotedKeys_TestCase" title="details" class="method-name">Services_JSON_UnquotedKeys_TestCase</a>
(<span class="var-type">mixed</span>&nbsp;<span class="var-name">$name</span>)
</div>
<div class="method-definition">
<span class="method-result">void</span>
<a href="#setUp" title="details" class="method-name">setUp</a>
()
</div>
<div class="method-definition">
<span class="method-result">void</span>
<a href="#test_from_JSON" title="details" class="method-name">test_from_JSON</a>
()
</div>
</div>
</div>
</div>
 
<a name="sec-methods"></a>
<div class="info-box">
<div class="info-box-title">Methods</div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
</div>
<div class="info-box-body">
<A NAME='method_detail'></A>
<a name="methodServices_JSON_UnquotedKeys_TestCase" id="Services_JSON_UnquotedKeys_TestCase"><!-- --></a>
<div class="evenrow">
<div class="method-header">
<span class="method-title">Constructor Services_JSON_UnquotedKeys_TestCase</span> (line <span class="line-number">408</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<div class="method-signature">
<span class="method-result">Services_JSON_UnquotedKeys_TestCase</span>
<span class="method-name">
Services_JSON_UnquotedKeys_TestCase
</span>
(<span class="var-type">mixed</span>&nbsp;<span class="var-name">$name</span>)
</div>
</div>
<a name="methodsetUp" id="setUp"><!-- --></a>
<div class="oddrow">
<div class="method-header">
<span class="method-title">setUp</span> (line <span class="line-number">412</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<div class="method-signature">
<span class="method-result">void</span>
<span class="method-name">
setUp
</span>
()
</div>
</div>
<a name="methodtest_from_JSON" id="test_from_JSON"><!-- --></a>
<div class="evenrow">
<div class="method-header">
<span class="method-title">test_from_JSON</span> (line <span class="line-number">424</span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<div class="method-signature">
<span class="method-result">void</span>
<span class="method-name">
test_from_JSON
</span>
()
</div>
</div>
</div>
</div>
<p class="notes" id="credit">
Documentation generated on Tue, 27 Jun 2006 22:54:27 -0700 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
</p>
</div></body>
</html>
Property changes:
Added: svn:mime-type
+text/html
\ No newline at end of property
/trunk/dependencies/jsonwrapper/JSON/doc/Services_JSON/_JSON_php.html
0,0 → 1,197
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title>Docs for page JSON.php</title>
<link rel="stylesheet" href="../media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<div class="page-body">
<h2 class="file-name">/JSON.php</h2>
 
<a name="sec-description"></a>
<div class="info-box">
<div class="info-box-title">Description</div>
<div class="nav-bar">
<span class="disabled">Description</span> |
<a href="#sec-classes">Classes</a>
| <a href="#sec-constants">Constants</a>
</div>
<div class="info-box-body">
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Converts to and from JSON format.</p>
<p class="description"><p>JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the JavaScript Programming Language, Standard ECMA-262 3rd Edition - December 1999. This feature can also be found in Python. JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, TCL, and many others. These properties make JSON an ideal data-interchange language.</p><p>This package provides a simple encoder and decoder for JSON notation. It is intended for use with client-side Javascript applications that make use of HTTPRequest to perform server communication functions - data can be encoded into JSON notation for use in a client-side javascript, or decoded from incoming Javascript requests. JSON format is native to Javascript, and can be directly eval()'ed with no further parsing overhead</p><p>All strings should be in ASCII or UTF-8 format!</p><p>LICENSE: 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.</p><p>THIS SOFTWARE IS PROVIDED ``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 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.</p></p>
<ul class="tags">
<li><span class="field">license:</span> <a href="http://www.opensource.org/licenses/bsd-license.php">http://www.opensource.org/licenses/bsd-license.php</a></li>
<li><span class="field">link:</span> <a href="http://pear.php.net/pepr/pepr-proposal-show.php?id=198">http://pear.php.net/pepr/pepr-proposal-show.php?id=198</a></li>
<li><span class="field">version:</span> CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $</li>
<li><span class="field">copyright:</span> 2005 Michal Migurski</li>
<li><span class="field">author:</span> Matt Knapp &lt;<a href="mailto:mdknapp[at]gmail[dot]com">mailto:mdknapp[at]gmail[dot]com</a>&gt;</li>
<li><span class="field">author:</span> Brett Stimmerman &lt;<a href="mailto:brettstimmerman[at]gmail[dot]com">mailto:brettstimmerman[at]gmail[dot]com</a>&gt;</li>
<li><span class="field">author:</span> Michal Migurski &lt;<a href="mailto:mike-json@teczno.com">mailto:mike-json@teczno.com</a>&gt;</li>
</ul>
</div>
</div>
<a name="sec-classes"></a>
<div class="info-box">
<div class="info-box-title">Classes</div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<span class="disabled">Classes</span>
| <a href="#sec-constants">Constants</a>
</div>
<div class="info-box-body">
<table cellpadding="2" cellspacing="0" class="class-table">
<tr>
<th class="class-table-header">Class</th>
<th class="class-table-header">Description</th>
</tr>
<tr>
<td style="padding-right: 2em; vertical-align: top">
<a href="../Services_JSON/Services_JSON.html">Services_JSON</a>
</td>
<td>
Converts to and from JSON format.
</td>
</tr>
<tr>
<td style="padding-right: 2em; vertical-align: top">
<a href="../Services_JSON/Services_JSON_Error.html">Services_JSON_Error</a>
</td>
<td>
</td>
</tr>
</table>
</div>
</div>
 
<a name="sec-constants"></a>
<div class="info-box">
<div class="info-box-title">Constants</div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<a href="#sec-classes">Classes</a>
| <span class="disabled">Constants</span>
</div>
<div class="info-box-body">
<a name="defineSERVICES_JSON_IN_ARR"><!-- --></a>
<div class="oddrow">
<div>
<span class="const-title">
<span class="const-name">SERVICES_JSON_IN_ARR</span> = 3
(line <span class="line-number">72</span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Marker constant for Services_JSON::decode(), used to flag stack state</p>
</div>
<a name="defineSERVICES_JSON_IN_CMT"><!-- --></a>
<div class="evenrow">
<div>
<span class="const-title">
<span class="const-name">SERVICES_JSON_IN_CMT</span> = 5
(line <span class="line-number">82</span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Marker constant for Services_JSON::decode(), used to flag stack state</p>
</div>
<a name="defineSERVICES_JSON_IN_OBJ"><!-- --></a>
<div class="oddrow">
<div>
<span class="const-title">
<span class="const-name">SERVICES_JSON_IN_OBJ</span> = 4
(line <span class="line-number">77</span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Marker constant for Services_JSON::decode(), used to flag stack state</p>
</div>
<a name="defineSERVICES_JSON_IN_STR"><!-- --></a>
<div class="evenrow">
<div>
<span class="const-title">
<span class="const-name">SERVICES_JSON_IN_STR</span> = 2
(line <span class="line-number">67</span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Marker constant for Services_JSON::decode(), used to flag stack state</p>
</div>
<a name="defineSERVICES_JSON_LOOSE_TYPE"><!-- --></a>
<div class="oddrow">
<div>
<span class="const-title">
<span class="const-name">SERVICES_JSON_LOOSE_TYPE</span> = 16
(line <span class="line-number">87</span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Behavior switch for Services_JSON::decode()</p>
</div>
<a name="defineSERVICES_JSON_SLICE"><!-- --></a>
<div class="evenrow">
<div>
<span class="const-title">
<span class="const-name">SERVICES_JSON_SLICE</span> = 1
(line <span class="line-number">62</span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Marker constant for Services_JSON::decode(), used to flag stack state</p>
</div>
<a name="defineSERVICES_JSON_SUPPRESS_ERRORS"><!-- --></a>
<div class="oddrow">
<div>
<span class="const-title">
<span class="const-name">SERVICES_JSON_SUPPRESS_ERRORS</span> = 32
(line <span class="line-number">92</span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Behavior switch for Services_JSON::decode()</p>
</div>
</div>
</div>
<p class="notes" id="credit">
Documentation generated on Tue, 27 Jun 2006 22:54:25 -0700 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
</p>
</div></body>
</html>
Property changes:
Added: svn:mime-type
+text/html
\ No newline at end of property
/trunk/dependencies/jsonwrapper/JSON/doc/Services_JSON/_Test-JSON_php.html
0,0 → 1,168
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title>Docs for page Test-JSON.php</title>
<link rel="stylesheet" href="../media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<div class="page-body">
<h2 class="file-name">/Test-JSON.php</h2>
 
<a name="sec-description"></a>
<div class="info-box">
<div class="info-box-title">Description</div>
<div class="nav-bar">
<span class="disabled">Description</span> |
<a href="#sec-classes">Classes</a>
| <a href="#sec-includes">Includes</a>
</div>
<div class="info-box-body">
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Unit tests for Services_JSON.</p>
<ul class="tags">
<li><span class="field">version:</span> CVS: $Id: Test-JSON.php,v 1.28 2006/06/28 05:54:17 migurski Exp $</li>
<li><span class="field">license:</span> <a href="http://www.opensource.org/licenses/bsd-license.php">http://www.opensource.org/licenses/bsd-license.php</a></li>
<li><span class="field">link:</span> <a href="http://pear.php.net/pepr/pepr-proposal-show.php?id=198">http://pear.php.net/pepr/pepr-proposal-show.php?id=198</a></li>
<li><span class="field">copyright:</span> 2005 Michal Migurski</li>
<li><span class="field">author:</span> Brett Stimmerman &lt;<a href="mailto:brettstimmerman[at]gmail[dot]com">mailto:brettstimmerman[at]gmail[dot]com</a>&gt;</li>
<li><span class="field">author:</span> Michal Migurski &lt;<a href="mailto:mike-json@teczno.com">mailto:mike-json@teczno.com</a>&gt;</li>
<li><span class="field">author:</span> Matt Knapp &lt;<a href="mailto:mdknapp[at]gmail[dot]com">mailto:mdknapp[at]gmail[dot]com</a>&gt;</li>
<li><span class="field">see:</span> <a href="../Services_JSON/_JSON_php.html">JSON.php</a></li>
</ul>
</div>
</div>
<a name="sec-classes"></a>
<div class="info-box">
<div class="info-box-title">Classes</div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<span class="disabled">Classes</span>
| <a href="#sec-includes">Includes</a>
</div>
<div class="info-box-body">
<table cellpadding="2" cellspacing="0" class="class-table">
<tr>
<th class="class-table-header">Class</th>
<th class="class-table-header">Description</th>
</tr>
<tr>
<td style="padding-right: 2em; vertical-align: top">
<a href="../Services_JSON/Services_JSON_EncDec_TestCase.html">Services_JSON_EncDec_TestCase</a>
</td>
<td>
</td>
</tr>
<tr>
<td style="padding-right: 2em; vertical-align: top">
<a href="../Services_JSON/Services_JSON_AssocArray_TestCase.html">Services_JSON_AssocArray_TestCase</a>
</td>
<td>
</td>
</tr>
<tr>
<td style="padding-right: 2em; vertical-align: top">
<a href="../Services_JSON/Services_JSON_NestedArray_TestCase.html">Services_JSON_NestedArray_TestCase</a>
</td>
<td>
</td>
</tr>
<tr>
<td style="padding-right: 2em; vertical-align: top">
<a href="../Services_JSON/Services_JSON_Object_TestCase.html">Services_JSON_Object_TestCase</a>
</td>
<td>
</td>
</tr>
<tr>
<td style="padding-right: 2em; vertical-align: top">
<a href="../Services_JSON/Services_JSON_Spaces_Comments_TestCase.html">Services_JSON_Spaces_Comments_TestCase</a>
</td>
<td>
</td>
</tr>
<tr>
<td style="padding-right: 2em; vertical-align: top">
<a href="../Services_JSON/Services_JSON_Empties_TestCase.html">Services_JSON_Empties_TestCase</a>
</td>
<td>
</td>
</tr>
<tr>
<td style="padding-right: 2em; vertical-align: top">
<a href="../Services_JSON/Services_JSON_UnquotedKeys_TestCase.html">Services_JSON_UnquotedKeys_TestCase</a>
</td>
<td>
</td>
</tr>
<tr>
<td style="padding-right: 2em; vertical-align: top">
<a href="../Services_JSON/Services_JSON_ErrorSuppression_TestCase.html">Services_JSON_ErrorSuppression_TestCase</a>
</td>
<td>
</td>
</tr>
</table>
</div>
</div>
 
<a name="sec-includes"></a>
<div class="info-box">
<div class="info-box-title">Includes</div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<a href="#sec-classes">Classes</a>
| <span class="disabled">Includes</span>
</div>
<div class="info-box-body">
<a name="_PHPUnit_php"><!-- --></a>
<div class="oddrow">
<div>
<span class="include-title">
<span class="include-type">require_once</span>
(<span class="include-name">'PHPUnit.php'</span>)
(line <span class="line-number">22</span>)
</span>
</div>
 
<!-- ========== Info from phpDoc block ========= -->
</div>
<a name="_JSON_php"><!-- --></a>
<div class="evenrow">
<div>
<span class="include-title">
<span class="include-type">require_once</span>
(<span class="include-name"><a href="../Services_JSON/_JSON_php.html">'JSON.php'</a></span>)
(line <span class="line-number">23</span>)
</span>
</div>
 
<!-- ========== Info from phpDoc block ========= -->
</div>
</div>
</div>
<p class="notes" id="credit">
Documentation generated on Tue, 27 Jun 2006 22:54:26 -0700 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
</p>
</div></body>
</html>
Property changes:
Added: svn:mime-type
+text/html
\ No newline at end of property
/trunk/dependencies/jsonwrapper/JSON/doc/blank.html
0,0 → 1,13
<html>
<head>
<title>Generated Documentation</title>
<link rel="stylesheet" href="media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<div align="center"><h1>Generated Documentation</h1></div>
<b>Welcome to default!</b><br />
<br />
This documentation was generated by <a href="http://www.phpdoc.org">phpDocumentor v1.2.3</a><br />
</body>
</html>
Property changes:
Added: svn:mime-type
+text/html
\ No newline at end of property
/trunk/dependencies/jsonwrapper/JSON/doc/classtrees_Services_JSON.html
0,0 → 1,60
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title></title>
<link rel="stylesheet" href="media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<!-- Start of Class Data -->
<H2>
</H2>
<h2>Root class Services_JSON</h2>
<ul>
<li><a href="Services_JSON/Services_JSON.html">Services_JSON</a></li></ul>
 
<h2>Root class Services_JSON_AssocArray_TestCase</h2>
<ul>
<li>PHPUnit_TestCase<ul><li><a href="Services_JSON/Services_JSON_AssocArray_TestCase.html">Services_JSON_AssocArray_TestCase</a></li></ul></li></ul>
 
<h2>Root class Services_JSON_Empties_TestCase</h2>
<ul>
<li>PHPUnit_TestCase<ul><li><a href="Services_JSON/Services_JSON_Empties_TestCase.html">Services_JSON_Empties_TestCase</a></li></ul></li></ul>
 
<h2>Root class Services_JSON_EncDec_TestCase</h2>
<ul>
<li>PHPUnit_TestCase<ul><li><a href="Services_JSON/Services_JSON_EncDec_TestCase.html">Services_JSON_EncDec_TestCase</a></li></ul></li></ul>
 
<h2>Root class Services_JSON_Error</h2>
<ul>
<li>PEAR_Error<ul><li><a href="Services_JSON/Services_JSON_Error.html">Services_JSON_Error</a></li></ul></li></ul>
 
<h2>Root class Services_JSON_ErrorSuppression_TestCase</h2>
<ul>
<li>PHPUnit_TestCase<ul><li><a href="Services_JSON/Services_JSON_ErrorSuppression_TestCase.html">Services_JSON_ErrorSuppression_TestCase</a></li></ul></li></ul>
 
<h2>Root class Services_JSON_NestedArray_TestCase</h2>
<ul>
<li>PHPUnit_TestCase<ul><li><a href="Services_JSON/Services_JSON_NestedArray_TestCase.html">Services_JSON_NestedArray_TestCase</a></li></ul></li></ul>
 
<h2>Root class Services_JSON_Object_TestCase</h2>
<ul>
<li>PHPUnit_TestCase<ul><li><a href="Services_JSON/Services_JSON_Object_TestCase.html">Services_JSON_Object_TestCase</a></li></ul></li></ul>
 
<h2>Root class Services_JSON_Spaces_Comments_TestCase</h2>
<ul>
<li>PHPUnit_TestCase<ul><li><a href="Services_JSON/Services_JSON_Spaces_Comments_TestCase.html">Services_JSON_Spaces_Comments_TestCase</a></li></ul></li></ul>
 
<h2>Root class Services_JSON_UnquotedKeys_TestCase</h2>
<ul>
<li>PHPUnit_TestCase<ul><li><a href="Services_JSON/Services_JSON_UnquotedKeys_TestCase.html">Services_JSON_UnquotedKeys_TestCase</a></li></ul></li></ul>
 
<p class="notes" id="credit">
Documentation generated on Tue, 27 Jun 2006 22:54:25 -0700 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
</p>
</body>
</html>
Property changes:
Added: svn:mime-type
+text/html
\ No newline at end of property
/trunk/dependencies/jsonwrapper/JSON/doc/elementindex.html
0,0 → 1,457
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title></title>
<link rel="stylesheet" href="media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<a name="top"></a>
<h2>Full index</h2>
<h3>Package indexes</h3>
<ul>
<li><a href="elementindex_Services_JSON.html">Services_JSON</a></li>
</ul>
<br />
<div class="index-letter-menu">
<a class="index-letter" href="elementindex.html#d">d</a>
<a class="index-letter" href="elementindex.html#e">e</a>
<a class="index-letter" href="elementindex.html#i">i</a>
<a class="index-letter" href="elementindex.html#"></a>
<a class="index-letter" href="elementindex.html#s">s</a>
<a class="index-letter" href="elementindex.html#t">t</a>
</div>
 
<a name="d"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">d</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<span class="method-title">decode</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON.html#methoddecode">Services_JSON::decode()</a> in JSON.php</div>
<div class="index-item-description">decodes a JSON string into appropriate variable</div>
</dd>
</dl>
<a name="e"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">e</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<span class="method-title">encode</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON.html#methodencode">Services_JSON::encode()</a> in JSON.php</div>
<div class="index-item-description">encodes an arbitrary variable into JSON format</div>
</dd>
</dl>
<a name="i"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">i</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<span class="method-title">isError</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON.html#methodisError">Services_JSON::isError()</a> in JSON.php</div>
</dd>
</dl>
<a name="j"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">j</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<span class="include-title">JSON.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/_JSON_php.html">JSON.php</a> in JSON.php</div>
</dd>
</dl>
<a name="s"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">s</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
Services_JSON
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON.html">Services_JSON</a> in JSON.php</div>
<div class="index-item-description">Converts to and from JSON format.</div>
</dd>
<dt class="field">
<span class="method-title">Services_JSON</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON.html#methodServices_JSON">Services_JSON::Services_JSON()</a> in JSON.php</div>
<div class="index-item-description">constructs a new JSON instance</div>
</dd>
<dt class="field">
<span class="method-title">Services_JSON_AssocArray_TestCase</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_AssocArray_TestCase.html#methodServices_JSON_AssocArray_TestCase">Services_JSON_AssocArray_TestCase::Services_JSON_AssocArray_TestCase()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
Services_JSON_AssocArray_TestCase
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_AssocArray_TestCase.html">Services_JSON_AssocArray_TestCase</a> in Test-JSON.php</div>
</dd>
<dt class="field">
Services_JSON_Empties_TestCase
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_Empties_TestCase.html">Services_JSON_Empties_TestCase</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">Services_JSON_Empties_TestCase</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_Empties_TestCase.html#methodServices_JSON_Empties_TestCase">Services_JSON_Empties_TestCase::Services_JSON_Empties_TestCase()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">Services_JSON_EncDec_TestCase</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_EncDec_TestCase.html#methodServices_JSON_EncDec_TestCase">Services_JSON_EncDec_TestCase::Services_JSON_EncDec_TestCase()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
Services_JSON_EncDec_TestCase
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_EncDec_TestCase.html">Services_JSON_EncDec_TestCase</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">Services_JSON_Error</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_Error.html#methodServices_JSON_Error">Services_JSON_Error::Services_JSON_Error()</a> in JSON.php</div>
</dd>
<dt class="field">
Services_JSON_Error
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_Error.html">Services_JSON_Error</a> in JSON.php</div>
</dd>
<dt class="field">
Services_JSON_ErrorSuppression_TestCase
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_ErrorSuppression_TestCase.html">Services_JSON_ErrorSuppression_TestCase</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">Services_JSON_ErrorSuppression_TestCase</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_ErrorSuppression_TestCase.html#methodServices_JSON_ErrorSuppression_TestCase">Services_JSON_ErrorSuppression_TestCase::Services_JSON_ErrorSuppression_TestCase()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="const-title">SERVICES_JSON_IN_ARR</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/_JSON_php.html#defineSERVICES_JSON_IN_ARR">SERVICES_JSON_IN_ARR</a> in JSON.php</div>
<div class="index-item-description">Marker constant for Services_JSON::decode(), used to flag stack state</div>
</dd>
<dt class="field">
<span class="const-title">SERVICES_JSON_IN_CMT</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/_JSON_php.html#defineSERVICES_JSON_IN_CMT">SERVICES_JSON_IN_CMT</a> in JSON.php</div>
<div class="index-item-description">Marker constant for Services_JSON::decode(), used to flag stack state</div>
</dd>
<dt class="field">
<span class="const-title">SERVICES_JSON_IN_OBJ</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/_JSON_php.html#defineSERVICES_JSON_IN_OBJ">SERVICES_JSON_IN_OBJ</a> in JSON.php</div>
<div class="index-item-description">Marker constant for Services_JSON::decode(), used to flag stack state</div>
</dd>
<dt class="field">
<span class="const-title">SERVICES_JSON_IN_STR</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/_JSON_php.html#defineSERVICES_JSON_IN_STR">SERVICES_JSON_IN_STR</a> in JSON.php</div>
<div class="index-item-description">Marker constant for Services_JSON::decode(), used to flag stack state</div>
</dd>
<dt class="field">
<span class="const-title">SERVICES_JSON_LOOSE_TYPE</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/_JSON_php.html#defineSERVICES_JSON_LOOSE_TYPE">SERVICES_JSON_LOOSE_TYPE</a> in JSON.php</div>
<div class="index-item-description">Behavior switch for Services_JSON::decode()</div>
</dd>
<dt class="field">
<span class="method-title">Services_JSON_NestedArray_TestCase</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_NestedArray_TestCase.html#methodServices_JSON_NestedArray_TestCase">Services_JSON_NestedArray_TestCase::Services_JSON_NestedArray_TestCase()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
Services_JSON_NestedArray_TestCase
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_NestedArray_TestCase.html">Services_JSON_NestedArray_TestCase</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">Services_JSON_Object_TestCase</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_Object_TestCase.html#methodServices_JSON_Object_TestCase">Services_JSON_Object_TestCase::Services_JSON_Object_TestCase()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
Services_JSON_Object_TestCase
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_Object_TestCase.html">Services_JSON_Object_TestCase</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="const-title">SERVICES_JSON_SLICE</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/_JSON_php.html#defineSERVICES_JSON_SLICE">SERVICES_JSON_SLICE</a> in JSON.php</div>
<div class="index-item-description">Marker constant for Services_JSON::decode(), used to flag stack state</div>
</dd>
<dt class="field">
Services_JSON_Spaces_Comments_TestCase
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_Spaces_Comments_TestCase.html">Services_JSON_Spaces_Comments_TestCase</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">Services_JSON_Spaces_Comments_TestCase</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_Spaces_Comments_TestCase.html#methodServices_JSON_Spaces_Comments_TestCase">Services_JSON_Spaces_Comments_TestCase::Services_JSON_Spaces_Comments_TestCase()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="const-title">SERVICES_JSON_SUPPRESS_ERRORS</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/_JSON_php.html#defineSERVICES_JSON_SUPPRESS_ERRORS">SERVICES_JSON_SUPPRESS_ERRORS</a> in JSON.php</div>
<div class="index-item-description">Behavior switch for Services_JSON::decode()</div>
</dd>
<dt class="field">
Services_JSON_UnquotedKeys_TestCase
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_UnquotedKeys_TestCase.html">Services_JSON_UnquotedKeys_TestCase</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">Services_JSON_UnquotedKeys_TestCase</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_UnquotedKeys_TestCase.html#methodServices_JSON_UnquotedKeys_TestCase">Services_JSON_UnquotedKeys_TestCase::Services_JSON_UnquotedKeys_TestCase()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">setUp</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_UnquotedKeys_TestCase.html#methodsetUp">Services_JSON_UnquotedKeys_TestCase::setUp()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">setUp</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_Spaces_Comments_TestCase.html#methodsetUp">Services_JSON_Spaces_Comments_TestCase::setUp()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">setUp</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_Object_TestCase.html#methodsetUp">Services_JSON_Object_TestCase::setUp()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">setUp</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_Empties_TestCase.html#methodsetUp">Services_JSON_Empties_TestCase::setUp()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">setUp</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_AssocArray_TestCase.html#methodsetUp">Services_JSON_AssocArray_TestCase::setUp()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">setUp</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_NestedArray_TestCase.html#methodsetUp">Services_JSON_NestedArray_TestCase::setUp()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">setUp</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_EncDec_TestCase.html#methodsetUp">Services_JSON_EncDec_TestCase::setUp()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">setUp</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_ErrorSuppression_TestCase.html#methodsetUp">Services_JSON_ErrorSuppression_TestCase::setUp()</a> in Test-JSON.php</div>
</dd>
</dl>
<a name="t"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">t</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<span class="include-title">Test-JSON.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/_Test-JSON_php.html">Test-JSON.php</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">test_comments</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_Spaces_Comments_TestCase.html#methodtest_comments">Services_JSON_Spaces_Comments_TestCase::test_comments()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">test_from_JSON</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_EncDec_TestCase.html#methodtest_from_JSON">Services_JSON_EncDec_TestCase::test_from_JSON()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">test_from_JSON</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_UnquotedKeys_TestCase.html#methodtest_from_JSON">Services_JSON_UnquotedKeys_TestCase::test_from_JSON()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">test_from_JSON</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_NestedArray_TestCase.html#methodtest_from_JSON">Services_JSON_NestedArray_TestCase::test_from_JSON()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">test_from_then_to_JSON</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_Object_TestCase.html#methodtest_from_then_to_JSON">Services_JSON_Object_TestCase::test_from_then_to_JSON()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">test_from_then_to_JSON</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_EncDec_TestCase.html#methodtest_from_then_to_JSON">Services_JSON_EncDec_TestCase::test_from_then_to_JSON()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">test_spaces</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_Spaces_Comments_TestCase.html#methodtest_spaces">Services_JSON_Spaces_Comments_TestCase::test_spaces()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">test_to_JSON</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_Object_TestCase.html#methodtest_to_JSON">Services_JSON_Object_TestCase::test_to_JSON()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">test_to_JSON</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_ErrorSuppression_TestCase.html#methodtest_to_JSON">Services_JSON_ErrorSuppression_TestCase::test_to_JSON()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">test_to_JSON</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_EncDec_TestCase.html#methodtest_to_JSON">Services_JSON_EncDec_TestCase::test_to_JSON()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">test_to_JSON</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_AssocArray_TestCase.html#methodtest_to_JSON">Services_JSON_AssocArray_TestCase::test_to_JSON()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">test_to_JSON_suppressed</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_ErrorSuppression_TestCase.html#methodtest_to_JSON_suppressed">Services_JSON_ErrorSuppression_TestCase::test_to_JSON_suppressed()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">test_to_then_from_JSON</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_AssocArray_TestCase.html#methodtest_to_then_from_JSON">Services_JSON_AssocArray_TestCase::test_to_then_from_JSON()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">test_to_then_from_JSON</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_EncDec_TestCase.html#methodtest_to_then_from_JSON">Services_JSON_EncDec_TestCase::test_to_then_from_JSON()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">test_type</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_AssocArray_TestCase.html#methodtest_type">Services_JSON_AssocArray_TestCase::test_type()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">test_type</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_Empties_TestCase.html#methodtest_type">Services_JSON_Empties_TestCase::test_type()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">test_type</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_NestedArray_TestCase.html#methodtest_type">Services_JSON_NestedArray_TestCase::test_type()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">test_type</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_Object_TestCase.html#methodtest_type">Services_JSON_Object_TestCase::test_type()</a> in Test-JSON.php</div>
</dd>
</dl>
<a name="_"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">_</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<span class="method-title">_test_from_JSON</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_NestedArray_TestCase.html#method_test_from_JSON">Services_JSON_NestedArray_TestCase::_test_from_JSON()</a> in Test-JSON.php</div>
</dd>
</dl>
 
<div class="index-letter-menu">
<a class="index-letter" href="elementindex.html#d">d</a>
<a class="index-letter" href="elementindex.html#e">e</a>
<a class="index-letter" href="elementindex.html#i">i</a>
<a class="index-letter" href="elementindex.html#"></a>
<a class="index-letter" href="elementindex.html#s">s</a>
<a class="index-letter" href="elementindex.html#t">t</a>
</div> </body>
</html>
Property changes:
Added: svn:mime-type
+text/html
\ No newline at end of property
/trunk/dependencies/jsonwrapper/JSON/doc/elementindex_Services_JSON.html
0,0 → 1,456
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title></title>
<link rel="stylesheet" href="media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<a name="top"></a>
<h2>[Services_JSON] element index</h2>
<a href="elementindex.html">All elements</a>
<br />
<div class="index-letter-menu">
<a class="index-letter" href="elementindex_Services_JSON.html#d">d</a>
<a class="index-letter" href="elementindex_Services_JSON.html#e">e</a>
<a class="index-letter" href="elementindex_Services_JSON.html#i">i</a>
<a class="index-letter" href="elementindex_Services_JSON.html#j">j</a>
<a class="index-letter" href="elementindex_Services_JSON.html#s">s</a>
<a class="index-letter" href="elementindex_Services_JSON.html#t">t</a>
<a class="index-letter" href="elementindex_Services_JSON.html#_">_</a>
</div>
 
<a name="_"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">_</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<span class="method-title">_test_from_JSON</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_NestedArray_TestCase.html#method_test_from_JSON">Services_JSON_NestedArray_TestCase::_test_from_JSON()</a> in Test-JSON.php</div>
</dd>
</dl>
<a name="d"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">d</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<span class="method-title">decode</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON.html#methoddecode">Services_JSON::decode()</a> in JSON.php</div>
<div class="index-item-description">decodes a JSON string into appropriate variable</div>
</dd>
</dl>
<a name="e"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">e</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<span class="method-title">encode</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON.html#methodencode">Services_JSON::encode()</a> in JSON.php</div>
<div class="index-item-description">encodes an arbitrary variable into JSON format</div>
</dd>
</dl>
<a name="i"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">i</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<span class="method-title">isError</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON.html#methodisError">Services_JSON::isError()</a> in JSON.php</div>
</dd>
</dl>
<a name="j"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">j</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<span class="include-title">JSON.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/_JSON_php.html">JSON.php</a> in JSON.php</div>
</dd>
</dl>
<a name="s"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">s</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
Services_JSON
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON.html">Services_JSON</a> in JSON.php</div>
<div class="index-item-description">Converts to and from JSON format.</div>
</dd>
<dt class="field">
<span class="method-title">Services_JSON</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON.html#methodServices_JSON">Services_JSON::Services_JSON()</a> in JSON.php</div>
<div class="index-item-description">constructs a new JSON instance</div>
</dd>
<dt class="field">
<span class="method-title">Services_JSON_AssocArray_TestCase</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_AssocArray_TestCase.html#methodServices_JSON_AssocArray_TestCase">Services_JSON_AssocArray_TestCase::Services_JSON_AssocArray_TestCase()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
Services_JSON_AssocArray_TestCase
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_AssocArray_TestCase.html">Services_JSON_AssocArray_TestCase</a> in Test-JSON.php</div>
</dd>
<dt class="field">
Services_JSON_Empties_TestCase
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_Empties_TestCase.html">Services_JSON_Empties_TestCase</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">Services_JSON_Empties_TestCase</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_Empties_TestCase.html#methodServices_JSON_Empties_TestCase">Services_JSON_Empties_TestCase::Services_JSON_Empties_TestCase()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">Services_JSON_EncDec_TestCase</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_EncDec_TestCase.html#methodServices_JSON_EncDec_TestCase">Services_JSON_EncDec_TestCase::Services_JSON_EncDec_TestCase()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
Services_JSON_EncDec_TestCase
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_EncDec_TestCase.html">Services_JSON_EncDec_TestCase</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">Services_JSON_Error</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_Error.html#methodServices_JSON_Error">Services_JSON_Error::Services_JSON_Error()</a> in JSON.php</div>
</dd>
<dt class="field">
Services_JSON_Error
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_Error.html">Services_JSON_Error</a> in JSON.php</div>
</dd>
<dt class="field">
Services_JSON_ErrorSuppression_TestCase
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_ErrorSuppression_TestCase.html">Services_JSON_ErrorSuppression_TestCase</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">Services_JSON_ErrorSuppression_TestCase</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_ErrorSuppression_TestCase.html#methodServices_JSON_ErrorSuppression_TestCase">Services_JSON_ErrorSuppression_TestCase::Services_JSON_ErrorSuppression_TestCase()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="const-title">SERVICES_JSON_IN_ARR</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/_JSON_php.html#defineSERVICES_JSON_IN_ARR">SERVICES_JSON_IN_ARR</a> in JSON.php</div>
<div class="index-item-description">Marker constant for Services_JSON::decode(), used to flag stack state</div>
</dd>
<dt class="field">
<span class="const-title">SERVICES_JSON_IN_CMT</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/_JSON_php.html#defineSERVICES_JSON_IN_CMT">SERVICES_JSON_IN_CMT</a> in JSON.php</div>
<div class="index-item-description">Marker constant for Services_JSON::decode(), used to flag stack state</div>
</dd>
<dt class="field">
<span class="const-title">SERVICES_JSON_IN_OBJ</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/_JSON_php.html#defineSERVICES_JSON_IN_OBJ">SERVICES_JSON_IN_OBJ</a> in JSON.php</div>
<div class="index-item-description">Marker constant for Services_JSON::decode(), used to flag stack state</div>
</dd>
<dt class="field">
<span class="const-title">SERVICES_JSON_IN_STR</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/_JSON_php.html#defineSERVICES_JSON_IN_STR">SERVICES_JSON_IN_STR</a> in JSON.php</div>
<div class="index-item-description">Marker constant for Services_JSON::decode(), used to flag stack state</div>
</dd>
<dt class="field">
<span class="const-title">SERVICES_JSON_LOOSE_TYPE</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/_JSON_php.html#defineSERVICES_JSON_LOOSE_TYPE">SERVICES_JSON_LOOSE_TYPE</a> in JSON.php</div>
<div class="index-item-description">Behavior switch for Services_JSON::decode()</div>
</dd>
<dt class="field">
<span class="method-title">Services_JSON_NestedArray_TestCase</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_NestedArray_TestCase.html#methodServices_JSON_NestedArray_TestCase">Services_JSON_NestedArray_TestCase::Services_JSON_NestedArray_TestCase()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
Services_JSON_NestedArray_TestCase
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_NestedArray_TestCase.html">Services_JSON_NestedArray_TestCase</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">Services_JSON_Object_TestCase</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_Object_TestCase.html#methodServices_JSON_Object_TestCase">Services_JSON_Object_TestCase::Services_JSON_Object_TestCase()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
Services_JSON_Object_TestCase
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_Object_TestCase.html">Services_JSON_Object_TestCase</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="const-title">SERVICES_JSON_SLICE</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/_JSON_php.html#defineSERVICES_JSON_SLICE">SERVICES_JSON_SLICE</a> in JSON.php</div>
<div class="index-item-description">Marker constant for Services_JSON::decode(), used to flag stack state</div>
</dd>
<dt class="field">
Services_JSON_Spaces_Comments_TestCase
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_Spaces_Comments_TestCase.html">Services_JSON_Spaces_Comments_TestCase</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">Services_JSON_Spaces_Comments_TestCase</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_Spaces_Comments_TestCase.html#methodServices_JSON_Spaces_Comments_TestCase">Services_JSON_Spaces_Comments_TestCase::Services_JSON_Spaces_Comments_TestCase()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="const-title">SERVICES_JSON_SUPPRESS_ERRORS</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/_JSON_php.html#defineSERVICES_JSON_SUPPRESS_ERRORS">SERVICES_JSON_SUPPRESS_ERRORS</a> in JSON.php</div>
<div class="index-item-description">Behavior switch for Services_JSON::decode()</div>
</dd>
<dt class="field">
Services_JSON_UnquotedKeys_TestCase
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_UnquotedKeys_TestCase.html">Services_JSON_UnquotedKeys_TestCase</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">Services_JSON_UnquotedKeys_TestCase</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_UnquotedKeys_TestCase.html#methodServices_JSON_UnquotedKeys_TestCase">Services_JSON_UnquotedKeys_TestCase::Services_JSON_UnquotedKeys_TestCase()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">setUp</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_UnquotedKeys_TestCase.html#methodsetUp">Services_JSON_UnquotedKeys_TestCase::setUp()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">setUp</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_Spaces_Comments_TestCase.html#methodsetUp">Services_JSON_Spaces_Comments_TestCase::setUp()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">setUp</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_Object_TestCase.html#methodsetUp">Services_JSON_Object_TestCase::setUp()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">setUp</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_Empties_TestCase.html#methodsetUp">Services_JSON_Empties_TestCase::setUp()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">setUp</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_AssocArray_TestCase.html#methodsetUp">Services_JSON_AssocArray_TestCase::setUp()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">setUp</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_NestedArray_TestCase.html#methodsetUp">Services_JSON_NestedArray_TestCase::setUp()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">setUp</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_EncDec_TestCase.html#methodsetUp">Services_JSON_EncDec_TestCase::setUp()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">setUp</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_ErrorSuppression_TestCase.html#methodsetUp">Services_JSON_ErrorSuppression_TestCase::setUp()</a> in Test-JSON.php</div>
</dd>
</dl>
<a name="t"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">t</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<span class="include-title">Test-JSON.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/_Test-JSON_php.html">Test-JSON.php</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">test_comments</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_Spaces_Comments_TestCase.html#methodtest_comments">Services_JSON_Spaces_Comments_TestCase::test_comments()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">test_from_JSON</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_EncDec_TestCase.html#methodtest_from_JSON">Services_JSON_EncDec_TestCase::test_from_JSON()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">test_from_JSON</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_UnquotedKeys_TestCase.html#methodtest_from_JSON">Services_JSON_UnquotedKeys_TestCase::test_from_JSON()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">test_from_JSON</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_NestedArray_TestCase.html#methodtest_from_JSON">Services_JSON_NestedArray_TestCase::test_from_JSON()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">test_from_then_to_JSON</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_Object_TestCase.html#methodtest_from_then_to_JSON">Services_JSON_Object_TestCase::test_from_then_to_JSON()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">test_from_then_to_JSON</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_EncDec_TestCase.html#methodtest_from_then_to_JSON">Services_JSON_EncDec_TestCase::test_from_then_to_JSON()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">test_spaces</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_Spaces_Comments_TestCase.html#methodtest_spaces">Services_JSON_Spaces_Comments_TestCase::test_spaces()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">test_to_JSON</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_Object_TestCase.html#methodtest_to_JSON">Services_JSON_Object_TestCase::test_to_JSON()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">test_to_JSON</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_ErrorSuppression_TestCase.html#methodtest_to_JSON">Services_JSON_ErrorSuppression_TestCase::test_to_JSON()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">test_to_JSON</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_EncDec_TestCase.html#methodtest_to_JSON">Services_JSON_EncDec_TestCase::test_to_JSON()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">test_to_JSON</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_AssocArray_TestCase.html#methodtest_to_JSON">Services_JSON_AssocArray_TestCase::test_to_JSON()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">test_to_JSON_suppressed</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_ErrorSuppression_TestCase.html#methodtest_to_JSON_suppressed">Services_JSON_ErrorSuppression_TestCase::test_to_JSON_suppressed()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">test_to_then_from_JSON</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_AssocArray_TestCase.html#methodtest_to_then_from_JSON">Services_JSON_AssocArray_TestCase::test_to_then_from_JSON()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">test_to_then_from_JSON</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_EncDec_TestCase.html#methodtest_to_then_from_JSON">Services_JSON_EncDec_TestCase::test_to_then_from_JSON()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">test_type</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_AssocArray_TestCase.html#methodtest_type">Services_JSON_AssocArray_TestCase::test_type()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">test_type</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_Empties_TestCase.html#methodtest_type">Services_JSON_Empties_TestCase::test_type()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">test_type</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_NestedArray_TestCase.html#methodtest_type">Services_JSON_NestedArray_TestCase::test_type()</a> in Test-JSON.php</div>
</dd>
<dt class="field">
<span class="method-title">test_type</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="Services_JSON/Services_JSON_Object_TestCase.html#methodtest_type">Services_JSON_Object_TestCase::test_type()</a> in Test-JSON.php</div>
</dd>
</dl>
 
<div class="index-letter-menu">
<a class="index-letter" href="elementindex_Services_JSON.html#d">d</a>
<a class="index-letter" href="elementindex_Services_JSON.html#e">e</a>
<a class="index-letter" href="elementindex_Services_JSON.html#i">i</a>
<a class="index-letter" href="elementindex_Services_JSON.html#j">j</a>
<a class="index-letter" href="elementindex_Services_JSON.html#s">s</a>
<a class="index-letter" href="elementindex_Services_JSON.html#t">t</a>
<a class="index-letter" href="elementindex_Services_JSON.html#_">_</a>
</div> </body>
</html>
Property changes:
Added: svn:mime-type
+text/html
\ No newline at end of property
/trunk/dependencies/jsonwrapper/JSON/doc/errors.html
0,0 → 1,51
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title>phpDocumentor Parser Errors and Warnings</title>
<link rel="stylesheet" href="media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<a href="#Post-parsing">Post-parsing</a><br>
<a href="#Test-JSON.php">Test-JSON.php</a><br>
<a name="Post-parsing"></a>
<h1>Post-parsing</h1>
<h2>Warnings:</h2><br>
<b>Warning</b> - Class Services_JSON_ErrorSuppression_TestCase parent PHPUnit_TestCase not found<br>
<b>Warning</b> - Class Services_JSON_Spaces_Comments_TestCase parent PHPUnit_TestCase not found<br>
<b>Warning</b> - Class Services_JSON_Empties_TestCase parent PHPUnit_TestCase not found<br>
<b>Warning</b> - Class Services_JSON_UnquotedKeys_TestCase parent PHPUnit_TestCase not found<br>
<b>Warning</b> - Class Services_JSON_Error parent PEAR_Error not found<br>
<b>Warning</b> - Class Services_JSON_AssocArray_TestCase parent PHPUnit_TestCase not found<br>
<b>Warning</b> - Class Services_JSON_EncDec_TestCase parent PHPUnit_TestCase not found<br>
<b>Warning</b> - Class Services_JSON_NestedArray_TestCase parent PHPUnit_TestCase not found<br>
<b>Warning</b> - Class Services_JSON_Object_TestCase parent PHPUnit_TestCase not found<br>
<a name="JSON.php"></a>
<h1>JSON.php</h1>
<h2>Warnings:</h2><br>
<b>Warning on line 115</b> - no @package tag was used in a DocBlock for class Services_JSON<br>
<b>Warning on line 781</b> - no @package tag was used in a DocBlock for class Services_JSON_Error<br>
<b>Warning on line 795</b> - no @package tag was used in a DocBlock for class Services_JSON_Error<br>
<b>Warning on line 795</b> -
duplicate class element "Services_JSON_Error" in file /Users/migurski/Sites/JSON-PHP/JSON.php will be ignored.
Use an @ignore tag on the original if you want this case to be documented.<br>
<a name="Test-JSON.php"></a>
<h1>Test-JSON.php</h1>
<h2>Warnings:</h2><br>
<b>Warning on line 19</b> - package default is already in category , will now replace with category <br>
<b>Warning on line 21</b> - Page-level DocBlock precedes "require_once Test-JSON.php", use another DocBlock to document the source element<br>
<b>Warning on line 24</b> - no @package tag was used in a DocBlock for class Services_JSON_EncDec_TestCase<br>
<b>Warning on line 156</b> - no @package tag was used in a DocBlock for class Services_JSON_AssocArray_TestCase<br>
<b>Warning on line 211</b> - no @package tag was used in a DocBlock for class Services_JSON_NestedArray_TestCase<br>
<b>Warning on line 288</b> - no @package tag was used in a DocBlock for class Services_JSON_Object_TestCase<br>
<b>Warning on line 327</b> - no @package tag was used in a DocBlock for class Services_JSON_Spaces_Comments_TestCase<br>
<b>Warning on line 363</b> - no @package tag was used in a DocBlock for class Services_JSON_Empties_TestCase<br>
<b>Warning on line 405</b> - no @package tag was used in a DocBlock for class Services_JSON_UnquotedKeys_TestCase<br>
<b>Warning on line 433</b> - no @package tag was used in a DocBlock for class Services_JSON_ErrorSuppression_TestCase<br>
<p class="notes" id="credit">
Documentation generated on Tue, 27 Jun 2006 22:54:27 -0700 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
</p>
</body>
</html>
Property changes:
Added: svn:mime-type
+text/html
\ No newline at end of property
/trunk/dependencies/jsonwrapper/JSON/doc/index.html
0,0 → 1,24
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//FR"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- Generated by phpDocumentor on Tue, 27 Jun 2006 22:54:25 -0700 -->
<title>Generated Documentation</title>
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
 
<FRAMESET rows='100,*'>
<FRAME src='packages.html' name='left_top' frameborder="1" bordercolor="#999999">
<FRAMESET cols='25%,*'>
<FRAME src='li_Services_JSON.html' name='left_bottom' frameborder="1" bordercolor="#999999">
<FRAME src='blank.html' name='right' frameborder="1" bordercolor="#999999">
</FRAMESET>
<NOFRAMES>
<H2>Frame Alert</H2>
<P>This document is designed to be viewed using the frames feature.
If you see this message, you are using a non-frame-capable web client.</P>
</NOFRAMES>
</FRAMESET>
</HTML>
Property changes:
Added: svn:mime-type
+text/html
\ No newline at end of property
/trunk/dependencies/jsonwrapper/JSON/doc/li_Services_JSON.html
0,0 → 1,45
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title></title>
<link rel="stylesheet" href="media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<div class="package-title">Services_JSON</div>
<div class="package-details">
 
<dl class="tree">
<dt class="folder-title">Description</dt>
<dd>
<a href='classtrees_Services_JSON.html' target='right'>Class trees</a><br />
<a href='elementindex_Services_JSON.html' target='right'>Index of elements</a><br />
<a href="todolist.html" target="right">Todo List</a><br />
</dd>
<dt class="folder-title">Classes</dt>
<dd><a href='Services_JSON/Services_JSON.html' target='right'>Services_JSON</a></dd>
<dd><a href='Services_JSON/Services_JSON_AssocArray_TestCase.html' target='right'>Services_JSON_AssocArray_TestCase</a></dd>
<dd><a href='Services_JSON/Services_JSON_Empties_TestCase.html' target='right'>Services_JSON_Empties_TestCase</a></dd>
<dd><a href='Services_JSON/Services_JSON_EncDec_TestCase.html' target='right'>Services_JSON_EncDec_TestCase</a></dd>
<dd><a href='Services_JSON/Services_JSON_Error.html' target='right'>Services_JSON_Error</a></dd>
<dd><a href='Services_JSON/Services_JSON_ErrorSuppression_TestCase.html' target='right'>Services_JSON_ErrorSuppression_TestCase</a></dd>
<dd><a href='Services_JSON/Services_JSON_NestedArray_TestCase.html' target='right'>Services_JSON_NestedArray_TestCase</a></dd>
<dd><a href='Services_JSON/Services_JSON_Object_TestCase.html' target='right'>Services_JSON_Object_TestCase</a></dd>
<dd><a href='Services_JSON/Services_JSON_Spaces_Comments_TestCase.html' target='right'>Services_JSON_Spaces_Comments_TestCase</a></dd>
<dd><a href='Services_JSON/Services_JSON_UnquotedKeys_TestCase.html' target='right'>Services_JSON_UnquotedKeys_TestCase</a></dd>
<dt class="folder-title">Files</dt>
<dd><a href='Services_JSON/_JSON_php.html' target='right'>JSON.php</a></dd>
<dd><a href='Services_JSON/_Test-JSON_php.html' target='right'>Test-JSON.php</a></dd>
</dl>
</div>
<p class="notes"><a href="http://www.phpdoc.org" target="_blank">phpDocumentor v <span class="field">1.2.3</span></a></p>
</BODY>
</HTML>
Property changes:
Added: svn:mime-type
+text/html
\ No newline at end of property
/trunk/dependencies/jsonwrapper/JSON/doc/media/banner.css
0,0 → 1,32
body
{
background-color: #CCCCFF;
margin: 0px;
padding: 0px;
}
 
/* Banner (top bar) classes */
 
.banner { }
 
.banner-menu
{
clear: both;
padding: .5em;
border-top: 2px solid #6666AA;
}
 
.banner-title
{
text-align: right;
font-size: 20pt;
font-weight: bold;
margin: .2em;
}
 
.package-selector
{
background-color: #AAAADD;
border: 1px solid black;
color: yellow;
}
Property changes:
Added: svn:mime-type
+text/css
\ No newline at end of property
/trunk/dependencies/jsonwrapper/JSON/doc/media/stylesheet.css
0,0 → 1,134
a { color: #336699; text-decoration: none; }
a:hover { color: #6699CC; text-decoration: underline; }
a:active { color: #6699CC; text-decoration: underline; }
 
body { background : #FFFFFF; }
body, table { font-family: Georgia, Times New Roman, Times, serif; font-size: 10pt }
p, li { line-height: 140% }
a img { border: 0px; }
dd { margin-left: 0px; padding-left: 1em; }
 
/* Page layout/boxes */
 
.info-box {}
.info-box-title { margin: 1em 0em 0em 0em; padding: .25em; font-weight: normal; font-size: 14pt; border: 2px solid #999999; background-color: #CCCCFF }
.info-box-body { border: 1px solid #999999; padding: .5em; }
.nav-bar { font-size: 8pt; white-space: nowrap; text-align: right; padding: .2em; margin: 0em 0em 1em 0em; }
 
.oddrow { background-color: #F8F8F8; border: 1px solid #AAAAAA; padding: .5em; margin-bottom: 1em}
.evenrow { border: 1px solid #AAAAAA; padding: .5em; margin-bottom: 1em}
 
.page-body { max-width: 800px; margin: auto; }
.tree dl { margin: 0px }
 
/* Index formatting classes */
 
.index-item-body { margin-top: .5em; margin-bottom: .5em}
.index-item-description { margin-top: .25em }
.index-item-details { font-weight: normal; font-style: italic; font-size: 8pt }
.index-letter-section { background-color: #EEEEEE; border: 1px dotted #999999; padding: .5em; margin-bottom: 1em}
.index-letter-title { font-size: 12pt; font-weight: bold }
.index-letter-menu { text-align: center; margin: 1em }
.index-letter { font-size: 12pt }
 
/* Docbook classes */
 
.description {}
.short-description { font-weight: bold; color: #666666; }
.tags { padding-left: 0em; margin-left: 3em; color: #666666; list-style-type: square; }
.parameters { padding-left: 0em; margin-left: 3em; font-style: italic; list-style-type: square; }
.redefinitions { font-size: 8pt; padding-left: 0em; margin-left: 2em; }
.package { }
.package-title { font-weight: bold; font-size: 14pt; border-bottom: 1px solid black }
.package-details { font-size: 85%; }
.sub-package { font-weight: bold; font-size: 120% }
.tutorial { border-width: thin; border-color: #0066ff }
.tutorial-nav-box { width: 100%; border: 1px solid #999999; background-color: #F8F8F8; }
.nav-button-disabled { color: #999999; }
.nav-button:active,
.nav-button:focus,
.nav-button:hover { background-color: #DDDDDD; outline: 1px solid #999999; text-decoration: none }
.folder-title { font-style: italic }
 
/* Generic formatting */
 
.field { font-weight: bold; }
.detail { font-size: 8pt; }
.notes { font-style: italic; font-size: 8pt; }
.separator { background-color: #999999; height: 2px; }
.warning { color: #FF6600; }
.disabled { font-style: italic; color: #999999; }
 
/* Code elements */
 
.line-number { }
 
.class-table { width: 100%; }
.class-table-header { border-bottom: 1px dotted #666666; text-align: left}
.class-name { color: #000000; font-weight: bold; }
 
.method-summary { padding-left: 1em; font-size: 8pt }
.method-header { }
.method-definition { margin-bottom: .3em }
.method-title { font-weight: bold; }
.method-name { font-weight: bold; }
.method-signature { font-size: 85%; color: #666666; margin: .5em 0em }
.method-result { font-style: italic; }
 
.var-summary { padding-left: 1em; font-size: 8pt; }
.var-header { }
.var-title { margin-bottom: .3em }
.var-type { font-style: italic; }
.var-name { font-weight: bold; }
.var-default {}
.var-description { font-weight: normal; color: #000000; }
 
.include-title { }
.include-type { font-style: italic; }
.include-name { font-weight: bold; }
 
.const-title { }
.const-name { font-weight: bold; }
 
/* Syntax highlighting */
 
.src-code { border: 1px solid #336699; padding: 1em; background-color: #EEEEEE; }
 
.src-comm { color: green; }
.src-id { }
.src-inc { color: #0000FF; }
.src-key { color: #0000FF; }
.src-num { color: #CC0000; }
.src-str { color: #66cccc; }
.src-sym { font-weight: bold; }
.src-var { }
 
.src-php { font-weight: bold; }
 
.src-doc { color: #009999 }
.src-doc-close-template { color: #0000FF }
.src-doc-coretag { color: #0099FF; font-weight: bold }
.src-doc-inlinetag { color: #0099FF }
.src-doc-internal { color: #6699cc }
.src-doc-tag { color: #0080CC }
.src-doc-template { color: #0000FF }
.src-doc-type { font-style: italic }
.src-doc-var { font-style: italic }
 
/* tutorial */
 
.authors { }
.author { font-style: italic; font-weight: bold }
.author-blurb { margin: .5em 0em .5em 2em; font-size: 85%; font-weight: normal; font-style: normal }
.example { border: 1px dashed #999999; background-color: #EEEEEE; padding: .5em }
.listing { border: 1px dashed #999999; background-color: #EEEEEE; padding: .5em; white-space: nowrap }
.release-info { font-size: 85%; font-style: italic; margin: 1em 0em }
.ref-title-box { }
.ref-title { }
.ref-purpose { font-style: italic; color: #666666 }
.ref-synopsis { }
.title { font-weight: bold; margin: 1em 0em 0em 0em; padding: .25em; border: 2px solid #999999; background-color: #CCCCFF }
.cmd-synopsis { margin: 1em 0em }
.cmd-title { font-weight: bold }
.toc { margin-left: 2em; padding-left: 0em }
 
Property changes:
Added: svn:mime-type
+text/css
\ No newline at end of property
/trunk/dependencies/jsonwrapper/JSON/doc/packages.html
0,0 → 1,27
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title></title>
<link rel="stylesheet" href="media/stylesheet.css" />
<link rel="stylesheet" href="media/banner.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<div class="banner">
<div class="banner-title">Services_JSON</div>
<div class="banner-menu">
<table cellpadding="0" cellspacing="0" style="width: 100%">
<tr>
<td>
</td>
<td style="width: 2em">&nbsp;</td>
<td style="text-align: right">
</td>
</tr>
</table>
</div>
</div>
</body>
</html>
Property changes:
Added: svn:mime-type
+text/html
\ No newline at end of property
/trunk/dependencies/jsonwrapper/JSON/doc/todolist.html
0,0 → 1,21
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title>Todo List</title>
<link rel="stylesheet" href="media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<div align="center"><h1>Todo List</h1></div>
<h2>Services_JSON</h2>
<h3><a href="Services_JSON/Services_JSON.html#methodisError">Services_JSON::isError()</a></h3>
<ul>
<li>Ultimately, this should just call PEAR::isError()</li>
</ul>
<p class="notes" id="credit">
Documentation generated on Tue, 27 Jun 2006 22:54:27 -0700 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
</p>
</body>
</html>
Property changes:
Added: svn:mime-type
+text/html
\ No newline at end of property
/trunk/dependencies/jsonwrapper/jsonwrapper.php
0,0 → 1,6
<?php
# In PHP 5.2 or higher we don't need to bring this in
if (!function_exists('json_encode')) {
require_once 'jsonwrapper_inner.php';
}
?>
/trunk/dependencies/jsonwrapper/jsonwrapper_inner.php
0,0 → 1,23
<?php
 
require_once 'JSON/JSON.php';
 
function json_encode($arg)
{
global $services_json;
if (!isset($services_json)) {
$services_json = new Services_JSON();
}
return $services_json->encode($arg);
}
 
function json_decode($arg)
{
global $services_json;
if (!isset($services_json)) {
$services_json = new Services_JSON();
}
return $services_json->decode($arg);
}
 
?>
/trunk/dependencies/sajax/Changes.txt
0,0 → 1,69
SAJAX CHANGELOG
---------------
 
Sajax version 0.13 (August 26, 2009)
 
* [php] Use php native json_encode for serilization of responce data.
* [php] use of JSON.parse on client side for better speed and security.
* [php] per function GET/POST
* [php] Autoselect POST if request is to large data for GET
* [php] Synchronous mode
* [php] gratly improved error handeling on both client and server side
* [php] Support for utf-8 and international charectors
* [php] Better handeling of IE (no more warnings in IE7+)
* [cf] Updated to match the PHP implementation.
 
Sajax version 0.12 (January 30, 2006)
 
* [php] Numerous improvements to serialization, support for varied PHP
setups, addition of sajax_cancel().
* [asp] Removed due to serious bugs
 
Sajax version 0.11 () Unreleased beta.
 
Sajax version 0.10 (March 21, 2005)
 
* [php] Support for POST instead of just GET. Set $sajax_request_type.
Based on code from Folletto Malefico, to whom I owe thanks.
POST mode should be used if you are sending long requests (more
than 512 bytes) or if you are modifying data with the request.
* [php] (untested) Support for GET/POST to pages other than $REQUEST_URI.
Set $sajax_remote_uri to the desired URL to get this behavior.
* [php] Small fixes to the Wall example, thanks to Leonardo Lorieri
and Jesse Sightler.
* [cf] Cold Fusion MX support (Thanks Eric Moritz)
* [asp] ASP support (Thanks Jared Nuzzolillo)
* [python] Improvements to the Python backend from Adam Collard
 
Sajax version 0.9 (March 15, 2005)
 
* [php] Major changes to the PHP backend:
* [php] Renamed incl_sajax.php to Sajax.php to fit PEAR and other language
naming conventions
* [php] Functions and vars previously named rs_* are now sajax_*
* [php] Function stubs all call one generalized sajax_do_call() dispatcher
* [php] Added non-echoing version of sajax_echo_javascript() called
sajax_get_javascript via the magic of output buffering
* [php] Changed all examples to support new framework
* [perl] Applied fix for URL encoding of space (Thanks Max Maischein)
* [ruby] Added Ruby backend contributed by anonymous author
* [io] Added Io (http://www.iolanguage.com/) backend by Sajax team @ MM
 
Sajax version 0.8 (March 9, 2005)
 
* [php] Bug in the long-open-tags changes. Thanks to Matthew M. Vince.
* [lua] Backend port added. Thanks to Javier Guerra.
 
Sajax version 0.7 (March 9, 2005)
 
* [php] Major bug calling remote functions without args.
 
Sajax version 0.6 (March 8, 2005)
 
* Layout of archive changed; base folder changed; subfolders added for backends
* [php] Used short open tags by default. Thanks to Matthew M. Vince.
* [perl] Backend port added. Thanks to Nathan Schmidt, Jason Purdy and Nate
Mueller.
* [python] Backend port added. Thanks to Adam Collard. Please note that
this port is licensed under the Creative Commons "By" License version
2.0.
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/trunk/dependencies/sajax/Known issues.txt
0,0 → 1,13
iCab 3.0.5 will fail badly when using json_parse_state and receving large stings.
 
IE 5.01 will fail nicly when using json_parse.
 
Safari 1.2 will send malformed data when using json2.stringify and sending numberes as strings.
 
Prototype 1.5.1 and later, 1.6.0.3 is the latest at this point, breaks firefox's JSON.stringify(), a workaround for this is to use the methode provided by Prototype instead, to this, include the folowing code just after you load prototype.js
<script type="text/javascript"><!--
var JSON = JSON || {};
JSON.stringify = function(value) { return value.toJSON(); };
JSON.parse = JSON.parse || function(jsonsring) { return jsonsring.evalJSON(true); };
//-->
</script>
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/trunk/dependencies/sajax/Old browsers.txt
0,0 → 1,10
Mozila 0.6 - 0.9.2 might be posible to geat to work but may requre major rewrite as it does not support x.readyState or x.onreadystatechange and probably othere parts of XMLHttpRequest, an alternative would be using iframe's. Also JSON.stringify() seams to fail for it.
 
 
IE 4 is also posible but it requres removing all try{} catch(e) {} from the code, only using 'Microsoft.XMLHTTP' for IE6, IE5.5, IE5 and IE4 and having less error handeling. and might break support for othere browsers and or functionality. In addition I think it would requre some special case of installed updates on the client end. If you do get it to work feel free to end us the code and we will include it in this file for the next version of Sajax.
 
 
iCab 3.0 - 3.0.4 are untested, please report your results.
 
 
Google Chrom is untested except for 2.0.172.39
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/trunk/dependencies/sajax/Readme.txt
0,0 → 1,27
WELCOME TO SAJAX
----------------
 
Sajax is a cross-platform, cross-browser web scripting toolkit
that makes it easy to expose functions in your code to JavaScript.
 
For more information about Sajax, please see the homepage:
 
http://sajax.info/
 
In this archive you will find a folder for each platform that is
currently supported. Please see individual documentation in each
folder for specific errata.
 
 
 
As of 0.13 a JavaScript implementation of JSON.stringify() has
become a requirement when sending data for browsers that does not
have this nativly (IE8 or FF3.5). JSON2 from
http://www.json.org/js.html has been included for this reason.
 
It is highly recomented to also include a JSON.parse()
implementation for better security for the client, especialy when
handeling data from othere sites, json.parse.js is the
implementation from JSON2, unfortunatly this breaks Safari 1.3.2
json_parse_state.js seams to be the most compatible but
json_parse.js might also be worth checking out.
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/trunk/dependencies/sajax/Todo.txt
0,0 → 1,24
SAJAX TO DO LIST
----------------
* Fix http://www.modernmethod.com/sajax/forum/viewtopic.php?p=308
* Make the whole darn thing an object
* Add J2EE module
* Apply Julien Grossiord's port non-80 patch.
* Apply Steve Smith (ND)'s ColdFusion POST patch.
* Better whitespace handling
* Test if a function exists before allowing you to export it
* Add Kae's IFRAME patch.
* Add C# support.
* Update othere backends to match php in 0.13.
 
THINGS THAT WERE TO DO AND ARE NOW TO DONE
------------------------------------------
* All-numeric array indices -> JS array, not object.
* Encode/serialize array elements
* Return false if the object could not be created.
* Support for "options" such as post-to-an-ID and POST/GET submit.
* Added sajax_set_remote_url or something along those lines instead of
$REQUEST_URI
* Support POST
* Add CFML, ASP.Net
* Fix Perl module (with the contributed code)
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/trunk/dependencies/sajax/asp/Readme.txt
0,0 → 1,3
ASP support has been temporarily removed due to bugs. It will be back soon.
 
- tlack
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/trunk/dependencies/sajax/asp/example_multiply.asp
0,0 → 1,77
<%@ Language=JScript %>
<!--#include file="sajax.asp"-->
 
<%
function multiply(x, y) {
return x * y;
}
function add(x, y, z) {
return x + y + z;
}
sajax = new Sajax();
// sajax.debug_mode = true;
sajax.export_function("multiply","add");
sajax.handle_client_request();
 
%>
<html>
<head>
<title>Multiplier</title>
<script>
<%
sajax.show_javascript();
%>
function do_multiply_cb(z) {
document.getElementById("z").value = z;
}
function do_multiply() {
// get the folder name
var x, y;
x = document.getElementById("x").value;
y = document.getElementById("y").value;
x_multiply(x, y, do_multiply_cb);
}
function do_add_cb(z) {
document.getElementById("zza").value = z;
}
 
function do_add() {
// get the folder name
var x, y, z;
x = "'"+document.getElementById("xa").value+"'";
y = "'"+document.getElementById("ya").value+"'";
z = "'"+document.getElementById("za").value+"'";
x_add(x, y, z, do_add_cb);
}
</script>
</head>
<body>
<input type="text" name="x" id="x" value="2" size="3">
*
<input type="text" name="y" id="y" value="3" size="3">
=
<input type="text" name="z" id="z" value="" size="3">
<input type="button" name="check" value="Calculate"
onclick="do_multiply(); return false;">
<br>
try adding some strings, eg:
<input type="text" name="xa" id="xa" value="ex " size="3">
+
<input type="text" name="ya" id="ya" value="nihil, " size="3">
+
<input type="text" name="za" id="za" value="nihil fit" size="3">
=
<input type="text" name="zza" id="zza" value="" size="15">
<input type="button" name="check" value="Calculate"
onclick="do_add(); return false;">
</body>
</html>
/trunk/dependencies/sajax/asp/sajax.asp
0,0 → 1,186
<%
 
function r(str)
{
Response.write("<br>-"+str+"-<br>")
}
 
function Sajax(debug_mode)
{
this.debug_mode = debug_mode||false;
this.export_list = [];
this.js_has_been_shown = false;
this.handle_client_request = function()
{
func_name = Request.QueryString("rs");
if(!func_name||String(func_name)=="undefined") return false
//bust cache
Response.AddHeader("Expires", "Mon, 26 Jul 1997 05:00:00 GMT")
//always modified
Response.AddHeader("Last-Modified", new Date().toGMTString().replace(/UTC/,"GMT"))
//HTTP/1.1
Response.AddHeader("Cache-Control", "no-cache, must-revalidate")
//HTTP/1.0
Response.AddHeader("Pragma", "no-cache")
if(this.export_list[func_name]=="undefined")
{
result = "-"+func_name+" is not callable";
//if(this.debug_mode) Response.write("-"+func_name+" is not callable");
}
else
{
rsargs_raw = Request.QueryString("rsargs[]")
 
rsargs = []
for(rs_i=1;rs_i<=rsargs_raw.Count;rs_i++)
{
rsargs[rs_i-1]=rsargs_raw(rs_i)
}
 
// if(this.debug_mode) Response.write("calling " + func_name + "(" +
// rsargs.join(",")+")")
eval_str = this.export_list[func_name]+"("+rsargs+")"
try
{
result = "+"+eval(eval_str);
}
catch(e)
{
result = "-"+e.message+" (x_"+eval_str+")";
}
}
Response.write(result+"[sajax_result________end]]")
//exit()
}
this.show_common_js = function()
{
js_debug_mode = this.debug_mode
js_string_out = " // remote scripting library\n" +
" // (c) copyright 2005 modernmethod, inc\n" +
" var rs_debug_mode = "+js_debug_mode+";\n" +
" var rs_obj = false;\n" +
" var rs_callback = false;\n" +
" \n" +
" function rs_debug(text) {\n" +
" if (rs_debug_mode)\n" +
" alert('RSD: ' + text)\n" +
" }\n" +
" \n" +
" function rs_init_object() {\n" +
" rs_debug('rs_init_object() called..')\n" +
" \n" +
" var A;\n" +
" try {\n" +
" A=new ActiveXObject('Msxml2.XMLHTTP');\n" +
" } catch (e) {\n" +
" try {\n" +
" A=new ActiveXObject('Microsoft.XMLHTTP');\n" +
" } catch (oc) {\n" +
" A=null;\n" +
" }\n" +
" }\n" +
" if(!A && typeof XMLHttpRequest != 'undefined')\n" +
" A = new XMLHttpRequest();\n" +
" if (!A)\n" +
" rs_debug('Could not create connection object.');\n" +
" return A;\n" +
" }\n"
 
Response.write(js_string_out)
}
 
this.rs_esc=function(val)
{
}
this.export_function = function()
{
for(var i=0;i<arguments.length;i++)
{
this.export_list[arguments[i]] = arguments[i];
}
}
this.show_javascript = function()
{
if(!this.js_has_been_shown)
{
this.show_common_js()
this.js_has_been_shown = true
}
for(func_name in this.export_list)
{
this.show_one(func_name);
}
}
this.rs_esc = function(val)
{
var dqex = /\"/g //"
return val.replace(dqex, '\\\\"')
}
this.show_one=function(func_name)
{
var svr, srl, qsr;
svr = Request.ServerVariables("SERVER_NAME")
srl = Request.ServerVariables("URL")
qsr = Request.ServerVariables("QUERY_STRING");
uri = svr + srl + qsr;
 
if(!(uri.indexOf('?')>-1))
{
uri += "?rs=" + escape(func_name)
}
else
{
uri += "&rs=" + escape(func_name)
}
 
escapeduri = this.rs_esc(uri)
js_string_out = " // wrapper for "+func_name+"\n" +
" function x_"+func_name+"(){\n" +
" // count args; build URL\n" +
" var i, x, n;\n" +
" //var url = 'http://"+escapeduri+"', a = x_"+func_name+".arguments;\n" +
" url = 'http://"+escapeduri+"', a = x_"+func_name+".arguments;\n" +
" for (i = 0; i < a.length-1; i++)\n" +
" url = url + '&rsargs[]=' + escape(a[i]);\n" +
" x = rs_init_object();\n" +
" x.open('GET', url, true);\n" +
" x.onreadystatechange = function() {\n" +
" if (x.readyState != 4)\n" +
" return;\n" +
" rs_debug('received ' + x.responseText);\n" +
" \n" +
" var status;\n" +
" var data;\n" +
" status = x.responseText.charAt(0);\n" +
" data = x.responseText;\n" +
" var pos = data.indexOf('[sajax_result________end]]');\n " +
" if (status == '-'){\n" +
" if("+this.debug_mode+"){alert('Error: ' + data.substring(1,pos));}}\n" +
" else \n" +
" a[a.length-1](data.substring(1,pos));\n" +
" }\n" +
" x.send(null);\n" +
" rs_debug('x_"+func_name+" url = ' + url);\n" +
" rs_debug('x_"+func_name+" waiting..');\n" +
" }\n"
Response.write(js_string_out)
}
}
%>
/trunk/dependencies/sajax/coldfusion/Readme.txt
0,0 → 1,4
SAJAX COLDFUSION MX BACKEND
---------------------------
 
Contributed by Eric Moritz <eric.moritz@gmail.com>. Maintained by Steve Smith <steve@orderedlist.com> and Anders Jenbo <anders@jenbo.dk>
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/trunk/dependencies/sajax/coldfusion/example_multiply.cfm
0,0 → 1,48
<cfinclude template="sajax.cfm">
<cfscript>
function multiply(x, y) {
return x * y;
}
// sajax_debug_mode = true;
sajax_failure_redirect = "http://sajax.info/sajaxfail.html";
sajax_export("multiply");
sajax_handle_client_request();
</cfscript>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sajax Multiplier example</title>
<script type="text/javascript" src="json2.stringify.js"></script>
<script type="text/javascript" src="json_stringify.js"></script>
<script type="text/javascript" src="json_parse_state.js"></script>
<script type="text/javascript" src="sajax.js"></script>
<script type="text/javascript"><!--
<cfscript>sajax_show_javascript();</cfscript>
function do_multiply_cb(z) {
document.getElementById("z").value = z;
}
function do_multiply() {
// get the folder name
var x, y;
x = parseFloat(document.getElementById("x").value);
y = parseFloat(document.getElementById("y").value);
x_multiply(x, y, do_multiply_cb);
}
//-->
</script>
</head>
<body>
<input type="text" name="x" id="x" value="2" size="3" />
*
<input type="text" name="y" id="y" value="3" size="3" />
=
<input type="text" name="z" id="z" value="" size="3" />
<input type="button" name="check" value="Calculate" onclick="do_multiply(); return false;" />
</body>
</html>
/trunk/dependencies/sajax/coldfusion/example_options.cfm
0,0 → 1,100
<cfinclude template="sajax.cfm">
<cfscript>
function test_get() {
return test();
}
function test_post() {
return test();
}
function test() {
s = "URI: example_options.cfm";
s = "#s#
-- GET --
";
if(isdefined("URL.rsargs"))
s = "#s##URL.rsargs#";
s = "#s#
 
-- POST --
";
if(isdefined("FORM.rsargs"))
s = "#s##FORM.rsargs#";
return s;
}
function get_the_time() {
return "#DateFormat(now(),"yyyy-mm-dd ")##TimeFormat(now() ,"HH:mm:ss")#";
}
function pause(sec) {
thread = CreateObject("java", "java.lang.Thread");
thread.sleep(sec*1000);
}
 
// $sajax_debug_mode = true;
 
//GET functions
sajax_request_type = "GET";
sajax_export("test_get", "get_the_time", "test", "otherefucntion2");
//POST functions
sajax_request_type = "POST";
sajax_export("test_post");
 
//synchronous GET functions
sajax_request_type = "GET";
sajax_request_asynchronous = "false";
sajax_export("pause");
 
//GET functions from a different uri
sajax_request_type = "GET";
sajax_remote_uri = "example_otheruri.cfm";
sajax_export("otherefucntion");
sajax_handle_client_request();
</cfscript>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Example of Sajax Options</title>
<script type="text/javascript" src="json2.stringify.js"></script>
<script type="text/javascript" src="json_stringify.js"></script>
<script type="text/javascript" src="json_parse_state.js"></script>
<script type="text/javascript" src="sajax.js"></script>
<script type="text/javascript"><!--
<cfscript>sajax_show_javascript();</cfscript>
function print_result(v) {
alert(v);
}
//-->
</script>
</head>
<body>
<!-- Testing if the browser supports GET -->
<button onclick="x_test_get(1, 2, 3, print_result);">Test GET</button>
 
<!-- Testing if the browser supports POST -->
<button onclick="x_test_post(1, 2, 3, print_result);">Test POST</button>
 
<!-- Forcing the function to POST -->
<button onclick="sajax_request_type ='POST'; x_test(1, 2, 3, print_result); sajax_request_type ='';">Test force POST</button>
 
<!-- if sajax_target_id is set, the sesponce will be inserted as HTML in an element with sajax_target_id for id-->
<button onclick="sajax_target_id = 'time'; x_get_the_time(); sajax_target_id = '';">Test updating IDs</button>
 
<!-- Calling a synchronous will cause the script to wait for the responce -->
<button onclick="x_pause(3, function(){}); alert('Link was clicked!');">Test synchronous</button>
 
<!-- Different URI set at config -->
<button onclick="x_otherefucntion(print_result);">Call to other uri.</button>
 
<!-- Forece different URI at runtime -->
<button onclick="sajax_remote_uri = 'example_otheruri.cfm'; x_otherefucntion2(print_result); sajax_remote_uri = '';">Force call to other uri.</button>
<div id="time"><em>Time will appear here</em></div>
</body>
</html>
/trunk/dependencies/sajax/coldfusion/example_otheruri.cfm
0,0 → 1,15
<cfinclude template="sajax.cfm">
<cfscript>
function otherefucntion() {
return "URI: example_otheruri.cfm";
}
function otherefucntion2() {
return otherefucntion();
}
//allowed functions
sajax_export("otherefucntion", "otherefucntion2");
sajax_handle_client_request();
</cfscript>
/trunk/dependencies/sajax/coldfusion/example_types.cfm
0,0 → 1,75
<cfinclude template="sajax.cfm">
<cfscript>
bday = "9/5/1983";
age = DateFormat(now(), "yyyy")-DateFormat(bday, "yyyy")-(DateFormat(bday, "m.dd")-DateFormat(now(), "m.dd"))/10;
function return_struct() {
struct = structNew();
struct["name"] = "Anders";
struct["age"] = age;
return struct;
}
function return_list() {
list = "";
list = listappend(list, "Anders");
list = listappend(list, age);
return list;
}
function return_float() {
return age;
}
function return_int() {
return int(age);
}
function return_string() {
return "Anders is #int(age)# years old.";
}
sajax_request_type = "GET";
// sajax_debug_mode = true;
sajax_export("return_struct", "return_list", "return_int", "return_float", "return_string");
sajax_handle_client_request();
</cfscript>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Sajax ColdFusion return types example</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="json2.stringify.js"></script>
<script type="text/javascript" src="json_stringify.js"></script>
<script type="text/javascript" src="json_parse_state.js"></script>
<script type="text/javascript" src="sajax.js"></script>
<script type="text/javascript"><!--
<cfscript>sajax_show_javascript();</cfscript>
function display_result(val) {
var repr;
repr = "";
repr += "Type: " + typeof val + "\n";
repr += "Value: ";
if (typeof val == "object" ||
typeof val == "array") {
repr += "{ ";
for (var i in val)
repr += i + ": " + val[i] + ", ";
repr = repr.substr(0, repr.length-2) + " }";
} else {
repr += val;
}
alert(repr);
}
//-->
</script>
</head>
<body>
<button onclick="x_return_struct(display_result);">Return as struct (will become an object)</button>
<button onclick="x_return_list(display_result);">Return as list (will become a string)</button>
<button onclick="x_return_int(display_result);">Return as int</button>
<button onclick="x_return_float(display_result);">Return as float/double</button>
<button onclick="x_return_string(display_result);">Return as string</button>
</body>
</html>
/trunk/dependencies/sajax/coldfusion/json2.parse.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/sajax/coldfusion/json2.stringify.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/sajax/coldfusion/json_parse.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/sajax/coldfusion/json_parse_state.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/sajax/coldfusion/json_stringify.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/sajax/coldfusion/sajax.cfm
0,0 → 1,148
<cfsilent>
 
<cfset sajax_version = "0.13">
<cfset sajax_debug_mode = false>
<cfset sajax_export_array = arraynew(1)>
<cfset sajax_export_list = "">
<cfset sajax_method_list = "">
<cfset sajax_asynchronous_list = "">
<cfset sajax_uri_list = "">
<cfset sajax_remote_uri = "">
<cfset sajax_failure_redirect = "">
<cfset sajax_request_type = "GET">
<cfset sajax_request_asynchronous = "true">
 
<!--- Always call server if this is a Sajax GET call --->
<cfif isdefined("URL.rs")>
<cfheader name="Cache-Control" value="max-age=0, must-revalidate">
<cfheader name="Pragma" value="no-cache">
</cfif>
 
<!--- emulate the php exit keyword --->
<cffunction name="exit">
<cfabort>
</cffunction>
 
<cffunction name="sajax_handle_client_request">
<cftry>
<cfsavecontent variable="output">
<cfscript>
if(not isdefined("URL.rs") and not isdefined("FORM.rs"))
return;
if(isdefined("URL.rs")) {
func_name = URL.rs;
if(isdefined("URL.rsargs"))
args = URL.rsargs;
} else {
func_name = FORM.rs;
if(isdefined("FORM.rsargs"))
args = FORM.rsargs;
}
if(isdefined("args")) {
args = DeserializeJSON(args);
} else {
args = arraynew(1);
}
if(not ListFindNoCase(sajax_export_list, func_name)) {
error = "#func_name# not callable";
} else {
result = SerializeJSON(call_user_func_array(func_name, args));
}
</cfscript>
</cfsavecontent>
<cfcatch>
<cfheader name="Content-Type" value="text/plain; charset=UTF-8">
<cfoutput>-:#cfcatch.type#
#cfcatch.message#
#cfcatch.detail#
<cfif arraylen(cfcatch.tagcontext) gt 0>
in #cfcatch.tagcontext[1].template# at #cfcatch.tagcontext[1].line#
</cfif>
</cfoutput>
<cfabort>
</cfcatch>
</cftry>
<cfheader name="Content-Type" value="text/plain; charset=UTF-8">
<cfscript>
//Remove start and end white space from output
output = REReplace(output,"^\s*|\s*$","","ALL");
if(isdefined("result") and "#output#" eq "")
writeoutput("+:#result#");
else if("#output#" eq "")
writeoutput("-:#error#");
else
writeoutput("-:#output#");
exit();
</cfscript>
</cffunction>
 
<cfscript>
sajax_js_has_been_shown = false;
function sajax_show_javascript()
{
 
if (not sajax_js_has_been_shown) {
writeoutput("
sajax_debug_mode = #iif(sajax_debug_mode, 'true', 'false')#;
sajax_failure_redirect = ""#sajax_failure_redirect#"";
");
//TODO get from an array instead of list
size = listlen(sajax_export_list);
for(i = 1; i lte size; i=i+1) {
name = listgetat(sajax_export_list, i);
method = listgetat(sajax_method_list, i);
asynchronous = listgetat(sajax_asynchronous_list, i);
uri = listgetat(sajax_uri_list, i);
if(uri == "##")
uri = "";
writeoutput("
function x_#name#() {
return sajax_do_call(""#name#"", arguments, ""#method#"", #asynchronous#, ""#uri#"");
}");
}
sajax_js_has_been_shown = true;
}
}
function sajax_export() {
//TODO make it a multi dimentional array of options
//TODO prevent multiple instances of the same functions
//if(not isarray(function))
var keys = structkeylist(arguments);
var size = listlen(keys);
var key = "";
for(i=1; i lte size;i=i+1) {
key = listgetat(keys, i);
sajax_export_list = listappend(sajax_export_list, arguments[key]);
sajax_method_list = listappend(sajax_method_list, sajax_request_type);
sajax_asynchronous_list = listappend(sajax_asynchronous_list, sajax_request_asynchronous);
if(sajax_remote_uri == "")
sajax_remote_uri = "##";
sajax_uri_list = listappend(sajax_uri_list, sajax_remote_uri);
if(sajax_remote_uri == "##")
sajax_remote_uri = "";
}
}
function call_user_func_array(user_func, arg_array) {
//TODO test with multi dimentional arrays
var func_call = "";
var func_args = "";
var size = ArrayLen(arg_array);
/* Loop though each of the args */
for(i=1; i lte size; i = i + 1) {
func_args = func_args & "arg_array[#i#]";
if(i lt size)
func_args = func_args & ",";
}
return evaluate("#user_func#(#func_args#)");
}
SAJAX_INCLUDED = 1;
</cfscript>
</cfsilent>
/trunk/dependencies/sajax/coldfusion/sajax.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/sajax/io/Sajax.io
0,0 → 1,203
//
// Sajax Io Backend
// (C) Copyright 2005 ModernMethod, Inc.
// Released under BSD license
//
 
String interpolate := method(
work := self clone
last_idx := 0
while (1,
idx := work find("<?io", last_idx)
if (idx == Nil,
// no more interps..
break)
idx := idx + 3
end_idx := work find("?>", idx + 1)
if (end_idx == Nil,
// invalid interp expression.. we're done.
break)
// in the case of an empty interpolated expression,
// lets move on
if (end_idx - idx == 1,
continue)
// otherwise proceed with replacement.
slotName := work substring(idx+1, end_idx)
find_str := "<?io" .. slotName .. "?>"
// write("doString(" .. slotName .. ")")
replace_str := sender doString(slotName)
work := work replace(find_str, replace_str)
last_idx = end_idx + 1
)
return work
)
 
Sajax := Object clone do (
 
debug_mode := 0
export_list := List clone
js_has_been_shown := Nil
init := method(
return self
)
handle_client_request := method(
if (my_getenv("QUERY_STRING") == Nil,
return
)
form := CGI clone parse
if (form hasKey("rs") == Nil,
return
)
 
write("Content-type: text/html\n");
write("Expires: Mon, 26 Jul 1997 05:00:00 GMT\n");
write("Cache-Control: no-cache, must-revalidate\n");
write("Pragma: no-cache\n\n");
func_name := form at("rs")
if (export_list contains(func_name) == Nil) then (
write("-:$func_name not callable\n")
) else (
write("+:")
args := form at("rsargs[]")
result := sender performWithArgList(func_name, args)
write(result)
)
exit;
}
show_common_js := method(
if (debug_mode == 1,
debugModeTrueFalse := "true",
debugModeTrueFalse := "false")
html := """
 
// remote scripting library
// (c) copyright 2005 modernmethod, inc
var rs_debug_mode = <?io debugModeTrueFalse ?>;
function rs_debug(text) {
if (rs_debug_mode)
alert("RSD: " + text)
}
function rs_init_object() {
rs_debug("rs_init_object() called..")
var A;
try {
A=new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
A=new ActiveXObject("Microsoft.XMLHTTP");
} catch (oc) {
A=null;
}
}
if(!A && typeof XMLHttpRequest != "undefined")
A = new XMLHttpRequest();
if (!A)
rs_debug("Could not create connection object.");
return A;
}
"""
write(html interpolate)
}
esc := method(val,
return val replace("\"", "\\\\\"");
)
my_getenv := method(val,
my_get := Nil
if (?System) then (
my_get := System getSlot("getenv")
) else (
my_get := Object getSlot("getenv")
)
return my_get(val)
)
get_my_uri := method(
uri := "http://www.example.com/"
if (my_getenv("REQUEST_URI") != Nil) then (
uri := my_getenv("REQUEST_URI")
) else (
if (my_getenv("SCRIPT_NAME") != Nil) then (
uri := my_getenv("SCRIPT_NAME")
if (my_getenv("QUERY_STRING") != Nil) then (
uri := uri .. "?" .. my_getenv("QUERY_STRING")
)
)
)
return uri
)
 
show_one := method(func_name,
uri := get_my_uri
func_name_encoded := CGI encodeUrlParam(func_name)
if (uri contains("?") == Nil) then (
uri = uri .. "?rs=" .. func_name_encoded
) else (
uri = uri .. "&rs=" .. func_name_encoded
)
html := """
// wrapper for <?io func_name ?>
function x_<?io func_name ?>() {
// count args; build URL
var i, x, n;
var url = "<?io esc(uri) ?>";
var a = x_<?io func_name ?>.arguments;
for (i = 0; i < a.length-1; i++)
url = url + "&rsargs[]=" + escape(a[i]);
url = url + "&rsrnd=" + new Date().getTime();
x = rs_init_object();
x.open("GET", url, true);
x.onreadystatechange = function() {
if (x.readyState != 4)
return;
rs_debug("received " + x.responseText);
var status;
var data;
status = x.responseText.charAt(0);
data = x.responseText.substring(2);
if (status == "-")
alert("Error: " + callback_n);
else
a[a.length-1](data);
}
x.send(null);
rs_debug("x_<?io func_name ?> url = " + url);
rs_debug("x_<?io func_name ?> waiting..");
delete x;
}
"""
write(html interpolate)
)
 
export := method(func,
export_list add(func)
}
show_javascript := method(
if (js_has_been_shown == Nil,
show_common_js
)
export_list foreach(index, func_name,
show_one(func_name)
)
)
)
 
/trunk/dependencies/sajax/io/example_multiply.io
0,0 → 1,53
#!/usr/bin/env ioServer
 
c := CGI clone
 
multiply := method(x, y,
x := x asNumber
y := y asNumber
return x * y
)
 
s := Sajax clone
s debug_mode := 1
s init
s export("multiply")
s handle_client_request
 
write("Content-type: text/html\n\n")
 
html := """
<html>
<head>
<title>Multiplier</title>
<script>"""
write(html)
s show_javascript
html := """
function do_multiply_cb(z) {
document.getElementById("z").value = z;
}
function do_multiply() {
// get the folder name
var x, y;
x = document.getElementById("x").value;
y = document.getElementById("y").value;
x_multiply(x, y, do_multiply_cb);
}
</script>
</head>
<body>
<input type="text" name="x" id="x" value="2" size="3">
*
<input type="text" name="y" id="y" value="3" size="3">
=
<input type="text" name="z" id="z" value="" size="3">
<input type="button" name="check" value="Calculate"
onclick="do_multiply(); return false;">
</body>
</html>
"""
write(html)
/trunk/dependencies/sajax/lua/Readme.txt
0,0 → 1,6
SAJAX LUA BACKEND
-----------------
 
Contributed and copyighted by Javier Guerra (http://www.guerrag.com/).
 
 
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/trunk/dependencies/sajax/lua/calculator.lp
0,0 → 1,46
<%
require "sajax"
function multiply(x, y)
return x * y
end
sajax.init()
-- $rs_debug_mode = 1;
sajax.export ("multiply", multiply)
if sajax.handle_client_request () then return end
%><html>
<head>
<title>Multiplier</title>
<script>
<%
sajax.show_javascript();
%>
function do_multiply_cb(z) {
document.getElementById("z").value = z;
}
function do_multiply() {
// get the folder name
var x, y;
x = document.getElementById("x").value;
y = document.getElementById("y").value;
x_multiply(x, y, do_multiply_cb);
}
</script>
</head>
<body>
<input type="text" name="x" id="x" value="2" size="3">
*
<input type="text" name="y" id="y" value="3" size="3">
=
<input type="text" name="z" id="z" value="" size="3">
<input type="button" name="check" value="Calculate"
onclick="do_multiply(); return false;">
</body>
</html>
/trunk/dependencies/sajax/lua/sajax.lua
0,0 → 1,135
module ("sajax")
 
local export_list = {}
local request_uri = ""
 
function init ()
end
 
function handle_client_request ()
 
if not cgi.rs then return end
-- Bust cache in the head
cgilua.header ("Expires", "Mon, 26 Jul 1997 05:00:00 GMT") -- Date in the past
cgilua.header ("Last-Modified", os.date ("!%a, %d %b %Y %H:%M:%S GMT"))
-- always modified
cgilua.header ("Cache-Control", "no-cache, must-revalidate") -- HTTP/1.1
cgilua.header ("Pragma", "no-cache") -- HTTP/1.0
local funcname = cgi.rs
if not export_list[funcname] then
cgilua.put (string.format ("-:%s not callable", funcname))
else
local func = export_list[funcname]
local rsargs = cgi["rsargs[]"]
local result
if not rsargs then
result = func()
elseif type (rsargs) == "string" then
result = func (rsargs)
elseif type (rsargs) == "table" then
result = func (unpack (rsargs))
else
return
end
cgilua.put ("+:")
cgilua.put (result)
end
return true
end
 
local function show_common_js ()
cgilua.put [[
// remote scripting library
// (c) copyright 2005 modernmethod, inc
var rs_debug_mode = false;
function rs_debug(text) {
if (rs_debug_mode)
alert("RSD: " + text)
}
function rs_init_object() {
rs_debug("rs_init_object() called..")
var A;
try {
A=new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
A=new ActiveXObject("Microsoft.XMLHTTP");
} catch (oc) {
A=null;
}
}
if(!A && typeof XMLHttpRequest != "undefined")
A = new XMLHttpRequest();
if (!A)
rs_debug("Could not create connection object.");
return A;
}
]]
end
 
local function show_one (funcname)
local uri = request_uri
if string.find (uri, "?") then
uri = uri .. "&rs=" .. cgilua.urlcode.escape (funcname)
else
uri = uri .. "?rs=" .. cgilua.urlcode.escape (funcname)
end
cgilua.put (string.format ([[
// wrapper for %s
function x_%s() {
// count args; build URL
var i, x, n;
var url = "%s";
var a = x_%s.arguments;
for (i = 0; i < a.length-1; i++)
url = url + "&rsargs[]=" + escape(a[i]);
url = url + "&rsrnd=" + new Date().getTime();
x = rs_init_object();
x.open("GET", url, true);
x.onreadystatechange = function() {
if (x.readyState != 4)
return;
rs_debug("received " + x.responseText);
var status;
var data;
status = x.responseText.charAt(0);
data = x.responseText.substring(2);
if (status == "-")
alert("Error: " + callback_n);
else
a[a.length-1](data);
}
x.send(null);
rs_debug("x_%s url = " + url);
rs_debug("x_%s waiting..");
delete x;
}
]], funcname, funcname, uri, funcname, funcname, funcname))
end
 
function export (funcname, func)
export_list[funcname] = func
end
 
local js_has_been_shown = false
 
function show_javascript ()
if not js_has_been_shown then
show_common_js ()
js_has_been_shown = true
end
for fn,_ in pairs (export_list) do
show_one (fn)
end
end
/trunk/dependencies/sajax/perl/Readme.txt
0,0 → 1,7
SAJAX PERL BACKEND
------------------
 
Contributed and copyighted by Nathan Schmidt (http://www.hinathan.com/).
Additional guidance and consultation by Jason Purdy and Nate Mueller.
 
 
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/trunk/dependencies/sajax/perl/Sajax.pm
0,0 → 1,184
package Sajax;
use Data::Dumper;
 
my $rs_debug_mode = 0;
my $rs_js_has_been_shown = 0;
my %rs_export_list = ();
my %rs_coderef_list = ();
 
sub incl_sajax {
}
sub rs_init {
$rs_debug_mode = 0;
$rs_js_has_been_shown = 0;
%rs_export_list = ();
%rs_coderef_list = ();
 
}
sub rs_handle_client_request {
my($q)=@_;
my $rv="";
if (!defined $q->param("rs")) {
return undef;
}
my $func_name = $q->param("rs");
 
if ( defined $rs_export_list{$func_name}) {
$rv .= "+:";
eval {
$rv .= &$func_name($q->param("rsargs"));
};
if($@) {
print STDERR "Err:[$@]\n";
}
} elsif ( defined $rs_coderef_list{$func_name}) {
$rv .= "+:";
my $cr = $rs_coderef_list{$func_name};
eval {
$rv .= &$cr($q->param("rsargs"));
};
if($@) {
print STDERR "Err:[$@]\n";
}
} else {
$rv .= "-:$func_name not callable";
}
return $rv;
}
sub rs_show_common_js() {
my $rv = "";
my $debug_mode = $rs_debug_mode ? "true" : "false";
my $CC = "\n// Perl backend version (c) copyright 2005 Nathan Schmidt";
$CC = "";
$rv .= <<EOT;
// remote scripting library
// (c) copyright 2005 modernmethod, inc$CC
var rs_debug_mode = $debug_mode;
var rs_obj = false;
var rs_callback = false;
 
function rs_debug(text) {
if (rs_debug_mode)
alert("RSD: " + text)
}
function rs_init_object() {
rs_debug("rs_init_object() called..")
var A;
try {
A=new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
A=new ActiveXObject("Microsoft.XMLHTTP");
} catch (oc) {
A=null;
}
}
if(!A && typeof XMLHttpRequest != "undefined")
A = new XMLHttpRequest();
if (!A)
rs_debug("Could not create connection object.");
return A;
}
EOT
return $rv;
}
 
 
#javascript escape a value
sub rs_esc {
my ($val)=@_;
$val =~ s/\"/\\\\\"/;
return $val;
}
 
sub rs_urlencode {
my($enc) = @_;
$enc =~ s/^\s+|\s+$//gs;
$enc =~ s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/eg;
$enc =~ s/ /\+/g;
$enc =~ s/%20/\+/g;
return $enc;
}
 
sub rs_show_one {
my($q,$func_name)=@_;
my $rv = "";
my $uri = $q->url(-query=>1);
if ($uri =~ m/\?/) {
$uri .= "&rs=".rs_urlencode($func_name);
} else {
$uri .= "?rs=".rs_urlencode($func_name);
}
 
my $urie = rs_esc($uri);
 
$rv .= <<EOT;
 
// wrapper for $func_name
function x_$func_name() {
// count args; build URL
var i, x, n;
var url = "$urie", a = x_$func_name.arguments;
for (i = 0; i < a.length-1; i++)
url = url + "&rsargs=" + escape(a[i]);
url = url.replace( /[+]/g, '%2B'); // fix the unescaped plus signs
x = rs_init_object();
x.open("GET", url, true);
x.onreadystatechange = function() {
if (x.readyState != 4)
return;
rs_debug("received " + x.responseText);
var status;
var data;
status = x.responseText.charAt(0);
data = x.responseText.substring(2);
if (status == "-")
alert("Error: " + callback_n);
else
a[a.length-1](data);
}
x.send(null);
rs_debug("x_$func_name url = " + url);
rs_debug("x_$func_name waiting..");
}
 
 
EOT
return $rv;
}
 
sub rs_register {
my($fn,$coderef)=@_;
$rs_coderef_list{$fn} = $coderef;
}
sub rs_export {
map {$rs_export_list{$_}=$_} @_;
return;
}
 
sub rs_show_javascript {
my ($q) = @_;
my $rv = "";
if (! $rs_js_has_been_shown) {
$rv .= rs_show_common_js();
$rs_js_has_been_shown = 1;
}
 
foreach my $func (keys %rs_export_list) {
$rv .= rs_show_one($q,$func);
}
foreach my $func (keys %rs_coderef_list) {
$rv .= rs_show_one($q,$func);
}
 
return $rv;
}
 
1;
Property changes:
Added: svn:mime-type
+text/x-perl
\ No newline at end of property
/trunk/dependencies/sajax/perl/example_multiply.cgi
0,0 → 1,113
#! /usr/bin/perl -w
 
# Perl version cloned from the original PHP by http://www.modernmethod.com/sajax/
# I've left commented-out examples in the code for running with static methods.
# For moving to ModPerl it's important to no be redefining subs all the time,
# so this code adds the rs_register(funcname,coderef) call, which takes a coderef
# rather than the name of a sub to be called.
 
 
use Sajax;
use CGI;
 
my $q = new CGI;
 
my $rv = "";
 
$rv .= "content-type: text/html\n\n";
 
 
=pod
#for static method calls
sub Sajax::multiply {
my($x, $y)=@_;
return $x * $y;
}
sub Sajax::divide {
my($x, $y)=@_;
return $x / $y;
}
=cut
 
#equivalent modperl methods
my $msub = sub {
my($x, $y)=@_;
return $x * $y;
};
my $dsub = sub {
my($x, $y)=@_;
return $x / $y;
};
 
 
 
Sajax::rs_init();
 
#register static methods (called by name)
#Sajax::rs_export("multiply","divide");
 
#modperl methods (called as anonymous coderefs)
Sajax::rs_register("multiply",$msub);
Sajax::rs_register("divide",$dsub);
 
 
my $handled_value = Sajax::rs_handle_client_request($q);
 
if(defined $handled_value) {
$rv .= $handled_value;
} else {
 
$rv .= "<html>\n<head>\n<title>Multiplier</title>\n<script>\n\n";
 
$rv .= Sajax::rs_show_javascript($q);
 
$rv .= <<EOT;
function do_multiply_cb(z) {
document.getElementById("z").value = z;
}
function do_divide_cb(z) {
document.getElementById("zz").value = z;
}
 
 
function do_multiply() {
var x, y;
x = document.getElementById("x").value;
y = document.getElementById("y").value;
x_multiply(x, y, do_multiply_cb);
}
 
function do_divide() {
var x, y;
x = document.getElementById("x").value;
y = document.getElementById("y").value;
x_divide(x, y, do_divide_cb);
}
EOT
 
 
$rv .= "</script>\n\n</head>\n";
$rv .= <<EOT;
<body>
<input type="text" name="x" id="x" value="2" size="3">
*
<input type="text" name="y" id="y" value="3" size="3">
=
<input type="text" name="z" id="z" value="" size="5">
<input type="text" name="zz" id="zz" value="" size="5">
<input type="button" name="check" value="Multiply" onclick="do_multiply(); return false;">
<input type="button" name="check" value="Divide" onclick="do_divide(); return false;">
<input type="button" name="check" value="Both" onclick="do_multiply();do_divide(); return false;">
 
<BR>
<A HREF=showsource.cgi>Show source</A>
</body>
</html>
EOT
}
 
 
print $rv;
 
 
 
/trunk/dependencies/sajax/php/Readme.txt
0,0 → 1,33
SAJAX PHP BACKEND
-----------------
 
Contributed and copyighted by Thomas Lackner (http://www.modernmethod.com/) and Anders Jenbo.
 
If you are using PHP < 5.2 you will need to a substitue for JSON_encode and JSON_decode, you might want to try this out http://abeautifulsite.net/notebook/71
 
Usage:
sajax_export() takes a list of functions that are alowed to be called from javascript, there are 4 parameters for each function you send to sajax_export. If strings are used in stead of arrays the functions will just have all options set to there default (like in older versions of Sajax).
 
name = the name of the function (requred)
method = GET : POST (default is GET)
asynchronous = true : false (default is true, if set to false the script will pause untill the call has been compleated)
uri = the uri where the function lives.
 
The default method can be changed by setting $sajax_request_type to "POST" (this can also be done at runtime).
The default uri can be changed by setting $sajax_remote_uri (this can also be done at runtime).
 
Sample:
sajax_export(
"myFunction",
array("name" => "myPostFunction", "method" => "POST"),
array("name" => "sleep", "asynchronous" => true),
array("name" => "myOffSitefunction", "uri" => "http://myotheresite.com/ajax.php")
);
 
sajax_export() may be called multiple times.
 
To get debug alert's set $sajax_debug_mode to true.
 
You can redirect the users browser to a frindly error page incase his/her borwser issn't supported by sajax by setting $sajax_failure_redirect to an URI.
 
Calling sajax_get_common_js() will print the client side script.
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/trunk/dependencies/sajax/php/example_multiply.php
0,0 → 1,48
<?php
function multiply($x, $y) {
return $x * $y;
}
require("sajax.php");
// $sajax_debug_mode = true;
$sajax_failure_redirect = "http://sajax.info/sajaxfail.html";
sajax_export("multiply");
sajax_handle_client_request();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sajax Multiplier example</title>
<script type="text/javascript" src="json2.stringify.js"></script>
<script type="text/javascript" src="json_stringify.js"></script>
<script type="text/javascript" src="json_parse_state.js"></script>
<script type="text/javascript" src="sajax.js"></script>
<script type="text/javascript"><!--
<?php sajax_show_javascript(); ?>
function do_multiply_cb(z) {
document.getElementById("z").value = z;
}
function do_multiply() {
// get the folder name
var x, y;
x = parseFloat(document.getElementById("x").value);
y = parseFloat(document.getElementById("y").value);
x_multiply(x, y, do_multiply_cb);
}
//-->
</script>
</head>
<body>
<input type="text" name="x" id="x" value="2" size="3" />
*
<input type="text" name="y" id="y" value="3" size="3" />
=
<input type="text" name="z" id="z" value="" size="3" />
<input type="button" name="check" value="Calculate" onclick="do_multiply(); return false;" />
</body>
</html>
/trunk/dependencies/sajax/php/example_options.php
0,0 → 1,83
<?php
date_default_timezone_set('Europe/Copenhagen');
function test_get() {
return test();
}
function test_post() {
return test();
}
function test() {
$s = "URI: ".$_SERVER['PHP_SELF'];
$s .= "\n\n-- GET --\n";
if(!empty($_GET["rsargs"]))
$s .= $_GET["rsargs"];
$s .= "\n-- POST --\n";
if(!empty($_POST["rsargs"]))
$s .= $_POST["rsargs"];
return $s;
}
function get_the_time() {
return date("Y-m-d h:i:s");
}
require_once("sajax.php");
// $sajax_debug_mode = true;
$sajax_failure_redirect = "http://sajax.info/sajaxfail.html";
sajax_export(
array("name" => "test_get", "method" => "GET"),
array("name" => "test_post", "method" => "POST"),
array("name" => "get_the_time", "method" => "GET"),
array("name" => "test", "method" => "GET"),
array("name" => "sleep", "asynchronous" => false),
array("name" => "otherefucntion", "uri" => "example_otheruri.php"),
array("name" => "otherefucntion2")
);
sajax_handle_client_request();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Example of Sajax Options</title>
<script type="text/javascript" src="json2.stringify.js"></script>
<script type="text/javascript" src="json_stringify.js"></script>
<script type="text/javascript" src="json_parse_state.js"></script>
<script type="text/javascript" src="sajax.js"></script>
<script type="text/javascript"><!--
<?php sajax_show_javascript(); ?>
function print_result(v) {
alert(v);
}
//-->
</script>
</head>
<body>
<!-- Testing if the browser supports GET -->
<button onclick="x_test_get(1, 2, 3, print_result);">Test GET</button>
 
<!-- Testing if the browser supports POST -->
<button onclick="x_test_post(1, 2, 3, print_result);">Test POST</button>
 
<!-- Forcing the function to POST -->
<button onclick="sajax_request_type ='POST'; x_test(1, 2, 3, print_result); sajax_request_type ='';">Test force POST</button>
 
<!-- if sajax_target_id is set, the sesponce will be inserted as HTML in an element with sajax_target_id for id-->
<button onclick="sajax_target_id = 'time'; x_get_the_time(); sajax_target_id = '';">Test updating IDs</button>
 
<!-- Calling a synchronous will cause the script to wait for the responce -->
<button onclick="x_sleep(3, function(){}); alert('Link was clicked!');">Test synchronous</button>
 
<!-- Different URI set at config -->
<button onclick="x_otherefucntion(print_result);">Call to other uri.</button>
 
<!-- Forece different URI at runtime -->
<button onclick="sajax_remote_uri = 'example_otheruri.php'; x_otherefucntion2(print_result); sajax_remote_uri = '';">Force call to other uri.</button>
<div id="time"><em>Time will appear here</em></div>
</body>
</html>
/trunk/dependencies/sajax/php/example_otheruri.php
0,0 → 1,13
<?php
function otherefucntion() {
return "URI: ".$_SERVER['PHP_SELF'];
}
function otherefucntion2() {
return otherefucntion();
}
require("sajax.php");
sajax_export("otherefucntion", "otherefucntion2");
sajax_handle_client_request();
?>
/trunk/dependencies/sajax/php/example_types.php
0,0 → 1,85
<?php
date_default_timezone_set('Europe/Copenhagen');
$bday = strtotime("5 September 1983");
$age = (date('z')-date('z', $bday))/1000+date('Y')-date('Y', $bday);
function return_array() {
global $age;
return array("name" => "Anders", "age" => $age);
}
function return_object() {
global $age;
class MyObj {
var $name, $age;
function MyObj($name, $age) {
$this->name = $name;
$this->age = $age;
}
}
$o = new MyObj("Anders", $age);
return $o;
}
function return_int() {
global $age;
return floor($age);
}
function return_float() {
global $age;
return $age;
}
function return_string() {
global $age;
return "Anders is ".floor($age)." years old.";
}
require("sajax.php");
$sajax_request_type = "GET";
// $sajax_debug_mode = true;
$sajax_failure_redirect = "http://sajax.info/sajaxfail.html";
sajax_export("return_array", "return_object", "return_int", "return_float", "return_string");
sajax_handle_client_request();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Sajax PHP return types example</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="json2.stringify.js"></script>
<script type="text/javascript" src="json_stringify.js"></script>
<script type="text/javascript" src="json_parse_state.js"></script>
<script type="text/javascript" src="sajax.js"></script>
<script type="text/javascript"><!--
<?php sajax_show_javascript(); ?>
function display_result(val) {
var repr;
repr = "";
repr += "Type: " + typeof val + "\n";
repr += "Value: ";
if (typeof val == "object" ||
typeof val == "array") {
repr += "{ ";
for (var i in val)
repr += i + ": " + val[i] + ", ";
repr = repr.substr(0, repr.length-2) + " }";
} else {
repr += val;
}
alert(repr);
}
//-->
</script>
</head>
<body>
<button onclick="x_return_array(display_result);">Return as array (will become an object)</button>
<button onclick="x_return_object(display_result);">Return as object</button>
<button onclick="x_return_int(display_result);">Return as int</button>
<button onclick="x_return_float(display_result);">Return as float/double</button>
<button onclick="x_return_string(display_result);">Return as string</button>
</body>
</html>
/trunk/dependencies/sajax/php/example_wall.php
0,0 → 1,122
<?php
//
// The world's least efficient wall implementation (now a bit more efficient)
//
date_default_timezone_set('Europe/Copenhagen');
$filename = "tmp/wall.html";
function colorify_ip($ip)
{
$parts = explode(".", $ip);
$color = sprintf("%02s", dechex($parts[1])) .
sprintf("%02s", dechex($parts[2])) .
sprintf("%02s", dechex($parts[3]));
return $color;
}
function add_line($msg) {
global $filename;
$f = fopen($filename, "a");
$date = date("Y-m-d h:i:s");
$msg = strip_tags(stripslashes($msg));
$remote = $_SERVER["REMOTE_ADDR"];
// generate unique-ish color for IP
$color = colorify_ip($remote);
fwrite($f, '<span style="color:#'.$color.'">'.$date.'</span> '.htmlspecialchars($msg).'<br />'."\r\n");
fclose($f);
return refresh(0);
}
function refresh($lastrefresh) {
global $filename;
if(filemtime($filename) > $lastrefresh) {
$lines = file($filename);
// return the last 25 lines
return array("wall" => join("\n", array_slice($lines, -25)), "update" => filemtime($filename));
} else {
return false;
}
}
require("sajax.php");
// $sajax_debug_mode = true;
$sajax_failure_redirect = "http://sajax.info/sajaxfail.html";
sajax_export(
array("name" => "add_line", "method" => "POST"),
array("name" => "refresh", "method" => "GET")
);
sajax_handle_client_request();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sajax graffiti wall example</title>
<style type="text/css">
.date {
color: blue;
}
</style>
<script type="text/javascript" src="json_stringify.js"></script>
<script type="text/javascript" src="json_parse.js"></script>
<script type="text/javascript" src="sajax.js"></script>
<script type="text/javascript"><!--
<?php sajax_show_javascript(); ?>
var check_n = 1;
var nextrefresh;
function refresh_cb(data) {
if(data !== false) {
document.getElementById("wall").innerHTML = data["wall"];
lastrefresh = data["update"];
clearTimeout(nextrefresh);
nextrefresh = setTimeout("refresh();", 1000);
} else {
clearTimeout(nextrefresh);
nextrefresh = setTimeout("refresh();", 2500);
}
document.getElementById("status").innerHTML = "Checked #" + check_n++;
}
var lastrefresh = <?php echo(filemtime($filename)); ?>;
function refresh() {
document.getElementById("status").innerHTML = "Checking..";
x_refresh(lastrefresh, refresh_cb);
}
function add() {
var line;
var handle;
handle = document.getElementById("handle").value;
line = document.getElementById("line").value;
if(line == "")
return;
x_add_line("[" + handle + "] " + line, refresh_cb);
document.getElementById("line").value = "";
}
function keypress(keyCode) {
if (keyCode==13) {
add();
document.getElementById("line").select();
return false;
}
return true;
}
nextrefresh = setTimeout("refresh();", 1000);
//-->
</script>
</head>
<body>
<b><a href="http://www.sajax.info/">Sajax</a> v<?php echo($sajax_version); ?></b> - You are a guinea pig - This example illustrates the simplest possible graffiti wall. It isn't meant to be perfect, featureful, or even useful.<br />
<form action="" method="post" onsubmit="add(); return false;">
<input type="text" name="handle" id="handle" value="(name)" onfocus="this.select()" style="width:130px;" />
<input type="text" name="line" id="line" value="(enter your message here)" onfocus="this.select();" onkeypress="keypress(event.keyCode);" style="width:300px;" />
<input type="button" name="check" value="Post message" onclick="add(); return false;" />
</form>
<div id="wall"> <?php $temp = refresh(0); echo($temp["wall"]); ?></div>
<div id="status">Checked #0</div>
</body>
</html>
/trunk/dependencies/sajax/php/json2.parse.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/sajax/php/json2.stringify.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/sajax/php/json_parse.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/sajax/php/json_parse_state.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/sajax/php/json_stringify.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/sajax/php/sajax.js
Cannot display: file marked as a binary type.
svn:mime-type = application/javascript
Property changes:
Added: svn:mime-type
+application/javascript
\ No newline at end of property
/trunk/dependencies/sajax/php/sajax.php
0,0 → 1,141
<?php
if (!isset($SAJAX_INCLUDED)) {
/*
* GLOBALS AND DEFAULTS
*
*/
$GLOBALS['sajax_version'] = "0.13";
$GLOBALS['sajax_debug_mode'] = false;
$GLOBALS['sajax_export_array'] = array();
$GLOBALS['sajax_export_list'] = array();
$GLOBALS['sajax_remote_uri'] = "";
$GLOBALS['sajax_failure_redirect'] = "";
$GLOBALS['sajax_request_type'] = "GET";
/*
* CODE
*
*/
function sajax_handle_client_request() {
if (empty($_GET["rs"]) && empty($_POST["rs"]))
return;
ob_start();
if (!empty($_GET["rs"])) {
// Always call server
header ("Cache-Control: max-age=0, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache"); // HTTP/1.0
$func_name = $_GET["rs"];
if (! empty($_GET["rsargs"]))
$args = $_GET["rsargs"];
} else {
$func_name = $_POST["rs"];
if (! empty($_POST["rsargs"]))
$args = $_POST["rsargs"];
}
if(! empty($args)) {
if(get_magic_quotes_gpc())
$args = stripslashes($args);
$args = json_decode($args, true);
if(get_magic_quotes_gpc()) {
function array_addslashes($value) {
if(is_array($value))
return array_map("array_addslashes", $value);
else
return addslashes($value);
}
$args = array_map("array_addslashes", $args);
}
} else {
$args = array();
}
global $sajax_export_list;
if (! in_array($func_name, $sajax_export_list)) {
$error = $func_name." not callable";
} else {
$result = call_user_func_array($func_name, $args);
$error = ob_get_contents();
ob_end_clean();
}
header('Content-Type: text/plain; charset=UTF-8');
if(!empty($error)) {
echo '-:'.$error;
} else {
echo "+:".json_encode($result);
}
exit;
}
$sajax_js_has_been_shown = false;
function sajax_show_javascript()
{
global $sajax_js_has_been_shown;
global $sajax_debug_mode;
global $sajax_failure_redirect;
if (! $sajax_js_has_been_shown) {
?>
sajax_debug_mode = <?php echo($sajax_debug_mode ? "true" : "false"); ?>;
sajax_failure_redirect = "<?php echo($sajax_failure_redirect); ?>";
<?php
global $sajax_export_array;
foreach($sajax_export_array as $function) {
?>
function x_<?php echo($function["name"]); ?>() {
return sajax_do_call("<?php echo($function["name"]); ?>", arguments, "<?php echo($function["method"]); ?>", <?php echo($function["asynchronous"] ? 'true' : 'false'); ?>, "<?php echo($function["uri"]); ?>");
}
<?php
}
$sajax_js_has_been_shown = true;
}
}
function sajax_export() {
global $sajax_export_array;
global $sajax_export_list;
global $sajax_request_type;
global $sajax_remote_uri;
$num = func_num_args();
for ($i=0; $i<$num; $i++) {
$function = func_get_arg($i);
if(!is_array($function))
$function = array("name" => $function);
if(!isset($function["method"]))
$function["method"] = $sajax_request_type;
if(!isset($function["asynchronous"]))
$function["asynchronous"] = true;
if(!isset($function["uri"]))
$function["uri"] = $sajax_remote_uri;
$key = array_search($function["name"], $sajax_export_list);
if ($key === false) {
$sajax_export_array[] = $function;
$sajax_export_list[] = $function["name"];
} else {
//Overwrite old function
$sajax_export_array[$key] = $function;
$sajax_export_list[$key] = $function["name"];
}
}
}
$SAJAX_INCLUDED = 1;
}
?>
/trunk/dependencies/sajax/php/tmp/wall.html
0,0 → 1,46
<span style="color:#5b024d">2009-08-21 12:42:37</span> [Netscape 6.0] Shows fail page correctly<br />
<span style="color:#5b024d">2009-08-21 12:42:37</span> [Netscape 6.1] Shows fail page correctly<br />
<span style="color:#3ca206">2009-08-22 12:37:12</span> [Mozilla 0.9.4] Works *<br />
<span style="color:#5b024d">2009-08-21 08:26:49</span> [Mozilla 0.9.9] Works<br />
<span style="color:#5b024d">2009-08-21 12:38:53</span> [Firefox 2.0.0.20] Works<br />
<span style="color:#5b024d">2009-08-21 12:41:09</span> [Firefox 3.5.2] Works<br />
<span style="color:#5b024d">2009-08-21 12:42:37</span> [IE 4] Failes horribly<br />
<span style="color:#fbc320">2009-08-22 03:32:36</span> [Fennec M10] Works<br />
<span style="color:#5b024d">2009-08-21 12:42:37</span> [IE 5.01] Works<br />
<span style="color:#5b024d">2009-08-21 12:42:30</span> [IE 5.5] Works<br />
<span style="color:#5b024d">2009-08-21 12:42:20</span> [IE 6] Works<br />
<span style="color:#5b024d">2009-08-21 12:41:56</span> [IE 7] Works<br />
<span style="color:#5b024d">2009-08-21 12:41:41</span> [IE 8] Works<br />
<span style="color:#fbc320">2009-08-22 02:42:44</span> [Pocket Interrnet Explorer 7.11] Works<br />
<span style="color:#5b024d">2009-08-21 01:47:23</span> [iCab 3.0.5] Works **<br />
<span style="color:#5b024d">2009-08-21 06:13:48</span> [Safari 1.0] Shows fail page correctly<br />
<span style="color:#5b024d">2009-08-21 06:13:48</span> [Safari 1.1] Shows fail page correctly<br />
<span style="color:#5b024d">2009-08-21 06:13:48</span> [Safari 1.2] Works<br />
<span style="color:#5b024d">2009-08-21 08:20:58</span> [Safari 1.3] Works<br />
<span style="color:#5b024d">2009-08-21 09:02:25</span> [Safari 1.3.1] Works<br />
<span style="color:#5b024d">2009-08-21 12:38:37</span> [Safari 1.3.2] Works<br />
<span style="color:#fbc302">2009-08-24 03:17:34</span> [Safari 2.0] Works<br />
<span style="color:#fbc302">2009-08-24 03:18:16</span> [Safari 2.0.2] Works<br />
<span style="color:#fbc302">2009-08-24 03:18:58</span> [Safari 2.0.3] Works<br />
<span style="color:#fbc302">2009-08-24 03:19:31</span> [Safari 2.0.4] Works<br />
<span style="color:#3ca206">2009-08-22 12:41:35</span> [Safari 3.0] Works<br />
<span style="color:#5b024d">2009-08-21 08:45:50</span> [Safari 3.0.4] Works<br />
<span style="color:#fbc302">2009-08-24 03:15:07</span> [Safari 3.1.2] Works<br />
<span style="color:#fbc302">2009-08-24 03:15:54</span> [Safari 3.2.1] Works<br />
<span style="color:#fbc31f">2009-08-23 02:23:18</span> [Safari 3.2.3] Works<br />
<span style="color:#5b024d">2009-08-21 10:17:10</span> [Safari 4.0.3] Works<br />
<span style="color:#fbc320">2009-08-22 01:58:58</span> [iPhone 3.0.1] Works<br />
<span style="color:#5b024d">2009-08-21 08:36:46</span> [Google Chrome 2.0.172.39] Works<br />
<span style="color:#3ca206">2009-08-22 12:39:57</span> [Opera 8.0] Works *<br />
<span style="color:#3ca206">2009-08-22 02:30:58</span> [Opera 8.01] Only with GET<br />
<span style="color:#3ca206">2009-08-22 01:57:33</span> [Opera 8.02] Works<br />
<span style="color:#3ca206">2009-08-22 01:50:09</span> [Opera 8.50] Works<br />
<span style="color:#5b024d">2009-08-21 06:32:43</span> [Opera 8.54] Works<br />
<span style="color:#5b024d">2009-08-21 12:41:17</span> [Opera 9.64] Works<br />
<span style="color:#5b024d">2009-08-21 06:31:49</span> [Opera 10b] Works<br />
<span style="color:#5b024d">2009-08-24 12:26:46</span> [Opera 10b3] Works<br />
<span style="color:#fbc320">2009-08-22 03:15:22</span> [Opera Mobile 8.65] Works<br />
<span style="color:#fbc320">2009-08-22 02:38:22</span> [Opera Mobile 9.5] Works<br />
<span style="color:#fbc320">2009-08-22 03:07:59</span> [Opera Mobile 9.7b] Works<br />
<span style="color:#cb6018">2009-08-22 03:09:52</span> [Opera Mobile 9.7b Turbo] Works<br />
<span style="color:#bd8e2a">2009-08-22 02:40:12</span> [Opera Mini 4.2] Works<br />
Property changes:
Added: svn:mime-type
+text/html
\ No newline at end of property
/trunk/dependencies/sajax/python/License.txt
0,0 → 1,0
This work is licensed under the Creative Commons Attribution License. To view a copy of this license, visit http://creativecommons.org/licenses/by/2.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/trunk/dependencies/sajax/python/Readme.txt
0,0 → 1,9
SAJAX PYTHON BACKEND
--------------------
 
Contributed and copyighted by Adam Collard. Additional guidance and
consultation by Carlos Bueno.
 
IMPORTANT: This backend is NOT licensed under the BSD-L. It is licensed
under the Creative Commons "By" License version 2.0. Please see
License.txt for details.
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/trunk/dependencies/sajax/python/multiply.py
0,0 → 1,46
#!/usr/bin/env python
import cgitb;cgitb.enable()
import sajax1
 
def multiply(x,y):
try:
float_x, float_y = float(x), float(y)
except:
return 0
return float_x * float_y
 
sajax1.sajax_init()
sajax1.sajax_export(multiply)
sajax1.sajax_handle_client_request()
 
print """
<html>
<head>
<title>PyMultiplier</title>
<script>
"""
sajax1.sajax_show_javascript()
print """
function do_multiply_cb(z) {
document.getElementById("z").value = z;
}
function do_multiply() {
var x, y;
 
x = document.getElementById("x").value;
y = document.getElementById("y").value;
x_multiply(x, y, do_multiply_cb);
}
</script>
</head>
<body>
<input type="text" name="x" id="x" value="2" size="3">
*
<input type="text" name="y" id="y" value="3" size="3">
=
<input type="text" name="z" id="z" value="" size="3">
<input type="button" name="check" value="Calculate"
onclick="do_multiply(); return false;">
</body>
</html>
""" % locals()
Property changes:
Added: svn:mime-type
+text/x-python
\ No newline at end of property
/trunk/dependencies/sajax/python/sajax1.py
0,0 → 1,149
#!/usr/bin/env python
import cgi
import cgitb; cgitb.enable()
import os
import sys
import datetime
import urllib
 
print "Content-type: text/html"
 
sajax_debug_mode = False
sajax_export_list = {}
sajax_js_has_been_shown = False
 
form = cgi.FieldStorage()
 
def sajax_init():
pass
def sajax_handle_client_request():
func_name = form.getfirst('rs')
if func_name is None:
return
# Bust cache in the head
print "Expires: Mon, 26 Jul 1997 05:00:00 GMT"
print "Last-Modified: %s GMT" % datetime.datetime.utcnow().strftime(
"%a, %d %m %H:%M:%S")
# always modified
print "Cache-Control: no-cache, must-revalidate" # HTTP/1.1
print "Pragma: no-cache" # HTTP/1.0
print
if not func_name in sajax_export_list:
print "-:%s not callable" % func_name
else:
print "+:",
rsargs = form.getlist('rsargs[]')
result = sajax_export_list[func_name](*rsargs)
print result
sys.exit()
def sajax_get_common_js():
sajax_debug_modeJS = str(sajax_debug_mode).lower()
return """\
// remote scripting library
// (c) copyright 2005 modernmethod, inc
var sajax_debug_mode = %(sajax_debug_modeJS)s;
function sajax_debug(text) {
if (sajax_debug_mode)
alert("RSD: " + text)
}
function sajax_init_object() {
sajax_debug("sajax_init_object() called..")
var A;
try {
A=new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
A=new ActiveXObject("Microsoft.XMLHTTP");
} catch (oc) {
A=null;
}
}
if(!A && typeof XMLHttpRequest != "undefined")
A = new XMLHttpRequest();
if (!A)
sajax_debug("Could not create connection object.");
return A;
}
function sajax_do_call(func_name, url, args) {
var i, x, n;
for (i = 0; i < args.length-1; i++)
url = url + "&rsargs[]=" + escape(args[i]);
url = url + "&rsrnd=" + new Date().getTime();
x = sajax_init_object();
x.open("GET", url, true);
x.onreadystatechange = function() {
if (x.readyState != 4)
return;
sajax_debug("received " + x.responseText);
var status;
var data;
status = x.responseText.charAt(0);
data = x.responseText.substring(2);
if (status == "-")
alert("Error: " + data);
else
args[args.length-1](data);
}
x.send(null);
sajax_debug(func_name + " url = " + url);
sajax_debug(func_name + " waiting..");
delete x;
}
""" % locals()
 
def sajax_show_common_js():
print sajax_get_common_js()
 
def sajax_esc(val):
return val.replace('"', '\\\\"')
 
def sajax_get_one_stub(func_name):
uri = os.environ['SCRIPT_NAME']
if os.environ.has_key('QUERY_STRING'):
uri += "?" + os.environ['QUERY_STRING'] + "&rs=%s" % urllib.quote_plus(func_name)
else:
uri += "?rs=%s" % urllib.quote_plus(func_name)
escapeduri = sajax_esc(uri)
return """
// wrapper for %(func_name)s
function x_%(func_name)s(){
// count args; build URL
sajax_do_call("%(func_name)s",
"%(escapeduri)s",
x_%(func_name)s.arguments);
}
""" % locals()
 
def sajax_show_one_stub(func_name):
print sajax_get_one_stub(func_name)
 
def sajax_export(*args):
decorated = [(f.func_name, f) for f in args]
sajax_export_list.update(dict(decorated))
def sajax_get_javascript():
global sajax_js_has_been_shown
 
html = ''
if not sajax_js_has_been_shown:
html += sajax_get_common_js()
sajax_js_has_been_shown = True
for func_name in sajax_export_list.iterkeys():
html += sajax_get_one_stub(func_name)
 
return html
 
def sajax_show_javascript():
print sajax_get_javascript()
Property changes:
Added: svn:mime-type
+text/x-python
\ No newline at end of property
/trunk/dependencies/sajax/python/wall.py
0,0 → 1,90
#!/usr/bin/env python
import cgi
import cgitb;cgitb.enable()
import datetime
import os
 
import sajax1
 
WALLFILE = '/tmp/wall.html'
 
if not os.path.exists(WALLFILE):
fh = open(WALLFILE, 'w')
fh.close()
 
def colourify_ip(ip):
colour = ''.join(['%02x' % int(part) for part in ip.split('.')[-3:]])
return colour
def add_line(msg):
f = open("/tmp/wall.html","a")
dt = datetime.datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S")
msg = cgi.escape(msg)
remote = os.environ['REMOTE_ADDR']
colour = colourify_ip(remote)
f.write('<span style="color:#%(colour)s">%(dt)s</span> %(msg)s<br />\n' % locals())
f.close()
def refresh():
f = open("/tmp/wall.html")
return '\n'.join(list(f)[-25:])
sajax1.sajax_init()
sajax1.sajax_export(refresh, add_line)
sajax1.sajax_handle_client_request()
 
print """
<html>
<head>
<title>PyWall</title>
<script>
"""
sajax1.sajax_show_javascript()
print """
var check_n = 0;
function refresh_cb(new_data) {
document.getElementById("wall").innerHTML = new_data;
document.getElementById("status").innerHTML = "Checked #" + check_n++;
setTimeout("refresh()", 1000);
}
function refresh() {
document.getElementById("status").innerHTML = "Checking..";
x_refresh(refresh_cb);
}
function add_cb() {
// we don't care..
}
 
function add() {
var line;
var handle;
handle = document.getElementById("handle").value;
line = document.getElementById("line").value;
if (line == "")
return;
x_add_line("[" + handle + "] " + line, add_cb);
document.getElementById("line").value = "";
}
</script>
</head>
<body onload="refresh();">
 
<a href="http://">Sajax</a> - Wall Example<br/>
<input type="text" name="handle" id="handle" value="(name)"
onfocus="this.select()" style="width:130px;">
<input type="text" name="line" id="line" value="(enter your message here)"
onfocus="this.select()"
style="width:300px;">
<input type="button" name="check" value="Post message"
onclick="add(); return false;">
<div id="wall"></div>
<div id="status"><em>Loading..</em></div>
</body>
</html>
""" % locals()
Property changes:
Added: svn:mime-type
+text/x-python
\ No newline at end of property
/trunk/dependencies/sajax/ruby/Readme.txt
0,0 → 1,9
SAJAX RUBY BACKEND
------------------
 
Contributed and put into the public domain by an anonymous member
of the Sajax forum. If anyone wants to take control of this port
and improve it, it would be welcomed.
 
 
 
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/trunk/dependencies/sajax/ruby/Sajax.rb
Cannot display: file marked as a binary type.
svn:mime-type = application/x-ruby
Property changes:
Added: svn:mime-type
+application/x-ruby
\ No newline at end of property
/trunk/index.php
0,0 → 1,1600
<?php
 
// ViaThinkSoft CryptoChat
// (C) 2014-2018 by Daniel Marschall, ViaThinkSoft
// Licensed under the terms of GPLv3
 
// -----------------------------------------------------------------------------------------------
 
// feature: user comes online, user comes offline, user is inactive, user is active, user is typing, get user list
// todo: hide password length to avoid screensaves revealing confidential information
// feature: split screen (frames), with united document.title ! (sum unread posts of each chat)
// ng: smileys
// ng: roomname, username encrypt
// ng: sha3
// ng: maybe it would be usefil if you could see by different colors if something was encrypted using a different password
// bug: some browsers cannot mark the last line, otherwise everything will be marked
// bug: offline detection does not work...
// todo: "reset chat" (counter=0, document='') while pwd change?
// feature: verhindern dass man etwas postet ohne ein passwort eingegeben zu haben? -> config
// feature: posts durchnumerieren?
// bug openpandora: password field on change geht net (cannot repro all the time?) ist !== null ok? (fixed now?)
// bug cheery laptop: froze, didn't check new messages (mehrfach. repro? Aurora 24.2.0 Gentoo). eigene kommen nicht an. nach einer weile geht es plötzlich wieder? evtl ist vts request 1 mal fehlgeschlagen. (fixed now with fail callbacks?)
// feature: shift+enter = new line without sending?
// rp feature: ((->[i] , rp notizen + cors
// feature: send files?
// feature: dereferer
// feature: configuration option to show a drop down box with all chat rooms
// todo: always renew cache
// todo: warn if config is not correct, e.g. admin password missing
// feature: prevent making screenshots? keep clipboard empty?
// feature: detect NoScript
// todo: onChatHide() does not get called when tab is active (and visible), but browser window hasn't the focus
// feature: loginmessage. show version of user. user soll bei jedem ajax-verkehr die version mitsenden, damit der server ihn ablehnen kann wenn die version zu alt ist!. ggf ein re-load forcing (self.reload in same room/user/pwd)?
// idea: undo decryption if pwd field changed? delete pwd field and save actual decryption key in VAR array. so no screenloggers can see
// feature?: possibility to disable hash? just try to do AES.
// feature?: possibility to disable user stats or to prune them.
// feature?: possibility to prune chat
// feature?: send pwd hashed with refresh() so you can see which key(s) the active users use?
// feature?: at "(Logging off)"-Message sending: remove DIRECTLY from stat list
// feature: when configuration symbols are not defined, redefine them with default settings
// feature: online list - instead of showing 2 same names, just write "x2"
 
// -----------------------------------------------------------------------------------------------
 
if (!file_exists(__DIR__ . '/config/config.inc.php')) {
die('ERROR: File <b>config/config.inc.php</b> does not exist. Please create it using <b>config/config.original.inc.php</b>');
}
require __DIR__ . '/config/config.inc.php';
define('PRODUCT_NAME', 'CryptoChat');
define('MCC_VER', trim(file_get_contents(__DIR__ . '/VERSION')));
 
require __DIR__ . '/' . DEP_DIR_SAJAX . '/php/sajax.php';
require __DIR__ . '/' . DEP_DIR_JSONWRAPPER . '/jsonwrapper.php'; // TODO: make optional. only required if running with PHP 5.1
 
header('Content-type: text/html; charset=utf-8');
 
if ((REQUIRE_TLS) && (!is_secure())) {
// TODO: redirect
echo '<h1>Please connect via HTTPS or change <b>REQUIRE_TLS</b> to false.</h1>';
die();
}
 
define('ACTION_LIST_ROOMS', 1);
define('ACTION_CREATE_ROOM', 2);
 
$ses_room = (isset($_POST['ses_room'])) ? trim($_POST['ses_room']) : '';
$ses_user = (isset($_POST['ses_user'])) ? trim($_POST['ses_user']) : '';
$admin_pwd = (isset($_POST['admin_pwd'])) ? trim($_POST['admin_pwd']) : '';
 
$ses_room = trim(strtolower($ses_room));
$ses_user = trim($ses_user);
// $admin_pwd will be trimmed in adminAuth()
 
$chat_exists = (!CHAT_MUST_EXIST) || (adminAuth($admin_pwd, ACTION_CREATE_ROOM)) || chat_exists($ses_room);
 
$is_logged_in = ($ses_room != '') && ($ses_user != '') && $chat_exists;
$show_list = isset($_REQUEST['list_chatrooms']) && (!LIST_CHATS_REQUIRE_PWD || adminAuth($_POST['admin_pwd'], ACTION_LIST_ROOMS));
 
if ($is_logged_in) {
$chatroom_file = chatroom_file($ses_room);
touch($chatroom_file);
}
 
function adminAuth($password, $action) {
if ($action == ACTION_LIST_ROOMS) {
// if (trim(PWD_LIST_ROOMS) == '') return false;
return (trim($password) == trim(PWD_LIST_ROOMS));
} else if ($action == ACTION_CREATE_ROOM) {
// if (trim(PWD_CREATE_ROOM) == '') return false;
return (trim($password) == trim(PWD_CREATE_ROOM));
} else {
throw new Exception('Unknown action');
}
}
 
function is_secure() {
// https://stackoverflow.com/questions/1175096/how-to-find-out-if-you-are-using-https-without-serverhttps
if(isset($_SERVER['HTTPS'])) {
if ($_SERVER['HTTPS'] == 'on') {
return true;
}
}
return false;
}
 
function chat_exists($room) {
return file_exists(chatroom_file($room));
}
 
function chatroom_file($room) {
return __DIR__ . '/chats/'.escape_filename($room).'.html';
}
 
function chatroom_userstat_file($room, $unique_id) {
return __DIR__ . '/chats/'.escape_filename($room).'_'.escape_filename($unique_id).'.session';
}
 
function chatroom_userstat_files($room) {
$ses_ids = array();
 
$ary = glob(__DIR__ . '/chats/'.escape_filename($room).'_*.session');
foreach ($ary as &$a) {
if (!preg_match('@'.preg_quote(__DIR__ . '/chats/'.escape_filename($room).'_').'(.+)\.session@ismU', $a, $m)) {
die('Internal error at '.__LINE__);
}
$ses_ids[] = $m[1];
}
 
return $ses_ids;
}
 
function write_user_stat($room, $unique_id, $username, $ip) {
$file = chatroom_userstat_file($room, $unique_id);
 
$cont = '';
# $cont .= "ROOM:$room\n";
$cont .= "USERNAME:$username\n";
# $cont .= "UNIQUEID:$unique_id\n";
$cont .= "IP:$ip\n";
# $now=time(); $cont .= "ACTIVE:$now\n";
# $key=...; $cont .= "KEY:$key\n";
 
file_put_contents($file, $cont);
}
 
function file_age($file) {
return time()-filemtime($file);
}
 
function get_active_users($room, $max_inactivity=USERSTAT_INACTIVE_SECS) {
$ses_ids = array();
 
$all_ses_ids = chatroom_userstat_files($room);
foreach ($all_ses_ids as &$ses_id) {
$file = chatroom_userstat_file($room, $ses_id);
if (file_age($file) <= $max_inactivity) {
$ses_ids[] = $ses_id;
} else {
if (DELETE_OLD_USERSTATS) {
$file = chatroom_userstat_file($room, $ses_id);
unlink($file);
}
}
}
 
return $ses_ids;
}
 
function read_user_stat($room, $unique_id) {
$res = array();
 
$file = chatroom_userstat_file($room, $unique_id);
 
if (!file_exists($file)) return false;
 
$cont = file($file);
foreach ($cont as &$c) {
$c = trim($c);
if ($c == '') continue;
$nameval = explode(':', $c, 2);
if (count($nameval) < 2) continue;
 
$name = $nameval[0];
$val = $nameval[1];
$res[$name] = $val;
}
$res['ACTIVE'] = filemtime($file);
$res['ROOM'] = $room;
$res['UNIQUEID'] = $unique_id;
 
return $res;
}
 
function list_rooms() {
$ary = glob(__DIR__ . '/chats/*.html');
foreach ($ary as &$a) {
$a = basename($a, '.html');
}
return $ary;
}
 
function count_messages($room) {
$room_file = chatroom_file($room);
return count(file($room_file));
}
 
function count_users($room) {
$room_file = chatroom_file($room);
$cont = file_get_contents($room_file);
preg_match_all('@\(user:(.*)\)@ismU', $cont, $m);
foreach ($m[1] as &$us) {
$users_lookup[$us] = true;
}
return count($users_lookup);
}
 
function escape_filename($str) {
$str = str_replace('/', '_', $str);
return $str;
}
 
/* exported via AJAX */
function add_line($id, $room, $user, $msg) {
if (!chat_exists($room)) return;
if ($user == '') return;
 
$f = fopen(chatroom_file($room), 'a');
$dt = date('Y-m-d H:i:s');
// $msg = stripslashes($msg);
$remote = $_SERVER['REMOTE_ADDR'];
 
// Escape stuff
$user = htmlentities($user, ENT_QUOTES, 'UTF-8');
$msg = htmlentities($msg, ENT_QUOTES, 'UTF-8');
 
$msgs = explode("\n", $msg);
foreach ($msgs as &$msg) {
fwrite($f, "(date: $dt)(user: $user)$msg<br>\n");
}
 
fclose($f);
 
return array($id);
}
 
/* exported via AJAX */
function refresh($room, $fromline, $username, $unique_id) {
if (!chat_exists($room)) return;
if ($fromline < 0) return;
 
$unique_id = trim($unique_id);
if ($unique_id == '') {
# TODO: show error message
return false;
}
write_user_stat($room, $unique_id, $username, $_SERVER['REMOTE_ADDR']);
 
$res = '';
$lines = file(chatroom_file($room));
for ($i=$fromline; $i<count($lines); $i++) {
$res .= $lines[$i] . "\n";
}
 
$userstats = array();
$ses_ids = get_active_users($room);
foreach ($ses_ids as &$ses_id) {
$userstats[] = read_user_stat($room, $ses_id);
}
 
return array(count($lines), $res, $userstats);
}
 
// $sajax_debug_mode = true;
$sajax_failure_redirect = 'http://web.archive.org/web/20090915191608/http://sajax.info/sajaxfail.html';
sajax_export(
array('name' => 'add_line', 'method' => 'POST'),
array('name' => 'refresh', 'method' => 'GET') // TODO: post?
);
sajax_handle_client_request();
 
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=utf-8">
<title><?php echo htmlentities(PRODUCT_NAME); ?></title>
<style>
body {
background-color:#000011;
color:white;
font-family:Arial;
font-size:13px;
}
body.chatroom {
margin: 0;
background-color:#000011;
color:white;
font-family:Arial;
font-size:13px;
}
thead td {
font-weight:bold;
background-color:#000044;
}
.encrypted {
color:orange;
}
.error {
color:#dd0000;
}
input, textarea {
background-color:#000011;
color:white;
}
#postarea textarea {
width:80%;
background-color:#000011;
color:white;
}
#header {
padding:5px;
position:fixed;
background-color:#000044;
color:white;
width:100%;
height: 50px;
}
#status {
position:fixed;
right:5px;
top:5px;
}
#chatmessages {
padding-bottom:115px;
padding-top: 65px;
padding-left: 5px;
padding-right: 5px;
}
#activeusers {
position:fixed;
top:65px;
/*bottom:115px;*/
right:5px;
/*height:100px;*/
width:150px;
background-color:#222222;
padding:10px;
}
#postarea {
padding:5px;
position: fixed;
bottom:0;
height: 100px;
width: 100%;
background-color:#000044;
color:white;
}
.button {
/* http://www.drweb.de/magazin/browser-cursor-hand/ */
cursor: hand; cursor: pointer;
font-family: Arial;
color:white;
background-color: #000022;
border-color:#000000;
border-style: inset;
}
.button:hover {
color:yellow;
}
label {
/* http://www.drweb.de/magazin/browser-cursor-hand/ */
cursor: hand; cursor: pointer;
}
label:hover {
color:yellow;
}
a:link {
color:#ffdd00;
}
a:visited {
color:darkred;
}
a:active, a:hover {
color:white;
}
.logout a {
color:white;
}
.logout a:hover {
color:orange;
}
.logout {
margin-left: 20px;
}
</style>
 
<?php
if ($is_logged_in) {
?>
 
<script type="text/javascript" src="<?php echo DEP_DIR_CRYPTOJS; ?>/rollups/sha256.js"></script>
<script type="text/javascript" src="<?php echo DEP_DIR_CRYPTOJS; ?>/rollups/aes.js"></script>
<script type="text/javascript" src="<?php echo DEP_DIR_CRYPTOJS; ?>/rollups/md5.js"></script>
 
<script type="text/javascript" src="<?php echo DEP_DIR_SAJAX; ?>/php/json_stringify.js"></script>
<script type="text/javascript" src="<?php echo DEP_DIR_SAJAX; ?>/php/json_parse.js"></script>
<script type="text/javascript" src="<?php echo DEP_DIR_SAJAX; ?>/php/sajax.js"></script>
 
<script type="text/javascript" src="<?php echo DEP_DIR_CRC32; ?>/crc32.js"></script>
 
<script type="text/javascript">
 
<?php
sajax_show_javascript();
?>
 
var product = <?php echo json_encode(PRODUCT_NAME); ?>;
var version = <?php echo json_encode(MCC_VER); ?>;
var room = <?php echo json_encode($ses_room); ?>;
var user = <?php echo json_encode($ses_user); ?>;
var curseq = 0;
var roomSalt = "<?php echo sha1(X_SALT.$ses_room); ?>";
var curVisible = true;
var backgroundSeqCount = 0;
var blink = 0;
var uniqueID = "";
 
// --- Useful functions
 
function scrollToBottom() {
// http://www.sourcetricks.com/2010/07/javascript-scroll-to-bottom-of-page.html
window.scrollTo(0, document.body.scrollHeight);
}
 
function randNum(min, max) {
return Math.floor((Math.random()*max)+min);
}
 
// http://stackoverflow.com/questions/1349404/generate-a-string-of-5-random-characters-in-javascript/1349426#1349426
function randomString(len) {
var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
 
for( var i=0; i < len; i++ ) {
text += possible.charAt(Math.floor(Math.random() * possible.length));
}
 
return text;
}
 
// Array Remove - By John Resig (MIT Licensed)
Array.prototype.remove = function(from, to) {
var rest = this.slice((to || from) + 1 || this.length);
this.length = from < 0 ? this.length + from : from;
return this.push.apply(this, rest);
};
 
function sleep(milliseconds) {
// http://www.phpied.com/sleep-in-javascript/
var start = new Date().getTime();
for (var i = 0; i < 1e7; i++) {
if ((new Date().getTime() - start) > milliseconds) {
break;
}
}
}
 
function get_html_translation_table(table, quote_style) {
// From: http://phpjs.org/functions
// + original by: Philip Peterson
// + revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + bugfixed by: noname
// + bugfixed by: Alex
// + bugfixed by: Marco
// + bugfixed by: madipta
// + improved by: KELAN
// + improved by: Brett Zamir (http://brett-zamir.me)
// + bugfixed by: Brett Zamir (http://brett-zamir.me)
// + input by: Frank Forte
// + bugfixed by: T.Wild
// + input by: Ratheous
// % note: It has been decided that we're not going to add global
// % note: dependencies to php.js, meaning the constants are not
// % note: real constants, but strings instead. Integers are also supported if someone
// % note: chooses to create the constants themselves.
// * example 1: get_html_translation_table('HTML_SPECIALCHARS');
// * returns 1: {'"': '&quot;', '&': '&amp;', '<': '&lt;', '>': '&gt;'}
var entities = {},
hash_map = {},
decimal;
var constMappingTable = {},
constMappingQuoteStyle = {};
var useTable = {},
useQuoteStyle = {};
 
// Translate arguments
constMappingTable[0] = 'HTML_SPECIALCHARS';
constMappingTable[1] = 'HTML_ENTITIES';
constMappingQuoteStyle[0] = 'ENT_NOQUOTES';
constMappingQuoteStyle[2] = 'ENT_COMPAT';
constMappingQuoteStyle[3] = 'ENT_QUOTES';
 
useTable = !isNaN(table) ? constMappingTable[table] : table ? table.toUpperCase() : 'HTML_SPECIALCHARS';
useQuoteStyle = !isNaN(quote_style) ? constMappingQuoteStyle[quote_style] : quote_style ? quote_style.toUpperCase() : 'ENT_COMPAT';
 
if (useTable !== 'HTML_SPECIALCHARS' && useTable !== 'HTML_ENTITIES') {
throw new Error("Table: " + useTable + ' not supported');
// return false;
}
 
entities['38'] = '&amp;';
if (useTable === 'HTML_ENTITIES') {
entities['160'] = '&nbsp;';
entities['161'] = '&iexcl;';
entities['162'] = '&cent;';
entities['163'] = '&pound;';
entities['164'] = '&curren;';
entities['165'] = '&yen;';
entities['166'] = '&brvbar;';
entities['167'] = '&sect;';
entities['168'] = '&uml;';
entities['169'] = '&copy;';
entities['170'] = '&ordf;';
entities['171'] = '&laquo;';
entities['172'] = '&not;';
entities['173'] = '&shy;';
entities['174'] = '&reg;';
entities['175'] = '&macr;';
entities['176'] = '&deg;';
entities['177'] = '&plusmn;';
entities['178'] = '&sup2;';
entities['179'] = '&sup3;';
entities['180'] = '&acute;';
entities['181'] = '&micro;';
entities['182'] = '&para;';
entities['183'] = '&middot;';
entities['184'] = '&cedil;';
entities['185'] = '&sup1;';
entities['186'] = '&ordm;';
entities['187'] = '&raquo;';
entities['188'] = '&frac14;';
entities['189'] = '&frac12;';
entities['190'] = '&frac34;';
entities['191'] = '&iquest;';
entities['192'] = '&Agrave;';
entities['193'] = '&Aacute;';
entities['194'] = '&Acirc;';
entities['195'] = '&Atilde;';
entities['196'] = '&Auml;';
entities['197'] = '&Aring;';
entities['198'] = '&AElig;';
entities['199'] = '&Ccedil;';
entities['200'] = '&Egrave;';
entities['201'] = '&Eacute;';
entities['202'] = '&Ecirc;';
entities['203'] = '&Euml;';
entities['204'] = '&Igrave;';
entities['205'] = '&Iacute;';
entities['206'] = '&Icirc;';
entities['207'] = '&Iuml;';
entities['208'] = '&ETH;';
entities['209'] = '&Ntilde;';
entities['210'] = '&Ograve;';
entities['211'] = '&Oacute;';
entities['212'] = '&Ocirc;';
entities['213'] = '&Otilde;';
entities['214'] = '&Ouml;';
entities['215'] = '&times;';
entities['216'] = '&Oslash;';
entities['217'] = '&Ugrave;';
entities['218'] = '&Uacute;';
entities['219'] = '&Ucirc;';
entities['220'] = '&Uuml;';
entities['221'] = '&Yacute;';
entities['222'] = '&THORN;';
entities['223'] = '&szlig;';
entities['224'] = '&agrave;';
entities['225'] = '&aacute;';
entities['226'] = '&acirc;';
entities['227'] = '&atilde;';
entities['228'] = '&auml;';
entities['229'] = '&aring;';
entities['230'] = '&aelig;';
entities['231'] = '&ccedil;';
entities['232'] = '&egrave;';
entities['233'] = '&eacute;';
entities['234'] = '&ecirc;';
entities['235'] = '&euml;';
entities['236'] = '&igrave;';
entities['237'] = '&iacute;';
entities['238'] = '&icirc;';
entities['239'] = '&iuml;';
entities['240'] = '&eth;';
entities['241'] = '&ntilde;';
entities['242'] = '&ograve;';
entities['243'] = '&oacute;';
entities['244'] = '&ocirc;';
entities['245'] = '&otilde;';
entities['246'] = '&ouml;';
entities['247'] = '&divide;';
entities['248'] = '&oslash;';
entities['249'] = '&ugrave;';
entities['250'] = '&uacute;';
entities['251'] = '&ucirc;';
entities['252'] = '&uuml;';
entities['253'] = '&yacute;';
entities['254'] = '&thorn;';
entities['255'] = '&yuml;';
}
 
if (useQuoteStyle !== 'ENT_NOQUOTES') {
entities['34'] = '&quot;';
}
if (useQuoteStyle === 'ENT_QUOTES') {
entities['39'] = '&#39;';
}
entities['60'] = '&lt;';
entities['62'] = '&gt;';
 
// ascii decimals to real symbols
for (decimal in entities) {
if (entities.hasOwnProperty(decimal)) {
hash_map[String.fromCharCode(decimal)] = entities[decimal];
}
}
 
return hash_map;
}
 
function htmlentities(string, quote_style, charset, double_encode) {
// From: http://phpjs.org/functions
// + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + improved by: nobbler
// + tweaked by: Jack
// + bugfixed by: Onno Marsman
// + revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + bugfixed by: Brett Zamir (http://brett-zamir.me)
// + input by: Ratheous
// + improved by: Rafa. Kukawski (http://blog.kukawski.pl)
// + improved by: Dj (http://phpjs.org/functions/htmlentities:425#comment_134018)
// - depends on: get_html_translation_table
// * example 1: htmlentities('Kevin & van Zonneveld');
// * returns 1: 'Kevin &amp; van Zonneveld'
// * example 2: htmlentities("foo'bar","ENT_QUOTES");
// * returns 2: 'foo&#039;bar'
var hash_map = this.get_html_translation_table('HTML_ENTITIES', quote_style),
symbol = '';
string = string == null ? '' : string + '';
 
if (!hash_map) {
return false;
}
 
if (quote_style && quote_style === 'ENT_QUOTES') {
hash_map["'"] = '&#039;';
}
 
if (!!double_encode || double_encode == null) { // TODO: korrekt "== null"? nicht "!= null"?
for (symbol in hash_map) {
if (hash_map.hasOwnProperty(symbol)) {
string = string.split(symbol).join(hash_map[symbol]);
}
}
} else {
string = string.replace(/([\s\S]*?)(&(?:#\d+|#x[\da-f]+|[a-zA-Z][\da-z]*);|$)/g, function (ignore, text, entity) {
for (symbol in hash_map) {
if (hash_map.hasOwnProperty(symbol)) {
text = text.split(symbol).join(hash_map[symbol]);
}
}
 
return text + entity;
});
}
 
return string;
}
 
/* accepts parameters
* h Object = {h:x, s:y, v:z}
* OR
* h, s, v
* This code expects 0 <= h, s, v <= 1
* http://stackoverflow.com/a/17243070
*/
function HSVtoRGB(h, s, v) {
var r, g, b, i, f, p, q, t;
if (h && s === undefined && v === undefined) {
s = h.s, v = h.v, h = h.h;
}
i = Math.floor(h * 6);
f = h * 6 - i;
p = v * (1 - s);
q = v * (1 - f * s);
t = v * (1 - (1 - f) * s);
switch (i % 6) {
case 0: r = v, g = t, b = p; break;
case 1: r = q, g = v, b = p; break;
case 2: r = p, g = v, b = t; break;
case 3: r = p, g = q, b = v; break;
case 4: r = t, g = p, b = v; break;
case 5: r = v, g = p, b = q; break;
}
return {
r: Math.floor(r * 255),
g: Math.floor(g * 255),
b: Math.floor(b * 255)
};
}
 
// Returns something between 0..255
function crc8(message) {
// return parseInt(CryptoJS.SHA256(message).toString().substr(0,2), 16);
// return parseInt(CryptoJS.MD5(message).toString().substr(0,2), 16);
return crc32(message)%256;
}
 
// http://stackoverflow.com/a/2998822
function pad(num, size) {
var s = num+"";
while (s.length < size) s = "0" + s;
return s;
}
 
function html_rgb(r, g, b) {
return "#" + pad(r.toString(16), 2) + pad(g.toString(16), 2) + pad(b.toString(16), 2);
 
}
 
function getToken() {
return new Date().getTime() + randNum(0, 999999);
}
 
function replaceURLWithHTMLLinks(text) {
// TODO: deferer?
 
// test@example.com
text = text.replace(/mailto:(.+?)@/ig, "mailto:$1#");
text = text.replace(/(([^>" ]+?)@([^<" ]+))/ig, "<a href=\"mailto:$1\" target=\"_blank\">$1</a>");
text = text.replace(/mailto:(.+?)#/ig, "mailto:$1@");
 
// www.example.com
text = text.replace(/:\/\/www\./ig, "://###.");
text = text.replace(/\b(www\.(.+?))\b/ig, "http://$1");
text = text.replace(/:\/\/###\./ig, "://www.");
 
// http://www.google.com
// https://stackoverflow.com/questions/37684/how-to-replace-plain-urls-with-links
var exp = /(\b(https?|ftp|file|mailto):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
text = text.replace(/href="(.{1,5}?):/ig, "href=\"$1#");
text = text.replace(exp, "<a href=\"$1\" target=\"_blank\">$1</a>");
text = text.replace(/href="(.{1,5}?)#/ig, "href=\"$1:");
 
return text;
}
 
function luminance_perceived(r, g, b) {
// Luminance (standard, objective)
// http://stackoverflow.com/a/596243
// return (0.2126*r) + (0.7152*g) + (0.0722*b);
 
// Luminance (perceived option 1)
// http://stackoverflow.com/a/596243
// return (0.299*r) + (0.587*g) + (0.114*b);
 
// Luminance (perceived option 2, slower to calculate)
// http://alienryderflex.com/hsp.html
// return Math.sqrt(0.299*Math.pow(r,2) + 0.587*Math.pow(g,2) + 0.114*Math.pow(b,2))
 
// TODO: Is this the correct formula?
return Math.sqrt(0.241*Math.pow(r,2) + 0.691*Math.pow(g,2) + 0.068*Math.pow(b,2))
}
 
function colorizeUsername(username, salt) {
if (salt === undefined) salt = "";
 
// return "#" + CryptoJS.SHA256(username).toString().substr(0,6);
 
// TODO: is there any method obtaining the background color in runtime? instead of using THEME_DARK
 
var x = crc8(username+salt);
var rgb = HSVtoRGB(x/255, 1, 0.75);
 
var bg_lum = <?php if (THEME_DARK) echo 0 /* assume #000011 */; else echo 255 /* assume white */; ?>;
var fg_lum = luminance_perceived(rgb.r, rgb.g, rgb.b);
 
var lum_dif = Math.floor(Math.abs(bg_lum-fg_lum));
 
if (lum_dif < 128) {
<?php if (THEME_DARK) { ?>
rgb.r = (rgb.r + (128-lum_dif)); if (rgb.r > 255) rgb.r = 255;
rgb.g = (rgb.g + (128-lum_dif)); if (rgb.g > 255) rgb.g = 255;
rgb.b = (rgb.b + (128-lum_dif)); if (rgb.b > 255) rgb.b = 255;
<?php } else { ?>
rgb.r = (rgb.r - (128-lum_dif)); if (rgb.r < 0) rgb.r = 0;
rgb.g = (rgb.g - (128-lum_dif)); if (rgb.g < 0) rgb.g = 0;
rgb.b = (rgb.b - (128-lum_dif)); if (rgb.b < 0) rgb.b = 0;
<?php } ?>
}
 
return html_rgb(rgb.r, rgb.g, rgb.b);
}
 
// --- Getter and setter
 
function encryptionEnabled() {
return document.getElementById("doencrypt").checked == 1;
}
 
function getPassword() {
return document.getElementById("pwd").value.trim();
}
 
function autoscrollEnabled() {
return document.getElementById("autoscroll").checked == 1;
}
 
// --- MD5
 
var selftest_md5_finished = false;
function selftest_md5() {
if (selftest_md5_finished) return;
selftest_md5_finished = true;
 
var errors = "";
cmp_a = CryptoJS.enc.Base64.stringify(CryptoJS.MD5("Message"));
cmp_b = "TCqP5+ryRyHMep8BdRFb1A==";
if (cmp_a !== cmp_b) {
errors += "MD5 self test failed!\n";
console.error("MD5 self test failed: '" + cmp_a + "' vs. '" + cmp_b + "'");
}
 
if (errors) {
alert(errors+"\nYour browser seems to be buggy. Decryption of particular messages might fail.");
} else {
console.info("MD5 self test passed");
}
}
 
function md5(message) {
selftest_md5();
var hash = CryptoJS.MD5(message);
hash = CryptoJS.enc.Base64.stringify(hash);
return hash;
}
 
// --- SHA256
 
var selftest_sha256_finished = false;
function selftest_sha256() {
if (selftest_sha256_finished) return;
selftest_sha256_finished = true;
 
var errors = "";
cmp_a = CryptoJS.enc.Base64.stringify(CryptoJS.SHA256("Message"));
cmp_b = "L3dmip37+NWEi57rSnFFypTG7ZI25Kdz9tyvpRMrL5E=";
if (cmp_a !== cmp_b) {
errors += "SHA256 self test failed!\n";
console.error("SHA256 self test failed: '" + cmp_a + "' vs. '" + cmp_b + "'");
}
 
if (errors) {
alert(errors+"\nYour browser seems to be buggy. Decryption of particular messages might fail.");
} else {
console.info("SHA256 self test passed");
}
}
 
function sha256(message) {
selftest_sha256();
var hash = CryptoJS.SHA256(message);
hash = CryptoJS.enc.Base64.stringify(hash);
return hash;
}
 
// --- AES
 
var selftest_aes_finished = false;
function selftest_aes() {
if (selftest_aes_finished) return;
selftest_aes_finished = true;
 
var errors = "";
var cmp_a = CryptoJS.AES.decrypt("U2FsdGVkX19kJJkA0NL7WJRdXKrdqDcf6A2yDODaL2g=", "Secret Passphrase").toString(CryptoJS.enc.Utf8);
var cmp_b = "Message";
if ((cmp_a !== cmp_b) || (aes_dec(aes_enc("Message")) !== "Message")) {
errors += "AES self test failed!\n";
console.error("AES self test failed: '" + cmp_a + "' vs. '" + cmp_b + "'");
}
 
if (errors) {
alert(errors+"\nYour browser seems to be buggy. Decryption of particular messages might fail.");
} else {
console.info("AES self test passed");
}
}
 
function aes_enc(msg, ver) {
// ver is currently not used
selftest_aes();
var passwd = getPassword();
return CryptoJS.AES.encrypt(msg, roomSalt+passwd);
}
 
function aes_dec(msg, ver) {
// ver is currently not used
selftest_aes();
var passwd = getPassword();
try {
return CryptoJS.AES.decrypt(msg, roomSalt+passwd).toString(CryptoJS.enc.Utf8);
} catch (e) {
return null;
}
}
 
// --- Decrypting stuff
 
// Alternative hash digest for compatibility issues
// Some browsers like Jumanji have problems using SHA1 or SHA2, but work with MD5, e.g.
// Jumanji 1.1.2.4 (versionsangabe nicht sicher) ist inkompatibel mit CryptoJS 3.1.2
// UA = "Mozilla/5.0 (X11; Linux armv7l) AppleWebKit/534.26+ (KHTML, like Gecko) Version/5.0 Safari/534.26+ jumanji/0.0"
// CryptoJS.MD5("Message"):
// - Normal: 4c2a8fe7eaf24721cc7a9f0175115bd4
// - Jumanji: 4c2a8fe7eaf24721cc7a9f0175115bd4 (OK)
// CryptoJS.SHA1("Message"):
// - Normal: 68f4145fee7dde76afceb910165924ad14cf0d00
// - Jumanji: 5a5aa74ecae1d696900b034d5f1b71497c170ea0 (Error)
// CryptoJS.SHA256("Message"):
// - Normal: 2f77668a9dfbf8d5848b9eeb4a7145ca94c6ed9236e4a773f6dcafa5132b2f91
// - Jumanji: 5a28f8b8778c15a166f7f17ebb89ce8e8381fbb5e39ddc2511239793119a649e (Error)
// CryptoJS.AES.encrypt("Message", "Secret Passphrase"):
// - Normal: U2FsdGVkX19zlzNcfljComkcU0A7XfZ+gzZbI+GyFm0=
// - Jumanji: U2FsdGVkX19kJJkA0NL7WJRdXKrdqDcf6A2yDODaL2g= (OK)
// This is a fast version (4x MD5) necessary for slow computers with ARM architecture
function specialMD5fast4(message) {
var a = md5("IuErOmVyPeL2ek6e16vkjTWjssgLmd" + message);
var b = md5("8wxdm3mVi8UQXdboJvCctYwm8ZxTyX" + message);
return md5(a+b) + md5(b+a);
}
 
function specialHash(val, entrySalt, version) {
var hash = null;
if (version == 1) {
hash = sha256(roomSalt+entrySalt+val);
} else if (version == 2) {
hash = specialMD5fast4(roomSalt+entrySalt+val);
} else {
console.error("Version " + version + " is unknown at specialHash()");
return null;
}
return entrySalt + "_" + hash + "_ver" + version;
}
 
function cbDecrypt(str, pEntrySalt, pHash, pVer, pMesg, offset, s) {
var passwd = getPassword();
 
var hash_client = specialHash(passwd, pEntrySalt, pVer);
var hash_server = pEntrySalt + "_" + pHash + "_ver" + pVer;
if (hash_client == hash_server) {
var msg = aes_dec(pMesg, pVer);
msg = htmlentities(msg, "ENT_NOQUOTES", "UTF-8");
return "<span class=\"encrypted\">" + msg + "</span>";
} else {
// TODO: maybe we can still make the string invisible or something, so it becomes more user comfortable?
// TODO: maybe we can still save the decode-information so we can revert decryption as soon as the password is changed again?
return str; // can be encrypted later
}
}
 
function cbUsername(str, pUsername, offset, s) {
var color = colorizeUsername(pUsername);
 
return "<font color=\"" + color + "\"><b>[" + pUsername + "]</b></font>: ";
}
 
function cbDate(str, pDateTime, offset, s) {
return pDateTime + " - ";
}
 
var formatAndDecryptIsRunning = false; // to prevent that two instances of formatAndDecrypt() run simultaneously
function formatAndDecrypt() {
// Set the mutex and write a "Decrypting..." message
//while (formatAndDecryptIsRunning);
if (formatAndDecryptIsRunning) return; // If there is already a decrypt process, we will exit instead of waiting (because we don't need 2 subsequent decryptions)
formatAndDecryptIsRunning = true;
changeStatusLabel(); // Add "Decrypting..." message
try {
var message = document.getElementById("chatmessages").innerHTML;
 
// TODO: man darf kein ")" im benutzernamen haben!!!!
 
// first decode
message = message.replace(/\(dec_(.*?)_(.+?)_ver(.+?): (.+?)\)/g, cbDecrypt);
 
// then do formating
message = message.replace(/\(date: (.+?)\)/g, cbDate);
message = message.replace(/\(user: (.+?)\)/g, cbUsername);
 
// make links clickable
message = replaceURLWithHTMLLinks(message);
 
// Only refresh if something has been changed. otherwise we could not copy-paste when it is permanently refreshing
if (document.getElementById("chatmessages").innerHTML != message) {
document.getElementById("chatmessages").innerHTML = message;
}
} finally {
// Release the mutex and remove the "Decrypting..." message
formatAndDecryptIsRunning = false;
changeStatusLabel(); // Remove "Decrypting..." message
}
}
 
// --- Status label function
 
function alertUser() {
// TODO: play sound?
}
 
function changeStatusLabel() {
var status = "";
 
if (addMessagePendingQueue.length > 0) {
status = "Sending (" + addMessagePendingQueue.length + ")...";
} else if (formatAndDecryptIsRunning) {
status = "Decrypting...";
} else if (refreshFailedTimerSet) {
status = "Checking...";
} else {
status = curseq + " posts";
}
 
document.getElementById("status").innerHTML = status;
 
var title = ""; // document.title;
 
// If tab is not in focus, we might want to alert the user when new posts arrived
if ((curseq > 0) && (!curVisible) && (backgroundSeqCount != curseq)) {
blink = 1 - blink;
title = "(" + (curseq-backgroundSeqCount) + ") " + htmlentities(room);
if (blink == 1) {
title = title.toUpperCase();
} else {
title = title.toLowerCase();
}
} else {
title = htmlentities(room);
}
title += " - " + htmlentities(product);
 
if (document.title != title) document.title = title;
}
 
// --- Refresh
 
var refreshTimer = null;
var refreshTimerSet = false;
var refreshFailedTimer = null;
var refreshFailedTimerSet = false;
 
function refresh_failed(id) {
sajax_cancel(id);
 
// var refreshFailedTimerSet = (typeof refreshFailedTimer !== 'undefined');
// var refreshFailedTimerSet = (refreshFailedTimer !== null);
if (refreshFailedTimerSet) {
clearTimeout(refreshFailedTimer);
refreshFailedTimer = null;
refreshFailedTimerSet = false;
}
 
// Remove "Checking..." message
// changeStatusLabel();
 
// TODO: die meldung kommt viel zu oft, auch nachdem alles wieder geht. warum?
// alert("Refresh failed. Will try again.");
refresh();
}
 
function refresh_cb(data) {
// var refreshFailedTimerSet = (typeof refreshFailedTimer !== 'undefined');
// var refreshFailedTimerSet = (refreshFailedTimer !== null);
if (refreshFailedTimerSet) {
clearTimeout(refreshFailedTimer);
refreshFailedTimer = null;
refreshFailedTimerSet = false;
}
 
var newcurseq = data[0];
var new_data = data[1];
var userstats = data[2];
 
// User list
document.getElementById("activeusers").innerHTML = '<b>ACTIVE USERS:</b><br><br>';
for (var i = 0; i < userstats.length; ++i ) {
var username = userstats[i]['USERNAME'];
var color = colorizeUsername(username);
var postfix = (userstats[i]['UNIQUEID'] == uniqueID) ? ' (you)' : '';
document.getElementById("activeusers").innerHTML += '<font color="'+color+'"><b>'+htmlentities(username)+'</b></font>'+postfix+'<br>';
}
 
var timeout = <?php echo TIMER_1; ?>; // default timeout
if (newcurseq != curseq) {
curseq = newcurseq;
 
document.getElementById("chatmessages").innerHTML += new_data;
 
formatAndDecrypt();
 
if (autoscrollEnabled()) {
scrollToBottom();
}
 
if (!curVisible) {
// blink = 0;
alertUser();
}
 
timeout = <?php echo TIMER_2; ?>; // shorter timeout when a new message has just arrived
}
 
// Remove "Checking..." message
changeStatusLabel();
 
if (!refreshTimerSet) {
refreshTimer = setTimeout("refresh()", timeout);
refreshTimerSet = true;
}
}
 
function refresh() {
// Only run the timer once (since we also call refresh() when a new post is added)
// var refreshTimerSet = (typeof refreshTimer !== 'undefined');
// var refreshTimerSet = (refreshTimer !== null);
if (refreshTimerSet) {
clearTimeout(refreshTimer);
refreshTimer = null;
refreshTimerSet = false;
}
 
var sajax_id = x_refresh(room, curseq, user, uniqueID, refresh_cb);
 
// TODO: gibt es eine bessere möglichkeit festzustellen, ob der request gestorben ist? ein negativer callback z.B.?
if (!refreshFailedTimerSet) {
refreshFailedTimer = setTimeout(function() { refresh_failed(sajax_id); }, <?php echo TIMER_DEAD; ?>);
refreshFailedTimerSet = true;
}
 
// Add "Checking..." message
changeStatusLabel();
}
 
// --- Add
 
var addMessagePendingQueue = [];
 
function do_encrypt(msg) { // NG: "Encrypting" status message
var msgToServer = "";
 
var lines = msg.split("\n");
for (var i = 0; i < lines.length; ++i ) {
var line = lines[i];
 
// encrypt message
if (encryptionEnabled()) {
var version = <?php echo CFG_CIPHERSUITE; ?>;
var passwd = getPassword();
var entrySalt = randomString(20);
var hash = specialHash(passwd, entrySalt, version);
line = "(dec_" + hash + ": " + aes_enc(line, version) + ")";
}
 
msgToServer += line + "\n";
}
 
return msgToServer.trim();
}
 
function add_get_index_of(token) {
for (var i = 0; i < addMessagePendingQueue.length; ++i ) {
if (addMessagePendingQueue[i].token == token) return i;
}
return -1;
}
 
function add_failed(token) {
var i = add_get_index_of(token);
if (i == -1) return;
 
sajax_cancel(addMessagePendingQueue[i].sajax_id);
 
var failedMsg = addMessagePendingQueue[i].message;
addMessagePendingQueue.remove(i);
changeStatusLabel(); // Remove "Sending..." message
 
// Nachricht ausgeben.
// QUE TODO: automatisch neu versuchen?
// TODO: reihenfolge der nachrichten stimmt nicht.
alert("Following message could not be sent. Please try again:" + failedMsg);
 
// Add message back to the input box, so the user can send it again
if (document.getElementById("line").value.trim() == initMsg.trim()) {
// If login message fails, then clear box first before append
document.getElementById("line").value = "";
}
var newMsgCont = document.getElementById("line").value.trim() + "\n" + failedMsg.trim();
document.getElementById("line").value = newMsgCont.trim();
}
 
function add_cb(data) {
var token = data[0];
 
var i = add_get_index_of(token);
if (i == -1) return;
 
clearTimeout(addMessagePendingQueue[i].failTimer);
addMessagePendingQueue.remove(i);
changeStatusLabel(); // Remove "Sending..." message
 
// Refresh now, so that the new post quickly appears!
refresh();
}
 
var addIsRunning = false; // to prevent that two instances of add() run simultaneously
function add() {
// Set the mutex
while (addIsRunning);
addIsRunning = true;
try {
var msg = document.getElementById("line").value.trim();
if ((msg == "") || (msg == initMsg.trim())) {
return;
} else {
document.getElementById("line").value = "";
}
 
send_msg(msg, 1);
 
sleep(100); // damit es zu keiner racecondition (= posts in falscher reihenfolge) kommen kann
} finally {
// Release the mutex
addIsRunning = false;
}
}
 
function send_msg(msg, encrypt) {
var msgToServer = msg;
 
if (encrypt) {
msgToServer = do_encrypt(msgToServer);
}
 
// We need a token which is sent back by the server, so our succeed-callback can find and remove the entry from the queue.
// We cannot use the sajax_id generated by SAJAX, because we need to send it to the server.
var token = getToken();
var sajax_id = x_add_line(token, room, user, msgToServer, add_cb);
 
// Backup the text, so we can back it up if it fails
// TODO: gibt es eine bessere möglichkeit festzustellen, ob der request gestorben ist? ein negativer callback z.B.?
var t = setTimeout(function() { add_failed(token); }, <?php echo TIMER_DEAD; ?>);
addMessagePendingQueue.push({
"token": token,
"sajax_id": sajax_id,
"message": msg,
"failTimer": t
} );
changeStatusLabel(); // Add "Sending..." message
 
return sajax_id;
}
 
// --- Logoff
 
var logoffEventFired = 0;
function send_logoff() {
if (logoffEventFired == 1) return;
logoffEventFired = 1;
 
send_msg("(Logging off)", 0);
 
document.getElementById("pwd").value = "";
 
// TODO: go back to login form
}
 
var logonEventFired = 0;
function send_logon() {
if (logonEventFired == 1) return;
logonEventFired = 1;
 
send_msg("(Logging in)", 0);
}
 
// --- Initialization stuff
 
var initMsg = "(enter your message here)"; /* const */
 
function initShowHideHandlers() {
// https://stackoverflow.com/questions/1060008/is-there-a-way-to-detect-if-a-browser-window-is-not-currently-active
 
var hidden = "hidden";
 
// Standards:
if (hidden in document)
document.addEventListener("visibilitychange", onchange);
else if ((hidden = "mozHidden") in document)
document.addEventListener("mozvisibilitychange", onchange);
else if ((hidden = "webkitHidden") in document)
document.addEventListener("webkitvisibilitychange", onchange);
else if ((hidden = "msHidden") in document)
document.addEventListener("msvisibilitychange", onchange);
// IE 9 and lower:
else if ('onfocusin' in document)
document.onfocusin = document.onfocusout = onchange;
// All others:
else
window.onpageshow = window.onpagehide = window.onfocus = window.onblur = onchange;
 
function onchange(evt) {
var v = true, h = false,
evtMap = {
focus:v, focusin:v, pageshow:v, blur:h, focusout:h, pagehide:h
};
 
evt = evt || window.event;
var res;
if (evt.type in evtMap) {
res = evtMap[evt.type];
} else {
res = !this[hidden];
}
 
if (res) {
onChatShow();
} else {
onChatHide();
}
}
}
 
function initReturnKeyHandler() {
var wage = document.getElementById("line");
wage.addEventListener("keydown", function (e) {
if (e.which == 13 || e.keyCode === 13) { //checks whether the pressed key is "Enter"
add();
}
});
// important for <textarea> otherwise we'll have a #13 in the box after it
wage.addEventListener("keyup", function (e) {
if (e.which == 13 || e.keyCode === 13) { //checks whether the pressed key is "Enter"
document.getElementById("line").value = "";
}
});
}
 
function initUnloadHandler() {
// TODO: does not work when following a link or when clicking "back button"
window.onbeforeunload = function() {
send_logoff();
}
window.addEventListener("beforeunload", function(e) {
send_logoff();
}, false);
}
 
// Delayed (single run) onkeydown event for the password field
var delayedKeyChangeTimer = null;
var delayedKeyChangeTimerSet = false;
function initKeyChangeHandler() {
// We use onkeydown instead of onkeypress, otherwise "del" or "ctrl+v" won't work on Chrome
// See http://help.dottoro.com/ljlwfxum.php
 
document.getElementById("pwd").onkeydown = function(evt) {
var enterPressed = (evt.which == 13 || evt.keyCode === 13);
 
// var delayedKeyChangeTimerSet = (typeof delayedKeyChangeTimer !== 'undefined');
// var delayedKeyChangeTimerSet = (delayedKeyChangeTimer !== null);
if (delayedKeyChangeTimerSet) {
clearTimeout(delayedKeyChangeTimer);
delayedKeyChangeTimer = null;
delayedKeyChangeTimerSet = false;
}
 
var timeout = enterPressed ? 0 : <?php echo TIMER_KEYCHANGE; ?>;
if (!delayedKeyChangeTimerSet) {
delayedKeyChangeTimer = setTimeout("formatAndDecrypt()", <?php echo TIMER_KEYCHANGE; ?>);
delayedKeyChangeTimerSet = true;
}
};
}
 
function initPage() {
uniqueID=randomString(20);
// document.getElementById("pwd").value = "";
document.getElementById("line").value = initMsg;
changeStatusLabel();
initUnloadHandler();
initReturnKeyHandler();
initShowHideHandlers();
initKeyChangeHandler();
refresh();
// We do it at last, otherwise we will have the problem that the chat will not be scrolled to the very bottom in the beginning
send_logon();
}
 
// --- Misc event handlers
 
function onChatShow() {
curVisible = true;
changeStatusLabel();
}
 
function onChatHide() {
curVisible = false;
blink = 1;
backgroundSeqCount = curseq;
// changeStatusLabel();
}
 
function onFocusChatField() {
if (document.getElementById("line").value == initMsg) {
document.getElementById("line").value = "";
}
}
 
</script>
 
</head>
 
<body class="chatroom" onload="initPage();">
 
<div id="header">
<font size="+2"><font color="orange"><?php echo htmlentities(PRODUCT_NAME); ?> <font size="-1"><?php
echo htmlentities(MCC_VER);
?></font></font> <span class="userid">[<?php
echo htmlentities("$ses_user@$ses_room");
?>]</span></font><br>
<span class="pwdenter">Password for client-side encryption of messages: <input type="password" name="pwd" id="pwd" value=""></span>
<span class="logout"><a href="<?php echo $_SERVER['SCRIPT_NAME']; ?>" onClick="send_logoff();return true;">Back to login form</a></span>
</div>
<div id="status"><em>Loading...</em></div>
<div id="activeusers"></div>
<div id="chatmessages"></div>
<form name="f" action="#" onsubmit="add();return false;">
<div id="postarea">
<textarea cols="70" rows="3" name="line" id="line" value="" onfocus="onFocusChatField()"></textarea>
<input type="button" name="check" value="Post message" onclick="add();return false;" class="button">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" width="50%"><label><input type="checkbox" id="autoscroll" name="autoscroll" value="yes" checked> Scroll down when new message arrives</label><br></td>
<td align="left" width="50%"><label><input type="checkbox" id="doencrypt" name="doencrypt" value="yes" checked> Encrypt all messages</label><br></td>
</tr>
</table>
</div>
</form>
 
</body>
 
<?php
 
} else if ($show_list) {
 
?>
 
</head>
 
<body>
 
<h1><?php echo htmlentities(PRODUCT_NAME); ?> <?php echo htmlentities(MCC_VER); ?></h1>
 
<h2>List chat rooms</h2>
 
<table border="1" cellpadding="4" cellspacing="0">
<thead><tr>
<td>Chat room</td>
<td>Messages</td>
<td>Users</td>
<td>Last activity</td>
</tr></thead>
<tbody>
<?php
 
$rooms = list_rooms();
foreach ($rooms as &$room) {
$room_file = chatroom_file($room);
$messages = count_messages($room);
$users = count_users($room);
$last_activity = date('Y-m-d H:i:s o', filemtime($room_file));
echo '<tr>';
echo '<td>'.htmlentities($room).'</td>';
echo '<td>'.htmlentities($messages).'</td>';
echo '<td>'.htmlentities($users).'</td>';
echo '<td>'.htmlentities($last_activity).'</td>';
echo '</tr>';
}
 
?>
</tbody>
</table>
 
<p><a href="<?php echo $_SERVER['SCRIPT_NAME']; ?>">Back to login</a></p>
 
<?php
 
} else {
 
?>
 
</head>
 
<body>
 
<h1><?php echo htmlentities(PRODUCT_NAME); ?> <?php echo htmlentities(MCC_VER); ?></h1>
 
<h2>Login</h2>
 
<form action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="POST">
<input type="hidden" name="sent" value="1">
 
<?php
 
if (isset($_POST['sent'])) {
if ($ses_room == '') {
echo "<p><span class=\"error\"><b>Error:</b> You must enter a chat room name.</span></p>";
} elseif (!$chat_exists) {
echo "<p><span class=\"error\"><b>Error:</b> Chat room <b>".htmlentities($ses_room)."</b> does not exist. Please ask an administrator to create one.</span></p>";
}
}
 
?>
 
Room<?php if (CHAT_MUST_EXIST) echo " (chat room must exist)"; ?>:<br>
<input type="text" name="ses_room" value="<?php echo $ses_room; ?>"><br><br>
 
<?php
 
if (isset($_POST['sent'])) {
if ($ses_user == '') {
echo "<p><span class=\"error\"><b>Error:</b> You must enter an username.</span></p>";
}
}
 
?>
 
Username (you can freely choose it yourself):<br>
<input type="text" name="ses_user" value="<?php echo $ses_user; ?>"><br><br>
 
<input type="submit" value="Login" class="button">
 
<?php
if (CHAT_MUST_EXIST) {
if (isset($_POST['sent'])) {
if (($admin_pwd != '') && (!adminAuth($admin_pwd, ACTION_CREATE_ROOM))) {
echo "<p><span class=\"error\"><b>Error:</b> This is not the correct administrator password.</span></p>";
}
}
?>
<br><br><br>Optional: Admin-Password for creating a new chat:<br>
<input type="password" name="admin_pwd" value=""><br><br>
<?php
}
?>
 
</form>
 
<hr>
 
<h2>List chat rooms</h2>
 
<form action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="POST">
<input type="hidden" name="list_chatrooms" value="1">
 
<?php
if (LIST_CHATS_REQUIRE_PWD) {
if (isset($_POST['list_chatrooms'])) {
echo "<p><span class=\"error\"><b>Error:</b> Wrong password.</span></p>";
}
?>
Admin-Password for listing chats:<br>
<input type="password" name="admin_pwd" value=""><br><br>
<?php
}
?>
 
<input type="submit" value="List chat rooms" class="button"><br><br>
 
</form>
 
<hr>
 
<p><a href="http://www.viathinksoft.com/redir.php?id=324897" target="_blank"><?php echo htmlentities(PRODUCT_NAME); ?> <?php echo htmlentities(MCC_VER); ?></a> &copy; 2014-2018 <a href="http://www.viathinksoft.com/" target="_blank">ViaThinkSoft</a>.</a></p>
 
</body>
 
<?php
}
?>
 
</html>
/trunk/install.sh
0,0 → 1,45
#!/bin/bash
 
DIR=$( dirname "$0" )
 
if [ ! -d "$DIR"/chats ]; then
mkdir "$DIR"/chats
 
# TODO: is 1777 ok?
chmod 1777 "$DIR"/chats
fi
 
if [ ! -f "$DIR"/chats/.htaccess ]; then
(
echo "Order Deny,Allow"
echo "Deny From All"
) > "$DIR"/chats/.htaccess
fi
 
if [ ! -d "$DIR"/dependencies ]; then
mkdir "$DIR"/dependencies
cd "$DIR"/dependencies
 
wget http://www.boutell.com/scripts/jsonwrapper.tar.gz
tar -zxvf jsonwrapper.tar.gz
rm jsonwrapper.tar.gz
 
wget https://crypto-js.googlecode.com/files/CryptoJS%20v3.1.2.zip
mkdir cryptojs
unzip -d cryptojs/ "CryptoJS v3.1.2.zip"
rm "CryptoJS v3.1.2.zip"
 
wget https://github.com/AJenbo/Sajax/archive/master.zip
unzip master.zip
rm master.zip
mv Sajax-master sajax
 
mkdir crc32-js-php
cd crc32-js-php
wget https://raw.github.com/wbond/crc32-js-php/master/crc32.js
fi
 
if [ ! -f "$DIR"/config/config.inc.php ]; then
cp "$DIR"/config/config.original.inc.php "$DIR"/config/config.inc.php
nano "$DIR"/config/config.inc.php
fi
Property changes:
Added: svn:executable
+*
\ No newline at end of property
Added: svn:mime-type
+text/x-sh
\ No newline at end of property
/trunk/private/.htaccess
0,0 → 1,2
Order Deny,Allow
Deny From All
/trunk/private/old_messenger/chat.php
0,0 → 1,29
<?php
 
if (!isset($_COOKIE['mov_nick'])) {
header('location:index.php');
die();
}
 
if (isset($_GET['show'])) {
$show = $_GET['show'];
} else {
$show = 20;
}
 
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>MOV Alpha</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
 
<frameset rows="*,90" cols="*" framespacing="1" frameborder="yes" border="1" bordercolor="#FF0000">
<frame src="messages.php?show=<?php echo $show; ?>" name="mainFrame">
 
<frame src="input.php" name="bottomFrame" scrolling="NO" noresize >
</frameset>
<noframes><body>
 
</body></noframes>
</html>
/trunk/private/old_messenger/col.inc.php
0,0 → 1,57
<?php
 
// http://www.actionscript.org/forums/archive/index.php3/t-50746.html
function HSV_TO_RGB ($H, $S, $V) // HSV Values:Number 0-1
{ // RGB Results:Number 0-255
$RGB = array();
 
if($S == 0)
{
$R = $G = $B = $V * 255;
}
else
{
$var_H = $H * 6;
$var_i = floor( $var_H );
$var_1 = $V * ( 1 - $S );
$var_2 = $V * ( 1 - $S * ( $var_H - $var_i ) );
$var_3 = $V * ( 1 - $S * (1 - ( $var_H - $var_i ) ) );
 
if ($var_i == 0) { $var_R = $V ; $var_G = $var_3 ; $var_B = $var_1 ; }
else if ($var_i == 1) { $var_R = $var_2 ; $var_G = $V ; $var_B = $var_1 ; }
else if ($var_i == 2) { $var_R = $var_1 ; $var_G = $V ; $var_B = $var_3 ; }
else if ($var_i == 3) { $var_R = $var_1 ; $var_G = $var_2 ; $var_B = $V ; }
else if ($var_i == 4) { $var_R = $var_3 ; $var_G = $var_1 ; $var_B = $V ; }
else { $var_R = $V ; $var_G = $var_1 ; $var_B = $var_2 ; }
 
$R = $var_R * 255;
$G = $var_G * 255;
$B = $var_B * 255;
}
 
$RGB['R'] = $R;
$RGB['G'] = $G;
$RGB['B'] = $B;
 
return $RGB;
}
 
function str_to_color($str) {
$str = md5(strtolower($str));
 
$sum = 0;
for ($i=0; $i<strlen($str); $i++) {
$c = substr($str,$i,1);
$sum += ord($c);
}
$a = $sum % 255;
 
 
$r = HSV_TO_RGB($a/255, 1, 0.75);
 
return '#'.str_pad(dechex($r['R']), 2, '0', STR_PAD_LEFT).
str_pad(dechex($r['G']), 2, '0', STR_PAD_LEFT).
str_pad(dechex($r['B']), 2, '0', STR_PAD_LEFT);
}
 
?>
/trunk/private/old_messenger/files/DirectoryHashCalculator.class.php
0,0 → 1,98
<?php
 
class DirectoryHashCalculator {
/*
 
Directory Hash V3 by Daniel Marschall
 
<directoryhash> ::= SHA1(<directorycontext>)
<directorycontext> ::= "" | <entry>
<entries> ::= <entry> ["|" <entry>]
IMPORTANT: (MD5) SORTED ASCENDING!
<entry> ::= <file_md5_hash> <filenames>
<filenames> ::= "*" <relative_directory> <filename> [<filenames>]
IMPORTANT: (RelativeDir+Filename) SORTED ASCENDING!
<file_md5_hash> ::= MD5(FILECONTENT(<relative_directory> <filename>))
<filename> ::= given.
IMPORTANT: All directories (this automatically
excludes "", "." and "..") and non-existing resp.
non-readable files are not included.
addFile() will return false.
<relative_directory> ::= given.
Note: Usually, the directory is in relative diction.
IMPORTANT: "./" is always stripped from beginning!
IMPORTANT: "\" is made to "/"!
 
Example:
"" --> Empty directory
<hash1>*<file1_with_hash1>*<file2_with_hash1>|<hash2>*<file1_with_hash2>
*/
 
private $hashes;
 
function __construct() {
$this->clear();
}
 
private static function makeFilenameConsistently(&$filename) {
// Rule 1: Cut off "./" from beginning
if (substr($filename, 0, 2) == './') {
$filename = substr($filename, 2, strlen($filename)-2);
}
// Rule 2: Use "/" instead of "\"
$filename = str_replace('\\', '/', $filename);
}
 
/*
@return
MD5-Hash of the file or FALSE is calculation/adding
was not successful.
*/
public function addFile($file) {
if (!file_exists($file)) return false;
// if (!is_readable($file)) return false;
// if (basename($file) == '') return false;
// if (basename($file) == '.') return false;
// if (basename($file) == '..') return false;
self::makeFilenameConsistently($file);
$file_md5 = md5_file($file);
if ($file_md5 === false) return false; // Error...
$this->hashes[$file_md5][] = $file;
return $file_md5;
}
 
public function clear() {
$this->hashes = array();
}
 
private function getDirectoryContext() {
if (count($this->hashes) == 0) return '';
$directory_context = '';
// Sort md5 hashes ascending (so that the result is equal at every machine)
ksort($this->hashes);
foreach ($this->hashes as $hash => $filenames) {
// Sort filenames ascending (so that the result is equal at every machine)
sort($filenames);
$directory_context .= $hash;
foreach ($filenames as $filename) {
$directory_context .= '*'.$filename;
}
$directory_context .= '|';
}
$directory_context = substr($directory_context, 0, strlen($directory_context)-1);
return $directory_context;
}
 
public function calculateDirectoryHash() {
$directory_context = $this->getDirectoryContext();
return sha1($directory_context);
}
function getVersionDescription() {
return 'Marschall V3';
}
}
 
?>
/trunk/private/old_messenger/files/index.php
0,0 → 1,134
<?php
 
require 'DirectoryHashCalculator.class.php';
 
define('VER', '09.03.2010 21:30');
 
error_reporting(E_ALL | E_NOTICE);
 
$path = dirname($_SERVER['SCRIPT_NAME']);
 
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
 
<html>
 
<head>
<title>Index f&uuml;r <?php echo $path; ?></title>
</head>
 
<body>
 
<h1>Index f&uuml;r <?php echo $path; ?></h1>
 
<hr>
 
<br><table border="1" width="100%">
<tr>
<td><b>Dateiname</b></td>
<td><b>Hochgeladen / Aktualisiert</b> (Sort)</td>
<td align="right"><b>Dateigr&ouml;&szlig;e</b></td>
<td align="right"><b>MD5-Hash</b></td>
</tr><?php
 
$outarray = array();
$sizesum = 0;
$filesum = 0;
$hash_calculator = new DirectoryHashCalculator();
dir_rekursiv('', $outarray, $sizesum, $filesum, $hash_calculator);
ksort($outarray);
 
foreach ($outarray as $value) {
echo $value;
}
 
?>
</table><br>
 
<?php
 
 
$filesum = number_format($filesum, 0, ',', '.');
$sizesum = number_format($sizesum, 0, ',', '.');
 
/*
 
Note:
In this solution, ".*" and "index.html" (this script) and
"DirectoryHashCalculator.class.php" (required by this script)
are not calculated in because dir_rekursiv() ignored them,
so the Directory-Hash-Result may differ from other applications which
implement it.
*/
 
$directory_hash = $hash_calculator->calculateDirectoryHash();
$hash_alg = $hash_calculator->getVersionDescription();
 
echo '<p><code>Berechnung abgeschlossen am '.date('Y-m-d H:i:s \G\M\TO').'<br>';
echo "$filesum Dateien mit $sizesum Byte Gr&ouml;&szlig;e.<br>";
echo "Directory-Hash ($hash_alg): $directory_hash.</code></p>";
echo '<hr>';
echo '<p><i>Directory Listing Script Version '.VER.' &copy; 2010 <a href="http://www.viathinksoft.de/">ViaThinkSoft</a>.</i></p>';
 
?>
 
</body>
 
</html><?php
 
// Ref: http://www.php.net/manual/de/function.urlencode.php#96256
function encode_full_url($url) {
$url = urlencode($url);
$url = str_replace("%2F", "/", $url);
$url = str_replace("%3A", ":", $url);
$url = str_replace("+", "%20", $url); // Neu
return $url;
}
 
function dir_rekursiv($verzeichnis, &$outarray, &$sizesum, &$filesum, $hash_calculator) {
if ($verzeichnis == '') $verzeichnis = './';
$handle = opendir($verzeichnis);
while ($datei = readdir($handle))
{
if (($datei != '.') && ($datei != '..'))
{
$file = $verzeichnis.$datei;
if (is_dir($file)) // Wenn Verzeichniseintrag ein Verzeichnis ist
{
// Erneuter Funktionsaufruf, um das aktuelle Verzeichnis auszulesen
dir_rekursiv($file.'/', $outarray, $sizesum, $filesum, $hash_calculator);
} else {
// Wenn Verzeichnis-Eintrag eine Datei ist, diese ausgeben
if (substr($file, 0, 2) == './') {
$file = substr($file, 2, strlen($file)-2); // './' entfernen
}
if (($file != 'index.php') &&
($file != 'DirectoryHashCalculator.class.php') &&
(substr($file, 0, 1) != '.')) {
$filesize = filesize($file);
$sizesum += $filesize;
$filesum++;
$sizeformat = number_format($filesize, 0, ',', '.');
$file_md5 = $hash_calculator->addFile($file);
if ($file_md5 === false) $file_md5 = '<b>ERROR!</b>';
$mtime = filemtime($file);
$date = date('Y-m-d H:i:s \G\M\TO', $mtime);
if (!isset($outarray[$mtime])) $outarray[$mtime] = '';
$outarray[$mtime] .= '<tr>
<td><a href="'.encode_full_url($file).'" target="_blank">'.str_replace('/', ' / ', $file).'</a></td>
<td>'.$date.'</td>
<td align="right">'.$sizeformat.'</td>
<td align="right"><code>'.$file_md5.'</code></td>
</tr>';
}
}
}
}
closedir($handle);
}
 
?>
/trunk/private/old_messenger/index.php
0,0 → 1,27
<?php
 
include 'col.inc.php';
 
if(!isset($_POST['nickname'])){
echo"<style type=\"text/css\">BODY{font-family:Verdana, Arial, Helvetica, sans-serif}</style>
 
<h1>MOV Login</h1>
<form method=\"post\" action=\"index.php\">
<p>Please enter your name code:</p>
<input name=\"nickname\" type=\"text\" id=\"nickname\">
<input type=\"submit\" value=\" Login \">
</form>
 
<p><a href=\"messages.php?show=all\" target=\"_blank\">Show only message log</a></p>
 
</body>
</html>";
}
else{
setcookie("mov_nick",$_POST['nickname'],0/*,0,"/",""*/);
$fileOpen=@fopen("messages.txt", "a");
@fwrite($fileOpen,date("d.m.Y H:i:s")." <font color=\"".str_to_color($_POST['nickname'])."\"><b>".$_POST['nickname']."</b> <i>betritt den Raum</i></font><br>\n");
fclose($fileOpen);
header("Location:chat.php");
}
?>
/trunk/private/old_messenger/input.php
0,0 → 1,33
<?php
 
include 'col.inc.php';
 
if ($_POST['txt']!="") {
$fileOpen=@fopen("messages.txt", "a");
$_POST['txt'] = stripslashes($_POST['txt']);
$_POST['txt'] = htmlentities($_POST['txt']);
$_POST['txt'] = str_replace('"', '&quot;', $_POST['txt']);
@fwrite($fileOpen,date('d.m.Y H:i:s')." <font color=\"".str_to_color($_COOKIE['mov_nick'])."\"><b>".$_COOKIE['mov_nick']." -- </b></font>".$_POST['txt']."<br>\n");
@fclose($fileOpen);
}
 
echo "<style type=\"text/css\">BODY{font-family:Verdana, Arial, Helvetica, sans-serif}</style>
<form method=\"post\" action=\"input.php\" name=\"inpform\">
<input name=\"txt\" type=\"text\" size=\"75\" id=\"txt\">
<input type=\"submit\" name=\"Submit\" value=\" Chat! \">
</form> <a href=\"logoff.php\" target=\"_top\">Log Off</a>
 
-- <a href=\"messages.php?show=all\" target=\"_blank\">Show full history</a>
 
-- <a href=\"files/\" target=\"_blank\">Show shared files</a><br>
 
 
<script type=\"text/javascript\" language=\"JavaScript\">
<!--
self.focus();
document.inpform.txt.focus();
// -->
</script>
 
";
?>
/trunk/private/old_messenger/logoff.php
0,0 → 1,16
<?php
 
setcookie ("mov_nick", "", time() - 3600);
 
include 'col.inc.php';
 
$fileOpen=@fopen("messages.txt", "a");
@fwrite($fileOpen,date("d.m.Y H:i:s")." <font color=\"".str_to_color($_COOKIE['mov_nick'])."\"><b>".$_COOKIE['mov_nick']."</b> <i>hat dem Raum verlasssen</i></font><br>\n");
fclose($fileOpen);
//echo "<style type=\"text/css\">BODY{font-family:Verdana, Arial, Helvetica, sans-serif}</style><a href=\"index.php\" target=\"_top\">Login Again!</a>";
 
unset($_COOKIE['mov_nick']);
 
header("Location:index.php");
 
?>
/trunk/private/old_messenger/messages.php
0,0 → 1,34
<?php
 
if ($_GET['show'] != 'all') {
echo '<meta http-equiv="refresh" content="2">';
}
 
echo '<style type="text/css">BODY{font-family:Verdana, Arial, Helvetica, sans-serif}</style>';
 
$fileRead = file_get_contents("messages.txt");
 
$expl = explode("\n", $fileRead);
 
$e = count($expl);
 
// -1, da am Dateiende immer "\n" (Leerzeile)
 
if ($_GET['show'] == 'all') {
$s = count($expl);
} else {
$s = $_GET['show'];
}
 
$s = count($expl)-$s-1;
if ($s < 0) $s = 0;
 
for ($i=$s; $i<count($expl)-1; $i++) {
echo "[".str_pad($i+1, 4, '0', STR_PAD_LEFT)."] ".$expl[$i];
}
 
?>
 
<!-- <script>
scrollto(0,2048);
</script> -->
/trunk/private/old_messenger/messages.txt
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
/trunk/tools/.htaccess
0,0 → 1,2
Options -Indexes
 
/trunk/tools/manual_create.php
0,0 → 1,283
<?php
 
// ViaThinkSoft CryptoChat
// (C) 2014 by Daniel Marschall, ViaThinkSoft
// Licensed under the terms of GPLv3
 
// -----------------------------------------------------------------------------------------------
 
require __DIR__ . '/../config/config.inc.php';
define('PRODUCT_NAME', 'CryptoChat');
define('MCC_VER', trim(file_get_contents(__DIR__ . '/../VERSION')));
 
header('Content-type: text/html; charset=utf-8');
 
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
 
<html>
 
<head>
<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=utf-8">
<title><?php echo PRODUCT_NAME; ?> - Manually encrypt chat lines</title>
 
<script type="text/javascript" src="../<?php echo DEP_DIR_CRYPTOJS; ?>/rollups/sha256.js"></script>
<script type="text/javascript" src="../<?php echo DEP_DIR_CRYPTOJS; ?>/rollups/sha1.js"></script>
<script type="text/javascript" src="../<?php echo DEP_DIR_CRYPTOJS; ?>/rollups/aes.js"></script>
<script type="text/javascript" src="../<?php echo DEP_DIR_CRYPTOJS; ?>/rollups/md5.js"></script>
 
<script type="text/javascript">
 
var roomSalt = null;
 
// http://stackoverflow.com/questions/1349404/generate-a-string-of-5-random-characters-in-javascript/1349426#1349426
function randomString(len) {
var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
 
for( var i=0; i < len; i++ ) {
text += possible.charAt(Math.floor(Math.random() * possible.length));
}
 
return text;
}
 
// --------------------------------------------
 
// --- MD5
 
var selftest_md5_finished = false;
function selftest_md5() {
if (selftest_md5_finished) return;
selftest_md5_finished = true;
 
var errors = "";
cmp_a = CryptoJS.enc.Base64.stringify(CryptoJS.MD5("Message"));
cmp_b = "TCqP5+ryRyHMep8BdRFb1A==";
if (cmp_a !== cmp_b) {
errors += "MD5 self test failed!\n";
console.error("MD5 self test failed: '" + cmp_a + "' vs. '" + cmp_b + "'");
}
 
if (errors) {
alert(errors+"\nYour browser seems to be buggy. Decryption of particular messages might fail.");
} else {
console.info("AES self test passed");
}
}
 
function md5(message) {
selftest_md5();
var hash = CryptoJS.MD5(message);
hash = CryptoJS.enc.Base64.stringify(hash);
return hash;
}
 
// --- SHA1
 
var selftest_sha1_finished = false;
function selftest_sha1() {
if (selftest_sha1_finished) return;
selftest_sha1_finished = true;
 
var errors = "";
cmp_a = CryptoJS.enc.Base64.stringify(CryptoJS.SHA1("Message"));
cmp_b = "aPQUX+593navzrkQFlkkrRTPDQA=";
if (cmp_a !== cmp_b) {
errors += "SHA1 self test failed!\n";
console.error("SHA1 self test failed: '" + cmp_a + "' vs. '" + cmp_b + "'");
}
 
if (errors) {
alert(errors+"\nYour browser seems to be buggy. Decryption of particular messages might fail.");
} else {
console.info("SHA1 self test passed");
}
}
 
function sha1(message) {
selftest_sha1();
var hash = CryptoJS.SHA1(message);
hash = CryptoJS.enc.Base64.stringify(hash);
return hash;
}
 
function sha1_base16(message) {
selftest_sha1();
return CryptoJS.SHA1(message).toString();
}
 
// --- SHA256
 
var selftest_sha256_finished = false;
function selftest_sha256() {
if (selftest_sha256_finished) return;
selftest_sha256_finished = true;
 
var errors = "";
cmp_a = CryptoJS.enc.Base64.stringify(CryptoJS.SHA256("Message"));
cmp_b = "L3dmip37+NWEi57rSnFFypTG7ZI25Kdz9tyvpRMrL5E=";
if (cmp_a !== cmp_b) {
errors += "SHA256 self test failed!\n";
console.error("SHA256 self test failed: '" + cmp_a + "' vs. '" + cmp_b + "'");
}
 
if (errors) {
alert(errors+"\nYour browser seems to be buggy. Decryption of particular messages might fail.");
} else {
console.info("AES self test passed");
}
}
 
function sha256(message) {
selftest_sha256();
var hash = CryptoJS.SHA256(message);
hash = CryptoJS.enc.Base64.stringify(hash);
return hash;
}
 
// --- AES
 
var selftest_aes_finished = false;
function selftest_aes() {
if (selftest_aes_finished) return;
selftest_aes_finished = true;
 
var errors = "";
var cmp_a = CryptoJS.AES.decrypt("U2FsdGVkX19kJJkA0NL7WJRdXKrdqDcf6A2yDODaL2g=", "Secret Passphrase").toString(CryptoJS.enc.Utf8);
var cmp_b = "Message";
if ((cmp_a !== cmp_b) || (aes_dec(aes_enc("Message")) !== "Message")) {
errors += "AES self test failed!\n";
console.error("AES self test failed: '" + cmp_a + "' vs. '" + cmp_b + "'");
}
 
if (errors) {
alert(errors+"\nYour browser seems to be buggy. Decryption of particular messages might fail.");
} else {
console.info("AES self test passed");
}
}
 
function aes_enc(msg, ver) {
// ver is currently not used
selftest_aes();
var passwd = getPassword();
return CryptoJS.AES.encrypt(msg, roomSalt+passwd);
}
 
function aes_dec(msg, ver) {
// ver is currently not used
selftest_aes();
var passwd = getPassword();
try {
return CryptoJS.AES.decrypt(msg, roomSalt+passwd).toString(CryptoJS.enc.Utf8);
} catch (e) {
return null;
}
}
 
# ---
 
// Alternative hash digest for compatibility issues
// Some browsers like Jumanji have problems using SHA1 or SHA2, but work with MD5, e.g.
// Jumanji 1.1.2.4 (versionsangabe nicht sicher) ist inkompatibel mit CryptoJS 3.1.2
// UA = "Mozilla/5.0 (X11; Linux armv7l) AppleWebKit/534.26+ (KHTML, like Gecko) Version/5.0 Safari/534.26+ jumanji/0.0"
// CryptoJS.MD5("Message"):
// - Normal: 4c2a8fe7eaf24721cc7a9f0175115bd4
// - Jumanji: 4c2a8fe7eaf24721cc7a9f0175115bd4 (OK)
// CryptoJS.SHA1("Message"):
// - Normal: 68f4145fee7dde76afceb910165924ad14cf0d00
// - Jumanji: 5a5aa74ecae1d696900b034d5f1b71497c170ea0 (Error)
// CryptoJS.SHA256("Message"):
// - Normal: 2f77668a9dfbf8d5848b9eeb4a7145ca94c6ed9236e4a773f6dcafa5132b2f91
// - Jumanji: 5a28f8b8778c15a166f7f17ebb89ce8e8381fbb5e39ddc2511239793119a649e (Error)
// CryptoJS.AES.encrypt("Message", "Secret Passphrase"):
// - Normal: U2FsdGVkX19zlzNcfljComkcU0A7XfZ+gzZbI+GyFm0=
// - Jumanji: U2FsdGVkX19kJJkA0NL7WJRdXKrdqDcf6A2yDODaL2g= (OK)
// This is a fast version (4x MD5) necessary for slow computers with ARM architecture
function specialMD5fast4(message) {
var a = md5("IuErOmVyPeL2ek6e16vkjTWjssgLmd" + message);
var b = md5("8wxdm3mVi8UQXdboJvCctYwm8ZxTyX" + message);
return md5(a+b) + md5(b+a);
}
 
function specialHash(val, entrySalt, version) {
var hash = null;
if (version == 1) {
hash = sha256(roomSalt+entrySalt+val);
} else if (version == 2) {
hash = specialMD5fast4(roomSalt+entrySalt+val);
} else {
console.error("Version " + version + " is unknown at specialHash()");
return null;
}
return entrySalt + "_" + hash + "_ver" + version;
}
 
// --------------------------------------------
 
function getPassword() {
return document.getElementById("key").value;
}
 
function cbLine(str, p1, p2, p3, offset, s) {
var ver = document.getElementById("ver").value;
var passwd = document.getElementById("key").value;
var entrySalt = randomString(20);
var hash = specialHash(passwd, entrySalt, ver);
 
return "(date: "+p1+")(user: "+p2+")(dec_"+hash+": "+aes_enc(p3,ver)+")<br>\n";
}
 
function convert() {
var ses_room = document.getElementById("room").value;
var xsalt = document.getElementById("xsalt").value;
roomSalt = sha1_base16(xsalt + ses_room);
 
var message = document.getElementById("in").value + "\n";
message = message.replace(/(.+?) - \[(.+?)\]: (.+?)\n/g, cbLine);
document.getElementById("out").value = message;
}
 
function initPage() {
document.getElementById("out").value = "";
}
</script>
 
</head>
 
<body onload="initPage();">
 
<h1>Manually encrypt chat lines</h1>
 
<table border="0" cellpadding="5" cellspacing="0">
<tr>
<td>Server's X_SALT: </td>
<td><input style="width:500px" id="xsalt" value="<?php if (!KEEP_X_SALT_SECRET) echo X_SALT; ?>"></td>
</tr><tr>
<td>Algorithm: </td>
<td><select id="ver">
<option value="1"<?php if (CFG_CIPHERSUITE == 1) echo ' selected'; ?>>[1] SHA256</option>
<option value="2"<?php if (CFG_CIPHERSUITE == 2) echo ' selected'; ?>>[2] specialMD5fast4</option>
</select></td>
</tr><tr>
<td>Key: </td>
<td><input style="width:500px" id="key"></td>
</tr><tr>
<td>Chatroom name: </td>
<td><input style="width:500px" id="room"></td>
</tr><tr>
<td colspan="2">Input:<br>
<textarea id="in" cols="100" rows="6">2014-12-31 14:21:20 - [Daniel]: Hello world!
2014-12-31 14:21:22 - [Daniel]: Example!</textarea><br></td>
</tr><tr>
<td colspan="2"><input type="button" onclick="convert();" value="Convert"><br></td>
</tr><tr>
<td colspan="2">Output:<br>
<textarea id="out" cols="100" rows="6"></textarea></td>
</tr>
</table><br>
</body>
 
</html>